var xN=Object.defineProperty;var Bb=e=>{throw TypeError(e)};var pN=(e,s,a)=>s in e?xN(e,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[s]=a;var $e=(e,s,a)=>pN(e,typeof s!="symbol"?s+"":s,a),wf=(e,s,a)=>s.has(e)||Bb("Cannot "+a);var le=(e,s,a)=>(wf(e,s,"read from private field"),a?a.call(e):s.get(e)),We=(e,s,a)=>s.has(e)?Bb("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(e):s.set(e,a),Oe=(e,s,a,r)=>(wf(e,s,"write to private field"),r?r.call(e,a):s.set(e,a),a),xn=(e,s,a)=>(wf(e,s,"access private method"),a);var ou=(e,s,a,r)=>({set _(o){Oe(e,s,o,a)},get _(){return le(e,s,r)}});(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(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"&&r(d)}).observe(document,{childList:!0,subtree:!0});function a(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 r(o){if(o.ep)return;o.ep=!0;const c=a(o);fetch(o.href,c)}})();function qu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zf={exports:{}},co={};/**
 * @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 Ib;function gN(){if(Ib)return co;Ib=1;var e=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function a(r,o,c){var d=null;if(c!==void 0&&(d=""+c),o.key!==void 0&&(d=""+o.key),"key"in o){c={};for(var h in o)h!=="key"&&(c[h]=o[h])}else c=o;return o=c.ref,{$$typeof:e,type:r,key:d,ref:o!==void 0?o:null,props:c}}return co.Fragment=s,co.jsx=a,co.jsxs=a,co}var Hb;function bN(){return Hb||(Hb=1,zf.exports=gN()),zf.exports}var n=bN(),Nf={exports:{}},Re={};/**
 * @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 Pb;function yN(){if(Pb)return Re;Pb=1;var e=Symbol.for("react.transitional.element"),s=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),v=Symbol.iterator;function y(P){return P===null||typeof P!="object"?null:(P=v&&P[v]||P["@@iterator"],typeof P=="function"?P:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,w={};function j(P,Y,O){this.props=P,this.context=Y,this.refs=w,this.updater=O||N}j.prototype.isReactComponent={},j.prototype.setState=function(P,Y){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,Y,"setState")},j.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function C(){}C.prototype=j.prototype;function T(P,Y,O){this.props=P,this.context=Y,this.refs=w,this.updater=O||N}var D=T.prototype=new C;D.constructor=T,S(D,j.prototype),D.isPureReactComponent=!0;var E=Array.isArray;function A(){}var B={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function ee(P,Y,O){var de=O.ref;return{$$typeof:e,type:P,key:Y,ref:de!==void 0?de:null,props:O}}function R(P,Y){return ee(P.type,Y,P.props)}function F(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function _(P){var Y={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(O){return Y[O]})}var se=/\/+/g;function U(P,Y){return typeof P=="object"&&P!==null&&P.key!=null?_(""+P.key):Y.toString(36)}function H(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(A,A):(P.status="pending",P.then(function(Y){P.status==="pending"&&(P.status="fulfilled",P.value=Y)},function(Y){P.status==="pending"&&(P.status="rejected",P.reason=Y)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function I(P,Y,O,de,ve){var ae=typeof P;(ae==="undefined"||ae==="boolean")&&(P=null);var je=!1;if(P===null)je=!0;else switch(ae){case"bigint":case"string":case"number":je=!0;break;case"object":switch(P.$$typeof){case e:case s:je=!0;break;case p:return je=P._init,I(je(P._payload),Y,O,de,ve)}}if(je)return ve=ve(P),je=de===""?"."+U(P,0):de,E(ve)?(O="",je!=null&&(O=je.replace(se,"$&/")+"/"),I(ve,Y,O,"",function(zt){return zt})):ve!=null&&(F(ve)&&(ve=R(ve,O+(ve.key==null||P&&P.key===ve.key?"":(""+ve.key).replace(se,"$&/")+"/")+je)),Y.push(ve)),1;je=0;var Xe=de===""?".":de+":";if(E(P))for(var Fe=0;Fe<P.length;Fe++)de=P[Fe],ae=Xe+U(de,Fe),je+=I(de,Y,O,ae,ve);else if(Fe=y(P),typeof Fe=="function")for(P=Fe.call(P),Fe=0;!(de=P.next()).done;)de=de.value,ae=Xe+U(de,Fe++),je+=I(de,Y,O,ae,ve);else if(ae==="object"){if(typeof P.then=="function")return I(H(P),Y,O,de,ve);throw Y=String(P),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return je}function W(P,Y,O){if(P==null)return P;var de=[],ve=0;return I(P,de,"","",function(ae){return Y.call(O,ae,ve++)}),de}function re(P){if(P._status===-1){var Y=P._result;Y=Y(),Y.then(function(O){(P._status===0||P._status===-1)&&(P._status=1,P._result=O)},function(O){(P._status===0||P._status===-1)&&(P._status=2,P._result=O)}),P._status===-1&&(P._status=0,P._result=Y)}if(P._status===1)return P._result.default;throw P._result}var he=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},L={map:W,forEach:function(P,Y,O){W(P,function(){Y.apply(this,arguments)},O)},count:function(P){var Y=0;return W(P,function(){Y++}),Y},toArray:function(P){return W(P,function(Y){return Y})||[]},only:function(P){if(!F(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return Re.Activity=b,Re.Children=L,Re.Component=j,Re.Fragment=a,Re.Profiler=o,Re.PureComponent=T,Re.StrictMode=r,Re.Suspense=m,Re.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,Re.__COMPILER_RUNTIME={__proto__:null,c:function(P){return B.H.useMemoCache(P)}},Re.cache=function(P){return function(){return P.apply(null,arguments)}},Re.cacheSignal=function(){return null},Re.cloneElement=function(P,Y,O){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var de=S({},P.props),ve=P.key;if(Y!=null)for(ae in Y.key!==void 0&&(ve=""+Y.key),Y)!V.call(Y,ae)||ae==="key"||ae==="__self"||ae==="__source"||ae==="ref"&&Y.ref===void 0||(de[ae]=Y[ae]);var ae=arguments.length-2;if(ae===1)de.children=O;else if(1<ae){for(var je=Array(ae),Xe=0;Xe<ae;Xe++)je[Xe]=arguments[Xe+2];de.children=je}return ee(P.type,ve,de)},Re.createContext=function(P){return P={$$typeof:d,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:c,_context:P},P},Re.createElement=function(P,Y,O){var de,ve={},ae=null;if(Y!=null)for(de in Y.key!==void 0&&(ae=""+Y.key),Y)V.call(Y,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(ve[de]=Y[de]);var je=arguments.length-2;if(je===1)ve.children=O;else if(1<je){for(var Xe=Array(je),Fe=0;Fe<je;Fe++)Xe[Fe]=arguments[Fe+2];ve.children=Xe}if(P&&P.defaultProps)for(de in je=P.defaultProps,je)ve[de]===void 0&&(ve[de]=je[de]);return ee(P,ae,ve)},Re.createRef=function(){return{current:null}},Re.forwardRef=function(P){return{$$typeof:h,render:P}},Re.isValidElement=F,Re.lazy=function(P){return{$$typeof:p,_payload:{_status:-1,_result:P},_init:re}},Re.memo=function(P,Y){return{$$typeof:f,type:P,compare:Y===void 0?null:Y}},Re.startTransition=function(P){var Y=B.T,O={};B.T=O;try{var de=P(),ve=B.S;ve!==null&&ve(O,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(A,he)}catch(ae){he(ae)}finally{Y!==null&&O.types!==null&&(Y.types=O.types),B.T=Y}},Re.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},Re.use=function(P){return B.H.use(P)},Re.useActionState=function(P,Y,O){return B.H.useActionState(P,Y,O)},Re.useCallback=function(P,Y){return B.H.useCallback(P,Y)},Re.useContext=function(P){return B.H.useContext(P)},Re.useDebugValue=function(){},Re.useDeferredValue=function(P,Y){return B.H.useDeferredValue(P,Y)},Re.useEffect=function(P,Y){return B.H.useEffect(P,Y)},Re.useEffectEvent=function(P){return B.H.useEffectEvent(P)},Re.useId=function(){return B.H.useId()},Re.useImperativeHandle=function(P,Y,O){return B.H.useImperativeHandle(P,Y,O)},Re.useInsertionEffect=function(P,Y){return B.H.useInsertionEffect(P,Y)},Re.useLayoutEffect=function(P,Y){return B.H.useLayoutEffect(P,Y)},Re.useMemo=function(P,Y){return B.H.useMemo(P,Y)},Re.useOptimistic=function(P,Y){return B.H.useOptimistic(P,Y)},Re.useReducer=function(P,Y,O){return B.H.useReducer(P,Y,O)},Re.useRef=function(P){return B.H.useRef(P)},Re.useState=function(P){return B.H.useState(P)},Re.useSyncExternalStore=function(P,Y,O){return B.H.useSyncExternalStore(P,Y,O)},Re.useTransition=function(){return B.H.useTransition()},Re.version="19.2.4",Re}var qb;function Pm(){return qb||(qb=1,Nf.exports=yN()),Nf.exports}var k=Pm();const be=qu(k);var kf={exports:{}},uo={},Sf={exports:{}},Cf={};/**
 * @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 Fb;function vN(){return Fb||(Fb=1,(function(e){function s(I,W){var re=I.length;I.push(W);e:for(;0<re;){var he=re-1>>>1,L=I[he];if(0<o(L,W))I[he]=W,I[re]=L,re=he;else break e}}function a(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var W=I[0],re=I.pop();if(re!==W){I[0]=re;e:for(var he=0,L=I.length,P=L>>>1;he<P;){var Y=2*(he+1)-1,O=I[Y],de=Y+1,ve=I[de];if(0>o(O,re))de<L&&0>o(ve,O)?(I[he]=ve,I[de]=re,he=de):(I[he]=O,I[Y]=re,he=Y);else if(de<L&&0>o(ve,re))I[he]=ve,I[de]=re,he=de;else break e}}return W}function o(I,W){var re=I.sortIndex-W.sortIndex;return re!==0?re:I.id-W.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,h=d.now();e.unstable_now=function(){return d.now()-h}}var m=[],f=[],p=1,b=null,v=3,y=!1,N=!1,S=!1,w=!1,j=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function D(I){for(var W=a(f);W!==null;){if(W.callback===null)r(f);else if(W.startTime<=I)r(f),W.sortIndex=W.expirationTime,s(m,W);else break;W=a(f)}}function E(I){if(S=!1,D(I),!N)if(a(m)!==null)N=!0,A||(A=!0,_());else{var W=a(f);W!==null&&H(E,W.startTime-I)}}var A=!1,B=-1,V=5,ee=-1;function R(){return w?!0:!(e.unstable_now()-ee<V)}function F(){if(w=!1,A){var I=e.unstable_now();ee=I;var W=!0;try{e:{N=!1,S&&(S=!1,C(B),B=-1),y=!0;var re=v;try{t:{for(D(I),b=a(m);b!==null&&!(b.expirationTime>I&&R());){var he=b.callback;if(typeof he=="function"){b.callback=null,v=b.priorityLevel;var L=he(b.expirationTime<=I);if(I=e.unstable_now(),typeof L=="function"){b.callback=L,D(I),W=!0;break t}b===a(m)&&r(m),D(I)}else r(m);b=a(m)}if(b!==null)W=!0;else{var P=a(f);P!==null&&H(E,P.startTime-I),W=!1}}break e}finally{b=null,v=re,y=!1}W=void 0}}finally{W?_():A=!1}}}var _;if(typeof T=="function")_=function(){T(F)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,U=se.port2;se.port1.onmessage=F,_=function(){U.postMessage(null)}}else _=function(){j(F,0)};function H(I,W){B=j(function(){I(e.unstable_now())},W)}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(I){I.callback=null},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(I){switch(v){case 1:case 2:case 3:var W=3;break;default:W=v}var re=v;v=W;try{return I()}finally{v=re}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(I,W){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var re=v;v=I;try{return W()}finally{v=re}},e.unstable_scheduleCallback=function(I,W,re){var he=e.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?he+re:he):re=he,I){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=re+L,I={id:p++,callback:W,priorityLevel:I,startTime:re,expirationTime:L,sortIndex:-1},re>he?(I.sortIndex=re,s(f,I),a(m)===null&&I===a(f)&&(S?(C(B),B=-1):S=!0,H(E,re-he))):(I.sortIndex=L,s(m,I),N||y||(N=!0,A||(A=!0,_()))),I},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(I){var W=v;return function(){var re=v;v=W;try{return I.apply(this,arguments)}finally{v=re}}}})(Cf)),Cf}var $b;function jN(){return $b||($b=1,Sf.exports=vN()),Sf.exports}var Tf={exports:{}},pn={};/**
 * @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 Vb;function wN(){if(Vb)return pn;Vb=1;var e=Pm();function s(m){var f="https://react.dev/errors/"+m;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)f+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+m+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var r={d:{f:a,r:function(){throw Error(s(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(m,f,p){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:b==null?null:""+b,children:m,containerInfo:f,implementation:p}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(m,f){if(m==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return pn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,pn.createPortal=function(m,f){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(s(299));return c(m,f,null,p)},pn.flushSync=function(m){var f=d.T,p=r.p;try{if(d.T=null,r.p=2,m)return m()}finally{d.T=f,r.p=p,r.d.f()}},pn.preconnect=function(m,f){typeof m=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(m,f))},pn.prefetchDNS=function(m){typeof m=="string"&&r.d.D(m)},pn.preinit=function(m,f){if(typeof m=="string"&&f&&typeof f.as=="string"){var p=f.as,b=h(p,f.crossOrigin),v=typeof f.integrity=="string"?f.integrity:void 0,y=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;p==="style"?r.d.S(m,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:b,integrity:v,fetchPriority:y}):p==="script"&&r.d.X(m,{crossOrigin:b,integrity:v,fetchPriority:y,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},pn.preinitModule=function(m,f){if(typeof m=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var p=h(f.as,f.crossOrigin);r.d.M(m,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(m)},pn.preload=function(m,f){if(typeof m=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var p=f.as,b=h(p,f.crossOrigin);r.d.L(m,p,{crossOrigin:b,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},pn.preloadModule=function(m,f){if(typeof m=="string")if(f){var p=h(f.as,f.crossOrigin);r.d.m(m,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(m)},pn.requestFormReset=function(m){r.d.r(m)},pn.unstable_batchedUpdates=function(m,f){return m(f)},pn.useFormState=function(m,f,p){return d.H.useFormState(m,f,p)},pn.useFormStatus=function(){return d.H.useHostTransitionStatus()},pn.version="19.2.4",pn}var Gb;function H1(){if(Gb)return Tf.exports;Gb=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(s){console.error(s)}}return e(),Tf.exports=wN(),Tf.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 Yb;function zN(){if(Yb)return uo;Yb=1;var e=jN(),s=Pm(),a=H1();function r(t){var i="https://react.dev/errors/"+t;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)i+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+t+"; visit "+i+" 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 i=t,l=t;if(t.alternate)for(;i.return;)i=i.return;else{t=i;do i=t,(i.flags&4098)!==0&&(l=i.return),t=i.return;while(t)}return i.tag===3?l:null}function d(t){if(t.tag===13){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function h(t){if(t.tag===31){var i=t.memoizedState;if(i===null&&(t=t.alternate,t!==null&&(i=t.memoizedState)),i!==null)return i.dehydrated}return null}function m(t){if(c(t)!==t)throw Error(r(188))}function f(t){var i=t.alternate;if(!i){if(i=c(t),i===null)throw Error(r(188));return i!==t?null:t}for(var l=t,u=i;;){var x=l.return;if(x===null)break;var g=x.alternate;if(g===null){if(u=x.return,u!==null){l=u;continue}break}if(x.child===g.child){for(g=x.child;g;){if(g===l)return m(x),t;if(g===u)return m(x),i;g=g.sibling}throw Error(r(188))}if(l.return!==u.return)l=x,u=g;else{for(var z=!1,M=x.child;M;){if(M===l){z=!0,l=x,u=g;break}if(M===u){z=!0,u=x,l=g;break}M=M.sibling}if(!z){for(M=g.child;M;){if(M===l){z=!0,l=g,u=x;break}if(M===u){z=!0,u=g,l=x;break}M=M.sibling}if(!z)throw Error(r(189))}}if(l.alternate!==u)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?t:i}function p(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t;for(t=t.child;t!==null;){if(i=p(t),i!==null)return i;t=t.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),T=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),R=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function _(t){return t===null||typeof t!="object"?null:(t=F&&t[F]||t["@@iterator"],typeof t=="function"?t:null)}var se=Symbol.for("react.client.reference");function U(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===se?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case S:return"Fragment";case j:return"Profiler";case w:return"StrictMode";case E:return"Suspense";case A:return"SuspenseList";case ee:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case N:return"Portal";case T:return t.displayName||"Context";case C:return(t._context.displayName||"Context")+".Consumer";case D:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case B:return i=t.displayName||null,i!==null?i:U(t.type)||"Memo";case V:i=t._payload,t=t._init;try{return U(t(i))}catch{}}return null}var H=Array.isArray,I=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},he=[],L=-1;function P(t){return{current:t}}function Y(t){0>L||(t.current=he[L],he[L]=null,L--)}function O(t,i){L++,he[L]=t.current,t.current=i}var de=P(null),ve=P(null),ae=P(null),je=P(null);function Xe(t,i){switch(O(ae,i),O(ve,t),O(de,null),i.nodeType){case 9:case 11:t=(t=i.documentElement)&&(t=t.namespaceURI)?lb(t):0;break;default:if(t=i.tagName,i=i.namespaceURI)i=lb(i),t=ob(i,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Y(de),O(de,t)}function Fe(){Y(de),Y(ve),Y(ae)}function zt(t){t.memoizedState!==null&&O(je,t);var i=de.current,l=ob(i,t.type);i!==l&&(O(ve,t),O(de,l))}function It(t){ve.current===t&&(Y(de),Y(ve)),je.current===t&&(Y(je),io._currentValue=re)}var qn,bs;function fn(t){if(qn===void 0)try{throw Error()}catch(l){var i=l.stack.trim().match(/\n( *(at )?)/);qn=i&&i[1]||"",bs=-1<l.stack.indexOf(`
    at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
`+qn+t+bs}var ts=!1;function ce(t,i){if(!t||ts)return"";ts=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(i){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(ne){var K=ne}Reflect.construct(t,[],ue)}else{try{ue.call()}catch(ne){K=ne}t.call(ue.prototype)}}else{try{throw Error()}catch(ne){K=ne}(ue=t())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(ne){if(ne&&K&&typeof ne.stack=="string")return[ne.stack,K.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=u.DetermineComponentFrameRoot(),z=g[0],M=g[1];if(z&&M){var q=z.split(`
`),J=M.split(`
`);for(x=u=0;u<q.length&&!q[u].includes("DetermineComponentFrameRoot");)u++;for(;x<J.length&&!J[x].includes("DetermineComponentFrameRoot");)x++;if(u===q.length||x===J.length)for(u=q.length-1,x=J.length-1;1<=u&&0<=x&&q[u]!==J[x];)x--;for(;1<=u&&0<=x;u--,x--)if(q[u]!==J[x]){if(u!==1||x!==1)do if(u--,x--,0>x||q[u]!==J[x]){var ie=`
`+q[u].replace(" at new "," at ");return t.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",t.displayName)),ie}while(1<=u&&0<=x);break}}}finally{ts=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?fn(l):""}function pe(t,i){switch(t.tag){case 26:case 27:case 5:return fn(t.type);case 16:return fn("Lazy");case 13:return t.child!==i&&i!==null?fn("Suspense Fallback"):fn("Suspense");case 19:return fn("SuspenseList");case 0:case 15:return ce(t.type,!1);case 11:return ce(t.type.render,!1);case 1:return ce(t.type,!0);case 31:return fn("Activity");default:return""}}function Ce(t){try{var i="",l=null;do i+=pe(t,l),l=t,t=t.return;while(t);return i}catch(u){return`
Error generating stack: `+u.message+`
`+u.stack}}var _e=Object.prototype.hasOwnProperty,me=e.unstable_scheduleCallback,ge=e.unstable_cancelCallback,Be=e.unstable_shouldYield,Se=e.unstable_requestPaint,Me=e.unstable_now,nt=e.unstable_getCurrentPriorityLevel,te=e.unstable_ImmediatePriority,fe=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,Ie=e.unstable_LowPriority,Ke=e.unstable_IdlePriority,jn=e.log,ns=e.unstable_setDisableYieldValue,Ht=null,pt=null;function en(t){if(typeof jn=="function"&&ns(t),pt&&typeof pt.setStrictMode=="function")try{pt.setStrictMode(Ht,t)}catch{}}var et=Math.clz32?Math.clz32:Jo,Ds=Math.log,Fn=Math.LN2;function Jo(t){return t>>>=0,t===0?32:31-(Ds(t)/Fn|0)|0}var bi=256,Zi=262144,Sa=4194304;function mn(t){var i=t&42;if(i!==0)return i;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 Wi(t,i,l){var u=t.pendingLanes;if(u===0)return 0;var x=0,g=t.suspendedLanes,z=t.pingedLanes;t=t.warmLanes;var M=u&134217727;return M!==0?(u=M&~g,u!==0?x=mn(u):(z&=M,z!==0?x=mn(z):l||(l=M&~t,l!==0&&(x=mn(l))))):(M=u&~g,M!==0?x=mn(M):z!==0?x=mn(z):l||(l=u&~t,l!==0&&(x=mn(l)))),x===0?0:i!==0&&i!==x&&(i&g)===0&&(g=x&-x,l=i&-i,g>=l||g===32&&(l&4194048)!==0)?i:x}function De(t,i){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&i)===0}function rt(t,i){switch(t){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ht(){var t=Sa;return Sa<<=1,(Sa&62914560)===0&&(Sa=4194304),t}function wn(t){for(var i=[],l=0;31>l;l++)i.push(t);return i}function tn(t,i){t.pendingLanes|=i,i!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Os(t,i,l,u,x,g){var z=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 M=t.entanglements,q=t.expirationTimes,J=t.hiddenUpdates;for(l=z&~l;0<l;){var ie=31-et(l),ue=1<<ie;M[ie]=0,q[ie]=-1;var K=J[ie];if(K!==null)for(J[ie]=null,ie=0;ie<K.length;ie++){var ne=K[ie];ne!==null&&(ne.lane&=-536870913)}l&=~ue}u!==0&&Rs(t,u,0),g!==0&&x===0&&t.tag!==0&&(t.suspendedLanes|=g&~(z&~i))}function Rs(t,i,l){t.pendingLanes|=i,t.suspendedLanes&=~i;var u=31-et(i);t.entangledLanes|=i,t.entanglements[u]=t.entanglements[u]|1073741824|l&261930}function An(t,i){var l=t.entangledLanes|=i;for(t=t.entanglements;l;){var u=31-et(l),x=1<<u;x&i|t[u]&i&&(t[u]|=i),l&=~x}}function ys(t,i){var l=i&-i;return l=(l&42)!==0?1:ud(l),(l&(t.suspendedLanes|i))!==0?0:l}function ud(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 dd(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function G0(){var t=W.p;return t!==0?t:(t=window.event,t===void 0?32:Mb(t.type))}function Y0(t,i){var l=W.p;try{return W.p=t,i()}finally{W.p=l}}var Ca=Math.random().toString(36).slice(2),nn="__reactFiber$"+Ca,Mn="__reactProps$"+Ca,er="__reactContainer$"+Ca,hd="__reactEvents$"+Ca,aw="__reactListeners$"+Ca,iw="__reactHandles$"+Ca,Q0="__reactResources$"+Ca,vl="__reactMarker$"+Ca;function fd(t){delete t[nn],delete t[Mn],delete t[hd],delete t[aw],delete t[iw]}function tr(t){var i=t[nn];if(i)return i;for(var l=t.parentNode;l;){if(i=l[er]||l[nn]){if(l=i.alternate,i.child!==null||l!==null&&l.child!==null)for(t=xb(t);t!==null;){if(l=t[nn])return l;t=xb(t)}return i}t=l,l=t.parentNode}return null}function nr(t){if(t=t[nn]||t[er]){var i=t.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return t}return null}function jl(t){var i=t.tag;if(i===5||i===26||i===27||i===6)return t.stateNode;throw Error(r(33))}function sr(t){var i=t[Q0];return i||(i=t[Q0]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Qt(t){t[vl]=!0}var J0=new Set,X0={};function yi(t,i){ar(t,i),ar(t+"Capture",i)}function ar(t,i){for(X0[t]=i,t=0;t<i.length;t++)J0.add(i[t])}var rw=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]*$"),K0={},Z0={};function lw(t){return _e.call(Z0,t)?!0:_e.call(K0,t)?!1:rw.test(t)?Z0[t]=!0:(K0[t]=!0,!1)}function Xo(t,i,l){if(lw(i))if(l===null)t.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":t.removeAttribute(i);return;case"boolean":var u=i.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(i);return}}t.setAttribute(i,""+l)}}function Ko(t,i,l){if(l===null)t.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttribute(i,""+l)}}function Ks(t,i,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(i,l,""+u)}}function ss(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function W0(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function ow(t,i,l){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,i);if(!t.hasOwnProperty(i)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var x=u.get,g=u.set;return Object.defineProperty(t,i,{configurable:!0,get:function(){return x.call(this)},set:function(z){l=""+z,g.call(this,z)}}),Object.defineProperty(t,i,{enumerable:u.enumerable}),{getValue:function(){return l},setValue:function(z){l=""+z},stopTracking:function(){t._valueTracker=null,delete t[i]}}}}function md(t){if(!t._valueTracker){var i=W0(t)?"checked":"value";t._valueTracker=ow(t,i,""+t[i])}}function ex(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var l=i.getValue(),u="";return t&&(u=W0(t)?t.checked?"true":"false":t.value),t=u,t!==l?(i.setValue(t),!0):!1}function Zo(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 cw=/[\n"\\]/g;function as(t){return t.replace(cw,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function xd(t,i,l,u,x,g,z,M){t.name="",z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?t.type=z:t.removeAttribute("type"),i!=null?z==="number"?(i===0&&t.value===""||t.value!=i)&&(t.value=""+ss(i)):t.value!==""+ss(i)&&(t.value=""+ss(i)):z!=="submit"&&z!=="reset"||t.removeAttribute("value"),i!=null?pd(t,z,ss(i)):l!=null?pd(t,z,ss(l)):u!=null&&t.removeAttribute("value"),x==null&&g!=null&&(t.defaultChecked=!!g),x!=null&&(t.checked=x&&typeof x!="function"&&typeof x!="symbol"),M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?t.name=""+ss(M):t.removeAttribute("name")}function tx(t,i,l,u,x,g,z,M){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(t.type=g),i!=null||l!=null){if(!(g!=="submit"&&g!=="reset"||i!=null)){md(t);return}l=l!=null?""+ss(l):"",i=i!=null?""+ss(i):l,M||i===t.value||(t.value=i),t.defaultValue=i}u=u??x,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=M?t.checked:!!u,t.defaultChecked=!!u,z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"&&(t.name=z),md(t)}function pd(t,i,l){i==="number"&&Zo(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function ir(t,i,l,u){if(t=t.options,i){i={};for(var x=0;x<l.length;x++)i["$"+l[x]]=!0;for(l=0;l<t.length;l++)x=i.hasOwnProperty("$"+t[l].value),t[l].selected!==x&&(t[l].selected=x),x&&u&&(t[l].defaultSelected=!0)}else{for(l=""+ss(l),i=null,x=0;x<t.length;x++){if(t[x].value===l){t[x].selected=!0,u&&(t[x].defaultSelected=!0);return}i!==null||t[x].disabled||(i=t[x])}i!==null&&(i.selected=!0)}}function nx(t,i,l){if(i!=null&&(i=""+ss(i),i!==t.value&&(t.value=i),l==null)){t.defaultValue!==i&&(t.defaultValue=i);return}t.defaultValue=l!=null?""+ss(l):""}function sx(t,i,l,u){if(i==null){if(u!=null){if(l!=null)throw Error(r(92));if(H(u)){if(1<u.length)throw Error(r(93));u=u[0]}l=u}l==null&&(l=""),i=l}l=ss(i),t.defaultValue=l,u=t.textContent,u===l&&u!==""&&u!==null&&(t.value=u),md(t)}function rr(t,i){if(i){var l=t.firstChild;if(l&&l===t.lastChild&&l.nodeType===3){l.nodeValue=i;return}}t.textContent=i}var uw=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 ax(t,i,l){var u=i.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?u?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="":u?t.setProperty(i,l):typeof l!="number"||l===0||uw.has(i)?i==="float"?t.cssFloat=l:t[i]=(""+l).trim():t[i]=l+"px"}function ix(t,i,l){if(i!=null&&typeof i!="object")throw Error(r(62));if(t=t.style,l!=null){for(var u in l)!l.hasOwnProperty(u)||i!=null&&i.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var x in i)u=i[x],i.hasOwnProperty(x)&&l[x]!==u&&ax(t,x,u)}else for(var g in i)i.hasOwnProperty(g)&&ax(t,g,i[g])}function gd(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 dw=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"]]),hw=/^[\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 Wo(t){return hw.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Zs(){}var bd=null;function yd(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var lr=null,or=null;function rx(t){var i=nr(t);if(i&&(t=i.stateNode)){var l=t[Mn]||null;e:switch(t=i.stateNode,i.type){case"input":if(xd(t,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),i=l.name,l.type==="radio"&&i!=null){for(l=t;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+as(""+i)+'"][type="radio"]'),i=0;i<l.length;i++){var u=l[i];if(u!==t&&u.form===t.form){var x=u[Mn]||null;if(!x)throw Error(r(90));xd(u,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(i=0;i<l.length;i++)u=l[i],u.form===t.form&&ex(u)}break e;case"textarea":nx(t,l.value,l.defaultValue);break e;case"select":i=l.value,i!=null&&ir(t,!!l.multiple,i,!1)}}}var vd=!1;function lx(t,i,l){if(vd)return t(i,l);vd=!0;try{var u=t(i);return u}finally{if(vd=!1,(lr!==null||or!==null)&&(Hc(),lr&&(i=lr,t=or,or=lr=null,rx(i),t)))for(i=0;i<t.length;i++)rx(t[i])}}function wl(t,i){var l=t.stateNode;if(l===null)return null;var u=l[Mn]||null;if(u===null)return null;l=u[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(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(r(231,i,typeof l));return l}var Ws=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jd=!1;if(Ws)try{var zl={};Object.defineProperty(zl,"passive",{get:function(){jd=!0}}),window.addEventListener("test",zl,zl),window.removeEventListener("test",zl,zl)}catch{jd=!1}var Ta=null,wd=null,ec=null;function ox(){if(ec)return ec;var t,i=wd,l=i.length,u,x="value"in Ta?Ta.value:Ta.textContent,g=x.length;for(t=0;t<l&&i[t]===x[t];t++);var z=l-t;for(u=1;u<=z&&i[l-u]===x[g-u];u++);return ec=x.slice(t,1<u?1-u:void 0)}function tc(t){var i=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&i===13&&(t=13)):t=i,t===10&&(t=13),32<=t||t===13?t:0}function nc(){return!0}function cx(){return!1}function Dn(t){function i(l,u,x,g,z){this._reactName=l,this._targetInst=x,this.type=u,this.nativeEvent=g,this.target=z,this.currentTarget=null;for(var M in t)t.hasOwnProperty(M)&&(l=t[M],this[M]=l?l(g):g[M]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?nc:cx,this.isPropagationStopped=cx,this}return b(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=nc)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=nc)},persist:function(){},isPersistent:nc}),i}var vi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sc=Dn(vi),Nl=b({},vi,{view:0,detail:0}),fw=Dn(Nl),zd,Nd,kl,ac=b({},Nl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Sd,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!==kl&&(kl&&t.type==="mousemove"?(zd=t.screenX-kl.screenX,Nd=t.screenY-kl.screenY):Nd=zd=0,kl=t),zd)},movementY:function(t){return"movementY"in t?t.movementY:Nd}}),ux=Dn(ac),mw=b({},ac,{dataTransfer:0}),xw=Dn(mw),pw=b({},Nl,{relatedTarget:0}),kd=Dn(pw),gw=b({},vi,{animationName:0,elapsedTime:0,pseudoElement:0}),bw=Dn(gw),yw=b({},vi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),vw=Dn(yw),jw=b({},vi,{data:0}),dx=Dn(jw),ww={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zw={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"},Nw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function kw(t){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(t):(t=Nw[t])?!!i[t]:!1}function Sd(){return kw}var Sw=b({},Nl,{key:function(t){if(t.key){var i=ww[t.key]||t.key;if(i!=="Unidentified")return i}return t.type==="keypress"?(t=tc(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?zw[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Sd,charCode:function(t){return t.type==="keypress"?tc(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?tc(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Cw=Dn(Sw),Tw=b({},ac,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hx=Dn(Tw),Ew=b({},Nl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Sd}),Aw=Dn(Ew),Mw=b({},vi,{propertyName:0,elapsedTime:0,pseudoElement:0}),Dw=Dn(Mw),Ow=b({},ac,{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}),Rw=Dn(Ow),_w=b({},vi,{newState:0,oldState:0}),Lw=Dn(_w),Uw=[9,13,27,32],Cd=Ws&&"CompositionEvent"in window,Sl=null;Ws&&"documentMode"in document&&(Sl=document.documentMode);var Bw=Ws&&"TextEvent"in window&&!Sl,fx=Ws&&(!Cd||Sl&&8<Sl&&11>=Sl),mx=" ",xx=!1;function px(t,i){switch(t){case"keyup":return Uw.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gx(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var cr=!1;function Iw(t,i){switch(t){case"compositionend":return gx(i);case"keypress":return i.which!==32?null:(xx=!0,mx);case"textInput":return t=i.data,t===mx&&xx?null:t;default:return null}}function Hw(t,i){if(cr)return t==="compositionend"||!Cd&&px(t,i)?(t=ox(),ec=wd=Ta=null,cr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return fx&&i.locale!=="ko"?null:i.data;default:return null}}var Pw={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 bx(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i==="input"?!!Pw[t.type]:i==="textarea"}function yx(t,i,l,u){lr?or?or.push(u):or=[u]:lr=u,i=Yc(i,"onChange"),0<i.length&&(l=new sc("onChange","change",null,l,u),t.push({event:l,listeners:i}))}var Cl=null,Tl=null;function qw(t){tb(t,0)}function ic(t){var i=jl(t);if(ex(i))return t}function vx(t,i){if(t==="change")return i}var jx=!1;if(Ws){var Td;if(Ws){var Ed="oninput"in document;if(!Ed){var wx=document.createElement("div");wx.setAttribute("oninput","return;"),Ed=typeof wx.oninput=="function"}Td=Ed}else Td=!1;jx=Td&&(!document.documentMode||9<document.documentMode)}function zx(){Cl&&(Cl.detachEvent("onpropertychange",Nx),Tl=Cl=null)}function Nx(t){if(t.propertyName==="value"&&ic(Tl)){var i=[];yx(i,Tl,t,yd(t)),lx(qw,i)}}function Fw(t,i,l){t==="focusin"?(zx(),Cl=i,Tl=l,Cl.attachEvent("onpropertychange",Nx)):t==="focusout"&&zx()}function $w(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ic(Tl)}function Vw(t,i){if(t==="click")return ic(i)}function Gw(t,i){if(t==="input"||t==="change")return ic(i)}function Yw(t,i){return t===i&&(t!==0||1/t===1/i)||t!==t&&i!==i}var $n=typeof Object.is=="function"?Object.is:Yw;function El(t,i){if($n(t,i))return!0;if(typeof t!="object"||t===null||typeof i!="object"||i===null)return!1;var l=Object.keys(t),u=Object.keys(i);if(l.length!==u.length)return!1;for(u=0;u<l.length;u++){var x=l[u];if(!_e.call(i,x)||!$n(t[x],i[x]))return!1}return!0}function kx(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Sx(t,i){var l=kx(t);t=0;for(var u;l;){if(l.nodeType===3){if(u=t+l.textContent.length,t<=i&&u>=i)return{node:l,offset:i-t};t=u}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=kx(l)}}function Cx(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Cx(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Tx(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var i=Zo(t.document);i instanceof t.HTMLIFrameElement;){try{var l=typeof i.contentWindow.location.href=="string"}catch{l=!1}if(l)t=i.contentWindow;else break;i=Zo(t.document)}return i}function Ad(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}var Qw=Ws&&"documentMode"in document&&11>=document.documentMode,ur=null,Md=null,Al=null,Dd=!1;function Ex(t,i,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Dd||ur==null||ur!==Zo(u)||(u=ur,"selectionStart"in u&&Ad(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}),Al&&El(Al,u)||(Al=u,u=Yc(Md,"onSelect"),0<u.length&&(i=new sc("onSelect","select",null,i,l),t.push({event:i,listeners:u}),i.target=ur)))}function ji(t,i){var l={};return l[t.toLowerCase()]=i.toLowerCase(),l["Webkit"+t]="webkit"+i,l["Moz"+t]="moz"+i,l}var dr={animationend:ji("Animation","AnimationEnd"),animationiteration:ji("Animation","AnimationIteration"),animationstart:ji("Animation","AnimationStart"),transitionrun:ji("Transition","TransitionRun"),transitionstart:ji("Transition","TransitionStart"),transitioncancel:ji("Transition","TransitionCancel"),transitionend:ji("Transition","TransitionEnd")},Od={},Ax={};Ws&&(Ax=document.createElement("div").style,"AnimationEvent"in window||(delete dr.animationend.animation,delete dr.animationiteration.animation,delete dr.animationstart.animation),"TransitionEvent"in window||delete dr.transitionend.transition);function wi(t){if(Od[t])return Od[t];if(!dr[t])return t;var i=dr[t],l;for(l in i)if(i.hasOwnProperty(l)&&l in Ax)return Od[t]=i[l];return t}var Mx=wi("animationend"),Dx=wi("animationiteration"),Ox=wi("animationstart"),Jw=wi("transitionrun"),Xw=wi("transitionstart"),Kw=wi("transitioncancel"),Rx=wi("transitionend"),_x=new Map,Rd="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(" ");Rd.push("scrollEnd");function vs(t,i){_x.set(t,i),yi(i,[t])}var rc=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=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(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},is=[],hr=0,_d=0;function lc(){for(var t=hr,i=_d=hr=0;i<t;){var l=is[i];is[i++]=null;var u=is[i];is[i++]=null;var x=is[i];is[i++]=null;var g=is[i];if(is[i++]=null,u!==null&&x!==null){var z=u.pending;z===null?x.next=x:(x.next=z.next,z.next=x),u.pending=x}g!==0&&Lx(l,x,g)}}function oc(t,i,l,u){is[hr++]=t,is[hr++]=i,is[hr++]=l,is[hr++]=u,_d|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function Ld(t,i,l,u){return oc(t,i,l,u),cc(t)}function zi(t,i){return oc(t,null,null,i),cc(t)}function Lx(t,i,l){t.lanes|=l;var u=t.alternate;u!==null&&(u.lanes|=l);for(var x=!1,g=t.return;g!==null;)g.childLanes|=l,u=g.alternate,u!==null&&(u.childLanes|=l),g.tag===22&&(t=g.stateNode,t===null||t._visibility&1||(x=!0)),t=g,g=g.return;return t.tag===3?(g=t.stateNode,x&&i!==null&&(x=31-et(l),t=g.hiddenUpdates,u=t[x],u===null?t[x]=[i]:u.push(i),i.lane=l|536870912),g):null}function cc(t){if(50<Zl)throw Zl=0,Vh=null,Error(r(185));for(var i=t.return;i!==null;)t=i,i=t.return;return t.tag===3?t.stateNode:null}var fr={};function Zw(t,i,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=i,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 Vn(t,i,l,u){return new Zw(t,i,l,u)}function Ud(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ea(t,i){var l=t.alternate;return l===null?(l=Vn(t.tag,i,t.key,t.mode),l.elementType=t.elementType,l.type=t.type,l.stateNode=t.stateNode,l.alternate=t,t.alternate=l):(l.pendingProps=i,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,i=t.dependencies,l.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},l.sibling=t.sibling,l.index=t.index,l.ref=t.ref,l.refCleanup=t.refCleanup,l}function Ux(t,i){t.flags&=65011714;var l=t.alternate;return l===null?(t.childLanes=0,t.lanes=i,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,i=l.dependencies,t.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),t}function uc(t,i,l,u,x,g){var z=0;if(u=t,typeof t=="function")Ud(t)&&(z=1);else if(typeof t=="string")z=sN(t,l,de.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case ee:return t=Vn(31,l,i,x),t.elementType=ee,t.lanes=g,t;case S:return Ni(l.children,x,g,i);case w:z=8,x|=24;break;case j:return t=Vn(12,l,i,x|2),t.elementType=j,t.lanes=g,t;case E:return t=Vn(13,l,i,x),t.elementType=E,t.lanes=g,t;case A:return t=Vn(19,l,i,x),t.elementType=A,t.lanes=g,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case T:z=10;break e;case C:z=9;break e;case D:z=11;break e;case B:z=14;break e;case V:z=16,u=null;break e}z=29,l=Error(r(130,t===null?"null":typeof t,"")),u=null}return i=Vn(z,l,i,x),i.elementType=t,i.type=u,i.lanes=g,i}function Ni(t,i,l,u){return t=Vn(7,t,u,i),t.lanes=l,t}function Bd(t,i,l){return t=Vn(6,t,null,i),t.lanes=l,t}function Bx(t){var i=Vn(18,null,null,0);return i.stateNode=t,i}function Id(t,i,l){return i=Vn(4,t.children!==null?t.children:[],t.key,i),i.lanes=l,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}var Ix=new WeakMap;function rs(t,i){if(typeof t=="object"&&t!==null){var l=Ix.get(t);return l!==void 0?l:(i={value:t,source:i,stack:Ce(i)},Ix.set(t,i),i)}return{value:t,source:i,stack:Ce(i)}}var mr=[],xr=0,dc=null,Ml=0,ls=[],os=0,Ea=null,_s=1,Ls="";function ta(t,i){mr[xr++]=Ml,mr[xr++]=dc,dc=t,Ml=i}function Hx(t,i,l){ls[os++]=_s,ls[os++]=Ls,ls[os++]=Ea,Ea=t;var u=_s;t=Ls;var x=32-et(u)-1;u&=~(1<<x),l+=1;var g=32-et(i)+x;if(30<g){var z=x-x%5;g=(u&(1<<z)-1).toString(32),u>>=z,x-=z,_s=1<<32-et(i)+x|l<<x|u,Ls=g+t}else _s=1<<g|l<<x|u,Ls=t}function Hd(t){t.return!==null&&(ta(t,1),Hx(t,1,0))}function Pd(t){for(;t===dc;)dc=mr[--xr],mr[xr]=null,Ml=mr[--xr],mr[xr]=null;for(;t===Ea;)Ea=ls[--os],ls[os]=null,Ls=ls[--os],ls[os]=null,_s=ls[--os],ls[os]=null}function Px(t,i){ls[os++]=_s,ls[os++]=Ls,ls[os++]=Ea,_s=i.id,Ls=i.overflow,Ea=t}var sn=null,bt=null,Ze=!1,Aa=null,cs=!1,qd=Error(r(519));function Ma(t){var i=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Dl(rs(i,t)),qd}function qx(t){var i=t.stateNode,l=t.type,u=t.memoizedProps;switch(i[nn]=t,i[Mn]=u,l){case"dialog":Ge("cancel",i),Ge("close",i);break;case"iframe":case"object":case"embed":Ge("load",i);break;case"video":case"audio":for(l=0;l<eo.length;l++)Ge(eo[l],i);break;case"source":Ge("error",i);break;case"img":case"image":case"link":Ge("error",i),Ge("load",i);break;case"details":Ge("toggle",i);break;case"input":Ge("invalid",i),tx(i,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Ge("invalid",i);break;case"textarea":Ge("invalid",i),sx(i,u.value,u.defaultValue,u.children)}l=u.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||i.textContent===""+l||u.suppressHydrationWarning===!0||ib(i.textContent,l)?(u.popover!=null&&(Ge("beforetoggle",i),Ge("toggle",i)),u.onScroll!=null&&Ge("scroll",i),u.onScrollEnd!=null&&Ge("scrollend",i),u.onClick!=null&&(i.onclick=Zs),i=!0):i=!1,i||Ma(t,!0)}function Fx(t){for(sn=t.return;sn;)switch(sn.tag){case 5:case 31:case 13:cs=!1;return;case 27:case 3:cs=!0;return;default:sn=sn.return}}function pr(t){if(t!==sn)return!1;if(!Ze)return Fx(t),Ze=!0,!1;var i=t.tag,l;if((l=i!==3&&i!==27)&&((l=i===5)&&(l=t.type,l=!(l!=="form"&&l!=="button")||lf(t.type,t.memoizedProps)),l=!l),l&&bt&&Ma(t),Fx(t),i===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));bt=mb(t)}else if(i===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));bt=mb(t)}else i===27?(i=bt,Va(t.type)?(t=hf,hf=null,bt=t):bt=i):bt=sn?ds(t.stateNode.nextSibling):null;return!0}function ki(){bt=sn=null,Ze=!1}function Fd(){var t=Aa;return t!==null&&(Ln===null?Ln=t:Ln.push.apply(Ln,t),Aa=null),t}function Dl(t){Aa===null?Aa=[t]:Aa.push(t)}var $d=P(null),Si=null,na=null;function Da(t,i,l){O($d,i._currentValue),i._currentValue=l}function sa(t){t._currentValue=$d.current,Y($d)}function Vd(t,i,l){for(;t!==null;){var u=t.alternate;if((t.childLanes&i)!==i?(t.childLanes|=i,u!==null&&(u.childLanes|=i)):u!==null&&(u.childLanes&i)!==i&&(u.childLanes|=i),t===l)break;t=t.return}}function Gd(t,i,l,u){var x=t.child;for(x!==null&&(x.return=t);x!==null;){var g=x.dependencies;if(g!==null){var z=x.child;g=g.firstContext;e:for(;g!==null;){var M=g;g=x;for(var q=0;q<i.length;q++)if(M.context===i[q]){g.lanes|=l,M=g.alternate,M!==null&&(M.lanes|=l),Vd(g.return,l,t),u||(z=null);break e}g=M.next}}else if(x.tag===18){if(z=x.return,z===null)throw Error(r(341));z.lanes|=l,g=z.alternate,g!==null&&(g.lanes|=l),Vd(z,l,t),z=null}else z=x.child;if(z!==null)z.return=x;else for(z=x;z!==null;){if(z===t){z=null;break}if(x=z.sibling,x!==null){x.return=z.return,z=x;break}z=z.return}x=z}}function gr(t,i,l,u){t=null;for(var x=i,g=!1;x!==null;){if(!g){if((x.flags&524288)!==0)g=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var z=x.alternate;if(z===null)throw Error(r(387));if(z=z.memoizedProps,z!==null){var M=x.type;$n(x.pendingProps.value,z.value)||(t!==null?t.push(M):t=[M])}}else if(x===je.current){if(z=x.alternate,z===null)throw Error(r(387));z.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(t!==null?t.push(io):t=[io])}x=x.return}t!==null&&Gd(i,t,l,u),i.flags|=262144}function hc(t){for(t=t.firstContext;t!==null;){if(!$n(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Ci(t){Si=t,na=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function an(t){return $x(Si,t)}function fc(t,i){return Si===null&&Ci(t),$x(t,i)}function $x(t,i){var l=i._currentValue;if(i={context:i,memoizedValue:l,next:null},na===null){if(t===null)throw Error(r(308));na=i,t.dependencies={lanes:0,firstContext:i},t.flags|=524288}else na=na.next=i;return l}var Ww=typeof AbortController<"u"?AbortController:function(){var t=[],i=this.signal={aborted:!1,addEventListener:function(l,u){t.push(u)}};this.abort=function(){i.aborted=!0,t.forEach(function(l){return l()})}},ez=e.unstable_scheduleCallback,tz=e.unstable_NormalPriority,Dt={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Yd(){return{controller:new Ww,data:new Map,refCount:0}}function Ol(t){t.refCount--,t.refCount===0&&ez(tz,function(){t.controller.abort()})}var Rl=null,Qd=0,br=0,yr=null;function nz(t,i){if(Rl===null){var l=Rl=[];Qd=0,br=Kh(),yr={status:"pending",value:void 0,then:function(u){l.push(u)}}}return Qd++,i.then(Vx,Vx),i}function Vx(){if(--Qd===0&&Rl!==null){yr!==null&&(yr.status="fulfilled");var t=Rl;Rl=null,br=0,yr=null;for(var i=0;i<t.length;i++)(0,t[i])()}}function sz(t,i){var l=[],u={status:"pending",value:null,reason:null,then:function(x){l.push(x)}};return t.then(function(){u.status="fulfilled",u.value=i;for(var x=0;x<l.length;x++)(0,l[x])(i)},function(x){for(u.status="rejected",u.reason=x,x=0;x<l.length;x++)(0,l[x])(void 0)}),u}var Gx=I.S;I.S=function(t,i){Eg=Me(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&nz(t,i),Gx!==null&&Gx(t,i)};var Ti=P(null);function Jd(){var t=Ti.current;return t!==null?t:ft.pooledCache}function mc(t,i){i===null?O(Ti,Ti.current):O(Ti,i.pool)}function Yx(){var t=Jd();return t===null?null:{parent:Dt._currentValue,pool:t}}var vr=Error(r(460)),Xd=Error(r(474)),xc=Error(r(542)),pc={then:function(){}};function Qx(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Jx(t,i,l){switch(l=t[l],l===void 0?t.push(i):l!==i&&(i.then(Zs,Zs),i=l),i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,Kx(t),t;default:if(typeof i.status=="string")i.then(Zs,Zs);else{if(t=ft,t!==null&&100<t.shellSuspendCounter)throw Error(r(482));t=i,t.status="pending",t.then(function(u){if(i.status==="pending"){var x=i;x.status="fulfilled",x.value=u}},function(u){if(i.status==="pending"){var x=i;x.status="rejected",x.reason=u}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw t=i.reason,Kx(t),t}throw Ai=i,vr}}function Ei(t){try{var i=t._init;return i(t._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Ai=l,vr):l}}var Ai=null;function Xx(){if(Ai===null)throw Error(r(459));var t=Ai;return Ai=null,t}function Kx(t){if(t===vr||t===xc)throw Error(r(483))}var jr=null,_l=0;function gc(t){var i=_l;return _l+=1,jr===null&&(jr=[]),Jx(jr,t,i)}function Ll(t,i){i=i.props.ref,t.ref=i!==void 0?i:null}function bc(t,i){throw i.$$typeof===v?Error(r(525)):(t=Object.prototype.toString.call(i),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":t)))}function Zx(t){function i(G,$){if(t){var Q=G.deletions;Q===null?(G.deletions=[$],G.flags|=16):Q.push($)}}function l(G,$){if(!t)return null;for(;$!==null;)i(G,$),$=$.sibling;return null}function u(G){for(var $=new Map;G!==null;)G.key!==null?$.set(G.key,G):$.set(G.index,G),G=G.sibling;return $}function x(G,$){return G=ea(G,$),G.index=0,G.sibling=null,G}function g(G,$,Q){return G.index=Q,t?(Q=G.alternate,Q!==null?(Q=Q.index,Q<$?(G.flags|=67108866,$):Q):(G.flags|=67108866,$)):(G.flags|=1048576,$)}function z(G){return t&&G.alternate===null&&(G.flags|=67108866),G}function M(G,$,Q,oe){return $===null||$.tag!==6?($=Bd(Q,G.mode,oe),$.return=G,$):($=x($,Q),$.return=G,$)}function q(G,$,Q,oe){var Te=Q.type;return Te===S?ie(G,$,Q.props.children,oe,Q.key):$!==null&&($.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===V&&Ei(Te)===$.type)?($=x($,Q.props),Ll($,Q),$.return=G,$):($=uc(Q.type,Q.key,Q.props,null,G.mode,oe),Ll($,Q),$.return=G,$)}function J(G,$,Q,oe){return $===null||$.tag!==4||$.stateNode.containerInfo!==Q.containerInfo||$.stateNode.implementation!==Q.implementation?($=Id(Q,G.mode,oe),$.return=G,$):($=x($,Q.children||[]),$.return=G,$)}function ie(G,$,Q,oe,Te){return $===null||$.tag!==7?($=Ni(Q,G.mode,oe,Te),$.return=G,$):($=x($,Q),$.return=G,$)}function ue(G,$,Q){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=Bd(""+$,G.mode,Q),$.return=G,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case y:return Q=uc($.type,$.key,$.props,null,G.mode,Q),Ll(Q,$),Q.return=G,Q;case N:return $=Id($,G.mode,Q),$.return=G,$;case V:return $=Ei($),ue(G,$,Q)}if(H($)||_($))return $=Ni($,G.mode,Q,null),$.return=G,$;if(typeof $.then=="function")return ue(G,gc($),Q);if($.$$typeof===T)return ue(G,fc(G,$),Q);bc(G,$)}return null}function K(G,$,Q,oe){var Te=$!==null?$.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Te!==null?null:M(G,$,""+Q,oe);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case y:return Q.key===Te?q(G,$,Q,oe):null;case N:return Q.key===Te?J(G,$,Q,oe):null;case V:return Q=Ei(Q),K(G,$,Q,oe)}if(H(Q)||_(Q))return Te!==null?null:ie(G,$,Q,oe,null);if(typeof Q.then=="function")return K(G,$,gc(Q),oe);if(Q.$$typeof===T)return K(G,$,fc(G,Q),oe);bc(G,Q)}return null}function ne(G,$,Q,oe,Te){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return G=G.get(Q)||null,M($,G,""+oe,Te);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case y:return G=G.get(oe.key===null?Q:oe.key)||null,q($,G,oe,Te);case N:return G=G.get(oe.key===null?Q:oe.key)||null,J($,G,oe,Te);case V:return oe=Ei(oe),ne(G,$,Q,oe,Te)}if(H(oe)||_(oe))return G=G.get(Q)||null,ie($,G,oe,Te,null);if(typeof oe.then=="function")return ne(G,$,Q,gc(oe),Te);if(oe.$$typeof===T)return ne(G,$,Q,fc($,oe),Te);bc($,oe)}return null}function we(G,$,Q,oe){for(var Te=null,st=null,ze=$,He=$=0,Je=null;ze!==null&&He<Q.length;He++){ze.index>He?(Je=ze,ze=null):Je=ze.sibling;var at=K(G,ze,Q[He],oe);if(at===null){ze===null&&(ze=Je);break}t&&ze&&at.alternate===null&&i(G,ze),$=g(at,$,He),st===null?Te=at:st.sibling=at,st=at,ze=Je}if(He===Q.length)return l(G,ze),Ze&&ta(G,He),Te;if(ze===null){for(;He<Q.length;He++)ze=ue(G,Q[He],oe),ze!==null&&($=g(ze,$,He),st===null?Te=ze:st.sibling=ze,st=ze);return Ze&&ta(G,He),Te}for(ze=u(ze);He<Q.length;He++)Je=ne(ze,G,He,Q[He],oe),Je!==null&&(t&&Je.alternate!==null&&ze.delete(Je.key===null?He:Je.key),$=g(Je,$,He),st===null?Te=Je:st.sibling=Je,st=Je);return t&&ze.forEach(function(Xa){return i(G,Xa)}),Ze&&ta(G,He),Te}function Ae(G,$,Q,oe){if(Q==null)throw Error(r(151));for(var Te=null,st=null,ze=$,He=$=0,Je=null,at=Q.next();ze!==null&&!at.done;He++,at=Q.next()){ze.index>He?(Je=ze,ze=null):Je=ze.sibling;var Xa=K(G,ze,at.value,oe);if(Xa===null){ze===null&&(ze=Je);break}t&&ze&&Xa.alternate===null&&i(G,ze),$=g(Xa,$,He),st===null?Te=Xa:st.sibling=Xa,st=Xa,ze=Je}if(at.done)return l(G,ze),Ze&&ta(G,He),Te;if(ze===null){for(;!at.done;He++,at=Q.next())at=ue(G,at.value,oe),at!==null&&($=g(at,$,He),st===null?Te=at:st.sibling=at,st=at);return Ze&&ta(G,He),Te}for(ze=u(ze);!at.done;He++,at=Q.next())at=ne(ze,G,He,at.value,oe),at!==null&&(t&&at.alternate!==null&&ze.delete(at.key===null?He:at.key),$=g(at,$,He),st===null?Te=at:st.sibling=at,st=at);return t&&ze.forEach(function(mN){return i(G,mN)}),Ze&&ta(G,He),Te}function dt(G,$,Q,oe){if(typeof Q=="object"&&Q!==null&&Q.type===S&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case y:e:{for(var Te=Q.key;$!==null;){if($.key===Te){if(Te=Q.type,Te===S){if($.tag===7){l(G,$.sibling),oe=x($,Q.props.children),oe.return=G,G=oe;break e}}else if($.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===V&&Ei(Te)===$.type){l(G,$.sibling),oe=x($,Q.props),Ll(oe,Q),oe.return=G,G=oe;break e}l(G,$);break}else i(G,$);$=$.sibling}Q.type===S?(oe=Ni(Q.props.children,G.mode,oe,Q.key),oe.return=G,G=oe):(oe=uc(Q.type,Q.key,Q.props,null,G.mode,oe),Ll(oe,Q),oe.return=G,G=oe)}return z(G);case N:e:{for(Te=Q.key;$!==null;){if($.key===Te)if($.tag===4&&$.stateNode.containerInfo===Q.containerInfo&&$.stateNode.implementation===Q.implementation){l(G,$.sibling),oe=x($,Q.children||[]),oe.return=G,G=oe;break e}else{l(G,$);break}else i(G,$);$=$.sibling}oe=Id(Q,G.mode,oe),oe.return=G,G=oe}return z(G);case V:return Q=Ei(Q),dt(G,$,Q,oe)}if(H(Q))return we(G,$,Q,oe);if(_(Q)){if(Te=_(Q),typeof Te!="function")throw Error(r(150));return Q=Te.call(Q),Ae(G,$,Q,oe)}if(typeof Q.then=="function")return dt(G,$,gc(Q),oe);if(Q.$$typeof===T)return dt(G,$,fc(G,Q),oe);bc(G,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,$!==null&&$.tag===6?(l(G,$.sibling),oe=x($,Q),oe.return=G,G=oe):(l(G,$),oe=Bd(Q,G.mode,oe),oe.return=G,G=oe),z(G)):l(G,$)}return function(G,$,Q,oe){try{_l=0;var Te=dt(G,$,Q,oe);return jr=null,Te}catch(ze){if(ze===vr||ze===xc)throw ze;var st=Vn(29,ze,null,G.mode);return st.lanes=oe,st.return=G,st}finally{}}}var Mi=Zx(!0),Wx=Zx(!1),Oa=!1;function Kd(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Zd(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ra(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function _a(t,i,l){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(it&2)!==0){var x=u.pending;return x===null?i.next=i:(i.next=x.next,x.next=i),u.pending=i,i=cc(t),Lx(t,null,l),i}return oc(t,u,i,l),cc(t)}function Ul(t,i,l){if(i=i.updateQueue,i!==null&&(i=i.shared,(l&4194048)!==0)){var u=i.lanes;u&=t.pendingLanes,l|=u,i.lanes=l,An(t,l)}}function Wd(t,i){var l=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,l===u)){var x=null,g=null;if(l=l.firstBaseUpdate,l!==null){do{var z={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};g===null?x=g=z:g=g.next=z,l=l.next}while(l!==null);g===null?x=g=i:g=g.next=i}else x=g=i;l={baseState:u.baseState,firstBaseUpdate:x,lastBaseUpdate:g,shared:u.shared,callbacks:u.callbacks},t.updateQueue=l;return}t=l.lastBaseUpdate,t===null?l.firstBaseUpdate=i:t.next=i,l.lastBaseUpdate=i}var eh=!1;function Bl(){if(eh){var t=yr;if(t!==null)throw t}}function Il(t,i,l,u){eh=!1;var x=t.updateQueue;Oa=!1;var g=x.firstBaseUpdate,z=x.lastBaseUpdate,M=x.shared.pending;if(M!==null){x.shared.pending=null;var q=M,J=q.next;q.next=null,z===null?g=J:z.next=J,z=q;var ie=t.alternate;ie!==null&&(ie=ie.updateQueue,M=ie.lastBaseUpdate,M!==z&&(M===null?ie.firstBaseUpdate=J:M.next=J,ie.lastBaseUpdate=q))}if(g!==null){var ue=x.baseState;z=0,ie=J=q=null,M=g;do{var K=M.lane&-536870913,ne=K!==M.lane;if(ne?(Qe&K)===K:(u&K)===K){K!==0&&K===br&&(eh=!0),ie!==null&&(ie=ie.next={lane:0,tag:M.tag,payload:M.payload,callback:null,next:null});e:{var we=t,Ae=M;K=i;var dt=l;switch(Ae.tag){case 1:if(we=Ae.payload,typeof we=="function"){ue=we.call(dt,ue,K);break e}ue=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Ae.payload,K=typeof we=="function"?we.call(dt,ue,K):we,K==null)break e;ue=b({},ue,K);break e;case 2:Oa=!0}}K=M.callback,K!==null&&(t.flags|=64,ne&&(t.flags|=8192),ne=x.callbacks,ne===null?x.callbacks=[K]:ne.push(K))}else ne={lane:K,tag:M.tag,payload:M.payload,callback:M.callback,next:null},ie===null?(J=ie=ne,q=ue):ie=ie.next=ne,z|=K;if(M=M.next,M===null){if(M=x.shared.pending,M===null)break;ne=M,M=ne.next,ne.next=null,x.lastBaseUpdate=ne,x.shared.pending=null}}while(!0);ie===null&&(q=ue),x.baseState=q,x.firstBaseUpdate=J,x.lastBaseUpdate=ie,g===null&&(x.shared.lanes=0),Ha|=z,t.lanes=z,t.memoizedState=ue}}function ep(t,i){if(typeof t!="function")throw Error(r(191,t));t.call(i)}function tp(t,i){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;t<l.length;t++)ep(l[t],i)}var wr=P(null),yc=P(0);function np(t,i){t=ha,O(yc,t),O(wr,i),ha=t|i.baseLanes}function th(){O(yc,ha),O(wr,wr.current)}function nh(){ha=yc.current,Y(wr),Y(yc)}var Gn=P(null),us=null;function La(t){var i=t.alternate;O(Et,Et.current&1),O(Gn,t),us===null&&(i===null||wr.current!==null||i.memoizedState!==null)&&(us=t)}function sh(t){O(Et,Et.current),O(Gn,t),us===null&&(us=t)}function sp(t){t.tag===22?(O(Et,Et.current),O(Gn,t),us===null&&(us=t)):Ua()}function Ua(){O(Et,Et.current),O(Gn,Gn.current)}function Yn(t){Y(Gn),us===t&&(us=null),Y(Et)}var Et=P(0);function vc(t){for(var i=t;i!==null;){if(i.tag===13){var l=i.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||uf(l)||df(l)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var aa=0,Ue=null,ct=null,Ot=null,jc=!1,zr=!1,Di=!1,wc=0,Hl=0,Nr=null,az=0;function kt(){throw Error(r(321))}function ah(t,i){if(i===null)return!1;for(var l=0;l<i.length&&l<t.length;l++)if(!$n(t[l],i[l]))return!1;return!0}function ih(t,i,l,u,x,g){return aa=g,Ue=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,I.H=t===null||t.memoizedState===null?Hp:vh,Di=!1,g=l(u,x),Di=!1,zr&&(g=ip(i,l,u,x)),ap(t),g}function ap(t){I.H=Fl;var i=ct!==null&&ct.next!==null;if(aa=0,Ot=ct=Ue=null,jc=!1,Hl=0,Nr=null,i)throw Error(r(300));t===null||Rt||(t=t.dependencies,t!==null&&hc(t)&&(Rt=!0))}function ip(t,i,l,u){Ue=t;var x=0;do{if(zr&&(Nr=null),Hl=0,zr=!1,25<=x)throw Error(r(301));if(x+=1,Ot=ct=null,t.updateQueue!=null){var g=t.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}I.H=Pp,g=i(l,u)}while(zr);return g}function iz(){var t=I.H,i=t.useState()[0];return i=typeof i.then=="function"?Pl(i):i,t=t.useState()[0],(ct!==null?ct.memoizedState:null)!==t&&(Ue.flags|=1024),i}function rh(){var t=wc!==0;return wc=0,t}function lh(t,i,l){i.updateQueue=t.updateQueue,i.flags&=-2053,t.lanes&=~l}function oh(t){if(jc){for(t=t.memoizedState;t!==null;){var i=t.queue;i!==null&&(i.pending=null),t=t.next}jc=!1}aa=0,Ot=ct=Ue=null,zr=!1,Hl=wc=0,Nr=null}function zn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ot===null?Ue.memoizedState=Ot=t:Ot=Ot.next=t,Ot}function At(){if(ct===null){var t=Ue.alternate;t=t!==null?t.memoizedState:null}else t=ct.next;var i=Ot===null?Ue.memoizedState:Ot.next;if(i!==null)Ot=i,ct=t;else{if(t===null)throw Ue.alternate===null?Error(r(467)):Error(r(310));ct=t,t={memoizedState:ct.memoizedState,baseState:ct.baseState,baseQueue:ct.baseQueue,queue:ct.queue,next:null},Ot===null?Ue.memoizedState=Ot=t:Ot=Ot.next=t}return Ot}function zc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Pl(t){var i=Hl;return Hl+=1,Nr===null&&(Nr=[]),t=Jx(Nr,t,i),i=Ue,(Ot===null?i.memoizedState:Ot.next)===null&&(i=i.alternate,I.H=i===null||i.memoizedState===null?Hp:vh),t}function Nc(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Pl(t);if(t.$$typeof===T)return an(t)}throw Error(r(438,String(t)))}function ch(t){var i=null,l=Ue.updateQueue;if(l!==null&&(i=l.memoCache),i==null){var u=Ue.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(i={data:u.data.map(function(x){return x.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),l===null&&(l=zc(),Ue.updateQueue=l),l.memoCache=i,l=i.data[i.index],l===void 0)for(l=i.data[i.index]=Array(t),u=0;u<t;u++)l[u]=R;return i.index++,l}function ia(t,i){return typeof i=="function"?i(t):i}function kc(t){var i=At();return uh(i,ct,t)}function uh(t,i,l){var u=t.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=l;var x=t.baseQueue,g=u.pending;if(g!==null){if(x!==null){var z=x.next;x.next=g.next,g.next=z}i.baseQueue=x=g,u.pending=null}if(g=t.baseState,x===null)t.memoizedState=g;else{i=x.next;var M=z=null,q=null,J=i,ie=!1;do{var ue=J.lane&-536870913;if(ue!==J.lane?(Qe&ue)===ue:(aa&ue)===ue){var K=J.revertLane;if(K===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),ue===br&&(ie=!0);else if((aa&K)===K){J=J.next,K===br&&(ie=!0);continue}else ue={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},q===null?(M=q=ue,z=g):q=q.next=ue,Ue.lanes|=K,Ha|=K;ue=J.action,Di&&l(g,ue),g=J.hasEagerState?J.eagerState:l(g,ue)}else K={lane:ue,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},q===null?(M=q=K,z=g):q=q.next=K,Ue.lanes|=ue,Ha|=ue;J=J.next}while(J!==null&&J!==i);if(q===null?z=g:q.next=M,!$n(g,t.memoizedState)&&(Rt=!0,ie&&(l=yr,l!==null)))throw l;t.memoizedState=g,t.baseState=z,t.baseQueue=q,u.lastRenderedState=g}return x===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function dh(t){var i=At(),l=i.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=t;var u=l.dispatch,x=l.pending,g=i.memoizedState;if(x!==null){l.pending=null;var z=x=x.next;do g=t(g,z.action),z=z.next;while(z!==x);$n(g,i.memoizedState)||(Rt=!0),i.memoizedState=g,i.baseQueue===null&&(i.baseState=g),l.lastRenderedState=g}return[g,u]}function rp(t,i,l){var u=Ue,x=At(),g=Ze;if(g){if(l===void 0)throw Error(r(407));l=l()}else l=i();var z=!$n((ct||x).memoizedState,l);if(z&&(x.memoizedState=l,Rt=!0),x=x.queue,mh(cp.bind(null,u,x,t),[t]),x.getSnapshot!==i||z||Ot!==null&&Ot.memoizedState.tag&1){if(u.flags|=2048,kr(9,{destroy:void 0},op.bind(null,u,x,l,i),null),ft===null)throw Error(r(349));g||(aa&127)!==0||lp(u,i,l)}return l}function lp(t,i,l){t.flags|=16384,t={getSnapshot:i,value:l},i=Ue.updateQueue,i===null?(i=zc(),Ue.updateQueue=i,i.stores=[t]):(l=i.stores,l===null?i.stores=[t]:l.push(t))}function op(t,i,l,u){i.value=l,i.getSnapshot=u,up(i)&&dp(t)}function cp(t,i,l){return l(function(){up(i)&&dp(t)})}function up(t){var i=t.getSnapshot;t=t.value;try{var l=i();return!$n(t,l)}catch{return!0}}function dp(t){var i=zi(t,2);i!==null&&Un(i,t,2)}function hh(t){var i=zn();if(typeof t=="function"){var l=t;if(t=l(),Di){en(!0);try{l()}finally{en(!1)}}}return i.memoizedState=i.baseState=t,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:t},i}function hp(t,i,l,u){return t.baseState=l,uh(t,ct,typeof u=="function"?u:ia)}function rz(t,i,l,u,x){if(Tc(t))throw Error(r(485));if(t=i.action,t!==null){var g={payload:x,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(z){g.listeners.push(z)}};I.T!==null?l(!0):g.isTransition=!1,u(g),l=i.pending,l===null?(g.next=i.pending=g,fp(i,g)):(g.next=l.next,i.pending=l.next=g)}}function fp(t,i){var l=i.action,u=i.payload,x=t.state;if(i.isTransition){var g=I.T,z={};I.T=z;try{var M=l(x,u),q=I.S;q!==null&&q(z,M),mp(t,i,M)}catch(J){fh(t,i,J)}finally{g!==null&&z.types!==null&&(g.types=z.types),I.T=g}}else try{g=l(x,u),mp(t,i,g)}catch(J){fh(t,i,J)}}function mp(t,i,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(u){xp(t,i,u)},function(u){return fh(t,i,u)}):xp(t,i,l)}function xp(t,i,l){i.status="fulfilled",i.value=l,pp(i),t.state=l,i=t.pending,i!==null&&(l=i.next,l===i?t.pending=null:(l=l.next,i.next=l,fp(t,l)))}function fh(t,i,l){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do i.status="rejected",i.reason=l,pp(i),i=i.next;while(i!==u)}t.action=null}function pp(t){t=t.listeners;for(var i=0;i<t.length;i++)(0,t[i])()}function gp(t,i){return i}function bp(t,i){if(Ze){var l=ft.formState;if(l!==null){e:{var u=Ue;if(Ze){if(bt){t:{for(var x=bt,g=cs;x.nodeType!==8;){if(!g){x=null;break t}if(x=ds(x.nextSibling),x===null){x=null;break t}}g=x.data,x=g==="F!"||g==="F"?x:null}if(x){bt=ds(x.nextSibling),u=x.data==="F!";break e}}Ma(u)}u=!1}u&&(i=l[0])}}return l=zn(),l.memoizedState=l.baseState=i,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gp,lastRenderedState:i},l.queue=u,l=Up.bind(null,Ue,u),u.dispatch=l,u=hh(!1),g=yh.bind(null,Ue,!1,u.queue),u=zn(),x={state:i,dispatch:null,action:t,pending:null},u.queue=x,l=rz.bind(null,Ue,x,g,l),x.dispatch=l,u.memoizedState=t,[i,l,!1]}function yp(t){var i=At();return vp(i,ct,t)}function vp(t,i,l){if(i=uh(t,i,gp)[0],t=kc(ia)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var u=Pl(i)}catch(z){throw z===vr?xc:z}else u=i;i=At();var x=i.queue,g=x.dispatch;return l!==i.memoizedState&&(Ue.flags|=2048,kr(9,{destroy:void 0},lz.bind(null,x,l),null)),[u,g,t]}function lz(t,i){t.action=i}function jp(t){var i=At(),l=ct;if(l!==null)return vp(i,l,t);At(),i=i.memoizedState,l=At();var u=l.queue.dispatch;return l.memoizedState=t,[i,u,!1]}function kr(t,i,l,u){return t={tag:t,create:l,deps:u,inst:i,next:null},i=Ue.updateQueue,i===null&&(i=zc(),Ue.updateQueue=i),l=i.lastEffect,l===null?i.lastEffect=t.next=t:(u=l.next,l.next=t,t.next=u,i.lastEffect=t),t}function wp(){return At().memoizedState}function Sc(t,i,l,u){var x=zn();Ue.flags|=t,x.memoizedState=kr(1|i,{destroy:void 0},l,u===void 0?null:u)}function Cc(t,i,l,u){var x=At();u=u===void 0?null:u;var g=x.memoizedState.inst;ct!==null&&u!==null&&ah(u,ct.memoizedState.deps)?x.memoizedState=kr(i,g,l,u):(Ue.flags|=t,x.memoizedState=kr(1|i,g,l,u))}function zp(t,i){Sc(8390656,8,t,i)}function mh(t,i){Cc(2048,8,t,i)}function oz(t){Ue.flags|=4;var i=Ue.updateQueue;if(i===null)i=zc(),Ue.updateQueue=i,i.events=[t];else{var l=i.events;l===null?i.events=[t]:l.push(t)}}function Np(t){var i=At().memoizedState;return oz({ref:i,nextImpl:t}),function(){if((it&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}function kp(t,i){return Cc(4,2,t,i)}function Sp(t,i){return Cc(4,4,t,i)}function Cp(t,i){if(typeof i=="function"){t=t();var l=i(t);return function(){typeof l=="function"?l():i(null)}}if(i!=null)return t=t(),i.current=t,function(){i.current=null}}function Tp(t,i,l){l=l!=null?l.concat([t]):null,Cc(4,4,Cp.bind(null,i,t),l)}function xh(){}function Ep(t,i){var l=At();i=i===void 0?null:i;var u=l.memoizedState;return i!==null&&ah(i,u[1])?u[0]:(l.memoizedState=[t,i],t)}function Ap(t,i){var l=At();i=i===void 0?null:i;var u=l.memoizedState;if(i!==null&&ah(i,u[1]))return u[0];if(u=t(),Di){en(!0);try{t()}finally{en(!1)}}return l.memoizedState=[u,i],u}function ph(t,i,l){return l===void 0||(aa&1073741824)!==0&&(Qe&261930)===0?t.memoizedState=i:(t.memoizedState=l,t=Mg(),Ue.lanes|=t,Ha|=t,l)}function Mp(t,i,l,u){return $n(l,i)?l:wr.current!==null?(t=ph(t,l,u),$n(t,i)||(Rt=!0),t):(aa&42)===0||(aa&1073741824)!==0&&(Qe&261930)===0?(Rt=!0,t.memoizedState=l):(t=Mg(),Ue.lanes|=t,Ha|=t,i)}function Dp(t,i,l,u,x){var g=W.p;W.p=g!==0&&8>g?g:8;var z=I.T,M={};I.T=M,yh(t,!1,i,l);try{var q=x(),J=I.S;if(J!==null&&J(M,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var ie=sz(q,u);ql(t,i,ie,Xn(t))}else ql(t,i,u,Xn(t))}catch(ue){ql(t,i,{then:function(){},status:"rejected",reason:ue},Xn())}finally{W.p=g,z!==null&&M.types!==null&&(z.types=M.types),I.T=z}}function cz(){}function gh(t,i,l,u){if(t.tag!==5)throw Error(r(476));var x=Op(t).queue;Dp(t,x,i,re,l===null?cz:function(){return Rp(t),l(u)})}function Op(t){var i=t.memoizedState;if(i!==null)return i;i={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:re},next:null};var l={};return i.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:l},next:null},t.memoizedState=i,t=t.alternate,t!==null&&(t.memoizedState=i),i}function Rp(t){var i=Op(t);i.next===null&&(i=t.alternate.memoizedState),ql(t,i.next.queue,{},Xn())}function bh(){return an(io)}function _p(){return At().memoizedState}function Lp(){return At().memoizedState}function uz(t){for(var i=t.return;i!==null;){switch(i.tag){case 24:case 3:var l=Xn();t=Ra(l);var u=_a(i,t,l);u!==null&&(Un(u,i,l),Ul(u,i,l)),i={cache:Yd()},t.payload=i;return}i=i.return}}function dz(t,i,l){var u=Xn();l={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Tc(t)?Bp(i,l):(l=Ld(t,i,l,u),l!==null&&(Un(l,t,u),Ip(l,i,u)))}function Up(t,i,l){var u=Xn();ql(t,i,l,u)}function ql(t,i,l,u){var x={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Tc(t))Bp(i,x);else{var g=t.alternate;if(t.lanes===0&&(g===null||g.lanes===0)&&(g=i.lastRenderedReducer,g!==null))try{var z=i.lastRenderedState,M=g(z,l);if(x.hasEagerState=!0,x.eagerState=M,$n(M,z))return oc(t,i,x,0),ft===null&&lc(),!1}catch{}finally{}if(l=Ld(t,i,x,u),l!==null)return Un(l,t,u),Ip(l,i,u),!0}return!1}function yh(t,i,l,u){if(u={lane:2,revertLane:Kh(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Tc(t)){if(i)throw Error(r(479))}else i=Ld(t,l,u,2),i!==null&&Un(i,t,2)}function Tc(t){var i=t.alternate;return t===Ue||i!==null&&i===Ue}function Bp(t,i){zr=jc=!0;var l=t.pending;l===null?i.next=i:(i.next=l.next,l.next=i),t.pending=i}function Ip(t,i,l){if((l&4194048)!==0){var u=i.lanes;u&=t.pendingLanes,l|=u,i.lanes=l,An(t,l)}}var Fl={readContext:an,use:Nc,useCallback:kt,useContext:kt,useEffect:kt,useImperativeHandle:kt,useLayoutEffect:kt,useInsertionEffect:kt,useMemo:kt,useReducer:kt,useRef:kt,useState:kt,useDebugValue:kt,useDeferredValue:kt,useTransition:kt,useSyncExternalStore:kt,useId:kt,useHostTransitionStatus:kt,useFormState:kt,useActionState:kt,useOptimistic:kt,useMemoCache:kt,useCacheRefresh:kt};Fl.useEffectEvent=kt;var Hp={readContext:an,use:Nc,useCallback:function(t,i){return zn().memoizedState=[t,i===void 0?null:i],t},useContext:an,useEffect:zp,useImperativeHandle:function(t,i,l){l=l!=null?l.concat([t]):null,Sc(4194308,4,Cp.bind(null,i,t),l)},useLayoutEffect:function(t,i){return Sc(4194308,4,t,i)},useInsertionEffect:function(t,i){Sc(4,2,t,i)},useMemo:function(t,i){var l=zn();i=i===void 0?null:i;var u=t();if(Di){en(!0);try{t()}finally{en(!1)}}return l.memoizedState=[u,i],u},useReducer:function(t,i,l){var u=zn();if(l!==void 0){var x=l(i);if(Di){en(!0);try{l(i)}finally{en(!1)}}}else x=i;return u.memoizedState=u.baseState=x,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:x},u.queue=t,t=t.dispatch=dz.bind(null,Ue,t),[u.memoizedState,t]},useRef:function(t){var i=zn();return t={current:t},i.memoizedState=t},useState:function(t){t=hh(t);var i=t.queue,l=Up.bind(null,Ue,i);return i.dispatch=l,[t.memoizedState,l]},useDebugValue:xh,useDeferredValue:function(t,i){var l=zn();return ph(l,t,i)},useTransition:function(){var t=hh(!1);return t=Dp.bind(null,Ue,t.queue,!0,!1),zn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,i,l){var u=Ue,x=zn();if(Ze){if(l===void 0)throw Error(r(407));l=l()}else{if(l=i(),ft===null)throw Error(r(349));(Qe&127)!==0||lp(u,i,l)}x.memoizedState=l;var g={value:l,getSnapshot:i};return x.queue=g,zp(cp.bind(null,u,g,t),[t]),u.flags|=2048,kr(9,{destroy:void 0},op.bind(null,u,g,l,i),null),l},useId:function(){var t=zn(),i=ft.identifierPrefix;if(Ze){var l=Ls,u=_s;l=(u&~(1<<32-et(u)-1)).toString(32)+l,i="_"+i+"R_"+l,l=wc++,0<l&&(i+="H"+l.toString(32)),i+="_"}else l=az++,i="_"+i+"r_"+l.toString(32)+"_";return t.memoizedState=i},useHostTransitionStatus:bh,useFormState:bp,useActionState:bp,useOptimistic:function(t){var i=zn();i.memoizedState=i.baseState=t;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=l,i=yh.bind(null,Ue,!0,l),l.dispatch=i,[t,i]},useMemoCache:ch,useCacheRefresh:function(){return zn().memoizedState=uz.bind(null,Ue)},useEffectEvent:function(t){var i=zn(),l={impl:t};return i.memoizedState=l,function(){if((it&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}},vh={readContext:an,use:Nc,useCallback:Ep,useContext:an,useEffect:mh,useImperativeHandle:Tp,useInsertionEffect:kp,useLayoutEffect:Sp,useMemo:Ap,useReducer:kc,useRef:wp,useState:function(){return kc(ia)},useDebugValue:xh,useDeferredValue:function(t,i){var l=At();return Mp(l,ct.memoizedState,t,i)},useTransition:function(){var t=kc(ia)[0],i=At().memoizedState;return[typeof t=="boolean"?t:Pl(t),i]},useSyncExternalStore:rp,useId:_p,useHostTransitionStatus:bh,useFormState:yp,useActionState:yp,useOptimistic:function(t,i){var l=At();return hp(l,ct,t,i)},useMemoCache:ch,useCacheRefresh:Lp};vh.useEffectEvent=Np;var Pp={readContext:an,use:Nc,useCallback:Ep,useContext:an,useEffect:mh,useImperativeHandle:Tp,useInsertionEffect:kp,useLayoutEffect:Sp,useMemo:Ap,useReducer:dh,useRef:wp,useState:function(){return dh(ia)},useDebugValue:xh,useDeferredValue:function(t,i){var l=At();return ct===null?ph(l,t,i):Mp(l,ct.memoizedState,t,i)},useTransition:function(){var t=dh(ia)[0],i=At().memoizedState;return[typeof t=="boolean"?t:Pl(t),i]},useSyncExternalStore:rp,useId:_p,useHostTransitionStatus:bh,useFormState:jp,useActionState:jp,useOptimistic:function(t,i){var l=At();return ct!==null?hp(l,ct,t,i):(l.baseState=t,[t,l.queue.dispatch])},useMemoCache:ch,useCacheRefresh:Lp};Pp.useEffectEvent=Np;function jh(t,i,l,u){i=t.memoizedState,l=l(u,i),l=l==null?i:b({},i,l),t.memoizedState=l,t.lanes===0&&(t.updateQueue.baseState=l)}var wh={enqueueSetState:function(t,i,l){t=t._reactInternals;var u=Xn(),x=Ra(u);x.payload=i,l!=null&&(x.callback=l),i=_a(t,x,u),i!==null&&(Un(i,t,u),Ul(i,t,u))},enqueueReplaceState:function(t,i,l){t=t._reactInternals;var u=Xn(),x=Ra(u);x.tag=1,x.payload=i,l!=null&&(x.callback=l),i=_a(t,x,u),i!==null&&(Un(i,t,u),Ul(i,t,u))},enqueueForceUpdate:function(t,i){t=t._reactInternals;var l=Xn(),u=Ra(l);u.tag=2,i!=null&&(u.callback=i),i=_a(t,u,l),i!==null&&(Un(i,t,l),Ul(i,t,l))}};function qp(t,i,l,u,x,g,z){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,g,z):i.prototype&&i.prototype.isPureReactComponent?!El(l,u)||!El(x,g):!0}function Fp(t,i,l,u){t=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(l,u),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(l,u),i.state!==t&&wh.enqueueReplaceState(i,i.state,null)}function Oi(t,i){var l=i;if("ref"in i){l={};for(var u in i)u!=="ref"&&(l[u]=i[u])}if(t=t.defaultProps){l===i&&(l=b({},l));for(var x in t)l[x]===void 0&&(l[x]=t[x])}return l}function $p(t){rc(t)}function Vp(t){console.error(t)}function Gp(t){rc(t)}function Ec(t,i){try{var l=t.onUncaughtError;l(i.value,{componentStack:i.stack})}catch(u){setTimeout(function(){throw u})}}function Yp(t,i,l){try{var u=t.onCaughtError;u(l.value,{componentStack:l.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function zh(t,i,l){return l=Ra(l),l.tag=3,l.payload={element:null},l.callback=function(){Ec(t,i)},l}function Qp(t){return t=Ra(t),t.tag=3,t}function Jp(t,i,l,u){var x=l.type.getDerivedStateFromError;if(typeof x=="function"){var g=u.value;t.payload=function(){return x(g)},t.callback=function(){Yp(i,l,u)}}var z=l.stateNode;z!==null&&typeof z.componentDidCatch=="function"&&(t.callback=function(){Yp(i,l,u),typeof x!="function"&&(Pa===null?Pa=new Set([this]):Pa.add(this));var M=u.stack;this.componentDidCatch(u.value,{componentStack:M!==null?M:""})})}function hz(t,i,l,u,x){if(l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(i=l.alternate,i!==null&&gr(i,l,x,!0),l=Gn.current,l!==null){switch(l.tag){case 31:case 13:return us===null?Pc():l.alternate===null&&St===0&&(St=3),l.flags&=-257,l.flags|=65536,l.lanes=x,u===pc?l.flags|=16384:(i=l.updateQueue,i===null?l.updateQueue=new Set([u]):i.add(u),Qh(t,u,x)),!1;case 22:return l.flags|=65536,u===pc?l.flags|=16384:(i=l.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([u])},l.updateQueue=i):(l=i.retryQueue,l===null?i.retryQueue=new Set([u]):l.add(u)),Qh(t,u,x)),!1}throw Error(r(435,l.tag))}return Qh(t,u,x),Pc(),!1}if(Ze)return i=Gn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=x,u!==qd&&(t=Error(r(422),{cause:u}),Dl(rs(t,l)))):(u!==qd&&(i=Error(r(423),{cause:u}),Dl(rs(i,l))),t=t.current.alternate,t.flags|=65536,x&=-x,t.lanes|=x,u=rs(u,l),x=zh(t.stateNode,u,x),Wd(t,x),St!==4&&(St=2)),!1;var g=Error(r(520),{cause:u});if(g=rs(g,l),Kl===null?Kl=[g]:Kl.push(g),St!==4&&(St=2),i===null)return!0;u=rs(u,l),l=i;do{switch(l.tag){case 3:return l.flags|=65536,t=x&-x,l.lanes|=t,t=zh(l.stateNode,u,t),Wd(l,t),!1;case 1:if(i=l.type,g=l.stateNode,(l.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(Pa===null||!Pa.has(g))))return l.flags|=65536,x&=-x,l.lanes|=x,x=Qp(x),Jp(x,t,l,u),Wd(l,x),!1}l=l.return}while(l!==null);return!1}var Nh=Error(r(461)),Rt=!1;function rn(t,i,l,u){i.child=t===null?Wx(i,null,l,u):Mi(i,t.child,l,u)}function Xp(t,i,l,u,x){l=l.render;var g=i.ref;if("ref"in u){var z={};for(var M in u)M!=="ref"&&(z[M]=u[M])}else z=u;return Ci(i),u=ih(t,i,l,z,g,x),M=rh(),t!==null&&!Rt?(lh(t,i,x),ra(t,i,x)):(Ze&&M&&Hd(i),i.flags|=1,rn(t,i,u,x),i.child)}function Kp(t,i,l,u,x){if(t===null){var g=l.type;return typeof g=="function"&&!Ud(g)&&g.defaultProps===void 0&&l.compare===null?(i.tag=15,i.type=g,Zp(t,i,g,u,x)):(t=uc(l.type,null,u,i,i.mode,x),t.ref=i.ref,t.return=i,i.child=t)}if(g=t.child,!Dh(t,x)){var z=g.memoizedProps;if(l=l.compare,l=l!==null?l:El,l(z,u)&&t.ref===i.ref)return ra(t,i,x)}return i.flags|=1,t=ea(g,u),t.ref=i.ref,t.return=i,i.child=t}function Zp(t,i,l,u,x){if(t!==null){var g=t.memoizedProps;if(El(g,u)&&t.ref===i.ref)if(Rt=!1,i.pendingProps=u=g,Dh(t,x))(t.flags&131072)!==0&&(Rt=!0);else return i.lanes=t.lanes,ra(t,i,x)}return kh(t,i,l,u,x)}function Wp(t,i,l,u){var x=u.children,g=t!==null?t.memoizedState:null;if(t===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((i.flags&128)!==0){if(g=g!==null?g.baseLanes|l:l,t!==null){for(u=i.child=t.child,x=0;u!==null;)x=x|u.lanes|u.childLanes,u=u.sibling;u=x&~g}else u=0,i.child=null;return eg(t,i,g,l,u)}if((l&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},t!==null&&mc(i,g!==null?g.cachePool:null),g!==null?np(i,g):th(),sp(i);else return u=i.lanes=536870912,eg(t,i,g!==null?g.baseLanes|l:l,l,u)}else g!==null?(mc(i,g.cachePool),np(i,g),Ua(),i.memoizedState=null):(t!==null&&mc(i,null),th(),Ua());return rn(t,i,x,l),i.child}function $l(t,i){return t!==null&&t.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function eg(t,i,l,u,x){var g=Jd();return g=g===null?null:{parent:Dt._currentValue,pool:g},i.memoizedState={baseLanes:l,cachePool:g},t!==null&&mc(i,null),th(),sp(i),t!==null&&gr(t,i,u,!0),i.childLanes=x,null}function Ac(t,i){return i=Dc({mode:i.mode,children:i.children},t.mode),i.ref=t.ref,t.child=i,i.return=t,i}function tg(t,i,l){return Mi(i,t.child,null,l),t=Ac(i,i.pendingProps),t.flags|=2,Yn(i),i.memoizedState=null,t}function fz(t,i,l){var u=i.pendingProps,x=(i.flags&128)!==0;if(i.flags&=-129,t===null){if(Ze){if(u.mode==="hidden")return t=Ac(i,u),i.lanes=536870912,$l(null,t);if(sh(i),(t=bt)?(t=fb(t,cs),t=t!==null&&t.data==="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:Ea!==null?{id:_s,overflow:Ls}:null,retryLane:536870912,hydrationErrors:null},l=Bx(t),l.return=i,i.child=l,sn=i,bt=null)):t=null,t===null)throw Ma(i);return i.lanes=536870912,null}return Ac(i,u)}var g=t.memoizedState;if(g!==null){var z=g.dehydrated;if(sh(i),x)if(i.flags&256)i.flags&=-257,i=tg(t,i,l);else if(i.memoizedState!==null)i.child=t.child,i.flags|=128,i=null;else throw Error(r(558));else if(Rt||gr(t,i,l,!1),x=(l&t.childLanes)!==0,Rt||x){if(u=ft,u!==null&&(z=ys(u,l),z!==0&&z!==g.retryLane))throw g.retryLane=z,zi(t,z),Un(u,t,z),Nh;Pc(),i=tg(t,i,l)}else t=g.treeContext,bt=ds(z.nextSibling),sn=i,Ze=!0,Aa=null,cs=!1,t!==null&&Px(i,t),i=Ac(i,u),i.flags|=4096;return i}return t=ea(t.child,{mode:u.mode,children:u.children}),t.ref=i.ref,i.child=t,t.return=i,t}function Mc(t,i){var l=i.ref;if(l===null)t!==null&&t.ref!==null&&(i.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(r(284));(t===null||t.ref!==l)&&(i.flags|=4194816)}}function kh(t,i,l,u,x){return Ci(i),l=ih(t,i,l,u,void 0,x),u=rh(),t!==null&&!Rt?(lh(t,i,x),ra(t,i,x)):(Ze&&u&&Hd(i),i.flags|=1,rn(t,i,l,x),i.child)}function ng(t,i,l,u,x,g){return Ci(i),i.updateQueue=null,l=ip(i,u,l,x),ap(t),u=rh(),t!==null&&!Rt?(lh(t,i,g),ra(t,i,g)):(Ze&&u&&Hd(i),i.flags|=1,rn(t,i,l,g),i.child)}function sg(t,i,l,u,x){if(Ci(i),i.stateNode===null){var g=fr,z=l.contextType;typeof z=="object"&&z!==null&&(g=an(z)),g=new l(u,g),i.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=wh,i.stateNode=g,g._reactInternals=i,g=i.stateNode,g.props=u,g.state=i.memoizedState,g.refs={},Kd(i),z=l.contextType,g.context=typeof z=="object"&&z!==null?an(z):fr,g.state=i.memoizedState,z=l.getDerivedStateFromProps,typeof z=="function"&&(jh(i,l,z,u),g.state=i.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(z=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),z!==g.state&&wh.enqueueReplaceState(g,g.state,null),Il(i,u,g,x),Bl(),g.state=i.memoizedState),typeof g.componentDidMount=="function"&&(i.flags|=4194308),u=!0}else if(t===null){g=i.stateNode;var M=i.memoizedProps,q=Oi(l,M);g.props=q;var J=g.context,ie=l.contextType;z=fr,typeof ie=="object"&&ie!==null&&(z=an(ie));var ue=l.getDerivedStateFromProps;ie=typeof ue=="function"||typeof g.getSnapshotBeforeUpdate=="function",M=i.pendingProps!==M,ie||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(M||J!==z)&&Fp(i,g,u,z),Oa=!1;var K=i.memoizedState;g.state=K,Il(i,u,g,x),Bl(),J=i.memoizedState,M||K!==J||Oa?(typeof ue=="function"&&(jh(i,l,ue,u),J=i.memoizedState),(q=Oa||qp(i,l,q,u,K,J,z))?(ie||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(i.flags|=4194308)):(typeof g.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=u,i.memoizedState=J),g.props=u,g.state=J,g.context=z,u=q):(typeof g.componentDidMount=="function"&&(i.flags|=4194308),u=!1)}else{g=i.stateNode,Zd(t,i),z=i.memoizedProps,ie=Oi(l,z),g.props=ie,ue=i.pendingProps,K=g.context,J=l.contextType,q=fr,typeof J=="object"&&J!==null&&(q=an(J)),M=l.getDerivedStateFromProps,(J=typeof M=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(z!==ue||K!==q)&&Fp(i,g,u,q),Oa=!1,K=i.memoizedState,g.state=K,Il(i,u,g,x),Bl();var ne=i.memoizedState;z!==ue||K!==ne||Oa||t!==null&&t.dependencies!==null&&hc(t.dependencies)?(typeof M=="function"&&(jh(i,l,M,u),ne=i.memoizedState),(ie=Oa||qp(i,l,ie,u,K,ne,q)||t!==null&&t.dependencies!==null&&hc(t.dependencies))?(J||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(u,ne,q),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(u,ne,q)),typeof g.componentDidUpdate=="function"&&(i.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof g.componentDidUpdate!="function"||z===t.memoizedProps&&K===t.memoizedState||(i.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||z===t.memoizedProps&&K===t.memoizedState||(i.flags|=1024),i.memoizedProps=u,i.memoizedState=ne),g.props=u,g.state=ne,g.context=q,u=ie):(typeof g.componentDidUpdate!="function"||z===t.memoizedProps&&K===t.memoizedState||(i.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||z===t.memoizedProps&&K===t.memoizedState||(i.flags|=1024),u=!1)}return g=u,Mc(t,i),u=(i.flags&128)!==0,g||u?(g=i.stateNode,l=u&&typeof l.getDerivedStateFromError!="function"?null:g.render(),i.flags|=1,t!==null&&u?(i.child=Mi(i,t.child,null,x),i.child=Mi(i,null,l,x)):rn(t,i,l,x),i.memoizedState=g.state,t=i.child):t=ra(t,i,x),t}function ag(t,i,l,u){return ki(),i.flags|=256,rn(t,i,l,u),i.child}var Sh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ch(t){return{baseLanes:t,cachePool:Yx()}}function Th(t,i,l){return t=t!==null?t.childLanes&~l:0,i&&(t|=Jn),t}function ig(t,i,l){var u=i.pendingProps,x=!1,g=(i.flags&128)!==0,z;if((z=g)||(z=t!==null&&t.memoizedState===null?!1:(Et.current&2)!==0),z&&(x=!0,i.flags&=-129),z=(i.flags&32)!==0,i.flags&=-33,t===null){if(Ze){if(x?La(i):Ua(),(t=bt)?(t=fb(t,cs),t=t!==null&&t.data!=="&"?t:null,t!==null&&(i.memoizedState={dehydrated:t,treeContext:Ea!==null?{id:_s,overflow:Ls}:null,retryLane:536870912,hydrationErrors:null},l=Bx(t),l.return=i,i.child=l,sn=i,bt=null)):t=null,t===null)throw Ma(i);return df(t)?i.lanes=32:i.lanes=536870912,null}var M=u.children;return u=u.fallback,x?(Ua(),x=i.mode,M=Dc({mode:"hidden",children:M},x),u=Ni(u,x,l,null),M.return=i,u.return=i,M.sibling=u,i.child=M,u=i.child,u.memoizedState=Ch(l),u.childLanes=Th(t,z,l),i.memoizedState=Sh,$l(null,u)):(La(i),Eh(i,M))}var q=t.memoizedState;if(q!==null&&(M=q.dehydrated,M!==null)){if(g)i.flags&256?(La(i),i.flags&=-257,i=Ah(t,i,l)):i.memoizedState!==null?(Ua(),i.child=t.child,i.flags|=128,i=null):(Ua(),M=u.fallback,x=i.mode,u=Dc({mode:"visible",children:u.children},x),M=Ni(M,x,l,null),M.flags|=2,u.return=i,M.return=i,u.sibling=M,i.child=u,Mi(i,t.child,null,l),u=i.child,u.memoizedState=Ch(l),u.childLanes=Th(t,z,l),i.memoizedState=Sh,i=$l(null,u));else if(La(i),df(M)){if(z=M.nextSibling&&M.nextSibling.dataset,z)var J=z.dgst;z=J,u=Error(r(419)),u.stack="",u.digest=z,Dl({value:u,source:null,stack:null}),i=Ah(t,i,l)}else if(Rt||gr(t,i,l,!1),z=(l&t.childLanes)!==0,Rt||z){if(z=ft,z!==null&&(u=ys(z,l),u!==0&&u!==q.retryLane))throw q.retryLane=u,zi(t,u),Un(z,t,u),Nh;uf(M)||Pc(),i=Ah(t,i,l)}else uf(M)?(i.flags|=192,i.child=t.child,i=null):(t=q.treeContext,bt=ds(M.nextSibling),sn=i,Ze=!0,Aa=null,cs=!1,t!==null&&Px(i,t),i=Eh(i,u.children),i.flags|=4096);return i}return x?(Ua(),M=u.fallback,x=i.mode,q=t.child,J=q.sibling,u=ea(q,{mode:"hidden",children:u.children}),u.subtreeFlags=q.subtreeFlags&65011712,J!==null?M=ea(J,M):(M=Ni(M,x,l,null),M.flags|=2),M.return=i,u.return=i,u.sibling=M,i.child=u,$l(null,u),u=i.child,M=t.child.memoizedState,M===null?M=Ch(l):(x=M.cachePool,x!==null?(q=Dt._currentValue,x=x.parent!==q?{parent:q,pool:q}:x):x=Yx(),M={baseLanes:M.baseLanes|l,cachePool:x}),u.memoizedState=M,u.childLanes=Th(t,z,l),i.memoizedState=Sh,$l(t.child,u)):(La(i),l=t.child,t=l.sibling,l=ea(l,{mode:"visible",children:u.children}),l.return=i,l.sibling=null,t!==null&&(z=i.deletions,z===null?(i.deletions=[t],i.flags|=16):z.push(t)),i.child=l,i.memoizedState=null,l)}function Eh(t,i){return i=Dc({mode:"visible",children:i},t.mode),i.return=t,t.child=i}function Dc(t,i){return t=Vn(22,t,null,i),t.lanes=0,t}function Ah(t,i,l){return Mi(i,t.child,null,l),t=Eh(i,i.pendingProps.children),t.flags|=2,i.memoizedState=null,t}function rg(t,i,l){t.lanes|=i;var u=t.alternate;u!==null&&(u.lanes|=i),Vd(t.return,i,l)}function Mh(t,i,l,u,x,g){var z=t.memoizedState;z===null?t.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:u,tail:l,tailMode:x,treeForkCount:g}:(z.isBackwards=i,z.rendering=null,z.renderingStartTime=0,z.last=u,z.tail=l,z.tailMode=x,z.treeForkCount=g)}function lg(t,i,l){var u=i.pendingProps,x=u.revealOrder,g=u.tail;u=u.children;var z=Et.current,M=(z&2)!==0;if(M?(z=z&1|2,i.flags|=128):z&=1,O(Et,z),rn(t,i,u,l),u=Ze?Ml:0,!M&&t!==null&&(t.flags&128)!==0)e:for(t=i.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&rg(t,l,i);else if(t.tag===19)rg(t,l,i);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===i)break e;for(;t.sibling===null;){if(t.return===null||t.return===i)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(x){case"forwards":for(l=i.child,x=null;l!==null;)t=l.alternate,t!==null&&vc(t)===null&&(x=l),l=l.sibling;l=x,l===null?(x=i.child,i.child=null):(x=l.sibling,l.sibling=null),Mh(i,!1,x,l,g,u);break;case"backwards":case"unstable_legacy-backwards":for(l=null,x=i.child,i.child=null;x!==null;){if(t=x.alternate,t!==null&&vc(t)===null){i.child=x;break}t=x.sibling,x.sibling=l,l=x,x=t}Mh(i,!0,l,null,g,u);break;case"together":Mh(i,!1,null,null,void 0,u);break;default:i.memoizedState=null}return i.child}function ra(t,i,l){if(t!==null&&(i.dependencies=t.dependencies),Ha|=i.lanes,(l&i.childLanes)===0)if(t!==null){if(gr(t,i,l,!1),(l&i.childLanes)===0)return null}else return null;if(t!==null&&i.child!==t.child)throw Error(r(153));if(i.child!==null){for(t=i.child,l=ea(t,t.pendingProps),i.child=l,l.return=i;t.sibling!==null;)t=t.sibling,l=l.sibling=ea(t,t.pendingProps),l.return=i;l.sibling=null}return i.child}function Dh(t,i){return(t.lanes&i)!==0?!0:(t=t.dependencies,!!(t!==null&&hc(t)))}function mz(t,i,l){switch(i.tag){case 3:Xe(i,i.stateNode.containerInfo),Da(i,Dt,t.memoizedState.cache),ki();break;case 27:case 5:zt(i);break;case 4:Xe(i,i.stateNode.containerInfo);break;case 10:Da(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,sh(i),null;break;case 13:var u=i.memoizedState;if(u!==null)return u.dehydrated!==null?(La(i),i.flags|=128,null):(l&i.child.childLanes)!==0?ig(t,i,l):(La(i),t=ra(t,i,l),t!==null?t.sibling:null);La(i);break;case 19:var x=(t.flags&128)!==0;if(u=(l&i.childLanes)!==0,u||(gr(t,i,l,!1),u=(l&i.childLanes)!==0),x){if(u)return lg(t,i,l);i.flags|=128}if(x=i.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),O(Et,Et.current),u)break;return null;case 22:return i.lanes=0,Wp(t,i,l,i.pendingProps);case 24:Da(i,Dt,t.memoizedState.cache)}return ra(t,i,l)}function og(t,i,l){if(t!==null)if(t.memoizedProps!==i.pendingProps)Rt=!0;else{if(!Dh(t,l)&&(i.flags&128)===0)return Rt=!1,mz(t,i,l);Rt=(t.flags&131072)!==0}else Rt=!1,Ze&&(i.flags&1048576)!==0&&Hx(i,Ml,i.index);switch(i.lanes=0,i.tag){case 16:e:{var u=i.pendingProps;if(t=Ei(i.elementType),i.type=t,typeof t=="function")Ud(t)?(u=Oi(t,u),i.tag=1,i=sg(null,i,t,u,l)):(i.tag=0,i=kh(null,i,t,u,l));else{if(t!=null){var x=t.$$typeof;if(x===D){i.tag=11,i=Xp(null,i,t,u,l);break e}else if(x===B){i.tag=14,i=Kp(null,i,t,u,l);break e}}throw i=U(t)||t,Error(r(306,i,""))}}return i;case 0:return kh(t,i,i.type,i.pendingProps,l);case 1:return u=i.type,x=Oi(u,i.pendingProps),sg(t,i,u,x,l);case 3:e:{if(Xe(i,i.stateNode.containerInfo),t===null)throw Error(r(387));u=i.pendingProps;var g=i.memoizedState;x=g.element,Zd(t,i),Il(i,u,null,l);var z=i.memoizedState;if(u=z.cache,Da(i,Dt,u),u!==g.cache&&Gd(i,[Dt],l,!0),Bl(),u=z.element,g.isDehydrated)if(g={element:u,isDehydrated:!1,cache:z.cache},i.updateQueue.baseState=g,i.memoizedState=g,i.flags&256){i=ag(t,i,u,l);break e}else if(u!==x){x=rs(Error(r(424)),i),Dl(x),i=ag(t,i,u,l);break e}else{switch(t=i.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(bt=ds(t.firstChild),sn=i,Ze=!0,Aa=null,cs=!0,l=Wx(i,null,u,l),i.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(ki(),u===x){i=ra(t,i,l);break e}rn(t,i,u,l)}i=i.child}return i;case 26:return Mc(t,i),t===null?(l=yb(i.type,null,i.pendingProps,null))?i.memoizedState=l:Ze||(l=i.type,t=i.pendingProps,u=Qc(ae.current).createElement(l),u[nn]=i,u[Mn]=t,ln(u,l,t),Qt(u),i.stateNode=u):i.memoizedState=yb(i.type,t.memoizedProps,i.pendingProps,t.memoizedState),null;case 27:return zt(i),t===null&&Ze&&(u=i.stateNode=pb(i.type,i.pendingProps,ae.current),sn=i,cs=!0,x=bt,Va(i.type)?(hf=x,bt=ds(u.firstChild)):bt=x),rn(t,i,i.pendingProps.children,l),Mc(t,i),t===null&&(i.flags|=4194304),i.child;case 5:return t===null&&Ze&&((x=u=bt)&&(u=$z(u,i.type,i.pendingProps,cs),u!==null?(i.stateNode=u,sn=i,bt=ds(u.firstChild),cs=!1,x=!0):x=!1),x||Ma(i)),zt(i),x=i.type,g=i.pendingProps,z=t!==null?t.memoizedProps:null,u=g.children,lf(x,g)?u=null:z!==null&&lf(x,z)&&(i.flags|=32),i.memoizedState!==null&&(x=ih(t,i,iz,null,null,l),io._currentValue=x),Mc(t,i),rn(t,i,u,l),i.child;case 6:return t===null&&Ze&&((t=l=bt)&&(l=Vz(l,i.pendingProps,cs),l!==null?(i.stateNode=l,sn=i,bt=null,t=!0):t=!1),t||Ma(i)),null;case 13:return ig(t,i,l);case 4:return Xe(i,i.stateNode.containerInfo),u=i.pendingProps,t===null?i.child=Mi(i,null,u,l):rn(t,i,u,l),i.child;case 11:return Xp(t,i,i.type,i.pendingProps,l);case 7:return rn(t,i,i.pendingProps,l),i.child;case 8:return rn(t,i,i.pendingProps.children,l),i.child;case 12:return rn(t,i,i.pendingProps.children,l),i.child;case 10:return u=i.pendingProps,Da(i,i.type,u.value),rn(t,i,u.children,l),i.child;case 9:return x=i.type._context,u=i.pendingProps.children,Ci(i),x=an(x),u=u(x),i.flags|=1,rn(t,i,u,l),i.child;case 14:return Kp(t,i,i.type,i.pendingProps,l);case 15:return Zp(t,i,i.type,i.pendingProps,l);case 19:return lg(t,i,l);case 31:return fz(t,i,l);case 22:return Wp(t,i,l,i.pendingProps);case 24:return Ci(i),u=an(Dt),t===null?(x=Jd(),x===null&&(x=ft,g=Yd(),x.pooledCache=g,g.refCount++,g!==null&&(x.pooledCacheLanes|=l),x=g),i.memoizedState={parent:u,cache:x},Kd(i),Da(i,Dt,x)):((t.lanes&l)!==0&&(Zd(t,i),Il(i,null,null,l),Bl()),x=t.memoizedState,g=i.memoizedState,x.parent!==u?(x={parent:u,cache:u},i.memoizedState=x,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=x),Da(i,Dt,u)):(u=g.cache,Da(i,Dt,u),u!==x.cache&&Gd(i,[Dt],l,!0))),rn(t,i,i.pendingProps.children,l),i.child;case 29:throw i.pendingProps}throw Error(r(156,i.tag))}function la(t){t.flags|=4}function Oh(t,i,l,u,x){if((i=(t.mode&32)!==0)&&(i=!1),i){if(t.flags|=16777216,(x&335544128)===x)if(t.stateNode.complete)t.flags|=8192;else if(_g())t.flags|=8192;else throw Ai=pc,Xd}else t.flags&=-16777217}function cg(t,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Nb(i))if(_g())t.flags|=8192;else throw Ai=pc,Xd}function Oc(t,i){i!==null&&(t.flags|=4),t.flags&16384&&(i=t.tag!==22?ht():536870912,t.lanes|=i,Er|=i)}function Vl(t,i){if(!Ze)switch(t.tailMode){case"hidden":i=t.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.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?i||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function yt(t){var i=t.alternate!==null&&t.alternate.child===t.child,l=0,u=0;if(i)for(var x=t.child;x!==null;)l|=x.lanes|x.childLanes,u|=x.subtreeFlags&65011712,u|=x.flags&65011712,x.return=t,x=x.sibling;else for(x=t.child;x!==null;)l|=x.lanes|x.childLanes,u|=x.subtreeFlags,u|=x.flags,x.return=t,x=x.sibling;return t.subtreeFlags|=u,t.childLanes=l,i}function xz(t,i,l){var u=i.pendingProps;switch(Pd(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return yt(i),null;case 1:return yt(i),null;case 3:return l=i.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),sa(Dt),Fe(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(t===null||t.child===null)&&(pr(i)?la(i):t===null||t.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Fd())),yt(i),null;case 26:var x=i.type,g=i.memoizedState;return t===null?(la(i),g!==null?(yt(i),cg(i,g)):(yt(i),Oh(i,x,null,u,l))):g?g!==t.memoizedState?(la(i),yt(i),cg(i,g)):(yt(i),i.flags&=-16777217):(t=t.memoizedProps,t!==u&&la(i),yt(i),Oh(i,x,t,u,l)),null;case 27:if(It(i),l=ae.current,x=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==u&&la(i);else{if(!u){if(i.stateNode===null)throw Error(r(166));return yt(i),null}t=de.current,pr(i)?qx(i):(t=pb(x,u,l),i.stateNode=t,la(i))}return yt(i),null;case 5:if(It(i),x=i.type,t!==null&&i.stateNode!=null)t.memoizedProps!==u&&la(i);else{if(!u){if(i.stateNode===null)throw Error(r(166));return yt(i),null}if(g=de.current,pr(i))qx(i);else{var z=Qc(ae.current);switch(g){case 1:g=z.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:g=z.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":g=z.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":g=z.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":g=z.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof u.is=="string"?z.createElement("select",{is:u.is}):z.createElement("select"),u.multiple?g.multiple=!0:u.size&&(g.size=u.size);break;default:g=typeof u.is=="string"?z.createElement(x,{is:u.is}):z.createElement(x)}}g[nn]=i,g[Mn]=u;e:for(z=i.child;z!==null;){if(z.tag===5||z.tag===6)g.appendChild(z.stateNode);else if(z.tag!==4&&z.tag!==27&&z.child!==null){z.child.return=z,z=z.child;continue}if(z===i)break e;for(;z.sibling===null;){if(z.return===null||z.return===i)break e;z=z.return}z.sibling.return=z.return,z=z.sibling}i.stateNode=g;e:switch(ln(g,x,u),x){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&la(i)}}return yt(i),Oh(i,i.type,t===null?null:t.memoizedProps,i.pendingProps,l),null;case 6:if(t&&i.stateNode!=null)t.memoizedProps!==u&&la(i);else{if(typeof u!="string"&&i.stateNode===null)throw Error(r(166));if(t=ae.current,pr(i)){if(t=i.stateNode,l=i.memoizedProps,u=null,x=sn,x!==null)switch(x.tag){case 27:case 5:u=x.memoizedProps}t[nn]=i,t=!!(t.nodeValue===l||u!==null&&u.suppressHydrationWarning===!0||ib(t.nodeValue,l)),t||Ma(i,!0)}else t=Qc(t).createTextNode(u),t[nn]=i,i.stateNode=t}return yt(i),null;case 31:if(l=i.memoizedState,t===null||t.memoizedState!==null){if(u=pr(i),l!==null){if(t===null){if(!u)throw Error(r(318));if(t=i.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(557));t[nn]=i}else ki(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;yt(i),t=!1}else l=Fd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=l),t=!0;if(!t)return i.flags&256?(Yn(i),i):(Yn(i),null);if((i.flags&128)!==0)throw Error(r(558))}return yt(i),null;case 13:if(u=i.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(x=pr(i),u!==null&&u.dehydrated!==null){if(t===null){if(!x)throw Error(r(318));if(x=i.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[nn]=i}else ki(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;yt(i),x=!1}else x=Fd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=x),x=!0;if(!x)return i.flags&256?(Yn(i),i):(Yn(i),null)}return Yn(i),(i.flags&128)!==0?(i.lanes=l,i):(l=u!==null,t=t!==null&&t.memoizedState!==null,l&&(u=i.child,x=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(x=u.alternate.memoizedState.cachePool.pool),g=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(g=u.memoizedState.cachePool.pool),g!==x&&(u.flags|=2048)),l!==t&&l&&(i.child.flags|=8192),Oc(i,i.updateQueue),yt(i),null);case 4:return Fe(),t===null&&tf(i.stateNode.containerInfo),yt(i),null;case 10:return sa(i.type),yt(i),null;case 19:if(Y(Et),u=i.memoizedState,u===null)return yt(i),null;if(x=(i.flags&128)!==0,g=u.rendering,g===null)if(x)Vl(u,!1);else{if(St!==0||t!==null&&(t.flags&128)!==0)for(t=i.child;t!==null;){if(g=vc(t),g!==null){for(i.flags|=128,Vl(u,!1),t=g.updateQueue,i.updateQueue=t,Oc(i,t),i.subtreeFlags=0,t=l,l=i.child;l!==null;)Ux(l,t),l=l.sibling;return O(Et,Et.current&1|2),Ze&&ta(i,u.treeForkCount),i.child}t=t.sibling}u.tail!==null&&Me()>Bc&&(i.flags|=128,x=!0,Vl(u,!1),i.lanes=4194304)}else{if(!x)if(t=vc(g),t!==null){if(i.flags|=128,x=!0,t=t.updateQueue,i.updateQueue=t,Oc(i,t),Vl(u,!0),u.tail===null&&u.tailMode==="hidden"&&!g.alternate&&!Ze)return yt(i),null}else 2*Me()-u.renderingStartTime>Bc&&l!==536870912&&(i.flags|=128,x=!0,Vl(u,!1),i.lanes=4194304);u.isBackwards?(g.sibling=i.child,i.child=g):(t=u.last,t!==null?t.sibling=g:i.child=g,u.last=g)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=Me(),t.sibling=null,l=Et.current,O(Et,x?l&1|2:l&1),Ze&&ta(i,u.treeForkCount),t):(yt(i),null);case 22:case 23:return Yn(i),nh(),u=i.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(i.flags|=8192):u&&(i.flags|=8192),u?(l&536870912)!==0&&(i.flags&128)===0&&(yt(i),i.subtreeFlags&6&&(i.flags|=8192)):yt(i),l=i.updateQueue,l!==null&&Oc(i,l.retryQueue),l=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),u=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),u!==l&&(i.flags|=2048),t!==null&&Y(Ti),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),i.memoizedState.cache!==l&&(i.flags|=2048),sa(Dt),yt(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function pz(t,i){switch(Pd(i),i.tag){case 1:return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return sa(Dt),Fe(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 26:case 27:case 5:return It(i),null;case 31:if(i.memoizedState!==null){if(Yn(i),i.alternate===null)throw Error(r(340));ki()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 13:if(Yn(i),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(r(340));ki()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return Y(Et),null;case 4:return Fe(),null;case 10:return sa(i.type),null;case 22:case 23:return Yn(i),nh(),t!==null&&Y(Ti),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 24:return sa(Dt),null;case 25:return null;default:return null}}function ug(t,i){switch(Pd(i),i.tag){case 3:sa(Dt),Fe();break;case 26:case 27:case 5:It(i);break;case 4:Fe();break;case 31:i.memoizedState!==null&&Yn(i);break;case 13:Yn(i);break;case 19:Y(Et);break;case 10:sa(i.type);break;case 22:case 23:Yn(i),nh(),t!==null&&Y(Ti);break;case 24:sa(Dt)}}function Gl(t,i){try{var l=i.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var x=u.next;l=x;do{if((l.tag&t)===t){u=void 0;var g=l.create,z=l.inst;u=g(),z.destroy=u}l=l.next}while(l!==x)}}catch(M){ot(i,i.return,M)}}function Ba(t,i,l){try{var u=i.updateQueue,x=u!==null?u.lastEffect:null;if(x!==null){var g=x.next;u=g;do{if((u.tag&t)===t){var z=u.inst,M=z.destroy;if(M!==void 0){z.destroy=void 0,x=i;var q=l,J=M;try{J()}catch(ie){ot(x,q,ie)}}}u=u.next}while(u!==g)}}catch(ie){ot(i,i.return,ie)}}function dg(t){var i=t.updateQueue;if(i!==null){var l=t.stateNode;try{tp(i,l)}catch(u){ot(t,t.return,u)}}}function hg(t,i,l){l.props=Oi(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(u){ot(t,i,u)}}function Yl(t,i){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(x){ot(t,i,x)}}function Us(t,i){var l=t.ref,u=t.refCleanup;if(l!==null)if(typeof u=="function")try{u()}catch(x){ot(t,i,x)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(x){ot(t,i,x)}else l.current=null}function fg(t){var i=t.type,l=t.memoizedProps,u=t.stateNode;try{e:switch(i){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(x){ot(t,t.return,x)}}function Rh(t,i,l){try{var u=t.stateNode;Bz(u,t.type,l,i),u[Mn]=i}catch(x){ot(t,t.return,x)}}function mg(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Va(t.type)||t.tag===4}function _h(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||mg(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&&Va(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 Lh(t,i,l){var u=t.tag;if(u===5||u===6)t=t.stateNode,i?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(t,i):(i=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,i.appendChild(t),l=l._reactRootContainer,l!=null||i.onclick!==null||(i.onclick=Zs));else if(u!==4&&(u===27&&Va(t.type)&&(l=t.stateNode,i=null),t=t.child,t!==null))for(Lh(t,i,l),t=t.sibling;t!==null;)Lh(t,i,l),t=t.sibling}function Rc(t,i,l){var u=t.tag;if(u===5||u===6)t=t.stateNode,i?l.insertBefore(t,i):l.appendChild(t);else if(u!==4&&(u===27&&Va(t.type)&&(l=t.stateNode),t=t.child,t!==null))for(Rc(t,i,l),t=t.sibling;t!==null;)Rc(t,i,l),t=t.sibling}function xg(t){var i=t.stateNode,l=t.memoizedProps;try{for(var u=t.type,x=i.attributes;x.length;)i.removeAttributeNode(x[0]);ln(i,u,l),i[nn]=t,i[Mn]=l}catch(g){ot(t,t.return,g)}}var oa=!1,_t=!1,Uh=!1,pg=typeof WeakSet=="function"?WeakSet:Set,Jt=null;function gz(t,i){if(t=t.containerInfo,af=tu,t=Tx(t),Ad(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 x=u.anchorOffset,g=u.focusNode;u=u.focusOffset;try{l.nodeType,g.nodeType}catch{l=null;break e}var z=0,M=-1,q=-1,J=0,ie=0,ue=t,K=null;t:for(;;){for(var ne;ue!==l||x!==0&&ue.nodeType!==3||(M=z+x),ue!==g||u!==0&&ue.nodeType!==3||(q=z+u),ue.nodeType===3&&(z+=ue.nodeValue.length),(ne=ue.firstChild)!==null;)K=ue,ue=ne;for(;;){if(ue===t)break t;if(K===l&&++J===x&&(M=z),K===g&&++ie===u&&(q=z),(ne=ue.nextSibling)!==null)break;ue=K,K=ue.parentNode}ue=ne}l=M===-1||q===-1?null:{start:M,end:q}}else l=null}l=l||{start:0,end:0}}else l=null;for(rf={focusedElem:t,selectionRange:l},tu=!1,Jt=i;Jt!==null;)if(i=Jt,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,Jt=t;else for(;Jt!==null;){switch(i=Jt,g=i.alternate,t=i.flags,i.tag){case 0:if((t&4)!==0&&(t=i.updateQueue,t=t!==null?t.events:null,t!==null))for(l=0;l<t.length;l++)x=t[l],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&g!==null){t=void 0,l=i,x=g.memoizedProps,g=g.memoizedState,u=l.stateNode;try{var we=Oi(l.type,x);t=u.getSnapshotBeforeUpdate(we,g),u.__reactInternalSnapshotBeforeUpdate=t}catch(Ae){ot(l,l.return,Ae)}}break;case 3:if((t&1024)!==0){if(t=i.stateNode.containerInfo,l=t.nodeType,l===9)cf(t);else if(l===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":cf(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(r(163))}if(t=i.sibling,t!==null){t.return=i.return,Jt=t;break}Jt=i.return}}function gg(t,i,l){var u=l.flags;switch(l.tag){case 0:case 11:case 15:ua(t,l),u&4&&Gl(5,l);break;case 1:if(ua(t,l),u&4)if(t=l.stateNode,i===null)try{t.componentDidMount()}catch(z){ot(l,l.return,z)}else{var x=Oi(l.type,i.memoizedProps);i=i.memoizedState;try{t.componentDidUpdate(x,i,t.__reactInternalSnapshotBeforeUpdate)}catch(z){ot(l,l.return,z)}}u&64&&dg(l),u&512&&Yl(l,l.return);break;case 3:if(ua(t,l),u&64&&(t=l.updateQueue,t!==null)){if(i=null,l.child!==null)switch(l.child.tag){case 27:case 5:i=l.child.stateNode;break;case 1:i=l.child.stateNode}try{tp(t,i)}catch(z){ot(l,l.return,z)}}break;case 27:i===null&&u&4&&xg(l);case 26:case 5:ua(t,l),i===null&&u&4&&fg(l),u&512&&Yl(l,l.return);break;case 12:ua(t,l);break;case 31:ua(t,l),u&4&&vg(t,l);break;case 13:ua(t,l),u&4&&jg(t,l),u&64&&(t=l.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(l=Sz.bind(null,l),Gz(t,l))));break;case 22:if(u=l.memoizedState!==null||oa,!u){i=i!==null&&i.memoizedState!==null||_t,x=oa;var g=_t;oa=u,(_t=i)&&!g?da(t,l,(l.subtreeFlags&8772)!==0):ua(t,l),oa=x,_t=g}break;case 30:break;default:ua(t,l)}}function bg(t){var i=t.alternate;i!==null&&(t.alternate=null,bg(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&fd(i)),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 jt=null,On=!1;function ca(t,i,l){for(l=l.child;l!==null;)yg(t,i,l),l=l.sibling}function yg(t,i,l){if(pt&&typeof pt.onCommitFiberUnmount=="function")try{pt.onCommitFiberUnmount(Ht,l)}catch{}switch(l.tag){case 26:_t||Us(l,i),ca(t,i,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:_t||Us(l,i);var u=jt,x=On;Va(l.type)&&(jt=l.stateNode,On=!1),ca(t,i,l),no(l.stateNode),jt=u,On=x;break;case 5:_t||Us(l,i);case 6:if(u=jt,x=On,jt=null,ca(t,i,l),jt=u,On=x,jt!==null)if(On)try{(jt.nodeType===9?jt.body:jt.nodeName==="HTML"?jt.ownerDocument.body:jt).removeChild(l.stateNode)}catch(g){ot(l,i,g)}else try{jt.removeChild(l.stateNode)}catch(g){ot(l,i,g)}break;case 18:jt!==null&&(On?(t=jt,db(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,l.stateNode),Ur(t)):db(jt,l.stateNode));break;case 4:u=jt,x=On,jt=l.stateNode.containerInfo,On=!0,ca(t,i,l),jt=u,On=x;break;case 0:case 11:case 14:case 15:Ba(2,l,i),_t||Ba(4,l,i),ca(t,i,l);break;case 1:_t||(Us(l,i),u=l.stateNode,typeof u.componentWillUnmount=="function"&&hg(l,i,u)),ca(t,i,l);break;case 21:ca(t,i,l);break;case 22:_t=(u=_t)||l.memoizedState!==null,ca(t,i,l),_t=u;break;default:ca(t,i,l)}}function vg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Ur(t)}catch(l){ot(i,i.return,l)}}}function jg(t,i){if(i.memoizedState===null&&(t=i.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Ur(t)}catch(l){ot(i,i.return,l)}}function bz(t){switch(t.tag){case 31:case 13:case 19:var i=t.stateNode;return i===null&&(i=t.stateNode=new pg),i;case 22:return t=t.stateNode,i=t._retryCache,i===null&&(i=t._retryCache=new pg),i;default:throw Error(r(435,t.tag))}}function _c(t,i){var l=bz(t);i.forEach(function(u){if(!l.has(u)){l.add(u);var x=Cz.bind(null,t,u);u.then(x,x)}})}function Rn(t,i){var l=i.deletions;if(l!==null)for(var u=0;u<l.length;u++){var x=l[u],g=t,z=i,M=z;e:for(;M!==null;){switch(M.tag){case 27:if(Va(M.type)){jt=M.stateNode,On=!1;break e}break;case 5:jt=M.stateNode,On=!1;break e;case 3:case 4:jt=M.stateNode.containerInfo,On=!0;break e}M=M.return}if(jt===null)throw Error(r(160));yg(g,z,x),jt=null,On=!1,g=x.alternate,g!==null&&(g.return=null),x.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)wg(i,t),i=i.sibling}var js=null;function wg(t,i){var l=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Rn(i,t),_n(t),u&4&&(Ba(3,t,t.return),Gl(3,t),Ba(5,t,t.return));break;case 1:Rn(i,t),_n(t),u&512&&(_t||l===null||Us(l,l.return)),u&64&&oa&&(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 x=js;if(Rn(i,t),_n(t),u&512&&(_t||l===null||Us(l,l.return)),u&4){var g=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,x=x.ownerDocument||x;t:switch(u){case"title":g=x.getElementsByTagName("title")[0],(!g||g[vl]||g[nn]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=x.createElement(u),x.head.insertBefore(g,x.querySelector("head > title"))),ln(g,u,l),g[nn]=t,Qt(g),u=g;break e;case"link":var z=wb("link","href",x).get(u+(l.href||""));if(z){for(var M=0;M<z.length;M++)if(g=z[M],g.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&g.getAttribute("rel")===(l.rel==null?null:l.rel)&&g.getAttribute("title")===(l.title==null?null:l.title)&&g.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){z.splice(M,1);break t}}g=x.createElement(u),ln(g,u,l),x.head.appendChild(g);break;case"meta":if(z=wb("meta","content",x).get(u+(l.content||""))){for(M=0;M<z.length;M++)if(g=z[M],g.getAttribute("content")===(l.content==null?null:""+l.content)&&g.getAttribute("name")===(l.name==null?null:l.name)&&g.getAttribute("property")===(l.property==null?null:l.property)&&g.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&g.getAttribute("charset")===(l.charSet==null?null:l.charSet)){z.splice(M,1);break t}}g=x.createElement(u),ln(g,u,l),x.head.appendChild(g);break;default:throw Error(r(468,u))}g[nn]=t,Qt(g),u=g}t.stateNode=u}else zb(x,t.type,t.stateNode);else t.stateNode=jb(x,u,t.memoizedProps);else g!==u?(g===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):g.count--,u===null?zb(x,t.type,t.stateNode):jb(x,u,t.memoizedProps)):u===null&&t.stateNode!==null&&Rh(t,t.memoizedProps,l.memoizedProps)}break;case 27:Rn(i,t),_n(t),u&512&&(_t||l===null||Us(l,l.return)),l!==null&&u&4&&Rh(t,t.memoizedProps,l.memoizedProps);break;case 5:if(Rn(i,t),_n(t),u&512&&(_t||l===null||Us(l,l.return)),t.flags&32){x=t.stateNode;try{rr(x,"")}catch(we){ot(t,t.return,we)}}u&4&&t.stateNode!=null&&(x=t.memoizedProps,Rh(t,x,l!==null?l.memoizedProps:x)),u&1024&&(Uh=!0);break;case 6:if(Rn(i,t),_n(t),u&4){if(t.stateNode===null)throw Error(r(162));u=t.memoizedProps,l=t.stateNode;try{l.nodeValue=u}catch(we){ot(t,t.return,we)}}break;case 3:if(Kc=null,x=js,js=Jc(i.containerInfo),Rn(i,t),js=x,_n(t),u&4&&l!==null&&l.memoizedState.isDehydrated)try{Ur(i.containerInfo)}catch(we){ot(t,t.return,we)}Uh&&(Uh=!1,zg(t));break;case 4:u=js,js=Jc(t.stateNode.containerInfo),Rn(i,t),_n(t),js=u;break;case 12:Rn(i,t),_n(t);break;case 31:Rn(i,t),_n(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,_c(t,u)));break;case 13:Rn(i,t),_n(t),t.child.flags&8192&&t.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Uc=Me()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,_c(t,u)));break;case 22:x=t.memoizedState!==null;var q=l!==null&&l.memoizedState!==null,J=oa,ie=_t;if(oa=J||x,_t=ie||q,Rn(i,t),_t=ie,oa=J,_n(t),u&8192)e:for(i=t.stateNode,i._visibility=x?i._visibility&-2:i._visibility|1,x&&(l===null||q||oa||_t||Ri(t)),l=null,i=t;;){if(i.tag===5||i.tag===26){if(l===null){q=l=i;try{if(g=q.stateNode,x)z=g.style,typeof z.setProperty=="function"?z.setProperty("display","none","important"):z.display="none";else{M=q.stateNode;var ue=q.memoizedProps.style,K=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;M.style.display=K==null||typeof K=="boolean"?"":(""+K).trim()}}catch(we){ot(q,q.return,we)}}}else if(i.tag===6){if(l===null){q=i;try{q.stateNode.nodeValue=x?"":q.memoizedProps}catch(we){ot(q,q.return,we)}}}else if(i.tag===18){if(l===null){q=i;try{var ne=q.stateNode;x?hb(ne,!0):hb(q.stateNode,!1)}catch(we){ot(q,q.return,we)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===t)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;l===i&&(l=null),i=i.return}l===i&&(l=null),i.sibling.return=i.return,i=i.sibling}u&4&&(u=t.updateQueue,u!==null&&(l=u.retryQueue,l!==null&&(u.retryQueue=null,_c(t,l))));break;case 19:Rn(i,t),_n(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,_c(t,u)));break;case 30:break;case 21:break;default:Rn(i,t),_n(t)}}function _n(t){var i=t.flags;if(i&2){try{for(var l,u=t.return;u!==null;){if(mg(u)){l=u;break}u=u.return}if(l==null)throw Error(r(160));switch(l.tag){case 27:var x=l.stateNode,g=_h(t);Rc(t,g,x);break;case 5:var z=l.stateNode;l.flags&32&&(rr(z,""),l.flags&=-33);var M=_h(t);Rc(t,M,z);break;case 3:case 4:var q=l.stateNode.containerInfo,J=_h(t);Lh(t,J,q);break;default:throw Error(r(161))}}catch(ie){ot(t,t.return,ie)}t.flags&=-3}i&4096&&(t.flags&=-4097)}function zg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var i=t;zg(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),t=t.sibling}}function ua(t,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)gg(t,i.alternate,i),i=i.sibling}function Ri(t){for(t=t.child;t!==null;){var i=t;switch(i.tag){case 0:case 11:case 14:case 15:Ba(4,i,i.return),Ri(i);break;case 1:Us(i,i.return);var l=i.stateNode;typeof l.componentWillUnmount=="function"&&hg(i,i.return,l),Ri(i);break;case 27:no(i.stateNode);case 26:case 5:Us(i,i.return),Ri(i);break;case 22:i.memoizedState===null&&Ri(i);break;case 30:Ri(i);break;default:Ri(i)}t=t.sibling}}function da(t,i,l){for(l=l&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var u=i.alternate,x=t,g=i,z=g.flags;switch(g.tag){case 0:case 11:case 15:da(x,g,l),Gl(4,g);break;case 1:if(da(x,g,l),u=g,x=u.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(J){ot(u,u.return,J)}if(u=g,x=u.updateQueue,x!==null){var M=u.stateNode;try{var q=x.shared.hiddenCallbacks;if(q!==null)for(x.shared.hiddenCallbacks=null,x=0;x<q.length;x++)ep(q[x],M)}catch(J){ot(u,u.return,J)}}l&&z&64&&dg(g),Yl(g,g.return);break;case 27:xg(g);case 26:case 5:da(x,g,l),l&&u===null&&z&4&&fg(g),Yl(g,g.return);break;case 12:da(x,g,l);break;case 31:da(x,g,l),l&&z&4&&vg(x,g);break;case 13:da(x,g,l),l&&z&4&&jg(x,g);break;case 22:g.memoizedState===null&&da(x,g,l),Yl(g,g.return);break;case 30:break;default:da(x,g,l)}i=i.sibling}}function Bh(t,i){var l=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),t=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(t=i.memoizedState.cachePool.pool),t!==l&&(t!=null&&t.refCount++,l!=null&&Ol(l))}function Ih(t,i){t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&Ol(t))}function ws(t,i,l,u){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Ng(t,i,l,u),i=i.sibling}function Ng(t,i,l,u){var x=i.flags;switch(i.tag){case 0:case 11:case 15:ws(t,i,l,u),x&2048&&Gl(9,i);break;case 1:ws(t,i,l,u);break;case 3:ws(t,i,l,u),x&2048&&(t=null,i.alternate!==null&&(t=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==t&&(i.refCount++,t!=null&&Ol(t)));break;case 12:if(x&2048){ws(t,i,l,u),t=i.stateNode;try{var g=i.memoizedProps,z=g.id,M=g.onPostCommit;typeof M=="function"&&M(z,i.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(q){ot(i,i.return,q)}}else ws(t,i,l,u);break;case 31:ws(t,i,l,u);break;case 13:ws(t,i,l,u);break;case 23:break;case 22:g=i.stateNode,z=i.alternate,i.memoizedState!==null?g._visibility&2?ws(t,i,l,u):Ql(t,i):g._visibility&2?ws(t,i,l,u):(g._visibility|=2,Sr(t,i,l,u,(i.subtreeFlags&10256)!==0||!1)),x&2048&&Bh(z,i);break;case 24:ws(t,i,l,u),x&2048&&Ih(i.alternate,i);break;default:ws(t,i,l,u)}}function Sr(t,i,l,u,x){for(x=x&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var g=t,z=i,M=l,q=u,J=z.flags;switch(z.tag){case 0:case 11:case 15:Sr(g,z,M,q,x),Gl(8,z);break;case 23:break;case 22:var ie=z.stateNode;z.memoizedState!==null?ie._visibility&2?Sr(g,z,M,q,x):Ql(g,z):(ie._visibility|=2,Sr(g,z,M,q,x)),x&&J&2048&&Bh(z.alternate,z);break;case 24:Sr(g,z,M,q,x),x&&J&2048&&Ih(z.alternate,z);break;default:Sr(g,z,M,q,x)}i=i.sibling}}function Ql(t,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var l=t,u=i,x=u.flags;switch(u.tag){case 22:Ql(l,u),x&2048&&Bh(u.alternate,u);break;case 24:Ql(l,u),x&2048&&Ih(u.alternate,u);break;default:Ql(l,u)}i=i.sibling}}var Jl=8192;function Cr(t,i,l){if(t.subtreeFlags&Jl)for(t=t.child;t!==null;)kg(t,i,l),t=t.sibling}function kg(t,i,l){switch(t.tag){case 26:Cr(t,i,l),t.flags&Jl&&t.memoizedState!==null&&aN(l,js,t.memoizedState,t.memoizedProps);break;case 5:Cr(t,i,l);break;case 3:case 4:var u=js;js=Jc(t.stateNode.containerInfo),Cr(t,i,l),js=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=Jl,Jl=16777216,Cr(t,i,l),Jl=u):Cr(t,i,l));break;default:Cr(t,i,l)}}function Sg(t){var i=t.alternate;if(i!==null&&(t=i.child,t!==null)){i.child=null;do i=t.sibling,t.sibling=null,t=i;while(t!==null)}}function Xl(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var u=i[l];Jt=u,Tg(u,t)}Sg(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Cg(t),t=t.sibling}function Cg(t){switch(t.tag){case 0:case 11:case 15:Xl(t),t.flags&2048&&Ba(9,t,t.return);break;case 3:Xl(t);break;case 12:Xl(t);break;case 22:var i=t.stateNode;t.memoizedState!==null&&i._visibility&2&&(t.return===null||t.return.tag!==13)?(i._visibility&=-3,Lc(t)):Xl(t);break;default:Xl(t)}}function Lc(t){var i=t.deletions;if((t.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var u=i[l];Jt=u,Tg(u,t)}Sg(t)}for(t=t.child;t!==null;){switch(i=t,i.tag){case 0:case 11:case 15:Ba(8,i,i.return),Lc(i);break;case 22:l=i.stateNode,l._visibility&2&&(l._visibility&=-3,Lc(i));break;default:Lc(i)}t=t.sibling}}function Tg(t,i){for(;Jt!==null;){var l=Jt;switch(l.tag){case 0:case 11:case 15:Ba(8,l,i);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:Ol(l.memoizedState.cache)}if(u=l.child,u!==null)u.return=l,Jt=u;else e:for(l=t;Jt!==null;){u=Jt;var x=u.sibling,g=u.return;if(bg(u),u===l){Jt=null;break e}if(x!==null){x.return=g,Jt=x;break e}Jt=g}}}var yz={getCacheForType:function(t){var i=an(Dt),l=i.data.get(t);return l===void 0&&(l=t(),i.data.set(t,l)),l},cacheSignal:function(){return an(Dt).controller.signal}},vz=typeof WeakMap=="function"?WeakMap:Map,it=0,ft=null,Ve=null,Qe=0,lt=0,Qn=null,Ia=!1,Tr=!1,Hh=!1,ha=0,St=0,Ha=0,_i=0,Ph=0,Jn=0,Er=0,Kl=null,Ln=null,qh=!1,Uc=0,Eg=0,Bc=1/0,Ic=null,Pa=null,Pt=0,qa=null,Ar=null,fa=0,Fh=0,$h=null,Ag=null,Zl=0,Vh=null;function Xn(){return(it&2)!==0&&Qe!==0?Qe&-Qe:I.T!==null?Kh():G0()}function Mg(){if(Jn===0)if((Qe&536870912)===0||Ze){var t=Zi;Zi<<=1,(Zi&3932160)===0&&(Zi=262144),Jn=t}else Jn=536870912;return t=Gn.current,t!==null&&(t.flags|=32),Jn}function Un(t,i,l){(t===ft&&(lt===2||lt===9)||t.cancelPendingCommit!==null)&&(Mr(t,0),Fa(t,Qe,Jn,!1)),tn(t,l),((it&2)===0||t!==ft)&&(t===ft&&((it&2)===0&&(_i|=l),St===4&&Fa(t,Qe,Jn,!1)),Bs(t))}function Dg(t,i,l){if((it&6)!==0)throw Error(r(327));var u=!l&&(i&127)===0&&(i&t.expiredLanes)===0||De(t,i),x=u?zz(t,i):Yh(t,i,!0),g=u;do{if(x===0){Tr&&!u&&Fa(t,i,0,!1);break}else{if(l=t.current.alternate,g&&!jz(l)){x=Yh(t,i,!1),g=!1;continue}if(x===2){if(g=i,t.errorRecoveryDisabledLanes&g)var z=0;else z=t.pendingLanes&-536870913,z=z!==0?z:z&536870912?536870912:0;if(z!==0){i=z;e:{var M=t;x=Kl;var q=M.current.memoizedState.isDehydrated;if(q&&(Mr(M,z).flags|=256),z=Yh(M,z,!1),z!==2){if(Hh&&!q){M.errorRecoveryDisabledLanes|=g,_i|=g,x=4;break e}g=Ln,Ln=x,g!==null&&(Ln===null?Ln=g:Ln.push.apply(Ln,g))}x=z}if(g=!1,x!==2)continue}}if(x===1){Mr(t,0),Fa(t,i,0,!0);break}e:{switch(u=t,g=x,g){case 0:case 1:throw Error(r(345));case 4:if((i&4194048)!==i)break;case 6:Fa(u,i,Jn,!Ia);break e;case 2:Ln=null;break;case 3:case 5:break;default:throw Error(r(329))}if((i&62914560)===i&&(x=Uc+300-Me(),10<x)){if(Fa(u,i,Jn,!Ia),Wi(u,0,!0)!==0)break e;fa=i,u.timeoutHandle=cb(Og.bind(null,u,l,Ln,Ic,qh,i,Jn,_i,Er,Ia,g,"Throttled",-0,0),x);break e}Og(u,l,Ln,Ic,qh,i,Jn,_i,Er,Ia,g,null,-0,0)}}break}while(!0);Bs(t)}function Og(t,i,l,u,x,g,z,M,q,J,ie,ue,K,ne){if(t.timeoutHandle=-1,ue=i.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Zs},kg(i,g,ue);var we=(g&62914560)===g?Uc-Me():(g&4194048)===g?Eg-Me():0;if(we=iN(ue,we),we!==null){fa=g,t.cancelPendingCommit=we(Pg.bind(null,t,i,g,l,u,x,z,M,q,ie,ue,null,K,ne)),Fa(t,g,z,!J);return}}Pg(t,i,g,l,u,x,z,M,q)}function jz(t){for(var i=t;;){var l=i.tag;if((l===0||l===11||l===15)&&i.flags&16384&&(l=i.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var u=0;u<l.length;u++){var x=l[u],g=x.getSnapshot;x=x.value;try{if(!$n(g(),x))return!1}catch{return!1}}if(l=i.child,i.subtreeFlags&16384&&l!==null)l.return=i,i=l;else{if(i===t)break;for(;i.sibling===null;){if(i.return===null||i.return===t)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Fa(t,i,l,u){i&=~Ph,i&=~_i,t.suspendedLanes|=i,t.pingedLanes&=~i,u&&(t.warmLanes|=i),u=t.expirationTimes;for(var x=i;0<x;){var g=31-et(x),z=1<<g;u[g]=-1,x&=~z}l!==0&&Rs(t,l,i)}function Hc(){return(it&6)===0?(Wl(0),!1):!0}function Gh(){if(Ve!==null){if(lt===0)var t=Ve.return;else t=Ve,na=Si=null,oh(t),jr=null,_l=0,t=Ve;for(;t!==null;)ug(t.alternate,t),t=t.return;Ve=null}}function Mr(t,i){var l=t.timeoutHandle;l!==-1&&(t.timeoutHandle=-1,Pz(l)),l=t.cancelPendingCommit,l!==null&&(t.cancelPendingCommit=null,l()),fa=0,Gh(),ft=t,Ve=l=ea(t.current,null),Qe=i,lt=0,Qn=null,Ia=!1,Tr=De(t,i),Hh=!1,Er=Jn=Ph=_i=Ha=St=0,Ln=Kl=null,qh=!1,(i&8)!==0&&(i|=i&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=i;0<u;){var x=31-et(u),g=1<<x;i|=t[x],u&=~g}return ha=i,lc(),l}function Rg(t,i){Ue=null,I.H=Fl,i===vr||i===xc?(i=Xx(),lt=3):i===Xd?(i=Xx(),lt=4):lt=i===Nh?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Qn=i,Ve===null&&(St=1,Ec(t,rs(i,t.current)))}function _g(){var t=Gn.current;return t===null?!0:(Qe&4194048)===Qe?us===null:(Qe&62914560)===Qe||(Qe&536870912)!==0?t===us:!1}function Lg(){var t=I.H;return I.H=Fl,t===null?Fl:t}function Ug(){var t=I.A;return I.A=yz,t}function Pc(){St=4,Ia||(Qe&4194048)!==Qe&&Gn.current!==null||(Tr=!0),(Ha&134217727)===0&&(_i&134217727)===0||ft===null||Fa(ft,Qe,Jn,!1)}function Yh(t,i,l){var u=it;it|=2;var x=Lg(),g=Ug();(ft!==t||Qe!==i)&&(Ic=null,Mr(t,i)),i=!1;var z=St;e:do try{if(lt!==0&&Ve!==null){var M=Ve,q=Qn;switch(lt){case 8:Gh(),z=6;break e;case 3:case 2:case 9:case 6:Gn.current===null&&(i=!0);var J=lt;if(lt=0,Qn=null,Dr(t,M,q,J),l&&Tr){z=0;break e}break;default:J=lt,lt=0,Qn=null,Dr(t,M,q,J)}}wz(),z=St;break}catch(ie){Rg(t,ie)}while(!0);return i&&t.shellSuspendCounter++,na=Si=null,it=u,I.H=x,I.A=g,Ve===null&&(ft=null,Qe=0,lc()),z}function wz(){for(;Ve!==null;)Bg(Ve)}function zz(t,i){var l=it;it|=2;var u=Lg(),x=Ug();ft!==t||Qe!==i?(Ic=null,Bc=Me()+500,Mr(t,i)):Tr=De(t,i);e:do try{if(lt!==0&&Ve!==null){i=Ve;var g=Qn;t:switch(lt){case 1:lt=0,Qn=null,Dr(t,i,g,1);break;case 2:case 9:if(Qx(g)){lt=0,Qn=null,Ig(i);break}i=function(){lt!==2&&lt!==9||ft!==t||(lt=7),Bs(t)},g.then(i,i);break e;case 3:lt=7;break e;case 4:lt=5;break e;case 7:Qx(g)?(lt=0,Qn=null,Ig(i)):(lt=0,Qn=null,Dr(t,i,g,7));break;case 5:var z=null;switch(Ve.tag){case 26:z=Ve.memoizedState;case 5:case 27:var M=Ve;if(z?Nb(z):M.stateNode.complete){lt=0,Qn=null;var q=M.sibling;if(q!==null)Ve=q;else{var J=M.return;J!==null?(Ve=J,qc(J)):Ve=null}break t}}lt=0,Qn=null,Dr(t,i,g,5);break;case 6:lt=0,Qn=null,Dr(t,i,g,6);break;case 8:Gh(),St=6;break e;default:throw Error(r(462))}}Nz();break}catch(ie){Rg(t,ie)}while(!0);return na=Si=null,I.H=u,I.A=x,it=l,Ve!==null?0:(ft=null,Qe=0,lc(),St)}function Nz(){for(;Ve!==null&&!Be();)Bg(Ve)}function Bg(t){var i=og(t.alternate,t,ha);t.memoizedProps=t.pendingProps,i===null?qc(t):Ve=i}function Ig(t){var i=t,l=i.alternate;switch(i.tag){case 15:case 0:i=ng(l,i,i.pendingProps,i.type,void 0,Qe);break;case 11:i=ng(l,i,i.pendingProps,i.type.render,i.ref,Qe);break;case 5:oh(i);default:ug(l,i),i=Ve=Ux(i,ha),i=og(l,i,ha)}t.memoizedProps=t.pendingProps,i===null?qc(t):Ve=i}function Dr(t,i,l,u){na=Si=null,oh(i),jr=null,_l=0;var x=i.return;try{if(hz(t,x,i,l,Qe)){St=1,Ec(t,rs(l,t.current)),Ve=null;return}}catch(g){if(x!==null)throw Ve=x,g;St=1,Ec(t,rs(l,t.current)),Ve=null;return}i.flags&32768?(Ze||u===1?t=!0:Tr||(Qe&536870912)!==0?t=!1:(Ia=t=!0,(u===2||u===9||u===3||u===6)&&(u=Gn.current,u!==null&&u.tag===13&&(u.flags|=16384))),Hg(i,t)):qc(i)}function qc(t){var i=t;do{if((i.flags&32768)!==0){Hg(i,Ia);return}t=i.return;var l=xz(i.alternate,i,ha);if(l!==null){Ve=l;return}if(i=i.sibling,i!==null){Ve=i;return}Ve=i=t}while(i!==null);St===0&&(St=5)}function Hg(t,i){do{var l=pz(t.alternate,t);if(l!==null){l.flags&=32767,Ve=l;return}if(l=t.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!i&&(t=t.sibling,t!==null)){Ve=t;return}Ve=t=l}while(t!==null);St=6,Ve=null}function Pg(t,i,l,u,x,g,z,M,q){t.cancelPendingCommit=null;do Fc();while(Pt!==0);if((it&6)!==0)throw Error(r(327));if(i!==null){if(i===t.current)throw Error(r(177));if(g=i.lanes|i.childLanes,g|=_d,Os(t,l,g,z,M,q),t===ft&&(Ve=ft=null,Qe=0),Ar=i,qa=t,fa=l,Fh=g,$h=x,Ag=u,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Tz(Ne,function(){return Gg(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||u){u=I.T,I.T=null,x=W.p,W.p=2,z=it,it|=4;try{gz(t,i,l)}finally{it=z,W.p=x,I.T=u}}Pt=1,qg(),Fg(),$g()}}function qg(){if(Pt===1){Pt=0;var t=qa,i=Ar,l=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||l){l=I.T,I.T=null;var u=W.p;W.p=2;var x=it;it|=4;try{wg(i,t);var g=rf,z=Tx(t.containerInfo),M=g.focusedElem,q=g.selectionRange;if(z!==M&&M&&M.ownerDocument&&Cx(M.ownerDocument.documentElement,M)){if(q!==null&&Ad(M)){var J=q.start,ie=q.end;if(ie===void 0&&(ie=J),"selectionStart"in M)M.selectionStart=J,M.selectionEnd=Math.min(ie,M.value.length);else{var ue=M.ownerDocument||document,K=ue&&ue.defaultView||window;if(K.getSelection){var ne=K.getSelection(),we=M.textContent.length,Ae=Math.min(q.start,we),dt=q.end===void 0?Ae:Math.min(q.end,we);!ne.extend&&Ae>dt&&(z=dt,dt=Ae,Ae=z);var G=Sx(M,Ae),$=Sx(M,dt);if(G&&$&&(ne.rangeCount!==1||ne.anchorNode!==G.node||ne.anchorOffset!==G.offset||ne.focusNode!==$.node||ne.focusOffset!==$.offset)){var Q=ue.createRange();Q.setStart(G.node,G.offset),ne.removeAllRanges(),Ae>dt?(ne.addRange(Q),ne.extend($.node,$.offset)):(Q.setEnd($.node,$.offset),ne.addRange(Q))}}}}for(ue=[],ne=M;ne=ne.parentNode;)ne.nodeType===1&&ue.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof M.focus=="function"&&M.focus(),M=0;M<ue.length;M++){var oe=ue[M];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}tu=!!af,rf=af=null}finally{it=x,W.p=u,I.T=l}}t.current=i,Pt=2}}function Fg(){if(Pt===2){Pt=0;var t=qa,i=Ar,l=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||l){l=I.T,I.T=null;var u=W.p;W.p=2;var x=it;it|=4;try{gg(t,i.alternate,i)}finally{it=x,W.p=u,I.T=l}}Pt=3}}function $g(){if(Pt===4||Pt===3){Pt=0,Se();var t=qa,i=Ar,l=fa,u=Ag;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Pt=5:(Pt=0,Ar=qa=null,Vg(t,t.pendingLanes));var x=t.pendingLanes;if(x===0&&(Pa=null),dd(l),i=i.stateNode,pt&&typeof pt.onCommitFiberRoot=="function")try{pt.onCommitFiberRoot(Ht,i,void 0,(i.current.flags&128)===128)}catch{}if(u!==null){i=I.T,x=W.p,W.p=2,I.T=null;try{for(var g=t.onRecoverableError,z=0;z<u.length;z++){var M=u[z];g(M.value,{componentStack:M.stack})}}finally{I.T=i,W.p=x}}(fa&3)!==0&&Fc(),Bs(t),x=t.pendingLanes,(l&261930)!==0&&(x&42)!==0?t===Vh?Zl++:(Zl=0,Vh=t):Zl=0,Wl(0)}}function Vg(t,i){(t.pooledCacheLanes&=i)===0&&(i=t.pooledCache,i!=null&&(t.pooledCache=null,Ol(i)))}function Fc(){return qg(),Fg(),$g(),Gg()}function Gg(){if(Pt!==5)return!1;var t=qa,i=Fh;Fh=0;var l=dd(fa),u=I.T,x=W.p;try{W.p=32>l?32:l,I.T=null,l=$h,$h=null;var g=qa,z=fa;if(Pt=0,Ar=qa=null,fa=0,(it&6)!==0)throw Error(r(331));var M=it;if(it|=4,Cg(g.current),Ng(g,g.current,z,l),it=M,Wl(0,!1),pt&&typeof pt.onPostCommitFiberRoot=="function")try{pt.onPostCommitFiberRoot(Ht,g)}catch{}return!0}finally{W.p=x,I.T=u,Vg(t,i)}}function Yg(t,i,l){i=rs(l,i),i=zh(t.stateNode,i,2),t=_a(t,i,2),t!==null&&(tn(t,2),Bs(t))}function ot(t,i,l){if(t.tag===3)Yg(t,t,l);else for(;i!==null;){if(i.tag===3){Yg(i,t,l);break}else if(i.tag===1){var u=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Pa===null||!Pa.has(u))){t=rs(l,t),l=Qp(2),u=_a(i,l,2),u!==null&&(Jp(l,u,i,t),tn(u,2),Bs(u));break}}i=i.return}}function Qh(t,i,l){var u=t.pingCache;if(u===null){u=t.pingCache=new vz;var x=new Set;u.set(i,x)}else x=u.get(i),x===void 0&&(x=new Set,u.set(i,x));x.has(l)||(Hh=!0,x.add(l),t=kz.bind(null,t,i,l),i.then(t,t))}function kz(t,i,l){var u=t.pingCache;u!==null&&u.delete(i),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,ft===t&&(Qe&l)===l&&(St===4||St===3&&(Qe&62914560)===Qe&&300>Me()-Uc?(it&2)===0&&Mr(t,0):Ph|=l,Er===Qe&&(Er=0)),Bs(t)}function Qg(t,i){i===0&&(i=ht()),t=zi(t,i),t!==null&&(tn(t,i),Bs(t))}function Sz(t){var i=t.memoizedState,l=0;i!==null&&(l=i.retryLane),Qg(t,l)}function Cz(t,i){var l=0;switch(t.tag){case 31:case 13:var u=t.stateNode,x=t.memoizedState;x!==null&&(l=x.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(r(314))}u!==null&&u.delete(i),Qg(t,l)}function Tz(t,i){return me(t,i)}var $c=null,Or=null,Jh=!1,Vc=!1,Xh=!1,$a=0;function Bs(t){t!==Or&&t.next===null&&(Or===null?$c=Or=t:Or=Or.next=t),Vc=!0,Jh||(Jh=!0,Az())}function Wl(t,i){if(!Xh&&Vc){Xh=!0;do for(var l=!1,u=$c;u!==null;){if(t!==0){var x=u.pendingLanes;if(x===0)var g=0;else{var z=u.suspendedLanes,M=u.pingedLanes;g=(1<<31-et(42|t)+1)-1,g&=x&~(z&~M),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(l=!0,Zg(u,g))}else g=Qe,g=Wi(u,u===ft?g:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(g&3)===0||De(u,g)||(l=!0,Zg(u,g));u=u.next}while(l);Xh=!1}}function Ez(){Jg()}function Jg(){Vc=Jh=!1;var t=0;$a!==0&&Hz()&&(t=$a);for(var i=Me(),l=null,u=$c;u!==null;){var x=u.next,g=Xg(u,i);g===0?(u.next=null,l===null?$c=x:l.next=x,x===null&&(Or=l)):(l=u,(t!==0||(g&3)!==0)&&(Vc=!0)),u=x}Pt!==0&&Pt!==5||Wl(t),$a!==0&&($a=0)}function Xg(t,i){for(var l=t.suspendedLanes,u=t.pingedLanes,x=t.expirationTimes,g=t.pendingLanes&-62914561;0<g;){var z=31-et(g),M=1<<z,q=x[z];q===-1?((M&l)===0||(M&u)!==0)&&(x[z]=rt(M,i)):q<=i&&(t.expiredLanes|=M),g&=~M}if(i=ft,l=Qe,l=Wi(t,t===i?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,l===0||t===i&&(lt===2||lt===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&ge(u),t.callbackNode=null,t.callbackPriority=0;if((l&3)===0||De(t,l)){if(i=l&-l,i===t.callbackPriority)return i;switch(u!==null&&ge(u),dd(l)){case 2:case 8:l=fe;break;case 32:l=Ne;break;case 268435456:l=Ke;break;default:l=Ne}return u=Kg.bind(null,t),l=me(l,u),t.callbackPriority=i,t.callbackNode=l,i}return u!==null&&u!==null&&ge(u),t.callbackPriority=2,t.callbackNode=null,2}function Kg(t,i){if(Pt!==0&&Pt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var l=t.callbackNode;if(Fc()&&t.callbackNode!==l)return null;var u=Qe;return u=Wi(t,t===ft?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(Dg(t,u,i),Xg(t,Me()),t.callbackNode!=null&&t.callbackNode===l?Kg.bind(null,t):null)}function Zg(t,i){if(Fc())return null;Dg(t,i,!0)}function Az(){qz(function(){(it&6)!==0?me(te,Ez):Jg()})}function Kh(){if($a===0){var t=br;t===0&&(t=bi,bi<<=1,(bi&261888)===0&&(bi=256)),$a=t}return $a}function Wg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Wo(""+t)}function eb(t,i){var l=i.ownerDocument.createElement("input");return l.name=i.name,l.value=i.value,t.id&&l.setAttribute("form",t.id),i.parentNode.insertBefore(l,i),t=new FormData(t),l.parentNode.removeChild(l),t}function Mz(t,i,l,u,x){if(i==="submit"&&l&&l.stateNode===x){var g=Wg((x[Mn]||null).action),z=u.submitter;z&&(i=(i=z[Mn]||null)?Wg(i.formAction):z.getAttribute("formAction"),i!==null&&(g=i,z=null));var M=new sc("action","action",null,u,x);t.push({event:M,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if($a!==0){var q=z?eb(x,z):new FormData(x);gh(l,{pending:!0,data:q,method:x.method,action:g},null,q)}}else typeof g=="function"&&(M.preventDefault(),q=z?eb(x,z):new FormData(x),gh(l,{pending:!0,data:q,method:x.method,action:g},g,q))},currentTarget:x}]})}}for(var Zh=0;Zh<Rd.length;Zh++){var Wh=Rd[Zh],Dz=Wh.toLowerCase(),Oz=Wh[0].toUpperCase()+Wh.slice(1);vs(Dz,"on"+Oz)}vs(Mx,"onAnimationEnd"),vs(Dx,"onAnimationIteration"),vs(Ox,"onAnimationStart"),vs("dblclick","onDoubleClick"),vs("focusin","onFocus"),vs("focusout","onBlur"),vs(Jw,"onTransitionRun"),vs(Xw,"onTransitionStart"),vs(Kw,"onTransitionCancel"),vs(Rx,"onTransitionEnd"),ar("onMouseEnter",["mouseout","mouseover"]),ar("onMouseLeave",["mouseout","mouseover"]),ar("onPointerEnter",["pointerout","pointerover"]),ar("onPointerLeave",["pointerout","pointerover"]),yi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),yi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),yi("onBeforeInput",["compositionend","keypress","textInput","paste"]),yi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),yi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),yi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var eo="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(" "),Rz=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(eo));function tb(t,i){i=(i&4)!==0;for(var l=0;l<t.length;l++){var u=t[l],x=u.event;u=u.listeners;e:{var g=void 0;if(i)for(var z=u.length-1;0<=z;z--){var M=u[z],q=M.instance,J=M.currentTarget;if(M=M.listener,q!==g&&x.isPropagationStopped())break e;g=M,x.currentTarget=J;try{g(x)}catch(ie){rc(ie)}x.currentTarget=null,g=q}else for(z=0;z<u.length;z++){if(M=u[z],q=M.instance,J=M.currentTarget,M=M.listener,q!==g&&x.isPropagationStopped())break e;g=M,x.currentTarget=J;try{g(x)}catch(ie){rc(ie)}x.currentTarget=null,g=q}}}}function Ge(t,i){var l=i[hd];l===void 0&&(l=i[hd]=new Set);var u=t+"__bubble";l.has(u)||(nb(i,t,2,!1),l.add(u))}function ef(t,i,l){var u=0;i&&(u|=4),nb(l,t,u,i)}var Gc="_reactListening"+Math.random().toString(36).slice(2);function tf(t){if(!t[Gc]){t[Gc]=!0,J0.forEach(function(l){l!=="selectionchange"&&(Rz.has(l)||ef(l,!1,t),ef(l,!0,t))});var i=t.nodeType===9?t:t.ownerDocument;i===null||i[Gc]||(i[Gc]=!0,ef("selectionchange",!1,i))}}function nb(t,i,l,u){switch(Mb(i)){case 2:var x=oN;break;case 8:x=cN;break;default:x=gf}l=x.bind(null,i,l,t),x=void 0,!jd||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(x=!0),u?x!==void 0?t.addEventListener(i,l,{capture:!0,passive:x}):t.addEventListener(i,l,!0):x!==void 0?t.addEventListener(i,l,{passive:x}):t.addEventListener(i,l,!1)}function nf(t,i,l,u,x){var g=u;if((i&1)===0&&(i&2)===0&&u!==null)e:for(;;){if(u===null)return;var z=u.tag;if(z===3||z===4){var M=u.stateNode.containerInfo;if(M===x)break;if(z===4)for(z=u.return;z!==null;){var q=z.tag;if((q===3||q===4)&&z.stateNode.containerInfo===x)return;z=z.return}for(;M!==null;){if(z=tr(M),z===null)return;if(q=z.tag,q===5||q===6||q===26||q===27){u=g=z;continue e}M=M.parentNode}}u=u.return}lx(function(){var J=g,ie=yd(l),ue=[];e:{var K=_x.get(t);if(K!==void 0){var ne=sc,we=t;switch(t){case"keypress":if(tc(l)===0)break e;case"keydown":case"keyup":ne=Cw;break;case"focusin":we="focus",ne=kd;break;case"focusout":we="blur",ne=kd;break;case"beforeblur":case"afterblur":ne=kd;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ne=ux;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ne=xw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ne=Aw;break;case Mx:case Dx:case Ox:ne=bw;break;case Rx:ne=Dw;break;case"scroll":case"scrollend":ne=fw;break;case"wheel":ne=Rw;break;case"copy":case"cut":case"paste":ne=vw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ne=hx;break;case"toggle":case"beforetoggle":ne=Lw}var Ae=(i&4)!==0,dt=!Ae&&(t==="scroll"||t==="scrollend"),G=Ae?K!==null?K+"Capture":null:K;Ae=[];for(var $=J,Q;$!==null;){var oe=$;if(Q=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||Q===null||G===null||(oe=wl($,G),oe!=null&&Ae.push(to($,oe,Q))),dt)break;$=$.return}0<Ae.length&&(K=new ne(K,we,null,l,ie),ue.push({event:K,listeners:Ae}))}}if((i&7)===0){e:{if(K=t==="mouseover"||t==="pointerover",ne=t==="mouseout"||t==="pointerout",K&&l!==bd&&(we=l.relatedTarget||l.fromElement)&&(tr(we)||we[er]))break e;if((ne||K)&&(K=ie.window===ie?ie:(K=ie.ownerDocument)?K.defaultView||K.parentWindow:window,ne?(we=l.relatedTarget||l.toElement,ne=J,we=we?tr(we):null,we!==null&&(dt=c(we),Ae=we.tag,we!==dt||Ae!==5&&Ae!==27&&Ae!==6)&&(we=null)):(ne=null,we=J),ne!==we)){if(Ae=ux,oe="onMouseLeave",G="onMouseEnter",$="mouse",(t==="pointerout"||t==="pointerover")&&(Ae=hx,oe="onPointerLeave",G="onPointerEnter",$="pointer"),dt=ne==null?K:jl(ne),Q=we==null?K:jl(we),K=new Ae(oe,$+"leave",ne,l,ie),K.target=dt,K.relatedTarget=Q,oe=null,tr(ie)===J&&(Ae=new Ae(G,$+"enter",we,l,ie),Ae.target=Q,Ae.relatedTarget=dt,oe=Ae),dt=oe,ne&&we)t:{for(Ae=_z,G=ne,$=we,Q=0,oe=G;oe;oe=Ae(oe))Q++;oe=0;for(var Te=$;Te;Te=Ae(Te))oe++;for(;0<Q-oe;)G=Ae(G),Q--;for(;0<oe-Q;)$=Ae($),oe--;for(;Q--;){if(G===$||$!==null&&G===$.alternate){Ae=G;break t}G=Ae(G),$=Ae($)}Ae=null}else Ae=null;ne!==null&&sb(ue,K,ne,Ae,!1),we!==null&&dt!==null&&sb(ue,dt,we,Ae,!0)}}e:{if(K=J?jl(J):window,ne=K.nodeName&&K.nodeName.toLowerCase(),ne==="select"||ne==="input"&&K.type==="file")var st=vx;else if(bx(K))if(jx)st=Gw;else{st=$w;var ze=Fw}else ne=K.nodeName,!ne||ne.toLowerCase()!=="input"||K.type!=="checkbox"&&K.type!=="radio"?J&&gd(J.elementType)&&(st=vx):st=Vw;if(st&&(st=st(t,J))){yx(ue,st,l,ie);break e}ze&&ze(t,K,J),t==="focusout"&&J&&K.type==="number"&&J.memoizedProps.value!=null&&pd(K,"number",K.value)}switch(ze=J?jl(J):window,t){case"focusin":(bx(ze)||ze.contentEditable==="true")&&(ur=ze,Md=J,Al=null);break;case"focusout":Al=Md=ur=null;break;case"mousedown":Dd=!0;break;case"contextmenu":case"mouseup":case"dragend":Dd=!1,Ex(ue,l,ie);break;case"selectionchange":if(Qw)break;case"keydown":case"keyup":Ex(ue,l,ie)}var He;if(Cd)e:{switch(t){case"compositionstart":var Je="onCompositionStart";break e;case"compositionend":Je="onCompositionEnd";break e;case"compositionupdate":Je="onCompositionUpdate";break e}Je=void 0}else cr?px(t,l)&&(Je="onCompositionEnd"):t==="keydown"&&l.keyCode===229&&(Je="onCompositionStart");Je&&(fx&&l.locale!=="ko"&&(cr||Je!=="onCompositionStart"?Je==="onCompositionEnd"&&cr&&(He=ox()):(Ta=ie,wd="value"in Ta?Ta.value:Ta.textContent,cr=!0)),ze=Yc(J,Je),0<ze.length&&(Je=new dx(Je,t,null,l,ie),ue.push({event:Je,listeners:ze}),He?Je.data=He:(He=gx(l),He!==null&&(Je.data=He)))),(He=Bw?Iw(t,l):Hw(t,l))&&(Je=Yc(J,"onBeforeInput"),0<Je.length&&(ze=new dx("onBeforeInput","beforeinput",null,l,ie),ue.push({event:ze,listeners:Je}),ze.data=He)),Mz(ue,t,J,l,ie)}tb(ue,i)})}function to(t,i,l){return{instance:t,listener:i,currentTarget:l}}function Yc(t,i){for(var l=i+"Capture",u=[];t!==null;){var x=t,g=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||g===null||(x=wl(t,l),x!=null&&u.unshift(to(t,x,g)),x=wl(t,i),x!=null&&u.push(to(t,x,g))),t.tag===3)return u;t=t.return}return[]}function _z(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function sb(t,i,l,u,x){for(var g=i._reactName,z=[];l!==null&&l!==u;){var M=l,q=M.alternate,J=M.stateNode;if(M=M.tag,q!==null&&q===u)break;M!==5&&M!==26&&M!==27||J===null||(q=J,x?(J=wl(l,g),J!=null&&z.unshift(to(l,J,q))):x||(J=wl(l,g),J!=null&&z.push(to(l,J,q)))),l=l.return}z.length!==0&&t.push({event:i,listeners:z})}var Lz=/\r\n?/g,Uz=/\u0000|\uFFFD/g;function ab(t){return(typeof t=="string"?t:""+t).replace(Lz,`
`).replace(Uz,"")}function ib(t,i){return i=ab(i),ab(t)===i}function ut(t,i,l,u,x,g){switch(l){case"children":typeof u=="string"?i==="body"||i==="textarea"&&u===""||rr(t,u):(typeof u=="number"||typeof u=="bigint")&&i!=="body"&&rr(t,""+u);break;case"className":Ko(t,"class",u);break;case"tabIndex":Ko(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Ko(t,l,u);break;case"style":ix(t,u,g);break;case"data":if(i!=="object"){Ko(t,"data",u);break}case"src":case"href":if(u===""&&(i!=="a"||l!=="href")){t.removeAttribute(l);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(l);break}u=Wo(""+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 g=="function"&&(l==="formAction"?(i!=="input"&&ut(t,i,"name",x.name,x,null),ut(t,i,"formEncType",x.formEncType,x,null),ut(t,i,"formMethod",x.formMethod,x,null),ut(t,i,"formTarget",x.formTarget,x,null)):(ut(t,i,"encType",x.encType,x,null),ut(t,i,"method",x.method,x,null),ut(t,i,"target",x.target,x,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(l);break}u=Wo(""+u),t.setAttribute(l,u);break;case"onClick":u!=null&&(t.onclick=Zs);break;case"onScroll":u!=null&&Ge("scroll",t);break;case"onScrollEnd":u!=null&&Ge("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(l=u.__html,l!=null){if(x.children!=null)throw Error(r(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=Wo(""+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":Ge("beforetoggle",t),Ge("toggle",t),Xo(t,"popover",u);break;case"xlinkActuate":Ks(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Ks(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Ks(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Ks(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Ks(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Ks(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Ks(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Ks(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Ks(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Xo(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=dw.get(l)||l,Xo(t,l,u))}}function sf(t,i,l,u,x,g){switch(l){case"style":ix(t,u,g);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(l=u.__html,l!=null){if(x.children!=null)throw Error(r(60));t.innerHTML=l}}break;case"children":typeof u=="string"?rr(t,u):(typeof u=="number"||typeof u=="bigint")&&rr(t,""+u);break;case"onScroll":u!=null&&Ge("scroll",t);break;case"onScrollEnd":u!=null&&Ge("scrollend",t);break;case"onClick":u!=null&&(t.onclick=Zs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!X0.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(x=l.endsWith("Capture"),i=l.slice(2,x?l.length-7:void 0),g=t[Mn]||null,g=g!=null?g[l]:null,typeof g=="function"&&t.removeEventListener(i,g,x),typeof u=="function")){typeof g!="function"&&g!==null&&(l in t?t[l]=null:t.hasAttribute(l)&&t.removeAttribute(l)),t.addEventListener(i,u,x);break e}l in t?t[l]=u:u===!0?t.setAttribute(l,""):Xo(t,l,u)}}}function ln(t,i,l){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ge("error",t),Ge("load",t);var u=!1,x=!1,g;for(g in l)if(l.hasOwnProperty(g)){var z=l[g];if(z!=null)switch(g){case"src":u=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:ut(t,i,g,z,l,null)}}x&&ut(t,i,"srcSet",l.srcSet,l,null),u&&ut(t,i,"src",l.src,l,null);return;case"input":Ge("invalid",t);var M=g=z=x=null,q=null,J=null;for(u in l)if(l.hasOwnProperty(u)){var ie=l[u];if(ie!=null)switch(u){case"name":x=ie;break;case"type":z=ie;break;case"checked":q=ie;break;case"defaultChecked":J=ie;break;case"value":g=ie;break;case"defaultValue":M=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(r(137,i));break;default:ut(t,i,u,ie,l,null)}}tx(t,g,M,q,J,z,x,!1);return;case"select":Ge("invalid",t),u=z=g=null;for(x in l)if(l.hasOwnProperty(x)&&(M=l[x],M!=null))switch(x){case"value":g=M;break;case"defaultValue":z=M;break;case"multiple":u=M;default:ut(t,i,x,M,l,null)}i=g,l=z,t.multiple=!!u,i!=null?ir(t,!!u,i,!1):l!=null&&ir(t,!!u,l,!0);return;case"textarea":Ge("invalid",t),g=x=u=null;for(z in l)if(l.hasOwnProperty(z)&&(M=l[z],M!=null))switch(z){case"value":u=M;break;case"defaultValue":x=M;break;case"children":g=M;break;case"dangerouslySetInnerHTML":if(M!=null)throw Error(r(91));break;default:ut(t,i,z,M,l,null)}sx(t,u,x,g);return;case"option":for(q in l)if(l.hasOwnProperty(q)&&(u=l[q],u!=null))switch(q){case"selected":t.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:ut(t,i,q,u,l,null)}return;case"dialog":Ge("beforetoggle",t),Ge("toggle",t),Ge("cancel",t),Ge("close",t);break;case"iframe":case"object":Ge("load",t);break;case"video":case"audio":for(u=0;u<eo.length;u++)Ge(eo[u],t);break;case"image":Ge("error",t),Ge("load",t);break;case"details":Ge("toggle",t);break;case"embed":case"source":case"link":Ge("error",t),Ge("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(r(137,i));default:ut(t,i,J,u,l,null)}return;default:if(gd(i)){for(ie in l)l.hasOwnProperty(ie)&&(u=l[ie],u!==void 0&&sf(t,i,ie,u,l,void 0));return}}for(M in l)l.hasOwnProperty(M)&&(u=l[M],u!=null&&ut(t,i,M,u,l,null))}function Bz(t,i,l,u){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,g=null,z=null,M=null,q=null,J=null,ie=null;for(ne in l){var ue=l[ne];if(l.hasOwnProperty(ne)&&ue!=null)switch(ne){case"checked":break;case"value":break;case"defaultValue":q=ue;default:u.hasOwnProperty(ne)||ut(t,i,ne,null,u,ue)}}for(var K in u){var ne=u[K];if(ue=l[K],u.hasOwnProperty(K)&&(ne!=null||ue!=null))switch(K){case"type":g=ne;break;case"name":x=ne;break;case"checked":J=ne;break;case"defaultChecked":ie=ne;break;case"value":z=ne;break;case"defaultValue":M=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(r(137,i));break;default:ne!==ue&&ut(t,i,K,ne,u,ue)}}xd(t,z,M,q,J,ie,g,x);return;case"select":ne=z=M=K=null;for(g in l)if(q=l[g],l.hasOwnProperty(g)&&q!=null)switch(g){case"value":break;case"multiple":ne=q;default:u.hasOwnProperty(g)||ut(t,i,g,null,u,q)}for(x in u)if(g=u[x],q=l[x],u.hasOwnProperty(x)&&(g!=null||q!=null))switch(x){case"value":K=g;break;case"defaultValue":M=g;break;case"multiple":z=g;default:g!==q&&ut(t,i,x,g,u,q)}i=M,l=z,u=ne,K!=null?ir(t,!!l,K,!1):!!u!=!!l&&(i!=null?ir(t,!!l,i,!0):ir(t,!!l,l?[]:"",!1));return;case"textarea":ne=K=null;for(M in l)if(x=l[M],l.hasOwnProperty(M)&&x!=null&&!u.hasOwnProperty(M))switch(M){case"value":break;case"children":break;default:ut(t,i,M,null,u,x)}for(z in u)if(x=u[z],g=l[z],u.hasOwnProperty(z)&&(x!=null||g!=null))switch(z){case"value":K=x;break;case"defaultValue":ne=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:x!==g&&ut(t,i,z,x,u,g)}nx(t,K,ne);return;case"option":for(var we in l)if(K=l[we],l.hasOwnProperty(we)&&K!=null&&!u.hasOwnProperty(we))switch(we){case"selected":t.selected=!1;break;default:ut(t,i,we,null,u,K)}for(q in u)if(K=u[q],ne=l[q],u.hasOwnProperty(q)&&K!==ne&&(K!=null||ne!=null))switch(q){case"selected":t.selected=K&&typeof K!="function"&&typeof K!="symbol";break;default:ut(t,i,q,K,u,ne)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ae in l)K=l[Ae],l.hasOwnProperty(Ae)&&K!=null&&!u.hasOwnProperty(Ae)&&ut(t,i,Ae,null,u,K);for(J in u)if(K=u[J],ne=l[J],u.hasOwnProperty(J)&&K!==ne&&(K!=null||ne!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,i));break;default:ut(t,i,J,K,u,ne)}return;default:if(gd(i)){for(var dt in l)K=l[dt],l.hasOwnProperty(dt)&&K!==void 0&&!u.hasOwnProperty(dt)&&sf(t,i,dt,void 0,u,K);for(ie in u)K=u[ie],ne=l[ie],!u.hasOwnProperty(ie)||K===ne||K===void 0&&ne===void 0||sf(t,i,ie,K,u,ne);return}}for(var G in l)K=l[G],l.hasOwnProperty(G)&&K!=null&&!u.hasOwnProperty(G)&&ut(t,i,G,null,u,K);for(ue in u)K=u[ue],ne=l[ue],!u.hasOwnProperty(ue)||K===ne||K==null&&ne==null||ut(t,i,ue,K,u,ne)}function rb(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,i=0,l=performance.getEntriesByType("resource"),u=0;u<l.length;u++){var x=l[u],g=x.transferSize,z=x.initiatorType,M=x.duration;if(g&&M&&rb(z)){for(z=0,M=x.responseEnd,u+=1;u<l.length;u++){var q=l[u],J=q.startTime;if(J>M)break;var ie=q.transferSize,ue=q.initiatorType;ie&&rb(ue)&&(q=q.responseEnd,z+=ie*(q<M?1:(M-J)/(q-J)))}if(--u,i+=8*(g+z)/(x.duration/1e3),t++,10<t)break}}if(0<t)return i/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var af=null,rf=null;function Qc(t){return t.nodeType===9?t:t.ownerDocument}function lb(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 ob(t,i){if(t===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&i==="foreignObject"?0:t}function lf(t,i){return t==="textarea"||t==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var of=null;function Hz(){var t=window.event;return t&&t.type==="popstate"?t===of?!1:(of=t,!0):(of=null,!1)}var cb=typeof setTimeout=="function"?setTimeout:void 0,Pz=typeof clearTimeout=="function"?clearTimeout:void 0,ub=typeof Promise=="function"?Promise:void 0,qz=typeof queueMicrotask=="function"?queueMicrotask:typeof ub<"u"?function(t){return ub.resolve(null).then(t).catch(Fz)}:cb;function Fz(t){setTimeout(function(){throw t})}function Va(t){return t==="head"}function db(t,i){var l=i,u=0;do{var x=l.nextSibling;if(t.removeChild(l),x&&x.nodeType===8)if(l=x.data,l==="/$"||l==="/&"){if(u===0){t.removeChild(x),Ur(i);return}u--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")u++;else if(l==="html")no(t.ownerDocument.documentElement);else if(l==="head"){l=t.ownerDocument.head,no(l);for(var g=l.firstChild;g;){var z=g.nextSibling,M=g.nodeName;g[vl]||M==="SCRIPT"||M==="STYLE"||M==="LINK"&&g.rel.toLowerCase()==="stylesheet"||l.removeChild(g),g=z}}else l==="body"&&no(t.ownerDocument.body);l=x}while(l);Ur(i)}function hb(t,i){var l=t;t=0;do{var u=l.nextSibling;if(l.nodeType===1?i?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(i?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),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 cf(t){var i=t.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var l=i;switch(i=i.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":cf(l),fd(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}t.removeChild(l)}}function $z(t,i,l,u){for(;t.nodeType===1;){var x=l;if(t.nodeName.toLowerCase()!==i.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[vl])switch(i){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(g=t.getAttribute("rel"),g==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(g!==x.rel||t.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||t.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||t.getAttribute("title")!==(x.title==null?null:x.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(g=t.getAttribute("src"),(g!==(x.src==null?null:x.src)||t.getAttribute("type")!==(x.type==null?null:x.type)||t.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&g&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(i==="input"&&t.type==="hidden"){var g=x.name==null?null:""+x.name;if(x.type==="hidden"&&t.getAttribute("name")===g)return t}else return t;if(t=ds(t.nextSibling),t===null)break}return null}function Vz(t,i,l){if(i==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!l||(t=ds(t.nextSibling),t===null))return null;return t}function fb(t,i){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=ds(t.nextSibling),t===null))return null;return t}function uf(t){return t.data==="$?"||t.data==="$~"}function df(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Gz(t,i){var l=t.ownerDocument;if(t.data==="$~")t._reactRetry=i;else if(t.data!=="$?"||l.readyState!=="loading")i();else{var u=function(){i(),l.removeEventListener("DOMContentLoaded",u)};l.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function ds(t){for(;t!=null;t=t.nextSibling){var i=t.nodeType;if(i===1||i===3)break;if(i===8){if(i=t.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return t}var hf=null;function mb(t){t=t.nextSibling;for(var i=0;t;){if(t.nodeType===8){var l=t.data;if(l==="/$"||l==="/&"){if(i===0)return ds(t.nextSibling);i--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||i++}t=t.nextSibling}return null}function xb(t){t=t.previousSibling;for(var i=0;t;){if(t.nodeType===8){var l=t.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(i===0)return t;i--}else l!=="/$"&&l!=="/&"||i++}t=t.previousSibling}return null}function pb(t,i,l){switch(i=Qc(l),t){case"html":if(t=i.documentElement,!t)throw Error(r(452));return t;case"head":if(t=i.head,!t)throw Error(r(453));return t;case"body":if(t=i.body,!t)throw Error(r(454));return t;default:throw Error(r(451))}}function no(t){for(var i=t.attributes;i.length;)t.removeAttributeNode(i[0]);fd(t)}var hs=new Map,gb=new Set;function Jc(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var ma=W.d;W.d={f:Yz,r:Qz,D:Jz,C:Xz,L:Kz,m:Zz,X:eN,S:Wz,M:tN};function Yz(){var t=ma.f(),i=Hc();return t||i}function Qz(t){var i=nr(t);i!==null&&i.tag===5&&i.type==="form"?Rp(i):ma.r(t)}var Rr=typeof document>"u"?null:document;function bb(t,i,l){var u=Rr;if(u&&typeof i=="string"&&i){var x=as(i);x='link[rel="'+t+'"][href="'+x+'"]',typeof l=="string"&&(x+='[crossorigin="'+l+'"]'),gb.has(x)||(gb.add(x),t={rel:t,crossOrigin:l,href:i},u.querySelector(x)===null&&(i=u.createElement("link"),ln(i,"link",t),Qt(i),u.head.appendChild(i)))}}function Jz(t){ma.D(t),bb("dns-prefetch",t,null)}function Xz(t,i){ma.C(t,i),bb("preconnect",t,i)}function Kz(t,i,l){ma.L(t,i,l);var u=Rr;if(u&&t&&i){var x='link[rel="preload"][as="'+as(i)+'"]';i==="image"&&l&&l.imageSrcSet?(x+='[imagesrcset="'+as(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(x+='[imagesizes="'+as(l.imageSizes)+'"]')):x+='[href="'+as(t)+'"]';var g=x;switch(i){case"style":g=_r(t);break;case"script":g=Lr(t)}hs.has(g)||(t=b({rel:"preload",href:i==="image"&&l&&l.imageSrcSet?void 0:t,as:i},l),hs.set(g,t),u.querySelector(x)!==null||i==="style"&&u.querySelector(so(g))||i==="script"&&u.querySelector(ao(g))||(i=u.createElement("link"),ln(i,"link",t),Qt(i),u.head.appendChild(i)))}}function Zz(t,i){ma.m(t,i);var l=Rr;if(l&&t){var u=i&&typeof i.as=="string"?i.as:"script",x='link[rel="modulepreload"][as="'+as(u)+'"][href="'+as(t)+'"]',g=x;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=Lr(t)}if(!hs.has(g)&&(t=b({rel:"modulepreload",href:t},i),hs.set(g,t),l.querySelector(x)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ao(g)))return}u=l.createElement("link"),ln(u,"link",t),Qt(u),l.head.appendChild(u)}}}function Wz(t,i,l){ma.S(t,i,l);var u=Rr;if(u&&t){var x=sr(u).hoistableStyles,g=_r(t);i=i||"default";var z=x.get(g);if(!z){var M={loading:0,preload:null};if(z=u.querySelector(so(g)))M.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":i},l),(l=hs.get(g))&&ff(t,l);var q=z=u.createElement("link");Qt(q),ln(q,"link",t),q._p=new Promise(function(J,ie){q.onload=J,q.onerror=ie}),q.addEventListener("load",function(){M.loading|=1}),q.addEventListener("error",function(){M.loading|=2}),M.loading|=4,Xc(z,i,u)}z={type:"stylesheet",instance:z,count:1,state:M},x.set(g,z)}}}function eN(t,i){ma.X(t,i);var l=Rr;if(l&&t){var u=sr(l).hoistableScripts,x=Lr(t),g=u.get(x);g||(g=l.querySelector(ao(x)),g||(t=b({src:t,async:!0},i),(i=hs.get(x))&&mf(t,i),g=l.createElement("script"),Qt(g),ln(g,"link",t),l.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},u.set(x,g))}}function tN(t,i){ma.M(t,i);var l=Rr;if(l&&t){var u=sr(l).hoistableScripts,x=Lr(t),g=u.get(x);g||(g=l.querySelector(ao(x)),g||(t=b({src:t,async:!0,type:"module"},i),(i=hs.get(x))&&mf(t,i),g=l.createElement("script"),Qt(g),ln(g,"link",t),l.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},u.set(x,g))}}function yb(t,i,l,u){var x=(x=ae.current)?Jc(x):null;if(!x)throw Error(r(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(i=_r(l.href),l=sr(x).hoistableStyles,u=l.get(i),u||(u={type:"style",instance:null,count:0,state:null},l.set(i,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=_r(l.href);var g=sr(x).hoistableStyles,z=g.get(t);if(z||(x=x.ownerDocument||x,z={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(t,z),(g=x.querySelector(so(t)))&&!g._p&&(z.instance=g,z.state.loading=5),hs.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},hs.set(t,l),g||nN(x,t,l,z.state))),i&&u===null)throw Error(r(528,""));return z}if(i&&u!==null)throw Error(r(529,""));return null;case"script":return i=l.async,l=l.src,typeof l=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Lr(l),l=sr(x).hoistableScripts,u=l.get(i),u||(u={type:"script",instance:null,count:0,state:null},l.set(i,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,t))}}function _r(t){return'href="'+as(t)+'"'}function so(t){return'link[rel="stylesheet"]['+t+"]"}function vb(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function nN(t,i,l,u){t.querySelector('link[rel="preload"][as="style"]['+i+"]")?u.loading=1:(i=t.createElement("link"),u.preload=i,i.addEventListener("load",function(){return u.loading|=1}),i.addEventListener("error",function(){return u.loading|=2}),ln(i,"link",l),Qt(i),t.head.appendChild(i))}function Lr(t){return'[src="'+as(t)+'"]'}function ao(t){return"script[async]"+t}function jb(t,i,l){if(i.count++,i.instance===null)switch(i.type){case"style":var u=t.querySelector('style[data-href~="'+as(l.href)+'"]');if(u)return i.instance=u,Qt(u),u;var x=b({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),Qt(u),ln(u,"style",x),Xc(u,l.precedence,t),i.instance=u;case"stylesheet":x=_r(l.href);var g=t.querySelector(so(x));if(g)return i.state.loading|=4,i.instance=g,Qt(g),g;u=vb(l),(x=hs.get(x))&&ff(u,x),g=(t.ownerDocument||t).createElement("link"),Qt(g);var z=g;return z._p=new Promise(function(M,q){z.onload=M,z.onerror=q}),ln(g,"link",u),i.state.loading|=4,Xc(g,l.precedence,t),i.instance=g;case"script":return g=Lr(l.src),(x=t.querySelector(ao(g)))?(i.instance=x,Qt(x),x):(u=l,(x=hs.get(g))&&(u=b({},l),mf(u,x)),t=t.ownerDocument||t,x=t.createElement("script"),Qt(x),ln(x,"link",u),t.head.appendChild(x),i.instance=x);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(u=i.instance,i.state.loading|=4,Xc(u,l.precedence,t));return i.instance}function Xc(t,i,l){for(var u=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=u.length?u[u.length-1]:null,g=x,z=0;z<u.length;z++){var M=u[z];if(M.dataset.precedence===i)g=M;else if(g!==x)break}g?g.parentNode.insertBefore(t,g.nextSibling):(i=l.nodeType===9?l.head:l,i.insertBefore(t,i.firstChild))}function ff(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.title==null&&(t.title=i.title)}function mf(t,i){t.crossOrigin==null&&(t.crossOrigin=i.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=i.referrerPolicy),t.integrity==null&&(t.integrity=i.integrity)}var Kc=null;function wb(t,i,l){if(Kc===null){var u=new Map,x=Kc=new Map;x.set(l,u)}else x=Kc,u=x.get(l),u||(u=new Map,x.set(l,u));if(u.has(t))return u;for(u.set(t,null),l=l.getElementsByTagName(t),x=0;x<l.length;x++){var g=l[x];if(!(g[vl]||g[nn]||t==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var z=g.getAttribute(i)||"";z=t+z;var M=u.get(z);M?M.push(g):u.set(z,[g])}}return u}function zb(t,i,l){t=t.ownerDocument||t,t.head.insertBefore(l,i==="title"?t.querySelector("head > title"):null)}function sN(t,i,l){if(l===1||i.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return t=i.disabled,typeof i.precedence=="string"&&t==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Nb(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function aN(t,i,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 x=_r(u.href),g=i.querySelector(so(x));if(g){i=g._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(t.count++,t=Zc.bind(t),i.then(t,t)),l.state.loading|=4,l.instance=g,Qt(g);return}g=i.ownerDocument||i,u=vb(u),(x=hs.get(x))&&ff(u,x),g=g.createElement("link"),Qt(g);var z=g;z._p=new Promise(function(M,q){z.onload=M,z.onerror=q}),ln(g,"link",u),l.instance=g}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(l,i),(i=l.state.preload)&&(l.state.loading&3)===0&&(t.count++,l=Zc.bind(t),i.addEventListener("load",l),i.addEventListener("error",l))}}var xf=0;function iN(t,i){return t.stylesheets&&t.count===0&&eu(t,t.stylesheets),0<t.count||0<t.imgCount?function(l){var u=setTimeout(function(){if(t.stylesheets&&eu(t,t.stylesheets),t.unsuspend){var g=t.unsuspend;t.unsuspend=null,g()}},6e4+i);0<t.imgBytes&&xf===0&&(xf=62500*Iz());var x=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&eu(t,t.stylesheets),t.unsuspend)){var g=t.unsuspend;t.unsuspend=null,g()}},(t.imgBytes>xf?50:800)+i);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(x)}}:null}function Zc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)eu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Wc=null;function eu(t,i){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Wc=new Map,i.forEach(rN,t),Wc=null,Zc.call(t))}function rN(t,i){if(!(i.state.loading&4)){var l=Wc.get(t);if(l)var u=l.get(null);else{l=new Map,Wc.set(t,l);for(var x=t.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<x.length;g++){var z=x[g];(z.nodeName==="LINK"||z.getAttribute("media")!=="not all")&&(l.set(z.dataset.precedence,z),u=z)}u&&l.set(null,u)}x=i.instance,z=x.getAttribute("data-precedence"),g=l.get(z)||u,g===u&&l.set(null,x),l.set(z,x),this.count++,u=Zc.bind(this),x.addEventListener("load",u),x.addEventListener("error",u),g?g.parentNode.insertBefore(x,g.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(x,t.firstChild)),i.state.loading|=4}}var io={$$typeof:T,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function lN(t,i,l,u,x,g,z,M,q){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=wn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wn(0),this.hiddenUpdates=wn(null),this.identifierPrefix=u,this.onUncaughtError=x,this.onCaughtError=g,this.onRecoverableError=z,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function kb(t,i,l,u,x,g,z,M,q,J,ie,ue){return t=new lN(t,i,l,z,q,J,ie,ue,M),i=1,g===!0&&(i|=24),g=Vn(3,null,null,i),t.current=g,g.stateNode=t,i=Yd(),i.refCount++,t.pooledCache=i,i.refCount++,g.memoizedState={element:u,isDehydrated:l,cache:i},Kd(g),t}function Sb(t){return t?(t=fr,t):fr}function Cb(t,i,l,u,x,g){x=Sb(x),u.context===null?u.context=x:u.pendingContext=x,u=Ra(i),u.payload={element:l},g=g===void 0?null:g,g!==null&&(u.callback=g),l=_a(t,u,i),l!==null&&(Un(l,t,i),Ul(l,t,i))}function Tb(t,i){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var l=t.retryLane;t.retryLane=l!==0&&l<i?l:i}}function pf(t,i){Tb(t,i),(t=t.alternate)&&Tb(t,i)}function Eb(t){if(t.tag===13||t.tag===31){var i=zi(t,67108864);i!==null&&Un(i,t,67108864),pf(t,67108864)}}function Ab(t){if(t.tag===13||t.tag===31){var i=Xn();i=ud(i);var l=zi(t,i);l!==null&&Un(l,t,i),pf(t,i)}}var tu=!0;function oN(t,i,l,u){var x=I.T;I.T=null;var g=W.p;try{W.p=2,gf(t,i,l,u)}finally{W.p=g,I.T=x}}function cN(t,i,l,u){var x=I.T;I.T=null;var g=W.p;try{W.p=8,gf(t,i,l,u)}finally{W.p=g,I.T=x}}function gf(t,i,l,u){if(tu){var x=bf(u);if(x===null)nf(t,i,u,nu,l),Db(t,u);else if(dN(x,t,i,l,u))u.stopPropagation();else if(Db(t,u),i&4&&-1<uN.indexOf(t)){for(;x!==null;){var g=nr(x);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var z=mn(g.pendingLanes);if(z!==0){var M=g;for(M.pendingLanes|=2,M.entangledLanes|=2;z;){var q=1<<31-et(z);M.entanglements[1]|=q,z&=~q}Bs(g),(it&6)===0&&(Bc=Me()+500,Wl(0))}}break;case 31:case 13:M=zi(g,2),M!==null&&Un(M,g,2),Hc(),pf(g,2)}if(g=bf(u),g===null&&nf(t,i,u,nu,l),g===x)break;x=g}x!==null&&u.stopPropagation()}else nf(t,i,u,null,l)}}function bf(t){return t=yd(t),yf(t)}var nu=null;function yf(t){if(nu=null,t=tr(t),t!==null){var i=c(t);if(i===null)t=null;else{var l=i.tag;if(l===13){if(t=d(i),t!==null)return t;t=null}else if(l===31){if(t=h(i),t!==null)return t;t=null}else if(l===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;t=null}else i!==t&&(t=null)}}return nu=t,null}function Mb(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(nt()){case te:return 2;case fe:return 8;case Ne:case Ie:return 32;case Ke:return 268435456;default:return 32}default:return 32}}var vf=!1,Ga=null,Ya=null,Qa=null,ro=new Map,lo=new Map,Ja=[],uN="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 Db(t,i){switch(t){case"focusin":case"focusout":Ga=null;break;case"dragenter":case"dragleave":Ya=null;break;case"mouseover":case"mouseout":Qa=null;break;case"pointerover":case"pointerout":ro.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":lo.delete(i.pointerId)}}function oo(t,i,l,u,x,g){return t===null||t.nativeEvent!==g?(t={blockedOn:i,domEventName:l,eventSystemFlags:u,nativeEvent:g,targetContainers:[x]},i!==null&&(i=nr(i),i!==null&&Eb(i)),t):(t.eventSystemFlags|=u,i=t.targetContainers,x!==null&&i.indexOf(x)===-1&&i.push(x),t)}function dN(t,i,l,u,x){switch(i){case"focusin":return Ga=oo(Ga,t,i,l,u,x),!0;case"dragenter":return Ya=oo(Ya,t,i,l,u,x),!0;case"mouseover":return Qa=oo(Qa,t,i,l,u,x),!0;case"pointerover":var g=x.pointerId;return ro.set(g,oo(ro.get(g)||null,t,i,l,u,x)),!0;case"gotpointercapture":return g=x.pointerId,lo.set(g,oo(lo.get(g)||null,t,i,l,u,x)),!0}return!1}function Ob(t){var i=tr(t.target);if(i!==null){var l=c(i);if(l!==null){if(i=l.tag,i===13){if(i=d(l),i!==null){t.blockedOn=i,Y0(t.priority,function(){Ab(l)});return}}else if(i===31){if(i=h(l),i!==null){t.blockedOn=i,Y0(t.priority,function(){Ab(l)});return}}else if(i===3&&l.stateNode.current.memoizedState.isDehydrated){t.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}t.blockedOn=null}function su(t){if(t.blockedOn!==null)return!1;for(var i=t.targetContainers;0<i.length;){var l=bf(t.nativeEvent);if(l===null){l=t.nativeEvent;var u=new l.constructor(l.type,l);bd=u,l.target.dispatchEvent(u),bd=null}else return i=nr(l),i!==null&&Eb(i),t.blockedOn=l,!1;i.shift()}return!0}function Rb(t,i,l){su(t)&&l.delete(i)}function hN(){vf=!1,Ga!==null&&su(Ga)&&(Ga=null),Ya!==null&&su(Ya)&&(Ya=null),Qa!==null&&su(Qa)&&(Qa=null),ro.forEach(Rb),lo.forEach(Rb)}function au(t,i){t.blockedOn===i&&(t.blockedOn=null,vf||(vf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,hN)))}var iu=null;function _b(t){iu!==t&&(iu=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){iu===t&&(iu=null);for(var i=0;i<t.length;i+=3){var l=t[i],u=t[i+1],x=t[i+2];if(typeof u!="function"){if(yf(u||l)===null)continue;break}var g=nr(l);g!==null&&(t.splice(i,3),i-=3,gh(g,{pending:!0,data:x,method:l.method,action:u},u,x))}}))}function Ur(t){function i(q){return au(q,t)}Ga!==null&&au(Ga,t),Ya!==null&&au(Ya,t),Qa!==null&&au(Qa,t),ro.forEach(i),lo.forEach(i);for(var l=0;l<Ja.length;l++){var u=Ja[l];u.blockedOn===t&&(u.blockedOn=null)}for(;0<Ja.length&&(l=Ja[0],l.blockedOn===null);)Ob(l),l.blockedOn===null&&Ja.shift();if(l=(t.ownerDocument||t).$$reactFormReplay,l!=null)for(u=0;u<l.length;u+=3){var x=l[u],g=l[u+1],z=x[Mn]||null;if(typeof g=="function")z||_b(l);else if(z){var M=null;if(g&&g.hasAttribute("formAction")){if(x=g,z=g[Mn]||null)M=z.formAction;else if(yf(x)!==null)continue}else M=z.action;typeof M=="function"?l[u+1]=M:(l.splice(u,3),u-=3),_b(l)}}}function Lb(){function t(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(z){return x=z})},focusReset:"manual",scroll:"manual"})}function i(){x!==null&&(x(),x=null),u||setTimeout(l,20)}function l(){if(!u&&!navigation.transition){var g=navigation.currentEntry;g&&g.url!=null&&navigation.navigate(g.url,{state:g.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,x=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(l,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),x!==null&&(x(),x=null)}}}function jf(t){this._internalRoot=t}ru.prototype.render=jf.prototype.render=function(t){var i=this._internalRoot;if(i===null)throw Error(r(409));var l=i.current,u=Xn();Cb(l,u,t,i,null,null)},ru.prototype.unmount=jf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var i=t.containerInfo;Cb(t.current,2,null,t,null,null),Hc(),i[er]=null}};function ru(t){this._internalRoot=t}ru.prototype.unstable_scheduleHydration=function(t){if(t){var i=G0();t={blockedOn:null,target:t,priority:i};for(var l=0;l<Ja.length&&i!==0&&i<Ja[l].priority;l++);Ja.splice(l,0,t),l===0&&Ob(t)}};var Ub=s.version;if(Ub!=="19.2.4")throw Error(r(527,Ub,"19.2.4"));W.findDOMNode=function(t){var i=t._reactInternals;if(i===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=f(i),t=t!==null?p(t):null,t=t===null?null:t.stateNode,t};var fN={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lu.isDisabled&&lu.supportsFiber)try{Ht=lu.inject(fN),pt=lu}catch{}}return uo.createRoot=function(t,i){if(!o(t))throw Error(r(299));var l=!1,u="",x=$p,g=Vp,z=Gp;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(u=i.identifierPrefix),i.onUncaughtError!==void 0&&(x=i.onUncaughtError),i.onCaughtError!==void 0&&(g=i.onCaughtError),i.onRecoverableError!==void 0&&(z=i.onRecoverableError)),i=kb(t,1,!1,null,null,l,u,null,x,g,z,Lb),t[er]=i.current,tf(t),new jf(i)},uo.hydrateRoot=function(t,i,l){if(!o(t))throw Error(r(299));var u=!1,x="",g=$p,z=Vp,M=Gp,q=null;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(x=l.identifierPrefix),l.onUncaughtError!==void 0&&(g=l.onUncaughtError),l.onCaughtError!==void 0&&(z=l.onCaughtError),l.onRecoverableError!==void 0&&(M=l.onRecoverableError),l.formState!==void 0&&(q=l.formState)),i=kb(t,1,!0,i,l??null,u,x,q,g,z,M,Lb),i.context=Sb(null),l=i.current,u=Xn(),u=ud(u),x=Ra(u),x.callback=null,_a(l,x,u),l=u,i.current.lanes=l,tn(i,l),Bs(i),t[er]=i.current,tf(t),new ru(i)},uo.version="19.2.4",uo}var Qb;function NN(){if(Qb)return kf.exports;Qb=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(s){console.error(s)}}return e(),kf.exports=zN(),kf.exports}var kN=NN();/**
 * 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 Jb="popstate";function SN(e={}){function s(r,o){let{pathname:c,search:d,hash:h}=r.location;return lm("",{pathname:c,search:d,hash:h},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function a(r,o){return typeof o=="string"?o:Eo(o)}return TN(s,a,null,e)}function wt(e,s){if(e===!1||e===null||typeof e>"u")throw new Error(s)}function xs(e,s){if(!e){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function CN(){return Math.random().toString(36).substring(2,10)}function Xb(e,s){return{usr:e.state,key:e.key,idx:s}}function lm(e,s,a=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof s=="string"?rl(s):s,state:a,key:s&&s.key||r||CN()}}function Eo({pathname:e="/",search:s="",hash:a=""}){return s&&s!=="?"&&(e+=s.charAt(0)==="?"?s:"?"+s),a&&a!=="#"&&(e+=a.charAt(0)==="#"?a:"#"+a),e}function rl(e){let s={};if(e){let a=e.indexOf("#");a>=0&&(s.hash=e.substring(a),e=e.substring(0,a));let r=e.indexOf("?");r>=0&&(s.search=e.substring(r),e=e.substring(0,r)),e&&(s.pathname=e)}return s}function TN(e,s,a,r={}){let{window:o=document.defaultView,v5Compat:c=!1}=r,d=o.history,h="POP",m=null,f=p();f==null&&(f=0,d.replaceState({...d.state,idx:f},""));function p(){return(d.state||{idx:null}).idx}function b(){h="POP";let w=p(),j=w==null?null:w-f;f=w,m&&m({action:h,location:S.location,delta:j})}function v(w,j){h="PUSH";let C=lm(S.location,w,j);f=p()+1;let T=Xb(C,f),D=S.createHref(C);try{d.pushState(T,"",D)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;o.location.assign(D)}c&&m&&m({action:h,location:S.location,delta:1})}function y(w,j){h="REPLACE";let C=lm(S.location,w,j);f=p();let T=Xb(C,f),D=S.createHref(C);d.replaceState(T,"",D),c&&m&&m({action:h,location:S.location,delta:0})}function N(w){return EN(w)}let S={get action(){return h},get location(){return e(o,d)},listen(w){if(m)throw new Error("A history only accepts one active listener");return o.addEventListener(Jb,b),m=w,()=>{o.removeEventListener(Jb,b),m=null}},createHref(w){return s(o,w)},createURL:N,encodeLocation(w){let j=N(w);return{pathname:j.pathname,search:j.search,hash:j.hash}},push:v,replace:y,go(w){return d.go(w)}};return S}function EN(e,s=!1){let a="http://localhost";typeof window<"u"&&(a=window.location.origin!=="null"?window.location.origin:window.location.href),wt(a,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Eo(e);return r=r.replace(/ $/,"%20"),!s&&r.startsWith("//")&&(r=a+r),new URL(r,a)}function P1(e,s,a="/"){return AN(e,s,a,!1)}function AN(e,s,a,r){let o=typeof s=="string"?rl(s):s,c=ja(o.pathname||"/",a);if(c==null)return null;let d=q1(e);MN(d);let h=null;for(let m=0;h==null&&m<d.length;++m){let f=qN(c);h=HN(d[m],f,r)}return h}function q1(e,s=[],a=[],r="",o=!1){let c=(d,h,m=o,f)=>{let p={relativePath:f===void 0?d.path||"":f,caseSensitive:d.caseSensitive===!0,childrenIndex:h,route:d};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&m)return;wt(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let b=va([r,p.relativePath]),v=a.concat(p);d.children&&d.children.length>0&&(wt(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),q1(d.children,s,v,b,m)),!(d.path==null&&!d.index)&&s.push({path:b,score:BN(b,d.index),routesMeta:v})};return e.forEach((d,h)=>{var m;if(d.path===""||!((m=d.path)!=null&&m.includes("?")))c(d,h);else for(let f of F1(d.path))c(d,h,!0,f)}),s}function F1(e){let s=e.split("/");if(s.length===0)return[];let[a,...r]=s,o=a.endsWith("?"),c=a.replace(/\?$/,"");if(r.length===0)return o?[c,""]:[c];let d=F1(r.join("/")),h=[];return h.push(...d.map(m=>m===""?c:[c,m].join("/"))),o&&h.push(...d),h.map(m=>e.startsWith("/")&&m===""?"/":m)}function MN(e){e.sort((s,a)=>s.score!==a.score?a.score-s.score:IN(s.routesMeta.map(r=>r.childrenIndex),a.routesMeta.map(r=>r.childrenIndex)))}var DN=/^:[\w-]+$/,ON=3,RN=2,_N=1,LN=10,UN=-2,Kb=e=>e==="*";function BN(e,s){let a=e.split("/"),r=a.length;return a.some(Kb)&&(r+=UN),s&&(r+=RN),a.filter(o=>!Kb(o)).reduce((o,c)=>o+(DN.test(c)?ON:c===""?_N:LN),r)}function IN(e,s){return e.length===s.length&&e.slice(0,-1).every((r,o)=>r===s[o])?e[e.length-1]-s[s.length-1]:0}function HN(e,s,a=!1){let{routesMeta:r}=e,o={},c="/",d=[];for(let h=0;h<r.length;++h){let m=r[h],f=h===r.length-1,p=c==="/"?s:s.slice(c.length)||"/",b=Au({path:m.relativePath,caseSensitive:m.caseSensitive,end:f},p),v=m.route;if(!b&&f&&a&&!r[r.length-1].route.index&&(b=Au({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},p)),!b)return null;Object.assign(o,b.params),d.push({params:o,pathname:va([c,b.pathname]),pathnameBase:GN(va([c,b.pathnameBase])),route:v}),b.pathnameBase!=="/"&&(c=va([c,b.pathnameBase]))}return d}function Au(e,s){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[a,r]=PN(e.path,e.caseSensitive,e.end),o=s.match(a);if(!o)return null;let c=o[0],d=c.replace(/(.)\/+$/,"$1"),h=o.slice(1);return{params:r.reduce((f,{paramName:p,isOptional:b},v)=>{if(p==="*"){let N=h[v]||"";d=c.slice(0,c.length-N.length).replace(/(.)\/+$/,"$1")}const y=h[v];return b&&!y?f[p]=void 0:f[p]=(y||"").replace(/%2F/g,"/"),f},{}),pathname:c,pathnameBase:d,pattern:e}}function PN(e,s=!1,a=!0){xs(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,h,m)=>(r.push({paramName:h,isOptional:m!=null}),m?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,s?void 0:"i"),r]}function qN(e){try{return e.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return xs(!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 (${s}).`),e}}function ja(e,s){if(s==="/")return e;if(!e.toLowerCase().startsWith(s.toLowerCase()))return null;let a=s.endsWith("/")?s.length-1:s.length,r=e.charAt(a);return r&&r!=="/"?null:e.slice(a)||"/"}var FN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function $N(e,s="/"){let{pathname:a,search:r="",hash:o=""}=typeof e=="string"?rl(e):e,c;return a?(a=a.replace(/\/\/+/g,"/"),a.startsWith("/")?c=Zb(a.substring(1),"/"):c=Zb(a,s)):c=s,{pathname:c,search:YN(r),hash:QN(o)}}function Zb(e,s){let a=s.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?a.length>1&&a.pop():o!=="."&&a.push(o)}),a.length>1?a.join("/"):"/"}function Ef(e,s,a,r){return`Cannot include a '${e}' character in a manually specified \`to.${s}\` field [${JSON.stringify(r)}].  Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function VN(e){return e.filter((s,a)=>a===0||s.route.path&&s.route.path.length>0)}function qm(e){let s=VN(e);return s.map((a,r)=>r===s.length-1?a.pathname:a.pathnameBase)}function Fm(e,s,a,r=!1){let o;typeof e=="string"?o=rl(e):(o={...e},wt(!o.pathname||!o.pathname.includes("?"),Ef("?","pathname","search",o)),wt(!o.pathname||!o.pathname.includes("#"),Ef("#","pathname","hash",o)),wt(!o.search||!o.search.includes("#"),Ef("#","search","hash",o)));let c=e===""||o.pathname==="",d=c?"/":o.pathname,h;if(d==null)h=a;else{let b=s.length-1;if(!r&&d.startsWith("..")){let v=d.split("/");for(;v[0]==="..";)v.shift(),b-=1;o.pathname=v.join("/")}h=b>=0?s[b]:"/"}let m=$N(o,h),f=d&&d!=="/"&&d.endsWith("/"),p=(c||d===".")&&a.endsWith("/");return!m.pathname.endsWith("/")&&(f||p)&&(m.pathname+="/"),m}var va=e=>e.join("/").replace(/\/\/+/g,"/"),GN=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),YN=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,QN=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,JN=class{constructor(e,s,a,r=!1){this.status=e,this.statusText=s||"",this.internal=r,a instanceof Error?(this.data=a.toString(),this.error=a):this.data=a}};function XN(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function KN(e){return e.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var $1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function V1(e,s){let a=e;if(typeof a!="string"||!FN.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let r=a,o=!1;if($1)try{let c=new URL(window.location.href),d=a.startsWith("//")?new URL(c.protocol+a):new URL(a),h=ja(d.pathname,s);d.origin===c.origin&&h!=null?a=h+d.search+d.hash:o=!0}catch{xs(!1,`<Link to="${a}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:o,to:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var G1=["POST","PUT","PATCH","DELETE"];new Set(G1);var ZN=["GET",...G1];new Set(ZN);var ll=k.createContext(null);ll.displayName="DataRouter";var Fu=k.createContext(null);Fu.displayName="DataRouterState";var WN=k.createContext(!1),Y1=k.createContext({isTransitioning:!1});Y1.displayName="ViewTransition";var ek=k.createContext(new Map);ek.displayName="Fetchers";var tk=k.createContext(null);tk.displayName="Await";var es=k.createContext(null);es.displayName="Navigation";var Bo=k.createContext(null);Bo.displayName="Location";var Ts=k.createContext({outlet:null,matches:[],isDataRoute:!1});Ts.displayName="Route";var $m=k.createContext(null);$m.displayName="RouteError";var Q1="REACT_ROUTER_ERROR",nk="REDIRECT",sk="ROUTE_ERROR_RESPONSE";function ak(e){if(e.startsWith(`${Q1}:${nk}:{`))try{let s=JSON.parse(e.slice(28));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.location=="string"&&typeof s.reloadDocument=="boolean"&&typeof s.replace=="boolean")return s}catch{}}function ik(e){if(e.startsWith(`${Q1}:${sk}:{`))try{let s=JSON.parse(e.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new JN(s.status,s.statusText,s.data)}catch{}}function rk(e,{relative:s}={}){wt(ol(),"useHref() may be used only in the context of a <Router> component.");let{basename:a,navigator:r}=k.useContext(es),{hash:o,pathname:c,search:d}=Io(e,{relative:s}),h=c;return a!=="/"&&(h=c==="/"?a:va([a,c])),r.createHref({pathname:h,search:d,hash:o})}function ol(){return k.useContext(Bo)!=null}function gs(){return wt(ol(),"useLocation() may be used only in the context of a <Router> component."),k.useContext(Bo).location}var J1="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function X1(e){k.useContext(es).static||k.useLayoutEffect(e)}function hn(){let{isDataRoute:e}=k.useContext(Ts);return e?yk():lk()}function lk(){wt(ol(),"useNavigate() may be used only in the context of a <Router> component.");let e=k.useContext(ll),{basename:s,navigator:a}=k.useContext(es),{matches:r}=k.useContext(Ts),{pathname:o}=gs(),c=JSON.stringify(qm(r)),d=k.useRef(!1);return X1(()=>{d.current=!0}),k.useCallback((m,f={})=>{if(xs(d.current,J1),!d.current)return;if(typeof m=="number"){a.go(m);return}let p=Fm(m,JSON.parse(c),o,f.relative==="path");e==null&&s!=="/"&&(p.pathname=p.pathname==="/"?s:va([s,p.pathname])),(f.replace?a.replace:a.push)(p,f.state,f)},[s,a,c,o,e])}k.createContext(null);function K1(){let{matches:e}=k.useContext(Ts),s=e[e.length-1];return s?s.params:{}}function Io(e,{relative:s}={}){let{matches:a}=k.useContext(Ts),{pathname:r}=gs(),o=JSON.stringify(qm(a));return k.useMemo(()=>Fm(e,JSON.parse(o),r,s==="path"),[e,o,r,s])}function ok(e,s){return Z1(e,s)}function Z1(e,s,a,r,o){var C;wt(ol(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:c}=k.useContext(es),{matches:d}=k.useContext(Ts),h=d[d.length-1],m=h?h.params:{},f=h?h.pathname:"/",p=h?h.pathnameBase:"/",b=h&&h.route;{let T=b&&b.path||"";ev(f,!b||T.endsWith("*")||T.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${T}">) 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="${T}"> to <Route path="${T==="/"?"*":`${T}/*`}">.`)}let v=gs(),y;if(s){let T=typeof s=="string"?rl(s):s;wt(p==="/"||((C=T.pathname)==null?void 0:C.startsWith(p)),`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 "${p}" but pathname "${T.pathname}" was given in the \`location\` prop.`),y=T}else y=v;let N=y.pathname||"/",S=N;if(p!=="/"){let T=p.replace(/^\//,"").split("/");S="/"+N.replace(/^\//,"").split("/").slice(T.length).join("/")}let w=P1(e,{pathname:S});xs(b||w!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),xs(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.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=fk(w&&w.map(T=>Object.assign({},T,{params:Object.assign({},m,T.params),pathname:va([p,c.encodeLocation?c.encodeLocation(T.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?p:va([p,c.encodeLocation?c.encodeLocation(T.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),d,a,r,o);return s&&j?k.createElement(Bo.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...y},navigationType:"POP"}},j):j}function ck(){let e=bk(),s=XN(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),a=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},c={padding:"2px 4px",backgroundColor:r},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=k.createElement(k.Fragment,null,k.createElement("p",null,"💿 Hey developer 👋"),k.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",k.createElement("code",{style:c},"ErrorBoundary")," or"," ",k.createElement("code",{style:c},"errorElement")," prop on your route.")),k.createElement(k.Fragment,null,k.createElement("h2",null,"Unexpected Application Error!"),k.createElement("h3",{style:{fontStyle:"italic"}},s),a?k.createElement("pre",{style:o},a):null,d)}var uk=k.createElement(ck,null),W1=class extends k.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,s){return s.location!==e.location||s.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:s.error,location:s.location,revalidation:e.revalidation||s.revalidation}}componentDidCatch(e,s){this.props.onError?this.props.onError(e,s):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 a=ik(e.digest);a&&(e=a)}let s=e!==void 0?k.createElement(Ts.Provider,{value:this.props.routeContext},k.createElement($m.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?k.createElement(dk,{error:e},s):s}};W1.contextType=WN;var Af=new WeakMap;function dk({children:e,error:s}){let{basename:a}=k.useContext(es);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=ak(s.digest);if(r){let o=Af.get(s);if(o)throw o;let c=V1(r.location,a);if($1&&!Af.get(s))if(c.isExternal||r.reloadDocument)window.location.href=c.absoluteURL||c.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:r.replace}));throw Af.set(s,d),d}return k.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c.absoluteURL||c.to}`})}}return e}function hk({routeContext:e,match:s,children:a}){let r=k.useContext(ll);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),k.createElement(Ts.Provider,{value:e},a)}function fk(e,s=[],a=null,r=null,o=null){if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(s.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let c=e,d=a==null?void 0:a.errors;if(d!=null){let p=c.findIndex(b=>b.route.id&&(d==null?void 0:d[b.route.id])!==void 0);wt(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),c=c.slice(0,Math.min(c.length,p+1))}let h=!1,m=-1;if(a)for(let p=0;p<c.length;p++){let b=c[p];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(m=p),b.route.id){let{loaderData:v,errors:y}=a,N=b.route.loader&&!v.hasOwnProperty(b.route.id)&&(!y||y[b.route.id]===void 0);if(b.route.lazy||N){h=!0,m>=0?c=c.slice(0,m+1):c=[c[0]];break}}}let f=a&&r?(p,b)=>{var v,y;r(p,{location:a.location,params:((y=(v=a.matches)==null?void 0:v[0])==null?void 0:y.params)??{},unstable_pattern:KN(a.matches),errorInfo:b})}:void 0;return c.reduceRight((p,b,v)=>{let y,N=!1,S=null,w=null;a&&(y=d&&b.route.id?d[b.route.id]:void 0,S=b.route.errorElement||uk,h&&(m<0&&v===0?(ev("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),N=!0,w=null):m===v&&(N=!0,w=b.route.hydrateFallbackElement||null)));let j=s.concat(c.slice(0,v+1)),C=()=>{let T;return y?T=S:N?T=w:b.route.Component?T=k.createElement(b.route.Component,null):b.route.element?T=b.route.element:T=p,k.createElement(hk,{match:b,routeContext:{outlet:p,matches:j,isDataRoute:a!=null},children:T})};return a&&(b.route.ErrorBoundary||b.route.errorElement||v===0)?k.createElement(W1,{location:a.location,revalidation:a.revalidation,component:S,error:y,children:C(),routeContext:{outlet:null,matches:j,isDataRoute:!0},onError:f}):C()},null)}function Vm(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function mk(e){let s=k.useContext(ll);return wt(s,Vm(e)),s}function xk(e){let s=k.useContext(Fu);return wt(s,Vm(e)),s}function pk(e){let s=k.useContext(Ts);return wt(s,Vm(e)),s}function Gm(e){let s=pk(e),a=s.matches[s.matches.length-1];return wt(a.route.id,`${e} can only be used on routes that contain a unique "id"`),a.route.id}function gk(){return Gm("useRouteId")}function bk(){var r;let e=k.useContext($m),s=xk("useRouteError"),a=Gm("useRouteError");return e!==void 0?e:(r=s.errors)==null?void 0:r[a]}function yk(){let{router:e}=mk("useNavigate"),s=Gm("useNavigate"),a=k.useRef(!1);return X1(()=>{a.current=!0}),k.useCallback(async(o,c={})=>{xs(a.current,J1),a.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:s,...c}))},[e,s])}var Wb={};function ev(e,s,a){!s&&!Wb[e]&&(Wb[e]=!0,xs(!1,a))}k.memo(vk);function vk({routes:e,future:s,state:a,onError:r}){return Z1(e,void 0,a,r,s)}function zu({to:e,replace:s,state:a,relative:r}){wt(ol(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=k.useContext(es);xs(!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}=k.useContext(Ts),{pathname:d}=gs(),h=hn(),m=Fm(e,qm(c),d,r==="path"),f=JSON.stringify(m);return k.useEffect(()=>{h(JSON.parse(f),{replace:s,state:a,relative:r})},[h,f,r,s,a]),null}function Ct(e){wt(!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 jk({basename:e="/",children:s=null,location:a,navigationType:r="POP",navigator:o,static:c=!1,unstable_useTransitions:d}){wt(!ol(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=e.replace(/^\/*/,"/"),m=k.useMemo(()=>({basename:h,navigator:o,static:c,unstable_useTransitions:d,future:{}}),[h,o,c,d]);typeof a=="string"&&(a=rl(a));let{pathname:f="/",search:p="",hash:b="",state:v=null,key:y="default"}=a,N=k.useMemo(()=>{let S=ja(f,h);return S==null?null:{location:{pathname:S,search:p,hash:b,state:v,key:y},navigationType:r}},[h,f,p,b,v,y,r]);return xs(N!=null,`<Router basename="${h}"> is not able to match the URL "${f}${p}${b}" because it does not start with the basename, so the <Router> won't render anything.`),N==null?null:k.createElement(es.Provider,{value:m},k.createElement(Bo.Provider,{children:s,value:N}))}function wk({children:e,location:s}){return ok(om(e),s)}function om(e,s=[]){let a=[];return k.Children.forEach(e,(r,o)=>{if(!k.isValidElement(r))return;let c=[...s,o];if(r.type===k.Fragment){a.push.apply(a,om(r.props.children,c));return}wt(r.type===Ct,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),wt(!r.props.index||!r.props.children,"An index route cannot have child routes.");let d={id:r.props.id||c.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(d.children=om(r.props.children,c)),a.push(d)}),a}var Nu="get",ku="application/x-www-form-urlencoded";function $u(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function zk(e){return $u(e)&&e.tagName.toLowerCase()==="button"}function Nk(e){return $u(e)&&e.tagName.toLowerCase()==="form"}function kk(e){return $u(e)&&e.tagName.toLowerCase()==="input"}function Sk(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ck(e,s){return e.button===0&&(!s||s==="_self")&&!Sk(e)}function cm(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((s,a)=>{let r=e[a];return s.concat(Array.isArray(r)?r.map(o=>[a,o]):[[a,r]])},[]))}function Tk(e,s){let a=cm(e);return s&&s.forEach((r,o)=>{a.has(o)||s.getAll(o).forEach(c=>{a.append(o,c)})}),a}var cu=null;function Ek(){if(cu===null)try{new FormData(document.createElement("form"),0),cu=!1}catch{cu=!0}return cu}var Ak=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Mf(e){return e!=null&&!Ak.has(e)?(xs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ku}"`),null):e}function Mk(e,s){let a,r,o,c,d;if(Nk(e)){let h=e.getAttribute("action");r=h?ja(h,s):null,a=e.getAttribute("method")||Nu,o=Mf(e.getAttribute("enctype"))||ku,c=new FormData(e)}else if(zk(e)||kk(e)&&(e.type==="submit"||e.type==="image")){let h=e.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||h.getAttribute("action");if(r=m?ja(m,s):null,a=e.getAttribute("formmethod")||h.getAttribute("method")||Nu,o=Mf(e.getAttribute("formenctype"))||Mf(h.getAttribute("enctype"))||ku,c=new FormData(h,e),!Ek()){let{name:f,type:p,value:b}=e;if(p==="image"){let v=f?`${f}.`:"";c.append(`${v}x`,"0"),c.append(`${v}y`,"0")}else f&&c.append(f,b)}}else{if($u(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=Nu,r=null,o=ku,d=e}return c&&o==="text/plain"&&(d=c,c=void 0),{action:r,method:a.toLowerCase(),encType:o,formData:c,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ym(e,s){if(e===!1||e===null||typeof e>"u")throw new Error(s)}function Dk(e,s,a,r){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return a?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${r}`:o.pathname=`${o.pathname}.${r}`:o.pathname==="/"?o.pathname=`_root.${r}`:s&&ja(o.pathname,s)==="/"?o.pathname=`${s.replace(/\/$/,"")}/_root.${r}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${r}`,o}async function Ok(e,s){if(e.id in s)return s[e.id];try{let a=await import(e.module);return s[e.id]=a,a}catch(a){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(a),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Rk(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 _k(e,s,a){let r=await Promise.all(e.map(async o=>{let c=s.routes[o.route.id];if(c){let d=await Ok(c,a);return d.links?d.links():[]}return[]}));return Ik(r.flat(1).filter(Rk).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function ey(e,s,a,r,o,c){let d=(m,f)=>a[f]?m.route.id!==a[f].route.id:!0,h=(m,f)=>{var p;return a[f].pathname!==m.pathname||((p=a[f].route.path)==null?void 0:p.endsWith("*"))&&a[f].params["*"]!==m.params["*"]};return c==="assets"?s.filter((m,f)=>d(m,f)||h(m,f)):c==="data"?s.filter((m,f)=>{var b;let p=r.routes[m.route.id];if(!p||!p.hasLoader)return!1;if(d(m,f)||h(m,f))return!0;if(m.route.shouldRevalidate){let v=m.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((b=a[0])==null?void 0:b.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function Lk(e,s,{includeHydrateFallback:a}={}){return Uk(e.map(r=>{let o=s.routes[r.route.id];if(!o)return[];let c=[o.module];return o.clientActionModule&&(c=c.concat(o.clientActionModule)),o.clientLoaderModule&&(c=c.concat(o.clientLoaderModule)),a&&o.hydrateFallbackModule&&(c=c.concat(o.hydrateFallbackModule)),o.imports&&(c=c.concat(o.imports)),c}).flat(1))}function Uk(e){return[...new Set(e)]}function Bk(e){let s={},a=Object.keys(e).sort();for(let r of a)s[r]=e[r];return s}function Ik(e,s){let a=new Set;return new Set(s),e.reduce((r,o)=>{let c=JSON.stringify(Bk(o));return a.has(c)||(a.add(c),r.push({key:c,link:o})),r},[])}function tv(){let e=k.useContext(ll);return Ym(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Hk(){let e=k.useContext(Fu);return Ym(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Qm=k.createContext(void 0);Qm.displayName="FrameworkContext";function nv(){let e=k.useContext(Qm);return Ym(e,"You must render this element inside a <HydratedRouter> element"),e}function Pk(e,s){let a=k.useContext(Qm),[r,o]=k.useState(!1),[c,d]=k.useState(!1),{onFocus:h,onBlur:m,onMouseEnter:f,onMouseLeave:p,onTouchStart:b}=s,v=k.useRef(null);k.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let S=j=>{j.forEach(C=>{d(C.isIntersecting)})},w=new IntersectionObserver(S,{threshold:.5});return v.current&&w.observe(v.current),()=>{w.disconnect()}}},[e]),k.useEffect(()=>{if(r){let S=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(S)}}},[r]);let y=()=>{o(!0)},N=()=>{o(!1),d(!1)};return a?e!=="intent"?[c,v,{}]:[c,v,{onFocus:ho(h,y),onBlur:ho(m,N),onMouseEnter:ho(f,y),onMouseLeave:ho(p,N),onTouchStart:ho(b,y)}]:[!1,v,{}]}function ho(e,s){return a=>{e&&e(a),a.defaultPrevented||s(a)}}function qk({page:e,...s}){let{router:a}=tv(),r=k.useMemo(()=>P1(a.routes,e,a.basename),[a.routes,e,a.basename]);return r?k.createElement($k,{page:e,matches:r,...s}):null}function Fk(e){let{manifest:s,routeModules:a}=nv(),[r,o]=k.useState([]);return k.useEffect(()=>{let c=!1;return _k(e,s,a).then(d=>{c||o(d)}),()=>{c=!0}},[e,s,a]),r}function $k({page:e,matches:s,...a}){let r=gs(),{future:o,manifest:c,routeModules:d}=nv(),{basename:h}=tv(),{loaderData:m,matches:f}=Hk(),p=k.useMemo(()=>ey(e,s,f,c,r,"data"),[e,s,f,c,r]),b=k.useMemo(()=>ey(e,s,f,c,r,"assets"),[e,s,f,c,r]),v=k.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let S=new Set,w=!1;if(s.forEach(C=>{var D;let T=c.routes[C.route.id];!T||!T.hasLoader||(!p.some(E=>E.route.id===C.route.id)&&C.route.id in m&&((D=d[C.route.id])!=null&&D.shouldRevalidate)||T.hasClientLoader?w=!0:S.add(C.route.id))}),S.size===0)return[];let j=Dk(e,h,o.unstable_trailingSlashAwareDataRequests,"data");return w&&S.size>0&&j.searchParams.set("_routes",s.filter(C=>S.has(C.route.id)).map(C=>C.route.id).join(",")),[j.pathname+j.search]},[h,o.unstable_trailingSlashAwareDataRequests,m,r,c,p,s,e,d]),y=k.useMemo(()=>Lk(b,c),[b,c]),N=Fk(b);return k.createElement(k.Fragment,null,v.map(S=>k.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...a})),y.map(S=>k.createElement("link",{key:S,rel:"modulepreload",href:S,...a})),N.map(({key:S,link:w})=>k.createElement("link",{key:S,nonce:a.nonce,...w,crossOrigin:w.crossOrigin??a.crossOrigin})))}function Vk(...e){return s=>{e.forEach(a=>{typeof a=="function"?a(s):a!=null&&(a.current=s)})}}var Gk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Gk&&(window.__reactRouterVersion="7.13.0")}catch{}function Yk({basename:e,children:s,unstable_useTransitions:a,window:r}){let o=k.useRef();o.current==null&&(o.current=SN({window:r,v5Compat:!0}));let c=o.current,[d,h]=k.useState({action:c.action,location:c.location}),m=k.useCallback(f=>{a===!1?h(f):k.startTransition(()=>h(f))},[a]);return k.useLayoutEffect(()=>c.listen(m),[c,m]),k.createElement(jk,{basename:e,children:s,location:d.location,navigationType:d.action,navigator:c,unstable_useTransitions:a})}var sv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,av=k.forwardRef(function({onClick:s,discover:a="render",prefetch:r="none",relative:o,reloadDocument:c,replace:d,state:h,target:m,to:f,preventScrollReset:p,viewTransition:b,unstable_defaultShouldRevalidate:v,...y},N){let{basename:S,unstable_useTransitions:w}=k.useContext(es),j=typeof f=="string"&&sv.test(f),C=V1(f,S);f=C.to;let T=rk(f,{relative:o}),[D,E,A]=Pk(r,y),B=Kk(f,{replace:d,state:h,target:m,preventScrollReset:p,relative:o,viewTransition:b,unstable_defaultShouldRevalidate:v,unstable_useTransitions:w});function V(R){s&&s(R),R.defaultPrevented||B(R)}let ee=k.createElement("a",{...y,...A,href:C.absoluteURL||T,onClick:C.isExternal||c?s:V,ref:Vk(N,E),target:m,"data-discover":!j&&a==="render"?"true":void 0});return D&&!j?k.createElement(k.Fragment,null,ee,k.createElement(qk,{page:T})):ee});av.displayName="Link";var Qk=k.forwardRef(function({"aria-current":s="page",caseSensitive:a=!1,className:r="",end:o=!1,style:c,to:d,viewTransition:h,children:m,...f},p){let b=Io(d,{relative:f.relative}),v=gs(),y=k.useContext(Fu),{navigator:N,basename:S}=k.useContext(es),w=y!=null&&s5(b)&&h===!0,j=N.encodeLocation?N.encodeLocation(b).pathname:b.pathname,C=v.pathname,T=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;a||(C=C.toLowerCase(),T=T?T.toLowerCase():null,j=j.toLowerCase()),T&&S&&(T=ja(T,S)||T);const D=j!=="/"&&j.endsWith("/")?j.length-1:j.length;let E=C===j||!o&&C.startsWith(j)&&C.charAt(D)==="/",A=T!=null&&(T===j||!o&&T.startsWith(j)&&T.charAt(j.length)==="/"),B={isActive:E,isPending:A,isTransitioning:w},V=E?s:void 0,ee;typeof r=="function"?ee=r(B):ee=[r,E?"active":null,A?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let R=typeof c=="function"?c(B):c;return k.createElement(av,{...f,"aria-current":V,className:ee,ref:p,style:R,to:d,viewTransition:h},typeof m=="function"?m(B):m)});Qk.displayName="NavLink";var Jk=k.forwardRef(({discover:e="render",fetcherKey:s,navigate:a,reloadDocument:r,replace:o,state:c,method:d=Nu,action:h,onSubmit:m,relative:f,preventScrollReset:p,viewTransition:b,unstable_defaultShouldRevalidate:v,...y},N)=>{let{unstable_useTransitions:S}=k.useContext(es),w=t5(),j=n5(h,{relative:f}),C=d.toLowerCase()==="get"?"get":"post",T=typeof h=="string"&&sv.test(h),D=E=>{if(m&&m(E),E.defaultPrevented)return;E.preventDefault();let A=E.nativeEvent.submitter,B=(A==null?void 0:A.getAttribute("formmethod"))||d,V=()=>w(A||E.currentTarget,{fetcherKey:s,method:B,navigate:a,replace:o,state:c,relative:f,preventScrollReset:p,viewTransition:b,unstable_defaultShouldRevalidate:v});S&&a!==!1?k.startTransition(()=>V()):V()};return k.createElement("form",{ref:N,method:C,action:j,onSubmit:r?m:D,...y,"data-discover":!T&&e==="render"?"true":void 0})});Jk.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 iv(e){let s=k.useContext(ll);return wt(s,Xk(e)),s}function Kk(e,{target:s,replace:a,state:r,preventScrollReset:o,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:h,unstable_useTransitions:m}={}){let f=hn(),p=gs(),b=Io(e,{relative:c});return k.useCallback(v=>{if(Ck(v,s)){v.preventDefault();let y=a!==void 0?a:Eo(p)===Eo(b),N=()=>f(e,{replace:y,state:r,preventScrollReset:o,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:h});m?k.startTransition(()=>N()):N()}},[p,f,b,a,r,s,e,o,c,d,h,m])}function Zk(e){xs(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let s=k.useRef(cm(e)),a=k.useRef(!1),r=gs(),o=k.useMemo(()=>Tk(r.search,a.current?null:s.current),[r.search]),c=hn(),d=k.useCallback((h,m)=>{const f=cm(typeof h=="function"?h(new URLSearchParams(o)):h);a.current=!0,c("?"+f,m)},[c,o]);return[o,d]}var Wk=0,e5=()=>`__${String(++Wk)}__`;function t5(){let{router:e}=iv("useSubmit"),{basename:s}=k.useContext(es),a=gk(),r=e.fetch,o=e.navigate;return k.useCallback(async(c,d={})=>{let{action:h,method:m,encType:f,formData:p,body:b}=Mk(c,s);if(d.navigate===!1){let v=d.fetcherKey||e5();await r(v,a,d.action||h,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:p,body:b,formMethod:d.method||m,formEncType:d.encType||f,flushSync:d.flushSync})}else await o(d.action||h,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:p,body:b,formMethod:d.method||m,formEncType:d.encType||f,replace:d.replace,state:d.state,fromRouteId:a,flushSync:d.flushSync,viewTransition:d.viewTransition})},[r,o,s,a])}function n5(e,{relative:s}={}){let{basename:a}=k.useContext(es),r=k.useContext(Ts);wt(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),c={...Io(e||".",{relative:s})},d=gs();if(e==null){c.search=d.search;let h=new URLSearchParams(c.search),m=h.getAll("index");if(m.some(p=>p==="")){h.delete("index"),m.filter(b=>b).forEach(b=>h.append("index",b));let p=h.toString();c.search=p?`?${p}`:""}}return(!e||e===".")&&o.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),a!=="/"&&(c.pathname=c.pathname==="/"?a:va([a,c.pathname])),Eo(c)}function s5(e,{relative:s}={}){let a=k.useContext(Y1);wt(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=iv("useViewTransitionState"),o=Io(e,{relative:s});if(!a.isTransitioning)return!1;let c=ja(a.currentLocation.pathname,r)||a.currentLocation.pathname,d=ja(a.nextLocation.pathname,r)||a.nextLocation.pathname;return Au(o.pathname,d)!=null||Au(o.pathname,c)!=null}var Jm=H1();const a5=qu(Jm);var Vu=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(){}},i5={setTimeout:(e,s)=>setTimeout(e,s),clearTimeout:e=>clearTimeout(e),setInterval:(e,s)=>setInterval(e,s),clearInterval:e=>clearInterval(e)},ni,Hm,M1,r5=(M1=class{constructor(){We(this,ni,i5);We(this,Hm,!1)}setTimeoutProvider(e){Oe(this,ni,e)}setTimeout(e,s){return le(this,ni).setTimeout(e,s)}clearTimeout(e){le(this,ni).clearTimeout(e)}setInterval(e,s){return le(this,ni).setInterval(e,s)}clearInterval(e){le(this,ni).clearInterval(e)}},ni=new WeakMap,Hm=new WeakMap,M1),um=new r5;function l5(e){setTimeout(e,0)}var Gu=typeof window>"u"||"Deno"in globalThis;function Ns(){}function o5(e,s){return typeof e=="function"?e(s):e}function c5(e){return typeof e=="number"&&e>=0&&e!==1/0}function u5(e,s){return Math.max(e+(s||0)-Date.now(),0)}function dm(e,s){return typeof e=="function"?e(s):e}function d5(e,s){return typeof e=="function"?e(s):e}function ty(e,s){const{type:a="all",exact:r,fetchStatus:o,predicate:c,queryKey:d,stale:h}=e;if(d){if(r){if(s.queryHash!==Xm(d,s.options))return!1}else if(!Mo(s.queryKey,d))return!1}if(a!=="all"){const m=s.isActive();if(a==="active"&&!m||a==="inactive"&&m)return!1}return!(typeof h=="boolean"&&s.isStale()!==h||o&&o!==s.state.fetchStatus||c&&!c(s))}function ny(e,s){const{exact:a,status:r,predicate:o,mutationKey:c}=e;if(c){if(!s.options.mutationKey)return!1;if(a){if(Ao(s.options.mutationKey)!==Ao(c))return!1}else if(!Mo(s.options.mutationKey,c))return!1}return!(r&&s.state.status!==r||o&&!o(s))}function Xm(e,s){return((s==null?void 0:s.queryKeyHashFn)||Ao)(e)}function Ao(e){return JSON.stringify(e,(s,a)=>hm(a)?Object.keys(a).sort().reduce((r,o)=>(r[o]=a[o],r),{}):a)}function Mo(e,s){return e===s?!0:typeof e!=typeof s?!1:e&&s&&typeof e=="object"&&typeof s=="object"?Object.keys(s).every(a=>Mo(e[a],s[a])):!1}var h5=Object.prototype.hasOwnProperty;function rv(e,s,a=0){if(e===s)return e;if(a>500)return s;const r=sy(e)&&sy(s);if(!r&&!(hm(e)&&hm(s)))return s;const c=(r?e:Object.keys(e)).length,d=r?s:Object.keys(s),h=d.length,m=r?new Array(h):{};let f=0;for(let p=0;p<h;p++){const b=r?p:d[p],v=e[b],y=s[b];if(v===y){m[b]=v,(r?p<c:h5.call(e,b))&&f++;continue}if(v===null||y===null||typeof v!="object"||typeof y!="object"){m[b]=y;continue}const N=rv(v,y,a+1);m[b]=N,N===v&&f++}return c===h&&f===c?e:m}function sy(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function hm(e){if(!ay(e))return!1;const s=e.constructor;if(s===void 0)return!0;const a=s.prototype;return!(!ay(a)||!a.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ay(e){return Object.prototype.toString.call(e)==="[object Object]"}function f5(e){return new Promise(s=>{um.setTimeout(s,e)})}function m5(e,s,a){return typeof a.structuralSharing=="function"?a.structuralSharing(e,s):a.structuralSharing!==!1?rv(e,s):s}function x5(e,s,a=0){const r=[...e,s];return a&&r.length>a?r.slice(1):r}function p5(e,s,a=0){const r=[s,...e];return a&&r.length>a?r.slice(0,-1):r}var Km=Symbol();function lv(e,s){return!e.queryFn&&(s!=null&&s.initialPromise)?()=>s.initialPromise:!e.queryFn||e.queryFn===Km?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function g5(e,s,a){let r=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=s()),r||(r=!0,o.aborted?a():o.addEventListener("abort",a,{once:!0})),o)}),e}var Bi,si,Gr,D1,b5=(D1=class extends Vu{constructor(){super();We(this,Bi);We(this,si);We(this,Gr);Oe(this,Gr,s=>{if(!Gu&&window.addEventListener){const a=()=>s();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}})}onSubscribe(){le(this,si)||this.setEventListener(le(this,Gr))}onUnsubscribe(){var s;this.hasListeners()||((s=le(this,si))==null||s.call(this),Oe(this,si,void 0))}setEventListener(s){var a;Oe(this,Gr,s),(a=le(this,si))==null||a.call(this),Oe(this,si,s(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(s){le(this,Bi)!==s&&(Oe(this,Bi,s),this.onFocus())}onFocus(){const s=this.isFocused();this.listeners.forEach(a=>{a(s)})}isFocused(){var s;return typeof le(this,Bi)=="boolean"?le(this,Bi):((s=globalThis.document)==null?void 0:s.visibilityState)!=="hidden"}},Bi=new WeakMap,si=new WeakMap,Gr=new WeakMap,D1),ov=new b5;function y5(){let e,s;const a=new Promise((o,c)=>{e=o,s=c});a.status="pending",a.catch(()=>{});function r(o){Object.assign(a,o),delete a.resolve,delete a.reject}return a.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},a.reject=o=>{r({status:"rejected",reason:o}),s(o)},a}var v5=l5;function j5(){let e=[],s=0,a=h=>{h()},r=h=>{h()},o=v5;const c=h=>{s?e.push(h):o(()=>{a(h)})},d=()=>{const h=e;e=[],h.length&&o(()=>{r(()=>{h.forEach(m=>{a(m)})})})};return{batch:h=>{let m;s++;try{m=h()}finally{s--,s||d()}return m},batchCalls:h=>(...m)=>{c(()=>{h(...m)})},schedule:c,setNotifyFunction:h=>{a=h},setBatchNotifyFunction:h=>{r=h},setScheduler:h=>{o=h}}}var Nn=j5(),Yr,ai,Qr,O1,w5=(O1=class extends Vu{constructor(){super();We(this,Yr,!0);We(this,ai);We(this,Qr);Oe(this,Qr,s=>{if(!Gu&&window.addEventListener){const a=()=>s(!0),r=()=>s(!1);return window.addEventListener("online",a,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",a),window.removeEventListener("offline",r)}}})}onSubscribe(){le(this,ai)||this.setEventListener(le(this,Qr))}onUnsubscribe(){var s;this.hasListeners()||((s=le(this,ai))==null||s.call(this),Oe(this,ai,void 0))}setEventListener(s){var a;Oe(this,Qr,s),(a=le(this,ai))==null||a.call(this),Oe(this,ai,s(this.setOnline.bind(this)))}setOnline(s){le(this,Yr)!==s&&(Oe(this,Yr,s),this.listeners.forEach(r=>{r(s)}))}isOnline(){return le(this,Yr)}},Yr=new WeakMap,ai=new WeakMap,Qr=new WeakMap,O1),Mu=new w5;function z5(e){return Math.min(1e3*2**e,3e4)}function cv(e){return(e??"online")==="online"?Mu.isOnline():!0}var fm=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function uv(e){let s=!1,a=0,r;const o=y5(),c=()=>o.status!=="pending",d=S=>{var w;if(!c()){const j=new fm(S);v(j),(w=e.onCancel)==null||w.call(e,j)}},h=()=>{s=!0},m=()=>{s=!1},f=()=>ov.isFocused()&&(e.networkMode==="always"||Mu.isOnline())&&e.canRun(),p=()=>cv(e.networkMode)&&e.canRun(),b=S=>{c()||(r==null||r(),o.resolve(S))},v=S=>{c()||(r==null||r(),o.reject(S))},y=()=>new Promise(S=>{var w;r=j=>{(c()||f())&&S(j)},(w=e.onPause)==null||w.call(e)}).then(()=>{var S;r=void 0,c()||(S=e.onContinue)==null||S.call(e)}),N=()=>{if(c())return;let S;const w=a===0?e.initialPromise:void 0;try{S=w??e.fn()}catch(j){S=Promise.reject(j)}Promise.resolve(S).then(b).catch(j=>{var A;if(c())return;const C=e.retry??(Gu?0:3),T=e.retryDelay??z5,D=typeof T=="function"?T(a,j):T,E=C===!0||typeof C=="number"&&a<C||typeof C=="function"&&C(a,j);if(s||!E){v(j);return}a++,(A=e.onFail)==null||A.call(e,a,j),f5(D).then(()=>f()?void 0:y()).then(()=>{s?v(j):N()})})};return{promise:o,status:()=>o.status,cancel:d,continue:()=>(r==null||r(),o),cancelRetry:h,continueRetry:m,canStart:p,start:()=>(p()?N():y().then(N),o)}}var Ii,R1,dv=(R1=class{constructor(){We(this,Ii)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),c5(this.gcTime)&&Oe(this,Ii,um.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Gu?1/0:300*1e3))}clearGcTimeout(){le(this,Ii)&&(um.clearTimeout(le(this,Ii)),Oe(this,Ii,void 0))}},Ii=new WeakMap,R1),Hi,Jr,fs,Pi,Kt,_o,qi,ks,ga,_1,N5=(_1=class extends dv{constructor(s){super();We(this,ks);We(this,Hi);We(this,Jr);We(this,fs);We(this,Pi);We(this,Kt);We(this,_o);We(this,qi);Oe(this,qi,!1),Oe(this,_o,s.defaultOptions),this.setOptions(s.options),this.observers=[],Oe(this,Pi,s.client),Oe(this,fs,le(this,Pi).getQueryCache()),this.queryKey=s.queryKey,this.queryHash=s.queryHash,Oe(this,Hi,ry(this.options)),this.state=s.state??le(this,Hi),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var s;return(s=le(this,Kt))==null?void 0:s.promise}setOptions(s){if(this.options={...le(this,_o),...s},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const a=ry(this.options);a.data!==void 0&&(this.setState(iy(a.data,a.dataUpdatedAt)),Oe(this,Hi,a))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&le(this,fs).remove(this)}setData(s,a){const r=m5(this.state.data,s,this.options);return xn(this,ks,ga).call(this,{data:r,type:"success",dataUpdatedAt:a==null?void 0:a.updatedAt,manual:a==null?void 0:a.manual}),r}setState(s,a){xn(this,ks,ga).call(this,{type:"setState",state:s,setStateOptions:a})}cancel(s){var r,o;const a=(r=le(this,Kt))==null?void 0:r.promise;return(o=le(this,Kt))==null||o.cancel(s),a?a.then(Ns).catch(Ns):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(le(this,Hi))}isActive(){return this.observers.some(s=>d5(s.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Km||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(s=>dm(s.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(s=>s.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(s=0){return this.state.data===void 0?!0:s==="static"?!1:this.state.isInvalidated?!0:!u5(this.state.dataUpdatedAt,s)}onFocus(){var a;const s=this.observers.find(r=>r.shouldFetchOnWindowFocus());s==null||s.refetch({cancelRefetch:!1}),(a=le(this,Kt))==null||a.continue()}onOnline(){var a;const s=this.observers.find(r=>r.shouldFetchOnReconnect());s==null||s.refetch({cancelRefetch:!1}),(a=le(this,Kt))==null||a.continue()}addObserver(s){this.observers.includes(s)||(this.observers.push(s),this.clearGcTimeout(),le(this,fs).notify({type:"observerAdded",query:this,observer:s}))}removeObserver(s){this.observers.includes(s)&&(this.observers=this.observers.filter(a=>a!==s),this.observers.length||(le(this,Kt)&&(le(this,qi)?le(this,Kt).cancel({revert:!0}):le(this,Kt).cancelRetry()),this.scheduleGc()),le(this,fs).notify({type:"observerRemoved",query:this,observer:s}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||xn(this,ks,ga).call(this,{type:"invalidate"})}async fetch(s,a){var m,f,p,b,v,y,N,S,w,j,C,T;if(this.state.fetchStatus!=="idle"&&((m=le(this,Kt))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(a!=null&&a.cancelRefetch))this.cancel({silent:!0});else if(le(this,Kt))return le(this,Kt).continueRetry(),le(this,Kt).promise}if(s&&this.setOptions(s),!this.options.queryFn){const D=this.observers.find(E=>E.options.queryFn);D&&this.setOptions(D.options)}const r=new AbortController,o=D=>{Object.defineProperty(D,"signal",{enumerable:!0,get:()=>(Oe(this,qi,!0),r.signal)})},c=()=>{const D=lv(this.options,a),A=(()=>{const B={client:le(this,Pi),queryKey:this.queryKey,meta:this.meta};return o(B),B})();return Oe(this,qi,!1),this.options.persister?this.options.persister(D,A,this):D(A)},h=(()=>{const D={fetchOptions:a,options:this.options,queryKey:this.queryKey,client:le(this,Pi),state:this.state,fetchFn:c};return o(D),D})();(f=this.options.behavior)==null||f.onFetch(h,this),Oe(this,Jr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=h.fetchOptions)==null?void 0:p.meta))&&xn(this,ks,ga).call(this,{type:"fetch",meta:(b=h.fetchOptions)==null?void 0:b.meta}),Oe(this,Kt,uv({initialPromise:a==null?void 0:a.initialPromise,fn:h.fetchFn,onCancel:D=>{D instanceof fm&&D.revert&&this.setState({...le(this,Jr),fetchStatus:"idle"}),r.abort()},onFail:(D,E)=>{xn(this,ks,ga).call(this,{type:"failed",failureCount:D,error:E})},onPause:()=>{xn(this,ks,ga).call(this,{type:"pause"})},onContinue:()=>{xn(this,ks,ga).call(this,{type:"continue"})},retry:h.options.retry,retryDelay:h.options.retryDelay,networkMode:h.options.networkMode,canRun:()=>!0}));try{const D=await le(this,Kt).start();if(D===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(D),(y=(v=le(this,fs).config).onSuccess)==null||y.call(v,D,this),(S=(N=le(this,fs).config).onSettled)==null||S.call(N,D,this.state.error,this),D}catch(D){if(D instanceof fm){if(D.silent)return le(this,Kt).promise;if(D.revert){if(this.state.data===void 0)throw D;return this.state.data}}throw xn(this,ks,ga).call(this,{type:"error",error:D}),(j=(w=le(this,fs).config).onError)==null||j.call(w,D,this),(T=(C=le(this,fs).config).onSettled)==null||T.call(C,this.state.data,D,this),D}finally{this.scheduleGc()}}},Hi=new WeakMap,Jr=new WeakMap,fs=new WeakMap,Pi=new WeakMap,Kt=new WeakMap,_o=new WeakMap,qi=new WeakMap,ks=new WeakSet,ga=function(s){const a=r=>{switch(s.type){case"failed":return{...r,fetchFailureCount:s.failureCount,fetchFailureReason:s.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...k5(r.data,this.options),fetchMeta:s.meta??null};case"success":const o={...r,...iy(s.data,s.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!s.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Oe(this,Jr,s.manual?o:void 0),o;case"error":const c=s.error;return{...r,error:c,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:c,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...s.state}}};this.state=a(this.state),Nn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),le(this,fs).notify({query:this,type:"updated",action:s})})},_1);function k5(e,s){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:cv(s.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function iy(e,s){return{data:e,dataUpdatedAt:s??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ry(e){const s=typeof e.initialData=="function"?e.initialData():e.initialData,a=s!==void 0,r=a?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:s,dataUpdateCount:0,dataUpdatedAt:a?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}function ly(e){return{onFetch:(s,a)=>{var p,b,v,y,N;const r=s.options,o=(v=(b=(p=s.fetchOptions)==null?void 0:p.meta)==null?void 0:b.fetchMore)==null?void 0:v.direction,c=((y=s.state.data)==null?void 0:y.pages)||[],d=((N=s.state.data)==null?void 0:N.pageParams)||[];let h={pages:[],pageParams:[]},m=0;const f=async()=>{let S=!1;const w=T=>{g5(T,()=>s.signal,()=>S=!0)},j=lv(s.options,s.fetchOptions),C=async(T,D,E)=>{if(S)return Promise.reject();if(D==null&&T.pages.length)return Promise.resolve(T);const B=(()=>{const F={client:s.client,queryKey:s.queryKey,pageParam:D,direction:E?"backward":"forward",meta:s.options.meta};return w(F),F})(),V=await j(B),{maxPages:ee}=s.options,R=E?p5:x5;return{pages:R(T.pages,V,ee),pageParams:R(T.pageParams,D,ee)}};if(o&&c.length){const T=o==="backward",D=T?S5:oy,E={pages:c,pageParams:d},A=D(r,E);h=await C(E,A,T)}else{const T=e??c.length;do{const D=m===0?d[0]??r.initialPageParam:oy(r,h);if(m>0&&D==null)break;h=await C(h,D),m++}while(m<T)}return h};s.options.persister?s.fetchFn=()=>{var S,w;return(w=(S=s.options).persister)==null?void 0:w.call(S,f,{client:s.client,queryKey:s.queryKey,meta:s.options.meta,signal:s.signal},a)}:s.fetchFn=f}}}function oy(e,{pages:s,pageParams:a}){const r=s.length-1;return s.length>0?e.getNextPageParam(s[r],s,a[r],a):void 0}function S5(e,{pages:s,pageParams:a}){var r;return s.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,s[0],s,a[0],a):void 0}var Lo,Hs,bn,Fi,Ps,ei,L1,C5=(L1=class extends dv{constructor(s){super();We(this,Ps);We(this,Lo);We(this,Hs);We(this,bn);We(this,Fi);Oe(this,Lo,s.client),this.mutationId=s.mutationId,Oe(this,bn,s.mutationCache),Oe(this,Hs,[]),this.state=s.state||T5(),this.setOptions(s.options),this.scheduleGc()}setOptions(s){this.options=s,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(s){le(this,Hs).includes(s)||(le(this,Hs).push(s),this.clearGcTimeout(),le(this,bn).notify({type:"observerAdded",mutation:this,observer:s}))}removeObserver(s){Oe(this,Hs,le(this,Hs).filter(a=>a!==s)),this.scheduleGc(),le(this,bn).notify({type:"observerRemoved",mutation:this,observer:s})}optionalRemove(){le(this,Hs).length||(this.state.status==="pending"?this.scheduleGc():le(this,bn).remove(this))}continue(){var s;return((s=le(this,Fi))==null?void 0:s.continue())??this.execute(this.state.variables)}async execute(s){var d,h,m,f,p,b,v,y,N,S,w,j,C,T,D,E,A,B;const a=()=>{xn(this,Ps,ei).call(this,{type:"continue"})},r={client:le(this,Lo),meta:this.options.meta,mutationKey:this.options.mutationKey};Oe(this,Fi,uv({fn:()=>this.options.mutationFn?this.options.mutationFn(s,r):Promise.reject(new Error("No mutationFn found")),onFail:(V,ee)=>{xn(this,Ps,ei).call(this,{type:"failed",failureCount:V,error:ee})},onPause:()=>{xn(this,Ps,ei).call(this,{type:"pause"})},onContinue:a,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>le(this,bn).canRun(this)}));const o=this.state.status==="pending",c=!le(this,Fi).canStart();try{if(o)a();else{xn(this,Ps,ei).call(this,{type:"pending",variables:s,isPaused:c}),le(this,bn).config.onMutate&&await le(this,bn).config.onMutate(s,this,r);const ee=await((h=(d=this.options).onMutate)==null?void 0:h.call(d,s,r));ee!==this.state.context&&xn(this,Ps,ei).call(this,{type:"pending",context:ee,variables:s,isPaused:c})}const V=await le(this,Fi).start();return await((f=(m=le(this,bn).config).onSuccess)==null?void 0:f.call(m,V,s,this.state.context,this,r)),await((b=(p=this.options).onSuccess)==null?void 0:b.call(p,V,s,this.state.context,r)),await((y=(v=le(this,bn).config).onSettled)==null?void 0:y.call(v,V,null,this.state.variables,this.state.context,this,r)),await((S=(N=this.options).onSettled)==null?void 0:S.call(N,V,null,s,this.state.context,r)),xn(this,Ps,ei).call(this,{type:"success",data:V}),V}catch(V){try{await((j=(w=le(this,bn).config).onError)==null?void 0:j.call(w,V,s,this.state.context,this,r))}catch(ee){Promise.reject(ee)}try{await((T=(C=this.options).onError)==null?void 0:T.call(C,V,s,this.state.context,r))}catch(ee){Promise.reject(ee)}try{await((E=(D=le(this,bn).config).onSettled)==null?void 0:E.call(D,void 0,V,this.state.variables,this.state.context,this,r))}catch(ee){Promise.reject(ee)}try{await((B=(A=this.options).onSettled)==null?void 0:B.call(A,void 0,V,s,this.state.context,r))}catch(ee){Promise.reject(ee)}throw xn(this,Ps,ei).call(this,{type:"error",error:V}),V}finally{le(this,bn).runNext(this)}}},Lo=new WeakMap,Hs=new WeakMap,bn=new WeakMap,Fi=new WeakMap,Ps=new WeakSet,ei=function(s){const a=r=>{switch(s.type){case"failed":return{...r,failureCount:s.failureCount,failureReason:s.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:s.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:s.isPaused,status:"pending",variables:s.variables,submittedAt:Date.now()};case"success":return{...r,data:s.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:s.error,failureCount:r.failureCount+1,failureReason:s.error,isPaused:!1,status:"error"}}};this.state=a(this.state),Nn.batch(()=>{le(this,Hs).forEach(r=>{r.onMutationUpdate(s)}),le(this,bn).notify({mutation:this,type:"updated",action:s})})},L1);function T5(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ba,Ss,Uo,U1,E5=(U1=class extends Vu{constructor(s={}){super();We(this,ba);We(this,Ss);We(this,Uo);this.config=s,Oe(this,ba,new Set),Oe(this,Ss,new Map),Oe(this,Uo,0)}build(s,a,r){const o=new C5({client:s,mutationCache:this,mutationId:++ou(this,Uo)._,options:s.defaultMutationOptions(a),state:r});return this.add(o),o}add(s){le(this,ba).add(s);const a=uu(s);if(typeof a=="string"){const r=le(this,Ss).get(a);r?r.push(s):le(this,Ss).set(a,[s])}this.notify({type:"added",mutation:s})}remove(s){if(le(this,ba).delete(s)){const a=uu(s);if(typeof a=="string"){const r=le(this,Ss).get(a);if(r)if(r.length>1){const o=r.indexOf(s);o!==-1&&r.splice(o,1)}else r[0]===s&&le(this,Ss).delete(a)}}this.notify({type:"removed",mutation:s})}canRun(s){const a=uu(s);if(typeof a=="string"){const r=le(this,Ss).get(a),o=r==null?void 0:r.find(c=>c.state.status==="pending");return!o||o===s}else return!0}runNext(s){var r;const a=uu(s);if(typeof a=="string"){const o=(r=le(this,Ss).get(a))==null?void 0:r.find(c=>c!==s&&c.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Nn.batch(()=>{le(this,ba).forEach(s=>{this.notify({type:"removed",mutation:s})}),le(this,ba).clear(),le(this,Ss).clear()})}getAll(){return Array.from(le(this,ba))}find(s){const a={exact:!0,...s};return this.getAll().find(r=>ny(a,r))}findAll(s={}){return this.getAll().filter(a=>ny(s,a))}notify(s){Nn.batch(()=>{this.listeners.forEach(a=>{a(s)})})}resumePausedMutations(){const s=this.getAll().filter(a=>a.state.isPaused);return Nn.batch(()=>Promise.all(s.map(a=>a.continue().catch(Ns))))}},ba=new WeakMap,Ss=new WeakMap,Uo=new WeakMap,U1);function uu(e){var s;return(s=e.options.scope)==null?void 0:s.id}var qs,B1,A5=(B1=class extends Vu{constructor(s={}){super();We(this,qs);this.config=s,Oe(this,qs,new Map)}build(s,a,r){const o=a.queryKey,c=a.queryHash??Xm(o,a);let d=this.get(c);return d||(d=new N5({client:s,queryKey:o,queryHash:c,options:s.defaultQueryOptions(a),state:r,defaultOptions:s.getQueryDefaults(o)}),this.add(d)),d}add(s){le(this,qs).has(s.queryHash)||(le(this,qs).set(s.queryHash,s),this.notify({type:"added",query:s}))}remove(s){const a=le(this,qs).get(s.queryHash);a&&(s.destroy(),a===s&&le(this,qs).delete(s.queryHash),this.notify({type:"removed",query:s}))}clear(){Nn.batch(()=>{this.getAll().forEach(s=>{this.remove(s)})})}get(s){return le(this,qs).get(s)}getAll(){return[...le(this,qs).values()]}find(s){const a={exact:!0,...s};return this.getAll().find(r=>ty(a,r))}findAll(s={}){const a=this.getAll();return Object.keys(s).length>0?a.filter(r=>ty(s,r)):a}notify(s){Nn.batch(()=>{this.listeners.forEach(a=>{a(s)})})}onFocus(){Nn.batch(()=>{this.getAll().forEach(s=>{s.onFocus()})})}onOnline(){Nn.batch(()=>{this.getAll().forEach(s=>{s.onOnline()})})}},qs=new WeakMap,B1),Tt,ii,ri,Xr,Kr,li,Zr,Wr,I1,M5=(I1=class{constructor(e={}){We(this,Tt);We(this,ii);We(this,ri);We(this,Xr);We(this,Kr);We(this,li);We(this,Zr);We(this,Wr);Oe(this,Tt,e.queryCache||new A5),Oe(this,ii,e.mutationCache||new E5),Oe(this,ri,e.defaultOptions||{}),Oe(this,Xr,new Map),Oe(this,Kr,new Map),Oe(this,li,0)}mount(){ou(this,li)._++,le(this,li)===1&&(Oe(this,Zr,ov.subscribe(async e=>{e&&(await this.resumePausedMutations(),le(this,Tt).onFocus())})),Oe(this,Wr,Mu.subscribe(async e=>{e&&(await this.resumePausedMutations(),le(this,Tt).onOnline())})))}unmount(){var e,s;ou(this,li)._--,le(this,li)===0&&((e=le(this,Zr))==null||e.call(this),Oe(this,Zr,void 0),(s=le(this,Wr))==null||s.call(this),Oe(this,Wr,void 0))}isFetching(e){return le(this,Tt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return le(this,ii).findAll({...e,status:"pending"}).length}getQueryData(e){var a;const s=this.defaultQueryOptions({queryKey:e});return(a=le(this,Tt).get(s.queryHash))==null?void 0:a.state.data}ensureQueryData(e){const s=this.defaultQueryOptions(e),a=le(this,Tt).build(this,s),r=a.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&a.isStaleByTime(dm(s.staleTime,a))&&this.prefetchQuery(s),Promise.resolve(r))}getQueriesData(e){return le(this,Tt).findAll(e).map(({queryKey:s,state:a})=>{const r=a.data;return[s,r]})}setQueryData(e,s,a){const r=this.defaultQueryOptions({queryKey:e}),o=le(this,Tt).get(r.queryHash),c=o==null?void 0:o.state.data,d=o5(s,c);if(d!==void 0)return le(this,Tt).build(this,r).setData(d,{...a,manual:!0})}setQueriesData(e,s,a){return Nn.batch(()=>le(this,Tt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,s,a)]))}getQueryState(e){var a;const s=this.defaultQueryOptions({queryKey:e});return(a=le(this,Tt).get(s.queryHash))==null?void 0:a.state}removeQueries(e){const s=le(this,Tt);Nn.batch(()=>{s.findAll(e).forEach(a=>{s.remove(a)})})}resetQueries(e,s){const a=le(this,Tt);return Nn.batch(()=>(a.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},s)))}cancelQueries(e,s={}){const a={revert:!0,...s},r=Nn.batch(()=>le(this,Tt).findAll(e).map(o=>o.cancel(a)));return Promise.all(r).then(Ns).catch(Ns)}invalidateQueries(e,s={}){return Nn.batch(()=>(le(this,Tt).findAll(e).forEach(a=>{a.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"},s)))}refetchQueries(e,s={}){const a={...s,cancelRefetch:s.cancelRefetch??!0},r=Nn.batch(()=>le(this,Tt).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let c=o.fetch(void 0,a);return a.throwOnError||(c=c.catch(Ns)),o.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(r).then(Ns)}fetchQuery(e){const s=this.defaultQueryOptions(e);s.retry===void 0&&(s.retry=!1);const a=le(this,Tt).build(this,s);return a.isStaleByTime(dm(s.staleTime,a))?a.fetch(s):Promise.resolve(a.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ns).catch(Ns)}fetchInfiniteQuery(e){return e.behavior=ly(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ns).catch(Ns)}ensureInfiniteQueryData(e){return e.behavior=ly(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Mu.isOnline()?le(this,ii).resumePausedMutations():Promise.resolve()}getQueryCache(){return le(this,Tt)}getMutationCache(){return le(this,ii)}getDefaultOptions(){return le(this,ri)}setDefaultOptions(e){Oe(this,ri,e)}setQueryDefaults(e,s){le(this,Xr).set(Ao(e),{queryKey:e,defaultOptions:s})}getQueryDefaults(e){const s=[...le(this,Xr).values()],a={};return s.forEach(r=>{Mo(e,r.queryKey)&&Object.assign(a,r.defaultOptions)}),a}setMutationDefaults(e,s){le(this,Kr).set(Ao(e),{mutationKey:e,defaultOptions:s})}getMutationDefaults(e){const s=[...le(this,Kr).values()],a={};return s.forEach(r=>{Mo(e,r.mutationKey)&&Object.assign(a,r.defaultOptions)}),a}defaultQueryOptions(e){if(e._defaulted)return e;const s={...le(this,ri).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return s.queryHash||(s.queryHash=Xm(s.queryKey,s)),s.refetchOnReconnect===void 0&&(s.refetchOnReconnect=s.networkMode!=="always"),s.throwOnError===void 0&&(s.throwOnError=!!s.suspense),!s.networkMode&&s.persister&&(s.networkMode="offlineFirst"),s.queryFn===Km&&(s.enabled=!1),s}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...le(this,ri).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){le(this,Tt).clear(),le(this,ii).clear()}},Tt=new WeakMap,ii=new WeakMap,ri=new WeakMap,Xr=new WeakMap,Kr=new WeakMap,li=new WeakMap,Zr=new WeakMap,Wr=new WeakMap,I1),D5=k.createContext(void 0),O5=({client:e,children:s})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),n.jsx(D5.Provider,{value:e,children:s})),R5=e=>{switch(e){case"success":return U5;case"info":return I5;case"warning":return B5;case"error":return H5;default:return null}},_5=Array(12).fill(0),L5=({visible:e,className:s})=>be.createElement("div",{className:["sonner-loading-wrapper",s].filter(Boolean).join(" "),"data-visible":e},be.createElement("div",{className:"sonner-spinner"},_5.map((a,r)=>be.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),U5=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},be.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"})),B5=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},be.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"})),I5=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},be.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"})),H5=be.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},be.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"})),P5=be.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"},be.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),be.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),q5=()=>{let[e,s]=be.useState(document.hidden);return be.useEffect(()=>{let a=()=>{s(document.hidden)};return document.addEventListener("visibilitychange",a),()=>window.removeEventListener("visibilitychange",a)},[]),e},mm=1,F5=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let s=this.subscribers.indexOf(e);this.subscribers.splice(s,1)}),this.publish=e=>{this.subscribers.forEach(s=>s(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var s;let{message:a,...r}=e,o=typeof(e==null?void 0:e.id)=="number"||((s=e.id)==null?void 0:s.length)>0?e.id:mm++,c=this.toasts.find(h=>h.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(h=>h.id===o?(this.publish({...h,...e,id:o,title:a}),{...h,...e,id:o,dismissible:d,title:a}):h):this.addToast({title:a,...r,dismissible:d,id:o}),o},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(s=>{this.subscribers.forEach(a=>a({id:s.id,dismiss:!0}))}),this.subscribers.forEach(s=>s({id:e,dismiss:!0})),e),this.message=(e,s)=>this.create({...s,message:e}),this.error=(e,s)=>this.create({...s,message:e,type:"error"}),this.success=(e,s)=>this.create({...s,type:"success",message:e}),this.info=(e,s)=>this.create({...s,type:"info",message:e}),this.warning=(e,s)=>this.create({...s,type:"warning",message:e}),this.loading=(e,s)=>this.create({...s,type:"loading",message:e}),this.promise=(e,s)=>{if(!s)return;let a;s.loading!==void 0&&(a=this.create({...s,promise:e,type:"loading",message:s.loading,description:typeof s.description!="function"?s.description:void 0}));let r=e instanceof Promise?e:e(),o=a!==void 0,c,d=r.then(async m=>{if(c=["resolve",m],be.isValidElement(m))o=!1,this.create({id:a,type:"default",message:m});else if(V5(m)&&!m.ok){o=!1;let f=typeof s.error=="function"?await s.error(`HTTP error! status: ${m.status}`):s.error,p=typeof s.description=="function"?await s.description(`HTTP error! status: ${m.status}`):s.description;this.create({id:a,type:"error",message:f,description:p})}else if(s.success!==void 0){o=!1;let f=typeof s.success=="function"?await s.success(m):s.success,p=typeof s.description=="function"?await s.description(m):s.description;this.create({id:a,type:"success",message:f,description:p})}}).catch(async m=>{if(c=["reject",m],s.error!==void 0){o=!1;let f=typeof s.error=="function"?await s.error(m):s.error,p=typeof s.description=="function"?await s.description(m):s.description;this.create({id:a,type:"error",message:f,description:p})}}).finally(()=>{var m;o&&(this.dismiss(a),a=void 0),(m=s.finally)==null||m.call(s)}),h=()=>new Promise((m,f)=>d.then(()=>c[0]==="reject"?f(c[1]):m(c[1])).catch(f));return typeof a!="string"&&typeof a!="number"?{unwrap:h}:Object.assign(a,{unwrap:h})},this.custom=(e,s)=>{let a=(s==null?void 0:s.id)||mm++;return this.create({jsx:e(a),id:a,...s}),a},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},In=new F5,$5=(e,s)=>{let a=(s==null?void 0:s.id)||mm++;return In.addToast({title:e,...s,id:a}),a},V5=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",G5=$5,Y5=()=>In.toasts,Q5=()=>In.getActiveToasts(),ke=Object.assign(G5,{success:In.success,info:In.info,warning:In.warning,error:In.error,custom:In.custom,message:In.message,promise:In.promise,dismiss:In.dismiss,loading:In.loading},{getHistory:Y5,getToasts:Q5});function J5(e,{insertAt:s}={}){if(typeof document>"u")return;let a=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",s==="top"&&a.firstChild?a.insertBefore(r,a.firstChild):a.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}J5(`: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 du(e){return e.label!==void 0}var X5=3,K5="32px",Z5="16px",cy=4e3,W5=356,e4=14,t4=20,n4=200;function zs(...e){return e.filter(Boolean).join(" ")}function s4(e){let[s,a]=e.split("-"),r=[];return s&&r.push(s),a&&r.push(a),r}var a4=e=>{var s,a,r,o,c,d,h,m,f,p,b;let{invert:v,toast:y,unstyled:N,interacting:S,setHeights:w,visibleToasts:j,heights:C,index:T,toasts:D,expanded:E,removeToast:A,defaultRichColors:B,closeButton:V,style:ee,cancelButtonStyle:R,actionButtonStyle:F,className:_="",descriptionClassName:se="",duration:U,position:H,gap:I,loadingIcon:W,expandByDefault:re,classNames:he,icons:L,closeButtonAriaLabel:P="Close toast",pauseWhenPageIsHidden:Y}=e,[O,de]=be.useState(null),[ve,ae]=be.useState(null),[je,Xe]=be.useState(!1),[Fe,zt]=be.useState(!1),[It,qn]=be.useState(!1),[bs,fn]=be.useState(!1),[ts,ce]=be.useState(!1),[pe,Ce]=be.useState(0),[_e,me]=be.useState(0),ge=be.useRef(y.duration||U||cy),Be=be.useRef(null),Se=be.useRef(null),Me=T===0,nt=T+1<=j,te=y.type,fe=y.dismissible!==!1,Ne=y.className||"",Ie=y.descriptionClassName||"",Ke=be.useMemo(()=>C.findIndex(De=>De.toastId===y.id)||0,[C,y.id]),jn=be.useMemo(()=>{var De;return(De=y.closeButton)!=null?De:V},[y.closeButton,V]),ns=be.useMemo(()=>y.duration||U||cy,[y.duration,U]),Ht=be.useRef(0),pt=be.useRef(0),en=be.useRef(0),et=be.useRef(null),[Ds,Fn]=H.split("-"),Jo=be.useMemo(()=>C.reduce((De,rt,ht)=>ht>=Ke?De:De+rt.height,0),[C,Ke]),bi=q5(),Zi=y.invert||v,Sa=te==="loading";pt.current=be.useMemo(()=>Ke*I+Jo,[Ke,Jo]),be.useEffect(()=>{ge.current=ns},[ns]),be.useEffect(()=>{Xe(!0)},[]),be.useEffect(()=>{let De=Se.current;if(De){let rt=De.getBoundingClientRect().height;return me(rt),w(ht=>[{toastId:y.id,height:rt,position:y.position},...ht]),()=>w(ht=>ht.filter(wn=>wn.toastId!==y.id))}},[w,y.id]),be.useLayoutEffect(()=>{if(!je)return;let De=Se.current,rt=De.style.height;De.style.height="auto";let ht=De.getBoundingClientRect().height;De.style.height=rt,me(ht),w(wn=>wn.find(tn=>tn.toastId===y.id)?wn.map(tn=>tn.toastId===y.id?{...tn,height:ht}:tn):[{toastId:y.id,height:ht,position:y.position},...wn])},[je,y.title,y.description,w,y.id]);let mn=be.useCallback(()=>{zt(!0),Ce(pt.current),w(De=>De.filter(rt=>rt.toastId!==y.id)),setTimeout(()=>{A(y)},n4)},[y,A,w,pt]);be.useEffect(()=>{if(y.promise&&te==="loading"||y.duration===1/0||y.type==="loading")return;let De;return E||S||Y&&bi?(()=>{if(en.current<Ht.current){let rt=new Date().getTime()-Ht.current;ge.current=ge.current-rt}en.current=new Date().getTime()})():ge.current!==1/0&&(Ht.current=new Date().getTime(),De=setTimeout(()=>{var rt;(rt=y.onAutoClose)==null||rt.call(y,y),mn()},ge.current)),()=>clearTimeout(De)},[E,S,y,te,Y,bi,mn]),be.useEffect(()=>{y.delete&&mn()},[mn,y.delete]);function Wi(){var De,rt,ht;return L!=null&&L.loading?be.createElement("div",{className:zs(he==null?void 0:he.loader,(De=y==null?void 0:y.classNames)==null?void 0:De.loader,"sonner-loader"),"data-visible":te==="loading"},L.loading):W?be.createElement("div",{className:zs(he==null?void 0:he.loader,(rt=y==null?void 0:y.classNames)==null?void 0:rt.loader,"sonner-loader"),"data-visible":te==="loading"},W):be.createElement(L5,{className:zs(he==null?void 0:he.loader,(ht=y==null?void 0:y.classNames)==null?void 0:ht.loader),visible:te==="loading"})}return be.createElement("li",{tabIndex:0,ref:Se,className:zs(_,Ne,he==null?void 0:he.toast,(s=y==null?void 0:y.classNames)==null?void 0:s.toast,he==null?void 0:he.default,he==null?void 0:he[te],(a=y==null?void 0:y.classNames)==null?void 0:a[te]),"data-sonner-toast":"","data-rich-colors":(r=y.richColors)!=null?r:B,"data-styled":!(y.jsx||y.unstyled||N),"data-mounted":je,"data-promise":!!y.promise,"data-swiped":ts,"data-removed":Fe,"data-visible":nt,"data-y-position":Ds,"data-x-position":Fn,"data-index":T,"data-front":Me,"data-swiping":It,"data-dismissible":fe,"data-type":te,"data-invert":Zi,"data-swipe-out":bs,"data-swipe-direction":ve,"data-expanded":!!(E||re&&je),style:{"--index":T,"--toasts-before":T,"--z-index":D.length-T,"--offset":`${Fe?pe:pt.current}px`,"--initial-height":re?"auto":`${_e}px`,...ee,...y.style},onDragEnd:()=>{qn(!1),de(null),et.current=null},onPointerDown:De=>{Sa||!fe||(Be.current=new Date,Ce(pt.current),De.target.setPointerCapture(De.pointerId),De.target.tagName!=="BUTTON"&&(qn(!0),et.current={x:De.clientX,y:De.clientY}))},onPointerUp:()=>{var De,rt,ht,wn;if(bs||!fe)return;et.current=null;let tn=Number(((De=Se.current)==null?void 0:De.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Os=Number(((rt=Se.current)==null?void 0:rt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Rs=new Date().getTime()-((ht=Be.current)==null?void 0:ht.getTime()),An=O==="x"?tn:Os,ys=Math.abs(An)/Rs;if(Math.abs(An)>=t4||ys>.11){Ce(pt.current),(wn=y.onDismiss)==null||wn.call(y,y),ae(O==="x"?tn>0?"right":"left":Os>0?"down":"up"),mn(),fn(!0),ce(!1);return}qn(!1),de(null)},onPointerMove:De=>{var rt,ht,wn,tn;if(!et.current||!fe||((rt=window.getSelection())==null?void 0:rt.toString().length)>0)return;let Os=De.clientY-et.current.y,Rs=De.clientX-et.current.x,An=(ht=e.swipeDirections)!=null?ht:s4(H);!O&&(Math.abs(Rs)>1||Math.abs(Os)>1)&&de(Math.abs(Rs)>Math.abs(Os)?"x":"y");let ys={x:0,y:0};O==="y"?(An.includes("top")||An.includes("bottom"))&&(An.includes("top")&&Os<0||An.includes("bottom")&&Os>0)&&(ys.y=Os):O==="x"&&(An.includes("left")||An.includes("right"))&&(An.includes("left")&&Rs<0||An.includes("right")&&Rs>0)&&(ys.x=Rs),(Math.abs(ys.x)>0||Math.abs(ys.y)>0)&&ce(!0),(wn=Se.current)==null||wn.style.setProperty("--swipe-amount-x",`${ys.x}px`),(tn=Se.current)==null||tn.style.setProperty("--swipe-amount-y",`${ys.y}px`)}},jn&&!y.jsx?be.createElement("button",{"aria-label":P,"data-disabled":Sa,"data-close-button":!0,onClick:Sa||!fe?()=>{}:()=>{var De;mn(),(De=y.onDismiss)==null||De.call(y,y)},className:zs(he==null?void 0:he.closeButton,(o=y==null?void 0:y.classNames)==null?void 0:o.closeButton)},(c=L==null?void 0:L.close)!=null?c:P5):null,y.jsx||k.isValidElement(y.title)?y.jsx?y.jsx:typeof y.title=="function"?y.title():y.title:be.createElement(be.Fragment,null,te||y.icon||y.promise?be.createElement("div",{"data-icon":"",className:zs(he==null?void 0:he.icon,(d=y==null?void 0:y.classNames)==null?void 0:d.icon)},y.promise||y.type==="loading"&&!y.icon?y.icon||Wi():null,y.type!=="loading"?y.icon||(L==null?void 0:L[te])||R5(te):null):null,be.createElement("div",{"data-content":"",className:zs(he==null?void 0:he.content,(h=y==null?void 0:y.classNames)==null?void 0:h.content)},be.createElement("div",{"data-title":"",className:zs(he==null?void 0:he.title,(m=y==null?void 0:y.classNames)==null?void 0:m.title)},typeof y.title=="function"?y.title():y.title),y.description?be.createElement("div",{"data-description":"",className:zs(se,Ie,he==null?void 0:he.description,(f=y==null?void 0:y.classNames)==null?void 0:f.description)},typeof y.description=="function"?y.description():y.description):null),k.isValidElement(y.cancel)?y.cancel:y.cancel&&du(y.cancel)?be.createElement("button",{"data-button":!0,"data-cancel":!0,style:y.cancelButtonStyle||R,onClick:De=>{var rt,ht;du(y.cancel)&&fe&&((ht=(rt=y.cancel).onClick)==null||ht.call(rt,De),mn())},className:zs(he==null?void 0:he.cancelButton,(p=y==null?void 0:y.classNames)==null?void 0:p.cancelButton)},y.cancel.label):null,k.isValidElement(y.action)?y.action:y.action&&du(y.action)?be.createElement("button",{"data-button":!0,"data-action":!0,style:y.actionButtonStyle||F,onClick:De=>{var rt,ht;du(y.action)&&((ht=(rt=y.action).onClick)==null||ht.call(rt,De),!De.defaultPrevented&&mn())},className:zs(he==null?void 0:he.actionButton,(b=y==null?void 0:y.classNames)==null?void 0:b.actionButton)},y.action.label):null))};function uy(){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 i4(e,s){let a={};return[e,s].forEach((r,o)=>{let c=o===1,d=c?"--mobile-offset":"--offset",h=c?Z5:K5;function m(f){["top","right","bottom","left"].forEach(p=>{a[`${d}-${p}`]=typeof f=="number"?`${f}px`:f})}typeof r=="number"||typeof r=="string"?m(r):typeof r=="object"?["top","right","bottom","left"].forEach(f=>{r[f]===void 0?a[`${d}-${f}`]=h:a[`${d}-${f}`]=typeof r[f]=="number"?`${r[f]}px`:r[f]}):m(h)}),a}var r4=k.forwardRef(function(e,s){let{invert:a,position:r="bottom-right",hotkey:o=["altKey","KeyT"],expand:c,closeButton:d,className:h,offset:m,mobileOffset:f,theme:p="light",richColors:b,duration:v,style:y,visibleToasts:N=X5,toastOptions:S,dir:w=uy(),gap:j=e4,loadingIcon:C,icons:T,containerAriaLabel:D="Notifications",pauseWhenPageIsHidden:E}=e,[A,B]=be.useState([]),V=be.useMemo(()=>Array.from(new Set([r].concat(A.filter(Y=>Y.position).map(Y=>Y.position)))),[A,r]),[ee,R]=be.useState([]),[F,_]=be.useState(!1),[se,U]=be.useState(!1),[H,I]=be.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=be.useRef(null),re=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),he=be.useRef(null),L=be.useRef(!1),P=be.useCallback(Y=>{B(O=>{var de;return(de=O.find(ve=>ve.id===Y.id))!=null&&de.delete||In.dismiss(Y.id),O.filter(({id:ve})=>ve!==Y.id)})},[]);return be.useEffect(()=>In.subscribe(Y=>{if(Y.dismiss){B(O=>O.map(de=>de.id===Y.id?{...de,delete:!0}:de));return}setTimeout(()=>{a5.flushSync(()=>{B(O=>{let de=O.findIndex(ve=>ve.id===Y.id);return de!==-1?[...O.slice(0,de),{...O[de],...Y},...O.slice(de+1)]:[Y,...O]})})})}),[]),be.useEffect(()=>{if(p!=="system"){I(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?I("dark"):I("light")),typeof window>"u")return;let Y=window.matchMedia("(prefers-color-scheme: dark)");try{Y.addEventListener("change",({matches:O})=>{I(O?"dark":"light")})}catch{Y.addListener(({matches:de})=>{try{I(de?"dark":"light")}catch(ve){console.error(ve)}})}},[p]),be.useEffect(()=>{A.length<=1&&_(!1)},[A]),be.useEffect(()=>{let Y=O=>{var de,ve;o.every(ae=>O[ae]||O.code===ae)&&(_(!0),(de=W.current)==null||de.focus()),O.code==="Escape"&&(document.activeElement===W.current||(ve=W.current)!=null&&ve.contains(document.activeElement))&&_(!1)};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[o]),be.useEffect(()=>{if(W.current)return()=>{he.current&&(he.current.focus({preventScroll:!0}),he.current=null,L.current=!1)}},[W.current]),be.createElement("section",{ref:s,"aria-label":`${D} ${re}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},V.map((Y,O)=>{var de;let[ve,ae]=Y.split("-");return A.length?be.createElement("ol",{key:Y,dir:w==="auto"?uy():w,tabIndex:-1,ref:W,className:h,"data-sonner-toaster":!0,"data-theme":H,"data-y-position":ve,"data-lifted":F&&A.length>1&&!c,"data-x-position":ae,style:{"--front-toast-height":`${((de=ee[0])==null?void 0:de.height)||0}px`,"--width":`${W5}px`,"--gap":`${j}px`,...y,...i4(m,f)},onBlur:je=>{L.current&&!je.currentTarget.contains(je.relatedTarget)&&(L.current=!1,he.current&&(he.current.focus({preventScroll:!0}),he.current=null))},onFocus:je=>{je.target instanceof HTMLElement&&je.target.dataset.dismissible==="false"||L.current||(L.current=!0,he.current=je.relatedTarget)},onMouseEnter:()=>_(!0),onMouseMove:()=>_(!0),onMouseLeave:()=>{se||_(!1)},onDragEnd:()=>_(!1),onPointerDown:je=>{je.target instanceof HTMLElement&&je.target.dataset.dismissible==="false"||U(!0)},onPointerUp:()=>U(!1)},A.filter(je=>!je.position&&O===0||je.position===Y).map((je,Xe)=>{var Fe,zt;return be.createElement(a4,{key:je.id,icons:T,index:Xe,toast:je,defaultRichColors:b,duration:(Fe=S==null?void 0:S.duration)!=null?Fe:v,className:S==null?void 0:S.className,descriptionClassName:S==null?void 0:S.descriptionClassName,invert:a,visibleToasts:N,closeButton:(zt=S==null?void 0:S.closeButton)!=null?zt:d,interacting:se,position:Y,style:S==null?void 0:S.style,unstyled:S==null?void 0:S.unstyled,classNames:S==null?void 0:S.classNames,cancelButtonStyle:S==null?void 0:S.cancelButtonStyle,actionButtonStyle:S==null?void 0:S.actionButtonStyle,removeToast:P,toasts:A.filter(It=>It.position==je.position),heights:ee.filter(It=>It.position==je.position),setHeights:R,expandByDefault:c,gap:j,loadingIcon:C,expanded:F,pauseWhenPageIsHidden:E,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 l4=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),hv=(...e)=>e.filter((s,a,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===a).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 o4={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 c4=k.forwardRef(({color:e="currentColor",size:s=24,strokeWidth:a=2,absoluteStrokeWidth:r,className:o="",children:c,iconNode:d,...h},m)=>k.createElement("svg",{ref:m,...o4,width:s,height:s,stroke:e,strokeWidth:r?Number(a)*24/Number(s):a,className:hv("lucide",o),...h},[...d.map(([f,p])=>k.createElement(f,p)),...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 Z=(e,s)=>{const a=k.forwardRef(({className:r,...o},c)=>k.createElement(c4,{ref:c,iconNode:s,className:hv(`lucide-${l4(e)}`,r),...o}));return a.displayName=`${e}`,a};/**
 * @license lucide-react v0.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=Z("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 u4=Z("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 xm=Z("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 d4=Z("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 mv=Z("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 h4=Z("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 Du=Z("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 pm=Z("AudioLines",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]);/**
 * @license lucide-react v0.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 f4=Z("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 xv=Z("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 Hn=Z("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 Fr=Z("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 Zm=Z("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 Wm=Z("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 e0=Z("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 Ou=Z("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 dn=Z("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 cl=Z("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 Yu=Z("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 Gs=Z("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gm=Z("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 ul=Z("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 wa=Z("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 m4=Z("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 x4=Z("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 ui=Z("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 p4=Z("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 pv=Z("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 gv=Z("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 Ho=Z("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 g4=Z("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 Js=Z("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 bv=Z("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 t0=Z("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 yv=Z("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 Po=Z("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 vv=Z("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 b4=Z("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 jv=Z("DoorOpen",[["path",{d:"M13 4h3a2 2 0 0 1 2 2v14",key:"hrm0s9"}],["path",{d:"M2 20h3",key:"1gaodv"}],["path",{d:"M13 20h9",key:"s90cdi"}],["path",{d:"M10 12v.01",key:"vx6srw"}],["path",{d:"M13 4.562v16.157a1 1 0 0 1-1.242.97L5 20V5.562a2 2 0 0 1 1.515-1.94l4-1A2 2 0 0 1 13 4.561Z",key:"199qr4"}]]);/**
 * @license lucide-react v0.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 Ys=Z("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 y4=Z("Ear",[["path",{d:"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0",key:"1dfaln"}],["path",{d:"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4",key:"1qnva7"}]]);/**
 * @license lucide-react v0.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=Z("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 n0=Z("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 v4=Z("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 dl=Z("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 Vi=Z("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 za=Z("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 zv=Z("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 j4=Z("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 w4=Z("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 Nv=Z("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 kv=Z("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 Sv=Z("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 Cv=Z("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 Na=Z("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 z4=Z("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 N4=Z("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 No=Z("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 s0=Z("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=Z("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 k4=Z("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 S4=Z("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 C4=Z("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 Tv=Z("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 Ev=Z("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 Av=Z("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 T4=Z("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 a0=Z("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 E4=Z("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);/**
 * @license lucide-react v0.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 i0=Z("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 bm=Z("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
 * @license lucide-react v0.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 r0=Z("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 Mv=Z("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 A4=Z("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 M4=Z("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 D4=Z("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
 * @license lucide-react v0.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=Z("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 R4=Z("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 _4=Z("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 L4=Z("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 l0=Z("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 Dv=Z("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 U4=Z("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 Le=Z("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 Ov=Z("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 B4=Z("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 I4=Z("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 H4=Z("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 Gi=Z("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 di=Z("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 P4=Z("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
 * @license lucide-react v0.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=Z("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
 * @license lucide-react v0.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=Z("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
 * @license lucide-react v0.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 _v=Z("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 Lv=Z("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 Uv=Z("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 qo=Z("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 dy=Z("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=Z("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 q4=Z("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 o0=Z("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 F4=Z("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]);/**
 * @license lucide-react v0.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 hy=Z("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
 * @license lucide-react v0.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 fy=Z("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 Ju=Z("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 c0=Z("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 $t=Z("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 $4=Z("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 V4=Z("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 Iv=Z("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 Cn=Z("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 u0=Z("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/**
 * @license lucide-react v0.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=Z("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 el=Z("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 Fo=Z("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 Tn=Z("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 tl=Z("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 G4=Z("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 hl=Z("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 Xu=Z("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 d0=Z("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 h0=Z("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 ps=Z("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 Ku=Z("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 Y4=Z("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 Sn=Z("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 Pv=Z("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 Q4=Z("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 nl=Z("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 f0=Z("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 Ru=Z("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 qv=Z("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 Fv=Z("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 $v=Z("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 m0=Z("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 Zu=Z("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 Vv=Z("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 hi=Z("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 fi=Z("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 Vt=Z("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 Yi=Z("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 Wu=Z("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 J4=Z("UserMinus",[["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:"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 ed=Z("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 fl=Z("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 Qi=Z("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 X4=Z("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
 * @license lucide-react v0.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 K4=Z("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/**
 * @license lucide-react v0.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=Z("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 mi=Z("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 Gt=Z("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 Xi=Z("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"}]]),my=e=>{let s;const a=new Set,r=(f,p)=>{const b=typeof f=="function"?f(s):f;if(!Object.is(b,s)){const v=s;s=p??(typeof b!="object"||b===null)?b:Object.assign({},s,b),a.forEach(y=>y(s,v))}},o=()=>s,h={setState:r,getState:o,getInitialState:()=>m,subscribe:f=>(a.add(f),()=>a.delete(f))},m=s=e(r,o,h);return h},Z4=(e=>e?my(e):my),W4=e=>e;function eS(e,s=W4){const a=be.useSyncExternalStore(e.subscribe,be.useCallback(()=>s(e.getState()),[e,s]),be.useCallback(()=>s(e.getInitialState()),[e,s]));return be.useDebugValue(a),a}const xy=e=>{const s=Z4(e),a=r=>eS(s,r);return Object.assign(a,s),a},Nt=(e=>e?xy(e):xy);function tS(e,s){let a;try{a=e()}catch{return}return{getItem:o=>{var c;const d=m=>m===null?null:JSON.parse(m,void 0),h=(c=a.getItem(o))!=null?c:null;return h instanceof Promise?h.then(d):d(h)},setItem:(o,c)=>a.setItem(o,JSON.stringify(c,void 0)),removeItem:o=>a.removeItem(o)}}const vm=e=>s=>{try{const a=e(s);return a instanceof Promise?a:{then(r){return vm(r)(a)},catch(r){return this}}}catch(a){return{then(r){return this},catch(r){return vm(r)(a)}}}},nS=(e,s)=>(a,r,o)=>{let c={storage:tS(()=>window.localStorage),partialize:w=>w,version:0,merge:(w,j)=>({...j,...w}),...s},d=!1,h=0;const m=new Set,f=new Set;let p=c.storage;if(!p)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${c.name}', the given storage is currently unavailable.`),a(...w)},r,o);const b=()=>{const w=c.partialize({...r()});return p.setItem(c.name,{state:w,version:c.version})},v=o.setState;o.setState=(w,j)=>(v(w,j),b());const y=e((...w)=>(a(...w),b()),r,o);o.getInitialState=()=>y;let N;const S=()=>{var w,j;if(!p)return;const C=++h;d=!1,m.forEach(D=>{var E;return D((E=r())!=null?E:y)});const T=((j=c.onRehydrateStorage)==null?void 0:j.call(c,(w=r())!=null?w:y))||void 0;return vm(p.getItem.bind(p))(c.name).then(D=>{if(D)if(typeof D.version=="number"&&D.version!==c.version){if(c.migrate){const E=c.migrate(D.state,D.version);return E instanceof Promise?E.then(A=>[!0,A]):[!0,E]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,D.state];return[!1,void 0]}).then(D=>{var E;if(C!==h)return;const[A,B]=D;if(N=c.merge(B,(E=r())!=null?E:y),a(N,!0),A)return b()}).then(()=>{C===h&&(T==null||T(N,void 0),N=r(),d=!0,f.forEach(D=>D(N)))}).catch(D=>{C===h&&(T==null||T(void 0,D))})};return o.persist={setOptions:w=>{c={...c,...w},w.storage&&(p=w.storage)},clearStorage:()=>{p==null||p.removeItem(c.name)},getOptions:()=>c,rehydrate:()=>S(),hasHydrated:()=>d,onHydrate:w=>(m.add(w),()=>{m.delete(w)}),onFinishHydration:w=>(f.add(w),()=>{f.delete(w)})},c.skipHydration||S(),N||y},Yt=nS,Ut=Nt()(Yt(e=>({user:null,accessToken:null,refreshToken:null,isAuthenticated:!1,isLoading:!0,setupRequired:null,authMode:null,setUser:s=>e({user:s,isAuthenticated:s!==null}),setTokens:(s,a)=>e({accessToken:s,refreshToken:a,isAuthenticated:!0}),setAccessToken:s=>e({accessToken:s}),setSetupRequired:s=>e({setupRequired:s,isLoading:!1}),setLoading:s=>e({isLoading:s}),setAuthMode:s=>e({authMode:s}),login:(s,a,r)=>e({user:s,accessToken:a,refreshToken:r,isAuthenticated:!0,isLoading:!1,setupRequired:!1}),logout:()=>e({user:null,accessToken:null,refreshToken:null,isAuthenticated:!1,isLoading:!1}),updateUser:s=>e(a=>({user:a.user?{...a.user,...s}:null}))}),{name:"cachibot-auth",partialize:e=>({user:e.user,accessToken:e.accessToken,refreshToken:e.refreshToken,isAuthenticated:e.isAuthenticated})})),sS="/api";class aS extends Error{constructor(s,a,r){super(s),this.status=a,this.data=r,this.name="AuthApiError"}}async function Es(e,s={},a=!1){const r=`${sS}${e}`,o={"Content-Type":"application/json",...s.headers};if(a){const{accessToken:d}=Ut.getState();d&&(o.Authorization=`Bearer ${d}`)}const c=await fetch(r,{...s,headers:o});if(!c.ok){const d=await c.json().catch(()=>({}));throw new aS(d.detail||`Request failed: ${c.statusText}`,c.status,d)}return c.json()}async function iS(){return Es("/auth/mode")}async function rS(e){return Es("/auth/exchange",{method:"POST",body:JSON.stringify(e)})}async function x0(){return Es("/auth/setup-required")}async function lS(e){return Es("/auth/setup",{method:"POST",body:JSON.stringify(e)})}async function oS(e){return Es("/auth/login",{method:"POST",body:JSON.stringify(e)})}async function cS(e){return Es("/auth/refresh",{method:"POST",body:JSON.stringify(e)})}async function uS(){return Es("/auth/me",{},!0)}async function Gv(e=100,s=0){return Es(`/auth/users?limit=${e}&offset=${s}`,{},!0)}async function Yv(e){return Es("/auth/users",{method:"POST",body:JSON.stringify(e)},!0)}async function Qv(e,s){return Es(`/auth/users/${e}`,{method:"PUT",body:JSON.stringify(s)},!0)}async function Jv(e){return Es(`/auth/users/${e}`,{method:"DELETE"},!0)}let fo=null;async function As(){const{refreshToken:e,setAccessToken:s,logout:a}=Ut.getState();if(!e)return null;if(fo)try{return(await fo).access_token}catch{return null}try{fo=cS({refresh_token:e});const r=await fo;return s(r.access_token),r.access_token}catch{return a(),null}finally{fo=null}}const Xv="/api";let p0=class extends Error{constructor(s,a,r){super(s),this.status=a,this.data=r,this.name="ApiError"}};function jm(){const{accessToken:e}=Ut.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function ye(e,s={},a=!0){const r=`${Xv}${e}`,o=await fetch(r,{headers:{"Content-Type":"application/json",...jm(),...s.headers},...s});if(o.status===401&&a&&await As())return ye(e,s,!1);if(!o.ok){const c=await o.json().catch(()=>({}));throw new p0(c.detail||`Request failed: ${o.statusText}`,o.status,c)}return o.json()}async function g0(){return ye("/health")}async function Kv(){return ye("/config")}async function Su(e){return ye("/config",{method:"PUT",body:JSON.stringify(e)})}async function dS(e=50,s=0){return ye(`/chat/history?limit=${e}&offset=${s}`)}async function hS(){return ye("/chat/history",{method:"DELETE"})}async function Zv(e=[]){return(await ye("/creation/names",{method:"POST",body:JSON.stringify({count:4,exclude:e})})).names}async function fS(e={}){return(await ye("/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 mS(e){return(await ye("/creation/follow-up-questions",{method:"POST",body:JSON.stringify(e)})).questions}async function*Wv(e,s,a){var m;const r=`${Xv}${e}`;let o=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",...jm()},body:JSON.stringify(s),signal:a});if(o.status===401&&await As()&&(o=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json",...jm()},body:JSON.stringify(s),signal:a})),!o.ok){const f=await o.json().catch(()=>({}));throw new p0(f.detail||`SSE request failed: ${o.statusText}`,o.status,f)}const c=(m=o.body)==null?void 0:m.getReader();if(!c)throw new Error("No response body");const d=new TextDecoder;let h="";try{for(;;){const{done:f,value:p}=await c.read();if(f)break;h+=d.decode(p,{stream:!0});const b=h.split(`

`);h=b.pop()||"";for(const v of b){if(!v.trim())continue;let y="message",N="";for(const S of v.split(`
`))S.startsWith("event: ")?y=S.slice(7).trim():S.startsWith("data: ")&&(N=S.slice(6));if(N)try{yield{event:y,data:JSON.parse(N)}}catch{}}}}finally{c.releaseLock()}}async function e2(e,s,a){try{for await(const{event:r,data:o}of Wv("/creation/names-with-meanings/stream",{count:e.count??4,exclude:e.exclude??[],purpose:e.purpose,personality:e.personality},a))r==="name"?s.onName(o):r==="done"?s.onDone():r==="error"&&s.onError(o.error)}catch(r){if(r.name==="AbortError")return;s.onError(r instanceof Error?r.message:"Stream failed")}}async function t2(e,s,a){try{for await(const{event:r,data:o}of Wv("/creation/follow-up-questions/stream",e,a))r==="question"?s.onQuestion(o):r==="done"?s.onDone():r==="error"&&s.onError(o.error)}catch(r){if(r.name==="AbortError")return;s.onError(r instanceof Error?r.message:"Stream failed")}}async function n2(e){return ye("/creation/generate-prompt",{method:"POST",body:JSON.stringify(e)})}async function xS(e){return ye("/creation/suggest-prompt",{method:"POST",body:JSON.stringify(e)})}async function s2(e){return ye("/creation/refine-prompt",{method:"POST",body:JSON.stringify(e)})}async function a2(e){return ye("/creation/preview-bot",{method:"POST",body:JSON.stringify(e)})}async function i2(e){return ye("/creation/analyze-context",{method:"POST",body:JSON.stringify(e)})}async function b0(e){return ye(`/bots/${e.id}`,{method:"PUT",body:JSON.stringify(e)})}async function r2(e){return ye(`/bots/${e}`,{method:"DELETE"})}async function pS(e){return ye(`/bots/${e}/export`)}async function gS(e){return ye("/bots/import",{method:"POST",body:JSON.stringify(e)})}async function l2(e){return ye(`/bots/${e}/chats`)}async function o2(e,s,a=50){return ye(`/bots/${e}/chats/${s}/messages?limit=${a}`)}async function c2(e,s){return ye(`/bots/${e}/chats/${s}`,{method:"DELETE"})}async function u2(e,s){return ye(`/bots/${e}/chats/${s}/_clear-messages`,{method:"POST"})}async function bS(e){return ye(`/bots/${e}/chats/_clear`,{method:"POST"})}async function d2(e,s){return ye(`/bots/${e}/chats/${s}/_archive`,{method:"POST"})}async function y0(e,s){return ye(`/bots/${e}/chats/${s}/_unarchive`,{method:"POST"})}async function h2(e){return ye(`/bots/${e}/chats?include_archived=true`)}async function yS(e){return ye(`/bots/${e}/functions`)}async function vS(e,s){return ye(`/bots/${e}/functions/${s}`)}async function jS(e,s){return ye(`/bots/${e}/functions`,{method:"POST",body:JSON.stringify(s)})}async function wS(e,s,a){return ye(`/bots/${e}/functions/${s}`,{method:"PATCH",body:JSON.stringify(a)})}async function zS(e,s){return ye(`/bots/${e}/functions/${s}`,{method:"DELETE"})}async function NS(e,s,a){return ye(`/bots/${e}/functions/${s}/run`,{method:"POST",body:JSON.stringify(a||{})})}async function kS(e){return ye(`/bots/${e}/schedules`)}async function SS(e,s){return ye(`/bots/${e}/schedules/${s}`)}async function f2(e,s){return ye(`/bots/${e}/schedules`,{method:"POST",body:JSON.stringify(s)})}async function CS(e,s,a){return ye(`/bots/${e}/schedules/${s}`,{method:"PATCH",body:JSON.stringify(a)})}async function TS(e,s){return ye(`/bots/${e}/schedules/${s}/toggle`,{method:"POST"})}async function ES(e,s){return ye(`/bots/${e}/schedules/${s}`,{method:"DELETE"})}async function AS(e,s,a=50){const r=new URLSearchParams;return s&&r.set("status",s),r.set("limit",a.toString()),ye(`/bots/${e}/work?${r}`)}async function MS(e){return ye(`/bots/${e}/work/active`)}async function DS(e,s){return ye(`/bots/${e}/work/${s}`)}async function OS(e,s){return ye(`/bots/${e}/work`,{method:"POST",body:JSON.stringify(s)})}async function RS(e,s,a){return ye(`/bots/${e}/work/${s}`,{method:"PATCH",body:JSON.stringify(a)})}async function _S(e,s){return ye(`/bots/${e}/work/${s}/start`,{method:"POST"})}async function LS(e,s,a){return ye(`/bots/${e}/work/${s}/complete`,{method:"POST",body:JSON.stringify({result:a})})}async function US(e,s,a){return ye(`/bots/${e}/work/${s}/fail`,{method:"POST",body:JSON.stringify({error:a})})}async function BS(e,s){return ye(`/bots/${e}/work/${s}`,{method:"DELETE"})}async function IS(e,s){return ye(`/bots/${e}/work/${s}/tasks`)}async function HS(e,s){return ye(`/bots/${e}/work/${s}/tasks/ready`)}async function PS(e,s){return ye(`/bots/${e}/tasks/${s}`)}async function qS(e,s,a){return ye(`/bots/${e}/work/${s}/tasks`,{method:"POST",body:JSON.stringify(a)})}async function FS(e,s,a){return ye(`/bots/${e}/tasks/${s}`,{method:"PATCH",body:JSON.stringify(a)})}async function $S(e,s){return ye(`/bots/${e}/tasks/${s}/start`,{method:"POST"})}async function VS(e,s,a){return ye(`/bots/${e}/tasks/${s}/complete`,{method:"POST",body:JSON.stringify({result:a})})}async function GS(e,s,a){return ye(`/bots/${e}/tasks/${s}/fail`,{method:"POST",body:JSON.stringify({error:a})})}async function YS(e,s){return ye(`/bots/${e}/tasks/${s}`,{method:"DELETE"})}async function QS(e,s){return ye(`/bots/${e}/tasks/${s}/jobs`)}async function JS(e,s){return ye(`/bots/${e}/work/${s}/jobs`)}async function XS(e){return ye(`/bots/${e}/jobs/running`)}async function KS(e,s){return ye(`/bots/${e}/jobs/${s}`)}async function ZS(e,s,a,r,o){return ye(`/bots/${e}/jobs/${s}/log`,{method:"POST",body:JSON.stringify({level:a,message:r,data:o})})}async function WS(e,s,a){return ye(`/bots/${e}/jobs/${s}/progress?progress=${a}`,{method:"PATCH"})}async function e3(e,s,a=50){const r=new URLSearchParams;return s&&r.set("status",s),r.set("limit",a.toString()),ye(`/bots/${e}/todos?${r}`)}async function t3(e){return ye(`/bots/${e}/todos/open`)}async function n3(e,s){return ye(`/bots/${e}/todos/${s}`)}async function m2(e,s){return ye(`/bots/${e}/todos`,{method:"POST",body:JSON.stringify(s)})}async function s3(e,s,a){return ye(`/bots/${e}/todos/${s}`,{method:"PATCH",body:JSON.stringify(a)})}async function a3(e,s){return ye(`/bots/${e}/todos/${s}/done`,{method:"POST"})}async function i3(e,s){return ye(`/bots/${e}/todos/${s}/dismiss`,{method:"POST"})}async function r3(e,s,a){return ye(`/bots/${e}/todos/${s}/convert`,{method:"POST",body:JSON.stringify(a||{})})}async function l3(e,s){return ye(`/bots/${e}/todos/${s}`,{method:"DELETE"})}async function o3(e,s){return null}async function c3(e){return null}async function u3(){return null}async function v0(e,s){const a=await o3();if(a)return a;const r=new URLSearchParams;return e&&r.set("category",e),s&&r.set("search",s),{...await ye(`/marketplace/templates?${r}`),source:"local"}}async function d3(e){const s=await c3();return s||ye(`/marketplace/templates/${e}`)}async function x2(e){return ye(`/marketplace/templates/${e}/install`,{method:"POST"})}async function p2(){const e=await u3();return e||ye("/marketplace/categories")}async function g2(e=!1){return ye(`/update/check?force=${e}`)}async function b2(e){return ye("/update/apply",{method:"POST",body:JSON.stringify(e||{})})}async function y2(){return ye("/update/restart",{method:"POST"})}const wm=Object.freeze(Object.defineProperty({__proto__:null,ApiError:p0,analyzeCreationContext:i2,appendJobLog:ZS,applyUpdate:b2,archivePlatformChat:d2,checkForUpdate:g2,checkHealth:g0,clearBotPlatformData:bS,clearChatHistory:hS,clearChatMessages:u2,completeTask:VS,completeWork:LS,convertTodoToWork:r3,createFunction:jS,createSchedule:f2,createTask:qS,createTodo:m2,createWork:OS,deleteBackendBot:r2,deleteFunction:zS,deletePlatformChat:c2,deleteSchedule:ES,deleteTask:YS,deleteTodo:l3,deleteWork:BS,dismissTodo:i3,exportBot:pS,failTask:GS,failWork:US,generateBotNames:Zv,generateBotNamesWithMeanings:fS,generateFollowUpQuestions:mS,generateFullPrompt:n2,getActiveWork:MS,getChatHistory:dS,getConfig:Kv,getFunction:vS,getFunctions:yS,getJob:KS,getJobsForTask:QS,getJobsForWork:JS,getMarketplaceCategories:p2,getMarketplaceTemplate:d3,getMarketplaceTemplates:v0,getOpenTodos:t3,getPlatformChatMessages:o2,getPlatformChats:l2,getPlatformChatsIncludingArchived:h2,getReadyTasks:HS,getRunningJobs:XS,getSchedule:SS,getSchedules:kS,getTask:PS,getTasks:IS,getTodo:n3,getTodos:e3,getWork:AS,getWorkById:DS,importBot:gS,installMarketplaceTemplate:x2,markTodoDone:a3,previewBot:a2,refinePrompt:s2,restartServer:y2,runFunction:NS,startTask:$S,startWork:_S,streamBotNamesWithMeanings:e2,streamFollowUpQuestions:t2,suggestPrompt:xS,syncBot:b0,toggleSchedule:TS,unarchivePlatformChat:y0,updateConfig:Su,updateFunction:wS,updateJobProgress:WS,updateSchedule:CS,updateTask:FS,updateTodo:s3,updateWork:RS},Symbol.toStringTag,{value:"Module"})),Pr={name:"CachiBot",description:"The Armored AI Agent - your general-purpose assistant",icon:"shield",color:"#22c55e",model:"",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`};function zm(e){var s,a,r,o;return{default:((s=e.models)==null?void 0:s.default)||e.model||"",image:((a=e.models)==null?void 0:a.image)||"",audio:((r=e.models)==null?void 0:r.audio)||"",structured:((o=e.models)==null?void 0:o.structured)||""}}const h3={id:"default",...Pr,tools:["file_read","file_write","file_list","file_edit","file_info","python_execute","task_complete"],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};function py(e){e.systemPrompt&&b0({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(s=>{console.warn("Failed to sync bot to backend:",s)})}const xt=Nt()(Yt((e,s)=>({bots:[h3],activeBotId:"default",activeView:"chats",addBot:a=>{e(r=>({bots:[...r.bots,a]})),py(a)},updateBot:(a,r)=>{e(c=>({bots:c.bots.map(d=>d.id===a?{...d,...r,updatedAt:new Date().toISOString()}:d)}));const o=s().bots.find(c=>c.id===a);o&&py(o)},deleteBot:a=>{a!=="default"&&(e(r=>{var o;return{bots:r.bots.filter(c=>c.id!==a),activeBotId:r.activeBotId===a?((o=r.bots[0])==null?void 0:o.id)??null:r.activeBotId}}),r2(a).catch(r=>{console.warn("Failed to delete bot from backend:",r)}))},setActiveBot:a=>e({activeBotId:a}),setActiveView:a=>e({activeView:a}),getActiveBot:()=>{const a=s();return a.bots.find(r=>r.id===a.activeBotId)}}),{name:"cachibot-bots"})),qt=Nt()(Yt((e,s)=>({chats:[],activeChatId:null,messages:{},thinking:null,toolCalls:[],isLoading:!1,error:null,replyToMessage:null,addChat:a=>e(r=>({chats:[a,...r.chats]})),updateChat:(a,r)=>e(o=>({chats:o.chats.map(c=>c.id===a?{...c,...r,updatedAt:new Date().toISOString()}:c)})),deleteChat:a=>e(r=>{const{[a]:o,...c}=r.messages;return{chats:r.chats.filter(d=>d.id!==a),messages:c,activeChatId:r.activeChatId===a?null:r.activeChatId}}),setActiveChat:a=>e({activeChatId:a}),getChatsByBot:a=>s().chats.filter(o=>o.botId===a).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 a=>{try{const r=await l2(a);e(o=>{const c=new Set(o.chats.map(m=>m.id)),d=r.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})),h=o.chats.map(m=>{const f=r.find(p=>p.id===m.id);return f?{...m,title:f.title,updatedAt:f.updatedAt,pinned:f.pinned}:m});return{chats:[...d,...h]}})}catch(r){console.warn("Failed to sync platform chats:",r)}},loadPlatformChatMessages:async(a,r)=>{try{const o=await o2(a,r);e(c=>({messages:{...c.messages,[r]:o.map(d=>{var f;const h=(f=d.metadata)==null?void 0:f.toolCalls,m={id:d.id,role:d.role,content:d.content,timestamp:d.timestamp,metadata:d.metadata,replyToId:d.replyToId};return h&&h.length>0&&(m.toolCalls=h),m})}}))}catch(o){console.warn("Failed to load platform chat messages:",o)}},archiveChat:async(a,r)=>{try{await d2(a,r),e(o=>({chats:o.chats.filter(c=>c.id!==r),activeChatId:o.activeChatId===r?null:o.activeChatId}))}catch(o){throw console.error("Failed to archive chat:",o),o}},unarchiveChat:async(a,r)=>{try{await y0(a,r),await s().syncPlatformChats(a)}catch(o){throw console.error("Failed to unarchive chat:",o),o}},addMessage:(a,r)=>e(o=>({messages:{...o.messages,[a]:[...o.messages[a]||[],r]}})),updateMessage:(a,r,o)=>e(c=>({messages:{...c.messages,[a]:(c.messages[a]||[]).map(d=>d.id===r?{...d,content:o}:d)}})),updateLastAssistantMessage:(a,r)=>e(o=>{const c=o.messages[a]||[];let d=-1;for(let h=c.length-1;h>=0;h--)if(c[h].role==="assistant"){d=h;break}return d===-1?o:{messages:{...o.messages,[a]:c.map((h,m)=>m===d?{...h,...r}:h)}}}),updateLastAssistantMessageMetadata:(a,r)=>e(o=>{const c=o.messages[a]||[];let d=-1;for(let h=c.length-1;h>=0;h--)if(c[h].role==="assistant"){d=h;break}return d===-1?o:{messages:{...o.messages,[a]:c.map((h,m)=>m===d?{...h,metadata:{...h.metadata,...r}}:h)}}}),getMessages:a=>s().messages[a]||[],getMessageById:(a,r)=>(s().messages[a]||[]).find(c=>c.id===r),setReplyTo:a=>e({replyToMessage:a}),clearMessages:a=>e(r=>({messages:{...r.messages,[a]:[]}})),setThinking:a=>e({thinking:a}),appendThinking:a=>e(r=>({thinking:r.thinking?r.thinking+a:a})),addToolCall:a=>e(r=>({toolCalls:[...r.toolCalls,{...a,startTime:Date.now()}]})),updateToolCall:(a,r,o)=>e(c=>({toolCalls:c.toolCalls.map(d=>d.id===a?{...d,result:r,success:o,endTime:Date.now()}:d)})),clearToolCalls:()=>e({toolCalls:[]}),attachToolCallsToLastMessage:(a,r)=>e(o=>{const c=o.messages[a]||[];let d=-1;for(let h=c.length-1;h>=0;h--)if(c[h].role==="assistant"){d=h;break}if(d===-1){const h={id:`msg-tools-${Date.now()}`,role:"assistant",content:"",timestamp:new Date().toISOString(),toolCalls:[...r]};return{messages:{...o.messages,[a]:[...c,h]}}}return{messages:{...o.messages,[a]:c.map((h,m)=>m===d?{...h,toolCalls:[...r]}:h)}}}),setLoading:a=>e({isLoading:a}),setError:a=>e({error:a})}),{name:"cachibot-chats",partialize:e=>({chats:e.chats,messages:e.messages})})),_u=Nt()(Yt((e,s)=>({jobs:[],activeJobId:null,addJob:a=>e(r=>({jobs:[a,...r.jobs]})),updateJob:(a,r)=>e(o=>({jobs:o.jobs.map(c=>c.id===a?{...c,...r}:c)})),deleteJob:a=>e(r=>({jobs:r.jobs.filter(o=>o.id!==a),activeJobId:r.activeJobId===a?null:r.activeJobId})),setActiveJob:a=>e({activeJobId:a}),getJobsByBot:a=>s().jobs.filter(o=>o.botId===a).sort((o,c)=>new Date(c.createdAt).getTime()-new Date(o.createdAt).getTime()),getActiveJobs:a=>s().jobs.filter(o=>o.botId===a&&["pending","running"].includes(o.status))}),{name:"cachibot-jobs"})),sl=Nt()(Yt((e,s)=>({tasks:[],activeTaskId:null,filter:{status:"all",priority:"all"},addTask:a=>e(r=>({tasks:[...r.tasks,a]})),updateTask:(a,r)=>e(o=>({tasks:o.tasks.map(c=>c.id===a?{...c,...r}:c)})),deleteTask:a=>e(r=>({tasks:r.tasks.filter(o=>o.id!==a),activeTaskId:r.activeTaskId===a?null:r.activeTaskId})),setActiveTask:a=>e({activeTaskId:a}),getTasksByBot:a=>{const r=s();let o=r.tasks.filter(h=>h.botId===a);r.filter.status!=="all"&&(o=o.filter(h=>h.status===r.filter.status)),r.filter.priority!=="all"&&(o=o.filter(h=>h.priority===r.filter.priority));const c={todo:0,in_progress:1,blocked:2,done:3},d={high:0,medium:1,low:2};return o.sort((h,m)=>{const f=c[h.status]-c[m.status];return f!==0?f:d[h.priority]-d[m.priority]})},setFilter:a=>e(r=>({filter:{...r.filter,...a}}))}),{name:"cachibot-tasks"})),j0=Nt()(Yt((e,s)=>({work:[],activeWorkId:null,filter:{status:"all",priority:"all"},addWork:a=>e(r=>({work:[a,...r.work]})),updateWork:(a,r)=>e(o=>({work:o.work.map(c=>c.id===a?{...c,...r}:c)})),deleteWork:a=>e(r=>({work:r.work.filter(o=>o.id!==a),activeWorkId:r.activeWorkId===a?null:r.activeWorkId})),setActiveWork:a=>e({activeWorkId:a}),getWorkByBot:a=>{const r=s();let o=r.work.filter(d=>d.botId===a);r.filter.status!=="all"&&(o=o.filter(d=>d.status===r.filter.status)),r.filter.priority!=="all"&&(o=o.filter(d=>d.priority===r.filter.priority));const c={urgent:0,high:1,normal:2,low:3};return o.sort((d,h)=>{const m=c[d.priority]-c[h.priority];return m!==0?m:new Date(h.createdAt).getTime()-new Date(d.createdAt).getTime()})},getActiveWork:a=>s().work.filter(o=>o.botId===a&&["pending","in_progress"].includes(o.status)),setFilter:a=>e(r=>({filter:{...r.filter,...a}}))}),{name:"cachibot-work"}));Nt()(Yt((e,s)=>({tasks:[],activeTaskId:null,addTask:a=>e(r=>({tasks:[...r.tasks,a]})),addTasks:a=>e(r=>({tasks:[...r.tasks,...a]})),updateTask:(a,r)=>e(o=>({tasks:o.tasks.map(c=>c.id===a?{...c,...r}:c)})),deleteTask:a=>e(r=>({tasks:r.tasks.filter(o=>o.id!==a),activeTaskId:r.activeTaskId===a?null:r.activeTaskId})),setActiveTask:a=>e({activeTaskId:a}),getTasksByWork:a=>s().tasks.filter(o=>o.workId===a).sort((o,c)=>o.order-c.order),getReadyTasks:a=>{const o=s().tasks.filter(d=>d.workId===a),c=new Set(o.filter(d=>d.status==="completed").map(d=>d.id));return o.filter(d=>d.status!=="pending"?!1:d.dependsOn.every(h=>c.has(h)))},clearTasksForWork:a=>e(r=>({tasks:r.tasks.filter(o=>o.workId!==a)}))}),{name:"cachibot-work-tasks"}));Nt()(Yt((e,s)=>({jobs:[],activeJobId:null,addJob:a=>e(r=>({jobs:[a,...r.jobs]})),updateJob:(a,r)=>e(o=>({jobs:o.jobs.map(c=>c.id===a?{...c,...r}:c)})),appendLog:(a,r,o,c)=>e(d=>({jobs:d.jobs.map(h=>h.id===a?{...h,logs:[...h.logs,{timestamp:new Date().toISOString(),level:r,message:o,data:c}]}:h)})),deleteJob:a=>e(r=>({jobs:r.jobs.filter(o=>o.id!==a),activeJobId:r.activeJobId===a?null:r.activeJobId})),setActiveJob:a=>e({activeJobId:a}),getJobsByTask:a=>s().jobs.filter(o=>o.taskId===a).sort((o,c)=>o.attempt-c.attempt),getJobsByWork:a=>s().jobs.filter(o=>o.workId===a).sort((o,c)=>new Date(c.createdAt).getTime()-new Date(o.createdAt).getTime()),getRunningJobs:a=>s().jobs.filter(o=>!(o.status!=="running"||a&&o.botId!==a)),clearJobsForWork:a=>e(r=>({jobs:r.jobs.filter(o=>o.workId!==a)}))}),{name:"cachibot-work-jobs"}));Nt()(Yt((e,s)=>({todos:[],activeTodoId:null,filter:{status:"all",priority:"all"},addTodo:a=>e(r=>({todos:[a,...r.todos]})),updateTodo:(a,r)=>e(o=>({todos:o.todos.map(c=>c.id===a?{...c,...r}:c)})),deleteTodo:a=>e(r=>({todos:r.todos.filter(o=>o.id!==a),activeTodoId:r.activeTodoId===a?null:r.activeTodoId})),setActiveTodo:a=>e({activeTodoId:a}),getTodosByBot:a=>{const r=s();let o=r.todos.filter(d=>d.botId===a);r.filter.status!=="all"&&(o=o.filter(d=>d.status===r.filter.status)),r.filter.priority!=="all"&&(o=o.filter(d=>d.priority===r.filter.priority));const c={urgent:0,high:1,normal:2,low:3};return o.sort((d,h)=>{const m=c[d.priority]-c[h.priority];return m!==0?m:new Date(h.createdAt).getTime()-new Date(d.createdAt).getTime()})},getOpenTodos:a=>s().todos.filter(o=>o.botId===a&&o.status==="open"),markDone:a=>e(r=>({todos:r.todos.map(o=>o.id===a?{...o,status:"done",completedAt:new Date().toISOString()}:o)})),markConverted:(a,r,o)=>e(c=>({todos:c.todos.map(d=>d.id===a?{...d,status:"done",completedAt:new Date().toISOString(),convertedToWorkId:r,convertedToTaskId:o}:d)})),setFilter:a=>e(r=>({filter:{...r.filter,...a}}))}),{name:"cachibot-todos"}));Nt()(Yt((e,s)=>({functions:[],activeFunctionId:null,addFunction:a=>e(r=>({functions:[...r.functions,a]})),updateFunction:(a,r)=>e(o=>({functions:o.functions.map(c=>c.id===a?{...c,...r,updatedAt:new Date().toISOString()}:c)})),deleteFunction:a=>e(r=>({functions:r.functions.filter(o=>o.id!==a),activeFunctionId:r.activeFunctionId===a?null:r.activeFunctionId})),setActiveFunction:a=>e({activeFunctionId:a}),getFunctionsByBot:a=>s().functions.filter(o=>o.botId===a).sort((o,c)=>o.name.localeCompare(c.name)),incrementRunCount:(a,r)=>e(o=>({functions:o.functions.map(c=>{if(c.id!==a)return c;const d=c.runCount+1,f=(c.runCount*c.successRate+(r?1:0))/d;return{...c,runCount:d,successRate:f,lastRunAt:new Date().toISOString(),updatedAt:new Date().toISOString()}})}))}),{name:"cachibot-functions"}));const v2=Nt()(Yt((e,s)=>({schedules:[],activeScheduleId:null,addSchedule:a=>e(r=>({schedules:[...r.schedules,a]})),updateSchedule:(a,r)=>e(o=>({schedules:o.schedules.map(c=>c.id===a?{...c,...r,updatedAt:new Date().toISOString()}:c)})),deleteSchedule:a=>e(r=>({schedules:r.schedules.filter(o=>o.id!==a),activeScheduleId:r.activeScheduleId===a?null:r.activeScheduleId})),setActiveSchedule:a=>e({activeScheduleId:a}),getSchedulesByBot:a=>s().schedules.filter(o=>o.botId===a).sort((o,c)=>o.name.localeCompare(c.name)),getEnabledSchedules:a=>s().schedules.filter(o=>!(!o.enabled||a&&o.botId!==a)),toggleEnabled:a=>e(r=>({schedules:r.schedules.map(o=>o.id===a?{...o,enabled:!o.enabled,updatedAt:new Date().toISOString()}:o)})),recordRun:(a,r)=>e(o=>({schedules:o.schedules.map(c=>c.id===a?{...c,runCount:c.runCount+1,lastRunAt:new Date().toISOString(),nextRunAt:r||c.nextRunAt,updatedAt:new Date().toISOString()}:c)}))}),{name:"cachibot-schedules"})),td={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"}}},Bt=Nt()(Yt(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:s=>e({theme:s}),setAccentColor:s=>e({accentColor:s}),toggleTheme:()=>e(s=>({theme:s.theme==="light"?"dark":"light"})),setSidebarCollapsed:s=>e({sidebarCollapsed:s}),toggleSidebar:()=>e(s=>({sidebarCollapsed:!s.sidebarCollapsed})),setMobileMenuOpen:s=>e({mobileMenuOpen:s}),toggleMobileMenu:()=>e(s=>({mobileMenuOpen:!s.mobileMenuOpen})),setSettingsOpen:s=>e({settingsOpen:s}),setBotSettingsOpen:s=>e({botSettingsOpen:s}),setCreateBotOpen:s=>e({createBotOpen:s}),setCommandPaletteOpen:s=>e({commandPaletteOpen:s}),setShowThinking:s=>e({showThinking:s}),setShowCost:s=>e({showCost:s}),setSettingsSection:s=>e({settingsSection:s}),setWorkSection:s=>e({workSection:s}),setScheduleSection:s=>e({scheduleSection:s})}),{name:"cachibot-ui",partialize:e=>({theme:e.theme,accentColor:e.accentColor,sidebarCollapsed:e.sidebarCollapsed,showThinking:e.showThinking,showCost:e.showCost})})),f3={shield:ps,bot:Hn,brain:Fr,zap:Xi,flame:N4,gem:S4,rocket:Hv,target:m0,laptop:M4,"bar-chart":Ou,sparkles:Sn,star:nl,cpu:t0,ghost:C4,palette:qo,"pen-tool":q4,code:Js,terminal:Zu};function En({icon:e,className:s,size:a=24,color:r}){const o=f3[e]||ps;return n.jsx(o,{className:s,size:a,style:r?{color:r}:void 0})}const j2=[{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 w2(e){var s,a,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(s=0;s<o;s++)e[s]&&(a=w2(e[s]))&&(r&&(r+=" "),r+=a)}else for(a in e)e[a]&&(r&&(r+=" "),r+=a);return r}function m3(){for(var e,s,a=0,r="",o=arguments.length;a<o;a++)(e=arguments[a])&&(s=w2(e))&&(r&&(r+=" "),r+=s);return r}const w0="-",x3=e=>{const s=g3(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:d=>{const h=d.split(w0);return h[0]===""&&h.length!==1&&h.shift(),z2(h,s)||p3(d)},getConflictingClassGroupIds:(d,h)=>{const m=a[d]||[];return h&&r[d]?[...m,...r[d]]:m}}},z2=(e,s)=>{var d;if(e.length===0)return s.classGroupId;const a=e[0],r=s.nextPart.get(a),o=r?z2(e.slice(1),r):void 0;if(o)return o;if(s.validators.length===0)return;const c=e.join(w0);return(d=s.validators.find(({validator:h})=>h(c)))==null?void 0:d.classGroupId},gy=/^\[(.+)\]$/,p3=e=>{if(gy.test(e)){const s=gy.exec(e)[1],a=s==null?void 0:s.substring(0,s.indexOf(":"));if(a)return"arbitrary.."+a}},g3=e=>{const{theme:s,prefix:a}=e,r={nextPart:new Map,validators:[]};return y3(Object.entries(e.classGroups),a).forEach(([c,d])=>{Nm(d,r,c,s)}),r},Nm=(e,s,a,r)=>{e.forEach(o=>{if(typeof o=="string"){const c=o===""?s:by(s,o);c.classGroupId=a;return}if(typeof o=="function"){if(b3(o)){Nm(o(r),s,a,r);return}s.validators.push({validator:o,classGroupId:a});return}Object.entries(o).forEach(([c,d])=>{Nm(d,by(s,c),a,r)})})},by=(e,s)=>{let a=e;return s.split(w0).forEach(r=>{a.nextPart.has(r)||a.nextPart.set(r,{nextPart:new Map,validators:[]}),a=a.nextPart.get(r)}),a},b3=e=>e.isThemeGetter,y3=(e,s)=>s?e.map(([a,r])=>{const o=r.map(c=>typeof c=="string"?s+c:typeof c=="object"?Object.fromEntries(Object.entries(c).map(([d,h])=>[s+d,h])):c);return[a,o]}):e,v3=e=>{if(e<1)return{get:()=>{},set:()=>{}};let s=0,a=new Map,r=new Map;const o=(c,d)=>{a.set(c,d),s++,s>e&&(s=0,r=a,a=new Map)};return{get(c){let d=a.get(c);if(d!==void 0)return d;if((d=r.get(c))!==void 0)return o(c,d),d},set(c,d){a.has(c)?a.set(c,d):o(c,d)}}},N2="!",j3=e=>{const{separator:s,experimentalParseClassName:a}=e,r=s.length===1,o=s[0],c=s.length,d=h=>{const m=[];let f=0,p=0,b;for(let w=0;w<h.length;w++){let j=h[w];if(f===0){if(j===o&&(r||h.slice(w,w+c)===s)){m.push(h.slice(p,w)),p=w+c;continue}if(j==="/"){b=w;continue}}j==="["?f++:j==="]"&&f--}const v=m.length===0?h:h.substring(p),y=v.startsWith(N2),N=y?v.substring(1):v,S=b&&b>p?b-p:void 0;return{modifiers:m,hasImportantModifier:y,baseClassName:N,maybePostfixModifierPosition:S}};return a?h=>a({className:h,parseClassName:d}):d},w3=e=>{if(e.length<=1)return e;const s=[];let a=[];return e.forEach(r=>{r[0]==="["?(s.push(...a.sort(),r),a=[]):a.push(r)}),s.push(...a.sort()),s},z3=e=>({cache:v3(e.cacheSize),parseClassName:j3(e),...x3(e)}),N3=/\s+/,k3=(e,s)=>{const{parseClassName:a,getClassGroupId:r,getConflictingClassGroupIds:o}=s,c=[],d=e.trim().split(N3);let h="";for(let m=d.length-1;m>=0;m-=1){const f=d[m],{modifiers:p,hasImportantModifier:b,baseClassName:v,maybePostfixModifierPosition:y}=a(f);let N=!!y,S=r(N?v.substring(0,y):v);if(!S){if(!N){h=f+(h.length>0?" "+h:h);continue}if(S=r(v),!S){h=f+(h.length>0?" "+h:h);continue}N=!1}const w=w3(p).join(":"),j=b?w+N2:w,C=j+S;if(c.includes(C))continue;c.push(C);const T=o(S,N);for(let D=0;D<T.length;++D){const E=T[D];c.push(j+E)}h=f+(h.length>0?" "+h:h)}return h};function S3(){let e=0,s,a,r="";for(;e<arguments.length;)(s=arguments[e++])&&(a=k2(s))&&(r&&(r+=" "),r+=a);return r}const k2=e=>{if(typeof e=="string")return e;let s,a="";for(let r=0;r<e.length;r++)e[r]&&(s=k2(e[r]))&&(a&&(a+=" "),a+=s);return a};function C3(e,...s){let a,r,o,c=d;function d(m){const f=s.reduce((p,b)=>b(p),e());return a=z3(f),r=a.cache.get,o=a.cache.set,c=h,h(m)}function h(m){const f=r(m);if(f)return f;const p=k3(m,a);return o(m,p),p}return function(){return c(S3.apply(null,arguments))}}const vt=e=>{const s=a=>a[e]||[];return s.isThemeGetter=!0,s},S2=/^\[(?:([a-z-]+):)?(.+)\]$/i,T3=/^\d+\/\d+$/,E3=new Set(["px","full","screen"]),A3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,M3=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,D3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,O3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,R3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xa=e=>$r(e)||E3.has(e)||T3.test(e),Ka=e=>ml(e,"length",q3),$r=e=>!!e&&!Number.isNaN(Number(e)),Df=e=>ml(e,"number",$r),mo=e=>!!e&&Number.isInteger(Number(e)),_3=e=>e.endsWith("%")&&$r(e.slice(0,-1)),Pe=e=>S2.test(e),Za=e=>A3.test(e),L3=new Set(["length","size","percentage"]),U3=e=>ml(e,L3,C2),B3=e=>ml(e,"position",C2),I3=new Set(["image","url"]),H3=e=>ml(e,I3,$3),P3=e=>ml(e,"",F3),xo=()=>!0,ml=(e,s,a)=>{const r=S2.exec(e);return r?r[1]?typeof s=="string"?r[1]===s:s.has(r[1]):a(r[2]):!1},q3=e=>M3.test(e)&&!D3.test(e),C2=()=>!1,F3=e=>O3.test(e),$3=e=>R3.test(e),V3=()=>{const e=vt("colors"),s=vt("spacing"),a=vt("blur"),r=vt("brightness"),o=vt("borderColor"),c=vt("borderRadius"),d=vt("borderSpacing"),h=vt("borderWidth"),m=vt("contrast"),f=vt("grayscale"),p=vt("hueRotate"),b=vt("invert"),v=vt("gap"),y=vt("gradientColorStops"),N=vt("gradientColorStopPositions"),S=vt("inset"),w=vt("margin"),j=vt("opacity"),C=vt("padding"),T=vt("saturate"),D=vt("scale"),E=vt("sepia"),A=vt("skew"),B=vt("space"),V=vt("translate"),ee=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto",Pe,s],_=()=>[Pe,s],se=()=>["",xa,Ka],U=()=>["auto",$r,Pe],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],I=()=>["solid","dashed","dotted","double","none"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>["start","end","center","between","around","evenly","stretch"],he=()=>["","0",Pe],L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>[$r,Pe];return{cacheSize:500,separator:":",theme:{colors:[xo],spacing:[xa,Ka],blur:["none","",Za,Pe],brightness:P(),borderColor:[e],borderRadius:["none","","full",Za,Pe],borderSpacing:_(),borderWidth:se(),contrast:P(),grayscale:he(),hueRotate:P(),invert:he(),gap:_(),gradientColorStops:[e],gradientColorStopPositions:[_3,Ka],inset:F(),margin:F(),opacity:P(),padding:_(),saturate:P(),scale:P(),sepia:he(),skew:P(),space:_(),translate:_()},classGroups:{aspect:[{aspect:["auto","square","video",Pe]}],container:["container"],columns:[{columns:[Za]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"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:[...H(),Pe]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:ee()}],"overscroll-x":[{"overscroll-x":ee()}],"overscroll-y":[{"overscroll-y":ee()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[S]}],"inset-x":[{"inset-x":[S]}],"inset-y":[{"inset-y":[S]}],start:[{start:[S]}],end:[{end:[S]}],top:[{top:[S]}],right:[{right:[S]}],bottom:[{bottom:[S]}],left:[{left:[S]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",mo,Pe]}],basis:[{basis:F()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Pe]}],grow:[{grow:he()}],shrink:[{shrink:he()}],order:[{order:["first","last","none",mo,Pe]}],"grid-cols":[{"grid-cols":[xo]}],"col-start-end":[{col:["auto",{span:["full",mo,Pe]},Pe]}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":[xo]}],"row-start-end":[{row:["auto",{span:[mo,Pe]},Pe]}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Pe]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Pe]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...re()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...re(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...re(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[C]}],px:[{px:[C]}],py:[{py:[C]}],ps:[{ps:[C]}],pe:[{pe:[C]}],pt:[{pt:[C]}],pr:[{pr:[C]}],pb:[{pb:[C]}],pl:[{pl:[C]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[B]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[B]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Pe,s]}],"min-w":[{"min-w":[Pe,s,"min","max","fit"]}],"max-w":[{"max-w":[Pe,s,"none","full","min","max","fit","prose",{screen:[Za]},Za]}],h:[{h:[Pe,s,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Pe,s,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Pe,s,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Pe,s,"auto","min","max","fit"]}],"font-size":[{text:["base",Za,Ka]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Df]}],"font-family":[{font:[xo]}],"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",Pe]}],"line-clamp":[{"line-clamp":["none",$r,Df]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",xa,Pe]}],"list-image":[{"list-image":["none",Pe]}],"list-style-type":[{list:["none","disc","decimal",Pe]}],"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:[...I(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",xa,Ka]}],"underline-offset":[{"underline-offset":["auto",xa,Pe]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Pe]}],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",Pe]}],"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:[...H(),B3]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",U3]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},H3]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[N]}],"gradient-via-pos":[{via:[N]}],"gradient-to-pos":[{to:[N]}],"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:[h]}],"border-w-x":[{"border-x":[h]}],"border-w-y":[{"border-y":[h]}],"border-w-s":[{"border-s":[h]}],"border-w-e":[{"border-e":[h]}],"border-w-t":[{"border-t":[h]}],"border-w-r":[{"border-r":[h]}],"border-w-b":[{"border-b":[h]}],"border-w-l":[{"border-l":[h]}],"border-opacity":[{"border-opacity":[j]}],"border-style":[{border:[...I(),"hidden"]}],"divide-x":[{"divide-x":[h]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[h]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[j]}],"divide-style":[{divide:I()}],"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:["",...I()]}],"outline-offset":[{"outline-offset":[xa,Pe]}],"outline-w":[{outline:[xa,Ka]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[j]}],"ring-offset-w":[{"ring-offset":[xa,Ka]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Za,P3]}],"shadow-color":[{shadow:[xo]}],opacity:[{opacity:[j]}],"mix-blend":[{"mix-blend":[...W(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":W()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[r]}],contrast:[{contrast:[m]}],"drop-shadow":[{"drop-shadow":["","none",Za,Pe]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[b]}],saturate:[{saturate:[T]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[m]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[b]}],"backdrop-opacity":[{"backdrop-opacity":[j]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"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",Pe]}],duration:[{duration:P()}],ease:[{ease:["linear","in","out","in-out",Pe]}],delay:[{delay:P()}],animate:[{animate:["none","spin","ping","pulse","bounce",Pe]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[D]}],"scale-x":[{"scale-x":[D]}],"scale-y":[{"scale-y":[D]}],rotate:[{rotate:[mo,Pe]}],"translate-x":[{"translate-x":[V]}],"translate-y":[{"translate-y":[V]}],"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",Pe]}],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",Pe]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Pe]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[xa,Ka,Df]}],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"]}}},G3=C3(V3);function X(...e){return G3(m3(e))}const Y3=["/dashboard","/settings"];function Q3({onNavigate:e}){const s=hn(),a=gs(),{bots:r,activeBotId:o,setActiveBot:c}=xt(),{setActiveChat:d}=qt(),{setCreateBotOpen:h}=Bt(),m=a.pathname,f=Y3.some(v=>m===v||m.startsWith(v+"/")),p=v=>{c(v),d(null),s(`/${v}/chats`),e==null||e()},b=v=>{s(m===v?"/":v),e==null||e()};return n.jsxs("div",{className:"flex h-full w-[72px] flex-col items-center bg-zinc-200 py-3 dark:bg-zinc-950",children:[n.jsxs("div",{className:"flex flex-col items-center gap-2 pb-3",children:[n.jsxs("button",{onClick:()=>b("/dashboard"),className:X("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:[n.jsx(O4,{className:"h-5 w-5"}),n.jsx(ko,{children:"Dashboard"})]}),n.jsx(yy,{})]}),n.jsxs("div",{className:"flex flex-1 flex-col items-center gap-2 overflow-y-auto scrollbar-none",children:[r.map(v=>n.jsx(J3,{bot:v,active:v.id===o&&!f&&m.startsWith(`/${v.id}/`),onClick:()=>p(v.id)},v.id)),n.jsxs("button",{onClick:()=>h(!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:[n.jsx($t,{className:"h-5 w-5"}),n.jsx(ko,{children:"Create Bot"})]})]}),n.jsxs("div",{className:"mt-auto flex flex-col items-center gap-2 pt-3",children:[n.jsx(yy,{}),n.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:[n.jsx(T4,{className:"h-5 w-5"}),n.jsx(ko,{children:"GitHub"})]}),n.jsxs("button",{onClick:()=>b("/settings"),className:X("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:[n.jsx(hl,{className:"h-5 w-5"}),n.jsx(ko,{children:"Settings"})]})]})]})}function J3({bot:e,active:s,onClick:a}){return n.jsxs("button",{onClick:a,className:"group relative",children:[n.jsx("div",{className:X("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",s?"h-10":"h-0 group-hover:h-5")}),n.jsx("div",{className:X("flex h-12 w-12 items-center justify-center transition-all duration-200",s?"rounded-[16px]":"rounded-[24px] group-hover:rounded-[16px]"),style:{backgroundColor:e.color+"30"},children:n.jsx(En,{icon:e.icon,className:"h-6 w-6",size:24})}),n.jsx(ko,{children:e.name})]})}function ko({children:e}){return n.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,n.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 yy(){return n.jsx("div",{className:"h-px w-8 bg-zinc-300 dark:bg-zinc-800"})}const X3="modulepreload",K3=function(e){return"/"+e},vy={},oi=function(s,a,r){let o=Promise.resolve();if(a&&a.length>0){let d=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),m=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));o=d(a.map(f=>{if(f=K3(f),f in vy)return;vy[f]=!0;const p=f.endsWith(".css"),b=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${b}`))return;const v=document.createElement("link");if(v.rel=p?"stylesheet":X3,p||(v.as="script"),v.crossOrigin="",v.href=f,m&&v.setAttribute("nonce",m),document.head.appendChild(v),p)return new Promise((y,N)=>{v.addEventListener("load",y),v.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${f}`)))})}))}function c(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return o.then(d=>{for(const h of d||[])h.status==="rejected"&&c(h.reason);return s().catch(c)})},$o=Nt()(Yt(e=>({rooms:[],activeRoomId:null,messages:{},onlineUsers:{},typingUsers:{},botStates:{},isLoading:!1,error:null,setRooms:s=>e({rooms:s}),addRoom:s=>e(a=>({rooms:[s,...a.rooms]})),updateRoom:(s,a)=>e(r=>({rooms:r.rooms.map(o=>o.id===s?{...o,...a}:o)})),deleteRoom:s=>e(a=>({rooms:a.rooms.filter(r=>r.id!==s),activeRoomId:a.activeRoomId===s?null:a.activeRoomId,messages:(()=>{const{[s]:r,...o}=a.messages;return o})()})),setActiveRoom:s=>e({activeRoomId:s}),addMessage:(s,a)=>e(r=>{const o=r.messages[s]||[],c=o.findIndex(d=>d.id===a.id);if(c>=0){const d=[...o];return d[c]={...d[c],content:d[c].content+a.content},{messages:{...r.messages,[s]:d}}}return{messages:{...r.messages,[s]:[...o,a]}}}),appendMessageContent:(s,a,r)=>e(o=>{const c=o.messages[s]||[],d=c.findIndex(m=>m.id===a);if(d<0)return o;const h=[...c];return h[d]={...h[d],content:h[d].content+r},{messages:{...o.messages,[s]:h}}}),setMessages:(s,a)=>e(r=>({messages:{...r.messages,[s]:a}})),setOnlineUsers:(s,a)=>e(r=>({onlineUsers:{...r.onlineUsers,[s]:a}})),addOnlineUser:(s,a)=>e(r=>{const o=r.onlineUsers[s]||[];return o.includes(a)?r:{onlineUsers:{...r.onlineUsers,[s]:[...o,a]}}}),removeOnlineUser:(s,a)=>e(r=>{const o=r.onlineUsers[s]||[];return{onlineUsers:{...r.onlineUsers,[s]:o.filter(c=>c!==a)}}}),setTyping:(s,a,r,o)=>e(c=>{const d=c.typingUsers[s]||[];return o?d.some(h=>h.userId===a)?c:{typingUsers:{...c.typingUsers,[s]:[...d,{userId:a,username:r}]}}:{typingUsers:{...c.typingUsers,[s]:d.filter(h=>h.userId!==a)}}}),setBotState:(s,a,r)=>e(o=>({botStates:{...o.botStates,[s]:{...o.botStates[s]||{},[a]:r}}})),setLoading:s=>e({isLoading:s}),setError:s=>e({error:s})}),{name:"cachibot-rooms",partialize:e=>({rooms:e.rooms,messages:e.messages})})),Z3="/api";function W3(){const{accessToken:e}=Ut.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function Ms(e,s={},a=!0){const r=`${Z3}${e}`,o=await fetch(r,{headers:{"Content-Type":"application/json",...W3(),...s.headers},...s});if(o.status===401&&a&&await As())return Ms(e,s,!1);if(!o.ok){const c=await o.json().catch(()=>({}));throw new Error(c.detail||`Request failed: ${o.statusText}`)}if(o.status!==204)return o.json()}async function T2(e){return Ms("/rooms",{method:"POST",body:JSON.stringify(e)})}async function z0(){return Ms("/rooms")}async function E2(e){return Ms(`/rooms/${e}`)}async function A2(e,s){return Ms(`/rooms/${e}`,{method:"PATCH",body:JSON.stringify(s)})}async function M2(e){return Ms(`/rooms/${e}`,{method:"DELETE"})}async function D2(e,s){return Ms(`/rooms/${e}/members`,{method:"POST",body:JSON.stringify({username:s})})}async function O2(e,s){return Ms(`/rooms/${e}/members/${s}`,{method:"DELETE"})}async function R2(e,s){return Ms(`/rooms/${e}/bots`,{method:"POST",body:JSON.stringify({bot_id:s})})}async function _2(e,s){return Ms(`/rooms/${e}/bots/${s}`,{method:"DELETE"})}async function L2(e,s=50,a){const r=new URLSearchParams({limit:s.toString()});return a&&r.set("before",a),Ms(`/rooms/${e}/messages?${r}`)}const hu=Object.freeze(Object.defineProperty({__proto__:null,addRoomBot:R2,createRoom:T2,deleteRoom:M2,getRoom:E2,getRoomMessages:L2,getRooms:z0,inviteMember:D2,removeMember:O2,removeRoomBot:_2,updateRoom:A2},Symbol.toStringTag,{value:"Module"})),km={"file-text":Na,"file-pen":Nv,"folder-open":Qu,"file-search":Sv,"file-scan":kv,"trash-2":Vt,code:Js,terminal:Zu,globe:a0,search:Tn,database:Po,wrench:mi,"check-circle":ul,send:tl,"message-circle":Gi,briefcase:Zm,"list-todo":Dv,"list-checks":l0,"circle-check":wa,"clipboard-plus":gv,"clipboard-list":pv,"git-branch":Tv,"git-commit-horizontal":Ev,"git-pull-request":Av,diff:vv,history:i0,"file-terminal":Cv,network:Uv,"file-archive":zv,"folder-archive":No,table:Fv,"database-zap":yv,folder:k4},eC={file_read:Na,file_write:Nv,file_list:Qu,file_edit:Sv,file_info:kv,file_delete:Vt,python_execute:Js,shell_execute:Zu,shell_which:Cv,git_status:Av,git_diff:vv,git_log:i0,git_commit:Ev,git_branch:Tv,web_fetch:a0,web_search:Tn,http_request:Uv,sqlite_query:Po,sqlite_execute:yv,sqlite_tables:Fv,zip_create:No,zip_extract:No,zip_list:zv,tar_create:No,tar_extract:No,task_complete:ul,telegram_send:tl,discord_send:Gi,work_create:Zm,work_list:pv,work_update:gv,todo_create:Dv,todo_list:l0,todo_done:wa};function N0({toolId:e,icon:s,className:a,size:r=20}){const o=s&&km[s]||eC[e]||mi;return n.jsx(o,{className:a,size:r})}function tC(e){return e&&km[e]?km[e]:mi}const nC=[{id:"chats",label:"Chats",icon:di},{id:"rooms",label:"Rooms",icon:jv},{id:"tasks",label:"Tasks",icon:Pv},{id:"work",label:"Work",icon:s0},{id:"schedules",label:"Schedules",icon:Wm},{id:"voice",label:"Voice",icon:Do},{id:"tools",label:"Tools",icon:mi},{id:"settings",label:"Settings",icon:hl}];function sC({onNavigate:e}){const s=hn(),{getActiveBot:a,activeView:r,setActiveView:o,activeBotId:c}=xt(),{sidebarCollapsed:d}=Bt(),h=a();if(!h)return null;const m=f=>{o(f),s(`/${c}/${f}`)};return n.jsxs("aside",{className:X("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:[n.jsxs("div",{className:"flex h-14 items-center gap-3 border-b border-zinc-300 px-4 dark:border-zinc-800",children:[n.jsx("div",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:h.color+"20"},children:n.jsx(En,{icon:h.icon,size:18})}),!d&&n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h2",{className:"truncate text-sm font-semibold text-zinc-900 dark:text-zinc-100",children:h.name}),n.jsx("p",{className:"truncate text-xs text-zinc-500",children:h.model})]})]}),n.jsx("nav",{className:"flex items-center justify-center gap-1 border-b border-zinc-300 px-3 py-2 dark:border-zinc-800",children:nC.map(f=>n.jsx(aC,{icon:f.icon,label:f.label,active:r===f.id,onClick:()=>m(f.id)},f.id))}),n.jsxs("div",{className:"flex-1 overflow-hidden",children:[r==="chats"&&n.jsx(iC,{botId:h.id,collapsed:d,onNavigate:e}),r==="rooms"&&n.jsx(rC,{collapsed:d,onNavigate:e}),r==="tasks"&&n.jsx(lC,{botId:h.id,collapsed:d,onNavigate:e}),r==="work"&&n.jsx(oC,{botId:h.id,collapsed:d}),r==="schedules"&&n.jsx(cC,{botId:h.id,collapsed:d}),r==="tools"&&n.jsx(uC,{botId:h.id,collapsed:d}),r==="settings"&&n.jsx(dC,{collapsed:d})]})]})}function aC({icon:e,label:s,active:a,onClick:r}){return n.jsxs("button",{onClick:r,title:s,className:X("group relative flex h-8 w-8 items-center justify-center rounded-lg transition-all",a?"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:[n.jsx(e,{className:"h-4 w-4"}),n.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:s})]})}function iC({botId:e,collapsed:s,onNavigate:a}){const r=hn(),{getChatsByBot:o,activeChatId:c,setActiveChat:d,addChat:h,updateChat:m,deleteChat:f,clearMessages:p,syncPlatformChats:b,loadPlatformChatMessages:v,archiveChat:y}=qt(),[N,S]=k.useState(""),[w,j]=k.useState(null);k.useEffect(()=>{b(e);const A=setInterval(()=>b(e),6e4);return()=>clearInterval(A)},[e,b]);const C=o(e).filter(A=>!N||A.title.toLowerCase().includes(N.toLowerCase())),T=A=>A.platform==="telegram"?n.jsx(Gi,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-blue-400"}):A.platform==="discord"?n.jsx(Gi,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-indigo-400"}):n.jsx(di,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-zinc-500"}),D=()=>{const A={id:crypto.randomUUID(),botId:e,title:"New Chat",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0};h(A),d(A.id),r(`/${e}/chats/${A.id}`),a==null||a()},E=async A=>{d(A.id),A.platform&&await v(e,A.id);const B=A.platform?A.platform:A.id;r(`/${e}/chats/${B}`),a==null||a()};return s?n.jsx("div",{className:"flex flex-col items-center gap-2 p-2",children:n.jsx("button",{onClick:D,className:"flex h-10 w-10 items-center justify-center rounded-lg bg-cachi-600 text-white hover:bg-cachi-500",children:n.jsx($t,{className:"h-4 w-4"})})}):n.jsxs("div",{className:"flex h-full flex-col",children:[n.jsxs("div",{className:"flex gap-2 p-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(Tn,{className:"absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),n.jsx("input",{type:"text",placeholder:"Search chats...",value:N,onChange:A=>S(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"})]}),n.jsx("button",{onClick:D,className:"flex h-9 w-9 items-center justify-center rounded-lg bg-cachi-600 text-white hover:bg-cachi-500",children:n.jsx($t,{className:"h-4 w-4"})})]}),n.jsx("div",{className:"flex-1 overflow-y-auto px-2 pb-2",children:C.length===0?n.jsx("div",{className:"py-8 text-center text-sm text-zinc-500",children:N?"No chats found":"No chats yet"}):n.jsx("div",{className:"space-y-1",children:C.map(A=>n.jsxs("div",{className:"group relative",children:[n.jsxs("button",{onClick:()=>E(A),className:X("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:[T(A),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"truncate text-sm font-medium",children:A.title}),A.pinned&&n.jsx(fy,{className:"h-3 w-3 flex-shrink-0 text-cachi-500"}),A.platform&&n.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&&n.jsx("p",{className:"truncate text-xs text-zinc-500",children:A.lastMessage})]})]}),n.jsx("button",{onClick:B=>{B.stopPropagation(),j(w===A.id?null:A.id)},className:X("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",w===A.id&&"opacity-100"),children:n.jsx(n0,{className:"h-4 w-4"})}),w===A.id&&n.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:[n.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:[n.jsx(fy,{className:"h-4 w-4"}),A.pinned?"Unpin":"Pin"]}),A.platform?n.jsxs(n.Fragment,{children:[n.jsxs("button",{onClick:async()=>{j(null);try{await u2(e,A.id),p(A.id),ke.success("Messages cleared")}catch{ke.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:[n.jsx(v4,{className:"h-4 w-4"}),"Clear Messages"]}),n.jsxs("button",{onClick:async()=>{j(null);try{await y(e,A.id),ke.success("Chat archived")}catch{ke.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:[n.jsx(xm,{className:"h-4 w-4"}),"Archive Chat"]})]}):n.jsxs(n.Fragment,{children:[n.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:[n.jsx(xm,{className:"h-4 w-4"}),"Archive"]}),n.jsx("div",{className:"my-1 h-px bg-zinc-300 dark:bg-zinc-700"}),n.jsxs("button",{onClick:()=>{f(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:[n.jsx(Vt,{className:"h-4 w-4"}),"Delete"]})]})]})]},A.id))})})]})}function rC({collapsed:e,onNavigate:s}){const a=hn(),{activeBotId:r}=xt(),{rooms:o,setRooms:c,activeRoomId:d,setActiveRoom:h}=$o(),[m,f]=k.useState(""),[p,b]=k.useState(!1);k.useEffect(()=>{z0().then(c).catch(()=>{})},[c]);const v=o.filter(S=>!m||S.title.toLowerCase().includes(m.toLowerCase())),y=S=>{h(S),a(`/${r}/rooms/${S}`),s==null||s()},N=()=>{b(!0)};return e?n.jsxs("div",{className:"flex flex-col items-center gap-2 p-2",children:[n.jsx("button",{onClick:N,className:"flex h-10 w-10 items-center justify-center rounded-lg bg-cachi-600 text-white hover:bg-cachi-500",children:n.jsx($t,{className:"h-4 w-4"})}),o.length>0&&n.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:o.length}),p&&n.jsx(jy,{onClose:()=>b(!1)})]}):n.jsxs("div",{className:"flex h-full flex-col",children:[n.jsxs("div",{className:"flex gap-2 p-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(Tn,{className:"absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),n.jsx("input",{type:"text",placeholder:"Search rooms...",value:m,onChange:S=>f(S.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"})]}),n.jsx("button",{onClick:N,className:"flex h-9 w-9 items-center justify-center rounded-lg bg-cachi-600 text-white hover:bg-cachi-500",children:n.jsx($t,{className:"h-4 w-4"})})]}),n.jsx("div",{className:"flex-1 overflow-y-auto px-2 pb-2",children:v.length===0?n.jsx("div",{className:"py-8 text-center text-sm text-zinc-500",children:m?"No rooms found":"No rooms yet"}):n.jsx("div",{className:"space-y-1",children:v.map(S=>n.jsxs("button",{onClick:()=>y(S.id),className:X("flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors",d===S.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.jsx(jv,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-zinc-500"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"truncate text-sm font-medium",children:S.title}),n.jsxs("div",{className:"flex items-center gap-2 text-xs text-zinc-500",children:[n.jsxs("span",{children:[S.bots.length," bots"]}),n.jsxs("span",{children:[S.messageCount??0," msgs"]})]})]})]},S.id))})}),p&&n.jsx(jy,{onClose:()=>b(!1)})]})}function jy({onClose:e}){const[s,a]=k.useState(null);return k.useEffect(()=>{oi(()=>Promise.resolve().then(()=>U7),[]).then(r=>{a(()=>r.CreateRoomDialog)})},[]),s?n.jsx(s,{onClose:e}):null}function lC({botId:e,collapsed:s,onNavigate:a}){const{getTasksByBot:r,activeTaskId:o,setActiveTask:c,addTask:d,updateTask:h}=sl(),m=r(e),f=b=>{switch(b){case"todo":return"border-zinc-600 bg-zinc-800";case"in_progress":return"border-blue-500 bg-blue-500/10";case"done":return"border-green-500 bg-green-500/10";case"blocked":return"border-red-500 bg-red-500/10"}},p=()=>{const b={id:crypto.randomUUID(),botId:e,title:"New Task",status:"todo",priority:"medium",tags:[],createdAt:new Date().toISOString()};d(b),c(b.id),a==null||a()};if(s){const b=m.filter(v=>v.status==="todo").length;return n.jsxs("div",{className:"flex flex-col items-center gap-2 p-2",children:[n.jsx("button",{onClick:p,className:"flex h-10 w-10 items-center justify-center rounded-lg bg-cachi-600 text-white hover:bg-cachi-500",children:n.jsx($t,{className:"h-4 w-4"})}),b>0&&n.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-zinc-800 text-xs font-bold text-zinc-300",children:b})]})}return n.jsxs("div",{className:"flex h-full flex-col",children:[n.jsx("div",{className:"p-3",children:n.jsxs("button",{onClick:p,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:[n.jsx($t,{className:"h-4 w-4"}),"Add Task"]})}),n.jsx("div",{className:"flex-1 overflow-y-auto px-2 pb-2",children:m.length===0?n.jsx("div",{className:"py-8 text-center text-sm text-zinc-500",children:"No tasks yet"}):n.jsx("div",{className:"space-y-2",children:m.map(b=>n.jsxs("button",{onClick:()=>{c(b.id),a==null||a()},className:X("flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors",o===b.id&&"ring-1 ring-cachi-500",f(b.status)),children:[n.jsx("button",{onClick:v=>{v.stopPropagation(),h(b.id,{status:b.status==="done"?"todo":"done",completedAt:b.status==="done"?void 0:new Date().toISOString()})},className:X("mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center rounded border transition-colors",b.status==="done"?"border-green-500 bg-green-500 text-white":"border-zinc-500 hover:border-cachi-500"),children:b.status==="done"&&"✓"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:X("text-sm",b.status==="done"?"text-zinc-500 line-through":"text-zinc-200"),children:b.title}),b.tags.length>0&&n.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:b.tags.map(v=>n.jsx("span",{className:"rounded bg-zinc-700 px-1.5 py-0.5 text-xs text-zinc-400",children:v},v))})]})]},b.id))})})]})}const wy=[{id:"overview",label:"Overview",icon:s0},{id:"active",label:"Active",icon:Ju},{id:"completed",label:"Completed",icon:wa},{id:"history",label:"History",icon:i0}];function oC({botId:e,collapsed:s}){const{workSection:a,setWorkSection:r}=Bt(),{getWorkByBot:o,getActiveWork:c}=j0(),d=o(e),h=c(e);return s?n.jsx("div",{className:"flex flex-col items-center gap-1 p-2",children:wy.map(m=>n.jsx("button",{onClick:()=>r(m.id),className:X("flex h-10 w-10 items-center justify-center rounded-lg transition-colors",a===m.id?"bg-blue-600/20 text-blue-400":"text-zinc-400 hover:bg-zinc-800"),title:m.label,children:n.jsx(m.icon,{className:"h-5 w-5"})},m.id))}):n.jsx("div",{className:"flex h-full flex-col p-3",children:n.jsx("div",{className:"space-y-1",children:wy.map(m=>{let f;return m.id==="active"&&(f=h.length),m.id==="completed"&&(f=d.filter(p=>p.status==="completed").length),m.id==="history"&&(f=d.length),n.jsxs("button",{onClick:()=>r(m.id),className:X("flex w-full items-center gap-3 rounded-lg p-3 text-left transition-colors",a===m.id?"bg-blue-600/20 text-blue-400":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"),children:[n.jsx(m.icon,{className:"h-5 w-5"}),n.jsx("span",{className:"flex-1 text-sm",children:m.label}),f!==void 0&&f>0&&n.jsx("span",{className:"rounded-full bg-zinc-700 px-2 py-0.5 text-xs text-zinc-400",children:f})]},m.id)})})})}const zy=[{id:"all",label:"All Schedules",icon:Wm},{id:"enabled",label:"Enabled",icon:Ju},{id:"disabled",label:"Disabled",icon:Bv},{id:"create",label:"Create New",icon:$t}];function cC({botId:e,collapsed:s}){const{scheduleSection:a,setScheduleSection:r}=Bt(),{getSchedulesByBot:o,getEnabledSchedules:c}=v2(),d=o(e),h=c(e);return s?n.jsx("div",{className:"flex flex-col items-center gap-1 p-2",children:zy.map(m=>n.jsx("button",{onClick:()=>r(m.id),className:X("flex h-10 w-10 items-center justify-center rounded-lg transition-colors",a===m.id?"bg-purple-600/20 text-purple-400":"text-zinc-400 hover:bg-zinc-800"),title:m.label,children:n.jsx(m.icon,{className:"h-5 w-5"})},m.id))}):n.jsx("div",{className:"flex h-full flex-col p-3",children:n.jsx("div",{className:"space-y-1",children:zy.map(m=>{let f;return m.id==="all"&&(f=d.length),m.id==="enabled"&&(f=h.length),m.id==="disabled"&&(f=d.length-h.length),n.jsxs("button",{onClick:()=>r(m.id),className:X("flex w-full items-center gap-3 rounded-lg p-3 text-left transition-colors",a===m.id?"bg-purple-600/20 text-purple-400":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"),children:[n.jsx(m.icon,{className:"h-5 w-5"}),n.jsx("span",{className:"flex-1 text-sm",children:m.label}),f!==void 0&&f>0&&n.jsx("span",{className:"rounded-full bg-zinc-700 px-2 py-0.5 text-xs text-zinc-400",children:f})]},m.id)})})})}function uC({collapsed:e}){const{getActiveBot:s}=xt(),a=s(),r=(a==null?void 0:a.tools)||[];return e?n.jsx("div",{className:"flex flex-col items-center p-2",children:n.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:r.length})}):n.jsx("div",{className:"flex h-full flex-col p-3",children:n.jsx("div",{className:"space-y-2",children:r.map(o=>n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-zinc-700 bg-zinc-800/30 p-3",children:[n.jsx(N0,{toolId:o,className:"h-5 w-5 text-zinc-400"}),n.jsx("span",{className:"text-sm capitalize text-zinc-300",children:o.replace(/_/g," ")})]},o))})})}const Ny=[{id:"general",label:"General",icon:Hn},{id:"knowledge",label:"Knowledge",icon:xv},{id:"skills",label:"Skills",icon:Sn},{id:"connections",label:"Connections",icon:c0},{id:"voice",label:"Voice",icon:Do},{id:"advanced",label:"Advanced",icon:Ku},{id:"danger",label:"Danger Zone",icon:Yi,danger:!0}];function dC({collapsed:e}){const{settingsSection:s,setSettingsSection:a}=Bt();return e?n.jsx("div",{className:"flex flex-col items-center gap-1 p-2",children:Ny.map(r=>n.jsx("button",{onClick:()=>a(r.id),className:X("flex h-10 w-10 items-center justify-center rounded-lg transition-colors",s===r.id?"bg-cachi-600/20 text-cachi-400":r.danger?"text-red-400/70 hover:bg-red-500/10":"text-zinc-400 hover:bg-zinc-800"),title:r.label,children:n.jsx(r.icon,{className:"h-5 w-5"})},r.id))}):n.jsx("div",{className:"flex h-full flex-col p-3",children:n.jsx("div",{className:"space-y-1",children:Ny.map(r=>n.jsxs("button",{onClick:()=>a(r.id),className:X("flex w-full items-center gap-3 rounded-lg p-3 text-left transition-colors",s===r.id?"bg-cachi-600/20 text-cachi-400":r.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:[n.jsx(r.icon,{className:"h-5 w-5"}),n.jsx("span",{className:"text-sm",children:r.label})]},r.id))})})}const fu={name:null,nameSuggestions:[],purposeCategory:null,purposeDescription:null,communicationStyle:null,useEmojis:null,detectedLanguage:null},hC=Nt()(Yt((e,s)=>({step:"idle",data:{...fu},flowChatId:null,isLoadingNames:!1,createdBotId:null,startFlow:a=>{e({step:"name",data:{...fu},flowChatId:a,isLoadingNames:!1})},setName:a=>{const r=xt.getState().bots,o=a.toLowerCase().trim();if(r.some(d=>d.name.toLowerCase()===o))throw new Error(`A bot named "${a}" already exists. Please choose a different name.`);e(d=>({step:"purpose-category",data:{...d.data,name:a.trim()}}))},setNameSuggestions:a=>{e(r=>({data:{...r.data,nameSuggestions:a}}))},setPurposeCategory:a=>{e(r=>({step:"purpose-description",data:{...r.data,purposeCategory:a}}))},setPurposeDescription:a=>{e(r=>({step:"style",data:{...r.data,purposeDescription:a}}))},setStyle:a=>{e(r=>({step:"emoji",data:{...r.data,communicationStyle:a}}))},setEmoji:a=>{e(r=>({step:"summary",data:{...r.data,useEmojis:a}}))},setDetectedLanguage:a=>{e(r=>({data:{...r.data,detectedLanguage:a}}))},confirmAndCreate:()=>s().data,completeFlow:a=>{e({step:"idle",data:{...fu},flowChatId:null,isLoadingNames:!1,createdBotId:a||null})},cancelFlow:()=>{e({step:"idle",data:{...fu},flowChatId:null,isLoadingNames:!1,createdBotId:null})},setLoadingNames:a=>{e({isLoadingNames:a})},getFlowData:()=>({...s().data})}),{name:"cachibot-creation-flow",partialize:e=>({step:e.step,data:e.data,flowChatId:e.flowChatId})})),fC="/api";function mC(){const{accessToken:e}=Ut.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function xl(e,s={},a=!0){const r=`${fC}${e}`,o=await fetch(r,{headers:{"Content-Type":"application/json",...mC(),...s.headers},...s});if(o.status===401&&a&&await As())return xl(e,s,!1);if(!o.ok){const c=await o.json().catch(()=>({}));throw new Error(c.detail||`Request failed: ${o.statusText}`)}return o.json()}async function xC(){return(await xl("/models")).groups||{}}async function pC(){return(await xl("/models/default")).model}async function gC(e){await xl("/models/default",{method:"PUT",body:JSON.stringify({model:e})})}async function bC(){return(await xl("/models/image")).groups||{}}async function yC(){return(await xl("/models/audio")).groups||{}}const Wn=Nt((e,s)=>({groups:{},imageGroups:{},audioGroups:{},defaultModel:"",loading:!0,error:null,get models(){return Object.values(s().groups).flat()},refresh:async()=>{e({loading:!0,error:null});try{const[a,r,o,c]=await Promise.all([xC(),pC(),bC().catch(()=>({})),yC().catch(()=>({}))]);e({groups:a,imageGroups:o,audioGroups:c,defaultModel:r,loading:!1})}catch(a){e({error:a instanceof Error?a.message:"Failed to load models",loading:!1})}},updateDefaultModel:async a=>{try{await gC(a),e({defaultModel:a})}catch(r){e({error:r instanceof Error?r.message:"Failed to update default model"})}}}));function vC(e,s){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const jC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,wC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zC={};function ky(e,s){return(zC.jsx?wC:jC).test(e)}const NC=/[ \t\n\f\r]/g;function kC(e){return typeof e=="object"?e.type==="text"?Sy(e.value):!1:Sy(e)}function Sy(e){return e.replace(NC,"")===""}class Vo{constructor(s,a,r){this.normal=a,this.property=s,r&&(this.space=r)}}Vo.prototype.normal={};Vo.prototype.property={};Vo.prototype.space=void 0;function U2(e,s){const a={},r={};for(const o of e)Object.assign(a,o.property),Object.assign(r,o.normal);return new Vo(a,r,s)}function Sm(e){return e.toLowerCase()}class Pn{constructor(s,a){this.attribute=a,this.property=s}}Pn.prototype.attribute="";Pn.prototype.booleanish=!1;Pn.prototype.boolean=!1;Pn.prototype.commaOrSpaceSeparated=!1;Pn.prototype.commaSeparated=!1;Pn.prototype.defined=!1;Pn.prototype.mustUseProperty=!1;Pn.prototype.number=!1;Pn.prototype.overloadedBoolean=!1;Pn.prototype.property="";Pn.prototype.spaceSeparated=!1;Pn.prototype.space=void 0;let SC=0;const qe=Ki(),Lt=Ki(),Cm=Ki(),xe=Ki(),gt=Ki(),Vr=Ki(),Kn=Ki();function Ki(){return 2**++SC}const Tm=Object.freeze(Object.defineProperty({__proto__:null,boolean:qe,booleanish:Lt,commaOrSpaceSeparated:Kn,commaSeparated:Vr,number:xe,overloadedBoolean:Cm,spaceSeparated:gt},Symbol.toStringTag,{value:"Module"})),Of=Object.keys(Tm);class k0 extends Pn{constructor(s,a,r,o){let c=-1;if(super(s,a),Cy(this,"space",o),typeof r=="number")for(;++c<Of.length;){const d=Of[c];Cy(this,Of[c],(r&Tm[d])===Tm[d])}}}k0.prototype.defined=!0;function Cy(e,s,a){a&&(e[s]=a)}function pl(e){const s={},a={};for(const[r,o]of Object.entries(e.properties)){const c=new k0(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(c.mustUseProperty=!0),s[r]=c,a[Sm(r)]=r,a[Sm(c.attribute)]=r}return new Vo(s,a,e.space)}const B2=pl({properties:{ariaActiveDescendant:null,ariaAtomic:Lt,ariaAutoComplete:null,ariaBusy:Lt,ariaChecked:Lt,ariaColCount:xe,ariaColIndex:xe,ariaColSpan:xe,ariaControls:gt,ariaCurrent:null,ariaDescribedBy:gt,ariaDetails:null,ariaDisabled:Lt,ariaDropEffect:gt,ariaErrorMessage:null,ariaExpanded:Lt,ariaFlowTo:gt,ariaGrabbed:Lt,ariaHasPopup:null,ariaHidden:Lt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gt,ariaLevel:xe,ariaLive:null,ariaModal:Lt,ariaMultiLine:Lt,ariaMultiSelectable:Lt,ariaOrientation:null,ariaOwns:gt,ariaPlaceholder:null,ariaPosInSet:xe,ariaPressed:Lt,ariaReadOnly:Lt,ariaRelevant:null,ariaRequired:Lt,ariaRoleDescription:gt,ariaRowCount:xe,ariaRowIndex:xe,ariaRowSpan:xe,ariaSelected:Lt,ariaSetSize:xe,ariaSort:null,ariaValueMax:xe,ariaValueMin:xe,ariaValueNow:xe,ariaValueText:null,role:null},transform(e,s){return s==="role"?s:"aria-"+s.slice(4).toLowerCase()}});function I2(e,s){return s in e?e[s]:s}function H2(e,s){return I2(e,s.toLowerCase())}const CC=pl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Vr,acceptCharset:gt,accessKey:gt,action:null,allow:null,allowFullScreen:qe,allowPaymentRequest:qe,allowUserMedia:qe,alt:null,as:null,async:qe,autoCapitalize:null,autoComplete:gt,autoFocus:qe,autoPlay:qe,blocking:gt,capture:null,charSet:null,checked:qe,cite:null,className:gt,cols:xe,colSpan:null,content:null,contentEditable:Lt,controls:qe,controlsList:gt,coords:xe|Vr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:qe,defer:qe,dir:null,dirName:null,disabled:qe,download:Cm,draggable:Lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:qe,formTarget:null,headers:gt,height:xe,hidden:Cm,high:xe,href:null,hrefLang:null,htmlFor:gt,httpEquiv:gt,id:null,imageSizes:null,imageSrcSet:null,inert:qe,inputMode:null,integrity:null,is:null,isMap:qe,itemId:null,itemProp:gt,itemRef:gt,itemScope:qe,itemType:gt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:qe,low:xe,manifest:null,max:null,maxLength:xe,media:null,method:null,min:null,minLength:xe,multiple:qe,muted:qe,name:null,nonce:null,noModule:qe,noValidate:qe,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:qe,optimum:xe,pattern:null,ping:gt,placeholder:null,playsInline:qe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:qe,referrerPolicy:null,rel:gt,required:qe,reversed:qe,rows:xe,rowSpan:xe,sandbox:gt,scope:null,scoped:qe,seamless:qe,selected:qe,shadowRootClonable:qe,shadowRootDelegatesFocus:qe,shadowRootMode:null,shape:null,size:xe,sizes:null,slot:null,span:xe,spellCheck:Lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:xe,step:null,style:null,tabIndex:xe,target:null,title:null,translate:null,type:null,typeMustMatch:qe,useMap:null,value:Lt,width:xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gt,axis:null,background:null,bgColor:null,border:xe,borderColor:null,bottomMargin:xe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:qe,declare:qe,event:null,face:null,frame:null,frameBorder:null,hSpace:xe,leftMargin:xe,link:null,longDesc:null,lowSrc:null,marginHeight:xe,marginWidth:xe,noResize:qe,noHref:qe,noShade:qe,noWrap:qe,object:null,profile:null,prompt:null,rev:null,rightMargin:xe,rules:null,scheme:null,scrolling:Lt,standby:null,summary:null,text:null,topMargin:xe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:xe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:qe,disableRemotePlayback:qe,prefix:null,property:null,results:xe,security:null,unselectable:null},space:"html",transform:H2}),TC=pl({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:Kn,accentHeight:xe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:xe,amplitude:xe,arabicForm:null,ascent:xe,attributeName:null,attributeType:null,azimuth:xe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:xe,by:null,calcMode:null,capHeight:xe,className:gt,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:xe,diffuseConstant:xe,direction:null,display:null,dur:null,divisor:xe,dominantBaseline:null,download:qe,dx:null,dy:null,edgeMode:null,editable:null,elevation:xe,enableBackground:null,end:null,event:null,exponent:xe,externalResourcesRequired:null,fill:null,fillOpacity:xe,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:Vr,g2:Vr,glyphName:Vr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:xe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:xe,horizOriginX:xe,horizOriginY:xe,id:null,ideographic:xe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:xe,k:xe,k1:xe,k2:xe,k3:xe,k4:xe,kernelMatrix:Kn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:xe,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:xe,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:xe,overlineThickness:xe,paintOrder:null,panose1:null,path:null,pathLength:xe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xe,pointsAtY:xe,pointsAtZ:xe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Kn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Kn,rev:Kn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Kn,requiredFeatures:Kn,requiredFonts:Kn,requiredFormats:Kn,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:xe,specularExponent:xe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:xe,strikethroughThickness:xe,string:null,stroke:null,strokeDashArray:Kn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:xe,strokeOpacity:xe,strokeWidth:null,style:null,surfaceScale:xe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Kn,tabIndex:xe,tableValues:null,target:null,targetX:xe,targetY:xe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Kn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:xe,underlineThickness:xe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:xe,values:null,vAlphabetic:xe,vMathematical:xe,vectorEffect:null,vHanging:xe,vIdeographic:xe,version:null,vertAdvY:xe,vertOriginX:xe,vertOriginY:xe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:xe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:I2}),P2=pl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,s){return"xlink:"+s.slice(5).toLowerCase()}}),q2=pl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:H2}),F2=pl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,s){return"xml:"+s.slice(3).toLowerCase()}}),EC={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"},AC=/[A-Z]/g,Ty=/-[a-z]/g,MC=/^data[-\w.:]+$/i;function DC(e,s){const a=Sm(s);let r=s,o=Pn;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&MC.test(s)){if(s.charAt(4)==="-"){const c=s.slice(5).replace(Ty,RC);r="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=s.slice(4);if(!Ty.test(c)){let d=c.replace(AC,OC);d.charAt(0)!=="-"&&(d="-"+d),s="data"+d}}o=k0}return new o(r,s)}function OC(e){return"-"+e.toLowerCase()}function RC(e){return e.charAt(1).toUpperCase()}const _C=U2([B2,CC,P2,q2,F2],"html"),S0=U2([B2,TC,P2,q2,F2],"svg");function LC(e){return e.join(" ").trim()}var Br={},Rf,Ey;function UC(){if(Ey)return Rf;Ey=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,s=/\n/g,a=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,h=/^\s+|\s+$/g,m=`
`,f="/",p="*",b="",v="comment",y="declaration";function N(w,j){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];j=j||{};var C=1,T=1;function D(U){var H=U.match(s);H&&(C+=H.length);var I=U.lastIndexOf(m);T=~I?U.length-I:T+U.length}function E(){var U={line:C,column:T};return function(H){return H.position=new A(U),ee(),H}}function A(U){this.start=U,this.end={line:C,column:T},this.source=j.source}A.prototype.content=w;function B(U){var H=new Error(j.source+":"+C+":"+T+": "+U);if(H.reason=U,H.filename=j.source,H.line=C,H.column=T,H.source=w,!j.silent)throw H}function V(U){var H=U.exec(w);if(H){var I=H[0];return D(I),w=w.slice(I.length),H}}function ee(){V(a)}function R(U){var H;for(U=U||[];H=F();)H!==!1&&U.push(H);return U}function F(){var U=E();if(!(f!=w.charAt(0)||p!=w.charAt(1))){for(var H=2;b!=w.charAt(H)&&(p!=w.charAt(H)||f!=w.charAt(H+1));)++H;if(H+=2,b===w.charAt(H-1))return B("End of comment missing");var I=w.slice(2,H-2);return T+=2,D(I),w=w.slice(H),T+=2,U({type:v,comment:I})}}function _(){var U=E(),H=V(r);if(H){if(F(),!V(o))return B("property missing ':'");var I=V(c),W=U({type:y,property:S(H[0].replace(e,b)),value:I?S(I[0].replace(e,b)):b});return V(d),W}}function se(){var U=[];R(U);for(var H;H=_();)H!==!1&&(U.push(H),R(U));return U}return ee(),se()}function S(w){return w?w.replace(h,b):b}return Rf=N,Rf}var Ay;function BC(){if(Ay)return Br;Ay=1;var e=Br&&Br.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Br,"__esModule",{value:!0}),Br.default=a;const s=e(UC());function a(r,o){let c=null;if(!r||typeof r!="string")return c;const d=(0,s.default)(r),h=typeof o=="function";return d.forEach(m=>{if(m.type!=="declaration")return;const{property:f,value:p}=m;h?o(f,p,m):p&&(c=c||{},c[f]=p)}),c}return Br}var po={},My;function IC(){if(My)return po;My=1,Object.defineProperty(po,"__esModule",{value:!0}),po.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,s=/-([a-z])/g,a=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,c=function(f){return!f||a.test(f)||e.test(f)},d=function(f,p){return p.toUpperCase()},h=function(f,p){return"".concat(p,"-")},m=function(f,p){return p===void 0&&(p={}),c(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(o,h):f=f.replace(r,h),f.replace(s,d))};return po.camelCase=m,po}var go,Dy;function HC(){if(Dy)return go;Dy=1;var e=go&&go.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},s=e(BC()),a=IC();function r(o,c){var d={};return!o||typeof o!="string"||(0,s.default)(o,function(h,m){h&&m&&(d[(0,a.camelCase)(h,c)]=m)}),d}return r.default=r,go=r,go}var PC=HC();const qC=qu(PC),$2=V2("end"),C0=V2("start");function V2(e){return s;function s(a){const r=a&&a.position&&a.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function FC(e){const s=C0(e),a=$2(e);if(s&&a)return{start:s,end:a}}function So(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Oy(e.position):"start"in e||"end"in e?Oy(e):"line"in e||"column"in e?Em(e):""}function Em(e){return Ry(e&&e.line)+":"+Ry(e&&e.column)}function Oy(e){return Em(e&&e.start)+"-"+Em(e&&e.end)}function Ry(e){return e&&typeof e=="number"?e:1}class vn extends Error{constructor(s,a,r){super(),typeof a=="string"&&(r=a,a=void 0);let o="",c={},d=!1;if(a&&("line"in a&&"column"in a?c={place:a}:"start"in a&&"end"in a?c={place:a}:"type"in a?c={ancestors:[a],place:a.position}:c={...a}),typeof s=="string"?o=s:!c.cause&&s&&(d=!0,o=s.message,c.cause=s),!c.ruleId&&!c.source&&typeof r=="string"){const m=r.indexOf(":");m===-1?c.ruleId=r:(c.source=r.slice(0,m),c.ruleId=r.slice(m+1))}if(!c.place&&c.ancestors&&c.ancestors){const m=c.ancestors[c.ancestors.length-1];m&&(c.place=m.position)}const h=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=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=h?h.line:void 0,this.name=So(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}}vn.prototype.file="";vn.prototype.name="";vn.prototype.reason="";vn.prototype.message="";vn.prototype.stack="";vn.prototype.column=void 0;vn.prototype.line=void 0;vn.prototype.ancestors=void 0;vn.prototype.cause=void 0;vn.prototype.fatal=void 0;vn.prototype.place=void 0;vn.prototype.ruleId=void 0;vn.prototype.source=void 0;const T0={}.hasOwnProperty,$C=new Map,VC=/[A-Z]/g,GC=new Set(["table","tbody","thead","tfoot","tr"]),YC=new Set(["td","th"]),G2="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function QC(e,s){if(!s||s.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=s.filePath||void 0;let r;if(s.development){if(typeof s.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=n6(a,s.jsxDEV)}else{if(typeof s.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof s.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=t6(a,s.jsx,s.jsxs)}const o={Fragment:s.Fragment,ancestors:[],components:s.components||{},create:r,elementAttributeNameCase:s.elementAttributeNameCase||"react",evaluater:s.createEvaluater?s.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:s.ignoreInvalidStyle||!1,passKeys:s.passKeys!==!1,passNode:s.passNode||!1,schema:s.space==="svg"?S0:_C,stylePropertyNameCase:s.stylePropertyNameCase||"dom",tableCellAlignToStyle:s.tableCellAlignToStyle!==!1},c=Y2(o,e,void 0);return c&&typeof c!="string"?c:o.create(e,o.Fragment,{children:c||void 0},void 0)}function Y2(e,s,a){if(s.type==="element")return JC(e,s,a);if(s.type==="mdxFlowExpression"||s.type==="mdxTextExpression")return XC(e,s);if(s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement")return ZC(e,s,a);if(s.type==="mdxjsEsm")return KC(e,s);if(s.type==="root")return WC(e,s,a);if(s.type==="text")return e6(e,s)}function JC(e,s,a){const r=e.schema;let o=r;s.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=S0,e.schema=o),e.ancestors.push(s);const c=J2(e,s.tagName,!1),d=s6(e,s);let h=A0(e,s);return GC.has(s.tagName)&&(h=h.filter(function(m){return typeof m=="string"?!kC(m):!0})),Q2(e,d,c,s),E0(d,h),e.ancestors.pop(),e.schema=r,e.create(s,c,d,a)}function XC(e,s){if(s.data&&s.data.estree&&e.evaluater){const r=s.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Oo(e,s.position)}function KC(e,s){if(s.data&&s.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(s.data.estree);Oo(e,s.position)}function ZC(e,s,a){const r=e.schema;let o=r;s.name==="svg"&&r.space==="html"&&(o=S0,e.schema=o),e.ancestors.push(s);const c=s.name===null?e.Fragment:J2(e,s.name,!0),d=a6(e,s),h=A0(e,s);return Q2(e,d,c,s),E0(d,h),e.ancestors.pop(),e.schema=r,e.create(s,c,d,a)}function WC(e,s,a){const r={};return E0(r,A0(e,s)),e.create(s,e.Fragment,r,a)}function e6(e,s){return s.value}function Q2(e,s,a,r){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(s.node=r)}function E0(e,s){if(s.length>0){const a=s.length>1?s:s[0];a&&(e.children=a)}}function t6(e,s,a){return r;function r(o,c,d,h){const f=Array.isArray(d.children)?a:s;return h?f(c,d,h):f(c,d)}}function n6(e,s){return a;function a(r,o,c,d){const h=Array.isArray(c.children),m=C0(r);return s(o,c,d,h,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function s6(e,s){const a={};let r,o;for(o in s.properties)if(o!=="children"&&T0.call(s.properties,o)){const c=i6(e,o,s.properties[o]);if(c){const[d,h]=c;e.tableCellAlignToStyle&&d==="align"&&typeof h=="string"&&YC.has(s.tagName)?r=h:a[d]=h}}if(r){const c=a.style||(a.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return a}function a6(e,s){const a={};for(const r of s.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const c=r.data.estree.body[0];c.type;const d=c.expression;d.type;const h=d.properties[0];h.type,Object.assign(a,e.evaluater.evaluateExpression(h.argument))}else Oo(e,s.position);else{const o=r.name;let c;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const h=r.value.data.estree.body[0];h.type,c=e.evaluater.evaluateExpression(h.expression)}else Oo(e,s.position);else c=r.value===null?!0:r.value;a[o]=c}return a}function A0(e,s){const a=[];let r=-1;const o=e.passKeys?new Map:$C;for(;++r<s.children.length;){const c=s.children[r];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 f=o.get(m)||0;d=m+"-"+f,o.set(m,f+1)}}const h=Y2(e,c,d);h!==void 0&&a.push(h)}return a}function i6(e,s,a){const r=DC(e.schema,s);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=r.commaSeparated?vC(a):LC(a)),r.property==="style"){let o=typeof a=="object"?a:r6(e,String(a));return e.stylePropertyNameCase==="css"&&(o=l6(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?EC[r.property]||r.property:r.attribute,a]}}function r6(e,s){try{return qC(s,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};const r=a,o=new vn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=G2+"#cannot-parse-style-attribute",o}}function J2(e,s,a){let r;if(!a)r={type:"Literal",value:s};else if(s.includes(".")){const o=s.split(".");let c=-1,d;for(;++c<o.length;){const h=ky(o[c])?{type:"Identifier",name:o[c]}:{type:"Literal",value:o[c]};d=d?{type:"MemberExpression",object:d,property:h,computed:!!(c&&h.type==="Literal"),optional:!1}:h}r=d}else r=ky(s)&&!/^[a-z]/.test(s)?{type:"Identifier",name:s}:{type:"Literal",value:s};if(r.type==="Literal"){const o=r.value;return T0.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Oo(e)}function Oo(e,s){const a=new vn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:s,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=G2+"#cannot-handle-mdx-estrees-without-createevaluater",a}function l6(e){const s={};let a;for(a in e)T0.call(e,a)&&(s[o6(a)]=e[a]);return s}function o6(e){let s=e.replace(VC,c6);return s.slice(0,3)==="ms-"&&(s="-"+s),s}function c6(e){return"-"+e.toLowerCase()}const _f={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"]},u6={};function M0(e,s){const a=u6,r=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,o=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return X2(e,r,o)}function X2(e,s,a){if(d6(e)){if("value"in e)return e.type==="html"&&!a?"":e.value;if(s&&"alt"in e&&e.alt)return e.alt;if("children"in e)return _y(e.children,s,a)}return Array.isArray(e)?_y(e,s,a):""}function _y(e,s,a){const r=[];let o=-1;for(;++o<e.length;)r[o]=X2(e[o],s,a);return r.join("")}function d6(e){return!!(e&&typeof e=="object")}const Ly=document.createElement("i");function D0(e){const s="&"+e+";";Ly.innerHTML=s;const a=Ly.textContent;return a.charCodeAt(a.length-1)===59&&e!=="semi"||a===s?!1:a}function Zn(e,s,a,r){const o=e.length;let c=0,d;if(s<0?s=-s>o?0:o+s:s=s>o?o:s,a=a>0?a:0,r.length<1e4)d=Array.from(r),d.unshift(s,a),e.splice(...d);else for(a&&e.splice(s,a);c<r.length;)d=r.slice(c,c+1e4),d.unshift(s,0),e.splice(...d),c+=1e4,s+=1e4}function ms(e,s){return e.length>0?(Zn(e,e.length,0,s),e):s}const Uy={}.hasOwnProperty;function K2(e){const s={};let a=-1;for(;++a<e.length;)h6(s,e[a]);return s}function h6(e,s){let a;for(a in s){const o=(Uy.call(e,a)?e[a]:void 0)||(e[a]={}),c=s[a];let d;if(c)for(d in c){Uy.call(o,d)||(o[d]=[]);const h=c[d];f6(o[d],Array.isArray(h)?h:h?[h]:[])}}}function f6(e,s){let a=-1;const r=[];for(;++a<s.length;)(s[a].add==="after"?e:r).push(s[a]);Zn(e,0,0,r)}function Z2(e,s){const a=Number.parseInt(e,s);return a<9||a===11||a>13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"�":String.fromCodePoint(a)}function Cs(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const kn=xi(/[A-Za-z]/),yn=xi(/[\dA-Za-z]/),m6=xi(/[#-'*+\--9=?A-Z^-~]/);function Lu(e){return e!==null&&(e<32||e===127)}const Am=xi(/\d/),x6=xi(/[\dA-Fa-f]/),p6=xi(/[!-/:-@[-`{-~]/);function Ee(e){return e!==null&&e<-2}function mt(e){return e!==null&&(e<0||e===32)}function Ye(e){return e===-2||e===-1||e===32}const nd=xi(new RegExp("\\p{P}|\\p{S}","u")),Ji=xi(/\s/);function xi(e){return s;function s(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function gl(e){const s=[];let a=-1,r=0,o=0;for(;++a<e.length;){const c=e.charCodeAt(a);let d="";if(c===37&&yn(e.charCodeAt(a+1))&&yn(e.charCodeAt(a+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 h=e.charCodeAt(a+1);c<56320&&h>56319&&h<57344?(d=String.fromCharCode(c,h),o=1):d="�"}else d=String.fromCharCode(c);d&&(s.push(e.slice(r,a),encodeURIComponent(d)),r=a+o+1,d=""),o&&(a+=o,o=0)}return s.join("")+e.slice(r)}function tt(e,s,a,r){const o=r?r-1:Number.POSITIVE_INFINITY;let c=0;return d;function d(m){return Ye(m)?(e.enter(a),h(m)):s(m)}function h(m){return Ye(m)&&c++<o?(e.consume(m),h):(e.exit(a),s(m))}}const g6={tokenize:b6};function b6(e){const s=e.attempt(this.parser.constructs.contentInitial,r,o);let a;return s;function r(h){if(h===null){e.consume(h);return}return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),tt(e,s,"linePrefix")}function o(h){return e.enter("paragraph"),c(h)}function c(h){const m=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=m),a=m,d(h)}function d(h){if(h===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(h);return}return Ee(h)?(e.consume(h),e.exit("chunkText"),c):(e.consume(h),d)}}const y6={tokenize:v6},By={tokenize:j6};function v6(e){const s=this,a=[];let r=0,o,c,d;return h;function h(T){if(r<a.length){const D=a[r];return s.containerState=D[1],e.attempt(D[0].continuation,m,f)(T)}return f(T)}function m(T){if(r++,s.containerState._closeFlow){s.containerState._closeFlow=void 0,o&&C();const D=s.events.length;let E=D,A;for(;E--;)if(s.events[E][0]==="exit"&&s.events[E][1].type==="chunkFlow"){A=s.events[E][1].end;break}j(r);let B=D;for(;B<s.events.length;)s.events[B][1].end={...A},B++;return Zn(s.events,E+1,0,s.events.slice(D)),s.events.length=B,f(T)}return h(T)}function f(T){if(r===a.length){if(!o)return v(T);if(o.currentConstruct&&o.currentConstruct.concrete)return N(T);s.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return s.containerState={},e.check(By,p,b)(T)}function p(T){return o&&C(),j(r),v(T)}function b(T){return s.parser.lazy[s.now().line]=r!==a.length,d=s.now().offset,N(T)}function v(T){return s.containerState={},e.attempt(By,y,N)(T)}function y(T){return r++,a.push([s.currentConstruct,s.containerState]),v(T)}function N(T){if(T===null){o&&C(),j(0),e.consume(T);return}return o=o||s.parser.flow(s.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:c}),S(T)}function S(T){if(T===null){w(e.exit("chunkFlow"),!0),j(0),e.consume(T);return}return Ee(T)?(e.consume(T),w(e.exit("chunkFlow")),r=0,s.interrupt=void 0,h):(e.consume(T),S)}function w(T,D){const E=s.sliceStream(T);if(D&&E.push(null),T.previous=c,c&&(c.next=T),c=T,o.defineSkip(T.start),o.write(E),s.parser.lazy[T.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 B=s.events.length;let V=B,ee,R;for(;V--;)if(s.events[V][0]==="exit"&&s.events[V][1].type==="chunkFlow"){if(ee){R=s.events[V][1].end;break}ee=!0}for(j(r),A=B;A<s.events.length;)s.events[A][1].end={...R},A++;Zn(s.events,V+1,0,s.events.slice(B)),s.events.length=A}}function j(T){let D=a.length;for(;D-- >T;){const E=a[D];s.containerState=E[1],E[0].exit.call(s,e)}a.length=T}function C(){o.write([null]),c=void 0,o=void 0,s.containerState._closeFlow=void 0}}function j6(e,s,a){return tt(e,e.attempt(this.parser.constructs.document,s,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function al(e){if(e===null||mt(e)||Ji(e))return 1;if(nd(e))return 2}function sd(e,s,a){const r=[];let o=-1;for(;++o<e.length;){const c=e[o].resolveAll;c&&!r.includes(c)&&(s=c(s,a),r.push(c))}return s}const Mm={name:"attention",resolveAll:w6,tokenize:z6};function w6(e,s){let a=-1,r,o,c,d,h,m,f,p;for(;++a<e.length;)if(e[a][0]==="enter"&&e[a][1].type==="attentionSequence"&&e[a][1]._close){for(r=a;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&s.sliceSerialize(e[r][1]).charCodeAt(0)===s.sliceSerialize(e[a][1]).charCodeAt(0)){if((e[r][1]._close||e[a][1]._open)&&(e[a][1].end.offset-e[a][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[a][1].end.offset-e[a][1].start.offset)%3))continue;m=e[r][1].end.offset-e[r][1].start.offset>1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1;const b={...e[r][1].end},v={...e[a][1].start};Iy(b,-m),Iy(v,m),d={type:m>1?"strongSequence":"emphasisSequence",start:b,end:{...e[r][1].end}},h={type:m>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:v},c={type:m>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[a][1].start}},o={type:m>1?"strong":"emphasis",start:{...d.start},end:{...h.end}},e[r][1].end={...d.start},e[a][1].start={...h.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=ms(f,[["enter",e[r][1],s],["exit",e[r][1],s]])),f=ms(f,[["enter",o,s],["enter",d,s],["exit",d,s],["enter",c,s]]),f=ms(f,sd(s.parser.constructs.insideSpan.null,e.slice(r+1,a),s)),f=ms(f,[["exit",c,s],["enter",h,s],["exit",h,s],["exit",o,s]]),e[a][1].end.offset-e[a][1].start.offset?(p=2,f=ms(f,[["enter",e[a][1],s],["exit",e[a][1],s]])):p=0,Zn(e,r-1,a-r+3,f),a=r+f.length-p-2;break}}for(a=-1;++a<e.length;)e[a][1].type==="attentionSequence"&&(e[a][1].type="data");return e}function z6(e,s){const a=this.parser.constructs.attentionMarkers.null,r=this.previous,o=al(r);let c;return d;function d(m){return c=m,e.enter("attentionSequence"),h(m)}function h(m){if(m===c)return e.consume(m),h;const f=e.exit("attentionSequence"),p=al(m),b=!p||p===2&&o||a.includes(m),v=!o||o===2&&p||a.includes(r);return f._open=!!(c===42?b:b&&(o||!v)),f._close=!!(c===42?v:v&&(p||!b)),s(m)}}function Iy(e,s){e.column+=s,e.offset+=s,e._bufferIndex+=s}const N6={name:"autolink",tokenize:k6};function k6(e,s,a){let r=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 kn(y)?(e.consume(y),d):y===64?a(y):f(y)}function d(y){return y===43||y===45||y===46||yn(y)?(r=1,h(y)):f(y)}function h(y){return y===58?(e.consume(y),r=0,m):(y===43||y===45||y===46||yn(y))&&r++<32?(e.consume(y),h):(r=0,f(y))}function m(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),s):y===null||y===32||y===60||Lu(y)?a(y):(e.consume(y),m)}function f(y){return y===64?(e.consume(y),p):m6(y)?(e.consume(y),f):a(y)}function p(y){return yn(y)?b(y):a(y)}function b(y){return y===46?(e.consume(y),r=0,p):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),s):v(y)}function v(y){if((y===45||yn(y))&&r++<63){const N=y===45?v:b;return e.consume(y),N}return a(y)}}const Go={partial:!0,tokenize:S6};function S6(e,s,a){return r;function r(c){return Ye(c)?tt(e,o,"linePrefix")(c):o(c)}function o(c){return c===null||Ee(c)?s(c):a(c)}}const W2={continuation:{tokenize:T6},exit:E6,name:"blockQuote",tokenize:C6};function C6(e,s,a){const r=this;return o;function o(d){if(d===62){const h=r.containerState;return h.open||(e.enter("blockQuote",{_container:!0}),h.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),c}return a(d)}function c(d){return Ye(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),s):(e.exit("blockQuotePrefix"),s(d))}}function T6(e,s,a){const r=this;return o;function o(d){return Ye(d)?tt(e,c,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):c(d)}function c(d){return e.attempt(W2,s,a)(d)}}function E6(e){e.exit("blockQuote")}const ej={name:"characterEscape",tokenize:A6};function A6(e,s,a){return r;function r(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),o}function o(c){return p6(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),s):a(c)}}const tj={name:"characterReference",tokenize:M6};function M6(e,s,a){const r=this;let o=0,c,d;return h;function h(b){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(b),e.exit("characterReferenceMarker"),m}function m(b){return b===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(b),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),c=31,d=yn,p(b))}function f(b){return b===88||b===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(b),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,d=x6,p):(e.enter("characterReferenceValue"),c=7,d=Am,p(b))}function p(b){if(b===59&&o){const v=e.exit("characterReferenceValue");return d===yn&&!D0(r.sliceSerialize(v))?a(b):(e.enter("characterReferenceMarker"),e.consume(b),e.exit("characterReferenceMarker"),e.exit("characterReference"),s)}return d(b)&&o++<c?(e.consume(b),p):a(b)}}const Hy={partial:!0,tokenize:O6},Py={concrete:!0,name:"codeFenced",tokenize:D6};function D6(e,s,a){const r=this,o={partial:!0,tokenize:E};let c=0,d=0,h;return m;function m(A){return f(A)}function f(A){const B=r.events[r.events.length-1];return c=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,h=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(A)}function p(A){return A===h?(d++,e.consume(A),p):d<3?a(A):(e.exit("codeFencedFenceSequence"),Ye(A)?tt(e,b,"whitespace")(A):b(A))}function b(A){return A===null||Ee(A)?(e.exit("codeFencedFence"),r.interrupt?s(A):e.check(Hy,S,D)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(A))}function v(A){return A===null||Ee(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),b(A)):Ye(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),tt(e,y,"whitespace")(A)):A===96&&A===h?a(A):(e.consume(A),v)}function y(A){return A===null||Ee(A)?b(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),N(A))}function N(A){return A===null||Ee(A)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),b(A)):A===96&&A===h?a(A):(e.consume(A),N)}function S(A){return e.attempt(o,D,w)(A)}function w(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),j}function j(A){return c>0&&Ye(A)?tt(e,C,"linePrefix",c+1)(A):C(A)}function C(A){return A===null||Ee(A)?e.check(Hy,S,D)(A):(e.enter("codeFlowValue"),T(A))}function T(A){return A===null||Ee(A)?(e.exit("codeFlowValue"),C(A)):(e.consume(A),T)}function D(A){return e.exit("codeFenced"),s(A)}function E(A,B,V){let ee=0;return R;function R(H){return A.enter("lineEnding"),A.consume(H),A.exit("lineEnding"),F}function F(H){return A.enter("codeFencedFence"),Ye(H)?tt(A,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):_(H)}function _(H){return H===h?(A.enter("codeFencedFenceSequence"),se(H)):V(H)}function se(H){return H===h?(ee++,A.consume(H),se):ee>=d?(A.exit("codeFencedFenceSequence"),Ye(H)?tt(A,U,"whitespace")(H):U(H)):V(H)}function U(H){return H===null||Ee(H)?(A.exit("codeFencedFence"),B(H)):V(H)}}}function O6(e,s,a){const r=this;return o;function o(d){return d===null?a(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c)}function c(d){return r.parser.lazy[r.now().line]?a(d):s(d)}}const Lf={name:"codeIndented",tokenize:_6},R6={partial:!0,tokenize:L6};function _6(e,s,a){const r=this;return o;function o(f){return e.enter("codeIndented"),tt(e,c,"linePrefix",5)(f)}function c(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?d(f):a(f)}function d(f){return f===null?m(f):Ee(f)?e.attempt(R6,d,m)(f):(e.enter("codeFlowValue"),h(f))}function h(f){return f===null||Ee(f)?(e.exit("codeFlowValue"),d(f)):(e.consume(f),h)}function m(f){return e.exit("codeIndented"),s(f)}}function L6(e,s,a){const r=this;return o;function o(d){return r.parser.lazy[r.now().line]?a(d):Ee(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):tt(e,c,"linePrefix",5)(d)}function c(d){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?s(d):Ee(d)?o(d):a(d)}}const U6={name:"codeText",previous:I6,resolve:B6,tokenize:H6};function B6(e){let s=e.length-4,a=3,r,o;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[s][1].type==="lineEnding"||e[s][1].type==="space")){for(r=a;++r<s;)if(e[r][1].type==="codeTextData"){e[a][1].type="codeTextPadding",e[s][1].type="codeTextPadding",a+=2,s-=2;break}}for(r=a-1,s++;++r<=s;)o===void 0?r!==s&&e[r][1].type!=="lineEnding"&&(o=r):(r===s||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),s-=r-o-2,r=o+2),o=void 0);return e}function I6(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function H6(e,s,a){let r=0,o,c;return d;function d(b){return e.enter("codeText"),e.enter("codeTextSequence"),h(b)}function h(b){return b===96?(e.consume(b),r++,h):(e.exit("codeTextSequence"),m(b))}function m(b){return b===null?a(b):b===32?(e.enter("space"),e.consume(b),e.exit("space"),m):b===96?(c=e.enter("codeTextSequence"),o=0,p(b)):Ee(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),m):(e.enter("codeTextData"),f(b))}function f(b){return b===null||b===32||b===96||Ee(b)?(e.exit("codeTextData"),m(b)):(e.consume(b),f)}function p(b){return b===96?(e.consume(b),o++,p):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),s(b)):(c.type="codeTextData",f(b))}}class P6{constructor(s){this.left=s?[...s]:[],this.right=[]}get(s){if(s<0||s>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+s+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return s<this.left.length?this.left[s]:this.right[this.right.length-s+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(s,a){const r=a??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(s,r):s>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-s+this.left.length).reverse():this.left.slice(s).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(s,a,r){const o=a||0;this.setCursor(Math.trunc(s));const c=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&bo(this.left,r),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(s){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(s)}pushMany(s){this.setCursor(Number.POSITIVE_INFINITY),bo(this.left,s)}unshift(s){this.setCursor(0),this.right.push(s)}unshiftMany(s){this.setCursor(0),bo(this.right,s.reverse())}setCursor(s){if(!(s===this.left.length||s>this.left.length&&this.right.length===0||s<0&&this.left.length===0))if(s<this.left.length){const a=this.left.splice(s,Number.POSITIVE_INFINITY);bo(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-s,Number.POSITIVE_INFINITY);bo(this.left,a.reverse())}}}function bo(e,s){let a=0;if(s.length<1e4)e.push(...s);else for(;a<s.length;)e.push(...s.slice(a,a+1e4)),a+=1e4}function nj(e){const s={};let a=-1,r,o,c,d,h,m,f;const p=new P6(e);for(;++a<p.length;){for(;a in s;)a=s[a];if(r=p.get(a),a&&r[1].type==="chunkFlow"&&p.get(a-1)[1].type==="listItemPrefix"&&(m=r[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(r[0]==="enter")r[1].contentType&&(Object.assign(s,q6(p,a)),a=s[a],f=!0);else if(r[1]._container){for(c=a,o=void 0;c--;)if(d=p.get(c),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(o&&(p.get(o)[1].type="lineEndingBlank"),d[1].type="lineEnding",o=c);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;o&&(r[1].end={...p.get(o)[1].start},h=p.slice(o,a),h.unshift(r),p.splice(o,a-o+1,h))}}return Zn(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function q6(e,s){const a=e.get(s)[1],r=e.get(s)[2];let o=s-1;const c=[];let d=a._tokenizer;d||(d=r.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const h=d.events,m=[],f={};let p,b,v=-1,y=a,N=0,S=0;const w=[S];for(;y;){for(;e.get(++o)[1]!==y;);c.push(o),y._tokenizer||(p=r.sliceStream(y),y.next||p.push(null),b&&d.defineSkip(y.start),y._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(p),y._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),b=y,y=y.next}for(y=a;++v<h.length;)h[v][0]==="exit"&&h[v-1][0]==="enter"&&h[v][1].type===h[v-1][1].type&&h[v][1].start.line!==h[v][1].end.line&&(S=v+1,w.push(S),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(d.events=[],y?(y._tokenizer=void 0,y.previous=void 0):w.pop(),v=w.length;v--;){const j=h.slice(w[v],w[v+1]),C=c.pop();m.push([C,C+j.length-1]),e.splice(C,2,j)}for(m.reverse(),v=-1;++v<m.length;)f[N+m[v][0]]=N+m[v][1],N+=m[v][1]-m[v][0]-1;return f}const F6={resolve:V6,tokenize:G6},$6={partial:!0,tokenize:Y6};function V6(e){return nj(e),e}function G6(e,s){let a;return r;function r(h){return e.enter("content"),a=e.enter("chunkContent",{contentType:"content"}),o(h)}function o(h){return h===null?c(h):Ee(h)?e.check($6,d,c)(h):(e.consume(h),o)}function c(h){return e.exit("chunkContent"),e.exit("content"),s(h)}function d(h){return e.consume(h),e.exit("chunkContent"),a.next=e.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,o}}function Y6(e,s,a){const r=this;return o;function o(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),tt(e,c,"linePrefix")}function c(d){if(d===null||Ee(d))return a(d);const h=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?s(d):e.interrupt(r.parser.constructs.flow,a,s)(d)}}function sj(e,s,a,r,o,c,d,h,m){const f=m||Number.POSITIVE_INFINITY;let p=0;return b;function b(j){return j===60?(e.enter(r),e.enter(o),e.enter(c),e.consume(j),e.exit(c),v):j===null||j===32||j===41||Lu(j)?a(j):(e.enter(r),e.enter(d),e.enter(h),e.enter("chunkString",{contentType:"string"}),S(j))}function v(j){return j===62?(e.enter(c),e.consume(j),e.exit(c),e.exit(o),e.exit(r),s):(e.enter(h),e.enter("chunkString",{contentType:"string"}),y(j))}function y(j){return j===62?(e.exit("chunkString"),e.exit(h),v(j)):j===null||j===60||Ee(j)?a(j):(e.consume(j),j===92?N:y)}function N(j){return j===60||j===62||j===92?(e.consume(j),y):y(j)}function S(j){return!p&&(j===null||j===41||mt(j))?(e.exit("chunkString"),e.exit(h),e.exit(d),e.exit(r),s(j)):p<f&&j===40?(e.consume(j),p++,S):j===41?(e.consume(j),p--,S):j===null||j===32||j===40||Lu(j)?a(j):(e.consume(j),j===92?w:S)}function w(j){return j===40||j===41||j===92?(e.consume(j),S):S(j)}}function aj(e,s,a,r,o,c){const d=this;let h=0,m;return f;function f(y){return e.enter(r),e.enter(o),e.consume(y),e.exit(o),e.enter(c),p}function p(y){return h>999||y===null||y===91||y===93&&!m||y===94&&!h&&"_hiddenFootnoteSupport"in d.parser.constructs?a(y):y===93?(e.exit(c),e.enter(o),e.consume(y),e.exit(o),e.exit(r),s):Ee(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),b(y))}function b(y){return y===null||y===91||y===93||Ee(y)||h++>999?(e.exit("chunkString"),p(y)):(e.consume(y),m||(m=!Ye(y)),y===92?v:b)}function v(y){return y===91||y===92||y===93?(e.consume(y),h++,b):b(y)}}function ij(e,s,a,r,o,c){let d;return h;function h(v){return v===34||v===39||v===40?(e.enter(r),e.enter(o),e.consume(v),e.exit(o),d=v===40?41:v,m):a(v)}function m(v){return v===d?(e.enter(o),e.consume(v),e.exit(o),e.exit(r),s):(e.enter(c),f(v))}function f(v){return v===d?(e.exit(c),m(d)):v===null?a(v):Ee(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),tt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===d||v===null||Ee(v)?(e.exit("chunkString"),f(v)):(e.consume(v),v===92?b:p)}function b(v){return v===d||v===92?(e.consume(v),p):p(v)}}function Co(e,s){let a;return r;function r(o){return Ee(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a=!0,r):Ye(o)?tt(e,r,a?"linePrefix":"lineSuffix")(o):s(o)}}const Q6={name:"definition",tokenize:X6},J6={partial:!0,tokenize:K6};function X6(e,s,a){const r=this;let o;return c;function c(y){return e.enter("definition"),d(y)}function d(y){return aj.call(r,e,h,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function h(y){return o=Cs(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),m):a(y)}function m(y){return mt(y)?Co(e,f)(y):f(y)}function f(y){return sj(e,p,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function p(y){return e.attempt(J6,b,b)(y)}function b(y){return Ye(y)?tt(e,v,"whitespace")(y):v(y)}function v(y){return y===null||Ee(y)?(e.exit("definition"),r.parser.defined.push(o),s(y)):a(y)}}function K6(e,s,a){return r;function r(h){return mt(h)?Co(e,o)(h):a(h)}function o(h){return ij(e,c,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function c(h){return Ye(h)?tt(e,d,"whitespace")(h):d(h)}function d(h){return h===null||Ee(h)?s(h):a(h)}}const Z6={name:"hardBreakEscape",tokenize:W6};function W6(e,s,a){return r;function r(c){return e.enter("hardBreakEscape"),e.consume(c),o}function o(c){return Ee(c)?(e.exit("hardBreakEscape"),s(c)):a(c)}}const eT={name:"headingAtx",resolve:tT,tokenize:nT};function tT(e,s){let a=e.length-2,r=3,o,c;return e[r][1].type==="whitespace"&&(r+=2),a-2>r&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(r===a-1||a-4>r&&e[a-2][1].type==="whitespace")&&(a-=r+1===a?2:4),a>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[a][1].end},c={type:"chunkText",start:e[r][1].start,end:e[a][1].end,contentType:"text"},Zn(e,r,a-r+1,[["enter",o,s],["enter",c,s],["exit",c,s],["exit",o,s]])),e}function nT(e,s,a){let r=0;return o;function o(p){return e.enter("atxHeading"),c(p)}function c(p){return e.enter("atxHeadingSequence"),d(p)}function d(p){return p===35&&r++<6?(e.consume(p),d):p===null||mt(p)?(e.exit("atxHeadingSequence"),h(p)):a(p)}function h(p){return p===35?(e.enter("atxHeadingSequence"),m(p)):p===null||Ee(p)?(e.exit("atxHeading"),s(p)):Ye(p)?tt(e,h,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function m(p){return p===35?(e.consume(p),m):(e.exit("atxHeadingSequence"),h(p))}function f(p){return p===null||p===35||mt(p)?(e.exit("atxHeadingText"),h(p)):(e.consume(p),f)}}const sT=["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"],qy=["pre","script","style","textarea"],aT={concrete:!0,name:"htmlFlow",resolveTo:lT,tokenize:oT},iT={partial:!0,tokenize:uT},rT={partial:!0,tokenize:cT};function lT(e){let s=e.length;for(;s--&&!(e[s][0]==="enter"&&e[s][1].type==="htmlFlow"););return s>1&&e[s-2][1].type==="linePrefix"&&(e[s][1].start=e[s-2][1].start,e[s+1][1].start=e[s-2][1].start,e.splice(s-2,2)),e}function oT(e,s,a){const r=this;let o,c,d,h,m;return f;function f(O){return p(O)}function p(O){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(O),b}function b(O){return O===33?(e.consume(O),v):O===47?(e.consume(O),c=!0,S):O===63?(e.consume(O),o=3,r.interrupt?s:L):kn(O)?(e.consume(O),d=String.fromCharCode(O),w):a(O)}function v(O){return O===45?(e.consume(O),o=2,y):O===91?(e.consume(O),o=5,h=0,N):kn(O)?(e.consume(O),o=4,r.interrupt?s:L):a(O)}function y(O){return O===45?(e.consume(O),r.interrupt?s:L):a(O)}function N(O){const de="CDATA[";return O===de.charCodeAt(h++)?(e.consume(O),h===de.length?r.interrupt?s:_:N):a(O)}function S(O){return kn(O)?(e.consume(O),d=String.fromCharCode(O),w):a(O)}function w(O){if(O===null||O===47||O===62||mt(O)){const de=O===47,ve=d.toLowerCase();return!de&&!c&&qy.includes(ve)?(o=1,r.interrupt?s(O):_(O)):sT.includes(d.toLowerCase())?(o=6,de?(e.consume(O),j):r.interrupt?s(O):_(O)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?a(O):c?C(O):T(O))}return O===45||yn(O)?(e.consume(O),d+=String.fromCharCode(O),w):a(O)}function j(O){return O===62?(e.consume(O),r.interrupt?s:_):a(O)}function C(O){return Ye(O)?(e.consume(O),C):R(O)}function T(O){return O===47?(e.consume(O),R):O===58||O===95||kn(O)?(e.consume(O),D):Ye(O)?(e.consume(O),T):R(O)}function D(O){return O===45||O===46||O===58||O===95||yn(O)?(e.consume(O),D):E(O)}function E(O){return O===61?(e.consume(O),A):Ye(O)?(e.consume(O),E):T(O)}function A(O){return O===null||O===60||O===61||O===62||O===96?a(O):O===34||O===39?(e.consume(O),m=O,B):Ye(O)?(e.consume(O),A):V(O)}function B(O){return O===m?(e.consume(O),m=null,ee):O===null||Ee(O)?a(O):(e.consume(O),B)}function V(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||mt(O)?E(O):(e.consume(O),V)}function ee(O){return O===47||O===62||Ye(O)?T(O):a(O)}function R(O){return O===62?(e.consume(O),F):a(O)}function F(O){return O===null||Ee(O)?_(O):Ye(O)?(e.consume(O),F):a(O)}function _(O){return O===45&&o===2?(e.consume(O),I):O===60&&o===1?(e.consume(O),W):O===62&&o===4?(e.consume(O),P):O===63&&o===3?(e.consume(O),L):O===93&&o===5?(e.consume(O),he):Ee(O)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(iT,Y,se)(O)):O===null||Ee(O)?(e.exit("htmlFlowData"),se(O)):(e.consume(O),_)}function se(O){return e.check(rT,U,Y)(O)}function U(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),H}function H(O){return O===null||Ee(O)?se(O):(e.enter("htmlFlowData"),_(O))}function I(O){return O===45?(e.consume(O),L):_(O)}function W(O){return O===47?(e.consume(O),d="",re):_(O)}function re(O){if(O===62){const de=d.toLowerCase();return qy.includes(de)?(e.consume(O),P):_(O)}return kn(O)&&d.length<8?(e.consume(O),d+=String.fromCharCode(O),re):_(O)}function he(O){return O===93?(e.consume(O),L):_(O)}function L(O){return O===62?(e.consume(O),P):O===45&&o===2?(e.consume(O),L):_(O)}function P(O){return O===null||Ee(O)?(e.exit("htmlFlowData"),Y(O)):(e.consume(O),P)}function Y(O){return e.exit("htmlFlow"),s(O)}}function cT(e,s,a){const r=this;return o;function o(d){return Ee(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):a(d)}function c(d){return r.parser.lazy[r.now().line]?a(d):s(d)}}function uT(e,s,a){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Go,s,a)}}const dT={name:"htmlText",tokenize:hT};function hT(e,s,a){const r=this;let o,c,d;return h;function h(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),m}function m(L){return L===33?(e.consume(L),f):L===47?(e.consume(L),E):L===63?(e.consume(L),T):kn(L)?(e.consume(L),V):a(L)}function f(L){return L===45?(e.consume(L),p):L===91?(e.consume(L),c=0,N):kn(L)?(e.consume(L),C):a(L)}function p(L){return L===45?(e.consume(L),y):a(L)}function b(L){return L===null?a(L):L===45?(e.consume(L),v):Ee(L)?(d=b,W(L)):(e.consume(L),b)}function v(L){return L===45?(e.consume(L),y):b(L)}function y(L){return L===62?I(L):L===45?v(L):b(L)}function N(L){const P="CDATA[";return L===P.charCodeAt(c++)?(e.consume(L),c===P.length?S:N):a(L)}function S(L){return L===null?a(L):L===93?(e.consume(L),w):Ee(L)?(d=S,W(L)):(e.consume(L),S)}function w(L){return L===93?(e.consume(L),j):S(L)}function j(L){return L===62?I(L):L===93?(e.consume(L),j):S(L)}function C(L){return L===null||L===62?I(L):Ee(L)?(d=C,W(L)):(e.consume(L),C)}function T(L){return L===null?a(L):L===63?(e.consume(L),D):Ee(L)?(d=T,W(L)):(e.consume(L),T)}function D(L){return L===62?I(L):T(L)}function E(L){return kn(L)?(e.consume(L),A):a(L)}function A(L){return L===45||yn(L)?(e.consume(L),A):B(L)}function B(L){return Ee(L)?(d=B,W(L)):Ye(L)?(e.consume(L),B):I(L)}function V(L){return L===45||yn(L)?(e.consume(L),V):L===47||L===62||mt(L)?ee(L):a(L)}function ee(L){return L===47?(e.consume(L),I):L===58||L===95||kn(L)?(e.consume(L),R):Ee(L)?(d=ee,W(L)):Ye(L)?(e.consume(L),ee):I(L)}function R(L){return L===45||L===46||L===58||L===95||yn(L)?(e.consume(L),R):F(L)}function F(L){return L===61?(e.consume(L),_):Ee(L)?(d=F,W(L)):Ye(L)?(e.consume(L),F):ee(L)}function _(L){return L===null||L===60||L===61||L===62||L===96?a(L):L===34||L===39?(e.consume(L),o=L,se):Ee(L)?(d=_,W(L)):Ye(L)?(e.consume(L),_):(e.consume(L),U)}function se(L){return L===o?(e.consume(L),o=void 0,H):L===null?a(L):Ee(L)?(d=se,W(L)):(e.consume(L),se)}function U(L){return L===null||L===34||L===39||L===60||L===61||L===96?a(L):L===47||L===62||mt(L)?ee(L):(e.consume(L),U)}function H(L){return L===47||L===62||mt(L)?ee(L):a(L)}function I(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),s):a(L)}function W(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),re}function re(L){return Ye(L)?tt(e,he,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):he(L)}function he(L){return e.enter("htmlTextData"),d(L)}}const O0={name:"labelEnd",resolveAll:pT,resolveTo:gT,tokenize:bT},fT={tokenize:yT},mT={tokenize:vT},xT={tokenize:jT};function pT(e){let s=-1;const a=[];for(;++s<e.length;){const r=e[s][1];if(a.push(e[s]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",s+=o}}return e.length!==a.length&&Zn(e,0,e.length,a),e}function gT(e,s){let a=e.length,r=0,o,c,d,h;for(;a--;)if(o=e[a][1],c){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[a][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(d){if(e[a][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(c=a,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(d=a);const m={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[c][1].start},end:{...e[d][1].end}},p={type:"labelText",start:{...e[c+r+2][1].end},end:{...e[d-2][1].start}};return h=[["enter",m,s],["enter",f,s]],h=ms(h,e.slice(c+1,c+r+3)),h=ms(h,[["enter",p,s]]),h=ms(h,sd(s.parser.constructs.insideSpan.null,e.slice(c+r+4,d-3),s)),h=ms(h,[["exit",p,s],e[d-2],e[d-1],["exit",f,s]]),h=ms(h,e.slice(d+1)),h=ms(h,[["exit",m,s]]),Zn(e,c,e.length,h),e}function bT(e,s,a){const r=this;let o=r.events.length,c,d;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){c=r.events[o][1];break}return h;function h(v){return c?c._inactive?b(v):(d=r.parser.defined.includes(Cs(r.sliceSerialize({start:c.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),m):a(v)}function m(v){return v===40?e.attempt(fT,p,d?p:b)(v):v===91?e.attempt(mT,p,d?f:b)(v):d?p(v):b(v)}function f(v){return e.attempt(xT,p,b)(v)}function p(v){return s(v)}function b(v){return c._balanced=!0,a(v)}}function yT(e,s,a){return r;function r(b){return e.enter("resource"),e.enter("resourceMarker"),e.consume(b),e.exit("resourceMarker"),o}function o(b){return mt(b)?Co(e,c)(b):c(b)}function c(b){return b===41?p(b):sj(e,d,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(b)}function d(b){return mt(b)?Co(e,m)(b):p(b)}function h(b){return a(b)}function m(b){return b===34||b===39||b===40?ij(e,f,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(b):p(b)}function f(b){return mt(b)?Co(e,p)(b):p(b)}function p(b){return b===41?(e.enter("resourceMarker"),e.consume(b),e.exit("resourceMarker"),e.exit("resource"),s):a(b)}}function vT(e,s,a){const r=this;return o;function o(h){return aj.call(r,e,c,d,"reference","referenceMarker","referenceString")(h)}function c(h){return r.parser.defined.includes(Cs(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?s(h):a(h)}function d(h){return a(h)}}function jT(e,s,a){return r;function r(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"),s):a(c)}}const wT={name:"labelStartImage",resolveAll:O0.resolveAll,tokenize:zT};function zT(e,s,a){const r=this;return o;function o(h){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(h),e.exit("labelImageMarker"),c}function c(h){return h===91?(e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelImage"),d):a(h)}function d(h){return h===94&&"_hiddenFootnoteSupport"in r.parser.constructs?a(h):s(h)}}const NT={name:"labelStartLink",resolveAll:O0.resolveAll,tokenize:kT};function kT(e,s,a){const r=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 r.parser.constructs?a(d):s(d)}}const Uf={name:"lineEnding",tokenize:ST};function ST(e,s){return a;function a(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),tt(e,s,"linePrefix")}}const Cu={name:"thematicBreak",tokenize:CT};function CT(e,s,a){let r=0,o;return c;function c(f){return e.enter("thematicBreak"),d(f)}function d(f){return o=f,h(f)}function h(f){return f===o?(e.enter("thematicBreakSequence"),m(f)):r>=3&&(f===null||Ee(f))?(e.exit("thematicBreak"),s(f)):a(f)}function m(f){return f===o?(e.consume(f),r++,m):(e.exit("thematicBreakSequence"),Ye(f)?tt(e,h,"whitespace")(f):h(f))}}const Bn={continuation:{tokenize:MT},exit:OT,name:"list",tokenize:AT},TT={partial:!0,tokenize:RT},ET={partial:!0,tokenize:DT};function AT(e,s,a){const r=this,o=r.events[r.events.length-1];let c=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,d=0;return h;function h(y){const N=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(N==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:Am(y)){if(r.containerState.type||(r.containerState.type=N,e.enter(N,{_container:!0})),N==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Cu,a,f)(y):f(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(y)}return a(y)}function m(y){return Am(y)&&++d<10?(e.consume(y),m):(!r.interrupt||d<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),f(y)):a(y)}function f(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(Go,r.interrupt?a:p,e.attempt(TT,v,b))}function p(y){return r.containerState.initialBlankLine=!0,c++,v(y)}function b(y){return Ye(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),v):a(y)}function v(y){return r.containerState.size=c+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,s(y)}}function MT(e,s,a){const r=this;return r.containerState._closeFlow=void 0,e.check(Go,o,c);function o(h){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,tt(e,s,"listItemIndent",r.containerState.size+1)(h)}function c(h){return r.containerState.furtherBlankLines||!Ye(h)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,d(h)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ET,s,d)(h))}function d(h){return r.containerState._closeFlow=!0,r.interrupt=void 0,tt(e,e.attempt(Bn,s,a),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function DT(e,s,a){const r=this;return tt(e,o,"listItemIndent",r.containerState.size+1);function o(c){const d=r.events[r.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===r.containerState.size?s(c):a(c)}}function OT(e){e.exit(this.containerState.type)}function RT(e,s,a){const r=this;return tt(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(c){const d=r.events[r.events.length-1];return!Ye(c)&&d&&d[1].type==="listItemPrefixWhitespace"?s(c):a(c)}}const Fy={name:"setextUnderline",resolveTo:_T,tokenize:LT};function _T(e,s){let a=e.length,r,o,c;for(;a--;)if(e[a][0]==="enter"){if(e[a][1].type==="content"){r=a;break}e[a][1].type==="paragraph"&&(o=a)}else e[a][1].type==="content"&&e.splice(a,1),!c&&e[a][1].type==="definition"&&(c=a);const d={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",c?(e.splice(o,0,["enter",d,s]),e.splice(c+1,0,["exit",e[r][1],s]),e[r][1].end={...e[c][1].end}):e[r][1]=d,e.push(["exit",d,s]),e}function LT(e,s,a){const r=this;let o;return c;function c(f){let p=r.events.length,b;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){b=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||b)?(e.enter("setextHeadingLine"),o=f,d(f)):a(f)}function d(f){return e.enter("setextHeadingLineSequence"),h(f)}function h(f){return f===o?(e.consume(f),h):(e.exit("setextHeadingLineSequence"),Ye(f)?tt(e,m,"lineSuffix")(f):m(f))}function m(f){return f===null||Ee(f)?(e.exit("setextHeadingLine"),s(f)):a(f)}}const UT={tokenize:BT};function BT(e){const s=this,a=e.attempt(Go,r,e.attempt(this.parser.constructs.flowInitial,o,tt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(F6,o)),"linePrefix")));return a;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),s.currentConstruct=void 0,a}function o(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s.currentConstruct=void 0,a}}const IT={resolveAll:lj()},HT=rj("string"),PT=rj("text");function rj(e){return{resolveAll:lj(e==="text"?qT:void 0),tokenize:s};function s(a){const r=this,o=this.parser.constructs[e],c=a.attempt(o,d,h);return d;function d(p){return f(p)?c(p):h(p)}function h(p){if(p===null){a.consume(p);return}return a.enter("data"),a.consume(p),m}function m(p){return f(p)?(a.exit("data"),c(p)):(a.consume(p),m)}function f(p){if(p===null)return!0;const b=o[p];let v=-1;if(b)for(;++v<b.length;){const y=b[v];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function lj(e){return s;function s(a,r){let o=-1,c;for(;++o<=a.length;)c===void 0?a[o]&&a[o][1].type==="data"&&(c=o,o++):(!a[o]||a[o][1].type!=="data")&&(o!==c+2&&(a[c][1].end=a[o-1][1].end,a.splice(c+2,o-c-2),o=c+2),c=void 0);return e?e(a,r):a}}function qT(e,s){let a=0;for(;++a<=e.length;)if((a===e.length||e[a][1].type==="lineEnding")&&e[a-1][1].type==="data"){const r=e[a-1][1],o=s.sliceStream(r);let c=o.length,d=-1,h=0,m;for(;c--;){const f=o[c];if(typeof f=="string"){for(d=f.length;f.charCodeAt(d-1)===32;)h++,d--;if(d)break;d=-1}else if(f===-2)m=!0,h++;else if(f!==-1){c++;break}}if(s._contentTypeTextTrailing&&a===e.length&&(h=0),h){const f={type:a===e.length||m||h<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?d:r.start._bufferIndex+d,_index:r.start._index+c,line:r.end.line,column:r.end.column-h,offset:r.end.offset-h},end:{...r.end}};r.end={...f.start},r.start.offset===r.end.offset?Object.assign(r,f):(e.splice(a,0,["enter",f,s],["exit",f,s]),a+=2)}a++}return e}const FT={42:Bn,43:Bn,45:Bn,48:Bn,49:Bn,50:Bn,51:Bn,52:Bn,53:Bn,54:Bn,55:Bn,56:Bn,57:Bn,62:W2},$T={91:Q6},VT={[-2]:Lf,[-1]:Lf,32:Lf},GT={35:eT,42:Cu,45:[Fy,Cu],60:aT,61:Fy,95:Cu,96:Py,126:Py},YT={38:tj,92:ej},QT={[-5]:Uf,[-4]:Uf,[-3]:Uf,33:wT,38:tj,42:Mm,60:[N6,dT],91:NT,92:[Z6,ej],93:O0,95:Mm,96:U6},JT={null:[Mm,IT]},XT={null:[42,95]},KT={null:[]},ZT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:XT,contentInitial:$T,disable:KT,document:FT,flow:GT,flowInitial:VT,insideSpan:JT,string:YT,text:QT},Symbol.toStringTag,{value:"Module"}));function WT(e,s,a){let r={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0};const o={},c=[];let d=[],h=[];const m={attempt:B(E),check:B(A),consume:C,enter:T,exit:D,interrupt:B(A,{interrupt:!0})},f={code:null,containerState:{},defineSkip:S,events:[],now:N,parser:e,previous:null,sliceSerialize:v,sliceStream:y,write:b};let p=s.tokenize.call(f,m);return s.resolveAll&&c.push(s),f;function b(F){return d=ms(d,F),w(),d[d.length-1]!==null?[]:(V(s,0),f.events=sd(c,f.events,f),f.events)}function v(F,_){return tE(y(F),_)}function y(F){return eE(d,F)}function N(){const{_bufferIndex:F,_index:_,line:se,column:U,offset:H}=r;return{_bufferIndex:F,_index:_,line:se,column:U,offset:H}}function S(F){o[F.line]=F.column,R()}function w(){let F;for(;r._index<d.length;){const _=d[r._index];if(typeof _=="string")for(F=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<_.length;)j(_.charCodeAt(r._bufferIndex));else j(_)}}function j(F){p=p(F)}function C(F){Ee(F)?(r.line++,r.column=1,r.offset+=F===-3?2:1,R()):F!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===d[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=F}function T(F,_){const se=_||{};return se.type=F,se.start=N(),f.events.push(["enter",se,f]),h.push(se),se}function D(F){const _=h.pop();return _.end=N(),f.events.push(["exit",_,f]),_}function E(F,_){V(F,_.from)}function A(F,_){_.restore()}function B(F,_){return se;function se(U,H,I){let W,re,he,L;return Array.isArray(U)?Y(U):"tokenize"in U?Y([U]):P(U);function P(ae){return je;function je(Xe){const Fe=Xe!==null&&ae[Xe],zt=Xe!==null&&ae.null,It=[...Array.isArray(Fe)?Fe:Fe?[Fe]:[],...Array.isArray(zt)?zt:zt?[zt]:[]];return Y(It)(Xe)}}function Y(ae){return W=ae,re=0,ae.length===0?I:O(ae[re])}function O(ae){return je;function je(Xe){return L=ee(),he=ae,ae.partial||(f.currentConstruct=ae),ae.name&&f.parser.constructs.disable.null.includes(ae.name)?ve():ae.tokenize.call(_?Object.assign(Object.create(f),_):f,m,de,ve)(Xe)}}function de(ae){return F(he,L),H}function ve(ae){return L.restore(),++re<W.length?O(W[re]):I}}}function V(F,_){F.resolveAll&&!c.includes(F)&&c.push(F),F.resolve&&Zn(f.events,_,f.events.length-_,F.resolve(f.events.slice(_),f)),F.resolveTo&&(f.events=F.resolveTo(f.events,f))}function ee(){const F=N(),_=f.previous,se=f.currentConstruct,U=f.events.length,H=Array.from(h);return{from:U,restore:I};function I(){r=F,f.previous=_,f.currentConstruct=se,f.events.length=U,h=H,R()}}function R(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function eE(e,s){const a=s.start._index,r=s.start._bufferIndex,o=s.end._index,c=s.end._bufferIndex;let d;if(a===o)d=[e[a].slice(r,c)];else{if(d=e.slice(a,o),r>-1){const h=d[0];typeof h=="string"?d[0]=h.slice(r):d.shift()}c>0&&d.push(e[o].slice(0,c))}return d}function tE(e,s){let a=-1;const r=[];let o;for(;++a<e.length;){const c=e[a];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=s?" ":"	";break}case-1:{if(!s&&o)continue;d=" ";break}default:d=String.fromCharCode(c)}o=c===-2,r.push(d)}return r.join("")}function nE(e){const r={constructs:K2([ZT,...(e||{}).extensions||[]]),content:o(g6),defined:[],document:o(y6),flow:o(UT),lazy:{},string:o(HT),text:o(PT)};return r;function o(c){return d;function d(h){return WT(r,c,h)}}}function sE(e){for(;!nj(e););return e}const $y=/[\0\t\n\r]/g;function aE(){let e=1,s="",a=!0,r;return o;function o(c,d,h){const m=[];let f,p,b,v,y;for(c=s+(typeof c=="string"?c.toString():new TextDecoder(d||void 0).decode(c)),b=0,s="",a&&(c.charCodeAt(0)===65279&&b++,a=void 0);b<c.length;){if($y.lastIndex=b,f=$y.exec(c),v=f&&f.index!==void 0?f.index:c.length,y=c.charCodeAt(v),!f){s=c.slice(b);break}if(y===10&&b===v&&r)m.push(-3),r=void 0;else switch(r&&(m.push(-5),r=void 0),b<v&&(m.push(c.slice(b,v)),e+=v-b),y){case 0:{m.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,m.push(-2);e++<p;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:r=!0,e=1}b=v+1}return h&&(r&&m.push(-5),s&&m.push(s),m.push(null)),m}}const iE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function rE(e){return e.replace(iE,lE)}function lE(e,s,a){if(s)return s;if(a.charCodeAt(0)===35){const o=a.charCodeAt(1),c=o===120||o===88;return Z2(a.slice(c?2:1),c?16:10)}return D0(a)||e}const oj={}.hasOwnProperty;function oE(e,s,a){return typeof s!="string"&&(a=s,s=void 0),cE(a)(sE(nE(a).document().write(aE()(e,s,!0))))}function cE(e){const s={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(_e),autolinkProtocol:ee,autolinkEmail:ee,atxHeading:c(ts),blockQuote:c(zt),characterEscape:ee,characterReference:ee,codeFenced:c(It),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:c(It,d),codeText:c(qn,d),codeTextData:ee,data:ee,codeFlowValue:ee,definition:c(bs),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:c(fn),hardBreakEscape:c(ce),hardBreakTrailing:c(ce),htmlFlow:c(pe,d),htmlFlowData:ee,htmlText:c(pe,d),htmlTextData:ee,image:c(Ce),label:d,link:c(_e),listItem:c(ge),listItemValue:v,listOrdered:c(me,b),listUnordered:c(me),paragraph:c(Be),reference:O,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:c(ts),strong:c(Se),thematicBreak:c(nt)},exit:{atxHeading:m(),atxHeadingSequence:E,autolink:m(),autolinkEmail:Fe,autolinkProtocol:Xe,blockQuote:m(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:ve,characterReferenceMarkerNumeric:ve,characterReferenceValue:ae,characterReference:je,codeFenced:m(w),codeFencedFence:S,codeFencedFenceInfo:y,codeFencedFenceMeta:N,codeFlowValue:R,codeIndented:m(j),codeText:m(H),codeTextData:R,data:R,definition:m(),definitionDestinationString:D,definitionLabelString:C,definitionTitleString:T,emphasis:m(),hardBreakEscape:m(_),hardBreakTrailing:m(_),htmlFlow:m(se),htmlFlowData:R,htmlText:m(U),htmlTextData:R,image:m(W),label:he,labelText:re,lineEnding:F,link:m(I),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:de,resourceDestinationString:L,resourceTitleString:P,resource:Y,setextHeading:m(V),setextHeadingLineSequence:B,setextHeadingText:A,strong:m(),thematicBreak:m()}};cj(s,(e||{}).mdastExtensions||[]);const a={};return r;function r(te){let fe={type:"root",children:[]};const Ne={stack:[fe],tokenStack:[],config:s,enter:h,exit:f,buffer:d,resume:p,data:a},Ie=[];let Ke=-1;for(;++Ke<te.length;)if(te[Ke][1].type==="listOrdered"||te[Ke][1].type==="listUnordered")if(te[Ke][0]==="enter")Ie.push(Ke);else{const jn=Ie.pop();Ke=o(te,jn,Ke)}for(Ke=-1;++Ke<te.length;){const jn=s[te[Ke][0]];oj.call(jn,te[Ke][1].type)&&jn[te[Ke][1].type].call(Object.assign({sliceSerialize:te[Ke][2].sliceSerialize},Ne),te[Ke][1])}if(Ne.tokenStack.length>0){const jn=Ne.tokenStack[Ne.tokenStack.length-1];(jn[1]||Vy).call(Ne,void 0,jn[0])}for(fe.position={start:Wa(te.length>0?te[0][1].start:{line:1,column:1,offset:0}),end:Wa(te.length>0?te[te.length-2][1].end:{line:1,column:1,offset:0})},Ke=-1;++Ke<s.transforms.length;)fe=s.transforms[Ke](fe)||fe;return fe}function o(te,fe,Ne){let Ie=fe-1,Ke=-1,jn=!1,ns,Ht,pt,en;for(;++Ie<=Ne;){const et=te[Ie];switch(et[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{et[0]==="enter"?Ke++:Ke--,en=void 0;break}case"lineEndingBlank":{et[0]==="enter"&&(ns&&!en&&!Ke&&!pt&&(pt=Ie),en=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:en=void 0}if(!Ke&&et[0]==="enter"&&et[1].type==="listItemPrefix"||Ke===-1&&et[0]==="exit"&&(et[1].type==="listUnordered"||et[1].type==="listOrdered")){if(ns){let Ds=Ie;for(Ht=void 0;Ds--;){const Fn=te[Ds];if(Fn[1].type==="lineEnding"||Fn[1].type==="lineEndingBlank"){if(Fn[0]==="exit")continue;Ht&&(te[Ht][1].type="lineEndingBlank",jn=!0),Fn[1].type="lineEnding",Ht=Ds}else if(!(Fn[1].type==="linePrefix"||Fn[1].type==="blockQuotePrefix"||Fn[1].type==="blockQuotePrefixWhitespace"||Fn[1].type==="blockQuoteMarker"||Fn[1].type==="listItemIndent"))break}pt&&(!Ht||pt<Ht)&&(ns._spread=!0),ns.end=Object.assign({},Ht?te[Ht][1].start:et[1].end),te.splice(Ht||Ie,0,["exit",ns,et[2]]),Ie++,Ne++}if(et[1].type==="listItemPrefix"){const Ds={type:"listItem",_spread:!1,start:Object.assign({},et[1].start),end:void 0};ns=Ds,te.splice(Ie,0,["enter",Ds,et[2]]),Ie++,Ne++,pt=void 0,en=!0}}}return te[fe][1]._spread=jn,Ne}function c(te,fe){return Ne;function Ne(Ie){h.call(this,te(Ie),Ie),fe&&fe.call(this,Ie)}}function d(){this.stack.push({type:"fragment",children:[]})}function h(te,fe,Ne){this.stack[this.stack.length-1].children.push(te),this.stack.push(te),this.tokenStack.push([fe,Ne||void 0]),te.position={start:Wa(fe.start),end:void 0}}function m(te){return fe;function fe(Ne){te&&te.call(this,Ne),f.call(this,Ne)}}function f(te,fe){const Ne=this.stack.pop(),Ie=this.tokenStack.pop();if(Ie)Ie[0].type!==te.type&&(fe?fe.call(this,te,Ie[0]):(Ie[1]||Vy).call(this,te,Ie[0]));else throw new Error("Cannot close `"+te.type+"` ("+So({start:te.start,end:te.end})+"): it’s not open");Ne.position.end=Wa(te.end)}function p(){return M0(this.stack.pop())}function b(){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 N(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.meta=te}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){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 C(te){const fe=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=fe,Ne.identifier=Cs(this.sliceSerialize(te)).toLowerCase()}function T(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.title=te}function D(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.url=te}function E(te){const fe=this.stack[this.stack.length-1];if(!fe.depth){const Ne=this.sliceSerialize(te).length;fe.depth=Ne}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function B(te){const fe=this.stack[this.stack.length-1];fe.depth=this.sliceSerialize(te).codePointAt(0)===61?1:2}function V(){this.data.setextHeadingSlurpLineEnding=void 0}function ee(te){const Ne=this.stack[this.stack.length-1].children;let Ie=Ne[Ne.length-1];(!Ie||Ie.type!=="text")&&(Ie=Me(),Ie.position={start:Wa(te.start),end:void 0},Ne.push(Ie)),this.stack.push(Ie)}function R(te){const fe=this.stack.pop();fe.value+=this.sliceSerialize(te),fe.position.end=Wa(te.end)}function F(te){const fe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ne=fe.children[fe.children.length-1];Ne.position.end=Wa(te.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&s.canContainEols.includes(fe.type)&&(ee.call(this,te),R.call(this,te))}function _(){this.data.atHardBreak=!0}function se(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.value=te}function U(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.value=te}function H(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.value=te}function I(){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 W(){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 re(te){const fe=this.sliceSerialize(te),Ne=this.stack[this.stack.length-2];Ne.label=rE(fe),Ne.identifier=Cs(fe).toLowerCase()}function he(){const te=this.stack[this.stack.length-1],fe=this.resume(),Ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ne.type==="link"){const Ie=te.children;Ne.children=Ie}else Ne.alt=fe}function L(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.url=te}function P(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.title=te}function Y(){this.data.inReference=void 0}function O(){this.data.referenceType="collapsed"}function de(te){const fe=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=fe,Ne.identifier=Cs(this.sliceSerialize(te)).toLowerCase(),this.data.referenceType="full"}function ve(te){this.data.characterReferenceType=te.type}function ae(te){const fe=this.sliceSerialize(te),Ne=this.data.characterReferenceType;let Ie;Ne?(Ie=Z2(fe,Ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=D0(fe);const Ke=this.stack[this.stack.length-1];Ke.value+=Ie}function je(te){const fe=this.stack.pop();fe.position.end=Wa(te.end)}function Xe(te){R.call(this,te);const fe=this.stack[this.stack.length-1];fe.url=this.sliceSerialize(te)}function Fe(te){R.call(this,te);const fe=this.stack[this.stack.length-1];fe.url="mailto:"+this.sliceSerialize(te)}function zt(){return{type:"blockquote",children:[]}}function It(){return{type:"code",lang:null,meta:null,value:""}}function qn(){return{type:"inlineCode",value:""}}function bs(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function fn(){return{type:"emphasis",children:[]}}function ts(){return{type:"heading",depth:0,children:[]}}function ce(){return{type:"break"}}function pe(){return{type:"html",value:""}}function Ce(){return{type:"image",title:null,url:"",alt:null}}function _e(){return{type:"link",title:null,url:"",children:[]}}function me(te){return{type:"list",ordered:te.type==="listOrdered",start:null,spread:te._spread,children:[]}}function ge(te){return{type:"listItem",spread:te._spread,checked:null,children:[]}}function Be(){return{type:"paragraph",children:[]}}function Se(){return{type:"strong",children:[]}}function Me(){return{type:"text",value:""}}function nt(){return{type:"thematicBreak"}}}function Wa(e){return{line:e.line,column:e.column,offset:e.offset}}function cj(e,s){let a=-1;for(;++a<s.length;){const r=s[a];Array.isArray(r)?cj(e,r):uE(e,r)}}function uE(e,s){let a;for(a in s)if(oj.call(s,a))switch(a){case"canContainEols":{const r=s[a];r&&e[a].push(...r);break}case"transforms":{const r=s[a];r&&e[a].push(...r);break}case"enter":case"exit":{const r=s[a];r&&Object.assign(e[a],r);break}}}function Vy(e,s){throw e?new Error("Cannot close `"+e.type+"` ("+So({start:e.start,end:e.end})+"): a different token (`"+s.type+"`, "+So({start:s.start,end:s.end})+") is open"):new Error("Cannot close document, a token (`"+s.type+"`, "+So({start:s.start,end:s.end})+") is still open")}function dE(e){const s=this;s.parser=a;function a(r){return oE(r,{...s.data("settings"),...e,extensions:s.data("micromarkExtensions")||[],mdastExtensions:s.data("fromMarkdownExtensions")||[]})}}function hE(e,s){const a={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(s),!0)};return e.patch(s,a),e.applyData(s,a)}function fE(e,s){const a={type:"element",tagName:"br",properties:{},children:[]};return e.patch(s,a),[e.applyData(s,a),{type:"text",value:`
`}]}function mE(e,s){const a=s.value?s.value+`
`:"",r={},o=s.lang?s.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let c={type:"element",tagName:"code",properties:r,children:[{type:"text",value:a}]};return s.meta&&(c.data={meta:s.meta}),e.patch(s,c),c=e.applyData(s,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(s,c),c}function xE(e,s){const a={type:"element",tagName:"del",properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}function pE(e,s){const a={type:"element",tagName:"em",properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}function gE(e,s){const a=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(s.identifier).toUpperCase(),o=gl(r.toLowerCase()),c=e.footnoteOrder.indexOf(r);let d,h=e.footnoteCounts.get(r);h===void 0?(h=0,e.footnoteOrder.push(r),d=e.footnoteOrder.length):d=c+1,h+=1,e.footnoteCounts.set(r,h);const m={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+o,id:a+"fnref-"+o+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};e.patch(s,m);const f={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(s,f),e.applyData(s,f)}function bE(e,s){const a={type:"element",tagName:"h"+s.depth,properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}function yE(e,s){if(e.options.allowDangerousHtml){const a={type:"raw",value:s.value};return e.patch(s,a),e.applyData(s,a)}}function uj(e,s){const a=s.referenceType;let r="]";if(a==="collapsed"?r+="[]":a==="full"&&(r+="["+(s.label||s.identifier)+"]"),s.type==="imageReference")return[{type:"text",value:"!["+s.alt+r}];const o=e.all(s),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+=r:o.push({type:"text",value:r}),o}function vE(e,s){const a=String(s.identifier).toUpperCase(),r=e.definitionById.get(a);if(!r)return uj(e,s);const o={src:gl(r.url||""),alt:s.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const c={type:"element",tagName:"img",properties:o,children:[]};return e.patch(s,c),e.applyData(s,c)}function jE(e,s){const a={src:gl(s.url)};s.alt!==null&&s.alt!==void 0&&(a.alt=s.alt),s.title!==null&&s.title!==void 0&&(a.title=s.title);const r={type:"element",tagName:"img",properties:a,children:[]};return e.patch(s,r),e.applyData(s,r)}function wE(e,s){const a={type:"text",value:s.value.replace(/\r?\n|\r/g," ")};e.patch(s,a);const r={type:"element",tagName:"code",properties:{},children:[a]};return e.patch(s,r),e.applyData(s,r)}function zE(e,s){const a=String(s.identifier).toUpperCase(),r=e.definitionById.get(a);if(!r)return uj(e,s);const o={href:gl(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const c={type:"element",tagName:"a",properties:o,children:e.all(s)};return e.patch(s,c),e.applyData(s,c)}function NE(e,s){const a={href:gl(s.url)};s.title!==null&&s.title!==void 0&&(a.title=s.title);const r={type:"element",tagName:"a",properties:a,children:e.all(s)};return e.patch(s,r),e.applyData(s,r)}function kE(e,s,a){const r=e.all(s),o=a?SE(a):dj(s),c={},d=[];if(typeof s.checked=="boolean"){const p=r[0];let b;p&&p.type==="element"&&p.tagName==="p"?b=p:(b={type:"element",tagName:"p",properties:{},children:[]},r.unshift(b)),b.children.length>0&&b.children.unshift({type:"text",value:" "}),b.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:s.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let h=-1;for(;++h<r.length;){const p=r[h];(o||h!==0||p.type!=="element"||p.tagName!=="p")&&d.push({type:"text",value:`
`}),p.type==="element"&&p.tagName==="p"&&!o?d.push(...p.children):d.push(p)}const m=r[r.length-1];m&&(o||m.type!=="element"||m.tagName!=="p")&&d.push({type:"text",value:`
`});const f={type:"element",tagName:"li",properties:c,children:d};return e.patch(s,f),e.applyData(s,f)}function SE(e){let s=!1;if(e.type==="list"){s=e.spread||!1;const a=e.children;let r=-1;for(;!s&&++r<a.length;)s=dj(a[r])}return s}function dj(e){const s=e.spread;return s??e.children.length>1}function CE(e,s){const a={},r=e.all(s);let o=-1;for(typeof s.start=="number"&&s.start!==1&&(a.start=s.start);++o<r.length;){const d=r[o];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){a.className=["contains-task-list"];break}}const c={type:"element",tagName:s.ordered?"ol":"ul",properties:a,children:e.wrap(r,!0)};return e.patch(s,c),e.applyData(s,c)}function TE(e,s){const a={type:"element",tagName:"p",properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}function EE(e,s){const a={type:"root",children:e.wrap(e.all(s))};return e.patch(s,a),e.applyData(s,a)}function AE(e,s){const a={type:"element",tagName:"strong",properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}function ME(e,s){const a=e.all(s),r=a.shift(),o=[];if(r){const d={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(s.children[0],d),o.push(d)}if(a.length>0){const d={type:"element",tagName:"tbody",properties:{},children:e.wrap(a,!0)},h=C0(s.children[1]),m=$2(s.children[s.children.length-1]);h&&m&&(d.position={start:h,end:m}),o.push(d)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(s,c),e.applyData(s,c)}function DE(e,s,a){const r=a?a.children:void 0,c=(r?r.indexOf(s):1)===0?"th":"td",d=a&&a.type==="table"?a.align:void 0,h=d?d.length:s.children.length;let m=-1;const f=[];for(;++m<h;){const b=s.children[m],v={},y=d?d[m]:void 0;y&&(v.align=y);let N={type:"element",tagName:c,properties:v,children:[]};b&&(N.children=e.all(b),e.patch(b,N),N=e.applyData(b,N)),f.push(N)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(s,p),e.applyData(s,p)}function OE(e,s){const a={type:"element",tagName:"td",properties:{},children:e.all(s)};return e.patch(s,a),e.applyData(s,a)}const Gy=9,Yy=32;function RE(e){const s=String(e),a=/\r?\n|\r/g;let r=a.exec(s),o=0;const c=[];for(;r;)c.push(Qy(s.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=a.exec(s);return c.push(Qy(s.slice(o),o>0,!1)),c.join("")}function Qy(e,s,a){let r=0,o=e.length;if(s){let c=e.codePointAt(r);for(;c===Gy||c===Yy;)r++,c=e.codePointAt(r)}if(a){let c=e.codePointAt(o-1);for(;c===Gy||c===Yy;)o--,c=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function _E(e,s){const a={type:"text",value:RE(String(s.value))};return e.patch(s,a),e.applyData(s,a)}function LE(e,s){const a={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(s,a),e.applyData(s,a)}const UE={blockquote:hE,break:fE,code:mE,delete:xE,emphasis:pE,footnoteReference:gE,heading:bE,html:yE,imageReference:vE,image:jE,inlineCode:wE,linkReference:zE,link:NE,listItem:kE,list:CE,paragraph:TE,root:EE,strong:AE,table:ME,tableCell:OE,tableRow:DE,text:_E,thematicBreak:LE,toml:mu,yaml:mu,definition:mu,footnoteDefinition:mu};function mu(){}const hj=-1,ad=0,To=1,Uu=2,R0=3,_0=4,L0=5,U0=6,fj=7,mj=8,Jy=typeof self=="object"?self:globalThis,BE=(e,s)=>{const a=(o,c)=>(e.set(c,o),o),r=o=>{if(e.has(o))return e.get(o);const[c,d]=s[o];switch(c){case ad:case hj:return a(d,o);case To:{const h=a([],o);for(const m of d)h.push(r(m));return h}case Uu:{const h=a({},o);for(const[m,f]of d)h[r(m)]=r(f);return h}case R0:return a(new Date(d),o);case _0:{const{source:h,flags:m}=d;return a(new RegExp(h,m),o)}case L0:{const h=a(new Map,o);for(const[m,f]of d)h.set(r(m),r(f));return h}case U0:{const h=a(new Set,o);for(const m of d)h.add(r(m));return h}case fj:{const{name:h,message:m}=d;return a(new Jy[h](m),o)}case mj:return a(BigInt(d),o);case"BigInt":return a(Object(BigInt(d)),o);case"ArrayBuffer":return a(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:h}=new Uint8Array(d);return a(new DataView(h),d)}}return a(new Jy[c](d),o)};return r},Xy=e=>BE(new Map,e)(0),Ir="",{toString:IE}={},{keys:HE}=Object,yo=e=>{const s=typeof e;if(s!=="object"||!e)return[ad,s];const a=IE.call(e).slice(8,-1);switch(a){case"Array":return[To,Ir];case"Object":return[Uu,Ir];case"Date":return[R0,Ir];case"RegExp":return[_0,Ir];case"Map":return[L0,Ir];case"Set":return[U0,Ir];case"DataView":return[To,a]}return a.includes("Array")?[To,a]:a.includes("Error")?[fj,a]:[Uu,a]},xu=([e,s])=>e===ad&&(s==="function"||s==="symbol"),PE=(e,s,a,r)=>{const o=(d,h)=>{const m=r.push(d)-1;return a.set(h,m),m},c=d=>{if(a.has(d))return a.get(d);let[h,m]=yo(d);switch(h){case ad:{let p=d;switch(m){case"bigint":h=mj,p=d.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);p=null;break;case"undefined":return o([hj],d)}return o([h,p],d)}case To:{if(m){let v=d;return m==="DataView"?v=new Uint8Array(d.buffer):m==="ArrayBuffer"&&(v=new Uint8Array(d)),o([m,[...v]],d)}const p=[],b=o([h,p],d);for(const v of d)p.push(c(v));return b}case Uu:{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(s&&"toJSON"in d)return c(d.toJSON());const p=[],b=o([h,p],d);for(const v of HE(d))(e||!xu(yo(d[v])))&&p.push([c(v),c(d[v])]);return b}case R0:return o([h,d.toISOString()],d);case _0:{const{source:p,flags:b}=d;return o([h,{source:p,flags:b}],d)}case L0:{const p=[],b=o([h,p],d);for(const[v,y]of d)(e||!(xu(yo(v))||xu(yo(y))))&&p.push([c(v),c(y)]);return b}case U0:{const p=[],b=o([h,p],d);for(const v of d)(e||!xu(yo(v)))&&p.push(c(v));return b}}const{message:f}=d;return o([h,{name:m,message:f}],d)};return c},Ky=(e,{json:s,lossy:a}={})=>{const r=[];return PE(!(s||a),!!s,new Map,r)(e),r},Bu=typeof structuredClone=="function"?(e,s)=>s&&("json"in s||"lossy"in s)?Xy(Ky(e,s)):structuredClone(e):(e,s)=>Xy(Ky(e,s));function qE(e,s){const a=[{type:"text",value:"↩"}];return s>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(s)}]}),a}function FE(e,s){return"Back to reference "+(e+1)+(s>1?"-"+s:"")}function $E(e){const s=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=e.options.footnoteBackContent||qE,r=e.options.footnoteBackLabel||FE,o=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",d=e.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let m=-1;for(;++m<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[m]);if(!f)continue;const p=e.all(f),b=String(f.identifier).toUpperCase(),v=gl(b.toLowerCase());let y=0;const N=[],S=e.footnoteCounts.get(b);for(;S!==void 0&&++y<=S;){N.length>0&&N.push({type:"text",value:" "});let C=typeof a=="string"?a:a(m,y);typeof C=="string"&&(C={type:"text",value:C}),N.push({type:"element",tagName:"a",properties:{href:"#"+s+"fnref-"+v+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(m,y),className:["data-footnote-backref"]},children:Array.isArray(C)?C:[C]})}const w=p[p.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const C=w.children[w.children.length-1];C&&C.type==="text"?C.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...N)}else p.push(...N);const j={type:"element",tagName:"li",properties:{id:s+"fn-"+v},children:e.wrap(p,!0)};e.patch(f,j),h.push(j)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...Bu(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(h,!0)},{type:"text",value:`
`}]}}const id=(function(e){if(e==null)return QE;if(typeof e=="function")return rd(e);if(typeof e=="object")return Array.isArray(e)?VE(e):GE(e);if(typeof e=="string")return YE(e);throw new Error("Expected function, string, or object as test")});function VE(e){const s=[];let a=-1;for(;++a<e.length;)s[a]=id(e[a]);return rd(r);function r(...o){let c=-1;for(;++c<s.length;)if(s[c].apply(this,o))return!0;return!1}}function GE(e){const s=e;return rd(a);function a(r){const o=r;let c;for(c in e)if(o[c]!==s[c])return!1;return!0}}function YE(e){return rd(s);function s(a){return a&&a.type===e}}function rd(e){return s;function s(a,r,o){return!!(JE(a)&&e.call(this,a,typeof r=="number"?r:void 0,o||void 0))}}function QE(){return!0}function JE(e){return e!==null&&typeof e=="object"&&"type"in e}const xj=[],XE=!0,Dm=!1,KE="skip";function pj(e,s,a,r){let o;typeof s=="function"&&typeof a!="function"?(r=a,a=s):o=s;const c=id(o),d=r?-1:1;h(e,void 0,[])();function h(m,f,p){const b=m&&typeof m=="object"?m:{};if(typeof b.type=="string"){const y=typeof b.tagName=="string"?b.tagName:typeof b.name=="string"?b.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(m.type+(y?"<"+y+">":""))+")"})}return v;function v(){let y=xj,N,S,w;if((!s||c(m,f,p[p.length-1]||void 0))&&(y=ZE(a(m,p)),y[0]===Dm))return y;if("children"in m&&m.children){const j=m;if(j.children&&y[0]!==KE)for(S=(r?j.children.length:-1)+d,w=p.concat(j);S>-1&&S<j.children.length;){const C=j.children[S];if(N=h(C,S,w)(),N[0]===Dm)return N;S=typeof N[1]=="number"?N[1]:S+d}}return y}}}function ZE(e){return Array.isArray(e)?e:typeof e=="number"?[XE,e]:e==null?xj:[e]}function B0(e,s,a,r){let o,c,d;typeof s=="function"&&typeof a!="function"?(c=void 0,d=s,o=a):(c=s,d=a,o=r),pj(e,c,h,o);function h(m,f){const p=f[f.length-1],b=p?p.children.indexOf(m):void 0;return d(m,b,p)}}const Om={}.hasOwnProperty,WE={};function e8(e,s){const a=s||WE,r=new Map,o=new Map,c=new Map,d={...UE,...a.handlers},h={all:f,applyData:n8,definitionById:r,footnoteById:o,footnoteCounts:c,footnoteOrder:[],handlers:d,one:m,options:a,patch:t8,wrap:a8};return B0(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const b=p.type==="definition"?r:o,v=String(p.identifier).toUpperCase();b.has(v)||b.set(v,p)}}),h;function m(p,b){const v=p.type,y=h.handlers[v];if(Om.call(h.handlers,v)&&y)return y(h,p,b);if(h.options.passThrough&&h.options.passThrough.includes(v)){if("children"in p){const{children:S,...w}=p,j=Bu(w);return j.children=h.all(p),j}return Bu(p)}return(h.options.unknownHandler||s8)(h,p,b)}function f(p){const b=[];if("children"in p){const v=p.children;let y=-1;for(;++y<v.length;){const N=h.one(v[y],p);if(N){if(y&&v[y-1].type==="break"&&(!Array.isArray(N)&&N.type==="text"&&(N.value=Zy(N.value)),!Array.isArray(N)&&N.type==="element")){const S=N.children[0];S&&S.type==="text"&&(S.value=Zy(S.value))}Array.isArray(N)?b.push(...N):b.push(N)}}}return b}}function t8(e,s){e.position&&(s.position=FC(e))}function n8(e,s){let a=s;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,c=e.data.hProperties;if(typeof r=="string")if(a.type==="element")a.tagName=r;else{const d="children"in a?a.children:[a];a={type:"element",tagName:r,properties:{},children:d}}a.type==="element"&&c&&Object.assign(a.properties,Bu(c)),"children"in a&&a.children&&o!==null&&o!==void 0&&(a.children=o)}return a}function s8(e,s){const a=s.data||{},r="value"in s&&!(Om.call(a,"hProperties")||Om.call(a,"hChildren"))?{type:"text",value:s.value}:{type:"element",tagName:"div",properties:{},children:e.all(s)};return e.patch(s,r),e.applyData(s,r)}function a8(e,s){const a=[];let r=-1;for(s&&a.push({type:"text",value:`
`});++r<e.length;)r&&a.push({type:"text",value:`
`}),a.push(e[r]);return s&&e.length>0&&a.push({type:"text",value:`
`}),a}function Zy(e){let s=0,a=e.charCodeAt(s);for(;a===9||a===32;)s++,a=e.charCodeAt(s);return e.slice(s)}function Wy(e,s){const a=e8(e,s),r=a.one(e,void 0),o=$E(a),c=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&c.children.push({type:"text",value:`
`},o),c}function i8(e,s){return e&&"run"in e?async function(a,r){const o=Wy(a,{file:r,...s});await e.run(o,r)}:function(a,r){return Wy(a,{file:r,...e||s})}}function e1(e){if(e)throw e}var Bf,t1;function r8(){if(t1)return Bf;t1=1;var e=Object.prototype.hasOwnProperty,s=Object.prototype.toString,a=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(f){return typeof Array.isArray=="function"?Array.isArray(f):s.call(f)==="[object Array]"},c=function(f){if(!f||s.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),b=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!b)return!1;var v;for(v in f);return typeof v>"u"||e.call(f,v)},d=function(f,p){a&&p.name==="__proto__"?a(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},h=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(r)return r(f,p).value}else return;return f[p]};return Bf=function m(){var f,p,b,v,y,N,S=arguments[0],w=1,j=arguments.length,C=!1;for(typeof S=="boolean"&&(C=S,S=arguments[1]||{},w=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});w<j;++w)if(f=arguments[w],f!=null)for(p in f)b=h(S,p),v=h(f,p),S!==v&&(C&&v&&(c(v)||(y=o(v)))?(y?(y=!1,N=b&&o(b)?b:[]):N=b&&c(b)?b:{},d(S,{name:p,newValue:m(C,N,v)})):typeof v<"u"&&d(S,{name:p,newValue:v}));return S},Bf}var l8=r8();const If=qu(l8);function Rm(e){if(typeof e!="object"||e===null)return!1;const s=Object.getPrototypeOf(e);return(s===null||s===Object.prototype||Object.getPrototypeOf(s)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function o8(){const e=[],s={run:a,use:r};return s;function a(...o){let c=-1;const d=o.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);h(null,...o);function h(m,...f){const p=e[++c];let b=-1;if(m){d(m);return}for(;++b<o.length;)(f[b]===null||f[b]===void 0)&&(f[b]=o[b]);o=f,p?c8(p,h)(...f):d(null,...f)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),s}}function c8(e,s){let a;return r;function r(...d){const h=e.length>d.length;let m;h&&d.push(o);try{m=e.apply(this,d)}catch(f){const p=f;if(h&&a)throw p;return o(p)}h||(m&&m.then&&typeof m.then=="function"?m.then(c,o):m instanceof Error?o(m):c(m))}function o(d,...h){a||(a=!0,s(d,...h))}function c(d){o(null,d)}}const Is={basename:u8,dirname:d8,extname:h8,join:f8,sep:"/"};function u8(e,s){if(s!==void 0&&typeof s!="string")throw new TypeError('"ext" argument must be a string');Yo(e);let a=0,r=-1,o=e.length,c;if(s===void 0||s.length===0||s.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(c){a=o+1;break}}else r<0&&(c=!0,r=o+1);return r<0?"":e.slice(a,r)}if(s===e)return"";let d=-1,h=s.length-1;for(;o--;)if(e.codePointAt(o)===47){if(c){a=o+1;break}}else d<0&&(c=!0,d=o+1),h>-1&&(e.codePointAt(o)===s.codePointAt(h--)?h<0&&(r=o):(h=-1,r=d));return a===r?r=d:r<0&&(r=e.length),e.slice(a,r)}function d8(e){if(Yo(e),e.length===0)return".";let s=-1,a=e.length,r;for(;--a;)if(e.codePointAt(a)===47){if(r){s=a;break}}else r||(r=!0);return s<0?e.codePointAt(0)===47?"/":".":s===1&&e.codePointAt(0)===47?"//":e.slice(0,s)}function h8(e){Yo(e);let s=e.length,a=-1,r=0,o=-1,c=0,d;for(;s--;){const h=e.codePointAt(s);if(h===47){if(d){r=s+1;break}continue}a<0&&(d=!0,a=s+1),h===46?o<0?o=s:c!==1&&(c=1):o>-1&&(c=-1)}return o<0||a<0||c===0||c===1&&o===a-1&&o===r+1?"":e.slice(o,a)}function f8(...e){let s=-1,a;for(;++s<e.length;)Yo(e[s]),e[s]&&(a=a===void 0?e[s]:a+"/"+e[s]);return a===void 0?".":m8(a)}function m8(e){Yo(e);const s=e.codePointAt(0)===47;let a=x8(e,!s);return a.length===0&&!s&&(a="."),a.length>0&&e.codePointAt(e.length-1)===47&&(a+="/"),s?"/"+a:a}function x8(e,s){let a="",r=0,o=-1,c=0,d=-1,h,m;for(;++d<=e.length;){if(d<e.length)h=e.codePointAt(d);else{if(h===47)break;h=47}if(h===47){if(!(o===d-1||c===1))if(o!==d-1&&c===2){if(a.length<2||r!==2||a.codePointAt(a.length-1)!==46||a.codePointAt(a.length-2)!==46){if(a.length>2){if(m=a.lastIndexOf("/"),m!==a.length-1){m<0?(a="",r=0):(a=a.slice(0,m),r=a.length-1-a.lastIndexOf("/")),o=d,c=0;continue}}else if(a.length>0){a="",r=0,o=d,c=0;continue}}s&&(a=a.length>0?a+"/..":"..",r=2)}else a.length>0?a+="/"+e.slice(o+1,d):a=e.slice(o+1,d),r=d-o-1;o=d,c=0}else h===46&&c>-1?c++:c=-1}return a}function Yo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const p8={cwd:g8};function g8(){return"/"}function _m(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function b8(e){if(typeof e=="string")e=new URL(e);else if(!_m(e)){const s=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw s.code="ERR_INVALID_ARG_TYPE",s}if(e.protocol!=="file:"){const s=new TypeError("The URL must be of scheme file");throw s.code="ERR_INVALID_URL_SCHEME",s}return y8(e)}function y8(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const s=e.pathname;let a=-1;for(;++a<s.length;)if(s.codePointAt(a)===37&&s.codePointAt(a+1)===50){const r=s.codePointAt(a+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(s)}const Hf=["history","path","basename","stem","extname","dirname"];class gj{constructor(s){let a;s?_m(s)?a={path:s}:typeof s=="string"||v8(s)?a={value:s}:a=s:a={},this.cwd="cwd"in a?"":p8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Hf.length;){const c=Hf[r];c in a&&a[c]!==void 0&&a[c]!==null&&(this[c]=c==="history"?[...a[c]]:a[c])}let o;for(o in a)Hf.includes(o)||(this[o]=a[o])}get basename(){return typeof this.path=="string"?Is.basename(this.path):void 0}set basename(s){qf(s,"basename"),Pf(s,"basename"),this.path=Is.join(this.dirname||"",s)}get dirname(){return typeof this.path=="string"?Is.dirname(this.path):void 0}set dirname(s){n1(this.basename,"dirname"),this.path=Is.join(s||"",this.basename)}get extname(){return typeof this.path=="string"?Is.extname(this.path):void 0}set extname(s){if(Pf(s,"extname"),n1(this.dirname,"extname"),s){if(s.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(s.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Is.join(this.dirname,this.stem+(s||""))}get path(){return this.history[this.history.length-1]}set path(s){_m(s)&&(s=b8(s)),qf(s,"path"),this.path!==s&&this.history.push(s)}get stem(){return typeof this.path=="string"?Is.basename(this.path,this.extname):void 0}set stem(s){qf(s,"stem"),Pf(s,"stem"),this.path=Is.join(this.dirname||"",s+(this.extname||""))}fail(s,a,r){const o=this.message(s,a,r);throw o.fatal=!0,o}info(s,a,r){const o=this.message(s,a,r);return o.fatal=void 0,o}message(s,a,r){const o=new vn(s,a,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(s){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(s||void 0).decode(this.value)}}function Pf(e,s){if(e&&e.includes(Is.sep))throw new Error("`"+s+"` cannot be a path: did not expect `"+Is.sep+"`")}function qf(e,s){if(!e)throw new Error("`"+s+"` cannot be empty")}function n1(e,s){if(!e)throw new Error("Setting `"+s+"` requires `path` to be set too")}function v8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const j8=(function(e){const r=this.constructor.prototype,o=r[e],c=function(){return o.apply(c,arguments)};return Object.setPrototypeOf(c,r),c}),w8={}.hasOwnProperty;class I0 extends j8{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=o8()}copy(){const s=new I0;let a=-1;for(;++a<this.attachers.length;){const r=this.attachers[a];s.use(...r)}return s.data(If(!0,{},this.namespace)),s}data(s,a){return typeof s=="string"?arguments.length===2?(Vf("data",this.frozen),this.namespace[s]=a,this):w8.call(this.namespace,s)&&this.namespace[s]||void 0:s?(Vf("data",this.frozen),this.namespace=s,this):this.namespace}freeze(){if(this.frozen)return this;const s=this;for(;++this.freezeIndex<this.attachers.length;){const[a,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=a.call(s,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(s){this.freeze();const a=pu(s),r=this.parser||this.Parser;return Ff("parse",r),r(String(a),a)}process(s,a){const r=this;return this.freeze(),Ff("process",this.parser||this.Parser),$f("process",this.compiler||this.Compiler),a?o(void 0,a):new Promise(o);function o(c,d){const h=pu(s),m=r.parse(h);r.run(m,h,function(p,b,v){if(p||!b||!v)return f(p);const y=b,N=r.stringify(y,v);k8(N)?v.value=N:v.result=N,f(p,v)});function f(p,b){p||!b?d(p):c?c(b):a(void 0,b)}}}processSync(s){let a=!1,r;return this.freeze(),Ff("processSync",this.parser||this.Parser),$f("processSync",this.compiler||this.Compiler),this.process(s,o),a1("processSync","process",a),r;function o(c,d){a=!0,e1(c),r=d}}run(s,a,r){s1(s),this.freeze();const o=this.transformers;return!r&&typeof a=="function"&&(r=a,a=void 0),r?c(void 0,r):new Promise(c);function c(d,h){const m=pu(a);o.run(s,m,f);function f(p,b,v){const y=b||s;p?h(p):d?d(y):r(void 0,y,v)}}}runSync(s,a){let r=!1,o;return this.run(s,a,c),a1("runSync","run",r),o;function c(d,h){e1(d),o=h,r=!0}}stringify(s,a){this.freeze();const r=pu(a),o=this.compiler||this.Compiler;return $f("stringify",o),s1(s),o(s,r)}use(s,...a){const r=this.attachers,o=this.namespace;if(Vf("use",this.frozen),s!=null)if(typeof s=="function")m(s,a);else if(typeof s=="object")Array.isArray(s)?h(s):d(s);else throw new TypeError("Expected usable value, not `"+s+"`");return this;function c(f){if(typeof f=="function")m(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[p,...b]=f;m(p,b)}else d(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function d(f){if(!("plugins"in f)&&!("settings"in f))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");h(f.plugins),f.settings&&(o.settings=If(!0,o.settings,f.settings))}function h(f){let p=-1;if(f!=null)if(Array.isArray(f))for(;++p<f.length;){const b=f[p];c(b)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function m(f,p){let b=-1,v=-1;for(;++b<r.length;)if(r[b][0]===f){v=b;break}if(v===-1)r.push([f,...p]);else if(p.length>0){let[y,...N]=p;const S=r[v][1];Rm(S)&&Rm(y)&&(y=If(!0,S,y)),r[v]=[f,y,...N]}}}}const z8=new I0().freeze();function Ff(e,s){if(typeof s!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $f(e,s){if(typeof s!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Vf(e,s){if(s)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function s1(e){if(!Rm(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function a1(e,s,a){if(!a)throw new Error("`"+e+"` finished async. Use `"+s+"` instead")}function pu(e){return N8(e)?e:new gj(e)}function N8(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function k8(e){return typeof e=="string"||S8(e)}function S8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const C8="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",i1=[],r1={allowDangerousHtml:!0},T8=/^(https?|ircs?|mailto|xmpp)$/i,E8=[{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 A8(e){const s=M8(e),a=D8(e);return O8(s.runSync(s.parse(a),a),e)}function M8(e){const s=e.rehypePlugins||i1,a=e.remarkPlugins||i1,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...r1}:r1;return z8().use(dE).use(a).use(i8,r).use(s)}function D8(e){const s=e.children||"",a=new gj;return typeof s=="string"&&(a.value=s),a}function O8(e,s){const a=s.allowedElements,r=s.allowElement,o=s.components,c=s.disallowedElements,d=s.skipHtml,h=s.unwrapDisallowed,m=s.urlTransform||bj;for(const p of E8)Object.hasOwn(s,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+C8+p.id,void 0);return B0(e,f),QC(e,{Fragment:n.Fragment,components:o,ignoreInvalidStyle:!0,jsx:n.jsx,jsxs:n.jsxs,passKeys:!0,passNode:!0});function f(p,b,v){if(p.type==="raw"&&v&&typeof b=="number")return d?v.children.splice(b,1):v.children[b]={type:"text",value:p.value},b;if(p.type==="element"){let y;for(y in _f)if(Object.hasOwn(_f,y)&&Object.hasOwn(p.properties,y)){const N=p.properties[y],S=_f[y];(S===null||S.includes(p.tagName))&&(p.properties[y]=m(String(N||""),y,p))}}if(p.type==="element"){let y=a?!a.includes(p.tagName):c?c.includes(p.tagName):!1;if(!y&&r&&typeof b=="number"&&(y=!r(p,b,v)),y&&v&&typeof b=="number")return h&&p.children?v.children.splice(b,1,...p.children):v.children.splice(b,1),b}}}function bj(e){const s=e.indexOf(":"),a=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return s===-1||o!==-1&&s>o||a!==-1&&s>a||r!==-1&&s>r||T8.test(e.slice(0,s))?e:""}function l1(e,s){const a=String(e);if(typeof s!="string")throw new TypeError("Expected character");let r=0,o=a.indexOf(s);for(;o!==-1;)r++,o=a.indexOf(s,o+s.length);return r}function R8(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function _8(e,s,a){const o=id((a||{}).ignore||[]),c=L8(s);let d=-1;for(;++d<c.length;)pj(e,"text",h);function h(f,p){let b=-1,v;for(;++b<p.length;){const y=p[b],N=v?v.children:void 0;if(o(y,N?N.indexOf(y):void 0,v))return;v=y}if(v)return m(f,p)}function m(f,p){const b=p[p.length-1],v=c[d][0],y=c[d][1];let N=0;const w=b.children.indexOf(f);let j=!1,C=[];v.lastIndex=0;let T=v.exec(f.value);for(;T;){const D=T.index,E={index:T.index,input:T.input,stack:[...p,f]};let A=y(...T,E);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?v.lastIndex=D+1:(N!==D&&C.push({type:"text",value:f.value.slice(N,D)}),Array.isArray(A)?C.push(...A):A&&C.push(A),N=D+T[0].length,j=!0),!v.global)break;T=v.exec(f.value)}return j?(N<f.value.length&&C.push({type:"text",value:f.value.slice(N)}),b.children.splice(w,1,...C)):C=[f],w+C.length}}function L8(e){const s=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const a=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<a.length;){const o=a[r];s.push([U8(o[0]),B8(o[1])])}return s}function U8(e){return typeof e=="string"?new RegExp(R8(e),"g"):e}function B8(e){return typeof e=="function"?e:function(){return e}}const Gf="phrasing",Yf=["autolink","link","image","label"];function I8(){return{transforms:[G8],enter:{literalAutolink:P8,literalAutolinkEmail:Qf,literalAutolinkHttp:Qf,literalAutolinkWww:Qf},exit:{literalAutolink:V8,literalAutolinkEmail:$8,literalAutolinkHttp:q8,literalAutolinkWww:F8}}}function H8(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Gf,notInConstruct:Yf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Gf,notInConstruct:Yf},{character:":",before:"[ps]",after:"\\/",inConstruct:Gf,notInConstruct:Yf}]}}function P8(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Qf(e){this.config.enter.autolinkProtocol.call(this,e)}function q8(e){this.config.exit.autolinkProtocol.call(this,e)}function F8(e){this.config.exit.data.call(this,e);const s=this.stack[this.stack.length-1];s.type,s.url="http://"+this.sliceSerialize(e)}function $8(e){this.config.exit.autolinkEmail.call(this,e)}function V8(e){this.exit(e)}function G8(e){_8(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Y8],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Q8]],{ignore:["link","linkReference"]})}function Y8(e,s,a,r,o){let c="";if(!yj(o)||(/^w/i.test(s)&&(a=s+a,s="",c="http://"),!J8(a)))return!1;const d=X8(a+r);if(!d[0])return!1;const h={type:"link",title:null,url:c+s+d[0],children:[{type:"text",value:s+d[0]}]};return d[1]?[h,{type:"text",value:d[1]}]:h}function Q8(e,s,a,r){return!yj(r,!0)||/[-\d_]$/.test(a)?!1:{type:"link",title:null,url:"mailto:"+s+"@"+a,children:[{type:"text",value:s+"@"+a}]}}function J8(e){const s=e.split(".");return!(s.length<2||s[s.length-1]&&(/_/.test(s[s.length-1])||!/[a-zA-Z\d]/.test(s[s.length-1]))||s[s.length-2]&&(/_/.test(s[s.length-2])||!/[a-zA-Z\d]/.test(s[s.length-2])))}function X8(e){const s=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!s)return[e,void 0];e=e.slice(0,s.index);let a=s[0],r=a.indexOf(")");const o=l1(e,"(");let c=l1(e,")");for(;r!==-1&&o>c;)e+=a.slice(0,r+1),a=a.slice(r+1),r=a.indexOf(")"),c++;return[e,a]}function yj(e,s){const a=e.input.charCodeAt(e.index-1);return(e.index===0||Ji(a)||nd(a))&&(!s||a!==47)}vj.peek=iA;function K8(){this.buffer()}function Z8(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function W8(){this.buffer()}function eA(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function tA(e){const s=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Cs(this.sliceSerialize(e)).toLowerCase(),a.label=s}function nA(e){this.exit(e)}function sA(e){const s=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=Cs(this.sliceSerialize(e)).toLowerCase(),a.label=s}function aA(e){this.exit(e)}function iA(){return"["}function vj(e,s,a,r){const o=a.createTracker(r);let c=o.move("[^");const d=a.enter("footnoteReference"),h=a.enter("reference");return c+=o.move(a.safe(a.associationId(e),{after:"]",before:c})),h(),d(),c+=o.move("]"),c}function rA(){return{enter:{gfmFootnoteCallString:K8,gfmFootnoteCall:Z8,gfmFootnoteDefinitionLabelString:W8,gfmFootnoteDefinition:eA},exit:{gfmFootnoteCallString:tA,gfmFootnoteCall:nA,gfmFootnoteDefinitionLabelString:sA,gfmFootnoteDefinition:aA}}}function lA(e){let s=!1;return e&&e.firstLineBlank&&(s=!0),{handlers:{footnoteDefinition:a,footnoteReference:vj},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(r,o,c,d){const h=c.createTracker(d);let m=h.move("[^");const f=c.enter("footnoteDefinition"),p=c.enter("label");return m+=h.move(c.safe(c.associationId(r),{before:m,after:"]"})),p(),m+=h.move("]:"),r.children&&r.children.length>0&&(h.shift(4),m+=h.move((s?`
`:" ")+c.indentLines(c.containerFlow(r,h.current()),s?jj:oA))),f(),m}}function oA(e,s,a){return s===0?e:jj(e,s,a)}function jj(e,s,a){return(a?"":"    ")+e}const cA=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];wj.peek=mA;function uA(){return{canContainEols:["delete"],enter:{strikethrough:hA},exit:{strikethrough:fA}}}function dA(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:cA}],handlers:{delete:wj}}}function hA(e){this.enter({type:"delete",children:[]},e)}function fA(e){this.exit(e)}function wj(e,s,a,r){const o=a.createTracker(r),c=a.enter("strikethrough");let d=o.move("~~");return d+=a.containerPhrasing(e,{...o.current(),before:d,after:"~"}),d+=o.move("~~"),c(),d}function mA(){return"~"}function xA(e){return e.length}function pA(e,s){const a=s||{},r=(a.align||[]).concat(),o=a.stringLength||xA,c=[],d=[],h=[],m=[];let f=0,p=-1;for(;++p<e.length;){const S=[],w=[];let j=-1;for(e[p].length>f&&(f=e[p].length);++j<e[p].length;){const C=gA(e[p][j]);if(a.alignDelimiters!==!1){const T=o(C);w[j]=T,(m[j]===void 0||T>m[j])&&(m[j]=T)}S.push(C)}d[p]=S,h[p]=w}let b=-1;if(typeof r=="object"&&"length"in r)for(;++b<f;)c[b]=o1(r[b]);else{const S=o1(r);for(;++b<f;)c[b]=S}b=-1;const v=[],y=[];for(;++b<f;){const S=c[b];let w="",j="";S===99?(w=":",j=":"):S===108?w=":":S===114&&(j=":");let C=a.alignDelimiters===!1?1:Math.max(1,m[b]-w.length-j.length);const T=w+"-".repeat(C)+j;a.alignDelimiters!==!1&&(C=w.length+C+j.length,C>m[b]&&(m[b]=C),y[b]=C),v[b]=T}d.splice(1,0,v),h.splice(1,0,y),p=-1;const N=[];for(;++p<d.length;){const S=d[p],w=h[p];b=-1;const j=[];for(;++b<f;){const C=S[b]||"";let T="",D="";if(a.alignDelimiters!==!1){const E=m[b]-(w[b]||0),A=c[b];A===114?T=" ".repeat(E):A===99?E%2?(T=" ".repeat(E/2+.5),D=" ".repeat(E/2-.5)):(T=" ".repeat(E/2),D=T):D=" ".repeat(E)}a.delimiterStart!==!1&&!b&&j.push("|"),a.padding!==!1&&!(a.alignDelimiters===!1&&C==="")&&(a.delimiterStart!==!1||b)&&j.push(" "),a.alignDelimiters!==!1&&j.push(T),j.push(C),a.alignDelimiters!==!1&&j.push(D),a.padding!==!1&&j.push(" "),(a.delimiterEnd!==!1||b!==f-1)&&j.push("|")}N.push(a.delimiterEnd===!1?j.join("").replace(/ +$/,""):j.join(""))}return N.join(`
`)}function gA(e){return e==null?"":String(e)}function o1(e){const s=typeof e=="string"?e.codePointAt(0):0;return s===67||s===99?99:s===76||s===108?108:s===82||s===114?114:0}function bA(e,s,a,r){const o=a.enter("blockquote"),c=a.createTracker(r);c.move("> "),c.shift(2);const d=a.indentLines(a.containerFlow(e,c.current()),yA);return o(),d}function yA(e,s,a){return">"+(a?"":" ")+e}function vA(e,s){return c1(e,s.inConstruct,!0)&&!c1(e,s.notInConstruct,!1)}function c1(e,s,a){if(typeof s=="string"&&(s=[s]),!s||s.length===0)return a;let r=-1;for(;++r<s.length;)if(e.includes(s[r]))return!0;return!1}function u1(e,s,a,r){let o=-1;for(;++o<a.unsafe.length;)if(a.unsafe[o].character===`
`&&vA(a.stack,a.unsafe[o]))return/[ \t]/.test(r.before)?"":" ";return`\\
`}function jA(e,s){const a=String(e);let r=a.indexOf(s),o=r,c=0,d=0;if(typeof s!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===o?++c>d&&(d=c):c=1,o=r+s.length,r=a.indexOf(s,o);return d}function wA(e,s){return!!(s.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function zA(e){const s=e.options.fence||"`";if(s!=="`"&&s!=="~")throw new Error("Cannot serialize code with `"+s+"` for `options.fence`, expected `` ` `` or `~`");return s}function NA(e,s,a,r){const o=zA(a),c=e.value||"",d=o==="`"?"GraveAccent":"Tilde";if(wA(e,a)){const b=a.enter("codeIndented"),v=a.indentLines(c,kA);return b(),v}const h=a.createTracker(r),m=o.repeat(Math.max(jA(c,o)+1,3)),f=a.enter("codeFenced");let p=h.move(m);if(e.lang){const b=a.enter(`codeFencedLang${d}`);p+=h.move(a.safe(e.lang,{before:p,after:" ",encode:["`"],...h.current()})),b()}if(e.lang&&e.meta){const b=a.enter(`codeFencedMeta${d}`);p+=h.move(" "),p+=h.move(a.safe(e.meta,{before:p,after:`
`,encode:["`"],...h.current()})),b()}return p+=h.move(`
`),c&&(p+=h.move(c+`
`)),p+=h.move(m),f(),p}function kA(e,s,a){return(a?"":"    ")+e}function H0(e){const s=e.options.quote||'"';if(s!=='"'&&s!=="'")throw new Error("Cannot serialize title with `"+s+"` for `options.quote`, expected `\"`, or `'`");return s}function SA(e,s,a,r){const o=H0(a),c=o==='"'?"Quote":"Apostrophe",d=a.enter("definition");let h=a.enter("label");const m=a.createTracker(r);let f=m.move("[");return f+=m.move(a.safe(a.associationId(e),{before:f,after:"]",...m.current()})),f+=m.move("]: "),h(),!e.url||/[\0- \u007F]/.test(e.url)?(h=a.enter("destinationLiteral"),f+=m.move("<"),f+=m.move(a.safe(e.url,{before:f,after:">",...m.current()})),f+=m.move(">")):(h=a.enter("destinationRaw"),f+=m.move(a.safe(e.url,{before:f,after:e.title?" ":`
`,...m.current()}))),h(),e.title&&(h=a.enter(`title${c}`),f+=m.move(" "+o),f+=m.move(a.safe(e.title,{before:f,after:o,...m.current()})),f+=m.move(o),h()),d(),f}function CA(e){const s=e.options.emphasis||"*";if(s!=="*"&&s!=="_")throw new Error("Cannot serialize emphasis with `"+s+"` for `options.emphasis`, expected `*`, or `_`");return s}function Ro(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Iu(e,s,a){const r=al(e),o=al(s);return r===void 0?o===void 0?a==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===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}}zj.peek=TA;function zj(e,s,a,r){const o=CA(a),c=a.enter("emphasis"),d=a.createTracker(r),h=d.move(o);let m=d.move(a.containerPhrasing(e,{after:o,before:h,...d.current()}));const f=m.charCodeAt(0),p=Iu(r.before.charCodeAt(r.before.length-1),f,o);p.inside&&(m=Ro(f)+m.slice(1));const b=m.charCodeAt(m.length-1),v=Iu(r.after.charCodeAt(0),b,o);v.inside&&(m=m.slice(0,-1)+Ro(b));const y=d.move(o);return c(),a.attentionEncodeSurroundingInfo={after:v.outside,before:p.outside},h+m+y}function TA(e,s,a){return a.options.emphasis||"*"}function EA(e,s){let a=!1;return B0(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return a=!0,Dm}),!!((!e.depth||e.depth<3)&&M0(e)&&(s.options.setext||a))}function AA(e,s,a,r){const o=Math.max(Math.min(6,e.depth||1),1),c=a.createTracker(r);if(EA(e,a)){const p=a.enter("headingSetext"),b=a.enter("phrasing"),v=a.containerPhrasing(e,{...c.current(),before:`
`,after:`
`});return b(),p(),v+`
`+(o===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
`))+1))}const d="#".repeat(o),h=a.enter("headingAtx"),m=a.enter("phrasing");c.move(d+" ");let f=a.containerPhrasing(e,{before:"# ",after:`
`,...c.current()});return/^[\t ]/.test(f)&&(f=Ro(f.charCodeAt(0))+f.slice(1)),f=f?d+" "+f:d,a.options.closeAtx&&(f+=" "+d),m(),h(),f}Nj.peek=MA;function Nj(e){return e.value||""}function MA(){return"<"}kj.peek=DA;function kj(e,s,a,r){const o=H0(a),c=o==='"'?"Quote":"Apostrophe",d=a.enter("image");let h=a.enter("label");const m=a.createTracker(r);let f=m.move("![");return f+=m.move(a.safe(e.alt,{before:f,after:"]",...m.current()})),f+=m.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=a.enter("destinationLiteral"),f+=m.move("<"),f+=m.move(a.safe(e.url,{before:f,after:">",...m.current()})),f+=m.move(">")):(h=a.enter("destinationRaw"),f+=m.move(a.safe(e.url,{before:f,after:e.title?" ":")",...m.current()}))),h(),e.title&&(h=a.enter(`title${c}`),f+=m.move(" "+o),f+=m.move(a.safe(e.title,{before:f,after:o,...m.current()})),f+=m.move(o),h()),f+=m.move(")"),d(),f}function DA(){return"!"}Sj.peek=OA;function Sj(e,s,a,r){const o=e.referenceType,c=a.enter("imageReference");let d=a.enter("label");const h=a.createTracker(r);let m=h.move("![");const f=a.safe(e.alt,{before:m,after:"]",...h.current()});m+=h.move(f+"]["),d();const p=a.stack;a.stack=[],d=a.enter("reference");const b=a.safe(a.associationId(e),{before:m,after:"]",...h.current()});return d(),a.stack=p,c(),o==="full"||!f||f!==b?m+=h.move(b+"]"):o==="shortcut"?m=m.slice(0,-1):m+=h.move("]"),m}function OA(){return"!"}Cj.peek=RA;function Cj(e,s,a){let r=e.value||"",o="`",c=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++c<a.unsafe.length;){const d=a.unsafe[c],h=a.compilePattern(d);let m;if(d.atBreak)for(;m=h.exec(r);){let f=m.index;r.charCodeAt(f)===10&&r.charCodeAt(f-1)===13&&f--,r=r.slice(0,f)+" "+r.slice(m.index+1)}}return o+r+o}function RA(){return"`"}function Tj(e,s){const a=M0(e);return!!(!s.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(a===e.url||"mailto:"+a===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Ej.peek=_A;function Ej(e,s,a,r){const o=H0(a),c=o==='"'?"Quote":"Apostrophe",d=a.createTracker(r);let h,m;if(Tj(e,a)){const p=a.stack;a.stack=[],h=a.enter("autolink");let b=d.move("<");return b+=d.move(a.containerPhrasing(e,{before:b,after:">",...d.current()})),b+=d.move(">"),h(),a.stack=p,b}h=a.enter("link"),m=a.enter("label");let f=d.move("[");return f+=d.move(a.containerPhrasing(e,{before:f,after:"](",...d.current()})),f+=d.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=a.enter("destinationLiteral"),f+=d.move("<"),f+=d.move(a.safe(e.url,{before:f,after:">",...d.current()})),f+=d.move(">")):(m=a.enter("destinationRaw"),f+=d.move(a.safe(e.url,{before:f,after:e.title?" ":")",...d.current()}))),m(),e.title&&(m=a.enter(`title${c}`),f+=d.move(" "+o),f+=d.move(a.safe(e.title,{before:f,after:o,...d.current()})),f+=d.move(o),m()),f+=d.move(")"),h(),f}function _A(e,s,a){return Tj(e,a)?"<":"["}Aj.peek=LA;function Aj(e,s,a,r){const o=e.referenceType,c=a.enter("linkReference");let d=a.enter("label");const h=a.createTracker(r);let m=h.move("[");const f=a.containerPhrasing(e,{before:m,after:"]",...h.current()});m+=h.move(f+"]["),d();const p=a.stack;a.stack=[],d=a.enter("reference");const b=a.safe(a.associationId(e),{before:m,after:"]",...h.current()});return d(),a.stack=p,c(),o==="full"||!f||f!==b?m+=h.move(b+"]"):o==="shortcut"?m=m.slice(0,-1):m+=h.move("]"),m}function LA(){return"["}function P0(e){const s=e.options.bullet||"*";if(s!=="*"&&s!=="+"&&s!=="-")throw new Error("Cannot serialize items with `"+s+"` for `options.bullet`, expected `*`, `+`, or `-`");return s}function UA(e){const s=P0(e),a=e.options.bulletOther;if(!a)return s==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===s)throw new Error("Expected `bullet` (`"+s+"`) and `bulletOther` (`"+a+"`) to be different");return a}function BA(e){const s=e.options.bulletOrdered||".";if(s!=="."&&s!==")")throw new Error("Cannot serialize items with `"+s+"` for `options.bulletOrdered`, expected `.` or `)`");return s}function Mj(e){const s=e.options.rule||"*";if(s!=="*"&&s!=="-"&&s!=="_")throw new Error("Cannot serialize rules with `"+s+"` for `options.rule`, expected `*`, `-`, or `_`");return s}function IA(e,s,a,r){const o=a.enter("list"),c=a.bulletCurrent;let d=e.ordered?BA(a):P0(a);const h=e.ordered?d==="."?")":".":UA(a);let m=s&&a.bulletLastUsed?d===a.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&p&&(!p.children||!p.children[0])&&a.stack[a.stack.length-1]==="list"&&a.stack[a.stack.length-2]==="listItem"&&a.stack[a.stack.length-3]==="list"&&a.stack[a.stack.length-4]==="listItem"&&a.indexStack[a.indexStack.length-1]===0&&a.indexStack[a.indexStack.length-2]===0&&a.indexStack[a.indexStack.length-3]===0&&(m=!0),Mj(a)===d&&p){let b=-1;for(;++b<e.children.length;){const v=e.children[b];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(d=h),a.bulletCurrent=d;const f=a.containerFlow(e,r);return a.bulletLastUsed=d,a.bulletCurrent=c,o(),f}function HA(e){const s=e.options.listItemIndent||"one";if(s!=="tab"&&s!=="one"&&s!=="mixed")throw new Error("Cannot serialize items with `"+s+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return s}function PA(e,s,a,r){const o=HA(a);let c=a.bulletCurrent||P0(a);s&&s.type==="list"&&s.ordered&&(c=(typeof s.start=="number"&&s.start>-1?s.start:1)+(a.options.incrementListMarker===!1?0:s.children.indexOf(e))+c);let d=c.length+1;(o==="tab"||o==="mixed"&&(s&&s.type==="list"&&s.spread||e.spread))&&(d=Math.ceil(d/4)*4);const h=a.createTracker(r);h.move(c+" ".repeat(d-c.length)),h.shift(d);const m=a.enter("listItem"),f=a.indentLines(a.containerFlow(e,h.current()),p);return m(),f;function p(b,v,y){return v?(y?"":" ".repeat(d))+b:(y?c:c+" ".repeat(d-c.length))+b}}function qA(e,s,a,r){const o=a.enter("paragraph"),c=a.enter("phrasing"),d=a.containerPhrasing(e,r);return c(),o(),d}const FA=id(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function $A(e,s,a,r){return(e.children.some(function(d){return FA(d)})?a.containerPhrasing:a.containerFlow).call(a,e,r)}function VA(e){const s=e.options.strong||"*";if(s!=="*"&&s!=="_")throw new Error("Cannot serialize strong with `"+s+"` for `options.strong`, expected `*`, or `_`");return s}Dj.peek=GA;function Dj(e,s,a,r){const o=VA(a),c=a.enter("strong"),d=a.createTracker(r),h=d.move(o+o);let m=d.move(a.containerPhrasing(e,{after:o,before:h,...d.current()}));const f=m.charCodeAt(0),p=Iu(r.before.charCodeAt(r.before.length-1),f,o);p.inside&&(m=Ro(f)+m.slice(1));const b=m.charCodeAt(m.length-1),v=Iu(r.after.charCodeAt(0),b,o);v.inside&&(m=m.slice(0,-1)+Ro(b));const y=d.move(o+o);return c(),a.attentionEncodeSurroundingInfo={after:v.outside,before:p.outside},h+m+y}function GA(e,s,a){return a.options.strong||"*"}function YA(e,s,a,r){return a.safe(e.value,r)}function QA(e){const s=e.options.ruleRepetition||3;if(s<3)throw new Error("Cannot serialize rules with repetition `"+s+"` for `options.ruleRepetition`, expected `3` or more");return s}function JA(e,s,a){const r=(Mj(a)+(a.options.ruleSpaces?" ":"")).repeat(QA(a));return a.options.ruleSpaces?r.slice(0,-1):r}const Oj={blockquote:bA,break:u1,code:NA,definition:SA,emphasis:zj,hardBreak:u1,heading:AA,html:Nj,image:kj,imageReference:Sj,inlineCode:Cj,link:Ej,linkReference:Aj,list:IA,listItem:PA,paragraph:qA,root:$A,strong:Dj,text:YA,thematicBreak:JA};function XA(){return{enter:{table:KA,tableData:d1,tableHeader:d1,tableRow:WA},exit:{codeText:eM,table:ZA,tableData:Jf,tableHeader:Jf,tableRow:Jf}}}function KA(e){const s=e._align;this.enter({type:"table",align:s.map(function(a){return a==="none"?null:a}),children:[]},e),this.data.inTable=!0}function ZA(e){this.exit(e),this.data.inTable=void 0}function WA(e){this.enter({type:"tableRow",children:[]},e)}function Jf(e){this.exit(e)}function d1(e){this.enter({type:"tableCell",children:[]},e)}function eM(e){let s=this.resume();this.data.inTable&&(s=s.replace(/\\([\\|])/g,tM));const a=this.stack[this.stack.length-1];a.type,a.value=s,this.exit(e)}function tM(e,s){return s==="|"?s:e}function nM(e){const s=e||{},a=s.tableCellPadding,r=s.tablePipeAlign,o=s.stringLength,c=a?" ":"|";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:h}};function d(y,N,S,w){return f(p(y,S,w),y.align)}function h(y,N,S,w){const j=b(y,S,w),C=f([j]);return C.slice(0,C.indexOf(`
`))}function m(y,N,S,w){const j=S.enter("tableCell"),C=S.enter("phrasing"),T=S.containerPhrasing(y,{...w,before:c,after:c});return C(),j(),T}function f(y,N){return pA(y,{align:N,alignDelimiters:r,padding:a,stringLength:o})}function p(y,N,S){const w=y.children;let j=-1;const C=[],T=N.enter("table");for(;++j<w.length;)C[j]=b(w[j],N,S);return T(),C}function b(y,N,S){const w=y.children;let j=-1;const C=[],T=N.enter("tableRow");for(;++j<w.length;)C[j]=m(w[j],y,N,S);return T(),C}function v(y,N,S){let w=Oj.inlineCode(y,N,S);return S.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function sM(){return{exit:{taskListCheckValueChecked:h1,taskListCheckValueUnchecked:h1,paragraph:iM}}}function aM(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:rM}}}function h1(e){const s=this.stack[this.stack.length-2];s.type,s.checked=e.type==="taskListCheckValueChecked"}function iM(e){const s=this.stack[this.stack.length-2];if(s&&s.type==="listItem"&&typeof s.checked=="boolean"){const a=this.stack[this.stack.length-1];a.type;const r=a.children[0];if(r&&r.type==="text"){const o=s.children;let c=-1,d;for(;++c<o.length;){const h=o[c];if(h.type==="paragraph"){d=h;break}}d===a&&(r.value=r.value.slice(1),r.value.length===0?a.children.shift():a.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,a.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function rM(e,s,a,r){const o=e.children[0],c=typeof e.checked=="boolean"&&o&&o.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",h=a.createTracker(r);c&&h.move(d);let m=Oj.listItem(e,s,a,{...r,...h.current()});return c&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),m;function f(p){return p+d}}function lM(){return[I8(),rA(),uA(),XA(),sM()]}function oM(e){return{extensions:[H8(),lA(e),dA(),nM(e),aM()]}}const cM={tokenize:xM,partial:!0},Rj={tokenize:pM,partial:!0},_j={tokenize:gM,partial:!0},Lj={tokenize:bM,partial:!0},uM={tokenize:yM,partial:!0},Uj={name:"wwwAutolink",tokenize:fM,previous:Ij},Bj={name:"protocolAutolink",tokenize:mM,previous:Hj},ka={name:"emailAutolink",tokenize:hM,previous:Pj},Xs={};function dM(){return{text:Xs}}let Li=48;for(;Li<123;)Xs[Li]=ka,Li++,Li===58?Li=65:Li===91&&(Li=97);Xs[43]=ka;Xs[45]=ka;Xs[46]=ka;Xs[95]=ka;Xs[72]=[ka,Bj];Xs[104]=[ka,Bj];Xs[87]=[ka,Uj];Xs[119]=[ka,Uj];function hM(e,s,a){const r=this;let o,c;return d;function d(b){return!Lm(b)||!Pj.call(r,r.previous)||q0(r.events)?a(b):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),h(b))}function h(b){return Lm(b)?(e.consume(b),h):b===64?(e.consume(b),m):a(b)}function m(b){return b===46?e.check(uM,p,f)(b):b===45||b===95||yn(b)?(c=!0,e.consume(b),m):p(b)}function f(b){return e.consume(b),o=!0,m}function p(b){return c&&o&&kn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),s(b)):a(b)}}function fM(e,s,a){const r=this;return o;function o(d){return d!==87&&d!==119||!Ij.call(r,r.previous)||q0(r.events)?a(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(cM,e.attempt(Rj,e.attempt(_j,c),a),a)(d))}function c(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),s(d)}}function mM(e,s,a){const r=this;let o="",c=!1;return d;function d(b){return(b===72||b===104)&&Hj.call(r,r.previous)&&!q0(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(b),e.consume(b),h):a(b)}function h(b){if(kn(b)&&o.length<5)return o+=String.fromCodePoint(b),e.consume(b),h;if(b===58){const v=o.toLowerCase();if(v==="http"||v==="https")return e.consume(b),m}return a(b)}function m(b){return b===47?(e.consume(b),c?f:(c=!0,m)):a(b)}function f(b){return b===null||Lu(b)||mt(b)||Ji(b)||nd(b)?a(b):e.attempt(Rj,e.attempt(_j,p),a)(b)}function p(b){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),s(b)}}function xM(e,s,a){let r=0;return o;function o(d){return(d===87||d===119)&&r<3?(r++,e.consume(d),o):d===46&&r===3?(e.consume(d),c):a(d)}function c(d){return d===null?a(d):s(d)}}function pM(e,s,a){let r,o,c;return d;function d(f){return f===46||f===95?e.check(Lj,m,h)(f):f===null||mt(f)||Ji(f)||f!==45&&nd(f)?m(f):(c=!0,e.consume(f),d)}function h(f){return f===95?r=!0:(o=r,r=void 0),e.consume(f),d}function m(f){return o||r||!c?a(f):s(f)}}function gM(e,s){let a=0,r=0;return o;function o(d){return d===40?(a++,e.consume(d),o):d===41&&r<a?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(Lj,s,c)(d):d===null||mt(d)||Ji(d)?s(d):(e.consume(d),o)}function c(d){return d===41&&r++,e.consume(d),o}}function bM(e,s,a){return r;function r(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(e.consume(h),r):h===38?(e.consume(h),c):h===93?(e.consume(h),o):h===60||h===null||mt(h)||Ji(h)?s(h):a(h)}function o(h){return h===null||h===40||h===91||mt(h)||Ji(h)?s(h):r(h)}function c(h){return kn(h)?d(h):a(h)}function d(h){return h===59?(e.consume(h),r):kn(h)?(e.consume(h),d):a(h)}}function yM(e,s,a){return r;function r(c){return e.consume(c),o}function o(c){return yn(c)?a(c):s(c)}}function Ij(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||mt(e)}function Hj(e){return!kn(e)}function Pj(e){return!(e===47||Lm(e))}function Lm(e){return e===43||e===45||e===46||e===95||yn(e)}function q0(e){let s=e.length,a=!1;for(;s--;){const r=e[s][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){a=!0;break}if(r._gfmAutolinkLiteralWalkedInto){a=!1;break}}return e.length>0&&!a&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const vM={tokenize:TM,partial:!0};function jM(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:kM,continuation:{tokenize:SM},exit:CM}},text:{91:{name:"gfmFootnoteCall",tokenize:NM},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:wM,resolveTo:zM}}}}function wM(e,s,a){const r=this;let o=r.events.length;const c=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let d;for(;o--;){const m=r.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 h;function h(m){if(!d||!d._balanced)return a(m);const f=Cs(r.sliceSerialize({start:d.end,end:r.now()}));return f.codePointAt(0)!==94||!c.includes(f.slice(1))?a(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),s(m))}}function zM(e,s){let a=e.length;for(;a--;)if(e[a][1].type==="labelImage"&&e[a][0]==="enter"){e[a][1];break}e[a+1][1].type="data",e[a+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[a+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[a+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)},h=[e[a+1],e[a+2],["enter",r,s],e[a+3],e[a+4],["enter",o,s],["exit",o,s],["enter",c,s],["enter",d,s],["exit",d,s],["exit",c,s],e[e.length-2],e[e.length-1],["exit",r,s]];return e.splice(a,e.length-a+1,...h),e}function NM(e,s,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c=0,d;return h;function h(b){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(b),e.exit("gfmFootnoteCallLabelMarker"),m}function m(b){return b!==94?a(b):(e.enter("gfmFootnoteCallMarker"),e.consume(b),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(b){if(c>999||b===93&&!d||b===null||b===91||mt(b))return a(b);if(b===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return o.includes(Cs(r.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(b),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),s):a(b)}return mt(b)||(d=!0),c++,e.consume(b),b===92?p:f}function p(b){return b===91||b===92||b===93?(e.consume(b),c++,f):f(b)}}function kM(e,s,a){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c,d=0,h;return m;function m(N){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(N){return N===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):a(N)}function p(N){if(d>999||N===93&&!h||N===null||N===91||mt(N))return a(N);if(N===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return c=Cs(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return mt(N)||(h=!0),d++,e.consume(N),N===92?b:p}function b(N){return N===91||N===92||N===93?(e.consume(N),d++,p):p(N)}function v(N){return N===58?(e.enter("definitionMarker"),e.consume(N),e.exit("definitionMarker"),o.includes(c)||o.push(c),tt(e,y,"gfmFootnoteDefinitionWhitespace")):a(N)}function y(N){return s(N)}}function SM(e,s,a){return e.check(Go,s,e.attempt(vM,s,a))}function CM(e){e.exit("gfmFootnoteDefinition")}function TM(e,s,a){const r=this;return tt(e,o,"gfmFootnoteDefinitionIndent",5);function o(c){const d=r.events[r.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?s(c):a(c)}}function EM(e){let a=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:c,resolveAll:o};return a==null&&(a=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(d,h){let m=-1;for(;++m<d.length;)if(d[m][0]==="enter"&&d[m][1].type==="strikethroughSequenceTemporary"&&d[m][1]._close){let f=m;for(;f--;)if(d[f][0]==="exit"&&d[f][1].type==="strikethroughSequenceTemporary"&&d[f][1]._open&&d[m][1].end.offset-d[m][1].start.offset===d[f][1].end.offset-d[f][1].start.offset){d[m][1].type="strikethroughSequence",d[f][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},d[f][1].start),end:Object.assign({},d[m][1].end)},b={type:"strikethroughText",start:Object.assign({},d[f][1].end),end:Object.assign({},d[m][1].start)},v=[["enter",p,h],["enter",d[f][1],h],["exit",d[f][1],h],["enter",b,h]],y=h.parser.constructs.insideSpan.null;y&&Zn(v,v.length,0,sd(y,d.slice(f+1,m),h)),Zn(v,v.length,0,[["exit",b,h],["enter",d[m][1],h],["exit",d[m][1],h],["exit",p,h]]),Zn(d,f-1,m-f+3,v),m=f+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,h,m){const f=this.previous,p=this.events;let b=0;return v;function v(N){return f===126&&p[p.length-1][1].type!=="characterEscape"?m(N):(d.enter("strikethroughSequenceTemporary"),y(N))}function y(N){const S=al(f);if(N===126)return b>1?m(N):(d.consume(N),b++,y);if(b<2&&!a)return m(N);const w=d.exit("strikethroughSequenceTemporary"),j=al(N);return w._open=!j||j===2&&!!S,w._close=!S||S===2&&!!j,h(N)}}}class AM{constructor(){this.map=[]}add(s,a,r){MM(this,s,a,r)}consume(s){if(this.map.sort(function(c,d){return c[0]-d[0]}),this.map.length===0)return;let a=this.map.length;const r=[];for(;a>0;)a-=1,r.push(s.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),s.length=this.map[a][0];r.push(s.slice()),s.length=0;let o=r.pop();for(;o;){for(const c of o)s.push(c);o=r.pop()}this.map.length=0}}function MM(e,s,a,r){let o=0;if(!(a===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===s){e.map[o][1]+=a,e.map[o][2].push(...r);return}o+=1}e.map.push([s,a,r])}}function DM(e,s){let a=!1;const r=[];for(;s<e.length;){const o=e[s];if(a){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[s+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[s-1][1].type==="tableDelimiterMarker"){const c=r.length-1;r[c]=r[c]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(a=!0);s+=1}return r}function OM(){return{flow:{null:{name:"table",tokenize:RM,resolveAll:_M}}}}function RM(e,s,a){const r=this;let o=0,c=0,d;return h;function h(R){let F=r.events.length-1;for(;F>-1;){const U=r.events[F][1].type;if(U==="lineEnding"||U==="linePrefix")F--;else break}const _=F>-1?r.events[F][1].type:null,se=_==="tableHead"||_==="tableRow"?A:m;return se===A&&r.parser.lazy[r.now().line]?a(R):se(R)}function m(R){return e.enter("tableHead"),e.enter("tableRow"),f(R)}function f(R){return R===124||(d=!0,c+=1),p(R)}function p(R){return R===null?a(R):Ee(R)?c>1?(c=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),y):a(R):Ye(R)?tt(e,p,"whitespace")(R):(c+=1,d&&(d=!1,o+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),d=!0,p):(e.enter("data"),b(R)))}function b(R){return R===null||R===124||mt(R)?(e.exit("data"),p(R)):(e.consume(R),R===92?v:b)}function v(R){return R===92||R===124?(e.consume(R),b):b(R)}function y(R){return r.interrupt=!1,r.parser.lazy[r.now().line]?a(R):(e.enter("tableDelimiterRow"),d=!1,Ye(R)?tt(e,N,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):N(R))}function N(R){return R===45||R===58?w(R):R===124?(d=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),S):E(R)}function S(R){return Ye(R)?tt(e,w,"whitespace")(R):w(R)}function w(R){return R===58?(c+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),j):R===45?(c+=1,j(R)):R===null||Ee(R)?D(R):E(R)}function j(R){return R===45?(e.enter("tableDelimiterFiller"),C(R)):E(R)}function C(R){return R===45?(e.consume(R),C):R===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(R))}function T(R){return Ye(R)?tt(e,D,"whitespace")(R):D(R)}function D(R){return R===124?N(R):R===null||Ee(R)?!d||o!==c?E(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),s(R)):E(R)}function E(R){return a(R)}function A(R){return e.enter("tableRow"),B(R)}function B(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),B):R===null||Ee(R)?(e.exit("tableRow"),s(R)):Ye(R)?tt(e,B,"whitespace")(R):(e.enter("data"),V(R))}function V(R){return R===null||R===124||mt(R)?(e.exit("data"),B(R)):(e.consume(R),R===92?ee:V)}function ee(R){return R===92||R===124?(e.consume(R),V):V(R)}}function _M(e,s){let a=-1,r=!0,o=0,c=[0,0,0,0],d=[0,0,0,0],h=!1,m=0,f,p,b;const v=new AM;for(;++a<e.length;){const y=e[a],N=y[1];y[0]==="enter"?N.type==="tableHead"?(h=!1,m!==0&&(f1(v,s,m,f,p),p=void 0,m=0),f={type:"table",start:Object.assign({},N.start),end:Object.assign({},N.end)},v.add(a,0,[["enter",f,s]])):N.type==="tableRow"||N.type==="tableDelimiterRow"?(r=!0,b=void 0,c=[0,0,0,0],d=[0,a+1,0,0],h&&(h=!1,p={type:"tableBody",start:Object.assign({},N.start),end:Object.assign({},N.end)},v.add(a,0,[["enter",p,s]])),o=N.type==="tableDelimiterRow"?2:p?3:1):o&&(N.type==="data"||N.type==="tableDelimiterMarker"||N.type==="tableDelimiterFiller")?(r=!1,d[2]===0&&(c[1]!==0&&(d[0]=d[1],b=gu(v,s,c,o,void 0,b),c=[0,0,0,0]),d[2]=a)):N.type==="tableCellDivider"&&(r?r=!1:(c[1]!==0&&(d[0]=d[1],b=gu(v,s,c,o,void 0,b)),c=d,d=[c[1],a,0,0])):N.type==="tableHead"?(h=!0,m=a):N.type==="tableRow"||N.type==="tableDelimiterRow"?(m=a,c[1]!==0?(d[0]=d[1],b=gu(v,s,c,o,a,b)):d[1]!==0&&(b=gu(v,s,d,o,a,b)),o=0):o&&(N.type==="data"||N.type==="tableDelimiterMarker"||N.type==="tableDelimiterFiller")&&(d[3]=a)}for(m!==0&&f1(v,s,m,f,p),v.consume(s.events),a=-1;++a<s.events.length;){const y=s.events[a];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=DM(s.events,a))}return e}function gu(e,s,a,r,o,c){const d=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",h="tableContent";a[0]!==0&&(c.end=Object.assign({},qr(s.events,a[0])),e.add(a[0],0,[["exit",c,s]]));const m=qr(s.events,a[1]);if(c={type:d,start:Object.assign({},m),end:Object.assign({},m)},e.add(a[1],0,[["enter",c,s]]),a[2]!==0){const f=qr(s.events,a[2]),p=qr(s.events,a[3]),b={type:h,start:Object.assign({},f),end:Object.assign({},p)};if(e.add(a[2],0,[["enter",b,s]]),r!==2){const v=s.events[a[2]],y=s.events[a[3]];if(v[1].end=Object.assign({},y[1].end),v[1].type="chunkText",v[1].contentType="text",a[3]>a[2]+1){const N=a[2]+1,S=a[3]-a[2]-1;e.add(N,S,[])}}e.add(a[3]+1,0,[["exit",b,s]])}return o!==void 0&&(c.end=Object.assign({},qr(s.events,o)),e.add(o,0,[["exit",c,s]]),c=void 0),c}function f1(e,s,a,r,o){const c=[],d=qr(s.events,a);o&&(o.end=Object.assign({},d),c.push(["exit",o,s])),r.end=Object.assign({},d),c.push(["exit",r,s]),e.add(a+1,0,c)}function qr(e,s){const a=e[s],r=a[0]==="enter"?"start":"end";return a[1][r]}const LM={name:"tasklistCheck",tokenize:BM};function UM(){return{text:{91:LM}}}function BM(e,s,a){const r=this;return o;function o(m){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?a(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),c)}function c(m){return mt(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):a(m)}function d(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),h):a(m)}function h(m){return Ee(m)?s(m):Ye(m)?e.check({tokenize:IM},s,a)(m):a(m)}}function IM(e,s,a){return tt(e,r,"whitespace");function r(o){return o===null?a(o):s(o)}}function HM(e){return K2([dM(),jM(),EM(e),OM(),UM()])}const PM={};function qM(e){const s=this,a=e||PM,r=s.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),c=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),d=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(HM(a)),c.push(lM()),d.push(oM(a))}const FM={h1:({children:e})=>n.jsx("h1",{className:"mb-4 mt-6 text-xl font-bold text-zinc-100 first:mt-0",children:e}),h2:({children:e})=>n.jsx("h2",{className:"mb-3 mt-5 text-lg font-bold text-zinc-100 first:mt-0",children:e}),h3:({children:e})=>n.jsx("h3",{className:"mb-2 mt-4 text-base font-bold text-zinc-100 first:mt-0",children:e}),p:({children:e})=>n.jsx("p",{className:"mb-3 leading-relaxed text-zinc-100 last:mb-0",children:e}),a:({href:e,children:s})=>n.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:s}),ul:({children:e})=>n.jsx("ul",{className:"mb-3 ml-4 list-disc space-y-1 text-zinc-100 last:mb-0",children:e}),ol:({children:e})=>n.jsx("ol",{className:"mb-3 ml-4 list-decimal space-y-1 text-zinc-100 last:mb-0",children:e}),li:({children:e})=>n.jsx("li",{className:"text-zinc-100",children:e}),code:({className:e,children:s,...a})=>{if(!e)return n.jsx("code",{className:"rounded bg-zinc-700/50 px-1.5 py-0.5 font-mono text-sm text-cachi-300",children:s});const o=/language-(\w+)/.exec(e||""),c=o?o[1]:"";return n.jsxs("div",{className:"relative my-3",children:[c&&n.jsx("div",{className:"absolute right-2 top-2 rounded bg-zinc-700 px-2 py-0.5 text-xs text-zinc-400",children:c}),n.jsx("pre",{className:"overflow-x-auto rounded-lg bg-zinc-900 p-4",children:n.jsx("code",{className:X("font-mono text-sm text-zinc-300",e),...a,children:s})})]})},pre:({children:e})=>n.jsx(n.Fragment,{children:e}),blockquote:({children:e})=>n.jsx("blockquote",{className:"my-3 border-l-4 border-cachi-500/50 pl-4 italic text-zinc-400",children:e}),hr:()=>n.jsx("hr",{className:"my-4 border-zinc-700"}),strong:({children:e})=>n.jsx("strong",{className:"font-bold text-zinc-100",children:e}),em:({children:e})=>n.jsx("em",{className:"italic text-zinc-200",children:e}),del:({children:e})=>n.jsx("del",{className:"text-zinc-500 line-through",children:e}),img:({src:e,alt:s,...a})=>e!=null&&e.startsWith("data:audio/")?n.jsx("audio",{controls:!0,className:"my-2 w-full max-w-md",children:n.jsx("source",{src:e,type:e.split(";")[0].replace("data:","")})}):n.jsx("img",{src:e,alt:s,className:"my-3 max-w-full rounded-lg",...a}),table:({children:e})=>n.jsx("div",{className:"my-3 overflow-x-auto",children:n.jsx("table",{className:"min-w-full border-collapse text-sm",children:e})}),thead:({children:e})=>n.jsx("thead",{className:"border-b border-zinc-700 bg-zinc-800/50",children:e}),tbody:({children:e})=>n.jsx("tbody",{children:e}),tr:({children:e})=>n.jsx("tr",{className:"border-b border-zinc-800",children:e}),th:({children:e})=>n.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-300",children:e}),td:({children:e})=>n.jsx("td",{className:"px-3 py-2 text-zinc-100",children:e})};function ld({content:e,className:s}){return n.jsx("div",{className:X("prose prose-invert prose-sm max-w-none",s),children:n.jsx(A8,{remarkPlugins:[qM],components:FM,urlTransform:a=>a.startsWith("data:")?a:bj(a),children:e})})}const $M={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 Xf(e){const s=e.join(" ").toLowerCase();if(s.length<10)return null;const a={};for(const[c,{words:d,chars:h}]of Object.entries($M)){let m=0;h&&h.test(s)&&(m+=3);for(const f of d){const p=s.match(f);p&&(m+=p.length)}a[c]=m}let r=null,o=0;for(const[c,d]of Object.entries(a))d>o&&(o=d,r=c);return o>=2?r:null}const VM={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."},GM={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."},YM={en:"English",es:"Spanish",pt:"Portuguese",fr:"French",de:"German",it:"Italian"};function QM(e){const s=[];if(s.push(`You are ${e.name}, an AI assistant.`),e.purposeDescription&&s.push(`Your purpose: ${e.purposeDescription}`),e.purposeCategory&&e.purposeCategory!=="Other"&&s.push(`You specialize in ${e.purposeCategory.toLowerCase()}-related tasks.`),e.communicationStyle){const a=VM[e.communicationStyle];a?s.push(a):s.push(`Communication style: ${e.communicationStyle}`)}if(e.useEmojis&&s.push(GM[e.useEmojis]),e.detectedLanguage&&e.detectedLanguage!=="en"){const a=YM[e.detectedLanguage]||e.detectedLanguage;s.push(`Always respond in ${a} unless the user explicitly requests another language.`)}return s.push("Be helpful, honest, and stay true to your personality."),s.join(`

`)}class JM{constructor(s){$e(this,"ws",null);$e(this,"url");$e(this,"reconnectAttempts",0);$e(this,"maxReconnectAttempts",5);$e(this,"reconnectDelay",1e3);$e(this,"isIntentionalClose",!1);$e(this,"messageHandlers",[]);$e(this,"connectHandlers",[]);$e(this,"disconnectHandlers",[]);$e(this,"errorHandlers",[]);const a=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host;this.url=s||`${a}//${r}/ws`}connect(){var r,o;if(((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN||((o=this.ws)==null?void 0:o.readyState)===WebSocket.CONNECTING)return;const{accessToken:s}=Ut.getState();if(!s){console.error("Cannot connect WebSocket: not authenticated");return}this.isIntentionalClose=!1;const a=`${this.url}?token=${encodeURIComponent(s)}`;this.ws=new WebSocket(a),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(h=>h(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 s=this.reconnectDelay*Math.pow(2,this.reconnectAttempts-1);setTimeout(()=>{this.isIntentionalClose||(console.log(`Reconnecting... (attempt ${this.reconnectAttempts})`),this.connect())},s)}send(s,a={}){var r;if(((r=this.ws)==null?void 0:r.readyState)!==WebSocket.OPEN){console.error("WebSocket is not connected");return}this.ws.send(JSON.stringify({type:s,payload:a}))}sendChat(s,a){this.send("chat",{message:s,systemPrompt:a==null?void 0:a.systemPrompt,botId:a==null?void 0:a.botId,chatId:a==null?void 0:a.chatId,model:a==null?void 0:a.model,models:a==null?void 0:a.models,capabilities:a==null?void 0:a.capabilities,toolConfigs:a==null?void 0:a.toolConfigs,enabledSkills:a==null?void 0:a.enabledSkills,replyToId:a==null?void 0:a.replyToId})}sendCancel(){this.send("cancel")}sendApproval(s,a){this.send("approval",{id:s,approved:a})}onMessage(s){return this.messageHandlers.push(s),()=>{this.messageHandlers=this.messageHandlers.filter(a=>a!==s)}}onConnect(s){return this.connectHandlers.push(s),()=>{this.connectHandlers=this.connectHandlers.filter(a=>a!==s)}}onDisconnect(s){return this.disconnectHandlers.push(s),()=>{this.disconnectHandlers=this.disconnectHandlers.filter(a=>a!==s)}}onError(s){return this.errorHandlers.push(s),()=>{this.errorHandlers=this.errorHandlers.filter(a=>a!==s)}}get isConnected(){var s;return((s=this.ws)==null?void 0:s.readyState)===WebSocket.OPEN}}const pa=new JM,m1={totalMessages:0,totalTokens:0,totalCost:0,byModel:{},byBot:{},daily:[]},Hu=Nt()(Yt(e=>({stats:m1,recordUsage:({botId:s,model:a,tokens:r,cost:o})=>e(c=>{var m,f,p,b,v,y;const d=new Date().toISOString().split("T")[0],h=c.stats.daily.find(N=>N.date===d);return{stats:{totalMessages:c.stats.totalMessages+1,totalTokens:c.stats.totalTokens+r,totalCost:c.stats.totalCost+o,byModel:{...c.stats.byModel,[a]:{tokens:(((m=c.stats.byModel[a])==null?void 0:m.tokens)||0)+r,cost:(((f=c.stats.byModel[a])==null?void 0:f.cost)||0)+o,messages:(((p=c.stats.byModel[a])==null?void 0:p.messages)||0)+1}},byBot:{...c.stats.byBot,[s]:{tokens:(((b=c.stats.byBot[s])==null?void 0:b.tokens)||0)+r,cost:(((v=c.stats.byBot[s])==null?void 0:v.cost)||0)+o,messages:(((y=c.stats.byBot[s])==null?void 0:y.messages)||0)+1}},daily:h?c.stats.daily.map(N=>N.date===d?{...N,tokens:N.tokens+r,cost:N.cost+o,messages:N.messages+1}:N):[...c.stats.daily.slice(-29),{date:d,tokens:r,cost:o,messages:1}]}}}),resetStats:()=>e({stats:m1}),clearBotStats:s=>e(a=>{const r=a.stats.byBot[s];if(!r)return a;const{[s]:o,...c}=a.stats.byBot;return{stats:{...a.stats,totalMessages:Math.max(0,a.stats.totalMessages-r.messages),totalTokens:Math.max(0,a.stats.totalTokens-r.tokens),totalCost:Math.max(0,a.stats.totalCost-r.cost),byBot:c}}})}),{name:"cachibot-usage"})),qj="/api/bots";function Um(){const{accessToken:e}=Ut.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function Wt(e,s={},a=!0){const r=`${qj}${e}`,o=await fetch(r,{headers:{"Content-Type":"application/json",...Um(),...s.headers},...s});if(o.status===401&&a&&await As())return Wt(e,s,!1);if(!o.ok){const c=await o.json().catch(()=>({}));throw new Error(c.detail||`Request failed: ${o.statusText}`)}return o.json()}async function XM(e,s){const a=new FormData;a.append("file",s);const r=`${qj}/${e}/documents/`,o=await fetch(r,{method:"POST",headers:{...Um()},body:a});if(o.status===401&&await As()){const d=await fetch(r,{method:"POST",headers:{...Um()},body:a});if(!d.ok){const h=await d.json().catch(()=>({detail:"Upload failed"}));throw new Error(h.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 KM(e){return Wt(`/${e}/documents/`)}async function ZM(e,s){return Wt(`/${e}/documents/${s}`)}async function WM(e,s){return Wt(`/${e}/documents/${s}`,{method:"DELETE"})}async function e7(e){return Wt(`/${e}/instructions/`)}async function Fj(e,s){return Wt(`/${e}/instructions/`,{method:"PUT",body:JSON.stringify({content:s})})}async function t7(e){return Wt(`/${e}/instructions/`,{method:"DELETE"})}async function n7(e,s){const a=new URLSearchParams;s!=null&&s.tags&&a.set("tags",s.tags),s!=null&&s.search&&a.set("search",s.search),s!=null&&s.limit&&a.set("limit",String(s.limit)),s!=null&&s.offset&&a.set("offset",String(s.offset));const r=a.toString();return Wt(`/${e}/knowledge/notes${r?`?${r}`:""}`)}async function s7(e,s){return Wt(`/${e}/knowledge/notes`,{method:"POST",body:JSON.stringify(s)})}async function a7(e,s){return Wt(`/${e}/knowledge/notes/${s}`)}async function i7(e,s,a){return Wt(`/${e}/knowledge/notes/${s}`,{method:"PUT",body:JSON.stringify(a)})}async function r7(e,s){return Wt(`/${e}/knowledge/notes/${s}`,{method:"DELETE"})}async function l7(e){return Wt(`/${e}/knowledge/notes/tags`)}async function o7(e){return Wt(`/${e}/knowledge/stats`)}async function c7(e,s,a=!0,r=!0,o=10){return Wt(`/${e}/knowledge/search`,{method:"POST",body:JSON.stringify({query:s,include_notes:a,include_documents:r,limit:o})})}async function u7(e){return Wt(`/${e}/knowledge/reindex`,{method:"POST"})}async function d7(e,s){return Wt(`/${e}/knowledge/documents/${s}/retry`,{method:"POST"})}async function h7(e,s){return Wt(`/${e}/knowledge/documents/${s}/chunks`)}const on={documents:{upload:XM,list:KM,get:ZM,delete:WM,retry:d7,reindex:u7,getChunks:h7},instructions:{get:e7,update:Fj,delete:t7},notes:{list:n7,create:s7,get:a7,update:i7,delete:r7,getTags:l7},stats:o7,search:c7},Qs=Nt()(Yt((e,s)=>({documents:{},instructions:{},notes:{},allTags:{},stats:{},searchResults:[],documentChunks:{},loadingDocuments:{},loadingInstructions:{},loadingNotes:{},loadingStats:{},loadingSearch:!1,loadingChunks:{},uploadingBots:new Set,error:null,loadDocuments:async a=>{e(r=>({loadingDocuments:{...r.loadingDocuments,[a]:!0},error:null}));try{const r=await on.documents.list(a);e(o=>({documents:{...o.documents,[a]:r},loadingDocuments:{...o.loadingDocuments,[a]:!1}}))}catch(r){e(o=>({loadingDocuments:{...o.loadingDocuments,[a]:!1},error:r instanceof Error?r.message:"Failed to load documents"}))}},uploadDocument:async(a,r)=>{e(o=>({uploadingBots:new Set([...o.uploadingBots,a]),error:null}));try{const o=await on.documents.upload(a,r);return await s().loadDocuments(a),e(c=>{const d=new Set(c.uploadingBots);return d.delete(a),{uploadingBots:d}}),o.document_id}catch(o){throw e(c=>{const d=new Set(c.uploadingBots);return d.delete(a),{uploadingBots:d,error:o instanceof Error?o.message:"Upload failed"}}),o}},deleteDocument:async(a,r)=>{try{await on.documents.delete(a,r),e(o=>({documents:{...o.documents,[a]:(o.documents[a]||[]).filter(c=>c.id!==r)}}))}catch(o){throw e({error:o instanceof Error?o.message:"Delete failed"}),o}},refreshDocument:async(a,r)=>{try{const o=await on.documents.get(a,r);e(c=>({documents:{...c.documents,[a]:(c.documents[a]||[]).map(d=>d.id===r?o:d)}}))}catch{}},getDocuments:a=>s().documents[a]||[],retryDocument:async(a,r)=>{try{await on.documents.retry(a,r),await s().loadDocuments(a)}catch(o){throw e({error:o instanceof Error?o.message:"Retry failed"}),o}},reindexDocuments:async a=>{try{const r=await on.documents.reindex(a);return await s().loadDocuments(a),r.documents_queued}catch(r){throw e({error:r instanceof Error?r.message:"Reindex failed"}),r}},loadDocumentChunks:async(a,r)=>{e(o=>({loadingChunks:{...o.loadingChunks,[r]:!0}}));try{const o=await on.documents.getChunks(a,r);e(c=>({documentChunks:{...c.documentChunks,[r]:o},loadingChunks:{...c.loadingChunks,[r]:!1}}))}catch(o){e(c=>({loadingChunks:{...c.loadingChunks,[r]:!1},error:o instanceof Error?o.message:"Failed to load chunks"}))}},loadInstructions:async a=>{e(r=>({loadingInstructions:{...r.loadingInstructions,[a]:!0},error:null}));try{const r=await on.instructions.get(a);e(o=>({instructions:{...o.instructions,[a]:r.content},loadingInstructions:{...o.loadingInstructions,[a]:!1}}))}catch(r){e(o=>({loadingInstructions:{...o.loadingInstructions,[a]:!1},error:r instanceof Error?r.message:"Failed to load instructions"}))}},updateInstructions:async(a,r)=>{try{await on.instructions.update(a,r),e(o=>({instructions:{...o.instructions,[a]:r}}))}catch(o){throw e({error:o instanceof Error?o.message:"Update failed"}),o}},deleteInstructions:async a=>{try{await on.instructions.delete(a),e(r=>({instructions:{...r.instructions,[a]:""}}))}catch(r){throw e({error:r instanceof Error?r.message:"Delete failed"}),r}},getInstructions:a=>s().instructions[a]||"",loadNotes:async(a,r,o)=>{e(c=>({loadingNotes:{...c.loadingNotes,[a]:!0},error:null}));try{const c=await on.notes.list(a,{tags:r,search:o});e(d=>({notes:{...d.notes,[a]:c},loadingNotes:{...d.loadingNotes,[a]:!1}}))}catch(c){e(d=>({loadingNotes:{...d.loadingNotes,[a]:!1},error:c instanceof Error?c.message:"Failed to load notes"}))}},createNote:async(a,r)=>{try{const o=await on.notes.create(a,r);return e(c=>({notes:{...c.notes,[a]:[o,...c.notes[a]||[]]}})),o}catch(o){throw e({error:o instanceof Error?o.message:"Failed to create note"}),o}},updateNote:async(a,r,o)=>{try{const c=await on.notes.update(a,r,o);e(d=>({notes:{...d.notes,[a]:(d.notes[a]||[]).map(h=>h.id===r?c:h)}}))}catch(c){throw e({error:c instanceof Error?c.message:"Failed to update note"}),c}},deleteNote:async(a,r)=>{try{await on.notes.delete(a,r),e(o=>({notes:{...o.notes,[a]:(o.notes[a]||[]).filter(c=>c.id!==r)}}))}catch(o){throw e({error:o instanceof Error?o.message:"Failed to delete note"}),o}},loadTags:async a=>{try{const r=await on.notes.getTags(a);e(o=>({allTags:{...o.allTags,[a]:r}}))}catch{}},loadStats:async a=>{e(r=>({loadingStats:{...r.loadingStats,[a]:!0}}));try{const r=await on.stats(a);e(o=>({stats:{...o.stats,[a]:r},loadingStats:{...o.loadingStats,[a]:!1}}))}catch(r){e(o=>({loadingStats:{...o.loadingStats,[a]:!1},error:r instanceof Error?r.message:"Failed to load stats"}))}},searchKnowledge:async(a,r)=>{e({loadingSearch:!0,error:null});try{const o=await on.search(a,r);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})}));let $j=null,Tu=[];function f7(){return $j}function x1(e){$j=e,Tu.forEach(s=>s(e))}function m7(e){return Tu.push(e),()=>{Tu=Tu.filter(s=>s!==e)}}let ti=null;function x7(e){ti=e}function p7(){const[e,s]=k.useState(!1),{addMessage:a,updateMessage:r,setThinking:o,appendThinking:c,addToolCall:d,updateToolCall:h,clearToolCalls:m,attachToolCallsToLastMessage:f,setLoading:p,setError:b,updateLastAssistantMessageMetadata:v,updateLastAssistantMessage:y}=qt(),N=k.useRef(null);k.useEffect(()=>{const T=qt.subscribe(D=>{N.current=D.activeChatId});return N.current=qt.getState().activeChatId,T},[]);const S=k.useCallback(T=>{var D;switch(T.type){case"thinking":{const E=T.payload;c(E.content);break}case"tool_start":{const E=T.payload;o(null),d({id:E.id,tool:E.tool,args:E.args});break}case"tool_end":{const E=T.payload;h(E.id,E.result,E.success);break}case"message":{const E=T.payload,A=N.current||ti;if(console.log("[WS] Message received:",{role:E.role,chatId:A,refValue:N.current,pendingChatId:ti}),A){const B=E.messageId||`msg-${Date.now()}-${Math.random().toString(36).slice(2)}`;if(E.messageId&&E.role==="assistant"){const ee=qt.getState().getMessages(A).find(R=>R.id===E.messageId);ee?r(A,E.messageId,ee.content+E.content):a(A,{id:B,role:E.role,content:E.content,timestamp:new Date().toISOString()})}else a(A,{id:B,role:E.role,content:E.content,timestamp:new Date().toISOString()})}else console.warn("[WS] No chatId available for message, dropping:",E);break}case"approval_needed":{const E=T.payload;x1(E);break}case"platform_message":{const E=T.payload,A=(D=E.metadata)==null?void 0:D.toolCalls,{toolCalls:B,...V}=E.metadata||{};a(E.chatId,{id:E.messageId,role:E.role,content:E.content,timestamp:new Date().toISOString(),metadata:{platform:E.platform,...V},...A&&A.length>0?{toolCalls:A}:{}});const ee=qt.getState(),R=E.botId;if(R&&(ee.getChatsByBot(R).some(se=>se.id===E.chatId)||ee.syncPlatformChats(R)),E.role==="assistant"&&E.metadata){const F=E.metadata.tokens,_=E.metadata.cost,se=E.metadata.model;F!==void 0&&_!==void 0&&Hu.getState().recordUsage({botId:E.botId,model:se||"unknown",tokens:F,cost:_})}break}case"scheduled_notification":{const E=T.payload;console.log("[WS] Scheduled notification:",E),E.chatId&&a(E.chatId,{id:`sched-${Date.now()}-${Math.random().toString(36).slice(2)}`,role:"assistant",content:`[Scheduled] ${E.content}`,timestamp:new Date().toISOString()});break}case"document_status":{const E=T.payload,B=Qs.getState().documents[E.botId];if(B){const V=B.map(ee=>ee.id===E.documentId?{...ee,status:E.status,...E.chunkCount!==void 0?{chunk_count:E.chunkCount}:{}}:ee);Qs.setState(ee=>({documents:{...ee.documents,[E.botId]:V}}))}break}case"connection_status":{const E=T.payload;window.dispatchEvent(new CustomEvent("connection-status-change",{detail:E}));break}case"usage":{const E=T.payload,A=xt.getState().activeBotId,B=xt.getState().getActiveBot(),V=N.current||ti;Hu.getState().recordUsage({botId:A||"unknown",model:(B==null?void 0:B.model)||"unknown",tokens:E.totalTokens,cost:E.totalCost}),V&&v(V,{tokens:E.totalTokens,promptTokens:E.promptTokens,completionTokens:E.completionTokens,cost:E.totalCost,model:B==null?void 0:B.model,iterations:E.iterations,elapsedMs:E.elapsedMs,tokensPerSecond:E.tokensPerSecond,callCount:E.callCount,errors:E.errors,perModel:E.perModel,latencyStats:E.latencyStats});break}case"job_update":{const E=T.payload,A=_u.getState();E.action==="created"?A.addJob({id:E.job.id,botId:E.job.botId,chatId:E.job.chatId,title:`Job ${E.job.taskId}`,status:E.job.status==="running"?"running":E.job.status,priority:"normal",progress:E.job.progress*100,createdAt:E.job.createdAt,startedAt:E.job.startedAt,completedAt:E.job.completedAt,result:E.job.result,error:E.job.error,logs:E.job.logs.map(B=>({timestamp:B.timestamp,level:B.level,message:B.message}))}):E.action==="updated"?A.updateJob(E.job.id,{status:E.job.status==="running"?"running":E.job.status,progress:E.job.progress*100,completedAt:E.job.completedAt,result:E.job.result,error:E.job.error}):E.action==="deleted"&&A.deleteJob(E.job.id);break}case"error":{const E=T.payload;b(E.message),p(!1),o(null);const A=N.current||ti,B=qt.getState().toolCalls;A&&B.length>0&&f(A,B),m(),ti=null;break}case"done":{p(!1),o(null);const E=N.current||ti,A=qt.getState().toolCalls;E&&A.length>0&&f(E,A),m();const B=T.payload.replyToId;B&&E&&y(E,{replyToId:B}),ti=null;break}}},[a,r,o,c,d,h,m,f,p,b,v,y]);k.useEffect(()=>{const T=pa.onMessage(S),D=pa.onConnect(()=>s(!0)),E=pa.onDisconnect(()=>s(!1)),A=pa.onError(()=>{b("WebSocket connection error")}),B=setTimeout(()=>{pa.connect()},100);return()=>{clearTimeout(B),T(),D(),E(),A(),pa.disconnect()}},[S,b]);const w=k.useCallback((T,D)=>{const{setLoading:E,setError:A,clearToolCalls:B}=qt.getState();E(!0),A(null),B(),pa.sendChat(T,D)},[]),j=k.useCallback(()=>{pa.sendCancel(),p(!1),o(null)},[p,o]),C=k.useCallback((T,D)=>{pa.sendApproval(T,D),x1(null)},[]);return{isConnected:e,sendMessage:w,cancel:j,approve:C}}function g7(){const{setCreateBotOpen:e,setSettingsOpen:s,setSidebarCollapsed:a}=Bt(),{bots:r}=xt(),{addMessage:o,activeChatId:c}=qt(),d=k.useCallback(f=>f.trim().startsWith("/"),[]),h=k.useCallback(f=>{c&&o(c,{id:crypto.randomUUID(),role:"assistant",content:f,timestamp:new Date().toISOString()})},[c,o]),m=k.useCallback(f=>{const p=f.trim();if(!p.startsWith("/"))return{handled:!1};const v=p.slice(1).split(/\s+/)[0].toLowerCase();switch(v){case"new":case"create":return e(!0),{handled:!0};case"settings":return s(!0),{handled:!0};case"list":case"bots":a(!1);const y=r.length>0?r.map((N,S)=>`${S+1}. **${N.name}**${N.description?` - ${N.description}`:""}`).join(`
`):"No bots yet. Use `/new` to create your first bot!";return h(`**Your Bots:**

${y}`),{handled:!0};case"help":return h("**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 h(`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 h(`Unknown command: \`/${v}\`

Type \`/help\` to see available commands.`),{handled:!0,message:"unknown"}}},[e,s,a,r,h]);return{isCommand:d,handleCommand:m}}const p1=["bot","brain","zap","sparkles","rocket","star","gem","flame"],g1=["#3b82f6","#8b5cf6","#ec4899","#f97316","#22c55e","#06b6d4"];function b7(){return p1[Math.floor(Math.random()*p1.length)]}function y7(){return g1[Math.floor(Math.random()*g1.length)]}function b1({onSendMessage:e,onCancel:s,isConnected:a}){const r=hn(),{activeChatId:o,getMessages:c,thinking:d,toolCalls:h,isLoading:m,addMessage:f,addChat:p,setActiveChat:b,replyToMessage:v,setReplyTo:y}=qt(),{getActiveBot:N,activeBotId:S,bots:w,addBot:j,setActiveBot:C,setActiveView:T}=xt(),{showThinking:D}=Bt(),E=hC(),{sendMessage:A,cancel:B,isConnected:V}=p7(),{isCommand:ee,handleCommand:R}=g7(),F=a??V,_=s??B,[se,U]=k.useState(""),[H,I]=k.useState([]),[W,re]=k.useState(!1),[he,L]=k.useState(0),P=k.useRef(null),Y=k.useRef(null),O=[{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:"👋"}],de=se.startsWith("/")?O.filter(me=>me.name.toLowerCase().startsWith(se.slice(1).toLowerCase())):[];k.useEffect(()=>{se==="/"||se.startsWith("/")&&se.length>1&&de.length>0?(re(!0),L(0)):re(!1)},[se,de.length]);const ve=o?c(o):[],ae=N(),je=E.step!=="idle",Xe=w.map(me=>me.name),Fe=k.useCallback(me=>me.map((ge,Be)=>`${Be+1}. ${ge}`).join(`
`),[]),zt=k.useCallback(async me=>{E.setLoadingNames(!0);try{const ge=await Zv(Xe);E.setNameSuggestions(ge),f(me,{id:crypto.randomUUID(),role:"assistant",content:`Here are some name ideas:

${Fe(ge)}

Type a number to pick one, your own name, or "more" for new suggestions.`,timestamp:new Date().toISOString()})}catch{f(me,{id:crypto.randomUUID(),role:"assistant",content:"I had trouble generating names. Please type a name for your new bot:",timestamp:new Date().toISOString()})}finally{E.setLoadingNames(!1)}},[E,Xe,Fe,f]),It=k.useCallback((me,ge)=>{const Be=me.trim();if(Be.toLowerCase()==="more")return f(ge,{id:crypto.randomUUID(),role:"user",content:Be,timestamp:new Date().toISOString()}),zt(ge),!0;const Me=parseInt(Be),nt=E.data.nameSuggestions;if(!isNaN(Me)&&Me>=1&&Me<=nt.length){const Ne=nt[Me-1];f(ge,{id:crypto.randomUUID(),role:"user",content:Be,timestamp:new Date().toISOString()});try{E.setName(Ne),f(ge,{id:crypto.randomUUID(),role:"assistant",content:`Great, ${Ne} 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{f(ge,{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 te=Be.toLowerCase(),fe=Xe.some(Ne=>Ne.toLowerCase()===te);if(f(ge,{id:crypto.randomUUID(),role:"user",content:Be,timestamp:new Date().toISOString()}),fe)return f(ge,{id:crypto.randomUUID(),role:"assistant",content:'That name is already taken. Please choose a different name or type "more" for new suggestions.',timestamp:new Date().toISOString()}),!0;try{E.setName(Be),f(ge,{id:crypto.randomUUID(),role:"assistant",content:`Great, ${Be} 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{f(ge,{id:crypto.randomUUID(),role:"assistant",content:"Something went wrong. Please try a different name.",timestamp:new Date().toISOString()})}return!0},[E,Xe,zt,f]),qn=k.useCallback((me,ge)=>{const Be=me.trim(),Se=E.data.name||"your bot";f(ge,{id:crypto.randomUUID(),role:"user",content:Be,timestamp:new Date().toISOString()});const Me=[...H,Be];I(Me);const nt=Xf(Me);nt&&E.setDetectedLanguage(nt);const fe={1:"Work",2:"Personal",3:"Creative",4:"Learning",5:"Other"}[Be]||Be;return E.setPurposeCategory(fe),f(ge,{id:crypto.randomUUID(),role:"assistant",content:`Got it! Now, describe what ${Se} 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 ${Se}'s personality.`,timestamp:new Date().toISOString()}),!0},[E,H,f]),bs=k.useCallback((me,ge)=>{const Be=me.trim(),Se=E.data.name||"your bot";f(ge,{id:crypto.randomUUID(),role:"user",content:Be,timestamp:new Date().toISOString()});const Me=[...H,Be];I(Me);const nt=Xf(Me);return nt&&E.setDetectedLanguage(nt),E.setPurposeDescription(Be),f(ge,{id:crypto.randomUUID(),role:"assistant",content:`Nice! How should ${Se} communicate?

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

Or describe the style you want in your own words, like "Warm but concise" or "Like a patient teacher"`,timestamp:new Date().toISOString()}),!0},[E,H,f]),fn=k.useCallback((me,ge)=>{const Be=me.trim(),Se=E.data.name||"your bot";f(ge,{id:crypto.randomUUID(),role:"user",content:Be,timestamp:new Date().toISOString()});const Me=[...H,Be];I(Me);const nt=Xf(Me);nt&&E.setDetectedLanguage(nt);const fe={1:"Professional",2:"Casual",3:"Playful",4:"Technical"}[Be]||Be;return E.setStyle(fe),f(ge,{id:crypto.randomUUID(),role:"assistant",content:`Almost done! Should ${Se} use emojis?

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

Type 1, 2, or 3.`,timestamp:new Date().toISOString()}),!0},[E,H,f]),ts=k.useCallback((me,ge)=>{const Be=me.trim(),Se=Be.toLowerCase(),Me=E.data.name||"your bot";f(ge,{id:crypto.randomUUID(),role:"user",content:Be,timestamp:new Date().toISOString()});let nt="sometimes";Se==="1"||Se==="yes"||Se==="y"?nt="yes":Se==="2"||Se==="no"||Se==="n"?nt="no":(Se==="3"||Se==="sometimes"||Se==="sparingly")&&(nt="sometimes"),E.setEmoji(nt);const te=E.data,fe=nt==="yes"?"Yes":nt==="no"?"No":"Sometimes";return f(ge,{id:crypto.randomUUID(),role:"assistant",content:`Perfect! Here's a summary of ${Me}:

**Name:** ${te.name}
**Category:** ${te.purposeCategory}
**Purpose:** ${te.purposeDescription}
**Style:** ${te.communicationStyle}
**Emojis:** ${fe}

Type "confirm" to create ${Me}, or "back" to make changes.`,timestamp:new Date().toISOString()}),!0},[E,f]),ce=k.useCallback((me,ge)=>{const Be=me.trim(),Se=Be.toLowerCase(),Me=E.data,nt=Me.name||"your bot";if(f(ge,{id:crypto.randomUUID(),role:"user",content:Be,timestamp:new Date().toISOString()}),Se==="cancel"||Se==="no"||Se==="n")return E.cancelFlow(),I([]),f(ge,{id:crypto.randomUUID(),role:"assistant",content:"No worries! Type /create when you're ready to try again.",timestamp:new Date().toISOString()}),!0;if(Se==="confirm"||Se==="yes"||Se==="y"||Se==="create"){const te=QM(Me),fe={id:crypto.randomUUID(),name:Me.name,description:Me.purposeDescription||`A ${Me.purposeCategory} assistant`,icon:b7(),color:y7(),model:Wn.getState().defaultModel,systemPrompt:te,tools:["file_read","file_write","python_execute"],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),personality:{purposeCategory:Me.purposeCategory,purposeDescription:Me.purposeDescription,communicationStyle:Me.communicationStyle,useEmojis:Me.useEmojis}};j(fe),C(fe.id),E.confirmAndCreate(),E.completeFlow(),I([]);const Ne=crypto.randomUUID(),Ie={id:Ne,botId:fe.id,title:`Chat with ${fe.name}`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0};return p(Ie),b(Ne),f(Ne,{id:crypto.randomUUID(),role:"assistant",content:`**${fe.name}** has been created! You're now chatting with your new bot.

Say hello to see ${fe.name}'s personality in action!`,timestamp:new Date().toISOString()}),!0}return f(ge,{id:crypto.randomUUID(),role:"assistant",content:`Type "confirm" to create ${nt}, or "cancel" to start over.`,timestamp:new Date().toISOString()}),!0},[E,H,f,j,C,p,b]);k.useEffect(()=>{var me;(me=P.current)==null||me.scrollIntoView({behavior:"smooth"})},[ve,d,h]),k.useEffect(()=>{Y.current&&(Y.current.style.height="auto",Y.current.style.height=Math.min(Y.current.scrollHeight,200)+"px")},[se]);const pe=me=>{if(me.preventDefault(),!se.trim()||m)return;const ge=se.trim(),Be=ge.toLowerCase();if(ee(ge)&&Be!=="/create"&&!je&&(o&&f(o,{id:crypto.randomUUID(),role:"user",content:ge,timestamp:new Date().toISOString()}),R(ge).handled)){U("");return}if(Be==="/create"){let Se=o;if(!Se&&S){const Me={id:crypto.randomUUID(),botId:S,title:"New Bot Creation",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0};p(Me),b(Me.id),Se=Me.id}Se&&(E.startFlow(Se),I([]),f(Se,{id:crypto.randomUUID(),role:"user",content:"/create",timestamp:new Date().toISOString()}),f(Se,{id:crypto.randomUUID(),role:"assistant",content:"Let's create a new bot! I'm generating some name ideas...",timestamp:new Date().toISOString()}),zt(Se)),U("");return}if(je&&Be==="cancel"){E.cancelFlow(),I([]),o&&(f(o,{id:crypto.randomUUID(),role:"user",content:"cancel",timestamp:new Date().toISOString()}),f(o,{id:crypto.randomUUID(),role:"assistant",content:"Bot creation cancelled. Type /create to start again.",timestamp:new Date().toISOString()})),U("");return}if(je&&o){let Se=!1;switch(E.step){case"name":Se=It(ge,o);break;case"purpose-category":Se=qn(ge,o);break;case"purpose-description":Se=bs(ge,o);break;case"style":Se=fn(ge,o);break;case"emoji":Se=ts(ge,o);break;case"summary":Se=ce(ge,o);break}if(Se){U("");return}}if(e)e(ge);else{let Se=o;if(!Se&&S){const nt=crypto.randomUUID(),te={id:nt,botId:S,title:ge.slice(0,50)+(ge.length>50?"...":""),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0};p(te),b(nt),Se=nt,x7(nt),r(`/${S}/chats/${nt}`)}const Me={codeExecution:!0,fileOperations:!0,gitOperations:!1,shellAccess:!1,webAccess:!1,dataOperations:!1,contacts:!1,connections:!1,workManagement:!0,imageGeneration:!1,audioGeneration:!1};A(ge,{systemPrompt:ae==null?void 0:ae.systemPrompt,botId:ae==null?void 0:ae.id,chatId:Se??void 0,model:ae==null?void 0:ae.model,models:ae==null?void 0:ae.models,capabilities:(ae==null?void 0:ae.capabilities)||Me,toolConfigs:ae==null?void 0:ae.toolConfigs,replyToId:v==null?void 0:v.id})}U(""),y(null)},Ce=me=>{var ge;U(`/${me}`),re(!1),(ge=Y.current)==null||ge.focus()},_e=me=>{if(W&&de.length>0){if(me.key==="ArrowDown"){me.preventDefault(),L(ge=>ge<de.length-1?ge+1:0);return}if(me.key==="ArrowUp"){me.preventDefault(),L(ge=>ge>0?ge-1:de.length-1);return}if(me.key==="Tab"||me.key==="Enter"&&!me.shiftKey){me.preventDefault(),Ce(de[he].name);return}if(me.key==="Escape"){me.preventDefault(),re(!1);return}}me.key==="Enter"&&!me.shiftKey&&(me.preventDefault(),pe(me))};return o?n.jsxs("div",{className:"flex h-full flex-col bg-zinc-100 dark:bg-zinc-950",children:[n.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:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full",style:{backgroundColor:((ae==null?void 0:ae.color)||"#22c55e")+"30"},children:n.jsx(En,{icon:(ae==null?void 0:ae.icon)||"shield",size:18,className:"text-zinc-100"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:(ae==null?void 0:ae.name)||"CachiBot"}),n.jsx("p",{className:"text-xs text-zinc-500",children:(ae==null?void 0:ae.model)||Wn.getState().defaultModel||"No model set"})]})]}),n.jsx("button",{onClick:()=>T("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:n.jsx(hl,{className:"h-4 w-4"})})]}),n.jsx("div",{className:"flex-1 overflow-y-auto",children:n.jsxs("div",{className:"mx-auto max-w-3xl px-3 py-4 sm:px-4 sm:py-6",children:[ve.length===0?n.jsxs("div",{className:"py-12 text-center",children:[n.jsx(Sn,{className:"mx-auto mb-4 h-8 w-8 text-cachi-500"}),n.jsx("p",{className:"text-zinc-400",children:"Start the conversation..."})]}):n.jsx("div",{className:"space-y-6",children:ve.map(me=>n.jsx(j7,{message:me,botIcon:ae==null?void 0:ae.icon,botColor:ae==null?void 0:ae.color,onReply:()=>y(me),chatId:o||""},me.id))}),h.length>0&&n.jsx("div",{className:"mt-6 space-y-2",children:h.map(me=>n.jsx(C7,{call:me},me.id))}),m&&!d&&h.length===0&&n.jsx("div",{className:"mt-6",children:n.jsx(E7,{botColor:ae==null?void 0:ae.color})}),d&&D&&n.jsx("div",{className:"mt-6",children:n.jsx(T7,{content:d})}),n.jsx("div",{ref:P})]})}),n.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:n.jsxs("form",{onSubmit:pe,className:"mx-auto max-w-3xl",children:[v&&n.jsxs("div",{className:"mb-2 flex items-center gap-2 rounded-xl border border-zinc-300 bg-zinc-50 px-3 py-2 dark:border-zinc-700 dark:bg-zinc-800/70",children:[n.jsx(u0,{className:"h-4 w-4 flex-shrink-0 text-cachi-500"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"text-xs font-medium text-zinc-500 dark:text-zinc-400",children:["Replying to ",v.role==="user"?"You":(ae==null?void 0:ae.name)||"Assistant"]}),n.jsxs("p",{className:"truncate text-xs text-zinc-600 dark:text-zinc-300",children:[v.content.slice(0,100),v.content.length>100?"...":""]})]}),n.jsx("button",{type:"button",onClick:()=>y(null),className:"flex-shrink-0 rounded p-1 text-zinc-400 hover:bg-zinc-200 hover:text-zinc-600 dark:hover:bg-zinc-700 dark:hover:text-zinc-200",children:n.jsx(Gt,{className:"h-4 w-4"})})]}),n.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:[W&&de.length>0&&n.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:[n.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"}),n.jsx("div",{className:"max-h-48 overflow-y-auto",children:de.map((me,ge)=>n.jsxs("button",{type:"button",onClick:()=>Ce(me.name),className:X("flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors",ge===he?"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:[n.jsx("span",{className:"text-lg",children:me.icon}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"font-medium",children:["/",me.name]}),n.jsx("div",{className:"text-xs text-zinc-500 truncate",children:me.description})]}),ge===he&&n.jsx("span",{className:"text-xs text-zinc-500",children:"↵"})]},me.name))})]}),n.jsx("textarea",{ref:Y,value:se,onChange:me=>U(me.target.value),onKeyDown:_e,placeholder:E.step==="name"?'Type a number (1-4), your own name, or "more"...':`Message ${(ae==null?void 0:ae.name)||"CachiBot"} or type / for commands...`,disabled:!F||m||E.isLoadingNames,rows:1,className:"block w-full resize-none bg-transparent px-4 py-3 pr-24 text-zinc-900 placeholder-zinc-500 outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:text-zinc-100"}),n.jsxs("div",{className:"absolute bottom-2 right-2 flex items-center gap-1",children:[n.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:n.jsx(dy,{className:"h-4 w-4"})}),m?n.jsx("button",{type:"button",onClick:_,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:n.jsx(Q4,{className:"h-4 w-4"})}):n.jsx("button",{type:"submit",disabled:!se.trim()||!F,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:n.jsx(tl,{className:"h-4 w-4"})})]})]}),n.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs text-zinc-500",children:[n.jsxs("div",{className:"flex items-center gap-2 sm:gap-4",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:X("h-2 w-2 rounded-full",F?"bg-green-500":"bg-red-500")}),n.jsx("span",{className:"hidden xs:inline",children:F?"Connected":"Disconnected"})]}),n.jsx("span",{className:"truncate max-w-[120px] sm:max-w-none",children:ae==null?void 0:ae.model})]}),n.jsx("span",{className:"hidden sm:inline",children:"Press Enter to send, Shift+Enter for new line"})]}),je&&n.jsx("div",{className:"mt-2 flex items-center justify-center gap-2 rounded-lg bg-cachi-900/30 px-3 py-1.5 text-xs text-cachi-400",children:E.isLoadingNames?n.jsxs(n.Fragment,{children:[n.jsx(Le,{className:"h-3 w-3 animate-spin"}),n.jsx("span",{children:"Generating name suggestions..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(Sn,{className:"h-3 w-3"}),n.jsxs("span",{children:["Creating a new bot (Step: ",E.step,")... Type 'cancel' to stop"]})]})})]})})]}):n.jsxs("div",{className:"flex h-full flex-col bg-zinc-100 dark:bg-zinc-950",children:[n.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:n.jsxs("div",{className:"max-w-md text-center",children:[n.jsx("div",{className:"mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-2xl",style:{backgroundColor:((ae==null?void 0:ae.color)||"#22c55e")+"30"},children:n.jsx(En,{icon:(ae==null?void 0:ae.icon)||"shield",size:48,className:"text-zinc-100"})}),n.jsxs("h2",{className:"mb-2 text-2xl font-bold text-zinc-900 dark:text-zinc-100",children:["Welcome to ",(ae==null?void 0:ae.name)||"CachiBot"]}),n.jsx("p",{className:"mb-8 text-zinc-500 dark:text-zinc-400",children:(ae==null?void 0:ae.description)||"Start a new chat to begin working with your AI assistant."}),n.jsx("div",{className:"grid gap-3",children:["Write a Python script","Analyze this codebase","Help me debug an error"].map(me=>n.jsxs("button",{onClick:()=>{var ge;U(me),(ge=Y.current)==null||ge.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:[n.jsx(Sn,{className:"h-4 w-4 text-cachi-500"}),me]},me))})]})}),n.jsx("div",{className:"border-t border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50 p-4",children:n.jsxs("form",{onSubmit:pe,className:"mx-auto max-w-3xl",children:[n.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:[W&&de.length>0&&n.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:[n.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"}),n.jsx("div",{className:"max-h-48 overflow-y-auto",children:de.map((me,ge)=>n.jsxs("button",{type:"button",onClick:()=>Ce(me.name),className:X("flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors",ge===he?"bg-cachi-600/20 text-zinc-100":"text-zinc-300 hover:bg-zinc-700/50"),children:[n.jsx("span",{className:"text-lg",children:me.icon}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"font-medium",children:["/",me.name]}),n.jsx("div",{className:"text-xs text-zinc-500 truncate",children:me.description})]}),ge===he&&n.jsx("span",{className:"text-xs text-zinc-500",children:"↵"})]},me.name))})]}),n.jsx("textarea",{ref:Y,value:se,onChange:me=>U(me.target.value),onKeyDown:_e,placeholder:`Message ${(ae==null?void 0:ae.name)||"CachiBot"} or type / for commands...`,disabled:!F||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"}),n.jsxs("div",{className:"absolute bottom-2 right-2 flex items-center gap-1",children:[n.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:n.jsx(dy,{className:"h-4 w-4"})}),n.jsx("button",{type:"submit",disabled:!se.trim()||!F,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:n.jsx(tl,{className:"h-4 w-4"})})]})]}),n.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs text-zinc-500",children:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:X("h-2 w-2 rounded-full",F?"bg-green-500":"bg-red-500")}),F?"Connected":"Disconnected"]}),n.jsx("span",{children:"Press Enter to send, Shift+Enter for new line"})]})]})})]})}function v7(e){return[...e.matchAll(/\[cite:([a-f0-9-]+)\]/g)].map(s=>s[1])}function Vj(e){return e.replace(/\[cite:[a-f0-9-]+\]/g,"")}function y1(e){const s=document.getElementById(`msg-${e}`);s&&(s.scrollIntoView({behavior:"smooth",block:"center"}),s.classList.add("reply-highlight"),setTimeout(()=>s.classList.remove("reply-highlight"),1500))}function v1({message:e,onClick:s}){return n.jsxs("button",{type:"button",onClick:s,className:"mb-1 flex items-start gap-2 rounded-lg border-l-2 border-cachi-500 bg-zinc-900/40 px-3 py-1.5 text-left transition-colors hover:bg-zinc-900/60",children:[n.jsx(u0,{className:"mt-0.5 h-3 w-3 flex-shrink-0 text-cachi-500"}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("span",{className:"text-[10px] font-semibold text-cachi-400",children:e.role==="user"?"You":"Assistant"}),n.jsxs("p",{className:"truncate text-xs text-zinc-400",children:[Vj(e.content).slice(0,80),e.content.length>80?"...":""]})]})]})}function j7({message:e,botIcon:s,botColor:a,onReply:r,chatId:o}){var D,E,A,B,V,ee;const c=e.role==="user",[d,h]=k.useState(!1),[m,f]=k.useState(!1),[p,b]=k.useState(!1),{accentColor:v}=Bt(),y=td[v].palette[600],N=qt(R=>R.getMessageById),S=e.replyToId?N(o,e.replyToId):void 0,w=c?[]:v7(e.content),j=c?e.content:Vj(e.content),C=()=>{navigator.clipboard.writeText(e.content),h(!0),setTimeout(()=>h(!1),2e3)},T=!c&&e.metadata&&(e.metadata.tokens!==void 0||e.metadata.cost!==void 0||e.metadata.model!==void 0);return n.jsxs("div",{id:`msg-${e.id}`,className:X("group flex gap-4 transition-colors duration-500",c&&"flex-row-reverse"),children:[n.jsx("div",{className:X("flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-full",c?"text-white":"bg-zinc-800"),style:c?{backgroundColor:y}:a?{backgroundColor:a+"30"}:void 0,children:c?n.jsx(fl,{className:"h-5 w-5"}):n.jsx(En,{icon:s||"shield",size:20})}),n.jsxs("div",{className:X("flex max-w-[80%] flex-col gap-1",c&&"items-end"),children:[S&&n.jsx(v1,{message:S,onClick:()=>y1(S.id)}),w.length>0&&!S&&w.map(R=>{const F=N(o,R);return F?n.jsx(v1,{message:F,onClick:()=>y1(R)},R):null}),n.jsxs("div",{className:X("rounded-2xl px-4 py-3",c?"text-white":"bg-zinc-800/80 text-zinc-100"),style:c?{backgroundColor:y}:void 0,children:[c?n.jsx("div",{className:"whitespace-pre-wrap",children:j}):n.jsx(ld,{content:j}),!c&&e.toolCalls&&e.toolCalls.length>0&&n.jsx(N7,{artifacts:w7(e.toolCalls)}),!c&&e.toolCalls&&e.toolCalls.length>0&&n.jsxs("div",{className:"mt-3",children:[n.jsxs("button",{onClick:()=>b(!p),className:"flex items-center gap-2 text-xs text-zinc-400 hover:text-zinc-200 transition-colors",children:[n.jsx(Xi,{className:"h-3 w-3"}),n.jsxs("span",{children:[e.toolCalls.length," tool action",e.toolCalls.length>1?"s":""]}),n.jsx(cl,{className:X("h-3 w-3 transition-transform",p&&"rotate-180")})]}),p&&n.jsx("div",{className:"mt-2 space-y-1.5",children:e.toolCalls.map(R=>n.jsx(k7,{call:R},R.id))})]}),m&&T&&n.jsx("div",{className:"mt-3 rounded-lg border border-zinc-700 bg-zinc-900 p-3 text-xs",children:n.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-zinc-400",children:[((D=e.metadata)==null?void 0:D.model)&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Model:"}),n.jsx("span",{className:"text-zinc-200",children:String(e.metadata.model)})]}),((E=e.metadata)==null?void 0:E.tokens)!==void 0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Tokens:"}),n.jsxs("span",{className:"text-zinc-200",children:[Number(e.metadata.tokens).toLocaleString(),(e.metadata.promptTokens!==void 0||e.metadata.completionTokens!==void 0)&&n.jsxs("span",{className:"text-zinc-500 ml-1",children:["(",Number(e.metadata.promptTokens||0).toLocaleString()," in / ",Number(e.metadata.completionTokens||0).toLocaleString()," out)"]})]})]}),((A=e.metadata)==null?void 0:A.cost)!==void 0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Cost:"}),n.jsxs("span",{className:"text-zinc-200",children:["$",Number(e.metadata.cost).toFixed(6)]})]}),((B=e.metadata)==null?void 0:B.iterations)!==void 0&&Number(e.metadata.iterations)>1&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Iterations:"}),n.jsx("span",{className:"text-zinc-200",children:Number(e.metadata.iterations)})]}),((V=e.metadata)==null?void 0:V.elapsedMs)!==void 0&&Number(e.metadata.elapsedMs)>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Time:"}),n.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`})]}),((ee=e.metadata)==null?void 0:ee.tokensPerSecond)!==void 0&&Number(e.metadata.tokensPerSecond)>0&&n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Speed:"}),n.jsxs("span",{className:"text-zinc-200",children:[Number(e.metadata.tokensPerSecond).toFixed(1)," tok/s"]})]})]})})]}),n.jsxs("div",{className:"flex items-center gap-2 opacity-0 transition-opacity group-hover:opacity-100",children:[n.jsxs("button",{onClick:C,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:[d?n.jsx(ul,{className:"h-3 w-3"}):n.jsx(bv,{className:"h-3 w-3"}),d?"Copied":"Copy"]}),n.jsxs("button",{onClick:r,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:[n.jsx(u0,{className:"h-3 w-3"}),"Reply"]}),!c&&e.toolCalls&&e.toolCalls.length>0&&n.jsxs("button",{onClick:()=>b(!p),className:X("flex h-6 items-center gap-1 rounded px-2 text-xs text-zinc-500 hover:bg-zinc-800 hover:text-zinc-300",p&&"bg-zinc-800 text-zinc-300"),children:[n.jsx(Js,{className:"h-3 w-3"}),"Tools (",e.toolCalls.length,")"]}),T&&n.jsxs("button",{onClick:()=>f(!m),className:X("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:[n.jsx(r0,{className:"h-3 w-3"}),"Info"]}),!c&&n.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:[n.jsx(el,{className:"h-3 w-3"}),"Retry"]})]})]})]})}function Gj(e){return typeof e!="string"?!1:/!\[.*?\]\(data:(?:image|audio)\//.test(e)}function w7(e){const s=[];for(const a of e){if(typeof a.result!="string")continue;const r=a.result.match(/!\[([^\]]*)\]\((data:image\/[^)]+)\)/);if(r){const c=a.result.replace(/!\[[^\]]*\]\(data:[^)]+\)/,"").trim();s.push({type:"image",dataUri:r[2],toolName:a.tool,caption:c||void 0});continue}const o=a.result.match(/!\[([^\]]*)\]\((data:audio\/[^\s)]+(?:\s[^)]*)?)\)/);if(o){const c=o[2].replace(/\s+/g,""),d=a.result.replace(/!\[[^\]]*\]\(data:audio\/[^)]+\)/,"").trim();s.push({type:"audio",dataUri:c,toolName:a.tool,caption:d||void 0})}}return s}function z7({src:e,onClose:s}){return n.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",onClick:s,children:[n.jsx("button",{onClick:s,className:"absolute right-4 top-4 flex h-10 w-10 items-center justify-center rounded-full bg-zinc-800/80 text-zinc-300 hover:bg-zinc-700 hover:text-white transition-colors",children:n.jsx(Gt,{className:"h-5 w-5"})}),n.jsx("img",{src:e,alt:"Full size",className:"max-h-[90vh] max-w-[90vw] rounded-lg object-contain",onClick:a=>a.stopPropagation()})]})}function N7({artifacts:e}){const[s,a]=k.useState(null);return e.length===0?null:n.jsxs(n.Fragment,{children:[s&&n.jsx(z7,{src:s,onClose:()=>a(null)}),n.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:e.map((r,o)=>r.type==="image"?n.jsxs("button",{onClick:()=>a(r.dataUri),className:"group/thumb relative overflow-hidden rounded-lg border border-zinc-700/50 bg-zinc-900/50 transition-colors hover:border-zinc-500",children:[n.jsx("img",{src:r.dataUri,alt:"Generated",className:"h-24 w-24 object-cover sm:h-32 sm:w-32"}),n.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/0 transition-colors group-hover/thumb:bg-black/30",children:n.jsx(bm,{className:"h-5 w-5 text-white opacity-0 transition-opacity group-hover/thumb:opacity-100"})}),r.caption&&n.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/60 to-transparent px-2 py-1",children:n.jsx("span",{className:"text-[10px] text-zinc-300 line-clamp-1",children:r.caption})})]},o):n.jsxs("div",{className:"flex w-full max-w-xs items-center gap-3 rounded-lg border border-zinc-700/50 bg-zinc-900/50 px-3 py-2",children:[n.jsx("div",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-cachi-600/20",children:n.jsx(X4,{className:"h-4 w-4 text-cachi-400"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("audio",{controls:!0,className:"h-8 w-full [&::-webkit-media-controls-panel]:bg-zinc-800",children:n.jsx("source",{src:r.dataUri,type:r.dataUri.split(";")[0].replace("data:","")})}),r.caption&&n.jsx("p",{className:"mt-0.5 truncate text-[10px] text-zinc-500",children:r.caption})]})]},o))})]})}function k7({call:e}){const s=typeof e.result=="string"?e.result:JSON.stringify(e.result??"",null,2),a=Gj(e.result),[r,o]=k.useState(a),c=e.success!==!1,d=Yj(e.tool);return n.jsxs("div",{className:"rounded-lg border border-zinc-700/50 bg-zinc-900/50",children:[n.jsxs("button",{onClick:()=>o(!r),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs",children:[c?n.jsx(ul,{className:"h-3 w-3 flex-shrink-0 text-green-400"}):n.jsx(ui,{className:"h-3 w-3 flex-shrink-0 text-red-400"}),n.jsx(Js,{className:"h-3 w-3 flex-shrink-0 text-zinc-500"}),n.jsx("span",{className:"flex-1 font-mono text-zinc-300 truncate",children:e.tool}),d&&n.jsx("span",{className:"rounded bg-zinc-800 px-1.5 py-0.5 font-mono text-zinc-500 truncate max-w-[140px]",children:d}),n.jsx(cl,{className:X("h-3 w-3 flex-shrink-0 text-zinc-500 transition-transform",r&&"rotate-180")})]}),r&&n.jsx("div",{className:"border-t border-zinc-700/50 px-3 py-2",children:n.jsxs("div",{className:"space-y-2 text-xs",children:[n.jsxs("div",{className:"font-mono",children:[n.jsx("span",{className:"text-zinc-500",children:"Arguments:"}),n.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&&n.jsxs("div",{children:[n.jsx("span",{className:"font-mono text-zinc-500",children:"Result:"}),a?n.jsx("div",{className:"mt-1",children:n.jsx(ld,{content:s})}):n.jsx("pre",{className:"mt-1 max-h-32 overflow-auto rounded bg-zinc-950 p-1.5 font-mono text-zinc-300",children:s})]})]})})]})}const S7={generate_image:"image",generate_audio:"audio",transcribe_audio:"audio"};function Yj(e){var r;const s=S7[e];if(!s)return;const a=xt.getState().getActiveBot();return((r=a==null?void 0:a.models)==null?void 0:r[s])||void 0}function C7({call:e}){const s=typeof e.result=="string"?e.result:JSON.stringify(e.result??"",null,2),a=Gj(e.result),[r,o]=k.useState(a),c=e.endTime!==void 0,d=e.success===!0,h=Yj(e.tool);return k.useEffect(()=>{a&&!r&&o(!0)},[a]),n.jsxs("div",{className:"overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50",children:[n.jsxs("button",{onClick:()=>o(!r),className:"flex w-full items-center gap-3 px-4 py-3 text-left",children:[c?d?n.jsx(ul,{className:"h-4 w-4 text-green-400"}):n.jsx(ui,{className:"h-4 w-4 text-red-400"}):n.jsx(Le,{className:"h-4 w-4 animate-spin text-blue-400"}),n.jsx(Js,{className:"h-4 w-4 text-zinc-500"}),n.jsx("span",{className:"flex-1 font-mono text-sm text-zinc-300",children:e.tool}),h&&n.jsx("span",{className:"rounded bg-zinc-800 px-2 py-0.5 font-mono text-xs text-zinc-400",children:h}),n.jsx(cl,{className:X("h-4 w-4 text-zinc-500 transition-transform",r&&"rotate-180")})]}),r&&n.jsx("div",{className:"border-t border-zinc-800 bg-zinc-950/50 p-4",children:n.jsxs("div",{className:"space-y-3 text-xs",children:[n.jsxs("div",{className:"font-mono",children:[n.jsx("span",{className:"text-zinc-500",children:"Arguments:"}),n.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&&n.jsxs("div",{children:[n.jsx("span",{className:"font-mono text-zinc-500",children:"Result:"}),a?n.jsx("div",{className:"mt-1",children:n.jsx(ld,{content:s})}):n.jsx("pre",{className:"mt-1 overflow-x-auto rounded bg-zinc-900 p-2 font-mono text-zinc-300",children:s})]})]})})]})}function T7({content:e}){return n.jsxs("div",{className:"flex items-start gap-4",children:[n.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-purple-600/20",children:n.jsx(Xi,{className:"h-5 w-5 animate-pulse text-purple-400"})}),n.jsxs("div",{className:"flex-1 rounded-2xl bg-purple-900/20 px-4 py-3",children:[n.jsx("div",{className:"mb-1 text-xs font-medium text-purple-400",children:"Thinking..."}),n.jsx("div",{className:"text-sm text-zinc-400",children:e})]})]})}function E7({botColor:e}){return n.jsxs("div",{className:"flex items-start gap-4",children:[n.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full animate-pulse",style:{backgroundColor:(e||"#22c55e")+"30"},children:n.jsx(Le,{className:"h-5 w-5 animate-spin",style:{color:e||"#22c55e"}})}),n.jsx("div",{className:"flex-1 rounded-2xl bg-zinc-800/50 px-4 py-3",children:n.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[n.jsx("span",{children:"Generating response"}),n.jsxs("span",{className:"flex gap-1",children:[n.jsx("span",{className:"animate-pulse",style:{animationDelay:"0ms"},children:"."}),n.jsx("span",{className:"animate-pulse",style:{animationDelay:"200ms"},children:"."}),n.jsx("span",{className:"animate-pulse",style:{animationDelay:"400ms"},children:"."})]})]})})]})}class A7{constructor(){$e(this,"ws",null);$e(this,"reconnectAttempts",0);$e(this,"maxReconnectAttempts",5);$e(this,"reconnectDelay",1e3);$e(this,"isIntentionalClose",!1);$e(this,"roomId",null);$e(this,"messageHandlers",[]);$e(this,"connectHandlers",[]);$e(this,"disconnectHandlers",[])}connect(s){var d,h;if(((d=this.ws)==null?void 0:d.readyState)===WebSocket.OPEN||((h=this.ws)==null?void 0:h.readyState)===WebSocket.CONNECTING)return;const{accessToken:a}=Ut.getState();if(!a){console.error("Cannot connect room WebSocket: not authenticated");return}this.roomId=s,this.isIntentionalClose=!1;const r=window.location.protocol==="https:"?"wss:":"ws:",o=window.location.host,c=`${r}//${o}/ws/room?token=${encodeURIComponent(a)}&room_id=${encodeURIComponent(s)}`;this.ws=new WebSocket(c),this.ws.onopen=()=>{this.reconnectAttempts=0,this.connectHandlers.forEach(m=>m())},this.ws.onmessage=m=>{try{const f=JSON.parse(m.data);this.messageHandlers.forEach(p=>p(f))}catch(f){console.error("Failed to parse room WebSocket message:",f)}},this.ws.onclose=()=>{this.disconnectHandlers.forEach(m=>m()),this.attemptReconnect()},this.ws.onerror=()=>{}}disconnect(){this.isIntentionalClose=!0,this.ws&&(this.ws.close(),this.ws=null),this.roomId=null}attemptReconnect(){if(this.isIntentionalClose||!this.roomId||this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts++;const s=this.reconnectDelay*Math.pow(2,this.reconnectAttempts-1);setTimeout(()=>{!this.isIntentionalClose&&this.roomId&&this.connect(this.roomId)},s)}send(s,a={}){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:s,payload:a}))}sendChat(s){this.send("room_chat",{message:s})}sendTyping(s){this.send("room_typing",{isTyping:s})}sendCancel(s){this.send("room_cancel",{botId:s})}onMessage(s){return this.messageHandlers.push(s),()=>{this.messageHandlers=this.messageHandlers.filter(a=>a!==s)}}onConnect(s){return this.connectHandlers.push(s),()=>{this.connectHandlers=this.connectHandlers.filter(a=>a!==s)}}onDisconnect(s){return this.disconnectHandlers.push(s),()=>{this.disconnectHandlers=this.disconnectHandlers.filter(a=>a!==s)}}get isConnected(){var s;return((s=this.ws)==null?void 0:s.readyState)===WebSocket.OPEN}}function M7(e){const s=k.useRef(null),[a,r]=k.useState(!1),{addMessage:o,setBotState:c,setTyping:d,addOnlineUser:h,removeOnlineUser:m,setError:f}=$o();k.useEffect(()=>{if(!e){s.current&&(s.current.disconnect(),s.current=null),r(!1);return}const y=new A7;return s.current=y,y.onConnect(()=>r(!0)),y.onDisconnect(()=>r(!1)),y.onMessage(N=>{const S=N.payload;switch(N.type){case"room_message":{const w={id:S.messageId||crypto.randomUUID(),roomId:S.roomId,senderType:S.senderType,senderId:S.senderId,senderName:S.senderName,content:S.content,metadata:{},timestamp:new Date().toISOString()};o(e,w);break}case"room_bot_thinking":c(e,S.botId,"thinking");break;case"room_bot_tool_start":c(e,S.botId,"responding");break;case"room_bot_tool_end":break;case"room_bot_done":c(e,S.botId,"idle");break;case"room_typing_indicator":d(e,S.userId,S.username,S.isTyping);break;case"room_presence":S.status==="online"?h(e,S.userId):(m(e,S.userId),d(e,S.userId,S.username,!1));break;case"room_error":f(S.message),S.botId&&c(e,S.botId,"idle");break}}),y.connect(e),()=>{y.disconnect(),s.current=null,r(!1)}},[e,o,c,d,h,m,f]);const p=k.useCallback(y=>{var N;(N=s.current)==null||N.sendChat(y)},[]),b=k.useCallback(y=>{var N;(N=s.current)==null||N.sendTyping(y)},[]),v=k.useCallback(y=>{var N;(N=s.current)==null||N.sendCancel(y)},[]);return{isConnected:a,sendMessage:p,sendTyping:b,sendCancel:v}}function D7({messages:e}){const s=k.useRef(null);return k.useEffect(()=>{var a;(a=s.current)==null||a.scrollIntoView({behavior:"smooth"})},[e.length]),e.length===0?n.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-zinc-500",children:"No messages yet. Start the conversation!"}):n.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-4",children:n.jsxs("div",{className:"mx-auto max-w-3xl space-y-3",children:[e.map(a=>n.jsx(O7,{message:a},`${a.id}-${a.content.length}`)),n.jsx("div",{ref:s})]})})}function O7({message:e}){if(e.senderType==="system")return n.jsx("div",{className:"py-1 text-center text-xs text-zinc-500",children:e.content});const s=e.senderType==="bot";return n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:X("flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full",s?"bg-accent-600/20 text-accent-600 dark:text-accent-400":"bg-blue-600/20 text-blue-600 dark:text-blue-400"),children:s?n.jsx(Hn,{className:"h-4 w-4"}):n.jsx(fl,{className:"h-4 w-4"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-baseline gap-2",children:[n.jsx("span",{className:X("text-sm font-semibold",s?"text-accent-600 dark:text-accent-400":"text-blue-600 dark:text-blue-400"),children:e.senderName}),n.jsx("span",{className:"text-xs text-zinc-500",children:new Date(e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),n.jsx("div",{className:"mt-0.5 whitespace-pre-wrap text-sm text-zinc-800 dark:text-zinc-200",children:e.content})]})]})}function R7({onSend:e,onTyping:s,bots:a,disabled:r}){const[o,c]=k.useState(""),[d,h]=k.useState(!1),[m,f]=k.useState(""),p=k.useRef(null),b=k.useRef(null),v=k.useCallback(j=>{c(j);const C=j.lastIndexOf("@");if(C>=0){const T=j.slice(C+1);((C>0?j[C-1]:" ")===" "||C===0)&&(!T.includes(" ")||T.length<20?(h(!0),f(T.toLowerCase())):h(!1))}else h(!1);s(!0),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>s(!1),3e3)},[s]),y=k.useCallback(()=>{const j=o.trim();!j||r||(e(j),c(""),h(!1),s(!1),b.current&&clearTimeout(b.current))},[o,r,e,s]),N=k.useCallback(j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),y())},[y]),S=k.useCallback(j=>{var T;const C=o.lastIndexOf("@");if(C>=0){const D=o.slice(0,C);c(`${D}@${j} `)}h(!1),(T=p.current)==null||T.focus()},[o]),w=a.filter(j=>j.botName.toLowerCase().includes(m));return k.useEffect(()=>{p.current&&(p.current.style.height="auto",p.current.style.height=Math.min(p.current.scrollHeight,120)+"px")},[o]),n.jsxs("div",{className:"relative border-t border-zinc-300 px-4 py-3 dark:border-zinc-800",children:[d&&w.length>0&&n.jsx("div",{className:"absolute bottom-full left-4 right-4 z-10 mb-1 rounded-lg border border-zinc-300 bg-white py-1 shadow-lg dark:border-zinc-700 dark:bg-zinc-800",children:w.map(j=>n.jsx("button",{onClick:()=>S(j.botName),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-700",children:n.jsxs("span",{className:"font-medium",children:["@",j.botName]})},j.botId))}),n.jsxs("div",{className:"mx-auto flex max-w-3xl items-end gap-2",children:[n.jsx("textarea",{ref:p,value:o,onChange:j=>v(j.target.value),onKeyDown:N,placeholder:"Type a message... Use @BotName to mention a specific bot",disabled:r,rows:1,className:"max-h-[120px] min-h-[40px] flex-1 resize-none rounded-lg border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900 placeholder-zinc-500 outline-none focus:border-accent-500 focus:ring-1 focus:ring-accent-500 dark:border-zinc-700 dark:bg-zinc-800/50 dark:text-zinc-100"}),n.jsx("button",{onClick:y,disabled:!o.trim()||r,className:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg bg-accent-600 text-white transition-colors hover:bg-accent-500 disabled:opacity-50",children:n.jsx(tl,{className:"h-4 w-4"})})]})]})}function _7({room:e,onClose:s,onUpdate:a}){const{bots:r}=xt(),[o,c]=k.useState(e.title),[d,h]=k.useState(e.description||""),[m,f]=k.useState(e.settings.cooldown_seconds),[p,b]=k.useState(e.settings.auto_relevance),[v,y]=k.useState(""),[N,S]=k.useState(!1),w=async()=>{S(!0);try{const B=await A2(e.id,{title:o.trim()||void 0,description:d.trim()||void 0,settings:{cooldown_seconds:m,auto_relevance:p}});a(B),ke.success("Room updated"),s()}catch(B){ke.error(B instanceof Error?B.message:"Failed to update")}finally{S(!1)}},j=async()=>{if(v.trim())try{await D2(e.id,v.trim()),ke.success(`Invited ${v}`),y("");const{getRoom:B}=await oi(async()=>{const{getRoom:ee}=await Promise.resolve().then(()=>hu);return{getRoom:ee}},void 0),V=await B(e.id);a(V)}catch(B){ke.error(B instanceof Error?B.message:"Failed to invite")}},C=async(B,V)=>{try{await O2(e.id,B),ke.success(`Removed ${V}`);const{getRoom:ee}=await oi(async()=>{const{getRoom:F}=await Promise.resolve().then(()=>hu);return{getRoom:F}},void 0),R=await ee(e.id);a(R)}catch(ee){ke.error(ee instanceof Error?ee.message:"Failed to remove")}},T=async B=>{try{await R2(e.id,B),ke.success("Bot added");const{getRoom:V}=await oi(async()=>{const{getRoom:R}=await Promise.resolve().then(()=>hu);return{getRoom:R}},void 0),ee=await V(e.id);a(ee)}catch(V){ke.error(V instanceof Error?V.message:"Failed to add bot")}},D=async B=>{try{await _2(e.id,B),ke.success("Bot removed");const{getRoom:V}=await oi(async()=>{const{getRoom:R}=await Promise.resolve().then(()=>hu);return{getRoom:R}},void 0),ee=await V(e.id);a(ee)}catch(V){ke.error(V instanceof Error?V.message:"Failed to remove bot")}},E=new Set(e.bots.map(B=>B.botId)),A=r.filter(B=>!E.has(B.id));return n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:n.jsxs("div",{className:"mx-4 max-h-[80vh] w-full max-w-md overflow-y-auto rounded-xl border border-zinc-300 bg-white shadow-2xl dark:border-zinc-700 dark:bg-zinc-900",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-300 px-4 py-3 dark:border-zinc-800",children:[n.jsx("h3",{className:"text-base font-semibold text-zinc-900 dark:text-zinc-100",children:"Room Settings"}),n.jsx("button",{onClick:s,className:"flex h-7 w-7 items-center justify-center rounded text-zinc-500 hover:bg-zinc-200 dark:hover:bg-zinc-800",children:n.jsx(Gt,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"space-y-4 p-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"mb-1 block text-xs font-medium text-zinc-600 dark:text-zinc-400",children:"Title"}),n.jsx("input",{type:"text",value:o,onChange:B=>c(B.target.value),className:"w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900 outline-none dark:border-zinc-700 dark:bg-zinc-800/50 dark:text-zinc-100"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-1 block text-xs font-medium text-zinc-600 dark:text-zinc-400",children:"Description"}),n.jsx("input",{type:"text",value:d,onChange:B=>h(B.target.value),className:"w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900 outline-none dark:border-zinc-700 dark:bg-zinc-800/50 dark:text-zinc-100"})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"mb-1 block text-xs font-medium text-zinc-600 dark:text-zinc-400",children:["Members (",e.members.length,")"]}),n.jsxs("div",{className:"space-y-1 rounded-lg border border-zinc-300 p-2 dark:border-zinc-700",children:[e.members.map(B=>n.jsxs("div",{className:"flex items-center justify-between rounded px-2 py-1 text-sm",children:[n.jsxs("span",{className:"text-zinc-700 dark:text-zinc-300",children:[B.username,B.role==="creator"&&n.jsx("span",{className:"ml-1 text-xs text-zinc-500",children:"(creator)"})]}),B.role!=="creator"&&n.jsx("button",{onClick:()=>C(B.userId,B.username),className:"text-red-400 hover:text-red-300",children:n.jsx(J4,{className:"h-3.5 w-3.5"})})]},B.userId)),n.jsxs("div",{className:"mt-2 flex gap-2",children:[n.jsx("input",{type:"text",value:v,onChange:B=>y(B.target.value),placeholder:"Invite by username",className:"flex-1 rounded border border-zinc-300 px-2 py-1 text-sm outline-none dark:border-zinc-700 dark:bg-zinc-800/50 dark:text-zinc-100",onKeyDown:B=>B.key==="Enter"&&j()}),n.jsx("button",{onClick:j,disabled:!v.trim(),className:"rounded bg-accent-600 px-2 py-1 text-xs text-white hover:bg-accent-500 disabled:opacity-50",children:n.jsx(ed,{className:"h-3.5 w-3.5"})})]})]})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"mb-1 block text-xs font-medium text-zinc-600 dark:text-zinc-400",children:["Bots (",e.bots.length,"/4)"]}),n.jsxs("div",{className:"space-y-1 rounded-lg border border-zinc-300 p-2 dark:border-zinc-700",children:[e.bots.map(B=>n.jsxs("div",{className:"flex items-center justify-between rounded px-2 py-1 text-sm",children:[n.jsx("span",{className:"text-zinc-700 dark:text-zinc-300",children:B.botName}),e.bots.length>2&&n.jsx("button",{onClick:()=>D(B.botId),className:"text-red-400 hover:text-red-300",children:n.jsx(Rv,{className:"h-3.5 w-3.5"})})]},B.botId)),e.bots.length<4&&A.length>0&&n.jsxs("div",{className:"mt-2",children:[n.jsx("p",{className:"mb-1 text-xs text-zinc-500",children:"Add a bot:"}),A.slice(0,5).map(B=>n.jsxs("button",{onClick:()=>T(B.id),className:"flex w-full items-center gap-2 rounded px-2 py-1 text-sm text-zinc-600 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:[n.jsx(En,{icon:B.icon,size:14}),n.jsx("span",{children:B.name}),n.jsx($t,{className:"ml-auto h-3.5 w-3.5 text-zinc-400"})]},B.id))]})]})]}),n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"mb-1 block text-xs font-medium text-zinc-600 dark:text-zinc-400",children:"Cooldown (seconds)"}),n.jsx("input",{type:"number",value:m,onChange:B=>f(Number(B.target.value)),min:1,max:30,className:"w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-sm outline-none dark:border-zinc-700 dark:bg-zinc-800/50 dark:text-zinc-100"})]}),n.jsxs("div",{className:"flex items-center gap-2 pt-4",children:[n.jsx("input",{id:"settings-auto-relevance",type:"checkbox",checked:p,onChange:B=>b(B.target.checked),className:"h-4 w-4 rounded border-zinc-300"}),n.jsx("label",{htmlFor:"settings-auto-relevance",className:"text-xs text-zinc-600 dark:text-zinc-400",children:"Auto-respond"})]})]})]}),n.jsxs("div",{className:"flex justify-end gap-2 border-t border-zinc-300 px-4 py-3 dark:border-zinc-800",children:[n.jsx("button",{onClick:s,className:"rounded-lg px-3 py-1.5 text-sm text-zinc-600 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:"Cancel"}),n.jsx("button",{onClick:w,disabled:N,className:"rounded-lg bg-accent-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-accent-500 disabled:opacity-50",children:N?"Saving...":"Save"})]})]})})}function L7({roomId:e}){const{messages:s,botStates:a,typingUsers:r,onlineUsers:o,setMessages:c,updateRoom:d}=$o(),{isConnected:h,sendMessage:m,sendTyping:f}=M7(e),[p,b]=k.useState(null),[v,y]=k.useState(!1),[N,S]=k.useState(!0),w=Ut(V=>V.user),j=s[e]||[],C=a[e]||{},T=r[e]||[],D=o[e]||[];k.useEffect(()=>{let V=!1;async function ee(){S(!0);try{const[R,F]=await Promise.all([E2(e),L2(e)]);if(V)return;b(R),c(e,F)}catch{}finally{V||S(!1)}}return ee(),()=>{V=!0}},[e,c]);const E=V=>{b(V),d(e,V)};if(N)return n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsx(Le,{className:"h-6 w-6 animate-spin text-zinc-500"})});if(!p)return n.jsx("div",{className:"flex h-full items-center justify-center text-sm text-zinc-500",children:"Room not found"});const A=Object.entries(C).filter(([,V])=>V!=="idle"),B=(w==null?void 0:w.id)===p.creatorId;return n.jsxs("div",{className:"flex h-full flex-col",children:[n.jsxs("div",{className:"flex h-14 items-center justify-between border-b border-zinc-300 px-4 dark:border-zinc-800",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("h2",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-100",children:p.title}),!h&&n.jsx("span",{className:"rounded bg-yellow-500/20 px-1.5 py-0.5 text-[10px] font-medium text-yellow-600 dark:text-yellow-400",children:"Reconnecting..."})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"flex items-center gap-1 text-xs text-zinc-500",children:[n.jsx(Qi,{className:"h-3.5 w-3.5"}),n.jsxs("span",{children:[D.length,"/",p.members.length]})]}),n.jsxs("div",{className:"flex items-center gap-1 text-xs text-zinc-500",children:[n.jsx(Hn,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:p.bots.length})]}),B&&n.jsx("button",{onClick:()=>y(!0),className:"flex h-7 w-7 items-center justify-center rounded text-zinc-500 hover:bg-zinc-200 dark:hover:bg-zinc-800",children:n.jsx(hl,{className:"h-4 w-4"})})]})]}),A.length>0&&n.jsx("div",{className:"flex items-center gap-2 border-b border-zinc-300 px-4 py-1.5 dark:border-zinc-800",children:A.map(([V,ee])=>{const R=p.bots.find(F=>F.botId===V);return n.jsxs("span",{className:X("flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium",ee==="thinking"?"bg-amber-500/20 text-amber-600 dark:text-amber-400":"bg-accent-500/20 text-accent-600 dark:text-accent-400"),children:[n.jsx(Le,{className:"h-3 w-3 animate-spin"}),(R==null?void 0:R.botName)||V," is ",ee==="thinking"?"thinking":"responding","..."]},V)})}),n.jsx(D7,{messages:j}),T.length>0&&n.jsxs("div",{className:"px-4 py-1 text-xs text-zinc-500",children:[T.map(V=>V.username).join(", "),T.length===1?" is":" are"," typing..."]}),n.jsx(R7,{onSend:m,onTyping:f,bots:p.bots,disabled:!h}),v&&p&&n.jsx(_7,{room:p,onClose:()=>y(!1),onUpdate:E})]})}function Qj({onClose:e}){const{bots:s}=xt(),{addRoom:a,setActiveRoom:r}=$o(),[o,c]=k.useState(""),[d,h]=k.useState(""),[m,f]=k.useState([]),[p,b]=k.useState(5),[v,y]=k.useState(!0),[N,S]=k.useState(!1),w=C=>{f(T=>T.includes(C)?T.filter(D=>D!==C):T.length<4?[...T,C]:T)},j=async()=>{if(!o.trim()){ke.error("Title is required");return}if(m.length<2){ke.error("Select at least 2 bots");return}S(!0);try{const C=await T2({title:o.trim(),description:d.trim()||void 0,bot_ids:m,settings:{cooldown_seconds:p,auto_relevance:v}});a(C),r(C.id),ke.success("Room created"),e()}catch(C){ke.error(C instanceof Error?C.message:"Failed to create room")}finally{S(!1)}};return n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:n.jsxs("div",{className:"mx-4 w-full max-w-md rounded-xl border border-zinc-300 bg-white shadow-2xl dark:border-zinc-700 dark:bg-zinc-900",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-300 px-4 py-3 dark:border-zinc-800",children:[n.jsx("h3",{className:"text-base font-semibold text-zinc-900 dark:text-zinc-100",children:"Create Room"}),n.jsx("button",{onClick:e,className:"flex h-7 w-7 items-center justify-center rounded text-zinc-500 hover:bg-zinc-200 dark:hover:bg-zinc-800",children:n.jsx(Gt,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"space-y-4 p-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"mb-1 block text-xs font-medium text-zinc-600 dark:text-zinc-400",children:"Title"}),n.jsx("input",{type:"text",value:o,onChange:C=>c(C.target.value),placeholder:"Room name",className:"w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900 outline-none focus:border-accent-500 dark:border-zinc-700 dark:bg-zinc-800/50 dark:text-zinc-100"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-1 block text-xs font-medium text-zinc-600 dark:text-zinc-400",children:"Description (optional)"}),n.jsx("input",{type:"text",value:d,onChange:C=>h(C.target.value),placeholder:"What's this room for?",className:"w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900 outline-none focus:border-accent-500 dark:border-zinc-700 dark:bg-zinc-800/50 dark:text-zinc-100"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-1 block text-xs font-medium text-zinc-600 dark:text-zinc-400",children:"Select Bots (2-4)"}),n.jsx("div",{className:"max-h-48 space-y-1 overflow-y-auto rounded-lg border border-zinc-300 p-2 dark:border-zinc-700",children:s.map(C=>{const T=m.includes(C.id);return n.jsxs("button",{onClick:()=>w(C.id),className:X("flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left text-sm transition-colors",T?"bg-accent-600/20 text-accent-600 dark:text-accent-400":"text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800"),children:[n.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded",style:{backgroundColor:(C.color||"#666")+"20"},children:n.jsx(En,{icon:C.icon,size:14})}),n.jsx("span",{className:"flex-1",children:C.name}),T?n.jsx(Rv,{className:"h-3.5 w-3.5 text-red-400"}):m.length<4?n.jsx($t,{className:"h-3.5 w-3.5 text-zinc-400"}):null]},C.id)})}),n.jsxs("p",{className:"mt-1 text-xs text-zinc-500",children:[m.length,"/4 bots selected"]})]}),n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"mb-1 block text-xs font-medium text-zinc-600 dark:text-zinc-400",children:"Cooldown (seconds)"}),n.jsx("input",{type:"number",value:p,onChange:C=>b(Number(C.target.value)),min:1,max:30,className:"w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900 outline-none dark:border-zinc-700 dark:bg-zinc-800/50 dark:text-zinc-100"})]}),n.jsxs("div",{className:"flex items-center gap-2 pt-4",children:[n.jsx("input",{id:"auto-relevance",type:"checkbox",checked:v,onChange:C=>y(C.target.checked),className:"h-4 w-4 rounded border-zinc-300 text-accent-600"}),n.jsx("label",{htmlFor:"auto-relevance",className:"text-xs text-zinc-600 dark:text-zinc-400",children:"Auto-respond"})]})]})]}),n.jsxs("div",{className:"flex justify-end gap-2 border-t border-zinc-300 px-4 py-3 dark:border-zinc-800",children:[n.jsx("button",{onClick:e,className:"rounded-lg px-3 py-1.5 text-sm text-zinc-600 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",children:"Cancel"}),n.jsx("button",{onClick:j,disabled:N||m.length<2||!o.trim(),className:"rounded-lg bg-accent-600 px-4 py-1.5 text-sm font-medium text-white hover:bg-accent-500 disabled:opacity-50",children:N?"Creating...":"Create Room"})]})]})})}const U7=Object.freeze(Object.defineProperty({__proto__:null,CreateRoomDialog:Qj},Symbol.toStringTag,{value:"Module"}));function B7(){const{rooms:e,setRooms:s,activeRoomId:a,setActiveRoom:r,deleteRoom:o}=$o(),[c,d]=k.useState(!1),[h,m]=k.useState(!0),[f,p]=k.useState(null);k.useEffect(()=>{async function v(){m(!0);try{const y=await z0();s(y)}catch{}finally{m(!1)}}v()},[s]);const b=async v=>{try{await M2(v),o(v),ke.success("Room deleted")}catch(y){ke.error(y instanceof Error?y.message:"Failed to delete")}p(null)};return a?n.jsx(L7,{roomId:a}):n.jsxs("div",{className:"flex h-full flex-col",children:[n.jsxs("div",{className:"flex h-14 items-center justify-between border-b border-zinc-300 px-6 dark:border-zinc-800",children:[n.jsx("h1",{className:"text-base font-semibold text-zinc-900 dark:text-zinc-100",children:"Rooms"}),n.jsxs("button",{onClick:()=>d(!0),className:"flex items-center gap-1.5 rounded-lg bg-accent-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-accent-500",children:[n.jsx($t,{className:"h-4 w-4"}),"Create Room"]})]}),n.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:h?n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx(Le,{className:"h-6 w-6 animate-spin text-zinc-500"})}):e.length===0?n.jsxs("div",{className:"py-12 text-center",children:[n.jsx(Qi,{className:"mx-auto h-12 w-12 text-zinc-400"}),n.jsx("p",{className:"mt-3 text-sm text-zinc-500",children:"No rooms yet"}),n.jsx("p",{className:"mt-1 text-xs text-zinc-400",children:"Create a room to start a multi-bot conversation"}),n.jsx("button",{onClick:()=>d(!0),className:"mt-4 rounded-lg bg-accent-600 px-4 py-2 text-sm font-medium text-white hover:bg-accent-500",children:"Create Your First Room"})]}):n.jsx("div",{className:"mx-auto max-w-2xl space-y-2",children:e.map(v=>n.jsx(I7,{room:v,active:!1,menuOpen:f===v.id,onSelect:()=>r(v.id),onMenuToggle:()=>p(f===v.id?null:v.id),onDelete:()=>b(v.id)},v.id))})}),c&&n.jsx(Qj,{onClose:()=>d(!1)})]})}function I7({room:e,active:s,menuOpen:a,onSelect:r,onMenuToggle:o,onDelete:c}){return n.jsxs("div",{className:"group relative",children:[n.jsxs("button",{onClick:r,className:X("flex w-full items-start gap-4 rounded-lg border p-4 text-left transition-colors",s?"border-accent-500 bg-accent-500/10":"border-zinc-300 bg-white hover:border-zinc-400 dark:border-zinc-700 dark:bg-zinc-900 dark:hover:border-zinc-600"),children:[n.jsx("div",{className:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg bg-accent-600/20 text-accent-600 dark:text-accent-400",children:n.jsx(Qi,{className:"h-5 w-5"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h3",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-100",children:e.title}),e.description&&n.jsx("p",{className:"mt-0.5 truncate text-xs text-zinc-500",children:e.description}),n.jsxs("div",{className:"mt-2 flex items-center gap-3 text-xs text-zinc-500",children:[n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx(Qi,{className:"h-3 w-3"})," ",e.members.length," members"]}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx(Hn,{className:"h-3 w-3"})," ",e.bots.length," bots"]}),n.jsxs("span",{children:[e.messageCount," messages"]})]})]})]}),n.jsx("button",{onClick:d=>{d.stopPropagation(),o()},className:X("absolute right-3 top-3 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:hover:bg-zinc-700",a&&"opacity-100"),children:n.jsx(n0,{className:"h-4 w-4"})}),a&&n.jsx("div",{className:"absolute right-0 top-10 z-10 w-40 rounded-lg border border-zinc-300 bg-white py-1 shadow-xl dark:border-zinc-700 dark:bg-zinc-800",children:n.jsxs("button",{onClick:d=>{d.stopPropagation(),c()},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:[n.jsx(Vt,{className:"h-4 w-4"}),"Delete Room"]})})]})}function H7(){const{getActiveBot:e}=xt(),{getTasksByBot:s,addTask:a,updateTask:r,deleteTask:o,filter:c,setFilter:d}=sl(),[h,m]=k.useState("kanban"),[f,p]=k.useState(""),[b,v]=k.useState(!1),y=e();if(!y)return null;const S=s(y.id).filter(T=>!f||T.title.toLowerCase().includes(f.toLowerCase())),w=(T,D="todo")=>{const E={id:crypto.randomUUID(),botId:y.id,title:T,status:D,priority:"medium",tags:[],createdAt:new Date().toISOString()};a(E),v(!1)},j=(T,D)=>{r(T,{status:D,completedAt:D==="done"?new Date().toISOString():void 0})},C={todo:S.filter(T=>T.status==="todo").length,in_progress:S.filter(T=>T.status==="in_progress").length,done:S.filter(T=>T.status==="done").length,blocked:S.filter(T=>T.status==="blocked").length};return n.jsxs("div",{className:"flex h-full flex-col bg-zinc-950",children:[n.jsxs("div",{className:"border-b border-zinc-800 px-6 py-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:"Tasks"}),n.jsxs("p",{className:"text-sm text-zinc-500",children:[C.done,"/",S.length," completed"]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center rounded-lg border border-zinc-700 bg-zinc-800/50 p-1",children:[n.jsx("button",{onClick:()=>m("kanban"),className:X("rounded-md p-1.5 transition-colors",h==="kanban"?"bg-zinc-700 text-zinc-100":"text-zinc-400 hover:text-zinc-200"),children:n.jsx(R4,{className:"h-4 w-4"})}),n.jsx("button",{onClick:()=>m("list"),className:X("rounded-md p-1.5 transition-colors",h==="list"?"bg-zinc-700 text-zinc-100":"text-zinc-400 hover:text-zinc-200"),children:n.jsx(U4,{className:"h-4 w-4"})})]}),n.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:[n.jsx($t,{className:"h-4 w-4"}),"Add Task"]})]})]}),n.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[n.jsxs("div",{className:"relative flex-1 max-w-md",children:[n.jsx(Tn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),n.jsx("input",{type:"text",placeholder:"Search tasks...",value:f,onChange:T=>p(T.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"})]}),n.jsxs("select",{value:c.priority,onChange:T=>d({priority:T.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:[n.jsx("option",{value:"all",children:"All priorities"}),n.jsx("option",{value:"high",children:"High"}),n.jsx("option",{value:"medium",children:"Medium"}),n.jsx("option",{value:"low",children:"Low"})]})]})]}),n.jsx("div",{className:"flex-1 overflow-hidden p-6",children:h==="kanban"?n.jsx(P7,{tasks:S,onMoveTask:j,onDeleteTask:o,onAddTask:w}):n.jsx(F7,{tasks:S,onMoveTask:j,onDeleteTask:o})}),b&&n.jsx($7,{onClose:()=>v(!1),onSave:w})]})}const F0=[{id:"todo",label:"To Do",icon:p4,color:"text-zinc-400"},{id:"in_progress",label:"In Progress",icon:Ho,color:"text-blue-400"},{id:"blocked",label:"Blocked",icon:Gs,color:"text-red-400"},{id:"done",label:"Done",icon:wa,color:"text-green-400"}];function P7({tasks:e,onMoveTask:s,onDeleteTask:a,onAddTask:r}){const o=k.useMemo(()=>{const c={todo:[],in_progress:[],blocked:[],done:[]};return e.forEach(d=>{c[d.status].push(d)}),c},[e]);return n.jsx("div",{className:"flex h-full gap-4 overflow-x-auto pb-4",children:F0.map(c=>n.jsxs("div",{className:"flex w-80 flex-shrink-0 flex-col rounded-xl border border-zinc-800 bg-zinc-900/30",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-zinc-800 px-4 py-3",children:[n.jsx(c.icon,{className:X("h-5 w-5",c.color)}),n.jsx("span",{className:"font-medium text-zinc-200",children:c.label}),n.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})]}),n.jsxs("div",{className:"flex-1 space-y-2 overflow-y-auto p-3",children:[o[c.id].map(d=>n.jsx(q7,{task:d,onMove:s,onDelete:a},d.id)),c.id==="todo"&&n.jsxs("button",{onClick:()=>{const d=prompt("Task title:");d&&r(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:[n.jsx($t,{className:"h-4 w-4"}),"Add task"]})]})]},c.id))})}function q7({task:e,onMove:s,onDelete:a}){const[r,o]=k.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 n.jsxs("div",{className:X("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:[n.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)"}}),n.jsxs("div",{className:"ml-2",children:[n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsx("span",{className:X("text-sm font-medium",e.status==="done"?"text-zinc-500 line-through":"text-zinc-200"),children:e.title}),n.jsx("button",{onClick:()=>o(!r),className:"flex-shrink-0 rounded p-1 text-zinc-500 opacity-0 transition-opacity hover:bg-zinc-700 group-hover:opacity-100",children:n.jsx(n0,{className:"h-4 w-4"})})]}),e.description&&n.jsx("p",{className:"mt-1 text-xs text-zinc-500 line-clamp-2",children:e.description}),e.tags.length>0&&n.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:e.tags.map(h=>n.jsx("span",{className:"rounded bg-zinc-700 px-1.5 py-0.5 text-xs text-zinc-400",children:h},h))}),n.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[n.jsxs("div",{className:X("flex items-center gap-1 rounded px-1.5 py-0.5 text-xs",d.bg,d.color),children:[n.jsx(z4,{className:"h-3 w-3"}),e.priority]}),e.dueDate&&n.jsxs("div",{className:"flex items-center gap-1 text-xs text-zinc-500",children:[n.jsx(e0,{className:"h-3 w-3"}),new Date(e.dueDate).toLocaleDateString()]})]})]}),r&&n.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:[F0.filter(h=>h.id!==e.status).map(h=>n.jsxs("button",{onClick:()=>{s(e.id,h.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:[n.jsx(mv,{className:"h-4 w-4"}),"Move to ",h.label]},h.id)),n.jsx("div",{className:"my-1 h-px bg-zinc-700"}),n.jsxs("button",{onClick:()=>{a(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:[n.jsx(Vt,{className:"h-4 w-4"}),"Delete"]})]})]})}function F7({tasks:e,onMoveTask:s,onDeleteTask:a}){return n.jsxs("div",{className:"space-y-1",children:[e.map(r=>n.jsxs("div",{className:"flex items-center gap-4 rounded-lg border border-zinc-800 bg-zinc-900/30 px-4 py-3",children:[n.jsx("button",{onClick:()=>s(r.id,r.status==="done"?"todo":"done"),className:X("flex h-5 w-5 items-center justify-center rounded border transition-colors",r.status==="done"?"border-green-500 bg-green-500 text-white":"border-zinc-600 hover:border-cachi-500"),children:r.status==="done"&&n.jsx(wa,{className:"h-4 w-4"})}),n.jsx("span",{className:X("flex-1",r.status==="done"?"text-zinc-500 line-through":"text-zinc-200"),children:r.title}),n.jsx("div",{className:"flex items-center gap-2",children:r.tags.map(o=>n.jsx("span",{className:"rounded bg-zinc-700 px-2 py-0.5 text-xs text-zinc-400",children:o},o))}),n.jsx("div",{className:X("rounded px-2 py-0.5 text-xs font-medium",r.priority==="high"&&"bg-red-500/20 text-red-400",r.priority==="medium"&&"bg-yellow-500/20 text-yellow-400",r.priority==="low"&&"bg-zinc-700 text-zinc-400"),children:r.priority}),n.jsx("select",{value:r.status,onChange:o=>s(r.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:F0.map(o=>n.jsx("option",{value:o.id,children:o.label},o.id))}),n.jsx("button",{onClick:()=>a(r.id),className:"rounded p-1 text-zinc-500 hover:bg-zinc-800 hover:text-red-400",children:n.jsx(Vt,{className:"h-4 w-4"})})]},r.id)),e.length===0&&n.jsx("div",{className:"py-12 text-center text-zinc-500",children:"No tasks yet"})]})}function $7({onClose:e,onSave:s}){const[a,r]=k.useState(""),o=c=>{c.preventDefault(),a.trim()&&s(a.trim(),"todo")};return n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:n.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-zinc-800 bg-zinc-900 p-6 shadow-2xl",children:[n.jsx("h2",{className:"mb-4 text-lg font-bold text-zinc-100",children:"New Task"}),n.jsxs("form",{onSubmit:o,children:[n.jsx("input",{type:"text",placeholder:"Task title...",value:a,onChange:c=>r(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"}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:e,className:"rounded-lg px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800",children:"Cancel"}),n.jsx("button",{type:"submit",disabled:!a.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 Kf(e,s){return s.type==="number"&&typeof e=="number"?s.unit==="chars"&&e>=1e3?`${(e/1e3).toFixed(0)}k ${s.unit}`:s.unit?`${e} ${s.unit}`:String(e):String(e)}function V7({tool:e,botId:s,currentConfigs:a,isOpen:r,onClose:o}){const{updateBot:c}=xt(),d=e.configParams||[],h=d.length>0,[m,f]=k.useState({});k.useEffect(()=>{if(!r)return;const j=e.configParams||[],C={},T=a==null?void 0:a[e.id];for(const D of j){const E=T==null?void 0:T[D.name];C[D.name]=E!==void 0?E:D.default}f(C)},[r,e.id,e.configParams,a]);const p=()=>{const j={...a};j[e.id]={...m},c(s,{toolConfigs:j}),o()},b=()=>{const j={};for(const C of d)j[C.name]=C.default;f(j)},v=(j,C)=>{f(T=>({...T,[j]:C}))},[y,N]=k.useState(new Set),S=j=>{N(C=>{const T=new Set(C);return T.has(j)?T.delete(j):T.add(j),T})};if(!r)return null;const w=j=>{const C=m[j.name];switch(j.type){case"number":{const T=typeof C=="number"?C:j.default??0;return n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),n.jsx("span",{className:"text-sm text-zinc-400",children:Kf(T,j)})]}),n.jsx("input",{type:"range",min:j.min??0,max:j.max??100,step:j.step??1,value:T,onChange:D=>v(j.name,Number(D.target.value)),className:"w-full accent-cachi-500"}),n.jsxs("div",{className:"flex justify-between text-xs text-zinc-500",children:[n.jsx("span",{children:Kf(j.min??0,j)}),n.jsx("span",{children:Kf(j.max??100,j)})]}),j.description&&n.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"boolean":{const T=typeof C=="boolean"?C:!!j.default;return n.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-800 p-4",children:[n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-medium text-zinc-200",children:j.displayName||j.name}),j.description&&n.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]}),n.jsx("button",{onClick:()=>v(j.name,!T),className:X("relative h-6 w-11 rounded-full transition-colors",T?"bg-cachi-600":"bg-zinc-700"),children:n.jsx("span",{className:X("absolute top-0.5 h-5 w-5 rounded-full bg-white transition-transform",T?"left-[22px]":"left-0.5")})})]},j.name)}case"select":{const T=String(C??j.default??"");return n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),n.jsx("select",{value:T,onChange:D=>v(j.name,D.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(D=>n.jsx("option",{value:D,children:D},D))}),j.description&&n.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"string":{const T=String(C??j.default??"");return n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),n.jsx("input",{type:"text",value:T,onChange:D=>v(j.name,D.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&&n.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"secret":{const T=String(C??j.default??""),D=y.has(j.name);return n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:D?"text":"password",value:T,onChange:E=>v(j.name,E.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"}),n.jsx("button",{type:"button",onClick:()=>S(j.name),className:"absolute right-2 top-1/2 -translate-y-1/2 text-zinc-500 hover:text-zinc-300",children:D?n.jsx(Vi,{className:"h-4 w-4"}):n.jsx(za,{className:"h-4 w-4"})})]}),j.description&&n.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"text":{const T=String(C??j.default??"");return n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),n.jsx("textarea",{value:T,onChange:D=>v(j.name,D.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&&n.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"path":{const T=String(C??j.default??""),E=j.pathType==="directory"?Qu:j.pathType==="file"?Na:B4;return n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),n.jsxs("div",{className:"relative",children:[n.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-zinc-500",children:n.jsx(E,{className:"h-4 w-4"})}),n.jsx("input",{type:"text",value:T,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&&n.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&&n.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"string[]":case"number[]":{const T=j.type==="number[]",D=Array.isArray(C)?C:Array.isArray(j.default)?j.default:[],E=j.maxItems===void 0||D.length<j.maxItems,A=j.minItems===void 0||D.length>j.minItems,B=V=>{v(j.name,V)};return n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),n.jsxs("span",{className:"text-xs text-zinc-500",children:[D.length,j.maxItems!==void 0?` / ${j.maxItems}`:""," items"]})]}),n.jsx("div",{className:"space-y-2",children:D.map((V,ee)=>n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:T?"number":"text",value:V,onChange:R=>{const F=[...D];F[ee]=T?Number(R.target.value):R.target.value,B(F)},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"}),n.jsx("button",{onClick:()=>{A&&B(D.filter((R,F)=>F!==ee))},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:n.jsx(Vt,{className:"h-3.5 w-3.5"})})]},ee))}),n.jsxs("button",{onClick:()=>{E&&B([...D,T?0:""])},disabled:!E,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:[n.jsx($t,{className:"h-3.5 w-3.5"}),"Add item"]}),j.description&&n.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"map":{const T=Array.isArray(C)?C:Array.isArray(j.default)?j.default:[],D=j.maxItems===void 0||T.length<j.maxItems,E=A=>{v(j.name,A)};return n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),n.jsxs("span",{className:"text-xs text-zinc-500",children:[T.length,j.maxItems!==void 0?` / ${j.maxItems}`:""," entries"]})]}),n.jsx("div",{className:"space-y-2",children:T.map(([A,B],V)=>n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:A,onChange:ee=>{const R=[...T];R[V]=[ee.target.value,B],E(R)},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"}),n.jsx("input",{type:"text",value:B,onChange:ee=>{const R=[...T];R[V]=[A,ee.target.value],E(R)},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"}),n.jsx("button",{onClick:()=>E(T.filter((ee,R)=>R!==V)),className:"rounded-lg p-1.5 text-zinc-500 hover:bg-zinc-800 hover:text-red-400",children:n.jsx(Vt,{className:"h-3.5 w-3.5"})})]},V))}),n.jsxs("button",{onClick:()=>{D&&E([...T,["",""]])},disabled:!D,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:[n.jsx($t,{className:"h-3.5 w-3.5"}),"Add entry"]}),j.description&&n.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"multiselect":{const T=Array.isArray(C)?C:Array.isArray(j.default)?j.default:[],D=j.options||[],E=A=>{const B=T.includes(A)?T.filter(V=>V!==A):[...T,A];v(j.name,B)};return n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),n.jsxs("span",{className:"text-xs text-zinc-500",children:[T.length," / ",D.length," selected"]})]}),n.jsx("div",{className:"flex flex-wrap gap-2",children:D.map(A=>{const B=T.includes(A);return n.jsxs("button",{onClick:()=>E(A),className:X("flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-xs transition-colors",B?"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:[B&&n.jsx(dn,{className:"h-3 w-3"}),A]},A)})}),j.description&&n.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"url":{const T=String(C??j.default??"");return n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),n.jsxs("div",{className:"relative",children:[n.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-zinc-500",children:n.jsx(L4,{className:"h-4 w-4"})}),n.jsx("input",{type:"url",value:T,onChange:D=>v(j.name,D.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&&n.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"code":{const T=String(C??j.default??"");return n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),j.language&&n.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:[n.jsx(Js,{className:"h-3 w-3"}),j.language]})]}),n.jsx("textarea",{value:T,onChange:D=>v(j.name,D.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&&n.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}default:return null}};return n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:n.jsxs("div",{className:"w-full max-w-md rounded-xl bg-zinc-900 shadow-xl",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 p-4",children:[n.jsxs("div",{children:[n.jsxs("h2",{className:"text-lg font-semibold text-zinc-100",children:["Configure ",e.name]}),n.jsx("p",{className:"text-sm text-zinc-500",children:e.description})]}),n.jsx("button",{onClick:o,className:"rounded-lg p-2 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:n.jsx(Gt,{className:"h-5 w-5"})})]}),n.jsx("div",{className:"max-h-[60vh] overflow-y-auto p-4",children:h?n.jsx("div",{className:"space-y-6",children:d.map(w)}):n.jsx("div",{className:"py-8 text-center text-zinc-500",children:"No configuration options available for this tool."})}),n.jsxs("div",{className:"flex justify-between border-t border-zinc-800 p-4",children:[n.jsxs("button",{onClick:b,disabled:!h,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:[n.jsx(el,{className:"h-4 w-4"}),"Reset to Defaults"]}),n.jsxs("div",{className:"flex gap-3",children:[n.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"}),n.jsxs("button",{onClick:p,disabled:!h,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:[n.jsx(Fo,{className:"h-4 w-4"}),"Save"]})]})]})]})})}const G7="/api";let Y7=class extends Error{constructor(s,a,r){super(s),this.status=a,this.data=r,this.name="ApiError"}};function Q7(){const{accessToken:e}=Ut.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function Jj(e,s={},a=!0){const r=`${G7}${e}`,o=await fetch(r,{headers:{"Content-Type":"application/json",...Q7(),...s.headers},...s});if(o.status===401&&a&&await As())return Jj(e,s,!1);if(!o.ok){const c=await o.json().catch(()=>({}));throw new Y7(c.detail||`Request failed: ${o.statusText}`,o.status,c)}return o.json()}async function J7(){return(await Jj("/plugins")).plugins}const X7={file:"filesystem",code:"code",task:"system",platform:"web",work:"data",git:"system",shell:"system",web:"web",http:"web",sql:"data",compression:"filesystem",general:"custom"},Xj={filesystem:{label:"Filesystem",icon:Na},code:{label:"Code",icon:Js},web:{label:"Connections",icon:a0},system:{label:"System",icon:Zu},data:{label:"Work",icon:Po},custom:{label:"Custom",icon:Iv}};function Bm(e){return e.split("_").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function K7(e){return typeof e=="string"?{id:e,name:Bm(e),description:"",category:"custom",icon:e,enabled:!0,riskLevel:"safe"}:{id:e.name,name:e.displayName||Bm(e.name),description:e.description,category:X7[e.category]||"custom",icon:e.icon||e.name,enabled:!0,riskLevel:e.riskLevel||"safe",configParams:e.configParams}}function Z7(){const{getActiveBot:e,updateBot:s}=xt(),[a,r]=k.useState(""),[o,c]=k.useState("all"),[d,h]=k.useState(null),[m,f]=k.useState(null),[p,b]=k.useState([]),[v,y]=k.useState(!0),[N,S]=k.useState(null),w=e();if(k.useEffect(()=>{let U=!1;return y(!0),S(null),J7().then(H=>{U||b(H)}).catch(H=>{U||S(H.message||"Failed to load plugins")}).finally(()=>{U||y(!1)}),()=>{U=!0}},[]),!w)return null;const j=p.map(U=>{const H=U.skills.map(K7);return{plugin:U,tools:H}}),C=j.map(({plugin:U,tools:H})=>({plugin:U,tools:H.filter(I=>!(a&&!I.name.toLowerCase().includes(a.toLowerCase())||o!=="all"&&I.category!==o))})).filter(({tools:U})=>U.length>0),T=j.flatMap(({tools:U})=>U.map(H=>H.id)),D=w.tools.filter(U=>T.includes(U)).length,E=U=>{const H=w.tools,I=H.includes(U)?H.filter(W=>W!==U):[...H,U];s(w.id,{tools:I})},A=U=>w.tools.includes(U),B=["safe","moderate","dangerous","critical"],V={safe:{icon:ps,color:"text-green-500",bg:"bg-green-500/10",border:"border-green-500/30"},moderate:{icon:Xu,color:"text-yellow-500",bg:"bg-yellow-500/10",border:"border-yellow-500/30"},dangerous:{icon:h0,color:"text-red-500",bg:"bg-red-500/10",border:"border-red-500/30"},critical:{icon:d0,color:"text-red-600",bg:"bg-red-600/10",border:"border-red-600/30"}},ee=U=>j.flatMap(({tools:H})=>H.filter(I=>I.riskLevel===U)),R=U=>{const H=ee(U);if(H.length===0)return;const I=H.every(re=>w.tools.includes(re.id));let W;if(I){const re=new Set(H.map(he=>he.id));W=w.tools.filter(he=>!re.has(he))}else{const re=H.map(he=>he.id).filter(he=>!w.tools.includes(he));W=[...w.tools,...re]}s(w.id,{tools:W})},F=()=>{const U=j.flatMap(({tools:H})=>H.map(I=>I.id));s(w.id,{tools:[...new Set([...w.tools,...U])]})},_=()=>{const U=new Set(j.flatMap(({tools:H})=>H.map(I=>I.id)));s(w.id,{tools:w.tools.filter(H=>!U.has(H))})},se=new Set;for(const{tools:U}of j)for(const H of U)se.add(H.category);return n.jsxs("div",{className:"flex h-full bg-zinc-950",children:[n.jsxs("div",{className:"flex-1 overflow-y-auto",children:[n.jsxs("div",{className:"border-b border-zinc-800 px-6 py-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:"Tools"}),n.jsxs("p",{className:"text-sm text-zinc-500",children:[D," tools enabled for ",w.name]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[B.map(U=>{const H=V[U],I=H.icon,W=ee(U),re=W.filter(P=>w.tools.includes(P.id)).length,he=W.length;if(he===0)return null;const L=re===he;return n.jsxs("button",{onClick:()=>R(U),title:L?`Disable all ${U} tools`:`Enable all ${U} tools`,className:X("flex items-center gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs transition-colors",L?`${H.bg} ${H.border} ${H.color}`:"border-zinc-700 bg-zinc-800/50 text-zinc-500 hover:border-zinc-600 hover:text-zinc-400"),children:[n.jsx(I,{className:"h-3.5 w-3.5"}),n.jsx("span",{className:"capitalize",children:U}),n.jsxs("span",{className:X("rounded-full px-1.5 py-0.5 text-[10px] font-medium leading-none",L?"bg-white/10":"bg-zinc-700"),children:[re,"/",he]})]},U)}),n.jsx("div",{className:"mx-1 h-5 w-px bg-zinc-700"}),n.jsx("button",{onClick:F,className:"rounded-lg px-2 py-1.5 text-xs text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:"All on"}),n.jsx("button",{onClick:_,className:"rounded-lg px-2 py-1.5 text-xs text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:"All off"})]})]}),n.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(Tn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),n.jsx("input",{type:"text",placeholder:"Search tools...",value:a,onChange:U=>r(U.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"})]}),n.jsxs("div",{className:"flex items-center gap-1 rounded-lg border border-zinc-700 bg-zinc-800/50 p-1",children:[n.jsx("button",{onClick:()=>c("all"),className:X("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(Xj).filter(([U])=>se.has(U)).map(([U,H])=>n.jsx("button",{onClick:()=>c(U),className:X("rounded-md px-3 py-1 text-xs font-medium transition-colors",o===U?"bg-zinc-700 text-zinc-100":"text-zinc-400 hover:text-zinc-200"),children:H.label},U))]})]})]}),n.jsxs("div",{className:"p-6",children:[v&&n.jsxs("div",{className:"flex items-center justify-center py-12 text-zinc-500",children:[n.jsx(Le,{className:"mr-2 h-5 w-5 animate-spin"}),"Loading plugins..."]}),N&&n.jsxs("div",{className:"flex items-center justify-center gap-2 py-12 text-red-400",children:[n.jsx(Gs,{className:"h-5 w-5"}),N]}),!v&&!N&&C.length===0&&n.jsx("div",{className:"py-12 text-center text-zinc-500",children:"No tools match your search"}),!v&&!N&&C.map(({plugin:U,tools:H})=>{const I=U.displayName||Bm(U.name),W=tC(U.icon);return n.jsxs("div",{className:"mb-8",children:[n.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[n.jsx(W,{className:"h-5 w-5 text-zinc-500"}),n.jsx("h2",{className:"text-sm font-semibold text-zinc-300",children:I}),n.jsx("span",{className:"rounded-full bg-zinc-800 px-2 py-0.5 text-xs text-zinc-500",children:H.length}),U.capability&&n.jsx("span",{className:"rounded-full bg-zinc-800/50 px-2 py-0.5 text-xs text-zinc-600",children:U.capability}),U.alwaysEnabled&&n.jsx("span",{className:"rounded-full bg-green-500/10 px-2 py-0.5 text-xs text-green-500",children:"always on"})]}),n.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:H.map(re=>n.jsx(W7,{tool:re,enabled:A(re.id),onToggle:()=>E(re.id),onSelect:()=>h(re),onConfigure:()=>f(re)},re.id))})]},U.name)})]})]}),d&&n.jsx(eD,{tool:d,enabled:A(d.id),onToggle:()=>E(d.id),onClose:()=>h(null)}),m&&n.jsx(V7,{tool:m,botId:w.id,currentConfigs:w.toolConfigs,isOpen:!!m,onClose:()=>f(null)})]})}function W7({tool:e,enabled:s,onToggle:a,onSelect:r,onConfigure:o}){const c={safe:{icon:ps,color:"text-green-500",bg:"bg-green-500/10"},moderate:{icon:Xu,color:"text-yellow-500",bg:"bg-yellow-500/10"},dangerous:{icon:h0,color:"text-red-500",bg:"bg-red-500/10"},critical:{icon:d0,color:"text-red-600",bg:"bg-red-600/10"}},d=c[e.riskLevel]||c.safe,h=d.icon;return n.jsxs("div",{className:X("group relative rounded-xl border p-4 transition-all",s?"border-cachi-500/50 bg-cachi-500/5":"border-zinc-800 bg-zinc-900/30 hover:border-zinc-700"),children:[n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-zinc-800",children:n.jsx(N0,{toolId:e.id,icon:e.icon,className:"h-5 w-5 text-zinc-300"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-medium text-zinc-200",children:e.name}),n.jsxs("div",{className:X("flex items-center gap-1 text-xs",d.color),children:[n.jsx(h,{className:"h-3 w-3"}),e.riskLevel]})]})]}),n.jsx("button",{onClick:m=>{m.stopPropagation(),a()},className:X("transition-colors",s?"text-cachi-500":"text-zinc-600"),children:s?n.jsx(fi,{className:"h-6 w-6"}):n.jsx(hi,{className:"h-6 w-6"})})]}),n.jsx("p",{className:"mt-3 text-sm text-zinc-500 line-clamp-2",children:e.description}),n.jsxs("div",{className:"mt-3 flex items-center gap-2 opacity-0 transition-opacity group-hover:opacity-100",children:[n.jsxs("button",{onClick:r,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:[n.jsx(r0,{className:"h-3 w-3"}),"Details"]}),e.configParams&&e.configParams.length>0&&n.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:[n.jsx(hl,{className:"h-3 w-3"}),"Configure"]})]})]})}function eD({tool:e,enabled:s,onToggle:a,onClose:r}){var h;const o={safe:{icon:ps,color:"text-green-500",bg:"bg-green-500/10",border:"border-green-500/30"},moderate:{icon:Xu,color:"text-yellow-500",bg:"bg-yellow-500/10",border:"border-yellow-500/30"},dangerous:{icon:h0,color:"text-red-500",bg:"bg-red-500/10",border:"border-red-500/30"},critical:{icon:d0,color:"text-red-600",bg:"bg-red-600/10",border:"border-red-600/30"}},c=o[e.riskLevel]||o.safe,d=c.icon;return n.jsxs("div",{className:"w-96 flex-shrink-0 border-l border-zinc-800 bg-zinc-900/50",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 px-4 py-3",children:[n.jsx("h2",{className:"font-semibold text-zinc-100",children:"Tool Details"}),n.jsx("button",{onClick:r,className:"rounded p-1 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:"x"})]}),n.jsxs("div",{className:"p-4",children:[n.jsxs("div",{className:"mb-6 flex items-center gap-4",children:[n.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-xl bg-zinc-800",children:n.jsx(N0,{toolId:e.id,icon:e.icon,className:"h-7 w-7 text-zinc-300"})}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-bold text-zinc-100",children:e.name}),n.jsx("p",{className:"text-sm text-zinc-500",children:((h=Xj[e.category])==null?void 0:h.label)||e.category})]})]}),n.jsxs("div",{className:X("mb-6 rounded-lg border p-4",c.bg,c.border),children:[n.jsxs("div",{className:X("flex items-center gap-2",c.color),children:[n.jsx(d,{className:"h-5 w-5"}),n.jsxs("span",{className:"font-medium capitalize",children:[e.riskLevel," Risk"]})]}),n.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."]})]}),n.jsxs("div",{className:"mb-6",children:[n.jsx("h4",{className:"mb-2 text-sm font-medium text-zinc-300",children:"Description"}),n.jsx("p",{className:"text-sm text-zinc-500",children:e.description})]}),e.parameters&&e.parameters.length>0&&n.jsxs("div",{className:"mb-6",children:[n.jsx("h4",{className:"mb-2 text-sm font-medium text-zinc-300",children:"Parameters"}),n.jsx("div",{className:"space-y-2",children:e.parameters.map(m=>n.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900 p-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"font-mono text-sm text-cachi-400",children:m.name}),n.jsx("span",{className:"rounded bg-zinc-800 px-1.5 py-0.5 text-xs text-zinc-500",children:m.type}),m.required&&n.jsx("span",{className:"rounded bg-red-500/20 px-1.5 py-0.5 text-xs text-red-400",children:"required"})]}),n.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:m.description})]},m.name))})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:a,className:X("flex flex-1 items-center justify-center gap-2 rounded-lg py-2 text-sm font-medium transition-colors",s?"bg-red-600/20 text-red-400 hover:bg-red-600/30":"bg-cachi-600 text-white hover:bg-cachi-500"),children:s?n.jsxs(n.Fragment,{children:[n.jsx(hi,{className:"h-4 w-4"}),"Disable"]}):n.jsxs(n.Fragment,{children:[n.jsx(fi,{className:"h-4 w-4"}),"Enable"]})}),n.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:[n.jsx(Ju,{className:"h-4 w-4"}),"Test"]})]})]})]})}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"};function nD(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 sD(e){return tD[e]||e.charAt(0).toUpperCase()+e.slice(1)}function $i({value:e,onChange:s,placeholder:a="System Default",className:r="",filter:o,groups:c}){const d=Wn(),{refresh:h,loading:m}=d,f=c??d.groups,[p,b]=k.useState(!1),[v,y]=k.useState(""),[N,S]=k.useState(!1),[w,j]=k.useState(""),C=k.useRef(null),T=k.useRef(null),D=k.useRef(null),E=k.useRef(null),[A,B]=k.useState({top:0,left:0,width:0});k.useEffect(()=>{h()},[h]);const V=k.useCallback(()=>{if(C.current){const _=C.current.getBoundingClientRect();B({top:_.bottom+4,left:_.left,width:_.width})}},[]);k.useEffect(()=>{if(!p)return;const _=se=>{C.current&&!C.current.contains(se.target)&&T.current&&!T.current.contains(se.target)&&(b(!1),S(!1))};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[p]),k.useEffect(()=>{if(p)return V(),window.addEventListener("scroll",V,!0),window.addEventListener("resize",V),()=>{window.removeEventListener("scroll",V,!0),window.removeEventListener("resize",V)}},[p,V]),k.useEffect(()=>{p&&!N&&D.current&&D.current.focus()},[p,N]),k.useEffect(()=>{N&&E.current&&E.current.focus()},[N]);const ee=k.useMemo(()=>{const _=v.toLowerCase().trim(),se={};for(const[U,H]of Object.entries(f)){let I=H;o&&(I=I.filter(o)),_&&(I=I.filter(W=>W.id.toLowerCase().includes(_)||U.toLowerCase().includes(_))),I.length>0&&(se[U]=I)}return se},[f,v,o]),R=Object.values(ee).reduce((_,se)=>_+se.length,0),F=()=>{const _=w.trim();_&&s(_),b(!1),S(!1),j("")};return n.jsxs("div",{className:X("relative",r),children:[n.jsxs("button",{ref:C,type:"button",onClick:()=>{b(!p),y(""),S(!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:[n.jsx("span",{className:X("truncate",e?"text-zinc-900 font-mono text-xs dark:text-zinc-100":"text-zinc-500"),children:e||a}),n.jsx(cl,{className:"absolute right-3 top-1/2 -translate-y-1/2 text-zinc-500 h-4 w-4 pointer-events-none"})]}),p&&Jm.createPortal(n.jsx("div",{ref:T,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:A.top,left:A.left,width:Math.max(A.width,300)},children:N?n.jsxs("div",{className:"p-2",children:[n.jsx("p",{className:"text-[10px] text-zinc-500 mb-1.5 px-1",children:"Enter model in provider/model format"}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{ref:E,type:"text",value:w,onChange:_=>j(_.target.value),onKeyDown:_=>{_.key==="Enter"&&F(),_.key==="Escape"&&(S(!1),j(""))},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"}),n.jsx("button",{type:"button",onClick:F,disabled:!w.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"})]})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"p-2 border-b border-zinc-200 dark:border-zinc-800",children:n.jsxs("div",{className:"relative",children:[n.jsx(Tn,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-zinc-500 h-3.5 w-3.5"}),n.jsx("input",{ref:D,type:"text",value:v,onChange:_=>y(_.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"})]})}),n.jsxs("div",{className:"max-h-64 overflow-y-auto",children:[m&&n.jsx("div",{className:"px-3 py-6 text-center text-xs text-zinc-500",children:"Discovering models..."}),!v&&!m&&n.jsxs("button",{type:"button",onClick:()=>{s(""),b(!1)},className:X("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:[n.jsx("span",{children:a}),!e&&n.jsx(dn,{className:"h-3.5 w-3.5 text-cachi-500"})]}),!m&&Object.entries(ee).sort(([_],[se])=>_.localeCompare(se)).map(([_,se])=>n.jsxs("div",{children:[n.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:[sD(_),n.jsx("span",{className:"ml-1.5 text-zinc-400 dark:text-zinc-600",children:se.length})]}),se.map(U=>{const H=e===U.id,I=nD(U.context_window);return n.jsxs("button",{type:"button",onClick:()=>{s(U.id),b(!1)},className:X("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",H?"text-cachi-600 bg-cachi-500/5 dark:text-cachi-400":"text-zinc-700 dark:text-zinc-300"),children:[n.jsx("span",{className:"truncate font-mono text-xs",children:U.id}),n.jsxs("span",{className:"flex items-center gap-2 shrink-0",children:[I&&n.jsx("span",{className:"text-[10px] text-zinc-500 dark:text-zinc-600",children:I}),U.supports_vision&&n.jsx("span",{className:"text-[9px] bg-zinc-200 text-zinc-600 px-1 rounded dark:bg-zinc-800 dark:text-zinc-400",children:"vision"}),U.is_reasoning&&n.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"}),H&&n.jsx(dn,{className:"h-3.5 w-3.5 text-cachi-500"})]})]},U.id)})]},_)),!m&&R===0&&n.jsx("div",{className:"px-3 py-6 text-center text-xs text-zinc-500",children:Object.keys(f).length===0?"No models available. Configure API keys first.":"No models match your search."})]}),n.jsx("div",{className:"border-t border-zinc-200 dark:border-zinc-800",children:n.jsxs("button",{type:"button",onClick:()=>{j(e||""),S(!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:[n.jsx(o0,{className:"h-3 w-3"}),"Enter manually"]})})]})}),document.body)]})}const Zf=[".pdf",".txt",".md",".docx"],Wf=10;function aD({botId:e}){const{uploadDocument:s,uploadingBots:a,error:r,clearError:o}=Qs(),[c,d]=k.useState(!1),h=a.has(e),m=k.useCallback(async y=>{var S;const N="."+((S=y.name.split(".").pop())==null?void 0:S.toLowerCase());if(!Zf.includes(N)){alert(`File type not allowed. Allowed: ${Zf.join(", ")}`);return}if(y.size>Wf*1024*1024){alert(`File too large. Maximum: ${Wf}MB`);return}o();try{await s(e,y)}catch{}},[e,s,o]),f=k.useCallback(y=>{y.preventDefault(),d(!1);const N=y.dataTransfer.files[0];N&&m(N)},[m]),p=k.useCallback(y=>{y.preventDefault(),d(!0)},[]),b=k.useCallback(y=>{y.preventDefault(),d(!1)},[]),v=k.useCallback(()=>{const y=document.createElement("input");y.type="file",y.accept=Zf.join(","),y.onchange=N=>{var w;const S=(w=N.target.files)==null?void 0:w[0];S&&m(S)},y.click()},[m]);return n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{onClick:h?void 0:v,onDrop:h?void 0:f,onDragOver:p,onDragLeave:b,className:`
          border-2 border-dashed rounded-lg p-6 text-center transition-colors
          ${c?"border-green-500 bg-green-500/10":"border-zinc-700"}
          ${h?"opacity-50 cursor-wait":"cursor-pointer hover:border-zinc-500"}
        `,children:h?n.jsxs("div",{className:"flex flex-col items-center gap-2",children:[n.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-green-500 border-t-transparent"}),n.jsx("p",{className:"text-sm text-zinc-400",children:"Uploading..."})]}):n.jsxs("div",{className:"flex flex-col items-center gap-2",children:[n.jsx(Wu,{className:"h-8 w-8 text-zinc-500"}),n.jsx("p",{className:"text-sm text-zinc-300",children:c?"Drop file here":"Drag & drop or click to upload"}),n.jsxs("p",{className:"text-xs text-zinc-500",children:["PDF, TXT, MD, or DOCX files up to ",Wf,"MB"]})]})}),r&&n.jsxs("div",{className:"flex items-center gap-2 text-red-400 text-sm",children:[n.jsx(Gs,{className:"h-4 w-4"}),r]})]})}function iD(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function rD(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function lD({status:e}){switch(e){case"processing":return n.jsx(Ho,{className:"h-4 w-4 text-yellow-500 animate-pulse"});case"ready":return n.jsx(ul,{className:"h-4 w-4 text-green-500"});case"failed":return n.jsx(ui,{className:"h-4 w-4 text-red-500"})}}function oD({botId:e,onViewChunks:s}){const{loadDocuments:a,deleteDocument:r,refreshDocument:o,retryDocument:c,getDocuments:d,loadingDocuments:h}=Qs(),m=d(e),f=h[e],[p,b]=k.useState(null),[v,y]=k.useState(null);k.useEffect(()=>{a(e)},[e,a]),k.useEffect(()=>{const w=m.filter(C=>C.status==="processing");if(w.length===0)return;const j=setInterval(()=>{w.forEach(C=>{o(e,C.id)})},3e3);return()=>clearInterval(j)},[e,m,o]);const N=async w=>{await r(e,w),b(null)},S=async w=>{y(w);try{await c(e,w)}finally{y(null)}};return f&&m.length===0?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx(Cn,{className:"h-5 w-5 animate-spin text-zinc-500"})}):m.length===0?n.jsxs("div",{className:"text-center py-8 text-zinc-500",children:[n.jsx(Na,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),n.jsx("p",{children:"No documents uploaded yet"})]}):n.jsx("div",{className:"space-y-2",children:m.map(w=>n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-3 p-3 bg-zinc-800/50 rounded-lg",children:[n.jsx(Na,{className:"h-5 w-5 text-zinc-400 flex-shrink-0"}),n.jsxs("div",{className:`flex-1 min-w-0 ${w.status==="ready"&&s?"cursor-pointer hover:opacity-80":""}`,onClick:()=>{w.status==="ready"&&s&&s(w.id,w.filename)},children:[n.jsx("p",{className:"text-sm text-zinc-200 truncate",children:w.filename}),n.jsxs("p",{className:"text-xs text-zinc-500",children:[iD(w.file_size),w.chunk_count>0&&` - ${w.chunk_count} chunks`," - ",rD(w.uploaded_at)]})]}),n.jsx(lD,{status:w.status}),w.status==="ready"&&s&&n.jsx("button",{onClick:()=>s(w.id,w.filename),className:"p-1.5 rounded hover:bg-zinc-700 text-zinc-400 hover:text-zinc-200 transition-colors",title:"View chunks",children:n.jsx(za,{className:"h-4 w-4"})}),w.status==="failed"&&n.jsx("button",{onClick:()=>S(w.id),disabled:v===w.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:n.jsx(el,{className:`h-4 w-4 ${v===w.id?"animate-spin":""}`})}),n.jsx("button",{onClick:()=>b(w.id),className:"p-1.5 rounded hover:bg-zinc-700 text-zinc-400 hover:text-red-400 transition-colors",title:"Delete document",children:n.jsx(Vt,{className:"h-4 w-4"})})]}),p===w.id&&n.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:[n.jsxs("span",{className:"text-xs text-red-400 flex-1",children:['Delete "',w.filename,'"?']}),n.jsx("button",{onClick:()=>N(w.id),className:"px-2 py-1 text-xs rounded bg-red-600 text-white hover:bg-red-500",children:"Delete"}),n.jsx("button",{onClick:()=>b(null),className:"px-2 py-1 text-xs rounded border border-zinc-600 text-zinc-300 hover:bg-zinc-700",children:"Cancel"})]})]},w.id))})}function cD({botId:e}){const{loadInstructions:s,updateInstructions:a,getInstructions:r,loadingInstructions:o}=Qs(),c=r(e),d=o[e],[h,m]=k.useState(c),[f,p]=k.useState(!1),[b,v]=k.useState(null);k.useEffect(()=>{s(e)},[e,s]),k.useEffect(()=>{m(c)},[c]);const y=h!==c,N=k.useCallback(async()=>{if(y){p(!0);try{await a(e,h),v(new Date)}catch{}finally{p(!1)}}},[e,h,y,a]);return k.useEffect(()=>{if(!y)return;const S=setTimeout(()=>{N()},2e3);return()=>clearTimeout(S)},[h,y,N]),d&&!c?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx(Cn,{className:"h-5 w-5 animate-spin text-zinc-500"})}):n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-sm font-medium text-zinc-300",children:"Custom Instructions"}),n.jsxs("div",{className:"flex items-center gap-2",children:[f&&n.jsx("span",{className:"text-xs text-zinc-500",children:"Saving..."}),!f&&b&&n.jsxs("span",{className:"text-xs text-zinc-500",children:["Saved ",b.toLocaleTimeString()]}),y&&!f&&n.jsxs("button",{onClick:N,className:"flex items-center gap-1 px-2 py-1 text-xs bg-green-600 hover:bg-green-500 rounded transition-colors",children:[n.jsx(Fo,{className:"h-3 w-3"}),"Save"]})]})]}),n.jsx("textarea",{value:h,onChange:S=>m(S.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}),n.jsxs("p",{className:"text-xs text-zinc-500",children:[h.length.toLocaleString()," / 10,000 characters"]})]})}function uD(e){const s=new Date(e),r=new Date().getTime()-s.getTime(),o=Math.floor(r/1e3),c=Math.floor(o/60),d=Math.floor(c/60),h=Math.floor(d/24);return o<60?"just now":c<60?`${c}m ago`:d<24?`${d}h ago`:h<7?`${h}d ago`:h<30?`${Math.floor(h/7)}w ago`:s.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function dD(e,s=150){return e.length<=s?e:e.slice(0,s).trimEnd()+"..."}const j1=["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 hD(e){let s=0;for(let a=0;a<e.length;a++)s=(s<<5)-s+e.charCodeAt(a)|0;return j1[Math.abs(s)%j1.length]}function fD({source:e}){return e==="bot"?n.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:[n.jsx(Hn,{className:"h-3 w-3"}),"bot"]}):n.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:[n.jsx(fl,{className:"h-3 w-3"}),"user"]})}function mD({botId:e,onEditNote:s,onNewNote:a}){const{notes:r,allTags:o,loadNotes:c,loadTags:d,deleteNote:h,loadingNotes:m}=Qs(),f=k.useMemo(()=>r[e]||[],[r,e]),p=k.useMemo(()=>o[e]||[],[o,e]),b=m[e],[v,y]=k.useState(""),[N,S]=k.useState(new Set),[w,j]=k.useState(null);k.useEffect(()=>{c(e),d(e)},[e,c,d]),k.useEffect(()=>{const E=N.size>0?Array.from(N).join(","):void 0,A=v.trim()||void 0,B=setTimeout(()=>{c(e,E,A)},A?300:0);return()=>clearTimeout(B)},[e,N,v,c]);const C=k.useCallback(E=>{S(A=>{const B=new Set(A);return B.has(E)?B.delete(E):B.add(E),B})},[]),T=k.useCallback(async E=>{try{await h(e,E)}catch{}finally{j(null)}},[e,h]),D=k.useMemo(()=>f,[f]);return b&&f.length===0?n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx(Cn,{className:"h-5 w-5 animate-spin text-zinc-500"})}):n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(Tn,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),n.jsx("input",{type:"text",value:v,onChange:E=>y(E.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"})]}),n.jsxs("button",{onClick:a,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:[n.jsx($t,{className:"h-4 w-4"}),"New Note"]})]}),p.length>0&&n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx($v,{className:"h-3.5 w-3.5 text-zinc-500 flex-shrink-0"}),p.map(E=>n.jsx("button",{onClick:()=>C(E),className:X("px-2 py-0.5 text-xs rounded-full border transition-colors",N.has(E)?"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:E},E)),N.size>0&&n.jsx("button",{onClick:()=>S(new Set),className:"px-2 py-0.5 text-xs text-zinc-500 hover:text-zinc-300 transition-colors",children:"Clear"})]}),D.length===0?n.jsxs("div",{className:"text-center py-12 text-zinc-500",children:[n.jsx(f0,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),n.jsx("p",{className:"text-sm",children:v||N.size>0?"No notes match your filters":"No notes yet"}),!v&&N.size===0&&n.jsx("button",{onClick:a,className:"mt-2 text-sm text-cachi-500 hover:text-cachi-400 transition-colors",children:"Create your first note"})]}):n.jsx("div",{className:"space-y-2",children:D.map(E=>n.jsxs("div",{className:"group p-3 bg-zinc-800/50 rounded-lg border border-zinc-800 hover:border-zinc-700 transition-colors",children:[n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsx("button",{onClick:()=>s(E.id),className:"text-sm font-medium text-zinc-200 hover:text-cachi-400 text-left transition-colors truncate flex-1",children:E.title}),n.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[n.jsx("button",{onClick:()=>s(E.id),className:"p-1 rounded hover:bg-zinc-700 text-zinc-400 hover:text-cachi-400 transition-colors",title:"Edit note",children:n.jsx(o0,{className:"h-3.5 w-3.5"})}),w===E.id?n.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[n.jsx("span",{className:"text-zinc-400",children:"Are you sure?"}),n.jsx("button",{onClick:()=>T(E.id),className:"px-1.5 py-0.5 rounded bg-red-600 hover:bg-red-500 text-white transition-colors",children:"Confirm"}),n.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"})]}):n.jsx("button",{onClick:()=>j(E.id),className:"p-1 rounded hover:bg-zinc-700 text-zinc-400 hover:text-red-400 transition-colors",title:"Delete note",children:n.jsx(Vt,{className:"h-3.5 w-3.5"})})]})]}),n.jsx("p",{className:"mt-1 text-xs text-zinc-400 leading-relaxed",children:dD(E.content)}),n.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[n.jsx("div",{className:"flex items-center gap-1.5 flex-wrap min-w-0",children:E.tags.map(A=>n.jsx("span",{className:X("px-1.5 py-0.5 text-[10px] rounded-full",hD(A)),children:A},A))}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx(fD,{source:E.source}),n.jsx("span",{className:"text-[10px] text-zinc-500",children:uD(E.updated_at)})]})]})]},E.id))})]})}const xD={sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-[90vw]"};function Fs({open:e,onClose:s,children:a,size:r="lg",className:o,closeOnBackdrop:c=!0,closeOnEscape:d=!0}){const h=k.useRef(null);if(k.useEffect(()=>{if(!e||!d)return;const f=p=>{p.key==="Escape"&&s()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,d,s]),k.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),!e)return null;const m=f=>{c&&f.target===f.currentTarget&&s()};return Jm.createPortal(n.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:n.jsx("div",{ref:h,className:X("w-full rounded-2xl border border-zinc-800 bg-zinc-900 shadow-2xl animate-in zoom-in-95 duration-150",xD[r],o),role:"dialog","aria-modal":"true",children:a})}),document.body)}function $s({title:e,subtitle:s,icon:a,iconClassName:r,onClose:o,className:c,children:d}){return n.jsxs("div",{className:X("flex items-center justify-between border-b border-zinc-800 px-6 py-4",c),children:[n.jsxs("div",{className:"flex items-center gap-3",children:[a&&n.jsx("div",{className:X("flex h-10 w-10 items-center justify-center rounded-xl bg-cachi-600/20",r),children:a}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-bold text-zinc-100",children:e}),s&&n.jsx("p",{className:"text-sm text-zinc-500",children:s})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[d,o&&n.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:n.jsx(Gt,{className:"h-5 w-5"})})]})]})}function Vs({children:e,className:s,scrollable:a=!1,maxHeight:r="max-h-[60vh]"}){return n.jsx("div",{className:X("p-6",a&&`overflow-y-auto ${r}`,s),children:e})}function il({children:e,className:s,leftContent:a}){return n.jsxs("div",{className:X("flex items-center justify-between border-t border-zinc-800 px-6 py-4",s),children:[n.jsx("div",{children:a}),n.jsx("div",{className:"flex items-center gap-2",children:e})]})}const pD={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 un({onClick:e,disabled:s,children:a,variant:r="secondary",className:o,type:c="button"}){return n.jsx("button",{type:c,onClick:e,disabled:s,className:X(pD[r],o),children:a})}function Kj({steps:e,currentStep:s,completedSteps:a=[],onStepClick:r,variant:o="horizontal",className:c}){const d=e.findIndex(h=>h.id===s);return o==="compact"?n.jsx("div",{className:X("flex items-center gap-1.5",c),children:e.map((h,m)=>{const f=a.includes(h.id),p=h.id===s,b=m<d;return n.jsx("button",{onClick:()=>r==null?void 0:r(h.id),disabled:!r||!f&&!b&&!p,className:X("h-2 rounded-full transition-all",p?"w-8 bg-cachi-500":f||b?"w-2 bg-cachi-600":"w-2 bg-zinc-700",r&&(f||b||p)?"cursor-pointer hover:opacity-80":"cursor-default"),title:h.label},h.id)})}):o==="vertical"?n.jsx("nav",{className:X("space-y-2",c),children:e.map((h,m)=>{const f=a.includes(h.id),p=h.id===s,b=m<d;return n.jsxs("button",{onClick:()=>r==null?void 0:r(h.id),disabled:!r||!f&&!b&&!p,className:X("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors",p?"bg-cachi-600/20 text-cachi-400":f||b?"text-zinc-400 hover:bg-zinc-800/50":"text-zinc-600",r&&(f||b||p)?"cursor-pointer":"cursor-default"),children:[n.jsx("div",{className:X("flex h-6 w-6 items-center justify-center rounded-full text-xs font-medium",p?"bg-cachi-600 text-white":f?"bg-cachi-600/30 text-cachi-400":"bg-zinc-800 text-zinc-500"),children:f?n.jsx(dn,{className:"h-3.5 w-3.5"}):m+1}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:h.label}),h.description&&n.jsx("div",{className:"text-xs text-zinc-500",children:h.description})]})]},h.id)})}):n.jsx("nav",{className:X("flex items-center justify-center gap-2",c),children:e.map((h,m)=>{const f=a.includes(h.id),p=h.id===s,b=m<d;return n.jsxs("div",{className:"flex items-center",children:[n.jsxs("button",{onClick:()=>r==null?void 0:r(h.id),disabled:!r||!f&&!b&&!p,className:X("flex items-center gap-2 rounded-lg px-3 py-1.5 text-sm transition-colors",p?"bg-cachi-600/20 text-cachi-400":f||b?"text-zinc-400 hover:text-zinc-300":"text-zinc-600",r&&(f||b||p)?"cursor-pointer":"cursor-default"),children:[n.jsx("div",{className:X("flex h-5 w-5 items-center justify-center rounded-full text-[10px] font-medium",p?"bg-cachi-600 text-white":f?"bg-cachi-600/30 text-cachi-400":"bg-zinc-800 text-zinc-500"),children:f?n.jsx(dn,{className:"h-3 w-3"}):m+1}),n.jsx("span",{className:"hidden sm:inline",children:h.label})]}),m<e.length-1&&n.jsx("div",{className:X("mx-1 h-px w-4",b?"bg-cachi-600/50":"bg-zinc-700")})]},h.id)})})}function gD({botId:e,noteId:s,open:a,onClose:r}){const{notes:o,allTags:c,createNote:d,updateNote:h,loadTags:m,loadNotes:f}=Qs(),[p,b]=k.useState(""),[v,y]=k.useState(""),[N,S]=k.useState([]),[w,j]=k.useState(""),[C,T]=k.useState(!1),D=k.useRef(null),E=s!==null,A=k.useMemo(()=>c[e]||[],[c,e]),B=k.useMemo(()=>o[e]||[],[o,e]),V=A.filter(U=>!N.includes(U));k.useEffect(()=>{if(a){if(E){const U=B.find(H=>H.id===s);U&&(b(U.title),y(U.content),S([...U.tags]))}else b(""),y(""),S([]);j(""),T(!1),m(e)}},[a,s,E,e,B,m]);const ee=k.useCallback(U=>{const H=U.trim().toLowerCase();H&&!N.includes(H)&&S(I=>[...I,H]),j("")},[N]),R=k.useCallback(U=>{S(H=>H.filter(I=>I!==U))},[]),F=k.useCallback(U=>{U.key==="Enter"?(U.preventDefault(),w.trim()&&ee(w)):U.key==="Backspace"&&!w&&N.length>0&&R(N[N.length-1])},[w,N,ee,R]),_=k.useCallback(async()=>{if(!(!p.trim()||!v.trim())){T(!0);try{E&&s?await h(e,s,{title:p.trim(),content:v.trim(),tags:N}):await d(e,{title:p.trim(),content:v.trim(),tags:N}),await Promise.all([f(e),m(e)]),r()}catch{}finally{T(!1)}}},[e,s,E,p,v,N,d,h,f,m,r]),se=p.trim().length>0&&v.trim().length>0&&!C;return n.jsxs(Fs,{open:a,onClose:r,size:"lg",children:[n.jsx($s,{title:E?"Edit Note":"New Note",onClose:r}),n.jsx(Vs,{scrollable:!0,maxHeight:"max-h-[70vh]",children:n.jsxs("div",{className:"space-y-5",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium text-zinc-300",children:"Title"}),n.jsx("input",{type:"text",value:p,onChange:U=>b(U.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"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium text-zinc-300",children:"Content"}),n.jsx("textarea",{value:v,onChange:U=>y(U.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"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-sm font-medium text-zinc-300 flex items-center gap-1.5",children:[n.jsx($v,{className:"h-3.5 w-3.5"}),"Tags"]}),n.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 U;return(U=D.current)==null?void 0:U.focus()},children:[N.map(U=>n.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:[U,n.jsx("button",{type:"button",onClick:H=>{H.stopPropagation(),R(U)},className:"rounded-sm p-0.5 hover:bg-cachi-600/30 hover:text-cachi-300 transition-colors",children:n.jsx(Gt,{className:"h-3 w-3"})})]},U)),n.jsx("input",{ref:D,type:"text",value:w,onChange:U=>j(U.target.value),onKeyDown:F,placeholder:N.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"})]}),V.length>0&&n.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[n.jsx("span",{className:"text-xs text-zinc-500",children:"Suggestions:"}),V.map(U=>n.jsxs("button",{type:"button",onClick:()=>ee(U),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:[n.jsx($t,{className:"h-3 w-3"}),U]},U))]})]})]})}),n.jsxs(il,{children:[n.jsx(un,{variant:"ghost",onClick:r,children:"Cancel"}),n.jsx(un,{variant:"primary",onClick:_,disabled:!se,children:C?"Saving...":E?"Save Changes":"Create Note"})]})]})}function bu(){return n.jsxs("div",{className:"rounded-lg border border-zinc-700 bg-zinc-800/50 p-4 animate-pulse",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx("div",{className:"h-5 w-5 rounded bg-zinc-700"}),n.jsx("div",{className:"h-3 w-16 rounded bg-zinc-700"})]}),n.jsx("div",{className:"h-6 w-10 rounded bg-zinc-700"})]})}function yu({icon:e,label:s,value:a,subtitle:r}){return n.jsxs("div",{className:"rounded-lg border border-zinc-700 bg-zinc-800/50 p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx(e,{className:"h-5 w-5 text-zinc-400"}),n.jsx("span",{className:"text-xs font-medium text-zinc-400 uppercase tracking-wide",children:s})]}),n.jsx("div",{className:"text-2xl font-semibold text-zinc-100",children:a}),r&&n.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:r})]})}function bD(e){const s=[];return e.documents_ready>0&&s.push(`${e.documents_ready} ready`),e.documents_processing>0&&s.push(`${e.documents_processing} processing`),e.documents_failed>0&&s.push(`${e.documents_failed} failed`),s.join(", ")}function yD({botId:e}){const{stats:s,loadingStats:a,loadStats:r,reindexDocuments:o}=Qs(),c=s[e],d=a[e],[h,m]=k.useState(!1),[f,p]=k.useState(!1),b=async()=>{p(!1),m(!0);try{await o(e),await r(e)}finally{m(!1)}};if(k.useEffect(()=>{r(e)},[e,r]),d&&!c)return n.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[n.jsx(bu,{}),n.jsx(bu,{}),n.jsx(bu,{}),n.jsx(bu,{})]});if(!c)return null;const v=bD(c);return n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-sm font-medium text-zinc-300",children:"Knowledge Base"}),n.jsxs("div",{className:"flex items-center gap-1",children:[c.total_documents>0&&!f&&n.jsxs("button",{onClick:()=>p(!0),disabled:h,className:"flex items-center gap-1 px-2 py-1 rounded text-xs hover:bg-zinc-700 text-zinc-500 hover:text-zinc-300 transition-colors disabled:opacity-50",title:"Re-index all documents",children:[n.jsx(el,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`}),h?"Re-indexing...":"Re-index"]}),f&&n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"text-xs text-zinc-400",children:"Re-index all?"}),n.jsx("button",{onClick:b,className:"px-2 py-0.5 text-xs rounded bg-cachi-600 text-white hover:bg-cachi-500",children:"Yes"}),n.jsx("button",{onClick:()=>p(!1),className:"px-2 py-0.5 text-xs rounded border border-zinc-600 text-zinc-300 hover:bg-zinc-700",children:"No"})]}),n.jsx("button",{onClick:()=>r(e),disabled:d,className:"p-1 rounded hover:bg-zinc-700 text-zinc-500 hover:text-zinc-300 transition-colors disabled:opacity-50",title:"Refresh stats",children:n.jsx(Cn,{className:`h-3.5 w-3.5 ${d?"animate-spin":""}`})})]})]}),n.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[n.jsx(yu,{icon:Na,label:"Documents",value:c.total_documents,subtitle:v||void 0}),n.jsx(yu,{icon:Iv,label:"Chunks",value:c.total_chunks}),n.jsx(yu,{icon:f0,label:"Notes",value:c.total_notes}),n.jsx(yu,{icon:xv,label:"Instructions",value:c.has_instructions?n.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"}):n.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 vD({type:e}){return e==="document"?n.jsx(Na,{className:"h-4 w-4 text-blue-400 flex-shrink-0"}):n.jsx(f0,{className:"h-4 w-4 text-amber-400 flex-shrink-0"})}function jD(e,s){return e.length<=s?e:e.slice(0,s).trimEnd()+"..."}function wD({botId:e}){const[s,a]=k.useState(""),r=k.useRef(void 0),o=k.useRef(null),{searchKnowledge:c,clearSearchResults:d,searchResults:h,loadingSearch:m}=Qs();k.useEffect(()=>{if(!s.trim()){d();return}return r.current=setTimeout(()=>{c(e,s)},300),()=>clearTimeout(r.current)},[s,e,c,d]),k.useEffect(()=>()=>{d(),clearTimeout(r.current)},[d]);const f=()=>{var b;a(""),d(),(b=o.current)==null||b.focus()},p=s.trim().length>0;return n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"relative",children:[n.jsx(Tn,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),n.jsx("input",{ref:o,type:"text",value:s,onChange:b=>a(b.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`}),p&&n.jsx("button",{onClick:f,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:n.jsx(Gt,{className:"h-4 w-4"})})]}),p&&n.jsxs("div",{className:"rounded-lg border border-zinc-700 bg-zinc-800/50 overflow-hidden",children:[m&&n.jsxs("div",{className:"flex items-center justify-center gap-2 py-6",children:[n.jsx(Cn,{className:"h-4 w-4 animate-spin text-cachi-500"}),n.jsx("span",{className:"text-sm text-zinc-400",children:"Searching..."})]}),!m&&h.length===0&&n.jsxs("div",{className:"text-center py-6",children:[n.jsx(Tn,{className:"h-6 w-6 mx-auto mb-2 text-zinc-600"}),n.jsx("p",{className:"text-sm text-zinc-500",children:"No results found"})]}),!m&&h.length>0&&n.jsx("ul",{className:"divide-y divide-zinc-700/50",children:h.map(b=>n.jsx("li",{className:"px-4 py-3 hover:bg-zinc-700/30 transition-colors",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"mt-0.5",children:n.jsx(vD,{type:b.type})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsx("span",{className:"text-sm font-medium text-zinc-200 truncate",children:b.title}),b.score!==null&&n.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:b.score.toFixed(2)})]}),n.jsx("p",{className:"text-xs text-zinc-400 leading-relaxed",children:jD(b.content,200)}),b.source&&n.jsx("span",{className:"inline-block mt-1.5 text-xs text-zinc-500",children:b.source})]})]})},`${b.type}-${b.id}`))})]})]})}function zD({botId:e,documentId:s,filename:a,open:r,onClose:o}){const{documentChunks:c,loadingChunks:d,loadDocumentChunks:h}=Qs(),m=c[s]??[],f=d[s]??!1;return k.useEffect(()=>{r&&e&&s&&h(e,s)},[r,e,s,h]),n.jsxs(Fs,{open:r,onClose:o,size:"xl",children:[n.jsx($s,{title:`Chunks: ${a}`,onClose:o}),n.jsx(Vs,{className:"max-h-[60vh] overflow-y-auto",children:f?n.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-zinc-400",children:[n.jsx(Cn,{className:"h-6 w-6 animate-spin"}),n.jsx("p",{className:"mt-3 text-sm",children:"Loading chunks..."})]}):m.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-zinc-500",children:[n.jsx(Na,{className:"h-8 w-8"}),n.jsx("p",{className:"mt-3 text-sm",children:"No chunks found for this document."})]}):n.jsx("div",{className:"space-y-3",children:m.map(p=>n.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-800/50 p-4",children:[n.jsx("div",{className:"mb-2 flex items-center gap-2",children:n.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:["#",p.chunk_index]})}),n.jsx("p",{className:"whitespace-pre-wrap text-sm leading-relaxed text-zinc-300",children:p.content})]},p.id))})})]})}const bl="/api/bots";function Zj(){const{accessToken:e}=Ut.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function pi(e,s={},a=!0){const r=await fetch(e,{headers:{"Content-Type":"application/json",...Zj(),...s.headers},...s});if(r.status===401&&a&&await As())return pi(e,s,!1);if(!r.ok){const o=await r.json().catch(()=>({}));throw new Error(o.detail||`Request failed: ${r.statusText}`)}return r.json()}async function Wj(e,s={},a=!0){const r=await fetch(e,{headers:{...Zj(),...s.headers},...s});if(r.status===401&&a&&await As())return Wj(e,s,!1);if(!r.ok){const o=await r.json().catch(()=>({}));throw new Error(o.detail||`Request failed: ${r.statusText}`)}}let em=null;async function ND(){if(em)return em;const e=await pi("/api/platforms");return em=e,e}async function kD(e){return pi(`${bl}/${e}/connections`)}async function SD(e,s){return pi(`${bl}/${e}/connections`,{method:"POST",body:JSON.stringify(s)})}async function CD(e,s,a){return pi(`${bl}/${e}/connections/${s}`,{method:"PATCH",body:JSON.stringify(a)})}async function TD(e,s){return Wj(`${bl}/${e}/connections/${s}`,{method:"DELETE"})}async function ED(e,s){return pi(`${bl}/${e}/connections/${s}/connect`,{method:"POST"})}async function AD(e,s){return pi(`${bl}/${e}/connections/${s}/disconnect`,{method:"POST"})}async function MD(){return pi("/api/platforms/custom/spec")}function DD({botId:e}){const[s,a]=k.useState([]),[r,o]=k.useState({}),[c,d]=k.useState(!0),[h,m]=k.useState(null),[f,p]=k.useState(null),[b,v]=k.useState(!1),[y,N]=k.useState([]),[S,w]=k.useState(!1),[j,C]=k.useState(null),[T,D]=k.useState(null),[E,A]=k.useState(null),[B,V]=k.useState(!1),[ee,R]=k.useState(null),[F,_]=k.useState(""),[se,U]=k.useState(""),[H,I]=k.useState({});k.useEffect(()=>{(async()=>{d(!0);try{const[pe,Ce]=await Promise.all([kD(e),ND()]);a(pe),o(Ce);const _e=Object.keys(Ce);_e.length>0&&!F&&_(_e[0])}catch(pe){m(pe instanceof Error?pe.message:"Failed to load connections")}finally{d(!1)}})()},[e]),k.useEffect(()=>{const ce=pe=>{const Ce=pe.detail;Ce.botId===e&&a(_e=>_e.map(me=>me.id===Ce.connectionId?{...me,status:Ce.status,error:Ce.error||null}:me))};return window.addEventListener("connection-status-change",ce),()=>window.removeEventListener("connection-status-change",ce)},[e]),k.useEffect(()=>{F==="custom"&&!T&&MD().then(D).catch(()=>{})},[F,T]);const W=ce=>{navigator.clipboard.writeText(ce),A(ce),setTimeout(()=>A(null),2e3)},re=Object.keys(r),he=async()=>{var pe;if(!se.trim()||!F)return;const ce=r[F];if(ce){for(const Ce of ce.required_config)if(!((pe=H[Ce])!=null&&pe.trim()))return}m(null);try{const Ce=await SD(e,{platform:F,name:se.trim(),config:H});a(_e=>[Ce,..._e]),ae()}catch(Ce){m(Ce instanceof Error?Ce.message:"Failed to create connection")}},L=async ce=>{if(se.trim()){m(null);try{const pe={name:se.trim()},Ce={};for(const[me,ge]of Object.entries(H))ge.trim()&&(Ce[me]=ge.trim());Object.keys(Ce).length>0&&(pe.config=Ce);const _e=await CD(e,ce,pe);a(me=>me.map(ge=>ge.id===ce?_e:ge)),ae()}catch(pe){m(pe instanceof Error?pe.message:"Failed to update connection")}}},P=async ce=>{m(null);try{await TD(e,ce),a(pe=>pe.filter(Ce=>Ce.id!==ce))}catch(pe){m(pe instanceof Error?pe.message:"Failed to delete connection")}},Y=async ce=>{m(null),p(ce);try{const pe=xt.getState().bots.find(_e=>_e.id===e);pe&&pe.systemPrompt&&await b0({id:pe.id,name:pe.name,description:pe.description,icon:pe.icon,color:pe.color,model:pe.model,systemPrompt:pe.systemPrompt,capabilities:pe.capabilities,createdAt:pe.createdAt,updatedAt:pe.updatedAt});const Ce=await ED(e,ce);a(_e=>_e.map(me=>me.id===ce?Ce:me))}catch(pe){m(pe instanceof Error?pe.message:"Failed to connect")}finally{p(null)}},O=async ce=>{m(null),p(ce);try{const pe=await AD(e,ce);a(Ce=>Ce.map(_e=>_e.id===ce?pe:_e))}catch(pe){m(pe instanceof Error?pe.message:"Failed to disconnect")}finally{p(null)}},de=ce=>{R(ce.id),_(ce.platform),U(ce.name);const pe=r[ce.platform],Ce={};if(pe){for(const _e of pe.required_config)Ce[_e]="";for(const _e of Object.keys(pe.optional_config))Ce[_e]=ce.strip_markdown&&_e==="strip_markdown"?"true":""}I(Ce),V(!1)},ve=()=>{V(!0),R(null);const ce=re[0]||"";_(ce),U(""),I({})},ae=()=>{V(!1),R(null),U(""),I({})},je=ce=>{switch(ce){case"connected":return"text-green-400";case"connecting":return"text-yellow-400";case"error":return"text-red-400";default:return"text-zinc-500"}},Xe=ce=>{switch(ce){case"connected":return"Connected";case"connecting":return"Connecting...";case"error":return"Error";default:return"Disconnected"}},Fe=ce=>{var pe;return((pe=r[ce])==null?void 0:pe.display_name)||ce},zt=async()=>{w(!0);try{const pe=(await h2(e)).filter(Ce=>Ce.archived&&Ce.platform);N(pe)}catch(ce){console.error("Failed to load archived chats:",ce)}finally{w(!1)}},It=()=>{const ce=!b;v(ce),ce&&zt()},qn=async ce=>{C(ce);try{await y0(e,ce),N(pe=>pe.filter(Ce=>Ce.id!==ce)),qt.getState().syncPlatformChats(e)}catch(pe){m(pe instanceof Error?pe.message:"Failed to unarchive chat")}finally{C(null)}},bs=async ce=>{if(confirm("Permanently delete this chat and all its messages? This cannot be undone.")){C(ce);try{await c2(e,ce),N(pe=>pe.filter(Ce=>Ce.id!==ce))}catch(pe){m(pe instanceof Error?pe.message:"Failed to delete chat")}finally{C(null)}}};if(c)return n.jsx("div",{className:"text-sm text-zinc-500",children:"Loading connections..."});const fn=(ce,pe)=>{const Ce=r[ce];return Ce?n.jsxs(n.Fragment,{children:[Ce.required_config.map(_e=>n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"block text-xs text-zinc-500",children:[OD(_e),pe?" (leave blank to keep current)":""]}),n.jsx("input",{type:RD(_e)?"password":"text",value:H[_e]||"",onChange:me=>I({...H,[_e]:me.target.value}),placeholder:pe?"Enter new value to update...":`Enter ${_e}...`,className:"w-full rounded border border-zinc-700 bg-zinc-800 px-2 py-1 text-sm text-zinc-100"})]},_e)),Object.entries(Ce.optional_config).map(([_e,me])=>n.jsxs("label",{className:"flex cursor-pointer items-center gap-2",children:[n.jsx("input",{type:"checkbox",checked:H[_e]==="true",onChange:ge=>I({...H,[_e]:ge.target.checked?"true":"false"}),className:"h-4 w-4 rounded border-zinc-600 bg-zinc-800 text-cachi-500 focus:ring-cachi-500"}),n.jsx("span",{className:"text-xs text-zinc-400",children:me})]},_e))]}):null};return n.jsxs("div",{className:"space-y-4",children:[h&&n.jsx("div",{className:"rounded-lg border border-red-500/50 bg-red-500/10 p-3 text-sm text-red-400",children:h}),n.jsx("div",{className:"space-y-2",children:s.map(ce=>n.jsx("div",{className:"rounded-lg border border-zinc-800 p-3",children:ee===ce.id?n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"block text-xs text-zinc-500",children:"Name"}),n.jsx("input",{type:"text",value:se,onChange:pe=>U(pe.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})]}),fn(ce.platform,!0),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>L(ce.id),className:"rounded bg-cachi-600 px-2 py-1 text-xs text-white hover:bg-cachi-500",children:n.jsx(dn,{className:"h-3 w-3"})}),n.jsx("button",{onClick:ae,className:"rounded bg-zinc-700 px-2 py-1 text-xs text-zinc-300 hover:bg-zinc-600",children:n.jsx(Gt,{className:"h-3 w-3"})})]})]}):n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-zinc-800",children:n.jsx(Gi,{className:"h-5 w-5 text-zinc-400"})}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"font-medium text-zinc-200",children:ce.name}),n.jsx("span",{className:"rounded bg-zinc-800 px-1.5 py-0.5 text-xs text-zinc-400",children:Fe(ce.platform)})]}),n.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[n.jsx("span",{className:je(ce.status),children:Xe(ce.status)}),ce.strip_markdown&&n.jsx("span",{className:"rounded bg-zinc-700 px-1.5 py-0.5 text-zinc-400",children:"Plain text"}),ce.message_count>0&&n.jsxs("span",{className:"text-zinc-500",children:[ce.message_count," messages"]})]}),ce.error&&n.jsx("div",{className:"mt-1 text-xs text-red-400",children:ce.error}),ce.platform==="custom"&&n.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[n.jsxs("code",{className:"text-xs text-cachi-400 truncate max-w-[280px]",children:[window.location.origin,"/api/webhooks/custom/",ce.id]}),n.jsx("button",{onClick:pe=>{pe.stopPropagation(),W(`${window.location.origin}/api/webhooks/custom/${ce.id}`)},className:"rounded p-0.5 text-zinc-500 hover:text-cachi-400",title:"Copy webhook URL",children:E===`${window.location.origin}/api/webhooks/custom/${ce.id}`?n.jsx(dn,{className:"h-3 w-3 text-green-400"}):n.jsx(bv,{className:"h-3 w-3"})})]})]})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[f===ce.id?n.jsx("div",{className:"p-2",children:n.jsx(Le,{className:"h-4 w-4 animate-spin text-zinc-400"})}):ce.status==="connected"?n.jsx("button",{onClick:()=>O(ce.id),className:"rounded p-2 text-green-400 hover:bg-zinc-800 hover:text-red-400",title:"Disconnect",children:n.jsx(V4,{className:"h-4 w-4"})}):n.jsx("button",{onClick:()=>Y(ce.id),className:"rounded p-2 text-zinc-500 hover:bg-zinc-800 hover:text-green-400",title:"Connect",children:n.jsx($4,{className:"h-4 w-4"})}),n.jsx("button",{onClick:()=>de(ce),className:"rounded p-2 text-zinc-500 hover:bg-zinc-800 hover:text-zinc-300",title:"Edit",children:n.jsx(o0,{className:"h-4 w-4"})}),n.jsx("button",{onClick:()=>P(ce.id),className:"rounded p-2 text-zinc-500 hover:bg-zinc-800 hover:text-red-400",title:"Delete",children:n.jsx(Vt,{className:"h-4 w-4"})})]})]})},ce.id))}),B?n.jsxs("div",{className:"space-y-3 rounded-lg border border-zinc-700 bg-zinc-800/50 p-3",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"block text-xs text-zinc-500",children:"Platform"}),n.jsx("select",{value:F,onChange:ce=>{_(ce.target.value),I({})},className:"w-full rounded border border-zinc-700 bg-zinc-800 px-2 py-1 text-sm text-zinc-100",children:re.map(ce=>n.jsx("option",{value:ce,children:r[ce].display_name},ce))})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"block text-xs text-zinc-500",children:"Name"}),n.jsx("input",{type:"text",value:se,onChange:ce=>U(ce.target.value),placeholder:`My ${Fe(F)} Bot`,className:"w-full rounded border border-zinc-700 bg-zinc-800 px-2 py-1 text-sm text-zinc-100"})]}),fn(F,!1),F==="custom"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"block text-xs text-zinc-500",children:"API Key (optional)"}),n.jsx("input",{type:"password",value:H.api_key||"",onChange:ce=>I({...H,api_key:ce.target.value}),placeholder:"Shared secret for webhook authentication",className:"w-full rounded border border-zinc-700 bg-zinc-800 px-2 py-1 text-sm text-zinc-100"}),n.jsx("p",{className:"text-xs text-zinc-600",children:"If set, CachiBot will require this key on inbound webhooks and send it on outbound requests."})]}),T&&n.jsxs("div",{className:"space-y-3 rounded-lg border border-zinc-700 bg-zinc-900/50 p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-zinc-300",children:[n.jsx(dl,{className:"h-3.5 w-3.5"}),"API Contract"]}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xs font-medium text-zinc-400",children:"Inbound Webhook"}),n.jsx("p",{className:"text-xs text-zinc-500",children:"Your platform POSTs messages to this URL (available after creating the connection):"}),n.jsxs("code",{className:"block rounded bg-zinc-800 px-2 py-1 text-xs text-cachi-400",children:["POST ",window.location.origin,"/api/webhooks/custom/","<connection_id>"]}),n.jsx("div",{className:"mt-1 text-xs text-zinc-500",children:"Expected JSON body:"}),n.jsx("pre",{className:"rounded bg-zinc-800 px-2 py-1.5 text-xs text-zinc-300 overflow-x-auto",children:JSON.stringify(T.inbound.example,null,2)})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xs font-medium text-zinc-400",children:"Outbound Endpoints"}),n.jsx("p",{className:"text-xs text-zinc-500",children:"CachiBot will POST to these endpoints on your API:"}),n.jsx("div",{className:"space-y-1",children:T.outbound.map(ce=>{const pe=ce.default?H[ce.capability]!=="false":H[ce.capability]==="true";return n.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[n.jsx("span",{className:pe?"text-green-400":"text-zinc-600",children:pe?"●":"○"}),n.jsx("code",{className:"text-zinc-400",children:ce.endpoint}),n.jsx("span",{className:pe?"text-green-400":"text-zinc-600",children:pe?"active":"inactive"})]},ce.capability)})})]})]})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:he,disabled:!se.trim()||!ts(),className:"rounded bg-cachi-600 px-3 py-1 text-xs text-white hover:bg-cachi-500 disabled:opacity-50",children:"Add Connection"}),n.jsx("button",{onClick:ae,className:"rounded bg-zinc-700 px-3 py-1 text-xs text-zinc-300 hover:bg-zinc-600",children:"Cancel"})]})]}):n.jsxs("button",{onClick:ve,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:[n.jsx($t,{className:"h-4 w-4"}),"Add Connection"]}),s.length===0&&!B&&n.jsx("p",{className:"text-center text-sm text-zinc-500",children:"No connections yet. Add a connection to a messaging platform."}),s.length>0&&n.jsxs("div",{className:"mt-6 border-t border-zinc-800 pt-4",children:[n.jsxs("button",{onClick:It,className:"flex w-full items-center gap-2 text-sm text-zinc-400 hover:text-zinc-300",children:[b?n.jsx(cl,{className:"h-4 w-4"}):n.jsx(Yu,{className:"h-4 w-4"}),n.jsx(xm,{className:"h-4 w-4"}),n.jsx("span",{children:"Archived Chats"}),y.length>0&&n.jsx("span",{className:"rounded-full bg-zinc-700 px-2 py-0.5 text-xs",children:y.length})]}),b&&n.jsx("div",{className:"mt-3 space-y-2",children:S?n.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-500",children:[n.jsx(Le,{className:"h-4 w-4 animate-spin"}),"Loading archived chats..."]}):y.length===0?n.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.`}):n.jsxs(n.Fragment,{children:[n.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."}),y.map(ce=>n.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-800 bg-zinc-800/30 p-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-zinc-700",children:n.jsx(Gi,{className:"h-4 w-4 text-zinc-400"})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium text-zinc-300",children:ce.title}),n.jsxs("div",{className:"flex items-center gap-2 text-xs text-zinc-500",children:[n.jsx("span",{className:"capitalize",children:ce.platform}),n.jsx("span",{children:"·"}),n.jsx("span",{children:"Archived"})]})]})]}),n.jsx("div",{className:"flex items-center gap-1",children:j===ce.id?n.jsx("div",{className:"p-2",children:n.jsx(Le,{className:"h-4 w-4 animate-spin text-zinc-400"})}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>qn(ce.id),className:"rounded p-2 text-zinc-500 hover:bg-zinc-700 hover:text-green-400",title:"Unarchive (restore chat)",children:n.jsx(u4,{className:"h-4 w-4"})}),n.jsx("button",{onClick:()=>bs(ce.id),className:"rounded p-2 text-zinc-500 hover:bg-zinc-700 hover:text-red-400",title:"Delete permanently",children:n.jsx(Vt,{className:"h-4 w-4"})})]})})]},ce.id))]})})]})]});function ts(){const ce=r[F];return ce?ce.required_config.every(pe=>{var Ce;return(Ce=H[pe])==null?void 0:Ce.trim()}):!1}}function OD(e){return e.split("_").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function RD(e){const s=e.toLowerCase();return s.includes("token")||s.includes("secret")||s.includes("key")}const _D={ttsVoice:"alloy",ttsSpeed:1,sttLanguage:null,enableInterruption:!0,saveTranscripts:!0},Xt=Nt()(Yt(e=>({voiceState:"disconnected",isMuted:!1,pushToTalkMode:!1,isHoldingPTT:!1,transcripts:[],currentThinking:null,activeToolCalls:[],error:null,audioLevel:0,voiceSettings:_D,setVoiceState:s=>e({voiceState:s,error:null}),setMuted:s=>e({isMuted:s}),toggleMute:()=>e(s=>({isMuted:!s.isMuted})),setPushToTalkMode:s=>e({pushToTalkMode:s}),togglePTTMode:()=>e(s=>({pushToTalkMode:!s.pushToTalkMode})),setHoldingPTT:s=>e({isHoldingPTT:s}),addTranscript:s=>e(a=>({transcripts:[...a.transcripts,s]})),setCurrentThinking:s=>e({currentThinking:s}),addToolCall:s=>e(a=>({activeToolCalls:[...a.activeToolCalls,s]})),updateToolCall:(s,a)=>e(r=>({activeToolCalls:r.activeToolCalls.map(o=>o.id===s?{...o,result:a}:o)})),clearActiveToolCalls:()=>e({activeToolCalls:[]}),setError:s=>e({error:s}),setAudioLevel:s=>e({audioLevel:s}),clearTranscripts:()=>e({transcripts:[]}),updateVoiceSettings:s=>e(a=>({voiceSettings:{...a.voiceSettings,...s}})),reset:()=>e({voiceState:"disconnected",isMuted:!1,isHoldingPTT:!1,transcripts:[],currentThinking:null,activeToolCalls:[],error:null,audioLevel:0})}),{name:"cachibot-voice",partialize:e=>({voiceSettings:e.voiceSettings,pushToTalkMode:e.pushToTalkMode})})),LD="/api";class UD extends Error{constructor(s,a,r){super(s),this.status=a,this.data=r,this.name="ApiError"}}function BD(){const{accessToken:e}=Ut.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function gi(e,s={},a=!0){const r=`${LD}${e}`,o=await fetch(r,{headers:{"Content-Type":"application/json",...BD(),...s.headers},...s});if(o.status===401&&a&&await As())return gi(e,s,!1);if(!o.ok){const c=await o.json().catch(()=>({}));throw new UD(c.detail||`Request failed: ${o.statusText}`,o.status,c)}if(o.status!==204)return o.json()}async function ID(){return gi("/skills")}async function HD(e){return gi(`/skills/${e}`,{method:"DELETE"})}async function PD(e){return gi("/skills/install",{method:"POST",body:JSON.stringify({url:e})})}async function qD(){return gi("/skills/refresh",{method:"POST"})}async function FD(e){return gi(`/bots/${e}/skills/ids`)}async function $D(e,s){return gi(`/bots/${e}/skills`,{method:"POST",body:JSON.stringify({skillId:s})})}async function VD(e,s){return gi(`/bots/${e}/skills/${s}`,{method:"DELETE"})}const GD=["#22c55e","#3b82f6","#8b5cf6","#ec4899","#f59e0b","#ef4444","#06b6d4","#84cc16"];function YD(){const e=hn(),{getActiveBot:s,updateBot:a,deleteBot:r}=xt(),{settingsSection:o}=Bt(),[c,d]=k.useState(!1),[h,m]=k.useState(!1),f=s(),[p,b]=k.useState({name:(f==null?void 0:f.name)||"",description:(f==null?void 0:f.description)||"",icon:f==null?void 0:f.icon,color:f==null?void 0:f.color,model:(f==null?void 0:f.model)||"",models:f?zm(f):void 0,systemPrompt:(f==null?void 0:f.systemPrompt)||"",capabilities:f==null?void 0:f.capabilities});if(k.useEffect(()=>{f&&b({name:f.name,description:f.description,icon:f.icon,color:f.color,model:f.model,models:zm(f),systemPrompt:f.systemPrompt,capabilities:f.capabilities})},[f==null?void 0:f.id]),!f)return null;const v=()=>{const{capabilities:S,...w}=p;a(f.id,w),m(!0),setTimeout(()=>m(!1),2e3)},y=()=>{const S=f.id;d(!1),e("/dashboard"),r(S)},N={general:"General",knowledge:"Knowledge",skills:"Skills",connections:"Connections",voice:"Voice",advanced:"Advanced",danger:"Danger Zone"};return n.jsxs("div",{className:"flex h-full flex-col bg-zinc-100 dark:bg-zinc-950",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 px-6 py-3",children:[n.jsx("h1",{className:"text-lg font-semibold text-zinc-100",children:N[o]}),o!=="danger"&&n.jsxs("button",{onClick:v,className:X("flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-colors",h?"bg-green-600 text-white":"bg-cachi-600 text-white hover:bg-cachi-500"),children:[n.jsx(Fo,{className:"h-4 w-4"}),h?"Saved!":"Save"]})]}),n.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:n.jsxs("div",{className:"mx-auto max-w-2xl",children:[o==="general"&&n.jsx(QD,{form:p,setForm:b,onReset:()=>{const S=Wn.getState().defaultModel;b({name:Pr.name,description:Pr.description,icon:Pr.icon,color:Pr.color,model:S,models:{default:S,image:"",audio:"",structured:""},systemPrompt:Pr.systemPrompt})}}),o==="knowledge"&&n.jsx(JD,{botId:f.id}),o==="skills"&&n.jsx(XD,{botId:f.id}),o==="connections"&&n.jsx(WD,{botId:f.id}),o==="voice"&&n.jsx(n9,{botId:f.id}),o==="advanced"&&n.jsx(s9,{}),o==="danger"&&n.jsx(a9,{botId:f.id,botName:f.name,isDefault:f.id==="default",onDelete:()=>d(!0)})]})}),c&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:n.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:[n.jsxs("div",{className:"mb-4 flex items-center gap-3 text-red-400",children:[n.jsx(Yi,{className:"h-6 w-6"}),n.jsx("h2",{className:"text-lg font-bold",children:"Delete Bot"})]}),n.jsxs("p",{className:"mb-6 text-zinc-400",children:["Are you sure you want to delete ",n.jsx("strong",{className:"text-zinc-200",children:f.name}),"? This action cannot be undone."]}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{onClick:()=>d(!1),className:"rounded-lg px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800",children:"Cancel"}),n.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 QD({form:e,setForm:s,onReset:a}){var b,v,y,N,S,w,j;const[r,o]=k.useState(!1),{imageGroups:c,audioGroups:d}=Wn(),{getActiveBot:h,updateBot:m}=xt(),f=h(),p=(C,T)=>{if(!f)return;const D={...f.capabilities||{},[C]:T};m(f.id,{capabilities:D})};return n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{className:"flex justify-end",children:n.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:[n.jsx(el,{className:"h-3 w-3"}),"Reset to Default"]})}),r&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:n.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:[n.jsxs("div",{className:"mb-4 flex items-center gap-3 text-amber-400",children:[n.jsx(el,{className:"h-6 w-6"}),n.jsx("h2",{className:"text-lg font-bold",children:"Reset General Settings"})]}),n.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.",n.jsx("br",{}),n.jsx("br",{}),n.jsx("strong",{className:"text-zinc-200",children:"Connections will not be affected."})]}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{onClick:()=>o(!1),className:"rounded-lg px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800",children:"Cancel"}),n.jsx("button",{onClick:()=>{a(),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"})]})]})}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Name"}),n.jsx("input",{type:"text",value:e.name,onChange:C=>s({...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"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Description"}),n.jsx("textarea",{value:e.description,onChange:C=>s({...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"})]})]}),n.jsxs("div",{className:"border-t border-zinc-800 pt-6",children:[n.jsxs("h3",{className:"mb-4 flex items-center gap-2 text-sm font-medium text-zinc-200",children:[n.jsx(t0,{className:"h-4 w-4 text-zinc-400"}),"Models"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsxs("label",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-zinc-300",children:[n.jsx(D4,{className:"h-3.5 w-3.5 text-zinc-500"}),"Default Model"]}),n.jsx($i,{value:((b=e.models)==null?void 0:b.default)||e.model||"",onChange:C=>{const T={...e.models||{default:""},default:C};s({...e,model:C,models:T})},placeholder:"Use system default",className:"w-full",filter:C=>!C.supports_image_generation&&!C.supports_audio}),n.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Main conversational model. Leave empty to use the system default."})]}),n.jsxs("div",{children:[n.jsx(w1,{icon:n.jsx(bm,{className:"h-4 w-4"}),label:"Image Generation",description:"Generate images via DALL-E, Imagen, Stability AI",enabled:!!((v=f==null?void 0:f.capabilities)!=null&&v.imageGeneration),onToggle:C=>p("imageGeneration",C)}),!!((y=f==null?void 0:f.capabilities)!=null&&y.imageGeneration)&&n.jsxs("div",{className:"mt-2 ml-7 pl-3 border-l-2 border-cachi-500/30",children:[n.jsxs("label",{className:"mb-1.5 flex items-center gap-2 text-xs font-medium text-zinc-400",children:[n.jsx(bm,{className:"h-3 w-3 text-zinc-500"}),"Image Model"]}),n.jsx($i,{value:((N=e.models)==null?void 0:N.image)||"",onChange:C=>{const T={...e.models||{default:""},image:C};s({...e,models:T})},placeholder:"Use plugin default",className:"w-full",groups:c}),n.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"e.g. openai/dall-e-3, google/imagen-3, stability/sd3-large"})]})]}),n.jsxs("div",{children:[n.jsx(w1,{icon:n.jsx(pm,{className:"h-4 w-4"}),label:"Audio Generation",description:"Text-to-speech and speech-to-text via OpenAI, ElevenLabs",enabled:!!((S=f==null?void 0:f.capabilities)!=null&&S.audioGeneration),onToggle:C=>p("audioGeneration",C)}),!!((w=f==null?void 0:f.capabilities)!=null&&w.audioGeneration)&&n.jsxs("div",{className:"mt-2 ml-7 pl-3 border-l-2 border-cachi-500/30",children:[n.jsxs("label",{className:"mb-1.5 flex items-center gap-2 text-xs font-medium text-zinc-400",children:[n.jsx(pm,{className:"h-3 w-3 text-zinc-500"}),"Audio Model"]}),n.jsx($i,{value:((j=e.models)==null?void 0:j.audio)||"",onChange:C=>{const T={...e.models||{default:""},audio:C};s({...e,models:T})},placeholder:"Use plugin default",className:"w-full",groups:d}),n.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"e.g. openai/tts-1, openai/whisper-1, elevenlabs/eleven_multilingual_v2"})]})]})]})]}),n.jsxs("div",{className:"border-t border-zinc-800 pt-6",children:[n.jsxs("h3",{className:"mb-4 flex items-center gap-2 text-sm font-medium text-zinc-200",children:[n.jsx(qo,{className:"h-4 w-4 text-zinc-400"}),"Appearance"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-xs text-zinc-500",children:"Icon"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:j2.map(C=>n.jsx("button",{onClick:()=>s({...e,icon:C.id}),title:C.label,className:X("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:n.jsx(En,{icon:C.id,size:20})},C.id))})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-xs text-zinc-500",children:"Color"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:GD.map(C=>n.jsx("button",{onClick:()=>s({...e,color:C}),className:X("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))})]})]})]}),n.jsxs("div",{className:"border-t border-zinc-800 pt-6",children:[n.jsxs("h3",{className:"mb-4 flex items-center gap-2 text-sm font-medium text-zinc-200",children:[n.jsx(Fr,{className:"h-4 w-4 text-zinc-400"}),"System Prompt"]}),n.jsx("textarea",{value:e.systemPrompt,onChange:C=>s({...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 JD({botId:e}){const[s,a]=k.useState(null),[r,o]=k.useState(!1),[c,d]=k.useState(null),h=p=>{a(p),o(!0)},m=()=>{a(null),o(!0)},f=()=>{o(!1),a(null)};return n.jsxs("div",{className:"space-y-6",children:[n.jsx(yD,{botId:e}),n.jsxs("div",{className:"border-t border-zinc-800 pt-6",children:[n.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-200",children:"Notes & Memory"}),n.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."}),n.jsx(mD,{botId:e,onEditNote:h,onNewNote:m})]}),n.jsxs("div",{className:"border-t border-zinc-800 pt-6",children:[n.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-200",children:"Search Knowledge"}),n.jsx("p",{className:"mb-4 text-xs text-zinc-500",children:"Test search across documents and notes."}),n.jsx(wD,{botId:e})]}),n.jsxs("div",{className:"border-t border-zinc-800 pt-6",children:[n.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-200",children:"Documents"}),n.jsx("p",{className:"mb-4 text-xs text-zinc-500",children:"Upload documents to give your bot specialized knowledge."}),n.jsx(aD,{botId:e}),n.jsx("div",{className:"mt-4",children:n.jsx(oD,{botId:e,onViewChunks:(p,b)=>d({id:p,filename:b})})})]}),n.jsx("div",{className:"border-t border-zinc-800 pt-6",children:n.jsx(cD,{botId:e})}),n.jsx(gD,{botId:e,noteId:s,open:r,onClose:f}),c&&n.jsx(zD,{botId:e,documentId:c.id,filename:c.filename,open:!!c,onClose:()=>d(null)})]})}function XD({botId:e}){const[s,a]=k.useState([]),[r,o]=k.useState(new Set),[c,d]=k.useState(!0),[h,m]=k.useState(!1),[f,p]=k.useState(null),[b,v]=k.useState(""),[y,N]=k.useState(!1),S=k.useCallback(async()=>{try{p(null);const[A,B]=await Promise.all([ID(),FD(e)]);a(A),o(new Set(B))}catch(A){p(A instanceof Error?A.message:"Failed to load skills")}finally{d(!1)}},[e]);k.useEffect(()=>{S()},[S]);const w=async()=>{m(!0);try{const A=await qD();a(A),p(null)}catch(A){p(A instanceof Error?A.message:"Failed to refresh skills")}finally{m(!1)}},j=async(A,B)=>{try{B?(await $D(e,A),o(V=>new Set([...V,A]))):(await VD(e,A),o(V=>{const ee=new Set(V);return ee.delete(A),ee}))}catch(V){p(V instanceof Error?V.message:"Failed to toggle skill")}},C=async A=>{if(confirm("Are you sure you want to delete this skill?"))try{await HD(A),a(B=>B.filter(V=>V.id!==A)),o(B=>{const V=new Set(B);return V.delete(A),V})}catch(B){p(B instanceof Error?B.message:"Failed to delete skill")}},T=A=>{a(B=>[...B,A]),N(!1)},E=[...s.filter(A=>{if(!b)return!0;const B=b.toLowerCase();return A.name.toLowerCase().includes(B)||A.description.toLowerCase().includes(B)||A.tags.some(V=>V.toLowerCase().includes(B))})].sort((A,B)=>{const V=r.has(A.id),ee=r.has(B.id);return V&&!ee?-1:!V&&ee?1:A.name.localeCompare(B.name)});return c?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx("div",{className:"text-sm text-zinc-500",children:"Loading skills..."})}):n.jsxs("div",{className:"space-y-6",children:[f&&n.jsx("div",{className:"rounded-lg border border-red-500/50 bg-red-500/10 p-3 text-sm text-red-400",children:f}),n.jsxs("div",{className:"flex items-center justify-between gap-4",children:[n.jsx("p",{className:"text-sm text-zinc-400",children:"Activate skills to give your bot specialized behaviors and capabilities."}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("button",{onClick:w,disabled:h,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:[n.jsx(Cn,{className:X("h-3.5 w-3.5",h&&"animate-spin")}),"Refresh"]}),n.jsxs("button",{onClick:()=>N(!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:[n.jsx(Ys,{className:"h-3.5 w-3.5"}),"Install"]})]})]}),n.jsxs("div",{className:"relative",children:[n.jsx(Tn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),n.jsx("input",{type:"text",value:b,onChange:A=>v(A.target.value),placeholder:"Search skills...",className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 py-2 pl-9 pr-3 text-sm text-zinc-100 placeholder:text-zinc-500 focus:border-cachi-500 focus:outline-none"})]}),E.length>0?n.jsx("div",{className:"space-y-3",children:E.map(A=>n.jsx(KD,{skill:A,isActive:r.has(A.id),onToggle:j,onDelete:C,showDelete:A.source==="local"||A.source==="installed"},A.id))}):b?n.jsx("div",{className:"rounded-lg border border-dashed border-zinc-700 p-8 text-center",children:n.jsx("p",{className:"text-sm text-zinc-500",children:"No skills match your search."})}):n.jsxs("div",{className:"rounded-lg border border-dashed border-zinc-700 p-8 text-center",children:[n.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-zinc-800",children:n.jsx(Sn,{className:"h-6 w-6 text-zinc-500"})}),n.jsx("h3",{className:"mb-2 font-medium text-zinc-300",children:"No skills available"}),n.jsxs("p",{className:"mb-4 text-sm text-zinc-500",children:["Create SKILL.md files in ",n.jsx("code",{className:"text-zinc-400",children:"~/.claude/skills/"})," ","or install from a URL."]}),n.jsxs("div",{className:"flex justify-center gap-3",children:[n.jsxs("button",{onClick:()=>N(!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:[n.jsx(Ys,{className:"h-4 w-4"}),"Install Skill"]}),n.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:[n.jsx(dl,{className:"h-4 w-4"}),"Browse skills.sh"]})]})]}),r.size>0&&n.jsxs("div",{className:"text-center text-xs text-zinc-500",children:[r.size," skill",r.size!==1?"s":""," active"]}),y&&n.jsx(ZD,{onClose:()=>N(!1),onInstalled:T})]})}function w1({icon:e,label:s,description:a,enabled:r,onToggle:o}){return n.jsxs("div",{className:X("flex items-center justify-between rounded-lg border p-3 transition-colors",r?"border-cachi-500/50 bg-cachi-500/5":"border-zinc-700 bg-zinc-800/30"),children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:X("text-zinc-400",r&&"text-cachi-500"),children:e}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium text-zinc-200",children:s}),n.jsx("div",{className:"text-xs text-zinc-500",children:a})]})]}),n.jsx("button",{onClick:()=>o(!r),className:r?"text-cachi-500":"text-zinc-600",children:r?n.jsx(fi,{className:"h-7 w-7"}):n.jsx(hi,{className:"h-7 w-7"})})]})}function KD({skill:e,isActive:s,onToggle:a,onDelete:r,showDelete:o}){return n.jsx("div",{className:X("rounded-lg border p-4 transition-colors",s?"border-cachi-500/50 bg-cachi-500/5":"border-zinc-700 bg-zinc-800/30"),children:n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h3",{className:"font-medium text-zinc-200",children:e.name}),e.version&&n.jsxs("span",{className:"rounded bg-zinc-700 px-1.5 py-0.5 text-xs text-zinc-400",children:["v",e.version]}),n.jsx("span",{className:"rounded bg-zinc-700 px-1.5 py-0.5 text-xs text-zinc-500",children:e.source})]}),n.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:e.description}),e.tags.length>0&&n.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:e.tags.map(c=>n.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&&n.jsxs("div",{className:"mt-2 text-xs text-zinc-500",children:["Requires: ",e.requiresTools.join(", ")]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[o&&n.jsx("button",{onClick:()=>r(e.id),className:"rounded p-1 text-zinc-500 hover:bg-zinc-700 hover:text-red-400",title:"Delete skill",children:n.jsx(Gt,{className:"h-4 w-4"})}),n.jsx("button",{onClick:()=>a(e.id,!s),className:s?"text-cachi-500":"text-zinc-600",children:s?n.jsx(fi,{className:"h-8 w-8"}):n.jsx(hi,{className:"h-8 w-8"})})]})]})})}function ZD({onClose:e,onInstalled:s}){const[a,r]=k.useState(""),[o,c]=k.useState(!1),[d,h]=k.useState(null),m=async()=>{if(a.trim()){c(!0),h(null);try{const f=await PD(a.trim());s(f)}catch(f){h(f instanceof Error?f.message:"Failed to install skill")}finally{c(!1)}}};return n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:n.jsxs("div",{className:"w-full max-w-md rounded-xl bg-zinc-900 shadow-xl",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 p-4",children:[n.jsx("h2",{className:"text-lg font-semibold text-zinc-100",children:"Install Skill"}),n.jsx("button",{onClick:e,className:"rounded-lg p-2 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:n.jsx(Gt,{className:"h-5 w-5"})})]}),n.jsxs("div",{className:"p-4 space-y-4",children:[d&&n.jsx("div",{className:"rounded-lg border border-red-500/50 bg-red-500/10 p-3 text-sm text-red-400",children:d}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Skill URL or skills.sh identifier"}),n.jsx("input",{type:"text",value:a,onChange:f=>r(f.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"}),n.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Enter a URL to a skill markdown file or a skills.sh identifier."})]})]}),n.jsxs("div",{className:"flex justify-end gap-3 border-t border-zinc-800 p-4",children:[n.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"}),n.jsx("button",{onClick:m,disabled:!a.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?n.jsxs(n.Fragment,{children:[n.jsx(Cn,{className:"h-4 w-4 animate-spin"}),"Installing..."]}):n.jsxs(n.Fragment,{children:[n.jsx(Ys,{className:"h-4 w-4"}),"Install"]})})]})]})})}function WD({botId:e}){return n.jsx("div",{className:"space-y-6",children:n.jsxs("div",{children:[n.jsx("p",{className:"mb-4 text-sm text-zinc-400",children:"Connect your bot to messaging platforms to send and receive messages."}),n.jsx(DD,{botId:e})]})})}const e9=["alloy","echo","fable","onyx","nova","shimmer"],t9=[{value:"",label:"Auto-detect"},{value:"en",label:"English"},{value:"es",label:"Spanish"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"pt",label:"Portuguese"},{value:"ja",label:"Japanese"},{value:"zh",label:"Chinese"},{value:"ko",label:"Korean"},{value:"it",label:"Italian"},{value:"ru",label:"Russian"},{value:"ar",label:"Arabic"}];function n9({botId:e}){var d;const{getActiveBot:s}=xt(),{voiceSettings:a,updateVoiceSettings:r}=Xt(),o=s();return!((d=o==null?void 0:o.capabilities)!=null&&d.audioGeneration)?n.jsx("div",{className:"space-y-4",children:n.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-amber-500/30 bg-amber-500/5 p-4",children:[n.jsx(pm,{className:"h-5 w-5 text-amber-400"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-amber-300",children:"Audio Generation Required"}),n.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:'Enable the "Audio Generation" capability in the General settings to use voice features.'})]})]})}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsxs("label",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-zinc-300",children:[n.jsx(Do,{className:"h-4 w-4 text-zinc-400"}),"TTS Voice"]}),n.jsx("div",{className:"flex flex-wrap gap-2",children:e9.map(h=>n.jsx("button",{onClick:()=>r({ttsVoice:h}),className:X("rounded-lg border px-3 py-1.5 text-sm capitalize transition-all",a.ttsVoice===h?"border-cachi-500 bg-cachi-500/20 text-cachi-300":"border-zinc-700 bg-zinc-800 text-zinc-400 hover:border-zinc-600"),children:h},h))}),n.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"For ElevenLabs, set a voice ID in the input below instead."}),n.jsx("input",{type:"text",placeholder:"Custom voice ID (ElevenLabs)",value:a.ttsVoice,onChange:h=>r({ttsVoice:h.target.value}),className:"mt-2 h-9 w-full 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"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Speech Speed"}),n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("input",{type:"range",min:"0.5",max:"2",step:"0.1",value:a.ttsSpeed,onChange:h=>r({ttsSpeed:parseFloat(h.target.value)}),className:"flex-1"}),n.jsxs("span",{className:"w-12 text-center text-sm text-zinc-400",children:[a.ttsSpeed,"x"]})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Speech Recognition Language"}),n.jsx("select",{value:a.sttLanguage||"",onChange:h=>r({sttLanguage:h.target.value||null}),className:"h-10 w-full rounded-lg border border-zinc-700 bg-zinc-800 px-3 text-sm text-zinc-100 outline-none focus:border-cachi-500",children:t9.map(h=>n.jsx("option",{value:h.value,children:h.label},h.value))})]}),n.jsxs("div",{className:"space-y-4 border-t border-zinc-800 pt-6",children:[n.jsxs("label",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-zinc-300",children:"Enable Interruption"}),n.jsx("p",{className:"text-xs text-zinc-500",children:"Allow interrupting the bot while it speaks"})]}),n.jsx("button",{onClick:()=>r({enableInterruption:!a.enableInterruption}),className:"text-zinc-400",children:a.enableInterruption?n.jsx(fi,{className:"h-6 w-6 text-cachi-500"}):n.jsx(hi,{className:"h-6 w-6"})})]}),n.jsxs("label",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-zinc-300",children:"Save Transcripts"}),n.jsx("p",{className:"text-xs text-zinc-500",children:"Save voice conversations to chat history"})]}),n.jsx("button",{onClick:()=>r({saveTranscripts:!a.saveTranscripts}),className:"text-zinc-400",children:a.saveTranscripts?n.jsx(fi,{className:"h-6 w-6 text-cachi-500"}):n.jsx(hi,{className:"h-6 w-6"})})]})]})]})}function s9(){return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Temperature"}),n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",defaultValue:"0.7",className:"flex-1"}),n.jsx("span",{className:"w-12 text-center text-sm text-zinc-400",children:"0.7"})]}),n.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Lower = focused, higher = creative"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Max Iterations"}),n.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"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Approval Mode"}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"radio",name:"approval",defaultChecked:!0,className:"text-cachi-500"}),n.jsx("span",{className:"text-sm text-zinc-300",children:"Auto-approve safe actions"})]}),n.jsxs("label",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"radio",name:"approval",className:"text-cachi-500"}),n.jsx("span",{className:"text-sm text-zinc-300",children:"Approve all actions"})]})]})]})]})}function a9({botId:e,botName:s,isDefault:a,onDelete:r}){const[o,c]=k.useState(!1),[d,h]=k.useState(null),m=async()=>{c(!0),h(null);try{const{exportBot:f}=await oi(async()=>{const{exportBot:N}=await Promise.resolve().then(()=>wm);return{exportBot:N}},void 0),p=await f(e),b=new Blob([JSON.stringify(p,null,2)],{type:"application/json"}),v=URL.createObjectURL(b),y=document.createElement("a");y.href=v,y.download=`${s.toLowerCase().replace(/\s+/g,"-")}-export.json`,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(v)}catch(f){h(f instanceof Error?f.message:"Failed to export bot")}finally{c(!1)}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-lg border border-zinc-700 bg-zinc-900/50 p-6",children:[n.jsx("h3",{className:"text-lg font-semibold text-zinc-200",children:"Export Bot"}),n.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&&n.jsx("p",{className:"mt-2 text-sm text-red-400",children:d}),n.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:[n.jsx(Ys,{className:"h-4 w-4"}),o?"Exporting...":"Export Configuration"]})]}),a?n.jsxs("div",{className:"rounded-lg border border-zinc-700 bg-zinc-900/50 p-6",children:[n.jsx("h3",{className:"text-lg font-semibold text-zinc-400",children:"Delete this bot"}),n.jsx("p",{className:"mt-2 text-sm text-zinc-500",children:"The default bot cannot be deleted."})]}):n.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-6",children:[n.jsx("h3",{className:"text-lg font-semibold text-red-400",children:"Delete this bot"}),n.jsxs("p",{className:"mt-2 text-sm text-zinc-400",children:["Once you delete ",n.jsx("strong",{className:"text-zinc-200",children:s}),", there is no going back. All chats, jobs, and tasks will be permanently deleted."]}),n.jsxs("button",{onClick:r,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:[n.jsx(Vt,{className:"h-4 w-4"}),"Delete Bot"]})]})]})}function i9(){var N,S;const[e,s]=k.useState("7d"),{bots:a}=xt(),{chats:r,messages:o}=qt(),{jobs:c}=_u(),{tasks:d}=sl(),{stats:h}=Hu(),m=Object.values(o).reduce((w,j)=>w+j.length,0),f=c.filter(w=>w.status==="running").length,p=d.filter(w=>w.status==="done").length,b=d.filter(w=>w.status==="todo").length,v=r.length,y=a.map(w=>{const j=r.filter(A=>A.botId===w.id),C=j.reduce((A,B)=>{var V;return A+(((V=o[B.id])==null?void 0:V.length)||0)},0),T=c.filter(A=>A.botId===w.id),D=d.filter(A=>A.botId===w.id),E=h.byBot[w.id]||{tokens:0,cost:0};return{bot:w,chats:j.length,messages:C,jobs:T.length,activeJobs:T.filter(A=>A.status==="running").length,tasks:D.length,completedTasks:D.filter(A=>A.status==="done").length,connections:j.length,tokens:E.tokens,cost:E.cost}});return n.jsxs("div",{className:"flex h-full flex-col bg-zinc-100 dark:bg-zinc-950",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-200 dark:border-zinc-800 px-6 py-4",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-bold text-zinc-900 dark:text-zinc-100",children:"Dashboard"}),n.jsx("p",{className:"text-sm text-zinc-500",children:"Overview of your bots and activity"})]}),n.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(w=>n.jsx("button",{onClick:()=>s(w),className:X("rounded-md px-3 py-1.5 text-sm font-medium transition-colors",e===w?"bg-cachi-600 text-white":"text-zinc-400 hover:text-zinc-200"),children:w==="all"?"All Time":w},w))})]}),n.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:n.jsxs("div",{className:"mx-auto max-w-6xl space-y-6",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[n.jsx(Ui,{icon:Hn,label:"Active Bots",value:a.length,trend:"+0",trendUp:!0,color:"green"}),n.jsx(Ui,{icon:di,label:"Total Messages",value:m.toLocaleString(),subValue:`${r.length} chats`,color:"blue"}),n.jsx(Ui,{icon:Xi,label:"Tokens Used",value:Eu(h.totalTokens),subValue:`${h.totalMessages} API calls`,color:"purple"}),n.jsx(Ui,{icon:b4,label:"Total Cost",value:`$${h.totalCost.toFixed(4)}`,subValue:"estimated",color:"amber"})]}),n.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[n.jsx(Ui,{icon:fv,label:"Active Jobs",value:f,subValue:`${c.length} total`,color:"blue",small:!0}),n.jsx(Ui,{icon:m0,label:"Tasks Completed",value:p,subValue:`${b} pending`,color:"green",small:!0}),n.jsx(Ui,{icon:c0,label:"Connections",value:v,subValue:`${a.length} bots`,color:"cyan",small:!0})]}),n.jsxs("section",{children:[n.jsxs("h2",{className:"mb-4 flex items-center gap-2 text-lg font-semibold text-zinc-200",children:[n.jsx(Hn,{className:"h-5 w-5 text-zinc-400"}),"Bot Performance"]}),n.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:y.map(({bot:w,chats:j,messages:C,activeJobs:T,completedTasks:D,tokens:E,cost:A,connections:B})=>n.jsx(r9,{bot:w,chats:j,messages:C,activeJobs:T,completedTasks:D,tokens:E,cost:A,connections:B},w.id))})]}),n.jsxs("section",{children:[n.jsxs("h2",{className:"mb-4 flex items-center gap-2 text-lg font-semibold text-zinc-200",children:[n.jsx(Ou,{className:"h-5 w-5 text-zinc-400"}),"Usage Over Time"]}),n.jsx("div",{className:"rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50 p-6",children:h.daily.length>0?n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"flex items-end gap-1",style:{height:120},children:h.daily.slice(-14).map(w=>{const j=Math.max(...h.daily.map(T=>T.tokens)),C=j>0?Math.max(w.tokens/j*120,5):5;return n.jsxs("div",{className:"group relative h-full flex-1",children:[n.jsx("div",{className:"absolute bottom-0 left-0 right-0 rounded-t bg-green-600 transition-all hover:bg-green-500",style:{height:C}}),n.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:[Eu(w.tokens)," tokens"]})]},w.date)})}),n.jsxs("div",{className:"flex justify-between text-xs text-zinc-600",children:[n.jsx("span",{children:(N=h.daily[Math.max(0,h.daily.length-14)])==null?void 0:N.date}),n.jsx("span",{children:(S=h.daily[h.daily.length-1])==null?void 0:S.date})]})]}):n.jsx("div",{className:"flex h-32 items-center justify-center text-zinc-500",children:n.jsxs("div",{className:"text-center",children:[n.jsx(Ou,{className:"mx-auto mb-2 h-8 w-8 text-zinc-600"}),n.jsx("p",{children:"No usage data yet"}),n.jsx("p",{className:"text-xs text-zinc-600",children:"Start chatting to see analytics"})]})})})]}),Object.keys(h.byModel).length>0&&n.jsxs("section",{children:[n.jsxs("h2",{className:"mb-4 flex items-center gap-2 text-lg font-semibold text-zinc-200",children:[n.jsx(t0,{className:"h-5 w-5 text-zinc-400"}),"Model Usage"]}),n.jsx("div",{className:"rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50",children:n.jsx("div",{className:"divide-y divide-zinc-800",children:Object.entries(h.byModel).sort((w,j)=>j[1].tokens-w[1].tokens).map(([w,j])=>n.jsxs("div",{className:"flex items-center justify-between px-5 py-3",children:[n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-zinc-200",children:w}),n.jsxs("p",{className:"text-xs text-zinc-500",children:[j.messages," messages"]})]}),n.jsxs("div",{className:"text-right",children:[n.jsx("p",{className:"font-mono text-sm text-zinc-200",children:Eu(j.tokens)}),n.jsxs("p",{className:"text-xs text-zinc-500",children:["$",j.cost.toFixed(4)]})]})]},w))})})]})]})})]})}function Ui({icon:e,label:s,value:a,subValue:r,trend:o,trendUp:c,color:d,small:h}){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 n.jsxs("div",{className:X("rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50",h?"p-4":"p-5"),children:[n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsx("div",{className:X("flex items-center justify-center rounded-lg",m[d],h?"h-9 w-9":"h-10 w-10"),children:n.jsx(e,{className:h?"h-4 w-4":"h-5 w-5"})}),o&&n.jsxs("div",{className:X("flex items-center gap-0.5 text-xs font-medium",c?"text-green-400":"text-red-400"),children:[o,n.jsx(h4,{className:X("h-3 w-3",!c&&"rotate-90")})]})]}),n.jsxs("div",{className:h?"mt-3":"mt-4",children:[n.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-zinc-500",children:s}),n.jsx("p",{className:X("font-bold text-zinc-100",h?"mt-0.5 text-xl":"mt-1 text-2xl"),children:a}),r&&n.jsx("p",{className:"mt-0.5 text-xs text-zinc-500",children:r})]})]})}function r9({bot:e,chats:s,messages:a,activeJobs:r,completedTasks:o,tokens:c,cost:d,connections:h}){return n.jsxs("div",{className:"rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50 p-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl",style:{backgroundColor:e.color+"20"},children:n.jsx(En,{icon:e.icon,size:22,color:e.color})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("h3",{className:"truncate font-semibold text-zinc-100",children:e.name}),n.jsx("p",{className:"truncate text-xs text-zinc-500",children:e.model})]})]}),n.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[n.jsx(vu,{icon:di,value:a,label:"messages"}),n.jsx(vu,{icon:Xi,value:Eu(c),label:"tokens"}),n.jsx(vu,{icon:fv,value:r,label:"active jobs"}),n.jsx(vu,{icon:m0,value:o,label:"completed"})]}),n.jsxs("div",{className:"mt-3 flex items-center justify-between border-t border-zinc-800 pt-3",children:[n.jsxs("div",{className:"flex items-center gap-3 text-xs text-zinc-500",children:[n.jsxs("span",{children:[s," chats"]}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx(c0,{className:"h-3 w-3"}),h]})]}),n.jsxs("div",{className:"text-xs font-medium text-zinc-400",children:["$",d.toFixed(4)]})]})]})}function vu({icon:e,value:s,label:a}){return n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(e,{className:"h-3.5 w-3.5 text-zinc-600"}),n.jsxs("div",{children:[n.jsx("span",{className:"font-medium text-zinc-200",children:s}),n.jsx("span",{className:"ml-1 text-xs text-zinc-600",children:a})]})]})}function Eu(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}const Im=["welcome","api-key","model","preferences","complete"],Pu=Nt()(Yt(e=>({isOpen:!1,currentStep:0,hasCompletedOnboarding:!1,open:()=>e({isOpen:!0,currentStep:0}),close:()=>e({isOpen:!1}),nextStep:()=>e(s=>({currentStep:Math.min(s.currentStep+1,Im.length-1)})),prevStep:()=>e(s=>({currentStep:Math.max(s.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})})),$0=Nt(e=>({config:null,setConfig:s=>e({config:s}),updateConfig:s=>e(a=>a.config?{config:{...a.config,agent:{...a.config.agent,...s.model!==void 0&&{model:s.model},...s.maxIterations!==void 0&&{maxIterations:s.maxIterations},...s.approveActions!==void 0&&{approveActions:s.approveActions},...s.temperature!==void 0&&{temperature:s.temperature}},display:{...a.config.display,...s.showThinking!==void 0&&{showThinking:s.showThinking},...s.showCost!==void 0&&{showCost:s.showCost}}}}:a)})),l9="/api";function o9(){const{accessToken:e}=Ut.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function od(e,s={},a=!0){const r=`${l9}${e}`,o=await fetch(r,{headers:{"Content-Type":"application/json",...o9(),...s.headers},...s});if(o.status===401&&a&&await As())return od(e,s,!1);if(!o.ok){const c=await o.json().catch(()=>({}));throw new Error(c.detail||`Request failed: ${o.statusText}`)}return o.json()}async function tm(){return(await od("/providers")).providers}async function c9(e,s){await od(`/providers/${e}`,{method:"PUT",body:JSON.stringify({value:s})})}async function u9(e){await od(`/providers/${e}`,{method:"DELETE"})}const Qo=Nt(e=>({providers:[],loading:!1,error:null,refresh:async()=>{e({loading:!0,error:null});try{const s=await tm();e({providers:s,loading:!1})}catch(s){e({error:s instanceof Error?s.message:"Failed to load providers",loading:!1})}},update:async(s,a)=>{try{await c9(s,a);const r=await tm();e({providers:r})}catch(r){throw e({error:r instanceof Error?r.message:"Failed to update provider"}),r}},remove:async s=>{try{await u9(s);const a=await tm();e({providers:a})}catch(a){throw e({error:a instanceof Error?a.message:"Failed to remove provider"}),a}}})),d9=36e5,cd=Nt()(Yt((e,s)=>({checkResult:null,updateResult:null,isChecking:!1,isUpdating:!1,isRestarting:!1,showBanner:!1,showDialog:!1,lastCheckAt:0,skippedVersions:[],optIntoBeta:!1,checkForUpdate:async(a=!1)=>{const r=s();if(!(!a&&Date.now()-r.lastCheckAt<d9)&&!r.isChecking){e({isChecking:!0});try{const o=await g2(a),c=o.latest_stable||o.latest_prerelease,d=c?r.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 a=>{var o,c;const r=s();if(!r.isUpdating){e({isUpdating:!0});try{const d=await b2({target_version:a,include_prerelease:r.optIntoBeta});e({updateResult:d})}catch(d){e({updateResult:{success:!1,old_version:((o=r.checkResult)==null?void 0:o.current_version)||"unknown",new_version:((c=r.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:a=>{e(r=>({skippedVersions:[...r.skippedVersions,a],showBanner:!1,showDialog:!1}))},restartServer:async()=>{e({isRestarting:!0});try{await y2()}catch{}const a=30;for(let r=0;r<a;r++){await new Promise(o=>setTimeout(o,2e3));try{await g0(),window.location.reload();return}catch{}}e({isRestarting:!1})},dismissBanner:()=>e({showBanner:!1}),openDialog:()=>e({showDialog:!0}),closeDialog:()=>e({showDialog:!1,updateResult:null}),setOptIntoBeta:a=>e({optIntoBeta:a})}),{name:"cachibot-update",partialize:e=>({skippedVersions:e.skippedVersions,optIntoBeta:e.optIntoBeta,lastCheckAt:e.lastCheckAt})})),Zt=k.forwardRef(({className:e,variant:s="primary",size:a="md",disabled:r,...o},c)=>n.jsx("button",{ref:c,disabled:r,className:X("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":s==="primary","bg-zinc-100 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700":s==="secondary","hover:bg-zinc-100 dark:hover:bg-zinc-800":s==="ghost","bg-red-600 text-white hover:bg-red-700 active:bg-red-800":s==="danger"},{"h-8 px-3 text-sm":a==="sm","h-10 px-4 text-sm":a==="md","h-12 px-6 text-base":a==="lg"},e),...o}));Zt.displayName="Button";const h9=["general","appearance","models","keys","advanced","data","users"];function f9(){const{settingsTab:e}=K1(),s=hn(),{theme:a,setTheme:r,accentColor:o,setAccentColor:c,showThinking:d,setShowThinking:h,showCost:m,setShowCost:f,sidebarCollapsed:p,setSidebarCollapsed:b}=Bt(),{config:v}=$0(),{user:y}=Ut(),N=(y==null?void 0:y.role)==="admin",[S,w]=k.useState(null);k.useEffect(()=>{g0().then(w).catch(()=>{})},[]);const C=!e||!h9.includes(e)||e==="users"&&!N?"general":e;k.useEffect(()=>{e&&C!==e&&s("/settings/general",{replace:!0})},[e,C,s]);const T=E=>{s(`/settings/${E}`)},D=[{id:"general",label:"General",icon:hl},{id:"appearance",label:"Appearance",icon:qo},{id:"models",label:"Models",icon:Fr},{id:"keys",label:"API Keys",icon:Mv},{id:"advanced",label:"Advanced",icon:Ku},{id:"data",label:"Data & Privacy",icon:Po},...N?[{id:"users",label:"Users",icon:Qi}]:[]];return n.jsxs("div",{className:"flex h-full flex-col bg-zinc-50 dark:bg-zinc-950",children:[n.jsx("div",{className:"flex items-center justify-between border-b border-zinc-300 px-6 py-4 dark:border-zinc-800",children:n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-bold text-zinc-900 dark:text-zinc-100",children:"Settings"}),n.jsx("p",{className:"text-sm text-zinc-500",children:"Configure CachiBot preferences"})]})}),n.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[n.jsx("nav",{className:"w-56 border-r border-zinc-300 p-4 dark:border-zinc-800",children:n.jsx("div",{className:"space-y-1",children:D.map(E=>n.jsxs("button",{onClick:()=>T(E.id),className:X("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm transition-colors",C===E.id?"bg-accent-600/20 text-accent-600 dark:text-accent-400":"text-zinc-600 hover:bg-zinc-200 hover:text-zinc-900 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-200"),children:[n.jsx(E.icon,{className:"h-4 w-4"}),E.label]},E.id))})}),n.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:n.jsxs("div",{className:"mx-auto max-w-2xl space-y-8",children:[C==="general"&&n.jsx(m9,{showThinking:d,setShowThinking:h,showCost:m,setShowCost:f,config:v,healthInfo:S}),C==="appearance"&&n.jsx(g9,{theme:a,setTheme:r,accentColor:o,setAccentColor:c,sidebarCollapsed:p,setSidebarCollapsed:b}),C==="models"&&n.jsx(j9,{}),C==="keys"&&n.jsx(w9,{}),C==="advanced"&&n.jsx(z9,{config:v}),C==="data"&&n.jsx(N9,{}),C==="users"&&N&&n.jsx(S9,{currentUser:y})]})})]})]})}function m9({showThinking:e,setShowThinking:s,showCost:a,setShowCost:r,config:o,healthInfo:c}){return n.jsxs(n.Fragment,{children:[n.jsx(Mt,{icon:za,title:"Display Options",children:n.jsxs("div",{className:"space-y-4",children:[n.jsx(ci,{label:"Show Thinking Process",description:"Display the AI's reasoning and thought process",checked:e,onChange:s}),n.jsx(ci,{label:"Show Token Costs",description:"Display estimated costs for API calls",checked:a,onChange:r})]})}),n.jsx(Mt,{icon:f4,title:"Notifications",children:n.jsxs("div",{className:"space-y-4",children:[n.jsx(ci,{label:"Desktop Notifications",description:"Get notified when tasks complete",checked:!1,onChange:()=>{}}),n.jsx(ci,{label:"Sound Effects",description:"Play sounds for important events",checked:!1,onChange:()=>{}})]})}),n.jsx(Mt,{icon:Qu,title:"Workspace",children:n.jsx("div",{className:"space-y-4",children:n.jsxs(ya,{label:"Workspace Path",children:[n.jsxs("div",{className:"flex gap-2",children:[n.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"}),n.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"})]}),n.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Directory where bots can read and write files"})]})})}),n.jsx(Mt,{icon:r0,title:"About",children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Version"}),n.jsx("span",{className:"font-mono text-zinc-800 dark:text-zinc-200",children:(c==null?void 0:c.version)??"..."})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Build"}),n.jsx("span",{className:"font-mono text-zinc-800 dark:text-zinc-200",children:(c==null?void 0:c.build)??"..."})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Python"}),n.jsx("span",{className:"font-mono text-zinc-800 dark:text-zinc-200",children:(c==null?void 0:c.python)??"..."})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Platform"}),n.jsx("span",{className:"font-mono text-zinc-800 dark:text-zinc-200",children:(c==null?void 0:c.platform)??"..."})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Documentation"}),n.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",n.jsx(dl,{className:"h-3 w-3"})]})]})]})}),n.jsx(x9,{}),n.jsx(p9,{healthInfo:c})]})}function x9(){const{open:e}=Pu(),s=()=>{e()};return n.jsx(Mt,{icon:Cn,title:"Setup",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:"Run Setup Wizard"}),n.jsx("p",{className:"text-sm text-zinc-500",children:"Re-run the initial setup to configure API keys, models, and preferences"})]}),n.jsxs("button",{onClick:s,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:[n.jsx(Cn,{className:"h-4 w-4"}),"Run Wizard"]})]})})}function p9({healthInfo:e}){const{checkResult:s,isChecking:a,optIntoBeta:r,setOptIntoBeta:o,checkForUpdate:c,openDialog:d,lastCheckAt:h}=cd();k.useEffect(()=>{c()},[c]);const m=(s==null?void 0:s.current_version)||(e==null?void 0:e.version)||"...",f=s==null?void 0:s.latest_stable,p=s==null?void 0:s.latest_prerelease,b=(s==null?void 0:s.update_available)||(s==null?void 0:s.prerelease_available),v=N=>{if(!N)return"Never";const S=Math.floor((Date.now()-N)/1e3);if(S<60)return"Just now";const w=Math.floor(S/60);if(w<60)return`${w}m ago`;const j=Math.floor(w/60);return j<24?`${j}h ago`:`${Math.floor(j/24)}d ago`},y=e!=null&&e.build?n.jsx("span",{className:X("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 n.jsx(Mt,{icon:Ys,title:"Updates",children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Current Version"}),n.jsxs("span",{className:"font-mono text-zinc-800 dark:text-zinc-200",children:[m,y]})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Latest Version"}),f?n.jsxs("span",{className:X("font-mono",s!=null&&s.update_available?"text-accent-500":"text-green-400"),children:[f,!(s!=null&&s.update_available)&&" (up to date)"]}):n.jsx("span",{className:"text-zinc-500",children:"—"})]}),p&&r&&n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Latest Pre-release"}),n.jsx("span",{className:"font-mono text-amber-400",children:p})]}),n.jsx(ci,{label:"Include Pre-release Versions",description:"Opt into beta and development builds",checked:r,onChange:o}),n.jsx("div",{className:"flex items-center justify-between",children:n.jsxs("span",{className:"text-sm text-zinc-500",children:["Last checked: ",v(h)]})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("button",{onClick:()=>c(!0),disabled:a,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:[a?n.jsx(Le,{className:"h-4 w-4 animate-spin"}):n.jsx(Cn,{className:"h-4 w-4"}),"Check Now"]}),b&&n.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:[n.jsx(Ys,{className:"h-4 w-4"}),"Update Available — View Details"]})]})]})})}function g9({theme:e,setTheme:s,accentColor:a,setAccentColor:r,sidebarCollapsed:o,setSidebarCollapsed:c}){const d=[{value:"light",label:"Light",icon:qv},{value:"dark",label:"Dark",icon:Lv},{value:"system",label:"System",icon:_v}],h=Object.entries(td);return n.jsxs(n.Fragment,{children:[n.jsx(Mt,{icon:qo,title:"Theme",children:n.jsxs("div",{className:"space-y-4",children:[n.jsx(ya,{label:"Color Theme",children:n.jsx("div",{className:"flex gap-2",children:d.map(m=>n.jsxs("button",{onClick:()=>s(m.value),className:X("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:[n.jsx(m.icon,{className:"h-4 w-4"}),m.label]},m.value))})}),n.jsx(ya,{label:"Accent Color",children:n.jsx("div",{className:"grid grid-cols-4 gap-2",children:h.map(([m,{name:f,palette:p}])=>n.jsxs("button",{onClick:()=>r(m),className:X("flex items-center gap-2 rounded-lg border p-3 transition-all",a===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:a===m?p[500]:void 0,"--tw-ring-color":a===m?p[500]:void 0},children:[n.jsx("div",{className:"h-5 w-5 rounded-full",style:{backgroundColor:p[500]}}),n.jsx("span",{className:"text-sm text-zinc-700 dark:text-zinc-300",children:f})]},m))})})]})}),n.jsx(Mt,{icon:Ku,title:"Layout",children:n.jsxs("div",{className:"space-y-4",children:[n.jsx(ci,{label:"Collapse Sidebar by Default",description:"Start with sidebar in compact mode",checked:o,onChange:c}),n.jsx(ya,{label:"Chat Message Style",children:n.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:[n.jsx("option",{value:"detailed",children:"Detailed (with metadata)"}),n.jsx("option",{value:"compact",children:"Compact"}),n.jsx("option",{value:"minimal",children:"Minimal"})]})})]})}),n.jsx(Mt,{icon:Js,title:"Code Display",children:n.jsxs("div",{className:"space-y-4",children:[n.jsx(ya,{label:"Code Font",children:n.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:[n.jsx("option",{value:"jetbrains-mono",children:"JetBrains Mono"}),n.jsx("option",{value:"fira-code",children:"Fira Code"}),n.jsx("option",{value:"monaco",children:"Monaco"}),n.jsx("option",{value:"consolas",children:"Consolas"})]})}),n.jsx(ci,{label:"Enable Ligatures",description:"Display programming ligatures in code",checked:!0,onChange:()=>{}})]})})]})}const b9={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"},y9={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 v9(e){return e?e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:e.toString():"—"}function z1(e){return e==null?"—":e===0?"Free":e>=1?`$${e.toFixed(2)}`:`$${e.toFixed(4)}`.replace(/0+$/,"")}function j9(){const{groups:e,defaultModel:s,loading:a,updateDefaultModel:r,refresh:o}=Wn(),[c,d]=k.useState(""),[h,m]=k.useState({});k.useEffect(()=>{o()},[o]);const f=async w=>{w&&await r(w)},p={};for(const[w,j]of Object.entries(e)){const C=c?j.filter(T=>T.id.toLowerCase().includes(c.toLowerCase())):j;C.length>0&&(p[w]=C)}const b=Object.values(e).reduce((w,j)=>w+j.length,0),v=Object.values(p).reduce((w,j)=>w+j.length,0),y=Object.keys(p).length,N=w=>m(j=>({...j,[w]:!j[w]})),S=c.length>0;return n.jsxs(n.Fragment,{children:[n.jsx(Mt,{icon:Fr,title:"Default Model",children:n.jsx("div",{className:"space-y-4",children:n.jsxs(ya,{label:"System Default Model",children:[n.jsx($i,{value:s,onChange:f,placeholder:"Select default model...",className:"w-full"}),n.jsx("p",{className:"mt-2 text-xs text-zinc-500",children:"Used when no specific model is configured for a bot."})]})})}),n.jsx(Mt,{icon:Fr,title:"Available Models",children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"relative",children:[n.jsx(Tn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),n.jsx("input",{type:"text",placeholder:"Search models...",value:c,onChange:w=>d(w.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&&n.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:n.jsx(Gt,{className:"h-3.5 w-3.5"})})]}),n.jsx("p",{className:"text-xs text-zinc-500",children:S?`${v} result${v!==1?"s":""} across ${y} provider${y!==1?"s":""}`:`${b} model${b!==1?"s":""} from ${y} provider${y!==1?"s":""}`}),a&&n.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-zinc-500",children:[n.jsx(Le,{className:"h-4 w-4 animate-spin"}),"Discovering models..."]}),!a&&b===0&&n.jsxs("div",{className:"text-center py-6",children:[n.jsx(Fr,{className:"h-7 w-7 text-zinc-400 dark:text-zinc-600 mx-auto mb-2"}),n.jsx("p",{className:"text-sm text-zinc-500",children:"No models available"}),n.jsx("p",{className:"text-xs text-zinc-400 dark:text-zinc-600 mt-1",children:"Configure API keys to discover models."})]}),!a&&b>0&&v===0&&n.jsx("div",{className:"text-center py-6 text-zinc-500 text-sm",children:"No models match your search"}),!a&&n.jsx("div",{className:"space-y-1.5",children:Object.entries(p).sort(([w],[j])=>w.localeCompare(j)).map(([w,j])=>{const C=b9[w]||w.charAt(0).toUpperCase()+w.slice(1),T=y9[w]||"bg-zinc-500",D=S||h[w];return n.jsxs("div",{className:"rounded-lg border border-zinc-200 overflow-hidden dark:border-zinc-700",children:[n.jsxs("button",{onClick:()=>N(w),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:[n.jsx(Yu,{className:X("h-3.5 w-3.5 text-zinc-400 transition-transform",D&&"rotate-90")}),n.jsx("span",{className:X("h-2 w-2 rounded-full shrink-0",T)}),n.jsx("span",{className:"text-sm font-medium text-zinc-700 dark:text-zinc-300",children:C}),n.jsx("span",{className:"ml-auto text-xs text-zinc-400 dark:text-zinc-500",children:j.length})]}),D&&n.jsx("div",{className:"border-t border-zinc-200 dark:border-zinc-700 max-h-64 overflow-y-auto",children:j.map(E=>{const A=E.id===s;return n.jsxs("div",{className:X("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:[n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-[13px] text-zinc-800 dark:text-zinc-200 truncate",title:E.id,children:E.id}),A&&n.jsx(nl,{className:"h-3 w-3 shrink-0 fill-current text-accent-500"}),E.is_reasoning&&n.jsx(Sn,{className:"h-3 w-3 shrink-0 text-purple-400"})]}),n.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-zinc-400 dark:text-zinc-500",children:[n.jsxs("span",{children:[v9(E.context_window)," ctx"]}),E.pricing&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-zinc-300 dark:text-zinc-700",children:"/"}),n.jsx("span",{className:"text-emerald-600 dark:text-emerald-400",children:z1(E.pricing.input)}),n.jsx("span",{className:"text-zinc-300 dark:text-zinc-700",children:"·"}),n.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:z1(E.pricing.output)})]})]})]}),!A&&n.jsx("button",{onClick:()=>f(E.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:n.jsx(nl,{className:"h-3.5 w-3.5"})})]},E.id)})})]},w)})})]})})]})}const N1=new Set(["openai","claude","google","groq","grok","openrouter","moonshot","zai","modelscope","azure","stability","elevenlabs"]),vo={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",stability:"Stability AI",elevenlabs:"ElevenLabs",ollama:"Ollama",lmstudio:"LM Studio",local_http:"Local HTTP"};function w9(){const{providers:e,loading:s,refresh:a,update:r,remove:o}=Qo(),{refresh:c}=Wn(),[d,h]=k.useState({}),[m,f]=k.useState(new Set),[p,b]=k.useState(null);k.useEffect(()=>{a()},[a]);const v=e.filter(C=>N1.has(C.name)),y=e.filter(C=>!N1.has(C.name)),N=async C=>{const T=d[C];if(T!=null&&T.trim()){b(C);try{await r(C,T.trim()),h(D=>{const E={...D};return delete E[C],E}),f(D=>{const E=new Set(D);return E.delete(C),E}),c(),ke.success(`${vo[C]||C} key saved`)}catch{ke.error(`Failed to save ${vo[C]||C} key`)}finally{b(null)}}},S=async C=>{try{await o(C),h(T=>{const D={...T};return delete D[C],D}),c(),ke.success(`${vo[C]||C} key removed`)}catch{ke.error(`Failed to remove ${vo[C]||C} key`)}},w=C=>{f(T=>{const D=new Set(T);return D.has(C)?D.delete(C):D.add(C),D})},j=C=>{const T=C.name in d,D=d[C.name]??"",E=m.has(C.name),A=p===C.name,B=vo[C.name]||C.name,V=C.type==="endpoint";return n.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:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:B}),n.jsx("span",{className:X("inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium",C.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:C.configured?"Active":"Not set"})]}),C.configured&&n.jsx("button",{onClick:()=>S(C.name),className:"rounded p-1 text-zinc-400 transition-colors hover:bg-red-500/10 hover:text-red-400",title:"Remove key",children:n.jsx(Vt,{className:"h-4 w-4"})})]}),n.jsxs("p",{className:"text-xs text-zinc-500",children:[V?"Endpoint URL":"API Key",": ",n.jsx("code",{className:"text-zinc-400",children:C.env_key}),C.default&&n.jsxs("span",{className:"ml-1 text-zinc-500",children:["(default: ",C.default,")"]})]}),C.configured&&!T&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.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:E?C.masked_value:C.masked_value.replace(/./g,"*").slice(0,20)+"****"}),n.jsx("button",{onClick:()=>w(C.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:E?"Hide":"Show",children:E?n.jsx(Vi,{className:"h-4 w-4"}):n.jsx(za,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{type:E||V?"text":"password",value:D,onChange:ee=>h(R=>({...R,[C.name]:ee.target.value})),placeholder:V?C.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"}),!V&&n.jsx("button",{onClick:()=>w(C.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:E?"Hide":"Show",children:E?n.jsx(Vi,{className:"h-4 w-4"}):n.jsx(za,{className:"h-4 w-4"})}),n.jsxs("button",{onClick:()=>N(C.name),disabled:!D.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?n.jsx(Le,{className:"h-4 w-4 animate-spin"}):n.jsx(Fo,{className:"h-4 w-4"}),"Save"]})]})]},C.name)};return s&&e.length===0?n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx(Le,{className:"h-8 w-8 animate-spin text-accent-500"})}):n.jsxs(n.Fragment,{children:[n.jsx(Mt,{icon:g4,title:"Cloud Providers",children:n.jsxs("div",{className:"space-y-4",children:[n.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)]})}),n.jsx(Mt,{icon:G4,title:"Local Providers",children:n.jsxs("div",{className:"space-y-4",children:[n.jsx("p",{className:"text-sm text-zinc-500",children:"Configure endpoints for locally-running model servers."}),y.map(j)]})})]})}function z9({config:e}){return n.jsxs(n.Fragment,{children:[n.jsx(Mt,{icon:ps,title:"Security",children:n.jsxs("div",{className:"space-y-4",children:[n.jsx(ci,{label:"Require Approval for Actions",description:"Ask before executing potentially dangerous operations",checked:(e==null?void 0:e.agent.approveActions)??!0,onChange:()=>{}}),n.jsx(ya,{label:"Sandbox Timeout",children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.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"}),n.jsx("span",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"seconds"})]})})]})}),n.jsx(Mt,{icon:Ku,title:"AI Configuration",children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs(ya,{label:"Default Temperature",children:[n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",defaultValue:(e==null?void 0:e.agent.temperature)??.7,className:"flex-1"}),n.jsx("span",{className:"w-12 text-center text-sm text-zinc-400",children:(e==null?void 0:e.agent.temperature)??.7})]}),n.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Controls randomness in responses (0 = deterministic, 1 = creative)"})]}),n.jsxs(ya,{label:"Max Iterations",children:[n.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"}),n.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Maximum tool calls per conversation turn"})]})]})}),n.jsx(Mt,{icon:A4,title:"Keyboard Shortcuts",children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(Hr,{label:"New Chat",shortcut:"Ctrl + N"}),n.jsx(Hr,{label:"Toggle Sidebar",shortcut:"Ctrl + B"}),n.jsx(Hr,{label:"Command Palette",shortcut:"Ctrl + K"}),n.jsx(Hr,{label:"Settings",shortcut:"Ctrl + ,"}),n.jsx(Hr,{label:"Send Message",shortcut:"Enter"}),n.jsx(Hr,{label:"New Line",shortcut:"Shift + Enter"})]})})]})}function N9(){const[e,s]=k.useState(!1),a=()=>{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),h=document.createElement("a");h.href=d,h.download=`cachibot-backup-${new Date().toISOString().split("T")[0]}.json`,h.click(),URL.revokeObjectURL(d)},r=()=>{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 n.jsxs(n.Fragment,{children:[n.jsx(Mt,{icon:Po,title:"Data Management",children:n.jsxs("div",{className:"space-y-4",children:[n.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:[n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:"Export Data"}),n.jsx("p",{className:"text-sm text-zinc-500",children:"Download all your data as a JSON file"})]}),n.jsxs("button",{onClick:a,className:"flex items-center gap-2 rounded-lg bg-cachi-600 px-4 py-2 text-sm font-medium text-white hover:bg-cachi-500",children:[n.jsx(Ys,{className:"h-4 w-4"}),"Export"]})]}),n.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:[n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:"Import Data"}),n.jsx("p",{className:"text-sm text-zinc-500",children:"Restore from a previous backup"})]}),n.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:[n.jsx(Wu,{className:"h-4 w-4"}),"Import"]})]})]})}),n.jsx(k9,{}),n.jsx(Mt,{icon:Cn,title:"Cache",children:n.jsx("div",{className:"space-y-4",children:n.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:[n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:"Clear Cache"}),n.jsx("p",{className:"text-sm text-zinc-500",children:"Remove cached responses and temporary data"})]}),n.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:[n.jsx(Cn,{className:"h-4 w-4"}),"Clear"]})]})})}),n.jsx(Mt,{icon:Yi,title:"Danger Zone",danger:!0,children:n.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-4",children:[n.jsx("h4",{className:"font-medium text-red-400",children:"Delete All Data"}),n.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Permanently delete all bots, chats, jobs, tasks, and settings. This cannot be undone."}),n.jsxs("button",{onClick:()=>s(!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:[n.jsx(Vt,{className:"h-4 w-4"}),"Delete Everything"]})]})}),e&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:n.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:[n.jsxs("div",{className:"mb-4 flex items-center gap-3 text-red-400",children:[n.jsx(Yi,{className:"h-6 w-6"}),n.jsx("h2",{className:"text-lg font-bold",children:"Delete All Data"})]}),n.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."}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{onClick:()=>s(!1),className:"rounded-lg px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800",children:"Cancel"}),n.jsx("button",{onClick:r,className:"rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-500",children:"Delete Everything"})]})]})})]})}function k9(){const{bots:e}=xt(),{chats:s,messages:a}=qt(),{jobs:r}=_u(),{tasks:o}=sl(),{stats:c,clearBotStats:d}=Hu(),[h,m]=k.useState(new Set),[f,p]=k.useState(new Map),[b,v]=k.useState(!1),[y,N]=k.useState(!1),[S,w]=k.useState({}),[j,C]=k.useState(!1);k.useEffect(()=>{(async()=>{C(!0);const se={};for(const U of e)try{const{getPlatformChats:H}=await oi(async()=>{const{getPlatformChats:W}=await Promise.resolve().then(()=>wm);return{getPlatformChats:W}},void 0),I=await H(U.id);se[U.id]=I.length}catch{se[U.id]=0}w(se),C(!1)})()},[e]);const T=k.useMemo(()=>e.map(_=>{const se=s.filter(Y=>Y.botId===_.id),U=se.filter(Y=>!Y.platform),H=se.filter(Y=>Y.platform),I=U.reduce((Y,O)=>{var de;return Y+(((de=a[O.id])==null?void 0:de.length)||0)},0),W=r.filter(Y=>Y.botId===_.id),re=o.filter(Y=>Y.botId===_.id),he=!!c.byBot[_.id],L=S[_.id]||0,P=Math.max(L,H.length);return{botId:_.id,botName:_.name,botColor:_.color||"#22c55e",chatsCount:U.length,messagesCount:I,jobsCount:W.length,tasksCount:re.length,hasUsageData:he,platformChatsCount:P}}),[e,s,a,r,o,c.byBot,S]),D=_=>{m(se=>{const U=new Set(se);return U.has(_)?U.delete(_):U.add(_),U})},E=(_,se)=>{p(U=>{const H=new Map(U),I=H.get(_)||new Set,W=new Set(I);return W.has(se)?W.delete(se):W.add(se),W.size===0?H.delete(_):H.set(_,W),H})},A=(_,se)=>{p(U=>{const H=new Map(U),I=new Set;return se.chatsCount>0&&I.add("chats"),se.jobsCount>0&&I.add("jobs"),se.tasksCount>0&&I.add("tasks"),se.hasUsageData&&I.add("usage"),se.platformChatsCount>0&&I.add("platform"),I.size>0&&H.set(_,I),H})},B=_=>{p(se=>{const U=new Map(se);return U.delete(_),U})},V=f.size>0,ee=()=>{let _=0;return f.forEach((se,U)=>{const H=T.find(I=>I.botId===U);H&&(se.has("chats")&&(_+=H.chatsCount),se.has("jobs")&&(_+=H.jobsCount),se.has("tasks")&&(_+=H.tasksCount),se.has("usage")&&(_+=1),se.has("platform")&&(_+=H.platformChatsCount))}),_},R=async()=>{N(!0);const _=qt.getState(),se=_u.getState(),U=sl.getState();for(const[H,I]of f)if(I.has("chats")&&s.filter(re=>re.botId===H&&!re.platform).forEach(re=>{_.deleteChat(re.id)}),I.has("jobs")&&r.filter(re=>re.botId===H).forEach(re=>{se.deleteJob(re.id)}),I.has("tasks")&&o.filter(re=>re.botId===H).forEach(re=>{U.deleteTask(re.id)}),I.has("usage")&&d(H),I.has("platform")){s.filter(re=>re.botId===H&&re.platform).forEach(re=>{_.deleteChat(re.id)});try{const{clearBotPlatformData:re}=await oi(async()=>{const{clearBotPlatformData:he}=await Promise.resolve().then(()=>wm);return{clearBotPlatformData:he}},void 0);await re(H),w(he=>({...he,[H]:0}))}catch(re){console.error("Failed to clear platform data:",re),ke.error("Failed to clear platform data for bot")}}await new Promise(H=>setTimeout(H,300)),N(!1),v(!1),p(new Map),ke.success("Selected data cleared successfully")},F={chats:{icon:di,label:"Local Chats",color:"text-blue-400"},jobs:{icon:Zm,label:"Jobs",color:"text-purple-400"},tasks:{icon:Pv,label:"Tasks",color:"text-green-400"},usage:{icon:Ou,label:"Usage Stats",color:"text-amber-400"},platform:{icon:di,label:"Platform Messages",color:"text-cyan-400"}};return n.jsxs(Mt,{icon:Hn,title:"Bot Data Manager",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsxs("p",{className:"text-sm text-zinc-500",children:["Clear specific data for each bot while keeping bot settings and connections intact.",j&&n.jsxs("span",{className:"ml-2 text-zinc-400",children:[n.jsx(Le,{className:"inline h-3 w-3 animate-spin mr-1"}),"Loading platform data..."]})]}),n.jsx("div",{className:"space-y-2",children:T.map(_=>{const se=h.has(_.botId),U=f.get(_.botId),H=_.chatsCount>0||_.jobsCount>0||_.tasksCount>0||_.hasUsageData||_.platformChatsCount>0;return n.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:[n.jsxs("button",{onClick:()=>D(_.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:[se?n.jsx(cl,{className:"h-4 w-4 text-zinc-500"}):n.jsx(Yu,{className:"h-4 w-4 text-zinc-500"}),n.jsx("div",{className:"h-8 w-8 rounded-lg flex items-center justify-center",style:{backgroundColor:_.botColor+"20"},children:n.jsx(Hn,{className:"h-4 w-4",style:{color:_.botColor}})}),n.jsxs("div",{className:"flex-1 text-left",children:[n.jsx("div",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:_.botName}),n.jsxs("div",{className:"text-xs text-zinc-500",children:[_.chatsCount," local chats · ",_.jobsCount," jobs · ",_.tasksCount," tasks",_.platformChatsCount>0&&n.jsxs("span",{className:"text-cyan-400",children:[" · ",_.platformChatsCount," platform chats"]})]})]}),U&&U.size>0&&n.jsxs("span",{className:"rounded-full bg-red-500/20 px-2 py-0.5 text-xs text-red-400",children:[U.size," selected"]})]}),se&&n.jsx("div",{className:"border-t border-zinc-300 p-3 dark:border-zinc-700",children:H?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex gap-2 mb-3",children:[n.jsx("button",{onClick:()=>A(_.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"}),n.jsx("span",{className:"text-zinc-400 dark:text-zinc-600",children:"·"}),n.jsx("button",{onClick:()=>B(_.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"})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[_.chatsCount>0&&n.jsx(jo,{category:"chats",config:F.chats,count:_.chatsCount,detail:`${_.messagesCount} messages`,selected:(U==null?void 0:U.has("chats"))||!1,onToggle:()=>E(_.botId,"chats")}),_.jobsCount>0&&n.jsx(jo,{category:"jobs",config:F.jobs,count:_.jobsCount,selected:(U==null?void 0:U.has("jobs"))||!1,onToggle:()=>E(_.botId,"jobs")}),_.tasksCount>0&&n.jsx(jo,{category:"tasks",config:F.tasks,count:_.tasksCount,selected:(U==null?void 0:U.has("tasks"))||!1,onToggle:()=>E(_.botId,"tasks")}),_.hasUsageData&&n.jsx(jo,{category:"usage",config:F.usage,count:1,detail:"statistics",selected:(U==null?void 0:U.has("usage"))||!1,onToggle:()=>E(_.botId,"usage")}),_.platformChatsCount>0&&n.jsx(jo,{category:"platform",config:F.platform,count:_.platformChatsCount,detail:"Telegram/Discord",selected:(U==null?void 0:U.has("platform"))||!1,onToggle:()=>E(_.botId,"platform")})]})]}):n.jsx("p",{className:"text-sm text-zinc-500 text-center py-2",children:"No data to clear for this bot"})})]},_.botId)})}),V&&n.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-red-500/30 bg-red-500/5 p-3",children:[n.jsxs("div",{className:"text-sm",children:[n.jsx("span",{className:"text-red-400 font-medium",children:ee()}),n.jsx("span",{className:"text-zinc-400",children:" items selected for deletion"})]}),n.jsxs("button",{onClick:()=>v(!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:[n.jsx(Vt,{className:"h-4 w-4"}),"Clear Selected"]})]})]}),b&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:n.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:[n.jsxs("div",{className:"mb-4 flex items-center gap-3 text-red-400",children:[n.jsx(Yi,{className:"h-6 w-6"}),n.jsx("h2",{className:"text-lg font-bold",children:"Clear Bot Data"})]}),n.jsx("p",{className:"mb-4 text-zinc-400",children:"Are you sure you want to clear the selected data? This action cannot be undone."}),n.jsx("div",{className:"mb-6 rounded-lg border border-zinc-700 bg-zinc-800/50 p-3 space-y-2",children:Array.from(f.entries()).map(([_,se])=>{const U=T.find(H=>H.botId===_);return U?n.jsxs("div",{className:"text-sm",children:[n.jsxs("span",{className:"font-medium text-zinc-200",children:[U.botName,":"]}),n.jsx("span",{className:"text-zinc-400 ml-2",children:Array.from(se).map(H=>F[H].label).join(", ")})]},_):null})}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{onClick:()=>v(!1),disabled:y,className:"rounded-lg px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800 disabled:opacity-50",children:"Cancel"}),n.jsx("button",{onClick:R,disabled:y,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:y?n.jsxs(n.Fragment,{children:[n.jsx(Le,{className:"h-4 w-4 animate-spin"}),"Clearing..."]}):n.jsxs(n.Fragment,{children:[n.jsx(Vt,{className:"h-4 w-4"}),"Clear Data"]})})]})]})})]})}function jo({config:e,count:s,detail:a,selected:r,onToggle:o}){const c=e.icon;return n.jsxs("button",{onClick:o,className:X("flex items-center gap-2 rounded-lg border p-2 transition-all text-left",r?"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:[n.jsx("div",{className:X("h-6 w-6 rounded flex items-center justify-center transition-colors",r?"bg-red-500/20":"bg-zinc-300 dark:bg-zinc-700"),children:r?n.jsx(dn,{className:"h-3.5 w-3.5 text-red-400"}):n.jsx(c,{className:X("h-3.5 w-3.5",e.color)})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:X("text-sm font-medium",r?"text-red-400":"text-zinc-800 dark:text-zinc-200"),children:e.label}),n.jsxs("div",{className:"text-xs text-zinc-500",children:[s," ",a||(s===1?"item":"items")]})]})]})}function S9({currentUser:e}){const[s,a]=k.useState([]),[r,o]=k.useState(!0),[c,d]=k.useState(0),[h,m]=k.useState(!1),[f,p]=k.useState({email:"",username:"",password:"",role:"user"}),[b,v]=k.useState(!1),[y,N]=k.useState(null),[S,w]=k.useState({email:"",username:"",role:"user"}),[j,C]=k.useState(!1),[T,D]=k.useState(null);k.useEffect(()=>{E()},[]);const E=async()=>{try{const R=await Gv();a(R.users),d(R.total)}catch{ke.error("Failed to load users")}finally{o(!1)}},A=async R=>{if(R.preventDefault(),!f.email||!f.username||!f.password){ke.error("All fields are required");return}if(f.password.length<8){ke.error("Password must be at least 8 characters");return}v(!0);try{const F=await Yv(f);a([F,...s]),d(c+1),m(!1),p({email:"",username:"",password:"",role:"user"}),ke.success("User created successfully")}catch(F){const _=F instanceof Error?F.message:"Failed to create user";ke.error(_)}finally{v(!1)}},B=async R=>{if(R.preventDefault(),!!y){C(!0);try{const F=await Qv(y.id,S);a(s.map(_=>_.id===F.id?F:_)),N(null),ke.success("User updated successfully")}catch(F){const _=F instanceof Error?F.message:"Failed to update user";ke.error(_)}finally{C(!1)}}},V=async R=>{if(confirm("Are you sure you want to deactivate this user?")){try{await Jv(R),a(s.map(F=>F.id===R?{...F,is_active:!1}:F)),ke.success("User deactivated")}catch(F){const _=F instanceof Error?F.message:"Failed to deactivate user";ke.error(_)}D(null)}},ee=R=>{N(R),w({email:R.email,username:R.username,role:R.role}),D(null)};return r?n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx(Le,{className:"h-8 w-8 animate-spin text-cachi-500"})}):n.jsxs(n.Fragment,{children:[n.jsx(Mt,{icon:Qi,title:"User Management",children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("p",{className:"text-sm text-zinc-400",children:[c," user",c!==1?"s":""," total"]}),n.jsxs(Zt,{onClick:()=>m(!0),size:"sm",children:[n.jsx(ed,{className:"h-4 w-4 mr-2"}),"Add User"]})]}),n.jsxs("div",{className:"rounded-lg border border-zinc-300 overflow-hidden dark:border-zinc-700",children:[n.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:[n.jsx("div",{children:"User"}),n.jsx("div",{children:"Email"}),n.jsx("div",{children:"Role"}),n.jsx("div",{children:"Status"}),n.jsx("div",{})]}),s.length===0?n.jsx("div",{className:"px-4 py-6 text-center text-zinc-500 text-sm",children:"No users found"}):s.map(R=>n.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:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.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:n.jsx(Du,{className:"h-3.5 w-3.5 text-zinc-500 dark:text-zinc-400"})}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"font-medium text-sm truncate text-zinc-800 dark:text-zinc-100",children:R.username}),R.id===(e==null?void 0:e.id)&&n.jsx("div",{className:"text-xs text-cachi-600 dark:text-cachi-400",children:"You"})]})]}),n.jsx("div",{className:"text-zinc-500 text-sm truncate dark:text-zinc-400",children:R.email}),n.jsx("div",{children:n.jsxs("span",{className:X("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",R.role==="admin"?"bg-purple-500/20 text-purple-300":"bg-zinc-700 text-zinc-300"),children:[R.role==="admin"?n.jsx(ps,{className:"h-3 w-3"}):n.jsx(fl,{className:"h-3 w-3"}),R.role]})}),n.jsx("div",{children:n.jsxs("span",{className:X("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",R.is_active?"bg-green-500/20 text-green-300":"bg-red-500/20 text-red-300"),children:[R.is_active?n.jsx(dn,{className:"h-3 w-3"}):n.jsx(Gt,{className:"h-3 w-3"}),R.is_active?"Active":"Off"]})}),n.jsxs("div",{className:"relative",children:[n.jsx("button",{onClick:()=>D(T===R.id?null:R.id),className:"p-1 hover:bg-zinc-200 rounded transition-colors disabled:opacity-50 dark:hover:bg-zinc-700",disabled:R.id===(e==null?void 0:e.id),children:n.jsx(wv,{className:"h-4 w-4 text-zinc-500 dark:text-zinc-400"})}),T===R.id&&n.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:[n.jsx("button",{onClick:()=>ee(R),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"}),R.is_active&&n.jsx("button",{onClick:()=>V(R.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"})]})]})]},R.id))]})]})}),h&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:n.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:[n.jsx("h2",{className:"text-lg font-semibold mb-4 text-zinc-900 dark:text-zinc-100",children:"Create New User"}),n.jsxs("form",{onSubmit:A,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Email"}),n.jsxs("div",{className:"relative",children:[n.jsx(Ov,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),n.jsx("input",{type:"email",value:f.email,onChange:R=>p({...f,email:R.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})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Username"}),n.jsxs("div",{className:"relative",children:[n.jsx(Du,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),n.jsx("input",{type:"text",value:f.username,onChange:R=>p({...f,username:R.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})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Password"}),n.jsx("input",{type:"password",value:f.password,onChange:R=>p({...f,password:R.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"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Role"}),n.jsxs("select",{value:f.role,onChange:R=>p({...f,role:R.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:[n.jsx("option",{value:"user",children:"User"}),n.jsx("option",{value:"admin",children:"Admin"})]})]}),n.jsxs("div",{className:"flex gap-3 pt-2",children:[n.jsx(Zt,{type:"button",variant:"ghost",className:"flex-1",onClick:()=>m(!1),children:"Cancel"}),n.jsx(Zt,{type:"submit",className:"flex-1",disabled:b,children:b?n.jsx(Le,{className:"h-4 w-4 animate-spin"}):"Create User"})]})]})]})}),y&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:n.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:[n.jsx("h2",{className:"text-lg font-semibold mb-4 text-zinc-900 dark:text-zinc-100",children:"Edit User"}),n.jsxs("form",{onSubmit:B,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Email"}),n.jsx("input",{type:"email",value:S.email,onChange:R=>w({...S,email:R.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})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Username"}),n.jsx("input",{type:"text",value:S.username,onChange:R=>w({...S,username:R.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})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Role"}),n.jsxs("select",{value:S.role,onChange:R=>w({...S,role:R.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:[n.jsx("option",{value:"user",children:"User"}),n.jsx("option",{value:"admin",children:"Admin"})]})]}),n.jsxs("div",{className:"flex gap-3 pt-2",children:[n.jsx(Zt,{type:"button",variant:"ghost",className:"flex-1",onClick:()=>N(null),children:"Cancel"}),n.jsx(Zt,{type:"submit",className:"flex-1",disabled:j,children:j?n.jsx(Le,{className:"h-4 w-4 animate-spin"}):"Save Changes"})]})]})]})}),T&&n.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>D(null)})]})}function Mt({icon:e,title:s,danger:a,children:r}){return n.jsxs("div",{className:"rounded-xl border border-zinc-300 bg-white dark:border-zinc-800 dark:bg-zinc-900/30",children:[n.jsxs("div",{className:X("flex items-center gap-2 border-b px-5 py-4",a?"border-red-500/30":"border-zinc-300 dark:border-zinc-800"),children:[n.jsx(e,{className:X("h-5 w-5",a?"text-red-400":"text-zinc-500 dark:text-zinc-400")}),n.jsx("h3",{className:X("font-semibold",a?"text-red-400":"text-zinc-800 dark:text-zinc-200"),children:s})]}),n.jsx("div",{className:"p-5",children:r})]})}function ya({label:e,children:s}){return n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:e}),s]})}function ci({label:e,description:s,checked:a,onChange:r}){return n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:e}),n.jsx("p",{className:"text-sm text-zinc-500",children:s})]}),n.jsx("button",{onClick:()=>r(!a),className:X("relative h-6 w-11 rounded-full transition-colors",a?"bg-accent-600":"bg-zinc-300 dark:bg-zinc-700"),children:n.jsx("span",{className:X("absolute top-1 h-4 w-4 rounded-full bg-white transition-transform",a?"left-6":"left-1")})})]})}function Hr({label:e,shortcut:s}){return n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-zinc-700 dark:text-zinc-300",children:e}),n.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:s})]})}function C9(){const{getActiveBot:e}=xt(),{workSection:s}=Bt(),a=e();return a?n.jsxs("div",{className:"flex h-full flex-col bg-zinc-100 dark:bg-zinc-950",children:[s==="overview"&&n.jsx(T9,{botId:a.id}),s==="active"&&n.jsx(nm,{botId:a.id,filter:"active"}),s==="completed"&&n.jsx(nm,{botId:a.id,filter:"completed"}),s==="history"&&n.jsx(nm,{botId:a.id,filter:"all"})]}):null}function T9({botId:e}){const{getWorkByBot:s,getActiveWork:a}=j0(),r=s(e),o=a(e),c={total:r.length,active:o.length,pending:r.filter(d=>d.status==="pending").length,completed:r.filter(d=>d.status==="completed").length,failed:r.filter(d=>d.status==="failed").length};return n.jsxs("div",{className:"flex h-full flex-col",children:[n.jsxs("div",{className:"border-b border-zinc-800 px-6 py-4",children:[n.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:"Work Overview"}),n.jsx("p",{className:"text-sm text-zinc-500",children:"Manage your work items, tasks, and jobs"})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[n.jsxs("div",{className:"mb-8 grid grid-cols-2 gap-4 lg:grid-cols-5",children:[n.jsx(wo,{label:"Total",value:c.total,color:"zinc"}),n.jsx(wo,{label:"Active",value:c.active,color:"blue",pulse:!0}),n.jsx(wo,{label:"Pending",value:c.pending,color:"yellow"}),n.jsx(wo,{label:"Completed",value:c.completed,color:"green"}),n.jsx(wo,{label:"Failed",value:c.failed,color:"red"})]}),o.length>0&&n.jsxs("div",{className:"mb-8",children:[n.jsx("h2",{className:"mb-4 text-lg font-semibold text-zinc-200",children:"Active Work"}),n.jsx("div",{className:"space-y-3",children:o.slice(0,5).map(d=>n.jsx(ew,{work:d},d.id))})]}),r.length===0&&n.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[n.jsx("div",{className:"mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-zinc-800",children:n.jsx(s0,{className:"h-8 w-8 text-zinc-500"})}),n.jsx("h3",{className:"mb-2 text-lg font-medium text-zinc-300",children:"No work items yet"}),n.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 nm({botId:e,filter:s}){const a=hn(),{getWorkByBot:r,activeWorkId:o,setActiveWork:c}=j0(),[d,h]=k.useState(""),f=r(e).filter(N=>!(s==="active"&&!["pending","in_progress","paused"].includes(N.status)||s==="completed"&&N.status!=="completed"||d&&!N.title.toLowerCase().includes(d.toLowerCase()))),p=f.find(N=>N.id===o),b={active:"Active Work",completed:"Completed Work",all:"Work History"},v={active:"Work items currently in progress or pending",completed:"Successfully completed work items",all:"All work items including failed and cancelled"},y=N=>{c(N.id),a(`/${e}/work/${N.id}`)};return n.jsxs("div",{className:"flex h-full flex-col",children:[n.jsxs("div",{className:"border-b border-zinc-800 px-6 py-4",children:[n.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:b[s]}),n.jsx("p",{className:"text-sm text-zinc-500",children:v[s]})]}),n.jsx("div",{className:"border-b border-zinc-800 px-6 py-3",children:n.jsxs("div",{className:"relative",children:[n.jsx(Tn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),n.jsx("input",{type:"text",placeholder:"Search work items...",value:d,onChange:N=>h(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-blue-500"})]})}),n.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[n.jsx("div",{className:"w-96 flex-shrink-0 overflow-y-auto border-r border-zinc-800 p-4",children:f.length===0?n.jsxs("div",{className:"py-12 text-center",children:[n.jsx(Gs,{className:"mx-auto mb-3 h-8 w-8 text-zinc-600"}),n.jsx("p",{className:"text-sm text-zinc-500",children:d?"No work items match your search":"No work items"})]}):n.jsx("div",{className:"space-y-2",children:f.map(N=>n.jsx(ew,{work:N,selected:o===N.id,onClick:()=>y(N),compact:!0},N.id))})}),n.jsx("div",{className:"flex-1 overflow-y-auto",children:p?n.jsx(E9,{work:p}):n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsx("p",{className:"text-zinc-500",children:"Select a work item to view details"})})})]})]})}function wo({label:e,value:s,color:a,pulse:r}){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 n.jsxs("div",{className:X("rounded-xl border p-4",o[a]),children:[n.jsx("div",{className:X("text-3xl font-bold",r&&s>0&&"animate-pulse"),children:s}),n.jsx("div",{className:"mt-1 text-sm opacity-80",children:e})]})}function ew({work:e,selected:s,onClick:a,compact:r}){const o=h=>{switch(h){case"pending":return n.jsx(Ho,{className:"h-4 w-4 text-zinc-400"});case"in_progress":return n.jsx(Ju,{className:"h-4 w-4 text-blue-400"});case"completed":return n.jsx(wa,{className:"h-4 w-4 text-green-400"});case"failed":return n.jsx(ui,{className:"h-4 w-4 text-red-400"});case"cancelled":return n.jsx(ui,{className:"h-4 w-4 text-zinc-500"});case"paused":return n.jsx(Bv,{className:"h-4 w-4 text-yellow-400"})}},c=h=>{switch(h){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=h=>{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[h]||m.normal};return n.jsx("button",{onClick:a,className:X("w-full rounded-xl border p-4 text-left transition-all",s&&"ring-1 ring-blue-500",c(e.status),a&&"hover:border-zinc-600"),children:n.jsxs("div",{className:"flex items-start gap-3",children:[o(e.status),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"truncate font-medium text-zinc-200",children:e.title}),e.priority!=="normal"&&n.jsx("span",{className:X("rounded px-1.5 py-0.5 text-[10px] font-medium uppercase",d(e.priority)),children:e.priority})]}),e.description&&!r&&n.jsx("p",{className:"mt-1 truncate text-sm text-zinc-500",children:e.description}),e.status==="in_progress"&&e.progress>0&&n.jsxs("div",{className:"mt-3",children:[n.jsxs("div",{className:"flex items-center justify-between text-xs text-zinc-500",children:[n.jsx("span",{children:"Progress"}),n.jsxs("span",{children:[e.progress,"%"]})]}),n.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-zinc-700",children:n.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&&n.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-zinc-500",children:[n.jsx(wa,{className:"h-3 w-3"}),e.completedTaskCount||0,"/",e.taskCount," tasks"]})]}),a&&n.jsx(Yu,{className:"h-4 w-4 text-zinc-600"})]})})}function E9({work:e}){const s=a=>new Date(a).toLocaleString();return n.jsxs("div",{className:"p-6",children:[n.jsxs("div",{className:"mb-6",children:[n.jsx("h2",{className:"text-xl font-bold text-zinc-100",children:e.title}),e.description&&n.jsx("p",{className:"mt-1 text-zinc-400",children:e.description}),e.goal&&n.jsxs("div",{className:"mt-3 rounded-lg border border-blue-500/30 bg-blue-500/10 p-3",children:[n.jsx("div",{className:"text-xs font-medium uppercase text-blue-400",children:"Goal"}),n.jsx("p",{className:"mt-1 text-sm text-zinc-300",children:e.goal})]})]}),n.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-4 lg:grid-cols-4",children:[n.jsx(ju,{label:"Status",value:e.status.replace("_"," ")}),n.jsx(ju,{label:"Priority",value:e.priority}),n.jsx(ju,{label:"Progress",value:`${e.progress}%`}),n.jsx(ju,{label:"Created",value:s(e.createdAt)})]}),e.status==="in_progress"&&n.jsxs("div",{className:"mb-6",children:[n.jsxs("div",{className:"mb-2 flex items-center justify-between text-sm",children:[n.jsx("span",{className:"text-zinc-400",children:"Progress"}),n.jsxs("span",{className:"font-mono text-zinc-300",children:[e.progress,"%"]})]}),n.jsx("div",{className:"h-3 overflow-hidden rounded-full bg-zinc-800",children:n.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&&n.jsxs("div",{className:"mb-6 rounded-xl border border-red-500/30 bg-red-500/10 p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 text-red-400",children:[n.jsx(ui,{className:"h-5 w-5"}),n.jsx("span",{className:"font-medium",children:"Error"})]}),n.jsx("pre",{className:"mt-2 overflow-x-auto text-sm text-red-300",children:e.error})]}),e.result!==void 0&&e.result!==null&&n.jsxs("div",{className:"mb-6 rounded-xl border border-green-500/30 bg-green-500/10 p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[n.jsx(wa,{className:"h-5 w-5"}),n.jsx("span",{className:"font-medium",children:"Result"})]}),n.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&&n.jsx("div",{className:"flex flex-wrap gap-2",children:e.tags.map(a=>n.jsx("span",{className:"rounded-full bg-zinc-800 px-3 py-1 text-sm text-zinc-400",children:a},a))})]})}function ju({label:e,value:s}){return n.jsxs("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900/50 p-3",children:[n.jsx("div",{className:"text-xs text-zinc-500",children:e}),n.jsx("div",{className:"mt-1 font-medium capitalize text-zinc-200",children:s})]})}function A9(){const{getActiveBot:e}=xt(),{scheduleSection:s}=Bt(),a=e();return a?n.jsxs("div",{className:"flex h-full flex-col bg-zinc-950",children:[s==="all"&&n.jsx(sm,{botId:a.id,filter:"all"}),s==="enabled"&&n.jsx(sm,{botId:a.id,filter:"enabled"}),s==="disabled"&&n.jsx(sm,{botId:a.id,filter:"disabled"}),s==="create"&&n.jsx(M9,{botId:a.id})]}):null}function sm({botId:e,filter:s}){const a=hn(),{getSchedulesByBot:r,activeScheduleId:o,setActiveSchedule:c,toggleEnabled:d}=v2(),[h,m]=k.useState(""),f=r(e),p=f.filter(w=>!(s==="enabled"&&!w.enabled||s==="disabled"&&w.enabled||h&&!w.name.toLowerCase().includes(h.toLowerCase()))),b=p.find(w=>w.id===o),v={total:f.length,enabled:f.filter(w=>w.enabled).length,disabled:f.filter(w=>!w.enabled).length},y={all:"All Schedules",enabled:"Enabled Schedules",disabled:"Disabled Schedules"},N={all:"Manage automated triggers and scheduled tasks",enabled:"Schedules that are currently active",disabled:"Schedules that are paused or inactive"},S=w=>{c(w.id),a(`/${e}/schedules/${w.id}`)};return n.jsxs("div",{className:"flex h-full flex-col",children:[n.jsx("div",{className:"border-b border-zinc-800 px-6 py-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:y[s]}),n.jsx("p",{className:"text-sm text-zinc-500",children:N[s]})]}),s==="all"&&n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsx(am,{label:"Total",value:v.total,color:"zinc"}),n.jsx(am,{label:"Enabled",value:v.enabled,color:"green"}),n.jsx(am,{label:"Disabled",value:v.disabled,color:"zinc"})]})]})}),n.jsx("div",{className:"border-b border-zinc-800 px-6 py-3",children:n.jsxs("div",{className:"relative",children:[n.jsx(Tn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),n.jsx("input",{type:"text",placeholder:"Search schedules...",value:h,onChange:w=>m(w.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"})]})}),n.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[n.jsx("div",{className:"w-96 flex-shrink-0 overflow-y-auto border-r border-zinc-800 p-4",children:p.length===0?n.jsxs("div",{className:"py-12 text-center",children:[n.jsx(Gs,{className:"mx-auto mb-3 h-8 w-8 text-zinc-600"}),n.jsx("p",{className:"text-sm text-zinc-500",children:h?"No schedules match your search":"No schedules yet"})]}):n.jsx("div",{className:"space-y-2",children:p.map(w=>n.jsx(D9,{schedule:w,selected:o===w.id,onClick:()=>S(w),onToggle:()=>d(w.id)},w.id))})}),n.jsx("div",{className:"flex-1 overflow-y-auto",children:b?n.jsx(O9,{schedule:b}):n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsx("p",{className:"text-zinc-500",children:"Select a schedule to view details"})})})]})]})}function M9({botId:e}){const{setScheduleSection:s}=Bt(),[a,r]=k.useState({name:"",description:"",scheduleType:"interval",cronExpression:"",intervalSeconds:3600,runAt:"",eventTrigger:"",enabled:!0}),o=c=>{c.preventDefault(),console.log("Create schedule:",a),s("all")};return n.jsxs("div",{className:"flex h-full flex-col",children:[n.jsxs("div",{className:"border-b border-zinc-800 px-6 py-4",children:[n.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:"Create Schedule"}),n.jsx("p",{className:"text-sm text-zinc-500",children:"Set up a new automated trigger"})]}),n.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:n.jsxs("form",{onSubmit:o,className:"mx-auto max-w-2xl space-y-6",children:[n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Name"}),n.jsx("input",{type:"text",value:a.name,onChange:c=>r({...a,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})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Description"}),n.jsx("textarea",{value:a.description,onChange:c=>r({...a,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"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Schedule Type"}),n.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:["cron","interval","once","event"].map(c=>n.jsxs("button",{type:"button",onClick:()=>r({...a,scheduleType:c}),className:X("flex flex-col items-center gap-2 rounded-lg border p-4 transition-all",a.scheduleType===c?"border-purple-500 bg-purple-500/10":"border-zinc-700 bg-zinc-800/50 hover:border-zinc-600"),children:[c==="cron"&&n.jsx(e0,{className:"h-5 w-5 text-purple-400"}),c==="interval"&&n.jsx(Vv,{className:"h-5 w-5 text-blue-400"}),c==="once"&&n.jsx(Ho,{className:"h-5 w-5 text-orange-400"}),c==="event"&&n.jsx(Xi,{className:"h-5 w-5 text-yellow-400"}),n.jsx("span",{className:"text-sm capitalize text-zinc-300",children:c})]},c))})]}),a.scheduleType==="cron"&&n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Cron Expression"}),n.jsx("input",{type:"text",value:a.cronExpression,onChange:c=>r({...a,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"}),n.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:'Format: minute hour day month weekday (e.g., "0 2 * * *" = 2am daily)'})]}),a.scheduleType==="interval"&&n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Interval"}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("input",{type:"number",value:a.intervalSeconds/60,onChange:c=>r({...a,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"}),n.jsx("span",{className:"text-zinc-400",children:"minutes"})]})]}),a.scheduleType==="once"&&n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Run At"}),n.jsx("input",{type:"datetime-local",value:a.runAt,onChange:c=>r({...a,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"})]}),a.scheduleType==="event"&&n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Event Trigger"}),n.jsx("input",{type:"text",value:a.eventTrigger,onChange:c=>r({...a,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"})]}),n.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-700 bg-zinc-800/50 p-4",children:[n.jsxs("div",{children:[n.jsx("div",{className:"font-medium text-zinc-200",children:"Enable immediately"}),n.jsx("div",{className:"text-sm text-zinc-500",children:"Start running this schedule right away"})]}),n.jsx("button",{type:"button",onClick:()=>r({...a,enabled:!a.enabled}),className:a.enabled?"text-purple-400":"text-zinc-600",children:a.enabled?n.jsx(fi,{className:"h-8 w-8"}):n.jsx(hi,{className:"h-8 w-8"})})]}),n.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[n.jsx("button",{type:"button",onClick:()=>s("all"),className:"rounded-lg border border-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-800",children:"Cancel"}),n.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:[n.jsx($t,{className:"h-4 w-4"}),"Create Schedule"]})]})]})})]})}function am({label:e,value:s,color:a}){const r={green:"bg-green-500/20 text-green-400",zinc:"bg-zinc-700 text-zinc-400"};return n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:X("flex h-8 min-w-[2rem] items-center justify-center rounded-lg px-2 text-sm font-bold",r[a]),children:s}),n.jsx("span",{className:"text-xs text-zinc-500",children:e})]})}function D9({schedule:e,selected:s,onClick:a,onToggle:r}){const o=d=>{switch(d){case"cron":return n.jsx(e0,{className:"h-4 w-4 text-purple-400"});case"interval":return n.jsx(Vv,{className:"h-4 w-4 text-blue-400"});case"once":return n.jsx(Ho,{className:"h-4 w-4 text-orange-400"});case"event":return n.jsx(Xi,{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 n.jsx("button",{onClick:a,className:X("w-full rounded-xl border p-4 text-left transition-all",s&&"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:n.jsxs("div",{className:"flex items-start gap-3",children:[o(e.scheduleType),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"font-medium text-zinc-200",children:e.name}),e.description&&n.jsx("p",{className:"mt-0.5 truncate text-sm text-zinc-500",children:e.description}),n.jsx("div",{className:"mt-2 flex items-center gap-2 text-xs text-zinc-500",children:n.jsx("span",{className:"rounded bg-zinc-700/50 px-1.5 py-0.5 font-mono",children:c(e)})}),e.runCount>0&&n.jsx("div",{className:"mt-2 flex items-center gap-2 text-xs text-zinc-500",children:n.jsxs("span",{children:[e.runCount," runs"]})})]}),n.jsx("button",{onClick:d=>{d.stopPropagation(),r==null||r()},className:X("flex-shrink-0 transition-colors",e.enabled?"text-purple-400":"text-zinc-600"),title:e.enabled?"Disable":"Enable",children:e.enabled?n.jsx(fi,{className:"h-6 w-6"}):n.jsx(hi,{className:"h-6 w-6"})})]})})}function O9({schedule:e}){const s=r=>r?new Date(r).toLocaleString():"-",a=r=>{switch(r){case"cron":return"Cron Schedule";case"interval":return"Interval Timer";case"once":return"One-Time";case"event":return"Event Trigger"}};return n.jsxs("div",{className:"p-6",children:[n.jsxs("div",{className:"mb-6 flex items-start justify-between",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("h2",{className:"text-xl font-bold text-zinc-100",children:e.name}),n.jsx("span",{className:X("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&&n.jsx("p",{className:"mt-1 text-zinc-400",children:e.description})]}),n.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:[n.jsx(Vt,{className:"h-4 w-4"}),"Delete"]})]}),n.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-4 lg:grid-cols-4",children:[n.jsx(wu,{label:"Type",value:a(e.scheduleType)}),n.jsx(wu,{label:"Timezone",value:e.timezone}),n.jsx(wu,{label:"Run Count",value:String(e.runCount)}),n.jsx(wu,{label:"Max Concurrent",value:String(e.maxConcurrent)})]}),n.jsxs("div",{className:"mb-6 rounded-xl border border-zinc-800 bg-zinc-900/50 p-4",children:[n.jsx("div",{className:"text-xs font-medium uppercase text-zinc-500",children:"Schedule"}),n.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"&&s(e.runAt),e.scheduleType==="event"&&e.eventTrigger]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900/50 p-4",children:[n.jsx("div",{className:"text-xs font-medium uppercase text-zinc-500",children:"Next Run"}),n.jsx("div",{className:"mt-2 text-zinc-200",children:e.nextRunAt?s(e.nextRunAt):"Not scheduled"})]}),n.jsxs("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900/50 p-4",children:[n.jsx("div",{className:"text-xs font-medium uppercase text-zinc-500",children:"Last Run"}),n.jsx("div",{className:"mt-2 text-zinc-200",children:e.lastRunAt?s(e.lastRunAt):"Never"})]})]})]})}function wu({label:e,value:s}){return n.jsxs("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900/50 p-3",children:[n.jsx("div",{className:"text-xs text-zinc-500",children:e}),n.jsx("div",{className:"mt-1 font-medium text-zinc-200",children:s})]})}class R9{constructor(){$e(this,"ws",null);$e(this,"mediaStream",null);$e(this,"mediaRecorder",null);$e(this,"audioContext",null);$e(this,"analyser",null);$e(this,"vadInterval",null);$e(this,"playbackContext",null);$e(this,"scheduledSources",[]);$e(this,"nextPlayTime",0);$e(this,"isSpeaking",!1);$e(this,"silenceStart",0);$e(this,"silenceThreshold",1500);$e(this,"jsonHandlers",[]);$e(this,"audioHandlers",[]);$e(this,"connectHandlers",[]);$e(this,"disconnectHandlers",[]);$e(this,"errorHandlers",[]);$e(this,"audioLevelHandlers",[]);$e(this,"_isMuted",!1)}async connect(s,a,r){var m;if(((m=this.ws)==null?void 0:m.readyState)===WebSocket.OPEN)return;const{accessToken:o}=Ut.getState();if(!o){this.errorHandlers.forEach(f=>f("Not authenticated"));return}const c=window.location.protocol==="https:"?"wss:":"ws:",d=window.location.host,h=`${c}//${d}/ws/voice?token=${encodeURIComponent(o)}`;this.ws=new WebSocket(h),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{this.connectHandlers.forEach(f=>f()),this.sendJson("voice_start",{bot_id:s,chat_id:a,system_prompt:r==null?void 0:r.systemPrompt,models:r==null?void 0:r.models,capabilities:r==null?void 0:r.capabilities,tool_configs:r==null?void 0:r.toolConfigs,voice_settings:r!=null&&r.voiceSettings?{tts_voice:r.voiceSettings.ttsVoice,tts_speed:r.voiceSettings.ttsSpeed,stt_language:r.voiceSettings.sttLanguage,enable_interruption:r.voiceSettings.enableInterruption,save_transcripts:r.voiceSettings.saveTranscripts}:void 0})},this.ws.onmessage=f=>{if(f.data instanceof ArrayBuffer)this.audioHandlers.forEach(p=>p(f.data));else try{const p=JSON.parse(f.data);this.jsonHandlers.forEach(b=>b(p))}catch{console.error("Failed to parse voice message")}},this.ws.onclose=()=>{this.disconnectHandlers.forEach(f=>f()),this.cleanup()},this.ws.onerror=f=>{this.errorHandlers.forEach(p=>p(f))}}disconnect(){this.ws&&(this.ws.close(),this.ws=null),this.cleanup()}cleanup(){this.stopMic(),this.stopPlayback(),this.stopVAD()}async startMic(){try{this.mediaStream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})}catch{this.errorHandlers.forEach(r=>r("Microphone access denied"));return}this.audioContext=new AudioContext;const s=this.audioContext.createMediaStreamSource(this.mediaStream);this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2048,s.connect(this.analyser);const a=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm";this.mediaRecorder=new MediaRecorder(this.mediaStream,{mimeType:a}),this.mediaRecorder.ondataavailable=r=>{var o;r.data.size>0&&((o=this.ws)==null?void 0:o.readyState)===WebSocket.OPEN&&!this._isMuted&&r.data.arrayBuffer().then(c=>{var d;(d=this.ws)==null||d.send(c)})},this.mediaRecorder.start(100)}stopMic(){this.mediaRecorder&&this.mediaRecorder.state!=="inactive"&&this.mediaRecorder.stop(),this.mediaRecorder=null,this.mediaStream&&(this.mediaStream.getTracks().forEach(s=>s.stop()),this.mediaStream=null),this.audioContext&&(this.audioContext.close(),this.audioContext=null),this.analyser=null}setMuted(s){var a;this._isMuted=s,this.mediaStream&&this.mediaStream.getAudioTracks().forEach(r=>{r.enabled=!s}),((a=this.ws)==null?void 0:a.readyState)===WebSocket.OPEN&&this.sendJson(s?"mute":"unmute",{})}get isMuted(){return this._isMuted}startVAD(s){if(!this.analyser)return;const a=new Uint8Array(this.analyser.fftSize);this.vadInterval=window.setInterval(()=>{if(!this.analyser)return;this.analyser.getByteTimeDomainData(a);let r=0;for(let d=0;d<a.length;d++){const h=(a[d]-128)/128;r+=h*h}const o=Math.sqrt(r/a.length);this.audioLevelHandlers.forEach(d=>d(o)),o>.02?(this.isSpeaking||(this.isSpeaking=!0),this.silenceStart=0):this.isSpeaking&&(this.silenceStart===0?this.silenceStart=Date.now():Date.now()-this.silenceStart>this.silenceThreshold&&(this.isSpeaking=!1,this.silenceStart=0,s==null||s()))},100)}stopVAD(){this.vadInterval!==null&&(clearInterval(this.vadInterval),this.vadInterval=null),this.isSpeaking=!1,this.silenceStart=0}playPCMChunk(s,a=24e3){this.playbackContext||(this.playbackContext=new AudioContext({sampleRate:a}));const r=new Int16Array(s),o=new Float32Array(r.length);for(let f=0;f<r.length;f++)o[f]=r[f]/32768;const c=this.playbackContext.createBuffer(1,o.length,a);c.copyToChannel(o,0);const d=this.playbackContext.createBufferSource();d.buffer=c,d.connect(this.playbackContext.destination);const h=this.playbackContext.currentTime,m=Math.max(h,this.nextPlayTime);d.start(m),this.nextPlayTime=m+c.duration,this.scheduledSources.push(d),d.onended=()=>{const f=this.scheduledSources.indexOf(d);f!==-1&&this.scheduledSources.splice(f,1)}}stopPlayback(){for(const s of this.scheduledSources)try{s.stop(),s.disconnect()}catch{}this.scheduledSources=[],this.nextPlayTime=0,this.playbackContext&&(this.playbackContext.close(),this.playbackContext=null)}sendJson(s,a){var r;((r=this.ws)==null?void 0:r.readyState)===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:s,payload:a}))}sendEndTurn(){this.sendJson("end_turn",{})}sendInterrupt(){this.sendJson("interrupt",{}),this.stopPlayback()}updateSettings(s){this.sendJson("config_update",{voiceSettings:{tts_voice:s.ttsVoice,tts_speed:s.ttsSpeed,stt_language:s.sttLanguage,enable_interruption:s.enableInterruption,save_transcripts:s.saveTranscripts}})}onJsonMessage(s){return this.jsonHandlers.push(s),()=>{this.jsonHandlers=this.jsonHandlers.filter(a=>a!==s)}}onAudioChunk(s){return this.audioHandlers.push(s),()=>{this.audioHandlers=this.audioHandlers.filter(a=>a!==s)}}onConnect(s){return this.connectHandlers.push(s),()=>{this.connectHandlers=this.connectHandlers.filter(a=>a!==s)}}onDisconnect(s){return this.disconnectHandlers.push(s),()=>{this.disconnectHandlers=this.disconnectHandlers.filter(a=>a!==s)}}onError(s){return this.errorHandlers.push(s),()=>{this.errorHandlers=this.errorHandlers.filter(a=>a!==s)}}onAudioLevel(s){return this.audioLevelHandlers.push(s),()=>{this.audioLevelHandlers=this.audioLevelHandlers.filter(a=>a!==s)}}get isConnected(){var s;return((s=this.ws)==null?void 0:s.readyState)===WebSocket.OPEN}}function _9(){const e=k.useRef(null),s=Xt();e.current||(e.current=new R9);const a=e.current;k.useEffect(()=>{const p=a.onConnect(()=>{Xt.getState().setVoiceState("connecting")}),b=a.onDisconnect(()=>{Xt.getState().setVoiceState("disconnected")}),v=a.onError(w=>{const j=typeof w=="string"?w:"Connection error";Xt.getState().setError(j)}),y=a.onAudioLevel(w=>{Xt.getState().setAudioLevel(w)}),N=a.onJsonMessage(w=>{const j=Xt.getState();switch(w.type){case"session_ready":j.setVoiceState("idle");break;case"transcribing":j.setVoiceState("transcribing");break;case"transcript":{const C=w.payload.role||"user";j.addTranscript({id:crypto.randomUUID(),role:C,text:w.payload.text,timestamp:Date.now()}),C==="user"&&j.setVoiceState("thinking");break}case"thinking":j.setCurrentThinking(w.payload.content);break;case"tool_start":j.addToolCall({id:w.payload.id,tool:w.payload.tool,args:w.payload.args||{}});break;case"tool_end":j.updateToolCall(w.payload.id,w.payload.result);break;case"audio_start":j.setVoiceState("speaking");break;case"audio_end":break;case"turn_complete":j.setCurrentThinking(null),j.clearActiveToolCalls(),j.setVoiceState("idle"),Xt.getState().isMuted||j.setVoiceState("listening");break;case"error":j.setError(w.payload.message),["transcribing","thinking","speaking"].includes(j.voiceState)&&j.setVoiceState("idle");break}}),S=a.onAudioChunk(w=>{a.playPCMChunk(w)});return()=>{p(),b(),v(),y(),N(),S()}},[a]);const r=k.useCallback(async(p,b,v)=>{const y=Xt.getState();y.setVoiceState("connecting"),y.setError(null),await a.connect(p,b,{...v,voiceSettings:y.voiceSettings}),await a.startMic(),Xt.getState().pushToTalkMode||(a.startVAD(()=>{a.sendEndTurn()}),Xt.getState().setVoiceState("listening"))},[a]),o=k.useCallback(()=>{a.disconnect(),Xt.getState().reset()},[a]),c=k.useCallback(()=>{const p=Xt.getState(),b=!p.isMuted;p.setMuted(b),a.setMuted(b)},[a]),d=k.useCallback(()=>{a.sendEndTurn()},[a]),h=k.useCallback(()=>{a.sendInterrupt(),Xt.getState().setVoiceState("idle")},[a]),m=k.useCallback(()=>{Xt.getState().setHoldingPTT(!0),Xt.getState().setVoiceState("listening")},[]),f=k.useCallback(()=>{Xt.getState().setHoldingPTT(!1),a.sendEndTurn()},[a]);return k.useEffect(()=>{s.voiceState==="disconnected"||s.voiceState==="connecting"||(s.pushToTalkMode?a.stopVAD():(a.startVAD(()=>{a.sendEndTurn()}),s.voiceState==="idle"&&Xt.getState().setVoiceState("listening")))},[s.pushToTalkMode,a,s.voiceState]),{voiceState:s.voiceState,isMuted:s.isMuted,pushToTalkMode:s.pushToTalkMode,isHoldingPTT:s.isHoldingPTT,transcripts:s.transcripts,currentThinking:s.currentThinking,activeToolCalls:s.activeToolCalls,error:s.error,audioLevel:s.audioLevel,voiceSettings:s.voiceSettings,connect:r,disconnect:o,toggleMute:c,endTurn:d,interrupt:h,startPTT:m,stopPTT:f,togglePTTMode:s.togglePTTMode,clearTranscripts:s.clearTranscripts,updateVoiceSettings:s.updateVoiceSettings}}const L9={disconnected:"Disconnected",connecting:"Connecting...",idle:"Ready",listening:"Listening...",transcribing:"Transcribing...",thinking:"Thinking...",speaking:"Speaking..."},U9={disconnected:"text-zinc-500",connecting:"text-yellow-400",idle:"text-green-400",listening:"text-blue-400",transcribing:"text-purple-400",thinking:"text-amber-400",speaking:"text-emerald-400"};function B9(){const{getActiveBot:e}=xt(),{activeChatId:s}=qt(),a=e(),{voiceState:r,isMuted:o,pushToTalkMode:c,isHoldingPTT:d,transcripts:h,currentThinking:m,activeToolCalls:f,error:p,audioLevel:b,connect:v,disconnect:y,toggleMute:N,interrupt:S,startPTT:w,stopPTT:j,togglePTTMode:C,clearTranscripts:T}=_9(),D=k.useRef(null),E=k.useRef(null),A=k.useRef(0);k.useEffect(()=>{var R;(R=D.current)==null||R.scrollIntoView({behavior:"smooth"})},[h.length]),k.useEffect(()=>{const R=E.current;if(!R)return;const F=R.getContext("2d");if(!F)return;const _=()=>{const U=R.width,H=R.height;F.clearRect(0,0,U,H);const I=b,W=["listening","speaking"].includes(r);F.lineWidth=2,F.strokeStyle=r==="speaking"?"#34d399":r==="listening"?"#60a5fa":"#52525b",F.beginPath();const re=64;for(let he=0;he<=re;he++){const L=he/re*U,P=W?I*H*3:2,Y=W?3+I*8:2,O=H/2+Math.sin(he/re*Math.PI*Y+Date.now()/300)*P;he===0?F.moveTo(L,O):F.lineTo(L,O)}F.stroke(),A.current=requestAnimationFrame(_)},se=()=>{var H;const U=(H=R.parentElement)==null?void 0:H.getBoundingClientRect();U&&(R.width=U.width,R.height=U.height)};return se(),window.addEventListener("resize",se),_(),()=>{cancelAnimationFrame(A.current),window.removeEventListener("resize",se)}},[b,r]),k.useEffect(()=>{if(!c||r==="disconnected")return;const R=_=>{_.code==="Space"&&!_.repeat&&!d&&(_.preventDefault(),w())},F=_=>{_.code==="Space"&&d&&(_.preventDefault(),j())};return window.addEventListener("keydown",R),window.addEventListener("keyup",F),()=>{window.removeEventListener("keydown",R),window.removeEventListener("keyup",F)}},[c,r,d,w,j]);const B=k.useCallback(()=>{if(!a)return;const R=zm(a);v(a.id,s,{systemPrompt:a.systemPrompt,models:R,capabilities:a.capabilities,toolConfigs:a.toolConfigs})},[a,s,v]);if(!a)return n.jsx("div",{className:"flex h-full items-center justify-center text-zinc-500",children:"No bot selected"});const V=r!=="disconnected"&&r!=="connecting",ee=r==="speaking";return n.jsxs("div",{className:"flex h-full flex-col bg-zinc-50 dark:bg-zinc-950",children:[n.jsxs("div",{className:"flex items-center gap-3 border-b border-zinc-200 px-6 py-4 dark:border-zinc-800",children:[n.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl",style:{backgroundColor:a.color+"20"},children:n.jsx(En,{icon:a.icon,size:22})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h2",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-100",children:a.name}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:X("text-xs font-medium",U9[r]),children:L9[r]}),r==="connecting"&&n.jsx(Le,{className:"h-3 w-3 animate-spin text-yellow-400"})]})]}),h.length>0&&V&&n.jsx("button",{onClick:T,className:"rounded-lg px-3 py-1.5 text-xs text-zinc-500 transition-colors hover:bg-zinc-200 hover:text-zinc-700 dark:hover:bg-zinc-800 dark:hover:text-zinc-300",children:"Clear"})]}),n.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:h.length===0?n.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-3 text-zinc-500",children:V?n.jsxs(n.Fragment,{children:[n.jsx(Do,{className:"h-8 w-8 opacity-50"}),n.jsx("p",{className:"text-sm",children:c?"Hold Space to talk":"Start speaking..."})]}):n.jsxs(n.Fragment,{children:[n.jsx(hy,{className:"h-8 w-8 opacity-50"}),n.jsx("p",{className:"text-sm",children:"Connect to start a voice conversation"})]})}):n.jsxs("div",{className:"space-y-4",children:[h.map(R=>n.jsx("div",{className:X("flex gap-3",R.role==="user"?"justify-end":"justify-start"),children:n.jsxs("div",{className:X("max-w-[80%] rounded-2xl px-4 py-2.5",R.role==="user"?"bg-accent-600 text-white":"bg-zinc-200 text-zinc-900 dark:bg-zinc-800 dark:text-zinc-100"),children:[n.jsx("p",{className:"text-sm leading-relaxed",children:R.text}),n.jsx("p",{className:"mt-1 text-[10px] opacity-60",children:new Date(R.timestamp).toLocaleTimeString()})]})},R.id)),f.length>0&&n.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-400",children:[n.jsx(mi,{className:"h-3.5 w-3.5 animate-spin"}),n.jsxs("span",{children:["Using ",f[f.length-1].tool,"..."]})]}),m&&n.jsxs("div",{className:"flex items-center gap-2 text-xs text-zinc-500",children:[n.jsx(Le,{className:"h-3.5 w-3.5 animate-spin"}),n.jsx("span",{className:"italic",children:"Thinking..."})]}),n.jsx("div",{ref:D})]})}),p&&n.jsxs("div",{className:"mx-6 mb-2 flex items-center gap-2 rounded-lg bg-red-500/10 px-4 py-2 text-sm text-red-400",children:[n.jsx(Gs,{className:"h-4 w-4 flex-shrink-0"}),n.jsx("span",{className:"flex-1",children:p})]}),n.jsx("div",{className:"mx-6 h-16 overflow-hidden rounded-xl bg-zinc-100 dark:bg-zinc-900/50",children:n.jsx("canvas",{ref:E,className:"h-full w-full"})}),c&&V&&n.jsx("div",{className:"py-2 text-center text-xs text-zinc-500",children:d?n.jsx("span",{className:"font-medium text-blue-400",children:"Recording..."}):"Hold Space to talk"}),n.jsxs("div",{className:"flex items-center justify-center gap-3 border-t border-zinc-200 px-6 py-5 dark:border-zinc-800",children:[V&&n.jsx("button",{onClick:N,className:X("flex h-12 w-12 items-center justify-center rounded-full transition-all",o?"bg-red-500/20 text-red-400 hover:bg-red-500/30":"bg-zinc-200 text-zinc-600 hover:bg-zinc-300 dark:bg-zinc-800 dark:text-zinc-400 dark:hover:bg-zinc-700"),title:o?"Unmute":"Mute",children:o?n.jsx(P4,{className:"h-5 w-5"}):n.jsx(Do,{className:"h-5 w-5"})}),n.jsx("button",{onClick:V?y:B,className:X("flex h-14 w-14 items-center justify-center rounded-full transition-all",V?"bg-red-500 text-white hover:bg-red-600":"bg-green-500 text-white hover:bg-green-600",r==="connecting"&&"animate-pulse"),title:V?"Disconnect":"Connect",children:V?n.jsx(F4,{className:"h-6 w-6"}):r==="connecting"?n.jsx(Le,{className:"h-6 w-6 animate-spin"}):n.jsx(hy,{className:"h-6 w-6"})}),V&&n.jsx("button",{onClick:C,className:X("flex h-12 w-12 items-center justify-center rounded-full transition-all","bg-zinc-200 text-zinc-600 hover:bg-zinc-300 dark:bg-zinc-800 dark:text-zinc-400 dark:hover:bg-zinc-700"),title:c?"Switch to auto-detect (VAD)":"Switch to push-to-talk",children:c?n.jsx(E4,{className:"h-5 w-5"}):n.jsx(y4,{className:"h-5 w-5"})}),ee&&n.jsx("button",{onClick:S,className:"flex h-12 w-12 items-center justify-center rounded-full bg-amber-500/20 text-amber-400 transition-all hover:bg-amber-500/30",title:"Interrupt",children:n.jsx(K4,{className:"h-5 w-5"})})]})]})}const yl=[{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"}],V0=[{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"}],k1={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"]},tw={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 I9(e,s){if(!e)return null;const a=tw[e],r=a.indexOf(s);return r===-1||r===a.length-1?null:a[r+1]}function H9(e,s){if(!e)return null;const a=tw[e],r=a.indexOf(s);return r<=0?null:a[r-1]}const Ft=Nt((e,s)=>({isOpen:!1,currentStep:"method-select",completedSteps:[],form:{...k1},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:{...k1},isGenerating:!1,generationError:null,excludedNames:[],previewMessages:[],isPreviewLoading:!1}),setStep:a=>e({currentStep:a}),nextStep:()=>{const{form:a,currentStep:r}=s(),o=I9(a.method,r);o&&e(c=>({currentStep:o,completedSteps:c.completedSteps.includes(r)?c.completedSteps:[...c.completedSteps,r]}))},prevStep:()=>{const{form:a,currentStep:r}=s(),o=H9(a.method,r);o&&e({currentStep:o})},markStepCompleted:a=>e(r=>({completedSteps:r.completedSteps.includes(a)?r.completedSteps:[...r.completedSteps,a]})),setMethod:a=>e(r=>({form:{...r.form,method:a}})),updateForm:a=>e(r=>({form:{...r.form,...a}})),setGenerating:a=>e({isGenerating:a}),setGenerationError:a=>e({generationError:a}),setGeneratedContent:(a,r,o)=>e(c=>({form:{...c.form,generatedPrompt:a,suggestedName:r,suggestedDescription:o,systemPrompt:a,name:c.form.name||r,description:c.form.description||o}})),setNameSuggestions:a=>e(r=>{const o=r.form.nameSuggestions.map(d=>d.name);return{excludedNames:[...new Set([...r.excludedNames,...o])],form:{...r.form,nameSuggestions:a}}}),selectName:(a,r)=>e(o=>({form:{...o.form,name:a,selectedNameMeaning:r}})),getExcludedNames:()=>{const a=s(),r=a.form.nameSuggestions.map(o=>o.name);return[...new Set([...a.excludedNames,...r])]},setFollowUpQuestions:a=>e(r=>({form:{...r.form,followUpQuestions:a}})),updateFollowUpAnswer:(a,r)=>e(o=>({form:{...o.form,followUpQuestions:o.form.followUpQuestions.map(c=>c.id===a?{...c,answer:r}:c)}})),addPreviewMessage:(a,r)=>e(o=>({previewMessages:[...o.previewMessages,{role:a,content:r}]})),clearPreviewMessages:()=>e({previewMessages:[]}),setPreviewLoading:a=>e({isPreviewLoading:a})}));function P9(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function nw({template:e,onClick:s}){return n.jsxs("button",{onClick:s,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:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl",style:{backgroundColor:e.color+"20"},children:n.jsx(En,{icon:e.icon,size:24,color:e.color})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("h3",{className:"font-semibold text-zinc-100 truncate",children:e.name}),n.jsx("p",{className:"text-xs text-zinc-500 capitalize",children:e.category})]})]}),n.jsx("p",{className:"mt-3 text-sm text-zinc-400 line-clamp-2",children:e.description}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-1",children:[e.tags.slice(0,3).map(a=>n.jsx("span",{className:"rounded-full bg-zinc-800 px-2 py-0.5 text-[10px] text-zinc-500",children:a},a)),e.tags.length>3&&n.jsxs("span",{className:"text-[10px] text-zinc-600",children:["+",e.tags.length-3]})]}),n.jsxs("div",{className:"mt-4 flex items-center justify-between border-t border-zinc-800 pt-3",children:[n.jsxs("div",{className:"flex items-center gap-1 text-amber-400",children:[n.jsx(nl,{className:"h-3.5 w-3.5 fill-current"}),n.jsx("span",{className:"text-xs font-medium",children:e.rating.toFixed(1)})]}),n.jsxs("div",{className:"flex items-center gap-1 text-zinc-500",children:[n.jsx(Ys,{className:"h-3.5 w-3.5"}),n.jsx("span",{className:"text-xs",children:P9(e.downloads)})]})]})]})}function q9(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function F9({template:e,onClose:s,onInstalled:a}){const{addBot:r,setActiveBot:o}=xt(),[c,d]=k.useState(!1),[h,m]=k.useState(null),f=async()=>{if(e){d(!0),m(null);try{const p=await x2(e.id),b={id:p.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()};r(b),o(p.bot_id),a(p.bot_id)}catch(p){m(p instanceof Error?p.message:"Failed to install template")}finally{d(!1)}}};return e?n.jsxs(Fs,{open:!!e,onClose:s,size:"lg",children:[n.jsx($s,{title:e.name,subtitle:e.description,icon:n.jsx(En,{icon:e.icon,size:20,color:e.color}),iconClassName:`bg-[${e.color}20]`,onClose:s}),n.jsx(Vs,{scrollable:!0,children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center gap-6",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-amber-400",children:[n.jsx(nl,{className:"h-4 w-4 fill-current"}),n.jsx("span",{className:"text-sm font-medium",children:e.rating.toFixed(1)}),n.jsx("span",{className:"text-xs text-zinc-500",children:"rating"})]}),n.jsxs("div",{className:"flex items-center gap-1.5 text-zinc-400",children:[n.jsx(Ys,{className:"h-4 w-4"}),n.jsx("span",{className:"text-sm font-medium",children:q9(e.downloads)}),n.jsx("span",{className:"text-xs text-zinc-500",children:"installs"})]}),n.jsx("span",{className:"rounded-full bg-zinc-800 px-2.5 py-1 text-xs text-zinc-400 capitalize",children:e.category})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-300",children:"Tags"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:e.tags.map(p=>n.jsx("span",{className:"rounded-full bg-zinc-800 px-3 py-1 text-xs text-zinc-400",children:p},p))})]}),n.jsxs("div",{children:[n.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-zinc-300",children:[n.jsx(mi,{className:"h-4 w-4 text-zinc-500"}),"Enabled Tools"]}),n.jsx("div",{className:"flex flex-wrap gap-2",children:e.tools.map(p=>n.jsx("span",{className:"rounded-lg border border-zinc-700 bg-zinc-800/50 px-2.5 py-1 text-xs text-zinc-300",children:p.replace(/_/g," ")},p))})]}),n.jsxs("div",{children:[n.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-zinc-300",children:[n.jsx(di,{className:"h-4 w-4 text-zinc-500"}),"System Prompt"]}),n.jsx("div",{className:"max-h-48 overflow-y-auto rounded-lg border border-zinc-800 bg-zinc-900/50 p-4",children:n.jsx("p",{className:"whitespace-pre-wrap text-sm text-zinc-400",children:e.system_prompt})})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-300",children:"Recommended Model"}),n.jsx("span",{className:"rounded-lg bg-zinc-800 px-3 py-1.5 font-mono text-xs text-zinc-300",children:e.model})]}),h&&n.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3",children:n.jsx("p",{className:"text-sm text-red-400",children:h})})]})}),n.jsxs(il,{children:[n.jsx(un,{variant:"ghost",onClick:s,children:"Cancel"}),n.jsx(un,{variant:"primary",onClick:f,disabled:c,children:c?n.jsxs(n.Fragment,{children:[n.jsx(Le,{className:"h-4 w-4 animate-spin mr-2"}),"Installing..."]}):n.jsxs(n.Fragment,{children:[n.jsx(Ys,{className:"h-4 w-4 mr-2"}),"Install Template"]})})]})]}):null}function sw({open:e,onClose:s,onInstalled:a}){const[r,o]=k.useState([]),[c,d]=k.useState([]),[h,m]=k.useState(null),[f,p]=k.useState(""),[b,v]=k.useState(!0),[y,N]=k.useState(null),[S,w]=k.useState(null);k.useEffect(()=>{e&&(j(),C())},[e]),k.useEffect(()=>{e&&C()},[h,f]);const j=async()=>{try{const D=await p2();d(D)}catch(D){console.error("Failed to load categories:",D)}},C=async()=>{v(!0),N(null);try{const D=await v0(h||void 0,f||void 0);o(D.templates)}catch(D){N(D instanceof Error?D.message:"Failed to load templates")}finally{v(!1)}},T=D=>{w(null),a==null||a(D),s()};return n.jsxs(n.Fragment,{children:[n.jsxs(Fs,{open:e,onClose:s,size:"xl",children:[n.jsx($s,{title:"Bot Marketplace",subtitle:"Discover and install bot templates",icon:n.jsx(Ru,{className:"h-5 w-5 text-cachi-500"}),onClose:s}),n.jsx(Vs,{className:"p-0",children:n.jsxs("div",{className:"flex h-[500px]",children:[n.jsx("div",{className:"w-56 shrink-0 border-r border-zinc-800 p-4",children:n.jsxs("nav",{className:"space-y-1",children:[n.jsx("button",{onClick:()=>m(null),className:X("w-full rounded-lg px-3 py-2 text-left text-sm transition-colors",h===null?"bg-cachi-600/20 text-cachi-400":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"),children:"All Templates"}),c.map(D=>n.jsxs("button",{onClick:()=>m(D.id),className:X("w-full rounded-lg px-3 py-2 text-left text-sm transition-colors",h===D.id?"bg-cachi-600/20 text-cachi-400":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"),children:[n.jsx("span",{children:D.name}),n.jsxs("span",{className:"ml-2 text-xs text-zinc-600",children:["(",D.count,")"]})]},D.id))]})}),n.jsxs("div",{className:"flex-1 overflow-hidden",children:[n.jsx("div",{className:"border-b border-zinc-800 p-4",children:n.jsxs("div",{className:"relative",children:[n.jsx(Tn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),n.jsx("input",{type:"text",value:f,onChange:D=>p(D.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"}),f&&n.jsx("button",{onClick:()=>p(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-zinc-500 hover:text-zinc-300",children:n.jsx(Gt,{className:"h-4 w-4"})})]})}),n.jsx("div",{className:"h-[calc(100%-68px)] overflow-y-auto p-4",children:b?n.jsx("div",{className:"flex h-full items-center justify-center",children:n.jsx(Le,{className:"h-8 w-8 animate-spin text-zinc-500"})}):y?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[n.jsx("p",{className:"text-sm text-red-400",children:y}),n.jsx("button",{onClick:C,className:"mt-2 text-sm text-cachi-400 hover:underline",children:"Try again"})]}):r.length===0?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[n.jsx(Ru,{className:"mb-3 h-10 w-10 text-zinc-600"}),n.jsx("p",{className:"text-sm text-zinc-500",children:"No templates found"}),f&&n.jsx("button",{onClick:()=>p(""),className:"mt-2 text-sm text-cachi-400 hover:underline",children:"Clear search"})]}):n.jsx("div",{className:"grid grid-cols-2 gap-4",children:r.map(D=>n.jsx(nw,{template:D,onClick:()=>w(D)},D.id))})})]})]})})]}),n.jsx(F9,{template:S,onClose:()=>w(null),onInstalled:T})]})}const $9=[{id:"ai-assisted",name:"AI-Assisted",description:"Describe what you want and let AI generate the perfect system prompt",icon:ym,color:"#8b5cf6",badge:"Recommended"},{id:"template",name:"Use Template",description:"Start with a pre-configured template and customize it",icon:_4,color:"#3b82f6"},{id:"blank",name:"Start Blank",description:"Build everything from scratch with full control",icon:j4,color:"#22c55e"},{id:"import",name:"Import",description:"Import a bot configuration from a JSON file",icon:Wu,color:"#f59e0b"}];function S1(){const{form:e,setMethod:s,nextStep:a,close:r,reset:o}=Ft(),[c,d]=k.useState(!1),h=f=>{s(f),setTimeout(a,150)},m=()=>{r(),setTimeout(o,200)};return n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"grid grid-cols-2 gap-4",children:$9.map(f=>{const p=f.icon,b=e.method===f.id;return n.jsxs("button",{onClick:()=>h(f.id),className:X("relative flex flex-col items-start gap-3 rounded-xl border p-5 text-left transition-all",b?"border-cachi-500 bg-cachi-500/10 ring-1 ring-cachi-500":"border-zinc-800 bg-zinc-800/30 hover:border-zinc-700 hover:bg-zinc-800/50"),children:[f.badge&&n.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:f.badge}),n.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl",style:{backgroundColor:f.color+"20"},children:n.jsx(p,{className:"h-6 w-6",style:{color:f.color}})}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-semibold text-zinc-200",children:f.name}),n.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:f.description})]})]},f.id)})}),n.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:[n.jsx(Ru,{className:"h-4 w-4"}),"Browse Bot Marketplace"]}),n.jsx(sw,{open:c,onClose:()=>d(!1),onInstalled:m})]})}function V9(){const{updateForm:e,nextStep:s,close:a,reset:r}=Ft(),[o,c]=k.useState([]),[d,h]=k.useState(!0),[m,f]=k.useState(null),[p,b]=k.useState(!1);k.useEffect(()=>{v()},[]);const v=async()=>{h(!0),f(null);try{const w=[...(await v0()).templates].sort((j,C)=>C.downloads-j.downloads);c(w.slice(0,6))}catch(S){f(S instanceof Error?S.message:"Failed to load templates")}finally{h(!1)}},y=S=>{e({name:S.name,description:S.description,icon:S.icon,color:S.color,model:S.model,systemPrompt:S.system_prompt,tools:S.tools}),s()},N=()=>{a(),setTimeout(r,200)};return d?n.jsx("div",{className:"flex h-64 items-center justify-center",children:n.jsx(Le,{className:"h-8 w-8 animate-spin text-zinc-500"})}):m?n.jsxs("div",{className:"flex h-64 flex-col items-center justify-center text-center",children:[n.jsx("p",{className:"text-sm text-red-400",children:m}),n.jsx("button",{onClick:v,className:"mt-2 text-sm text-cachi-400 hover:underline",children:"Try again"})]}):n.jsxs("div",{className:"space-y-4",children:[n.jsx("p",{className:"text-sm text-zinc-500",children:"Select a template to customize, or browse the full marketplace."}),n.jsx("div",{className:"grid grid-cols-2 gap-3",children:o.map(S=>n.jsx(nw,{template:S,onClick:()=>y(S)},S.id))}),n.jsxs("button",{onClick:()=>b(!0),className:"flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-zinc-700 py-3 text-sm text-zinc-400 transition-colors hover:border-cachi-500 hover:text-cachi-400",children:[n.jsx(Ru,{className:"h-4 w-4"}),"Browse All Templates"]}),n.jsx(sw,{open:p,onClose:()=>b(!1),onInstalled:N})]})}const G9={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 Y9(){const{form:e,updateForm:s}=Ft(),a=G9[e.purposeCategory]||"Describe what you want your bot to help you with...";return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("label",{className:"mb-3 block text-sm font-medium text-zinc-300",children:"What's your bot for?"}),n.jsx("div",{className:"grid grid-cols-3 gap-2",children:yl.map(r=>n.jsxs("button",{onClick:()=>s({purposeCategory:r.id}),className:X("flex flex-col items-start rounded-lg border p-3 text-left transition-all",e.purposeCategory===r.id?"border-cachi-500 bg-cachi-500/10":"border-zinc-800 bg-zinc-800/30 hover:border-zinc-700"),children:[n.jsx("span",{className:"text-sm font-medium text-zinc-200",children:r.label}),n.jsx("span",{className:"text-xs text-zinc-500 line-clamp-1",children:r.description})]},r.id))})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"What do you want your bot to do?"}),n.jsx("textarea",{value:e.purposeDescription,onChange:r=>s({purposeDescription:r.target.value}),placeholder:a,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"}),n.jsx("p",{className:"mt-2 text-xs text-zinc-500",children:"The more specific you are, the better we can personalize your bot."})]})]})}function Q9(){const{form:e,updateForm:s,isGenerating:a,setGenerating:r,setGenerationError:o,selectName:c,getExcludedNames:d}=Ft(),h=k.useRef(!1),m=k.useRef(null);k.useEffect(()=>(e.nameSuggestions.length===0&&!a&&!h.current&&(h.current=!0,f()),()=>{var v;(v=m.current)==null||v.abort()}),[]);const f=async()=>{var w,j;(w=m.current)==null||w.abort();const v=new AbortController;m.current=v,r(!0),o(null);const y=Ft.getState(),N=[];let S=!0;try{const C=((j=yl.find(T=>T.id===e.purposeCategory))==null?void 0:j.label)||e.purposeCategory;await e2({count:4,exclude:d(),purpose:`${C}: ${e.purposeDescription}`},{onName:T=>{N.push(T),Ft.setState(D=>({form:{...D.form,nameSuggestions:[...D.form.nameSuggestions,{name:T.name,meaning:T.meaning}]}})),S&&!y.form.name&&(c(T.name,T.meaning),S=!1)},onDone:()=>{r(!1)},onError:T=>{o(T),r(!1)}},v.signal)}catch(C){C.name!=="AbortError"&&(o(C instanceof Error?C.message:"Failed to generate names"),r(!1))}},p=()=>{const v=Ft.getState().form.nameSuggestions;Ft.setState(y=>({excludedNames:[...new Set([...y.excludedNames,...v.map(N=>N.name)])],form:{...y.form,nameSuggestions:[]}})),f()},b=(v,y)=>{c(v,y)};return a&&e.nameSuggestions.length===0?n.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-cachi-500/20"}),n.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-full bg-cachi-500/10",children:n.jsx(Sn,{className:"h-8 w-8 text-cachi-400"})})]}),n.jsxs("div",{className:"text-center",children:[n.jsx("p",{className:"text-lg font-medium text-zinc-200",children:"Finding the perfect name..."}),n.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Each name has a special meaning"})]}),n.jsx(Le,{className:"h-5 w-5 animate-spin text-cachi-400"})]}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Sn,{className:"h-4 w-4 text-cachi-400"}),n.jsx("span",{className:"text-sm font-medium text-zinc-300",children:"Pick a name that resonates with you"})]}),n.jsxs("button",{onClick:p,disabled:a,className:"flex items-center gap-1.5 text-xs text-cachi-400 hover:text-cachi-300 disabled:opacity-50",children:[n.jsx(Cn,{className:X("h-3 w-3",a&&"animate-spin")}),"New suggestions"]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.nameSuggestions.map((v,y)=>n.jsxs("button",{onClick:()=>b(v.name,v.meaning),disabled:a&&e.nameSuggestions.length<4,className:X("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&&n.jsx("div",{className:"absolute right-3 top-3",children:n.jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-cachi-500",children:n.jsx(dn,{className:"h-3 w-3 text-white"})})}),n.jsx("h4",{className:X("mb-2 text-xl font-bold",e.name===v.name?"text-cachi-300":"text-zinc-100"),children:v.name}),n.jsx("p",{className:"text-xs leading-relaxed text-zinc-400",children:v.meaning})]},v.name)),a&&e.nameSuggestions.length<4&&Array.from({length:4-e.nameSuggestions.length}).map((v,y)=>n.jsx("div",{className:"flex items-center justify-center rounded-xl border border-zinc-800 bg-zinc-800/30 p-4",style:{minHeight:"100px"},children:n.jsx(Le,{className:"h-5 w-5 animate-spin text-zinc-600"})},`placeholder-${y}`))]}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute inset-0 flex items-center",children:n.jsx("div",{className:"w-full border-t border-zinc-800"})}),n.jsx("div",{className:"relative flex justify-center",children:n.jsx("span",{className:"bg-zinc-900 px-3 text-xs text-zinc-600",children:"or use your own"})})]}),n.jsx("input",{type:"text",value:e.name,onChange:v=>s({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&&n.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/50 p-4 text-center",children:[n.jsx("p",{className:"text-sm text-zinc-500",children:"Your bot will be called"}),n.jsx("p",{className:"mt-1 text-2xl font-bold text-cachi-400",children:e.name}),e.selectedNameMeaning&&n.jsxs("p",{className:"mt-2 text-xs text-zinc-500 italic",children:['"',e.selectedNameMeaning,'"']})]})]})}function J9(){const{form:e,isGenerating:s,setGenerating:a,setGenerationError:r,updateFollowUpAnswer:o}=Ft(),c=k.useRef(!1),d=k.useRef(null);k.useEffect(()=>(e.followUpQuestions.length===0&&!s&&!c.current&&(c.current=!0,h()),()=>{var m;(m=d.current)==null||m.abort()}),[]);const h=async()=>{var f,p;(f=d.current)==null||f.abort();const m=new AbortController;d.current=m,a(!0),r(null);try{const b=((p=yl.find(v=>v.id===e.purposeCategory))==null?void 0:p.label)||e.purposeCategory;await t2({category:b,description:e.purposeDescription},{onQuestion:v=>{Ft.setState(y=>({form:{...y.form,followUpQuestions:[...y.form.followUpQuestions,{...v,answer:""}]}}))},onDone:()=>{a(!1)},onError:v=>{r(v),a(!1)}},m.signal)}catch(b){b.name!=="AbortError"&&(r(b instanceof Error?b.message:"Failed to generate questions"),a(!1))}};return s&&e.followUpQuestions.length===0?n.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-cachi-500/20"}),n.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-full bg-cachi-500/10",children:n.jsx(Sn,{className:"h-8 w-8 text-cachi-400"})})]}),n.jsxs("div",{className:"text-center",children:[n.jsx("p",{className:"text-lg font-medium text-zinc-200",children:"Getting to know you better..."}),n.jsxs("p",{className:"mt-1 text-sm text-zinc-500",children:["Creating personalized questions for ",e.name]})]}),n.jsx(Le,{className:"h-5 w-5 animate-spin text-cachi-400"})]}):n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{className:"rounded-lg border border-cachi-500/20 bg-cachi-500/5 p-4",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx(m4,{className:"mt-0.5 h-5 w-5 shrink-0 text-cachi-400"}),n.jsxs("div",{children:[n.jsxs("p",{className:"text-sm font-medium text-zinc-200",children:["Help ",e.name," understand you better"]}),n.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"These answers will help create a personalized assistant just for you."})]})]})}),n.jsxs("div",{className:"space-y-5",children:[e.followUpQuestions.map((m,f)=>n.jsxs("div",{className:"group animate-in fade-in slide-in-from-bottom-2 duration-300",style:{animationDelay:`${f*100}ms`,animationFillMode:"backwards"},children:[n.jsxs("label",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-zinc-300",children:[n.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-cachi-600/20 text-xs text-cachi-400",children:f+1}),m.question]}),n.jsx("textarea",{value:m.answer,onChange:p=>o(m.id,p.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)),s&&e.followUpQuestions.length<3&&n.jsx("div",{className:"flex items-center justify-center py-4",children:n.jsx(Le,{className:"h-5 w-5 animate-spin text-zinc-600"})})]}),n.jsx("p",{className:"text-center text-xs text-zinc-600",children:"Don't worry, you can always refine your bot later"})]})}const X9=[{id:"yes",label:"Yes, often",description:"Use emojis freely",icon:Y4},{id:"sometimes",label:"Sometimes",description:"Use sparingly",icon:I4},{id:"no",label:"No emojis",description:"Keep it professional",icon:ui}];function K9(){const{form:e,updateForm:s}=Ft();return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("label",{className:"mb-3 block text-sm font-medium text-zinc-300",children:"How should your bot communicate?"}),n.jsx("div",{className:"grid grid-cols-3 gap-2",children:V0.map(a=>n.jsxs("button",{onClick:()=>s({communicationStyle:a.id}),className:X("flex flex-col items-start rounded-lg border p-3 text-left transition-all",e.communicationStyle===a.id?"border-cachi-500 bg-cachi-500/10":"border-zinc-800 bg-zinc-800/30 hover:border-zinc-700"),children:[n.jsx("span",{className:"font-medium text-zinc-200",children:a.label}),n.jsx("span",{className:"text-xs text-zinc-500",children:a.description})]},a.id))})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-3 block text-sm font-medium text-zinc-300",children:"Should your bot use emojis?"}),n.jsx("div",{className:"flex gap-3",children:X9.map(a=>{const r=a.icon;return n.jsxs("button",{onClick:()=>s({useEmojis:a.id}),className:X("flex flex-1 flex-col items-center gap-2 rounded-lg border p-4 transition-all",e.useEmojis===a.id?"border-cachi-500 bg-cachi-500/10":"border-zinc-800 bg-zinc-800/30 hover:border-zinc-700"),children:[n.jsx(r,{className:X("h-6 w-6",e.useEmojis===a.id?"text-cachi-400":"text-zinc-500")}),n.jsxs("div",{className:"text-center",children:[n.jsx("span",{className:"block font-medium text-zinc-200",children:a.label}),n.jsx("span",{className:"text-xs text-zinc-500",children:a.description})]})]},a.id)})})]})]})}function Z9(){const{form:e,updateForm:s,isGenerating:a,generationError:r,setGenerating:o,setGenerationError:c,setGeneratedContent:d}=Ft(),[h,m]=k.useState(""),[f,p]=k.useState(!1);k.useEffect(()=>{!e.generatedPrompt&&!a&&b()},[]);const b=async()=>{var y,N;o(!0),c(null);try{const S=((y=yl.find(C=>C.id===e.purposeCategory))==null?void 0:y.label)||e.purposeCategory,w=((N=V0.find(C=>C.id===e.communicationStyle))==null?void 0:N.label)||e.communicationStyle,j=await n2({name:e.name,name_meaning:e.selectedNameMeaning,purpose_category:S,purpose_description:e.purposeDescription,follow_up_answers:e.followUpQuestions.filter(C=>C.answer.trim()).map(C=>({question:C.question,answer:C.answer})),communication_style:w,use_emojis:e.useEmojis});d(j.system_prompt,j.suggested_name,j.suggested_description)}catch(S){c(S instanceof Error?S.message:"Failed to generate prompt")}finally{o(!1)}},v=async()=>{if(h.trim()){p(!0),c(null);try{const y=await s2({current_prompt:e.systemPrompt,feedback:h});s({systemPrompt:y.system_prompt}),m("")}catch(y){c(y instanceof Error?y.message:"Failed to refine prompt")}finally{p(!1)}}};return a?n.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-cachi-500/20"}),n.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-full bg-cachi-500/10",children:n.jsx(Sn,{className:"h-8 w-8 text-cachi-400"})})]}),n.jsxs("div",{className:"text-center",children:[n.jsxs("p",{className:"text-lg font-medium text-zinc-200",children:["Creating ",e.name,"'s personality..."]}),n.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Crafting a unique system prompt just for you"})]}),n.jsx(Le,{className:"h-5 w-5 animate-spin text-cachi-400"})]}):n.jsxs("div",{className:"space-y-4",children:[r&&n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3",children:[n.jsx(Gs,{className:"h-5 w-5 text-red-400"}),n.jsx("span",{className:"text-sm text-red-400",children:r}),n.jsx("button",{onClick:b,className:"ml-auto text-sm text-red-400 underline hover:text-red-300",children:"Try again"})]}),n.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-800 bg-zinc-900/50 px-4 py-3",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-sm text-zinc-500",children:"Personality for"}),n.jsx("p",{className:"text-lg font-bold text-cachi-400",children:e.name})]}),n.jsxs("button",{onClick:b,className:"flex items-center gap-1.5 text-xs text-cachi-400 hover:text-cachi-300",children:[n.jsx(Cn,{className:"h-3 w-3"}),"Regenerate"]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"System Prompt"}),n.jsx("textarea",{value:e.systemPrompt,onChange:y=>s({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"})]}),n.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/50 p-4",children:[n.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[n.jsx(ym,{className:"h-4 w-4 text-cachi-400"}),n.jsx("span",{className:"text-sm font-medium text-zinc-300",children:"Refine with AI"})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{type:"text",value:h,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"}),n.jsx("button",{onClick:v,disabled:f||!h.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:f?n.jsx(Le,{className:"h-4 w-4 animate-spin"}):n.jsxs(n.Fragment,{children:[n.jsx(ym,{className:"h-4 w-4"}),"Refine"]})})]})]})]})}function W9(){const{form:e,isGenerating:s,setGenerating:a,setGenerationError:r,updateForm:o}=Ft(),c=k.useRef(!1);k.useEffect(()=>{!c.current&&!e.userContext&&!s&&(c.current=!0,d())},[]);const d=async()=>{a(!0),r(null);try{const f=await i2({purpose_category:e.purposeCategory,purpose_description:e.purposeDescription,follow_up_answers:e.followUpQuestions.filter(p=>p.answer.trim()).map(p=>({question:p.question,answer:p.answer})),system_prompt:e.systemPrompt,bot_name:e.name});o({userContext:f.user_context,suggestedTodos:f.suggested_todos.map(p=>({...p,enabled:!0})),suggestedSchedules:f.suggested_schedules.map(p=>({...p,enabled:!0}))})}catch(f){r(f instanceof Error?f.message:"Failed to analyze context")}finally{a(!1)}},h=f=>{const p=e.suggestedTodos.map((b,v)=>v===f?{...b,enabled:!b.enabled}:b);o({suggestedTodos:p})},m=f=>{const p=e.suggestedSchedules.map((b,v)=>v===f?{...b,enabled:!b.enabled}:b);o({suggestedSchedules:p})};return s?n.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-cachi-500/20"}),n.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-full bg-cachi-500/10",children:n.jsx(Sn,{className:"h-8 w-8 text-cachi-400"})})]}),n.jsxs("div",{className:"text-center",children:[n.jsx("p",{className:"text-lg font-medium text-zinc-200",children:"Analyzing your answers..."}),n.jsxs("p",{className:"mt-1 text-sm text-zinc-500",children:["Extracting what ",e.name," should know about you"]})]}),n.jsx(Le,{className:"h-5 w-5 animate-spin text-cachi-400"})]}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-zinc-200",children:[n.jsx(x4,{className:"h-4 w-4 text-cachi-400"}),"What ",e.name," knows about you"]}),n.jsx("textarea",{value:e.userContext,onChange:f=>o({userContext:f.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"}),n.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&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-zinc-200",children:[n.jsx(l0,{className:"h-4 w-4 text-cachi-400"}),"Suggested todos"]}),n.jsx("div",{className:"space-y-2",children:e.suggestedTodos.map((f,p)=>n.jsxs("button",{type:"button",onClick:()=>h(p),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:[n.jsx("div",{className:`mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded border transition-colors ${f.enabled?"border-cachi-500 bg-cachi-500 text-white":"border-zinc-600 bg-zinc-800"}`,children:f.enabled&&n.jsx(dn,{className:"h-3 w-3"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:`text-sm font-medium ${f.enabled?"text-zinc-200":"text-zinc-500 line-through"}`,children:f.title}),f.notes&&n.jsx("p",{className:"mt-0.5 text-xs text-zinc-500",children:f.notes})]})]},p))}),n.jsx("p",{className:"text-xs text-zinc-600",children:"Checked items will be created as todos for your bot."})]}),e.suggestedSchedules.length>0&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-zinc-200",children:[n.jsx(Wm,{className:"h-4 w-4 text-cachi-400"}),"Suggested recurring tasks"]}),n.jsx("div",{className:"space-y-2",children:e.suggestedSchedules.map((f,p)=>n.jsxs("button",{type:"button",onClick:()=>m(p),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:[n.jsx("div",{className:`mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded border transition-colors ${f.enabled?"border-cachi-500 bg-cachi-500 text-white":"border-zinc-600 bg-zinc-800"}`,children:f.enabled&&n.jsx(dn,{className:"h-3 w-3"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("p",{className:`text-sm font-medium ${f.enabled?"text-zinc-200":"text-zinc-500 line-through"}`,children:f.name}),n.jsxs("div",{className:"mt-0.5 flex items-center gap-2 text-xs text-zinc-500",children:[n.jsx("span",{className:"rounded bg-zinc-700/50 px-1.5 py-0.5",children:f.frequency}),f.description&&n.jsx("span",{children:f.description})]})]})]},p))}),n.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&&n.jsx("div",{className:"rounded-lg border border-zinc-700/50 bg-zinc-800/30 p-6 text-center",children:n.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 eO(){var v;const{form:e,previewMessages:s,isPreviewLoading:a,addPreviewMessage:r,clearPreviewMessages:o,setPreviewLoading:c}=Ft(),[d,h]=k.useState(""),m=((v=yl.find(y=>y.id===e.purposeCategory))==null?void 0:v.label)||"general",f=[`Hey ${e.name}, what can you help me with?`,"What makes you different from other assistants?",`Give me a quick tip about ${m.toLowerCase()}`],p=async y=>{if(!(!y.trim()||a)){r("user",y),h(""),c(!0);try{const N=await a2({system_prompt:e.systemPrompt,test_message:y});r("assistant",N.response)}catch{r("assistant",`Hey! I'm ${e.name}. How can I help you today?`)}finally{c(!1)}}},b=y=>{y.preventDefault(),p(d)};return n.jsxs("div",{className:"flex h-[400px] flex-col",children:[n.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[n.jsx(Gi,{className:"h-4 w-4 text-cachi-400"}),n.jsxs("span",{className:"text-sm font-medium text-zinc-300",children:["Chat with ",e.name]})]}),n.jsxs("div",{className:"flex-1 space-y-4 overflow-y-auto rounded-lg border border-zinc-800 bg-zinc-900/50 p-4",children:[s.length===0?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[n.jsx("div",{className:"mb-3 flex h-14 w-14 items-center justify-center rounded-full bg-cachi-500/10",children:n.jsx(Hn,{className:"h-7 w-7 text-cachi-400"})}),n.jsx("p",{className:"text-lg font-medium text-zinc-300",children:e.name}),n.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"See how your bot responds before creating it"})]}):s.map((y,N)=>n.jsxs("div",{className:X("flex gap-3",y.role==="user"?"justify-end":"justify-start"),children:[y.role==="assistant"&&n.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-cachi-600/20",children:n.jsx(Hn,{className:"h-4 w-4 text-cachi-400"})}),n.jsx("div",{className:X("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:n.jsx("p",{className:"text-sm whitespace-pre-wrap",children:y.content})}),y.role==="user"&&n.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-zinc-700",children:n.jsx(fl,{className:"h-4 w-4 text-zinc-300"})})]},N)),a&&n.jsxs("div",{className:"flex gap-3",children:[n.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-cachi-600/20",children:n.jsx(Hn,{className:"h-4 w-4 text-cachi-400"})}),n.jsx("div",{className:"rounded-2xl bg-zinc-800 px-4 py-2.5",children:n.jsx(Le,{className:"h-5 w-5 animate-spin text-zinc-400"})})]})]}),s.length===0&&n.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:f.map((y,N)=>n.jsx("button",{onClick:()=>p(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},N))}),n.jsxs("form",{onSubmit:b,className:"mt-3 flex gap-2",children:[n.jsx("input",{type:"text",value:d,onChange:y=>h(y.target.value),placeholder:`Message ${e.name}...`,disabled:a,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"}),n.jsx("button",{type:"submit",disabled:a||!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:n.jsx(tl,{className:"h-4 w-4"})})]}),s.length>0&&n.jsx("button",{onClick:o,className:"mt-2 text-xs text-zinc-500 hover:text-zinc-400",children:"Clear conversation"})]})}const tO=["#22c55e","#3b82f6","#8b5cf6","#ec4899","#f59e0b","#ef4444","#06b6d4","#84cc16"];function nO(){const{form:e,updateForm:s}=Ft();return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Bot Name"}),n.jsx("input",{type:"text",value:e.name,onChange:a=>s({name:a.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"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Description"}),n.jsx("input",{type:"text",value:e.description,onChange:a=>s({description:a.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"})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Icon"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:j2.map(a=>n.jsx("button",{onClick:()=>s({icon:a.id}),title:a.label,className:X("flex h-10 w-10 items-center justify-center rounded-lg border transition-all",e.icon===a.id?"border-cachi-500 bg-cachi-500/20":"border-zinc-700 bg-zinc-800 hover:border-zinc-600"),children:n.jsx(En,{icon:a.id,size:20})},a.id))})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Color"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:tO.map(a=>n.jsx("button",{onClick:()=>s({color:a}),className:X("h-10 w-10 rounded-lg border-2 transition-all",e.color===a?"border-white scale-110":"border-transparent hover:scale-105"),style:{backgroundColor:a}},a))})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"AI Model"}),n.jsx($i,{value:e.model,onChange:a=>s({model:a}),placeholder:"Select AI Model"})]}),(e.method==="blank"||!e.generatedPrompt)&&n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"System Prompt"}),n.jsx("textarea",{value:e.systemPrompt,onChange:a=>s({systemPrompt:a.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"})]}),n.jsxs("div",{className:"flex items-center gap-4 rounded-lg border border-zinc-800 bg-zinc-900/50 p-4",children:[n.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-xl",style:{backgroundColor:e.color+"20"},children:n.jsx(En,{icon:e.icon,size:28,color:e.color})}),n.jsxs("div",{children:[n.jsx("h3",{className:"font-semibold text-zinc-100",children:e.name||"Bot Name"}),n.jsx("p",{className:"text-sm text-zinc-500",children:e.description||"Bot description"})]})]})]})}function sO(){var r,o;const{form:e}=Ft(),s=(r=yl.find(c=>c.id===e.purposeCategory))==null?void 0:r.label,a=(o=V0.find(c=>c.id===e.communicationStyle))==null?void 0:o.label;return n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900/50 p-6",children:n.jsxs("div",{className:"flex items-start gap-4",children:[n.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-xl",style:{backgroundColor:e.color+"20"},children:n.jsx(En,{icon:e.icon,size:32,color:e.color})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("h2",{className:"text-xl font-bold text-zinc-100",children:e.name||"New Bot"}),n.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:e.description||"A new AI assistant"}),n.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.model&&n.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&&n.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-zinc-800 px-2.5 py-1 text-xs text-zinc-400",children:[n.jsx(mi,{className:"h-3 w-3"}),e.tools.length," tools"]})]})]})]})}),e.method==="ai-assisted"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("h3",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[n.jsx(Sn,{className:"h-4 w-4 text-cachi-400"}),"AI-Generated Configuration"]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s&&n.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/30 p-3",children:[n.jsx("span",{className:"text-xs text-zinc-500",children:"Purpose"}),n.jsx("p",{className:"mt-0.5 text-sm text-zinc-200",children:s})]}),a&&n.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/30 p-3",children:[n.jsx("span",{className:"text-xs text-zinc-500",children:"Style"}),n.jsx("p",{className:"mt-0.5 text-sm text-zinc-200",children:a})]})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("h3",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[n.jsx(di,{className:"h-4 w-4 text-zinc-500"}),"System Prompt"]}),n.jsx("div",{className:"max-h-40 overflow-y-auto rounded-lg border border-zinc-800 bg-zinc-900/30 p-4",children:n.jsx("p",{className:"whitespace-pre-wrap text-sm text-zinc-400",children:e.systemPrompt||"(No system prompt configured)"})})]}),e.tools.length>0&&n.jsxs("div",{className:"space-y-2",children:[n.jsxs("h3",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[n.jsx(mi,{className:"h-4 w-4 text-zinc-500"}),"Enabled Tools"]}),n.jsx("div",{className:"flex flex-wrap gap-2",children:e.tools.map(c=>n.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-zinc-800 px-3 py-1 text-xs text-zinc-300",children:[n.jsx(dn,{className:"h-3 w-3 text-cachi-400"}),c.replace(/_/g," ")]},c))})]}),n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-cachi-500/30 bg-cachi-500/10 px-4 py-3",children:[n.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-cachi-600",children:n.jsx(dn,{className:"h-4 w-4 text-white"})}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-cachi-400",children:"Ready to create"}),n.jsx("p",{className:"text-xs text-cachi-400/70",children:'Click "Create Bot" to add this bot to your collection'})]})]})]})}function aO(e){const s=[],a=[];if(!e||typeof e!="object")return{valid:!1,errors:["Invalid file format"],warnings:[]};const r=e;if(r.version?r.version!=="1.0"&&s.push(`Unsupported version: ${r.version}`):s.push("Missing version field"),!r.bot||typeof r.bot!="object")return s.push("Missing or invalid bot data"),{valid:!1,errors:s,warnings:a};const o=r.bot;return(!o.name||typeof o.name!="string")&&s.push("Missing bot name"),(!o.model||typeof o.model!="string")&&s.push("Missing model"),(!o.systemPrompt||typeof o.systemPrompt!="string")&&s.push("Missing system prompt"),o.description||a.push("No description provided"),o.icon||a.push("Using default icon"),o.color||a.push("Using default color"),s.length>0?{valid:!1,errors:s,warnings:a}:{valid:!0,errors:[],warnings:a,bot:{name:o.name,description:o.description,icon:o.icon,color:o.color,model:o.model,systemPrompt:o.systemPrompt,tools:o.tools||[]}}}function iO(){const{updateForm:e}=Ft(),s=k.useRef(null),[a,r]=k.useState(!1),[o,c]=k.useState(null),[d,h]=k.useState(null),m=async N=>{if(!N.name.endsWith(".json")){c({valid:!1,errors:["Please select a JSON file"],warnings:[]});return}h(N.name);try{const S=await N.text(),w=JSON.parse(S),j=aO(w);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:[]})}},f=N=>{var w;const S=(w=N.target.files)==null?void 0:w[0];S&&m(S)},p=N=>{N.preventDefault(),r(!1);const S=N.dataTransfer.files[0];S&&m(S)},b=N=>{N.preventDefault(),r(!0)},v=()=>{r(!1)},y=()=>{c(null),h(null),s.current&&(s.current.value="")};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{onDrop:p,onDragOver:b,onDragLeave:v,onClick:()=>{var N;return(N=s.current)==null?void 0:N.click()},className:X("flex cursor-pointer flex-col items-center justify-center rounded-xl border-2 border-dashed p-8 transition-colors",a?"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:[n.jsx("input",{ref:s,type:"file",accept:".json",onChange:f,className:"hidden"}),o!=null&&o.valid?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-green-500/20",children:n.jsx(dn,{className:"h-7 w-7 text-green-400"})}),n.jsx("p",{className:"mt-4 font-medium text-green-400",children:"File validated successfully"}),n.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:d})]}):o&&!o.valid?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-red-500/20",children:n.jsx(Gs,{className:"h-7 w-7 text-red-400"})}),n.jsx("p",{className:"mt-4 font-medium text-red-400",children:"Invalid file"}),n.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:d})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-zinc-800",children:n.jsx(Wu,{className:"h-7 w-7 text-zinc-500"})}),n.jsx("p",{className:"mt-4 font-medium text-zinc-300",children:"Drop a bot file here or click to browse"}),n.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Supports .json export files"})]})]}),o&&n.jsxs("div",{className:"space-y-3",children:[o.errors.length>0&&n.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 p-4",children:[n.jsxs("h4",{className:"flex items-center gap-2 text-sm font-medium text-red-400",children:[n.jsx(Gt,{className:"h-4 w-4"}),"Errors"]}),n.jsx("ul",{className:"mt-2 space-y-1",children:o.errors.map((N,S)=>n.jsx("li",{className:"text-sm text-red-300",children:N},S))})]}),o.warnings.length>0&&n.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 p-4",children:[n.jsxs("h4",{className:"flex items-center gap-2 text-sm font-medium text-amber-400",children:[n.jsx(Gs,{className:"h-4 w-4"}),"Warnings"]}),n.jsx("ul",{className:"mt-2 space-y-1",children:o.warnings.map((N,S)=>n.jsx("li",{className:"text-sm text-amber-300",children:N},S))})]})]}),(o==null?void 0:o.valid)&&o.bot&&n.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/50 p-4",children:[n.jsxs("h4",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[n.jsx(w4,{className:"h-4 w-4 text-zinc-500"}),"Imported Bot Preview"]}),n.jsxs("div",{className:"mt-3 space-y-2",children:[n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-sm text-zinc-500",children:"Name:"}),n.jsx("span",{className:"text-sm text-zinc-200",children:o.bot.name})]}),n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-sm text-zinc-500",children:"Model:"}),n.jsx("span",{className:"font-mono text-xs text-zinc-200",children:o.bot.model})]}),o.bot.tools&&o.bot.tools.length>0&&n.jsxs("div",{className:"flex justify-between",children:[n.jsx("span",{className:"text-sm text-zinc-500",children:"Tools:"}),n.jsx("span",{className:"text-sm text-zinc-200",children:o.bot.tools.length})]})]})]}),o&&n.jsx("button",{onClick:y,className:"text-sm text-zinc-500 hover:text-zinc-400",children:"Clear and try again"})]})}const C1={"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 rO(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 lO(){const{setCreateBotOpen:e}=Bt(),{addBot:s,setActiveBot:a}=xt(),{isOpen:r,currentStep:o,completedSteps:c,form:d,isGenerating:h,close:m,reset:f,nextStep:p,prevStep:b}=Ft(),v=()=>{m(),e(!1),setTimeout(f,200)},y=async()=>{const T=crypto.randomUUID(),D={id:T,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(s(D),a(D.id),d.method==="ai-assisted"){d.userContext.trim()&&Fj(T,d.userContext).catch(E=>console.warn("Failed to save custom instructions:",E));for(const E of d.suggestedTodos)E.enabled&&m2(T,{title:E.title,notes:E.notes||void 0}).catch(A=>console.warn("Failed to create todo:",A));for(const E of d.suggestedSchedules)E.enabled&&f2(T,{name:E.name,description:E.description||void 0}).catch(A=>console.warn("Failed to create schedule:",A))}v()},N=()=>{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}},S=d.method?C1[d.method]:C1["ai-assisted"],w=()=>{switch(o){case"method-select":return n.jsx(S1,{});case"template-select":return n.jsx(V9,{});case"purpose":return n.jsx(Y9,{});case"name-picker":return n.jsx(Q9,{});case"details":return n.jsx(J9,{});case"personality":return n.jsx(K9,{});case"prompt-review":return n.jsx(Z9,{});case"setup":return n.jsx(W9,{});case"preview":return n.jsx(eO,{});case"appearance":return n.jsx(nO,{});case"confirm":return n.jsx(sO,{});case"import":return n.jsx(iO,{});default:return n.jsx(S1,{})}},j=o!=="method-select",C=o==="confirm";return n.jsxs(Fs,{open:r,onClose:v,size:"xl",children:[n.jsx($s,{title:"Create New Bot",subtitle:rO(o),icon:n.jsx(Sn,{className:"h-5 w-5 text-cachi-500"}),onClose:v,children:d.method&&n.jsx(Kj,{steps:S,currentStep:o,completedSteps:c,variant:"compact",className:"mr-4"})}),n.jsx(Vs,{scrollable:!0,maxHeight:"max-h-[65vh]",children:w()}),n.jsxs(il,{leftContent:j?n.jsx(un,{variant:"ghost",onClick:b,children:"Back"}):null,children:[n.jsx(un,{variant:"ghost",onClick:v,children:"Cancel"}),C?n.jsx(un,{variant:"primary",onClick:y,disabled:!N()||h,children:"Create Bot"}):n.jsx(un,{variant:"primary",onClick:p,disabled:!N()||h,children:h?"Generating...":"Continue"})]})]})}function oO(){const{createBotOpen:e,setCreateBotOpen:s}=Bt(),{isOpen:a,open:r,close:o,reset:c}=Ft(),d=k.useRef(a);return k.useEffect(()=>{e&&!a?r():!e&&a&&(o(),setTimeout(c,200))},[e,a,r,o,c]),k.useEffect(()=>{d.current&&!a&&e&&s(!1),d.current=a},[a,e,s]),n.jsx(lO,{})}function cO(){const{settingsOpen:e,setSettingsOpen:s,showThinking:a,setShowThinking:r,showCost:o,setShowCost:c}=Bt(),{config:d,updateConfig:h}=$0(),{defaultModel:m,updateDefaultModel:f}=Wn();if(!e)return null;const p=async y=>{await f(y);try{await Su({model:y})}catch(N){console.error("Failed to update model:",N)}},b=async(y,N)=>{y==="showThinking"?r(N):c(N);try{await Su({[y==="showThinking"?"show_thinking":"show_cost"]:N})}catch(S){console.error("Failed to update setting:",S)}},v=async y=>{h({approveActions:y});try{await Su({approve_actions:y})}catch(N){console.error("Failed to update setting:",N)}};return n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:n.jsxs("div",{className:"w-full max-w-md rounded-xl bg-white p-6 shadow-xl dark:bg-zinc-900",children:[n.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[n.jsx("h2",{className:"text-lg font-semibold",children:"Settings"}),n.jsx(Zt,{variant:"ghost",size:"sm",onClick:()=>s(!1),children:n.jsx(Gt,{className:"h-5 w-5"})})]}),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("label",{className:"mb-2 block text-sm font-medium",children:"Default Model"}),n.jsx($i,{value:m,onChange:p,placeholder:"Select a model...",className:"w-full"})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx(im,{label:"Show thinking",description:"Display the agent's reasoning process",checked:a,onChange:y=>b("showThinking",y)}),n.jsx(im,{label:"Show cost",description:"Display token usage and cost information",checked:o,onChange:y=>b("showCost",y)}),n.jsx(im,{label:"Require approval",description:"Ask for approval before executing risky operations",checked:(d==null?void 0:d.agent.approveActions)??!1,onChange:v})]}),d&&n.jsxs("div",{children:[n.jsx("label",{className:"mb-1 block text-sm font-medium",children:"Workspace"}),n.jsx("p",{className:"truncate text-sm text-zinc-500 dark:text-zinc-400",children:d.workspacePath})]})]})]})})}function im({label:e,description:s,checked:a,onChange:r}){return n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium",children:e}),n.jsx("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:s})]}),n.jsx("button",{type:"button",role:"switch","aria-checked":a,onClick:()=>r(!a),className:X("relative h-6 w-11 rounded-full transition-colors",a?"bg-cachi-600":"bg-zinc-200 dark:bg-zinc-700"),children:n.jsx("span",{className:X("absolute left-0.5 top-0.5 h-5 w-5 rounded-full bg-white transition-transform",a&&"translate-x-5")})})]})}function uO({onApprove:e}){const[s,a]=k.useState(f7());if(k.useEffect(()=>m7(a),[]),!s)return null;const{id:r,tool:o,action:c,details:d}=s,h=d.riskLevel||"UNKNOWN",m=d.reasons||[],f=d.code,p=h==="HIGH"||h==="CRITICAL";return n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:n.jsxs("div",{className:"w-full max-w-lg rounded-xl bg-white shadow-xl dark:bg-zinc-900",children:[n.jsxs("div",{className:X("flex items-center gap-3 rounded-t-xl px-6 py-4",p?"bg-red-50 dark:bg-red-900/20":"bg-amber-50 dark:bg-amber-900/20"),children:[n.jsx("div",{className:X("flex h-10 w-10 items-center justify-center rounded-full",p?"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:n.jsx(Xu,{className:"h-5 w-5"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"font-semibold",children:"Approval Required"}),n.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:c})]})]}),n.jsxs("div",{className:"max-h-[60vh] overflow-y-auto p-6",children:[n.jsxs("div",{className:"mb-4",children:[n.jsx("p",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"Tool"}),n.jsx("p",{className:"font-medium",children:o})]}),n.jsxs("div",{className:"mb-4",children:[n.jsx("p",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"Risk Level"}),n.jsxs("span",{className:X("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":h==="CRITICAL","bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400":h==="HIGH","bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":h==="MEDIUM","bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":h==="LOW"}),children:[n.jsx(Yi,{className:"h-3 w-3"}),h]})]}),m.length>0&&n.jsxs("div",{className:"mb-4",children:[n.jsx("p",{className:"mb-2 text-sm text-zinc-500 dark:text-zinc-400",children:"Risk Factors"}),n.jsx("ul",{className:"space-y-1",children:m.map((b,v)=>n.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[n.jsx("span",{className:"mt-1 h-1.5 w-1.5 flex-shrink-0 rounded-full bg-amber-500"}),b]},v))})]}),f&&n.jsxs("div",{children:[n.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-sm text-zinc-500 dark:text-zinc-400",children:[n.jsx(Js,{className:"h-4 w-4"}),"Code to Execute"]}),n.jsx("pre",{className:"max-h-48 overflow-auto rounded-lg bg-zinc-900 p-4 text-sm text-zinc-100",children:n.jsx("code",{children:f})})]})]}),n.jsxs("div",{className:"flex justify-end gap-3 border-t border-zinc-200 px-6 py-4 dark:border-zinc-800",children:[n.jsx(Zt,{variant:"secondary",onClick:()=>e(r,!1),children:"Deny"}),n.jsx(Zt,{variant:p?"danger":"primary",onClick:()=>e(r,!0),children:p?"Allow Anyway":"Approve"})]})]})})}function T1(){return n.jsxs("div",{className:"flex flex-col items-center py-8 text-center",children:[n.jsx("div",{className:"mb-6 flex h-20 w-20 items-center justify-center rounded-2xl bg-accent-600/20",children:n.jsx(Hn,{className:"h-10 w-10 text-accent-500"})}),n.jsx("h2",{className:"text-2xl font-bold text-zinc-100",children:"Welcome to CachiBot"}),n.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."}),n.jsxs("div",{className:"mt-8 grid w-full max-w-sm gap-3",children:[n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-zinc-800 bg-zinc-800/50 p-3 text-left",children:[n.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-blue-500/20",children:n.jsx(Mv,{className:"h-4 w-4 text-blue-400"})}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-zinc-200",children:"Connect a Provider"}),n.jsx("p",{className:"text-xs text-zinc-500",children:"Add an API key to get started"})]})]}),n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-zinc-800 bg-zinc-800/50 p-3 text-left",children:[n.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-purple-500/20",children:n.jsx(Sn,{className:"h-4 w-4 text-purple-400"})}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-zinc-200",children:"Pick a Model"}),n.jsx("p",{className:"text-xs text-zinc-500",children:"Choose your default AI model"})]})]}),n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-zinc-800 bg-zinc-800/50 p-3 text-left",children:[n.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-orange-500/20",children:n.jsx(qo,{className:"h-4 w-4 text-orange-400"})}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-zinc-200",children:"Personalize"}),n.jsx("p",{className:"text-xs text-zinc-500",children:"Set your theme and preferences"})]})]})]})]})}const dO=["openai","claude","google","groq"],zo={openai:"OpenAI",claude:"Anthropic / Claude",google:"Google AI",groq:"Groq"};function hO(){const{providers:e,refresh:s,update:a,remove:r}=Qo(),{refresh:o}=Wn(),[c,d]=k.useState({}),[h,m]=k.useState(new Set),[f,p]=k.useState(null);k.useEffect(()=>{s()},[s]);const b=e.filter(w=>dO.includes(w.name)),v=b.filter(w=>w.configured).length,y=async w=>{const j=c[w];if(j!=null&&j.trim()){p(w);try{await a(w,j.trim()),d(C=>{const T={...C};return delete T[w],T}),m(C=>{const T=new Set(C);return T.delete(w),T}),o(),ke.success(`${zo[w]||w} key saved`)}catch{ke.error(`Failed to save ${zo[w]||w} key`)}finally{p(null)}}},N=async w=>{try{await r(w),d(j=>{const C={...j};return delete C[w],C}),o(),ke.success(`${zo[w]||w} key removed`)}catch{ke.error(`Failed to remove ${zo[w]||w} key`)}},S=w=>{m(j=>{const C=new Set(j);return C.has(w)?C.delete(w):C.add(w),C})};return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-zinc-100",children:"Connect an AI Provider"}),n.jsxs("p",{className:"mt-1 text-sm text-zinc-400",children:["You need at least one API key to use CachiBot.",v>0&&n.jsxs("span",{className:"ml-1 text-green-400",children:[v," provider",v>1?"s":""," configured."]})]})]}),n.jsx("div",{className:"space-y-3",children:b.map(w=>{const j=c[w.name]??"",C=h.has(w.name),T=f===w.name,D=zo[w.name]||w.name;return n.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-800/50 p-4 space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h4",{className:"font-medium text-zinc-200",children:D}),n.jsx("span",{className:X("inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium",w.configured?"bg-green-500/20 text-green-400":"bg-zinc-700 text-zinc-400"),children:w.configured?"Active":"Not set"})]}),w.configured&&n.jsx("button",{onClick:()=>N(w.name),className:"rounded p-1 text-zinc-400 transition-colors hover:bg-red-500/10 hover:text-red-400",title:"Remove key",children:n.jsx(Vt,{className:"h-4 w-4"})})]}),w.configured&&!(w.name in c)&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.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:C?w.masked_value:w.masked_value.replace(/./g,"*").slice(0,20)+"****"}),n.jsx("button",{onClick:()=>S(w.name),className:"rounded p-2 text-zinc-400 transition-colors hover:bg-zinc-700 hover:text-zinc-300",children:C?n.jsx(Vi,{className:"h-4 w-4"}):n.jsx(za,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{type:C?"text":"password",value:j,onChange:E=>d(A=>({...A,[w.name]:E.target.value})),placeholder:w.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"}),n.jsx("button",{onClick:()=>S(w.name),className:"rounded-lg border border-zinc-700 px-3 text-zinc-400 transition-colors hover:bg-zinc-700 hover:text-zinc-300",children:C?n.jsx(Vi,{className:"h-4 w-4"}):n.jsx(za,{className:"h-4 w-4"})}),n.jsxs("button",{onClick:()=>y(w.name),disabled:!j.trim()||T,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:[T?n.jsx(Le,{className:"h-4 w-4 animate-spin"}):n.jsx(Fo,{className:"h-4 w-4"}),"Save"]})]})]},w.name)})}),n.jsx("p",{className:"text-xs text-zinc-500",children:"More providers available in Settings > API Keys after setup."})]})}function fO(){const{defaultModel:e,updateDefaultModel:s,refresh:a}=Wn();k.useEffect(()=>{a()},[a]);const r=async o=>{o&&await s(o)};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-zinc-100",children:"Choose a Default Model"}),n.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."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-300",children:"Default Model"}),n.jsx($i,{value:e,onChange:r,placeholder:"Select a model...",className:"w-full"})]}),e&&n.jsx("div",{className:"rounded-lg border border-green-500/30 bg-green-500/10 p-3",children:n.jsxs("p",{className:"text-sm text-green-400",children:["Selected: ",n.jsx("span",{className:"font-mono text-xs",children:e})]})}),n.jsx("p",{className:"text-xs text-zinc-500",children:"You can change this anytime in Settings > Models."})]})}const mO=[{value:"light",label:"Light",icon:qv},{value:"dark",label:"Dark",icon:Lv},{value:"system",label:"System",icon:_v}],xO=Object.entries(td);function pO(){const{theme:e,setTheme:s,accentColor:a,setAccentColor:r,showThinking:o,setShowThinking:c,showCost:d,setShowCost:h}=Bt();return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-lg font-semibold text-zinc-100",children:"Personalize Your Experience"}),n.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Customize how CachiBot looks and feels."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-300",children:"Color Theme"}),n.jsx("div",{className:"flex gap-2",children:mO.map(m=>n.jsxs("button",{onClick:()=>s(m.value),className:X("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:[n.jsx(m.icon,{className:"h-4 w-4"}),m.label]},m.value))})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-300",children:"Accent Color"}),n.jsx("div",{className:"grid grid-cols-4 gap-2",children:xO.map(([m,{name:f,palette:p}])=>n.jsxs("button",{onClick:()=>r(m),className:X("flex items-center gap-2 rounded-lg border p-3 transition-all",a===m?"border-2 ring-1 ring-offset-1 ring-offset-zinc-900":"border-zinc-700 hover:border-zinc-600"),style:{borderColor:a===m?p[500]:void 0,"--tw-ring-color":a===m?p[500]:void 0},children:[n.jsx("div",{className:"h-5 w-5 rounded-full",style:{backgroundColor:p[500]}}),n.jsx("span",{className:"text-sm text-zinc-300",children:f})]},m))})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-300",children:"Display Options"}),n.jsx(E1,{label:"Show Thinking Process",description:"Display the AI's reasoning and thought process",checked:o,onChange:c}),n.jsx(E1,{label:"Show Token Costs",description:"Display estimated costs for API calls",checked:d,onChange:h})]})]})}function E1({label:e,description:s,checked:a,onChange:r}){return n.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-800 bg-zinc-800/50 p-3",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-zinc-200",children:e}),n.jsx("p",{className:"text-xs text-zinc-500",children:s})]}),n.jsx("button",{onClick:()=>r(!a),className:X("relative h-6 w-11 rounded-full transition-colors",a?"bg-accent-600":"bg-zinc-700"),children:n.jsx("span",{className:X("absolute top-1 h-4 w-4 rounded-full bg-white transition-transform",a?"left-6":"left-1")})})]})}const gO={openai:"OpenAI",claude:"Anthropic / Claude",google:"Google AI",groq:"Groq",grok:"Grok (xAI)",openrouter:"OpenRouter",moonshot:"Moonshot",ollama:"Ollama",lmstudio:"LM Studio"};function bO(){const{providers:e}=Qo(),{defaultModel:s}=Wn(),{theme:a,accentColor:r}=Bt(),o=e.filter(c=>c.configured).map(c=>gO[c.name]||c.name);return n.jsxs("div",{className:"flex flex-col items-center py-8 text-center",children:[n.jsx("div",{className:"mb-6 flex h-20 w-20 items-center justify-center rounded-full bg-green-500/20",children:n.jsx(dn,{className:"h-10 w-10 text-green-400"})}),n.jsx("h2",{className:"text-2xl font-bold text-zinc-100",children:"You're All Set!"}),n.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:"}),n.jsxs("div",{className:"mt-6 w-full max-w-sm space-y-3 text-left",children:[o.length>0&&n.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-800/50 p-3",children:[n.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-zinc-500",children:"Providers"}),n.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:o.join(", ")})]}),s&&n.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-800/50 p-3",children:[n.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-zinc-500",children:"Default Model"}),n.jsx("p",{className:"mt-1 font-mono text-sm text-zinc-200",children:s})]}),n.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-800/50 p-3",children:[n.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-zinc-500",children:"Appearance"}),n.jsxs("p",{className:"mt-1 text-sm text-zinc-200",children:[a.charAt(0).toUpperCase()+a.slice(1)," theme, ",r," accent"]})]})]}),n.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:[n.jsx(nl,{className:"h-5 w-5 shrink-0 text-amber-400"}),n.jsxs("div",{className:"flex-1 text-left",children:[n.jsx("p",{className:"text-sm font-medium text-zinc-200",children:"Enjoying CachiBot?"}),n.jsx("p",{className:"text-xs text-zinc-400",children:"Star us on GitHub to show your support!"})]}),n.jsx(dl,{className:"h-4 w-4 shrink-0 text-zinc-500"})]})]})}const yO=[{id:"welcome",label:"Welcome"},{id:"api-key",label:"API Key"},{id:"model",label:"Model"},{id:"preferences",label:"Style"},{id:"complete",label:"Done"}];function vO(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 jO(){const{isOpen:e,currentStep:s,nextStep:a,prevStep:r,completeOnboarding:o,skipOnboarding:c}=Pu(),{providers:d}=Qo(),{defaultModel:h}=Wn(),m=Im[s],f=Im.slice(0,s),p=()=>{switch(m){case"api-key":return d.some(S=>S.configured);case"model":return h!=="";default:return!0}},b=()=>{switch(m){case"welcome":return n.jsx(T1,{});case"api-key":return n.jsx(hO,{});case"model":return n.jsx(fO,{});case"preferences":return n.jsx(pO,{});case"complete":return n.jsx(bO,{});default:return n.jsx(T1,{})}},v=s===0,y=m==="complete",N=()=>{};return n.jsxs(Fs,{open:e,onClose:N,size:"xl",closeOnBackdrop:!1,closeOnEscape:!1,children:[n.jsx($s,{title:"Setup Wizard",subtitle:vO(m),icon:n.jsx(Hv,{className:"h-5 w-5 text-accent-500"}),onClose:N,children:n.jsx(Kj,{steps:yO,currentStep:m,completedSteps:f,variant:"compact",className:"mr-4"})}),n.jsx(Vs,{scrollable:!0,maxHeight:"max-h-[65vh]",children:b()}),n.jsx(il,{leftContent:v?n.jsx("button",{onClick:c,className:"text-sm text-zinc-500 transition-colors hover:text-zinc-300",children:"Skip for now"}):n.jsx(un,{variant:"ghost",onClick:r,children:"Back"}),children:y?n.jsx(un,{variant:"primary",onClick:o,children:"Get Started"}):n.jsx(un,{variant:"primary",onClick:a,disabled:!p(),children:"Continue"})})]})}function A1({size:e="md",className:s}){return n.jsx("div",{className:X("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"},s),children:n.jsx("span",{className:"sr-only",children:"Loading..."})})}function wO(){const{showDialog:e,closeDialog:s,checkResult:a,updateResult:r,isUpdating:o,isRestarting:c,optIntoBeta:d,performUpdate:h,restartServer:m,skipVersion:f,setOptIntoBeta:p}=cd();if(!e||!a)return null;const b=a.latest_stable||a.latest_prerelease;return c?n.jsxs(Fs,{open:!0,onClose:()=>{},closeOnBackdrop:!1,closeOnEscape:!1,size:"md",children:[n.jsx($s,{title:"Restarting CachiBot"}),n.jsx(Vs,{children:n.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[n.jsx(A1,{size:"lg",className:"text-accent-500"}),n.jsx("p",{className:"text-sm text-zinc-400",children:"Waiting for the new server to come online..."})]})})]}):o?n.jsxs(Fs,{open:!0,onClose:()=>{},closeOnBackdrop:!1,closeOnEscape:!1,size:"md",children:[n.jsx($s,{title:"Updating CachiBot",icon:n.jsx(gm,{className:"h-5 w-5 text-accent-500"})}),n.jsx(Vs,{children:n.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[n.jsx(A1,{size:"lg",className:"text-accent-500"}),n.jsxs("p",{className:"text-sm text-zinc-400",children:["Installing CachiBot v",b,"..."]})]})})]}):r?n.jsxs(Fs,{open:!0,onClose:s,size:"md",children:[n.jsx($s,{title:r.success?"Update Complete":"Update Failed",icon:r.success?n.jsx(wa,{className:"h-5 w-5 text-green-500"}):n.jsx(ui,{className:"h-5 w-5 text-red-500"}),onClose:s}),n.jsx(Vs,{children:n.jsxs("div",{className:"space-y-3",children:[n.jsx("p",{className:"text-sm text-zinc-300",children:r.message}),r.success&&n.jsxs("p",{className:"text-sm text-zinc-400",children:[r.old_version," → ",r.new_version]}),r.pip_output&&n.jsxs("details",{className:"mt-3",children:[n.jsx("summary",{className:"cursor-pointer text-xs text-zinc-500 hover:text-zinc-400",children:"Show pip output"}),n.jsx("pre",{className:"mt-2 max-h-40 overflow-auto rounded-lg bg-zinc-950 p-3 text-xs text-zinc-400",children:r.pip_output})]})]})}),n.jsx(il,{children:r.success?n.jsxs(n.Fragment,{children:[n.jsx(un,{variant:"secondary",onClick:s,children:"Later"}),n.jsx(un,{variant:"primary",onClick:m,children:"Restart now"})]}):n.jsx(un,{variant:"secondary",onClick:s,children:"Close"})})]}):n.jsxs(Fs,{open:!0,onClose:s,size:"lg",children:[n.jsx($s,{title:"Update Available",subtitle:`v${a.current_version} → v${b}`,icon:n.jsx(gm,{className:"h-5 w-5 text-accent-500"}),onClose:s}),n.jsx(Vs,{scrollable:!0,maxHeight:"max-h-[50vh]",children:n.jsxs("div",{className:"space-y-4",children:[a.is_docker&&n.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-yellow-800/50 bg-yellow-900/20 p-3",children:[n.jsx(Yi,{className:"mt-0.5 h-4 w-4 shrink-0 text-yellow-500"}),n.jsx("p",{className:"text-sm text-yellow-300",children:"Running inside Docker. Auto-update is disabled — rebuild the container to update."})]}),a.release_notes&&n.jsxs("div",{children:[n.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-300",children:"Release Notes"}),n.jsx("div",{className:"rounded-lg border border-zinc-800 bg-zinc-950 p-4",children:n.jsx(ld,{content:a.release_notes})})]}),a.release_url&&n.jsxs("a",{href:a.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:[n.jsx(dl,{className:"h-3.5 w-3.5"}),"View on GitHub"]}),a.prerelease_available&&n.jsxs("label",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[n.jsx("input",{type:"checkbox",checked:d,onChange:v=>p(v.target.checked),className:"rounded border-zinc-600 bg-zinc-800 text-accent-600 focus:ring-accent-500"}),"Include pre-release / beta versions"]})]})}),n.jsxs(il,{leftContent:b&&n.jsx(un,{variant:"ghost",onClick:()=>f(b),children:"Skip this version"}),children:[n.jsx(un,{variant:"secondary",onClick:s,children:"Not now"}),n.jsx(un,{variant:"primary",onClick:()=>h(),disabled:a.is_docker,children:"Update now"})]})]})}function zO(){const{showBanner:e,checkResult:s,dismissBanner:a,openDialog:r}=cd();if(!e||!s)return null;const o=s.latest_stable||s.latest_prerelease;return n.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:[n.jsxs("div",{className:"flex items-center gap-2 text-accent-400",children:[n.jsx(gm,{className:"h-4 w-4 shrink-0"}),n.jsxs("span",{children:["CachiBot ",n.jsxs("strong",{children:["v",o]})," is available"," ",n.jsxs("span",{className:"text-zinc-400",children:["(current: v",s.current_version,")"]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:r,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"}),n.jsx("button",{onClick:a,className:"rounded-md p-1 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200 transition-colors","aria-label":"Dismiss",children:n.jsx(Gt,{className:"h-3.5 w-3.5"})})]})]})}const rm={"/dashboard":"dashboard","/settings":"settings"};function NO(e){if(rm[e])return rm[e];for(const[s,a]of Object.entries(rm))if(e.startsWith(s+"/"))return a;return null}function gn(){const e=gs(),s=hn(),{botId:a,chatId:r,taskId:o}=K1(),{activeView:c,activeBotId:d,bots:h,setActiveBot:m,setActiveView:f}=xt(),{activeChatId:p,chats:b,setActiveChat:v}=qt(),{setActiveTask:y}=sl(),{theme:N,accentColor:S,mobileMenuOpen:w,setMobileMenuOpen:j}=Bt(),{setConfig:C}=$0(),{refresh:T}=Wn(),{providers:D,refresh:E}=Qo(),{hasCompletedOnboarding:A,open:B}=Pu(),V=NO(e.pathname),R=e.pathname.split("/").filter(Boolean)[1],_=R?{chats:"chats",tasks:"tasks",work:"work",schedules:"schedules",voice:"voice",tools:"tools",settings:"settings"}[R]:null;k.useEffect(()=>{if(a&&a!==d)if(h.some(H=>H.id===a))m(a);else{s("/",{replace:!0});return}if(_&&_!==c&&f(_),r&&r!==p){let U=b.find(H=>H.id===r);!U&&(r==="telegram"||r==="discord")&&(U=b.find(H=>H.platform===r&&H.botId===a)),U&&U.botId===a&&v(U.id)}o&&y(o)},[a,_,r,o,h,b,d,p,c,m,f,v,y,s]),k.useEffect(()=>{const U=H=>{H?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};if(N==="system"){const H=window.matchMedia("(prefers-color-scheme: dark)");U(H.matches);const I=W=>U(W.matches);return H.addEventListener("change",I),()=>H.removeEventListener("change",I)}else U(N==="dark")},[N]),k.useEffect(()=>{var H;const U=(H=td[S])==null?void 0:H.palette;if(U){const I=document.documentElement;Object.entries(U).forEach(([W,re])=>{I.style.setProperty(`--accent-${W}`,re)})}},[S]),k.useEffect(()=>{async function U(){try{const H=await Kv(),I={agent:{model:H.agent.model,maxIterations:H.agent.max_iterations,approveActions:H.agent.approve_actions,temperature:H.agent.temperature},sandbox:{allowedImports:H.sandbox.allowed_imports,timeoutSeconds:H.sandbox.timeout_seconds,maxOutputLength:H.sandbox.max_output_length},display:{showThinking:H.display.show_thinking,showCost:H.display.show_cost,style:H.display.style},workspacePath:H.workspace_path};C(I)}catch(H){console.error("Failed to load config:",H)}}U(),T(),E()},[C,T,E]),k.useEffect(()=>{if(A||D.length===0)return;D.some(H=>H.configured)?Pu.getState().completeOnboarding():B()},[A,D,B]),k.useEffect(()=>{cd.getState().checkForUpdate()},[]);const se=()=>{if(V)switch(V){case"dashboard":return n.jsx(i9,{});case"settings":return n.jsx(f9,{})}switch(_||c){case"chats":return n.jsx(b1,{});case"rooms":return n.jsx(B7,{});case"tasks":return n.jsx(H7,{});case"work":return n.jsx(C9,{});case"schedules":return n.jsx(A9,{});case"voice":return n.jsx(B9,{});case"tools":return n.jsx(Z7,{});case"settings":return n.jsx(YD,{});default:return n.jsx(b1,{})}};return n.jsxs("div",{className:"flex h-screen bg-zinc-100 text-zinc-900 dark:bg-zinc-950 dark:text-zinc-100",children:[w&&n.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>j(!1)}),n.jsx("div",{className:`
          fixed inset-y-0 left-0 z-50 transition-transform duration-300 lg:static lg:translate-x-0
          ${w?"translate-x-0":"-translate-x-full"}
        `,children:n.jsx(Q3,{onNavigate:()=>j(!1)})}),!V&&n.jsx("div",{className:`
            fixed inset-y-0 left-[72px] z-50 transition-transform duration-300 lg:static lg:translate-x-0
            ${w?"translate-x-0":"-translate-x-[calc(100%+72px)]"}
          `,children:n.jsx(sC,{onNavigate:()=>j(!1)})}),n.jsxs("main",{className:"flex flex-1 flex-col overflow-hidden",children:[n.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:[n.jsx("button",{onClick:()=>j(!w),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:w?n.jsx(Gt,{className:"h-5 w-5"}):n.jsx(H4,{className:"h-5 w-5"})}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-accent-600",children:n.jsx("span",{className:"text-sm font-bold text-white",children:"C"})}),n.jsx("span",{className:"font-semibold text-zinc-900 dark:text-zinc-100",children:"CachiBot"})]})]}),n.jsx(zO,{}),se()]}),n.jsx(oO,{}),n.jsx(cO,{}),n.jsx(uO,{onApprove:()=>{}}),n.jsx(jO,{}),n.jsx(wO,{})]})}function kO(){const e=hn(),[s]=Zk(),{login:a,authMode:r}=Ut(),[o,c]=k.useState(null);k.useEffect(()=>{const h=s.get("token");if(!h){c("No token provided");return}(async()=>{try{const f=await rS({token:h});a(f.user,f.access_token,f.refresh_token),ke.success(`Welcome, ${f.user.username}!`),e("/",{replace:!0})}catch(f){const p=f instanceof Error?f.message:"Token exchange failed";c(p)}})()},[s,a,e]);const d=r==null?void 0:r.login_url;return n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950 px-4",children:n.jsxs("div",{className:"w-full max-w-md text-center",children:[n.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:n.jsx(ps,{className:"h-8 w-8 text-white"})}),o?n.jsxs("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 p-6 shadow-sm",children:[n.jsx(Gs,{className:"h-8 w-8 text-red-500 mx-auto mb-3"}),n.jsx("h2",{className:"text-lg font-semibold text-zinc-900 dark:text-white mb-2",children:"Authentication Failed"}),n.jsx("p",{className:"text-zinc-500 dark:text-zinc-400 text-sm mb-4",children:o}),d&&n.jsx("a",{href:d,children:n.jsx(Zt,{className:"w-full justify-center",children:"Back to Website"})})]}):n.jsxs(n.Fragment,{children:[n.jsx(Le,{className:"h-8 w-8 animate-spin text-accent-500 mx-auto mb-4"}),n.jsx("p",{className:"text-zinc-500 dark:text-zinc-400",children:"Signing you in..."})]})]})})}function SO(){const e=hn(),{login:s,setSetupRequired:a,setAuthMode:r,authMode:o,isLoading:c,setLoading:d}=Ut(),[h,m]=k.useState(""),[f,p]=k.useState(""),[b,v]=k.useState(!1),[y,N]=k.useState(!1);k.useEffect(()=>{(async()=>{try{const j=await iS();if(r(j),j.mode==="cloud"){d(!1);return}const{setup_required:C}=await x0();a(C),C&&e("/setup",{replace:!0})}catch(j){console.error("Failed to check auth mode:",j)}finally{d(!1)}})()},[a,r,d,e]);const S=async w=>{if(w.preventDefault(),!h.trim()||!f){ke.error("Please enter your credentials");return}N(!0);try{const j=await oS({identifier:h.trim(),password:f});s(j.user,j.access_token,j.refresh_token),ke.success(`Welcome back, ${j.user.username}!`),e("/")}catch(j){const C=j instanceof Error?j.message:"Login failed";ke.error(C)}finally{N(!1)}};return c?n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950",children:n.jsx(Le,{className:"h-8 w-8 animate-spin text-accent-500"})}):(o==null?void 0:o.mode)==="cloud"&&o.login_url?n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950 px-4",children:n.jsxs("div",{className:"w-full max-w-md",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.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:n.jsx(ps,{className:"h-8 w-8 text-white"})}),n.jsx("h1",{className:"text-2xl font-bold text-zinc-900 dark:text-white",children:"CachiBot"}),n.jsx("p",{className:"text-zinc-500 dark:text-zinc-400 mt-1",children:"Sign in to continue"})]}),n.jsxs("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 p-6 shadow-sm text-center",children:[n.jsx("p",{className:"text-zinc-600 dark:text-zinc-300 text-sm mb-4",children:"This platform uses cachibot.ai for authentication."}),n.jsx("a",{href:o.login_url,children:n.jsxs(Zt,{className:"w-full justify-center",children:[n.jsx(dl,{className:"h-4 w-4 mr-2"}),"Sign in via cachibot.ai"]})})]}),n.jsx("p",{className:"text-center text-zinc-500 text-sm mt-6",children:"The Armored AI Agent"})]})}):n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950 px-4",children:n.jsxs("div",{className:"w-full max-w-md",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.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:n.jsx(ps,{className:"h-8 w-8 text-white"})}),n.jsx("h1",{className:"text-2xl font-bold text-zinc-900 dark:text-white",children:"CachiBot"}),n.jsx("p",{className:"text-zinc-500 dark:text-zinc-400 mt-1",children:"Sign in to continue"})]}),n.jsx("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 p-6 shadow-sm",children:n.jsxs("form",{onSubmit:S,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{htmlFor:"identifier",className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-1.5",children:"Email or Username"}),n.jsx("input",{id:"identifier",type:"text",value:h,onChange:w=>m(w.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})]}),n.jsxs("div",{children:[n.jsx("label",{htmlFor:"loginPassword",className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-1.5",children:"Password"}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{id:"loginPassword",type:b?"text":"password",value:f,onChange:w=>p(w.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}),n.jsx("button",{type:"button",onClick:()=>v(!b),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:b?n.jsx(Vi,{className:"h-4 w-4"}):n.jsx(za,{className:"h-4 w-4"})})]})]}),n.jsx(Zt,{type:"submit",className:"w-full justify-center",disabled:y,children:y?n.jsxs(n.Fragment,{children:[n.jsx(Le,{className:"h-4 w-4 animate-spin mr-2"}),"Signing in..."]}):"Sign In"})]})}),n.jsx("p",{className:"text-center text-zinc-500 text-sm mt-6",children:"The Armored AI Agent"})]})})}function CO(){const e=hn(),{login:s,setSetupRequired:a,isLoading:r,setLoading:o}=Ut(),[c,d]=k.useState(""),[h,m]=k.useState(""),[f,p]=k.useState(""),[b,v]=k.useState(""),[y,N]=k.useState(!1),[S,w]=k.useState(!1),[j,C]=k.useState(null);k.useEffect(()=>{(async()=>{try{const{setup_required:E}=await x0();a(E),C(E),E||e("/login",{replace:!0})}catch(E){console.error("Failed to check setup status:",E),ke.error("Failed to check setup status")}finally{o(!1)}})()},[a,o,e]);const T=async D=>{if(D.preventDefault(),!c.trim()||!h.trim()||!f){ke.error("Please fill in all fields");return}if(f!==b){ke.error("Passwords do not match");return}if(f.length<8){ke.error("Password must be at least 8 characters");return}if(h.length<3){ke.error("Username must be at least 3 characters");return}w(!0);try{const E=await lS({email:c.trim().toLowerCase(),username:h.trim().toLowerCase(),password:f});s(E.user,E.access_token,E.refresh_token),ke.success("Admin account created successfully!"),e("/")}catch(E){const A=E instanceof Error?E.message:"Setup failed";ke.error(A)}finally{w(!1)}};return r||j===null?n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950",children:n.jsx(Le,{className:"h-8 w-8 animate-spin text-accent-500"})}):n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950 px-4",children:n.jsxs("div",{className:"w-full max-w-md",children:[n.jsxs("div",{className:"text-center mb-8",children:[n.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:n.jsx(ps,{className:"h-8 w-8 text-white"})}),n.jsx("h1",{className:"text-2xl font-bold text-zinc-900 dark:text-white",children:"CachiBot Setup"}),n.jsx("p",{className:"text-zinc-500 dark:text-zinc-400 mt-1",children:"Create your admin account to get started"})]}),n.jsx("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 p-6 shadow-sm",children:n.jsxs("form",{onSubmit:T,className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-4 p-3 bg-blue-500/10 rounded-lg border border-blue-500/20",children:[n.jsx(ed,{className:"h-5 w-5 text-blue-400 flex-shrink-0"}),n.jsx("p",{className:"text-sm text-blue-300",children:"Welcome! Set up your admin account to start using CachiBot."})]}),n.jsxs("div",{children:[n.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Email"}),n.jsx("input",{id:"email",type:"email",value:c,onChange:D=>d(D.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})]}),n.jsxs("div",{children:[n.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Username"}),n.jsx("input",{id:"username",type:"text",value:h,onChange:D=>m(D.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})]}),n.jsxs("div",{children:[n.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Password"}),n.jsxs("div",{className:"relative",children:[n.jsx("input",{id:"password",type:y?"text":"password",value:f,onChange:D=>p(D.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}),n.jsx("button",{type:"button",onClick:()=>N(!y),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-zinc-400 hover:text-zinc-300",children:y?n.jsx(Vi,{className:"h-4 w-4"}):n.jsx(za,{className:"h-4 w-4"})})]})]}),n.jsxs("div",{children:[n.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Confirm Password"}),n.jsx("input",{id:"confirmPassword",type:y?"text":"password",value:b,onChange:D=>v(D.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})]}),n.jsx(Zt,{type:"submit",className:"w-full justify-center",disabled:S,children:S?n.jsxs(n.Fragment,{children:[n.jsx(Le,{className:"h-4 w-4 animate-spin mr-2"}),"Creating account..."]}):n.jsxs(n.Fragment,{children:["Create Admin Account",n.jsx(mv,{className:"h-4 w-4 ml-2"})]})})]})}),n.jsx("p",{className:"text-center text-zinc-500 text-sm mt-6",children:"The Armored AI Agent"})]})})}function cn({children:e,requireAdmin:s=!1}){const a=gs(),{isAuthenticated:r,isLoading:o,user:c,setupRequired:d,setUser:h,setSetupRequired:m,setLoading:f,logout:p}=Ut(),[b,v]=k.useState(!1);return k.useEffect(()=>{(async()=>{if(d===null)try{const{setup_required:N}=await x0();if(m(N),N){f(!1),v(!0);return}}catch{m(!1)}if(r)try{const N=await uS();h(N)}catch{p()}f(!1),v(!0)})()},[r,d,h,m,f,p]),o||!b?n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950",children:n.jsx(Le,{className:"h-8 w-8 animate-spin text-accent-500"})}):d?n.jsx(zu,{to:"/setup",state:{from:a},replace:!0}):r?s&&(c==null?void 0:c.role)!=="admin"?n.jsx(zu,{to:"/",replace:!0}):n.jsx(n.Fragment,{children:e}):n.jsx(zu,{to:"/login",state:{from:a},replace:!0})}function TO(){const e=hn(),{user:s}=Ut(),[a,r]=k.useState([]),[o,c]=k.useState(!0),[d,h]=k.useState(0),[m,f]=k.useState(!1),[p,b]=k.useState({email:"",username:"",password:"",role:"user"}),[v,y]=k.useState(!1),[N,S]=k.useState(null),[w,j]=k.useState({email:"",username:"",role:"user"}),[C,T]=k.useState(!1),[D,E]=k.useState(null);k.useEffect(()=>{A()},[]);const A=async()=>{try{const F=await Gv();r(F.users),h(F.total)}catch{ke.error("Failed to load users")}finally{c(!1)}},B=async F=>{if(F.preventDefault(),!p.email||!p.username||!p.password){ke.error("All fields are required");return}if(p.password.length<8){ke.error("Password must be at least 8 characters");return}y(!0);try{const _=await Yv(p);r([_,...a]),h(d+1),f(!1),b({email:"",username:"",password:"",role:"user"}),ke.success("User created successfully")}catch(_){const se=_ instanceof Error?_.message:"Failed to create user";ke.error(se)}finally{y(!1)}},V=async F=>{if(F.preventDefault(),!!N){T(!0);try{const _=await Qv(N.id,w);r(a.map(se=>se.id===_.id?_:se)),S(null),ke.success("User updated successfully")}catch(_){const se=_ instanceof Error?_.message:"Failed to update user";ke.error(se)}finally{T(!1)}}},ee=async F=>{if(confirm("Are you sure you want to deactivate this user?")){try{await Jv(F),r(a.map(_=>_.id===F?{..._,is_active:!1}:_)),ke.success("User deactivated")}catch(_){const se=_ instanceof Error?_.message:"Failed to deactivate user";ke.error(se)}E(null)}},R=F=>{S(F),j({email:F.email,username:F.username,role:F.role}),E(null)};return o?n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-950",children:n.jsx(Le,{className:"h-8 w-8 animate-spin text-blue-500"})}):n.jsxs("div",{className:"min-h-screen bg-zinc-950 text-white",children:[n.jsx("header",{className:"sticky top-0 z-10 bg-zinc-950/80 backdrop-blur-sm border-b border-zinc-800",children:n.jsxs("div",{className:"max-w-5xl mx-auto px-4 py-4 flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:()=>e("/"),className:"p-2 hover:bg-zinc-800 rounded-lg transition-colors",children:n.jsx(d4,{className:"h-5 w-5"})}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Qi,{className:"h-5 w-5 text-blue-400"}),n.jsx("h1",{className:"text-lg font-semibold",children:"User Management"})]})]}),n.jsxs(Zt,{onClick:()=>f(!0),children:[n.jsx(ed,{className:"h-4 w-4 mr-2"}),"Add User"]})]})}),n.jsxs("main",{className:"max-w-5xl mx-auto px-4 py-6",children:[n.jsxs("div",{className:"bg-zinc-900 rounded-xl border border-zinc-800 overflow-hidden",children:[n.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:[n.jsx("div",{children:"User"}),n.jsx("div",{children:"Email"}),n.jsx("div",{children:"Role"}),n.jsx("div",{children:"Status"}),n.jsx("div",{})]}),a.length===0?n.jsx("div",{className:"px-4 py-8 text-center text-zinc-500",children:"No users found"}):a.map(F=>n.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:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-full bg-zinc-700 flex items-center justify-center",children:n.jsx(Du,{className:"h-4 w-4 text-zinc-400"})}),n.jsxs("div",{children:[n.jsx("div",{className:"font-medium",children:F.username}),F.id===(s==null?void 0:s.id)&&n.jsx("div",{className:"text-xs text-blue-400",children:"You"})]})]}),n.jsx("div",{className:"text-zinc-400 truncate",children:F.email}),n.jsx("div",{children:n.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium ${F.role==="admin"?"bg-purple-500/20 text-purple-300":"bg-zinc-700 text-zinc-300"}`,children:[F.role==="admin"?n.jsx(ps,{className:"h-3 w-3"}):n.jsx(fl,{className:"h-3 w-3"}),F.role]})}),n.jsx("div",{children:n.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium ${F.is_active?"bg-green-500/20 text-green-300":"bg-red-500/20 text-red-300"}`,children:[F.is_active?n.jsx(dn,{className:"h-3 w-3"}):n.jsx(Gt,{className:"h-3 w-3"}),F.is_active?"Active":"Inactive"]})}),n.jsxs("div",{className:"relative",children:[n.jsx("button",{onClick:()=>E(D===F.id?null:F.id),className:"p-1.5 hover:bg-zinc-700 rounded transition-colors",disabled:F.id===(s==null?void 0:s.id),children:n.jsx(wv,{className:"h-4 w-4 text-zinc-400"})}),D===F.id&&n.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:[n.jsx("button",{onClick:()=>R(F),className:"w-full px-3 py-2 text-left text-sm hover:bg-zinc-700 transition-colors",children:"Edit User"}),F.is_active&&n.jsx("button",{onClick:()=>ee(F.id),className:"w-full px-3 py-2 text-left text-sm text-red-400 hover:bg-zinc-700 transition-colors",children:"Deactivate"})]})]})]},F.id))]}),n.jsxs("p",{className:"text-sm text-zinc-500 mt-4 text-center",children:[d," user",d!==1?"s":""," total"]})]}),m&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:n.jsxs("div",{className:"bg-zinc-900 rounded-xl border border-zinc-800 p-6 w-full max-w-md mx-4",children:[n.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Create New User"}),n.jsxs("form",{onSubmit:B,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Email"}),n.jsxs("div",{className:"relative",children:[n.jsx(Ov,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),n.jsx("input",{type:"email",value:p.email,onChange:F=>b({...p,email:F.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})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Username"}),n.jsxs("div",{className:"relative",children:[n.jsx(Du,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),n.jsx("input",{type:"text",value:p.username,onChange:F=>b({...p,username:F.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})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Password"}),n.jsx("input",{type:"password",value:p.password,onChange:F=>b({...p,password:F.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"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Role"}),n.jsxs("select",{value:p.role,onChange:F=>b({...p,role:F.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:[n.jsx("option",{value:"user",children:"User"}),n.jsx("option",{value:"admin",children:"Admin"})]})]}),n.jsxs("div",{className:"flex gap-3 pt-2",children:[n.jsx(Zt,{type:"button",variant:"ghost",className:"flex-1",onClick:()=>f(!1),children:"Cancel"}),n.jsx(Zt,{type:"submit",className:"flex-1",disabled:v,children:v?n.jsx(Le,{className:"h-4 w-4 animate-spin"}):"Create User"})]})]})]})}),N&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:n.jsxs("div",{className:"bg-zinc-900 rounded-xl border border-zinc-800 p-6 w-full max-w-md mx-4",children:[n.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Edit User"}),n.jsxs("form",{onSubmit:V,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Email"}),n.jsx("input",{type:"email",value:w.email,onChange:F=>j({...w,email:F.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})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Username"}),n.jsx("input",{type:"text",value:w.username,onChange:F=>j({...w,username:F.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})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Role"}),n.jsxs("select",{value:w.role,onChange:F=>j({...w,role:F.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:[n.jsx("option",{value:"user",children:"User"}),n.jsx("option",{value:"admin",children:"Admin"})]})]}),n.jsxs("div",{className:"flex gap-3 pt-2",children:[n.jsx(Zt,{type:"button",variant:"ghost",className:"flex-1",onClick:()=>S(null),children:"Cancel"}),n.jsx(Zt,{type:"submit",className:"flex-1",disabled:C,children:C?n.jsx(Le,{className:"h-4 w-4 animate-spin"}):"Save Changes"})]})]})]})}),D&&n.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>E(null)})]})}function EO(){const{theme:e}=Bt();return k.useEffect(()=>{const s=document.documentElement;e==="dark"||e==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches?s.classList.add("dark"):s.classList.remove("dark")},[e]),n.jsxs(wk,{children:[n.jsx(Ct,{path:"/login",element:n.jsx(SO,{})}),n.jsx(Ct,{path:"/setup",element:n.jsx(CO,{})}),n.jsx(Ct,{path:"/auth/callback",element:n.jsx(kO,{})}),n.jsx(Ct,{path:"/dashboard",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"/settings",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"/settings/:settingsTab",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"/users",element:n.jsx(cn,{requireAdmin:!0,children:n.jsx(TO,{})})}),n.jsx(Ct,{path:"/:botId/chats",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"/:botId/chats/:chatId",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"/:botId/tasks",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"/:botId/tasks/:taskId",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"/:botId/work",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"/:botId/work/:workId",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"/:botId/schedules",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"/:botId/schedules/:scheduleId",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"/:botId/rooms",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"/:botId/rooms/:roomId",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"/:botId/tools",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"/:botId/settings",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"/",element:n.jsx(cn,{children:n.jsx(gn,{})})}),n.jsx(Ct,{path:"*",element:n.jsx(zu,{to:"/",replace:!0})})]})}const AO=new M5({defaultOptions:{queries:{staleTime:1e3*60,retry:1}}});kN.createRoot(document.getElementById("root")).render(n.jsx(k.StrictMode,{children:n.jsx(Yk,{children:n.jsxs(O5,{client:AO,children:[n.jsx(EO,{}),n.jsx(r4,{position:"bottom-right",richColors:!0})]})})}));
