@maudecode/cove 1.1.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,421 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const s of l.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&a(s)}).observe(document,{childList:!0,subtree:!0});function r(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function a(o){if(o.ep)return;o.ep=!0;const l=r(o);fetch(o.href,l)}})();var co,W,vf,mf,Dn,td,bf,xf,yf,Ec,Ci,Ei,wf,Ba={},kf=[],mv=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,uo=Array.isArray;function Ot(e,t){for(var r in t)e[r]=t[r];return e}function Tc(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function nn(e,t,r){var a,o,l,s={};for(l in t)l=="key"?a=t[l]:l=="ref"?o=t[l]:s[l]=t[l];if(arguments.length>2&&(s.children=arguments.length>3?co.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(l in e.defaultProps)s[l]===void 0&&(s[l]=e.defaultProps[l]);return wa(e,s,a,o,null)}function wa(e,t,r,a,o){var l={type:e,props:t,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++vf,__i:-1,__u:0};return o==null&&W.vnode!=null&&W.vnode(l),l}function Y(e){return e.children}function Xe(e,t){this.props=e,this.context=t}function Tr(e,t){if(t==null)return e.__?Tr(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Tr(e):null}function _f(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return _f(e)}}function Ti(e){(!e.__d&&(e.__d=!0)&&Dn.push(e)&&!Ml.__r++||td!=W.debounceRendering)&&((td=W.debounceRendering)||bf)(Ml)}function Ml(){for(var e,t,r,a,o,l,s,c=1;Dn.length;)Dn.length>c&&Dn.sort(xf),e=Dn.shift(),c=Dn.length,e.__d&&(r=void 0,a=void 0,o=(a=(t=e).__v).__e,l=[],s=[],t.__P&&((r=Ot({},a)).__v=a.__v+1,W.vnode&&W.vnode(r),Ac(t.__P,r,a,t.__n,t.__P.namespaceURI,32&a.__u?[o]:null,l,o??Tr(a),!!(32&a.__u),s),r.__v=a.__v,r.__.__k[r.__i]=r,Ef(l,r,s),a.__e=a.__=null,r.__e!=o&&_f(r)));Ml.__r=0}function Sf(e,t,r,a,o,l,s,c,u,d,h){var f,g,m,y,C,T,_,p=a&&a.__k||kf,b=t.length;for(u=bv(r,t,p,u,b),f=0;f<b;f++)(m=r.__k[f])!=null&&(g=m.__i==-1?Ba:p[m.__i]||Ba,m.__i=f,T=Ac(e,m,g,o,l,s,c,u,d,h),y=m.__e,m.ref&&g.ref!=m.ref&&(g.ref&&Mc(g.ref,null,m),h.push(m.ref,m.__c||y,m)),C==null&&y!=null&&(C=y),(_=!!(4&m.__u))||g.__k===m.__k?u=Cf(m,u,e,_):typeof m.type=="function"&&T!==void 0?u=T:y&&(u=y.nextSibling),m.__u&=-7);return r.__e=C,u}function bv(e,t,r,a,o){var l,s,c,u,d,h=r.length,f=h,g=0;for(e.__k=new Array(o),l=0;l<o;l++)(s=t[l])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[l]=wa(null,s,null,null,null):uo(s)?s=e.__k[l]=wa(Y,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[l]=wa(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[l]=s,u=l+g,s.__=e,s.__b=e.__b+1,c=null,(d=s.__i=xv(s,r,u,f))!=-1&&(f--,(c=r[d])&&(c.__u|=2)),c==null||c.__v==null?(d==-1&&(o>h?g--:o<h&&g++),typeof s.type!="function"&&(s.__u|=4)):d!=u&&(d==u-1?g--:d==u+1?g++:(d>u?g--:g++,s.__u|=4))):e.__k[l]=null;if(f)for(l=0;l<h;l++)(c=r[l])!=null&&(2&c.__u)==0&&(c.__e==a&&(a=Tr(c)),Af(c,c));return a}function Cf(e,t,r,a){var o,l;if(typeof e.type=="function"){for(o=e.__k,l=0;o&&l<o.length;l++)o[l]&&(o[l].__=e,t=Cf(o[l],t,r,a));return t}e.__e!=t&&(a&&(t&&e.type&&!t.parentNode&&(t=Tr(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Wn(e,t){return t=t||[],e==null||typeof e=="boolean"||(uo(e)?e.some(function(r){Wn(r,t)}):t.push(e)),t}function xv(e,t,r,a){var o,l,s,c=e.key,u=e.type,d=t[r],h=d!=null&&(2&d.__u)==0;if(d===null&&c==null||h&&c==d.key&&u==d.type)return r;if(a>(h?1:0)){for(o=r-1,l=r+1;o>=0||l<t.length;)if((d=t[s=o>=0?o--:l++])!=null&&(2&d.__u)==0&&c==d.key&&u==d.type)return s}return-1}function nd(e,t,r){t[0]=="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||mv.test(t)?r:r+"px"}function Oo(e,t,r,a,o){var l,s;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof a=="string"&&(e.style.cssText=a=""),a)for(t in a)r&&t in r||nd(e.style,t,"");if(r)for(t in r)a&&r[t]==a[t]||nd(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")l=t!=(t=t.replace(yf,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+l]=r,r?a?r.u=a.u:(r.u=Ec,e.addEventListener(t,l?Ei:Ci,l)):e.removeEventListener(t,l?Ei:Ci,l);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function rd(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.t==null)t.t=Ec++;else if(t.t<r.u)return;return r(W.event?W.event(t):t)}}}function Ac(e,t,r,a,o,l,s,c,u,d){var h,f,g,m,y,C,T,_,p,b,k,E,w,A,D,S,F,N=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(u=!!(32&r.__u),l=[c=t.__e=r.__e]),(h=W.__b)&&h(t);e:if(typeof N=="function")try{if(_=t.props,p="prototype"in N&&N.prototype.render,b=(h=N.contextType)&&a[h.__c],k=h?b?b.props.value:h.__:a,r.__c?T=(f=t.__c=r.__c).__=f.__E:(p?t.__c=f=new N(_,k):(t.__c=f=new Xe(_,k),f.constructor=N,f.render=wv),b&&b.sub(f),f.state||(f.state={}),f.__n=a,g=f.__d=!0,f.__h=[],f._sb=[]),p&&f.__s==null&&(f.__s=f.state),p&&N.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Ot({},f.__s)),Ot(f.__s,N.getDerivedStateFromProps(_,f.__s))),m=f.props,y=f.state,f.__v=t,g)p&&N.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),p&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(p&&N.getDerivedStateFromProps==null&&_!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(_,k),t.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(_,f.__s,k)===!1){for(t.__v!=r.__v&&(f.props=_,f.state=f.__s,f.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(re){re&&(re.__=t)}),E=0;E<f._sb.length;E++)f.__h.push(f._sb[E]);f._sb=[],f.__h.length&&s.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(_,f.__s,k),p&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,y,C)})}if(f.context=k,f.props=_,f.__P=e,f.__e=!1,w=W.__r,A=0,p){for(f.state=f.__s,f.__d=!1,w&&w(t),h=f.render(f.props,f.state,f.context),D=0;D<f._sb.length;D++)f.__h.push(f._sb[D]);f._sb=[]}else do f.__d=!1,w&&w(t),h=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++A<25);f.state=f.__s,f.getChildContext!=null&&(a=Ot(Ot({},a),f.getChildContext())),p&&!g&&f.getSnapshotBeforeUpdate!=null&&(C=f.getSnapshotBeforeUpdate(m,y)),S=h,h!=null&&h.type===Y&&h.key==null&&(S=Tf(h.props.children)),c=Sf(e,uo(S)?S:[S],t,r,a,o,l,s,c,u,d),f.base=t.__e,t.__u&=-161,f.__h.length&&s.push(f),T&&(f.__E=f.__=null)}catch(re){if(t.__v=null,u||l!=null)if(re.then){for(t.__u|=u?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;l[l.indexOf(c)]=null,t.__e=c}else{for(F=l.length;F--;)Tc(l[F]);Ai(t)}else t.__e=r.__e,t.__k=r.__k,re.then||Ai(t);W.__e(re,t,r)}else l==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):c=t.__e=yv(r.__e,t,r,a,o,l,s,u,d);return(h=W.diffed)&&h(t),128&t.__u?void 0:c}function Ai(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(Ai)}function Ef(e,t,r){for(var a=0;a<r.length;a++)Mc(r[a],r[++a],r[++a]);W.__c&&W.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(l){l.call(o)})}catch(l){W.__e(l,o.__v)}})}function Tf(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:uo(e)?e.map(Tf):Ot({},e)}function yv(e,t,r,a,o,l,s,c,u){var d,h,f,g,m,y,C,T=r.props||Ba,_=t.props,p=t.type;if(p=="svg"?o="http://www.w3.org/2000/svg":p=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),l!=null){for(d=0;d<l.length;d++)if((m=l[d])&&"setAttribute"in m==!!p&&(p?m.localName==p:m.nodeType==3)){e=m,l[d]=null;break}}if(e==null){if(p==null)return document.createTextNode(_);e=document.createElementNS(o,p,_.is&&_),c&&(W.__m&&W.__m(t,l),c=!1),l=null}if(p==null)T===_||c&&e.data==_||(e.data=_);else{if(l=l&&co.call(e.childNodes),!c&&l!=null)for(T={},d=0;d<e.attributes.length;d++)T[(m=e.attributes[d]).name]=m.value;for(d in T)if(m=T[d],d!="children"){if(d=="dangerouslySetInnerHTML")f=m;else if(!(d in _)){if(d=="value"&&"defaultValue"in _||d=="checked"&&"defaultChecked"in _)continue;Oo(e,d,null,m,o)}}for(d in _)m=_[d],d=="children"?g=m:d=="dangerouslySetInnerHTML"?h=m:d=="value"?y=m:d=="checked"?C=m:c&&typeof m!="function"||T[d]===m||Oo(e,d,m,T[d],o);if(h)c||f&&(h.__html==f.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(f&&(e.innerHTML=""),Sf(t.type=="template"?e.content:e,uo(g)?g:[g],t,r,a,p=="foreignObject"?"http://www.w3.org/1999/xhtml":o,l,s,l?l[0]:r.__k&&Tr(r,0),c,u),l!=null)for(d=l.length;d--;)Tc(l[d]);c||(d="value",p=="progress"&&y==null?e.removeAttribute("value"):y!=null&&(y!==e[d]||p=="progress"&&!y||p=="option"&&y!=T[d])&&Oo(e,d,y,T[d],o),d="checked",C!=null&&C!=e[d]&&Oo(e,d,C,T[d],o))}return e}function Mc(e,t,r){try{if(typeof e=="function"){var a=typeof e.__u=="function";a&&e.__u(),a&&t==null||(e.__u=e(t))}else e.current=t}catch(o){W.__e(o,r)}}function Af(e,t,r){var a,o;if(W.unmount&&W.unmount(e),(a=e.ref)&&(a.current&&a.current!=e.__e||Mc(a,null,t)),(a=e.__c)!=null){if(a.componentWillUnmount)try{a.componentWillUnmount()}catch(l){W.__e(l,t)}a.base=a.__P=null}if(a=e.__k)for(o=0;o<a.length;o++)a[o]&&Af(a[o],t,r||typeof e.type!="function");r||Tc(e.__e),e.__c=e.__=e.__e=void 0}function wv(e,t,r){return this.constructor(e,r)}function Mi(e,t,r){var a,o,l,s;t==document&&(t=document.documentElement),W.__&&W.__(e,t),o=(a=!1)?null:t.__k,l=[],s=[],Ac(t,e=t.__k=nn(Y,null,[e]),o||Ba,Ba,t.namespaceURI,o?null:t.firstChild?co.call(t.childNodes):null,l,o?o.__e:t.firstChild,a,s),Ef(l,e,s)}function kv(e,t,r){var a,o,l,s,c=Ot({},e.props);for(l in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)l=="key"?a=t[l]:l=="ref"?o=t[l]:c[l]=t[l]===void 0&&s!=null?s[l]:t[l];return arguments.length>2&&(c.children=arguments.length>3?co.call(arguments,2):r),wa(e.type,c,a||e.key,o||e.ref,null)}function Mf(e){function t(r){var a,o;return this.getChildContext||(a=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){a=null},this.shouldComponentUpdate=function(l){this.props.value!=l.value&&a.forEach(function(s){s.__e=!0,Ti(s)})},this.sub=function(l){a.add(l);var s=l.componentWillUnmount;l.componentWillUnmount=function(){a&&a.delete(l),s&&s.call(l)}}),r.children}return t.__c="__cC"+wf++,t.__=e,t.Provider=t.__l=(t.Consumer=function(r,a){return r.children(a)}).contextType=t,t}co=kf.slice,W={__e:function(e,t,r,a){for(var o,l,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((l=o.constructor)&&l.getDerivedStateFromError!=null&&(o.setState(l.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,a||{}),s=o.__d),s)return o.__E=o}catch(c){e=c}throw e}},vf=0,mf=function(e){return e!=null&&e.constructor===void 0},Xe.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ot({},this.state),typeof e=="function"&&(e=e(Ot({},r),this.props)),e&&Ot(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ti(this))},Xe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ti(this))},Xe.prototype.render=Y,Dn=[],bf=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,xf=function(e,t){return e.__v.__b-t.__v.__b},Ml.__r=0,yf=/(PointerCapture)$|Capture$/i,Ec=0,Ci=rd(!1),Ei=rd(!0),wf=0;var _v=0;function n(e,t,r,a,o,l){t||(t={});var s,c,u=t;if("ref"in u)for(c in u={},t)c=="ref"?s=t[c]:u[c]=t[c];var d={type:e,props:u,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--_v,__i:-1,__u:0,__source:o,__self:l};if(typeof e=="function"&&(s=e.defaultProps))for(c in s)u[c]===void 0&&(u[c]=s[c]);return W.vnode&&W.vnode(d),d}var qn,ie,js,ad,Wa=0,If=[],be=W,od=be.__b,ld=be.__r,sd=be.diffed,id=be.__c,cd=be.unmount,ud=be.__;function ho(e,t){be.__h&&be.__h(ie,e,Wa||t),Wa=0;var r=ie.__H||(ie.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function j(e){return Wa=1,Sv(Rf,e)}function Sv(e,t,r){var a=ho(qn++,2);if(a.t=e,!a.__c&&(a.__=[r?r(t):Rf(void 0,t),function(c){var u=a.__N?a.__N[0]:a.__[0],d=a.t(u,c);u!==d&&(a.__N=[d,a.__[1]],a.__c.setState({}))}],a.__c=ie,!ie.__f)){var o=function(c,u,d){if(!a.__c.__H)return!0;var h=a.__c.__H.__.filter(function(g){return!!g.__c});if(h.every(function(g){return!g.__N}))return!l||l.call(this,c,u,d);var f=a.__c.props!==c;return h.forEach(function(g){if(g.__N){var m=g.__[0];g.__=g.__N,g.__N=void 0,m!==g.__[0]&&(f=!0)}}),l&&l.call(this,c,u,d)||f};ie.__f=!0;var l=ie.shouldComponentUpdate,s=ie.componentWillUpdate;ie.componentWillUpdate=function(c,u,d){if(this.__e){var h=l;l=void 0,o(c,u,d),l=h}s&&s.call(this,c,u,d)},ie.shouldComponentUpdate=o}return a.__N||a.__}function z(e,t){var r=ho(qn++,3);!be.__s&&Ic(r.__H,t)&&(r.__=e,r.u=t,ie.__H.__h.push(r))}function Cv(e,t){var r=ho(qn++,4);!be.__s&&Ic(r.__H,t)&&(r.__=e,r.u=t,ie.__h.push(r))}function q(e){return Wa=5,Qn(function(){return{current:e}},[])}function Qn(e,t){var r=ho(qn++,7);return Ic(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function K(e,t){return Wa=8,Qn(function(){return e},t)}function Ev(e){var t=ie.context[e.__c],r=ho(qn++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(ie)),t.props.value):e.__}function Tv(){for(var e;e=If.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ul),e.__H.__h.forEach(Ii),e.__H.__h=[]}catch(t){e.__H.__h=[],be.__e(t,e.__v)}}be.__b=function(e){ie=null,od&&od(e)},be.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ud&&ud(e,t)},be.__r=function(e){ld&&ld(e),qn=0;var t=(ie=e.__c).__H;t&&(js===ie?(t.__h=[],ie.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(ul),t.__h.forEach(Ii),t.__h=[],qn=0)),js=ie},be.diffed=function(e){sd&&sd(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(If.push(t)!==1&&ad===be.requestAnimationFrame||((ad=be.requestAnimationFrame)||Av)(Tv)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),js=ie=null},be.__c=function(e,t){t.some(function(r){try{r.__h.forEach(ul),r.__h=r.__h.filter(function(a){return!a.__||Ii(a)})}catch(a){t.some(function(o){o.__h&&(o.__h=[])}),t=[],be.__e(a,r.__v)}}),id&&id(e,t)},be.unmount=function(e){cd&&cd(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(a){try{ul(a)}catch(o){t=o}}),r.__H=void 0,t&&be.__e(t,r.__v))};var dd=typeof requestAnimationFrame=="function";function Av(e){var t,r=function(){clearTimeout(a),dd&&cancelAnimationFrame(t),setTimeout(e)},a=setTimeout(r,35);dd&&(t=requestAnimationFrame(r))}function ul(e){var t=ie,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),ie=t}function Ii(e){var t=ie;e.__c=e.__(),ie=t}function Ic(e,t){return!e||e.length!==t.length||t.some(function(r,a){return r!==e[a]})}function Rf(e,t){return typeof t=="function"?t(e):t}var Mv=Symbol.for("preact-signals");function ls(){if(bn>1)bn--;else{for(var e,t=!1;ka!==void 0;){var r=ka;for(ka=void 0,Ri++;r!==void 0;){var a=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Nf(r))try{r.c()}catch(o){t||(e=o,t=!0)}r=a}}if(Ri=0,bn--,t)throw e}}function $f(e){if(bn>0)return e();bn++;try{return e()}finally{ls()}}var ee=void 0;function Df(e){var t=ee;ee=void 0;try{return e()}finally{ee=t}}var ka=void 0,bn=0,Ri=0,Il=0;function Lf(e){if(ee!==void 0){var t=e.n;if(t===void 0||t.t!==ee)return t={i:0,S:e,p:ee.s,n:void 0,t:ee,e:void 0,x:void 0,r:t},ee.s!==void 0&&(ee.s.n=t),ee.s=t,e.n=t,32&ee.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=ee.s,t.n=void 0,ee.s.n=t,ee.s=t),t}}function Re(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Re.prototype.brand=Mv;Re.prototype.h=function(){return!0};Re.prototype.S=function(e){var t=this,r=this.t;r!==e&&e.e===void 0&&(e.x=r,this.t=e,r!==void 0?r.e=e:Df(function(){var a;(a=t.W)==null||a.call(t)}))};Re.prototype.U=function(e){var t=this;if(this.t!==void 0){var r=e.e,a=e.x;r!==void 0&&(r.x=a,e.e=void 0),a!==void 0&&(a.e=r,e.x=void 0),e===this.t&&(this.t=a,a===void 0&&Df(function(){var o;(o=t.Z)==null||o.call(t)}))}};Re.prototype.subscribe=function(e){var t=this;return Ie(function(){var r=t.value,a=ee;ee=void 0;try{e(r)}finally{ee=a}},{name:"sub"})};Re.prototype.valueOf=function(){return this.value};Re.prototype.toString=function(){return this.value+""};Re.prototype.toJSON=function(){return this.value};Re.prototype.peek=function(){var e=ee;ee=void 0;try{return this.value}finally{ee=e}};Object.defineProperty(Re.prototype,"value",{get:function(){var e=Lf(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Ri>100)throw new Error("Cycle detected");this.v=e,this.i++,Il++,bn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{ls()}}}});function v(e,t){return new Re(e,t)}function Nf(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Of(e){for(var t=e.s;t!==void 0;t=t.n){var r=t.S.n;if(r!==void 0&&(t.r=r),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Ff(e){for(var t=e.s,r=void 0;t!==void 0;){var a=t.p;t.i===-1?(t.S.U(t),a!==void 0&&(a.n=t.n),t.n!==void 0&&(t.n.p=a)):r=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=a}e.s=r}function er(e,t){Re.call(this,void 0),this.x=e,this.s=void 0,this.g=Il-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}er.prototype=new Re;er.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Il))return!0;if(this.g=Il,this.f|=1,this.i>0&&!Nf(this))return this.f&=-2,!0;var e=ee;try{Of(this),ee=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return ee=e,Ff(this),this.f&=-2,!0};er.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Re.prototype.S.call(this,e)};er.prototype.U=function(e){if(this.t!==void 0&&(Re.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};er.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(er.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Lf(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function B(e,t){return new er(e,t)}function Pf(e){var t=e.u;if(e.u=void 0,typeof t=="function"){bn++;var r=ee;ee=void 0;try{t()}catch(a){throw e.f&=-2,e.f|=8,Rc(e),a}finally{ee=r,ls()}}}function Rc(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Pf(e)}function Iv(e){if(ee!==this)throw new Error("Out-of-order effect");Ff(this),ee=e,this.f&=-2,8&this.f&&Rc(this),ls()}function Kr(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t?.name}Kr.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}};Kr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Pf(this),Of(this),bn++;var e=ee;return ee=this,Iv.bind(this,e)};Kr.prototype.N=function(){2&this.f||(this.f|=2,this.o=ka,ka=this)};Kr.prototype.d=function(){this.f|=8,1&this.f||Rc(this)};Kr.prototype.dispose=function(){this.d()};function Ie(e,t){var r=new Kr(e,t);try{r.c()}catch(o){throw r.d(),o}var a=r.d.bind(r);return a[Symbol.dispose]=a,a}var $c,ss,Bs,Rv=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,zf=[],Uf=[];Ie(function(){$c=this.N})();function Vr(e,t){W[e]=t.bind(null,W[e]||function(){})}function Rl(e){Bs&&Bs(),Bs=e&&e.S()}function Hf(e){var t=this,r=e.data,a=J(r);a.value=r;var o=Qn(function(){for(var c=t,u=t.__v;u=u.__;)if(u.__c){u.__c.__$f|=4;break}var d=B(function(){var m=a.value.value;return m===0?0:m===!0?"":m||""}),h=B(function(){return!Array.isArray(d.value)&&!mf(d.value)}),f=Ie(function(){if(this.N=jf,h.value){var m=d.value;c.__v&&c.__v.__e&&c.__v.__e.nodeType===3&&(c.__v.__e.data=m)}}),g=t.__$u.d;return t.__$u.d=function(){f(),g.call(this)},[h,d]},[]),l=o[0],s=o[1];return l.value?s.peek():s.value}Hf.displayName="ReactiveTextNode";Object.defineProperties(Re.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Hf},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Vr("__b",function(e,t){if(typeof t.type=="string"){var r,a=t.props;for(var o in a)if(o!=="children"){var l=a[o];l instanceof Re&&(r||(t.__np=r={}),r[o]=l,a[o]=l.peek())}}e(t)});Vr("__r",function(e,t){if(t.type!==Y){Rl();var r,a=t.__c;a&&(a.__$f&=-2,(r=a.__$u)===void 0&&(a.__$u=r=(function(o,l){var s;return Ie(function(){s=this},{name:l}),s.c=o,s})(function(){var o;Rv&&((o=r.y)==null||o.call(r)),a.__$f|=1,a.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),ss=a,Rl(r)}e(t)});Vr("__e",function(e,t,r,a){Rl(),ss=void 0,e(t,r,a)});Vr("diffed",function(e,t){Rl(),ss=void 0;var r;if(typeof t.type=="string"&&(r=t.__e)){var a=t.__np,o=t.props;if(a){var l=r.U;if(l)for(var s in l){var c=l[s];c!==void 0&&!(s in a)&&(c.d(),l[s]=void 0)}else l={},r.U=l;for(var u in a){var d=l[u],h=a[u];d===void 0?(d=$v(r,u,h,o),l[u]=d):d.o(h,o)}}}e(t)});function $v(e,t,r,a){var o=t in e&&e.ownerSVGElement===void 0,l=v(r);return{o:function(s,c){l.value=s,a=c},d:Ie(function(){this.N=jf;var s=l.value.value;a[t]!==s&&(a[t]=s,o?e[t]=s:s!=null&&(s!==!1||t[4]==="-")?e.setAttribute(t,s):e.removeAttribute(t))})}}Vr("unmount",function(e,t){if(typeof t.type=="string"){var r=t.__e;if(r){var a=r.U;if(a){r.U=void 0;for(var o in a){var l=a[o];l&&l.d()}}}}else{var s=t.__c;if(s){var c=s.__$u;c&&(s.__$u=void 0,c.d())}}e(t)});Vr("__h",function(e,t,r,a){(a<3||a===9)&&(t.__$f|=2),e(t,r,a)});Xe.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var r=this.__$u,a=r&&r.s!==void 0;for(var o in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var l=2&this.__$f;if(!(a||l||4&this.__$f)||1&this.__$f)return!0}else if(!(a||4&this.__$f)||3&this.__$f)return!0;for(var s in e)if(s!=="__source"&&e[s]!==this.props[s])return!0;for(var c in this.props)if(!(c in e))return!0;return!1};function J(e,t){return j(function(){return v(e,t)})[0]}function is(e,t){var r=q(e);return r.current=e,ss.__$f|=4,Qn(function(){return B(function(){return r.current()},t)},[])}var Dv=typeof requestAnimationFrame>"u"?setTimeout:function(e){var t=function(){clearTimeout(r),cancelAnimationFrame(a),e()},r=setTimeout(t,35),a=requestAnimationFrame(t)},Lv=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Nv(){$f(function(){for(var e;e=zf.shift();)$c.call(e)})}function Ov(){zf.push(this)===1&&(W.requestAnimationFrame||Dv)(Nv)}function Fv(){$f(function(){for(var e;e=Uf.shift();)$c.call(e)})}function jf(){Uf.push(this)===1&&(W.requestAnimationFrame||Lv)(Fv)}function $i(e,t){var r=q(e);r.current=e,z(function(){return Ie(function(){return this.N=Ov,r.current()},t)},[])}var Pv={};function Fo(e,t){for(var r in t)e[r]=t[r];return e}function zv(e,t,r){var a,o=/(?:\?([^#]*))?(#.*)?$/,l=e.match(o),s={};if(l&&l[1])for(var c=l[1].split("&"),u=0;u<c.length;u++){var d=c[u].split("=");s[decodeURIComponent(d[0])]=decodeURIComponent(d.slice(1).join("="))}e=Di(e.replace(o,"")),t=Di(t||"");for(var h=Math.max(e.length,t.length),f=0;f<h;f++)if(t[f]&&t[f].charAt(0)===":"){var g=t[f].replace(/(^:|[+*?]+$)/g,""),m=(t[f].match(/[+*?]+$/)||Pv)[0]||"",y=~m.indexOf("+"),C=~m.indexOf("*"),T=e[f]||"";if(!T&&!C&&(m.indexOf("?")<0||y)){a=!1;break}if(s[g]=decodeURIComponent(T),y||C){s[g]=e.slice(f).map(decodeURIComponent).join("/");break}}else if(t[f]!==e[f]){a=!1;break}return(r.default===!0||a!==!1)&&s}function Uv(e,t){return e.rank<t.rank?1:e.rank>t.rank?-1:e.index-t.index}function Hv(e,t){return e.index=t,e.rank=(function(r){return r.props.default?0:Di(r.props.path).map(jv).join("")})(e),e.props}function Di(e){return e.replace(/(^\/+|\/+$)/g,"").split("/")}function jv(e){return e.charAt(0)==":"?1+"*+?".indexOf(e.charAt(e.length-1))||4:5}var Bv={},zn=[],hd=[],Ye=null,Bf={url:cs()},Wv=Mf(Bf);function cs(){var e;return""+((e=Ye&&Ye.location?Ye.location:Ye&&Ye.getCurrentLocation?Ye.getCurrentLocation():typeof location<"u"?location:Bv).pathname||"")+(e.search||"")}function it(e,t){return t===void 0&&(t=!1),typeof e!="string"&&e.url&&(t=e.replace,e=e.url),(function(r){for(var a=zn.length;a--;)if(zn[a].canRoute(r))return!0;return!1})(e)&&(function(r,a){a===void 0&&(a="push"),Ye&&Ye[a]?Ye[a](r):typeof history<"u"&&history[a+"State"]&&history[a+"State"](null,null,r)})(e,t?"replace":"push"),Wf(e)}function Wf(e){for(var t=!1,r=0;r<zn.length;r++)zn[r].routeTo(e)&&(t=!0);return t}function qv(e){if(e&&e.getAttribute){var t=e.getAttribute("href"),r=e.getAttribute("target");if(t&&t.match(/^\//g)&&(!r||r.match(/^_?self$/i)))return it(t)}}function Gv(e){return e.stopImmediatePropagation&&e.stopImmediatePropagation(),e.stopPropagation&&e.stopPropagation(),e.preventDefault(),!1}function Kv(e){if(!(e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||e.button)){var t=e.target;do if(t.localName==="a"&&t.getAttribute("href")){if(t.hasAttribute("data-native")||t.hasAttribute("native"))return;if(qv(t))return Gv(e)}while(t=t.parentNode)}}var fd=!1;function qf(e){e.history&&(Ye=e.history),this.state={url:e.url||cs()}}Fo(qf.prototype=new Xe,{shouldComponentUpdate:function(e){return e.static!==!0||e.url!==this.props.url||e.onChange!==this.props.onChange},canRoute:function(e){var t=Wn(this.props.children);return this.g(t,e)!==void 0},routeTo:function(e){this.setState({url:e});var t=this.canRoute(e);return this.p||this.forceUpdate(),t},componentWillMount:function(){this.p=!0},componentDidMount:function(){var e=this;fd||(fd=!0,Ye||addEventListener("popstate",function(){Wf(cs())}),addEventListener("click",Kv)),zn.push(this),Ye&&(this.u=Ye.listen(function(t){var r=t.location||t;e.routeTo(""+(r.pathname||"")+(r.search||""))})),this.p=!1},componentWillUnmount:function(){typeof this.u=="function"&&this.u(),zn.splice(zn.indexOf(this),1)},componentWillUpdate:function(){this.p=!0},componentDidUpdate:function(){this.p=!1},g:function(e,t){e=e.filter(Hv).sort(Uv);for(var r=0;r<e.length;r++){var a=e[r],o=zv(t,a.props.path,a.props);if(o)return[a,o]}},render:function(e,t){var r,a,o=e.onChange,l=t.url,s=this.c,c=this.g(Wn(e.children),l);if(c&&(a=kv(c[0],Fo(Fo({url:l,matches:r=c[1]},r),{key:void 0,ref:void 0}))),l!==(s&&s.url)){Fo(Bf,s=this.c={url:l,previous:s&&s.url,current:a,path:a?a.props.path:null,matches:r}),s.router=this,s.active=a?[a]:[];for(var u=hd.length;u--;)hd[u]({});typeof o=="function"&&o(s)}return nn(Wv.Provider,{value:s},a)}});const pd={selected:"system",lightTheme:"light",darkTheme:"dark"},Vv={id:"light",name:"Light",appearance:"light",builtIn:!0,colors:{"--color-bg-primary":"#ffffff","--color-bg-secondary":"#f1f5f9","--color-bg-tertiary":"#e2e8f0","--color-bg-surface":"#f8fafc","--color-bg-elevated":"#ffffff","--color-bg-hover":"#f1f5f9","--color-bg-active":"#e2e8f0","--color-text-primary":"#0f172a","--color-text-secondary":"#475569","--color-text-tertiary":"#64748b","--color-text-muted":"#94a3b8","--color-text-inverse":"#f8fafc","--color-accent":"#e11d48","--color-accent-hover":"#be123c","--color-accent-active":"#9f1239","--color-accent-muted":"#ffe4e6","--color-accent-text":"#ffffff","--color-success":"#16a34a","--color-success-muted":"#dcfce7","--color-warning":"#d97706","--color-warning-muted":"#fef3c7","--color-error":"#dc2626","--color-error-muted":"#fee2e2","--color-info":"#0284c7","--color-info-muted":"#e0f2fe","--color-border":"#e2e8f0","--color-border-hover":"#cbd5e1","--color-border-focus":"#e11d48","--shadow-sm":"0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.12), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--color-syntax-comment":"#a0a1a7","--color-syntax-string":"#50a14f","--color-syntax-keyword":"#a626a4","--color-syntax-function":"#4078f2","--color-syntax-number":"#986801","--color-syntax-operator":"#0184bc","--color-syntax-variable":"#e45649","--color-syntax-punctuation":"#383a42","--color-syntax-property":"#e45649","--color-syntax-tag":"#e45649","--color-syntax-class":"#c18401"}},Yv={id:"dark",name:"Dark",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#0f0f12","--color-bg-secondary":"#0a0a0c","--color-bg-tertiary":"#161619","--color-bg-surface":"#1a1a1f","--color-bg-elevated":"#222228","--color-bg-hover":"#2a2a32","--color-bg-active":"#363640","--color-text-primary":"#f4f4f5","--color-text-secondary":"#a1a1aa","--color-text-tertiary":"#71717a","--color-text-muted":"#52525b","--color-text-inverse":"#09090b","--color-accent":"#f97066","--color-accent-hover":"#ef5a50","--color-accent-active":"#dc4840","--color-accent-muted":"#5c2320","--color-accent-text":"#ffffff","--color-success":"#22c55e","--color-success-muted":"#14532d","--color-warning":"#f59e0b","--color-warning-muted":"#451a03","--color-error":"#f43f5e","--color-error-muted":"#4c0519","--color-info":"#38bdf8","--color-info-muted":"#0c4a6e","--color-border":"#252530","--color-border-hover":"#3f3f4a","--color-border-focus":"#f97066","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#5c6370","--color-syntax-string":"#98c379","--color-syntax-keyword":"#c678dd","--color-syntax-function":"#61afef","--color-syntax-number":"#d19a66","--color-syntax-operator":"#56b6c2","--color-syntax-variable":"#e06c75","--color-syntax-punctuation":"#abb2bf","--color-syntax-property":"#e06c75","--color-syntax-tag":"#e06c75","--color-syntax-class":"#e5c07b"}},Jv={id:"dracula",name:"Dracula",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#282a36","--color-bg-secondary":"#1e1f29","--color-bg-tertiary":"#191a23","--color-bg-surface":"#343746","--color-bg-elevated":"#44475a","--color-bg-hover":"#3c3f52","--color-bg-active":"#44475a","--color-text-primary":"#f8f8f2","--color-text-secondary":"#e6e6e0","--color-text-tertiary":"#bfbfb8","--color-text-muted":"#6272a4","--color-text-inverse":"#282a36","--color-accent":"#bd93f9","--color-accent-hover":"#caa9fa","--color-accent-active":"#a67bf5","--color-accent-muted":"#3d3560","--color-accent-text":"#282a36","--color-success":"#50fa7b","--color-success-muted":"#1f3528","--color-warning":"#f1fa8c","--color-warning-muted":"#35351f","--color-error":"#ff5555","--color-error-muted":"#402020","--color-info":"#8be9fd","--color-info-muted":"#1f3538","--color-border":"#44475a","--color-border-hover":"#565970","--color-border-focus":"#bd93f9","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#6272a4","--color-syntax-string":"#f1fa8c","--color-syntax-keyword":"#ff79c6","--color-syntax-function":"#50fa7b","--color-syntax-number":"#bd93f9","--color-syntax-operator":"#ff79c6","--color-syntax-variable":"#f8f8f2","--color-syntax-punctuation":"#f8f8f2","--color-syntax-property":"#66d9ef","--color-syntax-tag":"#ff79c6","--color-syntax-class":"#8be9fd"}},Xv={id:"catppuccin-mocha",name:"Catppuccin Mocha",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#1e1e2e","--color-bg-secondary":"#11111b","--color-bg-tertiary":"#181825","--color-bg-surface":"#313244","--color-bg-elevated":"#45475a","--color-bg-hover":"#313244","--color-bg-active":"#45475a","--color-text-primary":"#cdd6f4","--color-text-secondary":"#bac2de","--color-text-tertiary":"#a6adc8","--color-text-muted":"#6c7086","--color-text-inverse":"#1e1e2e","--color-accent":"#f5c2e7","--color-accent-hover":"#f5e0dc","--color-accent-active":"#cba6f7","--color-accent-muted":"#3d2d40","--color-accent-text":"#1e1e2e","--color-success":"#a6e3a1","--color-success-muted":"#243028","--color-warning":"#f9e2af","--color-warning-muted":"#382f20","--color-error":"#f38ba8","--color-error-muted":"#3d2430","--color-info":"#89dceb","--color-info-muted":"#203035","--color-border":"#45475a","--color-border-hover":"#585b70","--color-border-focus":"#f5c2e7","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.35)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.45), 0 2px 4px -2px rgb(0 0 0 / 0.45)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.55), 0 4px 6px -4px rgb(0 0 0 / 0.55)","--color-syntax-comment":"#6c7086","--color-syntax-string":"#a6e3a1","--color-syntax-keyword":"#cba6f7","--color-syntax-function":"#89b4fa","--color-syntax-number":"#fab387","--color-syntax-operator":"#89dceb","--color-syntax-variable":"#f38ba8","--color-syntax-punctuation":"#cdd6f4","--color-syntax-property":"#f5c2e7","--color-syntax-tag":"#cba6f7","--color-syntax-class":"#f9e2af"}},Zv={id:"catppuccin-latte",name:"Catppuccin Latte",appearance:"light",builtIn:!0,colors:{"--color-bg-primary":"#eff1f5","--color-bg-secondary":"#dce0e8","--color-bg-tertiary":"#e6e9ef","--color-bg-surface":"#ffffff","--color-bg-elevated":"#ffffff","--color-bg-hover":"#e6e9ef","--color-bg-active":"#ccd0da","--color-text-primary":"#4c4f69","--color-text-secondary":"#5c5f77","--color-text-tertiary":"#6c6f85","--color-text-muted":"#9ca0b0","--color-text-inverse":"#eff1f5","--color-accent":"#ea76cb","--color-accent-hover":"#d65db1","--color-accent-active":"#8839ef","--color-accent-muted":"#f5e0f0","--color-accent-text":"#ffffff","--color-success":"#40a02b","--color-success-muted":"#d8f0d0","--color-warning":"#df8e1d","--color-warning-muted":"#f9ecd0","--color-error":"#d20f39","--color-error-muted":"#f9d5dd","--color-info":"#04a5e5","--color-info-muted":"#d0f0f9","--color-border":"#ccd0da","--color-border-hover":"#bcc0cc","--color-border-focus":"#ea76cb","--shadow-sm":"0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.06)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.08)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.08)","--color-syntax-comment":"#9ca0b0","--color-syntax-string":"#40a02b","--color-syntax-keyword":"#8839ef","--color-syntax-function":"#1e66f5","--color-syntax-number":"#fe640b","--color-syntax-operator":"#04a5e5","--color-syntax-variable":"#d20f39","--color-syntax-punctuation":"#4c4f69","--color-syntax-property":"#ea76cb","--color-syntax-tag":"#8839ef","--color-syntax-class":"#df8e1d"}},Qv={id:"nord",name:"Nord",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#2e3440","--color-bg-secondary":"#242933","--color-bg-tertiary":"#1f232b","--color-bg-surface":"#3b4252","--color-bg-elevated":"#434c5e","--color-bg-hover":"#3b4252","--color-bg-active":"#4c566a","--color-text-primary":"#eceff4","--color-text-secondary":"#e5e9f0","--color-text-tertiary":"#d8dee9","--color-text-muted":"#616e88","--color-text-inverse":"#2e3440","--color-accent":"#8fbcbb","--color-accent-hover":"#88c0d0","--color-accent-active":"#81a1c1","--color-accent-muted":"#304048","--color-accent-text":"#2e3440","--color-success":"#a3be8c","--color-success-muted":"#2e3d2e","--color-warning":"#ebcb8b","--color-warning-muted":"#3d3828","--color-error":"#bf616a","--color-error-muted":"#3d2830","--color-info":"#81a1c1","--color-info-muted":"#283040","--color-border":"#3b4252","--color-border-hover":"#4c566a","--color-border-focus":"#8fbcbb","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.3)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5)","--color-syntax-comment":"#616e88","--color-syntax-string":"#a3be8c","--color-syntax-keyword":"#81a1c1","--color-syntax-function":"#88c0d0","--color-syntax-number":"#b48ead","--color-syntax-operator":"#81a1c1","--color-syntax-variable":"#d8dee9","--color-syntax-punctuation":"#eceff4","--color-syntax-property":"#8fbcbb","--color-syntax-tag":"#81a1c1","--color-syntax-class":"#8fbcbb"}},em={id:"gruvbox-dark",name:"Gruvbox Dark",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#282828","--color-bg-secondary":"#1d2021","--color-bg-tertiary":"#32302f","--color-bg-surface":"#3c3836","--color-bg-elevated":"#504945","--color-bg-hover":"#504945","--color-bg-active":"#665c54","--color-text-primary":"#ebdbb2","--color-text-secondary":"#d5c4a1","--color-text-tertiary":"#bdae93","--color-text-muted":"#928374","--color-text-inverse":"#282828","--color-accent":"#fe8019","--color-accent-hover":"#d65d0e","--color-accent-active":"#af3a03","--color-accent-muted":"#4a3526","--color-accent-text":"#282828","--color-success":"#b8bb26","--color-success-muted":"#3d4220","--color-warning":"#fabd2f","--color-warning-muted":"#4a4020","--color-error":"#fb4934","--color-error-muted":"#4a2520","--color-info":"#83a598","--color-info-muted":"#2a3a38","--color-border":"#504945","--color-border-hover":"#665c54","--color-border-focus":"#fe8019","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#928374","--color-syntax-string":"#b8bb26","--color-syntax-keyword":"#fb4934","--color-syntax-function":"#b8bb26","--color-syntax-number":"#d3869b","--color-syntax-operator":"#fe8019","--color-syntax-variable":"#83a598","--color-syntax-punctuation":"#ebdbb2","--color-syntax-property":"#8ec07c","--color-syntax-tag":"#fb4934","--color-syntax-class":"#fabd2f"}},tm={id:"gruvbox-light",name:"Gruvbox Light",appearance:"light",builtIn:!0,colors:{"--color-bg-primary":"#fbf1c7","--color-bg-secondary":"#f2e5bc","--color-bg-tertiary":"#ebdbb2","--color-bg-surface":"#f9f5d7","--color-bg-elevated":"#ffffff","--color-bg-hover":"#ebdbb2","--color-bg-active":"#d5c4a1","--color-text-primary":"#3c3836","--color-text-secondary":"#504945","--color-text-tertiary":"#665c54","--color-text-muted":"#928374","--color-text-inverse":"#fbf1c7","--color-accent":"#d65d0e","--color-accent-hover":"#af3a03","--color-accent-active":"#8f3000","--color-accent-muted":"#f0d8c0","--color-accent-text":"#fbf1c7","--color-success":"#79740e","--color-success-muted":"#e8ecc8","--color-warning":"#b57614","--color-warning-muted":"#f5e6c8","--color-error":"#9d0006","--color-error-muted":"#f5d0c8","--color-info":"#076678","--color-info-muted":"#c8e8f0","--color-border":"#d5c4a1","--color-border-hover":"#bdae93","--color-border-focus":"#d65d0e","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--color-syntax-comment":"#928374","--color-syntax-string":"#79740e","--color-syntax-keyword":"#9d0006","--color-syntax-function":"#79740e","--color-syntax-number":"#8f3f71","--color-syntax-operator":"#af3a03","--color-syntax-variable":"#076678","--color-syntax-punctuation":"#3c3836","--color-syntax-property":"#427b58","--color-syntax-tag":"#9d0006","--color-syntax-class":"#b57614"}},nm={id:"solarized-dark",name:"Solarized Dark",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#002b36","--color-bg-secondary":"#00212b","--color-bg-tertiary":"#073642","--color-bg-surface":"#073642","--color-bg-elevated":"#094552","--color-bg-hover":"#094552","--color-bg-active":"#0a5565","--color-text-primary":"#839496","--color-text-secondary":"#93a1a1","--color-text-tertiary":"#657b83","--color-text-muted":"#586e75","--color-text-inverse":"#002b36","--color-accent":"#268bd2","--color-accent-hover":"#1a7cc4","--color-accent-active":"#1569a8","--color-accent-muted":"#0a3a52","--color-accent-text":"#fdf6e3","--color-success":"#859900","--color-success-muted":"#2a3a20","--color-warning":"#b58900","--color-warning-muted":"#3a3520","--color-error":"#dc322f","--color-error-muted":"#3a2020","--color-info":"#2aa198","--color-info-muted":"#1a3a38","--color-border":"#073642","--color-border-hover":"#094552","--color-border-focus":"#268bd2","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#586e75","--color-syntax-string":"#2aa198","--color-syntax-keyword":"#859900","--color-syntax-function":"#268bd2","--color-syntax-number":"#d33682","--color-syntax-operator":"#859900","--color-syntax-variable":"#b58900","--color-syntax-punctuation":"#839496","--color-syntax-property":"#268bd2","--color-syntax-tag":"#cb4b16","--color-syntax-class":"#cb4b16"}},rm={id:"solarized-light",name:"Solarized Light",appearance:"light",builtIn:!0,colors:{"--color-bg-primary":"#fdf6e3","--color-bg-secondary":"#eee8d5","--color-bg-tertiary":"#e8e2cf","--color-bg-surface":"#ffffff","--color-bg-elevated":"#ffffff","--color-bg-hover":"#eee8d5","--color-bg-active":"#e0dac8","--color-text-primary":"#657b83","--color-text-secondary":"#586e75","--color-text-tertiary":"#839496","--color-text-muted":"#93a1a1","--color-text-inverse":"#fdf6e3","--color-accent":"#268bd2","--color-accent-hover":"#1a7cc4","--color-accent-active":"#1569a8","--color-accent-muted":"#d0e8f5","--color-accent-text":"#fdf6e3","--color-success":"#859900","--color-success-muted":"#e8f0c8","--color-warning":"#b58900","--color-warning-muted":"#f5ecc8","--color-error":"#dc322f","--color-error-muted":"#f5d0d0","--color-info":"#2aa198","--color-info-muted":"#c8f0ec","--color-border":"#eee8d5","--color-border-hover":"#ddd8c5","--color-border-focus":"#268bd2","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--color-syntax-comment":"#93a1a1","--color-syntax-string":"#2aa198","--color-syntax-keyword":"#859900","--color-syntax-function":"#268bd2","--color-syntax-number":"#d33682","--color-syntax-operator":"#859900","--color-syntax-variable":"#b58900","--color-syntax-punctuation":"#657b83","--color-syntax-property":"#268bd2","--color-syntax-tag":"#cb4b16","--color-syntax-class":"#cb4b16"}},am={id:"one-dark",name:"One Dark",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#282c34","--color-bg-secondary":"#21252b","--color-bg-tertiary":"#2c313a","--color-bg-surface":"#3a3f4b","--color-bg-elevated":"#3e4451","--color-bg-hover":"#3a3f4b","--color-bg-active":"#4b5263","--color-text-primary":"#abb2bf","--color-text-secondary":"#9da5b4","--color-text-tertiary":"#7f848e","--color-text-muted":"#5c6370","--color-text-inverse":"#282c34","--color-accent":"#61afef","--color-accent-hover":"#528bcc","--color-accent-active":"#4678a8","--color-accent-muted":"#2a3a48","--color-accent-text":"#282c34","--color-success":"#98c379","--color-success-muted":"#2a3a28","--color-warning":"#e5c07b","--color-warning-muted":"#3a3828","--color-error":"#e06c75","--color-error-muted":"#3a2828","--color-info":"#56b6c2","--color-info-muted":"#203a3a","--color-border":"#3a3f4b","--color-border-hover":"#4b5263","--color-border-focus":"#61afef","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#5c6370","--color-syntax-string":"#98c379","--color-syntax-keyword":"#c678dd","--color-syntax-function":"#61afef","--color-syntax-number":"#d19a66","--color-syntax-operator":"#56b6c2","--color-syntax-variable":"#e06c75","--color-syntax-punctuation":"#abb2bf","--color-syntax-property":"#e06c75","--color-syntax-tag":"#e06c75","--color-syntax-class":"#e5c07b"}},om={id:"tokyo-night",name:"Tokyo Night",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#1a1b26","--color-bg-secondary":"#16161e","--color-bg-tertiary":"#1f2335","--color-bg-surface":"#24283b","--color-bg-elevated":"#292e42","--color-bg-hover":"#292e42","--color-bg-active":"#33384d","--color-text-primary":"#c0caf5","--color-text-secondary":"#a9b1d6","--color-text-tertiary":"#787c99","--color-text-muted":"#565f89","--color-text-inverse":"#1a1b26","--color-accent":"#bb9af7","--color-accent-hover":"#9d7cd8","--color-accent-active":"#7c5dc0","--color-accent-muted":"#3d3560","--color-accent-text":"#1a1b26","--color-success":"#9ece6a","--color-success-muted":"#2a3a25","--color-warning":"#e0af68","--color-warning-muted":"#3a3525","--color-error":"#f7768e","--color-error-muted":"#3a2530","--color-info":"#7dcfff","--color-info-muted":"#1a3545","--color-border":"#292e42","--color-border-hover":"#3b4261","--color-border-focus":"#bb9af7","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#565f89","--color-syntax-string":"#9ece6a","--color-syntax-keyword":"#bb9af7","--color-syntax-function":"#7aa2f7","--color-syntax-number":"#ff9e64","--color-syntax-operator":"#89ddff","--color-syntax-variable":"#c0caf5","--color-syntax-punctuation":"#c0caf5","--color-syntax-property":"#73daca","--color-syntax-tag":"#f7768e","--color-syntax-class":"#e0af68"}},lm={id:"tokyo-night-day",name:"Tokyo Night Day",appearance:"light",builtIn:!0,colors:{"--color-bg-primary":"#e1e2e7","--color-bg-secondary":"#d5d6db","--color-bg-tertiary":"#c8c9ce","--color-bg-surface":"#ffffff","--color-bg-elevated":"#ffffff","--color-bg-hover":"#d5d6db","--color-bg-active":"#c8c9ce","--color-text-primary":"#3760bf","--color-text-secondary":"#4c6bc0","--color-text-tertiary":"#6172b0","--color-text-muted":"#8990b3","--color-text-inverse":"#e1e2e7","--color-accent":"#9854f1","--color-accent-hover":"#7847c4","--color-accent-active":"#5d38a0","--color-accent-muted":"#e8dff8","--color-accent-text":"#ffffff","--color-success":"#587539","--color-success-muted":"#e0f0d0","--color-warning":"#8c6c3e","--color-warning-muted":"#f5ecd0","--color-error":"#f52a65","--color-error-muted":"#fdd8e0","--color-info":"#007197","--color-info-muted":"#d0f0f8","--color-border":"#c8c9ce","--color-border-hover":"#b8b9be","--color-border-focus":"#9854f1","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--color-syntax-comment":"#8990b3","--color-syntax-string":"#587539","--color-syntax-keyword":"#9854f1","--color-syntax-function":"#2e7de9","--color-syntax-number":"#b15c00","--color-syntax-operator":"#006a83","--color-syntax-variable":"#3760bf","--color-syntax-punctuation":"#3760bf","--color-syntax-property":"#118c74","--color-syntax-tag":"#f52a65","--color-syntax-class":"#8c6c3e"}},sm={id:"rose-pine",name:"Rosé Pine",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#191724","--color-bg-secondary":"#1f1d2e","--color-bg-tertiary":"#21202e","--color-bg-surface":"#26233a","--color-bg-elevated":"#2a283e","--color-bg-hover":"#2a283e","--color-bg-active":"#393552","--color-text-primary":"#e0def4","--color-text-secondary":"#c4a7e7","--color-text-tertiary":"#908caa","--color-text-muted":"#6e6a86","--color-text-inverse":"#191724","--color-accent":"#ebbcba","--color-accent-hover":"#d4a5a5","--color-accent-active":"#c09090","--color-accent-muted":"#3a3040","--color-accent-text":"#191724","--color-success":"#9ccfd8","--color-success-muted":"#253540","--color-warning":"#f6c177","--color-warning-muted":"#3a3528","--color-error":"#eb6f92","--color-error-muted":"#3a2535","--color-info":"#31748f","--color-info-muted":"#1a2a35","--color-border":"#26233a","--color-border-hover":"#393552","--color-border-focus":"#ebbcba","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#6e6a86","--color-syntax-string":"#f6c177","--color-syntax-keyword":"#31748f","--color-syntax-function":"#ebbcba","--color-syntax-number":"#eb6f92","--color-syntax-operator":"#9ccfd8","--color-syntax-variable":"#e0def4","--color-syntax-punctuation":"#908caa","--color-syntax-property":"#c4a7e7","--color-syntax-tag":"#eb6f92","--color-syntax-class":"#9ccfd8"}},im={id:"rose-pine-moon",name:"Rosé Pine Moon",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#232136","--color-bg-secondary":"#2a273f","--color-bg-tertiary":"#2d2a45","--color-bg-surface":"#393552","--color-bg-elevated":"#3e3a58","--color-bg-hover":"#3e3a58","--color-bg-active":"#44415a","--color-text-primary":"#e0def4","--color-text-secondary":"#c4a7e7","--color-text-tertiary":"#908caa","--color-text-muted":"#6e6a86","--color-text-inverse":"#232136","--color-accent":"#ea9a97","--color-accent-hover":"#d48580","--color-accent-active":"#c07570","--color-accent-muted":"#3a3040","--color-accent-text":"#232136","--color-success":"#9ccfd8","--color-success-muted":"#2a3540","--color-warning":"#f6c177","--color-warning-muted":"#3a3528","--color-error":"#eb6f92","--color-error-muted":"#3a2535","--color-info":"#3e8fb0","--color-info-muted":"#1a2a38","--color-border":"#393552","--color-border-hover":"#44415a","--color-border-focus":"#ea9a97","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#6e6a86","--color-syntax-string":"#f6c177","--color-syntax-keyword":"#3e8fb0","--color-syntax-function":"#ea9a97","--color-syntax-number":"#eb6f92","--color-syntax-operator":"#9ccfd8","--color-syntax-variable":"#e0def4","--color-syntax-punctuation":"#908caa","--color-syntax-property":"#c4a7e7","--color-syntax-tag":"#eb6f92","--color-syntax-class":"#9ccfd8"}},cm={id:"rose-pine-dawn",name:"Rosé Pine Dawn",appearance:"light",builtIn:!0,colors:{"--color-bg-primary":"#faf4ed","--color-bg-secondary":"#f2e9e1","--color-bg-tertiary":"#e4dfde","--color-bg-surface":"#fffaf3","--color-bg-elevated":"#ffffff","--color-bg-hover":"#f2e9e1","--color-bg-active":"#e4dfde","--color-text-primary":"#575279","--color-text-secondary":"#797593","--color-text-tertiary":"#9893a5","--color-text-muted":"#b4b0c3","--color-text-inverse":"#faf4ed","--color-accent":"#d7827e","--color-accent-hover":"#c46865","--color-accent-active":"#b05550","--color-accent-muted":"#fae8e8","--color-accent-text":"#faf4ed","--color-success":"#56949f","--color-success-muted":"#e0f0f0","--color-warning":"#ea9d34","--color-warning-muted":"#faf0d8","--color-error":"#b4637a","--color-error-muted":"#f8e0e8","--color-info":"#286983","--color-info-muted":"#d8f0f8","--color-border":"#e4dfde","--color-border-hover":"#d5d0ce","--color-border-focus":"#d7827e","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--color-syntax-comment":"#9893a5","--color-syntax-string":"#ea9d34","--color-syntax-keyword":"#286983","--color-syntax-function":"#d7827e","--color-syntax-number":"#b4637a","--color-syntax-operator":"#56949f","--color-syntax-variable":"#575279","--color-syntax-punctuation":"#797593","--color-syntax-property":"#907aa9","--color-syntax-tag":"#b4637a","--color-syntax-class":"#56949f"}},um={id:"github-dark",name:"GitHub Dark",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#0d1117","--color-bg-secondary":"#010409","--color-bg-tertiary":"#161b22","--color-bg-surface":"#21262d","--color-bg-elevated":"#30363d","--color-bg-hover":"#21262d","--color-bg-active":"#30363d","--color-text-primary":"#e6edf3","--color-text-secondary":"#c9d1d9","--color-text-tertiary":"#8b949e","--color-text-muted":"#6e7681","--color-text-inverse":"#0d1117","--color-accent":"#58a6ff","--color-accent-hover":"#388bfd","--color-accent-active":"#1f6feb","--color-accent-muted":"#1a3050","--color-accent-text":"#ffffff","--color-success":"#3fb950","--color-success-muted":"#1a3020","--color-warning":"#d29922","--color-warning-muted":"#3a3020","--color-error":"#f85149","--color-error-muted":"#3a2020","--color-info":"#58a6ff","--color-info-muted":"#1a3050","--color-border":"#30363d","--color-border-hover":"#484f58","--color-border-focus":"#58a6ff","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#8b949e","--color-syntax-string":"#a5d6ff","--color-syntax-keyword":"#ff7b72","--color-syntax-function":"#d2a8ff","--color-syntax-number":"#79c0ff","--color-syntax-operator":"#ff7b72","--color-syntax-variable":"#ffa657","--color-syntax-punctuation":"#c9d1d9","--color-syntax-property":"#7ee787","--color-syntax-tag":"#7ee787","--color-syntax-class":"#ffa657"}},dm={id:"github-light",name:"GitHub Light",appearance:"light",builtIn:!0,colors:{"--color-bg-primary":"#ffffff","--color-bg-secondary":"#f6f8fa","--color-bg-tertiary":"#eaeef2","--color-bg-surface":"#ffffff","--color-bg-elevated":"#ffffff","--color-bg-hover":"#f3f4f6","--color-bg-active":"#eaeef2","--color-text-primary":"#1f2328","--color-text-secondary":"#424a53","--color-text-tertiary":"#656d76","--color-text-muted":"#8c959f","--color-text-inverse":"#ffffff","--color-accent":"#0969da","--color-accent-hover":"#0860ca","--color-accent-active":"#0550ae","--color-accent-muted":"#ddf4ff","--color-accent-text":"#ffffff","--color-success":"#1a7f37","--color-success-muted":"#dafbe1","--color-warning":"#9a6700","--color-warning-muted":"#fff8c5","--color-error":"#cf222e","--color-error-muted":"#ffebe9","--color-info":"#0969da","--color-info-muted":"#ddf4ff","--color-border":"#d0d7de","--color-border-hover":"#afb8c1","--color-border-focus":"#0969da","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.05)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)","--color-syntax-comment":"#6e7781","--color-syntax-string":"#0a3069","--color-syntax-keyword":"#cf222e","--color-syntax-function":"#8250df","--color-syntax-number":"#0550ae","--color-syntax-operator":"#cf222e","--color-syntax-variable":"#953800","--color-syntax-punctuation":"#1f2328","--color-syntax-property":"#116329","--color-syntax-tag":"#116329","--color-syntax-class":"#953800"}},hm={id:"github-dimmed",name:"GitHub Dimmed",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#22272e","--color-bg-secondary":"#1c2128","--color-bg-tertiary":"#2d333b","--color-bg-surface":"#373e47","--color-bg-elevated":"#444c56","--color-bg-hover":"#2d333b","--color-bg-active":"#373e47","--color-text-primary":"#adbac7","--color-text-secondary":"#909dab","--color-text-tertiary":"#768390","--color-text-muted":"#636e7b","--color-text-inverse":"#22272e","--color-accent":"#539bf5","--color-accent-hover":"#4184e4","--color-accent-active":"#316dca","--color-accent-muted":"#1a3050","--color-accent-text":"#ffffff","--color-success":"#57ab5a","--color-success-muted":"#1a3020","--color-warning":"#c69026","--color-warning-muted":"#3a3020","--color-error":"#e5534b","--color-error-muted":"#3a2020","--color-info":"#539bf5","--color-info-muted":"#1a3050","--color-border":"#444c56","--color-border-hover":"#545d68","--color-border-focus":"#539bf5","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#768390","--color-syntax-string":"#96d0ff","--color-syntax-keyword":"#f47067","--color-syntax-function":"#dcbdfb","--color-syntax-number":"#6cb6ff","--color-syntax-operator":"#f47067","--color-syntax-variable":"#f69d50","--color-syntax-punctuation":"#adbac7","--color-syntax-property":"#8ddb8c","--color-syntax-tag":"#8ddb8c","--color-syntax-class":"#f69d50"}},fm={id:"monokai",name:"Monokai",appearance:"dark",builtIn:!0,colors:{"--color-bg-primary":"#272822","--color-bg-secondary":"#1e1f1c","--color-bg-tertiary":"#2d2e27","--color-bg-surface":"#3e3d32","--color-bg-elevated":"#49483e","--color-bg-hover":"#3e3d32","--color-bg-active":"#49483e","--color-text-primary":"#f8f8f2","--color-text-secondary":"#e6e6e0","--color-text-tertiary":"#b8b8b0","--color-text-muted":"#75715e","--color-text-inverse":"#272822","--color-accent":"#f92672","--color-accent-hover":"#e01f65","--color-accent-active":"#c01a58","--color-accent-muted":"#402030","--color-accent-text":"#ffffff","--color-success":"#a6e22e","--color-success-muted":"#2a3a20","--color-warning":"#e6db74","--color-warning-muted":"#3a3a25","--color-error":"#f92672","--color-error-muted":"#402030","--color-info":"#66d9ef","--color-info-muted":"#203540","--color-border":"#49483e","--color-border-hover":"#5a5950","--color-border-focus":"#f92672","--shadow-sm":"0 1px 2px 0 rgb(0 0 0 / 0.4)","--shadow-md":"0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5)","--shadow-lg":"0 10px 15px -3px rgb(0 0 0 / 0.6), 0 4px 6px -4px rgb(0 0 0 / 0.6)","--color-syntax-comment":"#75715e","--color-syntax-string":"#e6db74","--color-syntax-keyword":"#f92672","--color-syntax-function":"#a6e22e","--color-syntax-number":"#ae81ff","--color-syntax-operator":"#f92672","--color-syntax-variable":"#f8f8f2","--color-syntax-punctuation":"#f8f8f2","--color-syntax-property":"#66d9ef","--color-syntax-tag":"#f92672","--color-syntax-class":"#a6e22e"}},Gf=[Vv,Yv,Jv,am,fm,om,Qv,Xv,Zv,sm,im,cm,em,tm,nm,rm,um,dm,hm,lm],pm=new Map(Gf.map(e=>[e.id,e]));function Po(e,t=[]){return pm.get(e)??t.find(r=>r.id===e)}const Dc="cove:",gd=1;function ye(e){try{const t=localStorage.getItem(Dc+e);return t===null?null:JSON.parse(t)}catch{return null}}function _e(e,t){try{localStorage.setItem(Dc+e,JSON.stringify(t))}catch{}}function $l(e){localStorage.removeItem(Dc+e)}const Lc="cove:session-auth";function Nc(){const e=ye("auth");return e?(e.credential&&(Oc({...e,credential:void 0}),Fc(e.credential)),e):null}function Oc(e){const t={url:e.url,authMode:e.authMode,rememberMe:e.rememberMe};_e("auth",t),e.credential&&(e.rememberMe?(_e("credential",e.credential),Vf()):(Fc(e.credential),$l("credential")))}function gm(){$l("auth"),$l("credential"),Vf()}function Fc(e){try{sessionStorage.setItem(Lc,JSON.stringify({credential:e}))}catch{}}function Kf(){try{const e=ye("credential");if(e)return e;const t=sessionStorage.getItem(Lc);return t&&JSON.parse(t).credential||null}catch{return null}}function Vf(){try{sessionStorage.removeItem(Lc)}catch{}}function vm(){return ye("hasCompletedOnboarding")??!1}function vd(){_e("hasCompletedOnboarding",!0)}function mm(e){_e("pendingTour",e)}function bm(){const e=ye("pendingTour")??!1;return e&&$l("pendingTour"),e}const us={timeFormat:"relative",fontSize:"md",fontFamily:"geist",sidebarWidth:280};function xm(){return ye("time-format")??us.timeFormat}function ym(e){_e("time-format",e)}function wm(){return ye("font-size")??us.fontSize}function km(e){_e("font-size",e)}function _m(){return ye("font-family")??us.fontFamily}function Sm(e){_e("font-family",e)}function Cm(){const e=ye("locale");return e||((navigator.language||"en").startsWith("en"),"en")}function Em(){return ye("theme-preference")}function Tm(e){_e("theme-preference",e)}function Am(){return ye("sidebarWidth")??us.sidebarWidth}function Mm(e){_e("sidebarWidth",e)}function Im(){const e=ye("messages-session"),t=ye("messages-cache");return e&&t?{sessionKey:e,messages:t}:null}function Rm(e,t){_e("messages-session",e),_e("messages-cache",t)}function $m(){return ye("sessions-cache")}function Dm(e){_e("sessions-cache",e)}function Lm(){return ye("usage-cache")}function Nm(e){_e("usage-cache",e)}function Om(){const e=ye("model-favorites");return new Set(e??[])}function Fm(e){_e("model-favorites",[...e])}function Pm(){return ye("custom-themes")??[]}function zm(e,t){_e("theme-cache",{id:e,css:t})}const Um={useDefaults:!0,defaultAgentId:"main"};function Hm(){return ye("new-chat-settings")??Um}function jm(e){_e("new-chat-settings",e)}function Bm(){return ye("app-mode")??"single"}function Wm(e){_e("app-mode",e)}function qm(){return ye("heartbeat-seen-count")??0}function Gm(e){_e("heartbeat-seen-count",e)}function Km(){(ye("schemaVersion")??0)<gd&&_e("schemaVersion",gd)}const lt=v(Ym()),Yf=v(Pm()),Vm=B(()=>{const e=lt.value,t=Yf.value;if(e.selected==="system"){const a=window.matchMedia("(prefers-color-scheme: dark)").matches?e.darkTheme:e.lightTheme;return Po(a,t)??Po("dark",t)}return Po(e.selected,t)??Po("dark",t)});function Ym(){const e=Em();return e?{...pd,...e}:pd}function Jm(e){const t=document.documentElement;for(const[r,a]of Object.entries(e))t.style.setProperty(r,a)}function Xm(e){zm(e.id,JSON.stringify({id:e.id,appearance:e.appearance,colors:e.colors}))}function Zm(e){Jm(e.colors),Xm(e);const t=document.querySelector('meta[name="theme-color"]');t&&t.setAttribute("content",e.colors["--color-bg-primary"]??(e.appearance==="dark"?"#0a0a0b":"#ffffff")),document.documentElement.setAttribute("data-appearance",e.appearance)}function Ws(e){lt.value={...lt.value,selected:e}}function Qm(e){lt.value={...lt.value,lightTheme:e}}function eb(e){lt.value={...lt.value,darkTheme:e}}function tb(){return[...Gf,...Yf.value]}function nb(){Ie(()=>{const t=Vm.value;Zm(t)}),Ie(()=>{Tm(lt.value)}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{lt.value.selected==="system"&&(lt.value={...lt.value})})}const rb={name:"Cove",description:"OpenClaw WebUI",tagline:"A cozy home for your AI assistant"},ab={welcome:"Welcome to Cove",welcomeSubtitle:"Your beautiful interface for OpenClaw",feature1Title:"Real-time Chat",feature1Desc:"Stream responses with tool calls and rich formatting",feature2Title:"Secure Connection",feature2Desc:"Connect to your own OpenClaw gateway with token or password auth",feature3Title:"Full Control",feature3Desc:"Manage sessions, cron jobs, skills, and more",getStarted:"Get Started",skip:"I'll configure this later",skipToLogin:"Skip to manual login",urlTitle:"Connect to Gateway",urlSubtitle:"Enter your OpenClaw gateway WebSocket URL",urlError:"URL must start with ws:// or wss://",troubleshootTitle:"Tips:",troubleshoot1:"Local gateway: ws://localhost:8080",troubleshoot2:"Remote gateway: wss://your-server.com:8080",troubleshoot3:"Check that your gateway is running",verifying:"Verifying...",gatewayFound:"Gateway found!",probeError:"Could not connect to gateway",authTitle:"Authentication",authSubtitle:"Enter your credentials to connect",authMethod:"Auth Method",rememberMeDesc:"Save credentials for automatic reconnection",connecting:"Connecting...",connectingDesc:"Establishing secure connection to your gateway",success:"Connected!",successDesc:"You're all set. Time to start chatting with your assistant.",startChatting:"Start Chatting",failed:"Connection Failed",failedHints:"Common fixes:",hint1:"Verify the gateway URL is correct",hint2:"Check that the gateway is running",hint3:"Ensure your credentials are valid",hint4:"Try refreshing if using HTTPS with self-signed certs",tryAgain:"Try Again",showFeatureTour:"Show feature tour",modeTitle:"How would you like to use Cove?",modeSingle:"Single chat",modeSingleDesc:"One focused conversation",modeMulti:"Multi-chat (Beta)",modeMultiDesc:"Multiple conversations"},ob={skipTour:"Skip tour",startChatting:"Start Chatting",themesTitle:"Personalize Your Experience",themesDesc:"Choose from multiple themes to match your style.",themesTip1:"6 built-in themes: Light, Dark, Nord, Dracula, and more",themesTip2:"System preference auto-switching supported",themesTip3:"Change anytime in Settings",shortcutsTitle:"Keyboard Shortcuts",shortcutsDesc:"Work faster with keyboard navigation.",shortcutsTip1:"⌘/Ctrl + K — Quick command palette",shortcutsTip2:"⌘/Ctrl + F — Search messages",shortcutsTip3:"Enter to send, Shift+Enter for newline",sessionsTitle:"Session Management",sessionsDesc:"Organize conversations your way.",sessionsTip1:"Multiple sessions with different contexts",sessionsTip2:"Rename, pin, and filter sessions",sessionsTip3:"Switch models per session",uploadsTitle:"File Uploads",uploadsDesc:"Share images and files with your assistant.",uploadsTip1:"Drag & drop files into the chat",uploadsTip2:"Paste images directly from clipboard",uploadsTip3:"Click the attachment button to browse"},lb={send:"Send",queue:"Queue",stop:"Stop",rename:"Rename",cancel:"Cancel",close:"Close",save:"Save",create:"Create",new:"New",delete:"Delete",edit:"Edit",copy:"Copy",copied:"Copied!",retry:"Retry",refresh:"Refresh",expand:"Expand",collapse:"Collapse",newChat:"New Chat",connect:"Connect",disconnect:"Disconnect",logout:"Logout",login:"Login",submit:"Submit",confirm:"Confirm",back:"Back",continue:"Continue",next:"Next",done:"Done",search:"Search",filter:"Filter",clear:"Clear",selectAll:"Select All",deselectAll:"Deselect All",more:"More",less:"Less",viewAll:"View All",showMore:"Show More",showLess:"Show Less",remove:"Remove",download:"Download"},sb={confirmDelete:"Are you sure?",deleting:"Deleting...",saving:"Saving...",loading:"Loading...",noData:"No data",noResults:"No results found",tryAgain:"Try again",dismiss:"Dismiss"},ib={title:"Connect to Gateway",gatewayUrl:"Gateway URL",gatewayUrlPlaceholder:"ws://localhost:8080",password:"Password",passwordPlaceholder:"Enter password",token:"Token",tokenPlaceholder:"Enter token",rememberMe:"Remember me",connecting:"Connecting...",authMode:{password:"Password",token:"Token"}},cb={generic:"Something went wrong",connectionFailed:"Failed to connect to gateway",connectionLost:"Connection lost",unauthorized:"Invalid credentials",timeout:"Request timed out",notFound:"Not found",serverError:"Server error",networkError:"Network error",unknown:"An unknown error occurred",retry:"Please try again",required:"This field is required",invalid:"Invalid value",viewFailed:"Failed to load {view}"},ub={approvalNeeded:"Exec Approval Needed",command:"Command",host:"Host",agent:"Agent",session:"Session",cwd:"Working Directory",resolved:"Resolved Path",security:"Security Mode",askMode:"Ask Mode",expiresIn:"Expires in {time}",expired:"Expired",approved:"Approved",denied:"Denied",pendingCount:"{count} pending",allowOnce:"Allow Once",allowAlways:"Always Allow",deny:"Deny"},db={connected:"Healthy",disconnected:"Disconnected",connecting:"Connecting",reconnecting:"Reconnecting",error:"Error",online:"Online",offline:"Offline",loading:"Loading...",saving:"Saving...",processing:"Processing..."},hb={disconnected:"Connection lost. Messages will be sent when reconnected.",reconnecting:"Reconnecting to gateway...",reconnectingAttempt:"Reconnecting... (attempt {count})",messageFailed:"Failed to send. Tap to retry.",messageFailedStatus:"Failed",messageSending:"Sending",messageQueued:"Queued",messagesQueued:"{count} message queued",messagesQueued_plural:"{count} messages queued"},fb={chat:"Chat",sessions:"Sessions",overview:"Overview",stats:"Server Stats",channels:"Channels",instances:"Instances",cron:"Cron Jobs",config:"Config",status:"Status",debug:"Debug",logs:"Logs",docs:"Docs",github:"GitHub",githubOpenClaw:"OpenClaw GitHub",discord:"Discord",settings:"Cove Settings",memory:"Memory",skills:"Skills",nodes:"Nodes",devices:"Devices",sections:{chat:"Chat",control:"Control",agent:"Agent",settings:"Settings",resources:"Resources"}},pb={title:"New Chat",agent:"Agent",agentDescription:"Choose which assistant to chat with",rememberChoice:"Remember this choice",rememberChoiceDescription:"Skip this dialog next time and use these defaults",create:"Create Chat"},gb={placeholder:"Message (Enter to send, Shift+Enter for new line)",placeholderMobile:"Message...",placeholderDisabled:"Connect to gateway to start chatting",sending:"Sending...",thinking:"Thinking...",queuedMessages:"Queued ({count})",queuedMessages_plural:"Queued ({count})",editQueuedMessage:"Edit Queued Message",images:"Images",addImage:"Add Image",noImages:"No images attached",imageCount:"{count} image",imageCount_plural:"{count} images",streaming:"Generating response...",copyCode:"Copy code",viewRaw:"View raw",viewRendered:"View rendered",scrollToBottom:"Scroll to bottom",search:"Search messages",searchPlaceholder:"Search in conversation...",match:"match",matches:"matches",dateRange:"Date",noMatches:"No matches found",newMessages:"{count} new message",newMessages_plural:"{count} new messages",emptyState:{title:"Start a conversation",titleWithName:"Chat with {name}",description:"Send a message to begin chatting with your assistant",assistant:"Assistant",hint:"Quick tips:",search:"Search",newSession:"New session"},toolCall:{running:"Running...",completed:"Completed",failed:"Failed",duration:"{duration}"},heartbeats:"{count} heartbeat",heartbeats_plural:"{count} heartbeats",heartbeatsTitle:"Heartbeats",noHeartbeats:"No heartbeats yet",compacting:"Compacting conversation...",conversationCompacted:"Conversation compacted",cronJobCompleted:"Cron job completed",dateFrom:"From",dateTo:"To",attachImage:"Attach image",dropFiles:"Drop files here",imageViewer:"Image viewer",copyMarkdown:"Copy markdown"},vb={title:"Sessions",main:"Main",current:"Current",pinned:"Pinned",today:"Today",yesterday:"Yesterday",thisWeek:"This Week",older:"Older",noSessions:"No sessions yet",noResults:"No sessions match your search",newSession:"New Session",rename:"Rename Session",label:"Session Label",labelPlaceholder:"Enter a name for this session",delete:"Delete Session",deleteConfirm:'Are you sure you want to delete "{name}"?',deleteWarning:"This action cannot be undone. All messages in this session will be permanently deleted.",switchTo:"Switch to {name}",count:"{count} session",count_plural:"{count} sessions",searchPlaceholder:"Search...",filterSessions:"Filter sessions",filterAll:"All",filterMain:"Main",filterIsolated:"Isolated",filterChannel:"Channel",showCron:"Show cron sessions",tokens:"{count} tokens",model:"Model: {model}",defaultModel:"Default",admin:{title:"Sessions",description:"Manage active sessions, configure overrides, and monitor usage.",label:"Label",labelPlaceholder:"Give this session a memorable name",labelHelp:"A friendly name to help identify this session in lists.",editLabel:"Edit label",overrides:"Session Overrides",tokens:"Tokens",contextUsed:"Context Used",lastActive:"Last Active",thinking:"Thinking",verbose:"Verbose",reasoning:"Reasoning",sessionDetails:"Session Details",openInChat:"Open in Chat",configure:"Configure",confirmDelete:"Delete this session?",emptyTitle:"No Sessions",emptyDescription:"Sessions will appear here once you start chatting.",noResults:"No Matching Sessions",noResultsDescription:"Try adjusting your search or filters.",clearFilters:"Clear Filters",searchPlaceholder:"Search sessions...",count:"{count} session",count_plural:"{count} sessions",filteredCount:"Showing {filtered} of {total} sessions",stats:{total:"Total"},kinds:{main:"Main",channel:"Channel",cron:"Cron",isolated:"Isolated"},levels:{inherit:"Inherit",off:"Off",low:"Low",medium:"Medium",high:"High"},filters:{all:"All Types"},columns:{session:"Session",kind:"Type",model:"Model",lastActive:"Last Active",tokens:"Tokens"}}},mb={addFavorite:"Add to favorites",removeFavorite:"Remove from favorites"},bb={title:"Settings",description:"Customize your Cove experience",appearance:{title:"Appearance",theme:"Theme",themeDescription:"Choose your color scheme",themeSystem:"System",useSystemTheme:"Follow system appearance",useSystemThemeDescription:"Automatically switch between light and dark themes",lightTheme:"Light Theme",darkTheme:"Dark Theme",lightThemes:"Light",darkThemes:"Dark",fontSize:"Font Size",fontSizeDescription:"Adjust text size throughout the app",fontSizeSm:"Small",fontSizeMd:"Medium",fontSizeLg:"Large",fontFamily:"Font Family",fontFamilyDescription:"Choose your preferred typeface",fontSystem:"System",fontGeist:"Geist",fontInter:"Inter",fontMono:"JetBrains Mono",fontDyslexic:"OpenDyslexic"},language:{title:"Language & Region",locale:"Language",timeFormat:"Time Format",timeRelative:"Relative (2 hours ago)",timeAbsolute:"Absolute (3:45 PM)"},notifications:{title:"Notifications",desktop:"Desktop Notifications",sound:"Sound"},about:{title:"About",cove:"Cove",gateway:"Gateway",gatewayUrl:"Gateway URL"},links:{title:"Links",docs:"Documentation",github:"GitHub",discord:"Discord Community"},preferences:{title:"Preferences",timeFormat:"Time Display",timeFormatDescription:"How timestamps are shown",timeRelative:"Relative (2 hours ago)",timeAbsolute:"Absolute (3:45 PM)"},appMode:{title:"Interface",multiChat:"Multi-chat mode (Beta)",multiChatDescription:"Show session sidebar with multiple conversations"},newChat:{title:"New Chat",useDefaults:"Always use defaults",useDefaultsDescription:"Skip the agent picker when creating new chats",defaultAgent:"Default Agent",defaultAgentDescription:"Which agent to use for new chats"},account:{title:"Account",logoutDescription:"Disconnect from the gateway"},data:{title:"Data",resetDefaults:"Reset to Defaults",resetDefaultsDescription:"Restore all settings to their defaults"},comingSoon:"Coming soon"},xb={title:"Cron Jobs",description:"Schedule and manage automated tasks.",createJob:"Create Job",editJob:"Edit Job",editJobNamed:"Edit {name}",deleteJob:"Delete Job",confirmDelete:"Delete this job?",runNow:"Run Now",enable:"Enable",disable:"Disable",enabled:"Enabled",disabled:"Disabled",running:"Running",pending:"Pending",lastOk:"Last OK",lastFailed:"Last Failed",schedule:"Schedule",nextRun:"Next Run",lastRun:"Last Run",lastDuration:"Last Duration",recentRuns:"Recent Runs",noRuns:"No runs recorded yet.",searchPlaceholder:"Search jobs...",emptyTitle:"No Cron Jobs",emptyDescription:"Create a job to schedule automated tasks.",noResults:"No Matching Jobs",noResultsDescription:"Try adjusting your search or filters.",clearFilters:"Clear Filters",count:"{count} job",count_plural:"{count} jobs",filteredCount:"Showing {filtered} of {total} jobs",stats:{total:"Total",enabled:"Enabled",disabled:"Disabled",nextWake:"Next Wake"},filters:{all:"All Jobs",enabled:"Enabled",disabled:"Disabled"},columns:{job:"Job",schedule:"Schedule",target:"Target",nextRun:"Next Run",status:"Status"},scheduleKind:{cron:"Cron Expression",every:"Interval",at:"One-time"},sessionTarget:{main:"Main Session",isolated:"Isolated Session"},wakeMode:{nextHeartbeat:"Next Heartbeat",now:"Immediate"},payloadKind:{systemEvent:"System Event",agentTurn:"Agent Turn"},form:{name:"Name",namePlaceholder:"My Job",description:"Description",descriptionPlaceholder:"What does this job do?",descriptionHint:"Optional description for this job.",enabled:"Enabled",schedule:"Schedule",timezonePlaceholder:"Timezone (e.g., America/New_York)",cronPlaceholder:"*/5 * * * *",intervalPlaceholder:"Interval in milliseconds",timestampPlaceholder:"Unix timestamp in milliseconds",sessionTarget:"Session Target",sessionTargetHint:"Main injects into the main session. Isolated runs in a separate session.",wakeMode:"Wake Mode",wakeModeHint:"When the job triggers after scheduling.",payload:"Payload",payloadHintMain:"Text injected as a system event into the main session.",payloadHintIsolated:"Runs as an agent turn in an isolated session.",systemEventPlaceholder:"Text to inject as system event",agentMessagePlaceholder:"Message to send to the agent",modelPlaceholder:"Model override (optional)"},validation:{nameRequired:"Name is required",cronRequired:"Cron expression is required",cronInvalid:"Invalid cron expression",intervalMin:"Interval must be at least 1 second",atFuture:"Time must be in the future",payloadRequired:"Payload text is required"}},yb={subtitle:"Connection diagnostics and event logging.",connection:"Connection",server:"Server",client:"Client",paths:"Paths",eventLog:"Event Log",state:"State",url:"URL",sessionKey:"Session Key",reconnectAttempts:"Reconnect Attempts",connectedAt:"Connected At",version:"Version",host:"Host",commit:"Commit",uptime:"Uptime",tickInterval:"Tick Interval",configPath:"Config Path",stateDir:"State Directory",appVersion:"App Version",platform:"Platform",userAgent:"User Agent",presenceCount:"Connected Clients",clear:"Clear",paused:"Paused",recording:"Recording",noEvents:"No events recorded",noEventsHint:"Events will appear here as they occur.",snapshots:"Snapshots",snapshotsDesc:"Status, health, and heartbeat data.",status:"Status",health:"Health",lastHeartbeat:"Last Heartbeat",noData:"No data — click Refresh",recentSession:"Recent Session",heartbeatAgents:"Heartbeat Agents",showRawJson:"Show raw JSON",input:"Input",output:"Output",total:"Total",used:"Used",healthy:"Healthy",unhealthy:"Unhealthy",linked:"Linked",configured:"Configured",on:"On",off:"Off",ok:"OK",error:"Error",clickToExpand:"click to expand",noPayload:"no payload",viewEventDetails:"View {{event}} event details",manualRpc:"Manual RPC",manualRpcDesc:"Send a raw gateway method with JSON params.",method:"Method",params:"Params",paramsJson:"Params (JSON)",addParam:"Add",noParams:"No params — click Add to add one",formMode:"Form",jsonMode:"JSON",call:"Call",result:"Result"},wb={serverInfo:"Server Information",version:"Version",commit:"Commit",host:"Host",capabilities:"Capabilities",capabilitiesCount:"{count} methods"},kb={title:"Logs",description:"Gateway log viewer with live tailing.",searchPlaceholder:"Search logs...",live:"Live",paused:"Paused",all:"All",debug:"Debug",info:"Info",warnings:"Warn",errors:"Error",download:"Download",clear:"Clear",noLogs:"No logs available",noLogsHint:"Logs will appear here when the gateway writes them.",noMatches:"No logs match your filter",fetchError:"Failed to fetch logs",expandLine:"Expand log details",filterByLevel:"Filter by {level} level"},_b={title:"Channels",description:"Messaging platform integrations and status.",emptyTitle:"No Channels",emptyDescription:"No channel plugins are available.",learnMore:"Learn how to set up channels",count:"{count} channel",count_plural:"{count} channels",accountSingular:"account",accountPlural:"accounts",docs:"Docs",configure:"Configure",probe:"Health Check",probing:"Checking...",probeOk:"Healthy",probeFailed:"Unhealthy",logout:"Logout",logoutTitle:"Logout from Channel",logoutConfirm:"Are you sure you want to log out of {channel}?",logoutWarning:"You may need to re-authenticate (QR code, token, etc.) to reconnect.",logoutSuccess:"Logged out of {channel}",viewDocs:"View documentation",stats:{total:"Total",active:"Active (24h)",errors:"Errors"},status:{connected:"Connected",configured:"Configured",notConfigured:"Not Configured",disabled:"Disabled",error:"Error"},account:{enabled:"enabled",disabled:"disabled",configured:"configured",linked:"linked",running:"running",connected:"connected",disconnected:"disconnected"},columns:{channel:"Channel",accounts:"Accounts",status:"Status",lastActivity:"Last Activity"}},Sb={title:"Instances",description:"Connected clients and services.",emptyTitle:"No Instances",emptyDescription:"No connected clients or services found.",count:"{count} instance",count_plural:"{count} instances",idle:"Idle",idleSeconds:"{count}s",idleMinutes:"{count}m",idleHours:"{count}h",stats:{total:"Total",gateways:"Gateways",clients:"Clients"},columns:{instance:"Instance",mode:"Mode",platform:"Platform",lastSeen:"Last Seen",idle:"Idle"}},Cb={title:"Skills",description:"Browse and manage assistant skills.",emptyTitle:"No Skills",emptyDescription:"No skills are available in this workspace.",noResults:"No Matching Skills",count:"{count} skill",count_plural:"{count} skills",noResultsDescription:"Try adjusting your search or filters.",clearFilters:"Clear Filters",filteredCount:"Showing {filtered} of {total} skills",searchPlaceholder:"Search skills...",enable:"Enable",disable:"Disable",enabledSuccess:"Enabled {name}",disabledSuccess:"Disabled {name}",installDeps:"Install Dependencies",installTitle:"Install Dependencies for {name}",installDescription:"Choose an installation method to install the required dependencies.",installSuccess:"Successfully installed dependencies for {name}",installFailed:"Failed to install dependencies",providesBins:"Provides",skillKey:"Skill Key",location:"Location",homepage:"Homepage",alwaysActive:"Always active",missingRequirements:"Missing requirements",blockedByAllowlist:"Blocked by allowlist",primaryEnv:"Primary env var",workspaceDir:"Workspace",managedDir:"Managed skills",stats:{total:"Total",eligible:"Eligible",disabled:"Disabled",missingReqs:"Missing Reqs"},status:{eligible:"Eligible",disabled:"Disabled",missingReqs:"Missing Reqs",blocked:"Blocked"},source:{bundled:"Bundled",workspace:"Workspace",managed:"Installed",extra:"Extra"},filters:{allSources:"All Sources"},tabs:{installed:"Installed",clawhub:"ClawHub"},clawhub:{title:"Browse ClawHub",description:"Discover and install skills from the community registry.",searchPlaceholder:"Search ClawHub skills...",install:"Install",installing:"Installing...",installTitle:"Install {name}",installConfirm:"Install {name} v{version} from ClawHub?",installSuccess:"Installed {name} from ClawHub",installFailed:"Failed to install from ClawHub",noDescription:"No description available",changelog:"Changelog",downloads:"downloads",stars:"stars",viewOnClawhub:"View on ClawHub",noResults:"No Skills Found",tryDifferentSearch:"Try a different search term.",notYetSupported:"ClawHub installation coming soon! Install manually: openclaw skills install {slug}"}},Eb={title:"Devices",description:"Manage paired devices and authentication tokens.",emptyTitle:"No Devices",emptyDescription:"No devices have been paired yet.",noResults:"No matching devices",count:"{count} device",count_plural:"{count} devices",filteredCount:"Showing {filtered} of {total}",searchPlaceholder:"Search devices...",pendingRequests:"Pending Pairing Requests",approve:"Approve",reject:"Reject",approveSuccess:"Device approved",rejectSuccess:"Device rejected",repair:"Repair",deviceId:"Device ID",clientId:"Client ID",scopes:"Scopes",approved:"Approved",tokens:"Auth Tokens",noTokens:"No tokens",tokenActive:"Active",tokenRevoked:"Revoked",rotateToken:"Rotate token",tokenManagement:"Token Management",tokenManagementDesc:"Manage authentication tokens for {name}.",tokenCreated:"Created",tokenRotatedAt:"Rotated",rotate:"Rotate",revoke:"Revoke",tokenRotated:"Token rotated and copied to clipboard",tokenCopied:"New token copied to clipboard",toggleDetails:"Toggle details for {name}",stats:{total:"Total",operators:"Operators",nodes:"Nodes",pending:"Pending"},filters:{allRoles:"All Roles",operators:"Operators",nodes:"Nodes"}},Tb={title:"Nodes",description:"Manage paired mobile devices and nodes.",emptyTitle:"No Nodes",emptyDescription:"Pair a mobile device or node to get started.",noResults:"No matching nodes",count:"{count} node",count_plural:"{count} nodes",filteredCount:"Showing {filtered} of {total}",searchPlaceholder:"Search nodes...",pendingRequests:"Pending Pairing Requests",requestedAt:"Requested",approve:"Approve",reject:"Reject",approveSuccess:"Pairing approved",rejectSuccess:"Pairing rejected",connected:"Connected",nodeId:"Node ID",version:"Version",ipAddress:"IP Address",commands:"Commands",actions:"Actions",actionsRequireConnection:"Actions require an active connection",notify:"Notify",notifyTitle:"Send Notification to {name}",notifyTitleLabel:"Title",notifyTitlePlaceholder:"Notification title",notifyBodyLabel:"Message",notifyBodyPlaceholder:"Notification message...",sendNotification:"Send",notifySuccess:"Notification sent to {name}",cameraFront:"Front Camera",cameraBack:"Back Camera",cameraRequested:"Requesting photo...",cameraSuccess:"Photo captured",location:"Location",locationSuccess:"Location retrieved",screenRecord:"Screen Record",screenRecordHint:"Record the device screen",stats:{total:"Total",connected:"Connected",paired:"Offline",pending:"Pending"},status:{connected:"Connected",paired:"Offline"}},Ab={title:"Server Stats",description:"Gateway metrics and usage statistics",loadError:"Failed to load server stats",gateway:{title:"Gateway",unknown:"Unknown host",uptime:"Uptime",sessions:"Sessions"},usage:{title:"Token Usage",period:"Last {days} days",totalCost:"Total Cost",input:"Input",output:"Output",total:"Total",cache:"Cache Tokens",cacheRead:"Cache Read",cacheWrite:"Cache Write",unavailable:"Usage data not available"},daily:{title:"Daily Activity"},agents:{title:"Agents",default:"Default",sessions:"sessions"}},Mb={justNow:"just now",secondsAgo:"{count} second ago",secondsAgo_plural:"{count} seconds ago",minutesAgo:"{count} minute ago",minutesAgo_plural:"{count} minutes ago",hoursAgo:"{count} hour ago",hoursAgo_plural:"{count} hours ago",daysAgo:"{count} day ago",daysAgo_plural:"{count} days ago",weeksAgo:"{count} week ago",weeksAgo_plural:"{count} weeks ago",monthsAgo:"{count} month ago",monthsAgo_plural:"{count} months ago",yearsAgo:"{count} year ago",yearsAgo_plural:"{count} years ago",compact:{now:"now",minutes:"{count}m",hours:"{count}h",days:"{count}d",weeks:"{count}w",months:"{count}mo",years:"{count}y"}},Ib={skipToContent:"Skip to content",menuOpen:"Open menu",menuClose:"Close menu",sidebarToggle:"Toggle sidebar",themeToggle:"Toggle theme",loading:"Loading",closeDialog:"Close dialog",expandSection:"Expand section",collapseSection:"Collapse section"},Rb={title:"Configuration",description:"Manage OpenClaw settings",searchPlaceholder:"Search settings...",save:"Save Changes",saving:"Saving...",reset:"Reset",unsavedChanges:"You have unsaved changes",discardChanges:"Discard changes?",saveSuccess:"Configuration saved. Gateway will restart.",saveError:"Failed to save configuration",hashMismatch:"Configuration was modified externally. Reload and try again.",reload:"Reload",showAdvanced:"Show advanced settings",hideAdvanced:"Hide advanced settings",restartRequired:"Gateway will restart to apply changes",noFields:"No settings found",noResults:"No matching settings",selectSection:"Select a section to configure",emptyConfig:"Configuration is empty",loadError:"Failed to load configuration",version:"OpenClaw {version}",configPath:"Config: {path}",expandAll:"Expand all",collapseAll:"Collapse all",sections:{gateway:"Gateway",agents:"Agents",channels:"Channels",tools:"Tools",models:"Models",auth:"Authentication",commands:"Commands",session:"Session",cron:"Cron",skills:"Skills",plugins:"Plugins",other:"Other"},validation:{required:"This field is required",invalidUrl:"Invalid URL format",invalidNumber:"Must be a number",invalidFormat:"Invalid format",mustBeString:"Must be a string",mustBeNumber:"Must be a number",mustBeInteger:"Must be an integer",mustBeBoolean:"Must be true or false",mustBeArray:"Must be an array",mustBeObject:"Must be an object",invalidOption:"Invalid option",minLength:"Must be at least {min} characters",maxLength:"Must be at most {max} characters",minimum:"Must be at least {min}",maximum:"Must be at most {max}",minItems:"Must have at least {min} items",maxItems:"Must have at most {max} items"},field:{showPassword:"Show password",hidePassword:"Hide password",addItem:"Add item",removeItem:"Remove item",noItems:"No items",editJson:"Edit as JSON",dragToReorder:"Drag to reorder",invalidJson:"Invalid JSON"}},$b={app:rb,onboarding:ab,tour:ob,actions:lb,common:sb,auth:ib,errors:cb,exec:ub,status:db,connection:hb,nav:fb,newChatModal:pb,chat:gb,sessions:vb,models:mb,settings:bb,cron:xb,debug:yb,overview:wb,logs:kb,channels:_b,instances:Sb,skills:Cb,devices:Eb,nodes:Tb,stats:Ab,time:Mb,accessibility:Ib,config:Rb},ia={en:$b};function Db(e){if(ia[e])return ia[e];const t=e.split("-")[0];return ia[t]?ia[t]:ia.en}const Ar=v(xm()),qa=v(wm()),Ga=v(_m()),Ge=v(Hm()),rn=v(Bm()),ds=B(()=>rn.value==="multi"),md=B(()=>rn.value==="single");Ie(()=>ym(Ar.value));Ie(()=>km(qa.value));Ie(()=>Sm(Ga.value));Ie(()=>jm(Ge.value));Ie(()=>Wm(rn.value));Ie(()=>{document.documentElement.dataset.fontSize=qa.value});Ie(()=>{const e={geist:'"Geist Sans", ui-sans-serif, system-ui, sans-serif',inter:'"Inter", ui-sans-serif, system-ui, sans-serif',system:'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',dyslexic:'"OpenDyslexic", ui-sans-serif, system-ui, sans-serif',mono:'"JetBrains Mono", ui-monospace, monospace'};document.documentElement.style.setProperty("--font-family-override",e[Ga.value])});const Lb=[{value:"sm",labelKey:"settings.appearance.fontSizeSm"},{value:"md",labelKey:"settings.appearance.fontSizeMd"},{value:"lg",labelKey:"settings.appearance.fontSizeLg"}],Nb=[{value:"system",labelKey:"settings.appearance.fontSystem"},{value:"geist",labelKey:"settings.appearance.fontGeist"},{value:"inter",labelKey:"settings.appearance.fontInter"},{value:"mono",labelKey:"settings.appearance.fontMono"},{value:"dyslexic",labelKey:"settings.appearance.fontDyslexic"}],Ob=[{value:"relative",labelKey:"settings.preferences.timeRelative"},{value:"local",labelKey:"settings.preferences.timeAbsolute"}];function Fb(){qa.value="md",Ga.value="geist",Ar.value="relative",Ge.value={useDefaults:!0,defaultAgentId:"main"},rn.value="single"}const bd={debug:0,info:1,warn:2,error:3,off:4};function Pb(){return"off"}const zb=Pb();function zo(e){return bd[e]>=bd[zb]}function Uo(e,t){return`[${e}] ${t}`}function Mn(e){return{debug:(t,...r)=>{zo("debug")&&(console.debug(Uo(e,t),...r),r.length,void 0)},info:(t,...r)=>{zo("info")&&(console.info(Uo(e,t),...r),r.length,void 0)},warn:(t,...r)=>{zo("warn")&&(console.warn(Uo(e,t),...r),r.length,void 0)},error:(t,...r)=>{zo("error")&&(console.error(Uo(e,t),...r),r.length,void 0)}}}const M={gateway:Mn("gateway"),auth:Mn("auth"),chat:Mn("chat"),exec:Mn("exec"),i18n:Mn("i18n"),ui:Mn("ui"),usage:Mn("usage")},wn=v(Cm()),xd=v(Db(wn.value)),yd=B(()=>["ar","he","fa","ur"].includes(wn.value.split("-")[0]));function Ub(){document.documentElement.dir=yd.value?"rtl":"ltr",document.documentElement.lang=wn.value,Ie(()=>{document.documentElement.dir=yd.value?"rtl":"ltr",document.documentElement.lang=wn.value})}function wd(e,t){return t.split(".").reduce((r,a)=>{if(r&&typeof r=="object"&&a in r)return r[a]},e)}function i(e,t){let r=wd(xd.value,e);if(t?.count!==void 0&&typeof t.count=="number"){const o=t.count===1?e:`${e}_plural`,l=wd(xd.value,o);l!==void 0&&(r=l)}return typeof r!="string"?(M.i18n.warn(`Missing translation: ${e}`),e):t?r.replace(/\{(\w+)\}/g,(a,o)=>t[o]?.toString()??`{${o}}`):r}function Jf(e,t="short"){const r=typeof e=="number"?new Date(e):e;return new Intl.DateTimeFormat(wn.value,{timeStyle:t}).format(r)}function kd(e){const t=typeof e=="number"?new Date(e):e,r=Date.now(),a=t.getTime()-r,o=Math.round(a/1e3),l=Math.round(o/60),s=Math.round(l/60),c=Math.round(s/24),u=Math.round(c/7),d=Math.round(c/30),h=Math.round(c/365),f=new Intl.RelativeTimeFormat(wn.value,{numeric:"auto"});return Math.abs(o)<60?f.format(o,"second"):Math.abs(l)<60?f.format(l,"minute"):Math.abs(s)<24?f.format(s,"hour"):Math.abs(c)<7?f.format(c,"day"):Math.abs(u)<4?f.format(u,"week"):Math.abs(d)<12?f.format(d,"month"):f.format(h,"year")}function ge(e,t){return t?.relative?kd(e):Ar.value==="local"?Jf(e,"short"):kd(e)}function Hb(e){const t=typeof e=="number"?new Date(e):e,r=Date.now(),a=Math.abs(t.getTime()-r),o=Math.round(a/1e3),l=Math.round(o/60),s=Math.round(l/60),c=Math.round(s/24),u=Math.round(c/7),d=Math.round(c/30),h=Math.round(c/365);return o<60?i("time.compact.now"):l<60?i("time.compact.minutes",{count:l}):s<24?i("time.compact.hours",{count:s}):c<7?i("time.compact.days",{count:c}):u<4?i("time.compact.weeks",{count:u}):d<12?i("time.compact.months",{count:d}):i("time.compact.years",{count:h})}function jb(e){if(Ar.value==="local"){const t=typeof e=="number"?new Date(e):e,r=new Date;return t.getDate()===r.getDate()&&t.getMonth()===r.getMonth()&&t.getFullYear()===r.getFullYear()?Jf(t,"short"):t.getFullYear()===r.getFullYear()?new Intl.DateTimeFormat(wn.value,{month:"short",day:"numeric"}).format(t):new Intl.DateTimeFormat(wn.value,{month:"short",year:"2-digit"}).format(t)}return Hb(e)}const _d=3,Bb=1e3,Wb=3e4,qb=1.5,Gb=3e4,Kb=3e4,Ce=v("disconnected"),$=B(()=>Ce.value==="connected"),Vb=v(!0),vn=v(null),st=v(null),zt=v(null),Pc=v(null),Le=v(null),zc=v([]),xt=v(0),fo=v(null),Yr=v(null),Ka=v(null),kn=v(null),Xf=v(null),_a=v(null),Sa=v(null),po=v([]),Uc=B(()=>{const e=Xf.value,t=kn.value;if(e==null||t==null)return null;const r=Date.now()-t;return e+r});let Se=null,mr=null,Yb=0,dl=null,br=null;const Mr=new Map,Li=new Set,Jb=5e3;function Sd(e,t){return new Promise(r=>{if(t?.aborted){r({ok:!1,error:"Aborted"});return}let a=null,o=null,l=!1;const s=()=>{o&&(clearTimeout(o),o=null),a&&(a.onopen=null,a.onmessage=null,a.onerror=null,a.onclose=null,a.close(),a=null)},c=d=>{l||(l=!0,s(),r({ok:!1,error:d}))},u=d=>{l||(l=!0,s(),r({ok:!0,version:d}))};t?.addEventListener("abort",()=>{c("Aborted")}),o=setTimeout(()=>{c("Connection timed out")},Jb);try{a=new WebSocket(e),a.onopen=()=>{M.gateway.debug("Probe: WebSocket opened, waiting for challenge...")},a.onmessage=d=>{try{const h=JSON.parse(d.data);h.type==="evt"&&h.event==="connect.challenge"?(M.gateway.debug("Probe: Received connect.challenge, gateway is valid"),u(h.payload?.version)):(M.gateway.debug("Probe: Received unexpected message:",h.type,h.event),u())}catch{c("Invalid response from server")}},a.onerror=d=>{M.gateway.error("Probe WebSocket error:",{url:e,event:d.type}),c("Connection failed")},a.onclose=d=>{d.wasClean||c("Connection closed unexpectedly")}}catch(d){c(d instanceof Error?d.message:"Failed to connect")}})}function go(e){const t=xt.value>0;return Se&&(t?(Se.onclose=null,Se.close(),Se=null):Ir()),mr=e,Ce.value="connecting",Vb.value=!1,vn.value=null,t||(xt.value=0),zt.value=e.url,new Promise((r,a)=>{try{Se=new WebSocket(e.url),Se.onopen=()=>{Ce.value="authenticating"},Se.onmessage=o=>{try{const l=JSON.parse(o.data);if(Ce.value==="authenticating"&&l.type==="event"&&l.event==="connect.challenge"){Xb(e).then(s=>{Ce.value="connected",kn.value=Date.now(),st.value=s.server?.version??null,fo.value=s.server?.commit??null,Yr.value=s.server?.host??null,Pc.value=s.server?.connId??null,zc.value=s.features?.methods??[],Ka.value=s.policy?.tickIntervalMs??null,po.value=s.snapshot?.presence??[],Xf.value=s.snapshot?.uptimeMs??null,_a.value=s.snapshot?.configPath??null,Sa.value=s.snapshot?.stateDir??null;const c=s.snapshot?.sessionDefaults;c?.mainSessionKey&&(Le.value=c.mainSessionKey,M.gateway.info("Main session key:",Le.value)),nx(),r(s)}).catch(s=>{vn.value=s.message,Ir(),a(s)});return}Qb(l)}catch(l){M.gateway.error(" Failed to parse message:",l)}},Se.onerror=o=>{M.gateway.error("WebSocket error:",{url:e.url,readyState:Se?.readyState,event:o.type}),vn.value="WebSocket error - check console for details"},Se.onclose=o=>{const s=Ce.value==="connected",c=xt.value>0;Hc(),Zf(new Error("Connection closed")),(s||c)&&mr?.autoReconnect!==!1?rx():Ce.value="disconnected"}}catch(o){Ce.value="disconnected",vn.value=o instanceof Error?o.message:"Failed to connect",a(o)}})}async function Xb(e){const t={minProtocol:_d,maxProtocol:_d,client:{id:"webchat",displayName:"Cove",version:"1.2.1",platform:Zb(),mode:"webchat"},caps:["tool-events"],role:"operator",scopes:["operator.admin","operator.read","operator.write"],auth:{}};return e.token?t.auth.token=e.token:e.password&&(t.auth.password=e.password),await H("connect",t)}function Zb(){const e=navigator.userAgent;return e.includes("Mac")?"macos":e.includes("Windows")?"windows":e.includes("Linux")?"linux":e.includes("iPhone")||e.includes("iPad")?"ios":e.includes("Android")?"android":"web"}function Ir(){mr=null,Hc(),ax(),Zf(new Error("Disconnected")),Se&&(Se.onclose=null,Se.close(),Se=null),Ce.value="disconnected",kn.value=null,st.value=null,fo.value=null,Yr.value=null,zt.value=null,Pc.value=null,Le.value=null,zc.value=[],Ka.value=null,po.value=[]}function H(e,t,r){return new Promise((a,o)=>{if(!Se||Se.readyState!==WebSocket.OPEN){o(new Error("Not connected"));return}const l=`req_${++Yb}`,s=r?.timeout??Gb,c={type:"req",id:l,method:e,params:t},u=setTimeout(()=>{Mr.delete(l),o(new Error(`Request timeout: ${e}`))},s);Mr.set(l,{resolve:a,reject:o,timeout:u}),Se.send(JSON.stringify(c))})}function Qb(e){switch(e.type){case"res":ex(e);break;case"event":tx(e);break;default:M.gateway.warn(" Unknown message type:",e)}}function ex(e){const t=Mr.get(e.id);if(!t){M.gateway.warn(" Received response for unknown request:",e.id);return}Mr.delete(e.id),clearTimeout(t.timeout),e.ok?t.resolve(e.payload):t.reject(new Error(e.error?.message??"Request failed"))}function tx(e){M.gateway.debug("Event received:",e.event);for(const t of Li)try{t(e)}catch(r){M.gateway.error(" Event handler error:",r)}}function Zf(e){for(const[t,r]of Mr)clearTimeout(r.timeout),r.reject(e);Mr.clear()}function hs(e){return Li.add(e),()=>Li.delete(e)}function Ni(e,t){return hs(a=>{a.event===e&&t(a.payload)})}let ca=0;const Cd=3;function nx(){Hc(),ca=0,dl=setInterval(()=>{Se?.readyState===WebSocket.OPEN&&H("health").then(()=>{ca=0}).catch(e=>{ca++,M.gateway.warn(`Heartbeat failed (${ca}/${Cd}):`,e instanceof Error?e.message:String(e)),ca>=Cd&&M.gateway.error("Too many consecutive heartbeat failures, connection may be unhealthy")})},Kb)}function Hc(){dl&&(clearInterval(dl),dl=null)}function rx(){if(!mr||br)return;Ce.value="reconnecting",xt.value++;const e=Math.min(Bb*Math.pow(qb,xt.value-1),Wb);M.gateway.info(`[gateway] Reconnecting in ${Math.round(e/1e3)}s (attempt ${xt.value})`),br=setTimeout(async()=>{if(br=null,!!mr)try{await go(mr)}catch{}},e)}function ax(){br&&(clearTimeout(br),br=null),xt.value=0}const xa={state:Ce,isConnected:$,error:vn,version:st,commit:fo,host:Yr,url:zt,connectionId:Pc,mainSessionKey:Le,capabilities:zc,tickIntervalMs:Ka,connectedAt:kn,presence:po,reconnectAttempt:xt,connect:go,disconnect:Ir,send:H,subscribe:hs,on:Ni},ox=6e4,lx=200,sx=100,ix=5e3,cx=1e3,Ho=`
2
+
3
+ `,ux=300,dx="1.2.1",jo={docs:"https://docs.openclaw.ai",github:"https://github.com/MaudeCode/cove",githubOpenClaw:"https://github.com/openclaw/openclaw",discord:"https://discord.com/invite/clawd"},hx=[/read heartbeat\.md/i,/heartbeat poll/i,/if nothing needs attention.*reply.*heartbeat_ok/i],fx=/^\s*heartbeat_ok\s*$/i,Qf=/^\s*no_(?:reply|repl|rep|re|r|_?)?\s*$/i,px=/^\s*\[cron\]/i;function gx(e){return e.role!=="user"?!1:hx.some(t=>t.test(e.content))}function jc(e){return e.role!=="assistant"?!1:fx.test(e.content)}function vx(e){return e.role!=="assistant"?!1:Qf.test(e.content)}function ep(e){return Qf.test(e)}function mx(e){return e.role!=="assistant"?!1:px.test(e.content)}function tp(e){return gx(e)||jc(e)}const bx=[/^<summary>/i,/the conversation.*compacted/i,/pre-compaction memory flush/i,/context was summarized/i];function xx(e){return e.role!=="user"?!1:bx.some(t=>t.test(e.content))}function Ca(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Bc(e){return e?e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:"):!1}function Wc(e){return typeof e=="string"&&e.trim().length>0}function qc(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function yx(e){return e.replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/__(.+?)__/g,"$1").replace(/_(.+?)_/g,"$1").replace(/~~(.+?)~~/g,"$1").replace(/`(.+?)`/g,"$1").replace(/^#{1,6}\s+/gm,"").replace(/^\s*[-*+]\s+/gm,"• ").replace(/^\s*\d+\.\s+/gm,"").replace(/\[(.+?)\]\(.+?\)/g,"$1").replace(/!\[.*?\]\(.+?\)/g,"").replace(/^>\s+/gm,"").replace(/```[\s\S]*?```/g,t=>t.replace(/```\w*\n?/,"").replace(/```$/,"")).trim()}function np(e){return/^\d/.test(e)?`v${e}`:e}const wx=[":discord:",":telegram:",":signal:",":slack:",":whatsapp:",":imessage:"];function Gn(e){return e===Le.value||e==="main"||e.endsWith(":main")}function kx(e){return op(e.key)==="cron"}function rp(e){return/^agent:[^:]+:chat:[^:]+$/.test(e)}function _x(e){return op(e.key)==="spawn"}function ap(e){const t=e.key.toLowerCase();return wx.some(r=>t.includes(r))?!0:e.kind==="group"}function Sx(e){const t=e.split(":");return t.length>=2&&t[0]==="agent"?t[1]:null}function op(e){const t=e.split(":");return t.length>=3&&t[0]==="agent"?t[2]:null}function lp(e){return e.split("-").map(Ca).join(" ")}function Ed(e){return e.includes("-")&&e.length>20}function Cx(e){if(Gn(e.key))return"pinned";const t=e.updatedAt??e.lastActiveAt;if(!t)return"older";const r=new Date,a=new Date(t),o=new Date(r.getFullYear(),r.getMonth(),r.getDate()),l=new Date(o);l.setDate(l.getDate()-1);const s=new Date(o);return s.setDate(s.getDate()-o.getDay()),a>=o?"today":a>=l?"yesterday":a>=s?"thisWeek":"older"}function Ex(e){const t=new Map([["pinned",[]],["today",[]],["yesterday",[]],["thisWeek",[]],["older",[]]]);for(const r of e){const a=Cx(r);t.get(a).push(r)}return t}function Tx(e){return e===void 0||e===0?null:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function Un(e){return e.key.includes(":cron:")?"cron":ap(e)?"channel":Gn(e.key)?"main":"isolated"}function le(e){return e instanceof Error?e.message:String(e)}const yt=v($m()??[]),en=v(null),Va=v(null),Ya=v(""),sp=v("");let qs=null;Ya.subscribe(e=>{qs&&clearTimeout(qs),qs=setTimeout(()=>{sp.value=e},300)});const Ja=v(!1),Ax=v(!0),Td=v(!1),Gc=v(null),Oi=v(null),ft=B(()=>{const e=en.value;return!e||e==="main"?Le.value??"main":e}),Mx=B(()=>yt.value.find(e=>e.key===ft.value)??null);function vo(e){const t=ft.value;return!e||!t||e===t}function Ix(e){return e.label?e.label:e.displayName?e.displayName:e.key}function Rx(e){return ap(e)?"channel":Gn(e.key)?"main":"isolated"}const Fi=B(()=>{let e=yt.value;Va.value&&(e=e.filter(r=>Rx(r)===Va.value)),Ja.value||(e=e.filter(r=>!kx(r))),Ax.value||(e=e.filter(r=>!_x(r)));const t=sp.value.toLowerCase().trim();return t&&(e=e.filter(r=>{const a=Ix(r).toLowerCase(),o=(r.channel??"").toLowerCase(),l=(r.model??"").toLowerCase();return a.includes(t)||o.includes(t)||l.includes(t)})),[...e].sort((r,a)=>{const o=Gn(r.key),l=Gn(a.key);return o&&!l?-1:l&&!o?1:(a.updatedAt??0)-(r.updatedAt??0)})}),$x=B(()=>Ex(Fi.value));async function fs(e){Td.value=!0,Oi.value=null;try{const t=await H("sessions.list",{limit:e?.limit??100,...e});yt.value=t.sessions??[],Dm(yt.value)}catch(t){throw Oi.value=t instanceof Error?t.message:String(t),t}finally{Td.value=!1}}function Xa(e){en.value=e}function Dx(e){Va.value=e}function Ad(e){Ya.value=e}function Lx(){Ja.value=!Ja.value}function Nx(){yt.value=[],en.value=null,Oi.value=null}function Kc(e,t){yt.value=yt.value.map(r=>r.key===e?{...r,...t}:r)}function Ox(e){yt.value=yt.value.filter(t=>t.key!==e),en.value===e&&(en.value=null),Gc.value=null}function Fx(e){return new Promise(t=>{Gc.value=e,setTimeout(()=>{Ox(e),t()},ux)})}let Vc=null;function Px(){const e=Im();return e?(Vc=e.sessionKey,e.messages):[]}function zx(e,t){Rm(e,t),Vc=e}function Ux(){return Vc}const Oe=v(Px()),Pi=v(!1),Dl=v(null),Hx=v("off"),zi=v(!1),ip=B(()=>Oe.value.filter(tp)),jx=B(()=>ip.value.length),Nn=v(""),ps=v("");let Gs=null;Nn.subscribe(e=>{Gs&&clearTimeout(Gs),Gs=setTimeout(()=>{ps.value=e},300)});const qe=v(!1),Bo=v(null),xr=v(null),yr=v(null),cp=B(()=>xr.value!==null||yr.value!==null);function Bx(){xr.value=null,yr.value=null}const up=B(()=>{let e=Oe.value;const t=xr.value,r=yr.value;(t||r)&&(e=e.filter(o=>{const l=new Date(o.timestamp);if(t&&l<t)return!1;if(r){const s=new Date(r);if(s.setHours(23,59,59,999),l>s)return!1}return!0}));const a=ps.value.trim().toLowerCase();return a&&(e=e.filter(o=>o.content.toLowerCase().includes(a))),e}),Wx=B(()=>!ps.value.trim().toLowerCase()&&!cp.value?0:up.value.length),Ze=v([]),dp=B(()=>Ze.value.length>0),ce=v(new Map),Yc=v(!1),Md=v(""),Id=v([]);function Jc(e){for(const t of ce.value.values())if(t.sessionKey===e&&(t.status==="pending"||t.status==="streaming"))return t;return null}function qx(e){const t=Jc(e);return t?{isStreaming:!0,content:t.content,toolCalls:t.toolCalls}:{isStreaming:!1,content:"",toolCalls:[]}}function gs(){let e=!1;for(const t of ce.value.values())if(t.status==="pending"||t.status==="streaming"){e=!0,Md.value=t.content,Id.value=t.toolCalls;break}e||(Md.value="",Id.value=[]),Yc.value=e}function vs(e,t){const r=ce.value.get(e);if(!r)return;const a=new Map(ce.value);a.set(e,{...r,...t}),ce.value=a,gs()}function Xc(e,t){setTimeout(()=>{const r=new Map(ce.value);r.delete(e),ce.value=r,gs()},t)}function Zc(e,t,r){Oe.value=Oe.value.map(a=>a.id===e?{...a,status:t,error:r}:a)}function hp(){Oe.value=[],Dl.value=null}function Gx(e){Oe.value=e}function Ll(e){const t=Oe.value.findIndex(r=>r.id===e.id);if(t>=0){Oe.value=Oe.value.map((r,a)=>a===t?{...r,...e}:r);return}Oe.value=[...Oe.value,e]}function fp(e){Zc(e,"sending",void 0)}function Kx(e){Zc(e,"sent",void 0)}function Rd(e,t){Zc(e,"failed",t)}function Jr(e,t){const r=new Map(ce.value);r.set(e,{runId:e,sessionKey:t,startedAt:Date.now(),status:"pending",content:"",toolCalls:[]}),ce.value=r,gs()}function Ea(e,t,r=[],a){const o=ce.value.get(e);o&&vs(e,{status:"streaming",content:t,toolCalls:r,lastBlockStart:a??o.lastBlockStart})}function Nl(e,t){const r=ce.value.get(e),a=t?.content??r?.content??"";vs(e,{status:"complete",message:t,content:a}),t&&vo(r?.sessionKey)&&(r?.sessionKey==="unknown"&&Vx(t)||Ll(t)),Xc(e,sx)}function Vx(e){const t=Oe.value;for(let r=t.length-1;r>=0;r--){const a=t[r];if(a.role==="assistant"){if(Date.now()-a.timestamp>6e4)break;if(e.toolCalls&&a.toolCalls){const o=new Set(e.toolCalls.map(s=>s.id));if(a.toolCalls.some(s=>o.has(s.id))){const s=a.toolCalls.map(u=>{const d=e.toolCalls?.find(h=>h.id===u.id);return d?{...u,status:d.status,result:d.result,completedAt:d.completedAt}:u});let c=a.content;if(e.content&&!a.content.endsWith(e.content)){const u=a.content?`
4
+
5
+ `:"";c=a.content+u+e.content}return Oe.value=t.map(u=>u.id===a.id?{...u,content:c,toolCalls:s}:u),!0}}}}return!1}function Ui(e,t){vs(e,{status:"error",error:t}),Xc(e,ix)}function Yx(e){vs(e,{status:"aborted"}),Xc(e,cx)}function Jx(){ce.value=new Map,gs()}function $d(e){Ze.value=[...Ze.value,e]}function pp(e){Ze.value=Ze.value.filter(t=>t.id!==e)}function Xx(e,t,r){Ze.value=Ze.value.map(a=>a.id===e?{...a,content:t,images:r}:a)}const Hi=v(new Map);function Dd(e){return Hi.value.get(e)||""}function gp(e,t){const r=new Map(Hi.value);t?r.set(e,t):r.delete(e),Hi.value=r}function Zx(e){gp(e,"")}function Ol(e){if(typeof e=="string")return{text:e,toolCalls:[],images:[]};const t=[],r=[],a=[];let o=0;for(const l of e)switch(l.type){case"text":{t.push(l.text),o+=l.text.length;break}case"image":{if(l.source?.type==="base64"&&l.source.data)a.push({url:`data:${l.source.media_type};base64,${l.source.data}`,alt:"Image"});else if(l.data){const s=l.data.startsWith("data:")?l.data:`data:${l.mimeType||"image/png"};base64,${l.data}`;a.push({url:s,alt:"Image"})}break}case"tool_use":{r.push({id:l.id,name:l.name,args:l.input,status:"running",startedAt:Date.now(),insertedAtContentLength:o});break}case"toolCall":{r.push({id:l.id,name:l.name,args:l.arguments,status:"pending",insertedAtContentLength:o});break}case"tool_result":{const s=r.find(c=>c.id===l.id);s&&(s.result=l.content,s.status="complete",s.completedAt=Date.now());break}}return{text:t.join(`
6
+ `),toolCalls:r,images:a}}function Qx(e,t){const r=Ol(e.content),a=e.role==="toolResult"?"assistant":e.role;return{id:t,role:a,content:r.text,images:r.images.length>0?r.images:void 0,toolCalls:r.toolCalls.length>0?r.toolCalls:void 0,timestamp:e.timestamp??Date.now(),isStreaming:!1}}function e0(e,t){const r=new Map;for(const a of e)r.set(a.id,{...a});for(const a of t){const o=r.get(a.id);o?r.set(a.id,{...o,...a,startedAt:o.startedAt??a.startedAt}):r.set(a.id,a)}return Array.from(r.values())}const Ks=new Map;function t0(e){const t=new Map;for(const r of e)if(r.role==="toolResult"&&r.toolCallId){const a=Array.isArray(r.content)&&r.content[0]?.type==="text"?r.content[0].text:r.content;t.set(r.toolCallId,{content:a,isError:r.isError??!1})}return t}function n0(e,t){if(e.toolCalls)for(const r of e.toolCalls){const a=t.get(r.id);a&&(r.result=a.content,r.status=a.isError?"error":"complete",r.completedAt=Date.now())}}function r0(e,t){return e.role==="assistant"&&t.role==="assistant"&&Math.abs(t.timestamp-e.timestamp)<ox}function a0(e,t){const r=e.content.length,a=e.content&&t.content?`
7
+
8
+ `:"";if(t.toolCalls&&t.toolCalls.length>0){const o=t.toolCalls.map(l=>({...l,insertedAtContentLength:l.insertedAtContentLength!==void 0?r+a.length+l.insertedAtContentLength:void 0}));e.toolCalls=[...e.toolCalls??[],...o]}t.content&&(e.content=e.content?`${e.content}${a}${t.content}`:t.content),e.timestamp=Math.max(e.timestamp,t.timestamp)}async function Qc(e,t=lx){const r=Ks.get(e);if(r)return M.chat.debug("History load already in progress for session, waiting:",e),r;const a=o0(e,t);Ks.set(e,a);try{await a}finally{Ks.delete(e)}}async function o0(e,t){Pi.value=!0,Dl.value=null;try{const r=await H("chat.history",{sessionKey:e,limit:t}),a=t0(r.messages),o=[];for(let l=0;l<r.messages.length;l++){const s=r.messages[l];if(s.role==="toolResult")continue;const c=Qx(s,`hist_${l}_${Date.now()}`);n0(c,a);const u=o[o.length-1];if(u&&r0(u,c)){a0(u,c);continue}o.push(c)}Gx(o),zx(e,o),r.thinkingLevel&&(Hx.value=r.thinkingLevel)}catch(r){throw Dl.value=r instanceof Error?r.message:String(r),r}finally{Pi.value=!1}}function l0(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.runId=="string"&&typeof t.sessionKey=="string"&&typeof t.seq=="number"&&typeof t.state=="string"&&["delta","final","aborted","error"].includes(t.state)}function s0(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.runId=="string"&&typeof t.stream=="string"&&["lifecycle","assistant","tool","error","compaction"].includes(t.stream)&&typeof t.seq=="number"&&typeof t.ts=="number"}function vp(e,t,r){if(!e)return{content:t};if(t.startsWith(e))return{content:t};if(r!==void 0&&r>0&&r<=e.length){const o=e.slice(0,r),l=e.slice(r);if(t.startsWith(l))return{content:o+t,lastBlockStart:r};if(l.startsWith(t))return{content:e,lastBlockStart:r};if(t.length<l.length&&!l.includes(t)){const s=e.length+Ho.length;return{content:e+Ho+t,lastBlockStart:s}}return{content:o+t,lastBlockStart:r}}const a=e.length+Ho.length;return{content:e+Ho+t,lastBlockStart:a}}function i0(e,t){const r=e.trim().replace(/\s+/g," ");return r.length<=t?r:r.slice(0,t).trim()+"…"}async function c0(e,t){if(!rp(e))return;const r=i0(t,50);if(!r){M.chat.debug("autoRenameSession: empty message, skipping");return}try{M.chat.debug("autoRenameSession: renaming",{sessionKey:e,title:r}),await H("sessions.patch",{key:e,label:r}),Kc(e,{label:r}),M.chat.info("autoRenameSession: renamed session",{sessionKey:e,title:r})}catch(a){M.chat.error("autoRenameSession: failed",{sessionKey:e,error:a})}}let u0=0;function d0(e){if(!e||e.length===0)return;const t=[];for(const r of e)r.type==="image"&&t.push({url:r.content,alt:r.fileName});return t.length>0?t:void 0}function h0(){return`cove_${Date.now()}_${++u0}`}async function mp(e,t,r){const a=r?.messageId??h0(),o=`user_${a}`,l=r?.messageId!=null,s={id:o,role:"user",content:t,images:d0(r?.attachments),timestamp:Date.now(),isStreaming:!1,status:"sending",sessionKey:e};if(!$.value)return M.chat.info("Not connected, queuing message"),s.status="queued",$d(s),a;if(Yc.value&&!l)return M.chat.info("Currently streaming, queuing message"),s.status="queued",$d(s),a;l?fp(o):Ll(s),Jr(a,e);try{M.chat.debug("Sending message to session:",e);const c=await H("chat.send",{sessionKey:e,message:t,thinking:r?.thinking,timeoutMs:r?.timeoutMs,idempotencyKey:a,attachments:r?.attachments});if(c.status==="error"){const u=c.summary??"Unknown error";throw Ui(a,u),Rd(o,u),new Error(u)}if(Kx(o),!l&&rp(e)){const u=yt.value.find(h=>h.key===e),d=i("newChatModal.title");u?.label===d&&c0(e,t).catch(h=>{M.chat.warn("Auto-rename failed:",h instanceof Error?h.message:String(h))})}return a}catch(c){const u=c instanceof Error?c.message:String(c);throw M.chat.error("chat.send failed:",c),Ui(a,u),Rd(o,u),c}}async function eu(e){if(!e.sessionKey){M.chat.warn("Cannot resend message - missing sessionKey:",e.id);return}pp(e.id),Oe.value.find(a=>a.id===e.id)?fp(e.id):Ll({...e,status:"sending"});const r=e.id.replace(/^user_/,"");await mp(e.sessionKey,e.content,{messageId:r})}async function ji(e){if(Yc.value){M.chat.debug("Still streaming, not processing queue");return}const t=Ze.value.find(r=>r.sessionKey===e);if(!t){M.chat.debug("No queued messages for session");return}M.chat.info("Processing next queued message:",t.id);try{await eu(t)}catch(r){M.chat.error("Failed to send queued message:",r)}}async function f0(e){let t=Ze.value.find(r=>r.id===e);if(t||(t=Oe.value.find(r=>r.id===e&&r.status==="failed")),!t){M.chat.warn("Cannot retry message - not found:",e);return}await eu(t)}async function p0(){const e=[...Ze.value];if(e.length!==0){M.chat.info(`Processing ${e.length} queued messages`);for(const t of e)try{await eu(t)}catch(r){M.chat.error("Failed to send queued message:",r)}}}async function g0(e){await H("chat.abort",{sessionKey:e})}let Ta=null,Aa=null;function v0(){return Ta&&Aa||(M.chat.info("Subscribing to chat events"),Ta=Ni("chat",e=>{if(!l0(e)){M.chat.warn("Invalid chat event payload:",e);return}k0(e)}),Aa=Ni("agent",e=>{if(!s0(e)){M.chat.warn("Invalid agent event payload:",e);return}const t=e;t.stream==="tool"?w0(t):t.stream==="lifecycle"?t.data?.phase==="start"?m0(t):(t.data?.phase==="end"||t.data?.phase==="error")&&b0(t):t.stream==="compaction"?x0(t):t.stream==="assistant"&&y0(t)})),Bi}function Bi(){Ta&&(Ta(),Ta=null),Aa&&(Aa(),Aa=null)}function m0(e){const{runId:t,sessionKey:r}=e;if(!vo(r))return;!ce.value.get(t)&&r&&(M.chat.debug("Creating run on-the-fly for lifecycle start:",t,"session:",r),Jr(t,r))}function b0(e){const{runId:t,sessionKey:r}=e;if(!vo(r))return;const a=ce.value.get(t);if(a&&(a.status==="pending"||a.status==="streaming")){M.chat.debug("Completing run via lifecycle end:",t,"phase:",e.data?.phase);const o=!a.content;if(a.content){const l={id:`assistant_${t}`,role:"assistant",content:a.content,toolCalls:a.toolCalls?.length?a.toolCalls:void 0,timestamp:Date.now()};Nl(t,l)}else Nl(t);if(a.sessionKey&&(setTimeout(()=>ji(a.sessionKey),100),o)){const l=a.sessionKey;setTimeout(()=>{Qc(l).catch(s=>{M.chat.warn("Failed to refresh history after heartbeat:",s)})},500)}}}function x0(e){const t=e.data?.phase;M.chat.info("Compaction event:",t),t==="start"?zi.value=!0:t==="end"&&(zi.value=!1)}function y0(e){const{runId:t,sessionKey:r,data:a}=e,o=typeof a?.text=="string"?a.text:null;if(!o||!vo(r))return;let l=ce.value.get(t);if(!l&&r&&(M.chat.debug("Creating run for assistant stream:",t,"session:",r),Jr(t,r),l=ce.value.get(t)),!l)return;const{content:s,lastBlockStart:c}=vp(l.content,o,l.lastBlockStart);Ea(t,s,l.toolCalls,c)}function w0(e){const{runId:t,sessionKey:r,data:a}=e;if(!a||!vo(r))return;M.chat.debug("Tool event received",{runId:t,phase:a.phase,toolCallId:a.toolCallId,toolName:a.name});let o=ce.value.get(t);if(!o&&(M.chat.debug("Creating run on-the-fly for tool event:",t,"session:",r),Jr(t,r??"unknown"),o=ce.value.get(t),!o))return;const l=a.toolCallId??`tool_${Date.now()}`,s=a.name??"unknown",c=[...o.toolCalls];M.chat.debug("Tool event state before processing",{runId:t,currentContentLen:o.content.length,existingToolCallsCount:c.length,existingToolCallIds:c.map(d=>d.id)});const u=()=>{let d=c.findIndex(h=>h.id===l);return d<0&&(M.chat.debug("Creating missing tool call:",l),c.push({id:l,name:s,status:"running",startedAt:Date.now(),insertedAtContentLength:o.content.length,contentSnapshotAtStart:o.content}),d=c.length-1),d};switch(a.phase){case"start":{if(c.some(d=>d.id===l)){M.chat.debug("Tool start skipped - duplicate",{toolCallId:l});return}setTimeout(()=>{const d=ce.value.get(t);if(!d){M.chat.warn("Tool start deferred - run no longer exists",{runId:t,toolCallId:l});return}const h=[...d.toolCalls];if(h.some(g=>g.id===l)){M.chat.debug("Tool start deferred skipped - duplicate",{toolCallId:l});return}const f={id:l,name:s,args:a.args,status:"running",startedAt:Date.now(),insertedAtContentLength:d.content.length,contentSnapshotAtStart:d.content};M.chat.debug("Tool start processed",{toolCallId:l,toolName:s,insertedAtContentLength:f.insertedAtContentLength,contentSnapshotLen:d.content.length}),h.push(f),Ea(t,d.content,h)},0);break}case"update":{const d=u();c[d]={...c[d],result:a.partialResult},Ea(t,o.content,c);break}case"result":{const d=u();c[d]={...c[d],result:a.result,status:a.isError?"error":"complete",completedAt:Date.now()},Ea(t,o.content,c);break}}}function k0(e){const{runId:t,state:r,errorMessage:a}=e;switch(M.chat.debug("Chat event:",r,t,"session:",e.sessionKey),r){case"delta":_0(e);break;case"final":S0(e);break;case"aborted":Yx(t);break;case"error":Ui(t,a??"Unknown error");break}}function _0(e){const{runId:t,sessionKey:r,message:a}=e;if(!a)return;const o=Ol(a.content);let l=ce.value.get(t);if(!l&&(M.chat.debug("Creating run on-the-fly for delta:",t,"session:",r),Jr(t,r),l=ce.value.get(t),!l)||o.toolCalls.length===0)return;M.chat.debug("Delta event - processing tool calls only",{runId:t,parsedToolCallsCount:o.toolCalls.length,existingToolCallsCount:l.toolCalls.length});const s=e0(l.toolCalls,o.toolCalls);Ea(t,l.content,s,l.lastBlockStart)}function S0(e){const{runId:t,sessionKey:r,message:a}=e;let o=ce.value.get(t);if(M.chat.debug("Final event received",{runId:t,hasExistingRun:!!o,existingContentLen:o?.content?.length,existingToolCallsCount:o?.toolCalls?.length,hasMessage:!!a}),o||(M.chat.debug("Creating run on-the-fly for final:",t,"session:",r),Jr(t,r),o=ce.value.get(t)),!o){M.chat.warn("Final event with no run and couldn't create one:",t);return}if(a?.content){const d=Ol(a.content);if(d.text&&(ep(d.text)||jc({role:"assistant",content:d.text}))){M.chat.debug("Heartbeat/no-reply detected, completing run without message:",t),Nl(t),setTimeout(()=>ji(r),100);return}}let l=o?.content??"",s=[];if(a?.content){const d=Ol(a.content);M.chat.debug("Final message parsed",{runId:t,parsedTextLen:d.text.length,parsedToolCallsCount:d.toolCalls.length,existingContentLen:l.length,willUseFinaContent:d.text.length>=l.length}),d.text.length>=l.length?(l=d.text,s=d.toolCalls):d.text&&(M.chat.debug("Final merging partial text",{existingLen:l.length,parsedLen:d.text.length}),l=vp(l,d.text,o?.lastBlockStart).content)}M.chat.debug("Final content determined",{runId:t,finalContentLen:l.length,finalContentPreview:l.slice(-200)});const c=o?.toolCalls?.map(d=>{const h={...d};(h.status==="running"||h.status==="pending")&&(h.status="complete",h.completedAt=Date.now());const f=s.find(g=>g.id===d.id);return f?.insertedAtContentLength!==void 0&&(h.insertedAtContentLength=f.insertedAtContentLength),delete h.contentSnapshotAtStart,h}),u={id:`assistant_${t}`,role:"assistant",content:l,toolCalls:c?.length?c:void 0,timestamp:a?.timestamp??Date.now()};Nl(t,u),setTimeout(()=>{ji(r)},100)}async function tu(e){v0(),await Qc(e)}function C0(){Bi(),hp()}const E0="Assistant",T0="🤖",A0="You",Wi=v(E0),bp=v(T0),M0=v(null),I0=v(A0),R0=v(null),Ld=v(!1);async function nu(e){Ld.value=!0;try{const r=await H("agent.identity.get",e?{sessionKey:e}:{});r&&(r.name&&(Wi.value=r.name),r.avatar&&(bp.value=r.avatar),r.agentId&&(M0.value=r.agentId),M.ui.info("Loaded assistant identity:",Wi.value))}catch(t){M.ui.error("Failed to load assistant identity:",t)}finally{Ld.value=!1}}const $0=300*1e3,xp=v(N0()),Nd=v(!1),Od=v(null);let hl=null;const ru=B(()=>{const e=xp.value;return e?e.providers.find(t=>t.provider==="anthropic")??null:null}),D0=B(()=>{const e=ru.value;return e!==null&&e.windows.length>0&&!e.error}),L0=B(()=>{const e=ru.value;if(!e||e.windows.length===0)return null;const t=e.windows.find(r=>r.label==="Week");return t||e.windows[0]});function N0(){const e=Lm();return e?(M.usage.debug("Loaded cached usage"),e):null}async function Fd(){if(!$.value){M.usage.debug("Skipping usage fetch - not connected");return}Nd.value=!0,Od.value=null;try{const e=await xa.send("usage.status");xp.value=e,Nm(e),M.usage.debug("Usage fetched:",e)}catch(e){const t=e instanceof Error?e.message:"Failed to fetch usage";Od.value=t,M.usage.error("Usage fetch failed:",t)}finally{Nd.value=!1}}function au(){yp(),Fd(),hl=setInterval(()=>{Fd()},$0),M.usage.debug("Usage polling started")}function yp(){hl&&(clearInterval(hl),hl=null,M.usage.debug("Usage polling stopped"))}let Pd=!1;$.subscribe(e=>{Pd&&!e&&yp(),Pd=e});const Kn=v([]),wp=v(null),zd=v(!1),Ud=v(null),O0=B(()=>{const e=new Map;for(const t of Kn.value){const r=t.provider;e.has(r)||e.set(r,[]),e.get(r).push(t)}return e});async function ou(){zd.value=!0,Ud.value=null;try{const[e,t]=await Promise.all([H("models.list",{}),H("status",{}).catch(()=>null)]);Kn.value=e.models??[],M.ui.debug("Loaded models:",Kn.value.length);const r=t?.sessions?.defaults?.model;r&&(wp.value=r,M.ui.debug("Default model:",r))}catch(e){Ud.value=e instanceof Error?e.message:String(e),M.ui.error("Failed to load models:",e)}finally{zd.value=!1}}function F0(e){return Kn.value.find(t=>t.id===e)}function P0(e){const t=F0(e);return t?t.name:e.replace(/^anthropic\//,"").replace(/^openai\//,"").replace(/^claude-/,"").replace(/^gpt-/,"")}const Hn=v([]),Za=v("main"),z0=v("main"),Vs=v(!1),Hd=v(null),U0=e=>Hn.value.find(t=>t.id===e);B(()=>U0(Za.value)||Hn.value[0]);B(()=>Hn.value.length>0);const qi=B(()=>Hn.value.map(e=>({value:e.id,label:`${e.identity?.emoji||"🤖"} ${e.identity?.name||e.name||e.id}`})));async function kp(){if(Vs.value){M.gateway.debug("loadAgents: already loading, skipping");return}Vs.value=!0,Hd.value=null;try{M.gateway.debug("loadAgents: fetching from gateway");const e=await H("agents.list",{});if(e&&Array.isArray(e.agents))Hn.value=e.agents,Za.value=e.defaultId||"main",z0.value=e.mainKey||"main",M.gateway.info("loadAgents: loaded",{count:e.agents.length,defaultId:e.defaultId,agents:e.agents.map(t=>t.id)});else throw new Error("Invalid response from agents.list")}catch(e){const t=e instanceof Error?e.message:"Failed to load agents";M.gateway.error("loadAgents: error",{error:t}),Hd.value=t,Hn.value.length===0&&(Hn.value=[{id:"main",identity:{name:"Main",emoji:"🤖"}}],Za.value="main")}finally{Vs.value=!1}}const H0=200,j0=480,On=288,lu=1024,B0=typeof window<"u"&&window.innerWidth<lu,at=v(!B0);function su(){window.innerWidth<lu&&(at.value=!1)}const fl=v(Am()),Ys=v(!1);Ie(()=>{Mm(fl.value)});const _p=v("/"),Js=v(!1),W0=20,q0=100,jd=On*.3,G0=75,hn=v(null),rt=v(!1);function K0(){z(()=>{const e=()=>window.innerWidth<lu;let t=0,r=0,a=!1,o=!1;const l=u=>{if(!e())return;const d=u.touches[0];t=d.clientX,r=d.clientY;const h=d.clientX>=W0&&d.clientX<=q0;a=h,o=at.value,(h||o)&&(hn.value=o?On:0)},s=u=>{if(!e()||!a&&!o)return;const d=u.touches[0],h=d.clientX-t;if(Math.abs(d.clientY-r)>G0&&!rt.value){hn.value=null,a=!1;return}if((Math.abs(h)>10||rt.value)&&(rt.value=!0,u.preventDefault()),!rt.value)return;let g;o?g=On+h:g=h,g=Math.max(0,Math.min(On,g)),hn.value=g},c=()=>{if(!rt.value){hn.value=null,a=!1,o=!1;return}const u=hn.value??0;o?at.value=u>On-jd:at.value=u>jd,hn.value=null,rt.value=!1,a=!1,o=!1};return document.addEventListener("touchstart",l,{passive:!0}),document.addEventListener("touchmove",s,{passive:!1}),document.addEventListener("touchend",c,{passive:!0}),document.addEventListener("touchcancel",c,{passive:!0}),()=>{document.removeEventListener("touchstart",l),document.removeEventListener("touchmove",s),document.removeEventListener("touchend",c),document.removeEventListener("touchcancel",c)}},[])}function V0({direction:e,onResizeStart:t,onResize:r,onResizeEnd:a,class:o=""}){const l=q(0),s=q(!1),c=q({move:null,up:null});z(()=>()=>{c.current.move&&document.removeEventListener("mousemove",c.current.move),c.current.up&&document.removeEventListener("mouseup",c.current.up),s.current&&(document.body.style.cursor="",document.body.style.userSelect="")},[]);const u=K(h=>{h.preventDefault(),s.current=!0,l.current=e==="horizontal"?h.clientX:h.clientY,t?.();const f=m=>{if(!s.current)return;const y=e==="horizontal"?m.clientX:m.clientY,C=y-l.current;l.current=y,r(C)},g=()=>{s.current=!1,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",g),c.current.move=null,c.current.up=null,document.body.style.cursor="",document.body.style.userSelect="",a?.()};c.current.move=f,c.current.up=g,document.addEventListener("mousemove",f),document.addEventListener("mouseup",g),document.body.style.cursor=e==="horizontal"?"col-resize":"row-resize",document.body.style.userSelect="none"},[e,r,t,a]),d=e==="horizontal";return n("div",{onMouseDown:u,class:`
9
+ ${d?"w-1 cursor-col-resize hover:w-1.5":"h-1 cursor-row-resize hover:h-1.5"}
10
+ bg-transparent hover:bg-[var(--color-accent)]/30 active:bg-[var(--color-accent)]/50
11
+ transition-all duration-150 ease-out
12
+ flex-shrink-0
13
+ ${o}
14
+ `,role:"separator","aria-orientation":d?"horizontal":"vertical","aria-label":"Resize handle"})}const Y0=(...e)=>e.filter((t,r,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===r).join(" ").trim();const Bd=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const J0=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,a)=>a?a.toUpperCase():r.toLowerCase());const Wd=e=>{const t=J0(e);return t.charAt(0).toUpperCase()+t.slice(1)};var X0={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};const Z0=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const Q0=({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:a,children:o,iconNode:l,class:s="",...c})=>nn("svg",{...X0,width:String(t),height:t,stroke:e,"stroke-width":a?Number(r)*24/Number(t):r,class:["lucide",s].join(" "),...!o&&!Z0(c)&&{"aria-hidden":"true"},...c},[...l.map(([u,d])=>nn(u,d)),...Wn(o)]);const I=(e,t)=>{const r=({class:a="",className:o="",children:l,...s})=>nn(Q0,{...s,iconNode:t,class:Y0(`lucide-${Bd(Wd(e))}`,`lucide-${Bd(e)}`,a,o)},l);return r.displayName=Wd(e),r};const xn=I("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"}]]);const ey=I("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);const iu=I("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const ms=I("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const ty=I("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);const ny=I("book-open",[["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"}]]);const ry=I("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"}]]);const qd=I("box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const ay=I("bug",[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]]);const mo=I("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"}]]);const oy=I("chart-column",[["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"}]]);const on=I("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const wt=I("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const qt=I("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const bs=I("circle-alert",[["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"}]]);const bo=I("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const xo=I("circle-x",[["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"}]]);const ly=I("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const me=I("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const sy=I("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);const xs=I("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"}]]);const Fl=I("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);const iy=I("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"}]]);const Ht=I("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);const Sp=I("ellipsis-vertical",[["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"}]]);const yo=I("external-link",[["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"}]]);const Cp=I("eye-off",[["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"}]]);const Ep=I("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"}]]);const jt=I("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const cy=I("folder-cog",[["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3",key:"128dxu"}],["path",{d:"m14.305 19.53.923-.382",key:"3m78fa"}],["path",{d:"m15.228 16.852-.923-.383",key:"npixar"}],["path",{d:"m16.852 15.228-.383-.923",key:"5xggr7"}],["path",{d:"m16.852 20.772-.383.924",key:"dpfhf9"}],["path",{d:"m19.148 15.228.383-.923",key:"1reyyz"}],["path",{d:"m19.53 21.696-.382-.924",key:"1goivc"}],["path",{d:"m20.772 16.852.924-.383",key:"htqkph"}],["path",{d:"m20.772 19.148.924.383",key:"9w9pjp"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);const uy=I("folder-open",[["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"}]]);const Pl=I("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"}]]);const dy=I("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]);const hy=I("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"}]]);const Bt=I("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"}]]);const Tp=I("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);const Gd=I("hard-drive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);const Ap=I("hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const Mp=I("heart",[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]]);const wr=I("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"}]]);const ys=I("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);const ws=I("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"}]]);const Gi=I("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:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);const fy=I("layout-grid",[["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"}]]);const py=I("layout-dashboard",[["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"}]]);const Ip=I("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"}]]);const Rp=I("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const Kd=I("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);const gy=I("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);const vy=I("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);const my=I("message-circle",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]);const an=I("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);const vt=I("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"}]]);const Vd=I("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);const Xs=I("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"}]]);const by=I("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);const xy=I("palette",[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["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:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]);const yy=I("panels-top-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);const $p=I("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"}]]);const wy=I("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"}]]);const cu=I("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);const Rr=I("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const uu=I("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"}]]);const zl=I("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);const ky=I("rectangle-ellipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);const He=I("refresh-cw",[["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"}]]);const du=I("rotate-ccw",[["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"}]]);const _y=I("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"}]]);const Pe=I("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const Dp=I("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"}]]);const Vn=I("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"}]]);const Lp=I("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);const hu=I("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const Sy=I("shield-off",[["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"}]]);const ks=I("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"}]]);const Cy=I("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);const $r=I("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);const fu=I("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);const Ey=I("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const Np=I("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"}]]);const Yd=I("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"}]]);const Ty=I("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);const Op=I("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"}]]);const Gt=I("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);const Jd=I("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);const tr=I("triangle-alert",[["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"}]]);const _s=I("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);const Ay=I("volume-2",[["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"}]]);const My=I("wand-sparkles",[["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"}]]);const Iy=I("webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);const Fp=I("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);const Ul=I("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);const Ry=I("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);const Xr=I("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const ln=I("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"}]]);function Pp(e,t){for(var r in t)e[r]=t[r];return e}function Xd(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var a in t)if(a!=="__source"&&e[a]!==t[a])return!0;return!1}function Zd(e,t){this.props=e,this.context=t}(Zd.prototype=new Xe).isPureReactComponent=!0,Zd.prototype.shouldComponentUpdate=function(e,t){return Xd(this.props,e)||Xd(this.state,t)};var Qd=W.__b;W.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Qd&&Qd(e)};var $y=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function wo(e){function t(r){var a=Pp({},r);return delete a.ref,e(a,r.ref||null)}return t.$$typeof=$y,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Dy=W.__e;W.__e=function(e,t,r,a){if(e.then){for(var o,l=t;l=l.__;)if((o=l.__c)&&o.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),o.__c(e,t)}Dy(e,t,r,a)};var eh=W.unmount;function zp(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(a){typeof a.__c=="function"&&a.__c()}),e.__c.__H=null),(e=Pp({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(a){return zp(a,t,r)})),e}function Up(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(a){return Up(a,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function Zs(){this.__u=0,this.o=null,this.__b=null}function Hp(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Wo(){this.i=null,this.l=null}W.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),eh&&eh(e)},(Zs.prototype=new Xe).__c=function(e,t){var r=t.__c,a=this;a.o==null&&(a.o=[]),a.o.push(r);var o=Hp(a.__v),l=!1,s=function(){l||(l=!0,r.__R=null,o?o(c):c())};r.__R=s;var c=function(){if(!--a.__u){if(a.state.__a){var u=a.state.__a;a.__v.__k[0]=Up(u,u.__c.__P,u.__c.__O)}var d;for(a.setState({__a:a.__b=null});d=a.o.pop();)d.forceUpdate()}};a.__u++||32&t.__u||a.setState({__a:a.__b=a.__v.__k[0]}),e.then(s,s)},Zs.prototype.componentWillUnmount=function(){this.o=[]},Zs.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),a=this.__v.__k[0].__c;this.__v.__k[0]=zp(this.__b,r,a.__O=a.__P)}this.__b=null}var o=t.__a&&nn(Y,null,e.fallback);return o&&(o.__u&=-33),[nn(Y,null,t.__a?null:e.children),o]};var th=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};function Ly(e){return this.getChildContext=function(){return e.context},e.children}function Ny(e){var t=this,r=e.h;if(t.componentWillUnmount=function(){Mi(null,t.v),t.v=null,t.h=null},t.h&&t.h!==r&&t.componentWillUnmount(),!t.v){for(var a=t.__v;a!==null&&!a.__m&&a.__!==null;)a=a.__;t.h=r,t.v={nodeType:1,parentNode:r,childNodes:[],__k:{__m:a.__m},contains:function(){return!0},insertBefore:function(o,l){this.childNodes.push(o),t.h.insertBefore(o,l)},removeChild:function(o){this.childNodes.splice(this.childNodes.indexOf(o)>>>1,1),t.h.removeChild(o)}}}Mi(nn(Ly,{context:t.context},e.__v),t.v)}function pu(e,t){var r=nn(Ny,{__v:e,h:t});return r.containerInfo=t,r}(Wo.prototype=new Xe).__a=function(e){var t=this,r=Hp(t.__v),a=t.l.get(e);return a[0]++,function(o){var l=function(){t.props.revealOrder?(a.push(o),th(t,e,a)):o()};r?r(l):l()}},Wo.prototype.render=function(e){this.i=null,this.l=new Map;var t=Wn(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},Wo.prototype.componentDidUpdate=Wo.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){th(e,r,t)})};var Oy=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Fy=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Py=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,zy=/[A-Z0-9]/g,Uy=typeof document<"u",Hy=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};Xe.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Xe.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var nh=W.event;function jy(){}function By(){return this.cancelBubble}function Wy(){return this.defaultPrevented}W.event=function(e){return nh&&(e=nh(e)),e.persist=jy,e.isPropagationStopped=By,e.isDefaultPrevented=Wy,e.nativeEvent=e};var qy={enumerable:!1,configurable:!0,get:function(){return this.class}},rh=W.vnode;W.vnode=function(e){typeof e.type=="string"&&(function(t){var r=t.props,a=t.type,o={},l=a.indexOf("-")===-1;for(var s in r){var c=r[s];if(!(s==="value"&&"defaultValue"in r&&c==null||Uy&&s==="children"&&a==="noscript"||s==="class"||s==="className")){var u=s.toLowerCase();s==="defaultValue"&&"value"in r&&r.value==null?s="value":s==="download"&&c===!0?c="":u==="translate"&&c==="no"?c=!1:u[0]==="o"&&u[1]==="n"?u==="ondoubleclick"?s="ondblclick":u!=="onchange"||a!=="input"&&a!=="textarea"||Hy(r.type)?u==="onfocus"?s="onfocusin":u==="onblur"?s="onfocusout":Py.test(s)&&(s=u):u=s="oninput":l&&Fy.test(s)?s=s.replace(zy,"-$&").toLowerCase():c===null&&(c=void 0),u==="oninput"&&o[s=u]&&(s="oninputCapture"),o[s]=c}}a=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=Wn(r.children).forEach(function(d){d.props.selected=o.value.indexOf(d.props.value)!=-1})),a=="select"&&o.defaultValue!=null&&(o.value=Wn(r.children).forEach(function(d){d.props.selected=o.multiple?o.defaultValue.indexOf(d.props.value)!=-1:o.defaultValue==d.props.value})),r.class&&!r.className?(o.class=r.class,Object.defineProperty(o,"className",qy)):(r.className&&!r.class||r.class&&r.className)&&(o.class=o.className=r.className),t.props=o})(e),e.$$typeof=Oy,rh&&rh(e)};var ah=W.__r;W.__r=function(e){ah&&ah(e),e.__c};var oh=W.diffed;W.diffed=function(e){oh&&oh(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value)};const Gy={xs:{container:"w-3 h-3",thickness:"2px"},sm:{container:"w-4 h-4",thickness:"2px"},md:{container:"w-6 h-6",thickness:"3px"},lg:{container:"w-8 h-8",thickness:"3px"}};function ue({size:e="md",label:t,class:r}){const a=Gy[e];return n("span",{class:`cove-spinner ${a.container} ${r||""}`,style:{"--spinner-thickness":a.thickness},role:"status","aria-label":t||i("accessibility.loading"),children:n("span",{class:"sr-only",children:t||i("accessibility.loading")})})}const jp=Mf(null);function Ky({children:e}){const[t,r]=j(null),[a,o]=j(!1),l=q(null),s=q(null);z(()=>()=>{l.current&&cancelAnimationFrame(l.current),s.current&&clearTimeout(s.current)},[]);const c=K(h=>{s.current&&(clearTimeout(s.current),s.current=null),o(!0),l.current=requestAnimationFrame(()=>{r({...h,isVisible:!0}),l.current=null})},[]),u=K(()=>{l.current&&(cancelAnimationFrame(l.current),l.current=null),r(h=>h?{...h,isVisible:!1}:null),s.current=window.setTimeout(()=>{o(!1),r(null),s.current=null},150)},[]),d=K(h=>{r(f=>f?{...f,triggerRect:h}:null)},[]);return z(()=>{if(!a)return;const h=f=>{f.key==="Escape"&&u()};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[a,u]),n(jp.Provider,{value:{show:c,hide:u,update:d},children:[e,a&&pu(n(Vy,{state:t}),document.body)]})}function Vy({state:e}){const t=q(null),[r,a]=j("top"),[o,l]=j({top:0,left:0});if(z(()=>{if(!e?.triggerRect||!t.current)return;const d=t.current.getBoundingClientRect(),{adjustedPlacement:h,pos:f}=Yy(e.triggerRect,d,e.placement);a(h),l(f)},[e?.triggerRect,e?.placement,e?.content]),!e?.triggerRect)return null;const{content:s,isVisible:c}=e;return n("div",{ref:t,role:"tooltip",class:`
15
+ fixed z-[9999] pointer-events-none
16
+ transition-opacity duration-150
17
+ ${c?"opacity-100":"opacity-0"}
18
+ `,style:{top:`${o.top}px`,left:`${o.left}px`},children:[n("div",{class:`
19
+ px-2.5 py-1.5 text-xs font-medium
20
+ bg-[var(--color-bg-elevated)] text-[var(--color-text-primary)]
21
+ rounded-lg shadow-lg
22
+ border border-[var(--color-border)]
23
+ whitespace-nowrap
24
+ `,children:s}),n("div",{class:`
25
+ absolute w-0 h-0 border-[6px]
26
+ ${Jy(r)}
27
+ `})]})}function Yy(e,t,r){const l={width:window.innerWidth,height:window.innerHeight},s={top:e.top,bottom:l.height-e.bottom,left:e.left,right:l.width-e.right},c={top:s.top>=t.height+8+8,bottom:s.bottom>=t.height+8+8,left:s.left>=t.width+8+8,right:s.right>=t.width+8+8};let u=r;r==="top"&&!c.top?u=c.bottom?"bottom":c.left?"left":c.right?"right":"bottom":r==="bottom"&&!c.bottom?u=c.top?"top":c.left?"left":c.right?"right":"top":r==="left"&&!c.left?u=c.right?"right":c.top?"top":c.bottom?"bottom":"right":r==="right"&&!c.right&&(u=c.left?"left":c.top?"top":c.bottom?"bottom":"left");let d,h;switch(u){case"top":d=e.top-t.height-8,h=e.left+e.width/2-t.width/2;break;case"bottom":d=e.bottom+8,h=e.left+e.width/2-t.width/2;break;case"left":d=e.top+e.height/2-t.height/2,h=e.left-t.width-8;break;case"right":d=e.top+e.height/2-t.height/2,h=e.right+8;break}return h=Math.max(8,Math.min(h,l.width-t.width-8)),d=Math.max(8,Math.min(d,l.height-t.height-8)),{adjustedPlacement:u,pos:{top:d,left:h}}}function Jy(e){switch(e){case"top":return"top-full left-1/2 -translate-x-1/2 border-t-[var(--color-bg-elevated)] border-x-transparent border-b-transparent";case"bottom":return"bottom-full left-1/2 -translate-x-1/2 border-b-[var(--color-bg-elevated)] border-x-transparent border-t-transparent";case"left":return"left-full top-1/2 -translate-y-1/2 border-l-[var(--color-bg-elevated)] border-y-transparent border-r-transparent";case"right":return"right-full top-1/2 -translate-y-1/2 border-r-[var(--color-bg-elevated)] border-y-transparent border-l-transparent"}}const Xy=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0;function Zr({content:e,placement:t="top",delay:r=300,children:a,class:o,disabled:l=!1}){const s=Ev(jp),c=q(null),u=q(null),d=l||Xy(),h=K(()=>{d||!s||(c.current=window.setTimeout(()=>{if(u.current){const g=u.current.getBoundingClientRect();s.show({content:e,placement:t,triggerRect:g})}},r))},[s,e,t,r,d]),f=K(()=>{c.current&&(clearTimeout(c.current),c.current=null),s?.hide()},[s]);return z(()=>()=>{c.current&&clearTimeout(c.current)},[]),s?n("div",{ref:u,class:`inline-flex ${o||""}`,onMouseEnter:h,onMouseLeave:f,onFocus:h,onBlur:f,children:a}):n("div",{class:`inline-flex ${o||""}`,children:a})}const Zy={sm:{button:"p-1.5",icon:"w-4 h-4"},md:{button:"p-2",icon:"w-5 h-5"},lg:{button:"p-3",icon:"w-6 h-6"}},Qy={default:`
28
+ text-[var(--color-text-secondary)]
29
+ hover:bg-[var(--color-bg-secondary)] hover:text-[var(--color-text-primary)]
30
+ focus-visible:ring-[var(--color-accent)]
31
+ `,ghost:`
32
+ text-[var(--color-text-muted)]
33
+ hover:bg-[var(--color-bg-primary)] hover:text-[var(--color-text-secondary)]
34
+ focus-visible:ring-[var(--color-accent)]
35
+ `,danger:`
36
+ text-[var(--color-text-secondary)]
37
+ hover:bg-[var(--color-error)]/10 hover:text-[var(--color-error)]
38
+ focus-visible:ring-[var(--color-error)]
39
+ `},Q=wo(({icon:e,label:t,size:r="md",variant:a="default",loading:o=!1,disabled:l,showTooltip:s=!0,tooltipPlacement:c="top",class:u,...d},h)=>{const f=l||o,g=Zy[r],m=n("button",{ref:h,type:"button",disabled:f,"aria-label":t,class:`
40
+ inline-flex items-center justify-center cursor-pointer
41
+ rounded-md transition-all duration-200 ease-out
42
+ hover:scale-105 active:scale-95
43
+ focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2
44
+ disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100 disabled:active:scale-100
45
+ ${g.button}
46
+ ${Qy[a]}
47
+ ${u||""}
48
+ `,...d,children:o?n(ue,{size:"sm"}):n("span",{class:`${g.icon} flex items-center justify-center [&>svg]:w-full [&>svg]:h-full`,"aria-hidden":"true",children:e})});return s&&t?n(Zr,{content:t,placement:c,delay:400,children:m}):m});Q.displayName="IconButton";const e1={default:"bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)]",success:"bg-[var(--color-success)]/15 text-[var(--color-success)]",warning:"bg-[var(--color-warning)]/15 text-[var(--color-warning)]",error:"bg-[var(--color-error)]/15 text-[var(--color-error)]",info:"bg-[var(--color-accent)]/15 text-[var(--color-accent)]"},t1={default:"bg-[var(--color-text-muted)]",success:"bg-[var(--color-success)]",warning:"bg-[var(--color-warning)]",error:"bg-[var(--color-error)]",info:"bg-[var(--color-accent)]"},n1={sm:"px-1.5 py-0.5 text-xs",md:"px-2 py-1 text-xs"};function X({variant:e="default",size:t="md",dot:r=!1,children:a,class:o}){return n("span",{class:`
49
+ inline-flex items-center gap-1.5
50
+ font-medium rounded-full
51
+ ${e1[e]}
52
+ ${n1[t]}
53
+ ${o||""}
54
+ `,children:[r&&n("span",{class:`w-1.5 h-1.5 rounded-full ${t1[e]}`,"aria-hidden":"true"}),a]})}function Qr(e,t,r=!0){z(()=>{if(!r)return;const a=o=>{const l=Array.isArray(e)?e:[e],s=o.target;l.some(u=>u.current?.contains(s))||t()};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[e,t,r])}function Bp(){const e=jx.value,[t,r]=j(!1),[a,o]=j(qm),l=q(null),s=q(null),c=Math.floor(e/2),u=Math.max(0,c-a),d=K(()=>{o(c),Gm(c),r(!1)},[c]);Qr([s,l],d,t);const f=ip.value.filter(jc).slice(-10).reverse();return n("div",{class:"relative inline-block",ref:s,children:[n(Q,{icon:n(Mp,{class:"w-4 h-4"}),label:i("chat.heartbeats",{count:e}),onClick:()=>t?d():r(!0),variant:"ghost",size:"sm",class:"border border-[var(--color-border)] bg-[var(--color-bg-surface)]"}),u>0&&n(X,{variant:"default",class:"absolute -top-1.5 -right-1.5 min-w-[1.25rem] h-5 text-xs px-1 pointer-events-none",children:u}),t&&n("div",{ref:l,class:"absolute top-full left-0 mt-1 z-50 min-w-[240px] max-h-[300px] overflow-y-auto rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)] shadow-lg",children:[n("div",{class:"px-3 py-2 border-b border-[var(--color-border)]",children:n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:i("chat.heartbeatsTitle")})}),n("div",{class:"py-1",children:f.length===0?n("div",{class:"px-3 py-4 text-sm text-[var(--color-text-muted)] text-center",children:i("chat.noHeartbeats")}):f.map(g=>n("div",{class:"px-3 py-2 flex items-center gap-2 text-sm hover:bg-[var(--color-bg-hover)]",children:[n("span",{class:"text-[var(--color-success)]",children:"✓"}),n("span",{class:"text-[var(--color-text-muted)]",children:ge(g.timestamp)})]},g.id))})]})]})}const r1={sm:"w-6 h-6 rounded",md:"w-8 h-8 rounded-lg",lg:"w-20 h-20 rounded-2xl",xl:"w-24 h-24 rounded-2xl shadow-lg"};function Ss({size:e="md",class:t="",animated:r=!1}){const a=r1[e];return n("img",{src:"/cove-icon.png",alt:"Cove",class:`${a} ${r?"group-hover:scale-110 transition-transform":""} ${t}`.trim()})}function ea({class:e}){return n(Xr,{class:e||"w-5 h-5","aria-hidden":"true"})}function Wp({class:e}){return n(Rr,{class:e||"w-4 h-4","aria-hidden":"true"})}function a1({class:e}){return n(vy,{class:e||"w-5 h-5","aria-hidden":"true"})}function o1({class:e}){return n(hu,{class:e||"w-5 h-5","aria-hidden":"true"})}function ta({class:e,open:t}){return n(wt,{class:`${e||"w-4 h-4"} transition-transform ${t?"rotate-180":""}`,"aria-hidden":"true"})}function l1({class:e}){return n(ey,{class:e||"w-5 h-5","aria-hidden":"true"})}function s1({class:e}){return n(yo,{class:e||"w-3 h-3","aria-hidden":"true"})}function i1({class:e}){return n(Dp,{class:e||"w-5 h-5","aria-hidden":"true"})}function c1({class:e}){return n(Ey,{class:e||"w-5 h-5",fill:"currentColor","aria-hidden":"true"})}function u1({class:e}){return n(Sp,{class:e||"w-5 h-5","aria-hidden":"true"})}function qp({class:e}){return n($p,{class:e||"w-5 h-5","aria-hidden":"true"})}function Gp({class:e}){return n(Gt,{class:e||"w-5 h-5","aria-hidden":"true"})}function d1({class:e}){return n(dy,{class:e||"w-5 h-5","aria-hidden":"true"})}function h1({class:e}){return n(wy,{class:e||"w-5 h-5","aria-hidden":"true"})}function gu({class:e}){return n(Pe,{class:e||"w-5 h-5","aria-hidden":"true"})}function f1({class:e}){return n(on,{class:e||"w-5 h-5","aria-hidden":"true"})}function p1({class:e}){return n(wr,{class:e||"w-5 h-5","aria-hidden":"true"})}function Kp(e){return e>=90?"critical":e>=80?"high":e>=50?"medium":"low"}function g1(){const[e,t]=j(!1),r=q(null);if(!D0.value)return null;Qr(r,()=>t(!1),e);const a=ru.value,o=L0.value;if(!a||!o)return null;const l=Kp(o.usedPercent),s=`${a.displayName} Usage`;return n("div",{ref:r,class:"relative",children:[n(Zr,{content:s,placement:"bottom",disabled:e,children:n("button",{type:"button",onClick:()=>t(!e),class:"flex items-center gap-2 px-2 py-1 rounded-md cursor-pointer hover:bg-[var(--color-bg-surface)] transition-colors","aria-expanded":e,"aria-label":`Anthropic usage: ${Math.round(o.usedPercent)}% ${o.label}`,children:[n("div",{class:"w-16 h-1.5 bg-[var(--color-border)] rounded-full overflow-hidden",children:n("div",{class:`h-full rounded-full transition-all ${Vp(l)}`,style:{width:`${Math.min(100,o.usedPercent)}%`}})}),n("span",{class:`text-xs font-medium ${Yp(l)}`,children:[Math.round(o.usedPercent),"%"]}),n("span",{class:"text-xs text-[var(--color-text-muted)] hidden sm:inline",children:o.label})]})}),e&&n("div",{class:"absolute right-0 top-full mt-2 w-64 bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-lg shadow-lg z-50 p-3",children:[n("div",{class:"flex items-center justify-between mb-3",children:[n("span",{class:"text-sm font-medium",children:a.displayName}),a.plan&&n("span",{class:"text-xs text-[var(--color-text-muted)] bg-[var(--color-bg-secondary)] px-2 py-0.5 rounded",children:a.plan})]}),n("div",{class:"space-y-3",children:a.windows.map(c=>n(v1,{window:c},c.label))})]})]})}function v1({window:e}){const t=Kp(e.usedPercent),r=e.resetAt?m1(e.resetAt):null;return n("div",{children:[n("div",{class:"flex items-center justify-between mb-1",children:[n("span",{class:"text-xs text-[var(--color-text-secondary)]",children:e.label}),n("span",{class:`text-xs font-medium ${Yp(t)}`,children:[Math.round(e.usedPercent),"%"]})]}),n("div",{class:"w-full h-2 bg-[var(--color-border)] rounded-full overflow-hidden",children:n("div",{class:`h-full rounded-full transition-all ${Vp(t)}`,style:{width:`${Math.min(100,e.usedPercent)}%`}})}),r&&n("div",{class:"text-[10px] text-[var(--color-text-muted)] mt-1",children:["Resets ",r]})]})}function Vp(e){switch(e){case"critical":return"bg-[var(--color-error)]";case"high":return"bg-[var(--color-warning)]";case"medium":return"bg-[var(--color-warning)]";default:return"bg-[var(--color-success)]"}}function Yp(e){switch(e){case"critical":return"text-[var(--color-error)]";case"high":return"text-[var(--color-warning)]";default:return"text-[var(--color-text-secondary)]"}}function m1(e){const t=Date.now(),r=e-t;if(r<0)return"soon";const a=Math.floor(r/(1e3*60*60)),o=Math.floor(r%(1e3*60*60)/(1e3*60));return a>24?`in ${Math.floor(a/24)}d`:a>0?`in ${a}h ${o}m`:`in ${o}m`}function b1(){return n("header",{class:"h-14 flex-shrink-0 bg-[var(--color-bg-secondary)]",children:n("div",{class:"h-full px-4 flex items-center justify-between",children:[n("div",{class:"flex items-center gap-3",children:[n("div",{class:"lg:hidden",children:n(Q,{icon:at.value?n(ea,{}):n(a1,{}),label:i("accessibility.sidebarToggle"),onClick:()=>at.value=!at.value,variant:"ghost",size:"md"})}),n("a",{href:"/",class:"hidden sm:flex items-center gap-2.5 font-semibold text-lg group no-underline",children:[n(Ss,{size:"md",animated:!0}),n("span",{class:"bg-gradient-to-r from-[var(--color-accent)] to-[color-mix(in_oklch,var(--color-accent),var(--color-text-primary)_40%)] bg-clip-text text-transparent",children:i("app.name")})]})]}),n("div",{class:"flex items-center gap-4",children:[(()=>{const e=x1(Ce.value);return n("div",{class:"flex items-center gap-2 text-sm animate-[fade-in_150ms_ease-out_100ms_forwards] opacity-0",children:[n("span",{class:`w-2 h-2 rounded-full ${e.dot}`,"aria-hidden":"true"}),n("span",{class:`hidden sm:inline ${e.text}`,children:[i(e.label),$.value&&st.value&&st.value!=="dev"&&n("span",{class:"text-[var(--color-text-muted)]",children:[" v",st.value]})]})]})})(),n("div",{class:"sm:hidden flex items-center gap-2",children:[n(Bp,{}),n(Q,{icon:n(gu,{}),label:i("chat.search"),onClick:()=>qe.value=!0,variant:"ghost",size:"md"})]}),n(g1,{}),n("div",{"data-tour":"settings",children:n(Q,{icon:n(o1,{}),label:i("nav.settings"),onClick:()=>{const e=cs()==="/settings";it(e?_p.value:"/settings")},variant:"ghost",size:"md"})})]})]})})}const lh={connected:{dot:"bg-[var(--color-success)]",text:"text-[var(--color-success)]",label:"status.connected"},connecting:{dot:"bg-[var(--color-warning)]",text:"text-[var(--color-warning)]",label:"status.connecting"},authenticating:{dot:"bg-[var(--color-warning)]",text:"text-[var(--color-warning)]",label:"status.connecting"},reconnecting:{dot:"bg-[var(--color-warning)]",text:"text-[var(--color-warning)]",label:"status.reconnecting"},error:{dot:"bg-[var(--color-error)]",text:"text-[var(--color-error)]",label:"status.error"},disconnected:{dot:"bg-[var(--color-text-muted)]",text:"text-[var(--color-text-muted)]",label:"status.disconnected"}};function x1(e){return lh[e]??lh.disconnected}const y1={primary:`
55
+ bg-[var(--color-accent)] text-white
56
+ hover:opacity-90
57
+ focus-visible:ring-[var(--color-accent)]
58
+ `,secondary:`
59
+ bg-[var(--color-bg-surface)] text-[var(--color-text-primary)]
60
+ border border-[var(--color-border)]
61
+ hover:bg-[var(--color-bg-secondary)]
62
+ focus-visible:ring-[var(--color-accent)]
63
+ `,ghost:`
64
+ bg-transparent text-[var(--color-text-secondary)]
65
+ hover:bg-[var(--color-bg-secondary)] hover:text-[var(--color-text-primary)]
66
+ focus-visible:ring-[var(--color-accent)]
67
+ `,danger:`
68
+ bg-[var(--color-error)] text-white
69
+ hover:opacity-90
70
+ focus-visible:ring-[var(--color-error)]
71
+ `},w1={sm:"px-3 py-1.5 text-xs gap-1.5",md:"px-4 py-2 text-sm gap-2",lg:"px-6 py-3 text-base gap-2.5"},L=wo(({type:e="button",variant:t="primary",size:r="md",loading:a=!1,icon:o,iconRight:l,fullWidth:s=!1,disabled:c,children:u,class:d,...h},f)=>n("button",{ref:f,type:e,disabled:c||a,class:`
72
+ inline-flex items-center justify-center
73
+ font-medium rounded-xl
74
+ transition-all duration-200 ease-out
75
+ shadow-soft-sm hover:shadow-soft
76
+ active:scale-[0.97] active:shadow-none
77
+ focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2
78
+ disabled:opacity-40 disabled:cursor-not-allowed disabled:shadow-none disabled:active:scale-100 disabled:grayscale disabled:hover:opacity-40
79
+ ${y1[t]}
80
+ ${w1[r]}
81
+ ${s?"w-full":""}
82
+ ${d||""}
83
+ `,...h,children:[a?n(ue,{size:r==="lg"?"md":"sm"}):o?n("span",{class:"flex-shrink-0","aria-hidden":"true",children:o}):null,u&&n("span",{children:u}),l&&!a&&n("span",{class:"flex-shrink-0","aria-hidden":"true",children:l})]}));L.displayName="Button";const Qs=['a[href]:not([disabled]):not([tabindex="-1"])','button:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="-1"])','input:not([disabled]):not([tabindex="-1"])','select:not([disabled]):not([tabindex="-1"])','[tabindex]:not([tabindex="-1"]):not([disabled])'].join(", ");function k1(e,t={}){const{enabled:r=!0,autoFocus:a=!0,returnFocusTo:o}=t,l=q(null);z(()=>{if(!r||!e.current)return;if(l.current=document.activeElement,a){const d=e.current.querySelectorAll(Qs)[0];d&&requestAnimationFrame(()=>{d.focus()})}function s(u){if(u.key!=="Tab"||!e.current)return;const d=e.current.querySelectorAll(Qs);if(d.length===0)return;const h=d[0],f=d[d.length-1];if(u.shiftKey&&document.activeElement===h){u.preventDefault(),f.focus();return}if(!u.shiftKey&&document.activeElement===f){u.preventDefault(),h.focus();return}e.current.contains(document.activeElement)||(u.preventDefault(),h.focus())}function c(u){if(!e.current)return;const d=u.target;if(!e.current.contains(d)){const h=e.current.querySelectorAll(Qs);h.length>0&&h[0].focus()}}return document.addEventListener("keydown",s),document.addEventListener("focusin",c),()=>{document.removeEventListener("keydown",s),document.removeEventListener("focusin",c);const u=o?.current??l.current;u&&typeof u.focus=="function"&&u.focus()}},[r,a,e,o])}const ei=250,_1=80,S1={sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl",full:"sm:max-w-4xl"};function Qe({open:e,onClose:t,title:r,size:a="md",hideCloseButton:o=!1,closeOnBackdrop:l=!0,closeOnEscape:s=!0,children:c,footer:u}){const d=q(null),h=q(null),[f,g]=j(e),m=q(!1),y=q(null),C=K(()=>{if(m.current)return;m.current=!0;const E=d.current,w=h.current;E&&(E.style.transition=`transform ${ei}ms ease-out`,E.style.transform="translateY(100%)"),w&&(w.style.transition=`opacity ${ei}ms ease-out`,w.style.opacity="0"),setTimeout(()=>{g(!1),m.current=!1,t()},ei)},[t]);z(()=>{e?(g(!0),m.current=!1):f&&!m.current&&C()},[e,f,C]),z(()=>{e&&d.current&&requestAnimationFrame(()=>{d.current&&(d.current.style.transform="",d.current.style.transition=""),h.current&&(h.current.style.opacity="",h.current.style.transition="")})},[e]),k1(d,{enabled:e&&!m.current,autoFocus:!1});const T=K(E=>{E.key==="Escape"&&s&&!m.current&&C()},[s,C]),_=K(E=>{y.current=E.touches[0].clientY,d.current&&(d.current.style.transition="none")},[]),p=K(E=>{if(y.current===null)return;const A=E.touches[0].clientY-y.current;if(A>0&&(d.current&&(d.current.style.transform=`translateY(${A}px)`),h.current)){const D=Math.max(0,1-A/300);h.current.style.opacity=String(D)}},[]),b=K(()=>{if(y.current===null)return;const E=d.current;if(E){const A=E.style.transform.match(/translateY\((\d+)px\)/);(A?parseInt(A[1],10):0)>_1?C():(E.style.transition="transform 150ms ease-out",E.style.transform="translateY(0)",h.current&&(h.current.style.transition="opacity 150ms ease-out",h.current.style.opacity="1"))}y.current=null},[C]);return z(()=>{if(f)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[f]),z(()=>{if(f)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[f,T]),f?pu(n("div",{class:"fixed inset-0 z-50 flex items-end sm:items-center justify-center sm:p-4",role:"dialog","aria-modal":"true","aria-labelledby":r?"modal-title":void 0,children:[n("div",{ref:h,class:"absolute inset-0 bg-black/40 backdrop-blur-md animate-fade-in",onClick:()=>{l&&!m.current&&C()},"aria-hidden":"true"}),n("div",{ref:d,tabIndex:-1,class:`
84
+ relative w-full ${S1[a]}
85
+ bg-[var(--color-bg-surface)]
86
+ border border-[var(--color-border)]
87
+ max-h-[85vh] sm:max-h-[90vh] flex flex-col
88
+ focus:outline-none shadow-soft-xl
89
+ rounded-t-xl border-b-0 sm:rounded-xl sm:border-b
90
+ animate-slide-up-full sm:animate-scale-in
91
+ `,children:[n("div",{class:"sm:hidden flex justify-center pt-3 pb-2 cursor-grab active:cursor-grabbing",onTouchStart:_,onTouchMove:p,onTouchEnd:b,"aria-hidden":"true",children:n("div",{class:"w-10 h-1 rounded-full bg-[var(--color-text-muted)]/40"})}),r&&n("div",{class:"flex items-center justify-between px-4 sm:px-6 py-2 sm:py-4 border-b border-[var(--color-border)]",children:[n("h2",{id:"modal-title",class:"text-base sm:text-lg font-semibold text-[var(--color-text-primary)] truncate pr-2",children:r}),!o&&n(Q,{icon:n(ea,{}),label:i("actions.close"),variant:"ghost",size:"sm",onClick:C,class:"hidden sm:flex flex-shrink-0"})]}),n("div",{class:"flex-1 overflow-y-auto px-4 sm:px-6 py-3 sm:py-4",children:c}),u&&n("div",{class:"px-4 sm:px-6 py-3 sm:py-4 border-t border-[var(--color-border)] bg-[var(--color-bg-secondary)] sm:rounded-b-xl",children:u})]})]}),document.body):null}const C1={sm:"px-2.5 py-1.5 text-xs",md:"px-3 py-2 text-sm",lg:"px-4 py-3 text-base"},te=wo(({size:e="md",error:t,leftElement:r,rightElement:a,fullWidth:o=!1,disabled:l,class:s,...c},u)=>{const d=!!t;return n("div",{class:`${o?"w-full":""}`,children:[n("div",{class:"relative",children:[r&&n("div",{class:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-[var(--color-text-muted)]",children:r}),n("input",{ref:u,disabled:l,class:`
92
+ block rounded-xl
93
+ bg-[var(--color-bg-primary)]
94
+ border transition-all duration-200 ease-out
95
+ shadow-soft-sm focus:shadow-soft
96
+ placeholder:text-[var(--color-text-muted)]
97
+ focus:outline-none focus:ring-2 focus:ring-offset-0
98
+ disabled:opacity-50 disabled:cursor-not-allowed disabled:shadow-none
99
+ ${d?"border-[var(--color-error)] focus:ring-[var(--color-error)]":"border-[var(--color-border)] focus:ring-[var(--color-accent)] focus:border-transparent"}
100
+ ${C1[e]}
101
+ ${r?"pl-10":""}
102
+ ${a?"pr-10":""}
103
+ ${o?"w-full":""}
104
+ ${s||""}
105
+ `,"aria-invalid":d,"aria-describedby":d?`${c.id}-error`:void 0,...c}),a&&n("div",{class:"absolute inset-y-0 right-0 flex items-center pr-3 text-[var(--color-text-muted)]",children:a})]}),typeof t=="string"&&t&&n("p",{id:`${c.id}-error`,class:"mt-1 text-xs text-[var(--color-error)]",role:"alert",children:t})]})});te.displayName="Input";function Ee({label:e,htmlFor:t,error:r,hint:a,required:o,children:l,class:s}){return n("div",{class:s,children:[e&&n("label",{htmlFor:t,class:"block text-sm font-medium text-[var(--color-text-secondary)] mb-1.5",children:[e,o&&n("span",{class:"text-[var(--color-error)] ml-0.5",children:"*"})]}),l,a&&!r&&n("p",{class:"mt-1 text-xs text-[var(--color-text-muted)]",children:a}),r&&n("p",{class:"mt-1 text-xs text-[var(--color-error)]",children:r})]})}function Hl(e){if(e.label)return e.label;if(e.displayName)return e.displayName;const t=e.key.split(":");if(t.length>=3&&t[0]==="agent"){const r=t[2];return r==="main"?lp(t[1]):Ca(r)}if(t.length>=2){const r=t[t.length-1];if(Ed(r)){const a=t[t.length-2];if(a&&!Ed(a))return Ca(a)}return Ca(r)}return e.key}function E1(e){if(!e.kind||e.kind==="main")return null;switch(e.kind){case"isolated":return{label:"Isolated",color:"text-[var(--color-warning)]"};case"channel":return{label:e.channel||"Channel",color:"text-[var(--color-accent)]"};default:return null}}function T1(e){const t=e.channel??e.lastChannel;return!t||t==="webchat"?null:Ca(t)}function sh({session:e,isActive:t=!1,isMain:r=!1,onClick:a,onRename:o,onDelete:l}){const[s,c]=j(!1),[u,d]=j(!1),h=q(null),f=q(null);Qr(h,()=>c(!1),s);const g=()=>{if(!s&&f.current){const w=f.current.getBoundingClientRect();let A=f.current.parentElement;for(;A&&getComputedStyle(A).overflowY!=="auto";)A=A.parentElement;const S=(A?A.getBoundingClientRect().bottom:window.innerHeight)-w.bottom;d(S<100)}c(!s)},m=E1(e),y=T1(e),C=Tx(e.totalTokens??e.contextTokens),T=e.updatedAt||e.lastActiveAt,_=Sx(e.key),p=_?lp(_):null,b=Gc.value===e.key,E=!!Jc(e.key);return n("div",{class:`relative group transition-all duration-300 ${b?"opacity-0 scale-95 -translate-x-2":""}`,children:[n("button",{type:"button",onClick:a,class:`
106
+ w-full text-left px-3 py-2.5 rounded-xl text-sm
107
+ flex items-start gap-2.5 transition-all duration-200 ease-out
108
+ ${E?"ai-glow":""}
109
+ ${t?"bg-[var(--color-accent)]/10 text-[var(--color-accent)] shadow-soft-sm":"hover:bg-[var(--color-bg-primary)] hover:shadow-soft-sm text-[var(--color-text-primary)]"}
110
+ `,children:[E?n(ue,{size:"xs",class:"flex-shrink-0 mt-0.5 text-[var(--color-accent)]"}):r?n(h1,{class:`w-3.5 h-3.5 flex-shrink-0 mt-1 ${t?"text-[var(--color-accent)]":"text-[var(--color-text-muted)]"}`}):n("span",{class:`w-2 h-2 rounded-full flex-shrink-0 mt-1.5 ${t?"bg-[var(--color-accent)]":"bg-[var(--color-text-muted)]"}`,"aria-hidden":"true"}),n("span",{class:"flex-1 min-w-0",children:[n("span",{class:"flex items-center gap-2",children:[n("span",{class:"truncate font-medium",children:Hl(e)}),m&&n("span",{class:`text-[10px] font-medium ${m.color}`,children:m.label})]}),n("span",{class:"flex items-center gap-1.5 text-xs text-[var(--color-text-muted)] mt-0.5 overflow-hidden",children:[p&&n("span",{class:"truncate flex-shrink",children:p}),y&&n(Y,{children:[p&&n("span",{class:"flex-shrink-0 text-[var(--color-border)]",children:"•"}),n("span",{class:"truncate flex-shrink text-[var(--color-accent)]/70",children:y})]}),C&&n(Y,{children:[(p||y)&&n("span",{class:"flex-shrink-0 text-[var(--color-border)]",children:"•"}),n("span",{class:"flex-shrink-0",title:`${e.totalTokens??e.contextTokens} tokens`,children:C})]}),n("span",{class:"flex-1 min-w-0"}),T&&n("span",{class:"whitespace-nowrap flex-shrink-0",children:jb(new Date(T))})]})]})]}),(o||l)&&n("div",{ref:h,class:"absolute right-2 top-2",children:[n("button",{ref:f,type:"button",onClick:w=>{w.stopPropagation(),g()},class:`p-1 rounded-lg transition-all duration-150
111
+ ${s?"bg-[var(--color-bg-secondary)] text-[var(--color-text-primary)]":"opacity-0 group-hover:opacity-100 hover:bg-[var(--color-bg-secondary)] text-[var(--color-text-muted)]"}`,"aria-label":"Session actions","aria-haspopup":"menu","aria-expanded":s,children:n(u1,{class:"w-4 h-4"})}),s&&n("div",{role:"menu","aria-label":"Session actions",class:`absolute right-0 w-36 bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-lg shadow-lg z-50 py-1 ${u?"bottom-full mb-1":"top-full mt-1"}`,children:[o&&n("button",{type:"button",role:"menuitem",onClick:w=>{w.stopPropagation(),c(!1),o(e)},class:"w-full flex items-center gap-2 px-3 py-2 text-sm text-[var(--color-text-primary)] hover:bg-[var(--color-bg-secondary)] transition-colors",children:[n(qp,{class:"w-4 h-4"}),i("actions.rename")]}),l&&n("button",{type:"button",role:"menuitem",onClick:w=>{w.stopPropagation(),c(!1),l(e)},class:"w-full flex items-center gap-2 px-3 py-2 text-sm text-[var(--color-error)] hover:bg-[var(--color-error)]/10 transition-colors",children:[n(Gp,{class:"w-4 h-4"}),i("actions.delete")]})]})]})]})}function A1({session:e,onClose:t,onRename:r}){const[a,o]=j(""),[l,s]=j(!1),c=q(null);z(()=>{e&&(o(Hl(e)),setTimeout(()=>c.current?.select(),100))},[e]);const u=async f=>{if(f.preventDefault(),!(!e||!a.trim())){s(!0);try{await r(e,a.trim()),t()}finally{s(!1)}}};if(!e)return null;const d=Hl(e),h=a.trim()!==d;return n(Qe,{open:!!e,onClose:t,title:i("sessions.rename"),children:n("form",{onSubmit:u,children:[n(Ee,{label:i("sessions.label"),htmlFor:"session-label",children:n(te,{ref:c,id:"session-label",type:"text",value:a,onInput:f=>o(f.target.value),placeholder:i("sessions.labelPlaceholder"),fullWidth:!0})}),n("div",{class:"flex justify-end gap-2 mt-4",children:[n(L,{variant:"ghost",onClick:t,disabled:l,children:i("actions.cancel")}),n(L,{type:"submit",variant:"primary",loading:l,disabled:!a.trim()||!h,children:i("actions.save")})]})]})})}function M1({session:e,onClose:t,onDelete:r}){const[a,o]=j(!1),l=async()=>{if(e){o(!0);try{t(),await new Promise(s=>setTimeout(s,100)),await r(e)}catch{}finally{o(!1)}}};return e?n(Qe,{open:!!e,onClose:t,title:i("sessions.delete"),children:[n("p",{class:"text-sm text-[var(--color-text-secondary)] mb-4",children:i("sessions.deleteConfirm",{name:Hl(e)})}),n("p",{class:"text-xs text-[var(--color-text-muted)] mb-4",children:i("sessions.deleteWarning")}),n("div",{class:"flex justify-end gap-2",children:[n(L,{variant:"ghost",onClick:t,disabled:a,children:i("actions.cancel")}),n(L,{variant:"danger",onClick:l,loading:a,children:i("actions.delete")})]})]}):null}const I1={sm:{trigger:"px-2.5 py-1.5 text-xs",menu:"text-xs",option:"px-2.5 py-1.5"},md:{trigger:"px-3 py-2 text-sm",menu:"text-sm",option:"px-3 py-2"},lg:{trigger:"px-4 py-3 text-base",menu:"text-base",option:"px-4 py-3"}};function Me({value:e,options:t,onChange:r,size:a="md",placeholder:o="Select...","aria-label":l,class:s,disabled:c=!1,align:u="left",width:d}){const[h,f]=j(!1),[g,m]=j(-1),[y,C]=j(void 0),T=q(null),_=q(null),p=q(null),b=I1[a],E=t.find(S=>S.value===e)?.label??o;Cv(()=>{!d&&p.current&&C(p.current.offsetWidth)},[t,d]);const w=K(()=>{f(!1),m(-1)},[]),A=K(S=>{r(S),w(),T.current?.focus()},[r,w]);Qr([T,_],w,h);const D=K(S=>{if(!h){(S.key==="Enter"||S.key===" "||S.key==="ArrowDown")&&(S.preventDefault(),f(!0),m(0));return}switch(S.key){case"Escape":S.preventDefault(),w(),T.current?.focus();break;case"ArrowDown":S.preventDefault(),m(F=>Math.min(F+1,t.length-1));break;case"ArrowUp":S.preventDefault(),m(F=>Math.max(F-1,0));break;case"Enter":case" ":S.preventDefault(),g>=0&&!t[g]?.disabled&&A(t[g].value);break;case"Tab":w();break}},[h,t,g,w,A]);return n("div",{class:`relative w-fit ${s||""}`,children:[n("div",{ref:p,"aria-hidden":"true",class:`
112
+ invisible absolute flex items-center gap-2
113
+ ${b.trigger}
114
+ `,children:[n("span",{children:t.reduce((S,F)=>F.label.length>S.length?F.label:S,o)}),n(wt,{class:"w-4 h-4 flex-shrink-0"})]}),n("button",{ref:T,type:"button",onClick:()=>!c&&f(!h),onKeyDown:D,disabled:c,"aria-label":l,"aria-haspopup":"listbox","aria-expanded":h,style:d?{width:d}:y?{minWidth:`${y}px`}:void 0,class:`
115
+ flex items-center justify-between gap-2 rounded-md cursor-pointer
116
+ bg-[var(--color-bg-primary)] text-[var(--color-text-primary)]
117
+ border border-[var(--color-border)] transition-all duration-200 ease-out
118
+ shadow-soft-sm hover:shadow-soft focus:shadow-soft
119
+ focus:outline-none focus:ring-2 focus:ring-[var(--color-accent)] focus:ring-offset-0 focus:border-transparent
120
+ disabled:opacity-50 disabled:cursor-not-allowed disabled:shadow-none
121
+ ${b.trigger}
122
+ `,children:[n("span",{class:"truncate",children:E}),n(wt,{class:`w-4 h-4 flex-shrink-0 text-[var(--color-text-muted)] transition-transform ${h?"rotate-180":""}`})]}),h&&T.current&&n("div",{ref:_,role:"listbox","aria-label":l,style:{position:"fixed",top:`${T.current.getBoundingClientRect().bottom+4}px`,minWidth:`${T.current.offsetWidth}px`,...u==="right"?{right:`${window.innerWidth-T.current.getBoundingClientRect().right}px`}:{left:`${T.current.getBoundingClientRect().left}px`}},class:`
123
+ z-[100] inline-flex flex-col
124
+ rounded-lg border border-[var(--color-border)]
125
+ bg-[var(--color-bg-primary)] shadow-lg
126
+ overflow-hidden
127
+ ${b.menu}
128
+ `,children:t.map((S,F)=>n("button",{type:"button",role:"option","aria-selected":S.value===e,disabled:S.disabled,onClick:()=>!S.disabled&&A(S.value),onMouseEnter:()=>m(F),class:`
129
+ text-left whitespace-nowrap transition-colors
130
+ ${b.option}
131
+ ${S.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}
132
+ ${S.value===e?"text-[var(--color-accent)] font-medium":"text-[var(--color-text-primary)]"}
133
+ ${g===F&&!S.disabled?"bg-[var(--color-bg-tertiary)]":""}
134
+ ${S.disabled?"":"hover:bg-[var(--color-bg-tertiary)]"}
135
+ `,children:S.label},S.value))})]})}function R1({checked:e,onChange:t,label:r,description:a,disabled:o=!1,class:l=""}){return n("label",{class:`flex items-start gap-3 ${o?"opacity-50 cursor-not-allowed":"cursor-pointer"} ${l}`,children:[n("input",{type:"checkbox",checked:e,onChange:s=>t(s.target.checked),disabled:o,class:"sr-only peer"}),n("div",{class:`
136
+ flex-shrink-0 w-5 h-5 rounded border-2 transition-colors
137
+ flex items-center justify-center
138
+ peer-focus-visible:ring-2 peer-focus-visible:ring-[var(--color-accent)] peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-[var(--color-bg-primary)]
139
+ ${e?"bg-[var(--color-accent)] border-[var(--color-accent)]":"bg-[var(--color-bg-primary)] border-[var(--color-border)] hover:border-[var(--color-accent)]"}
140
+ `,"aria-hidden":"true",children:e&&n(f1,{class:"w-3 h-3 text-white"})}),(r||a)&&n("div",{class:"flex-1 min-w-0",children:[r&&n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:r}),a&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-0.5",children:a})]})]})}function $1({open:e,onClose:t,onCreate:r}){const[a,o]=j(Ge.value.defaultAgentId||Za.value),[l,s]=j(!1),c=()=>{l&&(Ge.value={...Ge.value,defaultAgentId:a,useDefaults:!0}),r(a),t()},u=()=>{o(Ge.value.defaultAgentId||Za.value),s(!1),t()};return qi.value.length===0?null:n(Qe,{open:e,onClose:u,title:i("newChatModal.title"),children:n("div",{class:"space-y-6",children:[n("div",{children:[n("label",{class:"block text-sm font-medium text-[var(--color-text-primary)] mb-2",children:i("newChatModal.agent")}),n(Me,{value:a,onChange:o,options:qi.value,class:"w-full"}),n("p",{class:"mt-1.5 text-xs text-[var(--color-text-muted)]",children:i("newChatModal.agentDescription")})]}),n(R1,{checked:l,onChange:s,label:i("newChatModal.rememberChoice"),description:i("newChatModal.rememberChoiceDescription")}),n("div",{class:"flex justify-end gap-3 pt-2",children:[n(L,{variant:"secondary",onClick:u,children:i("actions.cancel")}),n(L,{variant:"primary",onClick:c,children:i("newChatModal.create")})]})]})})}const D1={sm:{track:"w-8 h-4",thumb:"w-3 h-3",translate:"translate-x-4"},md:{track:"w-10 h-5",thumb:"w-4 h-4",translate:"translate-x-5"},lg:{track:"w-12 h-6",thumb:"w-5 h-5",translate:"translate-x-6"}},Ke=wo(({checked:e,onChange:t,size:r="md",label:a,description:o,disabled:l,class:s,id:c,...u},d)=>{const h=D1[r],f=c?`${c}-label`:void 0,g=c?`${c}-desc`:void 0;return n("div",{class:`flex items-start justify-between gap-3 ${s||""}`,children:[(a||o)&&n("div",{class:"flex flex-col",children:[a&&n("span",{id:f,class:"text-sm font-medium text-[var(--color-text-primary)]",children:a}),o&&n("span",{id:g,class:"text-xs text-[var(--color-text-muted)]",children:o})]}),n("button",{ref:d,type:"button",role:"switch","aria-checked":e,"aria-labelledby":f,"aria-describedby":g,disabled:l,onClick:()=>t(!e),class:`
141
+ relative inline-flex flex-shrink-0 items-center
142
+ rounded-full transition-colors
143
+ focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)] focus-visible:ring-offset-2
144
+ disabled:opacity-50 disabled:cursor-not-allowed
145
+ ${h.track}
146
+ ${e?"bg-[var(--color-accent)]":"bg-[var(--color-border)]"}
147
+ `,...u,children:n("span",{"aria-hidden":"true",class:`
148
+ inline-block rounded-full bg-white shadow-sm
149
+ transform transition-transform
150
+ ${h.thumb}
151
+ ${e?h.translate:"translate-x-0.5"}
152
+ `})})]})});Ke.displayName="Toggle";const L1={xs:"px-2 py-0.5 text-[10px]",sm:"px-2.5 py-1 text-xs",md:"px-3 py-1.5 text-sm"};function N1({selected:e=!1,size:t="sm",onClick:r,disabled:a=!1,children:o,class:l}){return n("button",{type:"button",onClick:r,disabled:a,class:`
153
+ inline-flex items-center justify-center
154
+ font-medium rounded-md transition-colors
155
+ focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)] focus-visible:ring-offset-1
156
+ disabled:opacity-50 disabled:cursor-not-allowed
157
+ ${L1[t]}
158
+ ${e?"bg-[var(--color-accent)] text-white":"bg-[var(--color-bg-primary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-secondary)]"}
159
+ ${l||""}
160
+ `,children:o})}function O1(){const[e,t]=j(!1),r=q(null),a=Ya.value.trim()!=="",o=Va.value!==null,l=a||o||Ja.value;z(()=>{l&&t(!0)},[l]),z(()=>{e&&r.current&&r.current.focus()},[e]);const s=[{value:null,label:i("sessions.filterAll")},{value:"main",label:i("sessions.filterMain")},{value:"isolated",label:i("sessions.filterIsolated")},{value:"channel",label:i("sessions.filterChannel")}];return n("div",{class:"px-2 py-1.5",children:[n("div",{class:"flex items-center justify-between",children:[n("h3",{class:"text-xs font-semibold text-[var(--color-accent)] uppercase tracking-wider",children:i("nav.sessions")}),n("button",{type:"button",onClick:()=>t(!e),class:`p-1 rounded transition-colors ${l?"text-[var(--color-accent)] bg-[var(--color-accent)]/10":"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]"}`,"aria-label":i("sessions.filterSessions"),children:n(d1,{class:"w-3.5 h-3.5"})})]}),e&&n("div",{class:"mt-2 space-y-2",children:[n("div",{class:"relative",children:[n(gu,{class:"absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-[var(--color-text-muted)]"}),n("input",{ref:r,type:"text",value:Ya.value,onInput:c=>Ad(c.target.value),onKeyDown:c=>{c.key==="Escape"&&!l&&t(!1)},placeholder:i("sessions.searchPlaceholder"),class:`w-full pl-7 pr-7 py-1.5 text-xs rounded-md
161
+ bg-[var(--color-bg-primary)] border border-[var(--color-border)]
162
+ text-[var(--color-text-primary)] placeholder-[var(--color-text-muted)]
163
+ focus:outline-none focus:border-[var(--color-accent)]/50`}),a&&n("button",{type:"button",onClick:()=>Ad(""),class:`absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded
164
+ text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]`,children:n(ea,{class:"w-3 h-3"})})]}),n("div",{class:"flex flex-wrap gap-1",children:s.map(c=>n(N1,{size:"xs",selected:Va.value===c.value,onClick:()=>Dx(c.value),children:c.label},c.value??"all"))}),n(Ke,{size:"sm",checked:Ja.value,onChange:Lx,label:i("sessions.showCron")})]})]})}function ih(e){it(`/chat/${encodeURIComponent(e)}`),su()}const F1={pinned:"sessions.pinned",today:"sessions.today",yesterday:"sessions.yesterday",thisWeek:"sessions.thisWeek",older:"sessions.older"},P1=["pinned","today","yesterday","thisWeek","older"];function z1({onRename:e,onDelete:t}){const r=$x.value,a=Fi.value.length>0,o=Wc(Ya.value);return a?o?n("ul",{class:"space-y-0.5",children:Fi.value.map(l=>n("li",{children:n(sh,{session:l,isActive:ft.value===l.key&&tn.value.startsWith("/chat"),isMain:Gn(l.key),onClick:()=>ih(l.key),onRename:e,onDelete:t})},l.key))}):n("div",{class:"space-y-3",children:P1.map(l=>{const s=r.get(l);return!s||s.length===0?null:n("div",{children:[l!=="pinned"&&n("h4",{class:"text-[10px] font-semibold text-[var(--color-text-muted)] uppercase tracking-wider px-2 py-1",children:i(F1[l])}),n("ul",{class:"space-y-0.5",children:s.map(u=>n("li",{children:n(sh,{session:u,isActive:ft.value===u.key&&tn.value.startsWith("/chat"),isMain:Gn(u.key),onClick:()=>ih(u.key),onRename:e,onDelete:t})},u.key))})]},l)})}):n("p",{class:"text-sm text-[var(--color-text-muted)] px-2 py-4",children:i(o?"sessions.noResults":"sessions.noSessions")})}const je="w-5 h-5",U1=()=>n(py,{class:je,"aria-hidden":"true"}),H1=()=>n(oy,{class:je,"aria-hidden":"true"}),j1=()=>n(Ip,{class:je,"aria-hidden":"true"}),B1=()=>n(Ul,{class:je,"aria-hidden":"true"}),W1=()=>n(Gi,{class:je,"aria-hidden":"true"}),q1=()=>n(me,{class:je,"aria-hidden":"true"}),G1=()=>n(ln,{class:je,"aria-hidden":"true"}),K1=()=>n($r,{class:je,"aria-hidden":"true"}),V1=()=>n(hu,{class:je,"aria-hidden":"true"}),Y1=()=>n(Cy,{class:je,"aria-hidden":"true"}),J1=()=>n(jt,{class:je,"aria-hidden":"true"}),X1=()=>n(ny,{class:je,"aria-hidden":"true"}),ch=()=>n(hy,{class:je,"aria-hidden":"true"}),Z1=()=>n(my,{class:je,"aria-hidden":"true"}),Q1=()=>n(xy,{class:je,"aria-hidden":"true"}),e2=[{titleKey:"nav.sections.control",items:[{id:"overview",labelKey:"nav.overview",icon:U1,requiresConnection:!0},{id:"stats",labelKey:"nav.stats",icon:H1,requiresConnection:!0},{id:"channels",labelKey:"nav.channels",icon:j1,requiresConnection:!0},{id:"instances",labelKey:"nav.instances",icon:B1,requiresConnection:!0},{id:"sessions",labelKey:"nav.sessions",icon:W1,requiresConnection:!0},{id:"cron",labelKey:"nav.cron",icon:q1,requiresConnection:!0}]},{titleKey:"nav.sections.agent",items:[{id:"skills",labelKey:"nav.skills",icon:G1,requiresConnection:!0},{id:"devices",labelKey:"nav.devices",icon:K1,requiresConnection:!0}]},{titleKey:"nav.sections.settings",items:[{id:"settings",labelKey:"nav.settings",icon:Q1},{id:"config",labelKey:"nav.config",icon:V1,requiresConnection:!0},{id:"debug",labelKey:"nav.debug",icon:Y1,requiresConnection:!0},{id:"logs",labelKey:"nav.logs",icon:J1,requiresConnection:!0}]},{titleKey:"nav.sections.resources",items:[{id:"docs",labelKey:"nav.docs",icon:X1,external:jo.docs},{id:"github",labelKey:"nav.github",icon:ch,external:jo.github},{id:"github-openclaw",labelKey:"nav.githubOpenClaw",icon:ch,external:jo.githubOpenClaw},{id:"discord",labelKey:"nav.discord",icon:Z1,external:jo.discord}]}],Jp="cove:nav-sections";function Xp(e){try{const t=`${Jp}-${e}`,r=localStorage.getItem(t);return r?JSON.parse(r):{}}catch{return{}}}function t2(e,t,r){try{const a=`${Jp}-${e}`,o=Xp(e);o[t]=r,localStorage.setItem(a,JSON.stringify(o))}catch{}}function n2({item:e}){const t=`/${e.id}`,r=is(()=>!e.external&&(tn.value===t||e.id==="chat"&&tn.value.startsWith("/chat"))),a=e.icon;return e.external?n("a",{href:e.external,target:"_blank",rel:"noopener noreferrer",class:"w-full flex items-center gap-3 px-3.5 py-2.5 rounded-xl text-sm transition-all duration-200 ease-out hover:bg-[var(--color-bg-primary)] hover:shadow-soft-sm text-[var(--color-text-secondary)]",children:[n("span",{class:"w-5 h-5 flex-shrink-0","aria-hidden":"true",children:n(a,{})}),i(e.labelKey),n(s1,{class:"w-3 h-3 ml-auto text-[var(--color-text-muted)]"})]}):n("button",{type:"button",onClick:()=>{it(t),su()},class:`
165
+ w-full flex items-center gap-3 px-3.5 py-2.5 rounded-xl text-sm
166
+ transition-all duration-200 ease-out
167
+ ${r.value?"bg-[var(--color-accent)]/10 text-[var(--color-accent)] shadow-soft-sm":"hover:bg-[var(--color-bg-primary)] hover:shadow-soft-sm text-[var(--color-text-secondary)]"}
168
+ `,children:[n("span",{class:"w-5 h-5 flex-shrink-0","aria-hidden":"true",children:n(a,{})}),i(e.labelKey)]})}function r2({section:e,mode:t,defaultOpen:r=!1}){const o=Xp(t)[e.titleKey]??r,l=J(o),s=e.items;return s.length===0?null:n("div",{class:"border-b border-[var(--color-border)] last:border-b-0",children:[n("button",{type:"button",onClick:()=>{const u=!l.value;l.value=u,t2(t,e.titleKey,u)},"aria-expanded":l.value,"aria-controls":`nav-section-${e.titleKey}`,class:"w-full flex items-center justify-between px-4 py-2.5 text-xs font-semibold uppercase tracking-wider hover:bg-[var(--color-bg-hover)] transition-colors text-[var(--color-text-tertiary)] hover:text-[var(--color-accent)]",children:[n("span",{children:i(e.titleKey)}),n(ta,{open:l.value})]}),l.value&&n("ul",{id:`nav-section-${e.titleKey}`,class:"px-3 pb-2 space-y-0.5",role:"list",children:s.map(u=>n("li",{children:n(n2,{item:u})},u.id))})]})}function Zp({expanded:e=!1}){const t=e?"single":"multi";return n("div",{class:e?"border-t border-[var(--color-border)]":"border-t border-[var(--color-border)] max-h-[50%] overflow-y-auto",children:e2.map(r=>n(r2,{section:r,mode:t,defaultOpen:e},`${t}-${r.titleKey}`))})}const tn=v(window.location.pathname);function a2({isStreaming:e}){const t=tn.value==="/"||tn.value.startsWith("/chat");return n("button",{type:"button",onClick:()=>{it("/chat"),su()},class:`w-full flex items-center gap-3 px-3.5 py-2.5 rounded-xl text-sm transition-all duration-200 ease-out ${t?"bg-[var(--color-accent)]/10 text-[var(--color-accent)] shadow-soft-sm":"hover:bg-[var(--color-bg-primary)] hover:shadow-soft-sm text-[var(--color-text-secondary)]"} ${e?"ai-glow":""}`,children:[e?n(ue,{size:"xs",class:"flex-shrink-0 text-[var(--color-accent)]"}):n("span",{class:"w-5 h-5 flex-shrink-0",children:"💬"}),i("nav.chat")]})}function o2(){const[e,t]=j(null),[r,a]=j(null),o=async(u,d)=>{try{await H("sessions.patch",{key:u.key,label:d}),Kc(u.key,{label:d})}catch(h){throw M.ui.error("Failed to rename session:",h),h}},l=async u=>{try{await H("sessions.delete",{key:u.key}),await Fx(u.key),en.value===u.key&&it("/chat")}catch(d){throw M.ui.error("Failed to delete session:",d),d}},s=()=>{Ge.value.useDefaults?c(Ge.value.defaultAgentId):Js.value=!0},c=async u=>{const d=crypto.randomUUID(),h=`agent:${u}:chat:${d}`;try{await H("sessions.patch",{key:h,label:i("newChatModal.title")}),await fs(),it(`/chat/${encodeURIComponent(h)}`)}catch(f){M.ui.error("Failed to create new chat:",f)}};return n("div",{class:"h-full flex flex-col",children:[ds.value?n(Y,{children:[n("div",{class:"p-3",children:n(L,{variant:"primary",disabled:!$.value,onClick:s,fullWidth:!0,icon:n(Wp,{}),children:i("actions.newChat")})}),n("div",{class:"flex-1 overflow-y-auto px-3 pb-3","data-tour":"sessions",children:[n(O1,{}),n(z1,{onRename:t,onDelete:a})]}),n(Zp,{})]}):n(l2,{}),n(A1,{session:e,onClose:()=>t(null),onRename:o}),n(M1,{session:r,onClose:()=>a(null),onDelete:l}),n($1,{open:Js.value,onClose:()=>Js.value=!1,onCreate:c})]})}function l2(){ce.value;const e=Le.value,t=e?!!Jc(e):!1;return n("div",{class:"flex-1 overflow-y-auto",children:[n("div",{class:"px-3 py-2",children:n(a2,{isStreaming:t})}),n(Zp,{expanded:!0})]})}function s2({children:e}){K0();const t=r=>{const a=Math.max(H0,Math.min(j0,fl.value+r));fl.value=a};return n("div",{class:"h-screen flex flex-col bg-[var(--color-bg-secondary)] text-[var(--color-text-primary)]",children:[n("a",{href:"#main-content",class:"sr-only focus:not-sr-only focus:absolute focus:top-2 focus:left-2 focus:z-50 focus:px-4 focus:py-2 focus:bg-[var(--color-accent)] focus:text-white focus:rounded-xl",children:"Skip to content"}),n(b1,{}),n("div",{class:"flex-1 flex overflow-hidden",children:[(at.value||rt.value)&&n("div",{class:"fixed inset-0 bg-black z-40 lg:hidden",style:{opacity:rt.value?(hn.value??0)/On*.5:.5,transition:rt.value?"none":"opacity 200ms ease-out"},onClick:()=>at.value=!1,"aria-hidden":"true"}),n("aside",{style:{"--sidebar-width":`${fl.value}px`,transform:rt.value?`translateX(${(hn.value??0)-On}px)`:void 0},class:`
169
+ fixed inset-y-0 left-0 z-50 w-72 p-2 pr-0 pt-16
170
+ lg:bg-[var(--color-bg-secondary)]
171
+ ${rt.value?"":"transition-transform duration-200 ease-out"}
172
+ ${!rt.value&&(at.value?"translate-x-0":"-translate-x-full")}
173
+ lg:relative lg:inset-auto lg:z-auto lg:pt-2 lg:translate-x-0
174
+ lg:w-[var(--sidebar-width)]
175
+ ${!at.value&&"lg:w-0 lg:p-0"}
176
+ ${Ys.value?"lg:transition-none":""}
177
+ `,children:n("div",{class:"h-full rounded-xl bg-[var(--color-bg-surface)] border border-[var(--color-border)] shadow-soft-sm overflow-hidden",children:n(o2,{})})}),at.value&&n("div",{class:"hidden lg:flex items-center py-2",children:n(V0,{direction:"horizontal",onResizeStart:()=>Ys.value=!0,onResize:t,onResizeEnd:()=>Ys.value=!1,class:"h-[calc(100%-4rem)] rounded-full"})}),n("main",{id:"main-content",class:"flex-1 flex flex-col overflow-hidden p-2 lg:pl-0",children:n("div",{class:"h-full rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)] shadow-soft overflow-hidden flex flex-col",children:e})})]})]})}const Dr=v([]);let i2=0;function qo(e,t="info",r=5e3){const a=`toast-${++i2}`;return Dr.value=[...Dr.value,{id:a,type:t,message:e,duration:r}].slice(-5),a}function c2(e){Dr.value=Dr.value.filter(t=>t.id!==e)}const pe={success:(e,t)=>qo(e,"success",t),error:(e,t)=>qo(e,"error",t),warning:(e,t)=>qo(e,"warning",t),info:(e,t)=>qo(e,"info",t)},u2={success:{bg:"bg-[var(--color-success)]/10",icon:"text-[var(--color-success)]",border:"border-[var(--color-success)]/20"},error:{bg:"bg-[var(--color-error)]/10",icon:"text-[var(--color-error)]",border:"border-[var(--color-error)]/20"},warning:{bg:"bg-[var(--color-warning)]/10",icon:"text-[var(--color-warning)]",border:"border-[var(--color-warning)]/20"},info:{bg:"bg-[var(--color-accent)]/10",icon:"text-[var(--color-accent)]",border:"border-[var(--color-accent)]/20"}};function d2({id:e,type:t,message:r,duration:a=5e3,onDismiss:o}){const l=u2[t];return z(()=>{if(a<=0)return;const s=setTimeout(()=>{o(e)},a);return()=>clearTimeout(s)},[e,a,o]),n("div",{role:"alert","aria-live":"polite",class:`
178
+ flex items-start gap-3 p-4
179
+ rounded-xl border shadow-soft-lg
180
+ backdrop-blur-sm
181
+ ${l.bg} ${l.border}
182
+ animate-slide-in
183
+ `,children:[n("span",{class:`flex-shrink-0 ${l.icon}`,"aria-hidden":"true",children:n(p2,{type:t})}),n("p",{class:"flex-1 text-sm text-[var(--color-text-primary)]",children:r}),n(Q,{icon:n(ea,{class:"w-4 h-4"}),label:i("actions.close"),variant:"ghost",size:"sm",onClick:()=>o(e)})]})}const h2={"top-right":"top-4 right-4","top-left":"top-4 left-4","bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-center":"top-4 left-1/2 -translate-x-1/2","bottom-center":"bottom-4 left-1/2 -translate-x-1/2"};function f2({position:e="top-right"}){return Dr.value.length===0?null:n("div",{class:`fixed z-50 flex flex-col gap-2 w-full max-w-sm ${h2[e]}`,"aria-label":"Notifications",children:Dr.value.map(t=>n(d2,{...t,onDismiss:c2},t.id))})}function p2({type:e}){const t="w-5 h-5";switch(e){case"success":return n(on,{class:t,"aria-hidden":"true"});case"error":return n(Xr,{class:t,"aria-hidden":"true"});case"warning":return n(tr,{class:t,"aria-hidden":"true"});default:return n(ys,{class:t,"aria-hidden":"true"})}}class g2 extends Xe{constructor(t){super(t),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){this.setState({errorInfo:r}),this.props.onError?.(t,r),M.ui.error("ErrorBoundary caught error:",t),M.ui.error("Component stack:",r.componentStack)}handleRetry=()=>{this.setState({hasError:!1,error:null,errorInfo:null}),this.props.onRetry?.()};render(){return this.state.hasError?this.props.fallback?this.props.fallback:n(v2,{error:this.state.error,errorInfo:this.state.errorInfo,onRetry:this.handleRetry}):this.props.children}}function v2({error:e,errorInfo:t,onRetry:r}){return n("div",{class:"flex-1 flex items-center justify-center p-8",role:"alert","aria-live":"assertive",children:n("div",{class:"max-w-md w-full text-center",children:[n("div",{class:"text-5xl mb-4",children:"⚠️"}),n("h2",{class:"text-xl font-semibold text-[var(--color-text-primary)] mb-2",children:i("errors.generic")}),n("p",{class:"text-[var(--color-text-muted)] mb-6",children:e?.message||i("errors.unknown")}),n(L,{onClick:r,variant:"primary",children:i("actions.retry")}),!1]})})}const Ft=v([]),Qa=v(new Map),m2=300*1e3,Ki=new Map;function b2(){const e=Date.now(),t=[];for(const[r,a]of Ki)e-a>m2&&t.push(r);if(t.length>0){const r=new Map(Qa.value);for(const a of t)r.delete(a),Ki.delete(a);Qa.value=r,M.exec.debug(`Pruned ${t.length} old resolved approval(s)`)}}const jl=v(!1),Bl=v(null);function x2(e){const t={request:e,expiresAtMs:e.expiresAtMs,receivedAt:Date.now()};Ft.value=[...Ft.value,t],M.exec.info(`Exec approval queued: ${e.command} (${Ft.value.length} pending)`)}function y2(e){Ft.value=Ft.value.filter(t=>t.request.requestId!==e)}function w2(){const e=Date.now(),t=Ft.value.length;Ft.value=Ft.value.filter(a=>a.expiresAtMs>e);const r=t-Ft.value.length;r>0&&M.exec.info(`Pruned ${r} expired exec approval(s)`)}async function k2(e,t){jl.value=!0,Bl.value=null;try{await H("exec.approval.resolve",{id:e,decision:t}),y2(e);const r=new Map(Qa.value);r.set(e,t),Qa.value=r,Ki.set(e,Date.now()),b2(),M.exec.info(`Exec ${t} (direct): id=${e}`)}catch(r){const a=r instanceof Error?r.message:"Failed to send decision";throw Bl.value=a,M.exec.error(`Exec approval error: ${a}`),r}finally{jl.value=!1}}let pl=null,gl=null;function _2(){Qp(),pl=hs(e=>{if(e.event==="exec.approval.requested"&&e.payload){const t=e.payload,r={requestId:t.id,command:t.request.command,cwd:t.request.cwd??void 0,host:t.request.host??void 0,security:t.request.security??void 0,ask:t.request.ask??void 0,agentId:t.request.agentId??void 0,resolvedPath:t.request.resolvedPath??void 0,sessionKey:t.request.sessionKey??void 0,expiresAtMs:t.expiresAtMs};r.expiresAtMs>Date.now()?x2(r):M.exec.debug("Ignoring already-expired approval request")}}),gl=setInterval(w2,1e3),M.exec.info("Exec approval system initialized")}function Qp(){pl&&(pl(),pl=null),gl&&(clearInterval(gl),gl=null),Ft.value=[],jl.value=!1,Bl.value=null}let uh=!1;$.subscribe(e=>{uh&&!e&&Qp(),uh=e});function vu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var nr=vu();function eg(e){nr=e}var Ma={exec:()=>null};function Z(e,t=""){let r=typeof e=="string"?e:e.source,a={replace:(o,l)=>{let s=typeof l=="string"?l:l.source;return s=s.replace(Fe.caret,"$1"),r=r.replace(o,s),a},getRegex:()=>new RegExp(r,t)};return a}var S2=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Fe={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},C2=/^(?:[ \t]*(?:\n|$))+/,E2=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,T2=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ko=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,A2=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,mu=/(?:[*+-]|\d{1,9}[.)])/,tg=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ng=Z(tg).replace(/bull/g,mu).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),M2=Z(tg).replace(/bull/g,mu).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),bu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,I2=/^[^\n]+/,xu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,R2=Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",xu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),$2=Z(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,mu).getRegex(),Cs="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",yu=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,D2=Z("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",yu).replace("tag",Cs).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),rg=Z(bu).replace("hr",ko).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Cs).getRegex(),L2=Z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",rg).getRegex(),wu={blockquote:L2,code:E2,def:R2,fences:T2,heading:A2,hr:ko,html:D2,lheading:ng,list:$2,newline:C2,paragraph:rg,table:Ma,text:I2},dh=Z("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ko).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Cs).getRegex(),N2={...wu,lheading:M2,table:dh,paragraph:Z(bu).replace("hr",ko).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",dh).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Cs).getRegex()},O2={...wu,html:Z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",yu).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ma,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Z(bu).replace("hr",ko).replace("heading",` *#{1,6} *[^
184
+ ]`).replace("lheading",ng).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},F2=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,P2=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ag=/^( {2,}|\\)\n(?!\s*$)/,z2=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Es=/[\p{P}\p{S}]/u,ku=/[\s\p{P}\p{S}]/u,og=/[^\s\p{P}\p{S}]/u,U2=Z(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ku).getRegex(),lg=/(?!~)[\p{P}\p{S}]/u,H2=/(?!~)[\s\p{P}\p{S}]/u,j2=/(?:[^\s\p{P}\p{S}]|~)/u,B2=Z(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",S2?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),sg=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,W2=Z(sg,"u").replace(/punct/g,Es).getRegex(),q2=Z(sg,"u").replace(/punct/g,lg).getRegex(),ig="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",G2=Z(ig,"gu").replace(/notPunctSpace/g,og).replace(/punctSpace/g,ku).replace(/punct/g,Es).getRegex(),K2=Z(ig,"gu").replace(/notPunctSpace/g,j2).replace(/punctSpace/g,H2).replace(/punct/g,lg).getRegex(),V2=Z("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,og).replace(/punctSpace/g,ku).replace(/punct/g,Es).getRegex(),Y2=Z(/\\(punct)/,"gu").replace(/punct/g,Es).getRegex(),J2=Z(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),X2=Z(yu).replace("(?:-->|$)","-->").getRegex(),Z2=Z("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",X2).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Wl=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Q2=Z(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Wl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),cg=Z(/^!?\[(label)\]\[(ref)\]/).replace("label",Wl).replace("ref",xu).getRegex(),ug=Z(/^!?\[(ref)\](?:\[\])?/).replace("ref",xu).getRegex(),ew=Z("reflink|nolink(?!\\()","g").replace("reflink",cg).replace("nolink",ug).getRegex(),hh=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,_u={_backpedal:Ma,anyPunctuation:Y2,autolink:J2,blockSkip:B2,br:ag,code:P2,del:Ma,emStrongLDelim:W2,emStrongRDelimAst:G2,emStrongRDelimUnd:V2,escape:F2,link:Q2,nolink:ug,punctuation:U2,reflink:cg,reflinkSearch:ew,tag:Z2,text:z2,url:Ma},tw={..._u,link:Z(/^!?\[(label)\]\((.*?)\)/).replace("label",Wl).getRegex(),reflink:Z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Wl).getRegex()},Vi={..._u,emStrongRDelimAst:K2,emStrongLDelim:q2,url:Z(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",hh).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Z(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",hh).getRegex()},nw={...Vi,br:Z(ag).replace("{2,}","*").getRegex(),text:Z(Vi.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Go={normal:wu,gfm:N2,pedantic:O2},ua={normal:_u,gfm:Vi,breaks:nw,pedantic:tw},rw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},fh=e=>rw[e];function Xt(e,t){if(t){if(Fe.escapeTest.test(e))return e.replace(Fe.escapeReplace,fh)}else if(Fe.escapeTestNoEncode.test(e))return e.replace(Fe.escapeReplaceNoEncode,fh);return e}function ph(e){try{e=encodeURI(e).replace(Fe.percentDecode,"%")}catch{return null}return e}function gh(e,t){let r=e.replace(Fe.findPipe,(l,s,c)=>{let u=!1,d=s;for(;--d>=0&&c[d]==="\\";)u=!u;return u?"|":" |"}),a=r.split(Fe.splitPipe),o=0;if(a[0].trim()||a.shift(),a.length>0&&!a.at(-1)?.trim()&&a.pop(),t)if(a.length>t)a.splice(t);else for(;a.length<t;)a.push("");for(;o<a.length;o++)a[o]=a[o].trim().replace(Fe.slashPipe,"|");return a}function da(e,t,r){let a=e.length;if(a===0)return"";let o=0;for(;o<a&&e.charAt(a-o-1)===t;)o++;return e.slice(0,a-o)}function aw(e,t){if(e.indexOf(t[1])===-1)return-1;let r=0;for(let a=0;a<e.length;a++)if(e[a]==="\\")a++;else if(e[a]===t[0])r++;else if(e[a]===t[1]&&(r--,r<0))return a;return r>0?-2:-1}function vh(e,t,r,a,o){let l=t.href,s=t.title||null,c=e[1].replace(o.other.outputLinkReplace,"$1");a.state.inLink=!0;let u={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:l,title:s,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,u}function ow(e,t,r){let a=e.match(r.other.indentCodeCompensation);if(a===null)return t;let o=a[1];return t.split(`
185
+ `).map(l=>{let s=l.match(r.other.beginningSpace);if(s===null)return l;let[c]=s;return c.length>=o.length?l.slice(o.length):l}).join(`
186
+ `)}var ql=class{options;rules;lexer;constructor(e){this.options=e||nr}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let r=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:da(r,`
187
+ `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],a=ow(r,t[3]||"",this.rules);return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:a}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(this.rules.other.endingHash.test(r)){let a=da(r,"#");(this.options.pedantic||!a||this.rules.other.endingSpaceChar.test(a))&&(r=a.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:da(t[0],`
188
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let r=da(t[0],`
189
+ `).split(`
190
+ `),a="",o="",l=[];for(;r.length>0;){let s=!1,c=[],u;for(u=0;u<r.length;u++)if(this.rules.other.blockquoteStart.test(r[u]))c.push(r[u]),s=!0;else if(!s)c.push(r[u]);else break;r=r.slice(u);let d=c.join(`
191
+ `),h=d.replace(this.rules.other.blockquoteSetextReplace,`
192
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
193
+ ${d}`:d,o=o?`${o}
194
+ ${h}`:h;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,l,!0),this.lexer.state.top=f,r.length===0)break;let g=l.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let m=g,y=m.raw+`
195
+ `+r.join(`
196
+ `),C=this.blockquote(y);l[l.length-1]=C,a=a.substring(0,a.length-m.raw.length)+C.raw,o=o.substring(0,o.length-m.text.length)+C.text;break}else if(g?.type==="list"){let m=g,y=m.raw+`
197
+ `+r.join(`
198
+ `),C=this.list(y);l[l.length-1]=C,a=a.substring(0,a.length-g.raw.length)+C.raw,o=o.substring(0,o.length-m.raw.length)+C.raw,r=y.substring(l.at(-1).raw.length).split(`
199
+ `);continue}}return{type:"blockquote",raw:a,tokens:l,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r=t[1].trim(),a=r.length>1,o={type:"list",raw:"",ordered:a,start:a?+r.slice(0,-1):"",loose:!1,items:[]};r=a?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=a?r:"[*+-]");let l=this.rules.other.listItemRegex(r),s=!1;for(;e;){let u=!1,d="",h="";if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let f=t[2].split(`
200
+ `,1)[0].replace(this.rules.other.listReplaceTabs,C=>" ".repeat(3*C.length)),g=e.split(`
201
+ `,1)[0],m=!f.trim(),y=0;if(this.options.pedantic?(y=2,h=f.trimStart()):m?y=t[1].length+1:(y=t[2].search(this.rules.other.nonSpaceChar),y=y>4?1:y,h=f.slice(y),y+=t[1].length),m&&this.rules.other.blankLine.test(g)&&(d+=g+`
202
+ `,e=e.substring(g.length+1),u=!0),!u){let C=this.rules.other.nextBulletRegex(y),T=this.rules.other.hrRegex(y),_=this.rules.other.fencesBeginRegex(y),p=this.rules.other.headingBeginRegex(y),b=this.rules.other.htmlBeginRegex(y);for(;e;){let k=e.split(`
203
+ `,1)[0],E;if(g=k,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),E=g):E=g.replace(this.rules.other.tabCharGlobal," "),_.test(g)||p.test(g)||b.test(g)||C.test(g)||T.test(g))break;if(E.search(this.rules.other.nonSpaceChar)>=y||!g.trim())h+=`
204
+ `+E.slice(y);else{if(m||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(f)||p.test(f)||T.test(f))break;h+=`
205
+ `+g}!m&&!g.trim()&&(m=!0),d+=k+`
206
+ `,e=e.substring(k.length+1),f=E.slice(y)}}o.loose||(s?o.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(s=!0)),o.items.push({type:"list_item",raw:d,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),o.raw+=d}let c=o.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let u of o.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){if(u.text=u.text.replace(this.rules.other.listReplaceTask,""),u.tokens[0]?.type==="text"||u.tokens[0]?.type==="paragraph"){u.tokens[0].raw=u.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),u.tokens[0].text=u.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}}let d=this.rules.other.listTaskCheckbox.exec(u.raw);if(d){let h={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};u.checked=h.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=h.raw+u.tokens[0].raw,u.tokens[0].text=h.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(h)):u.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):u.tokens.unshift(h)}}if(!o.loose){let d=u.tokens.filter(f=>f.type==="space"),h=d.length>0&&d.some(f=>this.rules.other.anyLine.test(f.raw));o.loose=h}}if(o.loose)for(let u of o.items){u.loose=!0;for(let d of u.tokens)d.type==="text"&&(d.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let r=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),a=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:r,raw:t[0],href:a,title:o}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let r=gh(t[1]),a=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
207
+ `):[],l={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===a.length){for(let s of a)this.rules.other.tableAlignRight.test(s)?l.align.push("right"):this.rules.other.tableAlignCenter.test(s)?l.align.push("center"):this.rules.other.tableAlignLeft.test(s)?l.align.push("left"):l.align.push(null);for(let s=0;s<r.length;s++)l.header.push({text:r[s],tokens:this.lexer.inline(r[s]),header:!0,align:l.align[s]});for(let s of o)l.rows.push(gh(s,l.header.length).map((c,u)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:l.align[u]})));return l}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let r=t[1].charAt(t[1].length-1)===`
208
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let l=da(r.slice(0,-1),"\\");if((r.length-l.length)%2===0)return}else{let l=aw(t[2],"()");if(l===-2)return;if(l>-1){let s=(t[0].indexOf("!")===0?5:4)+t[1].length+l;t[2]=t[2].substring(0,l),t[0]=t[0].substring(0,s).trim(),t[3]=""}}let a=t[2],o="";if(this.options.pedantic){let l=this.rules.other.pedanticHrefTitle.exec(a);l&&(a=l[1],o=l[3])}else o=t[3]?t[3].slice(1,-1):"";return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?a=a.slice(1):a=a.slice(1,-1)),vh(t,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let a=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[a.toLowerCase()];if(!o){let l=r[0].charAt(0);return{type:"text",raw:l,text:l}}return vh(r,o,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let a=this.rules.inline.emStrongLDelim.exec(e);if(!(!a||a[3]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(a[1]||a[2])||!r||this.rules.inline.punctuation.exec(r))){let o=[...a[0]].length-1,l,s,c=o,u=0,d=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+o);(a=d.exec(t))!=null;){if(l=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!l)continue;if(s=[...l].length,a[3]||a[4]){c+=s;continue}else if((a[5]||a[6])&&o%3&&!((o+s)%3)){u+=s;continue}if(c-=s,c>0)continue;s=Math.min(s,s+c+u);let h=[...a[0]][0].length,f=e.slice(0,o+a.index+h+s);if(Math.min(o,s)%2){let m=f.slice(1,-1);return{type:"em",raw:f,text:m,tokens:this.lexer.inlineTokens(m)}}let g=f.slice(2,-2);return{type:"strong",raw:f,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(this.rules.other.newLineCharGlobal," "),a=this.rules.other.nonSpaceChar.test(r),o=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return a&&o&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:t[0],text:r}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let r,a;return t[2]==="@"?(r=t[1],a="mailto:"+r):(r=t[1],a=r),{type:"link",raw:t[0],text:r,href:a,tokens:[{type:"text",raw:r,text:r}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let r,a;if(t[2]==="@")r=t[0],a="mailto:"+r;else{let o;do o=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(o!==t[0]);r=t[0],t[1]==="www."?a="http://"+t[0]:a=t[0]}return{type:"link",raw:t[0],text:r,href:a,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let r=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:r}}}},pt=class Yi{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||nr,this.options.tokenizer=this.options.tokenizer||new ql,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:Fe,block:Go.normal,inline:ua.normal};this.options.pedantic?(r.block=Go.pedantic,r.inline=ua.pedantic):this.options.gfm&&(r.block=Go.gfm,this.options.breaks?r.inline=ua.breaks:r.inline=ua.gfm),this.tokenizer.rules=r}static get rules(){return{block:Go,inline:ua}}static lex(t,r){return new Yi(r).lex(t)}static lexInline(t,r){return new Yi(r).inlineTokens(t)}lex(t){t=t.replace(Fe.carriageReturn,`
209
+ `),this.blockTokens(t,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let a=this.inlineQueue[r];this.inlineTokens(a.src,a.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,r=[],a=!1){for(this.options.pedantic&&(t=t.replace(Fe.tabCharGlobal," ").replace(Fe.spaceLine,""));t;){let o;if(this.options.extensions?.block?.some(s=>(o=s.call({lexer:this},t,r))?(t=t.substring(o.raw.length),r.push(o),!0):!1))continue;if(o=this.tokenizer.space(t)){t=t.substring(o.raw.length);let s=r.at(-1);o.raw.length===1&&s!==void 0?s.raw+=`
210
+ `:r.push(o);continue}if(o=this.tokenizer.code(t)){t=t.substring(o.raw.length);let s=r.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
211
+ `)?"":`
212
+ `)+o.raw,s.text+=`
213
+ `+o.text,this.inlineQueue.at(-1).src=s.text):r.push(o);continue}if(o=this.tokenizer.fences(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.heading(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.hr(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.blockquote(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.list(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.html(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.def(t)){t=t.substring(o.raw.length);let s=r.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
214
+ `)?"":`
215
+ `)+o.raw,s.text+=`
216
+ `+o.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},r.push(o));continue}if(o=this.tokenizer.table(t)){t=t.substring(o.raw.length),r.push(o);continue}if(o=this.tokenizer.lheading(t)){t=t.substring(o.raw.length),r.push(o);continue}let l=t;if(this.options.extensions?.startBlock){let s=1/0,c=t.slice(1),u;this.options.extensions.startBlock.forEach(d=>{u=d.call({lexer:this},c),typeof u=="number"&&u>=0&&(s=Math.min(s,u))}),s<1/0&&s>=0&&(l=t.substring(0,s+1))}if(this.state.top&&(o=this.tokenizer.paragraph(l))){let s=r.at(-1);a&&s?.type==="paragraph"?(s.raw+=(s.raw.endsWith(`
217
+ `)?"":`
218
+ `)+o.raw,s.text+=`
219
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):r.push(o),a=l.length!==t.length,t=t.substring(o.raw.length);continue}if(o=this.tokenizer.text(t)){t=t.substring(o.raw.length);let s=r.at(-1);s?.type==="text"?(s.raw+=(s.raw.endsWith(`
220
+ `)?"":`
221
+ `)+o.raw,s.text+=`
222
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):r.push(o);continue}if(t){let s="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){let a=t,o=null;if(this.tokens.links){let u=Object.keys(this.tokens.links);if(u.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)u.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,o.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let l;for(;(o=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)l=o[2]?o[2].length:0,a=a.slice(0,o.index+l)+"["+"a".repeat(o[0].length-l-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);a=this.options.hooks?.emStrongMask?.call({lexer:this},a)??a;let s=!1,c="";for(;t;){s||(c=""),s=!1;let u;if(this.options.extensions?.inline?.some(h=>(u=h.call({lexer:this},t,r))?(t=t.substring(u.raw.length),r.push(u),!0):!1))continue;if(u=this.tokenizer.escape(t)){t=t.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.tag(t)){t=t.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.link(t)){t=t.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(u.raw.length);let h=r.at(-1);u.type==="text"&&h?.type==="text"?(h.raw+=u.raw,h.text+=u.text):r.push(u);continue}if(u=this.tokenizer.emStrong(t,a,c)){t=t.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.codespan(t)){t=t.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.br(t)){t=t.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.del(t)){t=t.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.autolink(t)){t=t.substring(u.raw.length),r.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(t))){t=t.substring(u.raw.length),r.push(u);continue}let d=t;if(this.options.extensions?.startInline){let h=1/0,f=t.slice(1),g;this.options.extensions.startInline.forEach(m=>{g=m.call({lexer:this},f),typeof g=="number"&&g>=0&&(h=Math.min(h,g))}),h<1/0&&h>=0&&(d=t.substring(0,h+1))}if(u=this.tokenizer.inlineText(d)){t=t.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(c=u.raw.slice(-1)),s=!0;let h=r.at(-1);h?.type==="text"?(h.raw+=u.raw,h.text+=u.text):r.push(u);continue}if(t){let h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return r}},Gl=class{options;parser;constructor(e){this.options=e||nr}space(e){return""}code({text:e,lang:t,escaped:r}){let a=(t||"").match(Fe.notSpaceStart)?.[0],o=e.replace(Fe.endingNewline,"")+`
223
+ `;return a?'<pre><code class="language-'+Xt(a)+'">'+(r?o:Xt(o,!0))+`</code></pre>
224
+ `:"<pre><code>"+(r?o:Xt(o,!0))+`</code></pre>
225
+ `}blockquote({tokens:e}){return`<blockquote>
226
+ ${this.parser.parse(e)}</blockquote>
227
+ `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
228
+ `}hr(e){return`<hr>
229
+ `}list(e){let t=e.ordered,r=e.start,a="";for(let s=0;s<e.items.length;s++){let c=e.items[s];a+=this.listitem(c)}let o=t?"ol":"ul",l=t&&r!==1?' start="'+r+'"':"";return"<"+o+l+`>
230
+ `+a+"</"+o+`>
231
+ `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
232
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
233
+ `}table(e){let t="",r="";for(let o=0;o<e.header.length;o++)r+=this.tablecell(e.header[o]);t+=this.tablerow({text:r});let a="";for(let o=0;o<e.rows.length;o++){let l=e.rows[o];r="";for(let s=0;s<l.length;s++)r+=this.tablecell(l[s]);a+=this.tablerow({text:r})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
234
+ <thead>
235
+ `+t+`</thead>
236
+ `+a+`</table>
237
+ `}tablerow({text:e}){return`<tr>
238
+ ${e}</tr>
239
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
240
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Xt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let a=this.parser.parseInline(r),o=ph(e);if(o===null)return a;e=o;let l='<a href="'+e+'"';return t&&(l+=' title="'+Xt(t)+'"'),l+=">"+a+"</a>",l}image({href:e,title:t,text:r,tokens:a}){a&&(r=this.parser.parseInline(a,this.parser.textRenderer));let o=ph(e);if(o===null)return Xt(r);e=o;let l=`<img src="${e}" alt="${r}"`;return t&&(l+=` title="${Xt(t)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Xt(e.text)}},Su=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},gt=class Ji{options;renderer;textRenderer;constructor(t){this.options=t||nr,this.options.renderer=this.options.renderer||new Gl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Su}static parse(t,r){return new Ji(r).parse(t)}static parseInline(t,r){return new Ji(r).parseInline(t)}parse(t){let r="";for(let a=0;a<t.length;a++){let o=t[a];if(this.options.extensions?.renderers?.[o.type]){let s=o,c=this.options.extensions.renderers[s.type].call({parser:this},s);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(s.type)){r+=c||"";continue}}let l=o;switch(l.type){case"space":{r+=this.renderer.space(l);break}case"hr":{r+=this.renderer.hr(l);break}case"heading":{r+=this.renderer.heading(l);break}case"code":{r+=this.renderer.code(l);break}case"table":{r+=this.renderer.table(l);break}case"blockquote":{r+=this.renderer.blockquote(l);break}case"list":{r+=this.renderer.list(l);break}case"checkbox":{r+=this.renderer.checkbox(l);break}case"html":{r+=this.renderer.html(l);break}case"def":{r+=this.renderer.def(l);break}case"paragraph":{r+=this.renderer.paragraph(l);break}case"text":{r+=this.renderer.text(l);break}default:{let s='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return r}parseInline(t,r=this.renderer){let a="";for(let o=0;o<t.length;o++){let l=t[o];if(this.options.extensions?.renderers?.[l.type]){let c=this.options.extensions.renderers[l.type].call({parser:this},l);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){a+=c||"";continue}}let s=l;switch(s.type){case"escape":{a+=r.text(s);break}case"html":{a+=r.html(s);break}case"link":{a+=r.link(s);break}case"image":{a+=r.image(s);break}case"checkbox":{a+=r.checkbox(s);break}case"strong":{a+=r.strong(s);break}case"em":{a+=r.em(s);break}case"codespan":{a+=r.codespan(s);break}case"br":{a+=r.br(s);break}case"del":{a+=r.del(s);break}case"text":{a+=r.text(s);break}default:{let c='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return a}},ya=class{options;block;constructor(e){this.options=e||nr}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?pt.lex:pt.lexInline}provideParser(){return this.block?gt.parse:gt.parseInline}},dg=class{defaults=vu();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=gt;Renderer=Gl;TextRenderer=Su;Lexer=pt;Tokenizer=ql;Hooks=ya;constructor(...e){this.use(...e)}walkTokens(e,t){let r=[];for(let a of e)switch(r=r.concat(t.call(this,a)),a.type){case"table":{let o=a;for(let l of o.header)r=r.concat(this.walkTokens(l.tokens,t));for(let l of o.rows)for(let s of l)r=r.concat(this.walkTokens(s.tokens,t));break}case"list":{let o=a;r=r.concat(this.walkTokens(o.items,t));break}default:{let o=a;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{let s=o[l].flat(1/0);r=r.concat(this.walkTokens(s,t))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let a={...r};if(a.async=this.defaults.async||a.async||!1,r.extensions&&(r.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let l=t.renderers[o.name];l?t.renderers[o.name]=function(...s){let c=o.renderer.apply(this,s);return c===!1&&(c=l.apply(this,s)),c}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let l=t[o.level];l?l.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),a.extensions=t),r.renderer){let o=this.defaults.renderer||new Gl(this.defaults);for(let l in r.renderer){if(!(l in o))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;let s=l,c=r.renderer[s],u=o[s];o[s]=(...d)=>{let h=c.apply(o,d);return h===!1&&(h=u.apply(o,d)),h||""}}a.renderer=o}if(r.tokenizer){let o=this.defaults.tokenizer||new ql(this.defaults);for(let l in r.tokenizer){if(!(l in o))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;let s=l,c=r.tokenizer[s],u=o[s];o[s]=(...d)=>{let h=c.apply(o,d);return h===!1&&(h=u.apply(o,d)),h}}a.tokenizer=o}if(r.hooks){let o=this.defaults.hooks||new ya;for(let l in r.hooks){if(!(l in o))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;let s=l,c=r.hooks[s],u=o[s];ya.passThroughHooks.has(l)?o[s]=d=>{if(this.defaults.async&&ya.passThroughHooksRespectAsync.has(l))return(async()=>{let f=await c.call(o,d);return u.call(o,f)})();let h=c.call(o,d);return u.call(o,h)}:o[s]=(...d)=>{if(this.defaults.async)return(async()=>{let f=await c.apply(o,d);return f===!1&&(f=await u.apply(o,d)),f})();let h=c.apply(o,d);return h===!1&&(h=u.apply(o,d)),h}}a.hooks=o}if(r.walkTokens){let o=this.defaults.walkTokens,l=r.walkTokens;a.walkTokens=function(s){let c=[];return c.push(l.call(this,s)),o&&(c=c.concat(o.call(this,s))),c}}this.defaults={...this.defaults,...a}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return pt.lex(e,t??this.defaults)}parser(e,t){return gt.parse(e,t??this.defaults)}parseMarkdown(e){return(t,r)=>{let a={...r},o={...this.defaults,...a},l=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&a.async===!1)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let s=o.hooks?await o.hooks.preprocess(t):t,c=await(o.hooks?await o.hooks.provideLexer():e?pt.lex:pt.lexInline)(s,o),u=o.hooks?await o.hooks.processAllTokens(c):c;o.walkTokens&&await Promise.all(this.walkTokens(u,o.walkTokens));let d=await(o.hooks?await o.hooks.provideParser():e?gt.parse:gt.parseInline)(u,o);return o.hooks?await o.hooks.postprocess(d):d})().catch(l);try{o.hooks&&(t=o.hooks.preprocess(t));let s=(o.hooks?o.hooks.provideLexer():e?pt.lex:pt.lexInline)(t,o);o.hooks&&(s=o.hooks.processAllTokens(s)),o.walkTokens&&this.walkTokens(s,o.walkTokens);let c=(o.hooks?o.hooks.provideParser():e?gt.parse:gt.parseInline)(s,o);return o.hooks&&(c=o.hooks.postprocess(c)),c}catch(s){return l(s)}}}onError(e,t){return r=>{if(r.message+=`
241
+ Please report this to https://github.com/markedjs/marked.`,e){let a="<p>An error occurred:</p><pre>"+Xt(r.message+"",!0)+"</pre>";return t?Promise.resolve(a):a}if(t)return Promise.reject(r);throw r}}},Yn=new dg;function ne(e,t){return Yn.parse(e,t)}ne.options=ne.setOptions=function(e){return Yn.setOptions(e),ne.defaults=Yn.defaults,eg(ne.defaults),ne};ne.getDefaults=vu;ne.defaults=nr;ne.use=function(...e){return Yn.use(...e),ne.defaults=Yn.defaults,eg(ne.defaults),ne};ne.walkTokens=function(e,t){return Yn.walkTokens(e,t)};ne.parseInline=Yn.parseInline;ne.Parser=gt;ne.parser=gt.parse;ne.Renderer=Gl;ne.TextRenderer=Su;ne.Lexer=pt;ne.lexer=pt.lex;ne.Tokenizer=ql;ne.Hooks=ya;ne.parse=ne;ne.options;ne.setOptions;ne.use;ne.walkTokens;ne.parseInline;gt.parse;pt.lex;var mh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function lw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ti={exports:{}},bh;function sw(){return bh||(bh=1,(function(e){var t=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var r=(function(a){var o=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,l=0,s={},c={manual:a.Prism&&a.Prism.manual,disableWorkerMessageHandler:a.Prism&&a.Prism.disableWorkerMessageHandler,util:{encode:function p(b){return b instanceof u?new u(b.type,p(b.content),b.alias):Array.isArray(b)?b.map(p):b.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(p){return Object.prototype.toString.call(p).slice(8,-1)},objId:function(p){return p.__id||Object.defineProperty(p,"__id",{value:++l}),p.__id},clone:function p(b,k){k=k||{};var E,w;switch(c.util.type(b)){case"Object":if(w=c.util.objId(b),k[w])return k[w];E={},k[w]=E;for(var A in b)b.hasOwnProperty(A)&&(E[A]=p(b[A],k));return E;case"Array":return w=c.util.objId(b),k[w]?k[w]:(E=[],k[w]=E,b.forEach(function(D,S){E[S]=p(D,k)}),E);default:return b}},getLanguage:function(p){for(;p;){var b=o.exec(p.className);if(b)return b[1].toLowerCase();p=p.parentElement}return"none"},setLanguage:function(p,b){p.className=p.className.replace(RegExp(o,"gi"),""),p.classList.add("language-"+b)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(E){var p=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(E.stack)||[])[1];if(p){var b=document.getElementsByTagName("script");for(var k in b)if(b[k].src==p)return b[k]}return null}},isActive:function(p,b,k){for(var E="no-"+b;p;){var w=p.classList;if(w.contains(b))return!0;if(w.contains(E))return!1;p=p.parentElement}return!!k}},languages:{plain:s,plaintext:s,text:s,txt:s,extend:function(p,b){var k=c.util.clone(c.languages[p]);for(var E in b)k[E]=b[E];return k},insertBefore:function(p,b,k,E){E=E||c.languages;var w=E[p],A={};for(var D in w)if(w.hasOwnProperty(D)){if(D==b)for(var S in k)k.hasOwnProperty(S)&&(A[S]=k[S]);k.hasOwnProperty(D)||(A[D]=w[D])}var F=E[p];return E[p]=A,c.languages.DFS(c.languages,function(N,re){re===F&&N!=p&&(this[N]=A)}),A},DFS:function p(b,k,E,w){w=w||{};var A=c.util.objId;for(var D in b)if(b.hasOwnProperty(D)){k.call(b,D,b[D],E||D);var S=b[D],F=c.util.type(S);F==="Object"&&!w[A(S)]?(w[A(S)]=!0,p(S,k,null,w)):F==="Array"&&!w[A(S)]&&(w[A(S)]=!0,p(S,k,D,w))}}},plugins:{},highlightAll:function(p,b){c.highlightAllUnder(document,p,b)},highlightAllUnder:function(p,b,k){var E={callback:k,container:p,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};c.hooks.run("before-highlightall",E),E.elements=Array.prototype.slice.apply(E.container.querySelectorAll(E.selector)),c.hooks.run("before-all-elements-highlight",E);for(var w=0,A;A=E.elements[w++];)c.highlightElement(A,b===!0,E.callback)},highlightElement:function(p,b,k){var E=c.util.getLanguage(p),w=c.languages[E];c.util.setLanguage(p,E);var A=p.parentElement;A&&A.nodeName.toLowerCase()==="pre"&&c.util.setLanguage(A,E);var D=p.textContent,S={element:p,language:E,grammar:w,code:D};function F(re){S.highlightedCode=re,c.hooks.run("before-insert",S),S.element.innerHTML=S.highlightedCode,c.hooks.run("after-highlight",S),c.hooks.run("complete",S),k&&k.call(S.element)}if(c.hooks.run("before-sanity-check",S),A=S.element.parentElement,A&&A.nodeName.toLowerCase()==="pre"&&!A.hasAttribute("tabindex")&&A.setAttribute("tabindex","0"),!S.code){c.hooks.run("complete",S),k&&k.call(S.element);return}if(c.hooks.run("before-highlight",S),!S.grammar){F(c.util.encode(S.code));return}if(b&&a.Worker){var N=new Worker(c.filename);N.onmessage=function(re){F(re.data)},N.postMessage(JSON.stringify({language:S.language,code:S.code,immediateClose:!0}))}else F(c.highlight(S.code,S.grammar,S.language))},highlight:function(p,b,k){var E={code:p,grammar:b,language:k};if(c.hooks.run("before-tokenize",E),!E.grammar)throw new Error('The language "'+E.language+'" has no grammar.');return E.tokens=c.tokenize(E.code,E.grammar),c.hooks.run("after-tokenize",E),u.stringify(c.util.encode(E.tokens),E.language)},tokenize:function(p,b){var k=b.rest;if(k){for(var E in k)b[E]=k[E];delete b.rest}var w=new f;return g(w,w.head,p),h(p,w,b,w.head,0),y(w)},hooks:{all:{},add:function(p,b){var k=c.hooks.all;k[p]=k[p]||[],k[p].push(b)},run:function(p,b){var k=c.hooks.all[p];if(!(!k||!k.length))for(var E=0,w;w=k[E++];)w(b)}},Token:u};a.Prism=c;function u(p,b,k,E){this.type=p,this.content=b,this.alias=k,this.length=(E||"").length|0}u.stringify=function p(b,k){if(typeof b=="string")return b;if(Array.isArray(b)){var E="";return b.forEach(function(F){E+=p(F,k)}),E}var w={type:b.type,content:p(b.content,k),tag:"span",classes:["token",b.type],attributes:{},language:k},A=b.alias;A&&(Array.isArray(A)?Array.prototype.push.apply(w.classes,A):w.classes.push(A)),c.hooks.run("wrap",w);var D="";for(var S in w.attributes)D+=" "+S+'="'+(w.attributes[S]||"").replace(/"/g,"&quot;")+'"';return"<"+w.tag+' class="'+w.classes.join(" ")+'"'+D+">"+w.content+"</"+w.tag+">"};function d(p,b,k,E){p.lastIndex=b;var w=p.exec(k);if(w&&E&&w[1]){var A=w[1].length;w.index+=A,w[0]=w[0].slice(A)}return w}function h(p,b,k,E,w,A){for(var D in k)if(!(!k.hasOwnProperty(D)||!k[D])){var S=k[D];S=Array.isArray(S)?S:[S];for(var F=0;F<S.length;++F){if(A&&A.cause==D+","+F)return;var N=S[F],re=N.inside,de=!!N.lookbehind,sn=!!N.greedy,ra=N.alias;if(sn&&!N.pattern.global){var aa=N.pattern.toString().match(/[imsuy]*$/)[0];N.pattern=RegExp(N.pattern.source,aa+"g")}for(var cn=N.pattern||N,ve=E.next,U=w;ve!==b.tail&&!(A&&U>=A.reach);U+=ve.value.length,ve=ve.next){var ae=ve.value;if(b.length>p.length)return;if(!(ae instanceof u)){var he=1,Be;if(sn){if(Be=d(cn,U,p,de),!Be||Be.index>=p.length)break;var _t=Be.index,we=Be.index+Be[0].length,dt=U;for(dt+=ve.value.length;_t>=dt;)ve=ve.next,dt+=ve.value.length;if(dt-=ve.value.length,U=dt,ve.value instanceof u)continue;for(var oe=ve;oe!==b.tail&&(dt<we||typeof oe.value=="string");oe=oe.next)he++,dt+=oe.value.length;he--,ae=p.slice(U,dt),Be.index-=U}else if(Be=d(cn,0,ae,de),!Be)continue;var _t=Be.index,un=Be[0],St=ae.slice(0,_t),oa=ae.slice(_t+un.length),Cn=U+ae.length;A&&Cn>A.reach&&(A.reach=Cn);var En=ve.prev;St&&(En=g(b,En,St),U+=St.length),m(b,En,he);var Ao=new u(D,re?c.tokenize(un,re):un,ra,un);if(ve=g(b,En,Ao),oa&&g(b,ve,oa),he>1){var Ct={cause:D+","+F,reach:Cn};h(p,b,k,ve.prev,U,Ct),A&&Ct.reach>A.reach&&(A.reach=Ct.reach)}}}}}}function f(){var p={value:null,prev:null,next:null},b={value:null,prev:p,next:null};p.next=b,this.head=p,this.tail=b,this.length=0}function g(p,b,k){var E=b.next,w={value:k,prev:b,next:E};return b.next=w,E.prev=w,p.length++,w}function m(p,b,k){for(var E=b.next,w=0;w<k&&E!==p.tail;w++)E=E.next;b.next=E,E.prev=b,p.length-=w}function y(p){for(var b=[],k=p.head.next;k!==p.tail;)b.push(k.value),k=k.next;return b}if(!a.document)return a.addEventListener&&(c.disableWorkerMessageHandler||a.addEventListener("message",function(p){var b=JSON.parse(p.data),k=b.language,E=b.code,w=b.immediateClose;a.postMessage(c.highlight(E,c.languages[k],k)),w&&a.close()},!1)),c;var C=c.util.currentScript();C&&(c.filename=C.src,C.hasAttribute("data-manual")&&(c.manual=!0));function T(){c.manual||c.highlightAll()}if(!c.manual){var _=document.readyState;_==="loading"||_==="interactive"&&C&&C.defer?document.addEventListener("DOMContentLoaded",T):window.requestAnimationFrame?window.requestAnimationFrame(T):window.setTimeout(T,16)}return c})(t);e.exports&&(e.exports=r),typeof mh<"u"&&(mh.Prism=r),r.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},r.languages.markup.tag.inside["attr-value"].inside.entity=r.languages.markup.entity,r.languages.markup.doctype.inside["internal-subset"].inside=r.languages.markup,r.hooks.add("wrap",function(a){a.type==="entity"&&(a.attributes.title=a.content.replace(/&amp;/,"&"))}),Object.defineProperty(r.languages.markup.tag,"addInlined",{value:function(o,l){var s={};s["language-"+l]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:r.languages[l]},s.cdata=/^<!\[CDATA\[|\]\]>$/i;var c={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:s}};c["language-"+l]={pattern:/[\s\S]+/,inside:r.languages[l]};var u={};u[o]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return o}),"i"),lookbehind:!0,greedy:!0,inside:c},r.languages.insertBefore("markup","cdata",u)}}),Object.defineProperty(r.languages.markup.tag,"addAttribute",{value:function(a,o){r.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+a+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[o,"language-"+o],inside:r.languages[o]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),r.languages.html=r.languages.markup,r.languages.mathml=r.languages.markup,r.languages.svg=r.languages.markup,r.languages.xml=r.languages.extend("markup",{}),r.languages.ssml=r.languages.xml,r.languages.atom=r.languages.xml,r.languages.rss=r.languages.xml,(function(a){var o=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;a.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+o.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+o.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+o.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+o.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:o,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},a.languages.css.atrule.inside.rest=a.languages.css;var l=a.languages.markup;l&&(l.tag.addInlined("style","css"),l.tag.addAttribute("style","css"))})(r),r.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},r.languages.javascript=r.languages.extend("clike",{"class-name":[r.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),r.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,r.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:r.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:r.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:r.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:r.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:r.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),r.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:r.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),r.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),r.languages.markup&&(r.languages.markup.tag.addInlined("script","javascript"),r.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),r.languages.js=r.languages.javascript,(function(){if(typeof r>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var a="Loading…",o=function(C,T){return"✖ Error "+C+" while fetching file: "+T},l="✖ Error: File does not exist or is empty",s={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},c="data-src-status",u="loading",d="loaded",h="failed",f="pre[data-src]:not(["+c+'="'+d+'"]):not(['+c+'="'+u+'"])';function g(C,T,_){var p=new XMLHttpRequest;p.open("GET",C,!0),p.onreadystatechange=function(){p.readyState==4&&(p.status<400&&p.responseText?T(p.responseText):p.status>=400?_(o(p.status,p.statusText)):_(l))},p.send(null)}function m(C){var T=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(C||"");if(T){var _=Number(T[1]),p=T[2],b=T[3];return p?b?[_,Number(b)]:[_,void 0]:[_,_]}}r.hooks.add("before-highlightall",function(C){C.selector+=", "+f}),r.hooks.add("before-sanity-check",function(C){var T=C.element;if(T.matches(f)){C.code="",T.setAttribute(c,u);var _=T.appendChild(document.createElement("CODE"));_.textContent=a;var p=T.getAttribute("data-src"),b=C.language;if(b==="none"){var k=(/\.(\w+)$/.exec(p)||[,"none"])[1];b=s[k]||k}r.util.setLanguage(_,b),r.util.setLanguage(T,b);var E=r.plugins.autoloader;E&&E.loadLanguages(b),g(p,function(w){T.setAttribute(c,d);var A=m(T.getAttribute("data-range"));if(A){var D=w.split(/\r\n?|\n/g),S=A[0],F=A[1]==null?D.length:A[1];S<0&&(S+=D.length),S=Math.max(0,Math.min(S-1,D.length)),F<0&&(F+=D.length),F=Math.max(0,Math.min(F,D.length)),w=D.slice(S,F).join(`
242
+ `),T.hasAttribute("data-start")||T.setAttribute("data-start",String(S+1))}_.textContent=w,r.highlightElement(_)},function(w){T.setAttribute(c,h),_.textContent=w})}}),r.plugins.fileHighlight={highlight:function(T){for(var _=(T||document).querySelectorAll(f),p=0,b;b=_[p++];)r.highlightElement(b)}};var y=!1;r.fileHighlight=function(){y||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),y=!0),r.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(ti)),ti.exports}var iw=sw();const Ia=lw(iw);var xh={},yh;function cw(){return yh||(yh=1,(function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript})(Prism)),xh}cw();Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;(function(e){var t=e.util.clone(e.languages.javascript),r=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,a=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,o=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function l(u,d){return u=u.replace(/<S>/g,function(){return r}).replace(/<BRACES>/g,function(){return a}).replace(/<SPREAD>/g,function(){return o}),RegExp(u,d)}o=l(o).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=l(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:l(/<SPREAD>/.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:l(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var s=function(u){return u?typeof u=="string"?u:typeof u.content=="string"?u.content:u.content.map(s).join(""):""},c=function(u){for(var d=[],h=0;h<u.length;h++){var f=u[h],g=!1;if(typeof f!="string"&&(f.type==="tag"&&f.content[0]&&f.content[0].type==="tag"?f.content[0].content[0].content==="</"?d.length>0&&d[d.length-1].tagName===s(f.content[0].content[1])&&d.pop():f.content[f.content.length-1].content==="/>"||d.push({tagName:s(f.content[0].content[1]),openedBraces:0}):d.length>0&&f.type==="punctuation"&&f.content==="{"?d[d.length-1].openedBraces++:d.length>0&&d[d.length-1].openedBraces>0&&f.type==="punctuation"&&f.content==="}"?d[d.length-1].openedBraces--:g=!0),(g||typeof f=="string")&&d.length>0&&d[d.length-1].openedBraces===0){var m=s(f);h<u.length-1&&(typeof u[h+1]=="string"||u[h+1].type==="plain-text")&&(m+=s(u[h+1]),u.splice(h+1,1)),h>0&&(typeof u[h-1]=="string"||u[h-1].type==="plain-text")&&(m=s(u[h-1])+m,u.splice(h-1,1),h--),u[h]=new e.Token("plain-text",m,null,m)}f.content&&typeof f.content!="string"&&c(f.content)}};e.hooks.add("after-tokenize",function(u){u.language!=="jsx"&&u.language!=="tsx"||c(u.tokens)})})(Prism);(function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var r=e.languages.tsx.tag;r.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+r.pattern.source+")",r.pattern.flags),r.lookbehind=!0})(Prism);Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",r={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},a={bash:r,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:a},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:a},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:a.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:a.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=e.languages.bash;for(var o=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],l=a.variable[1].inside,s=0;s<o.length;s++)l[o[s]]=e.languages.bash[o[s]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism);var wh={},kh;function uw(){return kh||(kh=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),wh}uw();var _h={},Sh;function dw(){return Sh||(Sh=1,(function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,r=0;r<2;r++)t=t.replace(/<self>/g,function(){return t});t=t.replace(/<self>/g,function(){return/[^\s\S]/.source}),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string})(Prism)),_h}dw();Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/});Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}});delete Prism.languages.go["class-name"];(function(e){var t=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,a="(?:"+r.source+"(?:[ ]+"+t.source+")?|"+t.source+"(?:[ ]+"+r.source+")?)",o=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),l=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function s(c,u){u=(u||"").replace(/m/g,"")+"m";var d=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return a}).replace(/<<value>>/g,function(){return c});return RegExp(d,u)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return a})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return a}).replace(/<<key>>/g,function(){return"(?:"+o+"|"+l+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:s(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:s(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:s(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:s(l),lookbehind:!0,greedy:!0},number:{pattern:s(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:r,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml})(Prism);(function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(h){return h=h.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+h+")")}var a=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,o=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return a}),l=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+o+l+"(?:"+o+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+o+l+")(?:"+o+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(a),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+o+")"+l+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+o+"$"),inside:{"table-header":{pattern:RegExp(a),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(h){["url","bold","italic","strike","code-snippet"].forEach(function(f){h!==f&&(e.languages.markdown[h].inside.content.inside[f]=e.languages.markdown[f])})}),e.hooks.add("after-tokenize",function(h){if(h.language!=="markdown"&&h.language!=="md")return;function f(g){if(!(!g||typeof g=="string"))for(var m=0,y=g.length;m<y;m++){var C=g[m];if(C.type!=="code"){f(C.content);continue}var T=C.content[1],_=C.content[3];if(T&&_&&T.type==="code-language"&&_.type==="code-block"&&typeof T.content=="string"){var p=T.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");p=(/[a-z][\w-]*/i.exec(p)||[""])[0].toLowerCase();var b="language-"+p;_.alias?typeof _.alias=="string"?_.alias=[_.alias,b]:_.alias.push(b):_.alias=[b]}}}f(h.tokens)}),e.hooks.add("wrap",function(h){if(h.type==="code-block"){for(var f="",g=0,m=h.classes.length;g<m;g++){var y=h.classes[g],C=/language-(.+)/.exec(y);if(C){f=C[1];break}}var T=e.languages[f];if(T)h.content=e.highlight(d(h.content),T,f);else if(f&&f!=="none"&&e.plugins.autoloader){var _="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);h.attributes.id=_,e.plugins.autoloader.loadLanguages(f,function(){var p=document.getElementById(_);p&&(p.innerHTML=e.highlight(p.textContent,e.languages[f],f))})}}});var s=RegExp(e.languages.markup.tag.pattern.source,"gi"),c={amp:"&",lt:"<",gt:">",quot:'"'},u=String.fromCodePoint||String.fromCharCode;function d(h){var f=h.replace(s,"");return f=f.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(g,m){if(m=m.toLowerCase(),m[0]==="#"){var y;return m[1]==="x"?y=parseInt(m.slice(2),16):y=Number(m.slice(1)),u(y)}else{var C=c[m];return C||g}}),f}e.languages.md=e.languages.markdown})(Prism);(function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach(function(r){var a=t[r],o=[];/^\w+$/.test(r)||o.push(/\w+/.exec(r)[0]),r==="diff"&&o.push("bold"),e.languages.diff[r]={pattern:RegExp("^(?:["+a+`].*(?:\r
243
+ ?|
244
+ |(?![\\s\\S])))+`,"m"),alias:o,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(r)[0]}}}}),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})})(Prism);(function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var r=e.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(Prism);Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};(function(e){var t=/(?:[\w-]+|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*")/.source;function r(a){return a.replace(/__/g,function(){return t})}e.languages.toml={comment:{pattern:/#.*/,greedy:!0},table:{pattern:RegExp(r(/(^[\t ]*\[\s*(?:\[\s*)?)__(?:\s*\.\s*__)*(?=\s*\])/.source),"m"),lookbehind:!0,greedy:!0,alias:"class-name"},key:{pattern:RegExp(r(/(^[\t ]*|[{,]\s*)__(?:\s*\.\s*__)*(?=\s*=)/.source),"m"),lookbehind:!0,greedy:!0,alias:"property"},string:{pattern:/"""(?:\\[\s\S]|[^\\])*?"""|'''[\s\S]*?'''|'[^'\n\r]*'|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},date:[{pattern:/\b\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?\b/i,alias:"number"},{pattern:/\b\d{2}:\d{2}:\d{2}(?:\.\d+)?\b/,alias:"number"}],number:/(?:\b0(?:x[\da-zA-Z]+(?:_[\da-zA-Z]+)*|o[0-7]+(?:_[0-7]+)*|b[10]+(?:_[10]+)*))\b|[-+]?\b\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?\b|[-+]?\b(?:inf|nan)\b/,boolean:/\b(?:false|true)\b/,punctuation:/[.,=[\]{}]/}})(Prism);const hw={js:"javascript",ts:"typescript",py:"python",rb:"ruby",sh:"bash",shell:"bash",zsh:"bash",yml:"yaml",dockerfile:"docker","":"plaintext"};function hg(e){const t=e.toLowerCase().trim();return hw[t]||t}function vl(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function fw(e,t){const r=hg(t);if(Ia.languages[r])try{return Ia.highlight(e,Ia.languages[r],r)}catch{}return vl(e)}function pw(){const e=new dg({gfm:!0,breaks:!0});return e.use({renderer:{code(t){const r=t.lang||"",a=t.text,o=fw(a,r);return`<pre class="code-block${r?` language-${hg(r)}`:""}"><code>${o}</code></pre>`},link(t){const r=t.href,a=t.title?` title="${vl(t.title)}"`:"",o=t.text;return r.startsWith("http://")||r.startsWith("https://")?`<a href="${vl(r)}"${a} target="_blank" rel="noopener noreferrer">${o}</a>`:`<a href="${vl(r)}"${a}>${o}</a>`}}}),e}const gw=pw();function vw(e){return gw.parse(e)}const{entries:fg,setPrototypeOf:Ch,isFrozen:mw,getPrototypeOf:bw,getOwnPropertyDescriptor:xw}=Object;let{freeze:ze,seal:ct,create:Xi}=Object,{apply:Zi,construct:Qi}=typeof Reflect<"u"&&Reflect;ze||(ze=function(t){return t});ct||(ct=function(t){return t});Zi||(Zi=function(t,r){for(var a=arguments.length,o=new Array(a>2?a-2:0),l=2;l<a;l++)o[l-2]=arguments[l];return t.apply(r,o)});Qi||(Qi=function(t){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return new t(...a)});const Ko=Ue(Array.prototype.forEach),yw=Ue(Array.prototype.lastIndexOf),Eh=Ue(Array.prototype.pop),ha=Ue(Array.prototype.push),ww=Ue(Array.prototype.splice),ml=Ue(String.prototype.toLowerCase),ni=Ue(String.prototype.toString),ri=Ue(String.prototype.match),fa=Ue(String.prototype.replace),kw=Ue(String.prototype.indexOf),_w=Ue(String.prototype.trim),ht=Ue(Object.prototype.hasOwnProperty),Ne=Ue(RegExp.prototype.test),pa=Sw(TypeError);function Ue(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return Zi(e,t,a)}}function Sw(e){return function(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return Qi(e,r)}}function G(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ml;Ch&&Ch(e,null);let a=t.length;for(;a--;){let o=t[a];if(typeof o=="string"){const l=r(o);l!==o&&(mw(t)||(t[a]=l),o=l)}e[o]=!0}return e}function Cw(e){for(let t=0;t<e.length;t++)ht(e,t)||(e[t]=null);return e}function At(e){const t=Xi(null);for(const[r,a]of fg(e))ht(e,r)&&(Array.isArray(a)?t[r]=Cw(a):a&&typeof a=="object"&&a.constructor===Object?t[r]=At(a):t[r]=a);return t}function ga(e,t){for(;e!==null;){const a=xw(e,t);if(a){if(a.get)return Ue(a.get);if(typeof a.value=="function")return Ue(a.value)}e=bw(e)}function r(){return null}return r}const Th=ze(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ai=ze(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),oi=ze(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ew=ze(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),li=ze(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Tw=ze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ah=ze(["#text"]),Mh=ze(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),si=ze(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ih=ze(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Vo=ze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Aw=ct(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Mw=ct(/<%[\w\W]*|[\w\W]*%>/gm),Iw=ct(/\$\{[\w\W]*/gm),Rw=ct(/^data-[\-\w.\u00B7-\uFFFF]+$/),$w=ct(/^aria-[\-\w]+$/),pg=ct(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Dw=ct(/^(?:\w+script|data):/i),Lw=ct(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),gg=ct(/^html$/i),Nw=ct(/^[a-z][.\w]*(-[.\w]+)+$/i);var Rh=Object.freeze({__proto__:null,ARIA_ATTR:$w,ATTR_WHITESPACE:Lw,CUSTOM_ELEMENT:Nw,DATA_ATTR:Rw,DOCTYPE_NAME:gg,ERB_EXPR:Mw,IS_ALLOWED_URI:pg,IS_SCRIPT_OR_DATA:Dw,MUSTACHE_EXPR:Aw,TMPLIT_EXPR:Iw});const va={element:1,text:3,progressingInstruction:7,comment:8,document:9},Ow=function(){return typeof window>"u"?null:window},Fw=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const o="data-tt-policy-suffix";r&&r.hasAttribute(o)&&(a=r.getAttribute(o));const l="dompurify"+(a?"#"+a:"");try{return t.createPolicy(l,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},$h=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function vg(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ow();const t=P=>vg(P);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==va.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const a=r,o=a.currentScript,{DocumentFragment:l,HTMLTemplateElement:s,Node:c,Element:u,NodeFilter:d,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:g,trustedTypes:m}=e,y=u.prototype,C=ga(y,"cloneNode"),T=ga(y,"remove"),_=ga(y,"nextSibling"),p=ga(y,"childNodes"),b=ga(y,"parentNode");if(typeof s=="function"){const P=r.createElement("template");P.content&&P.content.ownerDocument&&(r=P.content.ownerDocument)}let k,E="";const{implementation:w,createNodeIterator:A,createDocumentFragment:D,getElementsByTagName:S}=r,{importNode:F}=a;let N=$h();t.isSupported=typeof fg=="function"&&typeof b=="function"&&w&&w.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:re,ERB_EXPR:de,TMPLIT_EXPR:sn,DATA_ATTR:ra,ARIA_ATTR:aa,IS_SCRIPT_OR_DATA:cn,ATTR_WHITESPACE:ve,CUSTOM_ELEMENT:U}=Rh;let{IS_ALLOWED_URI:ae}=Rh,he=null;const Be=G({},[...Th,...ai,...oi,...li,...Ah]);let we=null;const dt=G({},[...Mh,...si,...Ih,...Vo]);let oe=Object.seal(Xi(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),_t=null,un=null;const St=Object.seal(Xi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let oa=!0,Cn=!0,En=!1,Ao=!0,Ct=!1,Mo=!0,Tn=!1,$s=!1,Ds=!1,rr=!1,Io=!1,Ro=!1,Pu=!0,zu=!1;const cv="user-content-";let Ls=!0,la=!1,ar={},Et=null;const Ns=G({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Uu=null;const Hu=G({},["audio","video","img","source","image","track"]);let Os=null;const ju=G({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$o="http://www.w3.org/1998/Math/MathML",Do="http://www.w3.org/2000/svg",Kt="http://www.w3.org/1999/xhtml";let or=Kt,Fs=!1,Ps=null;const uv=G({},[$o,Do,Kt],ni);let Lo=G({},["mi","mo","mn","ms","mtext"]),No=G({},["annotation-xml"]);const dv=G({},["title","style","font","a","script"]);let sa=null;const hv=["application/xhtml+xml","text/html"],fv="text/html";let ke=null,lr=null;const pv=r.createElement("form"),Bu=function(x){return x instanceof RegExp||x instanceof Function},zs=function(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(lr&&lr===x)){if((!x||typeof x!="object")&&(x={}),x=At(x),sa=hv.indexOf(x.PARSER_MEDIA_TYPE)===-1?fv:x.PARSER_MEDIA_TYPE,ke=sa==="application/xhtml+xml"?ni:ml,he=ht(x,"ALLOWED_TAGS")?G({},x.ALLOWED_TAGS,ke):Be,we=ht(x,"ALLOWED_ATTR")?G({},x.ALLOWED_ATTR,ke):dt,Ps=ht(x,"ALLOWED_NAMESPACES")?G({},x.ALLOWED_NAMESPACES,ni):uv,Os=ht(x,"ADD_URI_SAFE_ATTR")?G(At(ju),x.ADD_URI_SAFE_ATTR,ke):ju,Uu=ht(x,"ADD_DATA_URI_TAGS")?G(At(Hu),x.ADD_DATA_URI_TAGS,ke):Hu,Et=ht(x,"FORBID_CONTENTS")?G({},x.FORBID_CONTENTS,ke):Ns,_t=ht(x,"FORBID_TAGS")?G({},x.FORBID_TAGS,ke):At({}),un=ht(x,"FORBID_ATTR")?G({},x.FORBID_ATTR,ke):At({}),ar=ht(x,"USE_PROFILES")?x.USE_PROFILES:!1,oa=x.ALLOW_ARIA_ATTR!==!1,Cn=x.ALLOW_DATA_ATTR!==!1,En=x.ALLOW_UNKNOWN_PROTOCOLS||!1,Ao=x.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ct=x.SAFE_FOR_TEMPLATES||!1,Mo=x.SAFE_FOR_XML!==!1,Tn=x.WHOLE_DOCUMENT||!1,rr=x.RETURN_DOM||!1,Io=x.RETURN_DOM_FRAGMENT||!1,Ro=x.RETURN_TRUSTED_TYPE||!1,Ds=x.FORCE_BODY||!1,Pu=x.SANITIZE_DOM!==!1,zu=x.SANITIZE_NAMED_PROPS||!1,Ls=x.KEEP_CONTENT!==!1,la=x.IN_PLACE||!1,ae=x.ALLOWED_URI_REGEXP||pg,or=x.NAMESPACE||Kt,Lo=x.MATHML_TEXT_INTEGRATION_POINTS||Lo,No=x.HTML_INTEGRATION_POINTS||No,oe=x.CUSTOM_ELEMENT_HANDLING||{},x.CUSTOM_ELEMENT_HANDLING&&Bu(x.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(oe.tagNameCheck=x.CUSTOM_ELEMENT_HANDLING.tagNameCheck),x.CUSTOM_ELEMENT_HANDLING&&Bu(x.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(oe.attributeNameCheck=x.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),x.CUSTOM_ELEMENT_HANDLING&&typeof x.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(oe.allowCustomizedBuiltInElements=x.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ct&&(Cn=!1),Io&&(rr=!0),ar&&(he=G({},Ah),we=[],ar.html===!0&&(G(he,Th),G(we,Mh)),ar.svg===!0&&(G(he,ai),G(we,si),G(we,Vo)),ar.svgFilters===!0&&(G(he,oi),G(we,si),G(we,Vo)),ar.mathMl===!0&&(G(he,li),G(we,Ih),G(we,Vo))),x.ADD_TAGS&&(typeof x.ADD_TAGS=="function"?St.tagCheck=x.ADD_TAGS:(he===Be&&(he=At(he)),G(he,x.ADD_TAGS,ke))),x.ADD_ATTR&&(typeof x.ADD_ATTR=="function"?St.attributeCheck=x.ADD_ATTR:(we===dt&&(we=At(we)),G(we,x.ADD_ATTR,ke))),x.ADD_URI_SAFE_ATTR&&G(Os,x.ADD_URI_SAFE_ATTR,ke),x.FORBID_CONTENTS&&(Et===Ns&&(Et=At(Et)),G(Et,x.FORBID_CONTENTS,ke)),x.ADD_FORBID_CONTENTS&&(Et===Ns&&(Et=At(Et)),G(Et,x.ADD_FORBID_CONTENTS,ke)),Ls&&(he["#text"]=!0),Tn&&G(he,["html","head","body"]),he.table&&(G(he,["tbody"]),delete _t.tbody),x.TRUSTED_TYPES_POLICY){if(typeof x.TRUSTED_TYPES_POLICY.createHTML!="function")throw pa('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof x.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw pa('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=x.TRUSTED_TYPES_POLICY,E=k.createHTML("")}else k===void 0&&(k=Fw(m,o)),k!==null&&typeof E=="string"&&(E=k.createHTML(""));ze&&ze(x),lr=x}},Wu=G({},[...ai,...oi,...Ew]),qu=G({},[...li,...Tw]),gv=function(x){let R=b(x);(!R||!R.tagName)&&(R={namespaceURI:or,tagName:"template"});const O=ml(x.tagName),se=ml(R.tagName);return Ps[x.namespaceURI]?x.namespaceURI===Do?R.namespaceURI===Kt?O==="svg":R.namespaceURI===$o?O==="svg"&&(se==="annotation-xml"||Lo[se]):!!Wu[O]:x.namespaceURI===$o?R.namespaceURI===Kt?O==="math":R.namespaceURI===Do?O==="math"&&No[se]:!!qu[O]:x.namespaceURI===Kt?R.namespaceURI===Do&&!No[se]||R.namespaceURI===$o&&!Lo[se]?!1:!qu[O]&&(dv[O]||!Wu[O]):!!(sa==="application/xhtml+xml"&&Ps[x.namespaceURI]):!1},Tt=function(x){ha(t.removed,{element:x});try{b(x).removeChild(x)}catch{T(x)}},An=function(x,R){try{ha(t.removed,{attribute:R.getAttributeNode(x),from:R})}catch{ha(t.removed,{attribute:null,from:R})}if(R.removeAttribute(x),x==="is")if(rr||Io)try{Tt(R)}catch{}else try{R.setAttribute(x,"")}catch{}},Gu=function(x){let R=null,O=null;if(Ds)x="<remove></remove>"+x;else{const xe=ri(x,/^[\r\n\t ]+/);O=xe&&xe[0]}sa==="application/xhtml+xml"&&or===Kt&&(x='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+x+"</body></html>");const se=k?k.createHTML(x):x;if(or===Kt)try{R=new g().parseFromString(se,sa)}catch{}if(!R||!R.documentElement){R=w.createDocument(or,"template",null);try{R.documentElement.innerHTML=Fs?E:se}catch{}}const $e=R.body||R.documentElement;return x&&O&&$e.insertBefore(r.createTextNode(O),$e.childNodes[0]||null),or===Kt?S.call(R,Tn?"html":"body")[0]:Tn?R.documentElement:$e},Ku=function(x){return A.call(x.ownerDocument||x,x,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Us=function(x){return x instanceof f&&(typeof x.nodeName!="string"||typeof x.textContent!="string"||typeof x.removeChild!="function"||!(x.attributes instanceof h)||typeof x.removeAttribute!="function"||typeof x.setAttribute!="function"||typeof x.namespaceURI!="string"||typeof x.insertBefore!="function"||typeof x.hasChildNodes!="function")},Vu=function(x){return typeof c=="function"&&x instanceof c};function Vt(P,x,R){Ko(P,O=>{O.call(t,x,R,lr)})}const Yu=function(x){let R=null;if(Vt(N.beforeSanitizeElements,x,null),Us(x))return Tt(x),!0;const O=ke(x.nodeName);if(Vt(N.uponSanitizeElement,x,{tagName:O,allowedTags:he}),Mo&&x.hasChildNodes()&&!Vu(x.firstElementChild)&&Ne(/<[/\w!]/g,x.innerHTML)&&Ne(/<[/\w!]/g,x.textContent)||x.nodeType===va.progressingInstruction||Mo&&x.nodeType===va.comment&&Ne(/<[/\w]/g,x.data))return Tt(x),!0;if(!(St.tagCheck instanceof Function&&St.tagCheck(O))&&(!he[O]||_t[O])){if(!_t[O]&&Xu(O)&&(oe.tagNameCheck instanceof RegExp&&Ne(oe.tagNameCheck,O)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(O)))return!1;if(Ls&&!Et[O]){const se=b(x)||x.parentNode,$e=p(x)||x.childNodes;if($e&&se){const xe=$e.length;for(let We=xe-1;We>=0;--We){const Yt=C($e[We],!0);Yt.__removalCount=(x.__removalCount||0)+1,se.insertBefore(Yt,_(x))}}}return Tt(x),!0}return x instanceof u&&!gv(x)||(O==="noscript"||O==="noembed"||O==="noframes")&&Ne(/<\/no(script|embed|frames)/i,x.innerHTML)?(Tt(x),!0):(Ct&&x.nodeType===va.text&&(R=x.textContent,Ko([re,de,sn],se=>{R=fa(R,se," ")}),x.textContent!==R&&(ha(t.removed,{element:x.cloneNode()}),x.textContent=R)),Vt(N.afterSanitizeElements,x,null),!1)},Ju=function(x,R,O){if(Pu&&(R==="id"||R==="name")&&(O in r||O in pv))return!1;if(!(Cn&&!un[R]&&Ne(ra,R))){if(!(oa&&Ne(aa,R))){if(!(St.attributeCheck instanceof Function&&St.attributeCheck(R,x))){if(!we[R]||un[R]){if(!(Xu(x)&&(oe.tagNameCheck instanceof RegExp&&Ne(oe.tagNameCheck,x)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(x))&&(oe.attributeNameCheck instanceof RegExp&&Ne(oe.attributeNameCheck,R)||oe.attributeNameCheck instanceof Function&&oe.attributeNameCheck(R,x))||R==="is"&&oe.allowCustomizedBuiltInElements&&(oe.tagNameCheck instanceof RegExp&&Ne(oe.tagNameCheck,O)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(O))))return!1}else if(!Os[R]){if(!Ne(ae,fa(O,ve,""))){if(!((R==="src"||R==="xlink:href"||R==="href")&&x!=="script"&&kw(O,"data:")===0&&Uu[x])){if(!(En&&!Ne(cn,fa(O,ve,"")))){if(O)return!1}}}}}}}return!0},Xu=function(x){return x!=="annotation-xml"&&ri(x,U)},Zu=function(x){Vt(N.beforeSanitizeAttributes,x,null);const{attributes:R}=x;if(!R||Us(x))return;const O={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:we,forceKeepAttr:void 0};let se=R.length;for(;se--;){const $e=R[se],{name:xe,namespaceURI:We,value:Yt}=$e,sr=ke(xe),Hs=Yt;let Te=xe==="value"?Hs:_w(Hs);if(O.attrName=sr,O.attrValue=Te,O.keepAttr=!0,O.forceKeepAttr=void 0,Vt(N.uponSanitizeAttribute,x,O),Te=O.attrValue,zu&&(sr==="id"||sr==="name")&&(An(xe,x),Te=cv+Te),Mo&&Ne(/((--!?|])>)|<\/(style|title|textarea)/i,Te)){An(xe,x);continue}if(sr==="attributename"&&ri(Te,"href")){An(xe,x);continue}if(O.forceKeepAttr)continue;if(!O.keepAttr){An(xe,x);continue}if(!Ao&&Ne(/\/>/i,Te)){An(xe,x);continue}Ct&&Ko([re,de,sn],ed=>{Te=fa(Te,ed," ")});const Qu=ke(x.nodeName);if(!Ju(Qu,sr,Te)){An(xe,x);continue}if(k&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!We)switch(m.getAttributeType(Qu,sr)){case"TrustedHTML":{Te=k.createHTML(Te);break}case"TrustedScriptURL":{Te=k.createScriptURL(Te);break}}if(Te!==Hs)try{We?x.setAttributeNS(We,xe,Te):x.setAttribute(xe,Te),Us(x)?Tt(x):Eh(t.removed)}catch{An(xe,x)}}Vt(N.afterSanitizeAttributes,x,null)},vv=function P(x){let R=null;const O=Ku(x);for(Vt(N.beforeSanitizeShadowDOM,x,null);R=O.nextNode();)Vt(N.uponSanitizeShadowNode,R,null),Yu(R),Zu(R),R.content instanceof l&&P(R.content);Vt(N.afterSanitizeShadowDOM,x,null)};return t.sanitize=function(P){let x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=null,O=null,se=null,$e=null;if(Fs=!P,Fs&&(P="<!-->"),typeof P!="string"&&!Vu(P))if(typeof P.toString=="function"){if(P=P.toString(),typeof P!="string")throw pa("dirty is not a string, aborting")}else throw pa("toString is not a function");if(!t.isSupported)return P;if($s||zs(x),t.removed=[],typeof P=="string"&&(la=!1),la){if(P.nodeName){const Yt=ke(P.nodeName);if(!he[Yt]||_t[Yt])throw pa("root node is forbidden and cannot be sanitized in-place")}}else if(P instanceof c)R=Gu("<!---->"),O=R.ownerDocument.importNode(P,!0),O.nodeType===va.element&&O.nodeName==="BODY"||O.nodeName==="HTML"?R=O:R.appendChild(O);else{if(!rr&&!Ct&&!Tn&&P.indexOf("<")===-1)return k&&Ro?k.createHTML(P):P;if(R=Gu(P),!R)return rr?null:Ro?E:""}R&&Ds&&Tt(R.firstChild);const xe=Ku(la?P:R);for(;se=xe.nextNode();)Yu(se),Zu(se),se.content instanceof l&&vv(se.content);if(la)return P;if(rr){if(Io)for($e=D.call(R.ownerDocument);R.firstChild;)$e.appendChild(R.firstChild);else $e=R;return(we.shadowroot||we.shadowrootmode)&&($e=F.call(a,$e,!0)),$e}let We=Tn?R.outerHTML:R.innerHTML;return Tn&&he["!doctype"]&&R.ownerDocument&&R.ownerDocument.doctype&&R.ownerDocument.doctype.name&&Ne(gg,R.ownerDocument.doctype.name)&&(We="<!DOCTYPE "+R.ownerDocument.doctype.name+`>
245
+ `+We),Ct&&Ko([re,de,sn],Yt=>{We=fa(We,Yt," ")}),k&&Ro?k.createHTML(We):We},t.setConfig=function(){let P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};zs(P),$s=!0},t.clearConfig=function(){lr=null,$s=!1},t.isValidAttribute=function(P,x,R){lr||zs({});const O=ke(P),se=ke(x);return Ju(O,se,R)},t.addHook=function(P,x){typeof x=="function"&&ha(N[P],x)},t.removeHook=function(P,x){if(x!==void 0){const R=yw(N[P],x);return R===-1?void 0:ww(N[P],R,1)[0]}return Eh(N[P])},t.removeHooks=function(P){N[P]=[]},t.removeAllHooks=function(){N=$h()},t}var mg=vg();const Pw={ALLOWED_TAGS:["h1","h2","h3","h4","h5","h6","p","br","hr","ul","ol","li","dl","dt","dd","strong","em","b","i","u","s","strike","del","ins","sub","sup","small","mark","abbr","code","pre","kbd","samp","var","blockquote","q","cite","a","img","figure","figcaption","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","div","span","details","summary"],ALLOWED_ATTR:["href","src","alt","title","class","id","name","target","rel","width","height","colspan","rowspan","scope","start","type","open","aria-label","aria-hidden","aria-describedby","role","tabindex","data-line","data-language"],ADD_ATTR:["target","rel"],FORBID_TAGS:["script","style","iframe","object","embed","form","input","button"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur"],ALLOW_DATA_ATTR:!1,ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|data):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i};function zw(e){return mg.sanitize(e,{...Pw,RETURN_TRUSTED_TYPE:!1})}function Dh(e){return mg.sanitize(e,{ALLOWED_TAGS:["span","code","pre","br"],ALLOWED_ATTR:["class"],FORBID_TAGS:["script","style"],FORBID_ATTR:["onerror","onload","onclick"],RETURN_TRUSTED_TYPE:!1})}function Kl({size:e="md",colorClass:t}){const r=e==="sm"?"w-1 h-1":"w-1.5 h-1.5",a=t??"bg-[var(--color-accent)]";return n("span",{class:"inline-flex items-end gap-1",children:[n("span",{class:`${r} rounded-full ${a} animate-bounce-dot-1`}),n("span",{class:`${r} rounded-full ${a} animate-bounce-dot-2`}),n("span",{class:`${r} rounded-full ${a} animate-bounce-dot-3`})]})}const Uw="bg-[var(--color-warning-muted)] rounded px-0.5";function Hw(e,t){if(!t)return;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:s=>{const c=s.parentElement;return c?.closest("pre, code")||c?.tagName==="MARK"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),a=[];let o;for(;o=r.nextNode();)a.push(o);const l=t.toLowerCase();for(const s of a){const c=s.textContent||"",u=c.toLowerCase(),d=[];let h=0,f;for(;(f=u.indexOf(l,h))!==-1;)d.push({start:f,end:f+t.length}),h=f+1;if(d.length===0)continue;const g=document.createDocumentFragment();let m=0;for(const y of d){y.start>m&&g.appendChild(document.createTextNode(c.slice(m,y.start)));const C=document.createElement("mark");C.className=Uw,C.textContent=c.slice(y.start,y.end),g.appendChild(C),m=y.end}m<c.length&&g.appendChild(document.createTextNode(c.slice(m))),s.replaceWith(g)}}function Cu({content:e,isStreaming:t=!1}){const r=q(null),a=Qn(()=>{if(!e)return"";const l=vw(e);return zw(l)},[e]),o=ps.value.trim();return z(()=>{if(!r.current)return;const l=r.current.querySelectorAll("pre.code-block");for(const s of l){if(s.querySelector(".copy-button"))return;const c=document.createElement("button");c.className="copy-button",c.textContent=i("actions.copy"),c.setAttribute("type","button"),c.onclick=async()=>{const u=s.querySelector("code")?.textContent||"";try{await navigator.clipboard.writeText(u),c.textContent=i("actions.copied"),setTimeout(()=>{c.textContent=i("actions.copy")},2e3)}catch{const d=document.createElement("textarea");d.value=u,document.body.appendChild(d),d.select(),document.execCommand("copy"),document.body.removeChild(d),c.textContent=i("actions.copied"),setTimeout(()=>{c.textContent=i("actions.copy")},2e3)}},s.classList.add("relative"),s.insertBefore(c,s.firstChild)}},[a]),z(()=>{!r.current||!o||(r.current.innerHTML=a,Hw(r.current,o))},[a,o]),!e&&t?n("span",{class:"inline-flex items-center gap-2 text-[var(--color-text-muted)]",children:[i("chat.thinking"),n(Kl,{})]}):n("div",{ref:r,class:"message-content prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:a}})}const Yo=`
246
+ p-2 rounded-full cursor-pointer
247
+ bg-white/10 text-white hover:bg-white/20
248
+ transition-colors
249
+ `;async function jw(e,t){try{const a=await(await fetch(e)).blob(),o=URL.createObjectURL(a),l=document.createElement("a");l.href=o,l.download=t,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(o)}catch{window.open(e,"_blank")}}function Bw(e,t){try{const a=new URL(e).pathname.split("/").pop();if(a&&/\.(png|jpe?g|gif|webp|svg)$/i.test(a))return a}catch{}return`image-${t+1}.png`}function bg({images:e}){const[t,r]=j(null);if(e.length===0)return null;const a=(o,l,s)=>{o.stopPropagation(),jw(l,Bw(l,s))};return n(Y,{children:[n("div",{class:"flex flex-wrap gap-2 mt-2",children:e.map((o,l)=>n("div",{class:"relative group",children:[n("button",{type:"button",onClick:()=>r(l),class:`
250
+ relative rounded-lg overflow-hidden cursor-pointer
251
+ border border-[var(--color-border)]
252
+ hover:border-[var(--color-accent)] hover:shadow-md
253
+ transition-all
254
+ `,children:n("img",{src:o.url,alt:o.alt||`Image ${l+1}`,class:"max-w-[200px] max-h-[200px] object-cover",loading:"lazy"})}),n("button",{type:"button",onClick:s=>a(s,o.url,l),"aria-label":i("actions.download"),class:`
255
+ absolute bottom-2 right-2 p-1.5 rounded-lg cursor-pointer
256
+ bg-black/60 text-white
257
+ opacity-0 group-hover:opacity-100
258
+ hover:bg-black/80
259
+ transition-all
260
+ `,children:n(Ht,{class:"w-4 h-4"})})]},l))}),t!==null&&n("div",{role:"dialog","aria-modal":"true","aria-label":i("chat.imageViewer"),class:"fixed inset-0 z-[9999] bg-black/80 flex items-center justify-center p-4",onClick:()=>r(null),onKeyDown:o=>{o.key==="Escape"&&r(null),o.key==="ArrowLeft"&&r((t-1+e.length)%e.length),o.key==="ArrowRight"&&r((t+1)%e.length)},tabIndex:0,children:[n("div",{class:"absolute top-4 right-4 flex items-center gap-2",children:[n("button",{type:"button",onClick:o=>a(o,e[t].url,t),"aria-label":i("actions.download"),class:Yo,children:n(Ht,{class:"w-6 h-6"})}),n("button",{type:"button",onClick:()=>r(null),"aria-label":i("actions.close"),class:Yo,children:n(Xr,{class:"w-6 h-6"})})]}),e.length>1&&n(Y,{children:[n("button",{type:"button",onClick:o=>{o.stopPropagation(),r((t-1+e.length)%e.length)},"aria-label":i("actions.back"),class:`${Yo} absolute left-4 p-3 text-2xl`,children:"‹"}),n("button",{type:"button",onClick:o=>{o.stopPropagation(),r((t+1)%e.length)},"aria-label":i("actions.next"),class:`${Yo} absolute right-4 p-3 text-2xl`,children:"›"})]}),n("img",{src:e[t].url,alt:e[t].alt||`Image ${t+1}`,class:"max-w-full max-h-full object-contain rounded-lg",onClick:o=>o.stopPropagation(),onKeyDown:o=>o.stopPropagation()}),e.length>1&&n("div",{class:"absolute bottom-4 left-1/2 -translate-x-1/2 px-3 py-1 rounded-full bg-white/10 text-white text-sm",children:[t+1," / ",e.length]})]})]})}const Ww=2e3;function Lh({icon:e,label:t,onClick:r}){return n("button",{role:"menuitem",onClick:r,class:`
261
+ w-full px-3 py-2 text-left text-sm
262
+ flex items-center gap-2
263
+ text-[var(--color-text-primary)]
264
+ hover:bg-[var(--color-bg-hover)]
265
+ transition-colors cursor-pointer
266
+ `,children:[e,t]})}function xg({content:e,visible:t=!1}){const[r,a]=j(!1),[o,l]=j(null),s=q(null),c=q(null);z(()=>{if(!r)return;const f=g=>{const m=g.target;s.current&&!s.current.contains(m)&&c.current&&!c.current.contains(m)&&a(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),z(()=>{if(!o)return;const f=setTimeout(()=>l(null),Ww);return()=>clearTimeout(f)},[o]);const u=K(async f=>{const g=f==="formatted"?yx(e):e;await navigator.clipboard.writeText(g),l(f),a(!1)},[e]),d=(f,g)=>o===f?n(on,{class:"w-4 h-4 text-[var(--color-success)]"}):n(g,{class:"w-4 h-4 text-[var(--color-text-muted)]"}),h=(f,g)=>o===f?i("actions.copied"):g;return n("div",{class:"relative",children:[n("button",{ref:c,onClick:()=>a(!r),"aria-label":i("actions.more"),"aria-expanded":r,"aria-haspopup":"menu",class:`
267
+ p-1 rounded
268
+ text-[var(--color-text-muted)]
269
+ hover:text-[var(--color-text-secondary)]
270
+ hover:bg-[var(--color-bg-hover)]
271
+ transition-all cursor-pointer
272
+ ${r||t?"opacity-100":"opacity-0"}
273
+ ${r?"bg-[var(--color-bg-hover)]":""}
274
+ `,children:n(Sp,{class:"w-4 h-4"})}),r&&n("div",{ref:s,role:"menu",class:`
275
+ absolute right-0 top-full mt-1 z-50
276
+ min-w-[160px] py-1
277
+ bg-[var(--color-bg-surface)]
278
+ border border-[var(--color-border)]
279
+ rounded-lg shadow-lg
280
+ `,children:[n(Lh,{icon:d("formatted",xs),label:h("formatted",i("actions.copy")),onClick:()=>u("formatted")}),n(Lh,{icon:d("raw",jt),label:h("raw",i("chat.copyMarkdown")),onClick:()=>u("raw")})]})]})}function qw({message:e,userName:t="You",userAvatar:r}){const a=J(!1),o=e.status==="queued",l=e.status==="sending",s=e.status==="failed",c=o||l,u=()=>{e.id&&f0(e.id)};return n("div",{class:"group",onMouseEnter:()=>a.value=!0,onMouseLeave:()=>a.value=!1,children:[n("div",{class:"flex items-center gap-2 mb-1.5",children:[Bc(r)?n("img",{src:r,alt:t,class:"w-6 h-6 rounded-full object-cover"}):n("div",{class:"w-6 h-6 rounded-full bg-[var(--color-accent)]/20 flex items-center justify-center text-xs font-medium text-[var(--color-accent)]",children:r||t.charAt(0).toUpperCase()}),n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:t}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:o?n("span",{class:"flex items-center gap-1 text-[var(--color-warning)]",children:[n(me,{class:"w-3 h-3","aria-hidden":"true"}),i("connection.messageQueued")]}):l?n("span",{class:"flex items-center gap-1",children:[n(Kl,{size:"sm",colorClass:"bg-current"}),i("connection.messageSending")]}):s?n("span",{class:"flex items-center gap-1 text-[var(--color-error)]",children:[n(bs,{class:"w-3 h-3","aria-hidden":"true"}),i("connection.messageFailedStatus")]}):ge(e.timestamp)}),n("div",{class:"flex-1"}),!c&&e.content&&n(xg,{content:e.content,visible:a.value})]}),n("div",{class:`
281
+ rounded-xl px-4 py-3
282
+ ${s?"bg-[var(--color-error)]/10 border border-[var(--color-error)]/20":c?"bg-[var(--color-bg-secondary)] border border-[var(--color-border)] opacity-80":"bg-[var(--color-accent)]/10 border border-[var(--color-accent)]/20"}
283
+ `,children:[e.images&&e.images.length>0&&n(bg,{images:e.images}),e.content&&n("div",{class:`text-[var(--color-text-primary)] ${e.images?.length?"mt-2":""}`,children:n(Cu,{content:e.content})}),s&&n("div",{class:"mt-2 pt-2 border-t border-[var(--color-error)]/20",children:n("button",{onClick:u,class:`px-3 py-1.5 rounded-lg text-xs font-medium
284
+ bg-[var(--color-error)]/10 text-[var(--color-error)]
285
+ hover:bg-[var(--color-error)]/20
286
+ active:scale-95 transition-all duration-150
287
+ flex items-center gap-1.5`,children:[n(He,{class:"w-3 h-3","aria-hidden":"true"}),i("actions.retry")]})})]})]})}const bl=v(null);let Gw=0;function Kw(){return`json-block-${++Gw}`}async function Vw(e,t){try{await navigator.clipboard.writeText(e),bl.value=t,setTimeout(()=>{bl.value===t&&(bl.value=null)},2e3)}catch{}}function Yw(e){try{const t=Ia.highlight(e,Ia.languages.json,"json");return Dh(t)}catch{return Dh(e)}}function _o({value:e,maxHeight:t="max-h-48",id:r}){const a=r??Kw(),o=bl.value===a,l=Yw(e);return n("div",{class:"relative group",children:[n("pre",{class:`text-xs font-mono bg-[var(--color-bg-tertiary)] p-3 rounded-lg overflow-x-auto ${t}`,dangerouslySetInnerHTML:{__html:l}}),n(Q,{icon:o?n(on,{size:14}):n(xs,{size:14}),size:"sm",variant:"ghost",label:i("actions.copy"),class:"absolute top-2 right-2 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100 transition-opacity",onClick:()=>Vw(e,a)})]})}function Jw(e){if(!e||typeof e!="object")return!1;const t=e;if(!t.details||typeof t.details!="object")return!1;const r=t.details;return r.status==="approval-pending"&&typeof r.approvalId=="string"}function Xw({toolCall:e}){const t=Jw(e.result),[r,a]=j(t);z(()=>{t&&a(!0)},[t]);const o=e.completedAt&&e.startedAt?e.completedAt-e.startedAt:null,l=Qw(e.status,t);return n("div",{class:"rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)] overflow-hidden",children:[n("button",{type:"button",onClick:()=>a(!r),class:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-[var(--color-bg-secondary)] transition-colors","aria-expanded":r,children:[n("span",{class:`text-sm flex-shrink-0 ${l.color}`,children:l.icon}),n("code",{class:"text-xs font-medium text-[var(--color-text-primary)] bg-[var(--color-bg-secondary)] px-1.5 py-0.5 rounded",children:e.name}),n("span",{class:"text-xs text-[var(--color-text-muted)] truncate flex-1",children:ek(e)}),o!==null&&n("span",{class:"text-[10px] text-[var(--color-text-muted)] bg-[var(--color-bg-secondary)] px-1.5 py-0.5 rounded flex-shrink-0",children:rk(o)}),n(ta,{class:"w-4 h-4 text-[var(--color-text-muted)] flex-shrink-0",open:r})]}),r&&n("div",{class:"px-3 py-2 border-t border-[var(--color-border)] bg-[var(--color-bg-secondary)] space-y-3",children:[e.args&&Object.keys(e.args).length>0&&n(Nh,{label:"Input",children:n(Oh,{content:e.args})}),t&&n(Zw,{approvalId:e.result.details.approvalId,expiresAtMs:e.result.details.expiresAtMs}),e.result!==void 0&&!t&&n(Nh,{label:"Output",children:n(Oh,{content:e.result,maxLines:20,error:e.status==="error"})}),e.status==="error"&&!e.result&&n("div",{class:"text-xs text-[var(--color-error)]",children:"Tool execution failed"})]})]})}function Zw({approvalId:e,expiresAtMs:t}){const r=jl.value,a=Bl.value,o=Qa.value.get(e),[l,s]=j(Math.max(0,t-Date.now())),[c,u]=j(null),d=o??c;z(()=>{const g=()=>{const y=Math.max(0,t-Date.now());s(y)};g();const m=setInterval(g,1e3);return()=>clearInterval(m)},[t]);const h=async g=>{try{await k2(e,g),u(g)}catch{}};if(d){const g=d==="deny";return n("div",{class:`text-xs italic ${g?"text-[var(--color-error)]":"text-[var(--color-success)]"}`,role:"status","aria-live":"polite",children:i(g?"exec.denied":"exec.approved")})}return l<=0?n("div",{class:"text-xs text-[var(--color-text-muted)] italic",children:i("exec.expired")}):n("div",{class:"space-y-2",role:"region","aria-label":i("exec.approvalNeeded"),"aria-live":"polite",children:[n("div",{class:"flex items-center justify-between",children:[n("span",{class:"text-xs font-medium text-[var(--color-warning)]",children:i("exec.approvalNeeded")}),n("span",{class:"text-[10px] text-[var(--color-text-muted)]","aria-label":i("exec.expiresIn",{time:`${Math.ceil(l/1e3)}s`}),children:[Math.ceil(l/1e3),"s"]})]}),a&&n("div",{class:"text-xs text-[var(--color-error)]",role:"alert",children:a}),n("div",{class:"flex gap-2",children:[n(L,{variant:"primary",size:"sm",onClick:()=>h("allow-once"),disabled:r,children:i("exec.allowOnce")}),n(L,{variant:"secondary",size:"sm",onClick:()=>h("allow-always"),disabled:r,children:i("exec.allowAlways")}),n(L,{variant:"ghost",size:"sm",onClick:()=>h("deny"),disabled:r,children:i("exec.deny")})]})]})}function Nh({label:e,children:t}){return n("div",{children:[n("div",{class:"text-[10px] font-medium text-[var(--color-text-muted)] uppercase tracking-wide mb-1",children:e}),t]})}function Oh({content:e,maxLines:t=30,error:r=!1}){if(typeof e=="object"&&e!==null){const c=JSON.stringify(e,null,2),u=c.split(`
288
+ `),h=u.length>t?u.slice(0,t).join(`
289
+ `)+`
290
+ ...`:c;return r?n("pre",{class:"text-xs p-2 rounded-md overflow-x-auto font-mono leading-relaxed bg-[var(--color-error)]/10 text-[var(--color-error)] max-h-[300px]",children:h}):n(_o,{value:h,maxHeight:"max-h-[300px]"})}const a=String(e),o=a.split(`
291
+ `),s=o.length>t?o.slice(0,t).join(`
292
+ `)+`
293
+ ...`:a;return n("pre",{class:`text-xs p-2 rounded-md overflow-x-auto font-mono leading-relaxed max-h-[300px] whitespace-pre-wrap ${r?"bg-[var(--color-error)]/10 text-[var(--color-error)]":"bg-[var(--color-bg-primary)] text-[var(--color-text-primary)]"}`,children:s})}function Qw(e,t=!1){if(t)return{icon:"⏳",color:"text-[var(--color-warning)]"};switch(e){case"pending":return{icon:"○",color:"text-[var(--color-text-muted)]"};case"running":return{icon:n(ue,{size:"xs",class:"text-[var(--color-accent)]"}),color:""};case"complete":return{icon:"✓",color:"text-[var(--color-success)]"};case"error":return{icon:"✗",color:"text-[var(--color-error)]"};default:return{icon:"○",color:"text-[var(--color-text-muted)]"}}}function ek(e){const t=e.args||{};if(t.path||t.file_path)return tk(String(t.path||t.file_path));if(t.command)return xl(String(t.command),60);if(t.query)return xl(String(t.query),60);if(t.url)return nk(String(t.url));if(t.action)return String(t.action);for(const[r,a]of Object.entries(t))if(typeof a=="string"&&a.length>0&&!r.startsWith("_"))return xl(a,50);return""}function xl(e,t){return e.length<=t?e:e.slice(0,t-1)+"…"}function tk(e){const t=e.split("/").filter(Boolean);return t.length<=2?e:"…/"+t.slice(-2).join("/")}function nk(e){try{const t=new URL(e),r=t.pathname.length>30?t.pathname.slice(0,30)+"…":t.pathname;return t.hostname+r}catch{return xl(e,50)}}function rk(e){if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/6e4),r=Math.floor(e%6e4/1e3);return`${t}m ${r}s`}function ak(e){return/^https?:\/\//i.test(e)}function ok(e){return/^data:/i.test(e)}function lk(e){return e.trim().replace(/^[`"'[{(]+/,"").replace(/[`"'\\})\],]+$/,"")}function sk(e){const t=[],r=[],a=e.split(`
294
+ `),o=[];for(const l of a){const s=l.trim();if(!s.startsWith("MEDIA:")){o.push(l);continue}const c=s.slice(6).trim(),u=lk(c);if(!u){o.push(l);continue}ak(u)||ok(u)?t.push(u):r.push(u)}return{text:o.join(`
295
+ `).trim(),mediaUrls:t,localPaths:r}}function ik(e){return e.map((t,r)=>({url:t,alt:`Image ${r+1}`}))}function ck(e,t){if(!t||t.length===0)return e?[{type:"text",content:e}]:[];M.chat.debug("buildContentBlocks called",{contentLen:e.length,contentPreview:e.slice(0,100),contentEnd:e.slice(-100),toolCallsCount:t.length,toolCallPositions:t.map(l=>({id:l.id.slice(-8),name:l.name,insertedAt:l.insertedAtContentLength}))});const r=[...t].sort((l,s)=>{const c=l.insertedAtContentLength??1/0,u=s.insertedAtContentLength??1/0;return c-u}),a=[];let o=0;for(const l of r){const s=l.insertedAtContentLength;if(!(s===void 0||s===1/0)){if(s>o){const c=e.slice(o,s);c.trim()&&(a.push({type:"text",content:c}),M.chat.debug("buildContentBlocks: added text block",{from:o,to:s,textLen:c.length}))}a.push({type:"tool",toolCall:l}),o=s}}if(o<e.length){const l=e.slice(o);M.chat.debug("buildContentBlocks: checking remaining text",{currentPos:o,contentLen:e.length,remainingLen:l.length,remainingTrimmedLen:l.trim().length,remainingPreview:l.slice(0,100)}),l.trim()&&(a.push({type:"text",content:l}),M.chat.debug("buildContentBlocks: added remaining text block"))}for(const l of r)l.insertedAtContentLength===void 0&&a.push({type:"tool",toolCall:l});return M.chat.debug("buildContentBlocks result",{totalBlocks:a.length,blockTypes:a.map(l=>l.type)}),a}function uk({message:e,assistantName:t="Assistant",assistantAvatar:r,isStreaming:a=!1}){const o=J(!1),l=sk(e.content),s=ik(l.mediaUrls),c=[...e.images??[],...s],u=ck(l.text,e.toolCalls??[]),d=u.length>0||a||c.length>0;return M.chat.debug("AssistantMessage render",{messageId:e.id,contentLen:e.content.length,toolCallsCount:e.toolCalls?.length??0,blocksCount:u.length,imagesCount:c.length,localPaths:l.localPaths,isStreaming:a}),n("div",{class:"group",onMouseEnter:()=>o.value=!0,onMouseLeave:()=>o.value=!1,children:[n("div",{class:"flex items-center gap-2 mb-1.5",children:[Bc(r)?n("img",{src:r,alt:t||"Assistant",class:"w-6 h-6 rounded-full object-cover"}):n("div",{class:"w-6 h-6 rounded-full bg-[var(--color-bg-surface)] border border-[var(--color-border)] flex items-center justify-center text-sm",children:r||"🤖"}),n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:t}),!a&&e.timestamp&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:ge(e.timestamp)}),n("div",{class:"flex-1"}),!a&&e.content&&n(xg,{content:e.content,visible:o.value})]}),n("div",{class:"space-y-3",children:[u.map((h,f)=>(M.chat.debug("Rendering block",{idx:f,type:h.type,contentLen:h.type==="text"?h.content.length:void 0,toolName:h.type==="tool"?h.toolCall.name:void 0}),h.type==="text"?n("div",{class:"prose prose-sm max-w-none text-[var(--color-text-primary)]",children:n(Cu,{content:h.content,isStreaming:!1})},`text-${f}`):n("div",{children:n(Xw,{toolCall:h.toolCall})},h.toolCall.id))),c.length>0&&n(bg,{images:c}),l.localPaths.length>0&&n("div",{class:"text-xs text-[var(--color-text-muted)] italic",children:l.localPaths.length===1?`📎 File: ${l.localPaths[0]}`:`📎 ${l.localPaths.length} files attached`}),a&&n("span",{class:"ml-1",children:n(Kl,{})}),!d&&a&&n("span",{class:"inline-flex items-center gap-2 text-[var(--color-text-muted)]",children:[i("chat.thinking"),n(Kl,{})]})]})]})}function dk({message:e}){return n("div",{class:"flex items-start gap-2 px-4 py-2 bg-[var(--color-bg-secondary)] rounded-xl border border-[var(--color-border)]",children:[n("div",{class:"flex-shrink-0 w-5 h-5 text-[var(--color-text-muted)] mt-0.5",children:n(ys,{class:"w-full h-full","aria-hidden":"true"})}),n("div",{class:"flex-1 text-sm text-[var(--color-text-muted)] italic",children:n(Cu,{content:e.content})})]})}function Fh({message:e,isStreaming:t=!1,assistantName:r,assistantAvatar:a,userName:o,userAvatar:l}){switch(e.role){case"user":return n(qw,{message:e,userName:o,userAvatar:l});case"assistant":return n(uk,{message:e,isStreaming:t,assistantName:r,assistantAvatar:a});case"system":return n(dk,{message:e});default:return null}}const hk={compaction:{icon:"📦",labelKey:"chat.conversationCompacted",bgClass:"bg-[var(--color-warning)]/5 border-[var(--color-warning)]/20"},cron:{icon:"⏰",labelKey:"chat.cronJobCompleted",bgClass:"bg-[var(--color-text-muted)]/5 border-[var(--color-border)]"}};function Ph({messages:e,type:t}){const[r,a]=j(!1),o=hk[t];if(e.length===0)return null;const l=e[0]?.content??"",s=t==="cron"?l.replace(/^\s*\[cron\]\s*/i,""):l;return n("div",{class:`rounded-lg border overflow-hidden ${o.bgClass}`,children:[n("button",{type:"button",onClick:()=>a(!r),class:"w-full flex items-center gap-2 px-3 py-2 text-sm text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors cursor-pointer",children:[n("span",{children:o.icon}),n("span",{class:"flex-1 text-left",children:i(o.labelKey)}),n(ta,{open:r,class:"w-4 h-4"})]}),r&&n("div",{class:"border-t border-[var(--color-border)] px-3 py-2",children:n("div",{class:"text-sm text-[var(--color-text-secondary)] whitespace-pre-wrap max-h-[400px] overflow-y-auto",children:s})})]})}const fk=["Su","Mo","Tu","We","Th","Fr","Sa"],pk=["January","February","March","April","May","June","July","August","September","October","November","December"];function gk(e,t){return new Date(e,t+1,0).getDate()}function vk(e,t){return new Date(e,t,1).getDay()}function mk(e){return e?e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):""}function zh({value:e,onChange:t,placeholder:r="Select date",class:a="",minDate:o,maxDate:l}){const[s,c]=j(!1),[u,d]=j(()=>e??new Date),[h,f]=j(!1),g=q(null);Qr(g,()=>c(!1),s);const m=()=>{if(g.current){const S=g.current.getBoundingClientRect();f(S.left+280>window.innerWidth)}c(!s)},y=u.getFullYear(),C=u.getMonth(),T=gk(y,C),_=vk(y,C),p=()=>{d(new Date(y,C-1,1))},b=()=>{d(new Date(y,C+1,1))},k=S=>{t(new Date(y,C,S)),c(!1)},E=S=>e?e.getFullYear()===y&&e.getMonth()===C&&e.getDate()===S:!1,w=S=>{const F=new Date;return F.getFullYear()===y&&F.getMonth()===C&&F.getDate()===S},A=S=>{const F=new Date(y,C,S);if(o){const N=new Date(o.getFullYear(),o.getMonth(),o.getDate());if(F<N)return!0}if(l){const N=new Date(l.getFullYear(),l.getMonth(),l.getDate());if(F>N)return!0}return!1},D=[];for(let S=0;S<_;S++)D.push(null);for(let S=1;S<=T;S++)D.push(S);return n("div",{ref:g,class:`relative ${a}`,children:[n("button",{type:"button",onClick:m,class:`
296
+ flex items-center justify-between gap-2 w-full
297
+ px-2.5 py-1.5 text-sm rounded-lg
298
+ bg-[var(--color-bg-primary)]
299
+ border border-[var(--color-border)]
300
+ ${s?"border-[var(--color-accent)]/50":""}
301
+ hover:border-[var(--color-border-hover)]
302
+ transition-colors text-left
303
+ `,children:[n("span",{class:e?"text-[var(--color-text-primary)]":"text-[var(--color-text-muted)]",children:e?mk(e):r}),n(ta,{open:s,class:"w-3.5 h-3.5 text-[var(--color-text-muted)]"})]}),s&&n("div",{class:`absolute top-full mt-1 z-50 p-3 rounded-lg shadow-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)] min-w-[260px] ${h?"right-0":"left-0"}`,children:[n("div",{class:"flex items-center justify-between mb-3",children:[n("button",{type:"button",onClick:p,class:"p-1.5 rounded-md hover:bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] transition-colors",children:n("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2",children:n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 19l-7-7 7-7"})})}),n("span",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:[pk[C]," ",y]}),n("button",{type:"button",onClick:b,class:"p-1.5 rounded-md hover:bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] transition-colors",children:n("svg",{class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2",children:n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 5l7 7-7 7"})})})]}),n("div",{class:"grid grid-cols-7 gap-1 mb-1",children:fk.map(S=>n("div",{class:"text-[10px] font-medium text-[var(--color-text-muted)] text-center py-1",children:S},S))}),n("div",{class:"grid grid-cols-7 gap-1",children:D.map((S,F)=>{const N=S!==null&&A(S);return n("div",{class:"aspect-square",children:S!==null&&n("button",{type:"button",onClick:()=>!N&&k(S),disabled:N,class:`
304
+ w-full h-full flex items-center justify-center
305
+ text-sm rounded-md transition-colors
306
+ ${N?"text-[var(--color-text-muted)]/40 cursor-not-allowed":E(S)?"bg-[var(--color-accent)] text-[var(--color-accent-text)] font-medium":w(S)?"bg-[var(--color-accent)]/10 text-[var(--color-accent)] font-medium":"text-[var(--color-text-primary)] hover:bg-[var(--color-bg-secondary)]"}
307
+ `,children:S})},F)})}),e&&n("button",{type:"button",onClick:()=>{t(null),c(!1)},class:"w-full mt-2 pt-2 border-t border-[var(--color-border)] text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors",children:"Clear"})]})]})}function bk(){const e=q(null),t=qe.value,r=K(()=>{qe.value=!1,Nn.value="",Bx()},[]);z(()=>{qe.value&&e.current&&e.current.focus()},[qe.value]),z(()=>{const s=c=>{(c.metaKey||c.ctrlKey)&&c.key==="f"&&(c.preventDefault(),qe.value=!0),c.key==="Escape"&&qe.value&&r()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[r]);const a=Wx.value,l=Wc(Nn.value)||cp.value;return n(Y,{children:[n("div",{class:`hidden sm:flex absolute top-2 left-2 z-10 items-center gap-2 transition-opacity ${t?"opacity-0 pointer-events-none":"opacity-100"}`,children:[n(Q,{icon:n(gu,{}),label:i("chat.search"),onClick:()=>qe.value=!0,variant:"ghost",size:"sm",class:"border border-[var(--color-border)] bg-[var(--color-bg-surface)]"}),n(Bp,{})]}),n("div",{class:`absolute top-0 left-0 right-0 z-10 flex items-center gap-3 px-3 py-2 bg-[var(--color-bg-surface)] border-b border-[var(--color-border)] transition-opacity ${t?"opacity-100":"opacity-0 pointer-events-none"}`,children:[n(Q,{icon:n(ea,{}),label:i("actions.close"),onClick:r,variant:"ghost",size:"sm",tabIndex:t?0:-1}),n("div",{class:"flex-1 flex items-center gap-2 min-w-[120px]",children:[n("input",{ref:e,type:"text",value:Nn.value,onInput:s=>Nn.value=s.target.value,placeholder:i("chat.searchPlaceholder"),class:"flex-1 px-2.5 py-1.5 text-sm rounded-lg bg-[var(--color-bg-primary)] border border-[var(--color-border)] text-[var(--color-text-primary)] placeholder:text-[var(--color-text-muted)] focus:outline-none focus:border-[var(--color-accent)]/50 transition-colors",tabIndex:t?0:-1}),l&&n("span",{class:"text-xs text-[var(--color-text-muted)] whitespace-nowrap",children:[a," ",i(a===1?"chat.match":"chat.matches")]})]}),n("div",{class:"hidden sm:flex items-center gap-1.5 flex-shrink-0",children:[n(zh,{value:xr.value,onChange:s=>xr.value=s,placeholder:i("chat.dateFrom"),class:"w-[130px]",maxDate:yr.value}),n("span",{class:"text-[var(--color-text-muted)] text-sm",children:"–"}),n(zh,{value:yr.value,onChange:s=>yr.value=s,placeholder:i("chat.dateTo"),class:"w-[130px]",minDate:xr.value})]})]})]})}function xk(e){const t=[];for(const r of e)vx(r)||tp(r)||(xx(r)?t.push({type:"compaction",messages:[r]}):mx(r)?t.push({type:"cron",message:r}):t.push({type:"message",message:r}));return t}const Uh=["bg-[var(--color-bg-hover)]","rounded-lg","transition-colors"],yk="cursor-pointer hover:bg-[var(--color-bg-hover)] rounded-lg transition-colors";function wk({messages:e,isLoading:t=!1,error:r=null,streamingContent:a="",streamingToolCalls:o=[],isStreaming:l=!1,assistantName:s,assistantAvatar:c,userName:u,userAvatar:d,queuedCount:h=0}){M.chat.debug("MessageList render",{messagesCount:e.length,streamingContentLen:a.length,streamingToolCallsCount:o.length,isStreaming:l,queuedCount:h});const f=q(null),g=q(null),m=J(!1),y=q(!0),C=K((w=!0)=>{requestAnimationFrame(()=>{f.current&&f.current.scrollTo({top:f.current.scrollHeight,behavior:w?"smooth":"auto"})})},[]),T=K(()=>{if(!f.current)return;const{scrollTop:w,scrollHeight:A,clientHeight:D}=f.current,S=A-w-D;m.value=S>100,y.current=S<50},[]),_=o.filter(w=>w.status==="complete"||w.status==="error").length,p=q(null);z(()=>{const w=e[e.length-1];(w?.role==="user"&&w.id!==p.current||h>0||y.current)&&C(!1),p.current=w?.id??null},[e.length,a.length,o.length,_,h,C]),z(()=>{C(!1)},[C]),z(()=>{const w=Bo.value;if(!w||!f.current)return;const A=f.current.querySelector(`[data-message-id="${w}"]`);A&&(A.scrollIntoView({behavior:"smooth",block:"center"}),A.classList.add(...Uh),setTimeout(()=>{A.classList.remove(...Uh)},2e3)),Bo.value=null},[Bo.value]);const b=l&&ep(a),k=l&&!b?{id:"streaming",role:"assistant",content:a,toolCalls:o.length>0?o:void 0,timestamp:Date.now(),isStreaming:!0}:null,E=Qn(()=>xk(e),[e]);return n("div",{class:"relative flex-1 flex flex-col overflow-hidden",children:[n("div",{class:"relative h-0 overflow-visible z-10",children:n(bk,{})}),n("div",{ref:f,onScroll:T,class:"flex-1 overflow-y-auto",role:"list","aria-label":"Messages",children:n("div",{class:"max-w-5xl mx-auto px-6 py-6 min-h-full flex flex-col",children:[t&&n("div",{class:"flex justify-center py-8",children:n(ue,{size:"md",label:i("status.loading")})}),r&&n("div",{class:"flex justify-center py-8",children:n("div",{class:"text-[var(--color-error)] text-center",children:n("p",{children:r})})}),!t&&!r&&e.length===0&&!l&&n("div",{class:"flex-1 flex items-center justify-center py-16",children:n("div",{class:"text-center max-w-md",children:[Bc(c)?n("img",{src:c,alt:s||i("chat.emptyState.assistant"),class:"w-20 h-20 rounded-2xl mx-auto mb-4 opacity-90"}):c?n("div",{class:"text-6xl mx-auto mb-4",role:"img","aria-label":s||i("chat.emptyState.assistant"),children:c}):n(Ss,{size:"lg",class:"mx-auto mb-4 opacity-80"}),n("h3",{class:"text-xl font-medium mb-2",children:s?i("chat.emptyState.titleWithName",{name:s}):i("chat.emptyState.title")}),n("p",{class:"text-[var(--color-text-muted)] mb-6",children:i("chat.emptyState.description")}),n("div",{class:"text-sm text-[var(--color-text-muted)]",children:[n("p",{class:"mb-2",children:i("chat.emptyState.hint")}),n("div",{class:"flex items-center justify-center gap-4 text-xs",children:[n("span",{class:"flex items-center gap-1",children:[n("kbd",{class:"px-1.5 py-0.5 rounded bg-[var(--color-bg-tertiary)] font-mono",children:"⌘"}),n("kbd",{class:"px-1.5 py-0.5 rounded bg-[var(--color-bg-tertiary)] font-mono",children:"F"}),n("span",{class:"ml-1",children:i("chat.emptyState.search")})]}),n("span",{class:"flex items-center gap-1",children:[n("kbd",{class:"px-1.5 py-0.5 rounded bg-[var(--color-bg-tertiary)] font-mono",children:"/new"}),n("span",{class:"ml-1",children:i("chat.emptyState.newSession")})]})]})]})]})}),n("div",{class:"space-y-6",children:[E.map((w,A)=>{if(w.type==="compaction")return n(Ph,{messages:w.messages,type:"compaction"},`compaction-${A}`);if(w.type==="cron")return n(Ph,{messages:[w.message],type:"cron"},`cron-${A}`);const D=w.message,S=qe.value?()=>{Bo.value=D.id,Nn.value="",qe.value=!1}:void 0;return n("div",{"data-message-id":D.id,onClick:S,onKeyDown:S?F=>{F.key==="Enter"&&S()}:void 0,role:qe.value?"button":void 0,tabIndex:qe.value?0:void 0,class:`-mx-2 px-2 py-1 rounded-lg ${qe.value?yk:""}`,children:n(Fh,{message:D,assistantName:s,assistantAvatar:c,userName:u,userAvatar:d})},D.id)}),k&&n(Fh,{message:k,isStreaming:!0,assistantName:s,assistantAvatar:c})]}),n("div",{ref:g,class:"h-1"})]})}),m.value&&n("div",{class:"absolute bottom-4 right-4",children:n(Q,{icon:n(l1,{}),label:i("chat.scrollToBottom"),onClick:()=>{y.current=!0,C(!0)},variant:"default",size:"md",class:"shadow-lg bg-[var(--color-bg-surface)] border border-[var(--color-border)]"})})]})}const kk=["image/png","image/jpeg","image/gif","image/webp"],Hh=10*1024*1024,ec=400*1024,Jo=2048;function Eu(e){return kk.includes(e)}let _k=0;function jh(){return`attachment_${Date.now()}_${++_k}`}async function yg(e){return new Promise((t,r)=>{const a=new Image,o=document.createElement("canvas"),l=o.getContext("2d");if(!l){r(new Error("Canvas not supported"));return}a.onload=()=>{let{width:s,height:c}=a;if(s>Jo||c>Jo){const y=Math.min(Jo/s,Jo/c);s=Math.round(s*y),c=Math.round(c*y)}o.width=s,o.height=c,l.drawImage(a,0,0,s,c);const u=e.type==="image/png"?"image/png":"image/jpeg";let d=.9,h=o.toDataURL(u,d);if(u==="image/jpeg")for(;h.length>ec&&d>.1;)d-=.1,h=o.toDataURL(u,d);let f=1;for(;h.length>ec&&f>.2;)f-=.1,o.width=Math.round(s*f),o.height=Math.round(c*f),l.drawImage(a,0,0,o.width,o.height),h=o.toDataURL(u,u==="image/jpeg"?.8:void 0);const g=h.split(",")[1]||"",m=Math.round(g.length*3/4);URL.revokeObjectURL(a.src),t({content:h,size:m})},a.onerror=()=>{URL.revokeObjectURL(a.src),r(new Error("Failed to load image"))},a.src=URL.createObjectURL(e)})}async function Bh(e){if(Eu(e.type)){const{content:r,size:a}=await yg(e);return{id:jh(),type:"image",mimeType:e.type==="image/png"?"image/png":"image/jpeg",fileName:e.name,content:r,size:a,previewUrl:r}}return new Promise((r,a)=>{const o=new FileReader;o.onload=()=>{const l=o.result;r({id:jh(),type:"file",mimeType:e.type||"application/octet-stream",fileName:e.name,content:l,size:e.size})},o.onerror=()=>a(new Error("Failed to read file")),o.readAsDataURL(e)})}function Sk(){const e=J([]),t=J(!1),r=J(null);z(()=>()=>{for(const d of e.value)d.previewUrl&&URL.revokeObjectURL(d.previewUrl)},[]);const a=K(async d=>{const h=Array.from(d);r.value=null,t.value=!0;try{for(const f of h){if(f.size>Hh){r.value=`File "${f.name}" is too large (max 10MB)`;continue}if(!Eu(f.type)&&f.size>ec){r.value=`File "${f.name}" is too large (max 400KB for non-images)`;continue}try{const g=await Bh(f);e.value=[...e.value,g]}catch{r.value=`Failed to read "${f.name}"`}}}finally{t.value=!1}},[]),o=K(d=>{const h=e.value.find(f=>f.id===d);h?.previewUrl&&URL.revokeObjectURL(h.previewUrl),e.value=e.value.filter(f=>f.id!==d)},[]),l=K(()=>{for(const d of e.value)d.previewUrl&&URL.revokeObjectURL(d.previewUrl);e.value=[]},[]),s=K(()=>e.value.map(d=>({type:d.type,mimeType:d.mimeType,fileName:d.fileName,content:d.content})),[]),c=K(async d=>{const h=d.clipboardData?.items;if(!h)return!1;const f=[];for(const g of h)g.type.startsWith("image/")&&f.push(g);if(f.length===0)return!1;d.preventDefault(),r.value=null,t.value=!0;try{for(const g of f){const m=g.getAsFile();if(m){if(m.size>Hh){r.value="Pasted image is too large (max 10MB)";continue}try{const y=await Bh(m);e.value=[...e.value,y]}catch{r.value="Failed to read pasted image"}}}}finally{t.value=!1}return!0},[]),u=K(()=>{r.value=null},[]);return{attachments:e.value,addFiles:a,removeAttachment:o,clearAttachments:l,getPayloads:s,handlePaste:c,isProcessing:t.value,error:r.value,clearError:u}}function Ck(e){if(!e)return null;const t=e.indexOf("/");return t===-1?null:e.substring(0,t)}function Ek(e){if(!e)return null;const t=Ck(e);return t||(Kn.value.find(a=>a.id===e)?.provider??null)}function Tk({sessionKey:e,currentModel:t,onModelChange:r}){const[a,o]=j(!1),[l,s]=j(!1),[c,u]=j(()=>Om()),d=q(null);if(Qr(d,()=>o(!1),a),Kn.value.length===0)return null;const h=t??wp.value??Kn.value[0]?.id,f=Ek(h),g=f?O0.value.get(f)??[]:[],m=Qn(()=>[...g.filter((p,b,k)=>k.findIndex(E=>E.id===p.id)===b)].sort((p,b)=>{if(p.id===h)return-1;if(b.id===h)return 1;const k=c.has(p.id),E=c.has(b.id);return k&&!E?-1:!k&&E?1:p.name.localeCompare(b.name)}),[g,h,c]);if(m.length===0)return null;const y=t?P0(t):i("sessions.defaultModel"),C=(_,p)=>{p.preventDefault(),p.stopPropagation();const b=new Set(c);b.has(_)?b.delete(_):b.add(_),u(b),Fm(b)},T=async _=>{if(_===t){o(!1);return}s(!0);try{await H("sessions.patch",{key:e,model:_}),r?.(_),M.ui.debug("Model changed to:",_)}catch(p){M.ui.error("Failed to change model:",p)}finally{s(!1),o(!1)}};return n("div",{ref:d,class:"relative",children:[n("button",{type:"button",onClick:()=>o(!a),disabled:l,class:`flex items-center gap-1 px-2 py-1 rounded-lg text-xs
308
+ text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]
309
+ hover:bg-[var(--color-bg-secondary)] transition-colors
310
+ disabled:opacity-50`,children:[n("span",{class:"max-w-[120px] truncate",children:y}),n(ta,{class:"w-3 h-3",open:a})]}),a&&n("div",{class:"absolute bottom-full left-0 mb-1 w-56 max-h-64 overflow-y-auto bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-lg shadow-lg z-50",children:m.map(_=>{const p=c.has(_.id),b=(t??h)===_.id;return n("div",{class:`flex items-center gap-1 px-2 py-2 transition-colors ${b?"text-[var(--color-accent)] bg-[var(--color-accent)]/10":"text-[var(--color-text-primary)] hover:bg-[var(--color-bg-secondary)]"}`,children:[n("button",{type:"button",onClick:k=>C(_.id,k),class:`p-1 -m-1 text-xs transition-colors rounded hover:bg-[var(--color-bg-tertiary)] ${p?"text-[var(--color-warning)]":"text-[var(--color-text-muted)] hover:text-[var(--color-warning)]/70"}`,title:i(p?"models.removeFavorite":"models.addFavorite"),"aria-label":i(p?"models.removeFavorite":"models.addFavorite"),children:p?"★":"☆"}),n("button",{type:"button",onClick:()=>T(_.id),class:"flex-1 text-left text-sm flex items-center gap-2 min-w-0",children:[n("span",{class:"truncate",children:_.name}),_.reasoning&&n("span",{class:"text-[10px] text-[var(--color-warning)] flex-shrink-0",children:"🧠"})]})]},_.id)})})]})}function Ak({onCancel:e,onConfirm:t,confirmLabel:r,confirmDisabled:a,cancelLabel:o}){return n("div",{class:"flex flex-col-reverse sm:flex-row sm:justify-end gap-2",children:[n(L,{variant:"secondary",onClick:e,fullWidth:!0,class:"sm:w-auto",children:o||i("actions.cancel")}),n(L,{onClick:t,disabled:a,fullWidth:!0,class:"sm:w-auto",children:r||i("actions.confirm")})]})}function wg({message:e,onCancel:t,onDelete:r,isDeleting:a}){return n("div",{class:"space-y-3",children:[n("p",{class:"text-sm text-[var(--color-error)] text-center sm:text-left",children:e}),n("div",{class:"flex flex-col-reverse sm:flex-row sm:justify-end gap-2",children:[n(L,{variant:"ghost",onClick:t,fullWidth:!0,class:"sm:w-auto",children:i("actions.cancel")}),n(L,{variant:"danger",icon:n(Gt,{class:"w-4 h-4"}),onClick:r,disabled:a,fullWidth:!0,class:"sm:w-auto",children:a?n(ue,{size:"sm"}):i("actions.delete")})]})]})}function kg({onCancel:e,onSave:t,isSaving:r,saveDisabled:a,saveLabel:o,isEdit:l,onDeleteClick:s,extraContent:c}){return n("div",{class:"flex flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-3",children:[n("div",{class:"flex items-center justify-between sm:justify-start gap-3",children:[l&&s&&n(L,{size:"sm",variant:"ghost",icon:n(Gt,{class:"w-4 h-4"}),onClick:s,class:"text-[var(--color-error)] hover:bg-[var(--color-error)]/10",children:i("actions.delete")}),c&&n("div",{class:"sm:hidden",children:c})]}),n("div",{class:"flex flex-col sm:flex-row sm:items-center gap-3",children:[c&&n("div",{class:"hidden sm:block",children:c}),n("div",{class:"flex flex-col sm:flex-row gap-2",children:[n(L,{variant:"secondary",onClick:e,fullWidth:!0,class:"sm:w-auto",children:i("actions.cancel")}),n(L,{onClick:t,disabled:r||a,fullWidth:!0,class:"sm:w-auto",children:r?n(ue,{size:"sm"}):o||i("actions.save")})]})]})]})}const Mk=100,Wh=120;function Ik(){const e=Ze.value,[t,r]=j(new Set),[a,o]=j(null),[l,s]=j(""),[c,u]=j([]),d=q(null);if(e.length===0)return null;const h=_=>{r(p=>{const b=new Set(p);return b.has(_)?b.delete(_):b.add(_),b})},f=_=>{o(_),s(_.content),u(_.images??[])},g=()=>{if(!a)return!1;const _=a.content,p=a.images??[];if(l.trim()!==_||c.length!==p.length)return!0;for(let b=0;b<c.length;b++)if(c[b].url!==p[b].url)return!0;return!1},m=()=>{a&&(l.trim()||c.length>0)&&g()&&(Xx(a.id,l.trim(),c.length>0?c:void 0),o(null),s(""),u([]))},y=()=>{o(null),s(""),u([])},C=_=>{u(p=>p.filter((b,k)=>k!==_))},T=async _=>{if(!_||_.length===0)return;const p=[];for(const b of Array.from(_))if(Eu(b.type))try{const{content:k}=await yg(b);p.push({url:k,alt:b.name})}catch{}p.length>0&&u(b=>[...b,...p]),d.current&&(d.current.value="")};return n(Y,{children:[n("div",{class:"mb-2 space-y-2",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] font-medium",children:i("chat.queuedMessages",{count:e.length})}),n("div",{class:"space-y-1",children:e.map(_=>{const p=_.content.length>Mk,b=t.has(_.id),k=_.images&&_.images.length>0;return n("div",{class:"px-3 py-2 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:[n("div",{class:"flex items-start gap-2",children:[n("div",{class:"flex-1 min-w-0",children:[n("p",{class:`text-sm text-[var(--color-text-secondary)] break-words ${p&&!b?"line-clamp-1":"whitespace-pre-wrap"}`,children:_.content}),k&&n("div",{class:"mt-1 flex items-center gap-1 text-xs text-[var(--color-text-muted)]",children:[n(p1,{class:"w-3 h-3"}),n("span",{children:i("chat.imageCount",{count:_.images.length})})]})]}),n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[n("button",{type:"button",onClick:()=>f(_),class:"p-1 rounded hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)] hover:text-[var(--color-accent)] transition-colors",title:i("actions.edit"),"aria-label":i("actions.edit"),children:n(qp,{class:"w-4 h-4"})}),n("button",{type:"button",onClick:()=>pp(_.id),class:"p-1 rounded hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)] hover:text-[var(--color-error)] transition-colors",title:i("actions.remove"),"aria-label":i("actions.remove"),children:n(Gp,{class:"w-4 h-4"})})]})]}),p&&n("button",{type:"button",onClick:()=>h(_.id),class:"mt-1 flex items-center gap-1 text-xs text-[var(--color-accent)] hover:text-[var(--color-accent-hover)] transition-colors",children:[n(ta,{class:"w-3 h-3",open:b}),i(b?"actions.showLess":"actions.showMore")]})]},_.id)})})]}),n(Qe,{open:!!a,onClose:y,title:i("chat.editQueuedMessage"),size:"lg",footer:n(Ak,{onCancel:y,onConfirm:m,confirmLabel:i("actions.save"),confirmDisabled:!l.trim()&&c.length===0||!g()}),children:n("div",{class:"space-y-4",children:[n("textarea",{value:l,onInput:_=>s(_.target.value),class:"w-full h-48 p-3 rounded-lg bg-[var(--color-bg-primary)] border border-[var(--color-border)] text-[var(--color-text-primary)] text-sm resize-none focus:outline-none focus:border-[var(--color-accent)]",placeholder:i("chat.placeholder")}),n("div",{children:[n("div",{class:"flex items-center justify-between mb-2",children:[n("span",{class:"text-sm font-medium text-[var(--color-text-secondary)]",children:i("chat.images")}),n(L,{variant:"ghost",size:"sm",icon:n(Wp,{class:"w-4 h-4"}),onClick:()=>d.current?.click(),children:i("chat.addImage")}),n("input",{ref:d,type:"file",accept:"image/*",multiple:!0,class:"hidden",onChange:_=>T(_.target.files)})]}),c.length>0?n("div",{class:"flex flex-wrap gap-2",children:c.map((_,p)=>n("div",{class:"relative group",children:[n("img",{src:_.url,alt:_.alt||`Image ${p+1}`,class:"rounded-lg object-cover border border-[var(--color-border)]",style:{width:Wh,height:Wh}}),n("button",{type:"button",onClick:()=>C(p),class:"absolute -top-2 -right-2 p-1 rounded-full bg-[var(--color-error)] text-white opacity-0 group-hover:opacity-100 transition-opacity shadow-sm",title:i("actions.remove"),"aria-label":i("actions.remove"),children:n(ea,{class:"w-3 h-3"})})]},p))}):n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("chat.noImages")})]})]})})]})}function Rk({attachments:e,onRemove:t,isProcessing:r}){return e.length===0&&!r?null:n("div",{class:"flex flex-wrap gap-2 px-4 pb-2 items-center",children:[e.map(a=>n($k,{attachment:a,onRemove:()=>t(a.id)},a.id)),r&&n("div",{class:`
311
+ w-16 h-16 rounded-lg
312
+ border border-[var(--color-border)]
313
+ bg-[var(--color-bg-secondary)]
314
+ flex items-center justify-center
315
+ `,children:n(ue,{size:"sm"})})]})}function $k({attachment:e,onRemove:t}){const r=e.type==="image",a=Dk(e.size);return n("div",{class:"relative group",children:[n(Zr,{content:`${e.fileName} (${a})`,placement:"top",children:n("div",{class:`
316
+ relative w-16 h-16 rounded-lg overflow-hidden
317
+ border border-[var(--color-border)]
318
+ bg-[var(--color-bg-secondary)]
319
+ flex items-center justify-center
320
+ `,children:r&&e.previewUrl?n("img",{src:e.previewUrl,alt:e.fileName,class:"w-full h-full object-cover"}):n("div",{class:"flex flex-col items-center gap-1 text-[var(--color-text-muted)]",children:[r?n(wr,{class:"w-6 h-6"}):n(jt,{class:"w-6 h-6"}),n("span",{class:"text-[8px] truncate max-w-[56px] px-1",children:Lk(e.fileName)})]})})}),n("button",{type:"button",onClick:t,"aria-label":i("actions.remove"),class:`
321
+ absolute -top-1.5 -right-1.5
322
+ w-5 h-5 rounded-full
323
+ bg-[var(--color-bg-surface)] border border-[var(--color-border)]
324
+ flex items-center justify-center
325
+ opacity-0 group-hover:opacity-100
326
+ hover:bg-[var(--color-error)] hover:border-[var(--color-error)] hover:text-white
327
+ transition-all cursor-pointer
328
+ `,children:n(Xr,{class:"w-3 h-3"})})]})}function Dk(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Lk(e){return e.split(".").pop()?.toUpperCase()||"FILE"}const qh=160;function Nk({onSend:e,onAbort:t,disabled:r=!1,isStreaming:a=!1,placeholder:o,sessionKey:l,currentModel:s,onModelChange:c}){const u=q(null),d=q(null),h=q(null),f=J(l?Dd(l):""),g=J(!1),{attachments:m,addFiles:y,removeAttachment:C,clearAttachments:T,getPayloads:_,handlePaste:p,isProcessing:b,error:k,clearError:E}=Sk(),w=K(()=>{const U=u.current;if(!U)return;U.style.height="auto";const ae=Math.min(U.scrollHeight,qh);U.style.height=`${ae}px`},[]),A=K(U=>{const ae=U.target.value;f.value=ae,l&&gp(l,ae),w()},[w,l]),D=K(()=>{const U=f.value.trim(),ae=_();!U&&ae.length===0||r||(e(U,ae.length>0?ae:void 0),f.value="",l&&Zx(l),T(),u.current&&(u.current.style.height="auto"))},[e,r,_,T,l]),S=K(U=>{if((U.metaKey||U.ctrlKey)&&U.key==="Enter"){U.preventDefault(),D();return}U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),D())},[D]),F=K(async U=>{await p(U)},[p]),N=K(U=>{const ae=U.target;ae.files&&ae.files.length>0&&(y(ae.files),ae.value="")},[y]),re=K(U=>{U.preventDefault(),U.stopPropagation(),g.value=!0},[]),de=K(U=>{U.preventDefault(),U.stopPropagation(),!(U.relatedTarget&&h.current?.contains(U.relatedTarget))&&(g.value=!1)},[]),sn=K(U=>{U.preventDefault(),U.stopPropagation()},[]),ra=K(async U=>{U.preventDefault(),U.stopPropagation(),g.value=!1;const ae=U.dataTransfer?.files;ae&&ae.length>0&&await y(ae)},[y]);z(()=>{if(u.current?.focus(),l){const U=Dd(l);f.value=U,U&&requestAnimationFrame(w)}},[l,w]),z(()=>{if(k){const U=setTimeout(E,5e3);return()=>clearTimeout(U)}},[k,E]);const aa=Wc(f.value),cn=m.length>0,ve=(aa||cn)&&!r;return n("div",{class:"pb-3 pt-2",children:n("div",{class:"max-w-5xl mx-auto px-6",children:[n(Ik,{}),k&&n("div",{class:"mb-2 px-3 py-2 text-sm text-[var(--color-error)] bg-[var(--color-error)]/10 rounded-lg",children:k}),n("div",{ref:h,"data-tour":"chat-input",onDragEnter:re,onDragLeave:de,onDragOver:sn,onDrop:ra,class:`
329
+ relative flex flex-col bg-[var(--color-bg-surface)] border rounded-xl
330
+ transition-all duration-200
331
+ ${g.value?"border-[var(--color-accent)] bg-[var(--color-accent)]/5":"border-[var(--color-border)] focus-within:border-[var(--color-accent)]"}
332
+ `,children:[g.value&&n("div",{class:"absolute inset-0 flex items-center justify-center bg-[var(--color-accent)]/10 rounded-xl z-10 pointer-events-none",children:n("span",{class:"text-sm font-medium text-[var(--color-accent)]",children:i("chat.dropFiles")})}),(cn||b)&&n("div",{class:"pt-3 px-4",children:n(Rk,{attachments:m,onRemove:C,isProcessing:b})}),n("textarea",{ref:u,value:f.value,onInput:A,onKeyDown:S,onPaste:F,disabled:r,placeholder:o||(window.innerWidth<640?i("chat.placeholderMobile"):i("chat.placeholder")),rows:1,class:`
333
+ w-full px-4 pb-1 text-base sm:text-sm rounded-t-xl resize-none
334
+ bg-transparent border-none
335
+ placeholder:text-[var(--color-text-muted)]
336
+ disabled:opacity-50 disabled:cursor-not-allowed
337
+ ${cn?"pt-2":"pt-3"}
338
+ `,style:{minHeight:"44px",maxHeight:`${qh}px`,outline:"none"}}),n("input",{ref:d,type:"file",multiple:!0,accept:"image/*",onChange:N,class:"hidden"}),n("div",{class:"px-2 pb-2 pt-1 flex items-center justify-between",children:[n("div",{class:"flex items-center gap-1",children:[l&&n("div",{"data-tour":"model-picker",children:n(Tk,{sessionKey:l,currentModel:s,onModelChange:c})}),n(Zr,{content:i("chat.attachImage"),placement:"top",children:n("button",{type:"button",onClick:()=>d.current?.click(),disabled:r,"aria-label":i("chat.attachImage"),class:`
339
+ p-1.5 rounded-lg cursor-pointer
340
+ text-[var(--color-text-muted)]
341
+ hover:text-[var(--color-text-secondary)]
342
+ hover:bg-[var(--color-bg-hover)]
343
+ disabled:opacity-50 disabled:cursor-not-allowed
344
+ transition-colors
345
+ `,children:n(wr,{class:"w-4 h-4","aria-hidden":"true"})})})]}),n("div",{class:"flex items-center gap-1.5",children:[a&&n("button",{type:"button",onClick:t,"aria-label":i("actions.stop"),class:`p-2 sm:px-3 sm:py-1.5 rounded-lg flex items-center justify-center gap-1.5 cursor-pointer
346
+ bg-[var(--color-error)]/10 text-[var(--color-error)]
347
+ hover:bg-[var(--color-error)]/20
348
+ active:scale-95 transition-all duration-150`,children:[n(c1,{class:"w-4 h-4"}),n("span",{class:"hidden sm:inline text-xs font-medium",children:i("actions.stop")})]}),n("button",{type:"button",onClick:D,disabled:!ve,"aria-label":i(a?"actions.queue":"actions.send"),class:`p-2 sm:px-3 sm:py-1.5 rounded-lg flex items-center justify-center gap-1.5
349
+ transition-all duration-150 active:scale-95
350
+ ${ve?"bg-[var(--color-accent)] text-white hover:opacity-90 cursor-pointer":"bg-[var(--color-bg-secondary)] text-[var(--color-text-muted)] cursor-not-allowed"}`,children:[n(i1,{class:"w-4 h-4"}),n("span",{class:"hidden sm:inline text-xs font-medium",children:i(a?"actions.queue":"actions.send")})]})]})]})]})]})})}function Ok(){const e=Ce.value;if(e==="connected"||e==="connecting"||e==="authenticating")return null;const t=e==="reconnecting",r=Ze.value.length;return n("div",{class:`
351
+ px-4 py-2 text-sm flex items-center justify-center gap-2
352
+ animate-[fade-in_150ms_ease-out_100ms_forwards] opacity-0
353
+ ${t?"bg-[var(--color-warning)]/10 text-[var(--color-warning)]":"bg-[var(--color-error)]/10 text-[var(--color-error)]"}
354
+ `,role:"alert",children:[n("span",{class:"flex-shrink-0",children:t?n(Rp,{class:"w-4 h-4 animate-spin","aria-hidden":"true"}):n(tr,{class:"w-4 h-4","aria-hidden":"true"})}),n("span",{children:t?xt.value>1?i("connection.reconnectingAttempt",{count:xt.value}):i("connection.reconnecting"):i("connection.disconnected")}),dp.value&&n("span",{class:"text-xs opacity-75",children:["• ",i("connection.messagesQueued",{count:r})]})]})}function Fk(){return zi.value?n("div",{class:"absolute top-2 left-1/2 -translate-x-1/2 z-20 px-4 py-2 text-sm flex items-center gap-2 bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] rounded-full shadow-lg border border-[var(--color-border)]",role:"status",children:[n(Rp,{class:"w-4 h-4 animate-spin","aria-hidden":"true"}),n("span",{children:i("chat.compacting")})]}):null}function Xo({sessionKey:e}){const t=q(null),r=q(!1);z(()=>{const s=e?decodeURIComponent(e):null;if(md.value&&Le.value){en.value!==Le.value&&Xa(Le.value),s&&s!==Le.value&&it(`/chat/${encodeURIComponent(Le.value)}`,!0);return}if(!s&&Le.value){it(`/chat/${encodeURIComponent(Le.value)}`,!0);return}const c=s||"main";c!==en.value&&Xa(c)},[e,Le.value,md.value]),z(()=>{const s=ft.value;if(!s||s===t.current)return;t.current=s,Ux()!==s&&(hp(),Nn.value="",qe.value=!1),Qc(s).catch(()=>{})},[en.value]),z(()=>{const s=$.value,c=r.current;r.current=s,!(!s||c)&&(Jx(),dp.value&&p0())},[Ce.value]);const a=async(s,c)=>{const u=ft.value;if(u)try{await mp(u,s,{attachments:c})}catch{}},o=()=>{const s=ft.value;s&&g0(s)},l=is(()=>qx(ft.value));return n("div",{class:"flex-1 flex flex-col overflow-hidden relative",children:[n(Ok,{}),n(Fk,{}),n(wk,{messages:up.value,isLoading:Pi.value,error:Dl.value,streamingContent:l.value.content,streamingToolCalls:l.value.toolCalls,isStreaming:l.value.isStreaming,assistantName:Wi.value,assistantAvatar:bp.value??void 0,userName:I0.value,userAvatar:R0.value??void 0,queuedCount:Ze.value.length}),n(Nk,{onSend:a,onAbort:o,disabled:!1,isStreaming:l.value.isStreaming,sessionKey:ft.value,currentModel:Mx.value?.model,onModelChange:s=>{ft.value&&Kc(ft.value,{model:s})}})]})}const Tu=wo(({size:e="md",error:t,fullWidth:r,class:a,...o},l)=>{const[s,c]=j(!1);return n(te,{ref:l,type:s?"text":"password",size:e,error:t,fullWidth:r,rightElement:n("button",{type:"button",onClick:()=>c(!s),class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors","aria-label":s?"Hide password":"Show password",tabIndex:-1,children:s?n(Cp,{class:"w-4 h-4"}):n(Ep,{class:"w-4 h-4"})}),class:a,...o})});Tu.displayName="PasswordInput";const Pk={default:`
355
+ bg-[var(--color-bg-surface)]
356
+ border border-[var(--color-border)]
357
+ shadow-soft-sm
358
+ transition-shadow duration-200 ease-out
359
+ hover:shadow-soft
360
+ `,elevated:`
361
+ bg-[var(--color-bg-surface)]
362
+ border border-[var(--color-border)]
363
+ shadow-soft-lg
364
+ transition-shadow duration-200 ease-out
365
+ hover:shadow-soft-xl
366
+ `,outlined:`
367
+ bg-transparent
368
+ border border-[var(--color-border)]
369
+ transition-colors duration-200 ease-out
370
+ `},ii={none:"",sm:"p-3",md:"p-4",lg:"p-6"};function V({variant:e="default",padding:t="md",title:r,subtitle:a,headerActions:o,footer:l,children:s,class:c,...u}){const d=r||a||o;return n("div",{class:`rounded-xl ${Pk[e]} ${c||""}`,...u,children:[d&&n("div",{class:`
371
+ flex items-start justify-between gap-4
372
+ ${t!=="none"?ii[t]:"p-4"}
373
+ ${s||l?"border-b border-[var(--color-border)]":""}
374
+ `,children:[n("div",{children:[r&&n("h3",{class:"font-medium text-[var(--color-text-primary)]",children:r}),a&&n("p",{class:"text-sm text-[var(--color-text-muted)] mt-0.5",children:a})]}),o&&n("div",{class:"flex items-center gap-2",children:o})]}),s&&n("div",{class:ii[t],children:s}),l&&n("div",{class:`
375
+ ${ii[t]}
376
+ border-t border-[var(--color-border)]
377
+ bg-[var(--color-bg-secondary)]/50
378
+ rounded-b-2xl
379
+ `,children:l})]})}function zk(){const e=J(""),t=J(""),r=J("token"),a=J(!1),o=J(!0),l=J(null),s=h=>{if(!h.trim())return i("errors.required");if(!h.startsWith("ws://")&&!h.startsWith("wss://"))return"URL must start with ws:// or wss://";try{new URL(h)}catch{return i("errors.invalid")}return null},c=async()=>{const h=s(e.value);if(h){l.value=h;return}l.value=null,a.value=!0;try{await go({url:e.value,token:r.value==="token"?t.value:void 0,password:r.value==="password"?t.value:void 0,autoReconnect:!0}),Oc({url:e.value,authMode:r.value,rememberMe:o.value,credential:t.value}),await fs(),await kp(),await nu(),Xa("main"),await tu("main"),au(),ou()}catch(f){M.auth.error("Connect failed:",f)}finally{a.value=!1}},u=h=>{h.key==="Enter"&&(h.preventDefault(),c())};if(!e.value){const h=Nc();if(h){e.value=h.url,r.value=h.authMode,o.value=h.rememberMe;const f=Kf();f&&(t.value=f)}}const d=[{value:"token",label:i("auth.authMode.token")},{value:"password",label:i("auth.authMode.password")}];return n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-8",children:n("div",{class:"w-full max-w-sm mx-auto min-h-full flex flex-col justify-center py-4 sm:py-0",children:[n("div",{class:"text-center mb-4 sm:mb-8",children:[n(Ss,{size:"lg",class:"mx-auto mb-2 sm:mb-3 sm:w-16 sm:h-16"}),n("h1",{class:"text-xl sm:text-2xl font-bold",children:i("app.name")}),n("p",{class:"text-sm sm:text-base text-[var(--color-text-muted)] mt-1",children:i("app.tagline")})]}),n(V,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:i("auth.title")}),n("div",{class:"space-y-3 sm:space-y-4",children:[n(Ee,{label:i("auth.gatewayUrl"),htmlFor:"gateway-url",error:l.value||void 0,children:n(te,{id:"gateway-url",type:"url",value:e.value,onInput:h=>{e.value=h.target.value,l.value=null},onKeyDown:u,placeholder:i("auth.gatewayUrlPlaceholder"),error:l.value||void 0,autoCorrect:"off",autoCapitalize:"off",spellcheck:!1,fullWidth:!0})}),n(Ee,{label:"Auth Mode",children:n(Me,{value:r.value,onChange:h=>r.value=h,options:d,"aria-label":"Auth Mode",class:"w-full"})}),n(Ee,{label:r.value==="token"?i("auth.token"):i("auth.password"),htmlFor:"auth-credential",children:n(Tu,{id:"auth-credential",value:t.value,onInput:h=>t.value=h.target.value,onKeyDown:u,placeholder:r.value==="token"?i("auth.tokenPlaceholder"):i("auth.passwordPlaceholder"),fullWidth:!0})}),n(Ke,{checked:o.value,onChange:h=>o.value=h,label:i("auth.rememberMe"),size:"sm"}),n(L,{variant:"primary",onClick:c,disabled:a.value||!e.value.trim(),loading:a.value,fullWidth:!0,children:a.value?i("auth.connecting"):i("actions.connect")}),vn.value&&n("p",{class:"text-sm text-[var(--color-error)] text-center",children:vn.value})]})]})]})})}class ut extends Xe{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){const{viewName:a}=this.props;M.ui.error(`ViewErrorBoundary caught error in ${a||"unknown view"}:`,t),M.ui.error("Component stack:",r.componentStack)}handleRetry=()=>{this.setState({hasError:!1,error:null}),this.props.onRetry?.()};render(){if(this.state.hasError){const{viewName:t}=this.props,{error:r}=this.state;return n("div",{class:"flex-1 flex flex-col items-center justify-center p-8",role:"alert",children:n("div",{class:"max-w-md w-full text-center space-y-4",children:[n(tr,{class:"w-12 h-12 mx-auto text-[var(--color-warning)]","aria-hidden":"true"}),n("h2",{class:"text-lg font-semibold text-[var(--color-text-primary)]",children:t?i("errors.viewFailed",{view:t}):i("errors.generic")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:r?.message||i("errors.unknown")}),n(L,{onClick:this.handleRetry,variant:"secondary",class:"inline-flex items-center gap-2",children:[n(He,{class:"w-4 h-4","aria-hidden":"true"}),i("actions.retry")]})]})})}return this.props.children}}const Fn=v(null),kr=v([]),Uk=v(null),hr=v(null),Gh=v(!1);async function Hk(){if($.value){Gh.value=!0;try{try{const e=await H("cron.status");Fn.value={enabled:e.enabled??!1,jobCount:e.jobs??0,nextWakeMs:e.nextWakeAtMs??null}}catch{Fn.value=null}try{const e=await H("channels.status"),t=[],r=e.channelOrder??[];for(const a of r){const o=e.channelAccounts?.[a]??[];for(const l of o)t.push({id:l.accountId,type:a,connected:l.connected??l.running??!1})}kr.value=t}catch{kr.value=[]}try{const t=(await H("skills.status")).skills??[];hr.value={total:t.length,eligible:t.filter(r=>r.eligible).length}}catch{hr.value=null}Uk.value=null}finally{Gh.value=!1}}}const jk=B(()=>{const e=Uc.value;if(e==null)return null;const t=Math.floor(e/1e3),r=Math.floor(t/60),a=Math.floor(r/60),o=Math.floor(a/24);return o>0?`${o}d ${a%24}h`:a>0?`${a}h ${r%60}m`:r>0?`${r}m ${t%60}s`:`${t}s`}),Bk=B(()=>window.location.protocol==="https:"||window.location.hostname==="localhost"),Wk=B(()=>zt.value?.startsWith("wss://")??!1),Kh=B(()=>kr.value.filter(e=>e.connected).length),qk=B(()=>{const e=Fn.value?.nextWakeMs;if(!e)return null;const t=Date.now(),r=e-t;return r<0?"now":r<6e4?`${Math.floor(r/1e3)}s`:r<36e5?`${Math.floor(r/6e4)}m`:r<864e5?`${Math.floor(r/36e5)}h`:`${Math.floor(r/864e5)}d`});function ir({icon:e,label:t,value:r,subtext:a,href:o}){const l=n(Y,{children:[n("div",{class:"p-1.5 sm:p-2 rounded-lg bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)]",children:n(e,{class:"w-4 h-4 sm:w-5 sm:h-5"})}),n("div",{class:"min-w-0 flex-1",children:[n("div",{class:"text-base sm:text-lg font-semibold truncate",children:r}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:t}),a&&n("div",{class:"text-xs text-[var(--color-text-muted)] truncate",children:a})]})]});return o?n("a",{href:o,class:"flex items-center gap-2 sm:gap-3 p-3 sm:p-4 rounded-lg bg-[var(--color-bg-secondary)] hover:bg-[var(--color-bg-tertiary)] transition-colors no-underline",children:l}):n("div",{class:"flex items-center gap-2 sm:gap-3 p-3 sm:p-4 rounded-lg bg-[var(--color-bg-secondary)]",children:l})}function Vh({value:e,label:t}){const[r,a]=j(!1);return n("div",{class:"py-2",children:[n("div",{class:"flex items-center justify-between mb-1",children:[n("span",{class:"text-[var(--color-text-muted)] text-sm",children:t}),n("button",{onClick:async()=>{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),2e3)},class:"p-1 text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] transition-colors flex-shrink-0","aria-label":`Copy ${t}`,children:r?n(on,{class:"w-4 h-4 text-[var(--color-success)]"}):n(xs,{class:"w-4 h-4"})})]}),n("code",{class:"block text-xs sm:text-sm bg-[var(--color-bg-secondary)] px-2 py-1 rounded truncate w-full",children:e})]})}function Zo({label:e,value:t}){return t?n("div",{class:"flex flex-col sm:flex-row sm:items-center sm:justify-between py-2 gap-0.5 sm:gap-2",children:[n("span",{class:"text-[var(--color-text-muted)] text-sm",children:e}),n("span",{class:"font-medium text-sm sm:text-base",children:t})]}):null}function Gk(e){const t=$.value,r=Ce.value;return z(()=>{t&&Hk()},[t]),n(ut,{viewName:i("nav.overview"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[!Bk.value&&n("div",{class:"flex items-start gap-3 p-4 rounded-lg bg-[var(--color-warning)]/10 border border-[var(--color-warning)]/20",children:[n(tr,{class:"w-5 h-5 text-[var(--color-warning)] flex-shrink-0 mt-0.5"}),n("div",{children:[n("div",{class:"font-medium text-[var(--color-warning)]",children:"Insecure Context"}),n("p",{class:"text-sm text-[var(--color-text-secondary)] mt-1",children:"This page is not served over HTTPS. Some features may be limited."})]})]}),t&&zt.value&&!Wk.value&&n("div",{class:"flex items-start gap-3 p-4 rounded-lg bg-[var(--color-warning)]/10 border border-[var(--color-warning)]/20",children:[n(ks,{class:"w-5 h-5 text-[var(--color-warning)] flex-shrink-0 mt-0.5"}),n("div",{children:[n("div",{class:"font-medium text-[var(--color-warning)]",children:"Insecure WebSocket"}),n("p",{class:"text-sm text-[var(--color-text-secondary)] mt-1",children:["Connected via"," ",n("code",{class:"bg-[var(--color-bg-secondary)] px-1 rounded",children:"ws://"})," instead of"," ",n("code",{class:"bg-[var(--color-bg-secondary)] px-1 rounded",children:"wss://"}),". Traffic is not encrypted."]})]})]}),n(V,{padding:"md",children:[n("div",{class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[n("div",{class:"flex items-center gap-3",children:[t?n("div",{class:"p-2 rounded-lg bg-[var(--color-success)]/10",children:n(Ul,{class:"w-5 h-5 sm:w-6 sm:h-6 text-[var(--color-success)]"})}):n("div",{class:"p-2 rounded-lg bg-[var(--color-error)]/10",children:n(Fp,{class:"w-5 h-5 sm:w-6 sm:h-6 text-[var(--color-error)]"})}),n("div",{children:[n("h2",{class:"text-base sm:text-lg font-semibold",children:"Gateway Connection"}),n(X,{variant:t?"success":r==="connecting"?"warning":"error",dot:!0,size:"sm",children:i(r==="connected"?"status.connected":r==="connecting"||r==="authenticating"?"status.connecting":r==="reconnecting"?"status.reconnecting":"status.disconnected")})]})]}),t&&n(L,{variant:"secondary",size:"sm",onClick:()=>Ir(),children:"Disconnect"})]}),t&&zt.value&&n("div",{class:"border-t border-[var(--color-border)] pt-4 mt-4 space-y-1",children:[n(Vh,{label:"URL",value:zt.value}),xa.connectionId.value&&n(Vh,{label:"Connection ID",value:xa.connectionId.value})]})]}),t&&n("div",{class:"grid grid-cols-2 md:grid-cols-3 gap-2 sm:gap-4",children:[n(ir,{icon:me,label:"Uptime",value:jk.value??"—",subtext:kn.value?`Since ${ge(kn.value)}`:void 0,href:"/stats"}),n(ir,{icon:_s,label:"Instances",value:po.value.length,subtext:"Connected clients",href:"/instances"}),n(ir,{icon:an,label:"Sessions",value:yt.value.length,subtext:"Active sessions",href:"/sessions"}),n(ir,{icon:ln,label:"Cron",value:Fn.value?.enabled?"Enabled":"Disabled",subtext:Fn.value?.nextWakeMs?`Next wake: ${qk.value}`:Fn.value?.jobCount?`${Fn.value.jobCount} jobs`:void 0,href:"/cron"}),n(ir,{icon:zl,label:"Channels",value:kr.value.length>0?Kh.value:"—",subtext:kr.value.length>0?`${Kh.value}/${kr.value.length} connected`:"No channels configured",href:"/channels"}),n(ir,{icon:fu,label:"Skills",value:hr.value?.eligible??"—",subtext:hr.value?`${hr.value.eligible}/${hr.value.total} active`:void 0,href:"/skills"})]}),t&&n(V,{title:i("overview.serverInfo"),padding:"md",children:n("div",{class:"divide-y divide-[var(--color-border)]",children:[n(Zo,{label:i("overview.version"),value:st.value}),n(Zo,{label:i("overview.commit"),value:fo.value?.substring(0,8)}),n(Zo,{label:i("overview.host"),value:Yr.value}),n(Zo,{label:i("overview.capabilities"),value:xa.capabilities.value.length>0?i("overview.capabilitiesCount",{count:xa.capabilities.value.length}):null})]})})]})})})}function fe({icon:e,label:t,value:r,active:a,highlight:o,onClick:l,class:s}){const c=!!l,u=n(Y,{children:[n("div",{class:`p-1.5 sm:p-2 rounded-lg ${a?"bg-[var(--color-accent)]/20":"bg-[var(--color-bg-tertiary)]"}`,children:n(e,{class:`w-4 h-4 sm:w-5 sm:h-5 ${a?"text-[var(--color-accent)]":"text-[var(--color-text-muted)]"}`})}),n("div",{class:"min-w-0",children:[n("div",{class:`text-lg sm:text-2xl font-bold ${o?"text-[var(--color-error)]":""}`,children:r}),n("div",{class:"text-[10px] sm:text-sm text-[var(--color-text-muted)] truncate",children:t})]})]}),d=`
380
+ flex items-center gap-1.5 sm:gap-3 p-2 sm:p-4 rounded-xl text-left transition-all
381
+ ${a?"bg-[var(--color-accent)]/10 border-2 border-[var(--color-accent)]":"bg-[var(--color-bg-secondary)] border-2 border-transparent"}
382
+ ${c?"hover:bg-[var(--color-bg-tertiary)] cursor-pointer":""}
383
+ ${s||""}
384
+ `;return c?n("button",{type:"button",onClick:l,class:d,children:u}):n("div",{class:d,children:u})}function kt({title:e,subtitle:t,actions:r,class:a}){const o=typeof t=="string"?n("p",{class:"text-sm text-[var(--color-text-muted)] mt-1",children:t}):t;return n("div",{class:`flex items-start justify-between gap-4 ${a??""}`,children:[n("div",{class:"flex-1 min-w-0",children:[n("h1",{class:"text-xl font-semibold text-[var(--color-text-primary)]",children:e}),o]}),r&&n("div",{class:"flex items-center gap-2 flex-shrink-0",children:r})]})}const Kk={default:"bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)]",success:"bg-[var(--color-success)]/10 text-[var(--color-success)]",warning:"bg-[var(--color-warning)]/10 text-[var(--color-warning)]",error:"bg-[var(--color-error)]/10 text-[var(--color-error)]",info:"bg-[var(--color-info)]/10 text-[var(--color-info)]"};function So({icon:e,iconVariant:t="default",title:r,subtitle:a,badges:o,meta:l,actions:s,onClick:c}){const u=n("div",{class:"flex items-start gap-3",children:[n("div",{class:`p-1.5 rounded-lg flex-shrink-0 ${Kk[t]}`,children:n(e,{class:"w-4 h-4"})}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2 mb-0.5",children:[n("span",{class:"font-medium truncate",children:r}),o]}),a&&n("div",{class:"text-xs text-[var(--color-text-muted)] font-mono truncate mb-2",children:a}),l&&l.length>0&&n("div",{class:"flex items-center gap-3 text-xs text-[var(--color-text-muted)]",children:l.map((d,h)=>n("span",{class:"flex items-center gap-1",title:d.title,children:[d.icon&&n(d.icon,{class:"w-3 h-3"}),d.value]},`${h}-${d.value}`))})]}),s&&n("div",{class:"flex-shrink-0",children:s})]});return c?n("button",{type:"button","aria-label":r,class:"w-full p-3 rounded-lg bg-[var(--color-bg-secondary)] hover:bg-[var(--color-bg-hover)] cursor-pointer transition-colors text-left",onClick:c,children:u}):n("div",{class:"p-3 rounded-lg bg-[var(--color-bg-secondary)]",children:u})}function Vk(e){const t=new Date(e),r=a=>String(a).padStart(2,"0");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}T${r(t.getHours())}:${r(t.getMinutes())}`}function Yk(e){return new Date(e).getTime()}function Vl(e){switch(e.kind){case"cron":return e.expr+(e.tz?` (${e.tz})`:"");case"every":{const t=e.everyMs;return t>=864e5?`Every ${Math.round(t/864e5)}d`:t>=36e5?`Every ${Math.round(t/36e5)}h`:t>=6e4?`Every ${Math.round(t/6e4)}m`:`Every ${Math.round(t/1e3)}s`}case"at":return`Once at ${ge(e.atMs)}`}}function Au(e){return e.enabled?e.state.runningAtMs?i("cron.running"):e.state.nextRunAtMs?ge(e.state.nextRunAtMs,{relative:!0}):"—":"—"}function Jk(e){return e.state.lastRunAtMs?ge(e.state.lastRunAtMs,{relative:!0}):"—"}function Mu(e){return e.enabled?e.state.runningAtMs?{variant:"warning",label:i("cron.running")}:e.state.lastStatus==="error"?{variant:"error",label:i("cron.lastFailed")}:e.state.lastStatus==="ok"?{variant:"success",label:i("cron.lastOk")}:{variant:"default",label:i("cron.pending")}:{variant:"default",label:i("cron.disabled")}}function Xk(e){const t=e.trim().split(/\s+/);if(t.length<5||t.length>6)return!1;const r=/^(\*|(\d+(-\d+)?(,\d+(-\d+)?)*)(\/\d+)?|\*\/\d+)$/;return t.every(a=>r.test(a))}const Zk=[{ms:6e4,label:"1m"},{ms:3e5,label:"5m"},{ms:6e5,label:"10m"},{ms:18e5,label:"30m"},{ms:36e5,label:"1h"},{ms:216e5,label:"6h"},{ms:864e5,label:"24h"}],Qk=[{expr:"*/5 * * * *",label:"Every 5 min"},{expr:"0 * * * *",label:"Hourly"},{expr:"0 8 * * *",label:"8am daily"},{expr:"0 9 * * 1-5",label:"9am weekdays"},{expr:"0 0 * * *",label:"Midnight"},{expr:"0 0 * * 0",label:"Weekly (Sun)"}];function e4({job:e,onRun:t,onToggleEnabled:r,isRunning:a}){return n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[n(Q,{icon:n(cu,{class:"w-4 h-4"}),label:i("cron.runNow"),size:"sm",variant:"ghost",disabled:a,onClick:o=>{o.stopPropagation(),t(e)}}),n(Q,{icon:e.enabled?n(xo,{class:"w-4 h-4"}):n(bo,{class:"w-4 h-4"}),label:e.enabled?i("cron.disable"):i("cron.enable"),size:"sm",variant:"ghost",onClick:o=>{o.stopPropagation(),r(e)},class:e.enabled?"text-[var(--color-text-muted)]":"text-[var(--color-success)]"})]})}function t4({job:e,onEdit:t}){const r=Mu(e);return n(So,{icon:me,iconVariant:e.enabled?r.variant==="error"?"error":"success":"default",title:e.name,badges:n(X,{variant:r.variant,size:"sm",children:r.label}),meta:[{icon:mo,value:Vl(e.schedule)},{icon:Op,value:Au(e)}],onClick:()=>t(e)})}function n4({job:e,onEdit:t,onRun:r,onToggleEnabled:a,isRunning:o}){const l=Mu(e);return n("tr",{role:"button",class:"group hover:bg-[var(--color-bg-hover)] cursor-pointer transition-colors",onClick:()=>t(e),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),t(e))},tabIndex:0,"aria-label":i("cron.editJob",{name:e.name}),children:[n("td",{class:"py-3 px-4",children:n("div",{class:"flex items-center gap-3",children:[n("div",{class:`p-1.5 rounded-lg flex-shrink-0 ${e.enabled?"bg-[var(--color-success)]/10":"bg-[var(--color-bg-tertiary)]"}`,children:n(me,{class:`w-4 h-4 ${e.enabled?"text-[var(--color-success)]":"text-[var(--color-text-muted)]"}`})}),n("div",{class:"min-w-0 flex-1",children:[n("div",{class:"font-medium truncate",title:e.name,children:e.name}),e.description&&n("div",{class:"text-xs text-[var(--color-text-muted)] truncate",title:e.description,children:e.description})]})]})}),n("td",{class:"py-3 px-4",children:n("div",{class:"flex items-center gap-1.5 text-sm text-[var(--color-text-muted)]",children:[n(mo,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{class:"truncate",title:Vl(e.schedule),children:Vl(e.schedule)})]})}),n("td",{class:"py-3 px-4",children:n(X,{variant:e.sessionTarget==="main"?"success":"default",size:"sm",children:e.sessionTarget})}),n("td",{class:"py-3 px-4 whitespace-nowrap",children:n("div",{class:"flex items-center gap-1.5 text-sm text-[var(--color-text-muted)]",children:[n(Op,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:Au(e)})]})}),n("td",{class:"py-3 px-4",children:n(X,{variant:l.variant,size:"sm",children:l.label})}),n("td",{class:"py-3 px-4",children:n(e4,{job:e,onRun:r,onToggleEnabled:a,isRunning:o})})]})}function eo({class:e="",fullWidth:t=!1,rows:r=3,error:a=!1,...o}){return n("textarea",{rows:r,class:`
385
+ px-3 py-2 text-sm rounded-lg resize-y
386
+ bg-[var(--color-bg-primary)]
387
+ text-[var(--color-text-primary)]
388
+ placeholder:text-[var(--color-text-muted)]
389
+ border transition-colors
390
+ focus:outline-none focus:ring-2 focus:ring-[var(--color-accent)]/30 focus:border-[var(--color-accent)]
391
+ disabled:opacity-50 disabled:cursor-not-allowed
392
+ ${a?"border-[var(--color-error)] focus:border-[var(--color-error)] focus:ring-[var(--color-error)]/30":"border-[var(--color-border)] hover:border-[var(--color-border-hover)]"}
393
+ ${t?"w-full":""}
394
+ ${e}
395
+ `,...o})}function r4({label:e,selected:t,onClick:r,title:a,size:o="md"}){return n("button",{type:"button",onClick:r,title:a,class:`
396
+ ${o==="sm"?"px-2.5 py-1 text-xs":"px-3 py-1.5 text-sm"} rounded-lg border transition-colors
397
+ ${t?"bg-[var(--color-accent)]/10 border-[var(--color-accent)] text-[var(--color-accent)]":"border-[var(--color-border)] hover:border-[var(--color-border-hover)] text-[var(--color-text-muted)]"}
398
+ `,children:e})}function Yh({options:e,value:t,onChange:r,size:a="md"}){return n("div",{class:"flex flex-wrap gap-2",children:e.map(o=>n(r4,{label:o.label,selected:t===o.value,onClick:()=>r(o.value),title:String(o.value),size:a},o.value))})}const a4=[{value:"cron",label:i("cron.scheduleKind.cron")},{value:"every",label:i("cron.scheduleKind.every")},{value:"at",label:i("cron.scheduleKind.at")}],o4=[{value:"main",label:i("cron.sessionTarget.main")},{value:"isolated",label:i("cron.sessionTarget.isolated")}],l4=[{value:"next-heartbeat",label:i("cron.wakeMode.nextHeartbeat")},{value:"now",label:i("cron.wakeMode.now")}];function s4({editName:e,editDescription:t,editScheduleKind:r,editScheduleExpr:a,editScheduleTz:o,editScheduleEveryMs:l,editScheduleAtMs:s,editSessionTarget:c,editWakeMode:u,editPayloadText:d,editPayloadMessage:h,editPayloadModel:f,formErrors:g}){const m=g.value;return n("div",{class:"space-y-4 sm:space-y-5",children:[n(Ee,{label:i("cron.form.name"),error:m.name,children:n(te,{value:e.value,onInput:y=>e.value=y.target.value,placeholder:i("cron.form.namePlaceholder"),error:!!m.name,fullWidth:!0})}),n(Ee,{label:i("cron.form.description"),hint:i("cron.form.descriptionHint"),children:n(te,{value:t.value,onInput:y=>t.value=y.target.value,placeholder:i("cron.form.descriptionPlaceholder"),fullWidth:!0})}),n(Ee,{label:i("cron.form.schedule"),error:m.schedule,children:n("div",{class:"space-y-3",children:[n(Me,{value:r.value,onChange:y=>r.value=y,options:a4}),r.value==="cron"&&n("div",{class:"space-y-3",children:[n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[n(te,{value:a.value,onInput:y=>a.value=y.target.value,placeholder:i("cron.form.cronPlaceholder"),fullWidth:!0}),n(te,{value:o.value,onInput:y=>o.value=y.target.value,placeholder:i("cron.form.timezonePlaceholder"),fullWidth:!0})]}),n(Yh,{options:Qk.map(({expr:y,label:C})=>({value:y,label:C})),value:a.value,onChange:y=>a.value=y,size:"sm"})]}),r.value==="every"&&n("div",{class:"space-y-2",children:[n(Yh,{options:Zk.map(({ms:y,label:C})=>({value:String(y),label:C})),value:l.value,onChange:y=>l.value=y}),n(te,{type:"number",value:l.value,onInput:y=>l.value=y.target.value,placeholder:i("cron.form.intervalPlaceholder"),fullWidth:!0})]}),r.value==="at"&&n(te,{type:"datetime-local",value:Vk(Number(s.value)||Date.now()),onInput:y=>{const C=y.target.value;s.value=String(Yk(C))},fullWidth:!0})]})}),n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",children:[n(Ee,{label:i("cron.form.sessionTarget"),hint:i("cron.form.sessionTargetHint"),children:n(Me,{value:c.value,onChange:y=>{c.value=y},options:o4})}),n(Ee,{label:i("cron.form.wakeMode"),hint:i("cron.form.wakeModeHint"),children:n(Me,{value:u.value,onChange:y=>u.value=y,options:l4})})]}),n(Ee,{label:i("cron.form.payload"),error:m.payload,hint:c.value==="main"?i("cron.form.payloadHintMain"):i("cron.form.payloadHintIsolated"),children:c.value==="main"?n(eo,{value:d.value,onInput:y=>d.value=y.target.value,placeholder:i("cron.form.systemEventPlaceholder"),error:!!m.payload,rows:3,fullWidth:!0}):n("div",{class:"space-y-3",children:[n(eo,{value:h.value,onInput:y=>h.value=y.target.value,placeholder:i("cron.form.agentMessagePlaceholder"),error:!!m.payload,rows:3,fullWidth:!0}),n(te,{value:f.value,onInput:y=>f.value=y.target.value,placeholder:i("cron.form.modelPlaceholder"),fullWidth:!0})]})})]})}function ci({value:e,label:t}){return n("div",{class:"text-center p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n("div",{class:"text-xl font-bold",children:e}),n("div",{class:"text-sm text-[var(--color-text-muted)]",children:t})]})}function i4({mode:e,job:t,runs:r,isLoadingRuns:a,isDeleting:o,isSaving:l,isRunning:s,hasChanges:c,onClose:u,onSave:d,onDelete:h,onRun:f,onSetDeleting:g,editName:m,editDescription:y,editEnabled:C,editScheduleKind:T,editScheduleExpr:_,editScheduleTz:p,editScheduleEveryMs:b,editScheduleAtMs:k,editSessionTarget:E,editWakeMode:w,editPayloadText:A,editPayloadMessage:D,editPayloadModel:S,formErrors:F}){if(!e)return null;const N=e==="edit",re=t?Mu(t):null;return n(Qe,{open:!!e,onClose:u,title:N&&t?t.name:i("cron.createJob"),size:"xl",footer:o?n(wg,{message:i("cron.confirmDelete"),onCancel:()=>g(!1),onDelete:h}):n(kg,{isEdit:N&&!!t,onDeleteClick:()=>g(!0),onCancel:u,onSave:d,isSaving:l,saveDisabled:!c,saveLabel:i(N?"actions.save":"actions.create"),extraContent:n("div",{class:"flex items-center justify-between sm:justify-start gap-2",children:[n("span",{class:"text-sm text-[var(--color-text-secondary)]",children:C.value?i("cron.enabled"):i("cron.disabled")}),n(Ke,{checked:C.value,onChange:de=>C.value=de})]})}),children:n("div",{class:"space-y-4 sm:space-y-6",children:[N&&t&&re&&n(Y,{children:[n("div",{class:"flex flex-col sm:flex-row sm:items-center gap-3 p-3 sm:p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n("div",{class:"flex items-center gap-3 flex-1 min-w-0",children:[n("div",{class:`p-2 sm:p-3 rounded-xl flex-shrink-0 ${t.enabled?"bg-[var(--color-success)]/10":"bg-[var(--color-bg-tertiary)]"}`,children:n(me,{class:`w-5 h-5 sm:w-6 sm:h-6 ${t.enabled?"text-[var(--color-success)]":"text-[var(--color-text-muted)]"}`})}),n("div",{class:"min-w-0",children:[n("div",{class:"flex flex-wrap items-center gap-1.5 mb-1",children:[n(X,{variant:re.variant,size:"sm",children:re.label}),n(X,{variant:t.sessionTarget==="main"?"success":"default",size:"sm",children:t.sessionTarget})]}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] truncate",children:Vl(t.schedule)})]})]}),n(L,{size:"sm",variant:"secondary",icon:n(cu,{class:"w-4 h-4"}),onClick:()=>f(t),disabled:s,fullWidth:!0,class:"sm:w-auto",children:i("cron.runNow")})]}),n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(ci,{value:Au(t),label:i("cron.nextRun")}),n(ci,{value:Jk(t),label:i("cron.lastRun")}),n(ci,{value:t.state.lastDurationMs?`${Math.round(t.state.lastDurationMs/1e3)}s`:"—",label:i("cron.lastDuration")})]})]}),n(s4,{editName:m,editDescription:y,editScheduleKind:T,editScheduleExpr:_,editScheduleTz:p,editScheduleEveryMs:b,editScheduleAtMs:k,editSessionTarget:E,editWakeMode:w,editPayloadText:A,editPayloadMessage:D,editPayloadModel:S,formErrors:F}),N&&n("div",{children:[n("h4",{class:"text-sm font-medium mb-3",children:i("cron.recentRuns")}),a?n("div",{class:"flex justify-center py-4",children:n(ue,{size:"sm"})}):r.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] text-center py-4",children:i("cron.noRuns")}):n("div",{class:"space-y-2 max-h-48 overflow-y-auto",children:r.map(de=>n("div",{class:"flex items-center gap-3 p-2 rounded-lg bg-[var(--color-bg-secondary)] text-sm",children:[de.status==="ok"?n(bo,{class:"w-4 h-4 text-[var(--color-success)]"}):de.status==="error"?n(xo,{class:"w-4 h-4 text-[var(--color-error)]"}):n(me,{class:"w-4 h-4 text-[var(--color-warning)]"}),n("span",{class:"flex-1",children:ge(de.runAtMs)}),de.durationMs&&n("span",{class:"text-[var(--color-text-muted)]",children:[Math.round(de.durationMs/1e3),"s"]}),de.error&&n("span",{class:"text-[var(--color-error)] truncate max-w-[200px]",title:de.error,children:de.error})]},de.runAtMs))})]})]})})}const _n=v([]),_g=v(null),tc=v(!1),Jn=v(null),Sg=v(""),nc=v("all"),Ts=v(null),Sn=v(null),to=v([]),rc=v(!1),Cg=v(!1),ac=v(!1),oc=v(!1),Xn=v(""),Lr=v(""),Nr=v(!0),mt=v("cron"),Zn=v(""),Or=v(""),Fr=v(""),Pr=v(""),zr=v("next-heartbeat"),Pt=v("main"),Ur=v(""),Hr=v(""),jr=v(""),As=v({}),c4=B(()=>{let e=_n.value;nc.value==="enabled"?e=e.filter(r=>r.enabled):nc.value==="disabled"&&(e=e.filter(r=>!r.enabled));const t=Sg.value.toLowerCase().trim();return t&&(e=e.filter(r=>{const a=r.name.toLowerCase(),o=(r.description||"").toLowerCase();return a.includes(t)||o.includes(t)})),[...e].sort((r,a)=>{if(r.enabled!==a.enabled)return r.enabled?-1:1;const o=r.state.nextRunAtMs??1/0,l=a.state.nextRunAtMs??1/0;return o-l})}),u4=B(()=>{const e={total:0,enabled:0,disabled:0};for(const t of _n.value)e.total++,t.enabled?e.enabled++:e.disabled++;return e});async function Yl(){tc.value=!0,Jn.value=null;const[e,t]=await Promise.allSettled([H("cron.status",{}),H("cron.list",{includeDisabled:!0})]);e.status==="fulfilled"&&(_g.value=e.value),t.status==="fulfilled"&&(_n.value=t.value.jobs??[]);const r=[];e.status==="rejected"&&r.push(`Status: ${le(e.reason)}`),t.status==="rejected"&&r.push(`Jobs: ${le(t.reason)}`),r.length>0&&(Jn.value=r.join("; ")),tc.value=!1}async function d4(e){rc.value=!0;try{const t=await H("cron.runs",{jobId:e,limit:20});to.value=t.entries??[]}catch{to.value=[]}finally{rc.value=!1}}function h4(e){Xn.value=e.name,Lr.value=e.description??"",Nr.value=e.enabled,mt.value=e.schedule.kind,e.schedule.kind==="cron"?(Zn.value=e.schedule.expr,Or.value=e.schedule.tz??""):e.schedule.kind==="every"?Fr.value=String(e.schedule.everyMs):e.schedule.kind==="at"&&(Pr.value=String(e.schedule.atMs)),zr.value=e.wakeMode,Pt.value=e.sessionTarget,e.payload.kind==="systemEvent"?Ur.value=e.payload.text:(Hr.value=e.payload.message,jr.value=e.payload.model??""),As.value={}}function f4(){Xn.value="",Lr.value="",Nr.value=!0,mt.value="cron",Zn.value="",Or.value="",Fr.value="",Pr.value="",zr.value="next-heartbeat",Pt.value="main",Ur.value="",Hr.value="",jr.value="",As.value={}}function p4(e,t){e==="edit"&&t?(Sn.value=t,h4(t),d4(t.id)):(Sn.value=null,f4(),to.value=[]),Ts.value=e}function Iu(){Ts.value=null,Sn.value=null,to.value=[],Cg.value=!1}function g4(){const e={};if(Xn.value.trim()||(e.name=i("cron.validation.nameRequired")),mt.value==="cron")Zn.value.trim()?Xk(Zn.value)||(e.schedule=i("cron.validation.cronInvalid")):e.schedule=i("cron.validation.cronRequired");else if(mt.value==="every"){const t=parseInt(Fr.value,10);(!t||t<1e3)&&(e.schedule=i("cron.validation.intervalMin"))}else if(mt.value==="at"){const t=parseInt(Pr.value,10);(!t||t<Date.now())&&(e.schedule=i("cron.validation.atFuture"))}return Pt.value==="main"?Ur.value.trim()||(e.payload=i("cron.validation.payloadRequired")):Hr.value.trim()||(e.payload=i("cron.validation.payloadRequired")),As.value=e,Object.keys(e).length===0}function Jh(){switch(mt.value){case"cron":return{kind:"cron",expr:Zn.value,...Or.value?{tz:Or.value}:{}};case"every":return{kind:"every",everyMs:parseInt(Fr.value,10)||6e4};case"at":return{kind:"at",atMs:parseInt(Pr.value,10)||Date.now()}}}function Xh(){return Pt.value==="main"?{kind:"systemEvent",text:Ur.value}:{kind:"agentTurn",message:Hr.value,...jr.value?{model:jr.value}:{}}}async function v4(){if(g4()){ac.value=!0;try{if(Ts.value==="edit"&&Sn.value){const e={name:Xn.value,description:Lr.value||void 0,enabled:Nr.value,schedule:Jh(),sessionTarget:Pt.value,wakeMode:zr.value,payload:Xh()};await H("cron.update",{jobId:Sn.value.id,patch:e})}else{const e={name:Xn.value,description:Lr.value||void 0,enabled:Nr.value,schedule:Jh(),sessionTarget:Pt.value,wakeMode:zr.value,payload:Xh()};await H("cron.add",{job:e})}await Yl(),Iu()}catch(e){Jn.value=le(e)}finally{ac.value=!1}}}async function m4(){const e=Sn.value;if(e)try{await H("cron.remove",{jobId:e.id}),_n.value=_n.value.filter(t=>t.id!==e.id),Iu()}catch(t){Jn.value=le(t)}}async function b4(e){oc.value=!0;try{await H("cron.run",{jobId:e.id,mode:"force"}),await Yl()}catch(t){Jn.value=le(t)}finally{oc.value=!1}}async function x4(e){try{await H("cron.update",{jobId:e.id,patch:{enabled:!e.enabled}}),_n.value=_n.value.map(t=>t.id===e.id?{...t,enabled:!t.enabled}:t)}catch(t){Jn.value=le(t)}}function y4(){z(()=>{$.value&&Yl()},[$.value]);const e=is(()=>{const t=Sn.value;if(!t||Xn.value!==t.name||Lr.value!==(t.description??"")||Nr.value!==t.enabled||mt.value!==t.schedule.kind||zr.value!==t.wakeMode||Pt.value!==t.sessionTarget)return!0;if(t.schedule.kind==="cron"&&mt.value==="cron"){if(Zn.value!==t.schedule.expr||Or.value!==(t.schedule.tz??""))return!0}else if(t.schedule.kind==="every"&&mt.value==="every"){if(Fr.value!==String(t.schedule.everyMs))return!0}else if(t.schedule.kind==="at"&&mt.value==="at"&&Pr.value!==String(t.schedule.atMs))return!0;if(t.payload.kind==="systemEvent"&&Pt.value==="main"){if(Ur.value!==t.payload.text)return!0}else if(t.payload.kind==="agentTurn"&&Pt.value==="isolated"&&(Hr.value!==t.payload.message||jr.value!==(t.payload.model??"")))return!0;return!1});return{state:{cronJobs:_n,cronStatus:_g,isLoading:tc,error:Jn,searchQuery:Sg,statusFilter:nc},modal:{modalMode:Ts,selectedJob:Sn,selectedJobRuns:to,isLoadingRuns:rc,isDeleting:Cg,isSaving:ac,isRunning:oc},form:{editName:Xn,editDescription:Lr,editEnabled:Nr,editScheduleKind:mt,editScheduleExpr:Zn,editScheduleTz:Or,editScheduleEveryMs:Fr,editScheduleAtMs:Pr,editWakeMode:zr,editSessionTarget:Pt,editPayloadText:Ur,editPayloadMessage:Hr,editPayloadModel:jr,formErrors:As},computed:{filteredJobs:c4,jobCounts:u4,hasFormChanges:e},actions:{loadCronJobs:Yl,openJobModal:p4,closeModal:Iu,saveOrCreateJob:v4,deleteJob:m4,runJobNow:b4,toggleJobEnabled:x4}}}function w4(e){const{state:t,modal:r,form:a,computed:o,actions:l}=y4(),s=o.jobCounts.value;return n(ut,{viewName:i("nav.cron"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:[n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[n(kt,{title:i("cron.title"),subtitle:i("cron.description"),actions:n(Y,{children:[$.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&n("div",{class:"relative hidden sm:block",children:[n(Pe,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(te,{type:"text",value:t.searchQuery.value,onInput:c=>t.searchQuery.value=c.target.value,placeholder:i("cron.searchPlaceholder"),"aria-label":i("cron.searchPlaceholder"),class:"pl-10 w-64"})]}),n(L,{icon:n(Rr,{class:"w-4 h-4"}),onClick:()=>l.openJobModal("create"),disabled:!$.value,children:[n("span",{class:"hidden sm:inline",children:i("cron.createJob")}),n("span",{class:"sm:hidden",children:i("actions.new")})]}),n(Q,{icon:n(He,{class:`w-4 h-4 ${t.isLoading.value?"animate-spin":""}`}),label:i("actions.refresh"),onClick:l.loadCronJobs,disabled:t.isLoading.value||!$.value,variant:"ghost"})]})}),$.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&n("div",{class:"relative sm:hidden",children:[n(Pe,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(te,{type:"text",value:t.searchQuery.value,onInput:c=>t.searchQuery.value=c.target.value,placeholder:i("cron.searchPlaceholder"),"aria-label":i("cron.searchPlaceholder"),class:"pl-10",fullWidth:!0})]}),$.value&&!t.isLoading.value&&n("div",{class:"grid grid-cols-2 sm:grid-cols-4 gap-2 sm:gap-4",children:[n(fe,{icon:me,label:i("cron.stats.total"),value:s.total,active:t.statusFilter.value==="all",onClick:()=>t.statusFilter.value="all"}),n(fe,{icon:bo,label:i("cron.stats.enabled"),value:s.enabled,active:t.statusFilter.value==="enabled",onClick:()=>t.statusFilter.value="enabled"}),n(fe,{icon:xo,label:i("cron.stats.disabled"),value:s.disabled,active:t.statusFilter.value==="disabled",onClick:()=>t.statusFilter.value="disabled"}),n(fe,{icon:ln,label:i("cron.stats.nextWake"),value:t.cronStatus.value?.nextWakeAtMs?ge(t.cronStatus.value.nextWakeAtMs,{relative:!0}):"—"})]}),t.error.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",role:"alert",children:t.error.value}),(t.isLoading.value||!$.value)&&n("div",{class:"flex justify-center py-16",children:n(ue,{size:"lg",label:$.value?void 0:i("status.connecting")})}),$.value&&!t.isLoading.value&&o.filteredJobs.value.length>0&&n(Y,{children:[n("div",{class:"md:hidden space-y-2",children:o.filteredJobs.value.map(c=>n(t4,{job:c,onEdit:l.openJobModal.bind(null,"edit")},c.id))}),n(V,{padding:"none",class:"hidden md:block",children:n("table",{class:"w-full",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)] text-left text-sm text-[var(--color-text-muted)]",children:[n("th",{class:"py-3 px-4 font-medium",children:i("cron.columns.job")}),n("th",{class:"py-3 px-4 font-medium w-40",children:i("cron.columns.schedule")}),n("th",{class:"py-3 px-4 font-medium w-24",children:i("cron.columns.target")}),n("th",{class:"py-3 px-4 font-medium w-32",children:i("cron.columns.nextRun")}),n("th",{class:"py-3 px-4 font-medium w-24",children:i("cron.columns.status")}),n("th",{class:"py-3 px-4 font-medium w-20"})]})}),n("tbody",{class:"divide-y divide-[var(--color-border)]",children:o.filteredJobs.value.map(c=>n(n4,{job:c,onEdit:l.openJobModal.bind(null,"edit"),onRun:l.runJobNow,onToggleEnabled:l.toggleJobEnabled,isRunning:r.isRunning.value},c.id))})]})})]}),$.value&&!t.isLoading.value&&t.cronJobs.value.length===0&&!t.error.value&&n(V,{children:n("div",{class:"p-16 text-center",children:[n(me,{class:"w-12 h-12 mx-auto mb-4 text-[var(--color-text-muted)] opacity-50"}),n("h3",{class:"text-lg font-medium mb-2",children:i("cron.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:i("cron.emptyDescription")}),n(L,{icon:n(Rr,{class:"w-4 h-4"}),onClick:()=>l.openJobModal("create"),children:i("cron.createJob")})]})}),$.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&o.filteredJobs.value.length===0&&n(V,{children:n("div",{class:"p-12 text-center",children:[n(Pe,{class:"w-10 h-10 mx-auto mb-4 text-[var(--color-text-muted)] opacity-50"}),n("h3",{class:"text-lg font-medium mb-2",children:i("cron.noResults")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:i("cron.noResultsDescription")}),n(L,{variant:"secondary",size:"sm",onClick:()=>{t.searchQuery.value="",t.statusFilter.value="all"},children:i("cron.clearFilters")})]})}),$.value&&!t.isLoading.value&&o.filteredJobs.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:o.filteredJobs.value.length===t.cronJobs.value.length?i("cron.count",{count:t.cronJobs.value.length}):i("cron.filteredCount",{filtered:o.filteredJobs.value.length,total:t.cronJobs.value.length})})]}),n(i4,{mode:r.modalMode.value,job:r.selectedJob.value,runs:r.selectedJobRuns.value,isLoadingRuns:r.isLoadingRuns.value,isDeleting:r.isDeleting.value,isSaving:r.isSaving.value,isRunning:r.isRunning.value,hasChanges:o.hasFormChanges.value,onClose:l.closeModal,onSave:l.saveOrCreateJob,onDelete:l.deleteJob,onRun:l.runJobNow,onSetDeleting:c=>r.isDeleting.value=c,editName:a.editName,editDescription:a.editDescription,editEnabled:a.editEnabled,editScheduleKind:a.editScheduleKind,editScheduleExpr:a.editScheduleExpr,editScheduleTz:a.editScheduleTz,editScheduleEveryMs:a.editScheduleEveryMs,editScheduleAtMs:a.editScheduleAtMs,editSessionTarget:a.editSessionTarget,editWakeMode:a.editWakeMode,editPayloadText:a.editPayloadText,editPayloadMessage:a.editPayloadMessage,editPayloadModel:a.editPayloadModel,formErrors:a.formErrors})]})})}const k4={info:"bg-[var(--color-bg-secondary)] text-[var(--color-text-muted)]",warning:"bg-[var(--color-warning)]/10 text-[var(--color-warning)]",error:"bg-[var(--color-error)]/10 text-[var(--color-error)]",success:"bg-[var(--color-success)]/10 text-[var(--color-success)]"};function na({title:e,children:t,items:r,variant:a="info",class:o}){return n("div",{class:`
399
+ p-3 rounded-lg text-xs
400
+ ${k4[a]}
401
+ ${o||""}
402
+ `,children:[e&&n("p",{class:"font-medium mb-1",children:e}),r?n("ul",{class:"list-disc list-inside space-y-0.5",children:r.map((l,s)=>n("li",{children:l},s))}):t]})}function Eg(e){return e.join(".")}function _4(e,t,r){if(t.length===0)return e;const a={...e};let o=a;for(let s=0;s<t.length-1;s++){const c=t[s],u=o[c];u==null||typeof u!="object"?o[c]=typeof t[s+1]=="number"?[]:{}:o[c]=Array.isArray(u)?[...u]:{...u},o=o[c]}const l=t[t.length-1];return r===void 0?delete o[l]:o[l]=r,a}function Co(e){if(!e)return null;if(typeof e.type=="string")return e.type;if(Array.isArray(e.type))return e.type.filter(r=>r!=="null")[0]??null;if(e.const!==void 0)return typeof e.const;if(e.enum&&e.enum.length>0)return typeof e.enum[0];if(e.anyOf||e.oneOf){const r=(e.anyOf??e.oneOf??[]).filter(a=>a.type!=="null"&&!(Array.isArray(a.type)&&a.type.includes("null")));if(r.length===1)return Co(r[0])}return null}function S4(e){if(e.default!==void 0)return e.default;if(e.const!==void 0)return e.const;switch(Co(e)){case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";case"array":return[];case"object":return{};default:return}}function C4(e,t){const r=Eg(e);if(t[r])return t[r];const a=[r.replace(/\.\d+\./g,".*."),r.replace(/\.\d+\./g,"[]."),r.replace(/\[\d+\]/g,"[*]")];for(const o of a)if(t[o])return t[o]}const E4=new Set(["ui","url","api","id","ip","http","https","ssl","tls","ssh","dns","smtp","imap","json","xml","html","css","jwt","oauth","mfa","2fa","cli","gui","cpu","gpu","ram","ssd","hdd","aws","gcp","ai","ml","llm","pty","tty"]);function Eo(e){return typeof e=="number"?`#${e+1}`:e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").split(" ").map(t=>{const r=t.toLowerCase();return E4.has(r)?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}).join(" ")}function yl(e,t){const r=Co(t);if(e==null)return t.nullable||Array.isArray(t.type)&&t.type.includes("null")||t.default!==void 0,null;switch(r){case"string":if(typeof e!="string")return i("config.validation.mustBeString");if(t.minLength&&e.length<t.minLength)return i("config.validation.minLength",{min:t.minLength});if(t.maxLength&&e.length>t.maxLength)return i("config.validation.maxLength",{max:t.maxLength});if(t.pattern&&!new RegExp(t.pattern).test(e))return i("config.validation.invalidFormat");break;case"number":case"integer":if(typeof e!="number")return i("config.validation.mustBeNumber");if(t.minimum!==void 0&&e<t.minimum)return i("config.validation.minimum",{min:t.minimum});if(t.maximum!==void 0&&e>t.maximum)return i("config.validation.maximum",{max:t.maximum});if(r==="integer"&&!Number.isInteger(e))return i("config.validation.mustBeInteger");break;case"boolean":if(typeof e!="boolean")return i("config.validation.mustBeBoolean");break;case"array":if(!Array.isArray(e))return i("config.validation.mustBeArray");if(t.minItems&&e.length<t.minItems)return i("config.validation.minItems",{min:t.minItems});if(t.maxItems&&e.length>t.maxItems)return i("config.validation.maxItems",{max:t.maxItems});break;case"object":if(typeof e!="object"||Array.isArray(e))return i("config.validation.mustBeObject");break}return t.enum&&!t.enum.includes(e)?i("config.validation.invalidOption"):null}const fr=v(!1),bt=v(null),Jl=v(!1),dn=v(null),wl=v({}),no=v({}),Ut=v({}),kl=v(null),Tg=v(null),Ag=v(!1),T4=v(!0),A4=v(null),ui=v(""),Br=v({}),lc=B(()=>JSON.stringify(no.value)!==JSON.stringify(Ut.value)),Mg=B(()=>lc.value&&!Jl.value&&Object.keys(Br.value).length===0);async function Zh(){fr.value=!0,bt.value=null;try{const[e,t]=await Promise.all([H("config.get",{}),H("config.schema",{})]);dn.value=t.schema,wl.value=t.uiHints,A4.value=t.version,no.value=e.config,Ut.value=structuredClone(e.config),kl.value=e.hash??null,Tg.value=e.path??null,Ag.value=e.exists,T4.value=e.valid,Br.value={}}catch(e){bt.value=le(e)}finally{fr.value=!1}}function Je(e,t){Ut.value=_4(Ut.value,e,t)}function M4(){Ut.value=structuredClone(no.value),Br.value={}}function _l(e,t){const r={...Br.value};t?r[e]=t:delete r[e],Br.value=r}async function I4(){if(!Mg.value)return!1;if(!kl.value&&Ag.value)return bt.value="Missing base hash. Reload and try again.",!1;Jl.value=!0,bt.value=null;try{const e=Ig(no.value,Ut.value),t=await H("config.patch",{raw:JSON.stringify(e),baseHash:kl.value});if(t.ok){no.value=t.config,Ut.value=structuredClone(t.config),Tg.value=t.path;const r=await H("config.get",{});return kl.value=r.hash??null,!0}else return bt.value="Failed to save configuration",!1}catch(e){const t=le(e);return t.includes("hash")||t.includes("changed")?bt.value="Configuration was modified externally. Please reload.":bt.value=t,!1}finally{Jl.value=!1}}function Ig(e,t){const r={};for(const a of Object.keys(t)){const o=e[a],l=t[a];JSON.stringify(o)!==JSON.stringify(l)&&(l!==null&&typeof l=="object"&&!Array.isArray(l)&&o!==null&&typeof o=="object"&&!Array.isArray(o)?r[a]=Ig(o,l):r[a]=l)}for(const a of Object.keys(e))a in t||(r[a]=null);return r}function R4(e){return e.type==="array"&&e.items?.properties?!0:e.type==="object"&&e.properties?Object.keys(e.properties).length>=2:!1}function sc(e,t,r,a=[],o=0){if(!e.properties)return[];const l=[];for(const[s,c]of Object.entries(e.properties)){const u=[...a,s],h=(r[s]??r[u.join(".")]??{}).label??c.title??Eo(s);if(o>0&&!R4(c))continue;const f={key:s,label:h,path:u,schema:c};if(c.type==="object"&&c.properties){const g=t[s]??{};f.children=sc(c,g,r,u,o+1),f.children.length===0&&delete f.children}if(c.type==="array"&&c.items?.properties){const g=t[s]??[];f.children=g.map((m,y)=>{const C=m,T=C.identity,_=C.id??C.name??C.label??`#${y+1}`,p=T?.emoji??"";return{key:String(y),label:p?`${p} ${_}`:String(_),path:[...u,y],schema:c.items}})}l.push(f)}return l.sort((s,c)=>{const u=r[s.key]?.order??100,d=r[c.key]?.order??100;return u-d}),l}const Rg={gateway:Bt,agents:ry,channels:zl,tools:Ry,commands:Ty,session:_s,cron:me,skills:fu,plugins:uu,logging:jt,auth:Kd,models:qd,wizard:My,update:Ht,diagnostics:xn,nodeHost:Vn,audio:Ay,messages:an,bindings:Ip,ui:yy,browser:vt,hooks:Iy,web:Bt,canvas:wr,canvasHost:wr,approvals:ks,notifications:ty,meta:jt,env:Gd,nodes:Vn,broadcast:zl,media:wr,network:Xs,secrets:ws,memory:Fl,memorySearch:Fl,storage:Gd,tls:Kd,remote:Xs,reload:He,tailscale:Xs,sandbox:qd,context:Gi,contextPruning:Gi,compaction:ln,heartbeat:xn,defaults:Lp},$4=ly;function $g({item:e,depth:t=0,selectedPath:r,expandedNav:a}){const o=e.path.join("."),l=a.value.has(o),s=r.value.join(".")===o||r.value.join(".").startsWith(o+"."),c=e.children&&e.children.length>0,u=t===0?Rg[e.key]??$4:void 0,d=()=>{r.value=e.path},h=g=>{g.stopPropagation();const m=new Set(a.value);l?m.delete(o):m.add(o),a.value=m},f=r.value.join(".")===o;return n("div",{children:[n("button",{type:"button",class:`w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded-md text-left transition-colors ${f?"bg-[var(--color-accent)] text-white":s?"text-[var(--color-accent)]":"hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-primary)]"} ${t>0?"text-[var(--color-text-secondary)]":"font-medium"}`,style:{paddingLeft:`${t*16+8}px`},onClick:d,children:[c?n("button",{type:"button",class:"p-0.5 -ml-1 hover:bg-[var(--color-bg-primary)]/20 rounded",onClick:h,"aria-label":i(l?"accessibility.collapseSection":"accessibility.expandSection"),children:l?n(wt,{class:"w-3.5 h-3.5"}):n(qt,{class:"w-3.5 h-3.5"})}):n("span",{class:"w-4"}),u&&n(u,{class:"w-4 h-4 flex-shrink-0 opacity-70"}),n("span",{class:"truncate",children:e.label})]}),c&&l&&n("div",{class:"relative ml-2",children:[n("div",{class:"absolute top-0 bottom-1 w-px bg-[var(--color-border)] opacity-50",style:{left:`${(t+1)*16+4}px`}}),e.children.map(g=>n($g,{item:g,depth:t+1,selectedPath:r,expandedNav:a},g.key))]})]})}function Qt({label:e,description:t,error:r,inline:a,children:o}){return a&&e?n("div",{class:"py-3",children:[n("div",{class:"flex items-start justify-between gap-8",children:[n("div",{class:"min-w-0 max-w-sm",children:[n("label",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:e}),t&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-1 leading-relaxed",children:t})]}),n("div",{class:"flex-shrink-0",children:o})]}),r&&n("p",{class:"text-xs text-[var(--color-error)] mt-1",children:r})]}):n("div",{class:"py-3",children:[e&&n("label",{class:"block text-sm font-medium text-[var(--color-text-primary)] mb-1.5",children:e}),t&&n("p",{class:"text-xs text-[var(--color-text-muted)] mb-2 leading-relaxed max-w-lg",children:t}),o,r&&n("p",{class:"text-xs text-[var(--color-error)] mt-1",children:r})]})}function D4({value:e,placeholder:t,onChange:r,wide:a}){const[o,l]=j(!1);return n("div",{class:"relative",children:[n(te,{type:o?"text":"password",value:e,placeholder:t,onInput:s=>r(s.target.value),class:`pr-10 ${a?"w-72":"w-48"}`}),n("button",{type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]",onClick:()=>l(!o),"aria-label":i(o?"config.field.hidePassword":"config.field.showPassword"),children:o?n(Cp,{class:"w-4 h-4"}):n(Ep,{class:"w-4 h-4"})})]})}function Dg({value:e,onChange:t}){const[r,a]=j(()=>JSON.stringify(e,null,2)??""),[o,l]=j(null);return n("div",{class:"space-y-1",children:[n(eo,{value:r,onInput:c=>a(c.target.value),onBlur:()=>{try{const c=JSON.parse(r);t(c),l(null)}catch{l(i("config.field.invalidJson"))}},rows:6,class:"font-mono text-sm w-full"}),o&&n("p",{class:"text-xs text-[var(--color-error)]",children:o})]})}function L4({schema:e,value:t,path:r,hints:a,level:o,label:l,help:s,isDetailView:c=!1}){const[u,d]=j(o<2||c),h=e.properties??{},f=Object.keys(h),g=t??{};return c&&o===0?n("div",{class:"space-y-2",children:[s&&n("p",{class:"text-sm text-[var(--color-text-muted)] mb-4",children:s}),f.map(m=>n(ro,{schema:h[m],value:g[m],path:[...r,m],hints:a,level:o+1},m))]}):n("div",{class:"mt-6 first:mt-3",children:[n("button",{type:"button",class:"flex items-center gap-2 py-2 text-left group",onClick:()=>d(!u),"aria-expanded":u,children:[n("span",{class:"text-[var(--color-text-muted)] group-hover:text-[var(--color-text-primary)] transition-colors",children:u?n(wt,{class:"w-4 h-4"}):n(qt,{class:"w-4 h-4"})}),n("span",{class:"text-sm font-semibold text-[var(--color-text-primary)]",children:l}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["(",f.length,")"]})]}),u&&n("div",{class:"ml-6 pl-4 border-l border-[var(--color-border)] mt-1",children:[s&&n("p",{class:"text-xs text-[var(--color-text-muted)] pb-2 leading-relaxed",children:s}),f.map(m=>n(ro,{schema:h[m],value:g[m],path:[...r,m],hints:a,level:o+1},m))]})]})}function N4({schema:e,value:t,path:r,hints:a,level:o,label:l,help:s}){const[c,u]=j(o<2),d=t??[],h=e.items??{},f=Co(h),g=()=>{const C=S4(h);Je(r,[...d,C])},m=C=>{const T=d.filter((_,p)=>p!==C);Je(r,T)},y=(C,T)=>{const _=[...d],[p]=_.splice(C,1);_.splice(T,0,p),Je(r,_)};return f==="string"||f==="number"?n("div",{class:"mt-6 first:mt-3",children:[n("div",{class:"flex items-center justify-between mb-3",children:[n("div",{children:[n("label",{class:"text-sm font-semibold text-[var(--color-text-primary)]",children:l}),s&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-1 leading-relaxed",children:s})]}),n(L,{variant:"secondary",size:"sm",icon:Rr,onClick:g,children:i("config.field.addItem")})]}),n("div",{class:"space-y-2 max-w-md",children:[d.map((C,T)=>n(F4,{index:T,path:r,onReorder:y,children:[n(te,{type:f==="number"?"number":"text",value:String(C??""),onInput:_=>{const p=_.target.value,b=[...d];b[T]=f==="number"?Number(p):p,Je(r,b)},class:"flex-1"}),n(Q,{icon:n(Gt,{class:"w-4 h-4"}),label:i("config.field.removeItem"),onClick:()=>m(T),size:"sm",variant:"ghost"})]},T)),d.length===0&&n("p",{class:"text-sm text-[var(--color-text-muted)] py-4 text-center border border-dashed border-[var(--color-border)] rounded-lg",children:i("config.field.noItems")})]})]}):n("div",{class:"mt-6 first:mt-3",children:[n("div",{class:"flex items-center justify-between mb-3",children:[n("button",{type:"button",class:"flex items-center gap-2 group",onClick:()=>u(!c),"aria-expanded":c,children:[n("span",{class:"text-[var(--color-text-muted)] group-hover:text-[var(--color-text-primary)] transition-colors",children:c?n(wt,{class:"w-4 h-4"}):n(qt,{class:"w-4 h-4"})}),n("span",{class:"text-sm font-semibold text-[var(--color-text-primary)]",children:l}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["(",d.length,")"]})]}),n(L,{variant:"secondary",size:"sm",icon:Rr,onClick:g,children:i("config.field.addItem")})]}),s&&n("p",{class:"text-xs text-[var(--color-text-muted)] mb-3 leading-relaxed",children:s}),c&&n("div",{class:"space-y-3",children:d.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] py-4 text-center border border-dashed border-[var(--color-border)] rounded-lg",children:i("config.field.noItems")}):d.map((C,T)=>n(O4,{schema:h,value:C,path:[...r,T],parentPath:r,hints:a,level:o+1,index:T,totalItems:d.length,onRemove:()=>m(T),onReorder:y},T))})]})}function O4({schema:e,value:t,path:r,parentPath:a,hints:o,level:l,index:s,totalItems:c,onRemove:u,onReorder:d}){const[h,f]=j(!1),[g,m]=j(!1),[y,C]=j(!1),T=t??{},_=T.id??T.name??T.label??T.displayName??`#${s+1}`,b=T.identity?.emoji??"",k=S=>{m(!0),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",JSON.stringify({path:a.join("."),index:s}))},E=()=>{m(!1)},w=S=>{S.preventDefault(),S.dataTransfer.dropEffect="move",C(!0)},A=()=>{C(!1)},D=S=>{S.preventDefault(),C(!1);try{const F=JSON.parse(S.dataTransfer.getData("text/plain"));F.path===a.join(".")&&F.index!==s&&d(F.index,s)}catch{}};return n(V,{padding:"none",class:`overflow-hidden transition-all ${g?"opacity-50":""} ${y?"ring-2 ring-[var(--color-accent)]":""}`,draggable:c>1,onDragStart:k,onDragEnd:E,onDragOver:w,onDragLeave:A,onDrop:D,children:[n("div",{class:"flex items-center gap-2 px-3 py-3",children:[c>1&&n("div",{class:"p-1 cursor-grab text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] active:cursor-grabbing",title:i("config.field.dragToReorder"),children:n(Tp,{class:"w-4 h-4"})}),n("button",{type:"button",class:"flex-1 flex items-center gap-2 text-left group",onClick:()=>f(!h),"aria-expanded":h,children:[n("span",{class:"text-[var(--color-text-muted)] group-hover:text-[var(--color-text-primary)] transition-colors",children:h?n(wt,{class:"w-4 h-4"}):n(qt,{class:"w-4 h-4"})}),b&&n("span",{children:b}),n("span",{class:"text-sm font-medium",children:String(_)})]}),n(Q,{icon:n(Gt,{class:"w-4 h-4"}),label:i("config.field.removeItem"),onClick:u,size:"sm",variant:"ghost"})]}),h&&n("div",{class:"px-4 pb-4 border-t border-[var(--color-border)]",children:n(ro,{schema:e,value:t,path:r,hints:o,level:l,showLabel:!1,isDetailView:!0})})]})}function F4({index:e,path:t,onReorder:r,children:a}){const[o,l]=j(!1),[s,c]=j(!1);return n("div",{class:`flex items-center gap-1 rounded-md transition-colors ${o?"opacity-50":""} ${s?"bg-[var(--color-accent)]/10 ring-1 ring-[var(--color-accent)]":""}`,draggable:!0,onDragStart:m=>{l(!0),m.dataTransfer.effectAllowed="move",m.dataTransfer.setData("text/plain",JSON.stringify({path:t.join("."),index:e}))},onDragEnd:()=>{l(!1)},onDragOver:m=>{m.preventDefault(),m.dataTransfer.dropEffect="move",c(!0)},onDragLeave:()=>{c(!1)},onDrop:m=>{m.preventDefault(),c(!1);try{const y=JSON.parse(m.dataTransfer.getData("text/plain"));y.path===t.join(".")&&y.index!==e&&r(y.index,e)}catch{}},children:[n("div",{class:"p-1 cursor-grab text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] active:cursor-grabbing",title:i("config.field.dragToReorder"),children:n(Tp,{class:"w-4 h-4"})}),a]})}function P4({schema:e,value:t,path:r,hints:a,level:o,label:l,help:s,showLabel:c}){const d=(e.anyOf??e.oneOf??[]).filter(f=>f.type!=="null"&&!(Array.isArray(f.type)&&f.type.includes("null")));if(d.length===1)return n(ro,{schema:d[0],value:t,path:r,hints:a,level:o,showLabel:c});const h=d.map(f=>f.const??(f.enum?.length===1?f.enum[0]:void 0)).filter(f=>f!==void 0);if(h.length===d.length&&h.length>0){const f=d.map((g,m)=>({value:String(h[m]),label:g.title??Eo(String(h[m]))}));return n(Qt,{label:c!==!1?l:void 0,description:s,inline:c!==!1,children:n(Me,{value:String(t??""),options:f,onChange:g=>Je(r,g),size:"sm",width:"160px"})})}return n(Qt,{label:c!==!1?l:void 0,description:s,children:n(Dg,{value:t,onChange:f=>Je(r,f)})})}function ro({schema:e,value:t,path:r,hints:a,level:o=0,showLabel:l=!0,isDetailView:s=!1}){const c=Co(e),u=C4(r,a)??{},d=Eg(r),h=u.label??e.title??Eo(r[r.length-1]??""),f=u.help??e.description,g=Br.value[d];if(e.anyOf||e.oneOf)return n(P4,{schema:e,value:t,path:r,hints:a,level:o,label:h,help:f,showLabel:l});switch(c){case"object":return n(L4,{schema:e,value:t,path:r,hints:a,level:o,label:h,help:f,isDetailView:s});case"array":return n(N4,{schema:e,value:t,path:r,hints:a,level:o,label:h,help:f});case"boolean":return n(Qt,{error:g,children:n(Ke,{checked:!!(t??e.default),onChange:m=>{Je(r,m)},label:l?h:void 0,description:f})});case"number":case"integer":return n(Qt,{label:l?h:void 0,description:f,error:g,inline:!0,children:n(te,{type:"number",value:t==null?"":String(t),placeholder:u.placeholder,onInput:m=>{const y=m.target.value,C=y===""?void 0:Number(y);Je(r,C),_l(d,yl(C,e))},min:e.minimum,max:e.maximum,class:"w-24 text-right"})});case"string":return z4({schema:e,value:t,path:r,hint:u,key:d,label:h,help:f,errorMsg:g,showLabel:l});default:return n(Qt,{label:l?h:void 0,description:f,error:g,children:n(Dg,{value:t,onChange:m=>Je(r,m)})})}}function z4({schema:e,value:t,path:r,hint:a,key:o,label:l,help:s,errorMsg:c,showLabel:u}){if(e.enum)return n(Qt,{label:u?l:void 0,description:s,error:c,inline:!0,children:n(Me,{value:String(t??""),options:e.enum.map(g=>({value:String(g),label:Eo(String(g))})),onChange:g=>Je(r,g),size:"sm",width:"160px"})});if(a.sensitive)return n(Qt,{label:u?l:void 0,description:s,error:c,inline:!0,children:n(D4,{value:String(t??""),placeholder:a.placeholder,onChange:g=>{Je(r,g),_l(o,yl(g,e))},wide:!0})});if((e.maxLength??0)>200)return n(Qt,{label:u?l:void 0,description:s,error:c,children:n(eo,{value:String(t??""),placeholder:a.placeholder,onInput:g=>{const m=g.target.value;Je(r,m),_l(o,yl(m,e))},rows:4,class:"w-full"})});const d=e.format==="uri"||e.format==="url",h=o.toLowerCase().includes("path")||o.toLowerCase().includes("dir")||o.toLowerCase().includes("file"),f=d||h?"w-72":"w-48";return n(Qt,{label:u?l:void 0,description:s,error:c,inline:!0,children:n(te,{type:d?"url":"text",value:String(t??""),placeholder:a.placeholder,onInput:g=>{const m=g.target.value;Je(r,m),_l(o,yl(m,e))},class:f})})}function U4({selectedPath:e,schema:t,draftConfig:r,uiHints:a}){const o=e.value,l=t.value,s=r.value,c=a.value;if(!l||o.length===0)return n("div",{class:"flex-1 flex items-center justify-center text-[var(--color-text-muted)]",children:n("div",{class:"text-center",children:[n(Lp,{class:"w-12 h-12 mx-auto mb-4 opacity-50"}),n("p",{children:i("config.selectSection")})]})});let u=l,d=s;for(const p of o)typeof p=="number"?(u=u?.items,d=d?.[p]):(u=u?.properties?.[p],d=d?.[p]);if(!u)return n("div",{class:"flex-1 p-6 text-[var(--color-text-muted)]",children:n("p",{children:["Schema not found for path: ",o.join(" › ")]})});const h=o.map((p,b)=>{const k=o.slice(0,b+1);return c[k.join(".")]?.label??Eo(p)}),f=h[h.length-1],g=h.slice(0,-1),m=o.join("."),C=c[m]?.help??u.description,T=String(o[0]),_=Rg[T];return n("div",{class:"flex-1 overflow-y-auto",children:[n("div",{class:"px-8 pt-6 pb-4 border-b border-[var(--color-border)] bg-[var(--color-bg-primary)]",children:[g.length>0&&n("div",{class:"text-xs text-[var(--color-text-muted)] mb-1.5",children:g.join(" › ")}),n("div",{class:"flex items-center gap-3",children:[_&&o.length===1&&n(_,{class:"w-6 h-6 text-[var(--color-accent)] opacity-80"}),n("h2",{class:"text-xl font-semibold text-[var(--color-text-primary)]",children:f})]}),C&&n("p",{class:"text-sm text-[var(--color-text-muted)] mt-2 max-w-2xl leading-relaxed",children:C})]}),n("div",{class:"px-8 py-6 max-w-4xl",children:n(ro,{schema:u,value:d,path:o,hints:c,level:0,showLabel:!1,isDetailView:!0})})]})}const Lg="cove:config:expandedNav";function Ru(){const e=window.location.hash.slice(1);return e?e.split(".").map(t=>{const r=Number(t);return Number.isInteger(r)&&r>=0?r:t}):[]}function H4(e){return e.length===0?"":e.join(".")}function j4(){try{const e=localStorage.getItem(Lg);if(e)return new Set(JSON.parse(e))}catch{}return new Set(["gateway","agents","channels"])}const fn=v(Ru()),Xl=v(j4());let ic=!1;fn.subscribe(e=>{const t=H4(e),r=window.location.hash.slice(1);if(t!==r&&(ic=!0,t?window.location.hash=t:history.replaceState(null,"",window.location.pathname+window.location.search),ic=!1),e.length>1){const a=new Set(Xl.value);for(let o=1;o<e.length;o++)a.add(e.slice(0,o).join("."));Xl.value=a}});typeof window<"u"&&window.addEventListener("hashchange",()=>{ic||(fn.value=Ru())});Xl.subscribe(e=>{try{localStorage.setItem(Lg,JSON.stringify([...e]))}catch{}});function B4(e){z(()=>{const d=Ru();d.length>0&&(fn.value=d)},[]),z(()=>{$.value&&!dn.value&&Zh()},[$.value]),z(()=>{if(!dn.value)return;const d=fn.value,f=sc(dn.value,Ut.value,wl.value)[0]?.path;if(d.length===0){f&&(fn.value=f);return}const g=String(d[0]);dn.value.properties?.[g]||f&&(fn.value=f)},[dn.value]);const t=async()=>{await I4()?pe.success(i("config.saveSuccess")):bt.value&&pe.error(bt.value)},r=()=>{M4(),pe.success(i("config.reset"))},a=dn.value,o=Ut.value,l=wl.value,s=a?sc(a,o,l):[],c=ui.value.toLowerCase().trim(),u=c?s.filter(d=>{const h=d.label.toLowerCase().includes(c),f=d.children?.some(g=>g.label.toLowerCase().includes(c));return h||f}):s;return n(ut,{viewName:i("config.title"),children:n("div",{class:"flex-1 overflow-y-auto p-6",children:n("div",{class:"max-w-6xl mx-auto space-y-6",children:[n(kt,{title:i("config.title"),subtitle:i("config.description"),actions:n(Y,{children:[lc.value&&n("span",{class:"text-sm text-[var(--color-warning)]",children:i("config.unsavedChanges")}),n(L,{variant:"secondary",size:"sm",icon:du,onClick:r,disabled:!lc.value,children:i("config.reset")}),n(L,{variant:"primary",size:"sm",icon:_y,onClick:t,disabled:!Mg.value,children:Jl.value?i("config.saving"):i("config.save")}),n(Q,{icon:n(He,{class:fr.value?"animate-spin":""}),onClick:Zh,disabled:fr.value,label:i("actions.refresh")})]})}),bt.value&&n(na,{variant:"error",children:bt.value}),fr.value&&!a&&n("div",{class:"flex items-center justify-center py-12",children:n(ue,{size:"lg"})}),!fr.value&&a&&n("div",{class:"flex min-h-[500px] rounded-xl overflow-hidden border border-[var(--color-border)]",children:[n("div",{class:"w-64 flex flex-col bg-[var(--color-bg-tertiary)]",children:[n("div",{class:"p-3",children:n(te,{type:"text",placeholder:i("config.searchPlaceholder"),value:ui.value,onInput:d=>{ui.value=d.target.value},leftElement:n(Pe,{class:"w-4 h-4"}),class:"text-sm"})}),n("div",{class:"flex-1 overflow-y-auto p-2",children:u.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] p-2",children:i(c?"config.noResults":"config.noFields")}):u.map(d=>n($g,{item:d,selectedPath:fn,expandedNav:Xl},d.key))})]}),n("div",{class:"flex-1 bg-[var(--color-bg-surface)]",children:n(U4,{selectedPath:fn,schema:dn,draftConfig:Ut,uiHints:wl})})]})]})})})}function Qo({theme:e,isSelected:t,onClick:r,size:a="md"}){const o=e.colors["--color-bg-primary"],l=e.colors["--color-accent"],s=a==="sm"?"w-10 h-10":"w-12 h-12",c=a==="sm"?"w-3 h-3":"w-4 h-4",u=a==="sm"?"w-4 h-4":"w-5 h-5";return n(Zr,{content:e.name,placement:"top",delay:200,children:n("button",{type:"button",onClick:r,class:`
403
+ relative ${s} rounded-xl border-2 transition-all
404
+ hover:scale-105
405
+ focus:outline-none focus:ring-2 focus:ring-[var(--color-accent)] focus:ring-offset-2
406
+ ${t?"border-[var(--color-accent)] ring-2 ring-[var(--color-accent)]":"border-[var(--color-border)] hover:border-[var(--color-text-muted)]"}
407
+ `,style:{backgroundColor:o},"aria-label":e.name,"aria-pressed":t,children:[n("span",{class:`absolute bottom-1.5 right-1.5 ${c} rounded-full border border-white/30`,style:{backgroundColor:l}}),t&&n("span",{class:"absolute inset-0 flex items-center justify-center",children:n(on,{class:`${u} text-[var(--color-accent)]`,strokeWidth:3})})]})})}function el({icon:e,titleKey:t,selectedThemeName:r}){return n("div",{class:"flex items-center gap-2 mb-3",children:[n("span",{class:"text-[var(--color-text-muted)]",children:e}),n("span",{class:"text-sm font-medium text-[var(--color-text-secondary)]",children:i(t)}),r&&n("span",{class:"text-sm text-[var(--color-text-muted)]",children:["— ",r]})]})}function W4(){const e=tb(),t=lt.value,r=t.selected==="system",a=e.filter(h=>h.appearance==="light"),o=e.filter(h=>h.appearance==="dark"),l=t.lightTheme,s=t.darkTheme,c=t.selected!=="system"?t.selected:null,u=h=>{if(h)Ws("system");else{const f=window.matchMedia("(prefers-color-scheme: dark)").matches;Ws(f?s:l)}},d=(h,f)=>{r?f==="light"?Qm(h):eb(h):Ws(h)};return n("div",{class:"space-y-6",children:[n("div",{class:"flex items-center justify-between p-4 rounded-xl bg-[var(--color-bg-secondary)]",children:[n("div",{class:"flex items-center gap-3",children:[n(vt,{class:"w-5 h-5 text-[var(--color-text-muted)]"}),n("div",{children:[n("p",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:i("settings.appearance.useSystemTheme")}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:i("settings.appearance.useSystemThemeDescription")})]})]}),n(Ke,{checked:r,onChange:u,size:"sm"})]}),r?n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-6",children:[n("div",{children:[n(el,{icon:n(Yd,{class:"w-4 h-4"}),titleKey:"settings.appearance.lightTheme",selectedThemeName:a.find(h=>h.id===l)?.name}),n("div",{class:"flex flex-wrap gap-2",children:a.map(h=>n(Qo,{theme:h,isSelected:l===h.id,onClick:()=>d(h.id,"light")},h.id))})]}),n("div",{children:[n(el,{icon:n(Vd,{class:"w-4 h-4"}),titleKey:"settings.appearance.darkTheme",selectedThemeName:o.find(h=>h.id===s)?.name}),n("div",{class:"flex flex-wrap gap-2",children:o.map(h=>n(Qo,{theme:h,isSelected:s===h.id,onClick:()=>d(h.id,"dark")},h.id))})]})]}):n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-6",children:[n("div",{children:[n(el,{icon:n(Yd,{class:"w-4 h-4"}),titleKey:"settings.appearance.lightThemes",selectedThemeName:a.find(h=>h.id===c)?.name}),n("div",{class:"flex flex-wrap gap-2",children:a.map(h=>n(Qo,{theme:h,isSelected:c===h.id,onClick:()=>d(h.id,"light")},h.id))})]}),n("div",{children:[n(el,{icon:n(Vd,{class:"w-4 h-4"}),titleKey:"settings.appearance.darkThemes",selectedThemeName:o.find(h=>h.id===c)?.name}),n("div",{class:"flex flex-wrap gap-2",children:o.map(h=>n(Qo,{theme:h,isSelected:c===h.id,onClick:()=>d(h.id,"dark")},h.id))})]})]})]})}function q4(){gm()}function G4(e=!0){C0(),Nx(),Ir(),e&&q4(),it("/")}function In({titleKey:e,children:t}){return n(V,{children:[n("div",{class:"p-3 sm:p-4 border-b border-[var(--color-border)]",children:n("h2",{class:"text-base sm:text-lg font-semibold text-[var(--color-text-primary)]",children:i(e)})}),n("div",{class:"p-3 sm:p-4",children:t})]})}function cr({labelKey:e,descriptionKey:t,disabled:r,children:a}){return n("div",{class:`flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-4 ${r?"opacity-50":""}`,children:[n("div",{class:"flex-1 min-w-0",children:[n("label",{class:"text-sm font-medium text-[var(--color-text-primary)]",children:i(e)}),n("p",{class:"text-xs text-[var(--color-text-muted)] mt-0.5",children:i(t)})]}),n("div",{class:"flex-shrink-0",children:a})]})}function di({label:e,value:t,truncate:r}){return n("div",{class:"flex flex-col sm:flex-row sm:justify-between text-sm gap-0.5 sm:gap-2",children:[n("span",{class:"text-[var(--color-text-muted)]",children:e}),n("span",{class:`text-[var(--color-text-primary)] ${r?"truncate max-w-full sm:max-w-[200px]":""}`,children:t})]})}function K4(e){return n(ut,{viewName:i("nav.settings"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[n(kt,{title:i("nav.settings"),subtitle:i("settings.description")}),n(In,{titleKey:"settings.appearance.title",children:n("div",{class:"space-y-6",children:[n(W4,{}),n(cr,{labelKey:"settings.appearance.fontSize",descriptionKey:"settings.appearance.fontSizeDescription",children:n(Me,{value:qa.value,onChange:t=>{qa.value=t},options:Lb.map(t=>({value:t.value,label:i(t.labelKey)})),size:"sm",width:"180px"})}),n(cr,{labelKey:"settings.appearance.fontFamily",descriptionKey:"settings.appearance.fontFamilyDescription",children:n(Me,{value:Ga.value,onChange:t=>{Ga.value=t},options:Nb.map(t=>({value:t.value,label:i(t.labelKey)})),size:"sm",width:"180px"})})]})}),n(In,{titleKey:"settings.preferences.title",children:n("div",{class:"space-y-6",children:n(cr,{labelKey:"settings.preferences.timeFormat",descriptionKey:"settings.preferences.timeFormatDescription",children:n(Me,{value:Ar.value,onChange:t=>{Ar.value=t},options:Ob.map(t=>({value:t.value,label:i(t.labelKey)})),size:"sm",width:"180px"})})})}),n(In,{titleKey:"settings.appMode.title",children:n(cr,{labelKey:"settings.appMode.multiChat",descriptionKey:"settings.appMode.multiChatDescription",children:n(Ke,{checked:rn.value==="multi",onChange:t=>{rn.value=t?"multi":"single"}})})}),ds.value&&n(In,{titleKey:"settings.newChat.title",children:n("div",{class:"space-y-6",children:[n(cr,{labelKey:"settings.newChat.useDefaults",descriptionKey:"settings.newChat.useDefaultsDescription",children:n(Ke,{checked:Ge.value.useDefaults,onChange:t=>{Ge.value={...Ge.value,useDefaults:t}}})}),n(cr,{labelKey:"settings.newChat.defaultAgent",descriptionKey:"settings.newChat.defaultAgentDescription",children:n(Me,{value:Ge.value.defaultAgentId,onChange:t=>{Ge.value={...Ge.value,defaultAgentId:t}},options:qi.value,size:"sm",width:"180px"})})]})}),n(In,{titleKey:"settings.about.title",children:n("div",{class:"space-y-3",children:[n(di,{label:i("settings.about.cove"),value:`v${dx}`}),st.value&&n(di,{label:i("settings.about.gateway"),value:np(st.value)}),zt.value&&n(di,{label:i("settings.about.gatewayUrl"),value:zt.value,truncate:!0})]})}),n(In,{titleKey:"settings.data.title",children:n("div",{class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("settings.data.resetDefaultsDescription")}),n(L,{variant:"secondary",onClick:()=>Fb(),class:"flex-shrink-0",children:i("settings.data.resetDefaults")})]})}),$.value&&n(In,{titleKey:"settings.account.title",children:n("div",{class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[n("p",{class:"text-sm text-[var(--color-text-primary)]",children:i("settings.account.logoutDescription")}),n(L,{variant:"secondary",onClick:()=>G4(),class:"flex-shrink-0",children:i("actions.logout")})]})})]})})})}const cc=v(null),uc=v(null),dc=v(!1),ma=v(!1);function tl(e){return e==null?"—":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function V4(e){return e==null?"—":`${Math.round(e)}%`}function Y4(e){return e==null?"—":e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}async function Qh(){if($.value){dc.value=!0;try{const[e,t]=await Promise.all([H("status").catch(()=>null),H("health").catch(()=>null)]);cc.value=e,uc.value=t}catch{}finally{dc.value=!1}}}function nl({label:e,value:t,sub:r}){return n("div",{class:"text-center",role:"group","aria-label":e,children:[n("div",{class:"text-lg font-semibold text-[var(--color-text-primary)]",children:t}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:e}),r&&n("div",{class:"text-xs text-[var(--color-text-muted)] opacity-70",children:r})]})}function J4({name:e,label:t,data:r}){const a=r.linked?"success":r.configured?"warning":"default",o=r.linked?i("debug.linked"):r.configured?i("debug.configured"):i("debug.off");return n("div",{class:"flex items-center justify-between py-1.5",children:[n("span",{class:"text-sm",children:t||e}),n(X,{variant:a,size:"sm",children:o})]})}function X4(){const e=$.value,t=cc.value,r=uc.value,a=t?.sessions?.recent?.[0];return z(()=>{e&&!cc.value&&!uc.value&&Qh()},[e]),n(V,{children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(iy,{size:18,class:"text-[var(--color-accent)]"}),n("h2",{class:"font-medium",children:i("debug.snapshots")})]}),n(L,{variant:"ghost",size:"sm",onClick:Qh,disabled:!e,loading:dc.value,icon:n(He,{size:14}),children:i("actions.refresh")})]}),!t&&!r?n("p",{class:"text-sm text-[var(--color-text-muted)] text-center py-6",children:i("debug.noData")}):n("div",{class:"space-y-5",children:[a&&n("div",{children:[n("div",{class:"flex items-center gap-2 mb-3",children:[n(xn,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:i("debug.recentSession")}),a.model&&n(X,{variant:"default",size:"sm",children:a.model})]}),n("div",{class:"grid grid-cols-2 sm:grid-cols-4 gap-2 p-3 bg-[var(--color-bg-tertiary)] rounded-lg",children:[n(nl,{label:i("debug.input"),value:tl(a.inputTokens)}),n(nl,{label:i("debug.output"),value:tl(a.outputTokens)}),n(nl,{label:i("debug.total"),value:tl(a.totalTokens)}),n(nl,{label:i("debug.used"),value:V4(a.percentUsed),sub:`of ${tl(a.contextTokens)}`})]})]}),r&&n("div",{children:[n("div",{class:"flex items-center gap-2 mb-3",children:[n(Mp,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:i("debug.health")}),n(X,{variant:r.ok?"success":"error",size:"sm",children:r.ok?i("debug.healthy"):i("debug.unhealthy")}),r.durationMs!=null&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["(",Y4(r.durationMs),")"]})]}),r.channels&&Object.keys(r.channels).length>0&&n("div",{class:"p-3 bg-[var(--color-bg-tertiary)] rounded-lg divide-y divide-[var(--color-border)]",children:(r.channelOrder??Object.keys(r.channels)).map(o=>{const l=r.channels?.[o];return l?n(J4,{name:o,label:r.channelLabels?.[o],data:l},o):null})})]}),t?.heartbeat?.agents&&t.heartbeat.agents.length>0&&n("div",{children:[n("div",{class:"flex items-center gap-2 mb-3",children:[n(ln,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:i("debug.heartbeatAgents")})]}),n("div",{class:"p-3 bg-[var(--color-bg-tertiary)] rounded-lg space-y-2",children:t.heartbeat.agents.map(o=>n("div",{class:"flex items-center justify-between",children:[n("span",{class:"text-sm font-mono",children:o.agentId}),n("div",{class:"flex items-center gap-2",children:[o.every&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:o.every}),n(X,{variant:o.enabled?"success":"default",size:"sm",children:o.enabled?i("debug.on"):i("debug.off")})]})]},o.agentId))})]}),n("button",{type:"button",onClick:()=>{ma.value=!ma.value},"aria-expanded":ma.value,class:"flex items-center gap-1 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors",children:[ma.value?n(wt,{size:12}):n(qt,{size:12}),i("debug.showRawJson")]}),ma.value&&n(_o,{value:JSON.stringify({status:t,health:r},null,2),id:"snapshots-raw-json"})]})]})}const Sl=v("system-presence"),ao=v("{}"),Pn=v(null),hc=v(!1),Zl=v(null),jn=v(!0),Wt=v([]);let Ng=0;const Og=B(()=>{const e={};for(const t of Wt.value)t.key.trim()&&(e[t.key.trim()]=t.value);return e});function Z4(){if(jn.value){const t=Og.value;return Object.keys(t).length>0?t:void 0}const e=ao.value.trim();if(!(!e||e==="{}"))return JSON.parse(e)}function Q4(){Wt.value=[...Wt.value,{id:`field_${++Ng}`,key:"",value:""}]}function e3(e){Wt.value=Wt.value.filter(t=>t.id!==e)}function ef(e,t){Wt.value=Wt.value.map(r=>r.id===e?{...r,...t}:r)}function t3(){const e=Og.value;ao.value=Object.keys(e).length>0?JSON.stringify(e,null,2):"{}"}function n3(){try{const e=JSON.parse(ao.value||"{}");typeof e=="object"&&e!==null&&!Array.isArray(e)&&(Wt.value=Object.entries(e).map(([t,r])=>({id:`field_${++Ng}`,key:t,value:typeof r=="string"?r:JSON.stringify(r)})))}catch{}}function r3(){jn.value?t3():n3(),jn.value=!jn.value}async function a3(){if($.value){hc.value=!0,Zl.value=null,Pn.value=null;try{const e=Z4(),t=await H(Sl.value,e);Pn.value={ok:!0,data:t}}catch(e){Zl.value=e instanceof Error?e.message:"RPC call failed",Pn.value={ok:!1,data:null}}finally{hc.value=!1}}}function o3(){const e=$.value;return n(V,{children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(Dp,{size:18,class:"text-[var(--color-warning)]"}),n("h2",{class:"font-medium",children:i("debug.manualRpc")})]}),n(L,{variant:"ghost",size:"sm",onClick:r3,icon:jn.value?n(sy,{size:14}):n(ky,{size:14}),children:jn.value?i("debug.jsonMode"):i("debug.formMode")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)] mb-4",children:i("debug.manualRpcDesc")}),n("div",{class:"space-y-4",children:[n("div",{children:[n("label",{htmlFor:"rpc-method",class:"block text-sm font-medium mb-1",children:i("debug.method")}),n(te,{id:"rpc-method",value:Sl.value,onInput:t=>{Sl.value=t.target.value},placeholder:"e.g., system-presence, status, health",class:"font-mono",fullWidth:!0})]}),jn.value?n("div",{children:[n("div",{class:"flex items-center justify-between mb-2",children:[n("span",{class:"text-sm font-medium",children:i("debug.params")}),n(L,{variant:"ghost",size:"sm",onClick:Q4,icon:n(Rr,{size:14}),children:i("debug.addParam")})]}),Wt.value.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] py-3 text-center",children:i("debug.noParams")}):n("div",{class:"space-y-2",children:Wt.value.map(t=>n("div",{class:"flex items-center gap-2",children:[n(te,{value:t.key,onInput:r=>ef(t.id,{key:r.target.value}),placeholder:"key",class:"font-mono flex-1"}),n(te,{value:t.value,onInput:r=>ef(t.id,{value:r.target.value}),placeholder:"value",class:"font-mono flex-1"}),n(Q,{icon:n(Gt,{size:14}),size:"sm",variant:"ghost",label:i("actions.delete"),onClick:()=>e3(t.id)})]},t.id))})]}):n("div",{children:[n("label",{htmlFor:"rpc-params",class:"block text-sm font-medium mb-1",children:i("debug.paramsJson")}),n(eo,{id:"rpc-params",value:ao.value,onInput:t=>{ao.value=t.target.value},placeholder:"{}",rows:4,class:"font-mono text-sm",fullWidth:!0})]}),n(L,{variant:"secondary",onClick:a3,disabled:!e||!Sl.value.trim(),loading:hc.value,icon:n(cu,{size:14}),children:i("debug.call")}),Zl.value&&n("div",{class:"text-sm text-[var(--color-error)] bg-[var(--color-error)]/10 p-3 rounded-lg",children:Zl.value}),Pn.value&&n("div",{children:[n("div",{class:"flex items-center justify-between mb-2",children:[n("span",{class:"text-sm font-medium",children:i("debug.result")}),n(X,{variant:Pn.value.ok?"success":"error",children:Pn.value.ok?i("debug.ok"):i("debug.error")})]}),n(_o,{value:qc(Pn.value.data),maxHeight:"max-h-64",id:"rpc-result"})]})]})]})}const pn=v([]),l3=v(100),Cl=v(!1);let s3=0;const El=v(null),fc=v(new Set),Mt=v(null),Fg=v(0),i3=B(()=>{Fg.value;const e=Uc.value;if(e==null)return"—";const t=Math.floor(e/1e3),r=Math.floor(t/60),a=Math.floor(r/60),o=Math.floor(a/24);return o>0?`${o}d ${a%24}h ${r%60}m`:a>0?`${a}h ${r%60}m`:r>0?`${r}m ${t%60}s`:`${t}s`}),c3=B(()=>{switch(Ce.value){case"connected":return"success";case"connecting":case"authenticating":case"reconnecting":return"warning";default:return"error"}});function u3(e,t){if(Cl.value)return;const r={id:++s3,timestamp:Date.now(),event:e,payload:t};pn.value=[r,...pn.value].slice(0,l3.value)}function d3(){pn.value=[]}function h3(e){const t=new Set(fc.value);t.has(e)?t.delete(e):t.add(e),fc.value=t}async function f3(e,t){try{await navigator.clipboard.writeText(e),El.value=t,setTimeout(()=>{El.value===t&&(El.value=null)},2e3)}catch{}}function De({icon:e,label:t,value:r,copyable:a,mono:o}){const l=r??"—",s=`${t}-${l}`,c=El.value===s;return n("div",{class:"flex flex-col sm:flex-row sm:items-center justify-between py-2 gap-1 sm:gap-2 border-b border-[var(--color-border)] last:border-0",children:[n("div",{class:"flex items-center gap-2 text-[var(--color-text-muted)]",children:[n(e,{size:16,class:"flex-shrink-0"}),n("span",{class:"text-sm",children:t})]}),n("div",{class:"flex items-center gap-2 pl-6 sm:pl-0",children:[n("span",{class:`${o?"font-mono text-sm":""} break-all`,children:l}),a&&r&&n(Q,{icon:c?n(on,{size:14}):n(xs,{size:14}),size:"sm",variant:"ghost",label:i("actions.copy"),onClick:()=>f3(r,s),class:"flex-shrink-0"})]})]})}function p3({entry:e}){const t=e.payload!=null&&Object.keys(e.payload).length>0;return n("button",{type:"button",class:"w-full flex items-center justify-between gap-3 p-3 text-left bg-[var(--color-bg-secondary)] rounded-lg hover:bg-[var(--color-bg-hover)] transition-colors",onClick:()=>{Mt.value=e},"aria-label":i("debug.viewEventDetails",{event:e.event}),children:[n("div",{class:"min-w-0",children:[n(X,{variant:"default",class:"font-mono text-xs mb-1",children:e.event}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:new Date(e.timestamp).toLocaleTimeString()})]}),t&&n(qt,{size:16,class:"text-[var(--color-text-muted)] flex-shrink-0"})]})}function g3({entry:e,expanded:t,onToggle:r}){const a=e.payload!=null&&Object.keys(e.payload).length>0,o=qc(e.payload),l=`event-${e.id}`;return n("div",{class:"border-b border-[var(--color-border)] last:border-0",children:[n("button",{type:"button",class:"w-full flex items-center gap-2 py-2 px-3 text-left hover:bg-[var(--color-bg-hover)] transition-colors",onClick:r,disabled:!a,"aria-expanded":t,"aria-label":`${e.event} event, ${i(a?"debug.clickToExpand":"debug.noPayload")}`,children:[a?t?n(wt,{size:14,class:"text-[var(--color-text-muted)]"}):n(qt,{size:14,class:"text-[var(--color-text-muted)]"}):n("span",{class:"w-[14px]"}),n("span",{class:"text-xs text-[var(--color-text-muted)] w-20 shrink-0",children:new Date(e.timestamp).toLocaleTimeString()}),n(X,{variant:"default",class:"font-mono text-xs",children:e.event})]}),t&&a&&n("div",{class:"px-3 pb-3",children:n(_o,{value:o,id:l})})]})}function v3(e){z(()=>hs(o=>{u3(o.event,o.payload)}),[]),z(()=>{const a=setInterval(()=>{Fg.value++},1e3);return()=>clearInterval(a)},[]);const t=$.value,r=Ce.value;return n(ut,{viewName:i("nav.debug"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[n(kt,{title:i("nav.debug"),subtitle:i("debug.subtitle"),actions:n(X,{variant:c3.value,children:[t?n(Ul,{size:14,class:"mr-1"}):n(Fp,{size:14,class:"mr-1"}),r]})}),n("div",{class:"grid grid-cols-1 md:grid-cols-2 gap-4 sm:gap-6",children:[n(V,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(Ul,{size:18,class:t?"text-[var(--color-success)]":"text-[var(--color-error)]"}),n("h2",{class:"font-medium",children:i("debug.connection")})]}),n("div",{class:"space-y-0",children:[n(De,{icon:xn,label:i("debug.state"),value:r}),n(De,{icon:ln,label:i("debug.url"),value:zt.value,copyable:!0,mono:!0}),n(De,{icon:ws,label:i("debug.sessionKey"),value:Le.value,copyable:!0,mono:!0}),n(De,{icon:He,label:i("debug.reconnectAttempts"),value:String(xt.value)}),n(De,{icon:me,label:i("debug.connectedAt"),value:kn.value?ge(kn.value):null})]})]}),n(V,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(Vn,{size:18,class:"text-[var(--color-primary)]"}),n("h2",{class:"font-medium",children:i("debug.server")})]}),n("div",{class:"space-y-0",children:[n(De,{icon:Vn,label:i("debug.version"),value:st.value}),n(De,{icon:vt,label:i("debug.host"),value:Yr.value}),n(De,{icon:jt,label:i("debug.commit"),value:fo.value?.slice(0,8),copyable:!0,mono:!0}),n(De,{icon:me,label:i("debug.uptime"),value:i3.value}),n(De,{icon:me,label:i("debug.tickInterval"),value:Ka.value?`${Ka.value}ms`:null})]})]}),n(V,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(Pl,{size:18,class:"text-[var(--color-warning)]"}),n("h2",{class:"font-medium",children:i("debug.paths")})]}),n("div",{class:"space-y-0",children:[n(De,{icon:jt,label:i("debug.configPath"),value:_a.value,copyable:!0,mono:!0}),n(De,{icon:Pl,label:i("debug.stateDir"),value:Sa.value,copyable:!0,mono:!0})]})]}),n(V,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(vt,{size:18,class:"text-[var(--color-info)]"}),n("h2",{class:"font-medium",children:i("debug.client")})]}),n("div",{class:"space-y-0",children:[n(De,{icon:vt,label:i("debug.appVersion"),value:"1.2.1"}),n(De,{icon:vt,label:i("debug.platform"),value:navigator.platform}),n(De,{icon:vt,label:i("debug.userAgent"),value:navigator.userAgent.slice(0,60)+"..."}),n(De,{icon:_s,label:i("debug.presenceCount"),value:String(po.value.length)})]})]})]}),n("div",{class:"grid grid-cols-1 lg:grid-cols-2 gap-4 sm:gap-6",children:[n(X4,{}),n(o3,{})]}),n(V,{children:[n("div",{class:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(xn,{size:18,class:"text-[var(--color-accent)]"}),n("h2",{class:"font-medium",children:i("debug.eventLog")}),n(X,{variant:"default",children:pn.value.length})]}),n("div",{class:"flex items-center gap-2",children:[n(Ke,{checked:!Cl.value,onChange:a=>{Cl.value=!a},label:Cl.value?i("debug.paused"):i("debug.recording")}),n(L,{variant:"ghost",size:"sm",onClick:d3,disabled:pn.value.length===0,icon:n(Gt,{size:14}),children:n("span",{class:"hidden sm:inline",children:i("debug.clear")})})]})]}),pn.value.length===0?n("div",{class:"text-center py-8 text-[var(--color-text-muted)]",children:[n(xn,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:i("debug.noEvents")}),n("p",{class:"text-sm mt-1",children:i("debug.noEventsHint")})]}):n(Y,{children:[n("div",{class:"md:hidden space-y-2 max-h-96 overflow-y-auto",children:pn.value.map(a=>n(p3,{entry:a},a.id))}),n("div",{class:"hidden md:block max-h-96 overflow-y-auto border border-[var(--color-border)] rounded-lg",children:pn.value.map(a=>n(g3,{entry:a,expanded:fc.value.has(a.id),onToggle:()=>h3(a.id)},a.id))})]})]}),n(Qe,{open:!!Mt.value,onClose:()=>{Mt.value=null},title:Mt.value?.event||"",children:Mt.value&&n("div",{class:"space-y-3",children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:new Date(Mt.value.timestamp).toLocaleString()}),Mt.value.payload!=null&&Object.keys(Mt.value.payload).length>0?n(_o,{value:qc(Mt.value.payload),maxHeight:"max-h-[60vh]",id:`mobile-event-${Mt.value.id}`}):n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("debug.noPayload")})]})})]})})})}const m3={debug:"text-[var(--color-text-muted)]",info:"text-[var(--color-info)]",warn:"text-[var(--color-warning)]",error:"text-[var(--color-error)]"},b3={debug:ay,info:ys,warn:tr,error:bs};function x3({line:e,expanded:t,onToggle:r}){const a=e.level?b3[e.level]:void 0,o=e.level?m3[e.level]:"text-[var(--color-text-muted)]",l=e.timestamp?e.timestamp.split("T")[1]?.slice(0,12)||e.timestamp.slice(0,12):null,s=e.fields&&Object.keys(e.fields).length>0;return n("div",{class:"border-b border-[var(--color-border)]/50 last:border-0",children:[n("button",{type:"button",onClick:r,disabled:!s,"aria-expanded":s?t:void 0,"aria-label":s?i("logs.expandLine",{message:e.message.slice(0,50)}):void 0,class:"w-full text-left py-2 px-3 hover:bg-[var(--color-bg-hover)] flex items-start gap-2 font-mono text-xs disabled:cursor-default",children:[s?n(qt,{size:12,class:`mt-0.5 flex-shrink-0 text-[var(--color-text-muted)] transition-transform ${t?"rotate-90":""}`}):n("span",{class:"w-3 flex-shrink-0"}),a&&n(a,{size:14,class:`mt-0.5 flex-shrink-0 ${o}`}),l&&n("span",{class:"text-[var(--color-text-muted)] flex-shrink-0",children:l}),n("span",{class:"flex-1 text-[var(--color-text-primary)] truncate",title:e.message,children:e.message})]}),t&&s&&e.fields&&n("div",{class:"pb-3 px-3 ml-7 space-y-2",children:[e.message&&n("div",{class:"text-xs font-mono",children:[n("span",{class:"text-[var(--color-accent)]",children:"message"}),n("div",{class:"text-[var(--color-text-primary)] mt-1 whitespace-pre-wrap break-all",children:e.message})]}),n("div",{class:"space-y-1 pt-1 border-t border-[var(--color-border)]/30",children:Object.entries(e.fields).map(([c,u])=>n("div",{class:"flex gap-2 text-xs font-mono",children:[n("span",{class:"text-[var(--color-accent)] flex-shrink-0",children:c}),n("span",{class:"text-[var(--color-text-secondary)] break-all",children:u})]},c))})]})]})}let Pg=0;function zg(){Pg=0}function Ug(e,t=""){const r={};for(const[a,o]of Object.entries(e)){if(/^\d+$/.test(a))continue;const l=t?`${t}.${a}`:a;o!=null&&(Array.isArray(o)?r[l]=JSON.stringify(o):typeof o=="object"?Object.assign(r,Ug(o,l)):typeof o=="string"?r[l]=o:r[l]=JSON.stringify(o))}return r}const tf=["time","timestamp","ts","level","lvl","pid","hostname","v","msg","message"];function nf(e){const t=++Pg;let r,a,o=e,l;if(e.startsWith("{"))try{const s=JSON.parse(e);r=s.time||s.timestamp||s.ts;const c=(s.level||s.lvl||"")?.toLowerCase();["debug","info","warn","warning","error","err"].includes(c)&&(a=c==="warning"?"warn":c==="err"?"error":c);const u=Object.keys(s).find(h=>/^\d+$/.test(h));if(s.msg||s.message)o=s.msg||s.message;else if(s.error&&typeof s.error=="string")o=s.error;else if(u&&typeof s[u]=="string")o=s[u];else{const h=[];for(const[f,g]of Object.entries(s))tf.includes(f)||(typeof g=="string"?h.push(`${f}=${g}`):g!=null&&h.push(`${f}=${JSON.stringify(g)}`));o=h.length>0?h.join(" "):e}const d={};for(const[h,f]of Object.entries(s))!tf.includes(h)&&!/^\d+$/.test(h)&&(d[h]=f);Object.keys(d).length>0&&(l=Ug(d))}catch{}if(!r){const s=e.match(/^(\d{4}-\d{2}-\d{2}T[\d:.]+Z)\s+\[([^\]]+)\]\s*(.*)$/);if(s){r=s[1],o=`[${s[2]}] ${s[3]}`;const c=e.toLowerCase();c.includes("error")||c.includes("err ")||c.includes("✗")?a="error":c.includes("warn")||c.includes("warning")?a="warn":c.includes("debug")?a="debug":a="info"}}if(!r){const s=e.match(/^\[([^\]]+)\]\s*(DEBUG|INFO|WARN|ERROR):?\s*(.*)$/i);s&&(r=s[1],a=s[2].toLowerCase(),o=s[3])}if(!r){const s=e.match(/^(\d{4}-\d{2}-\d{2}T[\d:]+Z)\s+(ERR|INF|WRN|DBG)\s+(.*)$/);if(s){r=s[1];const c=s[2];a=c==="ERR"?"error":c==="WRN"?"warn":c==="DBG"?"debug":"info",o=s[3]}}if(!a&&!r){const s=e.match(/^(DEBUG|INFO|WARN|ERROR):?\s+(.*)$/i);s&&(a=s[1].toLowerCase(),o=s[2])}if(!a){const s=e.toLowerCase();s.includes("error")||s.includes("failed")||s.includes("exception")||s.includes("✗")?a="error":s.includes("warn")||s.includes("deprecated")?a="warn":(s.includes("debug")||s.includes("trace"))&&(a="debug")}return{id:t,raw:e,timestamp:r,level:a,message:o,fields:l}}const ot=v([]),pc=v(0),gc=v(""),pr=v(!1),Ql=v(null),ba=v(!0),vc=v(""),Lt=v(new Set),mc=v(new Set);async function hi(e=!1){if($.value){pr.value=!0,Ql.value=null;try{const t=await H("logs.tail",{cursor:e?void 0:pc.value||void 0,limit:500,maxBytes:25e4});if(t)if(gc.value=t.file,pc.value=t.cursor,t.reset||e)zg(),ot.value=t.lines.map(nf);else{const r=t.lines.map(nf);r.length>0&&(ot.value=[...ot.value,...r].slice(-2e3))}}catch(t){Ql.value=t instanceof Error?t.message:i("logs.fetchError")}finally{pr.value=!1}}}function y3(){ot.value=[],pc.value=0,zg()}function w3(){const e=ot.value.map(o=>o.raw).join(`
408
+ `),t=new Blob([e],{type:"text/plain"}),r=URL.createObjectURL(t),a=document.createElement("a");a.href=r,a.download=`openclaw-logs-${new Date().toISOString().slice(0,10)}.log`,a.click(),URL.revokeObjectURL(r)}function rl(e){const t=new Set(Lt.value);t.has(e)?t.delete(e):t.add(e),Lt.value=t}function k3(){Lt.value=new Set}function _3(e){const t=new Set(mc.value);t.has(e)?t.delete(e):t.add(e),mc.value=t}const rf=B(()=>{let e=ot.value;const t=Lt.value;t.size>0&&(e=e.filter(a=>a.level&&t.has(a.level)));const r=vc.value.toLowerCase().trim();return r&&(e=e.filter(a=>a.raw.toLowerCase().includes(r))),e}),S3=B(()=>{const e={debug:0,info:0,warn:0,error:0};for(const t of ot.value)t.level&&t.level in e&&e[t.level]++;return e}),C3={debug:{active:"bg-[var(--color-text-muted)]/30 text-[var(--color-text-primary)] ring-1 ring-[var(--color-text-muted)]",inactive:"bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]"},info:{active:"bg-[var(--color-info)]/20 text-[var(--color-info)] ring-1 ring-[var(--color-info)]",inactive:"bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]"},warn:{active:"bg-[var(--color-warning)]/20 text-[var(--color-warning)] ring-1 ring-[var(--color-warning)]",inactive:"bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]"},error:{active:"bg-[var(--color-error)]/20 text-[var(--color-error)] ring-1 ring-[var(--color-error)]",inactive:"bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]"}},af={debug:"logs.debug",info:"logs.info",warn:"logs.warnings",error:"logs.errors"};function al({level:e,count:t,selected:r,onClick:a}){const o=C3[e];return n("button",{type:"button",onClick:a,"aria-label":i("logs.filterByLevel",{level:i(af[e])}),"aria-pressed":r,class:`px-3 py-1 text-sm rounded-full transition-colors ${r?o.active:o.inactive}`,children:[i(af[e])," (",t,")"]})}function E3(e){const t=q(null),r=q(!0);z(()=>{$.value&&hi(!0)},[$.value]),z(()=>{if(!ba.value||!$.value)return;const s=setInterval(()=>hi(),2e3);return()=>clearInterval(s)},[ba.value,$.value]),z(()=>{r.current&&t.current&&(t.current.scrollTop=t.current.scrollHeight)},[rf.value.length]);const a=()=>{if(!t.current)return;const{scrollTop:s,scrollHeight:c,clientHeight:u}=t.current;r.current=c-s-u<50},o=rf.value,l=S3.value;return n(ut,{viewName:i("nav.logs"),children:n("div",{class:"flex-1 overflow-y-auto p-6",children:n("div",{class:"max-w-6xl mx-auto space-y-6",children:[n(kt,{title:i("logs.title"),subtitle:i("logs.description"),actions:n(Y,{children:[n("div",{class:"relative",children:[n(Pe,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(te,{type:"text",value:vc.value,onInput:s=>vc.value=s.target.value,placeholder:i("logs.searchPlaceholder"),"aria-label":i("logs.searchPlaceholder"),class:"pl-10 w-48"})]}),n(Ke,{checked:ba.value,onChange:s=>ba.value=s,label:ba.value?i("logs.live"):i("logs.paused")}),n(L,{variant:"ghost",size:"sm",onClick:()=>hi(!0),disabled:pr.value,icon:n(He,{size:14,class:pr.value?"animate-spin":""}),children:i("actions.refresh")})]})}),n("div",{class:"flex items-center justify-between flex-wrap gap-2",children:[n("div",{class:"flex items-center gap-2",role:"group","aria-label":i("logs.filterByLevel",{level:""}),children:[n("button",{type:"button",onClick:k3,"aria-pressed":Lt.value.size===0,class:`px-3 py-1 text-sm rounded-full transition-colors ${Lt.value.size===0?"bg-[var(--color-accent)] text-white":"bg-[var(--color-bg-secondary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]"}`,children:[i("logs.all")," (",ot.value.length,")"]}),n(al,{level:"debug",count:l.debug,selected:Lt.value.has("debug"),onClick:()=>rl("debug")}),n(al,{level:"info",count:l.info,selected:Lt.value.has("info"),onClick:()=>rl("info")}),n(al,{level:"warn",count:l.warn,selected:Lt.value.has("warn"),onClick:()=>rl("warn")}),n(al,{level:"error",count:l.error,selected:Lt.value.has("error"),onClick:()=>rl("error")})]}),n("div",{class:"flex items-center gap-2",children:[gc.value&&n("span",{class:"text-xs text-[var(--color-text-muted)] flex items-center gap-1",children:[n(jt,{size:12}),gc.value.split("/").pop()]}),n(L,{variant:"ghost",size:"sm",onClick:w3,icon:n(Ht,{size:14}),children:i("logs.download")}),n(L,{variant:"ghost",size:"sm",onClick:y3,disabled:ot.value.length===0,icon:n(Gt,{size:14}),children:i("logs.clear")})]})]}),Ql.value&&n("div",{class:"p-4 rounded-lg bg-[var(--color-error)]/10 text-[var(--color-error)] text-sm",role:"alert",children:Ql.value}),n("div",{class:"rounded-xl border border-[var(--color-border)] bg-[var(--color-bg-tertiary)] overflow-hidden min-h-[calc(100vh-280px)]",children:[pr.value&&ot.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(ue,{size:"lg"})}),!pr.value&&ot.value.length===0&&n("div",{class:"text-center py-12 text-[var(--color-text-muted)]",children:[n(jt,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:i("logs.noLogs")}),n("p",{class:"text-sm mt-1",children:i("logs.noLogsHint")})]}),ot.value.length>0&&o.length===0&&n("div",{class:"text-center py-12 text-[var(--color-text-muted)]",children:[n(Pe,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:i("logs.noMatches")})]}),o.length>0&&n("div",{ref:t,class:"max-h-[calc(100vh-280px)] overflow-y-auto",onScroll:a,role:"log","aria-live":"polite",children:o.map(s=>n(x3,{line:s,expanded:mc.value.has(s.id),onToggle:()=>_3(s.id)},s.id))})]})]})})})}function $u(e){return e.role?e.role:e.roles&&e.roles.length>0?e.roles[0]:"unknown"}function Hg(e){return!!(e.role==="node"||e.roles?.includes("node"))}function jg(e){return!!(e.role==="operator"||e.roles?.includes("operator"))}function Du(e){switch(e){case"operator":return"info";case"node":return"success";default:return"default"}}function Bg(e){switch(e?.toLowerCase()){case"ios":return"🍎";case"android":return"🤖";case"macos":case"darwin":return"💻";case"windows":case"win32":return"🪟";case"linux":return"🐧";case"web":return"🌐";default:return"📱"}}function Wr(e){return e.length<=20?e:`${e.slice(0,10)}...${e.slice(-6)}`}function T3({device:e,onSelect:t}){const r=$u(e),a=e.tokens?.length??0,o=e.platform?.includes("ios")||e.platform?.includes("android")?$r:vt;return n(So,{icon:o,iconVariant:r==="operator"?"info":"success",title:e.displayName||Wr(e.deviceId),subtitle:e.platform||void 0,badges:n(X,{variant:Du(r),children:r}),meta:[...a>0?[{icon:ws,value:`${a}`}]:[],{icon:me,value:ge(e.approvedAtMs,{relative:!0})}],onClick:()=>t(e)})}function ol({label:e,children:t}){return n("div",{children:[n("span",{class:"text-[var(--color-text-muted)]",children:[e,":"]})," ",t]})}function A3({token:e,onRotate:t}){return n("div",{class:"flex items-center justify-between rounded-lg p-2 bg-[var(--color-bg-primary)]",children:[n("div",{children:[n("div",{class:"font-medium text-sm",children:e.role}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:e.revokedAtMs?i("devices.tokenRevoked"):i("devices.tokenActive")})]}),n("div",{class:"flex gap-1",children:n(Q,{icon:n(du,{class:"w-4 h-4"}),label:i("devices.rotateToken"),onClick:t,size:"sm"})})]})}function Wg({device:e,bare:t=!1,onOpenTokenModal:r}){const a=e.tokens??[];return n("div",{class:t?"":"px-4 py-3 bg-[var(--color-bg-tertiary)] border-t border-[var(--color-border)]",children:n("div",{class:"grid grid-cols-1 md:grid-cols-[1fr_auto] gap-4",children:[n("div",{class:"space-y-2 text-sm min-w-0",children:[n(ol,{label:i("devices.deviceId"),children:n("code",{class:"text-xs bg-[var(--color-bg-primary)] px-1 py-0.5 rounded break-all",children:e.deviceId})}),e.clientId&&n(ol,{label:i("devices.clientId"),children:e.clientId}),e.scopes&&e.scopes.length>0&&n(ol,{label:i("devices.scopes"),children:n("span",{class:"text-xs",children:e.scopes.join(", ")})}),n(ol,{label:i("devices.approved"),children:ge(e.approvedAtMs)})]}),n("div",{class:"space-y-2 w-full md:w-48 shrink-0",children:[n("h4",{class:"text-sm font-medium flex items-center gap-2",children:[n(ks,{class:"w-4 h-4"}),i("devices.tokens")]}),a.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("devices.noTokens")}):n("div",{class:"space-y-2",children:a.map(l=>n(A3,{token:l,onRotate:()=>r?.(e)},l.role))})]})]})})}function M3({device:e,isExpanded:t,onToggleExpand:r,onOpenTokenModal:a}){const o=$u(e),l=e.tokens?.length??0;return n("div",{class:"border-b border-[var(--color-border)] last:border-b-0",children:[n("button",{type:"button",class:"w-full flex items-center gap-4 px-4 py-3 hover:bg-[var(--color-bg-tertiary)] text-left",onClick:r,"aria-expanded":t,"aria-label":i("devices.toggleDetails",{name:e.displayName||Wr(e.deviceId)}),children:[n("span",{class:"text-[var(--color-text-muted)]",children:t?n(wt,{class:"w-4 h-4"}):n(qt,{class:"w-4 h-4"})}),n("span",{class:"text-xl w-8 text-center flex-shrink-0",children:Bg(e.platform)}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2",children:n("span",{class:"font-medium truncate",children:e.displayName||Wr(e.deviceId)})}),n("div",{class:"text-sm text-[var(--color-text-muted)] truncate",children:[e.platform,e.remoteIp&&` • ${e.remoteIp}`,e.clientMode&&` • ${e.clientMode}`]})]}),n(X,{variant:Du(o),children:o}),l>0&&n("div",{class:"flex items-center gap-1 text-sm text-[var(--color-text-muted)]",children:[n(ws,{class:"w-4 h-4"}),n("span",{children:l})]}),n("div",{class:"hidden md:flex items-center gap-1 text-sm text-[var(--color-text-muted)]",children:[n(me,{class:"w-4 h-4"}),n("span",{children:ge(e.approvedAtMs)})]})]}),t&&n(Wg,{device:e,onOpenTokenModal:a})]})}const _r=v([]),Lu=v([]),gr=v(!1),Ra=v(null),bc=v(""),Rt=v("all"),xc=v(new Set),Bn=v(null),Jt=v(null),yc=v(!1),I3=[{value:"all",label:()=>i("devices.filters.allRoles")},{value:"operator",label:()=>i("devices.filters.operators")},{value:"node",label:()=>i("devices.filters.nodes")}],R3=B(()=>{const e=_r.value,t=e.filter(jg).length,r=e.filter(Hg).length,a=Lu.value.length;return{total:e.length,operators:t,nodes:r,pending:a}}),$3=B(()=>{let e=_r.value;Rt.value==="operator"?e=e.filter(jg):Rt.value==="node"&&(e=e.filter(Hg));const t=bc.value.toLowerCase().trim();return t&&(e=e.filter(r=>r.deviceId.toLowerCase().includes(t)||r.displayName?.toLowerCase().includes(t)||r.platform?.toLowerCase().includes(t)||r.remoteIp?.toLowerCase().includes(t))),e});async function qr(){gr.value=!0,Ra.value=null;try{const e=await H("device.pair.list",{});_r.value=e.paired,Lu.value=e.pending}catch(e){Ra.value=le(e)}finally{gr.value=!1}}async function D3(e){try{await H("device.pair.approve",{requestId:e}),pe.success(i("devices.approveSuccess")),await qr()}catch(t){pe.error(le(t))}}async function L3(e){try{await H("device.pair.reject",{requestId:e}),pe.success(i("devices.rejectSuccess")),await qr()}catch(t){pe.error(le(t))}}async function N3(e,t){yc.value=!0;try{const r=await H("device.token.rotate",{deviceId:e.deviceId,role:t});pe.success(i("devices.tokenRotated")),await navigator.clipboard.writeText(r.token),pe.success(i("devices.tokenCopied")),Bn.value=null,await qr()}catch(r){pe.error(le(r))}finally{yc.value=!1}}async function O3(e,t){try{await H("device.token.revoke",{deviceId:e.deviceId,role:t}),pe.success(i("devices.tokenRevoked")),Bn.value=null,await qr()}catch(r){pe.error(le(r))}}function F3(e){const t=new Set(xc.value);t.has(e)?t.delete(e):t.add(e),xc.value=t}function P3({request:e}){const t=$u(e);return n(V,{class:"border-[var(--color-warning)] border-2",children:n("div",{class:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4",children:[n("div",{class:"flex items-center gap-3",children:[n("span",{class:"text-2xl",children:Bg(e.platform)}),n("div",{children:[n("div",{class:"flex items-center gap-2 flex-wrap",children:[n("h3",{class:"font-medium",children:e.displayName||Wr(e.deviceId)}),n(X,{variant:Du(t),children:t}),e.isRepair&&n(X,{variant:"warning",children:i("devices.repair")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:[e.platform,e.remoteIp&&` • ${e.remoteIp}`," • ",ge(e.ts)]})]})]}),n("div",{class:"flex gap-2 self-end sm:self-start",children:[n(L,{variant:"primary",size:"sm",icon:on,onClick:()=>D3(e.requestId),children:i("devices.approve")}),n(L,{variant:"danger",size:"sm",icon:Xr,onClick:()=>L3(e.requestId),children:i("devices.reject")})]})]})})}function z3({token:e,device:t,disabled:r}){return n("div",{class:"flex items-center justify-between rounded-lg p-3 bg-[var(--color-bg-tertiary)]",children:[n("div",{children:[n("div",{class:"font-medium",children:e.role}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:[i("devices.tokenCreated"),": ",ge(e.createdAtMs),e.rotatedAtMs&&n(Y,{children:[" ","• ",i("devices.tokenRotatedAt"),": ",ge(e.rotatedAtMs)]})]})]}),n("div",{class:"flex gap-2",children:[n(L,{variant:"secondary",size:"sm",icon:du,onClick:()=>N3(t,e.role),disabled:r,children:i("devices.rotate")}),n(L,{variant:"danger",size:"sm",icon:Gt,onClick:()=>O3(t,e.role),children:i("devices.revoke")})]})]})}function U3(){const e=Bn.value;if(!e)return null;const t=e.tokens??[];return n(Qe,{open:!0,onClose:()=>{Bn.value=null},title:i("devices.tokenManagement"),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("devices.tokenManagementDesc",{name:e.displayName||Wr(e.deviceId)})}),t.length===0?n("p",{class:"text-sm",children:i("devices.noTokens")}):n("div",{class:"space-y-3",children:t.map(r=>n(z3,{token:r,device:e,disabled:yc.value},r.role))})]}),n("div",{class:"mt-6 flex justify-end",children:n(L,{variant:"secondary",onClick:()=>{Bn.value=null},children:i("actions.close")})})]})}function H3(){return n("div",{class:"text-center py-12",children:[n($r,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:i("devices.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:i("devices.emptyDescription")})]})}function j3(e){z(()=>{$.value&&qr()},[$.value]);const t=$3.value,r=R3.value,a=Lu.value;return n(ut,{viewName:i("nav.devices"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[n(kt,{title:i("devices.title"),subtitle:i("devices.description"),actions:n(Q,{icon:n(He,{class:gr.value?"animate-spin":""}),onClick:qr,disabled:gr.value,label:i("actions.refresh")})}),Ra.value&&n(na,{variant:"error",children:Ra.value}),gr.value&&_r.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(ue,{size:"lg"})}),!gr.value&&!Ra.value&&n(Y,{children:[n("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-2 sm:gap-4",children:[n(fe,{icon:$r,label:i("devices.stats.total"),value:r.total,active:Rt.value==="all",onClick:()=>{Rt.value="all"}}),n(fe,{icon:Bt,label:i("devices.stats.operators"),value:r.operators,active:Rt.value==="operator",onClick:()=>{Rt.value="operator"}}),n(fe,{icon:vt,label:i("devices.stats.nodes"),value:r.nodes,active:Rt.value==="node",onClick:()=>{Rt.value="node"}}),n(fe,{icon:me,label:i("devices.stats.pending"),value:r.pending,highlight:r.pending>0})]}),a.length>0&&n("div",{class:"space-y-3",children:[n("h2",{class:"text-lg font-semibold",children:i("devices.pendingRequests")}),a.map(o=>n(P3,{request:o},o.requestId))]}),_r.value.length>0&&n("div",{class:"space-y-3",children:[n("div",{class:"flex items-center gap-3",children:[n(te,{type:"text",placeholder:i("devices.searchPlaceholder"),value:bc.value,onInput:o=>{bc.value=o.target.value},leftElement:n(Pe,{class:"w-4 h-4"}),class:"flex-1"}),n(Me,{value:Rt.value,onChange:o=>{Rt.value=o},options:I3.map(o=>({value:o.value,label:o.label()})),size:"sm",align:"right","aria-label":i("devices.filters.allRoles")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:t.length!==r.total?i("devices.filteredCount",{filtered:t.length,total:r.total}):i("devices.count",{count:r.total})})]}),_r.value.length>0?t.length===0?n(V,{padding:"none",children:n("div",{class:"text-center py-8 text-[var(--color-text-muted)]",children:i("devices.noResults")})}):n(Y,{children:[n("div",{class:"md:hidden space-y-2",children:t.map(o=>n(T3,{device:o,onSelect:l=>{Jt.value=l}},o.deviceId))}),n(V,{padding:"none",class:"hidden md:block overflow-hidden",children:t.map(o=>n(M3,{device:o,isExpanded:xc.value.has(o.deviceId),onToggleExpand:()=>F3(o.deviceId),onOpenTokenModal:l=>{Bn.value=l}},o.deviceId))})]}):n(H3,{})]}),n(Qe,{open:!!Jt.value,onClose:()=>{Jt.value=null},title:Jt.value?.displayName||(Jt.value?Wr(Jt.value.deviceId):""),children:Jt.value&&n(Wg,{device:Jt.value,bare:!0,onOpenTokenModal:o=>{Jt.value=null,Bn.value=o}})}),n(U3,{})]})})})}function Ms(e){return e.disabled?"disabled":e.blockedByAllowlist?"blocked":e.eligible?"eligible":"missing-reqs"}function B3(e){const{missing:t}=e;return t.bins.length>0||t.anyBins.length>0||t.env.length>0||t.config.length>0||t.os.length>0}function W3(e){const t=[],{missing:r}=e;return r.bins.length>0&&t.push(`bins: ${r.bins.join(", ")}`),r.anyBins.length>0&&t.push(`needs one of: ${r.anyBins.join(", ")}`),r.env.length>0&&t.push(`env: ${r.env.join(", ")}`),r.config.length>0&&t.push(`config: ${r.config.join(", ")}`),r.os.length>0&&t.push(`os: ${r.os.join(", ")}`),t}const qg="https://clawhub.ai/api/v1";async function q3(e){const t=new URLSearchParams;t.set("limit",String(e.limit)),e?.cursor&&t.set("cursor",e.cursor);const r=`${qg}/skills${t.toString()?`?${t}`:""}`,a=await fetch(r);if(!a.ok)throw new Error(`ClawHub API error: ${a.status}`);return a.json()}async function G3(e,t){const r=new URLSearchParams({q:e});r.set("limit",String(t.limit));const a=`${qg}/search?${r}`,o=await fetch(a);if(!o.ok)throw new Error(`ClawHub API error: ${o.status}`);return o.json()}const gn=v([]),Dt=v(!1),$a=v(null),es=v(""),ts=v(void 0),Da=v(null),La=v(!1);async function Tl(e=!1){if(!Dt.value){Dt.value=!0,$a.value=null;try{const t=e?ts.value:void 0,r=es.value?await G3(es.value,{limit:20}):await q3({limit:20,cursor:t});e?gn.value=[...gn.value,...r.items]:gn.value=r.items,ts.value=r.nextCursor}catch(t){$a.value=le(t)}finally{Dt.value=!1}}}async function of(){ts.value=void 0,await Tl()}async function K3(e){La.value=!0;try{pe.error(i("skills.clawhub.notYetSupported",{slug:e.slug})),Da.value=null}catch(t){pe.error(le(t))}finally{La.value=!1}}function V3({skill:e}){const t=e.tags?.latest||e.latestVersion?.version||"?";return n(V,{class:"hover:border-[var(--color-border-hover)] transition-colors",children:n("div",{class:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 sm:gap-4",children:[n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2 mb-1 flex-wrap",children:[n("h3",{class:"font-semibold truncate",children:e.displayName}),n(X,{variant:"default",children:t})]}),n("p",{class:"text-sm text-[var(--color-text-muted)] line-clamp-2 mb-3",title:e.summary||void 0,children:e.summary||i("skills.clawhub.noDescription")}),n("div",{class:"flex items-center gap-3 sm:gap-4 text-xs text-[var(--color-text-muted)] flex-wrap",children:[n("span",{class:"flex items-center gap-1",children:[n(Ht,{class:"w-3 h-3"}),e.stats.downloads]}),n("span",{class:"flex items-center gap-1",children:[n(Np,{class:"w-3 h-3"}),e.stats.stars]}),n("span",{class:"flex items-center gap-1",children:[n(mo,{class:"w-3 h-3"}),ge(e.updatedAt)]})]})]}),n(L,{variant:"secondary",size:"sm",icon:Ht,onClick:()=>{Da.value=e},class:"self-start sm:flex-shrink-0",children:i("skills.clawhub.install")})]})})}function Y3(){const e=Da.value;if(!e)return null;const t=e.tags?.latest||e.latestVersion?.version||"?",r=e.latestVersion?.changelog;return n(Qe,{open:!0,onClose:()=>{Da.value=null},title:i("skills.clawhub.installTitle",{name:e.displayName}),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("skills.clawhub.installConfirm",{name:e.displayName,version:t})}),e.summary&&n("div",{class:"p-3 bg-[var(--color-bg-tertiary)] rounded-lg text-sm",children:e.summary}),r&&n("div",{children:[n("h4",{class:"text-sm font-medium mb-2",children:i("skills.clawhub.changelog")}),n("div",{class:"p-3 bg-[var(--color-bg-tertiary)] rounded-lg text-xs max-h-32 overflow-y-auto whitespace-pre-wrap",children:r})]}),n("div",{class:"flex items-center gap-4 text-sm text-[var(--color-text-muted)]",children:[n("span",{class:"flex items-center gap-1",children:[n(Ht,{class:"w-4 h-4"}),e.stats.downloads," ",i("skills.clawhub.downloads")]}),n("span",{class:"flex items-center gap-1",children:[n(Np,{class:"w-4 h-4"}),e.stats.stars," ",i("skills.clawhub.stars")]})]}),n("a",{href:`https://clawhub.ai/skills/${e.slug}`,target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 text-sm text-[var(--color-accent)] hover:underline",children:[i("skills.clawhub.viewOnClawhub"),n(yo,{class:"w-3 h-3"})]})]}),n("div",{class:"mt-6 flex justify-end gap-3",children:[n(L,{variant:"secondary",onClick:()=>{Da.value=null},disabled:La.value,children:i("actions.cancel")}),n(L,{variant:"primary",icon:Ht,onClick:()=>K3(e),disabled:La.value,children:La.value?i("skills.clawhub.installing"):i("skills.clawhub.install")})]})]})}function J3(){return n("div",{class:"text-center py-12",children:[n(Bt,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:i("skills.clawhub.noResults")}),n("p",{class:"text-[var(--color-text-muted)]",children:i("skills.clawhub.tryDifferentSearch")})]})}function X3(){z(()=>{Tl()},[]);const e=!!ts.value;return n("div",{class:"space-y-6",children:[n("div",{class:"flex items-center gap-2 sm:gap-4",children:[n("div",{class:"flex-1 min-w-0",children:n(te,{type:"text",placeholder:i("skills.clawhub.searchPlaceholder"),value:es.value,onInput:t=>{es.value=t.target.value},onKeyDown:t=>{t.key==="Enter"&&of()},leftElement:n(Pe,{class:"w-4 h-4"})})}),n(L,{variant:"secondary",onClick:of,disabled:Dt.value,class:"flex-shrink-0",children:[n("span",{class:"hidden sm:inline",children:i("actions.search")}),n(Pe,{class:"w-4 h-4 sm:hidden"})]}),n(Q,{icon:n(He,{class:Dt.value?"animate-spin":""}),label:i("actions.refresh"),onClick:()=>Tl(),disabled:Dt.value})]}),$a.value&&n(na,{variant:"error",children:$a.value}),Dt.value&&gn.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(ue,{size:"lg"})}),gn.value.length>0&&n("div",{class:"grid gap-4",children:gn.value.map(t=>n(V3,{skill:t},t.slug))}),!Dt.value&&!$a.value&&gn.value.length===0&&n(J3,{}),e&&!Dt.value&&n("div",{class:"flex justify-center",children:n(L,{variant:"secondary",onClick:()=>Tl(!0),children:i("actions.showMore")})}),Dt.value&&gn.value.length>0&&n("div",{class:"flex justify-center py-4",children:n(ue,{size:"md"})}),n(Y3,{})]})}const ll=v(!1);function Z3({skill:e,onClose:t,onSuccess:r}){if(!e)return null;const a=async o=>{ll.value=!0;try{const l=await H("skills.install",{name:e.name,installId:o,timeoutMs:6e4});l.ok?(pe.success(i("skills.installSuccess",{name:e.name})),t(),r()):pe.error(l.message||i("skills.installFailed"))}catch(l){pe.error(le(l))}finally{ll.value=!1}};return n(Qe,{open:!0,onClose:t,title:i("skills.installTitle",{name:e.name}),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("skills.installDescription")}),n("div",{class:"space-y-2",children:e.install.map(o=>n("button",{type:"button",class:"w-full flex items-center gap-3 p-3 rounded-lg border border-[var(--color-border)] hover:bg-[var(--color-bg-tertiary)] transition-colors text-left disabled:opacity-50 disabled:cursor-not-allowed",onClick:()=>a(o.id),disabled:ll.value,children:[n(Ht,{class:"w-5 h-5 text-[var(--color-accent)]"}),n("div",{class:"flex-1",children:[n("div",{class:"font-medium",children:o.label}),o.bins.length>0&&n("div",{class:"text-xs text-[var(--color-text-muted)]",children:[i("skills.providesBins"),": ",o.bins.join(", ")]})]}),ll.value&&n(ue,{size:"sm"})]},o.id))})]}),n("div",{class:"mt-6 flex justify-end",children:n(L,{variant:"secondary",onClick:t,children:i("actions.cancel")})})]})}function lf({label:e,children:t}){return n("div",{children:[n("span",{class:"text-[var(--color-text-muted)]",children:[e,":"]})," ",t]})}function Gg({skill:e,onInstall:t,bare:r=!1}){const a=W3(e),o=e.install.length>0&&B3(e);return n("div",{class:r?"":"px-4 py-3 bg-[var(--color-bg-tertiary)] border-t border-[var(--color-border)]",children:[n("p",{class:"text-sm text-[var(--color-text-secondary)] mb-4",children:e.description}),n("div",{class:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[n("div",{class:"space-y-2",children:[n(lf,{label:i("skills.skillKey"),children:n("code",{class:"text-xs bg-[var(--color-bg-primary)] px-1 py-0.5 rounded",children:e.skillKey})}),n(lf,{label:i("skills.location"),children:n("span",{class:"text-xs break-all",children:e.filePath})}),e.homepage&&n("div",{children:n("a",{href:e.homepage,target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-1 text-[var(--color-accent)] hover:underline",children:[i("skills.homepage"),n(yo,{class:"w-3 h-3"})]})})]}),n("div",{class:"space-y-2",children:[a.length>0&&n("div",{children:[n("span",{class:"text-[var(--color-warning)] font-medium",children:[i("skills.missingRequirements"),":"]}),n("ul",{class:"list-disc list-inside text-xs mt-1 space-y-0.5",children:a.map(s=>n("li",{children:s},s))})]}),e.blockedByAllowlist&&n("div",{class:"flex items-center gap-2 text-[var(--color-error)]",children:[n(Sy,{class:"w-4 h-4"}),n("span",{children:i("skills.blockedByAllowlist")})]}),o&&n("div",{class:"pt-2",children:n(L,{variant:"secondary",size:"sm",icon:Ht,onClick:()=>t(e),children:i("skills.installDeps")})}),e.primaryEnv&&n("div",{class:"text-xs text-[var(--color-text-muted)]",children:[i("skills.primaryEnv"),": ",n("code",{children:e.primaryEnv})]})]})]})]})}const Q3={"openclaw-bundled":by,"openclaw-managed":cy,"openclaw-workspace":Pl,"openclaw-extra":Pl},e_={"openclaw-bundled":"skills.source.bundled","openclaw-managed":"skills.source.managed","openclaw-workspace":"skills.source.workspace","openclaw-extra":"skills.source.extra"};function Kg(e){const t={eligible:{variant:"success",key:"skills.status.eligible"},disabled:{variant:"default",key:"skills.status.disabled"},"missing-reqs":{variant:"warning",key:"skills.status.missingReqs"},blocked:{variant:"error",key:"skills.status.blocked"}},{variant:r,key:a}=t[e];return{variant:r,label:i(a)}}function Vg(e){return Q3[e]||uu}function Yg(e){const t=e_[e];return t?i(t):e}function t_({skill:e,onToggleExpand:t,onToggleEnabled:r}){const a=Ms(e),o=Kg(a),l=Vg(e.source);return n(So,{icon:()=>n("span",{class:"text-lg",children:e.emoji||"🔧"}),iconVariant:a==="eligible"?"success":a==="missing-reqs"?"warning":"default",title:e.name,subtitle:e.description,badges:n(Y,{children:[n(X,{variant:o.variant,size:"sm",children:o.label}),e.always&&n("span",{class:"text-xs text-[var(--color-text-muted)]",title:i("skills.alwaysActive"),children:"⚡"})]}),meta:[{icon:l,value:Yg(e.source)}],actions:n("div",{onClick:s=>s.stopPropagation(),onKeyDown:s=>s.stopPropagation(),role:"presentation",children:n(Ke,{checked:!e.disabled,onChange:r,size:"sm","aria-label":e.disabled?i("skills.enable"):i("skills.disable")})}),onClick:t})}function n_({skill:e,isExpanded:t,onToggleExpand:r,onToggleEnabled:a,onInstall:o}){const l=Ms(e),s=Kg(l),c=Vg(e.source);return n("div",{class:"border-b border-[var(--color-border)] last:border-b-0",children:[n("button",{type:"button",class:"w-full flex items-center gap-4 px-4 py-3 hover:bg-[var(--color-bg-tertiary)] text-left",onClick:r,"aria-expanded":t,children:[n("span",{class:"text-[var(--color-text-muted)]",children:t?n(wt,{class:"w-4 h-4"}):n(qt,{class:"w-4 h-4"})}),n("span",{class:"text-xl w-8 text-center flex-shrink-0",children:e.emoji||"🔧"}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:"font-medium truncate",children:e.name}),e.always&&n("span",{class:"text-xs text-[var(--color-text-muted)]",title:i("skills.alwaysActive"),children:"⚡"})]}),n("div",{class:"text-sm text-[var(--color-text-muted)] truncate",title:e.description,children:e.description})]}),n("div",{class:"hidden md:flex items-center gap-1 text-sm text-[var(--color-text-muted)]",children:[n(c,{class:"w-4 h-4"}),n("span",{children:Yg(e.source)})]}),n("div",{class:"w-24 flex justify-end",children:n(X,{variant:s.variant,children:s.label})}),n("div",{onClick:u=>u.stopPropagation(),onKeyDown:u=>u.stopPropagation(),role:"presentation",children:n(Ke,{checked:!e.disabled,onChange:a,size:"sm","aria-label":e.disabled?i("skills.enable"):i("skills.disable")})})]}),t&&n(Gg,{skill:e,onInstall:o})]})}const r_=[{value:"all",label:()=>i("skills.filters.allSources")},{value:"openclaw-bundled",label:()=>i("skills.source.bundled")},{value:"openclaw-workspace",label:()=>i("skills.source.workspace")},{value:"openclaw-managed",label:()=>i("skills.source.managed")},{value:"openclaw-extra",label:()=>i("skills.source.extra")}],wc=v("installed"),Gr=v([]),kc=v(""),Jg=v(""),vr=v(!1),Na=v(null),Oa=v(""),Sr=v("all"),nt=v("all"),_c=v(new Set),sl=v(null),Rn=v(null),a_=B(()=>{const e=Gr.value;let t=0,r=0,a=0;for(const o of e){const l=Ms(o);l==="eligible"?t++:l==="disabled"?r++:l==="missing-reqs"&&a++}return{total:e.length,eligible:t,disabled:r,missingReqs:a}}),o_=B(()=>{let e=Gr.value;const t=Oa.value.toLowerCase().trim();return t&&(e=e.filter(r=>r.name.toLowerCase().includes(t)||r.description.toLowerCase().includes(t)||r.skillKey.toLowerCase().includes(t))),Sr.value!=="all"&&(e=e.filter(r=>r.source===Sr.value)),nt.value!=="all"&&(e=e.filter(r=>Ms(r)===nt.value)),e});async function fi(){vr.value=!0,Na.value=null;try{const e=await H("skills.status",{});Gr.value=e.skills,kc.value=e.workspaceDir,Jg.value=e.managedSkillsDir}catch(e){Na.value=le(e)}finally{vr.value=!1}}async function sf(e){const t=e.disabled;try{await H("skills.update",{skillKey:e.skillKey,enabled:t}),Gr.value=Gr.value.map(r=>r.skillKey===e.skillKey?{...r,disabled:!t}:r),pe.success(t?i("skills.enabledSuccess",{name:e.name}):i("skills.disabledSuccess",{name:e.name}))}catch(r){pe.error(le(r))}}function l_(e){const t=new Set(_c.value);t.has(e)?t.delete(e):t.add(e),_c.value=t}function s_(){Oa.value="",Sr.value="all",nt.value="all"}function cf({tab:e,label:t,active:r}){return n("button",{type:"button",role:"tab","aria-selected":r,onClick:()=>{wc.value=e},class:`px-4 py-2 text-sm font-medium rounded-lg transition-colors ${r?"bg-[var(--color-accent)] text-white":"text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-tertiary)]"}`,children:t})}function i_({hasFilters:e}){return n("div",{class:"text-center py-12",children:[n(Pe,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:i(e?"skills.noResults":"skills.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:i(e?"skills.noResultsDescription":"skills.emptyDescription")}),e&&n("button",{type:"button",onClick:s_,class:"text-[var(--color-accent)] hover:underline",children:i("skills.clearFilters")})]})}function c_(e){z(()=>{$.value&&wc.value==="installed"&&fi()},[$.value]);const t=o_.value,r=a_.value,a=wc.value,o=!!Oa.value||Sr.value!=="all"||nt.value!=="all";return n(ut,{viewName:i("nav.skills"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[n(kt,{title:i("skills.title"),subtitle:i("skills.description"),actions:a==="installed"?n(Q,{icon:n(He,{class:vr.value?"animate-spin":""}),onClick:fi,disabled:vr.value,label:i("actions.refresh")}):void 0}),n("div",{class:"flex gap-2",role:"tablist",children:[n(cf,{tab:"installed",label:i("skills.tabs.installed"),active:a==="installed"}),n(cf,{tab:"clawhub",label:i("skills.tabs.clawhub"),active:a==="clawhub"})]}),a==="clawhub"&&n(X3,{}),a==="installed"&&n(Y,{children:[Na.value&&n(na,{variant:"error",children:Na.value}),vr.value&&Gr.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(ue,{size:"lg"})}),!vr.value&&!Na.value&&n(Y,{children:[n("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-2 sm:gap-4",children:[n(fe,{icon:uu,label:i("skills.stats.total"),value:r.total,active:nt.value==="all",onClick:()=>{nt.value="all"}}),n(fe,{icon:bo,label:i("skills.stats.eligible"),value:r.eligible,active:nt.value==="eligible",onClick:()=>{nt.value="eligible"}}),n(fe,{icon:xo,label:i("skills.stats.disabled"),value:r.disabled,active:nt.value==="disabled",onClick:()=>{nt.value="disabled"}}),n(fe,{icon:tr,label:i("skills.stats.missingReqs"),value:r.missingReqs,active:nt.value==="missing-reqs",highlight:r.missingReqs>0,onClick:()=>{nt.value="missing-reqs"}})]}),n("div",{class:"space-y-3",children:[n("div",{class:"flex items-center gap-3",children:[n(te,{type:"text",placeholder:i("skills.searchPlaceholder"),value:Oa.value,onInput:l=>{Oa.value=l.target.value},leftElement:n(Pe,{class:"w-4 h-4"}),class:"flex-1"}),n(Me,{value:Sr.value,onChange:l=>{Sr.value=l},options:r_.map(l=>({value:l.value,label:l.label()})),size:"sm",align:"right","aria-label":i("skills.filters.allSources")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:t.length!==r.total?i("skills.filteredCount",{filtered:t.length,total:r.total}):i("skills.count",{count:r.total})})]}),t.length===0?n(V,{padding:"none",children:n(i_,{hasFilters:o})}):n(Y,{children:[n("div",{class:"md:hidden space-y-2",children:t.map(l=>n(t_,{skill:l,onToggleExpand:()=>{Rn.value=l},onToggleEnabled:()=>sf(l)},l.skillKey))}),n(V,{padding:"none",class:"hidden md:block overflow-hidden",children:t.map(l=>n(n_,{skill:l,isExpanded:_c.value.has(l.skillKey),onToggleExpand:()=>l_(l.skillKey),onToggleEnabled:()=>sf(l),onInstall:s=>{sl.value=s}},l.skillKey))})]}),kc.value&&n("div",{class:"text-xs text-[var(--color-text-muted)] space-y-1",children:[n("div",{children:[i("skills.workspaceDir"),": ",n("code",{children:kc.value})]}),n("div",{children:[i("skills.managedDir"),": ",n("code",{children:Jg.value})]})]})]})]}),n(Qe,{open:!!Rn.value,onClose:()=>{Rn.value=null},title:Rn.value?.name||"",children:Rn.value&&n(Gg,{skill:Rn.value,onInstall:l=>{Rn.value=null,sl.value=l},bare:!0})}),n(Z3,{skill:sl.value,onClose:()=>{sl.value=null},onSuccess:fi})]})})})}function u_(e){const t=Math.floor(e/1e3),r=Math.floor(t/60),a=Math.floor(r/60),o=Math.floor(a/24);if(o>0){const l=a%24;return`${o}d ${l}h`}if(a>0){const l=r%60;return`${a}h ${l}m`}return r>0?`${r}m`:`${t}s`}function ur(e){return e==null||!Number.isFinite(e)?"0":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}function d_(e){return e==null||!Number.isFinite(e)?"$0.00":e>=1?`$${e.toFixed(2)}`:e>=.01?`$${e.toFixed(2)}`:e>0?`$${e.toFixed(4)}`:"$0.00"}const Is=v(null),Rs=v(null),Fa=v(!1),ns=v(!1),rs=v(null),Nu=v(30);async function h_(){Fa.value=!0,rs.value=null;try{const e=await H("health",{probe:!1});Is.value=e}catch(e){rs.value=le(e),pe.error(i("stats.loadError"))}finally{Fa.value=!1}}async function Xg(e=30){ns.value=!0;try{const t=await H("usage.cost",{days:e});Rs.value=t,Nu.value=e}catch{}finally{ns.value=!1}}async function uf(){await Promise.all([h_(),Xg(Nu.value)])}function f_(){const e=Uc.value;return n(V,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-accent)]/10",children:n(Vn,{class:"w-5 h-5 text-[var(--color-accent)]"})}),n("div",{children:[n("h3",{class:"font-semibold",children:i("stats.gateway.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:Yr.value||i("stats.gateway.unknown")})]}),st.value&&n(X,{variant:"default",size:"sm",class:"ml-auto",children:np(st.value)})]}),n("div",{class:"grid grid-cols-2 gap-4",children:[n("div",{class:"flex items-center gap-2",children:[n(me,{class:"w-4 h-4 text-[var(--color-text-muted)]"}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:i("stats.gateway.uptime")}),n("div",{class:"font-medium",children:e!=null?u_(e):"-"})]})]}),n("div",{class:"flex items-center gap-2",children:[n(xn,{class:"w-4 h-4 text-[var(--color-text-muted)]"}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:i("stats.gateway.sessions")}),n("div",{class:"font-medium",children:Is.value?.sessions?.count??"-"})]})]})]}),(_a.value||Sa.value)&&n("div",{class:"mt-4 pt-4 border-t border-[var(--color-border)] space-y-2",children:[_a.value&&n("div",{class:"flex items-center gap-2 text-xs text-[var(--color-text-muted)]",children:[n(jt,{class:"w-3.5 h-3.5"}),n("span",{class:"truncate font-mono",children:_a.value})]}),Sa.value&&n("div",{class:"flex items-center gap-2 text-xs text-[var(--color-text-muted)]",children:[n(uy,{class:"w-3.5 h-3.5"}),n("span",{class:"truncate font-mono",children:Sa.value})]})]})]})}function p_(){const e=Rs.value;if(!e)return n(V,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-success)]/10",children:n(Jd,{class:"w-5 h-5 text-[var(--color-success)]"})}),n("h3",{class:"font-semibold",children:i("stats.usage.title")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:ns.value?i("status.loading"):i("stats.usage.unavailable")})]});const t=e.totals;return n(V,{padding:"md",children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-3",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-success)]/10",children:n(Jd,{class:"w-5 h-5 text-[var(--color-success)]"})}),n("div",{children:[n("h3",{class:"font-semibold",children:i("stats.usage.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("stats.usage.period",{days:e.days})})]})]}),t.totalCost>0&&n("div",{class:"text-right",children:[n("div",{class:"text-2xl font-bold text-[var(--color-success)]",children:d_(t.totalCost)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:i("stats.usage.totalCost")})]})]}),n("div",{class:"grid grid-cols-3 gap-4",children:[n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:i("stats.usage.input")}),n("div",{class:"font-medium",children:ur(t.input)})]}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:i("stats.usage.output")}),n("div",{class:"font-medium",children:ur(t.output)})]}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:i("stats.usage.total")}),n("div",{class:"font-medium",children:ur(t.totalTokens)})]})]}),(t.cacheRead>0||t.cacheWrite>0)&&n("div",{class:"mt-4 pt-4 border-t border-[var(--color-border)]",children:[n("div",{class:"text-sm text-[var(--color-text-muted)] mb-2",children:i("stats.usage.cache")}),n("div",{class:"grid grid-cols-2 gap-4",children:[n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:i("stats.usage.cacheRead")}),n("div",{class:"font-medium",children:ur(t.cacheRead)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:i("stats.usage.cacheWrite")}),n("div",{class:"font-medium",children:ur(t.cacheWrite)})]})]})]})]})}function g_(){const e=Rs.value;if(!e||e.daily.length===0)return null;const t=e.daily.slice(-14),r=Math.max(...t.map(a=>a.totalTokens),1);return n(V,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-info)]/10",children:n(mo,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:i("stats.daily.title")})]}),n("div",{class:"space-y-2",children:t.map(a=>{const o=a.totalTokens/r*100,s=new Date(a.date).toLocaleDateString(void 0,{month:"short",day:"numeric"});return n("div",{class:"flex items-center gap-3",children:[n("div",{class:"w-20 text-xs text-[var(--color-text-muted)] truncate",children:s}),n("div",{class:"flex-1 h-4 bg-[var(--color-bg-tertiary)] rounded-full overflow-hidden",children:n("div",{class:"h-full bg-[var(--color-accent)] rounded-full transition-all",style:{width:`${Math.max(o,1)}%`}})}),n("div",{class:"w-16 text-xs text-right font-mono",children:ur(a.totalTokens)})]},a.date)})})]})}function v_(){const e=Is.value;return!e?.agents||e.agents.length===0?null:n(V,{padding:"md",children:[n("div",{class:"flex items-center gap-3 mb-4",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-warning)]/10",children:n(Fl,{class:"w-5 h-5 text-[var(--color-warning)]"})}),n("h3",{class:"font-semibold",children:i("stats.agents.title")})]}),n("div",{class:"space-y-3",children:e.agents.map(t=>n("div",{class:"flex items-center justify-between py-2 px-3 bg-[var(--color-bg-secondary)] rounded-lg",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:"font-medium",children:t.name||t.agentId}),t.isDefault&&n(X,{variant:"success",size:"sm",children:i("stats.agents.default")})]}),n("div",{class:"flex items-center gap-4 text-sm text-[var(--color-text-muted)]",children:[n("span",{children:[t.sessions.count," ",i("stats.agents.sessions")]}),t.heartbeat.enabled&&n("span",{class:"flex items-center gap-1",children:[n(ln,{class:"w-3.5 h-3.5"}),t.heartbeat.every]})]})]},t.agentId))})]})}function m_(e){return z(()=>{$.value&&uf()},[$.value]),n(ut,{viewName:i("nav.stats"),children:n("div",{class:"flex-1 overflow-y-auto p-6",children:n("div",{class:"max-w-4xl mx-auto space-y-6",children:[n(kt,{title:i("stats.title"),subtitle:i("stats.description"),actions:n(Q,{icon:n(He,{class:`w-4 h-4 ${Fa.value?"animate-spin":""}`}),label:i("actions.refresh"),onClick:()=>uf(),disabled:Fa.value||!$.value,variant:"ghost"})}),rs.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:rs.value}),Fa.value&&!Is.value||!$.value?n("div",{class:"flex justify-center py-16",children:n(ue,{size:"lg",label:$.value?void 0:i("status.connecting")})}):n("div",{class:"grid gap-6 md:grid-cols-2",children:[n(f_,{}),n(p_,{}),n("div",{class:"md:col-span-2",children:n(g_,{})}),n("div",{class:"md:col-span-2",children:n(v_,{})})]}),Rs.value&&n("div",{class:"flex justify-center gap-2",children:[7,14,30,90].map(t=>n(L,{variant:Nu.value===t?"primary":"ghost",size:"sm",onClick:()=>Xg(t),disabled:ns.value,children:[t,"d"]},t))})]})})})}const pi={title:"Discord",path:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z",hex:"5865F2"},gi={title:"Google Chat",path:"M1.637 0C.733 0 0 .733 0 1.637v16.5c0 .904.733 1.636 1.637 1.636h3.955v3.323c0 .804.97 1.207 1.539.638l3.963-3.96h11.27c.903 0 1.636-.733 1.636-1.637V5.592L18.408 0Zm3.955 5.592h12.816v8.59H8.455l-2.863 2.863Z",hex:"34A853"},vi={title:"Mastodon",path:"M23.268 5.313c-.35-2.578-2.617-4.61-5.304-5.004C17.51.242 15.792 0 11.813 0h-.03c-3.98 0-4.835.242-5.288.309C3.882.692 1.496 2.518.917 5.127.64 6.412.61 7.837.661 9.143c.074 1.874.088 3.745.26 5.611.118 1.24.325 2.47.62 3.68.55 2.237 2.777 4.098 4.96 4.857 2.336.792 4.849.923 7.256.38.265-.061.527-.132.786-.213.585-.184 1.27-.39 1.774-.753a.057.057 0 0 0 .023-.043v-1.809a.052.052 0 0 0-.02-.041.053.053 0 0 0-.046-.01 20.282 20.282 0 0 1-4.709.545c-2.73 0-3.463-1.284-3.674-1.818a5.593 5.593 0 0 1-.319-1.433.053.053 0 0 1 .066-.054c1.517.363 3.072.546 4.632.546.376 0 .75 0 1.125-.01 1.57-.044 3.224-.124 4.768-.422.038-.008.077-.015.11-.024 2.435-.464 4.753-1.92 4.989-5.604.008-.145.03-1.52.03-1.67.002-.512.167-3.63-.024-5.545zm-3.748 9.195h-2.561V8.29c0-1.309-.55-1.976-1.67-1.976-1.23 0-1.846.79-1.846 2.35v3.403h-2.546V8.663c0-1.56-.617-2.35-1.848-2.35-1.112 0-1.668.668-1.67 1.977v6.218H4.822V8.102c0-1.31.337-2.35 1.011-3.12.696-.77 1.608-1.164 2.74-1.164 1.311 0 2.302.5 2.962 1.498l.638 1.06.638-1.06c.66-.999 1.65-1.498 2.96-1.498 1.13 0 2.043.395 2.74 1.164.675.77 1.012 1.81 1.012 3.12z",hex:"6364FF"},mi={title:"Matrix",path:"M.632.55v22.9H2.28V24H0V0h2.28v.55zm7.043 7.26v1.157h.033c.309-.443.683-.784 1.117-1.024.433-.245.936-.365 1.5-.365.54 0 1.033.107 1.481.314.448.208.785.582 1.02 1.108.254-.374.6-.706 1.034-.992.434-.287.95-.43 1.546-.43.453 0 .872.056 1.26.167.388.11.716.286.993.53.276.245.489.559.646.951.152.392.23.863.23 1.417v5.728h-2.349V11.52c0-.286-.01-.559-.032-.812a1.755 1.755 0 0 0-.18-.66 1.106 1.106 0 0 0-.438-.448c-.194-.11-.457-.166-.785-.166-.332 0-.6.064-.803.189a1.38 1.38 0 0 0-.48.499 1.946 1.946 0 0 0-.231.696 5.56 5.56 0 0 0-.06.785v4.768h-2.35v-4.8c0-.254-.004-.503-.018-.752a2.074 2.074 0 0 0-.143-.688 1.052 1.052 0 0 0-.415-.503c-.194-.125-.476-.19-.854-.19-.111 0-.259.024-.439.074-.18.051-.36.143-.53.282-.171.138-.319.337-.439.595-.12.259-.18.6-.18 1.02v4.966H5.46V7.81zm15.693 15.64V.55H21.72V0H24v24h-2.28v-.55z",hex:"000000"},bi={title:"Signal",path:"M12 0q-.934 0-1.83.139l.17 1.111a11 11 0 0 1 3.32 0l.172-1.111A12 12 0 0 0 12 0M9.152.34A12 12 0 0 0 5.77 1.742l.584.961a10.8 10.8 0 0 1 3.066-1.27zm5.696 0-.268 1.094a10.8 10.8 0 0 1 3.066 1.27l.584-.962A12 12 0 0 0 14.848.34M12 2.25a9.75 9.75 0 0 0-8.539 14.459c.074.134.1.292.064.441l-1.013 4.338 4.338-1.013a.62.62 0 0 1 .441.064A9.7 9.7 0 0 0 12 21.75c5.385 0 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25m-7.092.068a12 12 0 0 0-2.59 2.59l.909.664a11 11 0 0 1 2.345-2.345zm14.184 0-.664.909a11 11 0 0 1 2.345 2.345l.909-.664a12 12 0 0 0-2.59-2.59M1.742 5.77A12 12 0 0 0 .34 9.152l1.094.268a10.8 10.8 0 0 1 1.269-3.066zm20.516 0-.961.584a10.8 10.8 0 0 1 1.27 3.066l1.093-.268a12 12 0 0 0-1.402-3.383M.138 10.168A12 12 0 0 0 0 12q0 .934.139 1.83l1.111-.17A11 11 0 0 1 1.125 12q0-.848.125-1.66zm23.723.002-1.111.17q.125.812.125 1.66c0 .848-.042 1.12-.125 1.66l1.111.172a12.1 12.1 0 0 0 0-3.662M1.434 14.58l-1.094.268a12 12 0 0 0 .96 2.591l-.265 1.14 1.096.255.36-1.539-.188-.365a10.8 10.8 0 0 1-.87-2.35m21.133 0a10.8 10.8 0 0 1-1.27 3.067l.962.584a12 12 0 0 0 1.402-3.383zm-1.793 3.848a11 11 0 0 1-2.345 2.345l.664.909a12 12 0 0 0 2.59-2.59zm-19.959 1.1L.357 21.48a1.8 1.8 0 0 0 2.162 2.161l1.954-.455-.256-1.095-1.953.455a.675.675 0 0 1-.81-.81l.454-1.954zm16.832 1.769a10.8 10.8 0 0 1-3.066 1.27l.268 1.093a12 12 0 0 0 3.382-1.402zm-10.94.213-1.54.36.256 1.095 1.139-.266c.814.415 1.683.74 2.591.961l.268-1.094a10.8 10.8 0 0 1-2.35-.869zm3.634 1.24-.172 1.111a12.1 12.1 0 0 0 3.662 0l-.17-1.111q-.812.125-1.66.125a11 11 0 0 1-1.66-.125",hex:"3B45FD"},xi={title:"Telegram",path:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z",hex:"26A5E4"},yi={title:"WhatsApp",path:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z",hex:"25D366"},b_="M12 2C6.477 2 2 5.813 2 10.5c0 2.34 1.06 4.463 2.777 6.003L3.5 21l5.025-2.512c1.078.327 2.24.512 3.475.512 5.523 0 10-3.813 10-8.5S17.523 2 12 2z",x_=[{path:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zm1.271 0a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313z",color:"#E01E5A"},{path:"M8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zm0 1.271a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312z",color:"#36C5F0"},{path:"M18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zm-1.27 0a2.528 2.528 0 0 1-2.522 2.521 2.528 2.528 0 0 1-2.521-2.521V2.522A2.528 2.528 0 0 1 15.164 0a2.528 2.528 0 0 1 2.522 2.522v6.312z",color:"#2EB67D"},{path:"M15.164 18.956a2.528 2.528 0 0 1 2.522 2.522A2.528 2.528 0 0 1 15.164 24a2.528 2.528 0 0 1-2.521-2.522v-2.522h2.521zm0-1.27a2.528 2.528 0 0 1-2.521-2.522 2.528 2.528 0 0 1 2.521-2.521h6.314A2.528 2.528 0 0 1 24 15.164a2.528 2.528 0 0 1-2.522 2.522h-6.314z",color:"#ECB22E"}],y_="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z",w_="M12 2C6.48 2 2 6.48 2 12c0 2.08.64 4.01 1.73 5.6L2 22l4.4-1.73C8 21.36 9.92 22 12 22c5.52 0 10-4.48 10-10S17.52 2 12 2z",k_=[{cx:7.5,cy:12,r:1.5},{cx:12,cy:12,r:1.5},{cx:16.5,cy:12,r:1.5}],__={telegram:{path:xi.path,hex:xi.hex,title:xi.title},discord:{path:pi.path,hex:pi.hex,title:pi.title},signal:{path:bi.path,hex:bi.hex,title:bi.title},whatsapp:{path:yi.path,hex:yi.hex,title:yi.title},googlechat:{path:gi.path,hex:gi.hex,title:gi.title},matrix:{path:mi.path,hex:mi.hex,title:mi.title},mastodon:{path:vi.path,hex:vi.hex,title:vi.title},imessage:{path:b_,hex:"34C759",title:"iMessage"},nostr:{path:y_,hex:"8B5CF6",title:"Nostr"}};function S_({channelId:e,size:t=20,class:r,colored:a=!0}){const o=e.toLowerCase();if(o==="slack")return n("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,class:r,"aria-label":"Slack",children:[n("title",{children:"Slack"}),x_.map((c,u)=>n("path",{fill:a?c.color:"currentColor",d:c.path},u))]});if(o==="bluebubbles"){const c=a?"#2196F3":"currentColor";return n("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,class:r,"aria-label":"BlueBubbles",children:[n("title",{children:"BlueBubbles"}),n("path",{fill:"none",stroke:c,"stroke-width":"2",d:w_}),k_.map((u,d)=>n("circle",{cx:u.cx,cy:u.cy,r:u.r,fill:c},d))]})}if(o==="webchat")return n(Bt,{class:r,style:{width:t,height:t,color:a?"#6366f1":"currentColor"}});const l=__[o];if(!l)return n(Bt,{class:r,style:{width:t,height:t}});const s=a?`#${l.hex}`:"currentColor";return n("svg",{role:"img",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,class:r,"aria-label":l.title,children:[n("title",{children:l.title}),n("path",{fill:s,d:l.path})]})}function C_(e){return e.length===0?"not-configured":e.some(l=>l.lastError)?"error":e.some(l=>l.connected)?"connected":e.some(l=>l.enabled!==!1)?e.some(l=>l.configured)?"configured":"not-configured":"disabled"}function E_(e){return e.channelOrder.map(t=>{const r=e.channelAccounts[t]||[];return{id:t,label:e.channelLabels[t]||t,detailLabel:e.channelDetailLabels[t]||e.channelLabels[t]||t,systemImage:e.channelSystemImages[t],summary:e.channels[t]||{},accounts:r,defaultAccountId:e.channelDefaultAccountId[t]||"default",status:C_(r)}})}function Zg(e){return e.accounts.reduce((t,r)=>{const a=r.lastInboundAt??0,o=r.lastOutboundAt??0;return Math.max(t,a,o)},0)}const Ln=v([]),$t=v(!1),Pa=v(!1),za=v(null),Nt=v(null),as=v(!1);function T_(e){switch(e){case"connected":return{variant:"success",label:i("channels.status.connected")};case"configured":return{variant:"warning",label:i("channels.status.configured")};case"not-configured":return{variant:"default",label:i("channels.status.notConfigured")};case"disabled":return{variant:"default",label:i("channels.status.disabled")};case"error":return{variant:"error",label:i("channels.status.error")}}}async function Al(e=!1){e?Pa.value=!0:$t.value=!0,za.value=null;try{const t=await H("channels.status",{probe:e,timeoutMs:e?15e3:1e4});Ln.value=E_(t)}catch(t){za.value=le(t)}finally{$t.value=!1,Pa.value=!1}}async function A_(){if(Nt.value){as.value=!0;try{await H("channels.logout",{channel:Nt.value.channel,accountId:Nt.value.accountId}),pe.success(i("channels.logoutSuccess",{channel:Nt.value.label})),Nt.value=null,Al()}catch(e){pe.error(le(e))}finally{as.value=!1}}}const M_=B(()=>{const e=Ln.value,t=Date.now()-1440*60*1e3;return{total:e.length,active:e.filter(r=>Zg(r)>t).length,errors:e.filter(r=>r.status==="error").length}});function I_({account:e,channelId:t,channelLabel:r}){const a=e.connected===!0,o=!!e.lastError,l=e.bot?.username;return n("div",{class:"flex items-center justify-between py-2 px-3 bg-[var(--color-bg-secondary)] rounded-lg",children:[n("div",{class:"flex items-center gap-3 min-w-0",children:[n("div",{class:`w-2 h-2 rounded-full flex-shrink-0 ${o?"bg-[var(--color-error)]":a?"bg-[var(--color-success)]":"bg-[var(--color-text-muted)]"}`}),n("div",{class:"min-w-0",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:"font-medium truncate",children:e.name||e.accountId}),l&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["@",l.replace(/^@/,"")]})]}),o&&n("div",{class:"text-xs text-[var(--color-error)] truncate",children:e.lastError})]})]}),n(Q,{icon:n(gy,{class:"w-3.5 h-3.5"}),label:i("channels.logout"),onClick:()=>{Nt.value={channel:t,accountId:e.accountId,label:`${r} (${e.name||e.accountId})`}},variant:"ghost",size:"sm"})]})}function R_({channel:e}){const t=T_(e.status),r=Zg(e);return n(V,{padding:"md",children:[n("div",{class:"flex items-start gap-3 mb-4",children:[n(S_,{channelId:e.id,size:40}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2 flex-wrap",children:[n("h3",{class:"font-semibold text-lg",children:e.label}),n(X,{variant:t.variant,size:"sm",children:t.label})]}),n("div",{class:"flex items-center gap-3 mt-1 text-sm text-[var(--color-text-muted)]",children:[r>0&&n("span",{class:"flex items-center gap-1",children:[n(me,{class:"w-3.5 h-3.5"}),ge(r,{relative:!0})]}),n("button",{type:"button",onClick:()=>it(`/config#channels.${e.id}`),class:"flex items-center gap-1 hover:text-[var(--color-accent)] transition-colors",children:[n(hu,{class:"w-3.5 h-3.5"}),i("channels.configure")]}),n("a",{href:`https://docs.openclaw.ai/channels/${e.id}`,target:"_blank",rel:"noopener noreferrer",class:"flex items-center gap-1 hover:text-[var(--color-accent)] transition-colors",children:[i("channels.docs"),n(yo,{class:"w-3 h-3"})]})]})]})]}),e.accounts.length>0&&n("div",{class:"space-y-2",children:e.accounts.map(a=>n(I_,{account:a,channelId:e.id,channelLabel:e.label},a.accountId))})]})}function $_(){return Nt.value?n(Qe,{open:!0,onClose:()=>{Nt.value=null},title:i("channels.logoutTitle"),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-[var(--color-text-secondary)]",children:i("channels.logoutConfirm",{channel:Nt.value.label})}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:i("channels.logoutWarning")})]}),n("div",{class:"flex justify-end gap-3 mt-6",children:[n(L,{variant:"ghost",onClick:()=>{Nt.value=null},disabled:as.value,children:i("actions.cancel")}),n(L,{variant:"danger",onClick:A_,loading:as.value,children:i("channels.logout")})]})]}):null}function D_(e){z(()=>{$.value&&Al()},[$.value]);const t=M_.value;return n(ut,{viewName:i("nav.channels"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:[n("div",{class:"max-w-4xl mx-auto space-y-4 sm:space-y-6",children:[n(kt,{title:i("channels.title"),subtitle:i("channels.description"),actions:n(Y,{children:[n(L,{variant:"secondary",size:"sm",onClick:()=>Al(!0),disabled:Pa.value||$t.value||!$.value,icon:n(xn,{class:`w-4 h-4 ${Pa.value?"animate-pulse":""}`}),children:Pa.value?i("channels.probing"):i("channels.probe")}),n(Q,{icon:n(He,{class:`w-4 h-4 ${$t.value?"animate-spin":""}`}),label:i("actions.refresh"),onClick:()=>Al(),disabled:$t.value||!$.value,variant:"ghost"})]})}),$.value&&!$t.value&&n("div",{class:"grid grid-cols-2 sm:grid-cols-3 gap-2 sm:gap-4",children:[n(fe,{icon:an,label:i("channels.stats.total"),value:t.total}),n(fe,{icon:ln,label:i("channels.stats.active"),value:t.active}),n(fe,{icon:bs,label:i("channels.stats.errors"),value:t.errors,highlight:t.errors>0})]}),za.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:za.value}),($t.value||!$.value)&&n("div",{class:"flex justify-center py-16",children:n(ue,{size:"lg",label:$.value?void 0:i("status.connecting")})}),$.value&&!$t.value&&Ln.value.length>0&&n("div",{class:"grid gap-4 sm:grid-cols-2",children:Ln.value.map(r=>n(R_,{channel:r},r.id))}),$.value&&!$t.value&&Ln.value.length===0&&!za.value&&n(V,{children:n("div",{class:"p-16 text-center",children:[n(an,{class:"w-12 h-12 mx-auto mb-4 text-[var(--color-text-muted)] opacity-50"}),n("h3",{class:"text-lg font-medium mb-2",children:i("channels.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:i("channels.emptyDescription")}),n("a",{href:"https://docs.openclaw.ai/channels",target:"_blank",rel:"noopener noreferrer",class:"inline-flex items-center gap-2 text-[var(--color-accent)] hover:underline",children:[i("channels.learnMore"),n(yo,{class:"w-4 h-4"})]})]})}),$.value&&!$t.value&&Ln.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:i("channels.count",{count:Ln.value.length})})]}),n($_,{})]})})}const It=v([]),Zt=v(!1),Ua=v(null);function Qg(e){const t=e.mode?.toLowerCase()??"",r=e.deviceFamily?.toLowerCase()??"";return t==="gateway"?Vn:r.includes("iphone")||r.includes("android")?$r:r.includes("mac")||r.includes("windows")||r.includes("linux")?vt:Bt}function L_(e){return e===void 0?"—":e<60?i("instances.idleSeconds",{count:e}):e<3600?i("instances.idleMinutes",{count:Math.floor(e/60)}):i("instances.idleHours",{count:Math.floor(e/3600)})}function ev(e){return e?e==="gateway"?"success":e==="webchat"||e==="chat"?"warning":"default":"default"}async function wi(){Zt.value=!0,Ua.value=null;try{const e=await H("system-presence",{});It.value=e??[]}catch(e){Ua.value=le(e)}finally{Zt.value=!1}}function N_({roles:e,scopes:t}){const r=[...e??[],...t??[]];return r.length===0?null:n("div",{class:"flex flex-wrap items-center gap-1 mt-1",children:r.map(a=>n(X,{variant:"default",size:"sm",children:a},a))})}function O_({presence:e}){const t=Qg(e),r=e.mode==="gateway";return n(So,{icon:t,iconVariant:r?"success":"default",title:e.host||e.instanceId||"Unknown",subtitle:e.ip,badges:e.mode?n(X,{variant:ev(e.mode),size:"sm",children:e.mode}):null,meta:[{icon:me,value:ge(e.ts,{relative:!0})},...e.platform?[{value:e.platform}]:[]]})}function F_({presence:e}){const t=Qg(e),r=e.mode==="gateway";return n("tr",{class:"hover:bg-[var(--color-bg-hover)] transition-colors",children:[n("td",{class:"py-3 px-4",children:n("div",{class:"flex items-center gap-3",children:[n("div",{class:`p-1.5 rounded-lg flex-shrink-0 ${r?"bg-[var(--color-success)]/10":"bg-[var(--color-bg-tertiary)]"}`,children:n(t,{class:`w-4 h-4 ${r?"text-[var(--color-success)]":"text-[var(--color-text-muted)]"}`})}),n("div",{class:"min-w-0",children:[n("div",{class:"font-medium truncate",children:e.host||e.instanceId||"Unknown"}),e.ip&&n("div",{class:"text-xs text-[var(--color-text-muted)]",children:e.ip}),n(N_,{roles:e.roles,scopes:e.scopes})]})]})}),n("td",{class:"py-3 px-4",children:e.mode?n(X,{variant:ev(e.mode),size:"sm",children:e.mode}):n("span",{class:"text-[var(--color-text-muted)]",children:"—"})}),n("td",{class:"py-3 px-4",children:[n("div",{class:"text-sm",children:e.platform||"—"}),e.version&&n("div",{class:"text-xs text-[var(--color-text-muted)]",children:["v",e.version]})]}),n("td",{class:"py-3 px-4 whitespace-nowrap",children:n("div",{class:"flex items-center gap-1.5 text-sm text-[var(--color-text-muted)]",children:[n(me,{class:"w-3.5 h-3.5"}),n("span",{children:ge(e.ts,{relative:!0})})]})}),n("td",{class:"py-3 px-4 whitespace-nowrap text-sm text-[var(--color-text-muted)] hidden lg:table-cell",children:L_(e.lastInputSeconds)})]})}function P_(e){z(()=>{$.value&&wi()},[$.value]);const t=It.value.filter(a=>a.mode==="gateway").length,r=It.value.filter(a=>a.mode!=="gateway").length;return n(ut,{viewName:i("nav.instances"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[n(kt,{title:i("instances.title"),subtitle:i("instances.description"),actions:n(Q,{icon:n(He,{class:`w-4 h-4 ${Zt.value?"animate-spin":""}`}),label:i("actions.refresh"),onClick:wi,disabled:Zt.value||!$.value,variant:"ghost"})}),$.value&&!Zt.value&&n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(fe,{icon:Bt,label:i("instances.stats.total"),value:It.value.length}),n(fe,{icon:Vn,label:i("instances.stats.gateways"),value:t}),n(fe,{icon:vt,label:i("instances.stats.clients"),value:r})]}),Ua.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Ua.value}),(Zt.value||!$.value)&&n("div",{class:"flex justify-center py-16",children:n(ue,{size:"lg",label:$.value?void 0:i("status.connecting")})}),$.value&&!Zt.value&&It.value.length>0&&n(Y,{children:[n("div",{class:"md:hidden space-y-2",children:It.value.map((a,o)=>n(O_,{presence:a},a.instanceId||a.host||o))}),n(V,{padding:"none",class:"hidden md:block",children:n("table",{class:"w-full",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)] text-left text-sm text-[var(--color-text-muted)]",children:[n("th",{class:"py-3 px-4 font-medium",children:i("instances.columns.instance")}),n("th",{class:"py-3 px-4 font-medium w-24",children:i("instances.columns.mode")}),n("th",{class:"py-3 px-4 font-medium w-40",children:i("instances.columns.platform")}),n("th",{class:"py-3 px-4 font-medium w-28",children:i("instances.columns.lastSeen")}),n("th",{class:"py-3 px-4 font-medium w-20 hidden lg:table-cell",children:i("instances.columns.idle")})]})}),n("tbody",{class:"divide-y divide-[var(--color-border)]",children:It.value.map((a,o)=>n(F_,{presence:a},a.instanceId||a.host||o))})]})})]}),$.value&&!Zt.value&&It.value.length===0&&!Ua.value&&n(V,{children:n("div",{class:"p-16 text-center",children:[n(Bt,{class:"w-12 h-12 mx-auto mb-4 text-[var(--color-text-muted)] opacity-50"}),n("h3",{class:"text-lg font-medium mb-2",children:i("instances.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:i("instances.emptyDescription")}),n(L,{variant:"secondary",onClick:wi,children:i("actions.refresh")})]})}),$.value&&!Zt.value&&It.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:i("instances.count",{count:It.value.length})})]})})})}const df={main:{icon:fu,color:"success",badgeVariant:"success"},channel:{icon:zl,color:"info",badgeVariant:"info"},cron:{icon:mo,color:"warning",badgeVariant:"warning"},isolated:{icon:_s,color:"text-muted",badgeVariant:"default"}};function mn(e){return df[e]??df.isolated}function tv(e){return i(`sessions.admin.kinds.${e}`)}const Ae=v([]),tt=v(!1),yn=v(null),dr=v(""),Ve=v("all"),To=v(null),Cr=v(!1),Sc=v(!1),Er=v(null),os=v(""),oo=v(""),lo=v("inherit"),so=v("inherit"),io=v("inherit");function Ou(e){return(e.totalTokens??0).toLocaleString()}function nv(e){const t=e.totalTokens??0,r=e.contextTokens??2e5;return r===0?"0%":`${Math.round(t/r*100)}%`}function rv(e){return e.label||e.displayName||e.key.split(":").pop()||e.key}const $n=B(()=>{let e=Ae.value;Ve.value!=="all"&&(e=e.filter(r=>Un(r)===Ve.value));const t=dr.value.toLowerCase().trim();return t&&(e=e.filter(r=>{const a=(r.label||r.displayName||"").toLowerCase(),o=r.key.toLowerCase(),l=(r.model||"").toLowerCase(),s=(r.channel||"").toLowerCase();return a.includes(t)||o.includes(t)||l.includes(t)||s.includes(t)})),[...e].sort((r,a)=>{const o=Un(r)==="main",l=Un(a)==="main";return o&&!l?-1:l&&!o?1:(a.updatedAt??0)-(r.updatedAt??0)})}),z_=B(()=>{const e={total:0,main:0,channel:0,cron:0,isolated:0};for(const t of Ae.value)e.total++,e[Un(t)]++;return e});async function hf(){tt.value=!0,yn.value=null;try{const e=await H("sessions.list",{limit:200});Ae.value=e.sessions??[]}catch(e){yn.value=le(e)}finally{tt.value=!1}}function Ha(e){To.value=e,oo.value=e.label??"",lo.value=e.thinking??"inherit",so.value=e.verbose??"inherit",io.value=e.reasoning??"inherit"}function ja(){To.value=null,Cr.value=!1}async function U_(){const e=To.value;if(e){Sc.value=!0;try{const t={};oo.value!==(e.label??"")&&(t.label=oo.value||void 0),lo.value!==(e.thinking??"inherit")&&(t.thinking=lo.value),so.value!==(e.verbose??"inherit")&&(t.verbose=so.value),io.value!==(e.reasoning??"inherit")&&(t.reasoning=io.value),Object.keys(t).length>0&&(await H("sessions.patch",{key:e.key,...t}),Ae.value=Ae.value.map(r=>r.key===e.key?{...r,...t}:r)),ja()}catch(t){yn.value=le(t)}finally{Sc.value=!1}}}async function H_(){const e=To.value;if(e)try{await H("sessions.delete",{key:e.key}),Ae.value=Ae.value.filter(t=>t.key!==e.key),ja()}catch(t){yn.value=le(t)}}function av(e){it(`/chat/${encodeURIComponent(e)}`)}function j_(e,t){t.stopPropagation(),Er.value=e.key,os.value=e.label??""}async function ff(){const e=Er.value;if(!e)return;const t=os.value.trim(),r=Ae.value.find(a=>a.key===e);if(!r||t===(r.label??"")){Er.value=null;return}try{await H("sessions.patch",{key:e,label:t||void 0}),Ae.value=Ae.value.map(a=>a.key===e?{...a,label:t||void 0}:a)}catch(a){yn.value=le(a)}finally{Er.value=null}}function B_(){Er.value=null}const ki=[{value:"inherit",label:i("sessions.admin.levels.inherit")},{value:"off",label:i("sessions.admin.levels.off")},{value:"low",label:i("sessions.admin.levels.low")},{value:"medium",label:i("sessions.admin.levels.medium")},{value:"high",label:i("sessions.admin.levels.high")}];function W_({kind:e,size:t="sm"}){const r=mn(e),a=r.icon,o=t==="md"?"w-6 h-6":"w-4 h-4",l=r.color==="text-muted"?"text-[var(--color-text-muted)]":`text-[var(--color-${r.color})]`;return n(a,{class:`${o} ${l}`})}function ov({kind:e,size:t="sm"}){const r=mn(e),a=t==="md"?"p-3":"p-1.5",o=r.color==="text-muted"?"bg-[var(--color-bg-tertiary)]":`bg-[var(--color-${r.color})]/10`;return n("div",{class:`${a} rounded-lg flex-shrink-0 ${o}`,children:n(W_,{kind:e,size:t})})}function lv({session:e,onDelete:t}){return n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[ds.value&&n(Q,{icon:n(an,{class:"w-4 h-4"}),label:i("sessions.admin.openInChat"),size:"sm",variant:"ghost",onClick:r=>{r.stopPropagation(),av(e.key)}}),n(Q,{icon:n(Gt,{class:"w-4 h-4"}),label:i("actions.delete"),size:"sm",variant:"ghost",onClick:t,class:"text-[var(--color-text-muted)] hover:text-[var(--color-error)] hover:bg-[var(--color-error)]/10"})]})}function q_({session:e}){const t=Un(e),r=mn(t),a=rv(e);return n(So,{icon:r.icon,iconVariant:t==="main"?"success":t==="channel"?"info":t==="cron"?"warning":"default",title:a,subtitle:e.key,badges:n(X,{variant:r.badgeVariant,size:"sm",children:tv(t)}),meta:[{icon:me,value:e.updatedAt?ge(e.updatedAt,{relative:!0}):"—"},{icon:Ap,value:Ou(e)}],actions:n(lv,{session:e,onDelete:o=>{o.stopPropagation(),Ha(e),Cr.value=!0}}),onClick:()=>Ha(e)})}function G_({session:e}){const t=Un(e),r=rv(e),a=Er.value===e.key;return n("tr",{class:"group hover:bg-[var(--color-bg-hover)] cursor-pointer transition-colors",onClick:()=>!a&&Ha(e),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&!a&&(o.preventDefault(),Ha(e))},tabIndex:a?-1:0,children:[n("td",{class:"py-3 px-4",children:n("div",{class:"flex items-center gap-3",children:[n(ov,{kind:t}),n("div",{class:"min-w-0 flex-1",children:[a?n("div",{class:"flex items-center gap-2",onClick:o=>o.stopPropagation(),onKeyDown:o=>o.stopPropagation(),children:n(te,{type:"text",value:os.value,onInput:o=>os.value=o.target.value,onKeyDown:o=>{o.key==="Enter"&&ff(),o.key==="Escape"&&B_()},onBlur:ff,placeholder:i("sessions.admin.labelPlaceholder"),class:"h-8 text-sm",autoFocus:!0})}):n("div",{class:"flex items-center gap-2 group/label",children:[n("div",{class:"font-medium truncate",title:r,children:r}),n(Q,{icon:n($p,{class:"w-3 h-3"}),label:i("sessions.admin.editLabel"),size:"sm",variant:"ghost",onClick:o=>j_(e,o),class:"opacity-0 group-hover/label:opacity-100 !p-1 flex-shrink-0"})]}),n("div",{class:"text-xs text-[var(--color-text-muted)] font-mono truncate",title:e.key,children:e.key})]})]})}),n("td",{class:"py-3 px-4",children:n("div",{class:"flex items-center gap-1.5 text-sm text-[var(--color-text-muted)]",children:[n(Fl,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{class:"truncate max-w-[120px]",title:e.model||"Default",children:e.model?e.model.split("/").pop():"Default"})]})}),n("td",{class:"py-3 px-4 whitespace-nowrap",children:n("div",{class:"flex items-center gap-1.5 text-sm text-[var(--color-text-muted)]",children:[n(me,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:e.updatedAt?ge(e.updatedAt):"—"})]})}),n("td",{class:"py-3 px-4 whitespace-nowrap hidden lg:table-cell",children:n("div",{class:"flex items-center gap-1.5 text-sm text-[var(--color-text-muted)]",children:[n(Ap,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:Ou(e)}),n("span",{class:"text-xs opacity-60",children:["(",nv(e),")"]})]})}),n("td",{class:"py-3 px-4",children:n(lv,{session:e,onDelete:o=>{o.stopPropagation(),Ha(e),Cr.value=!0}})})]})}function K_(){const e=To.value;if(!e)return null;const t=Un(e),r=mn(t);return n(Qe,{open:!!e,onClose:ja,title:e.label||e.displayName||i("sessions.admin.sessionDetails"),size:"xl",footer:Cr.value?n(wg,{message:i("sessions.admin.confirmDelete"),onCancel:()=>Cr.value=!1,onDelete:H_}):n(kg,{isEdit:!0,onDeleteClick:()=>Cr.value=!0,onCancel:ja,onSave:U_,isSaving:Sc.value}),children:n("div",{class:"space-y-4 sm:space-y-6",children:[n("div",{class:"flex items-start gap-3 p-3 sm:p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n(ov,{kind:t,size:"md"}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex flex-wrap items-center gap-1.5 sm:gap-2 mb-1",children:[n(X,{variant:r.badgeVariant,size:"sm",children:tv(t)}),e.channel&&n(X,{variant:"default",size:"sm",children:e.channel})]}),n("code",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] break-all",children:e.key})]})]}),n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n("div",{class:"text-center p-2 sm:p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n("div",{class:"text-lg sm:text-xl font-bold",children:Ou(e)}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:i("sessions.admin.tokens")})]}),n("div",{class:"text-center p-2 sm:p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n("div",{class:"text-lg sm:text-xl font-bold",children:nv(e)}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:i("sessions.admin.contextUsed")})]}),n("div",{class:"text-center p-2 sm:p-4 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)]",children:[n("div",{class:"text-lg sm:text-xl font-bold",children:e.updatedAt?ge(e.updatedAt,{relative:!0}):"—"}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:i("sessions.admin.lastActive")})]})]}),n("div",{class:"space-y-4 sm:space-y-5",children:[n(Ee,{label:i("sessions.admin.label"),hint:i("sessions.admin.labelHelp"),children:n(te,{value:oo.value,onInput:a=>oo.value=a.target.value,placeholder:i("sessions.admin.labelPlaceholder"),fullWidth:!0})}),n(Ee,{label:i("sessions.admin.overrides"),children:n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(Ee,{label:i("sessions.admin.thinking"),class:"space-y-1",children:n(Me,{value:lo.value,onChange:a=>lo.value=a,options:ki})}),n(Ee,{label:i("sessions.admin.verbose"),class:"space-y-1",children:n(Me,{value:so.value,onChange:a=>so.value=a,options:ki})}),n(Ee,{label:i("sessions.admin.reasoning"),class:"space-y-1",children:n(Me,{value:io.value,onChange:a=>io.value=a,options:ki})})]})})]}),ds.value&&n(L,{variant:"secondary",fullWidth:!0,icon:n(an,{class:"w-4 h-4"}),onClick:()=>{ja(),av(e.key)},children:i("sessions.admin.openInChat")})]})})}function V_(e){z(()=>{$.value&&hf()},[$.value]);const t=z_.value;return n(ut,{viewName:i("nav.sessions"),children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:[n("div",{class:"max-w-5xl mx-auto space-y-4 sm:space-y-6",children:[n(kt,{title:i("sessions.admin.title"),subtitle:i("sessions.admin.description"),actions:n(Y,{children:[$.value&&!tt.value&&Ae.value.length>0&&n("div",{class:"relative hidden sm:block",children:[n(Pe,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(te,{type:"text",value:dr.value,onInput:r=>dr.value=r.target.value,placeholder:i("sessions.admin.searchPlaceholder"),class:"pl-10 w-48 lg:w-64"})]}),n(Q,{icon:n(He,{class:`w-4 h-4 ${tt.value?"animate-spin":""}`}),label:i("actions.refresh"),onClick:hf,disabled:tt.value||!$.value,variant:"ghost"})]})}),$.value&&!tt.value&&Ae.value.length>0&&n("div",{class:"relative md:hidden",children:[n(Pe,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(te,{type:"text",value:dr.value,onInput:r=>dr.value=r.target.value,placeholder:i("sessions.admin.searchPlaceholder"),class:"pl-10",fullWidth:!0})]}),$.value&&!tt.value&&n("div",{class:"flex flex-wrap justify-center sm:grid sm:grid-cols-5 gap-2 sm:gap-3 [&>*]:w-[calc(33.333%-0.375rem)] sm:[&>*]:w-auto",children:[n(fe,{icon:an,label:i("sessions.admin.stats.total"),value:t.total,active:Ve.value==="all",onClick:()=>Ve.value="all"}),n(fe,{icon:mn("main").icon,label:i("sessions.admin.kinds.main"),value:t.main,active:Ve.value==="main",onClick:()=>Ve.value="main"}),n(fe,{icon:mn("channel").icon,label:i("sessions.admin.kinds.channel"),value:t.channel,active:Ve.value==="channel",onClick:()=>Ve.value="channel"}),n(fe,{icon:mn("cron").icon,label:i("sessions.admin.kinds.cron"),value:t.cron,active:Ve.value==="cron",onClick:()=>Ve.value="cron"}),n(fe,{icon:mn("isolated").icon,label:i("sessions.admin.kinds.isolated"),value:t.isolated,active:Ve.value==="isolated",onClick:()=>Ve.value="isolated"})]}),yn.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:yn.value}),(tt.value||!$.value)&&n("div",{class:"flex justify-center py-16",children:n(ue,{size:"lg",label:$.value?void 0:i("status.connecting")})}),$.value&&!tt.value&&$n.value.length>0&&n(Y,{children:[n("div",{class:"md:hidden space-y-2",children:$n.value.map(r=>n(q_,{session:r},r.key))}),n(V,{padding:"none",class:"hidden md:block",children:n("table",{class:"w-full",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)] text-left text-sm text-[var(--color-text-muted)]",children:[n("th",{class:"py-3 px-4 font-medium",children:i("sessions.admin.columns.session")}),n("th",{class:"py-3 px-4 font-medium w-32",children:i("sessions.admin.columns.model")}),n("th",{class:"py-3 px-4 font-medium w-36",children:i("sessions.admin.columns.lastActive")}),n("th",{class:"py-3 px-4 font-medium w-32 hidden lg:table-cell",children:i("sessions.admin.columns.tokens")}),n("th",{class:"py-3 px-4 font-medium w-12"})]})}),n("tbody",{class:"divide-y divide-[var(--color-border)]",children:$n.value.map(r=>n(G_,{session:r},r.key))})]})})]}),$.value&&!tt.value&&Ae.value.length===0&&!yn.value&&n(V,{children:n("div",{class:"p-16 text-center",children:[n(an,{class:"w-12 h-12 mx-auto mb-4 text-[var(--color-text-muted)] opacity-50"}),n("h3",{class:"text-lg font-medium mb-2",children:i("sessions.admin.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)]",children:i("sessions.admin.emptyDescription")})]})}),$.value&&!tt.value&&Ae.value.length>0&&$n.value.length===0&&n(V,{children:n("div",{class:"p-12 text-center",children:[n(Pe,{class:"w-10 h-10 mx-auto mb-4 text-[var(--color-text-muted)] opacity-50"}),n("h3",{class:"text-lg font-medium mb-2",children:i("sessions.admin.noResults")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:i("sessions.admin.noResultsDescription")}),n(L,{variant:"secondary",size:"sm",onClick:()=>{dr.value="",Ve.value="all"},children:i("sessions.admin.clearFilters")})]})}),$.value&&!tt.value&&$n.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:$n.value.length===Ae.value.length?i("sessions.admin.count",{count:Ae.value.length}):i("sessions.admin.filteredCount",{filtered:$n.value.length,total:Ae.value.length})})]}),n(K_,{})]})})}const Y_={sm:"text-xs",md:"text-sm",lg:"text-base"};function Fu({children:e,size:t="sm",muted:r=!0,icon:a,iconRight:o,class:l,...s}){return n("button",{type:"button",class:`
409
+ inline-flex items-center gap-1
410
+ ${Y_[t]}
411
+ ${r?"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]":"text-[var(--color-accent)] hover:text-[var(--color-accent-hover)]"}
412
+ transition-colors
413
+ disabled:opacity-50 disabled:cursor-not-allowed
414
+ ${l||""}
415
+ `,...s,children:[a&&n("span",{class:"flex-shrink-0",children:a}),e,o&&n("span",{class:"flex-shrink-0",children:o})]})}const J_={success:"bg-[var(--color-success)]/10 text-[var(--color-success)]",error:"bg-[var(--color-error)]/10 text-[var(--color-error)]",warning:"bg-[var(--color-warning)]/10 text-[var(--color-warning)]",info:"bg-[var(--color-accent)]/10 text-[var(--color-accent)]"},X_={sm:{container:"w-10 h-10",icon:"w-5 h-5"},md:{container:"w-12 h-12",icon:"w-6 h-6"},lg:{container:"w-16 h-16",icon:"w-8 h-8"}},Z_={success:bo,error:xo,warning:tr,info:ys};function pf({variant:e,size:t="lg",class:r}){const{container:a,icon:o}=X_[t],l=Z_[e];return n("div",{class:`
416
+ ${a}
417
+ rounded-full
418
+ flex items-center justify-center
419
+ ${J_[e]}
420
+ ${r||""}
421
+ `,children:n(l,{class:o})})}function sv({onBack:e,onNext:t,nextLabel:r,backLabel:a,nextDisabled:o=!1,nextLoading:l=!1,class:s}){return n("div",{class:`flex gap-3 mt-6 ${s||""}`,children:[e&&n(L,{variant:"ghost",onClick:e,icon:n(iu,{class:"w-4 h-4"}),children:a||i("actions.back")}),n(L,{variant:"primary",onClick:t,disabled:o,loading:l,class:e?"flex-1":"w-full",iconRight:n(ms,{class:"w-4 h-4"}),children:r||i("actions.continue")})]})}function Q_({steps:e,current:t,class:r}){const a=e.indexOf(t);return n("div",{class:`flex justify-center gap-2 ${r||""}`,children:e.map((o,l)=>n("div",{class:`h-1.5 rounded-full transition-all duration-300 ${l<=a?"w-8 bg-[var(--color-accent)]":"w-4 bg-[var(--color-border)]"}`},o))})}function e5({onComplete:e,onSkip:t}){const r=J("welcome"),a=J(""),o=J("token"),l=J(""),s=J(!0),c=J(!1),u=J(!1),d=J(null),h=J(!1),f=J(!1),g=J(!0),m=J("single"),y=is(()=>{const w=a.value.trim();if(!w||!w.startsWith("ws://")&&!w.startsWith("wss://"))return!1;try{return new URL(w),!0}catch{return!1}});$i(()=>{const w=a.value;if(f.value=!1,h.value=!1,!y.value)return;const A=new AbortController,D=setTimeout(async()=>{if(A.signal.aborted||a.peek()!==w)return;h.value=!0,d.value=null;const S=await Sd(w,A.signal);!A.signal.aborted&&a.peek()===w&&(h.value=!1,S.ok?(f.value=!0,d.value=null):S.error!=="Aborted"&&(f.value=!1,d.value=S.error||i("onboarding.probeError")))},600);return()=>{clearTimeout(D),A.abort()}});const C=()=>a.value.trim()?y.value?(d.value=null,!0):(d.value=i("onboarding.urlError"),!1):(d.value=i("errors.required"),!1),T=async()=>{c.value=!0,u.value=!1;try{await go({url:a.value,token:o.value==="token"?l.value:void 0,password:o.value==="password"?l.value:void 0,autoReconnect:!0}),Oc({url:a.value,authMode:o.value,rememberMe:s.value,credential:l.value}),vd(),await fs(),await nu(),Xa("main"),await tu("main"),au(),ou(),u.value=!0}catch(w){M.auth.error("Connect failed:",w),u.value=!1}finally{c.value=!1}},_=()=>{Ir(),u.value=!1,r.value="auth"},p=async()=>{if(!C())return;if(f.value){r.value="auth";return}if(h.value)return;h.value=!0,d.value=null;const w=await Sd(a.value);h.value=!1,w.ok?(f.value=!0,setTimeout(()=>{r.value="auth",f.value=!1},500)):d.value=w.error||i("onboarding.probeError")},b=()=>{r.value==="welcome"?r.value="url":r.value==="url"?p():r.value==="auth"&&(r.value="connect",T())},k=()=>{r.value==="url"?r.value="welcome":r.value==="auth"?r.value="url":r.value==="connect"&&!u.value&&(r.value="auth")},E=()=>{vd(),t()};return n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-8",children:n("div",{class:"w-full max-w-md mx-auto min-h-full flex flex-col justify-center py-4 sm:py-0",children:[n(Q_,{steps:["welcome","url","auth","connect"],current:r.value,class:"mb-4 sm:mb-8"}),r.value==="welcome"&&n(t5,{onNext:b,onSkip:E}),r.value==="url"&&n(n5,{url:a.value,onUrlChange:w=>{a.value=w,d.value=null,f.value=!1},error:d.value,canProceed:y.value,probing:h.value,probeSuccess:f.value,onNext:b,onBack:k,onSkip:E}),r.value==="auth"&&n(r5,{authMode:o.value,onAuthModeChange:w=>o.value=w,credential:l.value,onCredentialChange:w=>l.value=w,rememberMe:s.value,onRememberMeChange:w=>s.value=w,onNext:b,onBack:k}),r.value==="connect"&&n(a5,{connecting:c.value,connected:u.value,error:vn.value,showTour:g.value,onShowTourChange:w=>g.value=w,selectedMode:m.value,onModeChange:w=>{m.value=w,rn.value=w},onRetry:_,onContinue:()=>{mm(g.value),rn.value=m.value,e()}})]})})}function t5({onNext:e,onSkip:t}){return n("div",{class:"text-center",children:[n(Ss,{size:"lg",class:"mx-auto mb-2 sm:mb-4 w-12 h-12 sm:w-16 sm:h-16"}),n("h1",{class:"text-xl sm:text-2xl font-bold mb-1 sm:mb-2",children:i("onboarding.welcome")}),n("p",{class:"text-sm sm:text-base text-[var(--color-text-muted)] mb-4 sm:mb-8",children:i("onboarding.welcomeSubtitle")}),n("div",{class:"grid gap-2 sm:gap-4 mb-4 sm:mb-8 text-left",children:[n(_i,{icon:n(ln,{class:"w-5 h-5"}),title:i("onboarding.feature1Title"),description:i("onboarding.feature1Desc")}),n(_i,{icon:n(ks,{class:"w-5 h-5"}),title:i("onboarding.feature2Title"),description:i("onboarding.feature2Desc")}),n(_i,{icon:n(Bt,{class:"w-5 h-5"}),title:i("onboarding.feature3Title"),description:i("onboarding.feature3Desc")})]}),n("div",{class:"space-y-3",children:[n(L,{variant:"primary",onClick:e,fullWidth:!0,iconRight:n(ms,{class:"w-4 h-4"}),children:i("onboarding.getStarted")}),n(Fu,{onClick:t,children:i("onboarding.skipToLogin")})]})]})}function _i({icon:e,title:t,description:r}){return n("div",{class:"flex gap-2 sm:gap-3 p-2 sm:p-3 rounded-lg bg-[var(--color-bg-secondary)]",children:[n("div",{class:"flex-shrink-0 w-8 h-8 sm:w-10 sm:h-10 rounded-lg bg-[var(--color-accent)]/10 text-[var(--color-accent)] flex items-center justify-center",children:e}),n("div",{class:"min-w-0",children:[n("h3",{class:"font-medium text-xs sm:text-sm",children:t}),n("p",{class:"text-xs text-[var(--color-text-muted)] line-clamp-2",children:r})]})]})}function n5({url:e,onUrlChange:t,error:r,canProceed:a,probing:o,probeSuccess:l,onNext:s,onBack:c,onSkip:u}){const d=f=>{f.key==="Enter"&&l&&s()},h=()=>{if(o)return n(ue,{size:"sm"});if(l)return n(on,{class:"w-4 h-4 text-[var(--color-success)]"});if(r&&a)return n(Zr,{content:r,placement:"left",children:n("span",{class:"cursor-help",children:n(bs,{class:"w-4 h-4 text-[var(--color-error)]"})})})};return n(V,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:i("onboarding.urlTitle")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-3 sm:mb-6",children:i("onboarding.urlSubtitle")}),n(Ee,{label:i("auth.gatewayUrl"),htmlFor:"gateway-url",children:n(te,{id:"gateway-url",type:"url",value:e,onInput:f=>t(f.target.value),onKeyDown:d,placeholder:i("auth.gatewayUrlPlaceholder"),rightElement:h(),autoCorrect:"off",autoCapitalize:"off",spellcheck:!1,fullWidth:!0})}),n(na,{title:i("onboarding.troubleshootTitle"),items:[i("onboarding.troubleshoot1"),i("onboarding.troubleshoot2"),i("onboarding.troubleshoot3")],class:"mt-3 sm:mt-4 text-xs sm:text-sm"}),n(sv,{onBack:c,onNext:s,nextDisabled:!l}),n("div",{class:"text-center mt-4",children:n(Fu,{onClick:u,disabled:o,children:i("onboarding.skipToLogin")})})]})}function r5({authMode:e,onAuthModeChange:t,credential:r,onCredentialChange:a,rememberMe:o,onRememberMeChange:l,onNext:s,onBack:c}){const u=h=>{h.key==="Enter"&&s()},d=[{value:"token",label:i("auth.authMode.token")},{value:"password",label:i("auth.authMode.password")}];return n(V,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:i("onboarding.authTitle")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-3 sm:mb-6",children:i("onboarding.authSubtitle")}),n("div",{class:"space-y-3 sm:space-y-4",children:[n(Ee,{label:i("onboarding.authMethod"),children:n(Me,{value:e,onChange:h=>t(h),options:d,"aria-label":i("onboarding.authMethod"),class:"w-full"})}),n(Ee,{label:i(e==="token"?"auth.token":"auth.password"),htmlFor:"credential",children:n(Tu,{id:"credential",value:r,onInput:h=>a(h.target.value),onKeyDown:u,placeholder:i(e==="token"?"auth.tokenPlaceholder":"auth.passwordPlaceholder"),fullWidth:!0})}),n(Ke,{checked:o,onChange:l,label:i("auth.rememberMe"),description:i("onboarding.rememberMeDesc"),size:"sm"})]}),n(sv,{onBack:c,onNext:s,nextLabel:i("actions.connect")})]})}function a5({connecting:e,connected:t,error:r,showTour:a,onShowTourChange:o,selectedMode:l,onModeChange:s,onRetry:c,onContinue:u}){return n(V,{variant:"elevated",padding:"md",class:"text-center",children:[e&&n(Y,{children:[n(ue,{size:"md",class:"mx-auto mb-3 sm:mb-4"}),n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:i("onboarding.connecting")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:i("onboarding.connectingDesc")})]}),!e&&t&&n(Y,{children:[n(pf,{variant:"success",size:"sm",class:"mx-auto mb-3 sm:mb-4"}),n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:i("onboarding.success")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-4 sm:mb-6",children:i("onboarding.successDesc")}),n("div",{class:"mb-4 sm:mb-6",children:[n("p",{class:"text-xs sm:text-sm font-medium text-[var(--color-text-primary)] mb-2 sm:mb-3",children:i("onboarding.modeTitle")}),n("div",{class:"grid grid-cols-2 gap-2 sm:gap-3",children:[n("button",{type:"button",onClick:()=>s("single"),class:`p-2 sm:p-4 rounded-lg border-2 text-left transition-colors ${l==="single"?"border-[var(--color-accent)] bg-[var(--color-accent)]/10":"border-[var(--color-border)] hover:border-[var(--color-accent)]/50"}`,children:[n(an,{class:"w-4 h-4 sm:w-5 sm:h-5 mb-1 sm:mb-2 text-[var(--color-accent)]"}),n("div",{class:"text-xs sm:text-sm font-medium",children:i("onboarding.modeSingle")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1 hidden sm:block",children:i("onboarding.modeSingleDesc")})]}),n("button",{type:"button",onClick:()=>s("multi"),class:`p-2 sm:p-4 rounded-lg border-2 text-left transition-colors ${l==="multi"?"border-[var(--color-accent)] bg-[var(--color-accent)]/10":"border-[var(--color-border)] hover:border-[var(--color-accent)]/50"}`,children:[n(fy,{class:"w-4 h-4 sm:w-5 sm:h-5 mb-1 sm:mb-2 text-[var(--color-accent)]"}),n("div",{class:"text-xs sm:text-sm font-medium",children:i("onboarding.modeMulti")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1 hidden sm:block",children:i("onboarding.modeMultiDesc")})]})]})]}),n("div",{class:"mb-4 sm:mb-6",children:n(Ke,{checked:a,onChange:o,label:i("onboarding.showFeatureTour"),size:"sm"})}),n(L,{variant:"primary",onClick:u,fullWidth:!0,iconRight:n(ms,{class:"w-4 h-4"}),children:i(a?"actions.continue":"onboarding.startChatting")})]}),!e&&!t&&r&&n(Y,{children:[n(pf,{variant:"error",size:"sm",class:"mx-auto mb-3 sm:mb-4"}),n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:i("onboarding.failed")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-error)] mb-3 sm:mb-4",children:r}),n(na,{title:i("onboarding.failedHints"),items:[i("onboarding.hint1"),i("onboarding.hint2"),i("onboarding.hint3"),i("onboarding.hint4")],class:"text-left mb-4 sm:mb-6 text-xs sm:text-sm"}),n(L,{variant:"primary",onClick:c,fullWidth:!0,icon:n(iu,{class:"w-4 h-4"}),children:i("onboarding.tryAgain")})]})]})}const o5=150,l5=300,s5=50,et=16,il=8,i5=8;function c5({steps:e,onComplete:t,spotlightPadding:r=i5}){const a=J(0),o=J(0),l=J(null),s=q(null),c=J(null),u=J(!1),d=e[o.value],h=e[a.value],f=a.value===0,g=a.value===e.length-1,m=K(async()=>{if(!h)return;await new Promise(b=>setTimeout(b,o5)),o.value=a.peek(),h.beforeShow&&await h.beforeShow(),await new Promise(b=>setTimeout(b,s5));const p=document.querySelector(h.target);if(p){p.scrollIntoView({behavior:"smooth",block:"center"}),await new Promise(k=>setTimeout(k,l5));const b=p.getBoundingClientRect();l.value=b}else l.value=null;u.value=!1},[h]);$i(()=>{a.value,u.value=!0,m()}),$i(()=>{const p=l.value;if(!p||!s.current)return;const k=s.current.getBoundingClientRect(),E={width:window.innerWidth,height:window.innerHeight};let w=h?.placement||"bottom",A=0,D=0;const S={bottom:{top:p.bottom+r+il+et,left:p.left+p.width/2-k.width/2,fits:p.bottom+r+k.height+et<E.height},top:{top:p.top-r-k.height-il-et,left:p.left+p.width/2-k.width/2,fits:p.top-r-k.height-et>0},right:{top:p.top+p.height/2-k.height/2,left:p.right+r+il+et,fits:p.right+r+k.width+et<E.width},left:{top:p.top+p.height/2-k.height/2,left:p.left-r-k.width-il-et,fits:p.left-r-k.width-et>0}},F=w==="top"?["top","bottom","right","left"]:w==="left"?["left","right","bottom","top"]:w==="right"?["right","left","bottom","top"]:["bottom","top","right","left"];for(const de of F)if(S[de].fits){w=de;break}const N=S[w];A=N.top,D=N.left,D=Math.max(et,Math.min(D,E.width-k.width-et)),A=Math.max(et,Math.min(A,E.height-k.height-et));const re=w==="bottom"?"top":w==="top"?"bottom":w==="left"?"right":"left";c.value={top:A,left:D,arrowPosition:re}}),z(()=>{const p=()=>m();return window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[m]),z(()=>{const p=b=>{b.key==="Escape"?t():b.key==="ArrowRight"||b.key==="Enter"?g?t():a.value++:b.key==="ArrowLeft"&&!f&&a.value--};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[f,g,t]);const y=()=>{g?t():a.value++},C=()=>{f||a.value--},T=l.value,_=c.value;return pu(n("div",{class:"fixed inset-0 z-[9999]",children:[n("svg",{class:"absolute inset-0 w-full h-full",children:[n("defs",{children:n("mask",{id:"spotlight-mask",children:[n("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white"}),T&&n("rect",{x:T.left-r,y:T.top-r,width:T.width+r*2,height:T.height+r*2,rx:"8",fill:"black"})]})}),n("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"rgba(0, 0, 0, 0.75)",mask:"url(#spotlight-mask)"})]}),T&&n("div",{class:"absolute border-2 border-[var(--color-accent)] rounded-lg pointer-events-none",style:{top:T.top-r,left:T.left-r,width:T.width+r*2,height:T.height+r*2}}),n("div",{ref:s,class:"absolute z-10 bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-xl shadow-lg p-4 max-w-sm transition-opacity duration-150",style:{top:_?.top??-9999,left:_?.left??-9999,opacity:_&&!u.value?1:0,pointerEvents:_&&!u.value?"auto":"none"},children:[_&&n("div",{class:`absolute w-3 h-3 bg-[var(--color-bg-surface)] border-[var(--color-border)] transform rotate-45 ${_.arrowPosition==="top"?"-top-1.5 left-1/2 -translate-x-1/2 border-l border-t":_.arrowPosition==="bottom"?"-bottom-1.5 left-1/2 -translate-x-1/2 border-r border-b":_.arrowPosition==="left"?"-left-1.5 top-1/2 -translate-y-1/2 border-l border-b":"-right-1.5 top-1/2 -translate-y-1/2 border-r border-t"}`}),n("div",{class:"text-xs text-[var(--color-text-muted)] mb-2",children:[o.value+1," / ",e.length]}),n("h3",{class:"font-semibold text-[var(--color-text-primary)] mb-1",children:d?.title}),n("p",{class:"text-sm text-[var(--color-text-secondary)] mb-4",children:d?.content}),n("div",{class:"flex items-center justify-between gap-2",children:[n(Fu,{onClick:t,icon:n(Xr,{class:"w-3 h-3"}),children:i("tour.skipTour")}),n("div",{class:"flex gap-2",children:[!f&&n(L,{variant:"ghost",size:"sm",onClick:C,icon:n(iu,{class:"w-3 h-3"}),children:i("actions.back")}),n(L,{variant:"primary",size:"sm",onClick:y,iconRight:n(ms,{class:"w-3 h-3"}),children:i(g?"actions.done":"actions.next")})]})]})]}),n("div",{class:"absolute inset-0",role:"presentation",onClick:p=>{if(T){const b=p.clientX,k=p.clientY;b>=T.left-r&&b<=T.right+r&&k>=T.top-r&&k<=T.bottom+r||(p.preventDefault(),p.stopPropagation())}},onKeyDown:()=>{},style:{pointerEvents:"auto"}})]}),document.body)}const u5=[{target:"[data-tour='sessions']",title:"Your Conversations",content:"All your chat sessions live here. Create new ones, rename them, or filter by type. Each session maintains its own context.",placement:"right"}],iv=[{target:"[data-tour='chat-input']",title:"Chat Input",content:"Type your message here. Press Enter to send, Shift+Enter for a new line. You can also drag & drop files or paste images.",placement:"top"},{target:"[data-tour='model-picker']",title:"Model Selection",content:"Switch between different AI models per session. Each model has different capabilities and response styles.",placement:"top"},{target:"[data-tour='settings']",title:"Settings",content:"Customize your experience with 12+ themes, font sizes, time formats, and more. Preferences are saved automatically.",placement:"bottom"}],d5=[...u5,...iv],h5=[...iv];function f5(e){return e==="multi"?d5:h5}Km();const Cc=Nc(),p5=v(!!(Cc?.url&&Cc.rememberMe)),gf=v(!1),cl=v(!vm()&&!Cc?.url),Si=v(!1);function g5(){z(()=>{nb(),Ub(),b5().finally(()=>{gf.value=!0})},[]);const e=()=>{cl.value=!1,bm()&&setTimeout(()=>{Si.value=!0},500)},t=()=>{cl.value=!1},r=()=>{Si.value=!1},a=Ce.value==="reconnecting",o=!cl.value&&!a&&(gf.value?!$.value:!p5.value);let l;return cl.value?l=n(e5,{onComplete:e,onSkip:t}):o?l=n(zk,{}):l=n(m5,{}),n(Ky,{children:[n(g2,{onError:s=>{pe.error(`Error: ${s.message}`)},children:n(s2,{children:l})}),n(f2,{position:"top-right"}),Si.value&&n(c5,{steps:f5(rn.value),onComplete:r})]})}function v5(e){e.url==="/settings"&&tn.value!=="/settings"&&(_p.value=tn.value),tn.value=e.url}function m5(){return n(qf,{onChange:v5,children:[n(Xo,{path:"/"}),n(Xo,{path:"/chat"}),n(Xo,{path:"/chat/:sessionKey"}),n(Gk,{path:"/overview"}),n(m_,{path:"/stats"}),n(D_,{path:"/channels"}),n(P_,{path:"/instances"}),n(V_,{path:"/sessions"}),n(w4,{path:"/cron"}),n(c_,{path:"/skills"}),n(j3,{path:"/devices"}),n(K4,{path:"/settings"}),n(B4,{path:"/config"}),n(v3,{path:"/debug"}),n(E3,{path:"/logs"}),n(Xo,{default:!0})]})}async function b5(){const e=Nc();if(!e?.url||!e.rememberMe)return;const t=Kf();if(t)try{await go({url:e.url,token:e.authMode==="token"?t:void 0,password:e.authMode==="password"?t:void 0,autoReconnect:!0}),await fs(),await kp(),await nu(),Xa("main"),await tu("main"),au(),ou(),_2()}catch{Fc("")}}Mi(n(g5,{}),document.querySelector("#app"));