@maudecode/cove 2026.2.13 → 2026.2.14

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.
@@ -1,426 +0,0 @@
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 i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&a(i)}).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 Il,V,vm,mm,ur,Lf,gm,bm,xm,Yd,Du,$u,ym,rl={},wm=[],Kx=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ml=Array.isArray;function on(e,t){for(var r in t)e[r]=t[r];return e}function Jd(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Cn(e,t,r){var a,o,l,i={};for(l in t)l=="key"?a=t[l]:l=="ref"?o=t[l]:i[l]=t[l];if(arguments.length>2&&(i.children=arguments.length>3?Il.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(l in e.defaultProps)i[l]===void 0&&(i[l]=e.defaultProps[l]);return ko(e,i,a,o,null)}function ko(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??++vm,__i:-1,__u:0};return o==null&&V.vnode!=null&&V.vnode(l),l}function G(e){return e.children}function mt(e,t){this.props=e,this.context=t}function da(e,t){if(t==null)return e.__?da(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"?da(e):null}function km(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 km(e)}}function Lu(e){(!e.__d&&(e.__d=!0)&&ur.push(e)&&!ii.__r++||Lf!=V.debounceRendering)&&((Lf=V.debounceRendering)||gm)(ii)}function ii(){for(var e,t,r,a,o,l,i,c=1;ur.length;)ur.length>c&&ur.sort(bm),e=ur.shift(),c=ur.length,e.__d&&(r=void 0,a=void 0,o=(a=(t=e).__v).__e,l=[],i=[],t.__P&&((r=on({},a)).__v=a.__v+1,V.vnode&&V.vnode(r),Xd(t.__P,r,a,t.__n,t.__P.namespaceURI,32&a.__u?[o]:null,l,o??da(a),!!(32&a.__u),i),r.__v=a.__v,r.__.__k[r.__i]=r,Cm(l,r,i),a.__e=a.__=null,r.__e!=o&&km(r)));ii.__r=0}function _m(e,t,r,a,o,l,i,c,d,u,h){var f,v,m,w,k,T,A,g=a&&a.__k||wm,x=t.length;for(d=qx(r,t,g,d,x),f=0;f<x;f++)(m=r.__k[f])!=null&&(v=m.__i==-1?rl:g[m.__i]||rl,m.__i=f,T=Xd(e,m,v,o,l,i,c,d,u,h),w=m.__e,m.ref&&v.ref!=m.ref&&(v.ref&&Zd(v.ref,null,m),h.push(m.ref,m.__c||w,m)),k==null&&w!=null&&(k=w),(A=!!(4&m.__u))||v.__k===m.__k?d=Sm(m,d,e,A):typeof m.type=="function"&&T!==void 0?d=T:w&&(d=w.nextSibling),m.__u&=-7);return r.__e=k,d}function qx(e,t,r,a,o){var l,i,c,d,u,h=r.length,f=h,v=0;for(e.__k=new Array(o),l=0;l<o;l++)(i=t[l])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=e.__k[l]=ko(null,i,null,null,null):Ml(i)?i=e.__k[l]=ko(G,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=e.__k[l]=ko(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):e.__k[l]=i,d=l+v,i.__=e,i.__b=e.__b+1,c=null,(u=i.__i=Gx(i,r,d,f))!=-1&&(f--,(c=r[u])&&(c.__u|=2)),c==null||c.__v==null?(u==-1&&(o>h?v--:o<h&&v++),typeof i.type!="function"&&(i.__u|=4)):u!=d&&(u==d-1?v--:u==d+1?v++:(u>d?v--:v++,i.__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=da(c)),Tm(c,c));return a}function Sm(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=Sm(o[l],t,r,a));return t}e.__e!=t&&(a&&(t&&e.type&&!t.parentNode&&(t=da(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function _r(e,t){return t=t||[],e==null||typeof e=="boolean"||(Ml(e)?e.some(function(r){_r(r,t)}):t.push(e)),t}function Gx(e,t,r,a){var o,l,i,c=e.key,d=e.type,u=t[r],h=u!=null&&(2&u.__u)==0;if(u===null&&c==null||h&&c==u.key&&d==u.type)return r;if(a>(h?1:0)){for(o=r-1,l=r+1;o>=0||l<t.length;)if((u=t[i=o>=0?o--:l++])!=null&&(2&u.__u)==0&&c==u.key&&d==u.type)return i}return-1}function Nf(e,t,r){t[0]=="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||Kx.test(t)?r:r+"px"}function os(e,t,r,a,o){var l,i;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||Nf(e.style,t,"");if(r)for(t in r)a&&r[t]==a[t]||Nf(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")l=t!=(t=t.replace(xm,"$1")),i=t.toLowerCase(),t=i in e||t=="onFocusOut"||t=="onFocusIn"?i.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+l]=r,r?a?r.u=a.u:(r.u=Yd,e.addEventListener(t,l?$u:Du,l)):e.removeEventListener(t,l?$u:Du,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 Of(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.t==null)t.t=Yd++;else if(t.t<r.u)return;return r(V.event?V.event(t):t)}}}function Xd(e,t,r,a,o,l,i,c,d,u){var h,f,v,m,w,k,T,A,g,x,C,b,S,_,M,I,F,D=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(d=!!(32&r.__u),l=[c=t.__e=r.__e]),(h=V.__b)&&h(t);e:if(typeof D=="function")try{if(A=t.props,g="prototype"in D&&D.prototype.render,x=(h=D.contextType)&&a[h.__c],C=h?x?x.props.value:h.__:a,r.__c?T=(f=t.__c=r.__c).__=f.__E:(g?t.__c=f=new D(A,C):(t.__c=f=new mt(A,C),f.constructor=D,f.render=Yx),x&&x.sub(f),f.state||(f.state={}),f.__n=a,v=f.__d=!0,f.__h=[],f._sb=[]),g&&f.__s==null&&(f.__s=f.state),g&&D.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=on({},f.__s)),on(f.__s,D.getDerivedStateFromProps(A,f.__s))),m=f.props,w=f.state,f.__v=t,v)g&&D.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),g&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(g&&D.getDerivedStateFromProps==null&&A!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(A,C),t.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(A,f.__s,C)===!1){for(t.__v!=r.__v&&(f.props=A,f.state=f.__s,f.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(Y){Y&&(Y.__=t)}),b=0;b<f._sb.length;b++)f.__h.push(f._sb[b]);f._sb=[],f.__h.length&&i.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(A,f.__s,C),g&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,w,k)})}if(f.context=C,f.props=A,f.__P=e,f.__e=!1,S=V.__r,_=0,g){for(f.state=f.__s,f.__d=!1,S&&S(t),h=f.render(f.props,f.state,f.context),M=0;M<f._sb.length;M++)f.__h.push(f._sb[M]);f._sb=[]}else do f.__d=!1,S&&S(t),h=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++_<25);f.state=f.__s,f.getChildContext!=null&&(a=on(on({},a),f.getChildContext())),g&&!v&&f.getSnapshotBeforeUpdate!=null&&(k=f.getSnapshotBeforeUpdate(m,w)),I=h,h!=null&&h.type===G&&h.key==null&&(I=Am(h.props.children)),c=_m(e,Ml(I)?I:[I],t,r,a,o,l,i,c,d,u),f.base=t.__e,t.__u&=-161,f.__h.length&&i.push(f),T&&(f.__E=f.__=null)}catch(Y){if(t.__v=null,d||l!=null)if(Y.then){for(t.__u|=d?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--;)Jd(l[F]);Nu(t)}else t.__e=r.__e,t.__k=r.__k,Y.then||Nu(t);V.__e(Y,t,r)}else l==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):c=t.__e=Vx(r.__e,t,r,a,o,l,i,d,u);return(h=V.diffed)&&h(t),128&t.__u?void 0:c}function Nu(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(Nu)}function Cm(e,t,r){for(var a=0;a<r.length;a++)Zd(r[a],r[++a],r[++a]);V.__c&&V.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(l){l.call(o)})}catch(l){V.__e(l,o.__v)}})}function Am(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:Ml(e)?e.map(Am):on({},e)}function Vx(e,t,r,a,o,l,i,c,d){var u,h,f,v,m,w,k,T=r.props||rl,A=t.props,g=t.type;if(g=="svg"?o="http://www.w3.org/2000/svg":g=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),l!=null){for(u=0;u<l.length;u++)if((m=l[u])&&"setAttribute"in m==!!g&&(g?m.localName==g:m.nodeType==3)){e=m,l[u]=null;break}}if(e==null){if(g==null)return document.createTextNode(A);e=document.createElementNS(o,g,A.is&&A),c&&(V.__m&&V.__m(t,l),c=!1),l=null}if(g==null)T===A||c&&e.data==A||(e.data=A);else{if(l=l&&Il.call(e.childNodes),!c&&l!=null)for(T={},u=0;u<e.attributes.length;u++)T[(m=e.attributes[u]).name]=m.value;for(u in T)if(m=T[u],u!="children"){if(u=="dangerouslySetInnerHTML")f=m;else if(!(u in A)){if(u=="value"&&"defaultValue"in A||u=="checked"&&"defaultChecked"in A)continue;os(e,u,null,m,o)}}for(u in A)m=A[u],u=="children"?v=m:u=="dangerouslySetInnerHTML"?h=m:u=="value"?w=m:u=="checked"?k=m:c&&typeof m!="function"||T[u]===m||os(e,u,m,T[u],o);if(h)c||f&&(h.__html==f.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(f&&(e.innerHTML=""),_m(t.type=="template"?e.content:e,Ml(v)?v:[v],t,r,a,g=="foreignObject"?"http://www.w3.org/1999/xhtml":o,l,i,l?l[0]:r.__k&&da(r,0),c,d),l!=null)for(u=l.length;u--;)Jd(l[u]);c||(u="value",g=="progress"&&w==null?e.removeAttribute("value"):w!=null&&(w!==e[u]||g=="progress"&&!w||g=="option"&&w!=T[u])&&os(e,u,w,T[u],o),u="checked",k!=null&&k!=e[u]&&os(e,u,k,T[u],o))}return e}function Zd(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){V.__e(o,r)}}function Tm(e,t,r){var a,o;if(V.unmount&&V.unmount(e),(a=e.ref)&&(a.current&&a.current!=e.__e||Zd(a,null,t)),(a=e.__c)!=null){if(a.componentWillUnmount)try{a.componentWillUnmount()}catch(l){V.__e(l,t)}a.base=a.__P=null}if(a=e.__k)for(o=0;o<a.length;o++)a[o]&&Tm(a[o],t,r||typeof e.type!="function");r||Jd(e.__e),e.__c=e.__=e.__e=void 0}function Yx(e,t,r){return this.constructor(e,r)}function Ou(e,t,r){var a,o,l,i;t==document&&(t=document.documentElement),V.__&&V.__(e,t),o=(a=!1)?null:t.__k,l=[],i=[],Xd(t,e=t.__k=Cn(G,null,[e]),o||rl,rl,t.namespaceURI,o?null:t.firstChild?Il.call(t.childNodes):null,l,o?o.__e:t.firstChild,a,i),Cm(l,e,i)}function Jx(e,t,r){var a,o,l,i,c=on({},e.props);for(l in e.type&&e.type.defaultProps&&(i=e.type.defaultProps),t)l=="key"?a=t[l]:l=="ref"?o=t[l]:c[l]=t[l]===void 0&&i!=null?i[l]:t[l];return arguments.length>2&&(c.children=arguments.length>3?Il.call(arguments,2):r),ko(e.type,c,a||e.key,o||e.ref,null)}function Em(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(i){i.__e=!0,Lu(i)})},this.sub=function(l){a.add(l);var i=l.componentWillUnmount;l.componentWillUnmount=function(){a&&a.delete(l),i&&i.call(l)}}),r.children}return t.__c="__cC"+ym++,t.__=e,t.Provider=t.__l=(t.Consumer=function(r,a){return r.children(a)}).contextType=t,t}Il=wm.slice,V={__e:function(e,t,r,a){for(var o,l,i;t=t.__;)if((o=t.__c)&&!o.__)try{if((l=o.constructor)&&l.getDerivedStateFromError!=null&&(o.setState(l.getDerivedStateFromError(e)),i=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,a||{}),i=o.__d),i)return o.__E=o}catch(c){e=c}throw e}},vm=0,mm=function(e){return e!=null&&e.constructor===void 0},mt.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=on({},this.state),typeof e=="function"&&(e=e(on({},r),this.props)),e&&on(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Lu(this))},mt.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Lu(this))},mt.prototype.render=G,ur=[],gm=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,bm=function(e,t){return e.__v.__b-t.__v.__b},ii.__r=0,xm=/(PointerCapture)$|Capture$/i,Yd=0,Du=Of(!1),$u=Of(!0),ym=0;var Xx=0;function n(e,t,r,a,o,l){t||(t={});var i,c,d=t;if("ref"in d)for(c in d={},t)c=="ref"?i=t[c]:d[c]=t[c];var u={type:e,props:d,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Xx,__i:-1,__u:0,__source:o,__self:l};if(typeof e=="function"&&(i=e.defaultProps))for(c in i)d[c]===void 0&&(d[c]=i[c]);return V.vnode&&V.vnode(u),u}const Zx="modulepreload",Qx=function(e){return"/"+e},Pf={},ci=function(t,r,a){let o=Promise.resolve();if(r&&r.length>0){let d=function(u){return Promise.all(u.map(h=>Promise.resolve(h).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=i?.nonce||i?.getAttribute("nonce");o=d(r.map(u=>{if(u=Qx(u),u in Pf)return;Pf[u]=!0;const h=u.endsWith(".css"),f=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const v=document.createElement("link");if(v.rel=h?"stylesheet":Zx,h||(v.as="script"),v.crossOrigin="",v.href=u,c&&v.setAttribute("nonce",c),document.head.appendChild(v),h)return new Promise((m,w)=>{v.addEventListener("load",m),v.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${u}`)))})}))}function l(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return o.then(i=>{for(const c of i||[])c.status==="rejected"&&l(c.reason);return t().catch(l)})};var Sr,he,Kc,Ff,al=0,Im=[],xe=V,zf=xe.__b,Uf=xe.__r,jf=xe.diffed,Hf=xe.__c,Bf=xe.unmount,Wf=xe.__;function Rl(e,t){xe.__h&&xe.__h(he,e,al||t),al=0;var r=he.__H||(he.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function U(e){return al=1,ey(Rm,e)}function ey(e,t,r){var a=Rl(Sr++,2);if(a.t=e,!a.__c&&(a.__=[r?r(t):Rm(void 0,t),function(c){var d=a.__N?a.__N[0]:a.__[0],u=a.t(d,c);d!==u&&(a.__N=[u,a.__[1]],a.__c.setState({}))}],a.__c=he,!he.__f)){var o=function(c,d,u){if(!a.__c.__H)return!0;var h=a.__c.__H.__.filter(function(v){return!!v.__c});if(h.every(function(v){return!v.__N}))return!l||l.call(this,c,d,u);var f=a.__c.props!==c;return h.forEach(function(v){if(v.__N){var m=v.__[0];v.__=v.__N,v.__N=void 0,m!==v.__[0]&&(f=!0)}}),l&&l.call(this,c,d,u)||f};he.__f=!0;var l=he.shouldComponentUpdate,i=he.componentWillUpdate;he.componentWillUpdate=function(c,d,u){if(this.__e){var h=l;l=void 0,o(c,d,u),l=h}i&&i.call(this,c,d,u)},he.shouldComponentUpdate=o}return a.__N||a.__}function O(e,t){var r=Rl(Sr++,3);!xe.__s&&Qd(r.__H,t)&&(r.__=e,r.u=t,he.__H.__h.push(r))}function Mm(e,t){var r=Rl(Sr++,4);!xe.__s&&Qd(r.__H,t)&&(r.__=e,r.u=t,he.__h.push(r))}function B(e){return al=5,pt(function(){return{current:e}},[])}function pt(e,t){var r=Rl(Sr++,7);return Qd(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function ee(e,t){return al=8,pt(function(){return e},t)}function ty(e){var t=he.context[e.__c],r=Rl(Sr++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(he)),t.props.value):e.__}function ny(){for(var e;e=Im.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ps),e.__H.__h.forEach(Pu),e.__H.__h=[]}catch(t){e.__H.__h=[],xe.__e(t,e.__v)}}xe.__b=function(e){he=null,zf&&zf(e)},xe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Wf&&Wf(e,t)},xe.__r=function(e){Uf&&Uf(e),Sr=0;var t=(he=e.__c).__H;t&&(Kc===he?(t.__h=[],he.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(Ps),t.__h.forEach(Pu),t.__h=[],Sr=0)),Kc=he},xe.diffed=function(e){jf&&jf(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Im.push(t)!==1&&Ff===xe.requestAnimationFrame||((Ff=xe.requestAnimationFrame)||ry)(ny)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Kc=he=null},xe.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Ps),r.__h=r.__h.filter(function(a){return!a.__||Pu(a)})}catch(a){t.some(function(o){o.__h&&(o.__h=[])}),t=[],xe.__e(a,r.__v)}}),Hf&&Hf(e,t)},xe.unmount=function(e){Bf&&Bf(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(a){try{Ps(a)}catch(o){t=o}}),r.__H=void 0,t&&xe.__e(t,r.__v))};var Kf=typeof requestAnimationFrame=="function";function ry(e){var t,r=function(){clearTimeout(a),Kf&&cancelAnimationFrame(t),setTimeout(e)},a=setTimeout(r,35);Kf&&(t=requestAnimationFrame(r))}function Ps(e){var t=he,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),he=t}function Pu(e){var t=he;e.__c=e.__(),he=t}function Qd(e,t){return!e||e.length!==t.length||t.some(function(r,a){return r!==e[a]})}function Rm(e,t){return typeof t=="function"?t(e):t}var ay=Symbol.for("preact-signals");function nc(){if(Bn>1)Bn--;else{for(var e,t=!1;_o!==void 0;){var r=_o;for(_o=void 0,Fu++;r!==void 0;){var a=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Lm(r))try{r.c()}catch(o){t||(e=o,t=!0)}r=a}}if(Fu=0,Bn--,t)throw e}}function rc(e){if(Bn>0)return e();Bn++;try{return e()}finally{nc()}}var oe=void 0;function Dm(e){var t=oe;oe=void 0;try{return e()}finally{oe=t}}var _o=void 0,Bn=0,Fu=0,ui=0;function $m(e){if(oe!==void 0){var t=e.n;if(t===void 0||t.t!==oe)return t={i:0,S:e,p:oe.s,n:void 0,t:oe,e:void 0,x:void 0,r:t},oe.s!==void 0&&(oe.s.n=t),oe.s=t,e.n=t,32&oe.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=oe.s,t.n=void 0,oe.s.n=t,oe.s=t),t}}function Pe(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}Pe.prototype.brand=ay;Pe.prototype.h=function(){return!0};Pe.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:Dm(function(){var a;(a=t.W)==null||a.call(t)}))};Pe.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&&Dm(function(){var o;(o=t.Z)==null||o.call(t)}))}};Pe.prototype.subscribe=function(e){var t=this;return Ae(function(){var r=t.value,a=oe;oe=void 0;try{e(r)}finally{oe=a}},{name:"sub"})};Pe.prototype.valueOf=function(){return this.value};Pe.prototype.toString=function(){return this.value+""};Pe.prototype.toJSON=function(){return this.value};Pe.prototype.peek=function(){var e=oe;oe=void 0;try{return this.value}finally{oe=e}};Object.defineProperty(Pe.prototype,"value",{get:function(){var e=$m(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Fu>100)throw new Error("Cycle detected");this.v=e,this.i++,ui++,Bn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{nc()}}}});function p(e,t){return new Pe(e,t)}function Lm(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 Nm(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 Om(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 $r(e,t){Pe.call(this,void 0),this.x=e,this.s=void 0,this.g=ui-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}$r.prototype=new Pe;$r.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ui))return!0;if(this.g=ui,this.f|=1,this.i>0&&!Lm(this))return this.f&=-2,!0;var e=oe;try{Nm(this),oe=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 oe=e,Om(this),this.f&=-2,!0};$r.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)}Pe.prototype.S.call(this,e)};$r.prototype.U=function(e){if(this.t!==void 0&&(Pe.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)}};$r.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($r.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=$m(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function W(e,t){return new $r(e,t)}function Pm(e){var t=e.u;if(e.u=void 0,typeof t=="function"){Bn++;var r=oe;oe=void 0;try{t()}catch(a){throw e.f&=-2,e.f|=8,eh(e),a}finally{oe=r,nc()}}}function eh(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Pm(e)}function oy(e){if(oe!==this)throw new Error("Out-of-order effect");Om(this),oe=e,this.f&=-2,8&this.f&&eh(this),nc()}function Fa(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=t?.name}Fa.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()}};Fa.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Pm(this),Nm(this),Bn++;var e=oe;return oe=this,oy.bind(this,e)};Fa.prototype.N=function(){2&this.f||(this.f|=2,this.o=_o,_o=this)};Fa.prototype.d=function(){this.f|=8,1&this.f||eh(this)};Fa.prototype.dispose=function(){this.d()};function Ae(e,t){var r=new Fa(e,t);try{r.c()}catch(o){throw r.d(),o}var a=r.d.bind(r);return a[Symbol.dispose]=a,a}var th,ac,qc,ly=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,Fm=[],zm=[];Ae(function(){th=this.N})();function za(e,t){V[e]=t.bind(null,V[e]||function(){})}function di(e){qc&&qc(),qc=e&&e.S()}function Um(e){var t=this,r=e.data,a=re(r);a.value=r;var o=pt(function(){for(var c=t,d=t.__v;d=d.__;)if(d.__c){d.__c.__$f|=4;break}var u=W(function(){var m=a.value.value;return m===0?0:m===!0?"":m||""}),h=W(function(){return!Array.isArray(u.value)&&!mm(u.value)}),f=Ae(function(){if(this.N=jm,h.value){var m=u.value;c.__v&&c.__v.__e&&c.__v.__e.nodeType===3&&(c.__v.__e.data=m)}}),v=t.__$u.d;return t.__$u.d=function(){f(),v.call(this)},[h,u]},[]),l=o[0],i=o[1];return l.value?i.peek():i.value}Um.displayName="ReactiveTextNode";Object.defineProperties(Pe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Um},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});za("__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 Pe&&(r||(t.__np=r={}),r[o]=l,a[o]=l.peek())}}e(t)});za("__r",function(e,t){if(t.type!==G){di();var r,a=t.__c;a&&(a.__$f&=-2,(r=a.__$u)===void 0&&(a.__$u=r=(function(o,l){var i;return Ae(function(){i=this},{name:l}),i.c=o,i})(function(){var o;ly&&((o=r.y)==null||o.call(r)),a.__$f|=1,a.setState({})},typeof t.type=="function"?t.type.displayName||t.type.name:""))),ac=a,di(r)}e(t)});za("__e",function(e,t,r,a){di(),ac=void 0,e(t,r,a)});za("diffed",function(e,t){di(),ac=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 i in l){var c=l[i];c!==void 0&&!(i in a)&&(c.d(),l[i]=void 0)}else l={},r.U=l;for(var d in a){var u=l[d],h=a[d];u===void 0?(u=sy(r,d,h,o),l[d]=u):u.o(h,o)}}}e(t)});function sy(e,t,r,a){var o=t in e&&e.ownerSVGElement===void 0,l=p(r);return{o:function(i,c){l.value=i,a=c},d:Ae(function(){this.N=jm;var i=l.value.value;a[t]!==i&&(a[t]=i,o?e[t]=i:i!=null&&(i!==!1||t[4]==="-")?e.setAttribute(t,i):e.removeAttribute(t))})}}za("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 i=t.__c;if(i){var c=i.__$u;c&&(i.__$u=void 0,c.d())}}e(t)});za("__h",function(e,t,r,a){(a<3||a===9)&&(t.__$f|=2),e(t,r,a)});mt.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 i in e)if(i!=="__source"&&e[i]!==this.props[i])return!0;for(var c in this.props)if(!(c in e))return!0;return!1};function re(e,t){return pt(function(){return p(e,t)},[])}function oc(e,t){var r=B(e);return r.current=e,ac.__$f|=4,pt(function(){return W(function(){return r.current()},t)},[])}var iy=typeof requestAnimationFrame>"u"?setTimeout:function(e){var t=function(){clearTimeout(r),cancelAnimationFrame(a),e()},r=setTimeout(t,35),a=requestAnimationFrame(t)},cy=function(e){queueMicrotask(function(){queueMicrotask(e)})};function uy(){rc(function(){for(var e;e=Fm.shift();)th.call(e)})}function dy(){Fm.push(this)===1&&(V.requestAnimationFrame||iy)(uy)}function hy(){rc(function(){for(var e;e=zm.shift();)th.call(e)})}function jm(){zm.push(this)===1&&(V.requestAnimationFrame||cy)(hy)}function zu(e,t){var r=B(e);r.current=e,O(function(){return Ae(function(){return this.N=dy,r.current()},t)},[])}var fy={};function ls(e,t){for(var r in t)e[r]=t[r];return e}function py(e,t,r){var a,o=/(?:\?([^#]*))?(#.*)?$/,l=e.match(o),i={};if(l&&l[1])for(var c=l[1].split("&"),d=0;d<c.length;d++){var u=c[d].split("=");i[decodeURIComponent(u[0])]=decodeURIComponent(u.slice(1).join("="))}e=Uu(e.replace(o,"")),t=Uu(t||"");for(var h=Math.max(e.length,t.length),f=0;f<h;f++)if(t[f]&&t[f].charAt(0)===":"){var v=t[f].replace(/(^:|[+*?]+$)/g,""),m=(t[f].match(/[+*?]+$/)||fy)[0]||"",w=~m.indexOf("+"),k=~m.indexOf("*"),T=e[f]||"";if(!T&&!k&&(m.indexOf("?")<0||w)){a=!1;break}if(i[v]=decodeURIComponent(T),w||k){i[v]=e.slice(f).map(decodeURIComponent).join("/");break}}else if(t[f]!==e[f]){a=!1;break}return(r.default===!0||a!==!1)&&i}function vy(e,t){return e.rank<t.rank?1:e.rank>t.rank?-1:e.index-t.index}function my(e,t){return e.index=t,e.rank=(function(r){return r.props.default?0:Uu(r.props.path).map(gy).join("")})(e),e.props}function Uu(e){return e.replace(/(^\/+|\/+$)/g,"").split("/")}function gy(e){return e.charAt(0)==":"?1+"*+?".indexOf(e.charAt(e.length-1))||4:5}var by={},mr=[],qf=[],ct=null,Hm={url:lc()},xy=Em(Hm);function lc(){var e;return""+((e=ct&&ct.location?ct.location:ct&&ct.getCurrentLocation?ct.getCurrentLocation():typeof location<"u"?location:by).pathname||"")+(e.search||"")}function De(e,t){return t===void 0&&(t=!1),typeof e!="string"&&e.url&&(t=e.replace,e=e.url),(function(r){for(var a=mr.length;a--;)if(mr[a].canRoute(r))return!0;return!1})(e)&&(function(r,a){a===void 0&&(a="push"),ct&&ct[a]?ct[a](r):typeof history<"u"&&history[a+"State"]&&history[a+"State"](null,null,r)})(e,t?"replace":"push"),Bm(e)}function Bm(e){for(var t=!1,r=0;r<mr.length;r++)mr[r].routeTo(e)&&(t=!0);return t}function yy(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 De(t)}}function wy(e){return e.stopImmediatePropagation&&e.stopImmediatePropagation(),e.stopPropagation&&e.stopPropagation(),e.preventDefault(),!1}function ky(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(yy(t))return wy(e)}while(t=t.parentNode)}}var Gf=!1;function Wm(e){e.history&&(ct=e.history),this.state={url:e.url||lc()}}ls(Wm.prototype=new mt,{shouldComponentUpdate:function(e){return e.static!==!0||e.url!==this.props.url||e.onChange!==this.props.onChange},canRoute:function(e){var t=_r(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;Gf||(Gf=!0,ct||addEventListener("popstate",function(){Bm(lc())}),addEventListener("click",ky)),mr.push(this),ct&&(this.u=ct.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(),mr.splice(mr.indexOf(this),1)},componentWillUpdate:function(){this.p=!0},componentDidUpdate:function(){this.p=!1},g:function(e,t){e=e.filter(my).sort(vy);for(var r=0;r<e.length;r++){var a=e[r],o=py(t,a.props.path,a.props);if(o)return[a,o]}},render:function(e,t){var r,a,o=e.onChange,l=t.url,i=this.c,c=this.g(_r(e.children),l);if(c&&(a=Jx(c[0],ls(ls({url:l,matches:r=c[1]},r),{key:void 0,ref:void 0}))),l!==(i&&i.url)){ls(Hm,i=this.c={url:l,previous:i&&i.url,current:a,path:a?a.props.path:null,matches:r}),i.router=this,i.active=a?[a]:[];for(var d=qf.length;d--;)qf[d]({});typeof o=="function"&&o(i)}return Cn(xy.Provider,{value:i},a)}});const Vf={selected:"system",lightTheme:"light",darkTheme:"dark"},_y={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"}},Sy={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"}},Cy={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"}},Ay={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"}},Ty={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"}},Ey={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"}},Iy={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"}},My={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"}},Ry={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"}},Dy={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"}},$y={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"}},Ly={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"}},Ny={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"}},Oy={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"}},Py={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"}},Fy={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"}},zy={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"}},Uy={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"}},jy={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"}},Hy={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"}},Km=[_y,Sy,Cy,$y,Hy,Ly,Ey,Ay,Ty,Oy,Py,Fy,Iy,My,Ry,Dy,zy,Uy,jy,Ny],By=new Map(Km.map(e=>[e.id,e]));function ss(e,t=[]){return By.get(e)??t.find(r=>r.id===e)}const nh="cove:",Yf=1;function be(e){try{const t=localStorage.getItem(nh+e);return t===null?null:JSON.parse(t)}catch{return null}}function ye(e,t){try{localStorage.setItem(nh+e,JSON.stringify(t))}catch{}}function hi(e){localStorage.removeItem(nh+e)}const rh="cove:session-auth";function sc(){const e=be("auth");return e?(e.credential&&(ah({...e,credential:void 0}),oh(e.credential)),e):null}function ah(e){const t={url:e.url,authMode:e.authMode,rememberMe:e.rememberMe};ye("auth",t),e.credential&&(e.rememberMe?(ye("credential",e.credential),qm()):(oh(e.credential),hi("credential")))}function Wy(){hi("auth"),hi("credential"),qm()}function oh(e){try{sessionStorage.setItem(rh,JSON.stringify({credential:e}))}catch{}}function lh(){try{const e=be("credential");if(e)return e;const t=sessionStorage.getItem(rh);return t&&JSON.parse(t).credential||null}catch{return null}}function qm(){try{sessionStorage.removeItem(rh)}catch{}}function Ky(){return be("hasCompletedOnboarding")??!1}function Jf(){ye("hasCompletedOnboarding",!0)}function qy(e){ye("pendingTour",e)}function Gy(){const e=be("pendingTour")??!1;return e&&hi("pendingTour"),e}const ic={timeFormat:"relative",fontSize:"md",fontFamily:"geist",sidebarWidth:280};function Vy(){return be("time-format")??ic.timeFormat}function Yy(e){ye("time-format",e)}function Jy(){return be("font-size")??ic.fontSize}function Xy(e){ye("font-size",e)}function Zy(){return be("font-family")??ic.fontFamily}function Qy(e){ye("font-family",e)}function e0(){const e=be("locale");return e||((navigator.language||"en").startsWith("en"),"en")}function t0(){return be("theme-preference")}function n0(e){ye("theme-preference",e)}function r0(){return be("sidebarWidth")??ic.sidebarWidth}function a0(e){ye("sidebarWidth",e)}function o0(){const e=be("messages-session"),t=be("messages-cache");return e&&t?{sessionKey:e,messages:t}:null}function l0(e,t){ye("messages-session",e),ye("messages-cache",t)}function s0(){return be("sessions-cache")}function i0(e){ye("sessions-cache",e)}function c0(){return be("usage-cache")}function u0(e){ye("usage-cache",e)}function d0(){return be("sessions-usage-cache")}function h0(e){ye("sessions-usage-cache",e)}function f0(){const e=be("model-favorites");return new Set(e??[])}function p0(e){ye("model-favorites",[...e])}function v0(){return be("custom-themes")??[]}function m0(e,t){ye("theme-cache",{id:e,css:t})}const g0={useDefaults:!0,defaultAgentId:"main"};function b0(){return be("new-chat-settings")??g0}function x0(e){ye("new-chat-settings",e)}function y0(){return be("app-mode")??"single"}function w0(e){ye("app-mode",e)}function k0(){return be("canvas-node-enabled")??!1}function _0(e){ye("canvas-node-enabled",e)}function S0(){return be("heartbeat-seen-count")??0}function C0(e){ye("heartbeat-seen-count",e)}function A0(){(be("schemaVersion")??0)<Yf&&ye("schemaVersion",Yf)}const lt=p(E0()),Gm=p(v0()),T0=W(()=>{const e=lt.value,t=Gm.value;if(e.selected==="system"){const a=window.matchMedia("(prefers-color-scheme: dark)").matches?e.darkTheme:e.lightTheme;return ss(a,t)??ss("dark",t)}return ss(e.selected,t)??ss("dark",t)});function E0(){const e=t0();return e?{...Vf,...e}:Vf}function I0(e){const t=document.documentElement;for(const[r,a]of Object.entries(e))t.style.setProperty(r,a)}function M0(e){m0(e.id,JSON.stringify({id:e.id,appearance:e.appearance,colors:e.colors}))}function R0(e){I0(e.colors),M0(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 So(e){lt.value={...lt.value,selected:e}}function D0(e){lt.value={...lt.value,lightTheme:e}}function $0(e){lt.value={...lt.value,darkTheme:e}}function ju(){return[...Km,...Gm.value]}function L0(){Ae(()=>{const t=T0.value;R0(t)}),Ae(()=>{n0(lt.value)}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{lt.value.selected==="system"&&(lt.value={...lt.value})})}const N0={name:"Cove",description:"OpenClaw WebUI",tagline:"A cozy home for your AI assistant"},O0={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",canvasTitle:"Enable Canvas",canvasDesc:"Let the agent push images and content to your browser"},P0={skipTour:"Skip tour",steps:{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."},chatInput:{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."},modelPicker:{title:"Model Selection",content:"Switch between different AI models per session. Each model has different capabilities and response styles."},settings:{title:"Settings",content:"Customize your experience with 12+ themes, font sizes, time formats, and more. Preferences are saved automatically."},canvasPairing:{title:"Approve Your Device",content:"Your browser needs to be approved as a canvas device. Click the approve button to allow your agent to push content here."},canvasButton:{title:"Canvas",content:"Your agent can push images, diagrams, and content directly here. Click to open the canvas panel."}},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"},F0={send:"Send",queue:"Queue",stop:"Stop",rename:"Rename",cancel:"Cancel",close:"Close",save:"Save",saved:"Saved",saving:"Saving...",clear:"Clear",create:"Create",creating:"Creating...",new:"New",delete:"Delete",deleting:"Deleting...",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",selectAll:"Select All",deselectAll:"Deselect All",more:"More",less:"Less",viewAll:"View All",showMore:"Show More",showLess:"Show Less",remove:"Remove",download:"Download"},z0={confirmDelete:"Are you sure?",deleting:"Deleting...",saving:"Saving...",loading:"Loading...",noData:"No data",noResults:"No results found",tryAgain:"Try again",dismiss:"Dismiss",enabled:"Enabled",disabled:"Disabled",dark:"Dark",light:"Light"},U0={placeholder:"Type a command...",loading:"Loading...",noItems:"No items",noMatches:"No matches",noCommands:"No commands found",failedToLoad:"Failed to load",hints:{navigate:"↑↓ navigate",select:"↵ select",close:"esc close",back:"esc back"},categories:{recent:"Recent",chat:"Chat",session:"Session",model:"Model",cron:"Automation",gateway:"Gateway",settings:"Settings"},commands:{chat:{abort:"Abort response",clear:"Clear chat",search:"Search in chat",export:"Export as Markdown",copyLast:"Copy last response"},session:{switch:"Switch session",delete:"Delete current session",copyKey:"Copy session key"},model:{change:"Change model"},cron:{run:"Run cron job",toggle:"Toggle cron job"},gateway:{restart:"Restart gateway"},settings:{theme:"Change theme",systemTheme:"System (auto)"}},confirm:{deleteSession:"Delete this session?",restartGateway:"Restart the gateway? Connection will drop briefly."}},j0={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"}},H0={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}"},B0={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"},W0={connected:"Healthy",disconnected:"Disconnected",connecting:"Connecting",reconnecting:"Reconnecting",error:"Error",online:"Online",offline:"Offline",loading:"Loading...",saving:"Saving...",processing:"Processing..."},K0={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"},q0={chat:"Chat",sessions:"Sessions",overview:"Overview",usage:"Usage",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",agents:"Agents",nodes:"Nodes",devices:"Devices",sections:{chat:"Chat",control:"Control",agent:"Agent",settings:"Settings",resources:"Resources"}},G0={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"},V0={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}"},thinkingBlock:{thinking:"Thinking",thoughtFor:"Thought for ~{duration}",second:"{count} second",second_plural:"{count} seconds",expandLabel:"Expand thinking",collapseLabel:"Collapse thinking"},heartbeats:"{count} heartbeat",heartbeats_plural:"{count} heartbeats",heartbeatsTitle:"Heartbeats",noHeartbeats:"No heartbeats yet",compacting:"Compacting…",conversationCompacted:"Conversation compacted",compactionLabel:"Compacted",cronJobCompleted:"Cron job completed",dateFrom:"From",dateTo:"To",attachImage:"Attach image",dropFiles:"Drop files here",imageViewer:"Image viewer",copyMarkdown:"Copy markdown"},Y0={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"}}},J0={addFavorite:"Add to favorites",removeFavorite:"Remove from favorites"},X0={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"},device:{title:"Canvas Node",enabled:"Enable Canvas",enabledDescription:"Register as a node so the agent can push content to this browser",id:"Device ID",name:"Display Name",nameDescription:"Custom name shown in node list",status:"Status",connected:"Connected",disconnected:"Not connected"},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"},Z0={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",announces:"Announces results",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)",announceResults:"Announce Results",announceResultsHint:"Send job results back to your chat when complete."},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"}},Q0={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"},e1={serverInfo:"Server Information",version:"Version",commit:"Commit",host:"Host",capabilities:"Capabilities",capabilitiesCount:"{count} methods"},t1={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",viewLogDetails:"View log details",logDetails:"Log Details",message:"Message",rawLine:"Raw",fields:"fields"},n1={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"}},r1={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"}},a1={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}"}},o1={title:"Agents",description:"Manage agent configuration and workspace files.",selectAgent:"Select agent",newAgent:"New Agent",deleteAgent:"Delete Agent",loadError:"Failed to load agent data",tabs:{overview:"Overview",files:"Files",tools:"Tools",skills:"Skills"},overview:{title:"Overview",model:"Model",modelDescription:"Primary model for this agent",fallbacks:"Fallbacks",fallbacksDescription:"Comma-separated fallback models",fallbacksPlaceholder:"provider/model, provider/model",identity:"Identity",identityName:"Name",identityEmoji:"Emoji",avatar:"Avatar",avatarPlaceholder:"avatar.jpg or https://...",namePlaceholder:"Agent name",workspace:"Workspace",workspacePath:"Path",workspacePlaceholder:"/path/to/workspace",modelPlaceholder:"anthropic/claude-sonnet-4-20250514",editHint:"Avatar: relative path, URL, or data URI. Model: leave empty to keep current.",isDefault:"Default Agent",inheritDefault:"Inherit default ({model})"},files:{title:"Files",totalTokens:"~{count} tokens injected per run",loadError:"Failed to load workspace files",loadFileError:"Failed to load file",saveError:"Failed to save file",saved:"File saved",missing:"Missing",create:"Create",edit:"Edit",view:"View",unsaved:"Unsaved",unsavedWarning:"You have unsaved changes. Are you sure you want to leave?",backToList:"Back to Files",emptyFile:"This file is empty.",editPlaceholder:"Enter file content...",memoryHint:{title:"About Memory Files",line1:"Files in the memory/ folder are not editable here.",line2:"Use the chat to update memory/*.md files."},meta:{agents:"Agent behavior and workspace rules",soul:"Persona and communication style",tools:"Tool usage notes and conventions",identity:"Agent identity (name, email, accounts)",user:"User profile and preferences",heartbeat:"Heartbeat checklist and reminders",bootstrap:"First-run ritual (deleted after completion)",memory:"Durable facts, preferences, and context",unknown:"Configuration file"}},tools:{title:"Tools",description:"Configure tool access for this agent.",profile:"Profile",profileDescription:"Base tool access profile",profiles:{full:"Full — All tools enabled",coding:"Coding — Files, exec, web",messaging:"Messaging — Messages, sessions",minimal:"Minimal — Read-only basics"},sections:{files:"Files",runtime:"Runtime",web:"Web",memory:"Memory",sessions:"Sessions",automation:"Automation"},toolDescriptions:{read:"Read file contents",write:"Create or overwrite files",edit:"Make precise edits",exec:"Run shell commands",process:"Manage background processes",webSearch:"Search the web",webFetch:"Fetch web content",browser:"Control web browser",memorySearch:"Semantic search",memoryGet:"Read memory files",sessionsList:"List sessions",sessionsSend:"Send to session",sessionsSpawn:"Spawn sub-agent",message:"Send messages",cron:"Schedule tasks",gateway:"Gateway control",nodes:"Node devices"},enableAll:"Enable All",disableAll:"Disable All",enabled:"{count} enabled",overrides:"Overrides"},skills:{title:"Agent Skill Access",description:"Enable or disable skills for this agent.",filter:"Filter skills",noSkills:"No eligible skills available",noSearchResults:"No skills match your search",enabledCount:"{count} enabled",usingAllowlist:"Using allowlist: {allowed} of {total} skills",usingAll:"Using all {count} eligible skills",useAll:"Use All Skills",useAllHint:"= agent can use any eligible skill (no allowlist).",selectAll:"Select All",selectNone:"Select None",selectSpecific:"Select specific skills",selectSpecificHint:"= agent can only use checked skills.",globalHint:"To globally enable/disable skills, visit the",page:"page",searchPlaceholder:"Search skills...",alwaysActive:"Always active",details:"Details"},create:{title:"Create Agent",name:"Name",nameHint:"Used as the agent ID (lowercase, no spaces)",namePlaceholder:"my-agent",workspace:"Workspace",workspacePlaceholder:"~/agents/my-agent",emoji:"Emoji (optional)",emojiPlaceholder:"🤖",requiredFields:"Name and workspace are required",submit:"Create Agent",success:"Agent created"},delete:{title:"Delete Agent",warning:"This action cannot be undone",warningDescription:"Deleting this agent will permanently remove its configuration from OpenClaw. Make sure you have backups if needed.",willDelete:"This will permanently delete:",willDeleteConfig:"Agent configuration from openclaw.json",willDeleteBindings:"Any channel bindings for this agent",willDeleteSessions:"Session associations (session data is preserved)",includeFiles:"Also delete workspace files",includeFilesDescription:"Permanently delete all files in {path}",confirmPrompt:'Type "{id}" to confirm deletion:',confirmMismatch:"Please type the agent ID to confirm deletion",submit:"Delete Agent",success:"Agent deleted"}},l1={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"}},s1={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"}},i1={title:"Usage",description:"Token usage and cost analytics",loadError:"Failed to load usage data",gateway:{title:"Gateway",unknown:"Unknown host",uptime:"Uptime",sessions:"Sessions"},summary:{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"},sessions:{title:"Sessions",noData:"No session usage data available",name:"Session",model:"Model",tokens:"Tokens",cost:"Cost",lastActive:"Last Active",showing:"Showing {from}–{to} of {total}",viewDetails:"View details for {name}"},detail:{title:"Session Details",contextWeight:"Context Weight",skills:"Skills",tools:"Tools",files:"Files",system:"System Prompt",other:"Other",tabs:{overview:"Overview",timeline:"Timeline",messages:"Messages"},noTimeline:"No timeline data available for this session",noMessages:"No message logs available for this session",cumulativeTokens:"Cumulative Tokens",requests:"Requests",totalTokens:"Total Tokens",totalCost:"Total Cost",role:{user:"User",assistant:"Assistant",tool:"Tool",toolResult:"Result"},tokenCount:"{count} tokens"}},c1={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"}},u1={title:"Canvas",close:"Close canvas",minimize:"Minimize",maximize:"Maximize",restore:"Restore",expand:"Expand",openInNewTab:"Open in new tab",openUrlInNewTab:"Open URL in new tab",openCanvasTab:"Pop out to canvas tab",iframeTitle:"Canvas content",imageAlt:"Canvas image",noContent:"No content to display",noContentHint:"The assistant can push content here."},d1={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"},h1={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",subsections:"Subsections",general:"General",noSettingsAtLevel:"No settings available at this level.",schemaNotFound:"Schema not found for path: {path}",mobileNotReady:"Mobile editing coming soon",mobileNotReadyHint:"Use desktop for full configuration editing.",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",moveUp:"Move up",moveDown:"Move down",invalidJson:"Invalid JSON"}},f1={app:N0,onboarding:O0,tour:P0,actions:F0,common:z0,commandPalette:U0,auth:j0,errors:H0,exec:B0,status:W0,connection:K0,nav:q0,newChatModal:G0,chat:V0,sessions:Y0,models:J0,settings:X0,cron:Z0,debug:Q0,overview:e1,logs:t1,channels:n1,instances:r1,skills:a1,agents:o1,devices:l1,nodes:s1,usage:i1,time:c1,canvas:u1,accessibility:d1,config:h1},to={en:f1};function p1(e){if(to[e])return to[e];const t=e.split("-")[0];return to[t]?to[t]:to.en}const Cr=p(Vy()),ha=p(Jy()),fa=p(Zy()),Ze=p(b0()),un=p(y0()),We=p(k0()),Dl=W(()=>un.value==="multi"),ol=W(()=>un.value==="single");Ae(()=>Yy(Cr.value));Ae(()=>Xy(ha.value));Ae(()=>Qy(fa.value));Ae(()=>x0(Ze.value));Ae(()=>w0(un.value));Ae(()=>_0(We.value));typeof window<"u"&&window.addEventListener("storage",e=>{if(e.key==="cove:canvas-node-enabled"){const t=e.newValue==="true";We.value!==t&&(We.value=t,ci(()=>Promise.resolve().then(()=>Yb),void 0).then(r=>{t?r.startNodeConnection():r.stopNodeConnection()}))}});Ae(()=>{document.documentElement.dataset.fontSize=ha.value});Ae(()=>{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[fa.value])});const Vm=[{value:"sm",labelKey:"settings.appearance.fontSizeSm"},{value:"md",labelKey:"settings.appearance.fontSizeMd"},{value:"lg",labelKey:"settings.appearance.fontSizeLg"}],Ym=[{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"}],Jm=[{value:"relative",labelKey:"settings.preferences.timeRelative"},{value:"local",labelKey:"settings.preferences.timeAbsolute"}];function Xm(){ha.value="md",fa.value="geist",Cr.value="relative",Ze.value={useDefaults:!0,defaultAgentId:"main"},un.value="single"}const v1=Object.freeze(Object.defineProperty({__proto__:null,FONT_FAMILY_OPTIONS:Ym,FONT_SIZE_OPTIONS:Vm,TIME_FORMAT_OPTIONS:Jm,appMode:un,canvasNodeEnabled:We,fontFamily:fa,fontSize:ha,isMultiChatMode:Dl,isSingleChatMode:ol,newChatSettings:Ze,resetToDefaults:Xm,timeFormat:Cr},Symbol.toStringTag,{value:"Module"})),Xf={debug:0,info:1,warn:2,error:3,off:4};function m1(){return"off"}const g1=m1();function is(e){return Xf[e]>=Xf[g1]}function cs(e,t){return`[${e}] ${t}`}function Rn(e){return{debug:(t,...r)=>{is("debug")&&(console.debug(cs(e,t),...r),r.length,void 0)},info:(t,...r)=>{is("info")&&(console.info(cs(e,t),...r),r.length,void 0)},warn:(t,...r)=>{is("warn")&&(console.warn(cs(e,t),...r),r.length,void 0)},error:(t,...r)=>{is("error")&&(console.error(cs(e,t),...r),r.length,void 0)}}}const E={gateway:Rn("gateway"),auth:Rn("auth"),chat:Rn("chat"),exec:Rn("exec"),i18n:Rn("i18n"),node:Rn("node"),ui:Rn("ui"),usage:Rn("usage")},Vn=p(e0()),Zf=p(p1(Vn.value)),Qf=W(()=>["ar","he","fa","ur"].includes(Vn.value.split("-")[0]));function b1(){document.documentElement.dir=Qf.value?"rtl":"ltr",document.documentElement.lang=Vn.value,Ae(()=>{document.documentElement.dir=Qf.value?"rtl":"ltr",document.documentElement.lang=Vn.value})}function ep(e,t){return t.split(".").reduce((r,a)=>{if(r&&typeof r=="object"&&a in r)return r[a]},e)}function s(e,t){let r=ep(Zf.value,e);if(t?.count!==void 0&&typeof t.count=="number"){const o=t.count===1?e:`${e}_plural`,l=ep(Zf.value,o);l!==void 0&&(r=l)}return typeof r!="string"?(E.i18n.warn(`Missing translation: ${e}`),e):t?r.replace(/\{(\w+)\}/g,(a,o)=>t[o]?.toString()??`{${o}}`):r}function Zm(e,t="short"){const r=typeof e=="number"?new Date(e):e;return new Intl.DateTimeFormat(Vn.value,{timeStyle:t}).format(r)}function tp(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),i=Math.round(l/60),c=Math.round(i/24),d=Math.round(c/7),u=Math.round(c/30),h=Math.round(c/365),f=new Intl.RelativeTimeFormat(Vn.value,{numeric:"auto"});return Math.abs(o)<60?f.format(o,"second"):Math.abs(l)<60?f.format(l,"minute"):Math.abs(i)<24?f.format(i,"hour"):Math.abs(c)<7?f.format(c,"day"):Math.abs(d)<4?f.format(d,"week"):Math.abs(u)<12?f.format(u,"month"):f.format(h,"year")}function le(e,t){return t?.relative?tp(e):Cr.value==="local"?Zm(e,"short"):tp(e)}function x1(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),i=Math.round(l/60),c=Math.round(i/24),d=Math.round(c/7),u=Math.round(c/30),h=Math.round(c/365);return o<60?s("time.compact.now"):l<60?s("time.compact.minutes",{count:l}):i<24?s("time.compact.hours",{count:i}):c<7?s("time.compact.days",{count:c}):d<4?s("time.compact.weeks",{count:d}):u<12?s("time.compact.months",{count:u}):s("time.compact.years",{count:h})}function fi(e){if(Cr.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()?Zm(t,"short"):t.getFullYear()===r.getFullYear()?new Intl.DateTimeFormat(Vn.value,{month:"short",day:"numeric"}).format(t):new Intl.DateTimeFormat(Vn.value,{month:"short",year:"2-digit"}).format(t)}return x1(e)}function Hu(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function pi(e){return e<1e3?`${e}`:e<1e4?`${(e/1e3).toFixed(1)}K`:`${Math.round(e/1e3)}K`}const np=3,y1=1e3,w1=3e4,k1=1.5,_1=3e4,S1=3e4,Ee=p("disconnected"),L=W(()=>Ee.value==="connected"),C1=p(!0),zn=p(null),At=p(null),st=p(null),sh=p(null),Be=p(null),ih=p([]),zt=p(0),$l=p(null),Ua=p(null),A1=p(null),ll=p(null),Yn=p(null),Qm=p(null),Co=p(null),Ao=p(null),Ll=p([]),ch=W(()=>{const e=Qm.value,t=Yn.value;if(e==null||t==null)return null;const r=Date.now()-t;return e+r});let Te=null,Zr=null,T1=0,Fs=null,Qr=null;const pa=new Map,Bu=new Set,E1=5e3;function rp(e,t){return new Promise(r=>{if(t?.aborted){r({ok:!1,error:"Aborted"});return}let a=null,o=null,l=!1;const i=()=>{o&&(clearTimeout(o),o=null),a&&(a.onopen=null,a.onmessage=null,a.onerror=null,a.onclose=null,a.close(),a=null)},c=u=>{l||(l=!0,i(),r({ok:!1,error:u}))},d=u=>{l||(l=!0,i(),r({ok:!0,version:u}))};t?.addEventListener("abort",()=>{c("Aborted")}),o=setTimeout(()=>{c("Connection timed out")},E1);try{a=new WebSocket(e),a.onopen=()=>{E.gateway.debug("Probe: WebSocket opened, waiting for challenge...")},a.onmessage=u=>{try{const h=JSON.parse(u.data);h.type==="evt"&&h.event==="connect.challenge"?(E.gateway.debug("Probe: Received connect.challenge, gateway is valid"),d(h.payload?.version)):(E.gateway.debug("Probe: Received unexpected message:",h.type,h.event),d())}catch{c("Invalid response from server")}},a.onerror=u=>{E.gateway.error("Probe WebSocket error:",{url:e,event:u.type}),c("Connection failed")},a.onclose=u=>{u.wasClean||c("Connection closed unexpectedly")}}catch(u){c(u instanceof Error?u.message:"Failed to connect")}})}function Nl(e){const t=zt.value>0;return Te&&(t?(Te.onclose=null,Te.close(),Te=null):va()),Zr=e,Ee.value="connecting",C1.value=!1,zn.value=null,t||(zt.value=0),st.value=e.url,new Promise((r,a)=>{try{Te=new WebSocket(e.url),Te.onopen=()=>{Ee.value="authenticating"},Te.onmessage=o=>{try{const l=JSON.parse(o.data);if(Ee.value==="authenticating"&&l.type==="event"&&l.event==="connect.challenge"){I1(e).then(i=>{Ee.value="connected",Yn.value=Date.now(),At.value=i.server?.version??null,$l.value=i.server?.commit??null,Ua.value=i.server?.host??null,sh.value=i.server?.connId??null,A1.value=i.canvasHostUrl??null,ih.value=i.features?.methods??[],ll.value=i.policy?.tickIntervalMs??null,Ll.value=i.snapshot?.presence??[],Qm.value=i.snapshot?.uptimeMs??null,Co.value=i.snapshot?.configPath??null,Ao.value=i.snapshot?.stateDir??null;const c=i.snapshot?.sessionDefaults;c?.mainSessionKey&&(Be.value=c.mainSessionKey,E.gateway.info("Main session key:",Be.value)),L1(),r(i)}).catch(i=>{zn.value=i.message,va(),a(i)});return}R1(l)}catch(l){E.gateway.error(" Failed to parse message:",l)}},Te.onerror=o=>{E.gateway.error("WebSocket error:",{url:e.url,readyState:Te?.readyState,event:o.type}),zn.value="WebSocket error - check console for details"},Te.onclose=o=>{const i=Ee.value==="connected",c=zt.value>0;uh(),eg(new Error("Connection closed")),(i||c)&&Zr?.autoReconnect!==!1?N1():Ee.value="disconnected"}}catch(o){Ee.value="disconnected",zn.value=o instanceof Error?o.message:"Failed to connect",a(o)}})}async function I1(e){const t={minProtocol:np,maxProtocol:np,client:{id:"webchat",displayName:"Cove",version:"2026.2.13",platform:M1(),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 N("connect",t)}function M1(){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 va(){Zr=null,uh(),O1(),eg(new Error("Disconnected")),Te&&(Te.onclose=null,Te.close(),Te=null),Ee.value="disconnected",Yn.value=null,At.value=null,$l.value=null,Ua.value=null,st.value=null,sh.value=null,Be.value=null,ih.value=[],ll.value=null,Ll.value=[]}function N(e,t,r){return new Promise((a,o)=>{if(!Te||Te.readyState!==WebSocket.OPEN){o(new Error("Not connected"));return}const l=`req_${++T1}`,i=r?.timeout??_1,c={type:"req",id:l,method:e,params:t},d=setTimeout(()=>{pa.delete(l),o(new Error(`Request timeout: ${e}`))},i);pa.set(l,{resolve:a,reject:o,timeout:d}),Te.send(JSON.stringify(c))})}function R1(e){switch(e.type){case"res":D1(e);break;case"event":$1(e);break;default:E.gateway.warn(" Unknown message type:",e)}}function D1(e){const t=pa.get(e.id);if(!t){E.gateway.warn(" Received response for unknown request:",e.id);return}pa.delete(e.id),clearTimeout(t.timeout),e.ok?t.resolve(e.payload):t.reject(new Error(e.error?.message??"Request failed"))}function $1(e){E.gateway.debug("Event received:",e.event);for(const t of Bu)try{t(e)}catch(r){E.gateway.error(" Event handler error:",r)}}function eg(e){for(const[t,r]of pa)clearTimeout(r.timeout),r.reject(e);pa.clear()}function cc(e){return Bu.add(e),()=>Bu.delete(e)}function Wu(e,t){return cc(a=>{a.event===e&&t(a.payload)})}let no=0;const ap=3;function L1(){uh(),no=0,Fs=setInterval(()=>{Te?.readyState===WebSocket.OPEN&&N("health").then(()=>{no=0}).catch(e=>{no++,E.gateway.warn(`Heartbeat failed (${no}/${ap}):`,e instanceof Error?e.message:String(e)),no>=ap&&E.gateway.error("Too many consecutive heartbeat failures, connection may be unhealthy")})},S1)}function uh(){Fs&&(clearInterval(Fs),Fs=null)}function N1(){if(!Zr||Qr)return;Ee.value="reconnecting",zt.value++;const e=Math.min(y1*Math.pow(k1,zt.value-1),w1);E.gateway.info(`[gateway] Reconnecting in ${Math.round(e/1e3)}s (attempt ${zt.value})`),Qr=setTimeout(async()=>{if(Qr=null,!!Zr)try{await Nl(Zr)}catch{}},e)}function O1(){Qr&&(clearTimeout(Qr),Qr=null),zt.value=0}const mo={state:Ee,isConnected:L,error:zn,version:At,commit:$l,host:Ua,url:st,connectionId:sh,mainSessionKey:Be,capabilities:ih,tickIntervalMs:ll,connectedAt:Yn,presence:Ll,reconnectAttempt:zt,connect:Nl,disconnect:va,send:N,subscribe:cc,on:Wu},P1=6e4,F1=200,z1=100,U1=5e3,j1=1e3,us=`
2
-
3
- `,H1=300,B1="2026.2.13",ds={docs:"https://docs.openclaw.ai",github:"https://github.com/MaudeCode/cove",githubOpenClaw:"https://github.com/openclaw/openclaw",discord:"https://discord.com/invite/clawd"},W1=[/read heartbeat\.md/i,/heartbeat poll/i,/if nothing needs attention.*reply.*heartbeat_ok/i],K1=/^\s*heartbeat_ok\s*$/i,tg=/^\s*no_(?:reply|repl|rep|re|r|_?)?\s*$/i,q1=/^\s*\[cron\]/i;function G1(e){return e.role!=="user"?!1:W1.some(t=>t.test(e.content))}function dh(e){return e.role!=="assistant"?!1:K1.test(e.content)}function V1(e){return e.role!=="assistant"?!1:tg.test(e.content)}function ng(e){return tg.test(e)}function Y1(e){return e.role!=="assistant"?!1:q1.test(e.content)}function rg(e){return G1(e)||dh(e)}const J1=[/^pre-compaction memory flush/i,/^read heartbeat\.md if it exists/i];function X1(e){return e.role!=="user"?!1:J1.some(t=>t.test(e.content))}function Z1(e){let t=e;t=t.replace(/^Conversation info \(untrusted metadata\):\s*```json\s*\{[^}]*\}\s*```\s*/s,"");const r=t.match(/^\[([^\]]+)\]\s*/);if(r){const a=r[1]??"";(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(a)||/\d{4}-\d{2}-\d{2} \d{2}:\d{2}/.test(a))&&(t=t.slice(r[0].length))}return t.includes("[message_id:")&&(t=t.split(/\r?\n/).filter(a=>!/^\s*\[message_id:\s*[^\]]+\]\s*$/i.test(a)).join(`
4
- `)),t.trim()}const Q1=[/^<summary>/i,/the conversation.*compacted/i,/context was summarized/i];function ew(e){return e.role!=="user"?!1:Q1.some(t=>t.test(e.content))}function To(e){return e.charAt(0).toUpperCase()+e.slice(1)}function hh(e){return e?e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:"):!1}function fh(e){return typeof e=="string"&&e.trim().length>0}function ph(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function tw(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 ag(e){return/^\d/.test(e)?`v${e}`:e}const nw=[":discord:",":telegram:",":signal:",":slack:",":whatsapp:",":imessage:"];function Ar(e){return e===Be.value||e==="main"||e.endsWith(":main")}function rw(e){return sg(e.key)==="cron"}function og(e){return/^agent:[^:]+:chat:[^:]+$/.test(e)}function aw(e){return sg(e.key)==="spawn"}function lg(e){const t=e.key.toLowerCase();return nw.some(r=>t.includes(r))?!0:e.kind==="group"}function ow(e){const t=e.split(":");return t.length>=2&&t[0]==="agent"?t[1]:null}function sg(e){const t=e.split(":");return t.length>=3&&t[0]==="agent"?t[2]:null}function ig(e){return e.split("-").map(To).join(" ")}function op(e){return e.includes("-")&&e.length>20}function lw(e){if(Ar(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 i=new Date(o);return i.setDate(i.getDate()-o.getDay()),a>=o?"today":a>=l?"yesterday":a>=i?"thisWeek":"older"}function sw(e){const t=new Map([["pinned",[]],["today",[]],["yesterday",[]],["thisWeek",[]],["older",[]]]);for(const r of e){const a=lw(r);t.get(a).push(r)}return t}function iw(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 gr(e){return e.key.includes(":cron:")?"cron":lg(e)?"channel":Ar(e.key)?"main":"isolated"}function ne(e){return e instanceof Error?e.message:String(e)}const gt=p(s0()??[]),cn=p(null),sl=p(null),il=p(""),cg=p("");let Gc=null;il.subscribe(e=>{Gc&&clearTimeout(Gc),Gc=setTimeout(()=>{cg.value=e},300)});const cl=p(!1),cw=p(!0),lp=p(!1),vh=p(null),Ku=p(null),Je=W(()=>{const e=cn.value;return!e||e==="main"?Be.value??"main":e}),uw=W(()=>gt.value.find(e=>e.key===Je.value)??null);function Ol(e){const t=Je.value;return!e||!t||e===t}function dw(e){return e.displayName?e.displayName:e.label?e.label:e.key}function hw(e){return lg(e)?"channel":Ar(e.key)?"main":"isolated"}const qu=W(()=>{let e=gt.value;sl.value&&(e=e.filter(r=>hw(r)===sl.value)),cl.value||(e=e.filter(r=>!rw(r))),cw.value||(e=e.filter(r=>!aw(r)));const t=cg.value.toLowerCase().trim();return t&&(e=e.filter(r=>{const a=dw(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=Ar(r.key),l=Ar(a.key);return o&&!l?-1:l&&!o?1:(a.updatedAt??0)-(r.updatedAt??0)})}),fw=W(()=>sw(qu.value));async function uc(e){lp.value=!0,Ku.value=null;try{const t=await N("sessions.list",{limit:e?.limit??100,...e});gt.value=t.sessions??[],i0(gt.value)}catch(t){throw Ku.value=t instanceof Error?t.message:String(t),t}finally{lp.value=!1}}function ma(e){cn.value=e}function pw(e){sl.value=e}function sp(e){il.value=e}function vw(){cl.value=!cl.value}function mw(){gt.value=[],cn.value=null,Ku.value=null}function mh(e,t){gt.value=gt.value.map(r=>r.key===e?{...r,...t}:r)}function gw(e){gt.value=gt.value.filter(t=>t.key!==e),cn.value===e&&(cn.value=null),vh.value=null}function bw(e){return new Promise(t=>{vh.value=e,setTimeout(()=>{gw(e),t()},H1)})}let gh=null;function xw(){const e=o0();return e?(gh=e.sessionKey,e.messages):[]}function yw(e,t){l0(e,t),gh=e}function ww(){return gh}const Me=p(xw()),Gu=p(!1),vi=p(null),kw=p("off"),Wn=p(!1),mi=p(void 0),hr=p(!1),gi=p(-1),ug=W(()=>Me.value.filter(rg)),_w=W(()=>ug.value.length),Un=p(""),dc=p("");let Vc=null;Un.subscribe(e=>{Vc&&clearTimeout(Vc),Vc=setTimeout(()=>{dc.value=e},300)});const Xe=p(!1),hs=p(null),ea=p(null),ta=p(null),dg=W(()=>ea.value!==null||ta.value!==null);function Sw(){ea.value=null,ta.value=null}const hg=W(()=>{let e=Me.value;const t=ea.value,r=ta.value;(t||r)&&(e=e.filter(o=>{const l=new Date(o.timestamp);if(t&&l<t)return!1;if(r){const i=new Date(r);if(i.setHours(23,59,59,999),l>i)return!1}return!0}));const a=dc.value.trim().toLowerCase();return a&&(e=e.filter(o=>o.content.toLowerCase().includes(a))),e}),Cw=W(()=>!dc.value.trim().toLowerCase()&&!dg.value?0:hg.value.length),bt=p([]),fg=W(()=>bt.value.length>0),ue=p(new Map),bh=p(!1),ip=p(""),cp=p([]);function xh(e){for(const t of ue.value.values())if(t.sessionKey===e&&(t.status==="pending"||t.status==="streaming"))return t;return null}function Aw(e){const t=xh(e);return t?{isStreaming:!0,content:t.content,toolCalls:t.toolCalls}:{isStreaming:!1,content:"",toolCalls:[]}}function hc(){let e=!1;for(const t of ue.value.values())if(t.status==="pending"||t.status==="streaming"){e=!0,ip.value=t.content,cp.value=t.toolCalls;break}e||(ip.value="",cp.value=[]),bh.value=e}function fc(e,t){const r=ue.value.get(e);if(!r)return;const a=new Map(ue.value);a.set(e,{...r,...t}),ue.value=a,hc()}function yh(e,t){setTimeout(()=>{const r=new Map(ue.value);r.delete(e),ue.value=r,hc()},t)}function wh(e,t,r){Me.value=Me.value.map(a=>a.id===e?{...a,status:t,error:r}:a)}function kh(){Me.value=[],vi.value=null}function Tw(e){Me.value=e,hr.value=!1,mi.value=void 0,gi.value=-1}function bi(e){const t=Me.value.findIndex(r=>r.id===e.id);if(t>=0){Me.value=Me.value.map((r,a)=>a===t?{...r,...e}:r);return}Me.value=[...Me.value,e]}function pg(e){wh(e,"sending",void 0)}function Ew(e){wh(e,"sent",void 0)}function up(e,t){wh(e,"failed",t)}function ja(e,t){const r=new Map(ue.value);r.set(e,{runId:e,sessionKey:t,startedAt:Date.now(),status:"pending",content:"",toolCalls:[]}),ue.value=r,hc()}function Eo(e,t,r=[],a){const o=ue.value.get(e);o&&fc(e,{status:"streaming",content:t,toolCalls:r,lastBlockStart:a??o.lastBlockStart})}function xi(e,t){const r=ue.value.get(e),a=t?.content??r?.content??"";fc(e,{status:"complete",message:t,content:a}),t&&Ol(r?.sessionKey)&&(r?.sessionKey==="unknown"&&Iw(t)||bi(t)),yh(e,z1)}function Iw(e){const t=Me.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(i=>i.id));if(a.toolCalls.some(i=>o.has(i.id))){const i=a.toolCalls.map(d=>{const u=e.toolCalls?.find(h=>h.id===d.id);return u?{...d,status:u.status,result:u.result,completedAt:u.completedAt}:d});let c=a.content;if(e.content&&!a.content.endsWith(e.content)){const d=a.content?`
5
-
6
- `:"";c=a.content+d+e.content}return Me.value=t.map(d=>d.id===a.id?{...d,content:c,toolCalls:i}:d),!0}}}}return!1}function Vu(e,t){fc(e,{status:"error",error:t}),yh(e,U1)}function Mw(e){fc(e,{status:"aborted"}),yh(e,j1)}function Rw(){ue.value=new Map,hc()}function dp(e){bt.value=[...bt.value,e]}function vg(e){bt.value=bt.value.filter(t=>t.id!==e)}function Dw(e,t,r){bt.value=bt.value.map(a=>a.id===e?{...a,content:t,images:r}:a)}const Yu=p(new Map);function hp(e){return Yu.value.get(e)||""}function mg(e,t){const r=new Map(Yu.value);t?r.set(e,t):r.delete(e),Yu.value=r}function $w(e){mg(e,"")}function yi(e){if(typeof e=="string")return{text:e,toolCalls:[],images:[]};const t=[],r=[],a=[],o=[];let l=0;for(const c of e)switch(c.type){case"text":{t.push(c.text),l+=c.text.length;break}case"image":{if(c.source?.type==="base64"&&c.source.data)a.push({url:`data:${c.source.media_type};base64,${c.source.data}`,alt:"Image"});else if(c.data){const d=c.data.startsWith("data:")?c.data:`data:${c.mimeType||"image/png"};base64,${c.data}`;a.push({url:d,alt:"Image"})}break}case"tool_use":{r.push({id:c.id,name:c.name,args:c.input,status:"running",startedAt:Date.now(),insertedAtContentLength:l});break}case"toolCall":{r.push({id:c.id,name:c.name,args:c.arguments,status:"pending",insertedAtContentLength:l});break}case"tool_result":{const d=r.find(u=>u.id===c.id);d&&(d.result=c.content,d.status="complete",d.completedAt=Date.now());break}case"thinking":{const d=c.thinking?.trim();d&&o.push(d);break}}const i=o.length>0?o.join(`
7
-
8
- `):void 0;return{text:t.join(`
9
- `),toolCalls:r,images:a,thinking:i}}function Lw(e,t){const r=yi(e.content),a=e.role==="toolResult"?"assistant":e.role,o=a==="user"?Z1(r.text):r.text,l={id:t,role:a,content:o,images:r.images.length>0?r.images:void 0,toolCalls:r.toolCalls.length>0?r.toolCalls:void 0,thinking:r.thinking,timestamp:e.timestamp??Date.now(),isStreaming:!1};return e.__openclaw?.kind==="compaction"&&(l.kind="compaction"),l}function Nw(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())}function Ju(e){if(!e||typeof e!="object")return e;if(Array.isArray(e)&&e.length>0){const r=e[0];if(r?.type==="text"&&typeof r.text=="string")return r.text}const t=e;if(Array.isArray(t.content)&&t.content.length>0){const r=t.content[0];if(r?.type==="text"&&typeof r.text=="string")return r.text}return e}const Yc=new Map;function Ow(e){const t=new Map;for(const r of e)r.role==="toolResult"&&r.toolCallId&&t.set(r.toolCallId,{content:Ju(r.content),isError:r.isError??!1});return t}function Pw(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 Fw(e,t){return e.role==="assistant"&&t.role==="assistant"&&Math.abs(t.timestamp-e.timestamp)<P1}function zw(e,t){const r=e.content.length,a=e.content&&t.content?`
10
-
11
- `:"";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 _h(e,t=F1){const r=Yc.get(e);if(r)return E.chat.debug("History load already in progress for session, waiting:",e),r;const a=Uw(e,t);Yc.set(e,a);try{await a}finally{Yc.delete(e)}}async function Uw(e,t){Gu.value=!0,vi.value=null;try{const r=await N("chat.history",{sessionKey:e,limit:t}),a=Ow(r.messages),o=[];for(let l=0;l<r.messages.length;l++){const i=r.messages[l];if(i.role==="toolResult")continue;const c=Lw(i,`hist_${l}_${Date.now()}`);Pw(c,a);const d=o[o.length-1];if(d&&Fw(d,c)){zw(d,c);continue}o.push(c)}Tw(o),yw(e,o),r.thinkingLevel&&(kw.value=r.thinkingLevel)}catch(r){throw vi.value=r instanceof Error?r.message:String(r),r}finally{Gu.value=!1}}function jw(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 Hw(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","thinking"].includes(t.stream)&&typeof t.seq=="number"&&typeof t.ts=="number"}function gg(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 i=e.length+us.length;return{content:e+us+t,lastBlockStart:i}}return{content:o+t,lastBlockStart:r}}const a=e.length+us.length;return{content:e+us+t,lastBlockStart:a}}function Bw(e,t){const r=e.trim().replace(/\s+/g," ");return r.length<=t?r:r.slice(0,t).trim()+"…"}async function Ww(e,t){if(!og(e))return;const r=Bw(t,50);if(!r){E.chat.debug("autoRenameSession: empty message, skipping");return}try{E.chat.debug("autoRenameSession: renaming",{sessionKey:e,title:r}),await N("sessions.patch",{key:e,label:r}),mh(e,{label:r}),E.chat.info("autoRenameSession: renamed session",{sessionKey:e,title:r})}catch(a){E.chat.error("autoRenameSession: failed",{sessionKey:e,error:a})}}let Kw=0;function qw(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 Gw(){return`cove_${Date.now()}_${++Kw}`}async function bg(e,t,r){const a=r?.messageId??Gw(),o=`user_${a}`,l=r?.messageId!=null,i={id:o,role:"user",content:t,images:qw(r?.attachments),timestamp:Date.now(),isStreaming:!1,status:"sending",sessionKey:e};if(!L.value)return E.chat.info("Not connected, queuing message"),i.status="queued",dp(i),a;if(bh.value&&!l)return E.chat.info("Currently streaming, queuing message"),i.status="queued",dp(i),a;l?pg(o):bi(i),ja(a,e);try{E.chat.debug("Sending message to session:",e);const c=await N("chat.send",{sessionKey:e,message:t,thinking:r?.thinking,timeoutMs:r?.timeoutMs,idempotencyKey:a,attachments:r?.attachments});if(c.status==="error"){const d=c.summary??"Unknown error";throw Vu(a,d),up(o,d),new Error(d)}if(Ew(o),!l&&og(e)){const d=gt.value.find(h=>h.key===e),u=s("newChatModal.title");d?.label===u&&Ww(e,t).catch(h=>{E.chat.warn("Auto-rename failed:",h instanceof Error?h.message:String(h))})}return a}catch(c){const d=c instanceof Error?c.message:String(c);throw E.chat.error("chat.send failed:",c),Vu(a,d),up(o,d),c}}async function Sh(e){if(!e.sessionKey){E.chat.warn("Cannot resend message - missing sessionKey:",e.id);return}vg(e.id),Me.value.find(a=>a.id===e.id)?pg(e.id):bi({...e,status:"sending"});const r=e.id.replace(/^user_/,"");await bg(e.sessionKey,e.content,{messageId:r})}async function Xu(e){if(bh.value){E.chat.debug("Still streaming, not processing queue");return}const t=bt.value.find(r=>r.sessionKey===e);if(!t){E.chat.debug("No queued messages for session");return}E.chat.info("Processing next queued message:",t.id);try{await Sh(t)}catch(r){E.chat.error("Failed to send queued message:",r)}}async function Vw(e){let t=bt.value.find(r=>r.id===e);if(t||(t=Me.value.find(r=>r.id===e&&r.status==="failed")),!t){E.chat.warn("Cannot retry message - not found:",e);return}await Sh(t)}async function Yw(){const e=[...bt.value];if(e.length!==0){E.chat.info(`Processing ${e.length} queued messages`);for(const t of e)try{await Sh(t)}catch(r){E.chat.error("Failed to send queued message:",r)}}}async function xg(e){await N("chat.abort",{sessionKey:e})}let Io=null,Mo=null;const Jn=new Set;function Jw(){return Io&&Mo||(E.chat.info("Subscribing to chat events"),Io=Wu("chat",e=>{if(!jw(e)){E.chat.warn("Invalid chat event payload:",e);return}n2(e)}),Mo=Wu("agent",e=>{if(!Hw(e)){E.chat.warn("Invalid agent event payload:",e);return}const t=e;t.stream==="tool"?t2(t):t.stream==="lifecycle"?t.data?.phase==="start"?Xw(t):(t.data?.phase==="end"||t.data?.phase==="error")&&Zw(t):t.stream==="compaction"?Qw(t):t.stream==="assistant"&&e2(t)})),Zu}function Zu(){Io&&(Io(),Io=null),Mo&&(Mo(),Mo=null),Jn.clear()}function Xw(e){const{runId:t,sessionKey:r}=e;if(!Ol(r)||Jn.has(t))return;!ue.value.get(t)&&r&&(E.chat.debug("Creating run on-the-fly for lifecycle start:",t,"session:",r),ja(t,r))}function Zw(e){const{runId:t,sessionKey:r}=e;if(!Ol(r))return;if(Jn.has(t)){Jn.delete(t),Wn.value&&(E.chat.warn("Clearing stale isCompacting flag via lifecycle end for run:",t),rc(()=>{Wn.value=!1,hr.value=!0}));return}const a=ue.value.get(t);if(a&&(a.status==="pending"||a.status==="streaming")){E.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()};xi(t,l)}else xi(t);if(a.sessionKey&&(setTimeout(()=>Xu(a.sessionKey),100),o)){const l=a.sessionKey;setTimeout(()=>{_h(l).catch(i=>{E.chat.warn("Failed to refresh history after heartbeat:",i)})},500)}}}function Qw(e){const t=e.data?.phase;if(E.chat.info("Compaction event:",t,"runId:",e.runId,"isCompacting:",Wn.value),e.runId&&Jn.add(e.runId),t==="start"){if(e.runId&&ue.value.has(e.runId)){E.chat.debug("Removing ghost run created before compaction registration:",e.runId);const r=new Map(ue.value);r.delete(e.runId),ue.value=r}Wn.value=!0}else if(t==="end"){const r=Me.value.length,a=typeof e.data?.summary=="string"?e.data.summary:void 0;rc(()=>{Wn.value=!1,mi.value=a,hr.value=!0,gi.value=r}),E.chat.info("Compaction ended, divider at index:",r)}}function e2(e){const{runId:t,sessionKey:r,data:a}=e,o=typeof a?.text=="string"?a.text:null;if(!o||Jn.has(t)||!Ol(r))return;let l=ue.value.get(t);if(!l&&r&&(E.chat.debug("Creating run for assistant stream:",t,"session:",r),ja(t,r),l=ue.value.get(t)),!l)return;const{content:i,lastBlockStart:c}=gg(l.content,o,l.lastBlockStart);Eo(t,i,l.toolCalls,c)}function t2(e){const{runId:t,sessionKey:r,data:a}=e;if(!a||Jn.has(t)||!Ol(r))return;E.chat.debug("Tool event received",{runId:t,phase:a.phase,toolCallId:a.toolCallId,toolName:a.name});let o=ue.value.get(t);if(!o&&(E.chat.debug("Creating run on-the-fly for tool event:",t,"session:",r),ja(t,r??"unknown"),o=ue.value.get(t),!o))return;const l=a.toolCallId??`tool_${Date.now()}`,i=a.name??"unknown",c=[...o.toolCalls];E.chat.debug("Tool event state before processing",{runId:t,currentContentLen:o.content.length,existingToolCallsCount:c.length,existingToolCallIds:c.map(u=>u.id)});const d=()=>{let u=c.findIndex(h=>h.id===l);return u<0&&(E.chat.debug("Creating missing tool call:",l),c.push({id:l,name:i,status:"running",startedAt:Date.now(),insertedAtContentLength:o.content.length,contentSnapshotAtStart:o.content}),u=c.length-1),u};switch(a.phase){case"start":{if(c.some(u=>u.id===l)){E.chat.debug("Tool start skipped - duplicate",{toolCallId:l});return}setTimeout(()=>{const u=ue.value.get(t);if(!u){E.chat.warn("Tool start deferred - run no longer exists",{runId:t,toolCallId:l});return}const h=[...u.toolCalls];if(h.some(v=>v.id===l)){E.chat.debug("Tool start deferred skipped - duplicate",{toolCallId:l});return}const f={id:l,name:i,args:a.args,status:"running",startedAt:Date.now(),insertedAtContentLength:u.content.length,contentSnapshotAtStart:u.content};E.chat.debug("Tool start processed",{toolCallId:l,toolName:i,insertedAtContentLength:f.insertedAtContentLength,contentSnapshotLen:u.content.length}),h.push(f),Eo(t,u.content,h)},0);break}case"update":{const u=d();c[u]={...c[u],result:Ju(a.partialResult)},Eo(t,o.content,c);break}case"result":{const u=d();c[u]={...c[u],result:Ju(a.result),status:a.isError?"error":"complete",completedAt:Date.now()},Eo(t,o.content,c);break}}}function n2(e){const{runId:t,state:r,errorMessage:a}=e;if(Jn.has(t)){E.chat.debug("Skipping chat event for compaction run:",t,r);return}switch(E.chat.debug("Chat event:",r,t,"session:",e.sessionKey),r){case"delta":r2(e);break;case"final":a2(e);break;case"aborted":Mw(t);break;case"error":Vu(t,a??"Unknown error");break}}function r2(e){const{runId:t,sessionKey:r,message:a}=e;if(!a)return;const o=yi(a.content);let l=ue.value.get(t);if(!l&&(E.chat.debug("Creating run on-the-fly for delta:",t,"session:",r),ja(t,r),l=ue.value.get(t),!l)||o.toolCalls.length===0)return;E.chat.debug("Delta event - processing tool calls only",{runId:t,parsedToolCallsCount:o.toolCalls.length,existingToolCallsCount:l.toolCalls.length});const i=Nw(l.toolCalls,o.toolCalls);Eo(t,l.content,i,l.lastBlockStart)}function a2(e){const{runId:t,sessionKey:r,message:a}=e;let o=ue.value.get(t);if(E.chat.debug("Final event received",{runId:t,hasExistingRun:!!o,existingContentLen:o?.content?.length,existingToolCallsCount:o?.toolCalls?.length,hasMessage:!!a}),o||(E.chat.debug("Creating run on-the-fly for final:",t,"session:",r),ja(t,r),o=ue.value.get(t)),!o){E.chat.warn("Final event with no run and couldn't create one:",t);return}if(a?.content){const u=yi(a.content);if(u.text&&(ng(u.text)||dh({role:"assistant",content:u.text}))){E.chat.debug("Heartbeat/no-reply detected, completing run without message:",t),xi(t),setTimeout(()=>Xu(r),100);return}}let l=o?.content??"",i=[];if(a?.content){const u=yi(a.content);E.chat.debug("Final message parsed",{runId:t,parsedTextLen:u.text.length,parsedToolCallsCount:u.toolCalls.length,existingContentLen:l.length,willUseFinaContent:u.text.length>=l.length}),u.text.length>=l.length?(l=u.text,i=u.toolCalls):u.text&&(E.chat.debug("Final merging partial text",{existingLen:l.length,parsedLen:u.text.length}),l=gg(l,u.text,o?.lastBlockStart).content)}E.chat.debug("Final content determined",{runId:t,finalContentLen:l.length,finalContentPreview:l.slice(-200)});const c=o?.toolCalls?.map(u=>{const h={...u};(h.status==="running"||h.status==="pending")&&(h.status="complete",h.completedAt=Date.now());const f=i.find(v=>v.id===u.id);return f?.insertedAtContentLength!==void 0&&(h.insertedAtContentLength=f.insertedAtContentLength),delete h.contentSnapshotAtStart,h}),d={id:`assistant_${t}`,role:"assistant",content:l,toolCalls:c?.length?c:void 0,timestamp:a?.timestamp??Date.now()};xi(t,d),setTimeout(()=>{Xu(r)},100)}async function Ch(e){Jw(),await _h(e)}function o2(){Zu(),kh()}function l2(e){if(!e)return null;if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:"))return e;if(e.startsWith("/")){const t=st.value;if(t)return`${t.replace(/^ws/,"http")}${e}`}return e}const s2="Assistant",i2="🤖",c2="You",Qu=p(s2),ed=p(i2),u2=p(null),d2=p(c2),h2=p(null),fp=p(!1);async function Ah(e){fp.value=!0;try{const r=await N("agent.identity.get",e?{sessionKey:e}:{});r&&(r.name&&(Qu.value=r.name),r.avatar&&(ed.value=l2(r.avatar)),r.agentId&&(u2.value=r.agentId),E.ui.info("Loaded assistant identity:",Qu.value,"avatar:",ed.value))}catch(t){E.ui.error("Failed to load assistant identity:",t)}finally{fp.value=!1}}const f2=300*1e3,yg=p(m2()),pp=p(!1),vp=p(null);let zs=null;const Th=W(()=>{const e=yg.value;return e?e.providers.find(t=>t.provider==="anthropic")??null:null}),p2=W(()=>{const e=Th.value;return e!==null&&e.windows.length>0&&!e.error}),v2=W(()=>{const e=Th.value;if(!e||e.windows.length===0)return null;const t=e.windows.find(r=>r.label==="Week");return t||e.windows[0]});function m2(){const e=c0();return e?(E.usage.debug("Loaded cached usage"),e):null}async function mp(){if(!L.value){E.usage.debug("Skipping usage fetch - not connected");return}pp.value=!0,vp.value=null;try{const e=await mo.send("usage.status");yg.value=e,u0(e),E.usage.debug("Usage fetched:",e)}catch(e){const t=e instanceof Error?e.message:"Failed to fetch usage";vp.value=t,E.usage.error("Usage fetch failed:",t)}finally{pp.value=!1}}function Eh(){wg(),mp(),zs=setInterval(()=>{mp()},f2),E.usage.debug("Usage polling started")}function wg(){zs&&(clearInterval(zs),zs=null,E.usage.debug("Usage polling stopped"))}let gp=!1;L.subscribe(e=>{gp&&!e&&wg(),gp=e});const Xn=p([]),kg=p(null),bp=p(!1),xp=p(null),g2=W(()=>{const e=new Map;for(const t of Xn.value){const r=t.provider;e.has(r)||e.set(r,[]),e.get(r).push(t)}return e});async function Ih(){bp.value=!0,xp.value=null;try{const[e,t]=await Promise.all([N("models.list",{}),N("status",{}).catch(()=>null)]);Xn.value=e.models??[],E.ui.debug("Loaded models:",Xn.value.length);const r=t?.sessions?.defaults?.model;r&&(kg.value=r,E.ui.debug("Default model:",r))}catch(e){xp.value=e instanceof Error?e.message:String(e),E.ui.error("Failed to load models:",e)}finally{bp.value=!1}}function b2(e){return Xn.value.find(t=>t.id===e)}function x2(e){const t=b2(e);return t?t.name:e.replace(/^anthropic\//,"").replace(/^openai\//,"").replace(/^claude-/,"").replace(/^gpt-/,"")}const Us=p([]),wi=p("main"),y2=p("main"),Jc=p(!1),yp=p(null),td=W(()=>Us.value.map(e=>({value:e.id,label:`${e.identity?.emoji||"🤖"} ${e.identity?.name||e.name||e.id}`})));async function _g(){if(Jc.value){E.gateway.debug("loadAgents: already loading, skipping");return}Jc.value=!0,yp.value=null;try{E.gateway.debug("loadAgents: fetching from gateway");const e=await N("agents.list",{});if(e&&Array.isArray(e.agents))Us.value=e.agents,wi.value=e.defaultId||"main",y2.value=e.mainKey||"main",E.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";E.gateway.error("loadAgents: error",{error:t}),yp.value=t,Us.value.length===0&&(Us.value=[{id:"main",identity:{name:"Main",emoji:"🤖"}}],wi.value="main")}finally{Jc.value=!1}}const w2=200,k2=480,fr=288,Mh=1024,_2=typeof window<"u"&&window.innerWidth<Mh,St=p(!_2);function Rh(){window.innerWidth<Mh&&(St.value=!1)}const js=p(r0()),Xc=p(!1);Ae(()=>{a0(js.value)});const Sg=p("/"),Zc=p(!1),ul=p(!1),S2=20,C2=100,wp=fr*.3,A2=75,Ln=p(null),_t=p(!1);function T2(){O(()=>{const e=()=>window.innerWidth<Mh;let t=0,r=0,a=!1,o=!1;const l=d=>{if(!e())return;const u=d.touches[0];t=u.clientX,r=u.clientY;const h=u.clientX>=S2&&u.clientX<=C2;a=h,o=St.value,(h||o)&&(Ln.value=o?fr:0)},i=d=>{if(!e()||!a&&!o)return;const u=d.touches[0],h=u.clientX-t;if(Math.abs(u.clientY-r)>A2&&!_t.value){Ln.value=null,a=!1;return}if((Math.abs(h)>10||_t.value)&&(_t.value=!0,d.preventDefault()),!_t.value)return;let v;o?v=fr+h:v=h,v=Math.max(0,Math.min(fr,v)),Ln.value=v},c=()=>{if(!_t.value){Ln.value=null,a=!1,o=!1;return}const d=Ln.value??0;o?St.value=d>fr-wp:St.value=d>wp,Ln.value=null,_t.value=!1,a=!1,o=!1};return document.addEventListener("touchstart",l,{passive:!0}),document.addEventListener("touchmove",i,{passive:!1}),document.addEventListener("touchend",c,{passive:!0}),document.addEventListener("touchcancel",c,{passive:!0}),()=>{document.removeEventListener("touchstart",l),document.removeEventListener("touchmove",i),document.removeEventListener("touchend",c),document.removeEventListener("touchcancel",c)}},[])}function E2({direction:e,onResizeStart:t,onResize:r,onResizeEnd:a,class:o=""}){const l=B(0),i=B(!1),c=B({move:null,up:null});O(()=>()=>{c.current.move&&document.removeEventListener("mousemove",c.current.move),c.current.up&&document.removeEventListener("mouseup",c.current.up),i.current&&(document.body.style.cursor="",document.body.style.userSelect="")},[]);const d=ee(h=>{h.preventDefault(),i.current=!0,l.current=e==="horizontal"?h.clientX:h.clientY,t?.();const f=m=>{if(!i.current)return;const w=e==="horizontal"?m.clientX:m.clientY,k=w-l.current;l.current=w,r(k)},v=()=>{i.current=!1,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",v),c.current.move=null,c.current.up=null,document.body.style.cursor="",document.body.style.userSelect="",a?.()};c.current.move=f,c.current.up=v,document.addEventListener("mousemove",f),document.addEventListener("mouseup",v),document.body.style.cursor=e==="horizontal"?"col-resize":"row-resize",document.body.style.userSelect="none"},[e,r,t,a]),u=e==="horizontal";return n("div",{onMouseDown:d,class:`
12
- ${u?"w-1 cursor-col-resize hover:w-1.5":"h-1 cursor-row-resize hover:h-1.5"}
13
- bg-transparent hover:bg-[var(--color-accent)]/30 active:bg-[var(--color-accent)]/50
14
- transition-all duration-150 ease-out
15
- flex-shrink-0
16
- ${o}
17
- `,role:"separator","aria-orientation":u?"horizontal":"vertical","aria-label":"Resize handle"})}const I2=(...e)=>e.filter((t,r,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===r).join(" ").trim();const kp=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const M2=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,a)=>a?a.toUpperCase():r.toLowerCase());const _p=e=>{const t=M2(e);return t.charAt(0).toUpperCase()+t.slice(1)};var R2={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 D2=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const $2=({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:a,children:o,iconNode:l,class:i="",...c})=>Cn("svg",{...R2,width:String(t),height:t,stroke:e,"stroke-width":a?Number(r)*24/Number(t):r,class:["lucide",i].join(" "),...!o&&!D2(c)&&{"aria-hidden":"true"},...c},[...l.map(([d,u])=>Cn(d,u)),..._r(o)]);const R=(e,t)=>{const r=({class:a="",className:o="",children:l,...i})=>Cn($2,{...i,iconNode:t,class:I2(`lucide-${kp(_p(e))}`,`lucide-${kp(e)}`,a,o)},l);return r.displayName=_p(e),r};const Kn=R("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 L2=R("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);const pc=R("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const vc=R("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Dh=R("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 N2=R("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 Cg=R("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 Sp=R("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 O2=R("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]);const P2=R("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 Pl=R("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 F2=R("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 Wt=R("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Oe=R("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Ag=R("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const rt=R("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const mc=R("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const gc=R("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 Ha=R("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 Ba=R("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 z2=R("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const me=R("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const U2=R("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);const bc=R("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 ki=R("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 j2=R("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 jt=R("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 Tg=R("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 Fl=R("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 Eg=R("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 $h=R("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 Ht=R("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 H2=R("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 B2=R("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 _i=R("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 W2=R("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 K2=R("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=R("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 Ig=R("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 Cp=R("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 Mg=R("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 Rg=R("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 na=R("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 zl=R("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 xc=R("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 nd=R("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 q2=R("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 G2=R("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 Dg=R("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 $g=R("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const Ap=R("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 V2=R("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 Y2=R("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);const J2=R("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 dn=R("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 Lg=R("monitor-play",[["path",{d:"M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z",key:"vbtd3f"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);const Nt=R("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 Tp=R("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 Qc=R("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 Ng=R("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 X2=R("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 Z2=R("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 Ul=R("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 Q2=R("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 Lh=R("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 Zn=R("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Nh=R("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 Si=R("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 ek=R("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 Fe=R("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 yc=R("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 Oh=R("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 Ep=R("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);const Ke=R("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const Og=R("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 Tr=R("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 Ph=R("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 Fh=R("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 tk=R("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 wc=R("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 nk=R("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 ga=R("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);const kc=R("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 rk=R("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const Pg=R("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 Ip=R("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 ak=R("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);const Fg=R("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 Et=R("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 rd=R("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]);const Tn=R("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 ok=R("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const jn=R("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 lk=R("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 sk=R("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 ik=R("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 zg=R("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 Ci=R("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 Ug=R("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 Wa=R("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const fn=R("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 jg(e,t){for(var r in t)e[r]=t[r];return e}function Mp(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 Rp(e,t){this.props=e,this.context=t}(Rp.prototype=new mt).isPureReactComponent=!0,Rp.prototype.shouldComponentUpdate=function(e,t){return Mp(this.props,e)||Mp(this.state,t)};var Dp=V.__b;V.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Dp&&Dp(e)};var ck=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function jl(e){function t(r){var a=jg({},r);return delete a.ref,e(a,r.ref||null)}return t.$$typeof=ck,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var uk=V.__e;V.__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)}uk(e,t,r,a)};var $p=V.unmount;function Hg(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=jg({},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 Hg(a,t,r)})),e}function Bg(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(a){return Bg(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 eu(){this.__u=0,this.o=null,this.__b=null}function Wg(e){if(!e.__)return null;var t=e.__.__c;return t&&t.__a&&t.__a(e)}function fs(){this.i=null,this.l=null}V.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),$p&&$p(e)},(eu.prototype=new mt).__c=function(e,t){var r=t.__c,a=this;a.o==null&&(a.o=[]),a.o.push(r);var o=Wg(a.__v),l=!1,i=function(){l||a.__z||(l=!0,r.__R=null,o?o(d):d())};r.__R=i;var c=r.__P;r.__P=null;var d=function(){if(!--a.__u){if(a.state.__a){var u=a.state.__a;a.__v.__k[0]=Bg(u,u.__c.__P,u.__c.__O)}var h;for(a.setState({__a:a.__b=null});h=a.o.pop();)h.__P=c,h.forceUpdate()}};a.__u++||32&t.__u||a.setState({__a:a.__b=a.__v.__k[0]}),e.then(i,i)},eu.prototype.componentWillUnmount=function(){this.o=[]},eu.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]=Hg(this.__b,r,a.__O=a.__P)}this.__b=null}var o=t.__a&&Cn(G,null,e.fallback);return o&&(o.__u&=-33),[Cn(G,null,t.__a?null:e.children),o]};var Lp=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 dk(e){return this.getChildContext=function(){return e.context},e.children}function hk(e){var t=this,r=e.h;if(t.componentWillUnmount=function(){Ou(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},namespaceURI:r.namespaceURI,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)}}}Ou(Cn(dk,{context:t.context},e.__v),t.v)}function zh(e,t){var r=Cn(hk,{__v:e,h:t});return r.containerInfo=t,r}(fs.prototype=new mt).__a=function(e){var t=this,r=Wg(t.__v),a=t.l.get(e);return a[0]++,function(o){var l=function(){t.props.revealOrder?(a.push(o),Lp(t,e,a)):o()};r?r(l):l()}},fs.prototype.render=function(e){this.i=null,this.l=new Map;var t=_r(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},fs.prototype.componentDidUpdate=fs.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){Lp(e,r,t)})};var fk=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,pk=/^(?: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]/,vk=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,mk=/[A-Z0-9]/g,gk=typeof document<"u",bk=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};mt.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(mt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Np=V.event;function xk(){}function yk(){return this.cancelBubble}function wk(){return this.defaultPrevented}V.event=function(e){return Np&&(e=Np(e)),e.persist=xk,e.isPropagationStopped=yk,e.isDefaultPrevented=wk,e.nativeEvent=e};var kk={enumerable:!1,configurable:!0,get:function(){return this.class}},Op=V.vnode;V.vnode=function(e){typeof e.type=="string"&&(function(t){var r=t.props,a=t.type,o={},l=a.indexOf("-")===-1;for(var i in r){var c=r[i];if(!(i==="value"&&"defaultValue"in r&&c==null||gk&&i==="children"&&a==="noscript"||i==="class"||i==="className")){var d=i.toLowerCase();i==="defaultValue"&&"value"in r&&r.value==null?i="value":i==="download"&&c===!0?c="":d==="translate"&&c==="no"?c=!1:d[0]==="o"&&d[1]==="n"?d==="ondoubleclick"?i="ondblclick":d!=="onchange"||a!=="input"&&a!=="textarea"||bk(r.type)?d==="onfocus"?i="onfocusin":d==="onblur"?i="onfocusout":vk.test(i)&&(i=d):d=i="oninput":l&&pk.test(i)?i=i.replace(mk,"-$&").toLowerCase():c===null&&(c=void 0),d==="oninput"&&o[i=d]&&(i="oninputCapture"),o[i]=c}}a=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=_r(r.children).forEach(function(u){u.props.selected=o.value.indexOf(u.props.value)!=-1})),a=="select"&&o.defaultValue!=null&&(o.value=_r(r.children).forEach(function(u){u.props.selected=o.multiple?o.defaultValue.indexOf(u.props.value)!=-1:o.defaultValue==u.props.value})),r.class&&!r.className?(o.class=r.class,Object.defineProperty(o,"className",kk)):(r.className&&!r.class||r.class&&r.className)&&(o.class=o.className=r.className),t.props=o})(e),e.$$typeof=fk,Op&&Op(e)};var Pp=V.__r;V.__r=function(e){Pp&&Pp(e),e.__c};var Fp=V.diffed;V.diffed=function(e){Fp&&Fp(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 _k={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 te({size:e="md",label:t,class:r}){const a=_k[e];return n("span",{class:`cove-spinner ${a.container} ${r||""}`,style:{"--spinner-thickness":a.thickness},role:"status","aria-label":t||s("accessibility.loading"),children:n("span",{class:"sr-only",children:t||s("accessibility.loading")})})}const Kg=Em(null);function zp({children:e}){const[t,r]=U(null),[a,o]=U(!1),l=B(null),i=B(null);O(()=>()=>{l.current&&cancelAnimationFrame(l.current),i.current&&clearTimeout(i.current)},[]);const c=ee(h=>{i.current&&(clearTimeout(i.current),i.current=null),o(!0),l.current=requestAnimationFrame(()=>{r({...h,isVisible:!0}),l.current=null})},[]),d=ee(()=>{l.current&&(cancelAnimationFrame(l.current),l.current=null),r(h=>h?{...h,isVisible:!1}:null),i.current=window.setTimeout(()=>{o(!1),r(null),i.current=null},150)},[]),u=ee(h=>{r(f=>f?{...f,triggerRect:h}:null)},[]);return O(()=>{if(!a)return;const h=f=>{f.key==="Escape"&&d()};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[a,d]),n(Kg.Provider,{value:{show:c,hide:d,update:u},children:[e,a&&zh(n(Sk,{state:t}),document.body)]})}function Sk({state:e}){const t=B(null),[r,a]=U("top"),[o,l]=U({top:0,left:0});if(O(()=>{if(!e?.triggerRect||!t.current)return;const u=t.current.getBoundingClientRect(),{adjustedPlacement:h,pos:f}=Ck(e.triggerRect,u,e.placement);a(h),l(f)},[e?.triggerRect,e?.placement,e?.content]),!e?.triggerRect)return null;const{content:i,isVisible:c}=e;return n("div",{ref:t,role:"tooltip",class:`
18
- fixed z-[9999] pointer-events-none
19
- transition-opacity duration-150
20
- ${c?"opacity-100":"opacity-0"}
21
- `,style:{top:`${o.top}px`,left:`${o.left}px`},children:[n("div",{class:`
22
- px-2.5 py-1.5 text-xs font-medium
23
- bg-[var(--color-bg-elevated)] text-[var(--color-text-primary)]
24
- rounded-lg shadow-lg
25
- border border-[var(--color-border)]
26
- whitespace-nowrap
27
- `,children:i}),n("div",{class:`
28
- absolute w-0 h-0 border-[6px]
29
- ${Ak(r)}
30
- `})]})}function Ck(e,t,r){const l={width:window.innerWidth,height:window.innerHeight},i={top:e.top,bottom:l.height-e.bottom,left:e.left,right:l.width-e.right},c={top:i.top>=t.height+8+8,bottom:i.bottom>=t.height+8+8,left:i.left>=t.width+8+8,right:i.right>=t.width+8+8};let d=r;r==="top"&&!c.top?d=c.bottom?"bottom":c.left?"left":c.right?"right":"bottom":r==="bottom"&&!c.bottom?d=c.top?"top":c.left?"left":c.right?"right":"top":r==="left"&&!c.left?d=c.right?"right":c.top?"top":c.bottom?"bottom":"right":r==="right"&&!c.right&&(d=c.left?"left":c.top?"top":c.bottom?"bottom":"left");let u,h;switch(d){case"top":u=e.top-t.height-8,h=e.left+e.width/2-t.width/2;break;case"bottom":u=e.bottom+8,h=e.left+e.width/2-t.width/2;break;case"left":u=e.top+e.height/2-t.height/2,h=e.left-t.width-8;break;case"right":u=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)),u=Math.max(8,Math.min(u,l.height-t.height-8)),{adjustedPlacement:d,pos:{top:u,left:h}}}function Ak(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 Tk=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0;function Ka({content:e,placement:t="top",delay:r=300,children:a,class:o,disabled:l=!1}){const i=ty(Kg),c=B(null),d=B(null),u=l||Tk(),h=ee(()=>{u||!i||(c.current=window.setTimeout(()=>{if(d.current){const v=d.current.getBoundingClientRect();i.show({content:e,placement:t,triggerRect:v})}},r))},[i,e,t,r,u]),f=ee(()=>{c.current&&(clearTimeout(c.current),c.current=null),i?.hide()},[i]);return O(()=>()=>{c.current&&clearTimeout(c.current)},[]),i?n("div",{ref:d,class:`inline-flex ${o||""}`,onMouseEnter:h,onMouseLeave:f,onFocus:h,onBlur:f,children:a}):n("div",{class:`inline-flex ${o||""}`,children:a})}const Ek={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"}},Ik={default:`
31
- text-[var(--color-text-secondary)]
32
- hover:bg-[var(--color-bg-secondary)] hover:text-[var(--color-text-primary)]
33
- focus-visible:ring-[var(--color-accent)]
34
- `,ghost:`
35
- text-[var(--color-text-muted)]
36
- hover:bg-[var(--color-bg-primary)] hover:text-[var(--color-text-secondary)]
37
- focus-visible:ring-[var(--color-accent)]
38
- `,danger:`
39
- text-[var(--color-text-secondary)]
40
- hover:bg-[var(--color-error)]/10 hover:text-[var(--color-error)]
41
- focus-visible:ring-[var(--color-error)]
42
- `},K=jl(({icon:e,label:t,size:r="md",variant:a="default",loading:o=!1,disabled:l,showTooltip:i=!0,tooltipPlacement:c="top",class:d,...u},h)=>{const f=l||o,v=Ek[r],m=n("button",{ref:h,type:"button",disabled:f,"aria-label":t,class:`
43
- inline-flex items-center justify-center cursor-pointer
44
- rounded-md transition-all duration-200 ease-out
45
- hover:scale-105 active:scale-95
46
- focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2
47
- disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100 disabled:active:scale-100
48
- ${v.button}
49
- ${Ik[a]}
50
- ${d||""}
51
- `,...u,children:o?n(te,{size:"sm"}):n("span",{class:`${v.icon} flex items-center justify-center [&>svg]:w-full [&>svg]:h-full`,"aria-hidden":"true",children:e})});return i&&t?n(Ka,{content:t,placement:c,delay:400,children:m}):m});K.displayName="IconButton";const Mk={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)]"},Rk={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)]"},Dk={sm:"px-1.5 py-0.5 text-xs",md:"px-2 py-1 text-xs"};function Z({variant:e="default",size:t="md",dot:r=!1,children:a,class:o}){return n("span",{class:`
52
- inline-flex items-center gap-1.5
53
- font-medium rounded-full
54
- ${Mk[e]}
55
- ${Dk[t]}
56
- ${o||""}
57
- `,children:[r&&n("span",{class:`w-1.5 h-1.5 rounded-full ${Rk[e]}`,"aria-hidden":"true"}),a]})}function qa(e,t,r=!0){O(()=>{if(!r)return;const a=o=>{const l=Array.isArray(e)?e:[e],i=o.target;l.some(d=>d.current?.contains(i))||t()};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[e,t,r])}function qg(){const e=_w.value,[t,r]=U(!1),[a,o]=U(S0),l=B(null),i=B(null),c=Math.floor(e/2),d=Math.max(0,c-a),u=ee(()=>{o(c),C0(c),r(!1)},[c]);qa([i,l],u,t);const f=ug.value.filter(dh).slice(-10).reverse();return n("div",{class:"relative inline-block",ref:i,children:[n(K,{icon:n(Rg,{class:"w-4 h-4"}),label:s("chat.heartbeats",{count:e}),onClick:()=>t?u():r(!0),variant:"ghost",size:"sm",class:"border border-[var(--color-border)] bg-[var(--color-bg-surface)]"}),d>0&&n(Z,{variant:"default",class:"absolute -top-1.5 -right-1.5 min-w-[1.25rem] h-5 text-xs px-1 pointer-events-none",children:d}),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:s("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:s("chat.noHeartbeats")}):f.map(v=>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:le(v.timestamp)})]},v.id))})]})]})}const $k={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 _c({size:e="md",class:t="",animated:r=!1}){const a=$k[e];return n("img",{src:"/cove-icon.png",alt:"Cove",class:`${a} ${r?"group-hover:scale-110 transition-transform":""} ${t}`.trim()})}function Ga({class:e}){return n(Wa,{class:e||"w-5 h-5","aria-hidden":"true"})}function Gg({class:e}){return n(Zn,{class:e||"w-4 h-4","aria-hidden":"true"})}function Lk({class:e}){return n(Y2,{class:e||"w-5 h-5","aria-hidden":"true"})}function Nk({class:e}){return n(Fh,{class:e||"w-5 h-5","aria-hidden":"true"})}function Vg({class:e}){return n(Lg,{class:e||"w-5 h-5","aria-hidden":"true"})}function Va({class:e,open:t}){return n(Oe,{class:`${e||"w-4 h-4"} transition-transform ${t?"rotate-180":""}`,"aria-hidden":"true"})}function Ok({class:e}){return n(L2,{class:e||"w-5 h-5","aria-hidden":"true"})}function Pk({class:e}){return n(Fl,{class:e||"w-3 h-3","aria-hidden":"true"})}function Fk({class:e}){return n(Og,{class:e||"w-5 h-5","aria-hidden":"true"})}function zk({class:e}){return n(rk,{class:e||"w-5 h-5",fill:"currentColor","aria-hidden":"true"})}function Uk({class:e}){return n(Tg,{class:e||"w-5 h-5","aria-hidden":"true"})}function Yg({class:e}){return n(Ul,{class:e||"w-5 h-5","aria-hidden":"true"})}function Jg({class:e}){return n(Et,{class:e||"w-5 h-5","aria-hidden":"true"})}function jk({class:e}){return n(W2,{class:e||"w-5 h-5","aria-hidden":"true"})}function Hk({class:e}){return n(Q2,{class:e||"w-5 h-5","aria-hidden":"true"})}function Uh({class:e}){return n(Ke,{class:e||"w-5 h-5","aria-hidden":"true"})}function Bk({class:e}){return n(Wt,{class:e||"w-5 h-5","aria-hidden":"true"})}function Wk({class:e}){return n(na,{class:e||"w-5 h-5","aria-hidden":"true"})}function Xg(e){return e>=90?"critical":e>=80?"high":e>=50?"medium":"low"}function Kk(){const[e,t]=U(!1),r=B(null);if(!p2.value)return null;qa(r,()=>t(!1),e);const a=Th.value,o=v2.value;if(!a||!o)return null;const l=Xg(o.usedPercent),i=`${a.displayName} Usage`;return n("div",{ref:r,class:"relative",children:[n(Ka,{content:i,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 ${Zg(l)}`,style:{width:`${Math.min(100,o.usedPercent)}%`}})}),n("span",{class:`text-xs font-medium ${Qg(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(qk,{window:c},c.label))})]})]})}function qk({window:e}){const t=Xg(e.usedPercent),r=e.resetAt?Gk(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 ${Qg(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 ${Zg(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 Zg(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 Qg(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 Gk(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 Vk(){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(K,{icon:St.value?n(Ga,{}):n(Lk,{}),label:s("accessibility.sidebarToggle"),onClick:()=>St.value=!St.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(_c,{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:s("app.name")})]})]}),n("div",{class:"flex items-center gap-4",children:[(()=>{const e=Yk(Ee.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:[s(e.label),L.value&&At.value&&At.value!=="dev"&&n("span",{class:"text-[var(--color-text-muted)]",children:[" v",At.value]})]})]})})(),n("div",{class:"sm:hidden flex items-center gap-1",children:[n(qg,{}),We.value&&n("div",{"data-tour":"canvas",children:n(K,{icon:n(Vg,{}),label:s("canvas.title"),onClick:()=>ul.value=!ul.value,variant:"ghost",size:"md"})}),n(K,{icon:n(Uh,{}),label:s("chat.search"),onClick:()=>Xe.value=!0,variant:"ghost",size:"md"})]}),n(Kk,{}),n("div",{"data-tour":"settings",children:n(K,{icon:n(Nk,{}),label:s("nav.settings"),onClick:()=>{const e=lc()==="/settings";De(e?Sg.value:"/settings")},variant:"ghost",size:"md"})})]})]})})}const Up={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 Yk(e){return Up[e]??Up.disconnected}const Jk={primary:`
58
- bg-[var(--color-accent)] text-white
59
- hover:opacity-90
60
- focus-visible:ring-[var(--color-accent)]
61
- `,secondary:`
62
- bg-[var(--color-bg-surface)] text-[var(--color-text-primary)]
63
- border border-[var(--color-border)]
64
- hover:bg-[var(--color-bg-secondary)]
65
- focus-visible:ring-[var(--color-accent)]
66
- `,ghost:`
67
- bg-transparent text-[var(--color-text-secondary)]
68
- hover:bg-[var(--color-bg-secondary)] hover:text-[var(--color-text-primary)]
69
- focus-visible:ring-[var(--color-accent)]
70
- `,danger:`
71
- bg-[var(--color-error)] text-white
72
- hover:opacity-90
73
- focus-visible:ring-[var(--color-error)]
74
- `},Xk={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"},P=jl(({type:e="button",variant:t="primary",size:r="md",loading:a=!1,icon:o,iconRight:l,fullWidth:i=!1,disabled:c,children:d,class:u,...h},f)=>n("button",{ref:f,type:e,disabled:c||a,class:`
75
- inline-flex items-center justify-center
76
- font-medium rounded-xl
77
- transition-all duration-200 ease-out
78
- shadow-soft-sm hover:shadow-soft
79
- active:scale-[0.97] active:shadow-none
80
- focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2
81
- disabled:opacity-40 disabled:cursor-not-allowed disabled:shadow-none disabled:active:scale-100 disabled:grayscale disabled:hover:opacity-40
82
- ${Jk[t]}
83
- ${Xk[r]}
84
- ${i?"w-full":""}
85
- ${u||""}
86
- `,...h,children:[a?n(te,{size:r==="lg"?"md":"sm"}):o?n("span",{class:"flex-shrink-0","aria-hidden":"true",children:o}):null,d&&n("span",{children:d}),l&&!a&&n("span",{class:"flex-shrink-0","aria-hidden":"true",children:l})]}));P.displayName="Button";const tu=['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 Zk(e,t={}){const{enabled:r=!0,autoFocus:a=!0,returnFocusTo:o}=t,l=B(null);O(()=>{if(!r||!e.current)return;if(l.current=document.activeElement,a){const u=e.current.querySelectorAll(tu)[0];u&&requestAnimationFrame(()=>{u.focus()})}function i(d){if(d.key!=="Tab"||!e.current)return;const u=e.current.querySelectorAll(tu);if(u.length===0)return;const h=u[0],f=u[u.length-1];if(d.shiftKey&&document.activeElement===h){d.preventDefault(),f.focus();return}if(!d.shiftKey&&document.activeElement===f){d.preventDefault(),h.focus();return}e.current.contains(document.activeElement)||(d.preventDefault(),h.focus())}function c(d){if(!e.current)return;const u=d.target;if(!e.current.contains(u)){const h=e.current.querySelectorAll(tu);h.length>0&&h[0].focus()}}return document.addEventListener("keydown",i),document.addEventListener("focusin",c),()=>{document.removeEventListener("keydown",i),document.removeEventListener("focusin",c);const d=o?.current??l.current;d&&typeof d.focus=="function"&&d.focus()}},[r,a,e,o])}const nu=250,Qk=80,e4={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 ze({open:e,onClose:t,title:r,size:a="md",hideCloseButton:o=!1,closeOnBackdrop:l=!0,closeOnEscape:i=!0,children:c,footer:d}){const u=B(null),h=B(null),[f,v]=U(e),m=B(!1),w=B(null),k=ee(()=>{if(m.current)return;m.current=!0;const b=u.current,S=h.current;b&&(b.style.transition=`transform ${nu}ms ease-out`,b.style.transform="translateY(100%)"),S&&(S.style.transition=`opacity ${nu}ms ease-out`,S.style.opacity="0"),setTimeout(()=>{v(!1),m.current=!1,t()},nu)},[t]);O(()=>{e?(v(!0),m.current=!1):f&&!m.current&&k()},[e,f,k]),O(()=>{e&&u.current&&requestAnimationFrame(()=>{u.current&&(u.current.style.transform="",u.current.style.transition=""),h.current&&(h.current.style.opacity="",h.current.style.transition="")})},[e]),Zk(u,{enabled:e&&!m.current,autoFocus:!1});const T=ee(b=>{b.key==="Escape"&&i&&!m.current&&k()},[i,k]),A=ee(b=>{w.current=b.touches[0].clientY,u.current&&(u.current.style.transition="none")},[]),g=ee(b=>{if(w.current===null)return;const _=b.touches[0].clientY-w.current;if(_>0&&(u.current&&(u.current.style.transform=`translateY(${_}px)`),h.current)){const M=Math.max(0,1-_/300);h.current.style.opacity=String(M)}},[]),x=ee(()=>{if(w.current===null)return;const b=u.current;if(b){const _=b.style.transform.match(/translateY\((\d+)px\)/);(_?parseInt(_[1],10):0)>Qk?k():(b.style.transition="transform 150ms ease-out",b.style.transform="translateY(0)",h.current&&(h.current.style.transition="opacity 150ms ease-out",h.current.style.opacity="1"))}w.current=null},[k]);return O(()=>{if(f)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[f]),O(()=>{if(f)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[f,T]),f?zh(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&&k()},"aria-hidden":"true"}),n("div",{ref:u,tabIndex:-1,class:`
87
- relative w-full ${e4[a]}
88
- bg-[var(--color-bg-surface)]
89
- border border-[var(--color-border)]
90
- max-h-[85vh] sm:max-h-[90vh] flex flex-col
91
- focus:outline-none shadow-soft-xl
92
- rounded-t-xl border-b-0 sm:rounded-xl sm:border-b
93
- animate-slide-up-full sm:animate-scale-in
94
- `,children:[n("div",{class:"sm:hidden flex justify-center pt-3 pb-2 cursor-grab active:cursor-grabbing",onTouchStart:A,onTouchMove:g,onTouchEnd:x,"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(K,{icon:n(Ga,{}),label:s("actions.close"),variant:"ghost",size:"sm",onClick:k,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}),d&&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:d})]})]}),document.body):null}const t4={sm:"px-2.5 py-1.5 text-xs",md:"px-3 py-2 text-sm",lg:"px-4 py-3 text-base"},X=jl(({size:e="md",error:t,leftElement:r,rightElement:a,fullWidth:o=!1,disabled:l,class:i,...c},d)=>{const u=!!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:d,disabled:l,class:`
95
- block rounded-xl
96
- bg-[var(--color-bg-primary)]
97
- border transition-all duration-200 ease-out
98
- shadow-soft-sm focus:shadow-soft
99
- placeholder:text-[var(--color-text-muted)]
100
- focus:outline-none focus:ring-2 focus:ring-offset-0
101
- disabled:opacity-50 disabled:cursor-not-allowed disabled:shadow-none
102
- ${u?"border-[var(--color-error)] focus:ring-[var(--color-error)]":"border-[var(--color-border)] focus:ring-[var(--color-accent)] focus:border-transparent"}
103
- ${t4[e]}
104
- ${r?"pl-10":""}
105
- ${a?"pr-10":""}
106
- ${o?"w-full":""}
107
- ${i||""}
108
- `,"aria-invalid":u,"aria-describedby":u?`${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})]})});X.displayName="Input";function Ie({label:e,htmlFor:t,error:r,hint:a,required:o,children:l,class:i}){return n("div",{class:i,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 Ai(e){if(e.displayName)return e.displayName;if(e.label)return e.label;const t=e.key.split(":");if(t.length>=3&&t[0]==="agent"){const r=t[2];return r==="main"?ig(t[1]):To(r)}if(t.length>=2){const r=t[t.length-1];if(op(r)){const a=t[t.length-2];if(a&&!op(a))return To(a)}return To(r)}return e.key}function n4(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 r4(e){const t=e.channel??e.lastChannel;return!t||t==="webchat"?null:To(t)}function jp({session:e,isActive:t=!1,isMain:r=!1,onClick:a,onRename:o,onDelete:l}){const[i,c]=U(!1),[d,u]=U(!1),h=B(null),f=B(null);qa(h,()=>c(!1),i);const v=()=>{if(!i&&f.current){const S=f.current.getBoundingClientRect();let _=f.current.parentElement;for(;_&&getComputedStyle(_).overflowY!=="auto";)_=_.parentElement;const I=(_?_.getBoundingClientRect().bottom:window.innerHeight)-S.bottom;u(I<100)}c(!i)},m=n4(e),w=r4(e),k=iw(e.totalTokens??e.contextTokens),T=e.updatedAt||e.lastActiveAt,A=ow(e.key),g=A?ig(A):null,x=vh.value===e.key,b=!!xh(e.key);return n("div",{class:`relative group transition-all duration-300 ${x?"opacity-0 scale-95 -translate-x-2":""}`,children:[n("button",{type:"button",onClick:a,class:`
109
- w-full text-left px-3 py-2.5 rounded-xl text-sm
110
- flex items-start gap-2.5 transition-all duration-200 ease-out
111
- ${b?"ai-glow":""}
112
- ${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)]"}
113
- `,children:[b?n(te,{size:"xs",class:"flex-shrink-0 mt-0.5 text-[var(--color-accent)]"}):r?n(Hk,{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:Ai(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:[g&&n("span",{class:"truncate flex-shrink",children:g}),w&&n(G,{children:[g&&n("span",{class:"flex-shrink-0 text-[var(--color-border)]",children:"•"}),n("span",{class:"truncate flex-shrink text-[var(--color-accent)]/70",children:w})]}),k&&n(G,{children:[(g||w)&&n("span",{class:"flex-shrink-0 text-[var(--color-border)]",children:"•"}),n("span",{class:"flex-shrink-0",title:`${e.totalTokens??e.contextTokens} tokens`,children:k})]}),n("span",{class:"flex-1 min-w-0"}),T&&n("span",{class:"whitespace-nowrap flex-shrink-0",children:fi(new Date(T))})]})]})]}),(o||l)&&n("div",{ref:h,class:"absolute right-2 top-2",children:[n("button",{ref:f,type:"button",onClick:S=>{S.stopPropagation(),v()},class:`p-1 rounded-lg transition-all duration-150
114
- ${i?"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":i,children:n(Uk,{class:"w-4 h-4"})}),i&&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 ${d?"bottom-full mb-1":"top-full mt-1"}`,children:[o&&n("button",{type:"button",role:"menuitem",onClick:S=>{S.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(Yg,{class:"w-4 h-4"}),s("actions.rename")]}),l&&n("button",{type:"button",role:"menuitem",onClick:S=>{S.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(Jg,{class:"w-4 h-4"}),s("actions.delete")]})]})]})]})}function a4({session:e,onClose:t,onRename:r}){const[a,o]=U(""),[l,i]=U(!1),c=B(null);O(()=>{e&&(o(Ai(e)),setTimeout(()=>c.current?.select(),100))},[e]);const d=async f=>{if(f.preventDefault(),!(!e||!a.trim())){i(!0);try{await r(e,a.trim()),t()}finally{i(!1)}}};if(!e)return null;const u=Ai(e),h=a.trim()!==u;return n(ze,{open:!!e,onClose:t,title:s("sessions.rename"),children:n("form",{onSubmit:d,children:[n(Ie,{label:s("sessions.label"),htmlFor:"session-label",children:n(X,{ref:c,id:"session-label",type:"text",value:a,onInput:f=>o(f.target.value),placeholder:s("sessions.labelPlaceholder"),fullWidth:!0})}),n("div",{class:"flex justify-end gap-2 mt-4",children:[n(P,{variant:"ghost",onClick:t,disabled:l,children:s("actions.cancel")}),n(P,{type:"submit",variant:"primary",loading:l,disabled:!a.trim()||!h,children:s("actions.save")})]})]})})}function o4({session:e,onClose:t,onDelete:r}){const[a,o]=U(!1),l=async()=>{if(e){o(!0);try{t(),await new Promise(i=>setTimeout(i,100)),await r(e)}catch{}finally{o(!1)}}};return e?n(ze,{open:!!e,onClose:t,title:s("sessions.delete"),children:[n("p",{class:"text-sm text-[var(--color-text-secondary)] mb-4",children:s("sessions.deleteConfirm",{name:Ai(e)})}),n("p",{class:"text-xs text-[var(--color-text-muted)] mb-4",children:s("sessions.deleteWarning")}),n("div",{class:"flex justify-end gap-2",children:[n(P,{variant:"ghost",onClick:t,disabled:a,children:s("actions.cancel")}),n(P,{variant:"danger",onClick:l,loading:a,children:s("actions.delete")})]})]}):null}const l4={sm:{trigger:"px-3 py-2.5 text-sm sm:px-2.5 sm:py-1.5 sm:text-xs",menu:"text-sm sm:text-xs",option:"px-3 py-2.5 sm:px-2.5 sm:py-1.5"},md:{trigger:"px-4 py-3 text-base sm:px-3 sm:py-2 sm:text-sm",menu:"text-base sm:text-sm",option:"px-4 py-3 sm:px-3 sm:py-2"},lg:{trigger:"px-4 py-3 text-base",menu:"text-base",option:"px-4 py-3"}};function Re({value:e,options:t,onChange:r,size:a="md",placeholder:o="Select...","aria-label":l,class:i,className:c,disabled:d=!1,align:u="left",width:h}){const f=i||c,[v,m]=U(!1),[w,k]=U(-1),[T,A]=U(void 0),g=B(null),x=B(null),C=B(null),b=l4[a],_=t.find(D=>D.value===e)?.label??o;Mm(()=>{!h&&C.current&&A(C.current.offsetWidth)},[t,h]);const M=ee(()=>{m(!1),k(-1)},[]),I=ee(D=>{r(D),M(),g.current?.focus()},[r,M]);qa([g,x],M,v);const F=ee(D=>{if(!v){(D.key==="Enter"||D.key===" "||D.key==="ArrowDown")&&(D.preventDefault(),m(!0),k(0));return}switch(D.key){case"Escape":D.preventDefault(),M(),g.current?.focus();break;case"ArrowDown":D.preventDefault(),k(Y=>Math.min(Y+1,t.length-1));break;case"ArrowUp":D.preventDefault(),k(Y=>Math.max(Y-1,0));break;case"Enter":case" ":D.preventDefault(),w>=0&&!t[w]?.disabled&&I(t[w].value);break;case"Tab":M();break}},[v,t,w,M,I]);return n("div",{class:`relative ${f??"inline-block"}`,children:[n("div",{ref:C,"aria-hidden":"true",class:`
115
- invisible absolute flex items-center gap-2
116
- ${b.trigger}
117
- `,children:[n("span",{children:t.reduce((D,Y)=>Y.label.length>D.length?Y.label:D,o)}),n(Oe,{class:"w-4 h-4 flex-shrink-0"})]}),n("button",{ref:g,type:"button",onClick:()=>!d&&m(!v),onKeyDown:F,disabled:d,"aria-label":l,"aria-haspopup":"listbox","aria-expanded":v,style:h?{width:h}:T&&!f?.includes("w-full")?{minWidth:`${T}px`}:void 0,class:`
118
- flex items-center justify-between gap-2 rounded-md cursor-pointer
119
- bg-[var(--color-bg-primary)] text-[var(--color-text-primary)]
120
- border border-[var(--color-border)] transition-all duration-200 ease-out
121
- shadow-soft-sm hover:shadow-soft focus:shadow-soft
122
- focus:outline-none focus:ring-2 focus:ring-[var(--color-accent)] focus:ring-offset-0 focus:border-transparent
123
- disabled:opacity-50 disabled:cursor-not-allowed disabled:shadow-none
124
- ${f?.includes("w-full")?"w-full":""}
125
- ${b.trigger}
126
- `,children:[n("span",{class:"truncate",children:_}),n(Oe,{class:`w-4 h-4 flex-shrink-0 text-[var(--color-text-muted)] transition-transform ${v?"rotate-180":""}`})]}),v&&g.current&&n("div",{ref:x,role:"listbox","aria-label":l,style:{position:"fixed",top:`${g.current.getBoundingClientRect().bottom+4}px`,minWidth:`${g.current.offsetWidth}px`,...u==="right"?{right:`${window.innerWidth-g.current.getBoundingClientRect().right}px`}:{left:`${g.current.getBoundingClientRect().left}px`}},class:`
127
- z-[100] inline-flex flex-col
128
- rounded-lg border border-[var(--color-border)]
129
- bg-[var(--color-bg-primary)] shadow-lg
130
- overflow-hidden
131
- ${b.menu}
132
- `,children:t.map((D,Y)=>n("button",{type:"button",role:"option","aria-selected":D.value===e,disabled:D.disabled,onClick:()=>!D.disabled&&I(D.value),onMouseEnter:()=>k(Y),class:`
133
- text-left whitespace-nowrap transition-colors
134
- ${b.option}
135
- ${D.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"}
136
- ${D.value===e?"text-[var(--color-accent)] font-medium":"text-[var(--color-text-primary)]"}
137
- ${w===Y&&!D.disabled?"bg-[var(--color-bg-tertiary)]":""}
138
- ${D.disabled?"":"hover:bg-[var(--color-bg-tertiary)]"}
139
- `,children:D.label},D.value))})]})}function eb({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:i=>t(i.target.checked),disabled:o,class:"sr-only peer"}),n("div",{class:`
140
- flex-shrink-0 w-5 h-5 rounded border-2 transition-colors
141
- flex items-center justify-center
142
- 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)]
143
- ${e?"bg-[var(--color-accent)] border-[var(--color-accent)]":"bg-[var(--color-bg-primary)] border-[var(--color-border)] hover:border-[var(--color-accent)]"}
144
- `,"aria-hidden":"true",children:e&&n(Bk,{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 s4({open:e,onClose:t,onCreate:r}){const[a,o]=U(Ze.value.defaultAgentId||wi.value),[l,i]=U(!1),c=()=>{l&&(Ze.value={...Ze.value,defaultAgentId:a,useDefaults:!0}),r(a),t()},d=()=>{o(Ze.value.defaultAgentId||wi.value),i(!1),t()};return td.value.length===0?null:n(ze,{open:e,onClose:d,title:s("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:s("newChatModal.agent")}),n(Re,{value:a,onChange:o,options:td.value,class:"w-full"}),n("p",{class:"mt-1.5 text-xs text-[var(--color-text-muted)]",children:s("newChatModal.agentDescription")})]}),n(eb,{checked:l,onChange:i,label:s("newChatModal.rememberChoice"),description:s("newChatModal.rememberChoiceDescription")}),n("div",{class:"flex justify-end gap-3 pt-2",children:[n(P,{variant:"secondary",onClick:d,children:s("actions.cancel")}),n(P,{variant:"primary",onClick:c,children:s("newChatModal.create")})]})]})})}const i4={sm:{track:"w-10 h-5 sm:w-8 sm:h-4",thumb:"w-4 h-4 sm:w-3 sm:h-3",translate:"translate-x-5 sm:translate-x-4"},md:{track:"w-12 h-6 sm:w-10 sm:h-5",thumb:"w-5 h-5 sm:w-4 sm:h-4",translate:"translate-x-6 sm:translate-x-5"},lg:{track:"w-12 h-6",thumb:"w-5 h-5",translate:"translate-x-6"}},$e=jl(({checked:e,onChange:t,size:r="md",label:a,description:o,disabled:l,class:i,id:c,...d},u)=>{const h=i4[r],f=c?`${c}-label`:void 0,v=c?`${c}-desc`:void 0;return n("div",{class:`flex items-start justify-between gap-3 ${i||""}`,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:v,class:"text-xs text-[var(--color-text-muted)]",children:o})]}),n("button",{ref:u,type:"button",role:"switch","aria-checked":e,"aria-labelledby":f,"aria-describedby":v,disabled:l,onClick:()=>t(!e),class:`
145
- relative inline-flex flex-shrink-0 items-center
146
- rounded-full transition-colors
147
- focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)] focus-visible:ring-offset-2
148
- disabled:opacity-50 disabled:cursor-not-allowed
149
- ${h.track}
150
- ${e?"bg-[var(--color-accent)]":"bg-[var(--color-border)]"}
151
- `,...d,children:n("span",{"aria-hidden":"true",class:`
152
- inline-block rounded-full bg-white shadow-sm
153
- transform transition-transform
154
- ${h.thumb}
155
- ${e?h.translate:"translate-x-0.5"}
156
- `})})]})});$e.displayName="Toggle";const c4={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 u4({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:`
157
- inline-flex items-center justify-center
158
- font-medium rounded-md transition-colors
159
- focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)] focus-visible:ring-offset-1
160
- disabled:opacity-50 disabled:cursor-not-allowed
161
- ${c4[t]}
162
- ${e?"bg-[var(--color-accent)] text-white":"bg-[var(--color-bg-primary)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-secondary)]"}
163
- ${l||""}
164
- `,children:o})}function d4(){const[e,t]=U(!1),r=B(null),a=il.value.trim()!=="",o=sl.value!==null,l=a||o||cl.value;O(()=>{l&&t(!0)},[l]),O(()=>{e&&r.current&&r.current.focus()},[e]);const i=[{value:null,label:s("sessions.filterAll")},{value:"main",label:s("sessions.filterMain")},{value:"isolated",label:s("sessions.filterIsolated")},{value:"channel",label:s("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:s("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":s("sessions.filterSessions"),children:n(jk,{class:"w-3.5 h-3.5"})})]}),e&&n("div",{class:"mt-2 space-y-2",children:[n("div",{class:"relative",children:[n(Uh,{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:il.value,onInput:c=>sp(c.target.value),onKeyDown:c=>{c.key==="Escape"&&!l&&t(!1)},placeholder:s("sessions.searchPlaceholder"),class:`w-full pl-7 pr-7 py-1.5 text-xs rounded-md
165
- bg-[var(--color-bg-primary)] border border-[var(--color-border)]
166
- text-[var(--color-text-primary)] placeholder-[var(--color-text-muted)]
167
- focus:outline-none focus:border-[var(--color-accent)]/50`}),a&&n("button",{type:"button",onClick:()=>sp(""),class:`absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded
168
- text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]`,children:n(Ga,{class:"w-3 h-3"})})]}),n("div",{class:"flex flex-wrap gap-1",children:i.map(c=>n(u4,{size:"xs",selected:sl.value===c.value,onClick:()=>pw(c.value),children:c.label},c.value??"all"))}),n($e,{size:"sm",checked:cl.value,onChange:vw,label:s("sessions.showCron")})]})]})}function Hp(e){De(`/chat/${encodeURIComponent(e)}`),Rh()}const h4={pinned:"sessions.pinned",today:"sessions.today",yesterday:"sessions.yesterday",thisWeek:"sessions.thisWeek",older:"sessions.older"},f4=["pinned","today","yesterday","thisWeek","older"];function p4({onRename:e,onDelete:t}){const r=fw.value,a=qu.value.length>0,o=fh(il.value);return a?o?n("ul",{class:"space-y-0.5",children:qu.value.map(l=>n("li",{children:n(jp,{session:l,isActive:Je.value===l.key&&Sn.value.startsWith("/chat"),isMain:Ar(l.key),onClick:()=>Hp(l.key),onRename:e,onDelete:t})},l.key))}):n("div",{class:"space-y-3",children:f4.map(l=>{const i=r.get(l);return!i||i.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:s(h4[l])}),n("ul",{class:"space-y-0.5",children:i.map(d=>n("li",{children:n(jp,{session:d,isActive:Je.value===d.key&&Sn.value.startsWith("/chat"),isMain:Ar(d.key),onClick:()=>Hp(d.key),onRename:e,onDelete:t})},d.key))})]},l)})}):n("p",{class:"text-sm text-[var(--color-text-muted)] px-2 py-4",children:s(o?"sessions.noResults":"sessions.noSessions")})}const Ge="w-5 h-5",v4=()=>n(G2,{class:Ge,"aria-hidden":"true"}),m4=()=>n(F2,{class:Ge,"aria-hidden":"true"}),g4=()=>n(Dg,{class:Ge,"aria-hidden":"true"}),b4=()=>n(Ci,{class:Ge,"aria-hidden":"true"}),x4=()=>n(nd,{class:Ge,"aria-hidden":"true"}),y4=()=>n(me,{class:Ge,"aria-hidden":"true"}),w4=()=>n(fn,{class:Ge,"aria-hidden":"true"}),k4=()=>n(Cg,{class:Ge,"aria-hidden":"true"}),_4=()=>n(ga,{class:Ge,"aria-hidden":"true"}),S4=()=>n(Fh,{class:Ge,"aria-hidden":"true"}),C4=()=>n(nk,{class:Ge,"aria-hidden":"true"}),A4=()=>n(Ht,{class:Ge,"aria-hidden":"true"}),T4=()=>n(N2,{class:Ge,"aria-hidden":"true"}),Bp=()=>n(K2,{class:Ge,"aria-hidden":"true"}),E4=()=>n(J2,{class:Ge,"aria-hidden":"true"}),I4=()=>n(X2,{class:Ge,"aria-hidden":"true"}),M4=[{titleKey:"nav.sections.control",items:[{id:"overview",labelKey:"nav.overview",icon:v4,requiresConnection:!0},{id:"usage",labelKey:"nav.usage",icon:m4,requiresConnection:!0},{id:"channels",labelKey:"nav.channels",icon:g4,requiresConnection:!0},{id:"instances",labelKey:"nav.instances",icon:b4,requiresConnection:!0},{id:"sessions",labelKey:"nav.sessions",icon:x4,requiresConnection:!0},{id:"cron",labelKey:"nav.cron",icon:y4,requiresConnection:!0}]},{titleKey:"nav.sections.agent",items:[{id:"skills",labelKey:"nav.skills",icon:w4,requiresConnection:!0},{id:"agents",labelKey:"nav.agents",icon:k4,requiresConnection:!0},{id:"devices",labelKey:"nav.devices",icon:_4,requiresConnection:!0}]},{titleKey:"nav.sections.settings",items:[{id:"settings",labelKey:"nav.settings",icon:I4},{id:"config",labelKey:"nav.config",icon:S4,requiresConnection:!0},{id:"debug",labelKey:"nav.debug",icon:C4,requiresConnection:!0},{id:"logs",labelKey:"nav.logs",icon:A4,requiresConnection:!0}]},{titleKey:"nav.sections.resources",items:[{id:"docs",labelKey:"nav.docs",icon:T4,external:ds.docs},{id:"github",labelKey:"nav.github",icon:Bp,external:ds.github},{id:"github-openclaw",labelKey:"nav.githubOpenClaw",icon:Bp,external:ds.githubOpenClaw},{id:"discord",labelKey:"nav.discord",icon:E4,external:ds.discord}]}],tb="cove:nav-sections";function nb(e){try{const t=`${tb}-${e}`,r=localStorage.getItem(t);return r?JSON.parse(r):{}}catch{return{}}}function R4(e,t,r){try{const a=`${tb}-${e}`,o=nb(e);o[t]=r,localStorage.setItem(a,JSON.stringify(o))}catch{}}function D4({item:e}){const t=`/${e.id}`,r=oc(()=>!e.external&&(Sn.value===t||e.id==="chat"&&Sn.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,{})}),s(e.labelKey),n(Pk,{class:"w-3 h-3 ml-auto text-[var(--color-text-muted)]"})]}):n("button",{type:"button",onClick:()=>{De(t),Rh()},class:`
169
- w-full flex items-center gap-3 px-3.5 py-2.5 rounded-xl text-sm
170
- transition-all duration-200 ease-out
171
- ${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)]"}
172
- `,children:[n("span",{class:"w-5 h-5 flex-shrink-0","aria-hidden":"true",children:n(a,{})}),s(e.labelKey)]})}function $4({section:e,mode:t,defaultOpen:r=!1}){const o=nb(t)[e.titleKey]??r,l=re(o),i=e.items;return i.length===0?null:n("div",{class:"border-b border-[var(--color-border)] last:border-b-0",children:[n("button",{type:"button",onClick:()=>{const d=!l.value;l.value=d,R4(t,e.titleKey,d)},"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:s(e.titleKey)}),n(Va,{open:l.value})]}),l.value&&n("ul",{id:`nav-section-${e.titleKey}`,class:"px-3 pb-2 space-y-0.5",role:"list",children:i.map(d=>n("li",{children:n(D4,{item:d})},d.id))})]})}function rb({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:M4.map(r=>n($4,{section:r,mode:t,defaultOpen:e},`${t}-${r.titleKey}`))})}const Sn=p(window.location.pathname);function L4({isStreaming:e}){const t=Sn.value==="/"||Sn.value.startsWith("/chat");return n("button",{type:"button",onClick:()=>{De("/chat"),Rh()},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(te,{size:"xs",class:"flex-shrink-0 text-[var(--color-accent)]"}):n("span",{class:"w-5 h-5 flex-shrink-0",children:"💬"}),s("nav.chat")]})}function N4(){const[e,t]=U(null),[r,a]=U(null),o=async(d,u)=>{try{await N("sessions.patch",{key:d.key,label:u}),mh(d.key,{label:u})}catch(h){throw E.ui.error("Failed to rename session:",h),h}},l=async d=>{try{await N("sessions.delete",{key:d.key}),await bw(d.key),cn.value===d.key&&De("/chat")}catch(u){throw E.ui.error("Failed to delete session:",u),u}},i=()=>{Ze.value.useDefaults?c(Ze.value.defaultAgentId):Zc.value=!0},c=async d=>{const u=crypto.randomUUID(),h=`agent:${d}:chat:${u}`;try{await N("sessions.patch",{key:h,label:s("newChatModal.title")}),await uc(),De(`/chat/${encodeURIComponent(h)}`)}catch(f){E.ui.error("Failed to create new chat:",f)}};return n("div",{class:"h-full flex flex-col",children:[Dl.value?n(G,{children:[n("div",{class:"p-3",children:n(P,{variant:"primary",disabled:!L.value,onClick:i,fullWidth:!0,icon:n(Gg,{}),children:s("actions.newChat")})}),n("div",{class:"flex-1 overflow-y-auto px-3 pb-3","data-tour":"sessions",children:[n(d4,{}),n(p4,{onRename:t,onDelete:a})]}),n(rb,{})]}):n(O4,{}),n(a4,{session:e,onClose:()=>t(null),onRename:o}),n(o4,{session:r,onClose:()=>a(null),onDelete:l}),n(s4,{open:Zc.value,onClose:()=>Zc.value=!1,onCreate:c})]})}function O4(){ue.value;const e=Be.value,t=e?!!xh(e):!1;return n("div",{class:"flex-1 overflow-y-auto",children:[n("div",{class:"px-3 py-2",children:n(L4,{isStreaming:t})}),n(rb,{expanded:!0})]})}const ab="cove:canvasPanel";function P4(){try{const e=localStorage.getItem(ab);if(e){const t=JSON.parse(e),r=window.innerWidth-100,a=window.innerHeight-50;return(t.x>r||t.x<0)&&(t.x=100),(t.y>a||t.y<0)&&(t.y=100),t.width>window.innerWidth&&(t.width=400),t.height>window.innerHeight&&(t.height=350),t}}catch{}return null}const Hl=P4(),Gr=p(Hl?.dockPosition??"floating"),ad=p(Hl?.x??100),od=p(Hl?.y??100),ra=p(Hl?.width??400),Ti=p(Hl?.height??350),ob=p(!1),NE=p("floating"),OE=p(!1);Ae(()=>{const e={dockPosition:Gr.value,x:ad.value,y:od.value,width:ra.value,height:Ti.value};localStorage.setItem(ab,JSON.stringify(e))});const PE=280,FE=200,zE=.5,UE=.6,jE=40,F4=44,z4=56,HE=1024,BE=W(()=>{if(ob.value)return{width:"auto",height:`${F4}px`,left:`${ad.value}px`,top:`${od.value}px`,borderRadius:"9999px"};switch(Gr.value){case"left":return{left:"0",top:"0",width:`${ra.value}px`,height:"100%",borderRadius:"0 12px 12px 0"};case"right":return{right:"0",top:"0",width:`${ra.value}px`,height:"100%",borderRadius:"12px 0 0 12px"};case"top":return{left:"0",top:`${z4}px`,width:"100%",height:`${Ti.value}px`,borderRadius:"0 0 12px 12px"};default:return{left:`${ad.value}px`,top:`${od.value}px`,width:`${ra.value}px`,height:`${Ti.value}px`,borderRadius:"12px"}}});function WE(e){if("touches"in e){const t=e.touches[0]||e.changedTouches[0];return{x:t.clientX,y:t.clientY}}return{x:e.clientX,y:e.clientY}}function U4({children:e}){T2();const t=ul.value&&!ob.value&&Gr.value!=="floating",r={};t&&(Gr.value==="left"?r.paddingLeft=`${ra.value}px`:Gr.value==="right"?r.paddingRight=`${ra.value}px`:Gr.value==="top"&&(r.paddingTop=`${Ti.value}px`));const a=o=>{const l=Math.max(w2,Math.min(k2,js.value+o));js.value=l};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(Vk,{}),n("div",{class:"flex-1 flex overflow-hidden",style:r,children:[(St.value||_t.value)&&n("div",{class:"fixed inset-0 bg-black z-40 lg:hidden",style:{opacity:_t.value?(Ln.value??0)/fr*.5:.5,transition:_t.value?"none":"opacity 200ms ease-out"},onClick:()=>St.value=!1,"aria-hidden":"true"}),n("aside",{style:{"--sidebar-width":`${js.value}px`,transform:_t.value?`translateX(${(Ln.value??0)-fr}px)`:void 0},class:`
173
- fixed inset-y-0 left-0 z-50 w-72 p-2 pr-0 pt-16
174
- lg:bg-[var(--color-bg-secondary)]
175
- ${_t.value?"":"transition-transform duration-200 ease-out"}
176
- ${!_t.value&&(St.value?"translate-x-0":"-translate-x-full")}
177
- lg:relative lg:inset-auto lg:z-auto lg:pt-2 lg:translate-x-0
178
- lg:w-[var(--sidebar-width)]
179
- ${!St.value&&"lg:w-0 lg:p-0"}
180
- ${Xc.value?"lg:transition-none":""}
181
- `,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(N4,{})})}),St.value&&n("div",{class:"hidden lg:flex items-center py-2",children:n(E2,{direction:"horizontal",onResizeStart:()=>Xc.value=!0,onResize:a,onResizeEnd:()=>Xc.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 ba=p([]);let j4=0;function ps(e,t="info",r=5e3){const a=`toast-${++j4}`;return ba.value=[...ba.value,{id:a,type:t,message:e,duration:r}].slice(-5),a}function H4(e){ba.value=ba.value.filter(t=>t.id!==e)}const J={success:(e,t)=>ps(e,"success",t),error:(e,t)=>ps(e,"error",t),warning:(e,t)=>ps(e,"warning",t),info:(e,t)=>ps(e,"info",t)},B4={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 W4({id:e,type:t,message:r,duration:a=5e3,onDismiss:o}){const l=B4[t];return O(()=>{if(a<=0)return;const i=setTimeout(()=>{o(e)},a);return()=>clearTimeout(i)},[e,a,o]),n("div",{role:"alert","aria-live":"polite",class:`
182
- flex items-start gap-3 p-4
183
- rounded-xl border shadow-soft-lg
184
- backdrop-blur-sm
185
- ${l.bg} ${l.border}
186
- animate-slide-in
187
- `,children:[n("span",{class:`flex-shrink-0 ${l.icon}`,"aria-hidden":"true",children:n(G4,{type:t})}),n("p",{class:"flex-1 text-sm text-[var(--color-text-primary)]",children:r}),n(K,{icon:n(Ga,{class:"w-4 h-4"}),label:s("actions.close"),variant:"ghost",size:"sm",onClick:()=>o(e)})]})}const K4={"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 q4({position:e="top-right"}){return ba.value.length===0?null:n("div",{class:`fixed z-50 flex flex-col gap-2 w-full max-w-sm ${K4[e]}`,"aria-label":"Notifications",children:ba.value.map(t=>n(W4,{...t,onDismiss:H4},t.id))})}function G4({type:e}){const t="w-5 h-5";switch(e){case"success":return n(Wt,{class:t,"aria-hidden":"true"});case"error":return n(Wa,{class:t,"aria-hidden":"true"});case"warning":return n(Tn,{class:t,"aria-hidden":"true"});default:return n(zl,{class:t,"aria-hidden":"true"})}}class Wp extends mt{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),E.ui.error("ErrorBoundary caught error:",t),E.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(V4,{error:this.state.error,errorInfo:this.state.errorInfo,onRetry:this.handleRetry}):this.props.children}}function V4({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:s("errors.generic")}),n("p",{class:"text-[var(--color-text-muted)] mb-6",children:e?.message||s("errors.unknown")}),n(P,{onClick:r,variant:"primary",children:s("actions.retry")}),!1]})})}const ln=p([]),dl=p(new Map),Y4=300*1e3,ld=new Map;function J4(){const e=Date.now(),t=[];for(const[r,a]of ld)e-a>Y4&&t.push(r);if(t.length>0){const r=new Map(dl.value);for(const a of t)r.delete(a),ld.delete(a);dl.value=r,E.exec.debug(`Pruned ${t.length} old resolved approval(s)`)}}const Ei=p(!1),Ii=p(null);function X4(e){const t={request:e,expiresAtMs:e.expiresAtMs,receivedAt:Date.now()};ln.value=[...ln.value,t],E.exec.info(`Exec approval queued: ${e.command} (${ln.value.length} pending)`)}function Z4(e){ln.value=ln.value.filter(t=>t.request.requestId!==e)}function Q4(){const e=Date.now(),t=ln.value.length;ln.value=ln.value.filter(a=>a.expiresAtMs>e);const r=t-ln.value.length;r>0&&E.exec.info(`Pruned ${r} expired exec approval(s)`)}async function e3(e,t){Ei.value=!0,Ii.value=null;try{await N("exec.approval.resolve",{id:e,decision:t}),Z4(e);const r=new Map(dl.value);r.set(e,t),dl.value=r,ld.set(e,Date.now()),J4(),E.exec.info(`Exec ${t} (direct): id=${e}`)}catch(r){const a=r instanceof Error?r.message:"Failed to send decision";throw Ii.value=a,E.exec.error(`Exec approval error: ${a}`),r}finally{Ei.value=!1}}let Hs=null,Bs=null;function t3(){lb(),Hs=cc(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()?X4(r):E.exec.debug("Ignoring already-expired approval request")}}),Bs=setInterval(Q4,1e3),E.exec.info("Exec approval system initialized")}function lb(){Hs&&(Hs(),Hs=null),Bs&&(clearInterval(Bs),Bs=null),ln.value=[],Ei.value=!1,Ii.value=null}let Kp=!1;L.subscribe(e=>{Kp&&!e&&lb(),Kp=e});function jh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Lr=jh();function sb(e){Lr=e}var Ro={exec:()=>null};function ae(e,t=""){let r=typeof e=="string"?e:e.source,a={replace:(o,l)=>{let i=typeof l=="string"?l:l.source;return i=i.replace(et.caret,"$1"),r=r.replace(o,i),a},getRegex:()=>new RegExp(r,t)};return a}var n3=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),et={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")},r3=/^(?:[ \t]*(?:\n|$))+/,a3=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,o3=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Bl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,l3=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Hh=/(?:[*+-]|\d{1,9}[.)])/,ib=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,cb=ae(ib).replace(/bull/g,Hh).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(),s3=ae(ib).replace(/bull/g,Hh).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(),Bh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,i3=/^[^\n]+/,Wh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,c3=ae(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Wh).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),u3=ae(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Hh).getRegex(),Sc="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",Kh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,d3=ae("^ {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",Kh).replace("tag",Sc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ub=ae(Bh).replace("hr",Bl).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",Sc).getRegex(),h3=ae(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ub).getRegex(),qh={blockquote:h3,code:a3,def:c3,fences:o3,heading:l3,hr:Bl,html:d3,lheading:cb,list:u3,newline:r3,paragraph:ub,table:Ro,text:i3},qp=ae("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Bl).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",Sc).getRegex(),f3={...qh,lheading:s3,table:qp,paragraph:ae(Bh).replace("hr",Bl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",qp).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",Sc).getRegex()},p3={...qh,html:ae(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Kh).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:Ro,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ae(Bh).replace("hr",Bl).replace("heading",` *#{1,6} *[^
188
- ]`).replace("lheading",cb).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},v3=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,m3=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,db=/^( {2,}|\\)\n(?!\s*$)/,g3=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Cc=/[\p{P}\p{S}]/u,Gh=/[\s\p{P}\p{S}]/u,hb=/[^\s\p{P}\p{S}]/u,b3=ae(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Gh).getRegex(),fb=/(?!~)[\p{P}\p{S}]/u,x3=/(?!~)[\s\p{P}\p{S}]/u,y3=/(?:[^\s\p{P}\p{S}]|~)/u,w3=ae(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",n3?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),pb=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,k3=ae(pb,"u").replace(/punct/g,Cc).getRegex(),_3=ae(pb,"u").replace(/punct/g,fb).getRegex(),vb="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",S3=ae(vb,"gu").replace(/notPunctSpace/g,hb).replace(/punctSpace/g,Gh).replace(/punct/g,Cc).getRegex(),C3=ae(vb,"gu").replace(/notPunctSpace/g,y3).replace(/punctSpace/g,x3).replace(/punct/g,fb).getRegex(),A3=ae("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,hb).replace(/punctSpace/g,Gh).replace(/punct/g,Cc).getRegex(),T3=ae(/\\(punct)/,"gu").replace(/punct/g,Cc).getRegex(),E3=ae(/^<(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(),I3=ae(Kh).replace("(?:-->|$)","-->").getRegex(),M3=ae("^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",I3).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Mi=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,R3=ae(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Mi).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),mb=ae(/^!?\[(label)\]\[(ref)\]/).replace("label",Mi).replace("ref",Wh).getRegex(),gb=ae(/^!?\[(ref)\](?:\[\])?/).replace("ref",Wh).getRegex(),D3=ae("reflink|nolink(?!\\()","g").replace("reflink",mb).replace("nolink",gb).getRegex(),Gp=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Vh={_backpedal:Ro,anyPunctuation:T3,autolink:E3,blockSkip:w3,br:db,code:m3,del:Ro,emStrongLDelim:k3,emStrongRDelimAst:S3,emStrongRDelimUnd:A3,escape:v3,link:R3,nolink:gb,punctuation:b3,reflink:mb,reflinkSearch:D3,tag:M3,text:g3,url:Ro},$3={...Vh,link:ae(/^!?\[(label)\]\((.*?)\)/).replace("label",Mi).getRegex(),reflink:ae(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Mi).getRegex()},sd={...Vh,emStrongRDelimAst:C3,emStrongLDelim:_3,url:ae(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Gp).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:ae(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Gp).getRegex()},L3={...sd,br:ae(db).replace("{2,}","*").getRegex(),text:ae(sd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},vs={normal:qh,gfm:f3,pedantic:p3},ro={normal:Vh,gfm:sd,breaks:L3,pedantic:$3},N3={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Vp=e=>N3[e];function bn(e,t){if(t){if(et.escapeTest.test(e))return e.replace(et.escapeReplace,Vp)}else if(et.escapeTestNoEncode.test(e))return e.replace(et.escapeReplaceNoEncode,Vp);return e}function Yp(e){try{e=encodeURI(e).replace(et.percentDecode,"%")}catch{return null}return e}function Jp(e,t){let r=e.replace(et.findPipe,(l,i,c)=>{let d=!1,u=i;for(;--u>=0&&c[u]==="\\";)d=!d;return d?"|":" |"}),a=r.split(et.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(et.slashPipe,"|");return a}function ao(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 O3(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 Xp(e,t,r,a,o){let l=t.href,i=t.title||null,c=e[1].replace(o.other.outputLinkReplace,"$1");a.state.inLink=!0;let d={type:e[0].charAt(0)==="!"?"image":"link",raw:r,href:l,title:i,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,d}function P3(e,t,r){let a=e.match(r.other.indentCodeCompensation);if(a===null)return t;let o=a[1];return t.split(`
189
- `).map(l=>{let i=l.match(r.other.beginningSpace);if(i===null)return l;let[c]=i;return c.length>=o.length?l.slice(o.length):l}).join(`
190
- `)}var Ri=class{options;rules;lexer;constructor(e){this.options=e||Lr}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:ao(r,`
191
- `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],a=P3(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=ao(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:ao(t[0],`
192
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let r=ao(t[0],`
193
- `).split(`
194
- `),a="",o="",l=[];for(;r.length>0;){let i=!1,c=[],d;for(d=0;d<r.length;d++)if(this.rules.other.blockquoteStart.test(r[d]))c.push(r[d]),i=!0;else if(!i)c.push(r[d]);else break;r=r.slice(d);let u=c.join(`
195
- `),h=u.replace(this.rules.other.blockquoteSetextReplace,`
196
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
197
- ${u}`:u,o=o?`${o}
198
- ${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 v=l.at(-1);if(v?.type==="code")break;if(v?.type==="blockquote"){let m=v,w=m.raw+`
199
- `+r.join(`
200
- `),k=this.blockquote(w);l[l.length-1]=k,a=a.substring(0,a.length-m.raw.length)+k.raw,o=o.substring(0,o.length-m.text.length)+k.text;break}else if(v?.type==="list"){let m=v,w=m.raw+`
201
- `+r.join(`
202
- `),k=this.list(w);l[l.length-1]=k,a=a.substring(0,a.length-v.raw.length)+k.raw,o=o.substring(0,o.length-m.raw.length)+k.raw,r=w.substring(l.at(-1).raw.length).split(`
203
- `);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),i=!1;for(;e;){let d=!1,u="",h="";if(!(t=l.exec(e))||this.rules.block.hr.test(e))break;u=t[0],e=e.substring(u.length);let f=t[2].split(`
204
- `,1)[0].replace(this.rules.other.listReplaceTabs,k=>" ".repeat(3*k.length)),v=e.split(`
205
- `,1)[0],m=!f.trim(),w=0;if(this.options.pedantic?(w=2,h=f.trimStart()):m?w=t[1].length+1:(w=t[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,h=f.slice(w),w+=t[1].length),m&&this.rules.other.blankLine.test(v)&&(u+=v+`
206
- `,e=e.substring(v.length+1),d=!0),!d){let k=this.rules.other.nextBulletRegex(w),T=this.rules.other.hrRegex(w),A=this.rules.other.fencesBeginRegex(w),g=this.rules.other.headingBeginRegex(w),x=this.rules.other.htmlBeginRegex(w);for(;e;){let C=e.split(`
207
- `,1)[0],b;if(v=C,this.options.pedantic?(v=v.replace(this.rules.other.listReplaceNesting," "),b=v):b=v.replace(this.rules.other.tabCharGlobal," "),A.test(v)||g.test(v)||x.test(v)||k.test(v)||T.test(v))break;if(b.search(this.rules.other.nonSpaceChar)>=w||!v.trim())h+=`
208
- `+b.slice(w);else{if(m||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||A.test(f)||g.test(f)||T.test(f))break;h+=`
209
- `+v}!m&&!v.trim()&&(m=!0),u+=C+`
210
- `,e=e.substring(C.length+1),f=b.slice(w)}}o.loose||(i?o.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(i=!0)),o.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),o.raw+=u}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 d of o.items){if(this.lexer.state.top=!1,d.tokens=this.lexer.blockTokens(d.text,[]),d.task){if(d.text=d.text.replace(this.rules.other.listReplaceTask,""),d.tokens[0]?.type==="text"||d.tokens[0]?.type==="paragraph"){d.tokens[0].raw=d.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),d.tokens[0].text=d.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 u=this.rules.other.listTaskCheckbox.exec(d.raw);if(u){let h={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};d.checked=h.checked,o.loose?d.tokens[0]&&["paragraph","text"].includes(d.tokens[0].type)&&"tokens"in d.tokens[0]&&d.tokens[0].tokens?(d.tokens[0].raw=h.raw+d.tokens[0].raw,d.tokens[0].text=h.raw+d.tokens[0].text,d.tokens[0].tokens.unshift(h)):d.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):d.tokens.unshift(h)}}if(!o.loose){let u=d.tokens.filter(f=>f.type==="space"),h=u.length>0&&u.some(f=>this.rules.other.anyLine.test(f.raw));o.loose=h}}if(o.loose)for(let d of o.items){d.loose=!0;for(let u of d.tokens)u.type==="text"&&(u.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=Jp(t[1]),a=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
211
- `):[],l={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===a.length){for(let i of a)this.rules.other.tableAlignRight.test(i)?l.align.push("right"):this.rules.other.tableAlignCenter.test(i)?l.align.push("center"):this.rules.other.tableAlignLeft.test(i)?l.align.push("left"):l.align.push(null);for(let i=0;i<r.length;i++)l.header.push({text:r[i],tokens:this.lexer.inline(r[i]),header:!0,align:l.align[i]});for(let i of o)l.rows.push(Jp(i,l.header.length).map((c,d)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:l.align[d]})));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)===`
212
- `?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=ao(r.slice(0,-1),"\\");if((r.length-l.length)%2===0)return}else{let l=O3(t[2],"()");if(l===-2)return;if(l>-1){let i=(t[0].indexOf("!")===0?5:4)+t[1].length+l;t[2]=t[2].substring(0,l),t[0]=t[0].substring(0,i).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)),Xp(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 Xp(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,i,c=o,d=0,u=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+o);(a=u.exec(t))!=null;){if(l=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!l)continue;if(i=[...l].length,a[3]||a[4]){c+=i;continue}else if((a[5]||a[6])&&o%3&&!((o+i)%3)){d+=i;continue}if(c-=i,c>0)continue;i=Math.min(i,i+c+d);let h=[...a[0]][0].length,f=e.slice(0,o+a.index+h+i);if(Math.min(o,i)%2){let m=f.slice(1,-1);return{type:"em",raw:f,text:m,tokens:this.lexer.inlineTokens(m)}}let v=f.slice(2,-2);return{type:"strong",raw:f,text:v,tokens:this.lexer.inlineTokens(v)}}}}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}}}},$t=class id{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Lr,this.options.tokenizer=this.options.tokenizer||new Ri,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:et,block:vs.normal,inline:ro.normal};this.options.pedantic?(r.block=vs.pedantic,r.inline=ro.pedantic):this.options.gfm&&(r.block=vs.gfm,this.options.breaks?r.inline=ro.breaks:r.inline=ro.gfm),this.tokenizer.rules=r}static get rules(){return{block:vs,inline:ro}}static lex(t,r){return new id(r).lex(t)}static lexInline(t,r){return new id(r).inlineTokens(t)}lex(t){t=t.replace(et.carriageReturn,`
213
- `),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(et.tabCharGlobal," ").replace(et.spaceLine,""));t;){let o;if(this.options.extensions?.block?.some(i=>(o=i.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 i=r.at(-1);o.raw.length===1&&i!==void 0?i.raw+=`
214
- `:r.push(o);continue}if(o=this.tokenizer.code(t)){t=t.substring(o.raw.length);let i=r.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
215
- `)?"":`
216
- `)+o.raw,i.text+=`
217
- `+o.text,this.inlineQueue.at(-1).src=i.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 i=r.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
218
- `)?"":`
219
- `)+o.raw,i.text+=`
220
- `+o.raw,this.inlineQueue.at(-1).src=i.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 i=1/0,c=t.slice(1),d;this.options.extensions.startBlock.forEach(u=>{d=u.call({lexer:this},c),typeof d=="number"&&d>=0&&(i=Math.min(i,d))}),i<1/0&&i>=0&&(l=t.substring(0,i+1))}if(this.state.top&&(o=this.tokenizer.paragraph(l))){let i=r.at(-1);a&&i?.type==="paragraph"?(i.raw+=(i.raw.endsWith(`
221
- `)?"":`
222
- `)+o.raw,i.text+=`
223
- `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.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 i=r.at(-1);i?.type==="text"?(i.raw+=(i.raw.endsWith(`
224
- `)?"":`
225
- `)+o.raw,i.text+=`
226
- `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=i.text):r.push(o);continue}if(t){let i="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(i);break}else throw new Error(i)}}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 d=Object.keys(this.tokens.links);if(d.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)d.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 i=!1,c="";for(;t;){i||(c=""),i=!1;let d;if(this.options.extensions?.inline?.some(h=>(d=h.call({lexer:this},t,r))?(t=t.substring(d.raw.length),r.push(d),!0):!1))continue;if(d=this.tokenizer.escape(t)){t=t.substring(d.raw.length),r.push(d);continue}if(d=this.tokenizer.tag(t)){t=t.substring(d.raw.length),r.push(d);continue}if(d=this.tokenizer.link(t)){t=t.substring(d.raw.length),r.push(d);continue}if(d=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(d.raw.length);let h=r.at(-1);d.type==="text"&&h?.type==="text"?(h.raw+=d.raw,h.text+=d.text):r.push(d);continue}if(d=this.tokenizer.emStrong(t,a,c)){t=t.substring(d.raw.length),r.push(d);continue}if(d=this.tokenizer.codespan(t)){t=t.substring(d.raw.length),r.push(d);continue}if(d=this.tokenizer.br(t)){t=t.substring(d.raw.length),r.push(d);continue}if(d=this.tokenizer.del(t)){t=t.substring(d.raw.length),r.push(d);continue}if(d=this.tokenizer.autolink(t)){t=t.substring(d.raw.length),r.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(t))){t=t.substring(d.raw.length),r.push(d);continue}let u=t;if(this.options.extensions?.startInline){let h=1/0,f=t.slice(1),v;this.options.extensions.startInline.forEach(m=>{v=m.call({lexer:this},f),typeof v=="number"&&v>=0&&(h=Math.min(h,v))}),h<1/0&&h>=0&&(u=t.substring(0,h+1))}if(d=this.tokenizer.inlineText(u)){t=t.substring(d.raw.length),d.raw.slice(-1)!=="_"&&(c=d.raw.slice(-1)),i=!0;let h=r.at(-1);h?.type==="text"?(h.raw+=d.raw,h.text+=d.text):r.push(d);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}},Di=class{options;parser;constructor(e){this.options=e||Lr}space(e){return""}code({text:e,lang:t,escaped:r}){let a=(t||"").match(et.notSpaceStart)?.[0],o=e.replace(et.endingNewline,"")+`
227
- `;return a?'<pre><code class="language-'+bn(a)+'">'+(r?o:bn(o,!0))+`</code></pre>
228
- `:"<pre><code>"+(r?o:bn(o,!0))+`</code></pre>
229
- `}blockquote({tokens:e}){return`<blockquote>
230
- ${this.parser.parse(e)}</blockquote>
231
- `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
232
- `}hr(e){return`<hr>
233
- `}list(e){let t=e.ordered,r=e.start,a="";for(let i=0;i<e.items.length;i++){let c=e.items[i];a+=this.listitem(c)}let o=t?"ol":"ul",l=t&&r!==1?' start="'+r+'"':"";return"<"+o+l+`>
234
- `+a+"</"+o+`>
235
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
236
- `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
237
- `}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 i=0;i<l.length;i++)r+=this.tablecell(l[i]);a+=this.tablerow({text:r})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
238
- <thead>
239
- `+t+`</thead>
240
- `+a+`</table>
241
- `}tablerow({text:e}){return`<tr>
242
- ${e}</tr>
243
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
244
- `}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>${bn(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=Yp(e);if(o===null)return a;e=o;let l='<a href="'+e+'"';return t&&(l+=' title="'+bn(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=Yp(e);if(o===null)return bn(r);e=o;let l=`<img src="${e}" alt="${r}"`;return t&&(l+=` title="${bn(t)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:bn(e.text)}},Yh=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}},Lt=class cd{options;renderer;textRenderer;constructor(t){this.options=t||Lr,this.options.renderer=this.options.renderer||new Di,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Yh}static parse(t,r){return new cd(r).parse(t)}static parseInline(t,r){return new cd(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 i=o,c=this.options.extensions.renderers[i.type].call({parser:this},i);if(c!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(i.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 i='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}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 i=l;switch(i.type){case"escape":{a+=r.text(i);break}case"html":{a+=r.html(i);break}case"link":{a+=r.link(i);break}case"image":{a+=r.image(i);break}case"checkbox":{a+=r.checkbox(i);break}case"strong":{a+=r.strong(i);break}case"em":{a+=r.em(i);break}case"codespan":{a+=r.codespan(i);break}case"br":{a+=r.br(i);break}case"del":{a+=r.del(i);break}case"text":{a+=r.text(i);break}default:{let c='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return a}},go=class{options;block;constructor(e){this.options=e||Lr}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?$t.lex:$t.lexInline}provideParser(){return this.block?Lt.parse:Lt.parseInline}},bb=class{defaults=jh();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Lt;Renderer=Di;TextRenderer=Yh;Lexer=$t;Tokenizer=Ri;Hooks=go;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 i of l)r=r.concat(this.walkTokens(i.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 i=o[l].flat(1/0);r=r.concat(this.walkTokens(i,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(...i){let c=o.renderer.apply(this,i);return c===!1&&(c=l.apply(this,i)),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 Di(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 i=l,c=r.renderer[i],d=o[i];o[i]=(...u)=>{let h=c.apply(o,u);return h===!1&&(h=d.apply(o,u)),h||""}}a.renderer=o}if(r.tokenizer){let o=this.defaults.tokenizer||new Ri(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 i=l,c=r.tokenizer[i],d=o[i];o[i]=(...u)=>{let h=c.apply(o,u);return h===!1&&(h=d.apply(o,u)),h}}a.tokenizer=o}if(r.hooks){let o=this.defaults.hooks||new go;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 i=l,c=r.hooks[i],d=o[i];go.passThroughHooks.has(l)?o[i]=u=>{if(this.defaults.async&&go.passThroughHooksRespectAsync.has(l))return(async()=>{let f=await c.call(o,u);return d.call(o,f)})();let h=c.call(o,u);return d.call(o,h)}:o[i]=(...u)=>{if(this.defaults.async)return(async()=>{let f=await c.apply(o,u);return f===!1&&(f=await d.apply(o,u)),f})();let h=c.apply(o,u);return h===!1&&(h=d.apply(o,u)),h}}a.hooks=o}if(r.walkTokens){let o=this.defaults.walkTokens,l=r.walkTokens;a.walkTokens=function(i){let c=[];return c.push(l.call(this,i)),o&&(c=c.concat(o.call(this,i))),c}}this.defaults={...this.defaults,...a}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return $t.lex(e,t??this.defaults)}parser(e,t){return Lt.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 i=o.hooks?await o.hooks.preprocess(t):t,c=await(o.hooks?await o.hooks.provideLexer():e?$t.lex:$t.lexInline)(i,o),d=o.hooks?await o.hooks.processAllTokens(c):c;o.walkTokens&&await Promise.all(this.walkTokens(d,o.walkTokens));let u=await(o.hooks?await o.hooks.provideParser():e?Lt.parse:Lt.parseInline)(d,o);return o.hooks?await o.hooks.postprocess(u):u})().catch(l);try{o.hooks&&(t=o.hooks.preprocess(t));let i=(o.hooks?o.hooks.provideLexer():e?$t.lex:$t.lexInline)(t,o);o.hooks&&(i=o.hooks.processAllTokens(i)),o.walkTokens&&this.walkTokens(i,o.walkTokens);let c=(o.hooks?o.hooks.provideParser():e?Lt.parse:Lt.parseInline)(i,o);return o.hooks&&(c=o.hooks.postprocess(c)),c}catch(i){return l(i)}}}onError(e,t){return r=>{if(r.message+=`
245
- Please report this to https://github.com/markedjs/marked.`,e){let a="<p>An error occurred:</p><pre>"+bn(r.message+"",!0)+"</pre>";return t?Promise.resolve(a):a}if(t)return Promise.reject(r);throw r}}},Er=new bb;function se(e,t){return Er.parse(e,t)}se.options=se.setOptions=function(e){return Er.setOptions(e),se.defaults=Er.defaults,sb(se.defaults),se};se.getDefaults=jh;se.defaults=Lr;se.use=function(...e){return Er.use(...e),se.defaults=Er.defaults,sb(se.defaults),se};se.walkTokens=function(e,t){return Er.walkTokens(e,t)};se.parseInline=Er.parseInline;se.Parser=Lt;se.parser=Lt.parse;se.Renderer=Di;se.TextRenderer=Yh;se.Lexer=$t;se.lexer=$t.lex;se.Tokenizer=Ri;se.Hooks=go;se.parse=se;se.options;se.setOptions;se.use;se.walkTokens;se.parseInline;Lt.parse;$t.lex;var Zp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function F3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ru={exports:{}},Qp;function z3(){return Qp||(Qp=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,i={},c={manual:a.Prism&&a.Prism.manual,disableWorkerMessageHandler:a.Prism&&a.Prism.disableWorkerMessageHandler,util:{encode:function g(x){return x instanceof d?new d(x.type,g(x.content),x.alias):Array.isArray(x)?x.map(g):x.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(g){return Object.prototype.toString.call(g).slice(8,-1)},objId:function(g){return g.__id||Object.defineProperty(g,"__id",{value:++l}),g.__id},clone:function g(x,C){C=C||{};var b,S;switch(c.util.type(x)){case"Object":if(S=c.util.objId(x),C[S])return C[S];b={},C[S]=b;for(var _ in x)x.hasOwnProperty(_)&&(b[_]=g(x[_],C));return b;case"Array":return S=c.util.objId(x),C[S]?C[S]:(b=[],C[S]=b,x.forEach(function(M,I){b[I]=g(M,C)}),b);default:return x}},getLanguage:function(g){for(;g;){var x=o.exec(g.className);if(x)return x[1].toLowerCase();g=g.parentElement}return"none"},setLanguage:function(g,x){g.className=g.className.replace(RegExp(o,"gi"),""),g.classList.add("language-"+x)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(b){var g=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(b.stack)||[])[1];if(g){var x=document.getElementsByTagName("script");for(var C in x)if(x[C].src==g)return x[C]}return null}},isActive:function(g,x,C){for(var b="no-"+x;g;){var S=g.classList;if(S.contains(x))return!0;if(S.contains(b))return!1;g=g.parentElement}return!!C}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(g,x){var C=c.util.clone(c.languages[g]);for(var b in x)C[b]=x[b];return C},insertBefore:function(g,x,C,b){b=b||c.languages;var S=b[g],_={};for(var M in S)if(S.hasOwnProperty(M)){if(M==x)for(var I in C)C.hasOwnProperty(I)&&(_[I]=C[I]);C.hasOwnProperty(M)||(_[M]=S[M])}var F=b[g];return b[g]=_,c.languages.DFS(c.languages,function(D,Y){Y===F&&D!=g&&(this[D]=_)}),_},DFS:function g(x,C,b,S){S=S||{};var _=c.util.objId;for(var M in x)if(x.hasOwnProperty(M)){C.call(x,M,x[M],b||M);var I=x[M],F=c.util.type(I);F==="Object"&&!S[_(I)]?(S[_(I)]=!0,g(I,C,null,S)):F==="Array"&&!S[_(I)]&&(S[_(I)]=!0,g(I,C,M,S))}}},plugins:{},highlightAll:function(g,x){c.highlightAllUnder(document,g,x)},highlightAllUnder:function(g,x,C){var b={callback:C,container:g,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};c.hooks.run("before-highlightall",b),b.elements=Array.prototype.slice.apply(b.container.querySelectorAll(b.selector)),c.hooks.run("before-all-elements-highlight",b);for(var S=0,_;_=b.elements[S++];)c.highlightElement(_,x===!0,b.callback)},highlightElement:function(g,x,C){var b=c.util.getLanguage(g),S=c.languages[b];c.util.setLanguage(g,b);var _=g.parentElement;_&&_.nodeName.toLowerCase()==="pre"&&c.util.setLanguage(_,b);var M=g.textContent,I={element:g,language:b,grammar:S,code:M};function F(Y){I.highlightedCode=Y,c.hooks.run("before-insert",I),I.element.innerHTML=I.highlightedCode,c.hooks.run("after-highlight",I),c.hooks.run("complete",I),C&&C.call(I.element)}if(c.hooks.run("before-sanity-check",I),_=I.element.parentElement,_&&_.nodeName.toLowerCase()==="pre"&&!_.hasAttribute("tabindex")&&_.setAttribute("tabindex","0"),!I.code){c.hooks.run("complete",I),C&&C.call(I.element);return}if(c.hooks.run("before-highlight",I),!I.grammar){F(c.util.encode(I.code));return}if(x&&a.Worker){var D=new Worker(c.filename);D.onmessage=function(Y){F(Y.data)},D.postMessage(JSON.stringify({language:I.language,code:I.code,immediateClose:!0}))}else F(c.highlight(I.code,I.grammar,I.language))},highlight:function(g,x,C){var b={code:g,grammar:x,language:C};if(c.hooks.run("before-tokenize",b),!b.grammar)throw new Error('The language "'+b.language+'" has no grammar.');return b.tokens=c.tokenize(b.code,b.grammar),c.hooks.run("after-tokenize",b),d.stringify(c.util.encode(b.tokens),b.language)},tokenize:function(g,x){var C=x.rest;if(C){for(var b in C)x[b]=C[b];delete x.rest}var S=new f;return v(S,S.head,g),h(g,S,x,S.head,0),w(S)},hooks:{all:{},add:function(g,x){var C=c.hooks.all;C[g]=C[g]||[],C[g].push(x)},run:function(g,x){var C=c.hooks.all[g];if(!(!C||!C.length))for(var b=0,S;S=C[b++];)S(x)}},Token:d};a.Prism=c;function d(g,x,C,b){this.type=g,this.content=x,this.alias=C,this.length=(b||"").length|0}d.stringify=function g(x,C){if(typeof x=="string")return x;if(Array.isArray(x)){var b="";return x.forEach(function(F){b+=g(F,C)}),b}var S={type:x.type,content:g(x.content,C),tag:"span",classes:["token",x.type],attributes:{},language:C},_=x.alias;_&&(Array.isArray(_)?Array.prototype.push.apply(S.classes,_):S.classes.push(_)),c.hooks.run("wrap",S);var M="";for(var I in S.attributes)M+=" "+I+'="'+(S.attributes[I]||"").replace(/"/g,"&quot;")+'"';return"<"+S.tag+' class="'+S.classes.join(" ")+'"'+M+">"+S.content+"</"+S.tag+">"};function u(g,x,C,b){g.lastIndex=x;var S=g.exec(C);if(S&&b&&S[1]){var _=S[1].length;S.index+=_,S[0]=S[0].slice(_)}return S}function h(g,x,C,b,S,_){for(var M in C)if(!(!C.hasOwnProperty(M)||!C[M])){var I=C[M];I=Array.isArray(I)?I:[I];for(var F=0;F<I.length;++F){if(_&&_.cause==M+","+F)return;var D=I[F],Y=D.inside,Ue=!!D.lookbehind,fe=!!D.greedy,nr=D.alias;if(fe&&!D.pattern.global){var En=D.pattern.toString().match(/[imsuy]*$/)[0];D.pattern=RegExp(D.pattern.source,En+"g")}for(var In=D.pattern||D,ge=b.next,H=S;ge!==x.tail&&!(_&&H>=_.reach);H+=ge.value.length,ge=ge.next){var ie=ge.value;if(x.length>g.length)return;if(!(ie instanceof d)){var pe=1,at;if(fe){if(at=u(In,H,g,Ue),!at||at.index>=g.length)break;var qt=at.index,Se=at.index+at[0].length,Rt=H;for(Rt+=ge.value.length;qt>=Rt;)ge=ge.next,Rt+=ge.value.length;if(Rt-=ge.value.length,H=Rt,ge.value instanceof d)continue;for(var ce=ge;ce!==x.tail&&(Rt<Se||typeof ce.value=="string");ce=ce.next)pe++,Rt+=ce.value.length;pe--,ie=g.slice(H,Rt),at.index-=H}else if(at=u(In,0,ie,Ue),!at)continue;var qt=at.index,Mn=at[0],Gt=ie.slice(0,qt),Za=ie.slice(qt+Mn.length),rr=H+ie.length;_&&rr>_.reach&&(_.reach=rr);var ar=ge.prev;Gt&&(ar=v(x,ar,Gt),H+=Gt.length),m(x,ar,pe);var Xl=new d(M,Y?c.tokenize(Mn,Y):Mn,nr,Mn);if(ge=v(x,ar,Xl),Za&&v(x,ge,Za),pe>1){var Vt={cause:M+","+F,reach:rr};h(g,x,C,ge.prev,H,Vt),_&&Vt.reach>_.reach&&(_.reach=Vt.reach)}}}}}}function f(){var g={value:null,prev:null,next:null},x={value:null,prev:g,next:null};g.next=x,this.head=g,this.tail=x,this.length=0}function v(g,x,C){var b=x.next,S={value:C,prev:x,next:b};return x.next=S,b.prev=S,g.length++,S}function m(g,x,C){for(var b=x.next,S=0;S<C&&b!==g.tail;S++)b=b.next;x.next=b,b.prev=x,g.length-=S}function w(g){for(var x=[],C=g.head.next;C!==g.tail;)x.push(C.value),C=C.next;return x}if(!a.document)return a.addEventListener&&(c.disableWorkerMessageHandler||a.addEventListener("message",function(g){var x=JSON.parse(g.data),C=x.language,b=x.code,S=x.immediateClose;a.postMessage(c.highlight(b,c.languages[C],C)),S&&a.close()},!1)),c;var k=c.util.currentScript();k&&(c.filename=k.src,k.hasAttribute("data-manual")&&(c.manual=!0));function T(){c.manual||c.highlightAll()}if(!c.manual){var A=document.readyState;A==="loading"||A==="interactive"&&k&&k.defer?document.addEventListener("DOMContentLoaded",T):window.requestAnimationFrame?window.requestAnimationFrame(T):window.setTimeout(T,16)}return c})(t);e.exports&&(e.exports=r),typeof Zp<"u"&&(Zp.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 i={};i["language-"+l]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:r.languages[l]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var c={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};c["language-"+l]={pattern:/[\s\S]+/,inside:r.languages[l]};var d={};d[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",d)}}),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(k,T){return"✖ Error "+k+" while fetching file: "+T},l="✖ Error: File does not exist or is empty",i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},c="data-src-status",d="loading",u="loaded",h="failed",f="pre[data-src]:not(["+c+'="'+u+'"]):not(['+c+'="'+d+'"])';function v(k,T,A){var g=new XMLHttpRequest;g.open("GET",k,!0),g.onreadystatechange=function(){g.readyState==4&&(g.status<400&&g.responseText?T(g.responseText):g.status>=400?A(o(g.status,g.statusText)):A(l))},g.send(null)}function m(k){var T=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(k||"");if(T){var A=Number(T[1]),g=T[2],x=T[3];return g?x?[A,Number(x)]:[A,void 0]:[A,A]}}r.hooks.add("before-highlightall",function(k){k.selector+=", "+f}),r.hooks.add("before-sanity-check",function(k){var T=k.element;if(T.matches(f)){k.code="",T.setAttribute(c,d);var A=T.appendChild(document.createElement("CODE"));A.textContent=a;var g=T.getAttribute("data-src"),x=k.language;if(x==="none"){var C=(/\.(\w+)$/.exec(g)||[,"none"])[1];x=i[C]||C}r.util.setLanguage(A,x),r.util.setLanguage(T,x);var b=r.plugins.autoloader;b&&b.loadLanguages(x),v(g,function(S){T.setAttribute(c,u);var _=m(T.getAttribute("data-range"));if(_){var M=S.split(/\r\n?|\n/g),I=_[0],F=_[1]==null?M.length:_[1];I<0&&(I+=M.length),I=Math.max(0,Math.min(I-1,M.length)),F<0&&(F+=M.length),F=Math.max(0,Math.min(F,M.length)),S=M.slice(I,F).join(`
246
- `),T.hasAttribute("data-start")||T.setAttribute("data-start",String(I+1))}A.textContent=S,r.highlightElement(A)},function(S){T.setAttribute(c,h),A.textContent=S})}}),r.plugins.fileHighlight={highlight:function(T){for(var A=(T||document).querySelectorAll(f),g=0,x;x=A[g++];)r.highlightElement(x)}};var w=!1;r.fileHighlight=function(){w||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),w=!0),r.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(ru)),ru.exports}var U3=z3();const Do=F3(U3);var ev={},tv;function j3(){return tv||(tv=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)),ev}j3();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(d,u){return d=d.replace(/<S>/g,function(){return r}).replace(/<BRACES>/g,function(){return a}).replace(/<SPREAD>/g,function(){return o}),RegExp(d,u)}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 i=function(d){return d?typeof d=="string"?d:typeof d.content=="string"?d.content:d.content.map(i).join(""):""},c=function(d){for(var u=[],h=0;h<d.length;h++){var f=d[h],v=!1;if(typeof f!="string"&&(f.type==="tag"&&f.content[0]&&f.content[0].type==="tag"?f.content[0].content[0].content==="</"?u.length>0&&u[u.length-1].tagName===i(f.content[0].content[1])&&u.pop():f.content[f.content.length-1].content==="/>"||u.push({tagName:i(f.content[0].content[1]),openedBraces:0}):u.length>0&&f.type==="punctuation"&&f.content==="{"?u[u.length-1].openedBraces++:u.length>0&&u[u.length-1].openedBraces>0&&f.type==="punctuation"&&f.content==="}"?u[u.length-1].openedBraces--:v=!0),(v||typeof f=="string")&&u.length>0&&u[u.length-1].openedBraces===0){var m=i(f);h<d.length-1&&(typeof d[h+1]=="string"||d[h+1].type==="plain-text")&&(m+=i(d[h+1]),d.splice(h+1,1)),h>0&&(typeof d[h-1]=="string"||d[h-1].type==="plain-text")&&(m=i(d[h-1])+m,d.splice(h-1,1),h--),d[h]=new e.Token("plain-text",m,null,m)}f.content&&typeof f.content!="string"&&c(f.content)}};e.hooks.add("after-tokenize",function(d){d.language!=="jsx"&&d.language!=="tsx"||c(d.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,i=0;i<o.length;i++)l[o[i]]=e.languages.bash[o[i]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism);var nv={},rv;function H3(){return rv||(rv=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),nv}H3();var av={},ov;function B3(){return ov||(ov=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)),av}B3();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 i(c,d){d=(d||"").replace(/m/g,"")+"m";var u=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return a}).replace(/<<value>>/g,function(){return c});return RegExp(u,d)}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:i(/\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:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(l),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?: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(v){if(!(!v||typeof v=="string"))for(var m=0,w=v.length;m<w;m++){var k=v[m];if(k.type!=="code"){f(k.content);continue}var T=k.content[1],A=k.content[3];if(T&&A&&T.type==="code-language"&&A.type==="code-block"&&typeof T.content=="string"){var g=T.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");g=(/[a-z][\w-]*/i.exec(g)||[""])[0].toLowerCase();var x="language-"+g;A.alias?typeof A.alias=="string"?A.alias=[A.alias,x]:A.alias.push(x):A.alias=[x]}}}f(h.tokens)}),e.hooks.add("wrap",function(h){if(h.type==="code-block"){for(var f="",v=0,m=h.classes.length;v<m;v++){var w=h.classes[v],k=/language-(.+)/.exec(w);if(k){f=k[1];break}}var T=e.languages[f];if(T)h.content=e.highlight(u(h.content),T,f);else if(f&&f!=="none"&&e.plugins.autoloader){var A="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);h.attributes.id=A,e.plugins.autoloader.loadLanguages(f,function(){var g=document.getElementById(A);g&&(g.innerHTML=e.highlight(g.textContent,e.languages[f],f))})}}});var i=RegExp(e.languages.markup.tag.pattern.source,"gi"),c={amp:"&",lt:"<",gt:">",quot:'"'},d=String.fromCodePoint||String.fromCharCode;function u(h){var f=h.replace(i,"");return f=f.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(v,m){if(m=m.toLowerCase(),m[0]==="#"){var w;return m[1]==="x"?w=parseInt(m.slice(2),16):w=Number(m.slice(1)),d(w)}else{var k=c[m];return k||v}}),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
247
- ?|
248
- |(?![\\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 W3={js:"javascript",ts:"typescript",py:"python",rb:"ruby",sh:"bash",shell:"bash",zsh:"bash",yml:"yaml",dockerfile:"docker","":"plaintext"};function xb(e){const t=e.toLowerCase().trim();return W3[t]||t}function bo(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function K3(e,t){const r=xb(t);if(Do.languages[r])try{return Do.highlight(e,Do.languages[r],r)}catch{}return bo(e)}function q3(){const e=new bb({gfm:!0,breaks:!0});return e.use({renderer:{code(t){const r=t.lang||"",a=t.text,o=K3(a,r);return`<pre class="code-block${r?` language-${xb(r)}`:""}"><code>${o}</code></pre>`},link(t){const r=t.href,a=t.title?` title="${bo(t.title)}"`:"",o=t.text;return r.startsWith("http://")||r.startsWith("https://")?`<a href="${bo(r)}"${a} target="_blank" rel="noopener noreferrer">${o}</a>`:`<a href="${bo(r)}"${a}>${o}</a>`},html(t){return bo(t.text)}}}),e}const G3=q3();function V3(e){return G3.parse(e)}const{entries:yb,setPrototypeOf:lv,isFrozen:Y3,getPrototypeOf:J3,getOwnPropertyDescriptor:X3}=Object;let{freeze:tt,seal:It,create:ud}=Object,{apply:dd,construct:hd}=typeof Reflect<"u"&&Reflect;tt||(tt=function(t){return t});It||(It=function(t){return t});dd||(dd=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)});hd||(hd=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 ms=nt(Array.prototype.forEach),Z3=nt(Array.prototype.lastIndexOf),sv=nt(Array.prototype.pop),oo=nt(Array.prototype.push),Q3=nt(Array.prototype.splice),Ws=nt(String.prototype.toLowerCase),au=nt(String.prototype.toString),ou=nt(String.prototype.match),lo=nt(String.prototype.replace),e_=nt(String.prototype.indexOf),t_=nt(String.prototype.trim),Dt=nt(Object.prototype.hasOwnProperty),Ve=nt(RegExp.prototype.test),so=n_(TypeError);function nt(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 dd(e,t,a)}}function n_(e){return function(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return hd(e,r)}}function Q(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ws;lv&&lv(e,null);let a=t.length;for(;a--;){let o=t[a];if(typeof o=="string"){const l=r(o);l!==o&&(Y3(t)||(t[a]=l),o=l)}e[o]=!0}return e}function r_(e){for(let t=0;t<e.length;t++)Dt(e,t)||(e[t]=null);return e}function Xt(e){const t=ud(null);for(const[r,a]of yb(e))Dt(e,r)&&(Array.isArray(a)?t[r]=r_(a):a&&typeof a=="object"&&a.constructor===Object?t[r]=Xt(a):t[r]=a);return t}function io(e,t){for(;e!==null;){const a=X3(e,t);if(a){if(a.get)return nt(a.get);if(typeof a.value=="function")return nt(a.value)}e=J3(e)}function r(){return null}return r}const iv=tt(["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"]),lu=tt(["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"]),su=tt(["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"]),a_=tt(["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"]),iu=tt(["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"]),o_=tt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),cv=tt(["#text"]),uv=tt(["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"]),cu=tt(["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"]),dv=tt(["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"]),gs=tt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),l_=It(/\{\{[\w\W]*|[\w\W]*\}\}/gm),s_=It(/<%[\w\W]*|[\w\W]*%>/gm),i_=It(/\$\{[\w\W]*/gm),c_=It(/^data-[\-\w.\u00B7-\uFFFF]+$/),u_=It(/^aria-[\-\w]+$/),wb=It(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),d_=It(/^(?:\w+script|data):/i),h_=It(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),kb=It(/^html$/i),f_=It(/^[a-z][.\w]*(-[.\w]+)+$/i);var hv=Object.freeze({__proto__:null,ARIA_ATTR:u_,ATTR_WHITESPACE:h_,CUSTOM_ELEMENT:f_,DATA_ATTR:c_,DOCTYPE_NAME:kb,ERB_EXPR:s_,IS_ALLOWED_URI:wb,IS_SCRIPT_OR_DATA:d_,MUSTACHE_EXPR:l_,TMPLIT_EXPR:i_});const co={element:1,text:3,progressingInstruction:7,comment:8,document:9},p_=function(){return typeof window>"u"?null:window},v_=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(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},fv=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function _b(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p_();const t=j=>_b(j);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==co.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const a=r,o=a.currentScript,{DocumentFragment:l,HTMLTemplateElement:i,Node:c,Element:d,NodeFilter:u,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:v,trustedTypes:m}=e,w=d.prototype,k=io(w,"cloneNode"),T=io(w,"remove"),A=io(w,"nextSibling"),g=io(w,"childNodes"),x=io(w,"parentNode");if(typeof i=="function"){const j=r.createElement("template");j.content&&j.content.ownerDocument&&(r=j.content.ownerDocument)}let C,b="";const{implementation:S,createNodeIterator:_,createDocumentFragment:M,getElementsByTagName:I}=r,{importNode:F}=a;let D=fv();t.isSupported=typeof yb=="function"&&typeof x=="function"&&S&&S.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Y,ERB_EXPR:Ue,TMPLIT_EXPR:fe,DATA_ATTR:nr,ARIA_ATTR:En,IS_SCRIPT_OR_DATA:In,ATTR_WHITESPACE:ge,CUSTOM_ELEMENT:H}=hv;let{IS_ALLOWED_URI:ie}=hv,pe=null;const at=Q({},[...iv,...lu,...su,...iu,...cv]);let Se=null;const Rt=Q({},[...uv,...cu,...dv,...gs]);let ce=Object.seal(ud(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}})),qt=null,Mn=null;const Gt=Object.seal(ud(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Za=!0,rr=!0,ar=!1,Xl=!0,Vt=!1,Zl=!0,or=!1,Nc=!1,Oc=!1,Pr=!1,Ql=!1,es=!1,gf=!0,bf=!1;const Px="user-content-";let Pc=!0,Qa=!1,Fr={},Yt=null;const Fc=Q({},["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 xf=null;const yf=Q({},["audio","video","img","source","image","track"]);let zc=null;const wf=Q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ts="http://www.w3.org/1998/Math/MathML",ns="http://www.w3.org/2000/svg",pn="http://www.w3.org/1999/xhtml";let zr=pn,Uc=!1,jc=null;const Fx=Q({},[ts,ns,pn],au);let rs=Q({},["mi","mo","mn","ms","mtext"]),as=Q({},["annotation-xml"]);const zx=Q({},["title","style","font","a","script"]);let eo=null;const Ux=["application/xhtml+xml","text/html"],jx="text/html";let Ce=null,Ur=null;const Hx=r.createElement("form"),kf=function(y){return y instanceof RegExp||y instanceof Function},Hc=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ur&&Ur===y)){if((!y||typeof y!="object")&&(y={}),y=Xt(y),eo=Ux.indexOf(y.PARSER_MEDIA_TYPE)===-1?jx:y.PARSER_MEDIA_TYPE,Ce=eo==="application/xhtml+xml"?au:Ws,pe=Dt(y,"ALLOWED_TAGS")?Q({},y.ALLOWED_TAGS,Ce):at,Se=Dt(y,"ALLOWED_ATTR")?Q({},y.ALLOWED_ATTR,Ce):Rt,jc=Dt(y,"ALLOWED_NAMESPACES")?Q({},y.ALLOWED_NAMESPACES,au):Fx,zc=Dt(y,"ADD_URI_SAFE_ATTR")?Q(Xt(wf),y.ADD_URI_SAFE_ATTR,Ce):wf,xf=Dt(y,"ADD_DATA_URI_TAGS")?Q(Xt(yf),y.ADD_DATA_URI_TAGS,Ce):yf,Yt=Dt(y,"FORBID_CONTENTS")?Q({},y.FORBID_CONTENTS,Ce):Fc,qt=Dt(y,"FORBID_TAGS")?Q({},y.FORBID_TAGS,Ce):Xt({}),Mn=Dt(y,"FORBID_ATTR")?Q({},y.FORBID_ATTR,Ce):Xt({}),Fr=Dt(y,"USE_PROFILES")?y.USE_PROFILES:!1,Za=y.ALLOW_ARIA_ATTR!==!1,rr=y.ALLOW_DATA_ATTR!==!1,ar=y.ALLOW_UNKNOWN_PROTOCOLS||!1,Xl=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Vt=y.SAFE_FOR_TEMPLATES||!1,Zl=y.SAFE_FOR_XML!==!1,or=y.WHOLE_DOCUMENT||!1,Pr=y.RETURN_DOM||!1,Ql=y.RETURN_DOM_FRAGMENT||!1,es=y.RETURN_TRUSTED_TYPE||!1,Oc=y.FORCE_BODY||!1,gf=y.SANITIZE_DOM!==!1,bf=y.SANITIZE_NAMED_PROPS||!1,Pc=y.KEEP_CONTENT!==!1,Qa=y.IN_PLACE||!1,ie=y.ALLOWED_URI_REGEXP||wb,zr=y.NAMESPACE||pn,rs=y.MATHML_TEXT_INTEGRATION_POINTS||rs,as=y.HTML_INTEGRATION_POINTS||as,ce=y.CUSTOM_ELEMENT_HANDLING||{},y.CUSTOM_ELEMENT_HANDLING&&kf(y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ce.tagNameCheck=y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),y.CUSTOM_ELEMENT_HANDLING&&kf(y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ce.attributeNameCheck=y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),y.CUSTOM_ELEMENT_HANDLING&&typeof y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ce.allowCustomizedBuiltInElements=y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Vt&&(rr=!1),Ql&&(Pr=!0),Fr&&(pe=Q({},cv),Se=[],Fr.html===!0&&(Q(pe,iv),Q(Se,uv)),Fr.svg===!0&&(Q(pe,lu),Q(Se,cu),Q(Se,gs)),Fr.svgFilters===!0&&(Q(pe,su),Q(Se,cu),Q(Se,gs)),Fr.mathMl===!0&&(Q(pe,iu),Q(Se,dv),Q(Se,gs))),y.ADD_TAGS&&(typeof y.ADD_TAGS=="function"?Gt.tagCheck=y.ADD_TAGS:(pe===at&&(pe=Xt(pe)),Q(pe,y.ADD_TAGS,Ce))),y.ADD_ATTR&&(typeof y.ADD_ATTR=="function"?Gt.attributeCheck=y.ADD_ATTR:(Se===Rt&&(Se=Xt(Se)),Q(Se,y.ADD_ATTR,Ce))),y.ADD_URI_SAFE_ATTR&&Q(zc,y.ADD_URI_SAFE_ATTR,Ce),y.FORBID_CONTENTS&&(Yt===Fc&&(Yt=Xt(Yt)),Q(Yt,y.FORBID_CONTENTS,Ce)),y.ADD_FORBID_CONTENTS&&(Yt===Fc&&(Yt=Xt(Yt)),Q(Yt,y.ADD_FORBID_CONTENTS,Ce)),Pc&&(pe["#text"]=!0),or&&Q(pe,["html","head","body"]),pe.table&&(Q(pe,["tbody"]),delete qt.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw so('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw so('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=y.TRUSTED_TYPES_POLICY,b=C.createHTML("")}else C===void 0&&(C=v_(m,o)),C!==null&&typeof b=="string"&&(b=C.createHTML(""));tt&&tt(y),Ur=y}},_f=Q({},[...lu,...su,...a_]),Sf=Q({},[...iu,...o_]),Bx=function(y){let $=x(y);(!$||!$.tagName)&&($={namespaceURI:zr,tagName:"template"});const z=Ws(y.tagName),de=Ws($.tagName);return jc[y.namespaceURI]?y.namespaceURI===ns?$.namespaceURI===pn?z==="svg":$.namespaceURI===ts?z==="svg"&&(de==="annotation-xml"||rs[de]):!!_f[z]:y.namespaceURI===ts?$.namespaceURI===pn?z==="math":$.namespaceURI===ns?z==="math"&&as[de]:!!Sf[z]:y.namespaceURI===pn?$.namespaceURI===ns&&!as[de]||$.namespaceURI===ts&&!rs[de]?!1:!Sf[z]&&(zx[z]||!_f[z]):!!(eo==="application/xhtml+xml"&&jc[y.namespaceURI]):!1},Jt=function(y){oo(t.removed,{element:y});try{x(y).removeChild(y)}catch{T(y)}},lr=function(y,$){try{oo(t.removed,{attribute:$.getAttributeNode(y),from:$})}catch{oo(t.removed,{attribute:null,from:$})}if($.removeAttribute(y),y==="is")if(Pr||Ql)try{Jt($)}catch{}else try{$.setAttribute(y,"")}catch{}},Cf=function(y){let $=null,z=null;if(Oc)y="<remove></remove>"+y;else{const we=ou(y,/^[\r\n\t ]+/);z=we&&we[0]}eo==="application/xhtml+xml"&&zr===pn&&(y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+y+"</body></html>");const de=C?C.createHTML(y):y;if(zr===pn)try{$=new v().parseFromString(de,eo)}catch{}if(!$||!$.documentElement){$=S.createDocument(zr,"template",null);try{$.documentElement.innerHTML=Uc?b:de}catch{}}const je=$.body||$.documentElement;return y&&z&&je.insertBefore(r.createTextNode(z),je.childNodes[0]||null),zr===pn?I.call($,or?"html":"body")[0]:or?$.documentElement:je},Af=function(y){return _.call(y.ownerDocument||y,y,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Bc=function(y){return y instanceof f&&(typeof y.nodeName!="string"||typeof y.textContent!="string"||typeof y.removeChild!="function"||!(y.attributes instanceof h)||typeof y.removeAttribute!="function"||typeof y.setAttribute!="function"||typeof y.namespaceURI!="string"||typeof y.insertBefore!="function"||typeof y.hasChildNodes!="function")},Tf=function(y){return typeof c=="function"&&y instanceof c};function vn(j,y,$){ms(j,z=>{z.call(t,y,$,Ur)})}const Ef=function(y){let $=null;if(vn(D.beforeSanitizeElements,y,null),Bc(y))return Jt(y),!0;const z=Ce(y.nodeName);if(vn(D.uponSanitizeElement,y,{tagName:z,allowedTags:pe}),Zl&&y.hasChildNodes()&&!Tf(y.firstElementChild)&&Ve(/<[/\w!]/g,y.innerHTML)&&Ve(/<[/\w!]/g,y.textContent)||y.nodeType===co.progressingInstruction||Zl&&y.nodeType===co.comment&&Ve(/<[/\w]/g,y.data))return Jt(y),!0;if(!(Gt.tagCheck instanceof Function&&Gt.tagCheck(z))&&(!pe[z]||qt[z])){if(!qt[z]&&Mf(z)&&(ce.tagNameCheck instanceof RegExp&&Ve(ce.tagNameCheck,z)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(z)))return!1;if(Pc&&!Yt[z]){const de=x(y)||y.parentNode,je=g(y)||y.childNodes;if(je&&de){const we=je.length;for(let ot=we-1;ot>=0;--ot){const mn=k(je[ot],!0);mn.__removalCount=(y.__removalCount||0)+1,de.insertBefore(mn,A(y))}}}return Jt(y),!0}return y instanceof d&&!Bx(y)||(z==="noscript"||z==="noembed"||z==="noframes")&&Ve(/<\/no(script|embed|frames)/i,y.innerHTML)?(Jt(y),!0):(Vt&&y.nodeType===co.text&&($=y.textContent,ms([Y,Ue,fe],de=>{$=lo($,de," ")}),y.textContent!==$&&(oo(t.removed,{element:y.cloneNode()}),y.textContent=$)),vn(D.afterSanitizeElements,y,null),!1)},If=function(y,$,z){if(gf&&($==="id"||$==="name")&&(z in r||z in Hx))return!1;if(!(rr&&!Mn[$]&&Ve(nr,$))){if(!(Za&&Ve(En,$))){if(!(Gt.attributeCheck instanceof Function&&Gt.attributeCheck($,y))){if(!Se[$]||Mn[$]){if(!(Mf(y)&&(ce.tagNameCheck instanceof RegExp&&Ve(ce.tagNameCheck,y)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(y))&&(ce.attributeNameCheck instanceof RegExp&&Ve(ce.attributeNameCheck,$)||ce.attributeNameCheck instanceof Function&&ce.attributeNameCheck($,y))||$==="is"&&ce.allowCustomizedBuiltInElements&&(ce.tagNameCheck instanceof RegExp&&Ve(ce.tagNameCheck,z)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(z))))return!1}else if(!zc[$]){if(!Ve(ie,lo(z,ge,""))){if(!(($==="src"||$==="xlink:href"||$==="href")&&y!=="script"&&e_(z,"data:")===0&&xf[y])){if(!(ar&&!Ve(In,lo(z,ge,"")))){if(z)return!1}}}}}}}return!0},Mf=function(y){return y!=="annotation-xml"&&ou(y,H)},Rf=function(y){vn(D.beforeSanitizeAttributes,y,null);const{attributes:$}=y;if(!$||Bc(y))return;const z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Se,forceKeepAttr:void 0};let de=$.length;for(;de--;){const je=$[de],{name:we,namespaceURI:ot,value:mn}=je,jr=Ce(we),Wc=mn;let Le=we==="value"?Wc:t_(Wc);if(z.attrName=jr,z.attrValue=Le,z.keepAttr=!0,z.forceKeepAttr=void 0,vn(D.uponSanitizeAttribute,y,z),Le=z.attrValue,bf&&(jr==="id"||jr==="name")&&(lr(we,y),Le=Px+Le),Zl&&Ve(/((--!?|])>)|<\/(style|title|textarea)/i,Le)){lr(we,y);continue}if(jr==="attributename"&&ou(Le,"href")){lr(we,y);continue}if(z.forceKeepAttr)continue;if(!z.keepAttr){lr(we,y);continue}if(!Xl&&Ve(/\/>/i,Le)){lr(we,y);continue}Vt&&ms([Y,Ue,fe],$f=>{Le=lo(Le,$f," ")});const Df=Ce(y.nodeName);if(!If(Df,jr,Le)){lr(we,y);continue}if(C&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!ot)switch(m.getAttributeType(Df,jr)){case"TrustedHTML":{Le=C.createHTML(Le);break}case"TrustedScriptURL":{Le=C.createScriptURL(Le);break}}if(Le!==Wc)try{ot?y.setAttributeNS(ot,we,Le):y.setAttribute(we,Le),Bc(y)?Jt(y):sv(t.removed)}catch{lr(we,y)}}vn(D.afterSanitizeAttributes,y,null)},Wx=function j(y){let $=null;const z=Af(y);for(vn(D.beforeSanitizeShadowDOM,y,null);$=z.nextNode();)vn(D.uponSanitizeShadowNode,$,null),Ef($),Rf($),$.content instanceof l&&j($.content);vn(D.afterSanitizeShadowDOM,y,null)};return t.sanitize=function(j){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=null,z=null,de=null,je=null;if(Uc=!j,Uc&&(j="<!-->"),typeof j!="string"&&!Tf(j))if(typeof j.toString=="function"){if(j=j.toString(),typeof j!="string")throw so("dirty is not a string, aborting")}else throw so("toString is not a function");if(!t.isSupported)return j;if(Nc||Hc(y),t.removed=[],typeof j=="string"&&(Qa=!1),Qa){if(j.nodeName){const mn=Ce(j.nodeName);if(!pe[mn]||qt[mn])throw so("root node is forbidden and cannot be sanitized in-place")}}else if(j instanceof c)$=Cf("<!---->"),z=$.ownerDocument.importNode(j,!0),z.nodeType===co.element&&z.nodeName==="BODY"||z.nodeName==="HTML"?$=z:$.appendChild(z);else{if(!Pr&&!Vt&&!or&&j.indexOf("<")===-1)return C&&es?C.createHTML(j):j;if($=Cf(j),!$)return Pr?null:es?b:""}$&&Oc&&Jt($.firstChild);const we=Af(Qa?j:$);for(;de=we.nextNode();)Ef(de),Rf(de),de.content instanceof l&&Wx(de.content);if(Qa)return j;if(Pr){if(Ql)for(je=M.call($.ownerDocument);$.firstChild;)je.appendChild($.firstChild);else je=$;return(Se.shadowroot||Se.shadowrootmode)&&(je=F.call(a,je,!0)),je}let ot=or?$.outerHTML:$.innerHTML;return or&&pe["!doctype"]&&$.ownerDocument&&$.ownerDocument.doctype&&$.ownerDocument.doctype.name&&Ve(kb,$.ownerDocument.doctype.name)&&(ot="<!DOCTYPE "+$.ownerDocument.doctype.name+`>
249
- `+ot),Vt&&ms([Y,Ue,fe],mn=>{ot=lo(ot,mn," ")}),C&&es?C.createHTML(ot):ot},t.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Hc(j),Nc=!0},t.clearConfig=function(){Ur=null,Nc=!1},t.isValidAttribute=function(j,y,$){Ur||Hc({});const z=Ce(j),de=Ce(y);return If(z,de,$)},t.addHook=function(j,y){typeof y=="function"&&oo(D[j],y)},t.removeHook=function(j,y){if(y!==void 0){const $=Z3(D[j],y);return $===-1?void 0:Q3(D[j],$,1)[0]}return sv(D[j])},t.removeHooks=function(j){D[j]=[]},t.removeAllHooks=function(){D=fv()},t}var Sb=_b();const m_={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,ADD_DATA_URI_TAGS:["img"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|data):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i};function g_(e){return Sb.sanitize(e,{...m_,RETURN_TRUSTED_TYPE:!1})}function pv(e){return Sb.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 $i({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 b_="bg-[var(--color-warning-muted)] rounded px-0.5";function x_(e,t){if(!t)return;const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:i=>{const c=i.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 i of a){const c=i.textContent||"",d=c.toLowerCase(),u=[];let h=0,f;for(;(f=d.indexOf(l,h))!==-1;)u.push({start:f,end:f+t.length}),h=f+1;if(u.length===0)continue;const v=document.createDocumentFragment();let m=0;for(const w of u){w.start>m&&v.appendChild(document.createTextNode(c.slice(m,w.start)));const k=document.createElement("mark");k.className=b_,k.textContent=c.slice(w.start,w.end),v.appendChild(k),m=w.end}m<c.length&&v.appendChild(document.createTextNode(c.slice(m))),i.replaceWith(v)}}function Wl({content:e,isStreaming:t=!1}){const r=B(null),a=pt(()=>{if(!e)return"";const l=V3(e);return g_(l)},[e]),o=dc.value.trim();return O(()=>{if(!r.current)return;const l=r.current.querySelectorAll("pre.code-block");for(const i of l){if(i.querySelector(".copy-button"))return;const c=document.createElement("button");c.className="copy-button",c.textContent=s("actions.copy"),c.setAttribute("type","button"),c.onclick=async()=>{const d=i.querySelector("code")?.textContent||"";try{await navigator.clipboard.writeText(d),c.textContent=s("actions.copied"),setTimeout(()=>{c.textContent=s("actions.copy")},2e3)}catch{const u=document.createElement("textarea");u.value=d,document.body.appendChild(u),u.select(),document.execCommand("copy"),document.body.removeChild(u),c.textContent=s("actions.copied"),setTimeout(()=>{c.textContent=s("actions.copy")},2e3)}},i.classList.add("relative"),i.insertBefore(c,i.firstChild)}},[a]),O(()=>{!r.current||!o||(r.current.innerHTML=a,x_(r.current,o))},[a,o]),!e&&t?n("span",{class:"inline-flex items-center gap-2 text-[var(--color-text-muted)]",children:[s("chat.thinking"),n($i,{})]}):n("div",{ref:r,class:"message-content prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:a}})}const bs=`
250
- p-2 rounded-full cursor-pointer
251
- bg-white/10 text-white hover:bg-white/20
252
- transition-colors
253
- `;async function y_(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 w_(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 Cb({images:e}){const[t,r]=U(null),a=B(null);if(O(()=>{t!==null&&a.current?.focus()},[t]),e.length===0)return null;const o=(l,i,c)=>{l.stopPropagation(),y_(i,w_(i,c))};return n(G,{children:[n("div",{class:"flex flex-wrap gap-2 mt-2",children:e.map((l,i)=>n("div",{class:"relative group",children:[n("button",{type:"button",onClick:()=>r(i),class:`
254
- relative rounded-lg overflow-hidden cursor-pointer
255
- border border-[var(--color-border)]
256
- hover:border-[var(--color-accent)] hover:shadow-md
257
- transition-all
258
- `,children:n("img",{src:l.url,alt:l.alt||`Image ${i+1}`,class:"max-w-[200px] max-h-[200px] object-cover",loading:"lazy"})}),n("button",{type:"button",onClick:c=>o(c,l.url,i),"aria-label":s("actions.download"),class:`
259
- absolute bottom-2 right-2 p-1.5 rounded-lg cursor-pointer
260
- bg-black/60 text-white
261
- opacity-0 group-hover:opacity-100
262
- hover:bg-black/80
263
- transition-all
264
- `,children:n(jt,{class:"w-4 h-4"})})]},i))}),t!==null&&n("div",{ref:a,role:"dialog","aria-modal":"true","aria-label":s("chat.imageViewer"),class:"fixed inset-0 z-[9999] bg-black/80 flex items-center justify-center p-4 outline-none",onClick:()=>r(null),onKeyDown:l=>{l.key==="Escape"&&r(null),l.key==="ArrowLeft"&&r((t-1+e.length)%e.length),l.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:l=>o(l,e[t].url,t),"aria-label":s("actions.download"),class:bs,children:n(jt,{class:"w-6 h-6"})}),n("button",{type:"button",onClick:()=>r(null),"aria-label":s("actions.close"),class:bs,children:n(Wa,{class:"w-6 h-6"})})]}),e.length>1&&n(G,{children:[n("button",{type:"button",onClick:l=>{l.stopPropagation(),r((t-1+e.length)%e.length)},"aria-label":s("actions.back"),class:`${bs} absolute left-4 p-3 text-2xl`,children:"‹"}),n("button",{type:"button",onClick:l=>{l.stopPropagation(),r((t+1)%e.length)},"aria-label":s("actions.next"),class:`${bs} 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:l=>l.stopPropagation(),onKeyDown:l=>l.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 k_=2e3;function vv({icon:e,label:t,onClick:r}){return n("button",{role:"menuitem",onClick:r,class:`
265
- w-full px-3 py-2 text-left text-sm
266
- flex items-center gap-2
267
- text-[var(--color-text-primary)]
268
- hover:bg-[var(--color-bg-hover)]
269
- transition-colors cursor-pointer
270
- `,children:[e,t]})}function Ab({content:e,visible:t=!1}){const[r,a]=U(!1),[o,l]=U(null),i=B(null),c=B(null);O(()=>{if(!r)return;const f=v=>{const m=v.target;i.current&&!i.current.contains(m)&&c.current&&!c.current.contains(m)&&a(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),O(()=>{if(!o)return;const f=setTimeout(()=>l(null),k_);return()=>clearTimeout(f)},[o]);const d=ee(async f=>{const v=f==="formatted"?tw(e):e;await navigator.clipboard.writeText(v),l(f),a(!1)},[e]),u=(f,v)=>o===f?n(Wt,{class:"w-4 h-4 text-[var(--color-success)]"}):n(v,{class:"w-4 h-4 text-[var(--color-text-muted)]"}),h=(f,v)=>o===f?s("actions.copied"):v;return n("div",{class:"relative",children:[n("button",{ref:c,onClick:()=>a(!r),"aria-label":s("actions.more"),"aria-expanded":r,"aria-haspopup":"menu",class:`
271
- p-1 rounded
272
- text-[var(--color-text-muted)]
273
- hover:text-[var(--color-text-secondary)]
274
- hover:bg-[var(--color-bg-hover)]
275
- transition-all cursor-pointer
276
- ${r||t?"opacity-100":"opacity-0"}
277
- ${r?"bg-[var(--color-bg-hover)]":""}
278
- `,children:n(Tg,{class:"w-4 h-4"})}),r&&n("div",{ref:i,role:"menu",class:`
279
- absolute right-0 top-full mt-1 z-50
280
- min-w-[160px] py-1
281
- bg-[var(--color-bg-surface)]
282
- border border-[var(--color-border)]
283
- rounded-lg shadow-lg
284
- `,children:[n(vv,{icon:u("formatted",bc),label:h("formatted",s("actions.copy")),onClick:()=>d("formatted")}),n(vv,{icon:u("raw",Ht),label:h("raw",s("chat.copyMarkdown")),onClick:()=>d("raw")})]})]})}function __({message:e,userName:t="You",userAvatar:r}){const a=re(!1),o=e.status==="queued",l=e.status==="sending",i=e.status==="failed",c=o||l,d=()=>{e.id&&Vw(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:[hh(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"}),s("connection.messageQueued")]}):l?n("span",{class:"flex items-center gap-1",children:[n($i,{size:"sm",colorClass:"bg-current"}),s("connection.messageSending")]}):i?n("span",{class:"flex items-center gap-1 text-[var(--color-error)]",children:[n(gc,{class:"w-3 h-3","aria-hidden":"true"}),s("connection.messageFailedStatus")]}):le(e.timestamp)}),n("div",{class:"flex-1"}),!c&&e.content&&n(Ab,{content:e.content,visible:a.value})]}),n("div",{class:`
285
- rounded-xl px-4 py-3
286
- ${i?"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"}
287
- `,children:[e.images&&e.images.length>0&&n(Cb,{images:e.images}),e.content&&n("div",{class:`text-[var(--color-text-primary)] ${e.images?.length?"mt-2":""}`,children:n(Wl,{content:e.content})}),i&&n("div",{class:"mt-2 pt-2 border-t border-[var(--color-error)]/20",children:n("button",{onClick:d,class:`px-3 py-1.5 rounded-lg text-xs font-medium
288
- bg-[var(--color-error)]/10 text-[var(--color-error)]
289
- hover:bg-[var(--color-error)]/20
290
- active:scale-95 transition-all duration-150
291
- flex items-center gap-1.5`,children:[n(Fe,{class:"w-3 h-3","aria-hidden":"true"}),s("actions.retry")]})})]})]})}const Ks=p(null);let S_=0;function C_(){return`json-block-${++S_}`}async function A_(e,t){try{await navigator.clipboard.writeText(e),Ks.value=t,setTimeout(()=>{Ks.value===t&&(Ks.value=null)},2e3)}catch{}}function T_(e){try{const t=Do.highlight(e,Do.languages.json,"json");return pv(t)}catch{return pv(e)}}function Kl({value:e,maxHeight:t="max-h-48",id:r}){const a=r??C_(),o=Ks.value===a,l=T_(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(K,{icon:o?n(Wt,{size:14}):n(bc,{size:14}),size:"sm",variant:"ghost",label:s("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:()=>A_(e,a)})]})}function E_(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 I_({toolCall:e}){const t=E_(e.result),[r,a]=U(t);O(()=>{t&&a(!0)},[t]);const o=e.completedAt&&e.startedAt?e.completedAt-e.startedAt:null,l=R_(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:D_(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:N_(o)}),n(Va,{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(mv,{label:"Input",children:n(gv,{content:e.args})}),t&&n(M_,{approvalId:e.result.details.approvalId,expiresAtMs:e.result.details.expiresAtMs}),e.result!==void 0&&!t&&n(mv,{label:"Output",children:n(gv,{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 M_({approvalId:e,expiresAtMs:t}){const r=Ei.value,a=Ii.value,o=dl.value.get(e),[l,i]=U(Math.max(0,t-Date.now())),[c,d]=U(null),u=o??c;O(()=>{const v=()=>{const w=Math.max(0,t-Date.now());i(w)};v();const m=setInterval(v,1e3);return()=>clearInterval(m)},[t]);const h=async v=>{try{await e3(e,v),d(v)}catch{}};if(u){const v=u==="deny";return n("div",{class:`text-xs italic ${v?"text-[var(--color-error)]":"text-[var(--color-success)]"}`,role:"status","aria-live":"polite",children:s(v?"exec.denied":"exec.approved")})}return l<=0?n("div",{class:"text-xs text-[var(--color-text-muted)] italic",children:s("exec.expired")}):n("div",{class:"space-y-2",role:"region","aria-label":s("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:s("exec.approvalNeeded")}),n("span",{class:"text-[10px] text-[var(--color-text-muted)]","aria-label":s("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(P,{variant:"primary",size:"sm",onClick:()=>h("allow-once"),disabled:r,children:s("exec.allowOnce")}),n(P,{variant:"secondary",size:"sm",onClick:()=>h("allow-always"),disabled:r,children:s("exec.allowAlways")}),n(P,{variant:"ghost",size:"sm",onClick:()=>h("deny"),disabled:r,children:s("exec.deny")})]})]})}function mv({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 gv({content:e,maxLines:t=30,error:r=!1}){if(typeof e=="object"&&e!==null){const c=JSON.stringify(e,null,2),d=c.split(`
292
- `),h=d.length>t?d.slice(0,t).join(`
293
- `)+`
294
- ...`: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(Kl,{value:h,maxHeight:"max-h-[300px]"})}const a=String(e),o=a.split(`
295
- `),i=o.length>t?o.slice(0,t).join(`
296
- `)+`
297
- ...`: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:i})}function R_(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(te,{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 D_(e){const t=e.args||{};if(t.path||t.file_path)return $_(String(t.path||t.file_path));if(t.command)return qs(String(t.command),60);if(t.query)return qs(String(t.query),60);if(t.url)return L_(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 qs(a,50);return""}function qs(e,t){return e.length<=t?e:e.slice(0,t-1)+"…"}function $_(e){const t=e.split("/").filter(Boolean);return t.length<=2?e:"…/"+t.slice(-2).join("/")}function L_(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 qs(e,50)}}function N_(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 O_({content:e}){const[t,r]=U(!1),a=Math.max(1,Math.round(e.length/500)),o=s(a===1?"chat.thinkingBlock.second":"chat.thinkingBlock.second_plural",{count:a});return n("div",{class:"thinking-block border border-[var(--color-border)] rounded-lg overflow-hidden my-2",children:[n("button",{type:"button",onClick:()=>r(!t),"aria-expanded":t,"aria-label":s(t?"chat.thinkingBlock.collapseLabel":"chat.thinkingBlock.expandLabel"),class:"w-full flex items-center gap-2 px-3 py-2 text-sm text-[var(--color-text-muted)] hover:bg-[var(--color-bg-hover)] transition-colors",children:[t?n(Oe,{class:"w-4 h-4 flex-shrink-0","aria-hidden":"true"}):n(rt,{class:"w-4 h-4 flex-shrink-0","aria-hidden":"true"}),n(O2,{class:"w-4 h-4 flex-shrink-0 text-[var(--color-text-muted)]","aria-hidden":"true"}),n("span",{class:"font-medium",children:t?s("chat.thinkingBlock.thinking"):s("chat.thinkingBlock.thoughtFor",{duration:o})})]}),t&&n("div",{class:"px-3 pb-3 border-t border-[var(--color-border)] bg-[var(--color-bg-subtle)]",children:n("div",{class:"pt-3 text-sm text-[var(--color-text-secondary)]",children:n(Wl,{content:e})})})]})}function P_(e){return/^https?:\/\//i.test(e)}function F_(e){return/^data:/i.test(e)}function z_(e){return e.trim().replace(/^[`"'[{(]+/,"").replace(/[`"'\\})\],]+$/,"")}function U_(e){const t=[],r=[],a=e.split(`
298
- `),o=[];for(const l of a){const i=l.trim();if(!i.startsWith("MEDIA:")){o.push(l);continue}const c=i.slice(6).trim(),d=z_(c);if(!d){o.push(l);continue}P_(d)||F_(d)?t.push(d):r.push(d)}return{text:o.join(`
299
- `).trim(),mediaUrls:t,localPaths:r}}function j_(e){return e.map((t,r)=>({url:t,alt:`Image ${r+1}`}))}function H_(e,t){if(!t||t.length===0)return e?[{type:"text",content:e}]:[];E.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,i)=>{const c=l.insertedAtContentLength??1/0,d=i.insertedAtContentLength??1/0;return c-d}),a=[];let o=0;for(const l of r){const i=l.insertedAtContentLength;if(!(i===void 0||i===1/0)){if(i>o){const c=e.slice(o,i);c.trim()&&(a.push({type:"text",content:c}),E.chat.debug("buildContentBlocks: added text block",{from:o,to:i,textLen:c.length}))}a.push({type:"tool",toolCall:l}),o=i}}if(o<e.length){const l=e.slice(o);E.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}),E.chat.debug("buildContentBlocks: added remaining text block"))}for(const l of r)l.insertedAtContentLength===void 0&&a.push({type:"tool",toolCall:l});return E.chat.debug("buildContentBlocks result",{totalBlocks:a.length,blockTypes:a.map(l=>l.type)}),a}function B_({message:e,assistantName:t="Assistant",assistantAvatar:r,isStreaming:a=!1}){const o=re(!1),l=U_(e.content),i=j_(l.mediaUrls),c=[...e.images??[],...i],d=H_(l.text,e.toolCalls??[]),u=d.length>0||a||c.length>0||!!e.thinking;return E.chat.debug("AssistantMessage render",{messageId:e.id,contentLen:e.content.length,toolCallsCount:e.toolCalls?.length??0,blocksCount:d.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:[hh(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:le(e.timestamp)}),n("div",{class:"flex-1"}),!a&&e.content&&n(Ab,{content:e.content,visible:o.value})]}),n("div",{class:"space-y-3",children:[e.thinking&&n(O_,{content:e.thinking}),d.map((h,f)=>(E.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(Wl,{content:h.content,isStreaming:!1})},`text-${f}`):n("div",{children:n(I_,{toolCall:h.toolCall})},h.toolCall.id))),c.length>0&&n(Cb,{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($i,{})}),!u&&a&&n("span",{class:"inline-flex items-center gap-2 text-[var(--color-text-muted)]",children:[s("chat.thinking"),n($i,{})]})]})]})}function W_({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(zl,{class:"w-full h-full","aria-hidden":"true"})}),n("div",{class:"flex-1 text-sm text-[var(--color-text-muted)] italic",children:n(Wl,{content:e.content})})]})}function bv({message:e,isStreaming:t=!1,assistantName:r,assistantAvatar:a,userName:o,userAvatar:l}){switch(e.role){case"user":return n(__,{message:e,userName:o,userAvatar:l});case"assistant":return n(B_,{message:e,isStreaming:t,assistantName:r,assistantAvatar:a});case"system":return n(W_,{message:e});default:return null}}function K_({messages:e}){const[t,r]=U(!1);if(e.length===0)return null;const o=(e[0]?.content??"").replace(/^\s*\[cron\]\s*/i,"");return n("div",{class:"rounded-lg border overflow-hidden bg-[var(--color-text-muted)]/5 border-[var(--color-border)]",children:[n("button",{type:"button",onClick:()=>r(!t),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","aria-expanded":t,children:[n("span",{children:"⏰"}),n("span",{class:"flex-1 text-left",children:s("chat.cronJobCompleted")}),n(Va,{open:t,class:"w-4 h-4"})]}),t&&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:o})})]})}function xs({messages:e,summary:t,active:r}){const[a,o]=U(!1),l=e?.[0],i=t??l?.content,c=!!i&&i.trim().length>0&&i.toLowerCase()!=="compaction",d=l?.timestamp?le(l.timestamp):void 0,u="flex items-center gap-1.5 px-3 py-1 text-xs tracking-wide uppercase rounded-full border";return r?n("div",{class:"my-4",children:n("div",{class:"flex items-center gap-3 select-none",role:"status",children:[n("div",{class:"flex-1 h-px bg-[var(--color-border)]"}),n("span",{class:`${u} border-[var(--color-border)] text-[var(--color-text-muted)]`,children:[n($g,{class:"w-3 h-3 animate-spin","aria-hidden":"true"}),n("span",{children:s("chat.compacting")})]}),n("div",{class:"flex-1 h-px bg-[var(--color-border)]"})]})}):n("div",{class:"my-4",children:[n("div",{class:"flex items-center gap-3 select-none",role:"separator",children:[n("div",{class:"flex-1 h-px bg-[var(--color-border)]"}),c?n("button",{type:"button",onClick:()=>o(!a),class:`${u} border-[var(--color-border)] text-[var(--color-text-muted)] cursor-pointer hover:text-[var(--color-text-secondary)] hover:border-[var(--color-text-muted)] transition-colors`,"aria-label":s("chat.conversationCompacted"),"aria-expanded":a,title:d,children:[n(Ep,{class:"w-3 h-3","aria-hidden":"true"}),n("span",{children:s("chat.compactionLabel")}),a?n(mc,{class:"w-3 h-3","aria-hidden":"true"}):n(Oe,{class:"w-3 h-3","aria-hidden":"true"})]}):n("span",{class:`${u} border-[var(--color-border)] text-[var(--color-text-muted)]`,title:d,children:[n(Ep,{class:"w-3 h-3","aria-hidden":"true"}),n("span",{children:s("chat.compactionLabel")})]}),n("div",{class:"flex-1 h-px bg-[var(--color-border)]"})]}),a&&c&&n("div",{class:"mt-2 mx-8 px-3 py-2 text-sm text-[var(--color-text-secondary)] bg-[var(--color-bg-secondary)] rounded-lg border border-[var(--color-border)] whitespace-pre-wrap max-h-[300px] overflow-y-auto",children:i})]})}const q_=["Su","Mo","Tu","We","Th","Fr","Sa"],G_=["January","February","March","April","May","June","July","August","September","October","November","December"];function V_(e,t){return new Date(e,t+1,0).getDate()}function Y_(e,t){return new Date(e,t,1).getDay()}function J_(e){return e?e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):""}function xv({value:e,onChange:t,placeholder:r="Select date",class:a="",minDate:o,maxDate:l}){const[i,c]=U(!1),[d,u]=U(()=>e??new Date),[h,f]=U(!1),v=B(null);qa(v,()=>c(!1),i);const m=()=>{if(v.current){const I=v.current.getBoundingClientRect();f(I.left+280>window.innerWidth)}c(!i)},w=d.getFullYear(),k=d.getMonth(),T=V_(w,k),A=Y_(w,k),g=()=>{u(new Date(w,k-1,1))},x=()=>{u(new Date(w,k+1,1))},C=I=>{t(new Date(w,k,I)),c(!1)},b=I=>e?e.getFullYear()===w&&e.getMonth()===k&&e.getDate()===I:!1,S=I=>{const F=new Date;return F.getFullYear()===w&&F.getMonth()===k&&F.getDate()===I},_=I=>{const F=new Date(w,k,I);if(o){const D=new Date(o.getFullYear(),o.getMonth(),o.getDate());if(F<D)return!0}if(l){const D=new Date(l.getFullYear(),l.getMonth(),l.getDate());if(F>D)return!0}return!1},M=[];for(let I=0;I<A;I++)M.push(null);for(let I=1;I<=T;I++)M.push(I);return n("div",{ref:v,class:`relative ${a}`,children:[n("button",{type:"button",onClick:m,class:`
300
- flex items-center justify-between gap-2 w-full
301
- px-2.5 py-1.5 text-sm rounded-lg
302
- bg-[var(--color-bg-primary)]
303
- border border-[var(--color-border)]
304
- ${i?"border-[var(--color-accent)]/50":""}
305
- hover:border-[var(--color-border-hover)]
306
- transition-colors text-left
307
- `,children:[n("span",{class:e?"text-[var(--color-text-primary)]":"text-[var(--color-text-muted)]",children:e?J_(e):r}),n(Va,{open:i,class:"w-3.5 h-3.5 text-[var(--color-text-muted)]"})]}),i&&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:g,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:[G_[k]," ",w]}),n("button",{type:"button",onClick:x,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:q_.map(I=>n("div",{class:"text-[10px] font-medium text-[var(--color-text-muted)] text-center py-1",children:I},I))}),n("div",{class:"grid grid-cols-7 gap-1",children:M.map((I,F)=>{const D=I!==null&&_(I);return n("div",{class:"aspect-square",children:I!==null&&n("button",{type:"button",onClick:()=>!D&&C(I),disabled:D,class:`
308
- w-full h-full flex items-center justify-center
309
- text-sm rounded-md transition-colors
310
- ${D?"text-[var(--color-text-muted)]/40 cursor-not-allowed":b(I)?"bg-[var(--color-accent)] text-[var(--color-accent-text)] font-medium":S(I)?"bg-[var(--color-accent)]/10 text-[var(--color-accent)] font-medium":"text-[var(--color-text-primary)] hover:bg-[var(--color-bg-secondary)]"}
311
- `,children:I})},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 X_(){const e=B(null),t=Xe.value,r=ee(()=>{Xe.value=!1,Un.value="",Sw()},[]);O(()=>{Xe.value&&e.current&&e.current.focus()},[Xe.value]),O(()=>{const i=c=>{(c.metaKey||c.ctrlKey)&&c.key==="f"&&(c.preventDefault(),Xe.value=!0),c.key==="Escape"&&Xe.value&&r()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[r]);const a=Cw.value,l=fh(Un.value)||dg.value;return n(G,{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(K,{icon:n(Uh,{}),label:s("chat.search"),onClick:()=>Xe.value=!0,variant:"ghost",size:"sm",class:"border border-[var(--color-border)] bg-[var(--color-bg-surface)]"}),n(qg,{}),n("div",{"data-tour":"canvas",class:We.value?void 0:"hidden",children:n(K,{icon:n(Vg,{}),label:s("canvas.title"),onClick:()=>ul.value=!ul.value,variant:"ghost",size:"sm",class:"border border-[var(--color-border)] bg-[var(--color-bg-surface)]"})})]}),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(K,{icon:n(Ga,{}),label:s("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:Un.value,onInput:i=>Un.value=i.target.value,placeholder:s("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," ",s(a===1?"chat.match":"chat.matches")]})]}),n("div",{class:"hidden sm:flex items-center gap-1.5 flex-shrink-0",children:[n(xv,{value:ea.value,onChange:i=>ea.value=i,placeholder:s("chat.dateFrom"),class:"w-[130px]",maxDate:ta.value}),n("span",{class:"text-[var(--color-text-muted)] text-sm",children:"–"}),n(xv,{value:ta.value,onChange:i=>ta.value=i,placeholder:s("chat.dateTo"),class:"w-[130px]",minDate:ea.value})]})]})]})}function Z_(e){const t=[],r=new Set;for(let a=0;a<e.length;a++)if(e[a].kind==="compaction")for(let o=Math.max(0,a-2);o<=Math.min(e.length-1,a+2);o++)r.add(o);for(let a=0;a<e.length;a++){const o=e[a];if(!V1(o)&&!rg(o)&&!X1(o))if(o.kind==="compaction")t.push({type:"compaction",messages:[o]});else if(ew(o)){if(r.has(a))continue;t.push({type:"compaction",messages:[o]})}else Y1(o)?t.push({type:"cron",message:o}):t.push({type:"message",message:o})}return t}const yv=["bg-[var(--color-bg-hover)]","rounded-lg","transition-colors"],Q_="cursor-pointer hover:bg-[var(--color-bg-hover)] rounded-lg transition-colors";function eS({messages:e,isLoading:t=!1,error:r=null,streamingContent:a="",streamingToolCalls:o=[],isStreaming:l=!1,assistantName:i,assistantAvatar:c,userName:d,userAvatar:u,queuedCount:h=0}){E.chat.debug("MessageList render",{messagesCount:e.length,streamingContentLen:a.length,streamingToolCallsCount:o.length,isStreaming:l,queuedCount:h});const f=B(null),v=B(null),m=re(!1),w=B(!0),k=ee((_=!0)=>{requestAnimationFrame(()=>{f.current&&f.current.scrollTo({top:f.current.scrollHeight,behavior:_?"smooth":"auto"})})},[]),T=ee(()=>{if(!f.current)return;const{scrollTop:_,scrollHeight:M,clientHeight:I}=f.current,F=M-_-I;m.value=F>100,w.current=F<50},[]),A=o.filter(_=>_.status==="complete"||_.status==="error").length,g=B(null);O(()=>{const _=e[e.length-1],M=_?.role==="user"&&_.id!==g.current;(M||h>0||w.current)&&(M&&(w.current=!0),k(!1)),g.current=_?.id??null},[e.length,a.length,o.length,A,h,k]),O(()=>{k(!1)},[k]),O(()=>{if(!f.current)return;const _=()=>{w.current&&k(!1)},M=f.current;return M.addEventListener("load",_,!0),()=>M.removeEventListener("load",_,!0)},[k]),O(()=>{const _=hs.value;if(!_||!f.current)return;const M=f.current.querySelector(`[data-message-id="${_}"]`);M&&(M.scrollIntoView({behavior:"smooth",block:"center"}),M.classList.add(...yv),setTimeout(()=>{M.classList.remove(...yv)},2e3)),hs.value=null},[hs.value]);const x=l&&ng(a),C=l&&!x?{id:"streaming",role:"assistant",content:a,toolCalls:o.length>0?o:void 0,timestamp:Date.now(),isStreaming:!0}:null,b=pt(()=>Z_(e),[e]),S=pt(()=>{const _=gi.value;if(_<0||!hr.value)return-1;for(let M=0;M<b.length;M++){const I=b[M],F=I.type==="message"||I.type==="cron"?I.message:I.type==="compaction"&&I.messages.length>0?I.messages[0]:null;if(F&&e.indexOf(F)>=_)return M}return b.length},[b,gi.value,hr.value]);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(X_,{})}),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(te,{size:"md",label:s("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:[hh(c)?n("img",{src:c,alt:i||s("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":i||s("chat.emptyState.assistant"),children:c}):n(_c,{size:"lg",class:"mx-auto mb-4 opacity-80"}),n("h3",{class:"text-xl font-medium mb-2",children:i?s("chat.emptyState.titleWithName",{name:i}):s("chat.emptyState.title")}),n("p",{class:"text-[var(--color-text-muted)] mb-6",children:s("chat.emptyState.description")}),n("div",{class:"text-sm text-[var(--color-text-muted)]",children:[n("p",{class:"mb-2",children:s("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:s("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:s("chat.emptyState.newSession")})]})]})]})]})}),n("div",{class:"space-y-6",children:[b.map((_,M)=>{const I=!Wn.value&&hr.value&&S===M,F=[];if(I&&F.push(n(xs,{summary:mi.value},"compaction-ephemeral")),_.type==="compaction")F.push(n(xs,{messages:_.messages},`compaction-${M}`));else if(_.type==="cron")F.push(n(K_,{messages:[_.message]},`cron-${M}`));else{const D=_.message,Y=Xe.value?()=>{hs.value=D.id,Un.value="",Xe.value=!1}:void 0;F.push(n("div",{"data-message-id":D.id,onClick:Y,onKeyDown:Y?Ue=>{Ue.key==="Enter"&&Y()}:void 0,role:Xe.value?"button":void 0,tabIndex:Xe.value?0:void 0,class:`-mx-2 px-2 py-1 rounded-lg ${Xe.value?Q_:""}`,children:n(bv,{message:D,assistantName:i,assistantAvatar:c,userName:d,userAvatar:u})},D.id))}return F}),!Wn.value&&hr.value&&S>=b.length&&n(xs,{summary:mi.value}),Wn.value&&n(xs,{active:!0}),C&&n(bv,{message:C,isStreaming:!0,assistantName:i,assistantAvatar:c})]}),n("div",{ref:v,class:"h-1"})]})}),m.value&&n("div",{class:"absolute bottom-4 right-4",children:n(K,{icon:n(Ok,{}),label:s("chat.scrollToBottom"),onClick:()=>{w.current=!0,k(!0)},variant:"default",size:"md",class:"shadow-lg bg-[var(--color-bg-surface)] border border-[var(--color-border)]"})})]})}const tS=["image/png","image/jpeg","image/gif","image/webp"],wv=10*1024*1024,fd=400*1024,ys=2048;function Jh(e){return tS.includes(e)}let nS=0;function kv(){return`attachment_${Date.now()}_${++nS}`}async function Tb(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:i,height:c}=a;if(i>ys||c>ys){const w=Math.min(ys/i,ys/c);i=Math.round(i*w),c=Math.round(c*w)}o.width=i,o.height=c,l.drawImage(a,0,0,i,c);const d=e.type==="image/png"?"image/png":"image/jpeg";let u=.9,h=o.toDataURL(d,u);if(d==="image/jpeg")for(;h.length>fd&&u>.1;)u-=.1,h=o.toDataURL(d,u);let f=1;for(;h.length>fd&&f>.2;)f-=.1,o.width=Math.round(i*f),o.height=Math.round(c*f),l.drawImage(a,0,0,o.width,o.height),h=o.toDataURL(d,d==="image/jpeg"?.8:void 0);const v=h.split(",")[1]||"",m=Math.round(v.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 _v(e){if(Jh(e.type)){const{content:r,size:a}=await Tb(e);return{id:kv(),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:kv(),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 rS(){const e=re([]),t=re(!1),r=re(null);O(()=>()=>{for(const u of e.value)u.previewUrl&&URL.revokeObjectURL(u.previewUrl)},[]);const a=ee(async u=>{const h=Array.from(u);r.value=null,t.value=!0;try{for(const f of h){if(f.size>wv){r.value=`File "${f.name}" is too large (max 10MB)`;continue}if(!Jh(f.type)&&f.size>fd){r.value=`File "${f.name}" is too large (max 400KB for non-images)`;continue}try{const v=await _v(f);e.value=[...e.value,v]}catch{r.value=`Failed to read "${f.name}"`}}}finally{t.value=!1}},[]),o=ee(u=>{const h=e.value.find(f=>f.id===u);h?.previewUrl&&URL.revokeObjectURL(h.previewUrl),e.value=e.value.filter(f=>f.id!==u)},[]),l=ee(()=>{for(const u of e.value)u.previewUrl&&URL.revokeObjectURL(u.previewUrl);e.value=[]},[]),i=ee(()=>e.value.map(u=>({type:u.type,mimeType:u.mimeType,fileName:u.fileName,content:u.content})),[]),c=ee(async u=>{const h=u.clipboardData?.items;if(!h)return!1;const f=[];for(const v of h)v.type.startsWith("image/")&&f.push(v);if(f.length===0)return!1;u.preventDefault(),r.value=null,t.value=!0;try{for(const v of f){const m=v.getAsFile();if(m){if(m.size>wv){r.value="Pasted image is too large (max 10MB)";continue}try{const w=await _v(m);e.value=[...e.value,w]}catch{r.value="Failed to read pasted image"}}}}finally{t.value=!1}return!0},[]),d=ee(()=>{r.value=null},[]);return{attachments:e.value,addFiles:a,removeAttachment:o,clearAttachments:l,getPayloads:i,handlePaste:c,isProcessing:t.value,error:r.value,clearError:d}}function aS(e){if(!e)return null;const t=e.indexOf("/");return t===-1?null:e.substring(0,t)}function oS(e){if(!e)return null;const t=aS(e);return t||(Xn.value.find(a=>a.id===e)?.provider??null)}function lS({sessionKey:e,currentModel:t,onModelChange:r}){const[a,o]=U(!1),[l,i]=U(!1),[c,d]=U(()=>f0()),u=B(null);if(qa(u,()=>o(!1),a),Xn.value.length===0)return null;const h=t??kg.value??Xn.value[0]?.id,f=oS(h),v=f?g2.value.get(f)??[]:[],m=pt(()=>[...v.filter((g,x,C)=>C.findIndex(b=>b.id===g.id)===x)].sort((g,x)=>{if(g.id===h)return-1;if(x.id===h)return 1;const C=c.has(g.id),b=c.has(x.id);return C&&!b?-1:!C&&b?1:g.name.localeCompare(x.name)}),[v,h,c]);if(m.length===0)return null;const w=t?x2(t):s("sessions.defaultModel"),k=(A,g)=>{g.preventDefault(),g.stopPropagation();const x=new Set(c);x.has(A)?x.delete(A):x.add(A),d(x),p0(x)},T=async A=>{if(A===t){o(!1);return}i(!0);try{await N("sessions.patch",{key:e,model:A}),r?.(A),E.ui.debug("Model changed to:",A)}catch(g){E.ui.error("Failed to change model:",g)}finally{i(!1),o(!1)}};return n("div",{ref:u,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
312
- text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]
313
- hover:bg-[var(--color-bg-secondary)] transition-colors
314
- disabled:opacity-50`,children:[n("span",{class:"max-w-[120px] truncate",children:w}),n(Va,{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(A=>{const g=c.has(A.id),x=(t??h)===A.id;return n("div",{class:`flex items-center gap-1 px-2 py-2 transition-colors ${x?"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:C=>k(A.id,C),class:`p-1 -m-1 text-xs transition-colors rounded hover:bg-[var(--color-bg-tertiary)] ${g?"text-[var(--color-warning)]":"text-[var(--color-text-muted)] hover:text-[var(--color-warning)]/70"}`,title:s(g?"models.removeFavorite":"models.addFavorite"),"aria-label":s(g?"models.removeFavorite":"models.addFavorite"),children:g?"★":"☆"}),n("button",{type:"button",onClick:()=>T(A.id),class:"flex-1 text-left text-sm flex items-center gap-2 min-w-0",children:[n("span",{class:"truncate",children:A.name}),A.reasoning&&n("span",{class:"text-[10px] text-[var(--color-warning)] flex-shrink-0",children:"🧠"})]})]},A.id)})})]})}function sS({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(P,{variant:"secondary",onClick:e,fullWidth:!0,class:"sm:w-auto",children:o||s("actions.cancel")}),n(P,{onClick:t,disabled:a,fullWidth:!0,class:"sm:w-auto",children:r||s("actions.confirm")})]})}function Eb({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(P,{variant:"ghost",onClick:t,fullWidth:!0,class:"sm:w-auto",children:s("actions.cancel")}),n(P,{variant:"danger",icon:n(Et,{class:"w-4 h-4"}),onClick:r,disabled:a,fullWidth:!0,class:"sm:w-auto",children:a?n(te,{size:"sm"}):s("actions.delete")})]})]})}function Ib({onCancel:e,onSave:t,isSaving:r,saveDisabled:a,saveLabel:o,isEdit:l,onDeleteClick:i,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&&i&&n(P,{size:"sm",variant:"ghost",icon:n(Et,{class:"w-4 h-4"}),onClick:i,class:"text-[var(--color-error)] hover:bg-[var(--color-error)]/10",children:s("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(P,{variant:"secondary",onClick:e,fullWidth:!0,class:"sm:w-auto",children:s("actions.cancel")}),n(P,{onClick:t,disabled:r||a,fullWidth:!0,class:"sm:w-auto",children:r?n(te,{size:"sm"}):o||s("actions.save")})]})]})]})}const iS=100,Sv=120;function cS(){const e=bt.value,[t,r]=U(new Set),[a,o]=U(null),[l,i]=U(""),[c,d]=U([]),u=B(null);if(e.length===0)return null;const h=A=>{r(g=>{const x=new Set(g);return x.has(A)?x.delete(A):x.add(A),x})},f=A=>{o(A),i(A.content),d(A.images??[])},v=()=>{if(!a)return!1;const A=a.content,g=a.images??[];if(l.trim()!==A||c.length!==g.length)return!0;for(let x=0;x<c.length;x++)if(c[x].url!==g[x].url)return!0;return!1},m=()=>{a&&(l.trim()||c.length>0)&&v()&&(Dw(a.id,l.trim(),c.length>0?c:void 0),o(null),i(""),d([]))},w=()=>{o(null),i(""),d([])},k=A=>{d(g=>g.filter((x,C)=>C!==A))},T=async A=>{if(!A||A.length===0)return;const g=[];for(const x of Array.from(A))if(Jh(x.type))try{const{content:C}=await Tb(x);g.push({url:C,alt:x.name})}catch{}g.length>0&&d(x=>[...x,...g]),u.current&&(u.current.value="")};return n(G,{children:[n("div",{class:"mb-2 space-y-2",children:[n("div",{class:"text-xs text-[var(--color-text-muted)] font-medium",children:s("chat.queuedMessages",{count:e.length})}),n("div",{class:"space-y-1",children:e.map(A=>{const g=A.content.length>iS,x=t.has(A.id),C=A.images&&A.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 ${g&&!x?"line-clamp-1":"whitespace-pre-wrap"}`,children:A.content}),C&&n("div",{class:"mt-1 flex items-center gap-1 text-xs text-[var(--color-text-muted)]",children:[n(Wk,{class:"w-3 h-3"}),n("span",{children:s("chat.imageCount",{count:A.images.length})})]})]}),n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[n("button",{type:"button",onClick:()=>f(A),class:"p-1 rounded hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)] hover:text-[var(--color-accent)] transition-colors",title:s("actions.edit"),"aria-label":s("actions.edit"),children:n(Yg,{class:"w-4 h-4"})}),n("button",{type:"button",onClick:()=>vg(A.id),class:"p-1 rounded hover:bg-[var(--color-bg-tertiary)] text-[var(--color-text-muted)] hover:text-[var(--color-error)] transition-colors",title:s("actions.remove"),"aria-label":s("actions.remove"),children:n(Jg,{class:"w-4 h-4"})})]})]}),g&&n("button",{type:"button",onClick:()=>h(A.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(Va,{class:"w-3 h-3",open:x}),s(x?"actions.showLess":"actions.showMore")]})]},A.id)})})]}),n(ze,{open:!!a,onClose:w,title:s("chat.editQueuedMessage"),size:"lg",footer:n(sS,{onCancel:w,onConfirm:m,confirmLabel:s("actions.save"),confirmDisabled:!l.trim()&&c.length===0||!v()}),children:n("div",{class:"space-y-4",children:[n("textarea",{value:l,onInput:A=>i(A.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:s("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:s("chat.images")}),n(P,{variant:"ghost",size:"sm",icon:n(Gg,{class:"w-4 h-4"}),onClick:()=>u.current?.click(),children:s("chat.addImage")}),n("input",{ref:u,type:"file",accept:"image/*",multiple:!0,class:"hidden",onChange:A=>T(A.target.files)})]}),c.length>0?n("div",{class:"flex flex-wrap gap-2",children:c.map((A,g)=>n("div",{class:"relative group",children:[n("img",{src:A.url,alt:A.alt||`Image ${g+1}`,class:"rounded-lg object-cover border border-[var(--color-border)]",style:{width:Sv,height:Sv}}),n("button",{type:"button",onClick:()=>k(g),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:s("actions.remove"),"aria-label":s("actions.remove"),children:n(Ga,{class:"w-3 h-3"})})]},g))}):n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("chat.noImages")})]})]})})]})}function uS({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(dS,{attachment:a,onRemove:()=>t(a.id)},a.id)),r&&n("div",{class:`
315
- w-16 h-16 rounded-lg
316
- border border-[var(--color-border)]
317
- bg-[var(--color-bg-secondary)]
318
- flex items-center justify-center
319
- `,children:n(te,{size:"sm"})})]})}function dS({attachment:e,onRemove:t}){const r=e.type==="image",a=hS(e.size);return n("div",{class:"relative group",children:[n(Ka,{content:`${e.fileName} (${a})`,placement:"top",children:n("div",{class:`
320
- relative w-16 h-16 rounded-lg overflow-hidden
321
- border border-[var(--color-border)]
322
- bg-[var(--color-bg-secondary)]
323
- flex items-center justify-center
324
- `,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(na,{class:"w-6 h-6"}):n(Ht,{class:"w-6 h-6"}),n("span",{class:"text-[8px] truncate max-w-[56px] px-1",children:fS(e.fileName)})]})})}),n("button",{type:"button",onClick:t,"aria-label":s("actions.remove"),class:`
325
- absolute -top-1.5 -right-1.5
326
- w-5 h-5 rounded-full
327
- bg-[var(--color-bg-surface)] border border-[var(--color-border)]
328
- flex items-center justify-center
329
- opacity-0 group-hover:opacity-100
330
- hover:bg-[var(--color-error)] hover:border-[var(--color-error)] hover:text-white
331
- transition-all cursor-pointer
332
- `,children:n(Wa,{class:"w-3 h-3"})})]})}function hS(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function fS(e){return e.split(".").pop()?.toUpperCase()||"FILE"}const Cv=160;function pS({onSend:e,onAbort:t,disabled:r=!1,isStreaming:a=!1,placeholder:o,sessionKey:l,currentModel:i,onModelChange:c}){const d=B(null),u=B(null),h=B(null),f=re(l?hp(l):""),v=re(!1),{attachments:m,addFiles:w,removeAttachment:k,clearAttachments:T,getPayloads:A,handlePaste:g,isProcessing:x,error:C,clearError:b}=rS(),S=ee(()=>{const H=d.current;if(!H)return;H.style.height="auto";const ie=Math.min(H.scrollHeight,Cv);H.style.height=`${ie}px`},[]),_=ee(H=>{const ie=H.target.value;f.value=ie,l&&mg(l,ie),S()},[S,l]),M=ee(()=>{const H=f.value.trim(),ie=A();!H&&ie.length===0||r||(e(H,ie.length>0?ie:void 0),f.value="",l&&$w(l),T(),d.current&&(d.current.style.height="auto"))},[e,r,A,T,l]),I=ee(H=>{if((H.metaKey||H.ctrlKey)&&H.key==="Enter"){H.preventDefault(),M();return}H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),M())},[M]),F=ee(async H=>{await g(H)},[g]),D=ee(H=>{const ie=H.target;ie.files&&ie.files.length>0&&(w(ie.files),ie.value="")},[w]),Y=ee(H=>{H.preventDefault(),H.stopPropagation(),v.value=!0},[]),Ue=ee(H=>{H.preventDefault(),H.stopPropagation(),!(H.relatedTarget&&h.current?.contains(H.relatedTarget))&&(v.value=!1)},[]),fe=ee(H=>{H.preventDefault(),H.stopPropagation()},[]),nr=ee(async H=>{H.preventDefault(),H.stopPropagation(),v.value=!1;const ie=H.dataTransfer?.files;ie&&ie.length>0&&await w(ie)},[w]);O(()=>{if(d.current?.focus(),l){const H=hp(l);f.value=H,H&&requestAnimationFrame(S)}},[l,S]),O(()=>{if(C){const H=setTimeout(b,5e3);return()=>clearTimeout(H)}},[C,b]);const En=fh(f.value),In=m.length>0,ge=(En||In)&&!r;return n("div",{class:"pb-3 pt-2",children:n("div",{class:"max-w-5xl mx-auto px-6",children:[n(cS,{}),C&&n("div",{class:"mb-2 px-3 py-2 text-sm text-[var(--color-error)] bg-[var(--color-error)]/10 rounded-lg",children:C}),n("div",{ref:h,"data-tour":"chat-input",onDragEnter:Y,onDragLeave:Ue,onDragOver:fe,onDrop:nr,class:`
333
- relative flex flex-col bg-[var(--color-bg-surface)] border rounded-xl
334
- transition-all duration-200
335
- ${v.value?"border-[var(--color-accent)] bg-[var(--color-accent)]/5":"border-[var(--color-border)] focus-within:border-[var(--color-accent)]"}
336
- `,children:[v.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:s("chat.dropFiles")})}),(In||x)&&n("div",{class:"pt-3 px-4",children:n(uS,{attachments:m,onRemove:k,isProcessing:x})}),n("textarea",{ref:d,value:f.value,onInput:_,onKeyDown:I,onPaste:F,disabled:r,placeholder:o||(window.innerWidth<640?s("chat.placeholderMobile"):s("chat.placeholder")),rows:1,class:`
337
- w-full px-4 pb-1 text-base sm:text-sm rounded-t-xl resize-none
338
- bg-transparent border-none
339
- placeholder:text-[var(--color-text-muted)]
340
- disabled:opacity-50 disabled:cursor-not-allowed
341
- ${In?"pt-2":"pt-3"}
342
- `,style:{minHeight:"44px",maxHeight:`${Cv}px`,outline:"none"}}),n("input",{ref:u,type:"file",multiple:!0,accept:"image/*",onChange:D,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(lS,{sessionKey:l,currentModel:i,onModelChange:c})}),n(Ka,{content:s("chat.attachImage"),placement:"top",children:n("button",{type:"button",onClick:()=>u.current?.click(),disabled:r,"aria-label":s("chat.attachImage"),class:`
343
- p-1.5 rounded-lg cursor-pointer
344
- text-[var(--color-text-muted)]
345
- hover:text-[var(--color-text-secondary)]
346
- hover:bg-[var(--color-bg-hover)]
347
- disabled:opacity-50 disabled:cursor-not-allowed
348
- transition-colors
349
- `,children:n(na,{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":s("actions.stop"),class:`p-2 sm:px-3 sm:py-1.5 rounded-lg flex items-center justify-center gap-1.5 cursor-pointer
350
- bg-[var(--color-error)]/10 text-[var(--color-error)]
351
- hover:bg-[var(--color-error)]/20
352
- active:scale-95 transition-all duration-150`,children:[n(zk,{class:"w-4 h-4"}),n("span",{class:"hidden sm:inline text-xs font-medium",children:s("actions.stop")})]}),n("button",{type:"button",onClick:M,disabled:!ge,"aria-label":s(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
353
- transition-all duration-150 active:scale-95
354
- ${ge?"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(Fk,{class:"w-4 h-4"}),n("span",{class:"hidden sm:inline text-xs font-medium",children:s(a?"actions.queue":"actions.send")})]})]})]})]})]})})}function vS(){const e=Ee.value;if(e==="connected"||e==="connecting"||e==="authenticating")return null;const t=e==="reconnecting",r=bt.value.length;return n("div",{class:`
355
- px-4 py-2 text-sm flex items-center justify-center gap-2
356
- animate-[fade-in_150ms_ease-out_100ms_forwards] opacity-0
357
- ${t?"bg-[var(--color-warning)]/10 text-[var(--color-warning)]":"bg-[var(--color-error)]/10 text-[var(--color-error)]"}
358
- `,role:"alert",children:[n("span",{class:"flex-shrink-0",children:t?n($g,{class:"w-4 h-4 animate-spin","aria-hidden":"true"}):n(Tn,{class:"w-4 h-4","aria-hidden":"true"})}),n("span",{children:t?zt.value>1?s("connection.reconnectingAttempt",{count:zt.value}):s("connection.reconnecting"):s("connection.disconnected")}),fg.value&&n("span",{class:"text-xs opacity-75",children:["• ",s("connection.messagesQueued",{count:r})]})]})}function ws({sessionKey:e}){const t=B(null),r=B(!1);O(()=>{const i=e?decodeURIComponent(e):null;if(ol.value&&Be.value){cn.value!==Be.value&&ma(Be.value),i&&i!==Be.value&&De(`/chat/${encodeURIComponent(Be.value)}`,!0);return}if(!i&&Be.value){De(`/chat/${encodeURIComponent(Be.value)}`,!0);return}const c=i||"main";c!==cn.value&&ma(c)},[e,Be.value,ol.value]),O(()=>{const i=Je.value;if(!i||i===t.current)return;t.current=i,ww()!==i&&(kh(),Un.value="",Xe.value=!1),_h(i).catch(()=>{})},[cn.value]),O(()=>{const i=L.value,c=r.current;r.current=i,!(!i||c)&&(Rw(),fg.value&&Yw())},[Ee.value]);const a=async(i,c)=>{const d=Je.value;if(d)try{await bg(d,i,{attachments:c})}catch{}},o=()=>{const i=Je.value;i&&xg(i)},l=oc(()=>Aw(Je.value));return n("div",{class:"flex-1 flex flex-col overflow-hidden relative",children:[n(vS,{}),n(eS,{messages:hg.value,isLoading:Gu.value,error:vi.value,streamingContent:l.value.content,streamingToolCalls:l.value.toolCalls,isStreaming:l.value.isStreaming,assistantName:Qu.value,assistantAvatar:ed.value??void 0,userName:d2.value,userAvatar:h2.value??void 0,queuedCount:bt.value.length}),n(pS,{onSend:a,onAbort:o,disabled:!1,isStreaming:l.value.isStreaming,sessionKey:Je.value,currentModel:uw.value?.model,onModelChange:i=>{Je.value&&mh(Je.value,{model:i})}})]})}const Xh=jl(({size:e="md",error:t,fullWidth:r,class:a,...o},l)=>{const[i,c]=U(!1);return n(X,{ref:l,type:i?"text":"password",size:e,error:t,fullWidth:r,rightElement:n("button",{type:"button",onClick:()=>c(!i),class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors","aria-label":i?"Hide password":"Show password",tabIndex:-1,children:i?n(Eg,{class:"w-4 h-4"}):n($h,{class:"w-4 h-4"})}),class:a,...o})});Xh.displayName="PasswordInput";const mS={default:`
359
- bg-[var(--color-bg-surface)]
360
- border border-[var(--color-border)]
361
- shadow-soft-sm
362
- transition-shadow duration-200 ease-out
363
- hover:shadow-soft
364
- `,elevated:`
365
- bg-[var(--color-bg-surface)]
366
- border border-[var(--color-border)]
367
- shadow-soft-lg
368
- transition-shadow duration-200 ease-out
369
- hover:shadow-soft-xl
370
- `,outlined:`
371
- bg-transparent
372
- border border-[var(--color-border)]
373
- transition-colors duration-200 ease-out
374
- `},uu={none:"",sm:"p-3",md:"p-4",lg:"p-6"};function q({variant:e="default",padding:t="md",title:r,subtitle:a,headerActions:o,footer:l,children:i,class:c,...d}){const u=r||a||o;return n("div",{class:`rounded-xl ${mS[e]} ${c||""}`,...d,children:[u&&n("div",{class:`
375
- flex items-start justify-between gap-4
376
- ${t!=="none"?uu[t]:"p-4"}
377
- ${i||l?"border-b border-[var(--color-border)]":""}
378
- `,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})]}),i&&n("div",{class:uu[t],children:i}),l&&n("div",{class:`
379
- ${uu[t]}
380
- border-t border-[var(--color-border)]
381
- bg-[var(--color-bg-secondary)]/50
382
- rounded-b-2xl
383
- `,children:l})]})}function gS(){const e=re(""),t=re(""),r=re("token"),a=re(!1),o=re(!0),l=re(null),i=h=>{if(!h.trim())return s("errors.required");if(!h.startsWith("ws://")&&!h.startsWith("wss://"))return"URL must start with ws:// or wss://";try{new URL(h)}catch{return s("errors.invalid")}return null},c=async()=>{const h=i(e.value);if(h){l.value=h;return}l.value=null,a.value=!0;try{await Nl({url:e.value,token:r.value==="token"?t.value:void 0,password:r.value==="password"?t.value:void 0,autoReconnect:!0}),ah({url:e.value,authMode:r.value,rememberMe:o.value,credential:t.value}),await uc(),await _g(),await Ah(),ma("main"),await Ch("main"),Eh(),Ih()}catch(f){E.auth.error("Connect failed:",f)}finally{a.value=!1}},d=h=>{h.key==="Enter"&&(h.preventDefault(),c())};if(!e.value){const h=sc();if(h){e.value=h.url,r.value=h.authMode,o.value=h.rememberMe;const f=lh();f&&(t.value=f)}}const u=[{value:"token",label:s("auth.authMode.token")},{value:"password",label:s("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(_c,{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:s("app.name")}),n("p",{class:"text-sm sm:text-base text-[var(--color-text-muted)] mt-1",children:s("app.tagline")})]}),n(q,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:s("auth.title")}),n("div",{class:"space-y-3 sm:space-y-4",children:[n(Ie,{label:s("auth.gatewayUrl"),htmlFor:"gateway-url",error:l.value||void 0,children:n(X,{id:"gateway-url",type:"url",value:e.value,onInput:h=>{e.value=h.target.value,l.value=null},onKeyDown:d,placeholder:s("auth.gatewayUrlPlaceholder"),error:l.value||void 0,autoCorrect:"off",autoCapitalize:"off",spellcheck:!1,fullWidth:!0})}),n(Ie,{label:"Auth Mode",children:n(Re,{value:r.value,onChange:h=>r.value=h,options:u,"aria-label":"Auth Mode",class:"w-full"})}),n(Ie,{label:r.value==="token"?s("auth.token"):s("auth.password"),htmlFor:"auth-credential",children:n(Xh,{id:"auth-credential",value:t.value,onInput:h=>t.value=h.target.value,onKeyDown:d,placeholder:r.value==="token"?s("auth.tokenPlaceholder"):s("auth.passwordPlaceholder"),fullWidth:!0})}),n($e,{checked:o.value,onChange:h=>o.value=h,label:s("auth.rememberMe"),size:"sm"}),n(P,{variant:"primary",onClick:c,disabled:a.value||!e.value.trim(),loading:a.value,fullWidth:!0,children:a.value?s("auth.connecting"):s("actions.connect")}),zn.value&&n("p",{class:"text-sm text-[var(--color-error)] text-center",children:zn.value})]})]})]})})}class Ac extends mt{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;E.ui.error(`ViewErrorBoundary caught error in ${a||"unknown view"}:`,t),E.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(Tn,{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?s("errors.viewFailed",{view:t}):s("errors.generic")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:r?.message||s("errors.unknown")}),n(P,{onClick:this.handleRetry,variant:"secondary",class:"inline-flex items-center gap-2",children:[n(Fe,{class:"w-4 h-4","aria-hidden":"true"}),s("actions.retry")]})]})})}return this.props.children}}const bS={"4xl":"max-w-4xl","5xl":"max-w-5xl","6xl":"max-w-6xl","7xl":"max-w-7xl",full:"max-w-full"};function Kt({viewName:e,children:t,maxWidth:r="5xl"}){return n(Ac,{viewName:e,children:n("div",{class:"flex-1 overflow-y-auto p-4 sm:p-6",children:n("div",{class:`${bS[r]} mx-auto space-y-4 sm:space-y-6`,children:t})})})}const pr=p(null),aa=p([]),xS=p(null),Vr=p(null),Av=p(!1);async function yS(){if(L.value){Av.value=!0;try{try{const e=await N("cron.status");pr.value={enabled:e.enabled??!1,jobCount:e.jobs??0,nextWakeMs:e.nextWakeAtMs??null}}catch{pr.value=null}try{const e=await N("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})}aa.value=t}catch{aa.value=[]}try{const t=(await N("skills.status")).skills??[];Vr.value={total:t.length,eligible:t.filter(r=>r.eligible).length}}catch{Vr.value=null}xS.value=null}finally{Av.value=!1}}}const wS=W(()=>{const e=ch.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`}),kS=W(()=>window.location.protocol==="https:"||window.location.hostname==="localhost"),_S=W(()=>st.value?.startsWith("wss://")??!1),Tv=W(()=>aa.value.filter(e=>e.connected).length),SS=W(()=>{const e=pr.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 Hr({icon:e,label:t,value:r,subtext:a,href:o}){const l=n(G,{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 Ev({value:e,label:t}){const[r,a]=U(!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(Wt,{class:"w-4 h-4 text-[var(--color-success)]"}):n(bc,{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 ks({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 CS(e){const t=L.value,r=Ee.value;return O(()=>{t&&yS()},[t]),n(Kt,{viewName:s("nav.overview"),children:[!kS.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(Tn,{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&&st.value&&!_S.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(wc,{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(q,{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(Ci,{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(zg,{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(Z,{variant:t?"success":r==="connecting"?"warning":"error",dot:!0,size:"sm",children:s(r==="connected"?"status.connected":r==="connecting"||r==="authenticating"?"status.connecting":r==="reconnecting"?"status.reconnecting":"status.disconnected")})]})]}),t&&n(P,{variant:"secondary",size:"sm",onClick:()=>va(),children:"Disconnect"})]}),t&&st.value&&n("div",{class:"border-t border-[var(--color-border)] pt-4 mt-4 space-y-1",children:[n(Ev,{label:"URL",value:st.value}),mo.connectionId.value&&n(Ev,{label:"Connection ID",value:mo.connectionId.value})]})]}),t&&n("div",{class:"grid grid-cols-2 md:grid-cols-3 gap-2 sm:gap-4",children:[n(Hr,{icon:me,label:"Uptime",value:wS.value??"—",subtext:Yn.value?`Since ${le(Yn.value)}`:void 0,href:"/stats"}),n(Hr,{icon:jn,label:"Instances",value:Ll.value.length,subtext:"Connected clients",href:"/instances"}),n(Hr,{icon:dn,label:"Sessions",value:gt.value.length,subtext:"Active sessions",href:"/sessions"}),n(Hr,{icon:fn,label:"Cron",value:pr.value?.enabled?"Enabled":"Disabled",subtext:pr.value?.nextWakeMs?`Next wake: ${SS.value}`:pr.value?.jobCount?`${pr.value.jobCount} jobs`:void 0,href:"/cron"}),n(Hr,{icon:Si,label:"Channels",value:aa.value.length>0?Tv.value:"—",subtext:aa.value.length>0?`${Tv.value}/${aa.value.length} connected`:"No channels configured",href:"/channels"}),n(Hr,{icon:kc,label:"Skills",value:Vr.value?.eligible??"—",subtext:Vr.value?`${Vr.value.eligible}/${Vr.value.total} active`:void 0,href:"/skills"})]}),t&&n(q,{title:s("overview.serverInfo"),padding:"md",children:n("div",{class:"divide-y divide-[var(--color-border)]",children:[n(ks,{label:s("overview.version"),value:At.value}),n(ks,{label:s("overview.commit"),value:$l.value?.substring(0,8)}),n(ks,{label:s("overview.host"),value:Ua.value}),n(ks,{label:s("overview.capabilities"),value:mo.capabilities.value.length>0?s("overview.capabilitiesCount",{count:mo.capabilities.value.length}):null})]})})]})}function ve({icon:e,label:t,value:r,active:a,highlight:o,onClick:l,class:i}){const c=!!l,d=n(G,{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})]})]}),u=`
384
- flex items-center gap-1.5 sm:gap-3 p-2 sm:p-4 rounded-xl text-left transition-all
385
- ${a?"bg-[var(--color-accent)]/10 border-2 border-[var(--color-accent)]":"bg-[var(--color-bg-secondary)] border-2 border-transparent"}
386
- ${c?"hover:bg-[var(--color-bg-tertiary)] cursor-pointer":""}
387
- ${i||""}
388
- `;return c?n("button",{type:"button",onClick:l,class:u,children:d}):n("div",{class:u,children:d})}function Mt({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 AS={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 Ya({icon:e,iconVariant:t="default",title:r,subtitle:a,badges:o,meta:l,actions:i,onClick:c}){const d=n("div",{class:"flex items-start gap-3 w-full",children:[n("div",{class:`p-1.5 rounded-lg flex-shrink-0 ${AS[t]}`,children:n(e,{class:"w-4 h-4"})}),n("div",{class:"flex-1 min-w-0 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 flex-wrap items-center gap-x-3 gap-y-1 text-xs text-[var(--color-text-muted)]",children:l.map((u,h)=>n("span",{class:"flex items-center gap-1",title:u.title,children:[u.icon&&n(u.icon,{class:"w-3 h-3"}),u.value]},`${h}-${u.value}`))})]}),i&&n("div",{class:"flex-shrink-0",children:i})]});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 overflow-hidden",onClick:c,children:d}):n("div",{class:"p-3 rounded-lg bg-[var(--color-bg-secondary)] overflow-hidden",children:d})}function TS(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 ES(e){return new Date(e).getTime()}function Li(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 ${le(e.atMs)}`}}function Zh(e){return e.enabled?e.state.runningAtMs?s("cron.running"):e.state.nextRunAtMs?le(e.state.nextRunAtMs,{relative:!0}):"—":"—"}function IS(e){return e.state.lastRunAtMs?le(e.state.lastRunAtMs,{relative:!0}):"—"}function Qh(e){return e.enabled?e.state.runningAtMs?{variant:"warning",label:s("cron.running")}:e.state.lastStatus==="error"?{variant:"error",label:s("cron.lastFailed")}:e.state.lastStatus==="ok"?{variant:"success",label:s("cron.lastOk")}:{variant:"default",label:s("cron.pending")}:{variant:"default",label:s("cron.disabled")}}function MS(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 RS=[{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"}],DS=[{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 $S({job:e,onRun:t,onToggleEnabled:r,isRunning:a}){return n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[n(K,{icon:n(Lh,{class:"w-4 h-4"}),label:s("cron.runNow"),size:"sm",variant:"ghost",disabled:a,onClick:o=>{o.stopPropagation(),t(e)}}),n(K,{icon:e.enabled?n(Ba,{class:"w-4 h-4"}):n(Ha,{class:"w-4 h-4"}),label:e.enabled?s("cron.disable"):s("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 LS({job:e,onEdit:t}){const r=Qh(e),a=e.delivery?.mode==="announce";return n(Ya,{icon:me,iconVariant:e.enabled?r.variant==="error"?"error":"success":"default",title:e.name,badges:n(G,{children:[a&&n(Dh,{class:"w-3.5 h-3.5 text-[var(--color-info)]","aria-label":s("cron.announces")}),n(Z,{variant:r.variant,size:"sm",children:r.label})]}),meta:[{icon:Pl,value:Li(e.schedule)},{icon:Fg,value:Zh(e)}],onClick:()=>t(e)})}function NS({job:e,onEdit:t,onRun:r,onToggleEnabled:a,isRunning:o}){const l=Qh(e),i=e.delivery?.mode==="announce";return n("tr",{class:"group hover:bg-[var(--color-bg-hover)] cursor-pointer transition-colors",onClick:()=>t(e),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t(e))},tabIndex:0,"aria-label":s("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 flex items-center gap-1.5",title:e.name,children:[e.name,i&&n(Dh,{class:"w-3.5 h-3.5 text-[var(--color-info)] flex-shrink-0","aria-label":s("cron.announces")})]}),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(Pl,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{class:"truncate",title:Li(e.schedule),children:Li(e.schedule)})]})}),n("td",{class:"py-3 px-4",children:n(Z,{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(Fg,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:Zh(e)})]})}),n("td",{class:"py-3 px-4",children:n(Z,{variant:l.variant,size:"sm",children:l.label})}),n("td",{class:"py-3 px-4",children:n($S,{job:e,onRun:r,onToggleEnabled:a,isRunning:o})})]})}function xa({class:e="",fullWidth:t=!1,rows:r=3,error:a=!1,...o}){return n("textarea",{rows:r,class:`
389
- px-3 py-2 text-sm rounded-lg resize-y
390
- bg-[var(--color-bg-primary)]
391
- text-[var(--color-text-primary)]
392
- placeholder:text-[var(--color-text-muted)]
393
- border transition-colors
394
- focus:outline-none focus:ring-2 focus:ring-[var(--color-accent)]/30 focus:border-[var(--color-accent)]
395
- disabled:opacity-50 disabled:cursor-not-allowed
396
- ${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)]"}
397
- ${t?"w-full":""}
398
- ${e}
399
- `,...o})}function OS({label:e,selected:t,onClick:r,title:a,size:o="md"}){return n("button",{type:"button",onClick:r,title:a,class:`
400
- ${o==="sm"?"px-2.5 py-1 text-xs":"px-3 py-1.5 text-sm"} rounded-lg border transition-colors
401
- ${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)]"}
402
- `,children:e})}function Iv({options:e,value:t,onChange:r,size:a="md"}){return n("div",{class:"flex flex-wrap gap-2",children:e.map(o=>n(OS,{label:o.label,selected:t===o.value,onClick:()=>r(o.value),title:String(o.value),size:a},o.value))})}const PS=[{value:"cron",label:s("cron.scheduleKind.cron")},{value:"every",label:s("cron.scheduleKind.every")},{value:"at",label:s("cron.scheduleKind.at")}],FS=[{value:"main",label:s("cron.sessionTarget.main")},{value:"isolated",label:s("cron.sessionTarget.isolated")}],zS=[{value:"next-heartbeat",label:s("cron.wakeMode.nextHeartbeat")},{value:"now",label:s("cron.wakeMode.now")}];function US({editName:e,editDescription:t,editScheduleKind:r,editScheduleExpr:a,editScheduleTz:o,editScheduleEveryMs:l,editScheduleAtMs:i,editSessionTarget:c,editWakeMode:d,editDeliveryAnnounce:u,editPayloadText:h,editPayloadMessage:f,editPayloadModel:v,formErrors:m}){const w=m.value;return n("div",{class:"space-y-4 sm:space-y-5",children:[n(Ie,{label:s("cron.form.name"),error:w.name,children:n(X,{value:e.value,onInput:k=>e.value=k.target.value,placeholder:s("cron.form.namePlaceholder"),error:!!w.name,fullWidth:!0})}),n(Ie,{label:s("cron.form.description"),hint:s("cron.form.descriptionHint"),children:n(X,{value:t.value,onInput:k=>t.value=k.target.value,placeholder:s("cron.form.descriptionPlaceholder"),fullWidth:!0})}),n(Ie,{label:s("cron.form.schedule"),error:w.schedule,children:n("div",{class:"space-y-3",children:[n(Re,{value:r.value,onChange:k=>r.value=k,options:PS}),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(X,{value:a.value,onInput:k=>a.value=k.target.value,placeholder:s("cron.form.cronPlaceholder"),fullWidth:!0}),n(X,{value:o.value,onInput:k=>o.value=k.target.value,placeholder:s("cron.form.timezonePlaceholder"),fullWidth:!0})]}),n(Iv,{options:DS.map(({expr:k,label:T})=>({value:k,label:T})),value:a.value,onChange:k=>a.value=k,size:"sm"})]}),r.value==="every"&&n("div",{class:"space-y-2",children:[n(Iv,{options:RS.map(({ms:k,label:T})=>({value:String(k),label:T})),value:l.value,onChange:k=>l.value=k}),n(X,{type:"number",value:l.value,onInput:k=>l.value=k.target.value,placeholder:s("cron.form.intervalPlaceholder"),fullWidth:!0})]}),r.value==="at"&&n(X,{type:"datetime-local",value:TS(Number(i.value)||Date.now()),onInput:k=>{const T=k.target.value;i.value=String(ES(T))},fullWidth:!0})]})}),n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",children:[n(Ie,{label:s("cron.form.sessionTarget"),hint:s("cron.form.sessionTargetHint"),children:n(Re,{value:c.value,onChange:k=>{c.value=k},options:FS})}),n(Ie,{label:s("cron.form.wakeMode"),hint:s("cron.form.wakeModeHint"),children:n(Re,{value:d.value,onChange:k=>d.value=k,options:zS})})]}),c.value==="isolated"&&n("div",{class:"flex items-center justify-between p-3 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:[n("div",{children:[n("div",{class:"text-sm font-medium",children:s("cron.form.announceResults")}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("cron.form.announceResultsHint")})]}),n($e,{checked:u.value,onChange:k=>u.value=k,label:s("cron.form.announceResults")})]}),n(Ie,{label:s("cron.form.payload"),error:w.payload,hint:c.value==="main"?s("cron.form.payloadHintMain"):s("cron.form.payloadHintIsolated"),children:c.value==="main"?n(xa,{value:h.value,onInput:k=>h.value=k.target.value,placeholder:s("cron.form.systemEventPlaceholder"),error:!!w.payload,rows:3,fullWidth:!0}):n("div",{class:"space-y-3",children:[n(xa,{value:f.value,onInput:k=>f.value=k.target.value,placeholder:s("cron.form.agentMessagePlaceholder"),error:!!w.payload,rows:3,fullWidth:!0}),n(X,{value:v.value,onInput:k=>v.value=k.target.value,placeholder:s("cron.form.modelPlaceholder"),fullWidth:!0})]})})]})}function du({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 jS({mode:e,job:t,runs:r,isLoadingRuns:a,isDeleting:o,isSaving:l,isRunning:i,hasChanges:c,onClose:d,onSave:u,onDelete:h,onRun:f,onSetDeleting:v,editName:m,editDescription:w,editEnabled:k,editScheduleKind:T,editScheduleExpr:A,editScheduleTz:g,editScheduleEveryMs:x,editScheduleAtMs:C,editSessionTarget:b,editWakeMode:S,editDeliveryAnnounce:_,editPayloadText:M,editPayloadMessage:I,editPayloadModel:F,formErrors:D}){if(!e)return null;const Y=e==="edit",Ue=t?Qh(t):null;return n(ze,{open:!!e,onClose:d,title:Y&&t?t.name:s("cron.createJob"),size:"xl",footer:o?n(Eb,{message:s("cron.confirmDelete"),onCancel:()=>v(!1),onDelete:h}):n(Ib,{isEdit:Y&&!!t,onDeleteClick:()=>v(!0),onCancel:d,onSave:u,isSaving:l,saveDisabled:!c,saveLabel:s(Y?"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:k.value?s("cron.enabled"):s("cron.disabled")}),n($e,{checked:k.value,onChange:fe=>k.value=fe})]})}),children:n("div",{class:"space-y-4 sm:space-y-6",children:[Y&&t&&Ue&&n(G,{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(Z,{variant:Ue.variant,size:"sm",children:Ue.label}),n(Z,{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:Li(t.schedule)})]})]}),n(P,{size:"sm",variant:"secondary",icon:n(Lh,{class:"w-4 h-4"}),onClick:()=>f(t),disabled:i,fullWidth:!0,class:"sm:w-auto",children:s("cron.runNow")})]}),n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(du,{value:Zh(t),label:s("cron.nextRun")}),n(du,{value:IS(t),label:s("cron.lastRun")}),n(du,{value:t.state.lastDurationMs?`${Math.round(t.state.lastDurationMs/1e3)}s`:"—",label:s("cron.lastDuration")})]})]}),n(US,{editName:m,editDescription:w,editScheduleKind:T,editScheduleExpr:A,editScheduleTz:g,editScheduleEveryMs:x,editScheduleAtMs:C,editSessionTarget:b,editWakeMode:S,editDeliveryAnnounce:_,editPayloadText:M,editPayloadMessage:I,editPayloadModel:F,formErrors:D}),Y&&n("div",{children:[n("h4",{class:"text-sm font-medium mb-3",children:s("cron.recentRuns")}),a?n("div",{class:"flex justify-center py-4",children:n(te,{size:"sm"})}):r.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] text-center py-4",children:s("cron.noRuns")}):n("div",{class:"space-y-2 max-h-48 overflow-y-auto",children:r.map(fe=>n("div",{class:"flex items-center gap-3 p-2 rounded-lg bg-[var(--color-bg-secondary)] text-sm",children:[fe.status==="ok"?n(Ha,{class:"w-4 h-4 text-[var(--color-success)]"}):fe.status==="error"?n(Ba,{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:le(fe.runAtMs)}),fe.durationMs&&n("span",{class:"text-[var(--color-text-muted)]",children:[Math.round(fe.durationMs/1e3),"s"]}),fe.error&&n("span",{class:"text-[var(--color-error)] truncate max-w-[200px]",title:fe.error,children:fe.error})]},fe.runAtMs))})]})]})})}const Qn=p([]),Mb=p(null),pd=p(!1),Ir=p(null),Rb=p(""),vd=p("all"),Tc=p(null),er=p(null),hl=p([]),md=p(!1),Db=p(!1),gd=p(!1),bd=p(!1),Mr=p(""),ya=p(""),wa=p(!0),Ot=p("cron"),Rr=p(""),ka=p(""),_a=p(""),Sa=p(""),Ca=p("next-heartbeat"),sn=p("main"),Aa=p(!1),Ta=p(""),Ea=p(""),Ia=p(""),Ec=p({}),HS=W(()=>{let e=Qn.value;vd.value==="enabled"?e=e.filter(r=>r.enabled):vd.value==="disabled"&&(e=e.filter(r=>!r.enabled));const t=Rb.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})}),BS=W(()=>{const e={total:0,enabled:0,disabled:0};for(const t of Qn.value)e.total++,t.enabled?e.enabled++:e.disabled++;return e});async function Ni(){pd.value=!0,Ir.value=null;const[e,t]=await Promise.allSettled([N("cron.status",{}),N("cron.list",{includeDisabled:!0})]);e.status==="fulfilled"&&(Mb.value=e.value),t.status==="fulfilled"&&(Qn.value=t.value.jobs??[]);const r=[];e.status==="rejected"&&r.push(`Status: ${ne(e.reason)}`),t.status==="rejected"&&r.push(`Jobs: ${ne(t.reason)}`),r.length>0&&(Ir.value=r.join("; ")),pd.value=!1}async function WS(e){md.value=!0;try{const t=await N("cron.runs",{jobId:e,limit:20});hl.value=t.entries??[]}catch{hl.value=[]}finally{md.value=!1}}function KS(e){Mr.value=e.name,ya.value=e.description??"",wa.value=e.enabled,Ot.value=e.schedule.kind,e.schedule.kind==="cron"?(Rr.value=e.schedule.expr,ka.value=e.schedule.tz??""):e.schedule.kind==="every"?_a.value=String(e.schedule.everyMs):e.schedule.kind==="at"&&(Sa.value=String(e.schedule.atMs)),Ca.value=e.wakeMode,sn.value=e.sessionTarget,Aa.value=e.delivery?.mode==="announce",e.payload.kind==="systemEvent"?Ta.value=e.payload.text:(Ea.value=e.payload.message,Ia.value=e.payload.model??""),Ec.value={}}function qS(){Mr.value="",ya.value="",wa.value=!0,Ot.value="cron",Rr.value="",ka.value="",_a.value="",Sa.value="",Ca.value="next-heartbeat",sn.value="main",Aa.value=!1,Ta.value="",Ea.value="",Ia.value="",Ec.value={}}function GS(e,t){e==="edit"&&t?(er.value=t,KS(t),WS(t.id)):(er.value=null,qS(),hl.value=[]),Tc.value=e}function ef(){Tc.value=null,er.value=null,hl.value=[],Db.value=!1}function VS(){const e={};if(Mr.value.trim()||(e.name=s("cron.validation.nameRequired")),Ot.value==="cron")Rr.value.trim()?MS(Rr.value)||(e.schedule=s("cron.validation.cronInvalid")):e.schedule=s("cron.validation.cronRequired");else if(Ot.value==="every"){const t=parseInt(_a.value,10);(!t||t<1e3)&&(e.schedule=s("cron.validation.intervalMin"))}else if(Ot.value==="at"){const t=parseInt(Sa.value,10);(!t||t<Date.now())&&(e.schedule=s("cron.validation.atFuture"))}return sn.value==="main"?Ta.value.trim()||(e.payload=s("cron.validation.payloadRequired")):Ea.value.trim()||(e.payload=s("cron.validation.payloadRequired")),Ec.value=e,Object.keys(e).length===0}function Mv(){switch(Ot.value){case"cron":return{kind:"cron",expr:Rr.value,...ka.value?{tz:ka.value}:{}};case"every":return{kind:"every",everyMs:parseInt(_a.value,10)||6e4};case"at":return{kind:"at",atMs:parseInt(Sa.value,10)||Date.now()}}}function Rv(){return sn.value==="main"?{kind:"systemEvent",text:Ta.value}:{kind:"agentTurn",message:Ea.value,...Ia.value?{model:Ia.value}:{}}}async function YS(){if(VS()){gd.value=!0;try{if(Tc.value==="edit"&&er.value){const e={name:Mr.value,description:ya.value||void 0,enabled:wa.value,schedule:Mv(),sessionTarget:sn.value,wakeMode:Ca.value,payload:Rv(),delivery:{mode:Aa.value?"announce":"none"}};await N("cron.update",{jobId:er.value.id,patch:e})}else{const e={name:Mr.value,description:ya.value||void 0,enabled:wa.value,schedule:Mv(),sessionTarget:sn.value,wakeMode:Ca.value,payload:Rv(),delivery:{mode:Aa.value?"announce":"none"}};await N("cron.add",{job:e})}await Ni(),ef()}catch(e){Ir.value=ne(e)}finally{gd.value=!1}}}async function JS(){const e=er.value;if(e)try{await N("cron.remove",{jobId:e.id}),Qn.value=Qn.value.filter(t=>t.id!==e.id),ef()}catch(t){Ir.value=ne(t)}}async function XS(e){bd.value=!0;try{await N("cron.run",{jobId:e.id,mode:"force"}),await Ni()}catch(t){Ir.value=ne(t)}finally{bd.value=!1}}async function ZS(e){try{await N("cron.update",{jobId:e.id,patch:{enabled:!e.enabled}}),Qn.value=Qn.value.map(t=>t.id===e.id?{...t,enabled:!t.enabled}:t)}catch(t){Ir.value=ne(t)}}function QS(){O(()=>{L.value&&Ni()},[L.value]);const e=oc(()=>{const t=er.value;if(!t||Mr.value!==t.name||ya.value!==(t.description??"")||wa.value!==t.enabled||Ot.value!==t.schedule.kind||Ca.value!==t.wakeMode||sn.value!==t.sessionTarget||Aa.value!==(t.delivery?.mode==="announce"))return!0;if(t.schedule.kind==="cron"&&Ot.value==="cron"){if(Rr.value!==t.schedule.expr||ka.value!==(t.schedule.tz??""))return!0}else if(t.schedule.kind==="every"&&Ot.value==="every"){if(_a.value!==String(t.schedule.everyMs))return!0}else if(t.schedule.kind==="at"&&Ot.value==="at"&&Sa.value!==String(t.schedule.atMs))return!0;if(t.payload.kind==="systemEvent"&&sn.value==="main"){if(Ta.value!==t.payload.text)return!0}else if(t.payload.kind==="agentTurn"&&sn.value==="isolated"&&(Ea.value!==t.payload.message||Ia.value!==(t.payload.model??"")))return!0;return!1});return{state:{cronJobs:Qn,cronStatus:Mb,isLoading:pd,error:Ir,searchQuery:Rb,statusFilter:vd},modal:{modalMode:Tc,selectedJob:er,selectedJobRuns:hl,isLoadingRuns:md,isDeleting:Db,isSaving:gd,isRunning:bd},form:{editName:Mr,editDescription:ya,editEnabled:wa,editScheduleKind:Ot,editScheduleExpr:Rr,editScheduleTz:ka,editScheduleEveryMs:_a,editScheduleAtMs:Sa,editWakeMode:Ca,editSessionTarget:sn,editDeliveryAnnounce:Aa,editPayloadText:Ta,editPayloadMessage:Ea,editPayloadModel:Ia,formErrors:Ec},computed:{filteredJobs:HS,jobCounts:BS,hasFormChanges:e},actions:{loadCronJobs:Ni,openJobModal:GS,closeModal:ef,saveOrCreateJob:YS,deleteJob:JS,runJobNow:XS,toggleJobEnabled:ZS}}}function e5(e){const{state:t,modal:r,form:a,computed:o,actions:l}=QS(),i=o.jobCounts.value;return n(Kt,{viewName:s("nav.cron"),children:[n(Mt,{title:s("cron.title"),subtitle:s("cron.description"),actions:n(G,{children:[L.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&n("div",{class:"relative hidden sm:block",children:[n(Ke,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(X,{type:"text",value:t.searchQuery.value,onInput:c=>t.searchQuery.value=c.target.value,placeholder:s("cron.searchPlaceholder"),"aria-label":s("cron.searchPlaceholder"),class:"pl-10 w-64"})]}),n(P,{icon:n(Zn,{class:"w-4 h-4"}),onClick:()=>l.openJobModal("create"),disabled:!L.value,children:[n("span",{class:"hidden sm:inline",children:s("cron.createJob")}),n("span",{class:"sm:hidden",children:s("actions.new")})]}),n(K,{icon:n(Fe,{class:`w-4 h-4 ${t.isLoading.value?"animate-spin":""}`}),label:s("actions.refresh"),onClick:l.loadCronJobs,disabled:t.isLoading.value||!L.value,variant:"ghost"})]})}),L.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&n("div",{class:"relative sm:hidden",children:[n(Ke,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(X,{type:"text",value:t.searchQuery.value,onInput:c=>t.searchQuery.value=c.target.value,placeholder:s("cron.searchPlaceholder"),"aria-label":s("cron.searchPlaceholder"),class:"pl-10",fullWidth:!0})]}),L.value&&!t.isLoading.value&&n("div",{class:"grid grid-cols-2 sm:grid-cols-4 gap-2 sm:gap-4",children:[n(ve,{icon:me,label:s("cron.stats.total"),value:i.total,active:t.statusFilter.value==="all",onClick:()=>t.statusFilter.value="all"}),n(ve,{icon:Ha,label:s("cron.stats.enabled"),value:i.enabled,active:t.statusFilter.value==="enabled",onClick:()=>t.statusFilter.value="enabled"}),n(ve,{icon:Ba,label:s("cron.stats.disabled"),value:i.disabled,active:t.statusFilter.value==="disabled",onClick:()=>t.statusFilter.value="disabled"}),n(ve,{icon:fn,label:s("cron.stats.nextWake"),value:t.cronStatus.value?.nextWakeAtMs?le(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||!L.value)&&n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:L.value?void 0:s("status.connecting")})}),L.value&&!t.isLoading.value&&o.filteredJobs.value.length>0&&n(G,{children:[n("div",{class:"md:hidden space-y-2",children:o.filteredJobs.value.map(c=>n(LS,{job:c,onEdit:l.openJobModal.bind(null,"edit")},c.id))}),n(q,{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:s("cron.columns.job")}),n("th",{class:"py-3 px-4 font-medium w-40",children:s("cron.columns.schedule")}),n("th",{class:"py-3 px-4 font-medium w-24",children:s("cron.columns.target")}),n("th",{class:"py-3 px-4 font-medium w-32",children:s("cron.columns.nextRun")}),n("th",{class:"py-3 px-4 font-medium w-24",children:s("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(NS,{job:c,onEdit:l.openJobModal.bind(null,"edit"),onRun:l.runJobNow,onToggleEnabled:l.toggleJobEnabled,isRunning:r.isRunning.value},c.id))})]})})]}),L.value&&!t.isLoading.value&&t.cronJobs.value.length===0&&!t.error.value&&n(q,{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:s("cron.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:s("cron.emptyDescription")}),n(P,{icon:n(Zn,{class:"w-4 h-4"}),onClick:()=>l.openJobModal("create"),children:s("cron.createJob")})]})}),L.value&&!t.isLoading.value&&t.cronJobs.value.length>0&&o.filteredJobs.value.length===0&&n(q,{children:n("div",{class:"p-12 text-center",children:[n(Ke,{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:s("cron.noResults")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:s("cron.noResultsDescription")}),n(P,{variant:"secondary",size:"sm",onClick:()=>{t.searchQuery.value="",t.statusFilter.value="all"},children:s("cron.clearFilters")})]})}),L.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?s("cron.count",{count:t.cronJobs.value.length}):s("cron.filteredCount",{filtered:o.filteredJobs.value.length,total:t.cronJobs.value.length})}),n(jS,{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,editDeliveryAnnounce:a.editDeliveryAnnounce,editPayloadText:a.editPayloadText,editPayloadMessage:a.editPayloadMessage,editPayloadModel:a.editPayloadModel,formErrors:a.formErrors})]})}const t5={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 An({title:e,children:t,items:r,variant:a="info",class:o}){return n("div",{class:`
403
- p-3 rounded-lg text-xs
404
- ${t5[a]}
405
- ${o||""}
406
- `,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,i)=>n("li",{children:l},i))}):t]})}function $b(e){return e.join(".")}function n5(e,t,r){if(t.length===0)return e;const a={...e};let o=a;for(let i=0;i<t.length-1;i++){const c=t[i],d=o[c];d==null||typeof d!="object"?o[c]=typeof t[i+1]=="number"?[]:{}:o[c]=Array.isArray(d)?[...d]:{...d},o=o[c]}const l=t[t.length-1];return r===void 0?delete o[l]:o[l]=r,a}function Lb(e,t){if(!e||t.length===0)return e??null;let r=e;for(const a of t){if(!r)return null;typeof a=="number"?r=r.items:r=r.properties?.[a]}return r??null}function r5(e,t){if(t.length===0)return e;let r=e;for(const a of t){if(r==null)return;r=r[a]}return r}function ql(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 ql(r[0])}return null}function a5(e){if(e.default!==void 0)return e.default;if(e.const!==void 0)return e.const;switch(ql(e)){case"boolean":return!1;case"number":case"integer":return 0;case"string":return"";case"array":return[];case"object":return{};default:return}}function o5(e,t){const r=$b(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 l5=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 Dr(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 l5.has(r)?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}).join(" ")}function Gs(e,t){const r=ql(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 s("config.validation.mustBeString");if(t.minLength&&e.length<t.minLength)return s("config.validation.minLength",{min:t.minLength});if(t.maxLength&&e.length>t.maxLength)return s("config.validation.maxLength",{max:t.maxLength});if(t.pattern&&!new RegExp(t.pattern).test(e))return s("config.validation.invalidFormat");break;case"number":case"integer":if(typeof e!="number")return s("config.validation.mustBeNumber");if(t.minimum!==void 0&&e<t.minimum)return s("config.validation.minimum",{min:t.minimum});if(t.maximum!==void 0&&e>t.maximum)return s("config.validation.maximum",{max:t.maximum});if(r==="integer"&&!Number.isInteger(e))return s("config.validation.mustBeInteger");break;case"boolean":if(typeof e!="boolean")return s("config.validation.mustBeBoolean");break;case"array":if(!Array.isArray(e))return s("config.validation.mustBeArray");if(t.minItems&&e.length<t.minItems)return s("config.validation.minItems",{min:t.minItems});if(t.maxItems&&e.length>t.maxItems)return s("config.validation.maxItems",{max:t.maxItems});break;case"object":if(typeof e!="object"||Array.isArray(e))return s("config.validation.mustBeObject");break}return t.enum&&!t.enum.includes(e)?s("config.validation.invalidOption"):null}const Nn=p(!1),ut=p(null),fl=p(!1),xn=p(null),Br=p({}),pl=p({}),Pt=p({}),Vs=p(null),Nb=p(null),Ob=p(!1),s5=p(!0),i5=p(null),hu=p(""),Ma=p({}),Ys=W(()=>JSON.stringify(pl.value)!==JSON.stringify(Pt.value)),xd=W(()=>Ys.value&&!fl.value&&Object.keys(Ma.value).length===0);async function Dv(){Nn.value=!0,ut.value=null;try{const[e,t]=await Promise.all([N("config.get",{}),N("config.schema",{})]);xn.value=t.schema,Br.value=t.uiHints,i5.value=t.version,pl.value=e.config,Pt.value=structuredClone(e.config),Vs.value=e.hash??null,Nb.value=e.path??null,Ob.value=e.exists,s5.value=e.valid,Ma.value={}}catch(e){ut.value=ne(e)}finally{Nn.value=!1}}function vt(e,t){Pt.value=n5(Pt.value,e,t)}function c5(){Pt.value=structuredClone(pl.value),Ma.value={}}function Js(e,t){const r={...Ma.value};t?r[e]=t:delete r[e],Ma.value=r}async function u5(){if(!xd.value)return!1;if(!Vs.value&&Ob.value)return ut.value="Missing base hash. Reload and try again.",!1;fl.value=!0,ut.value=null;try{const e=Pb(pl.value,Pt.value),t=await N("config.patch",{raw:JSON.stringify(e),baseHash:Vs.value});if(t.ok){pl.value=t.config,Pt.value=structuredClone(t.config),Nb.value=t.path;const r=await N("config.get",{});return Vs.value=r.hash??null,!0}else return ut.value="Failed to save configuration",!1}catch(e){const t=ne(e);return t.includes("hash")||t.includes("changed")?ut.value="Configuration was modified externally. Please reload.":ut.value=t,!1}finally{fl.value=!1}}function Pb(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]=Pb(o,l):r[a]=l)}for(const a of Object.keys(e))a in t||(r[a]=null);return r}function d5(e){return e.properties?Object.values(e.properties).some(t=>!tf(t)):!1}function tf(e){return e.type==="array"&&e.items?.properties?!0:e.type==="object"&&e.properties?Object.keys(e.properties).length>=2:!1}function yd(e,t,r,a=[],o=0){if(!e.properties)return[];const l=[];for(const[i,c]of Object.entries(e.properties)){const d=[...a,i],h=(r[i]??r[d.join(".")]??{}).label??c.title??Dr(i);if(o>0&&!tf(c))continue;const f={key:i,label:h,path:d,schema:c};if(c.type==="object"&&c.properties){const v=t[i]??{};f.children=yd(c,v,r,d,o+1),f.children.length===0&&delete f.children}if(c.type==="array"&&c.items?.properties){const v=t[i]??[];f.children=v.map((m,w)=>{const k=m,T=k.identity,A=k.id??k.name??k.label??`#${w+1}`,g=T?.emoji??"";return{key:String(w),label:g?`${g} ${A}`:String(A),path:[...d,w],schema:c.items}})}l.push(f)}return l.sort((i,c)=>{const d=r[i.key]?.order??100,u=r[c.key]?.order??100;return d-u}),l}const nf={gateway:Bt,agents:Cg,channels:Si,tools:Ug,commands:ak,session:jn,cron:me,skills:kc,plugins:Nh,logging:Ht,auth:Ap,models:Sp,wizard:sk,update:jt,diagnostics:Kn,nodeHost:Tr,audio:lk,messages:dn,bindings:Dg,ui:Z2,browser:Nt,hooks:ik,web:Bt,canvas:na,canvasHost:na,approvals:wc,notifications:Dh,meta:Ht,env:Cp,nodes:Tr,broadcast:Si,media:na,network:Qc,secrets:xc,memory:ki,memorySearch:ki,storage:Cp,tls:Ap,remote:Qc,reload:Fe,tailscale:Qc,sandbox:Sp,context:nd,contextPruning:nd,compaction:fn,heartbeat:Kn,defaults:Ph},Fb=z2;function zb({item:e,depth:t=0,selectedPath:r,expandedNav:a}){const o=e.path.join("."),l=a.value.has(o),i=r.value.join(".")===o||r.value.join(".").startsWith(o+"."),c=e.children&&e.children.length>0,d=t===0?nf[e.key]??Fb:void 0,u=()=>{r.value=e.path},h=v=>{v.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":i?"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:u,children:[c?n("button",{type:"button",class:"p-0.5 -ml-1 hover:bg-[var(--color-bg-primary)]/20 rounded",onClick:h,"aria-label":s(l?"accessibility.collapseSection":"accessibility.expandSection"),children:l?n(Oe,{class:"w-3.5 h-3.5"}):n(rt,{class:"w-3.5 h-3.5"})}):n("span",{class:"w-4"}),d&&n(d,{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(v=>n(zb,{item:v,depth:t+1,selectedPath:r,expandedNav:a},v.key))]})]})}function _n({label:e,description:t,error:r,inline:a,children:o}){return a&&e?n("div",{class:"py-3",children:[n("div",{class:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between sm:gap-8",children:[n("div",{class:"min-w-0 sm: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:"w-full sm:w-auto sm: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 h5({value:e,placeholder:t,onChange:r,wide:a}){const[o,l]=U(!1);return n("div",{class:"relative",children:[n(X,{type:o?"text":"password",value:e,placeholder:t,onInput:i=>r(i.target.value),class:`pr-10 w-full ${a?"sm:w-72":"sm: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":s(o?"config.field.hidePassword":"config.field.showPassword"),children:o?n(Eg,{class:"w-4 h-4"}):n($h,{class:"w-4 h-4"})})]})}function Ub({value:e,onChange:t}){const[r,a]=U(()=>JSON.stringify(e,null,2)??""),[o,l]=U(null);return n("div",{class:"space-y-1",children:[n(xa,{value:r,onInput:c=>a(c.target.value),onBlur:()=>{try{const c=JSON.parse(r);t(c),l(null)}catch{l(s("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 f5({schema:e,value:t,path:r,hints:a,level:o,label:l,help:i,isDetailView:c=!1,skipNavWorthy:d=!1}){const[u,h]=U(o<2||c),f=e.properties??{},v=Object.keys(f).filter(w=>{if(!d)return!0;const k=f[w];return!tf(k)}),m=t??{};return c&&o===0?v.length===0?n("div",{class:"text-sm text-[var(--color-text-muted)] py-4",children:s("config.noSettingsAtLevel")}):n("div",{class:"space-y-2",children:[i&&n("p",{class:"text-sm text-[var(--color-text-muted)] mb-4",children:i}),v.map(w=>n(oa,{schema:f[w],value:m[w],path:[...r,w],hints:a,level:o+1,skipNavWorthy:d},w))]}):n("div",{class:"mt-6 first:mt-3",children:[n("div",{class:"md:hidden",children:n("div",{class:"rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)] overflow-hidden",children:[n("div",{class:"px-4 py-3 bg-[var(--color-bg-secondary)] border-b border-[var(--color-border)]",children:[n("span",{class:"text-sm font-semibold text-[var(--color-text-primary)]",children:l}),i&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-1 leading-relaxed",children:i})]}),n("div",{class:"px-4 py-2",children:v.map(w=>n(oa,{schema:f[w],value:m[w],path:[...r,w],hints:a,level:o+1,skipNavWorthy:d},w))})]})}),n("div",{class:"hidden md:block",children:[n("button",{type:"button",class:"flex items-center gap-2 py-2 text-left group",onClick:()=>h(!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(Oe,{class:"w-4 h-4"}):n(rt,{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:["(",v.length,")"]})]}),u&&n("div",{class:"ml-6 pl-4 border-l border-[var(--color-border)] mt-1",children:[i&&n("p",{class:"text-xs text-[var(--color-text-muted)] pb-2 leading-relaxed",children:i}),v.map(w=>n(oa,{schema:f[w],value:m[w],path:[...r,w],hints:a,level:o+1,skipNavWorthy:d},w))]})]})]})}function p5({schema:e,value:t,path:r,hints:a,level:o,label:l,help:i}){const[c,d]=U(o<2),u=t??[],h=e.items??{},f=ql(h),v=()=>{const k=a5(h);vt(r,[...u,k])},m=k=>{const T=u.filter((A,g)=>g!==k);vt(r,T)},w=(k,T)=>{const A=[...u],[g]=A.splice(k,1);A.splice(T,0,g),vt(r,A)};return f==="string"||f==="number"?n("div",{class:"mt-6 first:mt-3",children:[n("div",{class:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-3",children:[n("div",{children:[n("label",{class:"text-sm font-semibold text-[var(--color-text-primary)]",children:l}),i&&n("p",{class:"text-xs text-[var(--color-text-muted)] mt-1 leading-relaxed",children:i})]}),n(P,{variant:"secondary",size:"sm",icon:Zn,onClick:v,fullWidth:!0,class:"sm:w-auto",children:s("config.field.addItem")})]}),n("div",{class:"space-y-2 w-full",children:[u.map((k,T)=>n("div",{class:"flex items-center gap-1 p-2 rounded-lg border border-[var(--color-border)] bg-[var(--color-bg-surface)]",children:[u.length>1&&n("div",{class:"flex flex-col sm:hidden",children:[n("button",{type:"button",class:"p-2 text-[var(--color-text-muted)] active:text-[var(--color-text-primary)] disabled:opacity-30",onClick:()=>T>0&&w(T,T-1),disabled:T===0,"aria-label":s("config.field.moveUp"),children:n(mc,{class:"w-4 h-4"})}),n("button",{type:"button",class:"p-2 text-[var(--color-text-muted)] active:text-[var(--color-text-primary)] disabled:opacity-30",onClick:()=>T<u.length-1&&w(T,T+1),disabled:T===u.length-1,"aria-label":s("config.field.moveDown"),children:n(Oe,{class:"w-4 h-4"})})]}),u.length>1&&n("div",{class:"hidden sm:block p-1 cursor-grab text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]",title:s("config.field.dragToReorder"),children:n(Ig,{class:"w-4 h-4"})}),n(X,{type:f==="number"?"number":"text",value:String(k??""),onInput:A=>{const g=A.target.value,x=[...u];x[T]=f==="number"?Number(g):g,vt(r,x)},fullWidth:!0}),n(K,{icon:n(Et,{class:"w-5 h-5 sm:w-4 sm:h-4"}),label:s("config.field.removeItem"),onClick:()=>m(T),size:"md",variant:"ghost",class:"!p-2.5 sm:!p-1.5 flex-shrink-0"})]},T)),u.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:s("config.field.noItems")})]})]}):n("div",{class:"mt-6 first:mt-3",children:[n("div",{class:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-3",children:[n("button",{type:"button",class:"flex items-center gap-2 group",onClick:()=>d(!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(Oe,{class:"w-4 h-4"}):n(rt,{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:["(",u.length,")"]})]}),n(P,{variant:"secondary",size:"sm",icon:Zn,onClick:v,fullWidth:!0,class:"sm:w-auto",children:s("config.field.addItem")})]}),i&&n("p",{class:"text-xs text-[var(--color-text-muted)] mb-3 leading-relaxed",children:i}),c&&n("div",{class:"space-y-3",children:u.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:s("config.field.noItems")}):u.map((k,T)=>n(v5,{schema:h,value:k,path:[...r,T],parentPath:r,hints:a,level:o+1,index:T,totalItems:u.length,onRemove:()=>m(T),onReorder:w},T))})]})}function v5({schema:e,value:t,path:r,parentPath:a,hints:o,level:l,index:i,totalItems:c,onRemove:d,onReorder:u}){const[h,f]=U(!1),[v,m]=U(!1),[w,k]=U(!1),T=t??{},A=T.id??T.name??T.label??T.displayName??`#${i+1}`,x=T.identity?.emoji??"",C=I=>{m(!0),I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/plain",JSON.stringify({path:a.join("."),index:i}))},b=()=>{m(!1)},S=I=>{I.preventDefault(),I.dataTransfer.dropEffect="move",k(!0)},_=()=>{k(!1)},M=I=>{I.preventDefault(),k(!1);try{const F=JSON.parse(I.dataTransfer.getData("text/plain"));F.path===a.join(".")&&F.index!==i&&u(F.index,i)}catch{}};return n(q,{padding:"none",class:`overflow-hidden transition-all ${v?"opacity-50":""} ${w?"ring-2 ring-[var(--color-accent)]":""}`,draggable:c>1,onDragStart:C,onDragEnd:b,onDragOver:S,onDragLeave:_,onDrop:M,children:[n("div",{class:"flex items-center gap-1 sm:gap-2 px-2 sm:px-3 py-2 sm:py-3 select-none",children:[c>1&&n("div",{class:"flex flex-col sm:hidden",children:[n("button",{type:"button",class:"p-3 -m-1 text-[var(--color-text-muted)] active:text-[var(--color-text-primary)] active:bg-[var(--color-bg-hover)] rounded disabled:opacity-30",onClick:()=>i>0&&u(i,i-1),disabled:i===0,"aria-label":s("config.field.moveUp"),children:n(mc,{class:"w-5 h-5"})}),n("button",{type:"button",class:"p-3 -m-1 text-[var(--color-text-muted)] active:text-[var(--color-text-primary)] active:bg-[var(--color-bg-hover)] rounded disabled:opacity-30",onClick:()=>i<c-1&&u(i,i+1),disabled:i===c-1,"aria-label":s("config.field.moveDown"),children:n(Oe,{class:"w-5 h-5"})})]}),c>1&&n("div",{class:"hidden sm:block p-1 cursor-grab text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] active:cursor-grabbing",title:s("config.field.dragToReorder"),children:n(Ig,{class:"w-4 h-4"})}),n("button",{type:"button",class:"flex-1 flex items-center gap-2 text-left group min-h-[44px] sm:min-h-0",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(Oe,{class:"w-4 h-4"}):n(rt,{class:"w-4 h-4"})}),x&&n("span",{children:x}),n("span",{class:"text-sm font-medium",children:String(A)})]}),n(K,{icon:n(Et,{class:"w-5 h-5 sm:w-4 sm:h-4"}),label:s("config.field.removeItem"),onClick:d,size:"md",variant:"ghost",class:"!p-2.5 sm:!p-1.5"})]}),h&&n("div",{class:"px-4 pb-4 border-t border-[var(--color-border)]",children:n(oa,{schema:e,value:t,path:r,hints:o,level:l,showLabel:!1,isDetailView:!0})})]})}function m5({schema:e,value:t,path:r,hints:a,level:o,label:l,help:i,showLabel:c}){const u=(e.anyOf??e.oneOf??[]).filter(f=>f.type!=="null"&&!(Array.isArray(f.type)&&f.type.includes("null")));if(u.length===1)return n(oa,{schema:u[0],value:t,path:r,hints:a,level:o,showLabel:c});const h=u.map(f=>f.const??(f.enum?.length===1?f.enum[0]:void 0)).filter(f=>f!==void 0);if(h.length===u.length&&h.length>0){const f=u.map((v,m)=>({value:String(h[m]),label:v.title??Dr(String(h[m]))}));return n(_n,{label:c!==!1?l:void 0,description:i,inline:c!==!1,children:n(Re,{value:String(t??""),options:f,onChange:v=>vt(r,v),size:"sm",class:"w-full sm:w-auto sm:inline-block"})})}return n(_n,{label:c!==!1?l:void 0,description:i,children:n(Ub,{value:t,onChange:f=>vt(r,f)})})}function oa({schema:e,value:t,path:r,hints:a,level:o=0,showLabel:l=!0,isDetailView:i=!1,skipNavWorthy:c=!1}){const d=ql(e),u=o5(r,a)??{},h=$b(r),f=u.label??e.title??Dr(r[r.length-1]??""),v=u.help??e.description,m=Ma.value[h];if(e.anyOf||e.oneOf)return n(m5,{schema:e,value:t,path:r,hints:a,level:o,label:f,help:v,showLabel:l});switch(d){case"object":return n(f5,{schema:e,value:t,path:r,hints:a,level:o,label:f,help:v,isDetailView:i,skipNavWorthy:c});case"array":return n(p5,{schema:e,value:t,path:r,hints:a,level:o,label:f,help:v});case"boolean":return n(_n,{error:m,children:n($e,{checked:!!(t??e.default),onChange:w=>{vt(r,w)},label:l?f:void 0,description:v})});case"number":case"integer":return n(_n,{label:l?f:void 0,description:v,error:m,inline:!0,children:n(X,{type:"number",value:t==null?"":String(t),placeholder:u.placeholder,onInput:w=>{const k=w.target.value,T=k===""?void 0:Number(k);vt(r,T),Js(h,Gs(T,e))},min:e.minimum,max:e.maximum,class:"w-full sm:w-24 text-right"})});case"string":return g5({schema:e,value:t,path:r,hint:u,key:h,label:f,help:v,errorMsg:m,showLabel:l});default:return n(_n,{label:l?f:void 0,description:v,error:m,children:n(Ub,{value:t,onChange:w=>vt(r,w)})})}}function g5({schema:e,value:t,path:r,hint:a,key:o,label:l,help:i,errorMsg:c,showLabel:d}){if(e.enum)return n(_n,{label:d?l:void 0,description:i,error:c,inline:!0,children:n(Re,{value:String(t??""),options:e.enum.map(v=>({value:String(v),label:Dr(String(v))})),onChange:v=>vt(r,v),size:"sm",class:"w-full sm:w-auto sm:inline-block"})});if(a.sensitive)return n(_n,{label:d?l:void 0,description:i,error:c,inline:!0,children:n(h5,{value:String(t??""),placeholder:a.placeholder,onChange:v=>{vt(r,v),Js(o,Gs(v,e))},wide:!0})});if((e.maxLength??0)>200)return n(_n,{label:d?l:void 0,description:i,error:c,children:n(xa,{value:String(t??""),placeholder:a.placeholder,onInput:v=>{const m=v.target.value;vt(r,m),Js(o,Gs(m,e))},rows:4,class:"w-full"})});const u=e.format==="uri"||e.format==="url",h=o.toLowerCase().includes("path")||o.toLowerCase().includes("dir")||o.toLowerCase().includes("file"),f=u||h?"w-full sm:w-72":"w-full sm:w-48";return n(_n,{label:d?l:void 0,description:i,error:c,inline:!0,children:n(X,{type:u?"url":"text",value:String(t??""),placeholder:a.placeholder,onInput:v=>{const m=v.target.value;vt(r,m),Js(o,Gs(m,e))},class:f})})}function $v({selectedPath:e,schema:t,draftConfig:r,uiHints:a,skipNavWorthy:o=!1}){const l=e.value,i=t.value,c=r.value,d=a.value;if(!i||l.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(Ph,{class:"w-12 h-12 mx-auto mb-4 opacity-50"}),n("p",{children:s("config.selectSection")})]})});const u=Lb(i,l),h=r5(c,l);if(!u)return n("div",{class:"flex-1 p-6 text-[var(--color-text-muted)]",children:n("p",{children:s("config.schemaNotFound",{path:l.join(" › ")})})});const f=l.map((x,C)=>{const b=l.slice(0,C+1);return d[b.join(".")]?.label??Dr(x)}),v=f[f.length-1],m=f.slice(0,-1),w=l.join("."),T=d[w]?.help??u.description,A=String(l[0]),g=nf[A];return n("div",{class:"flex-1 overflow-y-auto",children:[n("div",{class:"hidden md:block px-4 sm:px-8 pt-4 sm:pt-6 pb-3 sm:pb-4 border-b border-[var(--color-border)] bg-[var(--color-bg-primary)]",children:[m.length>0&&n("div",{class:"text-xs text-[var(--color-text-muted)] mb-1.5",children:m.join(" › ")}),n("div",{class:"flex items-center gap-3",children:[g&&l.length===1&&n(g,{class:"w-6 h-6 text-[var(--color-accent)] opacity-80"}),n("h2",{class:"text-xl font-semibold text-[var(--color-text-primary)]",children:v})]}),T&&n("p",{class:"text-sm text-[var(--color-text-muted)] mt-2 max-w-2xl leading-relaxed",children:T})]}),T&&n("div",{class:"md:hidden px-4 pt-3 pb-2 border-b border-[var(--color-border)] bg-[var(--color-bg-primary)]",children:n("p",{class:"text-sm text-[var(--color-text-muted)] leading-relaxed",children:T})}),n("div",{class:"px-4 sm:px-8 py-4 sm:py-6 max-w-4xl",children:n(oa,{schema:u,value:h,path:l,hints:d,level:0,showLabel:!1,isDetailView:!0,skipNavWorthy:o})})]})}function b5({selectedPath:e,uiHints:t,isDirty:r,canSave:a,isSaving:o,onSave:l,onReset:i,onBack:c,showBack:d}){const u=e.value,h=t.value,f=d??u.length>0,v=()=>{if(u.length===0)return s("config.title");const A=u[u.length-1],g=u.join("."),x=h[g];return x?.label?x.label:Dr(A)},m=()=>u.length<=1?null:u.slice(0,-1).map((g,x)=>{const C=u.slice(0,x+1);return h[C.join(".")]?.label??Dr(g)}).join(" › "),w=()=>{c?c():u.length>0&&(e.value=u.slice(0,-1))},k=v(),T=m();return n("div",{class:"flex items-center gap-2 px-4 py-3 border-b border-[var(--color-border)] bg-[var(--color-bg-surface)]",children:[f&&n(K,{icon:n(Ag,{size:20}),onClick:w,label:s("actions.back"),size:"sm",variant:"ghost",class:"touch-manipulation"}),n("div",{class:"flex-1 min-w-0",children:[T&&n("div",{class:"text-xs text-[var(--color-text-muted)] truncate",children:T}),n("h1",{class:"text-lg font-semibold text-[var(--color-text-primary)] truncate",children:k})]}),n("div",{class:"flex items-center gap-1",children:r&&n(G,{children:[n(K,{icon:n(yc,{size:18}),onClick:i,label:s("config.reset"),size:"sm",variant:"ghost"}),n(K,{icon:n(Oh,{size:18}),onClick:l,disabled:!a,label:s(o?"config.saving":"config.save"),size:"sm",variant:"ghost",class:a?"text-[var(--color-accent)]":""})]})})]})}function x5({items:e,selectedPath:t,isTopLevel:r=!1}){const a=o=>{t.value=o.path};return e.length===0?null:n("div",{class:"divide-y divide-[var(--color-border)]",children:e.map(o=>{const l=r?nf[o.key]??Fb:void 0;return n("button",{type:"button",class:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[var(--color-bg-hover)] active:bg-[var(--color-bg-tertiary)] transition-colors",onClick:()=>a(o),children:[l&&n("div",{class:"w-8 h-8 rounded-lg bg-[var(--color-accent)]/10 flex items-center justify-center flex-shrink-0",children:n(l,{size:18,class:"text-[var(--color-accent)]"})}),n("span",{class:"flex-1 text-[var(--color-text-primary)] truncate",children:o.label}),n(rt,{size:18,class:"text-[var(--color-text-muted)] flex-shrink-0"})]},o.key)})})}const jb="cove:config:expandedNav";function rf(){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 y5(e){return e.length===0?"":e.join(".")}function w5(){try{const e=localStorage.getItem(jb);if(e)return new Set(JSON.parse(e))}catch{}return new Set(["gateway","agents","channels"])}const ke=p(rf()),Oi=p(w5()),cr=p(!1);ke.subscribe(()=>{cr.value=!1});let wd=!1;ke.subscribe(e=>{const t=y5(e),r=window.location.hash.slice(1);if(t!==r&&(wd=!0,t?window.location.hash=t:history.replaceState(null,"",window.location.pathname+window.location.search),wd=!1),e.length>1){const a=new Set(Oi.value);for(let o=1;o<e.length;o++)a.add(e.slice(0,o).join("."));Oi.value=a}});typeof window<"u"&&window.addEventListener("hashchange",()=>{wd||(ke.value=rf())});Oi.subscribe(e=>{try{localStorage.setItem(jb,JSON.stringify([...e]))}catch{}});function Hb(e,t){if(t.length===0)return null;const[r,...a]=t,o=e.find(l=>l.key===String(r));return o?a.length===0?o:o.children?Hb(o.children,a):null:null}function k5(e,t){if(t.length===0)return{items:e,isTopLevel:!0};const r=Hb(e,t);return r?.children&&r.children.length>0?{items:r.children,isTopLevel:!1}:null}function _5(e){O(()=>{const m=rf();m.length>0&&(ke.value=m)},[]),O(()=>{L.value&&!xn.value&&Dv()},[L.value]),O(()=>{if(!xn.value)return;const m=ke.value,w=window.matchMedia("(max-width: 767px)").matches,T=yd(xn.value,Pt.value,Br.value)[0]?.path;if(m.length===0){T&&!w&&(ke.value=T);return}const A=String(m[0]);xn.value.properties?.[A]||(w?ke.value=[]:T&&(ke.value=T))},[xn.value]);const t=async()=>{await u5()?J.success(s("config.saveSuccess")):ut.value&&J.error(ut.value)},r=()=>{c5(),J.success(s("config.reset"))},a=xn.value,o=Pt.value,l=Br.value,i=a?yd(a,o,l):[],c=hu.value.toLowerCase().trim(),d=c?i.filter(m=>{const w=m.label.toLowerCase().includes(c),k=m.children?.some(T=>T.label.toLowerCase().includes(c));return w||k}):i,u=k5(i,ke.value),h=u!==null&&!cr.value,f=Lb(a,ke.value),v=ke.value.length>0&&u!==null&&u.items.length>0&&f!==null&&d5(f);return n(Ac,{viewName:s("config.title"),children:[n("div",{class:"md:hidden flex-1 flex flex-col overflow-hidden",children:[n(b5,{selectedPath:ke,uiHints:Br,isDirty:Ys.value,canSave:xd.value,isSaving:fl.value,onSave:t,onReset:r,showBack:ke.value.length>0||cr.value,onBack:()=>{cr.value?cr.value=!1:ke.value.length>0&&(ke.value=ke.value.slice(0,-1))}}),ut.value&&n("div",{class:"px-4 pt-4",children:n(An,{variant:"error",children:ut.value})}),Nn.value&&!a&&n("div",{class:"flex-1 flex items-center justify-center",children:n(te,{size:"lg"})}),!Nn.value&&a&&n("div",{class:"flex-1 overflow-y-auto bg-[var(--color-bg-surface)]",children:h?n("div",{class:"divide-y divide-[var(--color-border)]",children:[v&&n("button",{type:"button",class:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-[var(--color-bg-hover)] active:bg-[var(--color-bg-tertiary)] transition-colors",onClick:()=>{cr.value=!0},children:[u.isTopLevel&&n("div",{class:"w-8 h-8 rounded-lg bg-[var(--color-text-muted)]/10 flex items-center justify-center flex-shrink-0",children:n(Ph,{size:18,class:"text-[var(--color-text-muted)]"})}),n("span",{class:"flex-1 text-[var(--color-text-primary)]",children:s("config.general")}),n(rt,{size:18,class:"text-[var(--color-text-muted)] flex-shrink-0"})]}),n(x5,{items:u.items,selectedPath:ke,isTopLevel:u.isTopLevel})]}):n($v,{selectedPath:ke,schema:xn,draftConfig:Pt,uiHints:Br,skipNavWorthy:cr.value})})]}),n("div",{class:"hidden md:flex md:flex-1 md:overflow-y-auto p-6",children:n("div",{class:"max-w-5xl mx-auto w-full space-y-6",children:[n(Mt,{title:s("config.title"),subtitle:s("config.description"),actions:n(G,{children:[Ys.value&&n("span",{class:"text-sm text-[var(--color-warning)]",children:s("config.unsavedChanges")}),n(P,{variant:"secondary",size:"sm",icon:yc,onClick:r,disabled:!Ys.value,children:s("config.reset")}),n(P,{variant:"primary",size:"sm",icon:Oh,onClick:t,disabled:!xd.value,children:fl.value?s("config.saving"):s("config.save")}),n(K,{icon:n(Fe,{class:Nn.value?"animate-spin":""}),onClick:Dv,disabled:Nn.value,label:s("actions.refresh")})]})}),ut.value&&n(An,{variant:"error",children:ut.value}),Nn.value&&!a&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!Nn.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(X,{type:"text",placeholder:s("config.searchPlaceholder"),value:hu.value,onInput:m=>{hu.value=m.target.value},leftElement:n(Ke,{class:"w-4 h-4"}),class:"text-sm"})}),n("div",{class:"flex-1 overflow-y-auto p-2",children:d.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] p-2",children:s(c?"config.noResults":"config.noFields")}):d.map(m=>n(zb,{item:m,selectedPath:ke,expandedNav:Oi},m.key))})]}),n("div",{class:"flex-1 bg-[var(--color-bg-surface)]",children:n($v,{selectedPath:ke,schema:xn,draftConfig:Pt,uiHints:Br})})]})]})})]})}function _s({theme:e,isSelected:t,onClick:r,size:a="md"}){const o=e.colors["--color-bg-primary"],l=e.colors["--color-accent"],i=a==="sm"?"w-10 h-10":"w-12 h-12",c=a==="sm"?"w-3 h-3":"w-4 h-4",d=a==="sm"?"w-4 h-4":"w-5 h-5";return n(Ka,{content:e.name,placement:"top",delay:200,children:n("button",{type:"button",onClick:r,class:`
407
- relative ${i} rounded-xl border-2 transition-all
408
- hover:scale-105
409
- focus:outline-none focus:ring-2 focus:ring-[var(--color-accent)] focus:ring-offset-2
410
- ${t?"border-[var(--color-accent)] ring-2 ring-[var(--color-accent)]":"border-[var(--color-border)] hover:border-[var(--color-text-muted)]"}
411
- `,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(Wt,{class:`${d} text-[var(--color-accent)]`,strokeWidth:3})})]})})}function Ss({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:s(t)}),r&&n("span",{class:"text-sm text-[var(--color-text-muted)]",children:["— ",r]})]})}function S5(){const e=ju(),t=lt.value,r=t.selected==="system",a=e.filter(h=>h.appearance==="light"),o=e.filter(h=>h.appearance==="dark"),l=t.lightTheme,i=t.darkTheme,c=t.selected!=="system"?t.selected:null,d=h=>{if(h)So("system");else{const f=window.matchMedia("(prefers-color-scheme: dark)").matches;So(f?i:l)}},u=(h,f)=>{r?f==="light"?D0(h):$0(h):So(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(Nt,{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:s("settings.appearance.useSystemTheme")}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:s("settings.appearance.useSystemThemeDescription")})]})]}),n($e,{checked:r,onChange:d,size:"sm"})]}),r?n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-6",children:[n("div",{children:[n(Ss,{icon:n(Ip,{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(_s,{theme:h,isSelected:l===h.id,onClick:()=>u(h.id,"light")},h.id))})]}),n("div",{children:[n(Ss,{icon:n(Tp,{class:"w-4 h-4"}),titleKey:"settings.appearance.darkTheme",selectedThemeName:o.find(h=>h.id===i)?.name}),n("div",{class:"flex flex-wrap gap-2",children:o.map(h=>n(_s,{theme:h,isSelected:i===h.id,onClick:()=>u(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(Ss,{icon:n(Ip,{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(_s,{theme:h,isSelected:c===h.id,onClick:()=>u(h.id,"light")},h.id))})]}),n("div",{children:[n(Ss,{icon:n(Tp,{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(_s,{theme:h,isSelected:c===h.id,onClick:()=>u(h.id,"dark")},h.id))})]})]})]})}function C5(){Wy()}function A5(e=!0){o2(),mw(),va(),e&&C5(),De("/")}const Bb="cove:device-identity",kd="cove:device-display-name",Ra=p(typeof localStorage<"u"?localStorage.getItem(kd):null);function T5(e){e?.trim()?(localStorage.setItem(kd,e.trim()),Ra.value=e.trim()):(localStorage.removeItem(kd),Ra.value=null)}function Wb(e){const t=new Uint8Array(e);let r="";for(let a=0;a<t.length;a++)r+=String.fromCharCode(t[a]);return btoa(r).replaceAll("+","-").replaceAll("/","_").replace(/=+$/g,"")}async function Kb(e){const t=await crypto.subtle.exportKey("raw",e),r=await crypto.subtle.digest("SHA-256",t),a=new Uint8Array(r);return Array.from(a).map(o=>o.toString(16).padStart(2,"0")).join("")}async function E5(){const e=await crypto.subtle.generateKey("Ed25519",!0,["sign","verify"]),t=await crypto.subtle.exportKey("raw",e.publicKey),r=Wb(t);return{deviceId:await Kb(e.publicKey),publicKeyBase64Url:r,privateKey:e.privateKey,publicKey:e.publicKey}}async function I5(e){const t=await crypto.subtle.exportKey("jwk",e.privateKey),r=await crypto.subtle.exportKey("jwk",e.publicKey),a={version:1,deviceId:e.deviceId,publicKeyBase64Url:e.publicKeyBase64Url,privateKeyJwk:t,publicKeyJwk:r,createdAtMs:Date.now()};localStorage.setItem(Bb,JSON.stringify(a)),E.node.debug("Stored device identity:",e.deviceId.slice(0,16)+"...")}async function M5(){try{const e=localStorage.getItem(Bb);if(!e)return null;const t=JSON.parse(e);if(t?.version!==1)return null;const r=await crypto.subtle.importKey("jwk",t.privateKeyJwk,"Ed25519",!0,["sign"]),a=await crypto.subtle.importKey("jwk",t.publicKeyJwk,"Ed25519",!0,["verify"]);return await Kb(a)!==t.deviceId?(E.node.warn("Device ID mismatch, regenerating identity"),null):(E.node.debug("Loaded device identity:",t.deviceId.slice(0,16)+"..."),{deviceId:t.deviceId,publicKeyBase64Url:t.publicKeyBase64Url,privateKey:r,publicKey:a})}catch(e){return E.node.warn("Failed to load device identity:",e),null}}let Dn=null;async function Ic(){return Dn||(Dn=await M5(),Dn)||(E.node.debug("Generating new device identity"),Dn=await E5(),await I5(Dn)),Dn}function R5(e){const t=e.nonce?"v2":"v1",r=e.scopes.join(","),a=e.token??"",o=[t,e.deviceId,e.clientId,e.clientMode,e.role,r,String(e.signedAtMs),a];return t==="v2"&&o.push(e.nonce??""),o.join("|")}async function D5(e,t){const a=new TextEncoder().encode(t),o=await crypto.subtle.sign("Ed25519",e.privateKey,a);return Wb(o)}async function $5(e){const t=await Ic(),r=Date.now(),a=e.scopes??[],o=R5({deviceId:t.deviceId,clientId:e.clientId,clientMode:e.clientMode,role:e.role,scopes:a,signedAtMs:r,token:e.token,nonce:e.nonce}),l=await D5(t,o);return{id:t.deviceId,publicKey:t.publicKeyBase64Url,signature:l,signedAt:r,...e.nonce?{nonce:e.nonce}:{}}}async function L5(){return Ra.value?Ra.value:`Cove Canvas (${(await Ic()).deviceId.slice(0,8)})`}function N5(e){return e?e.startsWith("image/"):!1}function Lv(e){if(!e)return!1;const t=e.toLowerCase();return/\.(png|jpg|jpeg|gif|webp|svg|ico|bmp)(\?|$)/.test(t)}function af(e,t){let r=e,a=t;if(e.startsWith("data:")){const c=e.match(/^data:([^;]+);base64,(.+)$/);c&&(a=c[1],r=c[2])}let o;try{o=atob(r)}catch{throw new Error("Invalid base64 data")}const l=new Uint8Array(o.length);for(let c=0;c<o.length;c++)l[c]=o.charCodeAt(c);const i=new Blob([l],{type:a});return URL.createObjectURL(i)}const Nr=p(!1),Da=p("unpaired"),Pi=p(null),Wr=p(!1),br=p(null),O5=p(null),xr=p(null),Mc=p(null),_d=p(!1),Xs=p(null),Zs=p(null),qb=typeof BroadcastChannel<"u"?new BroadcastChannel("cove:canvas"):null;let Fi=null,Sd=null;function Cd(){qb?.postMessage({type:"canvas-content",url:br.value,base64:Fi,mimeType:Sd})}qb?.addEventListener("message",e=>{if(e.data.type==="canvas-content"){if(e.data.url)br.value=e.data.url,xr.value=null;else if(e.data.base64)try{const t=af(e.data.base64,e.data.mimeType||"image/png");xr.value=t,Mc.value=e.data.mimeType,br.value=null}catch{}}if(e.data.type==="canvas-standalone-status"){const t=_d.value;_d.value=e.data.open,E.node.debug(`Standalone canvas status: ${e.data.open?"open":"closed"}`),e.data.open?(br.value||Fi)&&Cd():t&&(E.node.debug("Standalone closed, re-registering node"),Gl())}});function P5(){xr.value&&(URL.revokeObjectURL(xr.value),xr.value=null),Mc.value=null}function F5(e){const t=/^https?:\/\/(127\.0\.0\.1|localhost)(:\d+)?(\/__openclaw__\/canvas)(\/.*)?/i,r=e.match(t);if(!r)return e;const o=`/_canvas${r[4]||"/"}`;return E.node.debug("Transformed canvas URL to proxy:",e,"->",o),o}function Nv(e){const t=e.url,r=e.imageBase64,a=e.imageMimeType||"image/png";if(P5(),r)try{const o=af(r,a);return xr.value=o,Mc.value=a,br.value=null,Fi=r,Sd=a,Cd(),{type:"base64",detail:a}}catch(o){return E.node.error("Failed to create blob from base64:",o),null}if(t){const o=F5(t);return br.value=o,Fi=null,Sd=null,Cd(),{type:"url",detail:o}}return null}let _e=null,la=null,qn=null,Ad,xo;const z5=15e3,Ov=1e4,yr=new Map;let Gb=0;const U5=3e4;function Vb(e,t){return new Promise((r,a)=>{if(!_e||_e.readyState!==WebSocket.OPEN){a(new Error("Not connected"));return}const o=String(++Gb),l=setTimeout(()=>{const i=yr.get(o);i&&(yr.delete(o),i.reject(new Error("Request timeout")))},U5);yr.set(o,{resolve:r,reject:a,timeout:l}),_e.send(JSON.stringify({type:"req",id:o,method:e,params:t}))})}function j5(e){try{const t=JSON.parse(e);if(t.type==="res"&&t.id!=null){const r=yr.get(String(t.id));r&&(yr.delete(t.id),clearTimeout(r.timeout),t.ok?r.resolve(t.payload):r.reject(new Error(t.error?.message??"Request failed")));return}if(t.type==="evt"||t.type==="event"){if(t.event==="node.invoke.request"){K5(t.payload);return}H5(t.event,t.payload);return}}catch(t){E.node.error("Failed to parse message:",t)}}function H5(e,t){if(E.node.debug("Event:",e,t),e==="connect.challenge"){const r=t,a=typeof r.nonce=="string"?r.nonce:void 0;E.node.debug("Received connect.challenge with nonce:",a?.slice(0,8)+"..."),B5(a);return}e==="node.pair.resolved"&&(t.status==="approved"?(Da.value="paired",E.node.debug("Pairing approved! Reconnecting..."),Gl()):(Da.value="unpaired",E.node.debug("Pairing rejected")))}async function B5(e){try{const t=await Ic(),r=await L5();Pi.value=t.deviceId;const a=await $5({clientId:"node-host",clientMode:"node",role:"node",scopes:[],token:xo??null,nonce:e}),o={minProtocol:3,maxProtocol:3,role:"node",client:{id:"node-host",displayName:r,mode:"node",version:"1.0.0",platform:navigator.platform?.toLowerCase().includes("mac")?"macos":"web"},device:a,caps:["canvas"],commands:["canvas.present","canvas.hide","canvas.navigate","canvas.eval","canvas.snapshot"]};xo&&(Ad==="token"?o.auth={token:xo}:Ad==="password"&&(o.auth={password:xo})),E.node.debug("Sending connect request with device:",a.id.slice(0,16)+"...");const l=await Vb("connect",o);E.node.debug("Connect result:",l),Nr.value=!0,Da.value="paired",E.node.info("Node connected as device:",t.deviceId.slice(0,16)+"..."),W5()}catch(t){E.node.error("Connect failed:",t)}}function W5(){qn||(qn=setInterval(async()=>{if(_e&&_e.readyState===WebSocket.OPEN)try{await Vb("ping",{}),E.node.debug("Keepalive ping successful")}catch{E.node.debug("Keepalive ping failed, reconnecting"),Gl()}},z5))}async function K5(e){const t=e;let r={};if(t.params&&typeof t.params=="object")r=t.params;else if(t.paramsJSON)try{r=JSON.parse(t.paramsJSON)}catch{E.node.error("Failed to parse paramsJSON:",t.paramsJSON)}E.node.debug("Invoke request:",t.command,"params keys:",Object.keys(r));let a={ok:!0},o;try{switch(t.command){case"canvas.present":{const l=Nv(r);Wr.value=!1,Wr.value=!0,l&&E.node.debug(`Canvas presented: ${l.type==="base64"?`(${l.detail})`:l.detail}`);break}case"canvas.hide":{Wr.value=!1,E.node.debug("Canvas hidden");break}case"canvas.navigate":{const l=Nv(r);Wr.value=!1,Wr.value=!0,l&&E.node.debug(`Canvas navigated: ${l.type==="base64"?`(${l.detail})`:l.detail}`);break}case"canvas.eval":{const l=r.javaScript;if(E.node.debug("canvas.eval requested:",l?.slice(0,50)),!l){o={code:"INVALID_PARAMS",message:"javaScript parameter required"};break}try{a={result:await new Promise((c,d)=>{Xs.value={js:l,resolve:c,reject:u=>d(new Error(u))},setTimeout(()=>{Xs.value?.js===l&&(Xs.value=null,d(new Error("Canvas eval timeout")))},Ov)})}}catch(i){o={code:"EVAL_ERROR",message:String(i)}}break}case"canvas.snapshot":{const l=r.maxWidth||800,i=r.quality||.8,d=(r.outputFormat||"jpeg")==="png"?"png":"jpeg";E.node.debug("canvas.snapshot requested:",{maxWidth:l,quality:i,outputFormat:d});try{a={dataUrl:await new Promise((h,f)=>{Zs.value={maxWidth:l,quality:i,outputFormat:d,resolve:h,reject:v=>f(new Error(v))},setTimeout(()=>{Zs.value&&(Zs.value=null,f(new Error("Canvas snapshot timeout")))},Ov)})}}catch(u){o={code:"SNAPSHOT_ERROR",message:String(u)}}break}default:o={code:"UNKNOWN_COMMAND",message:`Unknown command: ${t.command}`}}}catch(l){o={code:"ERROR",message:String(l)}}if(_e&&_e.readyState===WebSocket.OPEN){const l={type:"req",id:String(++Gb),method:"node.invoke.result",params:{id:t.id,nodeId:Pi.value,ok:!o,payload:o?void 0:a,error:o??void 0}};E.node.debug("Sending invoke result for node:",Pi.value?.slice(0,8)),_e.send(JSON.stringify(l))}}async function of(){const e=st.value,t=sc(),r=lh();if(E.node.debug("connectNode called"),!e){E.node.debug("No gateway URL, skipping node connection");return}Ad=t?.authMode,xo=r??void 0;const a=e.replace(/^http/,"ws");E.node.debug("Connecting to gateway as node"),_e=new WebSocket(a),_e.onopen=()=>{E.node.debug("WebSocket connected, waiting for connect.challenge")},_e.onmessage=o=>{j5(String(o.data))},_e.onclose=o=>{E.node.debug("WebSocket closed:",o.code,o.reason),Nr.value=!1,_e=null,qn&&(clearInterval(qn),qn=null),la||(la=setTimeout(()=>{la=null,of()},5e3))},_e.onerror=()=>{E.node.error("WebSocket error")}}function lf(){E.node.debug("startNodeConnection called"),st.value?of():E.node.debug("No gateway URL, skipping node connection")}function Gl(){E.node.debug("refreshNodeRegistration called - doing full reconnect"),_e&&(_e.close(),_e=null),Nr.value=!1,setTimeout(()=>{of()},500)}function sf(){la&&(clearTimeout(la),la=null),qn&&(clearInterval(qn),qn=null);for(const[e,t]of yr)clearTimeout(t.timeout),t.reject(new Error("Connection closed")),yr.delete(e);_e&&(_e.close(),_e=null),Nr.value=!1}const Yb=Object.freeze(Object.defineProperty({__proto__:null,canvasBlobUrl:xr,canvasContent:O5,canvasContentType:Mc,canvasUrl:br,canvasVisible:Wr,nodeConnected:Nr,nodeId:Pi,nodePairingStatus:Da,pendingCanvasEval:Xs,pendingCanvasSnapshot:Zs,refreshNodeRegistration:Gl,standaloneCanvasOpen:_d,startNodeConnection:lf,stopNodeConnection:sf},Symbol.toStringTag,{value:"Module"}));function fu({titleKey:e,children:t}){return n(q,{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:s(e)})}),n("div",{class:"p-3 sm:p-4",children:t})]})}function On({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:s(e)}),n("p",{class:"text-xs text-[var(--color-text-muted)] mt-0.5",children:s(t)})]}),n("div",{class:"flex-shrink-0",children:a})]})}function pu({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 q5(){const[e,t]=U(""),[r,a]=U(""),[o,l]=U(!1);O(()=>{Ic().then(u=>{const h=`Cove Canvas (${u.deviceId.slice(0,8)})`;t(h),a(Ra.value??h)})},[]);const i=u=>{We.value=u,u?lf():sf()},c=u=>{a(u),l(!0)},d=()=>{if(!o)return;const u=Ra.value;let h;!r.trim()||r.trim()===e?(h=null,a(e)):h=r.trim(),T5(h),l(!1),h!==u&&Nr.value&&Gl()};return n(G,{children:[n(On,{labelKey:"settings.device.enabled",descriptionKey:"settings.device.enabledDescription",children:n($e,{checked:We.value,onChange:i})}),We.value&&n(On,{labelKey:"settings.device.name",descriptionKey:"settings.device.nameDescription",children:n(X,{value:r,onChange:u=>c(u.target.value),onBlur:d,class:"w-[200px]"})})]})}function G5(e){return n(Kt,{viewName:s("nav.settings"),children:[n(Mt,{title:s("nav.settings"),subtitle:s("settings.description")}),n(fu,{titleKey:"settings.appearance.title",children:n("div",{class:"space-y-6",children:[n(S5,{}),n(On,{labelKey:"settings.appearance.fontSize",descriptionKey:"settings.appearance.fontSizeDescription",children:n(Re,{value:ha.value,onChange:t=>{ha.value=t},options:Vm.map(t=>({value:t.value,label:s(t.labelKey)})),size:"sm",width:"180px"})}),n(On,{labelKey:"settings.appearance.fontFamily",descriptionKey:"settings.appearance.fontFamilyDescription",children:n(Re,{value:fa.value,onChange:t=>{fa.value=t},options:Ym.map(t=>({value:t.value,label:s(t.labelKey)})),size:"sm",width:"180px"})})]})}),n(fu,{titleKey:"settings.appMode.title",children:n("div",{class:"space-y-6",children:[n(On,{labelKey:"settings.preferences.timeFormat",descriptionKey:"settings.preferences.timeFormatDescription",children:n(Re,{value:Cr.value,onChange:t=>{Cr.value=t},options:Jm.map(t=>({value:t.value,label:s(t.labelKey)})),size:"sm",width:"180px"})}),n(On,{labelKey:"settings.appMode.multiChat",descriptionKey:"settings.appMode.multiChatDescription",children:n($e,{checked:un.value==="multi",onChange:t=>{un.value=t?"multi":"single"}})}),Dl.value&&n(G,{children:[n(On,{labelKey:"settings.newChat.useDefaults",descriptionKey:"settings.newChat.useDefaultsDescription",children:n($e,{checked:Ze.value.useDefaults,onChange:t=>{Ze.value={...Ze.value,useDefaults:t}}})}),n(On,{labelKey:"settings.newChat.defaultAgent",descriptionKey:"settings.newChat.defaultAgentDescription",children:n(Re,{value:Ze.value.defaultAgentId,onChange:t=>{Ze.value={...Ze.value,defaultAgentId:t}},options:td.value,size:"sm",width:"180px"})})]}),n(q5,{})]})}),n(fu,{titleKey:"settings.about.title",children:n("div",{class:"space-y-4",children:[n("div",{class:"space-y-3",children:[n(pu,{label:s("settings.about.cove"),value:`v${B1}`}),At.value&&n(pu,{label:s("settings.about.gateway"),value:ag(At.value)}),st.value&&n(pu,{label:s("settings.about.gatewayUrl"),value:st.value,truncate:!0})]}),n("div",{class:"border-t border-[var(--color-border)] pt-4 flex flex-wrap justify-end gap-2",children:[n(P,{variant:"secondary",onClick:()=>Xm(),children:s("settings.data.resetDefaults")}),L.value&&n(P,{variant:"secondary",onClick:()=>A5(),children:s("actions.logout")})]})]})})]})}const Td=p(null),Ed=p(null),Id=p(!1),uo=p(!1);function Cs(e){return e==null?"—":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function V5(e){return e==null?"—":`${Math.round(e)}%`}function Y5(e){return e==null?"—":e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}async function Pv(){if(L.value){Id.value=!0;try{const[e,t]=await Promise.all([N("status").catch(()=>null),N("health").catch(()=>null)]);Td.value=e,Ed.value=t}catch{}finally{Id.value=!1}}}function As({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 J5({name:e,label:t,data:r}){const a=r.linked?"success":r.configured?"warning":"default",o=r.linked?s("debug.linked"):r.configured?s("debug.configured"):s("debug.off");return n("div",{class:"flex items-center justify-between py-1.5",children:[n("span",{class:"text-sm",children:t||e}),n(Z,{variant:a,size:"sm",children:o})]})}function X5(){const e=L.value,t=Td.value,r=Ed.value,a=t?.sessions?.recent?.[0];return O(()=>{e&&!Td.value&&!Ed.value&&Pv()},[e]),n(q,{children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(j2,{size:18,class:"text-[var(--color-accent)]"}),n("h2",{class:"font-medium",children:s("debug.snapshots")})]}),n(P,{variant:"ghost",size:"sm",onClick:Pv,disabled:!e,loading:Id.value,icon:n(Fe,{size:14}),children:s("actions.refresh")})]}),!t&&!r?n("p",{class:"text-sm text-[var(--color-text-muted)] text-center py-6",children:s("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(Kn,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:s("debug.recentSession")}),a.model&&n(Z,{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(As,{label:s("debug.input"),value:Cs(a.inputTokens)}),n(As,{label:s("debug.output"),value:Cs(a.outputTokens)}),n(As,{label:s("debug.total"),value:Cs(a.totalTokens)}),n(As,{label:s("debug.used"),value:V5(a.percentUsed),sub:`of ${Cs(a.contextTokens)}`})]})]}),r&&n("div",{children:[n("div",{class:"flex items-center gap-2 mb-3",children:[n(Rg,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:s("debug.health")}),n(Z,{variant:r.ok?"success":"error",size:"sm",children:r.ok?s("debug.healthy"):s("debug.unhealthy")}),r.durationMs!=null&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:["(",Y5(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(J5,{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(fn,{size:14,class:"text-[var(--color-text-muted)]"}),n("span",{class:"text-sm font-medium",children:s("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(Z,{variant:o.enabled?"success":"default",size:"sm",children:o.enabled?s("debug.on"):s("debug.off")})]})]},o.agentId))})]}),n("button",{type:"button",onClick:()=>{uo.value=!uo.value},"aria-expanded":uo.value,class:"flex items-center gap-1 text-xs text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)] transition-colors",children:[uo.value?n(Oe,{size:12}):n(rt,{size:12}),s("debug.showRawJson")]}),uo.value&&n(Kl,{value:JSON.stringify({status:t,health:r},null,2),id:"snapshots-raw-json"})]})]})}const Qs=p("system-presence"),vl=p("{}"),vr=p(null),Md=p(!1),zi=p(null),wr=p(!0),hn=p([]);let Jb=0;const Xb=W(()=>{const e={};for(const t of hn.value)t.key.trim()&&(e[t.key.trim()]=t.value);return e});function Z5(){if(wr.value){const t=Xb.value;return Object.keys(t).length>0?t:void 0}const e=vl.value.trim();if(!(!e||e==="{}"))return JSON.parse(e)}function Q5(){hn.value=[...hn.value,{id:`field_${++Jb}`,key:"",value:""}]}function eC(e){hn.value=hn.value.filter(t=>t.id!==e)}function Fv(e,t){hn.value=hn.value.map(r=>r.id===e?{...r,...t}:r)}function tC(){const e=Xb.value;vl.value=Object.keys(e).length>0?JSON.stringify(e,null,2):"{}"}function nC(){try{const e=JSON.parse(vl.value||"{}");typeof e=="object"&&e!==null&&!Array.isArray(e)&&(hn.value=Object.entries(e).map(([t,r])=>({id:`field_${++Jb}`,key:t,value:typeof r=="string"?r:JSON.stringify(r)})))}catch{}}function rC(){wr.value?tC():nC(),wr.value=!wr.value}async function aC(){if(L.value){Md.value=!0,zi.value=null,vr.value=null;try{const e=Z5(),t=await N(Qs.value,e);vr.value={ok:!0,data:t}}catch(e){zi.value=e instanceof Error?e.message:"RPC call failed",vr.value={ok:!1,data:null}}finally{Md.value=!1}}}function oC(){const e=L.value;return n(q,{children:[n("div",{class:"flex items-center justify-between mb-4",children:[n("div",{class:"flex items-center gap-2",children:[n(Og,{size:18,class:"text-[var(--color-warning)]"}),n("h2",{class:"font-medium",children:s("debug.manualRpc")})]}),n(P,{variant:"ghost",size:"sm",onClick:rC,icon:wr.value?n(U2,{size:14}):n(ek,{size:14}),children:wr.value?s("debug.jsonMode"):s("debug.formMode")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)] mb-4",children:s("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:s("debug.method")}),n(X,{id:"rpc-method",value:Qs.value,onInput:t=>{Qs.value=t.target.value},placeholder:"e.g., system-presence, status, health",class:"font-mono",fullWidth:!0})]}),wr.value?n("div",{children:[n("div",{class:"flex items-center justify-between mb-2",children:[n("span",{class:"text-sm font-medium",children:s("debug.params")}),n(P,{variant:"ghost",size:"sm",onClick:Q5,icon:n(Zn,{size:14}),children:s("debug.addParam")})]}),hn.value.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)] py-3 text-center",children:s("debug.noParams")}):n("div",{class:"space-y-2",children:hn.value.map(t=>n("div",{class:"flex items-center gap-2",children:[n(X,{value:t.key,onInput:r=>Fv(t.id,{key:r.target.value}),placeholder:"key",class:"font-mono flex-1"}),n(X,{value:t.value,onInput:r=>Fv(t.id,{value:r.target.value}),placeholder:"value",class:"font-mono flex-1"}),n(K,{icon:n(Et,{size:14}),size:"sm",variant:"ghost",label:s("actions.delete"),onClick:()=>eC(t.id)})]},t.id))})]}):n("div",{children:[n("label",{htmlFor:"rpc-params",class:"block text-sm font-medium mb-1",children:s("debug.paramsJson")}),n(xa,{id:"rpc-params",value:vl.value,onInput:t=>{vl.value=t.target.value},placeholder:"{}",rows:4,class:"font-mono text-sm",fullWidth:!0})]}),n(P,{variant:"secondary",onClick:aC,disabled:!e||!Qs.value.trim(),loading:Md.value,icon:n(Lh,{size:14}),children:s("debug.call")}),zi.value&&n("div",{class:"text-sm text-[var(--color-error)] bg-[var(--color-error)]/10 p-3 rounded-lg",children:zi.value}),vr.value&&n("div",{children:[n("div",{class:"flex items-center justify-between mb-2",children:[n("span",{class:"text-sm font-medium",children:s("debug.result")}),n(Z,{variant:vr.value.ok?"success":"error",children:vr.value.ok?s("debug.ok"):s("debug.error")})]}),n(Kl,{value:ph(vr.value.data),maxHeight:"max-h-64",id:"rpc-result"})]})]})]})}const Pn=p([]),lC=p(100),ei=p(!1);let sC=0;const ti=p(null),Rd=p(new Set),Zt=p(null),Zb=p(0),iC=W(()=>{Zb.value;const e=ch.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`}),cC=W(()=>{switch(Ee.value){case"connected":return"success";case"connecting":case"authenticating":case"reconnecting":return"warning";default:return"error"}});function uC(e,t){if(ei.value)return;const r={id:++sC,timestamp:Date.now(),event:e,payload:t};Pn.value=[r,...Pn.value].slice(0,lC.value)}function dC(){Pn.value=[]}function hC(e){const t=new Set(Rd.value);t.has(e)?t.delete(e):t.add(e),Rd.value=t}async function fC(e,t){try{await navigator.clipboard.writeText(e),ti.value=t,setTimeout(()=>{ti.value===t&&(ti.value=null)},2e3)}catch{}}function He({icon:e,label:t,value:r,copyable:a,mono:o}){const l=r??"—",i=`${t}-${l}`,c=ti.value===i;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(K,{icon:c?n(Wt,{size:14}):n(bc,{size:14}),size:"sm",variant:"ghost",label:s("actions.copy"),onClick:()=>fC(r,i),class:"flex-shrink-0"})]})]})}function pC({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:()=>{Zt.value=e},"aria-label":s("debug.viewEventDetails",{event:e.event}),children:[n("div",{class:"min-w-0",children:[n(Z,{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(rt,{size:16,class:"text-[var(--color-text-muted)] flex-shrink-0"})]})}function vC({entry:e,expanded:t,onToggle:r}){const a=e.payload!=null&&Object.keys(e.payload).length>0,o=ph(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, ${s(a?"debug.clickToExpand":"debug.noPayload")}`,children:[a?t?n(Oe,{size:14,class:"text-[var(--color-text-muted)]"}):n(rt,{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(Z,{variant:"default",class:"font-mono text-xs",children:e.event})]}),t&&a&&n("div",{class:"px-3 pb-3",children:n(Kl,{value:o,id:l})})]})}function mC(e){O(()=>cc(o=>{uC(o.event,o.payload)}),[]),O(()=>{const a=setInterval(()=>{Zb.value++},1e3);return()=>clearInterval(a)},[]);const t=L.value,r=Ee.value;return n(Kt,{viewName:s("nav.debug"),children:[n(Mt,{title:s("nav.debug"),subtitle:s("debug.subtitle"),actions:n(Z,{variant:cC.value,children:[t?n(Ci,{size:14,class:"mr-1"}):n(zg,{size:14,class:"mr-1"}),r]})}),n("div",{class:"grid grid-cols-1 md:grid-cols-2 gap-4 sm:gap-6",children:[n(q,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(Ci,{size:18,class:t?"text-[var(--color-success)]":"text-[var(--color-error)]"}),n("h2",{class:"font-medium",children:s("debug.connection")})]}),n("div",{class:"space-y-0",children:[n(He,{icon:Kn,label:s("debug.state"),value:r}),n(He,{icon:fn,label:s("debug.url"),value:st.value,copyable:!0,mono:!0}),n(He,{icon:xc,label:s("debug.sessionKey"),value:Be.value,copyable:!0,mono:!0}),n(He,{icon:Fe,label:s("debug.reconnectAttempts"),value:String(zt.value)}),n(He,{icon:me,label:s("debug.connectedAt"),value:Yn.value?le(Yn.value):null})]})]}),n(q,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(Tr,{size:18,class:"text-[var(--color-primary)]"}),n("h2",{class:"font-medium",children:s("debug.server")})]}),n("div",{class:"space-y-0",children:[n(He,{icon:Tr,label:s("debug.version"),value:At.value}),n(He,{icon:Nt,label:s("debug.host"),value:Ua.value}),n(He,{icon:Ht,label:s("debug.commit"),value:$l.value?.slice(0,8),copyable:!0,mono:!0}),n(He,{icon:me,label:s("debug.uptime"),value:iC.value}),n(He,{icon:me,label:s("debug.tickInterval"),value:ll.value?`${ll.value}ms`:null})]})]}),n(q,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(_i,{size:18,class:"text-[var(--color-warning)]"}),n("h2",{class:"font-medium",children:s("debug.paths")})]}),n("div",{class:"space-y-0",children:[n(He,{icon:Ht,label:s("debug.configPath"),value:Co.value,copyable:!0,mono:!0}),n(He,{icon:_i,label:s("debug.stateDir"),value:Ao.value,copyable:!0,mono:!0})]})]}),n(q,{children:[n("div",{class:"flex items-center gap-2 mb-4",children:[n(Nt,{size:18,class:"text-[var(--color-info)]"}),n("h2",{class:"font-medium",children:s("debug.client")})]}),n("div",{class:"space-y-0",children:[n(He,{icon:Nt,label:s("debug.appVersion"),value:"2026.2.13"}),n(He,{icon:Nt,label:s("debug.platform"),value:navigator.platform}),n(He,{icon:Nt,label:s("debug.userAgent"),value:navigator.userAgent.slice(0,60)+"..."}),n(He,{icon:jn,label:s("debug.presenceCount"),value:String(Ll.value.length)})]})]})]}),n("div",{class:"grid grid-cols-1 lg:grid-cols-2 gap-4 sm:gap-6",children:[n(X5,{}),n(oC,{})]}),n(q,{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(Kn,{size:18,class:"text-[var(--color-accent)]"}),n("h2",{class:"font-medium",children:s("debug.eventLog")}),n(Z,{variant:"default",children:Pn.value.length})]}),n("div",{class:"flex items-center gap-2",children:[n($e,{checked:!ei.value,onChange:a=>{ei.value=!a},label:ei.value?s("debug.paused"):s("debug.recording")}),n(P,{variant:"ghost",size:"sm",onClick:dC,disabled:Pn.value.length===0,icon:n(Et,{size:14}),children:n("span",{class:"hidden sm:inline",children:s("debug.clear")})})]})]}),Pn.value.length===0?n("div",{class:"text-center py-8 text-[var(--color-text-muted)]",children:[n(Kn,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:s("debug.noEvents")}),n("p",{class:"text-sm mt-1",children:s("debug.noEventsHint")})]}):n(G,{children:[n("div",{class:"md:hidden space-y-2 max-h-96 overflow-y-auto",children:Pn.value.map(a=>n(pC,{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(vC,{entry:a,expanded:Rd.value.has(a.id),onToggle:()=>hC(a.id)},a.id))})]})]}),n(ze,{open:!!Zt.value,onClose:()=>{Zt.value=null},title:Zt.value?.event||"",children:Zt.value&&n("div",{class:"space-y-3",children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:new Date(Zt.value.timestamp).toLocaleString()}),Zt.value.payload!=null&&Object.keys(Zt.value.payload).length>0?n(Kl,{value:ph(Zt.value.payload),maxHeight:"max-h-[60vh]",id:`mobile-event-${Zt.value.id}`}):n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("debug.noPayload")})]})})]})}const Qb={debug:P2,info:zl,warn:Tn,error:gc},ex={debug:"text-[var(--color-text-muted)]",info:"text-[var(--color-info)]",warn:"text-[var(--color-warning)]",error:"text-[var(--color-error)]"};function tx(e){return e?e.split("T")[1]?.slice(0,12)||e.slice(0,12):null}function gC({line:e,expanded:t,onToggle:r}){const a=e.level?Qb[e.level]:void 0,o=e.level?ex[e.level]:"text-[var(--color-text-muted)]",l=tx(e.timestamp),i=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:!i,"aria-expanded":i?t:void 0,"aria-label":i?s("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:[i?n(rt,{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&&i&&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,d])=>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:d})]},c))})]})]})}let nx=0;function rx(){nx=0}function ax(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,ax(o,l)):typeof o=="string"?r[l]=o:r[l]=JSON.stringify(o))}return r}const zv=["time","timestamp","ts","level","lvl","pid","hostname","v","msg","message"];function Uv(e){const t=++nx;let r,a,o=e,l;if(e.startsWith("{"))try{const i=JSON.parse(e);r=i.time||i.timestamp||i.ts;const c=(i.level||i.lvl||"")?.toLowerCase();["debug","info","warn","warning","error","err"].includes(c)&&(a=c==="warning"?"warn":c==="err"?"error":c);const d=Object.keys(i).find(h=>/^\d+$/.test(h));if(i.msg||i.message)o=i.msg||i.message;else if(i.error&&typeof i.error=="string")o=i.error;else if(d&&typeof i[d]=="string")o=i[d];else{const h=[];for(const[f,v]of Object.entries(i))zv.includes(f)||(typeof v=="string"?h.push(`${f}=${v}`):v!=null&&h.push(`${f}=${JSON.stringify(v)}`));o=h.length>0?h.join(" "):e}const u={};for(const[h,f]of Object.entries(i))!zv.includes(h)&&!/^\d+$/.test(h)&&(u[h]=f);Object.keys(u).length>0&&(l=ax(u))}catch{}if(!r){const i=e.match(/^(\d{4}-\d{2}-\d{2}T[\d:.]+Z)\s+\[([^\]]+)\]\s*(.*)$/);if(i){r=i[1],o=`[${i[2]}] ${i[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 i=e.match(/^\[([^\]]+)\]\s*(DEBUG|INFO|WARN|ERROR):?\s*(.*)$/i);i&&(r=i[1],a=i[2].toLowerCase(),o=i[3])}if(!r){const i=e.match(/^(\d{4}-\d{2}-\d{2}T[\d:]+Z)\s+(ERR|INF|WRN|DBG)\s+(.*)$/);if(i){r=i[1];const c=i[2];a=c==="ERR"?"error":c==="WRN"?"warn":c==="DBG"?"debug":"info",o=i[3]}}if(!a&&!r){const i=e.match(/^(DEBUG|INFO|WARN|ERROR):?\s+(.*)$/i);i&&(a=i[1].toLowerCase(),o=i[2])}if(!a){const i=e.toLowerCase();i.includes("error")||i.includes("failed")||i.includes("exception")||i.includes("✗")?a="error":i.includes("warn")||i.includes("deprecated")?a="warn":(i.includes("debug")||i.includes("trace"))&&(a="debug")}return{id:t,raw:e,timestamp:r,level:a,message:o,fields:l}}const dt=p([]),Dd=p(0),$d=p(""),Yr=p(!1),Ui=p(null),ho=p(!0),Ld=p(""),rn=p(new Set),Nd=p(new Set),Ye=p(null);async function vu(e=!1){if(L.value){Yr.value=!0,Ui.value=null;try{const t=await N("logs.tail",{cursor:e?void 0:Dd.value||void 0,limit:500,maxBytes:25e4});if(t)if($d.value=t.file,Dd.value=t.cursor,t.reset||e)rx(),dt.value=t.lines.map(Uv);else{const r=t.lines.map(Uv);r.length>0&&(dt.value=[...dt.value,...r].slice(-2e3))}}catch(t){Ui.value=t instanceof Error?t.message:s("logs.fetchError")}finally{Yr.value=!1}}}function jv(){dt.value=[],Dd.value=0,rx()}function Hv(){const e=dt.value.map(o=>o.raw).join(`
412
- `),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 Ts(e){const t=new Set(rn.value);t.has(e)?t.delete(e):t.add(e),rn.value=t}function bC(){rn.value=new Set}function xC(e){const t=new Set(Nd.value);t.has(e)?t.delete(e):t.add(e),Nd.value=t}const Bv=W(()=>{let e=dt.value;const t=rn.value;t.size>0&&(e=e.filter(a=>a.level&&t.has(a.level)));const r=Ld.value.toLowerCase().trim();return r&&(e=e.filter(a=>a.raw.toLowerCase().includes(r))),e}),yC=W(()=>{const e={debug:0,info:0,warn:0,error:0};for(const t of dt.value)t.level&&t.level in e&&e[t.level]++;return e}),wC={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)]"}},Wv={debug:"logs.debug",info:"logs.info",warn:"logs.warnings",error:"logs.errors"};function Es({level:e,count:t,selected:r,onClick:a}){const o=wC[e];return n("button",{type:"button",onClick:a,"aria-label":s("logs.filterByLevel",{level:s(Wv[e])}),"aria-pressed":r,class:`px-3 py-1 text-sm rounded-full transition-colors ${r?o.active:o.inactive}`,children:[s(Wv[e])," (",t,")"]})}function kC({line:e}){const t=e.level?Qb[e.level]:zl,r=e.level?ex[e.level]:"text-[var(--color-text-muted)]",a=e.fields&&Object.keys(e.fields).length>0,o=tx(e.timestamp);return n("button",{type:"button",class:"w-full flex items-start gap-3 p-3 text-left bg-[var(--color-bg-secondary)] rounded-lg hover:bg-[var(--color-bg-hover)] transition-colors",onClick:()=>{Ye.value=e},"aria-label":s("logs.viewLogDetails"),children:[n(t,{size:16,class:`mt-0.5 flex-shrink-0 ${r}`}),n("div",{class:"flex-1 min-w-0",children:[n("p",{class:"text-sm text-[var(--color-text-primary)] line-clamp-2",children:e.message}),n("div",{class:"flex items-center gap-2 mt-1",children:[o&&n("span",{class:"text-xs text-[var(--color-text-muted)] font-mono",children:o}),a&&n(Z,{variant:"default",class:"text-xs",children:[Object.keys(e.fields).length," ",s("logs.fields")]})]})]}),n(rt,{size:16,class:"text-[var(--color-text-muted)] flex-shrink-0 mt-0.5"})]})}function _C(e){const t=B(null),r=B(null),a=B(!0),o=B(!0);O(()=>{L.value&&vu(!0)},[L.value]),O(()=>{if(!ho.value||!L.value)return;const u=setInterval(()=>vu(),2e3);return()=>clearInterval(u)},[ho.value,L.value]),O(()=>{a.current&&t.current&&(t.current.scrollTop=t.current.scrollHeight),o.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[Bv.value.length]);const l=()=>{if(!t.current)return;const{scrollTop:u,scrollHeight:h,clientHeight:f}=t.current;a.current=h-u-f<50},i=()=>{if(!r.current)return;const{scrollTop:u,scrollHeight:h,clientHeight:f}=r.current;o.current=h-u-f<50},c=Bv.value,d=yC.value;return n(Ac,{viewName:s("nav.logs"),children:n("div",{class:"flex-1 flex flex-col overflow-hidden p-4 sm:p-6",children:n("div",{class:"max-w-5xl mx-auto w-full flex flex-col flex-1 min-h-0 space-y-4 sm:space-y-6",children:[n(Mt,{title:s("logs.title"),subtitle:s("logs.description"),actions:n("div",{class:"flex items-center gap-2",children:[n($e,{checked:ho.value,onChange:u=>ho.value=u,label:ho.value?s("logs.live"):s("logs.paused")}),n(K,{icon:n(Fe,{size:16,class:Yr.value?"animate-spin":""}),onClick:()=>vu(!0),disabled:Yr.value,label:s("actions.refresh")})]})}),n(X,{type:"text",value:Ld.value,onInput:u=>Ld.value=u.target.value,placeholder:s("logs.searchPlaceholder"),"aria-label":s("logs.searchPlaceholder"),leftElement:n(Ke,{class:"w-4 h-4"})}),n("div",{class:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[n("div",{class:"flex items-center gap-2 overflow-x-auto pb-1 sm:pb-0 -mx-4 px-4 sm:mx-0 sm:px-0",role:"group","aria-label":s("logs.filterByLevel",{level:""}),children:[n("button",{type:"button",onClick:bC,"aria-pressed":rn.value.size===0,class:`px-3 py-1 text-sm rounded-full transition-colors whitespace-nowrap ${rn.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:[s("logs.all")," (",dt.value.length,")"]}),n(Es,{level:"debug",count:d.debug,selected:rn.value.has("debug"),onClick:()=>Ts("debug")}),n(Es,{level:"info",count:d.info,selected:rn.value.has("info"),onClick:()=>Ts("info")}),n(Es,{level:"warn",count:d.warn,selected:rn.value.has("warn"),onClick:()=>Ts("warn")}),n(Es,{level:"error",count:d.error,selected:rn.value.has("error"),onClick:()=>Ts("error")})]}),n("div",{class:"flex items-center gap-2",children:[$d.value&&n("span",{class:"hidden sm:flex text-xs text-[var(--color-text-muted)] items-center gap-1",children:[n(Ht,{size:12}),$d.value.split("/").pop()]}),n("div",{class:"hidden sm:flex items-center gap-2",children:[n(P,{variant:"ghost",size:"sm",onClick:Hv,icon:n(jt,{size:14}),children:s("logs.download")}),n(P,{variant:"ghost",size:"sm",onClick:jv,disabled:dt.value.length===0,icon:n(Et,{size:14}),children:s("logs.clear")})]}),n("div",{class:"flex sm:hidden items-center gap-1",children:[n(K,{icon:n(jt,{size:16}),onClick:Hv,label:s("logs.download"),size:"sm"}),n(K,{icon:n(Et,{size:16}),onClick:jv,disabled:dt.value.length===0,label:s("logs.clear"),size:"sm"})]})]})]}),Ui.value&&n("div",{class:"p-4 rounded-lg bg-[var(--color-error)]/10 text-[var(--color-error)] text-sm",role:"alert",children:Ui.value}),n("div",{class:"flex-1 min-h-0 rounded-xl border border-[var(--color-border)] bg-[var(--color-bg-tertiary)] overflow-hidden flex flex-col",children:[Yr.value&&dt.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!Yr.value&&dt.value.length===0&&n("div",{class:"text-center py-12 text-[var(--color-text-muted)]",children:[n(Ht,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:s("logs.noLogs")}),n("p",{class:"text-sm mt-1",children:s("logs.noLogsHint")})]}),dt.value.length>0&&c.length===0&&n("div",{class:"text-center py-12 text-[var(--color-text-muted)]",children:[n(Ke,{size:32,class:"mx-auto mb-2 opacity-50"}),n("p",{children:s("logs.noMatches")})]}),c.length>0&&n(G,{children:[n("div",{ref:r,class:"md:hidden flex-1 overflow-y-auto p-3 space-y-2",onScroll:i,role:"log","aria-live":"polite",children:c.map(u=>n(kC,{line:u},u.id))}),n("div",{ref:t,class:"hidden md:flex md:flex-col flex-1 overflow-y-auto",onScroll:l,role:"log","aria-live":"polite",children:c.map(u=>n(gC,{line:u,expanded:Nd.value.has(u.id),onToggle:()=>xC(u.id)},u.id))})]})]}),n(ze,{open:!!Ye.value,onClose:()=>{Ye.value=null},title:s("logs.logDetails"),children:Ye.value&&n("div",{class:"space-y-4",children:[n("div",{class:"flex items-center gap-2",children:[Ye.value.level&&n(Z,{variant:Ye.value.level==="error"?"error":Ye.value.level==="warn"?"warning":"default",children:Ye.value.level}),Ye.value.timestamp&&n("span",{class:"text-sm text-[var(--color-text-muted)] font-mono",children:Ye.value.timestamp})]}),n("div",{children:[n("h4",{class:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:s("logs.message")}),n("p",{class:"text-sm text-[var(--color-text-primary)] whitespace-pre-wrap break-words",children:Ye.value.message})]}),Ye.value.fields&&Object.keys(Ye.value.fields).length>0&&n("div",{children:[n("h4",{class:"text-xs font-medium text-[var(--color-text-muted)] mb-2",children:s("logs.fields")}),n("div",{class:"space-y-2 bg-[var(--color-bg-tertiary)] rounded-lg p-3",children:Object.entries(Ye.value.fields).map(([u,h])=>n("div",{class:"text-xs font-mono",children:[n("span",{class:"text-[var(--color-accent)]",children:u}),n("span",{class:"text-[var(--color-text-muted)] mx-1",children:"="}),n("span",{class:"text-[var(--color-text-secondary)] break-all",children:h})]},u))})]}),n("div",{children:[n("h4",{class:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:s("logs.rawLine")}),n("pre",{class:"text-xs font-mono text-[var(--color-text-secondary)] bg-[var(--color-bg-tertiary)] rounded-lg p-3 overflow-x-auto whitespace-pre-wrap break-all",children:Ye.value.raw})]})]})})]})})})}function cf(e){return e.role?e.role:e.roles&&e.roles.length>0?e.roles[0]:"unknown"}function ox(e){return!!(e.role==="node"||e.roles?.includes("node"))}function lx(e){return!!(e.role==="operator"||e.roles?.includes("operator"))}function uf(e){switch(e){case"operator":return"info";case"node":return"success";default:return"default"}}function sx(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 $a(e){return e.length<=20?e:`${e.slice(0,10)}...${e.slice(-6)}`}function SC({device:e,onSelect:t}){const r=cf(e),a=e.tokens?.length??0,o=e.platform?.includes("ios")||e.platform?.includes("android")?ga:Nt;return n(Ya,{icon:o,iconVariant:r==="operator"?"info":"success",title:e.displayName||$a(e.deviceId),subtitle:e.platform||void 0,badges:n(Z,{variant:uf(r),children:r}),meta:[...a>0?[{icon:xc,value:`${a}`}]:[],{icon:me,value:le(e.approvedAtMs,{relative:!0})}],onClick:()=>t(e)})}function Is({label:e,children:t}){return n("div",{children:[n("span",{class:"text-[var(--color-text-muted)]",children:[e,":"]})," ",t]})}function CC({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?s("devices.tokenRevoked"):s("devices.tokenActive")})]}),n("div",{class:"flex gap-1",children:n(K,{icon:n(yc,{class:"w-4 h-4"}),label:s("devices.rotateToken"),onClick:t,size:"sm"})})]})}function ix({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(Is,{label:s("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(Is,{label:s("devices.clientId"),children:e.clientId}),e.scopes&&e.scopes.length>0&&n(Is,{label:s("devices.scopes"),children:n("span",{class:"text-xs",children:e.scopes.join(", ")})}),n(Is,{label:s("devices.approved"),children:le(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(wc,{class:"w-4 h-4"}),s("devices.tokens")]}),a.length===0?n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("devices.noTokens")}):n("div",{class:"space-y-2",children:a.map(l=>n(CC,{token:l,onRotate:()=>r?.(e)},l.role))})]})]})})}function AC({device:e,isExpanded:t,onToggleExpand:r,onOpenTokenModal:a}){const o=cf(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":s("devices.toggleDetails",{name:e.displayName||$a(e.deviceId)}),children:[n("span",{class:"text-[var(--color-text-muted)]",children:t?n(Oe,{class:"w-4 h-4"}):n(rt,{class:"w-4 h-4"})}),n("span",{class:"text-xl w-8 text-center flex-shrink-0",children:sx(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||$a(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(Z,{variant:uf(o),children:o}),l>0&&n("div",{class:"flex items-center gap-1 text-sm text-[var(--color-text-muted)]",children:[n(xc,{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:le(e.approvedAtMs)})]})]}),t&&n(ix,{device:e,onOpenTokenModal:a})]})}const sa=p([]),df=p([]),Jr=p(!1),$o=p(null),Od=p(""),en=p("all"),Pd=p(new Set),kr=p(null),gn=p(null),Fd=p(!1),TC=[{value:"all",label:()=>s("devices.filters.allRoles")},{value:"operator",label:()=>s("devices.filters.operators")},{value:"node",label:()=>s("devices.filters.nodes")}],EC=W(()=>{const e=sa.value,t=e.filter(lx).length,r=e.filter(ox).length,a=df.value.length;return{total:e.length,operators:t,nodes:r,pending:a}}),IC=W(()=>{let e=sa.value;en.value==="operator"?e=e.filter(lx):en.value==="node"&&(e=e.filter(ox));const t=Od.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 La(){Jr.value=!0,$o.value=null;try{const e=await N("device.pair.list",{});sa.value=e.paired,df.value=e.pending}catch(e){$o.value=ne(e)}finally{Jr.value=!1}}async function MC(e){try{await N("device.pair.approve",{requestId:e}),J.success(s("devices.approveSuccess")),await La()}catch(t){J.error(ne(t))}}async function RC(e){try{await N("device.pair.reject",{requestId:e}),J.success(s("devices.rejectSuccess")),await La()}catch(t){J.error(ne(t))}}async function DC(e,t){Fd.value=!0;try{const r=await N("device.token.rotate",{deviceId:e.deviceId,role:t});J.success(s("devices.tokenRotated")),await navigator.clipboard.writeText(r.token),J.success(s("devices.tokenCopied")),kr.value=null,await La()}catch(r){J.error(ne(r))}finally{Fd.value=!1}}async function $C(e,t){try{await N("device.token.revoke",{deviceId:e.deviceId,role:t}),J.success(s("devices.tokenRevoked")),kr.value=null,await La()}catch(r){J.error(ne(r))}}function LC(e){const t=new Set(Pd.value);t.has(e)?t.delete(e):t.add(e),Pd.value=t}function NC({request:e}){const t=cf(e);return n(q,{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:sx(e.platform)}),n("div",{children:[n("div",{class:"flex items-center gap-2 flex-wrap",children:[n("h3",{class:"font-medium",children:e.displayName||$a(e.deviceId)}),n(Z,{variant:uf(t),children:t}),e.isRepair&&n(Z,{variant:"warning",children:s("devices.repair")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:[e.platform,e.remoteIp&&` • ${e.remoteIp}`," • ",le(e.ts)]})]})]}),n("div",{class:"flex gap-2 self-end sm:self-start",children:[n(P,{variant:"primary",size:"sm",icon:Wt,onClick:()=>MC(e.requestId),children:s("devices.approve")}),n(P,{variant:"danger",size:"sm",icon:Wa,onClick:()=>RC(e.requestId),children:s("devices.reject")})]})]})})}function OC({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:[s("devices.tokenCreated"),": ",le(e.createdAtMs),e.rotatedAtMs&&n(G,{children:[" ","• ",s("devices.tokenRotatedAt"),": ",le(e.rotatedAtMs)]})]})]}),n("div",{class:"flex gap-2",children:[n(P,{variant:"secondary",size:"sm",icon:yc,onClick:()=>DC(t,e.role),disabled:r,children:s("devices.rotate")}),n(P,{variant:"danger",size:"sm",icon:Et,onClick:()=>$C(t,e.role),children:s("devices.revoke")})]})]})}function PC(){const e=kr.value;if(!e)return null;const t=e.tokens??[];return n(ze,{open:!0,onClose:()=>{kr.value=null},title:s("devices.tokenManagement"),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("devices.tokenManagementDesc",{name:e.displayName||$a(e.deviceId)})}),t.length===0?n("p",{class:"text-sm",children:s("devices.noTokens")}):n("div",{class:"space-y-3",children:t.map(r=>n(OC,{token:r,device:e,disabled:Fd.value},r.role))})]}),n("div",{class:"mt-6 flex justify-end",children:n(P,{variant:"secondary",onClick:()=>{kr.value=null},children:s("actions.close")})})]})}function FC(){return n("div",{class:"text-center py-12",children:[n(ga,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:s("devices.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:s("devices.emptyDescription")})]})}function zC(e){O(()=>{L.value&&La()},[L.value]);const t=IC.value,r=EC.value,a=df.value;return n(Kt,{viewName:s("nav.devices"),children:[n(Mt,{title:s("devices.title"),subtitle:s("devices.description"),actions:n(K,{icon:n(Fe,{class:Jr.value?"animate-spin":""}),onClick:La,disabled:Jr.value,label:s("actions.refresh")})}),$o.value&&n(An,{variant:"error",children:$o.value}),Jr.value&&sa.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!Jr.value&&!$o.value&&n(G,{children:[n("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-2 sm:gap-4",children:[n(ve,{icon:ga,label:s("devices.stats.total"),value:r.total,active:en.value==="all",onClick:()=>{en.value="all"}}),n(ve,{icon:Bt,label:s("devices.stats.operators"),value:r.operators,active:en.value==="operator",onClick:()=>{en.value="operator"}}),n(ve,{icon:Nt,label:s("devices.stats.nodes"),value:r.nodes,active:en.value==="node",onClick:()=>{en.value="node"}}),n(ve,{icon:me,label:s("devices.stats.pending"),value:r.pending,highlight:r.pending>0})]}),a.length>0&&n("div",{class:"space-y-3","data-tour":"pending-requests",children:[n("h2",{class:"text-lg font-semibold",children:s("devices.pendingRequests")}),a.map(o=>n(NC,{request:o},o.requestId))]}),sa.value.length>0&&n("div",{class:"space-y-3",children:[n("div",{class:"flex items-center gap-3",children:[n(X,{type:"text",placeholder:s("devices.searchPlaceholder"),value:Od.value,onInput:o=>{Od.value=o.target.value},leftElement:n(Ke,{class:"w-4 h-4"}),class:"flex-1"}),n(Re,{value:en.value,onChange:o=>{en.value=o},options:TC.map(o=>({value:o.value,label:o.label()})),size:"sm",align:"right","aria-label":s("devices.filters.allRoles")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:t.length!==r.total?s("devices.filteredCount",{filtered:t.length,total:r.total}):s("devices.count",{count:r.total})})]}),sa.value.length>0?t.length===0?n(q,{padding:"none",children:n("div",{class:"text-center py-8 text-[var(--color-text-muted)]",children:s("devices.noResults")})}):n(G,{children:[n("div",{class:"md:hidden space-y-2",children:t.map(o=>n(SC,{device:o,onSelect:l=>{gn.value=l}},o.deviceId))}),n(q,{padding:"none",class:"hidden md:block overflow-hidden",children:t.map(o=>n(AC,{device:o,isExpanded:Pd.value.has(o.deviceId),onToggleExpand:()=>LC(o.deviceId),onOpenTokenModal:l=>{kr.value=l}},o.deviceId))})]}):n(FC,{})]}),n(ze,{open:!!gn.value,onClose:()=>{gn.value=null},title:gn.value?.displayName||(gn.value?$a(gn.value.deviceId):""),children:gn.value&&n(ix,{device:gn.value,bare:!0,onOpenTokenModal:o=>{gn.value=null,kr.value=o}})}),n(PC,{})]})}function cx({items:e,activeId:t,onChange:r}){return n("div",{class:"flex border-b border-[var(--color-border)]",role:"tablist",children:e.map(a=>{const o=a.id===t;return n("button",{type:"button",role:"tab","aria-selected":o,onClick:()=>r(a.id),class:`relative flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors ${o?"text-[var(--color-accent)]":"text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)]"}`,children:[a.icon,a.label,o&&n("span",{class:"absolute bottom-0 left-0 right-0 h-0.5 bg-[var(--color-accent)] rounded-full"})]},a.id)})})}function Rc(e){return e.disabled?"disabled":e.blockedByAllowlist?"blocked":e.eligible?"eligible":"missing-reqs"}function UC(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 jC(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 ux="https://clawhub.ai/api/v1";async function HC(e){const t=new URLSearchParams;t.set("limit",String(e.limit)),e?.cursor&&t.set("cursor",e.cursor);const r=`${ux}/skills${t.toString()?`?${t}`:""}`,a=await fetch(r);if(!a.ok)throw new Error(`ClawHub API error: ${a.status}`);return a.json()}async function BC(e,t){const r=new URLSearchParams({q:e});r.set("limit",String(t.limit));const a=`${ux}/search?${r}`,o=await fetch(a);if(!o.ok)throw new Error(`ClawHub API error: ${o.status}`);return o.json()}const Fn=p([]),nn=p(!1),Lo=p(null),ji=p(""),Hi=p(void 0),No=p(null),Oo=p(!1);async function ni(e=!1){if(!nn.value){nn.value=!0,Lo.value=null;try{const t=e?Hi.value:void 0,r=ji.value?await BC(ji.value,{limit:20}):await HC({limit:20,cursor:t});e?Fn.value=[...Fn.value,...r.items]:Fn.value=r.items,Hi.value=r.nextCursor}catch(t){Lo.value=ne(t)}finally{nn.value=!1}}}async function Kv(){Hi.value=void 0,await ni()}async function WC(e){Oo.value=!0;try{J.error(s("skills.clawhub.notYetSupported",{slug:e.slug})),No.value=null}catch(t){J.error(ne(t))}finally{Oo.value=!1}}function KC({skill:e}){const t=e.tags?.latest||e.latestVersion?.version||"?";return n(q,{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(Z,{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||s("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(jt,{class:"w-3 h-3"}),e.stats.downloads]}),n("span",{class:"flex items-center gap-1",children:[n(Pg,{class:"w-3 h-3"}),e.stats.stars]}),n("span",{class:"flex items-center gap-1",children:[n(Pl,{class:"w-3 h-3"}),le(e.updatedAt)]})]})]}),n(P,{variant:"secondary",size:"sm",icon:jt,onClick:()=>{No.value=e},class:"self-start sm:flex-shrink-0",children:s("skills.clawhub.install")})]})})}function qC(){const e=No.value;if(!e)return null;const t=e.tags?.latest||e.latestVersion?.version||"?",r=e.latestVersion?.changelog;return n(ze,{open:!0,onClose:()=>{No.value=null},title:s("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:s("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:s("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(jt,{class:"w-4 h-4"}),e.stats.downloads," ",s("skills.clawhub.downloads")]}),n("span",{class:"flex items-center gap-1",children:[n(Pg,{class:"w-4 h-4"}),e.stats.stars," ",s("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:[s("skills.clawhub.viewOnClawhub"),n(Fl,{class:"w-3 h-3"})]})]}),n("div",{class:"mt-6 flex justify-end gap-3",children:[n(P,{variant:"secondary",onClick:()=>{No.value=null},disabled:Oo.value,children:s("actions.cancel")}),n(P,{variant:"primary",icon:jt,onClick:()=>WC(e),disabled:Oo.value,children:Oo.value?s("skills.clawhub.installing"):s("skills.clawhub.install")})]})]})}function GC(){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:s("skills.clawhub.noResults")}),n("p",{class:"text-[var(--color-text-muted)]",children:s("skills.clawhub.tryDifferentSearch")})]})}function VC(){O(()=>{ni()},[]);const e=!!Hi.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(X,{type:"text",placeholder:s("skills.clawhub.searchPlaceholder"),value:ji.value,onInput:t=>{ji.value=t.target.value},onKeyDown:t=>{t.key==="Enter"&&Kv()},leftElement:n(Ke,{class:"w-4 h-4"})})}),n(P,{variant:"secondary",onClick:Kv,disabled:nn.value,class:"flex-shrink-0",children:[n("span",{class:"hidden sm:inline",children:s("actions.search")}),n(Ke,{class:"w-4 h-4 sm:hidden"})]}),n(K,{icon:n(Fe,{class:nn.value?"animate-spin":""}),label:s("actions.refresh"),onClick:()=>ni(),disabled:nn.value})]}),Lo.value&&n(An,{variant:"error",children:Lo.value}),nn.value&&Fn.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),Fn.value.length>0&&n("div",{class:"grid gap-4",children:Fn.value.map(t=>n(KC,{skill:t},t.slug))}),!nn.value&&!Lo.value&&Fn.value.length===0&&n(GC,{}),e&&!nn.value&&n("div",{class:"flex justify-center",children:n(P,{variant:"secondary",onClick:()=>ni(!0),children:s("actions.showMore")})}),nn.value&&Fn.value.length>0&&n("div",{class:"flex justify-center py-4",children:n(te,{size:"md"})}),n(qC,{})]})}const Ms=p(!1);function YC({skill:e,onClose:t,onSuccess:r}){if(!e)return null;const a=async o=>{Ms.value=!0;try{const l=await N("skills.install",{name:e.name,installId:o,timeoutMs:6e4});l.ok?(J.success(s("skills.installSuccess",{name:e.name})),t(),r()):J.error(l.message||s("skills.installFailed"))}catch(l){J.error(ne(l))}finally{Ms.value=!1}};return n(ze,{open:!0,onClose:t,title:s("skills.installTitle",{name:e.name}),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("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:Ms.value,children:[n(jt,{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:[s("skills.providesBins"),": ",o.bins.join(", ")]})]}),Ms.value&&n(te,{size:"sm"})]},o.id))})]}),n("div",{class:"mt-6 flex justify-end",children:n(P,{variant:"secondary",onClick:t,children:s("actions.cancel")})})]})}function qv({label:e,children:t}){return n("div",{children:[n("span",{class:"text-[var(--color-text-muted)]",children:[e,":"]})," ",t]})}function dx({skill:e,onInstall:t,bare:r=!1}){const a=jC(e),o=e.install.length>0&&UC(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(qv,{label:s("skills.skillKey"),children:n("code",{class:"text-xs bg-[var(--color-bg-primary)] px-1 py-0.5 rounded",children:e.skillKey})}),n(qv,{label:s("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:[s("skills.homepage"),n(Fl,{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:[s("skills.missingRequirements"),":"]}),n("ul",{class:"list-disc list-inside text-xs mt-1 space-y-0.5",children:a.map(i=>n("li",{children:i},i))})]}),e.blockedByAllowlist&&n("div",{class:"flex items-center gap-2 text-[var(--color-error)]",children:[n(tk,{class:"w-4 h-4"}),n("span",{children:s("skills.blockedByAllowlist")})]}),o&&n("div",{class:"pt-2",children:n(P,{variant:"secondary",size:"sm",icon:jt,onClick:()=>t(e),children:s("skills.installDeps")})}),e.primaryEnv&&n("div",{class:"text-xs text-[var(--color-text-muted)]",children:[s("skills.primaryEnv"),": ",n("code",{children:e.primaryEnv})]})]})]})]})}const JC={"openclaw-bundled":Ng,"openclaw-managed":H2,"openclaw-workspace":_i,"openclaw-extra":_i},XC={"openclaw-bundled":"skills.source.bundled","openclaw-managed":"skills.source.managed","openclaw-workspace":"skills.source.workspace","openclaw-extra":"skills.source.extra"};function hx(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:s(a)}}function fx(e){return JC[e]||Nh}function px(e){const t=XC[e];return t?s(t):e}function ZC({skill:e,onToggleExpand:t,onToggleEnabled:r}){const a=Rc(e),o=hx(a),l=fx(e.source);return n(Ya,{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(G,{children:[n(Z,{variant:o.variant,size:"sm",children:o.label}),e.always&&n("span",{class:"text-xs text-[var(--color-text-muted)]",title:s("skills.alwaysActive"),children:"⚡"})]}),meta:[{icon:l,value:px(e.source)}],actions:n("div",{onClick:i=>i.stopPropagation(),onKeyDown:i=>i.stopPropagation(),role:"presentation",children:n($e,{checked:!e.disabled,onChange:r,size:"sm","aria-label":e.disabled?s("skills.enable"):s("skills.disable")})}),onClick:t})}function QC({skill:e,isExpanded:t,onToggleExpand:r,onToggleEnabled:a,onInstall:o}){const l=Rc(e),i=hx(l),c=fx(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(Oe,{class:"w-4 h-4"}):n(rt,{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:s("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:px(e.source)})]}),n("div",{class:"w-24 flex justify-end",children:n(Z,{variant:i.variant,children:i.label})}),n("div",{onClick:d=>d.stopPropagation(),onKeyDown:d=>d.stopPropagation(),role:"presentation",children:n($e,{checked:!e.disabled,onChange:a,size:"sm","aria-label":e.disabled?s("skills.enable"):s("skills.disable")})})]}),t&&n(dx,{skill:e,onInstall:o})]})}const eA=[{value:"all",label:()=>s("skills.filters.allSources")},{value:"openclaw-bundled",label:()=>s("skills.source.bundled")},{value:"openclaw-workspace",label:()=>s("skills.source.workspace")},{value:"openclaw-managed",label:()=>s("skills.source.managed")},{value:"openclaw-extra",label:()=>s("skills.source.extra")}],mu=p("installed"),Na=p([]),zd=p(""),vx=p(""),Xr=p(!1),Po=p(null),Fo=p(""),ia=p("all"),kt=p("all"),Bi=p(new Set),Rs=p(null),sr=p(null),tA=W(()=>{const e=Na.value;let t=0,r=0,a=0;for(const o of e){const l=Rc(o);l==="eligible"?t++:l==="disabled"?r++:l==="missing-reqs"&&a++}return{total:e.length,eligible:t,disabled:r,missingReqs:a}}),nA=W(()=>{let e=Na.value;const t=Fo.value.toLowerCase().trim();return t&&(e=e.filter(r=>r.name.toLowerCase().includes(t)||r.description.toLowerCase().includes(t)||r.skillKey.toLowerCase().includes(t))),ia.value!=="all"&&(e=e.filter(r=>r.source===ia.value)),kt.value!=="all"&&(e=e.filter(r=>Rc(r)===kt.value)),e});async function gu(){Xr.value=!0,Po.value=null;try{const e=await N("skills.status",{});Na.value=e.skills,zd.value=e.workspaceDir,vx.value=e.managedSkillsDir}catch(e){Po.value=ne(e)}finally{Xr.value=!1}}async function Gv(e){const t=e.disabled;try{await N("skills.update",{skillKey:e.skillKey,enabled:t}),Na.value=Na.value.map(r=>r.skillKey===e.skillKey?{...r,disabled:!t}:r),J.success(t?s("skills.enabledSuccess",{name:e.name}):s("skills.disabledSuccess",{name:e.name}))}catch(r){J.error(ne(r))}}function rA(e){const t=new Set(Bi.value);t.has(e)?t.delete(e):t.add(e),Bi.value=t}function aA(){Fo.value="",ia.value="all",kt.value="all"}const oA=[{id:"installed",label:"Installed",icon:n(Ng,{class:"w-4 h-4"})},{id:"clawhub",label:"ClawHub",icon:n(Bt,{class:"w-4 h-4"})}];function lA({hasFilters:e}){return n("div",{class:"text-center py-12",children:[n(Ke,{class:"w-12 h-12 mx-auto text-[var(--color-text-muted)] mb-4"}),n("h3",{class:"text-lg font-medium mb-2",children:s(e?"skills.noResults":"skills.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:s(e?"skills.noResultsDescription":"skills.emptyDescription")}),e&&n("button",{type:"button",onClick:aA,class:"text-[var(--color-accent)] hover:underline",children:s("skills.clearFilters")})]})}function sA(e){O(()=>{L.value&&mu.value==="installed"&&gu().then(()=>{const l=new URLSearchParams(window.location.search),i=l.get("expand")||l.get("skill");i&&(Bi.value=new Set([i]),setTimeout(()=>{document.querySelector(`[data-skill-key="${i}"]`)?.scrollIntoView({behavior:"smooth",block:"center"})},100),window.history.replaceState({},"",window.location.pathname))})},[L.value]);const t=nA.value,r=tA.value,a=mu.value,o=!!Fo.value||ia.value!=="all"||kt.value!=="all";return n(Kt,{viewName:s("nav.skills"),children:[n(Mt,{title:s("skills.title"),subtitle:s("skills.description"),actions:a==="installed"?n(K,{icon:n(Fe,{class:Xr.value?"animate-spin":""}),onClick:gu,disabled:Xr.value,label:s("actions.refresh")}):void 0}),n(cx,{items:oA.map(l=>({...l,label:l.label})),activeId:a,onChange:l=>mu.value=l}),a==="clawhub"&&n(VC,{}),a==="installed"&&n(G,{children:[Po.value&&n(An,{variant:"error",children:Po.value}),Xr.value&&Na.value.length===0&&n("div",{class:"flex items-center justify-center py-12",children:n(te,{size:"lg"})}),!Xr.value&&!Po.value&&n(G,{children:[n("div",{class:"grid grid-cols-2 md:grid-cols-4 gap-2 sm:gap-4",children:[n(ve,{icon:Nh,label:s("skills.stats.total"),value:r.total,active:kt.value==="all",onClick:()=>{kt.value="all"}}),n(ve,{icon:Ha,label:s("skills.stats.eligible"),value:r.eligible,active:kt.value==="eligible",onClick:()=>{kt.value="eligible"}}),n(ve,{icon:Ba,label:s("skills.stats.disabled"),value:r.disabled,active:kt.value==="disabled",onClick:()=>{kt.value="disabled"}}),n(ve,{icon:Tn,label:s("skills.stats.missingReqs"),value:r.missingReqs,active:kt.value==="missing-reqs",highlight:r.missingReqs>0,onClick:()=>{kt.value="missing-reqs"}})]}),n("div",{class:"space-y-3",children:[n("div",{class:"flex items-center gap-3",children:[n(X,{type:"text",placeholder:s("skills.searchPlaceholder"),value:Fo.value,onInput:l=>{Fo.value=l.target.value},leftElement:n(Ke,{class:"w-4 h-4"}),class:"flex-1"}),n(Re,{value:ia.value,onChange:l=>{ia.value=l},options:eA.map(l=>({value:l.value,label:l.label()})),size:"sm",align:"right","aria-label":s("skills.filters.allSources")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:t.length!==r.total?s("skills.filteredCount",{filtered:t.length,total:r.total}):s("skills.count",{count:r.total})})]}),t.length===0?n(q,{padding:"none",children:n(lA,{hasFilters:o})}):n(G,{children:[n("div",{class:"md:hidden space-y-2",children:t.map(l=>n(ZC,{skill:l,onToggleExpand:()=>{sr.value=l},onToggleEnabled:()=>Gv(l)},l.skillKey))}),n(q,{padding:"none",class:"hidden md:block overflow-hidden",children:t.map(l=>n("div",{"data-skill-key":l.skillKey,children:n(QC,{skill:l,isExpanded:Bi.value.has(l.skillKey),onToggleExpand:()=>rA(l.skillKey),onToggleEnabled:()=>Gv(l),onInstall:i=>{Rs.value=i}})},l.skillKey))})]}),zd.value&&n("div",{class:"text-xs text-[var(--color-text-muted)] space-y-1",children:[n("div",{children:[s("skills.workspaceDir"),": ",n("code",{children:zd.value})]}),n("div",{children:[s("skills.managedDir"),": ",n("code",{children:vx.value})]})]})]})]}),n(ze,{open:!!sr.value,onClose:()=>{sr.value=null},title:sr.value?.name||"",children:sr.value&&n(dx,{skill:sr.value,onInstall:l=>{sr.value=null,Rs.value=l},bare:!0})}),n(YC,{skill:Rs.value,onClose:()=>{Rs.value=null},onSuccess:gu})]})}function iA(e){return e.identity?.name||e.name||e.id}function cA(e){const t=iA(e),r=e.identity?.emoji;return r?`${r}  ${t}`:t}const ml=p([]),mx=p("main"),qe=p("main"),Oa=p("overview"),Dc=p([]),tr=p(""),zo=p(!1),Wi=p(null),Tt=p(null),Ud=p(!1),Ki=p(!1),Vl=p(!1),Ct=p({}),Pa=p([]),qi=p(!1),bu=p(""),Gi=p(!1),Or=p(!1),gx=p(null),Ft=p(null),$c=p(!1),Uo=p(!1),gl=p(""),bl=p(""),xl=p(""),yl=p(""),Ds=p(!1),jo=p(!1),Ho=p(""),Bo=p(""),wl=p(""),Wo=p(!1),Ko=p(!1),qo=p(""),Vi=p(!1),Go=p(!1),uA=W(()=>{const e=new Set;return ml.value.filter(t=>{const r=t.workspace||cA(t);return e.has(r)?!1:(e.add(r),!0)})}),Ja=W(()=>ml.value.find(e=>e.id===qe.value)??null);function Vv(e){if(e)return typeof e=="string"?e:e.primary}function hf(e){const t=Tt.value;if(!t)return;const r=t.agents?.list?.find(o=>o.id===e),a=Vv(r?.model);return a||Vv(t.agents?.defaults?.model)}async function Yl(){try{const e=await N("agents.list",{});ml.value=e.agents,mx.value=e.defaultId,e.agents.find(t=>t.id===qe.value)||(qe.value=e.defaultId||e.agents[0]?.id||"main")}catch{ml.value=[{id:"main",name:"Main"}]}}async function Xa(){zo.value=!0,Wi.value=null;try{const e=await N("agents.files.list",{agentId:qe.value});Dc.value=e.files,tr.value=e.workspace}catch(e){Wi.value=ne(e),J.error(s("agents.files.loadError"))}finally{zo.value=!1}}async function Ut(){Ud.value=!0;try{const e=await N("config.get",{});Tt.value=e.config;const t=e.config.agents?.list?.find(a=>a.id===qe.value);Ct.value={profile:t?.tools?.profile??e.config.tools?.profile??"full",alsoAllow:t?.tools?.alsoAllow??[],deny:t?.tools?.deny??[]},Vl.value=!1;const r=t?.skills??null;gx.value=r,Ft.value=r?[...r]:null,Or.value=!1}catch(e){J.error(ne(e))}finally{Ud.value=!1}}async function ff(){qi.value=!0;try{const e=await N("skills.status",{});Pa.value=e.skills}catch(e){J.error(ne(e))}finally{qi.value=!1}}function Yv(e){const t=Ct.value,r=t.profile??"full",a=t.alsoAllow??[];return(t.deny??[]).includes(e)?!1:a.includes(e)||r==="full"?!0:r==="minimal"?["read","memory_search","memory_get"].includes(e):r==="coding"?["read","write","edit","exec","process","web_search","web_fetch"].includes(e):r==="messaging"?["read","message","sessions_list","sessions_send"].includes(e):!1}function dA(e){Ct.value={...Ct.value,profile:e},Vl.value=!0}function hA(e,t){const r={...Ct.value},a=new Set(r.alsoAllow??[]),o=new Set(r.deny??[]);t?(o.delete(e),(r.profile??"full")!=="full"&&a.add(e)):(a.delete(e),o.add(e)),Ct.value={...r,alsoAllow:[...a],deny:[...o]},Vl.value=!0}async function fA(){if(Tt.value){Ki.value=!0;try{const e={...Tt.value},t=[...e.agents?.list??[]],r=t.findIndex(o=>o.id===qe.value),a={profile:Ct.value.profile,alsoAllow:Ct.value.alsoAllow?.length?Ct.value.alsoAllow:void 0,deny:Ct.value.deny?.length?Ct.value.deny:void 0};r>=0?t[r]={...t[r],tools:a}:t.push({id:qe.value,tools:a}),e.agents={...e.agents,list:t},await N("config.apply",{config:e}),Tt.value=e,Vl.value=!1,J.success(s("actions.saved"))}catch(e){J.error(ne(e))}finally{Ki.value=!1}}}function pA(e){const t=Ft.value;if(t===null){const r=Pa.value.filter(a=>!a.disabled&&a.eligible).map(a=>a.name);Ft.value=r.filter(a=>a!==e)}else t.includes(e)?Ft.value=t.filter(r=>r!==e):Ft.value=[...t,e];Or.value=!0}function vA(){Ft.value=null,Or.value=!0}function mA(){Ft.value=[],Or.value=!0}function gA(){const e=Pa.value.filter(t=>!t.disabled&&t.eligible).map(t=>t.name);Ft.value=e,Or.value=!0}async function bA(){if(Tt.value){Gi.value=!0;try{const e={...Tt.value},t=[...e.agents?.list??[]],r=t.findIndex(o=>o.id===qe.value),a=Ft.value;r>=0?(t[r]={...t[r],skills:a??void 0},a===null&&delete t[r].skills):a!==null&&t.push({id:qe.value,skills:a}),e.agents={...e.agents,list:t},await N("config.apply",{config:e}),Tt.value=e,gx.value=Ft.value,Or.value=!1,J.success(s("actions.saved"))}catch(e){J.error(ne(e))}finally{Gi.value=!1}}}async function xA(){const e=Ja.value;e&&(Tt.value||await Ut(),gl.value=e.identity?.name||e.name||"",bl.value=e.identity?.avatar||"",xl.value=tr.value||"",yl.value=hf(e.id)||"",$c.value=!0)}function yA(){$c.value=!1,gl.value="",bl.value="",xl.value="",yl.value=""}async function wA(){const e=Ja.value;if(e){Uo.value=!0;try{const t={agentId:e.id},r=gl.value.trim(),a=e.identity?.name||e.name||"";r&&r!==a&&(t.name=r);const o=bl.value.trim(),l=e.identity?.avatar||"";o!==l&&(t.avatar=o);const i=xl.value.trim(),c=tr.value||"";i&&i!==c&&(t.workspace=i);const d=yl.value.trim(),u=hf(e.id)||"";d&&d!==u&&(t.model=d),(t.name||t.avatar!==void 0||t.workspace||t.model)&&(await N("agents.update",t),await Yl(),await Xa(),J.success(s("actions.saved"))),$c.value=!1}catch(t){J.error(ne(t))}finally{Uo.value=!1}}}function kA(){Ho.value="",Bo.value="",wl.value="",jo.value=!0}async function _A(){const e=Ho.value.trim(),t=Bo.value.trim();if(!e||!t){J.error(s("agents.create.requiredFields"));return}Wo.value=!0;try{const r={name:e,workspace:t};wl.value.trim()&&(r.emoji=wl.value.trim());const a=await N("agents.create",r);a.ok&&(await Yl(),qe.value=a.agentId,await Xa(),await Ut(),J.success(s("agents.create.success")),jo.value=!1)}catch(r){J.error(ne(r))}finally{Wo.value=!1}}function SA(){qo.value="",Vi.value=!1,Ko.value=!0}async function CA(){const e=Ja.value;if(e){if(qo.value!==e.id){J.error(s("agents.delete.confirmMismatch"));return}Go.value=!0;try{await N("agents.delete",{agentId:e.id,deleteFiles:Vi.value}),await Yl();const t=ml.value;t.length>0?qe.value=t[0].id:qe.value="main",await Xa(),await Ut(),J.success(s("agents.delete.success")),Ko.value=!1}catch(t){J.error(ne(t))}finally{Go.value=!1}}}async function AA(){await Yl(),await Xa(),Oa.value==="tools"?await Ut():Oa.value==="skills"&&(await Ut(),await ff())}function TA(e){qe.value=e,Xa(),(Oa.value==="tools"||Oa.value==="skills")&&Ut()}function EA(e){Oa.value=e,e==="overview"&&!Tt.value||e==="tools"&&!Tt.value?Ut():e==="skills"&&(Pa.value.length===0&&ff(),Tt.value||Ut())}function Jv(e){De(`/agents/edit/${encodeURIComponent(e)}?agent=${qe.value}`)}const fo=p({}),IA={sm:"w-7 h-7 text-base",md:"w-8 h-8 text-lg",lg:"w-16 h-16 text-3xl"},MA={sm:"w-7 h-7",md:"w-8 h-8",lg:"w-16 h-16"};function RA(e){const t=st.value;return t?`${t.replace(/^ws/,"http")}/avatar/${encodeURIComponent(e)}`:null}function jd({agentId:e,emoji:t="🤖",size:r="md",class:a=""}){const o=RA(e),l=fo.value[e],i=IA[r],c=MA[r],d=()=>{fo.value={...fo.value,[e]:!0}},u=()=>{fo.value={...fo.value,[e]:!1}};return n("div",{class:`flex-shrink-0 relative ${a}`,children:[o&&n("img",{src:o,alt:"",class:`${c} rounded-xl object-cover border border-[var(--color-border)] ${l?"":"hidden"}`,onLoad:d,onError:u}),!l&&n("div",{class:`${i} rounded-xl bg-[var(--color-bg-tertiary)] flex items-center justify-center border border-[var(--color-border)]`,children:t})]})}function DA(){const e=Ja.value,t=uA.value,r=Ds.value;if(!e)return null;const a=e.identity?.emoji||"🤖",o=e.identity?.name||e.name||e.id;return n("div",{class:"relative",children:[n("button",{type:"button",onClick:()=>Ds.value=!r,class:"flex items-center gap-3 px-3 py-2 rounded-xl border border-[var(--color-border)] bg-[var(--color-bg-surface)] hover:bg-[var(--color-bg-hover)] transition-colors min-w-[180px]","aria-expanded":r,"aria-haspopup":"listbox",children:[n(jd,{agentId:e.id,emoji:a,size:"md"}),n("span",{class:"flex-1 text-left font-medium truncate",children:o}),n(Oe,{class:`w-4 h-4 text-[var(--color-text-muted)] transition-transform ${r?"rotate-180":""}`})]}),r&&n(G,{children:[n("button",{type:"button",class:"fixed inset-0 z-10 cursor-default",onClick:()=>Ds.value=!1,"aria-label":"Close menu"}),n("div",{class:"absolute top-full left-0 mt-1 w-full min-w-[220px] py-1 rounded-xl border border-[var(--color-border)] bg-[var(--color-bg-surface)] shadow-lg z-20",role:"listbox",children:t.map(l=>{const i=l.identity?.emoji||"🤖",c=l.identity?.name||l.name||l.id,d=l.id===qe.value;return n("button",{type:"button",role:"option","aria-selected":d,onClick:()=>{TA(l.id),Ds.value=!1},class:`w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-[var(--color-bg-hover)] transition-colors ${d?"bg-[var(--color-bg-tertiary)]":""}`,children:[n(jd,{agentId:l.id,emoji:i,size:"sm"}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"font-medium truncate",children:c}),c!==l.id&&n("div",{class:"text-xs text-[var(--color-text-muted)] truncate",children:l.id})]}),d&&n(Wt,{class:"w-4 h-4 text-[var(--color-accent)] flex-shrink-0"})]},l.id)})})]})]})}function $A(){const e=Ja.value;if(!e)return null;const t=e.id===mx.value,r=e.identity?.name||e.name||e.id,a=e.identity?.emoji||"🤖",o=$c.value,l=hf(e.id);return n("div",{class:"space-y-4",children:n(q,{children:n("div",{class:"p-4",children:o?n("div",{class:"space-y-4",children:[n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n("div",{children:[n("label",{htmlFor:"edit-name",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:s("agents.overview.identityName")}),n(X,{id:"edit-name",type:"text",value:gl.value,onInput:i=>gl.value=i.target.value,placeholder:s("agents.overview.namePlaceholder"),class:"mt-1",fullWidth:!0})]}),n("div",{children:[n("label",{htmlFor:"edit-avatar",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:s("agents.overview.avatar")}),n(X,{id:"edit-avatar",type:"text",value:bl.value,onInput:i=>bl.value=i.target.value,placeholder:s("agents.overview.avatarPlaceholder"),class:"mt-1",fullWidth:!0})]})]}),n("div",{class:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[n("div",{children:[n("label",{htmlFor:"edit-workspace",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:s("agents.overview.workspace")}),n(X,{id:"edit-workspace",type:"text",value:xl.value,onInput:i=>xl.value=i.target.value,placeholder:s("agents.overview.workspacePlaceholder"),class:"mt-1 font-mono text-sm",fullWidth:!0})]}),n("div",{children:[n("label",{htmlFor:"edit-model",class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:s("agents.overview.model")}),n(X,{id:"edit-model",type:"text",value:yl.value,onInput:i=>yl.value=i.target.value,placeholder:s("agents.overview.modelPlaceholder"),class:"mt-1 font-mono text-sm",fullWidth:!0})]})]}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:s("agents.overview.editHint")}),n("div",{class:"flex gap-2",children:[n("button",{type:"button",onClick:wA,disabled:Uo.value,class:"px-3 py-1.5 text-sm font-medium bg-[var(--color-accent)] text-white rounded-lg hover:bg-[var(--color-accent-hover)] disabled:opacity-50",children:Uo.value?s("actions.saving"):s("actions.save")}),n("button",{type:"button",onClick:yA,disabled:Uo.value,class:"px-3 py-1.5 text-sm font-medium text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)] rounded-lg",children:s("actions.cancel")})]})]}):n("div",{class:"flex items-center gap-4",children:[n(jd,{agentId:e.id,emoji:a,size:"lg"}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2",children:[n("h3",{class:"text-lg font-semibold truncate",children:r}),n("span",{class:"text-xl",title:s("agents.overview.identityEmoji"),children:a}),t&&n(Z,{variant:"info",size:"sm",children:s("agents.overview.isDefault")})]}),n("div",{class:"flex flex-col sm:flex-row sm:items-center gap-1 sm:gap-3 mt-1 text-sm text-[var(--color-text-muted)]",children:[n("span",{class:"font-mono truncate",title:tr.value,children:tr.value||"—"}),l&&n(G,{children:[n("span",{class:"hidden sm:inline",children:"•"}),n("span",{class:"truncate",title:l,children:l})]})]})]}),n("div",{class:"flex items-center gap-1",children:[n(K,{icon:n(Ul,{class:"w-4 h-4"}),label:s("actions.edit"),onClick:xA,variant:"ghost"}),qe.value!=="main"&&n(K,{icon:n(Et,{class:"w-4 h-4"}),label:s("actions.delete"),onClick:SA,variant:"ghost",class:"text-[var(--color-error)] hover:bg-[var(--color-error)]/10"})]})]})})})})}const Kr={whitespace:/^\s+$/,cjk:/[\u4E00-\u9FFF\u3400-\u4DBF\u3000-\u303F\uFF00-\uFFEF\u30A0-\u30FF\u2E80-\u2EFF\u31C0-\u31EF\u3200-\u32FF\u3300-\u33FF\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uD7B0-\uD7FF]/,numeric:/^\d+(?:[.,]\d+)*$/,punctuation:/[.,!?;(){}[\]<>:/\\|@#$%^&*+=`~_-]/,alphanumeric:/^[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]+$/},LA=new RegExp(`(\\s+|${Kr.punctuation.source}+)`),NA=6,OA=3,PA=[{pattern:/[äöüßẞ]/i,averageCharsPerToken:3},{pattern:/[éèêëàâîïôûùüÿçœæáíóúñ]/i,averageCharsPerToken:3},{pattern:/[ąćęłńóśźżěščřžýůúďťň]/i,averageCharsPerToken:3.5}];function bx(e,t={}){if(!e)return 0;const{defaultCharsPerToken:r=NA,languageConfigs:a=PA}=t,o=e.split(LA).filter(Boolean);let l=0;for(const i of o)l+=FA(i,a,r);return l}function FA(e,t,r){if(Kr.whitespace.test(e))return 0;if(Kr.cjk.test(e))return zA(e);if(Kr.numeric.test(e)||e.length<=OA)return 1;if(Kr.punctuation.test(e))return e.length>1?Math.ceil(e.length/2):1;if(Kr.alphanumeric.test(e)){const o=Xv(e,t)??r;return Math.ceil(e.length/o)}const a=Xv(e,t)??r;return Math.ceil(e.length/a)}function Xv(e,t){for(const r of t)if(r.pattern.test(e))return r.averageCharsPerToken}function zA(e){return Array.from(e).length}function Yi(e){return e.toLowerCase()==="memory.md"?"MEMORY.md":e}const xx={"AGENTS.md":{icon:"📋",description:"agents.files.meta.agents"},"SOUL.md":{icon:"🎭",description:"agents.files.meta.soul"},"TOOLS.md":{icon:"🛠️",description:"agents.files.meta.tools"},"IDENTITY.md":{icon:"🪪",description:"agents.files.meta.identity"},"USER.md":{icon:"👤",description:"agents.files.meta.user"},"HEARTBEAT.md":{icon:"💓",description:"agents.files.meta.heartbeat"},"BOOTSTRAP.md":{icon:"🚀",description:"agents.files.meta.bootstrap"},"MEMORY.md":{icon:"🧠",description:"agents.files.meta.memory"}},Zv=["AGENTS.md","SOUL.md","TOOLS.md","IDENTITY.md","USER.md","HEARTBEAT.md","MEMORY.md","BOOTSTRAP.md"],UA=["BOOTSTRAP.md"];function yx(e){return e.missing?0:e.content?bx(e.content):e.size!=null?Math.round(e.size/4):0}const Qv=W(()=>Dc.value.reduce((e,t)=>e+yx(t),0));function jA({file:e}){const t=Yi(e.name),r=xx[t]??{icon:"📄",description:"agents.files.meta.unknown"},a=UA.includes(t),o=e.missing&&!a,l=yx(e);return n(q,{padding:"md",class:"hover:bg-[var(--color-bg-hover)] transition-colors cursor-pointer",onClick:()=>Jv(e.name),children:n("div",{class:"flex items-center gap-4",children:[n("div",{class:"text-2xl flex-shrink-0","aria-hidden":"true",children:r.icon}),n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2",children:[n("span",{class:"font-medium",children:e.name}),o&&n(Z,{variant:"warning",size:"sm",children:[n(Tn,{class:"w-3 h-3 mr-1"}),s("agents.files.missing")]})]}),n("p",{class:"text-sm text-[var(--color-text-muted)] truncate",children:s(r.description)}),!e.missing&&(e.size!=null||e.updatedAtMs)&&n("div",{class:"sm:hidden text-xs text-[var(--color-text-muted)] mt-0.5",children:[e.size!=null&&Hu(e.size),l>0&&` · ${pi(l)} tokens`,e.updatedAtMs&&` · ${fi(e.updatedAtMs)}`]})]}),!e.missing&&n("div",{class:"hidden sm:flex items-center gap-4 text-sm text-[var(--color-text-muted)] tabular-nums",children:[n("span",{class:"w-16 text-right",children:e.size!=null&&Hu(e.size)}),n("span",{class:"w-24 text-right",children:l>0&&`${pi(l)} tokens`}),n("span",{class:"w-12 text-right",children:e.updatedAtMs&&fi(e.updatedAtMs)})]}),n(K,{icon:e.missing?n(Zn,{class:"w-4 h-4"}):n(Ul,{class:"w-4 h-4"}),label:e.missing?s("agents.files.create"):s("agents.files.edit"),onClick:i=>{i.stopPropagation(),Jv(e.name)},variant:"ghost"})]})})}function HA(){const e=[...Dc.value].sort((t,r)=>{const a=Yi(t.name),o=Yi(r.name),l=Zv.indexOf(a),i=Zv.indexOf(o);return(l===-1?999:l)-(i===-1?999:i)});return n("div",{class:"space-y-4",children:[n("div",{class:"space-y-2",children:e.map(t=>n(jA,{file:t},t.name))}),Qv.value>0&&n("div",{class:"flex justify-center",children:n(Z,{variant:"default",size:"md",children:s("agents.files.totalTokens",{count:pi(Qv.value)})})}),n(An,{title:s("agents.files.memoryHint.title"),children:n("ul",{class:"list-disc list-inside space-y-1 text-sm",children:[n("li",{children:s("agents.files.memoryHint.line1")}),n("li",{children:s("agents.files.memoryHint.line2")})]})})]})}const BA=[{value:"full",labelKey:"agents.tools.profiles.full"},{value:"coding",labelKey:"agents.tools.profiles.coding"},{value:"messaging",labelKey:"agents.tools.profiles.messaging"},{value:"minimal",labelKey:"agents.tools.profiles.minimal"}],xu=[{id:"fs",labelKey:"agents.tools.sections.files",tools:[{id:"read",label:"read",descriptionKey:"agents.tools.toolDescriptions.read"},{id:"write",label:"write",descriptionKey:"agents.tools.toolDescriptions.write"},{id:"edit",label:"edit",descriptionKey:"agents.tools.toolDescriptions.edit"}]},{id:"runtime",labelKey:"agents.tools.sections.runtime",tools:[{id:"exec",label:"exec",descriptionKey:"agents.tools.toolDescriptions.exec"},{id:"process",label:"process",descriptionKey:"agents.tools.toolDescriptions.process"}]},{id:"web",labelKey:"agents.tools.sections.web",tools:[{id:"web_search",label:"web_search",descriptionKey:"agents.tools.toolDescriptions.webSearch"},{id:"web_fetch",label:"web_fetch",descriptionKey:"agents.tools.toolDescriptions.webFetch"},{id:"browser",label:"browser",descriptionKey:"agents.tools.toolDescriptions.browser"}]},{id:"memory",labelKey:"agents.tools.sections.memory",tools:[{id:"memory_search",label:"memory_search",descriptionKey:"agents.tools.toolDescriptions.memorySearch"},{id:"memory_get",label:"memory_get",descriptionKey:"agents.tools.toolDescriptions.memoryGet"}]},{id:"sessions",labelKey:"agents.tools.sections.sessions",tools:[{id:"sessions_list",label:"sessions_list",descriptionKey:"agents.tools.toolDescriptions.sessionsList"},{id:"sessions_send",label:"sessions_send",descriptionKey:"agents.tools.toolDescriptions.sessionsSend"},{id:"sessions_spawn",label:"sessions_spawn",descriptionKey:"agents.tools.toolDescriptions.sessionsSpawn"}]},{id:"automation",labelKey:"agents.tools.sections.automation",tools:[{id:"message",label:"message",descriptionKey:"agents.tools.toolDescriptions.message"},{id:"cron",label:"cron",descriptionKey:"agents.tools.toolDescriptions.cron"},{id:"gateway",label:"gateway",descriptionKey:"agents.tools.toolDescriptions.gateway"},{id:"nodes",label:"nodes",descriptionKey:"agents.tools.toolDescriptions.nodes"}]}];function WA(){if(Ud.value)return n("div",{class:"flex justify-center py-12",children:n(te,{size:"lg"})});const e=Ct.value.profile??"full",t=xu.flatMap(a=>a.tools).filter(a=>Yv(a.id)).length,r=xu.flatMap(a=>a.tools).length;return n("div",{class:"space-y-4",children:[n(q,{children:[n("div",{class:"p-4 border-b border-[var(--color-border)] flex items-center justify-between",children:[n("div",{children:[n("h3",{class:"text-base font-semibold",children:s("agents.tools.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("agents.tools.enabled",{count:`${t}/${r}`})})]}),Vl.value&&n("button",{type:"button",onClick:fA,disabled:Ki.value,class:"px-3 py-1.5 text-sm font-medium bg-[var(--color-accent)] text-white rounded-lg hover:bg-[var(--color-accent-hover)] disabled:opacity-50",children:Ki.value?s("actions.saving"):s("actions.save")})]}),n("div",{class:"p-4",children:[n("span",{class:"text-xs text-[var(--color-text-muted)] uppercase tracking-wide",children:s("agents.tools.profile")}),n(Re,{value:e,options:BA.map(a=>({value:a.value,label:s(a.labelKey)})),onChange:dA,class:"mt-2 w-full","aria-label":s("agents.tools.profile")})]})]}),xu.map(a=>n(q,{children:[n("div",{class:"p-4 border-b border-[var(--color-border)]",children:n("h4",{class:"text-sm font-semibold",children:s(a.labelKey)})}),n("div",{class:"divide-y divide-[var(--color-border)]",children:a.tools.map(o=>{const l=Yv(o.id);return n("div",{class:"p-4 flex items-center justify-between gap-4 hover:bg-[var(--color-bg-hover)]",children:[n("div",{class:"flex-1 min-w-0",children:[n("div",{class:"flex items-center gap-2",children:[n("code",{class:"text-sm font-medium",children:o.label}),l?n(Ha,{class:"w-4 h-4 text-[var(--color-success)]"}):n(Ba,{class:"w-4 h-4 text-[var(--color-text-muted)]"})]}),n("p",{class:"text-xs text-[var(--color-text-muted)]",children:s(o.descriptionKey)})]}),n($e,{checked:l,onChange:i=>hA(o.id,i)})]},o.id)})})]},a.id))]})}function KA(){const e=Pa.value.filter(d=>!d.disabled&&d.eligible),t=Ft.value,r=t!==null,a=new Set(t??[]),o=bu.value.toLowerCase().trim(),l=o?e.filter(d=>d.name.toLowerCase().includes(o)||d.description.toLowerCase().includes(o)||d.skillKey.toLowerCase().includes(o)):e,i=r?t.length:e.length;function c(d){return r?a.has(d):!0}return qi.value&&Pa.value.length===0?n("div",{class:"flex justify-center py-12",children:n(te,{size:"lg"})}):n("div",{class:"space-y-4",children:[n(q,{children:n("div",{class:"p-4",children:[n("div",{class:"flex items-center justify-between gap-4",children:[n("div",{children:[n("h3",{class:"text-base font-semibold",children:s("agents.skills.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:r?s("agents.skills.usingAllowlist",{allowed:i,total:e.length}):s("agents.skills.usingAll",{count:e.length})})]}),n("div",{class:"flex items-center gap-2",children:[Or.value&&n("button",{type:"button",onClick:bA,disabled:Gi.value,class:"px-3 py-1.5 text-sm font-medium bg-[var(--color-accent)] text-white rounded-lg hover:bg-[var(--color-accent-hover)] disabled:opacity-50",children:Gi.value?s("actions.saving"):s("actions.save")}),n(K,{icon:n(Fe,{class:qi.value?"animate-spin":""}),label:s("actions.refresh"),onClick:()=>{ff(),Ut()},variant:"ghost"})]})]}),n("div",{class:"mt-4 flex flex-wrap gap-2",children:[n("button",{type:"button",onClick:vA,disabled:!r,class:`px-3 py-1.5 text-sm rounded-lg border transition-colors ${r?"border-[var(--color-border)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]":"bg-[var(--color-accent)]/10 border-[var(--color-accent)] text-[var(--color-accent)]"}`,children:s("agents.skills.useAll")}),n("button",{type:"button",onClick:gA,class:"px-3 py-1.5 text-sm rounded-lg border border-[var(--color-border)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]",children:s("agents.skills.selectAll")}),n("button",{type:"button",onClick:mA,class:"px-3 py-1.5 text-sm rounded-lg border border-[var(--color-border)] text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]",children:s("agents.skills.selectNone")})]}),n("div",{class:"mt-4 relative",children:[n(Ke,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(X,{id:"skills-search",type:"text",value:bu.value,onInput:d=>bu.value=d.target.value,placeholder:s("agents.skills.searchPlaceholder"),class:"pl-9",fullWidth:!0,"aria-label":s("agents.skills.searchPlaceholder")})]})]})}),l.length===0?n(q,{children:n("div",{class:"p-8 text-center text-[var(--color-text-muted)]",children:s(o?"agents.skills.noSearchResults":"agents.skills.noSkills")})}):n(q,{padding:"none",children:l.map(d=>{const u=c(d.name);return n("div",{class:"flex items-center gap-3 px-4 py-3 border-b border-[var(--color-border)] last:border-b-0 hover:bg-[var(--color-bg-tertiary)]",children:[n("span",{class:"text-xl w-8 text-center flex-shrink-0",children:d.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:d.name}),d.always&&n("span",{class:"text-xs text-[var(--color-text-muted)]",title:s("agents.skills.alwaysActive"),children:"⚡"})]}),n("p",{class:"text-xs text-[var(--color-text-muted)] truncate",children:d.description})]}),n("a",{href:`/skills?skill=${encodeURIComponent(d.skillKey)}`,onClick:h=>{h.preventDefault(),De(`/skills?skill=${encodeURIComponent(d.skillKey)}`)},class:"text-xs text-[var(--color-accent)] hover:underline flex-shrink-0",children:s("agents.skills.details")}),n($e,{checked:u,onChange:()=>pA(d.name)})]},d.skillKey)})}),n(An,{children:[n("strong",{children:s("agents.skills.useAll")})," ",s("agents.skills.useAllHint"),n("br",{}),n("strong",{children:s("agents.skills.selectSpecific")})," ",s("agents.skills.selectSpecificHint"),n("br",{}),s("agents.skills.globalHint")," ",n("a",{href:"/skills",class:"text-[var(--color-accent)] hover:underline",children:s("nav.skills")})," ",s("agents.skills.page"),"."]})]})}function qA(){return n(ze,{open:jo.value,onClose:()=>jo.value=!1,title:s("agents.create.title"),children:n("div",{class:"space-y-4",children:[n("div",{children:[n("label",{htmlFor:"create-name",class:"text-sm font-medium",children:s("agents.create.name")}),n(X,{id:"create-name",type:"text",value:Ho.value,onInput:e=>Ho.value=e.target.value,placeholder:s("agents.create.namePlaceholder"),class:"mt-1",fullWidth:!0}),n("p",{class:"mt-1 text-xs text-[var(--color-text-muted)]",children:s("agents.create.nameHint")})]}),n("div",{children:[n("label",{htmlFor:"create-workspace",class:"text-sm font-medium",children:s("agents.create.workspace")}),n(X,{id:"create-workspace",type:"text",value:Bo.value,onInput:e=>Bo.value=e.target.value,placeholder:s("agents.create.workspacePlaceholder"),class:"mt-1 font-mono text-sm",fullWidth:!0})]}),n("div",{children:[n("label",{htmlFor:"create-emoji",class:"text-sm font-medium",children:s("agents.create.emoji")}),n(X,{id:"create-emoji",type:"text",value:wl.value,onInput:e=>wl.value=e.target.value,placeholder:s("agents.create.emojiPlaceholder"),class:"mt-1",fullWidth:!0})]}),n("div",{class:"flex justify-end gap-2 pt-2",children:[n(P,{variant:"ghost",onClick:()=>jo.value=!1,disabled:Wo.value,children:s("actions.cancel")}),n(P,{variant:"primary",onClick:_A,disabled:Wo.value||!Ho.value.trim()||!Bo.value.trim(),children:Wo.value?s("actions.creating"):s("agents.create.submit")})]})]})})}function GA(){const e=Ja.value;return n(ze,{open:Ko.value,onClose:()=>Ko.value=!1,title:s("agents.delete.title"),children:n("div",{class:"space-y-4",children:[n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 border border-[var(--color-error)]/20",children:n("div",{class:"flex items-start gap-3",children:[n(Tn,{class:"w-6 h-6 text-[var(--color-error)] flex-shrink-0 mt-0.5"}),n("div",{children:[n("h4",{class:"font-semibold text-[var(--color-error)]",children:s("agents.delete.warning")}),n("p",{class:"mt-1 text-sm text-[var(--color-text-secondary)]",children:s("agents.delete.warningDescription")})]})]})}),n("div",{class:"text-sm",children:[n("p",{class:"font-medium mb-2",children:s("agents.delete.willDelete")}),n("ul",{class:"list-disc list-inside space-y-1 text-[var(--color-text-secondary)]",children:[n("li",{children:s("agents.delete.willDeleteConfig")}),n("li",{children:s("agents.delete.willDeleteBindings")}),n("li",{children:s("agents.delete.willDeleteSessions")})]})]}),n("div",{class:"p-3 rounded-lg border border-[var(--color-border)]",children:n(eb,{checked:Vi.value,onChange:t=>Vi.value=t,label:s("agents.delete.includeFiles"),description:s("agents.delete.includeFilesDescription",{path:tr.value}),class:"text-[var(--color-error)]"})}),n("div",{children:[n("label",{htmlFor:"delete-confirm",class:"text-sm font-medium",children:s("agents.delete.confirmPrompt",{id:e?.id||"agent"})}),n(X,{id:"delete-confirm",type:"text",value:qo.value,onInput:t=>qo.value=t.target.value,placeholder:e?.id||"agent",class:"mt-1 font-mono",fullWidth:!0})]}),n("div",{class:"flex justify-end gap-2 pt-2",children:[n(P,{variant:"ghost",onClick:()=>Ko.value=!1,disabled:Go.value,children:s("actions.cancel")}),n(P,{variant:"danger",onClick:CA,disabled:Go.value||qo.value!==e?.id,children:Go.value?s("actions.deleting"):s("agents.delete.submit")})]})]})})}const VA=[{id:"overview",label:"agents.tabs.overview",icon:n(ok,{class:"w-4 h-4"})},{id:"files",label:"agents.tabs.files",icon:n(Ht,{class:"w-4 h-4"})},{id:"tools",label:"agents.tabs.tools",icon:n(Ug,{class:"w-4 h-4"})},{id:"skills",label:"agents.tabs.skills",icon:n(kc,{class:"w-4 h-4"})}];function YA(e){O(()=>{L.value&&Yl().then(()=>{Xa(),Ut()})},[L.value]);const t=Oa.value;return n(Kt,{viewName:s("nav.agents"),children:[n(Mt,{title:s("agents.title"),subtitle:s("agents.description"),actions:n("div",{class:"flex items-center gap-3",children:[n(DA,{}),n(K,{icon:n(Zn,{class:"w-4 h-4"}),label:s("agents.create.title"),onClick:kA,disabled:!L.value,variant:"ghost"}),n(K,{icon:n(Fe,{class:`w-4 h-4 ${zo.value?"animate-spin":""}`}),label:s("actions.refresh"),onClick:AA,disabled:zo.value||!L.value,variant:"ghost"})]})}),n(cx,{items:VA.map(r=>({...r,label:s(r.label)})),activeId:t,onChange:r=>EA(r)}),Wi.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Wi.value}),zo.value&&Dc.value.length===0?n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg"})}):n(G,{children:[t==="overview"&&n($A,{}),t==="files"&&n(HA,{}),t==="tools"&&n(WA,{}),t==="skills"&&n(KA,{})]}),tr.value&&n("p",{class:"text-xs text-[var(--color-text-muted)] text-center",children:tr.value}),n(qA,{}),n(GA,{})]})}const ht=p(null),wx=p("main"),Lc=p(""),ft=p(""),yn=p("view"),Hd=p(!1),Vo=p(!1),Ji=p(null),yo=W(()=>ft.value!==Lc.value),JA=W(()=>{const e=ht.value?.name??"",t=Yi(e);return xx[t]??{icon:"📄",description:"agents.files.meta.unknown"}});function XA(){return new URLSearchParams(window.location.search).get("agent")||"main"}async function ZA(e,t){Hd.value=!0,Ji.value=null,wx.value=t;try{const r=await N("agents.files.get",{agentId:t,name:e});ht.value=r.file;const a=r.file.content??"";Lc.value=a,ft.value=a,yn.value=r.file.missing||!a?"edit":"view"}catch(r){Ji.value=r instanceof Error?r.message:s("agents.files.loadFileError"),J.error(s("agents.files.loadFileError"))}finally{Hd.value=!1}}async function em(){if(ht.value){Vo.value=!0;try{await N("agents.files.set",{agentId:wx.value,name:ht.value.name,content:ft.value}),Lc.value=ft.value,ht.value={...ht.value,missing:!1,content:ft.value,size:new Blob([ft.value]).size,updatedAtMs:Date.now()},J.success(s("agents.files.saved"))}catch{J.error(s("agents.files.saveError"))}finally{Vo.value=!1}}}function QA(){yo.value&&!window.confirm(s("agents.files.unsavedWarning"))||(ht.value=null,Lc.value="",ft.value="",yn.value="view",De("/agents"))}function tm({active:e,onClick:t,icon:r,label:a,indicator:o}){return n("button",{type:"button",onClick:t,class:`flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${e?"bg-[var(--color-accent)]/10 text-[var(--color-accent)]":"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-bg-hover)]"}`,children:[r,a,o&&n("span",{class:"w-1.5 h-1.5 rounded-full bg-[var(--color-warning)]"})]})}function eT({filename:e}){const t=e?decodeURIComponent(e):"";return O(()=>{if(L.value&&t){const r=XA();ZA(t,r)}},[L.value,t]),O(()=>{function r(a){(a.metaKey||a.ctrlKey)&&a.key==="s"&&(a.preventDefault(),yn.value==="edit"&&yo.value&&!Vo.value&&em())}return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),n(Ac,{viewName:t||s("nav.agents"),children:n("div",{class:"flex-1 flex flex-col overflow-hidden",children:[n("div",{class:"flex items-center justify-between gap-4 px-4 sm:px-6 py-3 border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)]",children:[n("div",{class:"flex items-center gap-3 min-w-0",children:[n(K,{icon:n(pc,{class:"w-4 h-4"}),label:s("agents.files.backToList"),onClick:QA,variant:"ghost"}),n("div",{class:"flex items-center gap-2 min-w-0",children:[n("span",{class:"text-xl","aria-hidden":"true",children:JA.value.icon}),n("h1",{class:"font-semibold truncate",children:e}),yo.value&&n(Z,{variant:"warning",size:"sm",children:s("agents.files.unsaved")})]})]}),n("div",{class:"flex items-center gap-2",children:[ht.value&&!ht.value.missing&&n("span",{class:"hidden sm:block text-sm text-[var(--color-text-muted)]",children:[ht.value.size!=null&&Hu(ht.value.size),ft.value&&n(G,{children:[" • ",pi(bx(ft.value))," tokens"]}),ht.value.updatedAtMs&&n(G,{children:[" • ",fi(ht.value.updatedAtMs)]})]}),yn.value==="edit"&&n(P,{variant:"primary",size:"sm",icon:n(Oh,{class:"w-4 h-4"}),onClick:em,disabled:!yo.value||Vo.value,children:Vo.value?s("actions.saving"):s("actions.save")})]})]}),n("div",{class:"flex gap-1 px-4 sm:px-6 py-2 border-b border-[var(--color-border)] bg-[var(--color-bg-primary)]",children:[n(tm,{active:yn.value==="view",onClick:()=>yn.value="view",icon:n($h,{class:"w-4 h-4"}),label:s("agents.files.view")}),n(tm,{active:yn.value==="edit",onClick:()=>yn.value="edit",icon:n(Ul,{class:"w-4 h-4"}),label:s("agents.files.edit"),indicator:yo.value})]}),n("div",{class:"flex-1 overflow-y-auto",children:[Ji.value&&n("div",{class:"m-4 p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Ji.value}),Hd.value?n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg"})}):yn.value==="view"?n("div",{class:"p-4 sm:p-6 max-w-4xl mx-auto",children:ft.value?n(Wl,{content:ft.value}):n("p",{class:"text-[var(--color-text-muted)] italic",children:s("agents.files.emptyFile")})}):n("div",{class:"p-4 sm:p-6 h-full",children:n(xa,{value:ft.value,onInput:r=>ft.value=r.target.value,placeholder:s("agents.files.editPlaceholder"),class:"font-mono text-sm h-full min-h-[400px] resize-none",fullWidth:!0})})]})]})})}function tT(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 Qe(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 kl(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"}function nT({healthData:e}){const t=ch.value;return n(q,{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(Tr,{class:"w-5 h-5 text-[var(--color-accent)]"})}),n("div",{children:[n("h3",{class:"font-semibold",children:s("usage.gateway.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:Ua.value||s("usage.gateway.unknown")})]}),At.value&&n(Z,{variant:"default",size:"sm",class:"ml-auto",children:ag(At.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:s("usage.gateway.uptime")}),n("div",{class:"font-medium",children:t!=null?tT(t):"-"})]})]}),n("div",{class:"flex items-center gap-2",children:[n(Kn,{class:"w-4 h-4 text-[var(--color-text-muted)]"}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:s("usage.gateway.sessions")}),n("div",{class:"font-medium",children:e?.sessions?.count??"-"})]})]})]}),(Co.value||Ao.value)&&n("div",{class:"mt-4 pt-4 border-t border-[var(--color-border)] space-y-2",children:[Co.value&&n("div",{class:"flex items-center gap-2 text-xs text-[var(--color-text-muted)]",children:[n(Ht,{class:"w-3.5 h-3.5"}),n("span",{class:"truncate font-mono",children:Co.value})]}),Ao.value&&n("div",{class:"flex items-center gap-2 text-xs text-[var(--color-text-muted)]",children:[n(B2,{class:"w-3.5 h-3.5"}),n("span",{class:"truncate font-mono",children:Ao.value})]})]})]})}function rT({usage:e,isLoading:t}){if(!e)return n(q,{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(rd,{class:"w-5 h-5 text-[var(--color-success)]"})}),n("h3",{class:"font-semibold",children:s("usage.summary.title")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s(t?"status.loading":"usage.summary.unavailable")})]});const r=e.totals;return n(q,{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(rd,{class:"w-5 h-5 text-[var(--color-success)]"})}),n("div",{children:[n("h3",{class:"font-semibold",children:s("usage.summary.title")}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("usage.summary.period",{days:e.days})})]})]}),r.totalCost>0&&n("div",{class:"text-right",children:[n("div",{class:"text-2xl font-bold text-[var(--color-success)]",children:kl(r.totalCost)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.summary.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:s("usage.summary.input")}),n("div",{class:"font-medium",children:Qe(r.input)})]}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:s("usage.summary.output")}),n("div",{class:"font-medium",children:Qe(r.output)})]}),n("div",{children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:s("usage.summary.total")}),n("div",{class:"font-medium",children:Qe(r.totalTokens)})]})]}),(r.cacheRead>0||r.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:s("usage.summary.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:s("usage.summary.cacheRead")}),n("div",{class:"font-medium",children:Qe(r.cacheRead)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.summary.cacheWrite")}),n("div",{class:"font-medium",children:Qe(r.cacheWrite)})]})]})]})]})}function aT({usage:e}){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(q,{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(Pl,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:s("usage.daily.title")})]}),n("div",{class:"space-y-2",children:t.map(a=>{const o=a.totalTokens/r*100,i=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:i}),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:Qe(a.totalTokens)})]},a.date)})})]})}function oT({healthData:e}){return!e?.agents||e.agents.length===0?null:n(q,{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(ki,{class:"w-5 h-5 text-[var(--color-warning)]"})}),n("h3",{class:"font-semibold",children:s("usage.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(Z,{variant:"success",size:"sm",children:s("usage.agents.default")})]}),n("div",{class:"flex items-center gap-4 text-sm text-[var(--color-text-muted)]",children:[n("span",{children:[t.sessions.count," ",s("usage.agents.sessions")]}),t.heartbeat.enabled&&n("span",{class:"flex items-center gap-1",children:[n(fn,{class:"w-3.5 h-3.5"}),t.heartbeat.every]})]})]},t.agentId))})]})}const ri=p(null),ai=p(null),oi=p(d0()),Xi=p(null),Yo=p(!1),Zi=p(!1),li=p(!1),Qi=p(null),pf=p(30),$s=p("recent"),po=p(!0),xt=p(0),$n=5,Bd=p("overview"),_l=p(null),Sl=p([]),Jo=p(!1),Xo=p(!1);async function lT(){Yo.value=!0,Qi.value=null;try{const e=await N("health",{probe:!1});ri.value=e}catch(e){Qi.value=ne(e),J.error(s("usage.loadError"))}finally{Yo.value=!1}}async function kx(e=30){Zi.value=!0,pf.value=e;try{const t=await N("usage.cost",{days:e});ai.value=t}catch{}finally{Zi.value=!1}sT(e)}async function sT(e=30){if(!li.value){li.value=!0;try{const t=new Date,r=new Date;r.setDate(r.getDate()-e);const a=await N("sessions.usage",{startDate:r.toISOString().split("T")[0],endDate:t.toISOString().split("T")[0],limit:100,includeContextWeight:!0});oi.value=a,a&&h0(a)}catch{oi.value||(oi.value=null)}finally{li.value=!1}}}async function nm(){await Promise.all([lT(),kx(pf.value)])}async function iT(e){if(!Jo.value){Jo.value=!0,_l.value=null;try{const t=await N("sessions.usage.timeseries",{key:e});_l.value=t}catch{}finally{Jo.value=!1}}}async function cT(e){if(!Xo.value){Xo.value=!0,Sl.value=[];try{const t=await N("sessions.usage.logs",{key:e,limit:100});Sl.value=t?.logs??[]}catch{}finally{Xo.value=!1}}}function uT(){Xi.value=null,Bd.value="overview",_l.value=null,Sl.value=[]}function dT(){const e=oi.value,t=Xi.value,r=li.value;if(!e&&r)return n(q,{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(jn,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:s("usage.sessions.title")}),n(te,{size:"sm"})]}),n("div",{class:"space-y-3",children:[1,2,3].map(u=>n("div",{class:"animate-pulse flex items-center gap-3 p-3 rounded-lg bg-[var(--color-bg-secondary)]",children:[n("div",{class:"w-8 h-8 rounded-lg bg-[var(--color-bg-tertiary)]"}),n("div",{class:"flex-1 space-y-2",children:[n("div",{class:"h-4 bg-[var(--color-bg-tertiary)] rounded w-1/3"}),n("div",{class:"h-3 bg-[var(--color-bg-tertiary)] rounded w-1/4"})]})]},u))})]});if(!e||e.sessions.length===0)return n(q,{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(jn,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:s("usage.sessions.title")})]}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("usage.sessions.noData")})]});const a=[...e.sessions].sort((u,h)=>{const f=$s.value,v=po.value;let m=0;return f==="cost"?m=(u.usage.totalCost||0)-(h.usage.totalCost||0):f==="tokens"?m=(u.usage.totalTokens||0)-(h.usage.totalTokens||0):f==="recent"&&(m=(u.updatedAt||0)-(h.updatedAt||0)),v?-m:m}),o=a.slice(xt.value*$n,(xt.value+1)*$n),l=u=>{$s.value===u?po.value=!po.value:($s.value=u,po.value=!0),xt.value=0},i=({col:u})=>$s.value!==u?null:po.value?n(Oe,{class:"w-3 h-3 inline ml-1"}):n(mc,{class:"w-3 h-3 inline ml-1"}),c=u=>{Xi.value=t?.key===u.key?null:u},d=()=>a.length>$n?n("div",{class:"mt-4 flex items-center justify-between",children:[n("div",{class:"text-sm text-[var(--color-text-muted)]",children:s("usage.sessions.showing",{from:xt.value*$n+1,to:Math.min((xt.value+1)*$n,a.length),total:a.length})}),n("div",{class:"flex items-center gap-1",children:[n(K,{icon:n(Ag,{class:"w-4 h-4"}),label:s("actions.previous"),onClick:()=>{xt.value=Math.max(0,xt.value-1)},disabled:xt.value===0,variant:"ghost",size:"sm"}),n("span",{class:"px-2 text-sm text-[var(--color-text-muted)]",children:[xt.value+1," / ",Math.ceil(a.length/$n)]}),n(K,{icon:n(rt,{class:"w-4 h-4"}),label:s("actions.next"),onClick:()=>{xt.value=Math.min(Math.ceil(a.length/$n)-1,xt.value+1)},disabled:xt.value>=Math.ceil(a.length/$n)-1,variant:"ghost",size:"sm"})]})]}):null;return n(G,{children:[n("div",{class:"md:hidden space-y-2 min-w-0 overflow-hidden",children:[n("div",{class:"flex items-center gap-3 mb-3",children:[n("div",{class:"p-2 rounded-lg bg-[var(--color-info)]/10",children:n(jn,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:s("usage.sessions.title")}),r&&n(te,{size:"sm"})]}),o.map(u=>n(Ya,{icon:dn,iconVariant:t?.key===u.key?"info":"default",title:u.label||u.key,subtitle:u.model||void 0,meta:[{icon:fn,value:Qe(u.usage.totalTokens)},{icon:rd,value:kl(u.usage.totalCost)},...u.updatedAt?[{icon:me,value:le(new Date(u.updatedAt),{relative:!0})}]:[]],onClick:()=>c(u)},u.key)),n(d,{})]}),n(q,{padding:"md",class:"hidden md:block",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(jn,{class:"w-5 h-5 text-[var(--color-info)]"})}),n("h3",{class:"font-semibold",children:s("usage.sessions.title")}),r&&n(te,{size:"sm"})]}),n("div",{class:"overflow-x-auto",children:n("table",{class:"w-full text-sm",children:[n("thead",{children:n("tr",{class:"border-b border-[var(--color-border)]",children:[n("th",{class:"text-left py-2 px-2 font-medium text-[var(--color-text-muted)]",children:s("usage.sessions.name")}),n("th",{class:"text-left py-2 px-2 font-medium text-[var(--color-text-muted)]",children:s("usage.sessions.model")}),n("th",{class:"text-right py-2 px-2 font-medium",children:n("button",{type:"button",class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] cursor-pointer",onClick:()=>l("tokens"),children:[s("usage.sessions.tokens"),n(i,{col:"tokens"})]})}),n("th",{class:"text-right py-2 px-2 font-medium",children:n("button",{type:"button",class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] cursor-pointer",onClick:()=>l("cost"),children:[s("usage.sessions.cost"),n(i,{col:"cost"})]})}),n("th",{class:"text-right py-2 px-2 font-medium",children:n("button",{type:"button",class:"text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)] cursor-pointer",onClick:()=>l("recent"),children:[s("usage.sessions.lastActive"),n(i,{col:"recent"})]})})]})}),n("tbody",{children:o.map(u=>{const h=t?.key===u.key;return n("tr",{class:`border-b border-[var(--color-border)] cursor-pointer transition-colors ${h?"bg-[var(--color-accent)]/10":"hover:bg-[var(--color-bg-hover)]"}`,onClick:()=>c(u),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),c(u))},tabIndex:0,"aria-label":s("usage.sessions.viewDetails",{name:u.label||u.key}),children:[n("td",{class:"py-2 px-2 truncate max-w-[200px]",title:u.key,children:u.label||u.key}),n("td",{class:"py-2 px-2 text-[var(--color-text-muted)] truncate max-w-[120px]",title:u.model||void 0,children:u.model||"-"}),n("td",{class:"py-2 px-2 text-right font-mono",children:Qe(u.usage.totalTokens)}),n("td",{class:"py-2 px-2 text-right font-mono",children:kl(u.usage.totalCost)}),n("td",{class:"py-2 px-2 text-right text-[var(--color-text-muted)]",children:u.updatedAt?le(new Date(u.updatedAt),{relative:!0}):"-"})]},u.key)})})]})}),n(d,{})]})]})}function hT(){const e=Xi.value,t=Bd.value;O(()=>{e&&(t==="timeline"&&!_l.value&&!Jo.value?iT(e.key):t==="messages"&&Sl.value.length===0&&!Xo.value&&cT(e.key))},[e,t]);const r=[{id:"overview",label:s("usage.detail.tabs.overview")},{id:"timeline",label:s("usage.detail.tabs.timeline")},{id:"messages",label:s("usage.detail.tabs.messages")}];return n(ze,{open:!!e,onClose:uT,title:s("usage.detail.title"),children:e&&n("div",{class:"space-y-4",children:[n("p",{class:"text-sm text-[var(--color-text-muted)] truncate -mt-2",children:e.label||e.key}),n("div",{class:"flex gap-1 border-b border-[var(--color-border)]",role:"tablist",children:r.map(a=>n("button",{type:"button",role:"tab","aria-selected":t===a.id,onClick:()=>{Bd.value=a.id},class:`px-3 py-2 text-sm font-medium transition-colors border-b-2 -mb-px ${t===a.id?"border-[var(--color-accent)] text-[var(--color-accent)]":"border-transparent text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]"}`,children:a.label},a.id))}),n("div",{role:"tabpanel",children:[t==="overview"&&n(fT,{session:e}),t==="timeline"&&n(pT,{}),t==="messages"&&n(vT,{})]})]})})}function fT({session:e}){const t=e.contextWeight;return n("div",{class:"space-y-4",children:[n("div",{class:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.summary.input")}),n("div",{class:"font-medium",children:Qe(e.usage.input)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.summary.output")}),n("div",{class:"font-medium",children:Qe(e.usage.output)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.summary.cacheRead")}),n("div",{class:"font-medium",children:Qe(e.usage.cacheRead)})]}),n("div",{children:[n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.summary.totalCost")}),n("div",{class:"font-medium text-[var(--color-success)]",children:kl(e.usage.totalCost)})]})]}),t&&t.total>0&&n("div",{class:"pt-4 border-t border-[var(--color-border)]",children:[n("h4",{class:"text-sm font-medium mb-3",children:s("usage.detail.contextWeight")}),n("div",{class:"space-y-2",children:[t.systemPrompt!=null&&t.systemPrompt>0&&n(vo,{label:s("usage.detail.system"),value:t.systemPrompt,total:t.total,color:"var(--color-accent)"}),t.skills!=null&&t.skills>0&&n(vo,{label:s("usage.detail.skills"),value:t.skills,total:t.total,color:"var(--color-success)"}),t.tools!=null&&t.tools>0&&n(vo,{label:s("usage.detail.tools"),value:t.tools,total:t.total,color:"var(--color-warning)"}),t.files!=null&&t.files>0&&n(vo,{label:s("usage.detail.files"),value:t.files,total:t.total,color:"var(--color-info)"}),t.other!=null&&t.other>0&&n(vo,{label:s("usage.detail.other"),value:t.other,total:t.total,color:"var(--color-text-muted)"})]})]})]})}function pT(){const e=_l.value;if(Jo.value)return n("div",{class:"flex justify-center py-8",children:n(te,{size:"md"})});if(!e||e.points.length===0)return n("p",{class:"text-sm text-[var(--color-text-muted)] py-4 text-center",children:s("usage.detail.noTimeline")});const r=e.points,a=Math.max(...r.map(w=>w.cumulativeTokens)),o=Math.max(...r.map(w=>w.cumulativeCost)),l=400,i=120,c={top:10,right:10,bottom:20,left:40},d=l-c.left-c.right,u=i-c.top-c.bottom,h=w=>c.left+w/(r.length-1)*d,f=w=>c.top+u-w/(a||1)*u,v=r.map((w,k)=>`${k===0?"M":"L"} ${h(k)} ${f(w.cumulativeTokens)}`).join(" "),m=`${v} L ${h(r.length-1)} ${c.top+u} L ${c.left} ${c.top+u} Z`;return n("div",{class:"space-y-3",children:[n("div",{class:"flex items-center justify-between text-xs text-[var(--color-text-muted)]",children:[n("span",{children:s("usage.detail.cumulativeTokens")}),n("span",{children:[Qe(a)," max"]})]}),n("svg",{viewBox:`0 0 ${l} ${i}`,class:"w-full h-auto",children:[[0,.25,.5,.75,1].map(w=>n("line",{x1:c.left,y1:c.top+u*(1-w),x2:l-c.right,y2:c.top+u*(1-w),stroke:"var(--color-border)","stroke-dasharray":"2,2"},w)),n("path",{d:m,fill:"var(--color-accent)",opacity:"0.2"}),n("path",{d:v,fill:"none",stroke:"var(--color-accent)","stroke-width":"2"}),n("text",{x:c.left,y:i-2,"font-size":"10",fill:"var(--color-text-muted)","text-anchor":"start",children:le(new Date(r[0].timestamp),{relative:!1})}),n("text",{x:l-c.right,y:i-2,"font-size":"10",fill:"var(--color-text-muted)","text-anchor":"end",children:le(new Date(r[r.length-1].timestamp),{relative:!1})})]}),n("div",{class:"grid grid-cols-3 gap-4 pt-2 border-t border-[var(--color-border)]",children:[n("div",{class:"text-center",children:[n("div",{class:"text-lg font-semibold",children:r.length}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.detail.requests")})]}),n("div",{class:"text-center",children:[n("div",{class:"text-lg font-semibold",children:Qe(a)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.detail.totalTokens")})]}),n("div",{class:"text-center",children:[n("div",{class:"text-lg font-semibold text-[var(--color-success)]",children:kl(o)}),n("div",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.detail.totalCost")})]})]})]})}function vT(){const e=Sl.value;if(Xo.value)return n("div",{class:"flex justify-center py-8",children:n(te,{size:"md"})});if(e.length===0)return n("p",{class:"text-sm text-[var(--color-text-muted)] py-4 text-center",children:s("usage.detail.noMessages")});const r={user:"info",assistant:"success",tool:"warning",toolResult:"default"},a={user:s("usage.detail.role.user"),assistant:s("usage.detail.role.assistant"),tool:s("usage.detail.role.tool"),toolResult:s("usage.detail.role.toolResult")};return n("div",{class:"space-y-2 max-h-[300px] overflow-y-auto",children:e.map((o,l)=>n("div",{class:"p-2 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:[n("div",{class:"flex items-center justify-between gap-2 mb-1",children:[n("div",{class:"flex items-center gap-2",children:[n(Z,{variant:r[o.role],children:a[o.role]||o.role}),o.tokens!=null&&n("span",{class:"text-xs text-[var(--color-text-muted)]",children:s("usage.detail.tokenCount",{count:Qe(o.tokens)})})]}),n("span",{class:"text-xs text-[var(--color-text-muted)]",children:le(new Date(o.timestamp),{relative:!0})})]}),n("p",{class:"text-sm text-[var(--color-text-secondary)] line-clamp-2",children:o.content})]},l))})}function vo({label:e,value:t,total:r,color:a}){const o=Math.round(t/r*100);return n("div",{class:"flex items-center gap-3",children:[n("div",{class:"w-24 text-xs text-[var(--color-text-muted)]",children:e}),n("div",{class:"flex-1 h-2 bg-[var(--color-bg-tertiary)] rounded-full overflow-hidden",children:n("div",{class:"h-full rounded-full transition-all",style:{width:`${o}%`,backgroundColor:a}})}),n("div",{class:"w-16 text-xs text-right",children:[Qe(t)," (",o,"%)"]})]})}function mT(e){return O(()=>{L.value&&nm()},[L.value]),n(Kt,{viewName:s("nav.usage"),children:[n(Mt,{title:s("usage.title"),subtitle:s("usage.description"),actions:n(K,{icon:n(Fe,{class:`w-4 h-4 ${Yo.value?"animate-spin":""}`}),label:s("actions.refresh"),onClick:()=>nm(),disabled:Yo.value||!L.value,variant:"ghost"})}),Qi.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Qi.value}),Yo.value&&!ri.value||!L.value?n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:L.value?void 0:s("status.connecting")})}):n("div",{class:"grid gap-6 md:grid-cols-2",children:[n(nT,{healthData:ri.value}),n(rT,{usage:ai.value,isLoading:Zi.value}),n("div",{class:"md:col-span-2",children:n(aT,{usage:ai.value})}),n("div",{class:"md:col-span-2 min-w-0",children:n(dT,{})}),n("div",{class:"md:col-span-2",children:n(oT,{healthData:ri.value})})]}),ai.value&&n("div",{class:"flex justify-center gap-2",children:[7,14,30,90].map(t=>n(P,{variant:pf.value===t?"primary":"ghost",size:"sm",onClick:()=>kx(t),disabled:Zi.value,children:[t,"d"]},t))}),n(hT,{})]})}const yu={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"},wu={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"},ku={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"},_u={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"},Su={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"},Cu={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"},Au={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"},gT="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",bT=[{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"}],xT="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",yT="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",wT=[{cx:7.5,cy:12,r:1.5},{cx:12,cy:12,r:1.5},{cx:16.5,cy:12,r:1.5}],kT={telegram:{path:Cu.path,hex:Cu.hex,title:Cu.title},discord:{path:yu.path,hex:yu.hex,title:yu.title},signal:{path:Su.path,hex:Su.hex,title:Su.title},whatsapp:{path:Au.path,hex:Au.hex,title:Au.title},googlechat:{path:wu.path,hex:wu.hex,title:wu.title},matrix:{path:_u.path,hex:_u.hex,title:_u.title},mastodon:{path:ku.path,hex:ku.hex,title:ku.title},imessage:{path:gT,hex:"34C759",title:"iMessage"},nostr:{path:xT,hex:"8B5CF6",title:"Nostr"}};function _T({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"}),bT.map((c,d)=>n("path",{fill:a?c.color:"currentColor",d:c.path},d))]});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:yT}),wT.map((d,u)=>n("circle",{cx:d.cx,cy:d.cy,r:d.r,fill:c},u))]})}if(o==="webchat")return n(Bt,{class:r,style:{width:t,height:t,color:a?"#6366f1":"currentColor"}});const l=kT[o];if(!l)return n(Bt,{class:r,style:{width:t,height:t}});const i=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:i,d:l.path})]})}function ST(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 CT(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:ST(r)}})}function _x(e){return e.accounts.reduce((t,r)=>{const a=r.lastInboundAt??0,o=r.lastOutboundAt??0;return Math.max(t,a,o)},0)}const dr=p([]),tn=p(!1),Zo=p(!1),Qo=p(null),an=p(null),ec=p(!1);function AT(e){switch(e){case"connected":return{variant:"success",label:s("channels.status.connected")};case"configured":return{variant:"warning",label:s("channels.status.configured")};case"not-configured":return{variant:"default",label:s("channels.status.notConfigured")};case"disabled":return{variant:"default",label:s("channels.status.disabled")};case"error":return{variant:"error",label:s("channels.status.error")}}}async function si(e=!1){e?Zo.value=!0:tn.value=!0,Qo.value=null;try{const t=await N("channels.status",{probe:e,timeoutMs:e?15e3:1e4});dr.value=CT(t)}catch(t){Qo.value=ne(t)}finally{tn.value=!1,Zo.value=!1}}async function TT(){if(an.value){ec.value=!0;try{await N("channels.logout",{channel:an.value.channel,accountId:an.value.accountId}),J.success(s("channels.logoutSuccess",{channel:an.value.label})),an.value=null,si()}catch(e){J.error(ne(e))}finally{ec.value=!1}}}const ET=W(()=>{const e=dr.value,t=Date.now()-1440*60*1e3;return{total:e.length,active:e.filter(r=>_x(r)>t).length,errors:e.filter(r=>r.status==="error").length}});function IT({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(K,{icon:n(V2,{class:"w-3.5 h-3.5"}),label:s("channels.logout"),onClick:()=>{an.value={channel:t,accountId:e.accountId,label:`${r} (${e.name||e.accountId})`}},variant:"ghost",size:"sm"})]})}function MT({channel:e}){const t=AT(e.status),r=_x(e);return n(q,{padding:"md",children:[n("div",{class:"flex items-start gap-3 mb-4",children:[n(_T,{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(Z,{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"}),le(r,{relative:!0})]}),n("button",{type:"button",onClick:()=>De(`/config#channels.${e.id}`),class:"flex items-center gap-1 hover:text-[var(--color-accent)] transition-colors",children:[n(Fh,{class:"w-3.5 h-3.5"}),s("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:[s("channels.docs"),n(Fl,{class:"w-3 h-3"})]})]})]})]}),e.accounts.length>0&&n("div",{class:"space-y-2",children:e.accounts.map(a=>n(IT,{account:a,channelId:e.id,channelLabel:e.label},a.accountId))})]})}function RT(){return an.value?n(ze,{open:!0,onClose:()=>{an.value=null},title:s("channels.logoutTitle"),children:[n("div",{class:"space-y-4",children:[n("p",{class:"text-[var(--color-text-secondary)]",children:s("channels.logoutConfirm",{channel:an.value.label})}),n("p",{class:"text-sm text-[var(--color-text-muted)]",children:s("channels.logoutWarning")})]}),n("div",{class:"flex justify-end gap-3 mt-6",children:[n(P,{variant:"ghost",onClick:()=>{an.value=null},disabled:ec.value,children:s("actions.cancel")}),n(P,{variant:"danger",onClick:TT,loading:ec.value,children:s("channels.logout")})]})]}):null}function DT(e){O(()=>{L.value&&si()},[L.value]);const t=ET.value;return n(Kt,{viewName:s("nav.channels"),children:[n(Mt,{title:s("channels.title"),subtitle:s("channels.description"),actions:n(G,{children:[n(P,{variant:"secondary",size:"sm",onClick:()=>si(!0),disabled:Zo.value||tn.value||!L.value,icon:n(Kn,{class:`w-4 h-4 ${Zo.value?"animate-pulse":""}`}),children:Zo.value?s("channels.probing"):s("channels.probe")}),n(K,{icon:n(Fe,{class:`w-4 h-4 ${tn.value?"animate-spin":""}`}),label:s("actions.refresh"),onClick:()=>si(),disabled:tn.value||!L.value,variant:"ghost"})]})}),L.value&&!tn.value&&n("div",{class:"grid grid-cols-2 sm:grid-cols-3 gap-2 sm:gap-4",children:[n(ve,{icon:dn,label:s("channels.stats.total"),value:t.total}),n(ve,{icon:fn,label:s("channels.stats.active"),value:t.active}),n(ve,{icon:gc,label:s("channels.stats.errors"),value:t.errors,highlight:t.errors>0})]}),Qo.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Qo.value}),(tn.value||!L.value)&&n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:L.value?void 0:s("status.connecting")})}),L.value&&!tn.value&&dr.value.length>0&&n("div",{class:"grid gap-4 sm:grid-cols-2",children:dr.value.map(r=>n(MT,{channel:r},r.id))}),L.value&&!tn.value&&dr.value.length===0&&!Qo.value&&n(q,{children:n("div",{class:"p-16 text-center",children:[n(dn,{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:s("channels.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:s("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:[s("channels.learnMore"),n(Fl,{class:"w-4 h-4"})]})]})}),L.value&&!tn.value&&dr.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:s("channels.count",{count:dr.value.length})}),n(RT,{})]})}const Qt=p([]),wn=p(!1),el=p(null);function Sx(e){const t=e.mode?.toLowerCase()??"",r=e.deviceFamily?.toLowerCase()??"";return t==="gateway"?Tr:r.includes("iphone")||r.includes("android")?ga:r.includes("mac")||r.includes("windows")||r.includes("linux")?Nt:Bt}function $T(e){return e===void 0?"—":e<60?s("instances.idleSeconds",{count:e}):e<3600?s("instances.idleMinutes",{count:Math.floor(e/60)}):s("instances.idleHours",{count:Math.floor(e/3600)})}function Cx(e){return e?e==="gateway"?"success":e==="webchat"||e==="chat"?"warning":"default":"default"}async function Tu(){wn.value=!0,el.value=null;try{const e=await N("system-presence",{});Qt.value=e??[]}catch(e){el.value=ne(e)}finally{wn.value=!1}}function LT({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(Z,{variant:"default",size:"sm",children:a},a))})}function NT({presence:e}){const t=Sx(e),r=e.mode==="gateway";return n(Ya,{icon:t,iconVariant:r?"success":"default",title:e.host||e.instanceId||"Unknown",subtitle:e.ip,badges:e.mode?n(Z,{variant:Cx(e.mode),size:"sm",children:e.mode}):null,meta:[{icon:me,value:le(e.ts,{relative:!0})},...e.platform?[{value:e.platform}]:[]]})}function OT({presence:e}){const t=Sx(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(LT,{roles:e.roles,scopes:e.scopes})]})]})}),n("td",{class:"py-3 px-4",children:e.mode?n(Z,{variant:Cx(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:le(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:$T(e.lastInputSeconds)})]})}function PT(e){O(()=>{L.value&&Tu()},[L.value]);const t=Qt.value.filter(a=>a.mode==="gateway").length,r=Qt.value.filter(a=>a.mode!=="gateway").length;return n(Kt,{viewName:s("nav.instances"),children:[n(Mt,{title:s("instances.title"),subtitle:s("instances.description"),actions:n(K,{icon:n(Fe,{class:`w-4 h-4 ${wn.value?"animate-spin":""}`}),label:s("actions.refresh"),onClick:Tu,disabled:wn.value||!L.value,variant:"ghost"})}),L.value&&!wn.value&&n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(ve,{icon:Bt,label:s("instances.stats.total"),value:Qt.value.length}),n(ve,{icon:Tr,label:s("instances.stats.gateways"),value:t}),n(ve,{icon:Nt,label:s("instances.stats.clients"),value:r})]}),el.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:el.value}),(wn.value||!L.value)&&n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:L.value?void 0:s("status.connecting")})}),L.value&&!wn.value&&Qt.value.length>0&&n(G,{children:[n("div",{class:"md:hidden space-y-2",children:Qt.value.map((a,o)=>n(NT,{presence:a},a.instanceId||a.host||o))}),n(q,{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:s("instances.columns.instance")}),n("th",{class:"py-3 px-4 font-medium w-24",children:s("instances.columns.mode")}),n("th",{class:"py-3 px-4 font-medium w-40",children:s("instances.columns.platform")}),n("th",{class:"py-3 px-4 font-medium w-28",children:s("instances.columns.lastSeen")}),n("th",{class:"py-3 px-4 font-medium w-20 hidden lg:table-cell",children:s("instances.columns.idle")})]})}),n("tbody",{class:"divide-y divide-[var(--color-border)]",children:Qt.value.map((a,o)=>n(OT,{presence:a},a.instanceId||a.host||o))})]})})]}),L.value&&!wn.value&&Qt.value.length===0&&!el.value&&n(q,{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:s("instances.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:s("instances.emptyDescription")}),n(P,{variant:"secondary",onClick:Tu,children:s("actions.refresh")})]})}),L.value&&!wn.value&&Qt.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:s("instances.count",{count:Qt.value.length})})]})}const rm={main:{icon:kc,color:"success",badgeVariant:"success"},channel:{icon:Si,color:"info",badgeVariant:"info"},cron:{icon:Pl,color:"warning",badgeVariant:"warning"},isolated:{icon:jn,color:"text-muted",badgeVariant:"default"}};function Hn(e){return rm[e]??rm.isolated}function Ax(e){return s(`sessions.admin.kinds.${e}`)}const Ne=p([]),wt=p(!1),Gn=p(null),qr=p(""),it=p("all"),Jl=p(null),ca=p(!1),Wd=p(!1),ua=p(null),tc=p(""),Cl=p(""),Al=p("inherit"),Tl=p("inherit"),El=p("inherit");function vf(e){return(e.totalTokens??0).toLocaleString()}function Tx(e){const t=e.totalTokens??0,r=e.contextTokens??2e5;return r===0?"0%":`${Math.round(t/r*100)}%`}function Ex(e){return e.displayName||e.label||e.key.split(":").pop()||e.key}const ir=W(()=>{let e=Ne.value;it.value!=="all"&&(e=e.filter(r=>gr(r)===it.value));const t=qr.value.toLowerCase().trim();return t&&(e=e.filter(r=>{const a=(r.label||r.displayName||"").toLowerCase(),o=r.key.toLowerCase(),l=(r.model||"").toLowerCase(),i=(r.channel||"").toLowerCase();return a.includes(t)||o.includes(t)||l.includes(t)||i.includes(t)})),[...e].sort((r,a)=>{const o=gr(r)==="main",l=gr(a)==="main";return o&&!l?-1:l&&!o?1:(a.updatedAt??0)-(r.updatedAt??0)})}),FT=W(()=>{const e={total:0,main:0,channel:0,cron:0,isolated:0};for(const t of Ne.value)e.total++,e[gr(t)]++;return e});async function am(){wt.value=!0,Gn.value=null;try{const e=await N("sessions.list",{limit:200});Ne.value=e.sessions??[]}catch(e){Gn.value=ne(e)}finally{wt.value=!1}}function tl(e){Jl.value=e,Cl.value=e.label??"",Al.value=e.thinking??"inherit",Tl.value=e.verbose??"inherit",El.value=e.reasoning??"inherit"}function nl(){Jl.value=null,ca.value=!1}async function zT(){const e=Jl.value;if(e){Wd.value=!0;try{const t={};Cl.value!==(e.label??"")&&(t.label=Cl.value||void 0),Al.value!==(e.thinking??"inherit")&&(t.thinking=Al.value),Tl.value!==(e.verbose??"inherit")&&(t.verbose=Tl.value),El.value!==(e.reasoning??"inherit")&&(t.reasoning=El.value),Object.keys(t).length>0&&(await N("sessions.patch",{key:e.key,...t}),Ne.value=Ne.value.map(r=>r.key===e.key?{...r,...t}:r)),nl()}catch(t){Gn.value=ne(t)}finally{Wd.value=!1}}}async function UT(){const e=Jl.value;if(e)try{await N("sessions.delete",{key:e.key}),Ne.value=Ne.value.filter(t=>t.key!==e.key),nl()}catch(t){Gn.value=ne(t)}}function Ix(e){De(`/chat/${encodeURIComponent(e)}`)}function jT(e,t){t.stopPropagation(),ua.value=e.key,tc.value=e.label??""}async function om(){const e=ua.value;if(!e)return;const t=tc.value.trim(),r=Ne.value.find(a=>a.key===e);if(!r||t===(r.label??"")){ua.value=null;return}try{await N("sessions.patch",{key:e,label:t||void 0}),Ne.value=Ne.value.map(a=>a.key===e?{...a,label:t||void 0}:a)}catch(a){Gn.value=ne(a)}finally{ua.value=null}}function HT(){ua.value=null}const Eu=[{value:"inherit",label:s("sessions.admin.levels.inherit")},{value:"off",label:s("sessions.admin.levels.off")},{value:"low",label:s("sessions.admin.levels.low")},{value:"medium",label:s("sessions.admin.levels.medium")},{value:"high",label:s("sessions.admin.levels.high")}];function BT({kind:e,size:t="sm"}){const r=Hn(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 Mx({kind:e,size:t="sm"}){const r=Hn(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(BT,{kind:e,size:t})})}function Rx({session:e,onDelete:t}){return n("div",{class:"flex items-center gap-1 flex-shrink-0",children:[Dl.value&&n(K,{icon:n(dn,{class:"w-4 h-4"}),label:s("sessions.admin.openInChat"),size:"sm",variant:"ghost",onClick:r=>{r.stopPropagation(),Ix(e.key)}}),n(K,{icon:n(Et,{class:"w-4 h-4"}),label:s("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 WT({session:e}){const t=gr(e),r=Hn(t),a=Ex(e);return n(Ya,{icon:r.icon,iconVariant:t==="main"?"success":t==="channel"?"info":t==="cron"?"warning":"default",title:a,subtitle:e.key,badges:n(Z,{variant:r.badgeVariant,size:"sm",children:Ax(t)}),meta:[{icon:me,value:e.updatedAt?le(e.updatedAt,{relative:!0}):"—"},{icon:Mg,value:vf(e)}],actions:n(Rx,{session:e,onDelete:o=>{o.stopPropagation(),tl(e),ca.value=!0}}),onClick:()=>tl(e)})}function KT({session:e}){const t=gr(e),r=Ex(e),a=ua.value===e.key;return n("tr",{class:"group hover:bg-[var(--color-bg-hover)] cursor-pointer transition-colors",onClick:()=>!a&&tl(e),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&!a&&(o.preventDefault(),tl(e))},tabIndex:a?-1:0,children:[n("td",{class:"py-3 px-4",children:n("div",{class:"flex items-center gap-3",children:[n(Mx,{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(X,{type:"text",value:tc.value,onInput:o=>tc.value=o.target.value,onKeyDown:o=>{o.key==="Enter"&&om(),o.key==="Escape"&&HT()},onBlur:om,placeholder:s("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(K,{icon:n(Ul,{class:"w-3 h-3"}),label:s("sessions.admin.editLabel"),size:"sm",variant:"ghost",onClick:o=>jT(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(ki,{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?le(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(Mg,{class:"w-3.5 h-3.5 flex-shrink-0"}),n("span",{children:vf(e)}),n("span",{class:"text-xs opacity-60",children:["(",Tx(e),")"]})]})}),n("td",{class:"py-3 px-4",children:n(Rx,{session:e,onDelete:o=>{o.stopPropagation(),tl(e),ca.value=!0}})})]})}function qT(){const e=Jl.value;if(!e)return null;const t=gr(e),r=Hn(t);return n(ze,{open:!!e,onClose:nl,title:e.label||e.displayName||s("sessions.admin.sessionDetails"),size:"xl",footer:ca.value?n(Eb,{message:s("sessions.admin.confirmDelete"),onCancel:()=>ca.value=!1,onDelete:UT}):n(Ib,{isEdit:!0,onDeleteClick:()=>ca.value=!0,onCancel:nl,onSave:zT,isSaving:Wd.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(Mx,{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(Z,{variant:r.badgeVariant,size:"sm",children:Ax(t)}),e.channel&&n(Z,{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:vf(e)}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:s("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:Tx(e)}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:s("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?le(e.updatedAt,{relative:!0}):"—"}),n("div",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:s("sessions.admin.lastActive")})]})]}),n("div",{class:"space-y-4 sm:space-y-5",children:[n(Ie,{label:s("sessions.admin.label"),hint:s("sessions.admin.labelHelp"),children:n(X,{value:Cl.value,onInput:a=>Cl.value=a.target.value,placeholder:s("sessions.admin.labelPlaceholder"),fullWidth:!0})}),n(Ie,{label:s("sessions.admin.overrides"),children:n("div",{class:"grid grid-cols-3 gap-2 sm:gap-4",children:[n(Ie,{label:s("sessions.admin.thinking"),class:"space-y-1",children:n(Re,{value:Al.value,onChange:a=>Al.value=a,options:Eu})}),n(Ie,{label:s("sessions.admin.verbose"),class:"space-y-1",children:n(Re,{value:Tl.value,onChange:a=>Tl.value=a,options:Eu})}),n(Ie,{label:s("sessions.admin.reasoning"),class:"space-y-1",children:n(Re,{value:El.value,onChange:a=>El.value=a,options:Eu})})]})})]}),Dl.value&&n(P,{variant:"secondary",fullWidth:!0,icon:n(dn,{class:"w-4 h-4"}),onClick:()=>{nl(),Ix(e.key)},children:s("sessions.admin.openInChat")})]})})}function GT(e){O(()=>{L.value&&am()},[L.value]);const t=FT.value;return n(Kt,{viewName:s("nav.sessions"),children:[n(Mt,{title:s("sessions.admin.title"),subtitle:s("sessions.admin.description"),actions:n(G,{children:[L.value&&!wt.value&&Ne.value.length>0&&n("div",{class:"relative hidden sm:block",children:[n(Ke,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(X,{type:"text",value:qr.value,onInput:r=>qr.value=r.target.value,placeholder:s("sessions.admin.searchPlaceholder"),class:"pl-10 w-48 lg:w-64"})]}),n(K,{icon:n(Fe,{class:`w-4 h-4 ${wt.value?"animate-spin":""}`}),label:s("actions.refresh"),onClick:am,disabled:wt.value||!L.value,variant:"ghost"})]})}),L.value&&!wt.value&&Ne.value.length>0&&n("div",{class:"relative md:hidden",children:[n(Ke,{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-muted)]"}),n(X,{type:"text",value:qr.value,onInput:r=>qr.value=r.target.value,placeholder:s("sessions.admin.searchPlaceholder"),class:"pl-10",fullWidth:!0})]}),L.value&&!wt.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(ve,{icon:dn,label:s("sessions.admin.stats.total"),value:t.total,active:it.value==="all",onClick:()=>it.value="all"}),n(ve,{icon:Hn("main").icon,label:s("sessions.admin.kinds.main"),value:t.main,active:it.value==="main",onClick:()=>it.value="main"}),n(ve,{icon:Hn("channel").icon,label:s("sessions.admin.kinds.channel"),value:t.channel,active:it.value==="channel",onClick:()=>it.value="channel"}),n(ve,{icon:Hn("cron").icon,label:s("sessions.admin.kinds.cron"),value:t.cron,active:it.value==="cron",onClick:()=>it.value="cron"}),n(ve,{icon:Hn("isolated").icon,label:s("sessions.admin.kinds.isolated"),value:t.isolated,active:it.value==="isolated",onClick:()=>it.value="isolated"})]}),Gn.value&&n("div",{class:"p-4 rounded-xl bg-[var(--color-error)]/10 text-[var(--color-error)]",children:Gn.value}),(wt.value||!L.value)&&n("div",{class:"flex justify-center py-16",children:n(te,{size:"lg",label:L.value?void 0:s("status.connecting")})}),L.value&&!wt.value&&ir.value.length>0&&n(G,{children:[n("div",{class:"md:hidden space-y-2",children:ir.value.map(r=>n(WT,{session:r},r.key))}),n(q,{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:s("sessions.admin.columns.session")}),n("th",{class:"py-3 px-4 font-medium w-32",children:s("sessions.admin.columns.model")}),n("th",{class:"py-3 px-4 font-medium w-36",children:s("sessions.admin.columns.lastActive")}),n("th",{class:"py-3 px-4 font-medium w-32 hidden lg:table-cell",children:s("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:ir.value.map(r=>n(KT,{session:r},r.key))})]})})]}),L.value&&!wt.value&&Ne.value.length===0&&!Gn.value&&n(q,{children:n("div",{class:"p-16 text-center",children:[n(dn,{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:s("sessions.admin.emptyTitle")}),n("p",{class:"text-[var(--color-text-muted)]",children:s("sessions.admin.emptyDescription")})]})}),L.value&&!wt.value&&Ne.value.length>0&&ir.value.length===0&&n(q,{children:n("div",{class:"p-12 text-center",children:[n(Ke,{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:s("sessions.admin.noResults")}),n("p",{class:"text-[var(--color-text-muted)] mb-4",children:s("sessions.admin.noResultsDescription")}),n(P,{variant:"secondary",size:"sm",onClick:()=>{qr.value="",it.value="all"},children:s("sessions.admin.clearFilters")})]})}),L.value&&!wt.value&&ir.value.length>0&&n("p",{class:"text-sm text-[var(--color-text-muted)] text-center",children:ir.value.length===Ne.value.length?s("sessions.admin.count",{count:Ne.value.length}):s("sessions.admin.filteredCount",{filtered:ir.value.length,total:Ne.value.length})}),n(qT,{})]})}const Kd=p(null),wo=p(null),qd=p(null),VT=p(null),Dx=typeof BroadcastChannel<"u"?new BroadcastChannel("cove:canvas"):null;Dx?.addEventListener("message",e=>{if(e.data.type==="canvas-content"){if(e.data.url)Kd.value=e.data.url,wo.value=null,qd.value=null;else if(e.data.base64)try{wo.value&&URL.revokeObjectURL(wo.value);const t=af(e.data.base64,e.data.mimeType||"image/png");wo.value=t,qd.value=e.data.mimeType,Kd.value=null}catch{}}});function lm(e){Dx?.postMessage({type:"canvas-standalone-status",open:e})}function YT({url:e,blobUrl:t,contentType:r,content:a,iframeRef:o,imgRef:l,largeEmptyState:i=!1}){return t?N5(r)||Lv(e)?n("div",{class:"w-full h-full flex items-center justify-center bg-[var(--color-bg-tertiary)] p-4 overflow-auto",children:n("img",{ref:l,src:t,alt:s("canvas.imageAlt"),class:"max-w-full max-h-full object-contain rounded-lg shadow-lg",crossOrigin:"anonymous"})}):n("div",{class:"w-full h-full overflow-hidden",children:n("iframe",{ref:o,src:t,class:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups",title:s("canvas.iframeTitle")})}):e?Lv(e)?n("div",{class:"w-full h-full flex items-center justify-center bg-[var(--color-bg-tertiary)] p-4 overflow-auto",children:n("img",{ref:l,src:e,alt:s("canvas.imageAlt"),class:"max-w-full max-h-full object-contain rounded-lg shadow-lg",crossOrigin:"anonymous"})}):n("div",{class:"w-full h-full overflow-hidden",children:n("iframe",{ref:o,src:e,class:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups",title:s("canvas.iframeTitle")})}):a?n("div",{class:"w-full h-full p-4 overflow-auto bg-[var(--color-bg-tertiary)]",dangerouslySetInnerHTML:{__html:a}}):i?n("div",{class:"flex flex-col items-center justify-center h-full gap-4 text-[var(--color-text-muted)] px-6 text-center bg-[var(--color-bg-primary)]",children:[n("div",{class:"text-6xl",children:"🖼️"}),n("p",{class:"text-lg",children:s("canvas.noContent")}),n("p",{class:"text-sm opacity-70",children:s("canvas.noContentHint")})]}):n("div",{class:"flex flex-col items-center justify-center h-full gap-3 text-[var(--color-text-muted)] px-6 text-center",children:[n("p",{class:"text-sm",children:s("canvas.noContent")}),n("p",{class:"text-xs opacity-70",children:s("canvas.noContentHint")})]})}function JT(){return O(()=>{lm(!0);const e=()=>lm(!1);return window.addEventListener("beforeunload",e),()=>{e(),window.removeEventListener("beforeunload",e)}},[]),n("div",{class:"w-screen h-screen overflow-hidden bg-[var(--color-bg-primary)]",children:n(YT,{url:Kd.value,blobUrl:wo.value,contentType:qd.value,content:VT.value,largeEmptyState:!0})})}const XT={sm:"text-xs",md:"text-sm",lg:"text-base"};function mf({children:e,size:t="sm",muted:r=!0,icon:a,iconRight:o,class:l,...i}){return n("button",{type:"button",class:`
413
- inline-flex items-center gap-1
414
- ${XT[t]}
415
- ${r?"text-[var(--color-text-muted)] hover:text-[var(--color-text-secondary)]":"text-[var(--color-accent)] hover:text-[var(--color-accent-hover)]"}
416
- transition-colors
417
- disabled:opacity-50 disabled:cursor-not-allowed
418
- ${l||""}
419
- `,...i,children:[a&&n("span",{class:"flex-shrink-0",children:a}),e,o&&n("span",{class:"flex-shrink-0",children:o})]})}const ZT={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)]"},QT={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"}},eE={success:Ha,error:Ba,warning:Tn,info:zl};function sm({variant:e,size:t="lg",class:r}){const{container:a,icon:o}=QT[t],l=eE[e];return n("div",{class:`
420
- ${a}
421
- rounded-full
422
- flex items-center justify-center
423
- ${ZT[e]}
424
- ${r||""}
425
- `,children:n(l,{class:o})})}function $x({onBack:e,onNext:t,nextLabel:r,backLabel:a,nextDisabled:o=!1,nextLoading:l=!1,class:i}){return n("div",{class:`flex gap-3 mt-6 ${i||""}`,children:[e&&n(P,{variant:"ghost",onClick:e,icon:n(pc,{class:"w-4 h-4"}),children:a||s("actions.back")}),n(P,{variant:"primary",onClick:t,disabled:o,loading:l,class:e?"flex-1":"w-full",iconRight:n(vc,{class:"w-4 h-4"}),children:r||s("actions.continue")})]})}function tE({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 nE({onComplete:e,onSkip:t}){const r=re("welcome"),a=re(""),o=re("token"),l=re(""),i=re(!0),c=re(!1),d=re(!1),u=re(null),h=re(!1),f=re(!1),v=re(!0),m=re("single"),w=oc(()=>{const _=a.value.trim();if(!_||!_.startsWith("ws://")&&!_.startsWith("wss://"))return!1;try{return new URL(_),!0}catch{return!1}}),k=B(!1);Mm(()=>{k.current||(k.current=!0,We.value=!0)},[]),zu(()=>{const _=a.value;if(f.value=!1,h.value=!1,!w.value)return;const M=new AbortController,I=setTimeout(async()=>{if(M.signal.aborted||a.peek()!==_)return;h.value=!0,u.value=null;const F=await rp(_,M.signal);!M.signal.aborted&&a.peek()===_&&(h.value=!1,F.ok?(f.value=!0,u.value=null):F.error!=="Aborted"&&(f.value=!1,u.value=F.error||s("onboarding.probeError")))},600);return()=>{clearTimeout(I),M.abort()}});const T=()=>a.value.trim()?w.value?(u.value=null,!0):(u.value=s("onboarding.urlError"),!1):(u.value=s("errors.required"),!1),A=async()=>{c.value=!0,d.value=!1;try{await Nl({url:a.value,token:o.value==="token"?l.value:void 0,password:o.value==="password"?l.value:void 0,autoReconnect:!0}),ah({url:a.value,authMode:o.value,rememberMe:i.value,credential:l.value}),Jf(),await uc(),await Ah(),ma("main"),await Ch("main"),Eh(),Ih(),d.value=!0}catch(_){E.auth.error("Connect failed:",_),d.value=!1}finally{c.value=!1}},g=()=>{va(),d.value=!1,r.value="auth"},x=async()=>{if(!T())return;if(f.value){r.value="auth";return}if(h.value)return;h.value=!0,u.value=null;const _=await rp(a.value);h.value=!1,_.ok?(f.value=!0,setTimeout(()=>{r.value="auth",f.value=!1},500)):u.value=_.error||s("onboarding.probeError")},C=()=>{r.value==="welcome"?r.value="url":r.value==="url"?x():r.value==="auth"&&(r.value="connect",A())},b=()=>{r.value==="url"?r.value="welcome":r.value==="auth"?r.value="url":r.value==="connect"&&!d.value&&(r.value="auth")},S=()=>{Jf(),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(tE,{steps:["welcome","url","auth","connect"],current:r.value,class:"mb-4 sm:mb-8"}),r.value==="welcome"&&n(rE,{onNext:C,onSkip:S}),r.value==="url"&&n(aE,{url:a.value,onUrlChange:_=>{a.value=_,u.value=null,f.value=!1},error:u.value,canProceed:w.value,probing:h.value,probeSuccess:f.value,onNext:C,onBack:b,onSkip:S}),r.value==="auth"&&n(oE,{authMode:o.value,onAuthModeChange:_=>o.value=_,credential:l.value,onCredentialChange:_=>l.value=_,rememberMe:i.value,onRememberMeChange:_=>i.value=_,onNext:C,onBack:b}),r.value==="connect"&&n(lE,{connecting:c.value,connected:d.value,error:zn.value,showTour:v.value,onShowTourChange:_=>v.value=_,selectedMode:m.value,onModeChange:_=>{m.value=_,un.value=_},onRetry:g,onContinue:()=>{qy(v.value),un.value=m.value,e()}})]})})}function rE({onNext:e,onSkip:t}){return n("div",{class:"text-center",children:[n(_c,{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:s("onboarding.welcome")}),n("p",{class:"text-sm sm:text-base text-[var(--color-text-muted)] mb-4 sm:mb-8",children:s("onboarding.welcomeSubtitle")}),n("div",{class:"grid gap-2 sm:gap-4 mb-4 sm:mb-8 text-left",children:[n(Iu,{icon:n(fn,{class:"w-5 h-5"}),title:s("onboarding.feature1Title"),description:s("onboarding.feature1Desc")}),n(Iu,{icon:n(wc,{class:"w-5 h-5"}),title:s("onboarding.feature2Title"),description:s("onboarding.feature2Desc")}),n(Iu,{icon:n(Bt,{class:"w-5 h-5"}),title:s("onboarding.feature3Title"),description:s("onboarding.feature3Desc")})]}),n("div",{class:"space-y-3",children:[n(P,{variant:"primary",onClick:e,fullWidth:!0,iconRight:n(vc,{class:"w-4 h-4"}),children:s("onboarding.getStarted")}),n(mf,{onClick:t,children:s("onboarding.skipToLogin")})]})]})}function Iu({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 aE({url:e,onUrlChange:t,error:r,canProceed:a,probing:o,probeSuccess:l,onNext:i,onBack:c,onSkip:d}){const u=f=>{f.key==="Enter"&&l&&i()},h=()=>{if(o)return n(te,{size:"sm"});if(l)return n(Wt,{class:"w-4 h-4 text-[var(--color-success)]"});if(r&&a)return n(Ka,{content:r,placement:"left",children:n("span",{class:"cursor-help",children:n(gc,{class:"w-4 h-4 text-[var(--color-error)]"})})})};return n(q,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:s("onboarding.urlTitle")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-3 sm:mb-6",children:s("onboarding.urlSubtitle")}),n(Ie,{label:s("auth.gatewayUrl"),htmlFor:"gateway-url",children:n(X,{id:"gateway-url",type:"url",value:e,onInput:f=>t(f.target.value),onKeyDown:u,placeholder:s("auth.gatewayUrlPlaceholder"),rightElement:h(),autoCorrect:"off",autoCapitalize:"off",spellcheck:!1,fullWidth:!0})}),n(An,{title:s("onboarding.troubleshootTitle"),items:[s("onboarding.troubleshoot1"),s("onboarding.troubleshoot2"),s("onboarding.troubleshoot3")],class:"mt-3 sm:mt-4 text-xs sm:text-sm"}),n($x,{onBack:c,onNext:i,nextDisabled:!l}),n("div",{class:"text-center mt-4",children:n(mf,{onClick:d,disabled:o,children:s("onboarding.skipToLogin")})})]})}function oE({authMode:e,onAuthModeChange:t,credential:r,onCredentialChange:a,rememberMe:o,onRememberMeChange:l,onNext:i,onBack:c}){const d=h=>{h.key==="Enter"&&i()},u=[{value:"token",label:s("auth.authMode.token")},{value:"password",label:s("auth.authMode.password")}];return n(q,{variant:"elevated",padding:"md",children:[n("h2",{class:"text-base sm:text-lg font-semibold mb-1 sm:mb-2",children:s("onboarding.authTitle")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-3 sm:mb-6",children:s("onboarding.authSubtitle")}),n("div",{class:"space-y-3 sm:space-y-4",children:[n(Ie,{label:s("onboarding.authMethod"),children:n(Re,{value:e,onChange:h=>t(h),options:u,"aria-label":s("onboarding.authMethod"),class:"w-full"})}),n(Ie,{label:s(e==="token"?"auth.token":"auth.password"),htmlFor:"credential",children:n(Xh,{id:"credential",value:r,onInput:h=>a(h.target.value),onKeyDown:d,placeholder:s(e==="token"?"auth.tokenPlaceholder":"auth.passwordPlaceholder"),fullWidth:!0})}),n($e,{checked:o,onChange:l,label:s("auth.rememberMe"),description:s("onboarding.rememberMeDesc"),size:"sm"})]}),n($x,{onBack:c,onNext:i,nextLabel:s("actions.connect")})]})}function lE({connecting:e,connected:t,error:r,showTour:a,onShowTourChange:o,selectedMode:l,onModeChange:i,onRetry:c,onContinue:d}){return n(q,{variant:"elevated",padding:"md",class:"text-center",children:[e&&n(G,{children:[n(te,{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:s("onboarding.connecting")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)]",children:s("onboarding.connectingDesc")})]}),!e&&t&&n(G,{children:[n(sm,{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:s("onboarding.success")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-text-muted)] mb-4 sm:mb-6",children:s("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:s("onboarding.modeTitle")}),n("div",{class:"grid grid-cols-2 gap-2 sm:gap-3",children:[n("button",{type:"button",onClick:()=>i("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(dn,{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:s("onboarding.modeSingle")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1 hidden sm:block",children:s("onboarding.modeSingleDesc")})]}),n("button",{type:"button",onClick:()=>i("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(q2,{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:s("onboarding.modeMulti")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1 hidden sm:block",children:s("onboarding.modeMultiDesc")})]})]})]}),n("div",{class:"mb-4 sm:mb-6",children:n("button",{type:"button",onClick:()=>{const u=!We.value;We.value=u,u?lf():sf()},class:`w-full p-3 sm:p-4 rounded-lg border-2 text-left transition-colors flex items-start gap-3 ${We.value?"border-[var(--color-accent)] bg-[var(--color-accent)]/10":"border-[var(--color-border)] hover:border-[var(--color-accent)]/50"}`,children:[n(Lg,{class:"w-5 h-5 flex-shrink-0 text-[var(--color-accent)]"}),n("div",{class:"flex-1",children:[n("div",{class:"text-xs sm:text-sm font-medium",children:s("onboarding.canvasTitle")}),n("div",{class:"text-xs text-[var(--color-text-muted)] mt-0.5 sm:mt-1",children:s("onboarding.canvasDesc")})]}),n("div",{class:`w-4 h-4 rounded-full border-2 flex-shrink-0 flex items-center justify-center ${We.value?"border-[var(--color-accent)] bg-[var(--color-accent)]":"border-[var(--color-border)]"}`,children:We.value&&n(Wt,{class:"w-3 h-3 text-white"})})]})}),n("div",{class:"mb-4 sm:mb-6",children:n($e,{checked:a,onChange:o,label:s("onboarding.showFeatureTour"),size:"sm"})}),n(P,{variant:"primary",onClick:d,fullWidth:!0,iconRight:n(vc,{class:"w-4 h-4"}),children:s(a?"actions.continue":"onboarding.startChatting")})]}),!e&&!t&&r&&n(G,{children:[n(sm,{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:s("onboarding.failed")}),n("p",{class:"text-xs sm:text-sm text-[var(--color-error)] mb-3 sm:mb-4",children:r}),n(An,{title:s("onboarding.failedHints"),items:[s("onboarding.hint1"),s("onboarding.hint2"),s("onboarding.hint3"),s("onboarding.hint4")],class:"text-left mb-4 sm:mb-6 text-xs sm:text-sm"}),n(P,{variant:"primary",onClick:c,fullWidth:!0,icon:n(pc,{class:"w-4 h-4"}),children:s("onboarding.tryAgain")})]})]})}const sE=150,iE=300,cE=50,yt=16,Ls=8,uE=8;function dE({steps:e,onComplete:t,spotlightPadding:r=uE}){const a=re(0),o=re(0),l=re(null),i=B(null),c=re(null),d=re(!1),u=e[o.value],h=e[a.value],f=a.value===0,v=a.value===e.length-1,m=B(null),w=B(""),k=B(""),T=ee(async()=>{if(!h)return;m.current&&(m.current.style.zIndex=w.current,m.current.style.position=k.current,m.current=null),await new Promise(_=>setTimeout(_,sE)),o.value=a.peek(),h.beforeShow&&await h.beforeShow(),await new Promise(_=>setTimeout(_,cE));const b=document.querySelectorAll(h.target);let S=null;for(const _ of b)if(_ instanceof HTMLElement&&_.offsetParent!==null){S=_;break}if(S){S.scrollIntoView({behavior:"smooth",block:"center"}),await new Promise(M=>setTimeout(M,iE)),w.current=S.style.zIndex,k.current=S.style.position,m.current=S,(!S.style.position||S.style.position==="static")&&(S.style.position="relative"),S.style.zIndex="10000";const _=S.getBoundingClientRect();l.value=_}else l.value=null;d.value=!1},[h]);zu(()=>{a.value,d.value=!0,T()}),zu(()=>{const b=l.value;if(!b||!i.current)return;const _=i.current.getBoundingClientRect(),M={width:window.innerWidth,height:window.innerHeight};let I=h?.placement||"bottom",F=0,D=0;const Y={bottom:{top:b.bottom+r+Ls+yt,left:b.left+b.width/2-_.width/2,fits:b.bottom+r+_.height+yt<M.height},top:{top:b.top-r-_.height-Ls-yt,left:b.left+b.width/2-_.width/2,fits:b.top-r-_.height-yt>0},right:{top:b.top+b.height/2-_.height/2,left:b.right+r+Ls+yt,fits:b.right+r+_.width+yt<M.width},left:{top:b.top+b.height/2-_.height/2,left:b.left-r-_.width-Ls-yt,fits:b.left-r-_.width-yt>0}},Ue=I==="top"?["top","bottom","right","left"]:I==="left"?["left","right","bottom","top"]:I==="right"?["right","left","bottom","top"]:["bottom","top","right","left"];for(const En of Ue)if(Y[En].fits){I=En;break}const fe=Y[I];F=fe.top,D=fe.left,D=Math.max(yt,Math.min(D,M.width-_.width-yt)),F=Math.max(yt,Math.min(F,M.height-_.height-yt));const nr=I==="bottom"?"top":I==="top"?"bottom":I==="left"?"right":"left";c.value={top:F,left:D,arrowPosition:nr}}),O(()=>{const b=()=>T();return window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[T]),O(()=>()=>{m.current&&(m.current.style.zIndex=w.current,m.current.style.position=k.current)},[]),O(()=>{if(!h?.autoAdvanceWhen)return;const b=setInterval(()=>{h.autoAdvanceWhen?.()&&(v?t():a.value++)},500);return()=>clearInterval(b)},[h,v,t]),O(()=>{const b=S=>{S.key==="Escape"?t():S.key==="ArrowRight"||S.key==="Enter"?v?t():a.value++:S.key==="ArrowLeft"&&!f&&a.value--};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[f,v,t]);const A=()=>{v?t():a.value++},g=()=>{f||a.value--},x=l.value,C=c.value;return zh(n("div",{class:"fixed inset-0 z-[9999] pointer-events-none",children:[n("svg",{class:"absolute inset-0 w-full h-full pointer-events-none",children:[n("defs",{children:n("mask",{id:"spotlight-mask",children:[n("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white"}),x&&n("rect",{x:x.left-r,y:x.top-r,width:x.width+r*2,height:x.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)"})]}),x&&n("div",{class:"absolute border-2 border-[var(--color-accent)] rounded-lg pointer-events-none",style:{top:x.top-r,left:x.left-r,width:x.width+r*2,height:x.height+r*2}}),n("div",{ref:i,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:C?.top??-9999,left:C?.left??-9999,opacity:C&&!d.value?1:0,pointerEvents:C&&!d.value?"auto":"none"},children:[C&&n("div",{class:`absolute w-3 h-3 bg-[var(--color-bg-surface)] border-[var(--color-border)] transform rotate-45 ${C.arrowPosition==="top"?"-top-1.5 left-1/2 -translate-x-1/2 border-l border-t":C.arrowPosition==="bottom"?"-bottom-1.5 left-1/2 -translate-x-1/2 border-r border-b":C.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:u?.title}),n("p",{class:"text-sm text-[var(--color-text-secondary)] mb-4",children:u?.content}),n("div",{class:"flex items-center justify-between gap-2",children:[n(mf,{onClick:t,icon:n(Wa,{class:"w-3 h-3"}),children:s("tour.skipTour")}),n("div",{class:"flex gap-2",children:[!f&&n(P,{variant:"ghost",size:"sm",onClick:g,icon:n(pc,{class:"w-3 h-3"}),children:s("actions.back")}),n(P,{variant:"primary",size:"sm",onClick:A,iconRight:n(vc,{class:"w-3 h-3"}),children:s(v?"actions.done":"actions.next")})]})]})]}),n("div",{class:"absolute inset-0",role:"presentation",onClick:b=>{if(x){const S=b.clientX,_=b.clientY;S>=x.left-r&&S<=x.right+r&&_>=x.top-r&&_<=x.bottom+r||(b.preventDefault(),b.stopPropagation())}},onKeyDown:()=>{},style:{pointerEvents:"auto"}})]}),document.body)}function hE(){return[{target:"[data-tour='sessions']",title:s("tour.steps.sessions.title"),content:s("tour.steps.sessions.content"),placement:"right"}]}function im(){return[{target:"[data-tour='chat-input']",title:s("tour.steps.chatInput.title"),content:s("tour.steps.chatInput.content"),placement:"top"},{target:"[data-tour='model-picker']",title:s("tour.steps.modelPicker.title"),content:s("tour.steps.modelPicker.content"),placement:"top"},{target:"[data-tour='settings']",title:s("tour.steps.settings.title"),content:s("tour.steps.settings.content"),placement:"bottom"}]}function fE(){return{target:"[data-tour='pending-requests']",title:s("tour.steps.canvasPairing.title"),content:s("tour.steps.canvasPairing.content"),placement:"bottom",beforeShow:async()=>{De("/devices"),await new Promise(e=>setTimeout(e,500))},autoAdvanceWhen:()=>Da.value==="paired"}}function cm(){return{target:"[data-tour='canvas']",title:s("tour.steps.canvasButton.title"),content:s("tour.steps.canvasButton.content"),placement:"bottom",beforeShow:async()=>{De("/");for(let e=0;e<20;e++)if(await new Promise(t=>setTimeout(t,100)),document.querySelector("[data-tour='canvas']"))return}}}function pE(e){const t=e==="multi"?[...hE(),...im()]:im();return We.value?Da.value==="paired"&&Nr.value?[...t,cm()]:[...t,fE(),cm()]:t}async function um(){try{return(await N("cron.list",{})).jobs||[]}catch{return[]}}const vE=[{id:"chat.abort",label:s("commandPalette.commands.chat.abort"),category:"chat",icon:"⏹",shortcut:"⌘.",action:()=>{const e=Je.value;e&&xg(e)},keywords:["stop","cancel","halt"]},{id:"chat.clear",label:s("commandPalette.commands.chat.clear"),category:"chat",icon:"🗑",action:()=>{kh()},keywords:["delete","reset","empty"]},{id:"chat.search",label:s("commandPalette.commands.chat.search"),category:"chat",icon:"🔍",shortcut:"⌘F",action:()=>{Xe.value=!0,Un.value=""},keywords:["find","filter"]},{id:"chat.export",label:s("commandPalette.commands.chat.export"),category:"chat",icon:"📄",action:()=>{const e=Me.value;if(e.length===0)return;const t=["# Chat Export","",`Exported: ${new Date().toLocaleString()}`,"","---",""];for(const i of e){const c=i.role==="user"?"**You**":"**Assistant**";t.push(c),t.push(""),t.push(i.content||""),t.push(""),t.push("---"),t.push("")}const r=t.join(`
426
- `),a=new Blob([r],{type:"text/markdown"}),o=URL.createObjectURL(a),l=document.createElement("a");l.href=o,l.download=`chat-${new Date().toISOString().slice(0,10)}.md`,l.click(),URL.revokeObjectURL(o)},keywords:["download","save","markdown"]},{id:"chat.copy-last",label:s("commandPalette.commands.chat.copyLast"),category:"chat",icon:"📋",action:async()=>{const t=[...Me.value].reverse().find(r=>r.role==="assistant");t?.content&&await navigator.clipboard.writeText(t.content)},keywords:["clipboard"]}],mE=[{id:"session.switch",label:s("commandPalette.commands.session.switch"),category:"session",icon:"🔄",hasSubmenu:!0,getSubmenuItems:()=>{const e=cn.value;return gt.value.map(t=>({id:t.key,label:t.label||t.key,isActive:t.key===e,description:t.model,action:()=>{ma(t.key),De(`/chat/${encodeURIComponent(t.key)}`)}}))},isAvailable:()=>!ol.value&&gt.value.length>1,keywords:["change","select"]},{id:"session.delete",label:s("commandPalette.commands.session.delete"),category:"session",icon:"🗑",action:async()=>{const e=Je.value;if(e&&confirm(s("commandPalette.confirm.deleteSession")))try{await N("sessions.delete",{sessionKey:e})}catch{}},isAvailable:()=>!ol.value,keywords:["remove"]},{id:"session.copy-key",label:s("commandPalette.commands.session.copyKey"),category:"session",icon:"🔑",action:async()=>{const e=Je.value;e&&await navigator.clipboard.writeText(e)},keywords:["clipboard"]}],gE=[{id:"model.change",label:s("commandPalette.commands.model.change"),category:"model",icon:"🤖",hasSubmenu:!0,getSubmenuItems:()=>Xn.value.map(e=>({id:e.id,label:e.name||e.id,description:e.provider,action:async()=>{const t=Je.value;if(t)try{await N("sessions.patch",{sessionKey:t,model:e.id})}catch{}}})),keywords:["switch","select","ai"]}],bE=[{id:"cron.run",label:s("commandPalette.commands.cron.run"),category:"cron",icon:"▶️",hasSubmenu:!0,getSubmenuItems:async()=>{const e=await um();return e.length===0?[{id:"none",label:s("commandPalette.noItems"),action:()=>{}}]:e.map(t=>({id:t.id,label:t.name||t.id,description:t.enabled?s("common.enabled"):s("common.disabled"),action:async()=>{try{await N("cron.run",{jobId:t.id})}catch{}}}))},isAvailable:()=>L.value,keywords:["trigger","execute","schedule"]},{id:"cron.toggle",label:s("commandPalette.commands.cron.toggle"),category:"cron",icon:"⏯",hasSubmenu:!0,getSubmenuItems:async()=>{const e=await um();return e.length===0?[{id:"none",label:s("commandPalette.noItems"),action:()=>{}}]:e.map(t=>({id:t.id,label:`${t.name||t.id}: ${t.enabled?"ON":"OFF"}`,isActive:t.enabled,action:async()=>{try{await N("cron.update",{jobId:t.id,patch:{enabled:!t.enabled}})}catch{}}}))},isAvailable:()=>L.value,keywords:["enable","disable","schedule"]}],xE=[{id:"gateway.restart",label:s("commandPalette.commands.gateway.restart"),category:"gateway",icon:"🔄",action:async()=>{if(confirm(s("commandPalette.confirm.restartGateway")))try{await N("gateway.restart",{})}catch{}},isAvailable:()=>L.value,keywords:["reboot","reload","refresh"]}],yE=[{id:"settings.theme",label:s("commandPalette.commands.settings.theme"),category:"settings",icon:"🎨",hasSubmenu:!0,getValue:()=>{const e=lt.value;return e.selected==="system"?s("commandPalette.commands.settings.systemTheme"):ju().find(a=>a.id===e.selected)?.name||e.selected},getSubmenuItems:()=>{const e=lt.value.selected,t=ju(),r=[{id:"system",label:s("commandPalette.commands.settings.systemTheme"),isActive:e==="system",action:()=>So("system")}];for(const a of t)r.push({id:a.id,label:a.name,description:a.appearance==="dark"?s("common.dark"):s("common.light"),isActive:e===a.id,action:()=>So(a.id)});return r},keywords:["dark","light","appearance","color","dracula","monokai","nord","catppuccin","gruvbox","solarized"]}],wE=[...vE,...mE,...gE,...bE,...xE,...yE];function kE(){return wE.filter(e=>e.isAvailable?e.isAvailable():!0)}function Gd(e){return s(`commandPalette.categories.${e}`)}const _E=["chat","session","model","cron","gateway","settings"],kn=p(!1),Lx="cove:command-palette:recent",SE=5;function Nx(){try{const e=localStorage.getItem(Lx);return e?JSON.parse(e):[]}catch{return[]}}function dm(e){const t=Nx().filter(r=>r!==e);t.unshift(e),localStorage.setItem(Lx,JSON.stringify(t.slice(0,SE)))}function Mu(e,t){const r=e.toLowerCase(),a=t.toLowerCase();if(a===r)return 100;if(a.startsWith(r))return 90;if(a.includes(r))return 70;let o=0,l=0;for(let i=0;i<a.length&&l<r.length;i++)a[i]===r[l]&&(o+=10,l++);return l===r.length?o:0}function CE(e,t){if(!t)return 0;let r=Mu(t,e.label);if(e.keywords)for(const o of e.keywords){const l=Mu(t,o);l>r&&(r=l)}const a=Mu(t,Gd(e.category));return a>r&&(r=a),r}function Ox(e){return`w-full flex items-center gap-3 px-3 py-2 rounded-lg text-left transition-colors ${e?"bg-[var(--color-bg-secondary)]":"hover:bg-[var(--color-bg-secondary)]/50"}`}function AE(){const[e,t]=U(""),[r,a]=U(0),[o,l]=U(null),[i,c]=U(!1),d=B(null),u=B(null),h=kn.value,f=kE(),v=Nx(),m=pt(()=>{if(e)return f.map(b=>({cmd:b,score:CE(b,e)})).filter(({score:b})=>b>0).sort((b,S)=>S.score-b.score).map(({cmd:b})=>b);{const b=v.map(_=>f.find(M=>M.id===_)).filter(_=>_!==void 0),S=f.filter(_=>!v.includes(_.id));return[...b,...S]}},[f,v,e]),w=pt(()=>e?null:TE(m,v),[m,v,e]),k=pt(()=>{if(!o)return[];if(!e)return o.items;const b=e.toLowerCase();return o.items.filter(S=>S.label.toLowerCase().includes(b)||(S.description?.toLowerCase().includes(b)??!1))},[o,e]),T=o?k:m,A=pt(()=>{if(o&&k[r])return`cmd-sub-${k[r].id}`;if(m[r])return`cmd-${m[r].id}`},[o,k,m,r]);O(()=>{a(0)},[e,o]),O(()=>{h&&(t(""),a(0),l(null),setTimeout(()=>d.current?.focus(),0))},[h]),O(()=>{const b=S=>{if(kn.value){if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),o?(l(null),t(""),a(0)):kn.value=!1;return}if(S.key==="ArrowDown"){S.preventDefault(),a(_=>Math.min(_+1,T.length-1));return}if(S.key==="ArrowUp"){S.preventDefault(),a(_=>Math.max(_-1,0));return}if(S.key==="Enter"){if(S.preventDefault(),o){const _=k[r];_&&x(_)}else{const _=m[r];_&&g(_)}return}S.key==="Backspace"&&e===""&&o&&(l(null),a(0))}};return document.addEventListener("keydown",b,!0),()=>document.removeEventListener("keydown",b,!0)},[o,k,m,r,e,T.length]),O(()=>{const b=u.current;if(!b)return;const S=b.querySelector("[aria-selected='true']");S&&S.scrollIntoView({block:"nearest"})},[r]);const g=async b=>{if(b.hasSubmenu&&b.getSubmenuItems){c(!0);try{const S=await b.getSubmenuItems();l({command:b,items:S}),a(0),t("")}finally{c(!1)}}else b.action&&(dm(b.id),kn.value=!1,await b.action())},x=async b=>{kn.value=!1,o&&dm(o.command.id),await b.action()};return h?n("div",{class:"fixed inset-0 z-50 flex items-start justify-center pt-[12vh] sm:pt-[15vh] animate-fade-in",onClick:()=>{kn.value=!1},onKeyDown:b=>{b.key==="Escape"&&(kn.value=!1)},role:"dialog","aria-modal":"true","aria-label":s("commandPalette.placeholder"),children:[n("div",{class:"absolute inset-0 bg-black/40 backdrop-blur-md","aria-hidden":"true"}),n("div",{class:"relative w-full max-w-xl mx-4 bg-[var(--color-bg-surface)] border border-[var(--color-border)] rounded-xl shadow-soft-xl overflow-hidden animate-scale-in",onClick:b=>b.stopPropagation(),onKeyDown:b=>b.stopPropagation(),children:[n("div",{class:"p-3 border-b border-[var(--color-border)]",children:n("div",{class:"flex items-center gap-3 px-4 py-2.5 rounded-xl bg-[var(--color-bg-primary)] border border-[var(--color-border)] shadow-soft-sm transition-all duration-200",children:[n("span",{class:"text-[var(--color-text-muted)]","aria-hidden":"true",children:o?"→":"⌘"}),n("input",{ref:d,type:"text",value:e,onInput:b=>t(b.target.value),placeholder:o?`${o.command.label}...`:s("commandPalette.placeholder"),class:"flex-1 bg-transparent text-[var(--color-text-primary)] placeholder:text-[var(--color-text-muted)] selection:bg-[var(--color-accent)]/20 caret-[var(--color-accent)]",style:{border:"none",outline:"none",boxShadow:"none"},autoComplete:"off",autoCorrect:"off",spellcheck:!1,role:"combobox","aria-expanded":"true","aria-controls":"command-list","aria-activedescendant":A}),i&&n("span",{class:"text-[var(--color-text-muted)] text-sm",children:s("commandPalette.loading")})]})}),n("div",{ref:u,id:"command-list",class:"max-h-[60vh] overflow-y-auto p-2",role:"listbox","aria-label":o?o.command.label:s("commandPalette.placeholder"),children:o?n("div",{children:k.length===0?n("div",{class:"px-3 py-8 text-center text-[var(--color-text-muted)]",children:s(e?"commandPalette.noMatches":"commandPalette.noItems")}):k.map((b,S)=>n("button",{id:`cmd-sub-${b.id}`,role:"option","aria-selected":S===r,onClick:()=>x(b),class:Ox(S===r),children:[n("span",{class:`flex-1 ${b.isActive?"text-[var(--color-accent)] font-medium":"text-[var(--color-text-primary)]"}`,children:b.label}),b.description&&n("span",{class:"text-sm text-[var(--color-text-muted)]",children:b.description}),b.isActive&&n("span",{class:"text-[var(--color-accent)]","aria-hidden":"true",children:"✓"})]},b.id))}):e?n("div",{children:m.length===0?n("div",{class:"px-3 py-8 text-center text-[var(--color-text-muted)]",children:s("commandPalette.noCommands")}):m.map((b,S)=>n(hm,{command:b,isSelected:S===r,onClick:()=>g(b)},b.id))}):n("div",{children:w&&w.map(b=>n("div",{class:"mb-2",children:[n("div",{class:"px-3 py-1 text-xs font-medium text-[var(--color-text-muted)] uppercase tracking-wider",children:b.label}),b.commands.map(S=>{const _=m.indexOf(S);return n(hm,{command:S,isSelected:_===r,onClick:()=>g(S)},S.id)})]},b.category))})}),n("div",{class:"flex items-center gap-4 px-4 py-2 border-t border-[var(--color-border)] bg-[var(--color-bg-secondary)] text-xs text-[var(--color-text-muted)]",children:[n("span",{children:s("commandPalette.hints.navigate")}),n("span",{children:s("commandPalette.hints.select")}),n("span",{children:s(o?"commandPalette.hints.back":"commandPalette.hints.close")})]})]})]}):null}function hm({command:e,isSelected:t,onClick:r}){const a=e.getValue?.();return n("button",{id:`cmd-${e.id}`,role:"option","aria-selected":t,onClick:r,class:Ox(t),children:[e.icon&&n("span",{class:"w-5 text-center","aria-hidden":"true",children:e.icon}),n("span",{class:"flex-1 text-[var(--color-text-primary)]",children:e.label}),a&&n("span",{class:"text-sm text-[var(--color-text-muted)]",children:a}),e.hasSubmenu&&n("span",{class:"text-[var(--color-text-muted)]","aria-hidden":"true",children:"→"}),e.shortcut&&!e.hasSubmenu&&n("span",{class:"text-xs text-[var(--color-text-muted)] bg-[var(--color-bg-secondary)] px-1.5 py-0.5 rounded",children:e.shortcut})]})}function TE(e,t){const r=[],a=e.filter(l=>t.includes(l.id));a.length>0&&r.push({category:"recent",label:Gd("recent"),commands:a});const o=e.filter(l=>!t.includes(l.id));for(const l of _E){const i=o.filter(c=>c.category===l);i.length>0&&r.push({category:l,label:Gd(l),commands:i})}return r}function EE(){O(()=>{const e=t=>{t.key==="k"&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),t.stopPropagation(),kn.value=!kn.value)};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[])}const fm=p(null);function IE(){O(()=>{ci(()=>import("./CanvasPanel-B6DhcK2j.js"),[]).then(t=>{fm.value=t.CanvasPanel})},[]);const e=fm.value;return e?n(e,{}):null}A0();const Vd=sc(),ME=p(!!(Vd?.url&&Vd.rememberMe)),pm=p(!1),Ns=p(!Ky()&&!Vd?.url),Ru=p(!1),Os=p(null);function RE(){O(()=>{L0(),b1(),LE().finally(()=>{pm.value=!0})},[]),EE();const e=()=>{Ns.value=!1,Gy()&&setTimeout(()=>{Os.value=pE(un.value),Ru.value=!0},500)},t=()=>{Ns.value=!1},r=()=>{Ru.value=!1,Os.value=null},a=Ee.value==="reconnecting",o=!Ns.value&&!a&&(pm.value?!L.value:!ME.value);if(window.location.pathname==="/canvas")return n(zp,{children:n(Wp,{onError:c=>J.error(`Error: ${c.message}`),children:n(JT,{})})});let i;return Ns.value?i=n(nE,{onComplete:e,onSkip:t}):o?i=n(gS,{}):i=n($E,{}),n(zp,{children:[n(Wp,{onError:c=>{J.error(`Error: ${c.message}`)},children:n(U4,{children:i})}),n(q4,{position:"top-right"}),n(AE,{}),n(IE,{}),Ru.value&&Os.value&&n(dE,{steps:Os.value,onComplete:r})]})}function DE(e){e.url==="/settings"&&Sn.value!=="/settings"&&(Sg.value=Sn.value),Sn.value=e.url}function $E(){return n(Wm,{onChange:DE,children:[n(ws,{path:"/"}),n(ws,{path:"/chat"}),n(ws,{path:"/chat/:sessionKey"}),n(CS,{path:"/overview"}),n(mT,{path:"/usage"}),n(DT,{path:"/channels"}),n(PT,{path:"/instances"}),n(GT,{path:"/sessions"}),n(e5,{path:"/cron"}),n(sA,{path:"/skills"}),n(YA,{path:"/agents"}),n(eT,{path:"/agents/edit/:filename"}),n(zC,{path:"/devices"}),n(G5,{path:"/settings"}),n(_5,{path:"/config"}),n(mC,{path:"/debug"}),n(_C,{path:"/logs"}),n(ws,{default:!0})]})}async function LE(){const e=sc();if(!e?.url||!e.rememberMe)return;const t=lh();if(t)try{await Nl({url:e.url,token:e.authMode==="token"?t:void 0,password:e.authMode==="password"?t:void 0,autoReconnect:!0}),await uc(),await _g(),await Ah(),ma("main"),await Ch("main"),Eh(),Ih(),t3(),ci(async()=>{const{canvasNodeEnabled:r}=await Promise.resolve().then(()=>v1);return{canvasNodeEnabled:r}},void 0).then(({canvasNodeEnabled:r})=>{r.value&&ci(()=>Promise.resolve().then(()=>Yb),void 0).then(a=>a.startNodeConnection())})}catch{oh("")}}Ou(n(RE,{}),document.querySelector("#app"));export{B as A,NE as B,YT as C,jE as D,Fl as E,G as F,_d as G,F4 as H,K as I,p as J,HE as L,PE as M,Wa as X,od as a,ra as b,R as c,Gr as d,Ti as e,FE as f,OE as g,WE as h,ob as i,zE as j,UE as k,U as l,Wr as m,Xs as n,Zs as o,ad as p,ee as q,ul as r,br as s,xr as t,Mc as u,O5 as v,n as w,s as x,O as y,BE as z};