const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/syntax-highlight-CQw1bBY6.js","assets/markdown-vendor-BC7Vi29N.js","assets/katex-BSBacQyE.js","assets/katex-wklAmtGL.css","assets/MarkdownTextRenderer-CE8hfq6X.js"])))=>i.map(i=>d[i]); var PS=Object.defineProperty;var TS=(e,t,n)=>t in e?PS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var $e=(e,t,n)=>TS(e,typeof t!="symbol"?t+"":t,n);import{j as s}from"./markdown-vendor-BC7Vi29N.js";import{r as u,g as RS,R as wm,a as Pa,_ as $l}from"./syntax-highlight-CQw1bBY6.js";import"./katex-BSBacQyE.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();var Xd={},Vx={exports:{}},In={},Kx={exports:{}},Gx={};/** * @license React * scheduler.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */(function(e){function t(E,F){var X=E.length;E.push(F);e:for(;0>>1,re=E[Q];if(0>>1;Qa(ce,X))za(q,ce)?(E[Q]=q,E[z]=X,Q=z):(E[Q]=ce,E[pe]=X,Q=pe);else if(za(q,X))E[Q]=q,E[z]=X,Q=z;else break e}}return F}function a(E,F){var X=E.sortIndex-F.sortIndex;return X!==0?X:E.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],d=[],p=1,m=null,f=3,h=!1,y=!1,x=!1,b=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(E){for(var F=n(d);F!==null;){if(F.callback===null)r(d);else if(F.startTime<=E)r(d),F.sortIndex=F.expirationTime,t(c,F);else break;F=n(d)}}function k(E){if(x=!1,w(E),!y)if(n(c)!==null)y=!0,W(C);else{var F=n(d);F!==null&&H(k,F.startTime-E)}}function C(E,F){y=!1,x&&(x=!1,v(P),P=-1),h=!0;var X=f;try{for(w(F),m=n(c);m!==null&&(!(m.expirationTime>F)||E&&!T());){var Q=m.callback;if(typeof Q=="function"){m.callback=null,f=m.priorityLevel;var re=Q(m.expirationTime<=F);F=e.unstable_now(),typeof re=="function"?m.callback=re:m===n(c)&&r(c),w(F)}else r(c);m=n(c)}if(m!==null)var ue=!0;else{var pe=n(d);pe!==null&&H(k,pe.startTime-F),ue=!1}return ue}finally{m=null,f=X,h=!1}}var j=!1,N=null,P=-1,L=5,_=-1;function T(){return!(e.unstable_now()-_E||125Q?(E.sortIndex=X,t(d,E),n(c)===null&&E===n(d)&&(x?(v(P),P=-1):x=!0,H(k,X-Q))):(E.sortIndex=re,t(c,E),y||h||(y=!0,W(C))),E},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(E){var F=f;return function(){var X=f;f=F;try{return E.apply(this,arguments)}finally{f=X}}}})(Gx);Kx.exports=Gx;var MS=Kx.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ES=u,En=MS;function ne(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Jd=Object.prototype.hasOwnProperty,IS=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,oh={},sh={};function LS(e){return Jd.call(sh,e)?!0:Jd.call(oh,e)?!1:IS.test(e)?sh[e]=!0:(oh[e]=!0,!1)}function DS(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function OS(e,t,n,r){if(t===null||typeof t>"u"||DS(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function dn(e,t,n,r,a,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var Xt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Xt[e]=new dn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Xt[t]=new dn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Xt[e]=new dn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Xt[e]=new dn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Xt[e]=new dn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Xt[e]=new dn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Xt[e]=new dn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Xt[e]=new dn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Xt[e]=new dn(e,5,!1,e.toLowerCase(),null,!1,!1)});var km=/[\-:]([a-z])/g;function Cm(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(km,Cm);Xt[t]=new dn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(km,Cm);Xt[t]=new dn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(km,Cm);Xt[t]=new dn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Xt[e]=new dn(e,1,!1,e.toLowerCase(),null,!1,!1)});Xt.xlinkHref=new dn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Xt[e]=new dn(e,1,!1,e.toLowerCase(),null,!0,!0)});function Sm(e,t,n,r){var a=Xt.hasOwnProperty(t)?Xt[t]:null;(a!==null?a.type!==0:r||!(2l||a[i]!==o[l]){var c=` `+a[i].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=i&&0<=l);break}}}finally{Ku=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?$s(e):""}function FS(e){switch(e.tag){case 5:return $s(e.type);case 16:return $s("Lazy");case 13:return $s("Suspense");case 19:return $s("SuspenseList");case 0:case 2:case 15:return e=Gu(e.type,!1),e;case 11:return e=Gu(e.type.render,!1),e;case 1:return e=Gu(e.type,!0),e;default:return""}}function np(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case bo:return"Fragment";case yo:return"Portal";case Zd:return"Profiler";case Nm:return"StrictMode";case ep:return"Suspense";case tp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Xx:return(e.displayName||"Context")+".Consumer";case Qx:return(e._context.displayName||"Context")+".Provider";case jm:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Am:return t=e.displayName||null,t!==null?t:np(e.type)||"Memo";case na:t=e._payload,e=e._init;try{return np(e(t))}catch{}}return null}function zS(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return np(t);case 8:return t===Nm?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function va(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Zx(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function $S(e){var t=Zx(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function dl(e){e._valueTracker||(e._valueTracker=$S(e))}function ey(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Zx(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function sc(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function rp(e,t){var n=t.checked;return gt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function lh(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=va(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function ty(e,t){t=t.checked,t!=null&&Sm(e,"checked",t,!1)}function ap(e,t){ty(e,t);var n=va(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?op(e,t.type,n):t.hasOwnProperty("defaultValue")&&op(e,t.type,va(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ch(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function op(e,t,n){(t!=="number"||sc(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Us=Array.isArray;function Io(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=pl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function pi(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Gs={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},US=["Webkit","ms","Moz","O"];Object.keys(Gs).forEach(function(e){US.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Gs[t]=Gs[e]})});function oy(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Gs.hasOwnProperty(e)&&Gs[e]?(""+t).trim():t+"px"}function sy(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,a=oy(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}var BS=gt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function lp(e,t){if(t){if(BS[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ne(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ne(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ne(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ne(62))}}function cp(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var up=null;function _m(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var dp=null,Lo=null,Do=null;function ph(e){if(e=Wi(e)){if(typeof dp!="function")throw Error(ne(280));var t=e.stateNode;t&&(t=Zc(t),dp(e.stateNode,e.type,t))}}function iy(e){Lo?Do?Do.push(e):Do=[e]:Lo=e}function ly(){if(Lo){var e=Lo,t=Do;if(Do=Lo=null,ph(e),t)for(e=0;e>>=0,e===0?32:31-(ZS(e)/eN|0)|0}var ml=64,fl=4194304;function Bs(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function uc(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,a=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var l=i&~a;l!==0?r=Bs(l):(o&=i,o!==0&&(r=Bs(o)))}else i=n&~a,i!==0?r=Bs(i):o!==0&&(r=Bs(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&a)&&(a=r&-r,o=t&-t,a>=o||a===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Bi(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Jn(t),e[t]=n}function aN(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Qs),wh=" ",kh=!1;function _y(e,t){switch(e){case"keyup":return MN.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Py(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var wo=!1;function IN(e,t){switch(e){case"compositionend":return Py(t);case"keypress":return t.which!==32?null:(kh=!0,wh);case"textInput":return e=t.data,e===wh&&kh?null:e;default:return null}}function LN(e,t){if(wo)return e==="compositionend"||!Dm&&_y(e,t)?(e=jy(),Bl=Em=ia=null,wo=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=jh(n)}}function Ey(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ey(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Iy(){for(var e=window,t=sc();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=sc(e.document)}return t}function Om(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function WN(e){var t=Iy(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ey(n.ownerDocument.documentElement,n)){if(r!==null&&Om(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=n.textContent.length,o=Math.min(r.start,a);r=r.end===void 0?o:Math.min(r.end,a),!e.extend&&o>r&&(a=r,r=o,o=a),a=Ah(n,o);var i=Ah(n,r);a&&i&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,ko=null,vp=null,Js=null,xp=!1;function _h(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;xp||ko==null||ko!==sc(r)||(r=ko,"selectionStart"in r&&Om(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Js&&xi(Js,r)||(Js=r,r=mc(vp,"onSelect"),0No||(e.current=Sp[No],Sp[No]=null,No--)}function tt(e,t){No++,Sp[No]=e.current,e.current=t}var xa={},rn=Sa(xa),bn=Sa(!1),Ha=xa;function Qo(e,t){var n=e.type.contextTypes;if(!n)return xa;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a={},o;for(o in n)a[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function wn(e){return e=e.childContextTypes,e!=null}function hc(){ot(bn),ot(rn)}function Lh(e,t,n){if(rn.current!==xa)throw Error(ne(168));tt(rn,t),tt(bn,n)}function Hy(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var a in r)if(!(a in t))throw Error(ne(108,zS(e)||"Unknown",a));return gt({},n,r)}function gc(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||xa,Ha=rn.current,tt(rn,e),tt(bn,bn.current),!0}function Dh(e,t,n){var r=e.stateNode;if(!r)throw Error(ne(169));n?(e=Hy(e,t,Ha),r.__reactInternalMemoizedMergedChildContext=e,ot(bn),ot(rn),tt(rn,e)):ot(bn),tt(bn,n)}var Tr=null,eu=!1,ld=!1;function Wy(e){Tr===null?Tr=[e]:Tr.push(e)}function nj(e){eu=!0,Wy(e)}function Na(){if(!ld&&Tr!==null){ld=!0;var e=0,t=Ye;try{var n=Tr;for(Ye=1;e>=i,a-=i,Rr=1<<32-Jn(t)+a|n<P?(L=N,N=null):L=N.sibling;var _=f(v,N,w[P],k);if(_===null){N===null&&(N=L);break}e&&N&&_.alternate===null&&t(v,N),g=o(_,g,P),j===null?C=_:j.sibling=_,j=_,N=L}if(P===w.length)return n(v,N),ct&&Ma(v,P),C;if(N===null){for(;PP?(L=N,N=null):L=N.sibling;var T=f(v,N,_.value,k);if(T===null){N===null&&(N=L);break}e&&N&&T.alternate===null&&t(v,N),g=o(T,g,P),j===null?C=T:j.sibling=T,j=T,N=L}if(_.done)return n(v,N),ct&&Ma(v,P),C;if(N===null){for(;!_.done;P++,_=w.next())_=m(v,_.value,k),_!==null&&(g=o(_,g,P),j===null?C=_:j.sibling=_,j=_);return ct&&Ma(v,P),C}for(N=r(v,N);!_.done;P++,_=w.next())_=h(N,v,P,_.value,k),_!==null&&(e&&_.alternate!==null&&N.delete(_.key===null?P:_.key),g=o(_,g,P),j===null?C=_:j.sibling=_,j=_);return e&&N.forEach(function(R){return t(v,R)}),ct&&Ma(v,P),C}function b(v,g,w,k){if(typeof w=="object"&&w!==null&&w.type===bo&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case ul:e:{for(var C=w.key,j=g;j!==null;){if(j.key===C){if(C=w.type,C===bo){if(j.tag===7){n(v,j.sibling),g=a(j,w.props.children),g.return=v,v=g;break e}}else if(j.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===na&&zh(C)===j.type){n(v,j.sibling),g=a(j,w.props),g.ref=Es(v,j,w),g.return=v,v=g;break e}n(v,j);break}else t(v,j);j=j.sibling}w.type===bo?(g=za(w.props.children,v.mode,k,w.key),g.return=v,v=g):(k=Ql(w.type,w.key,w.props,null,v.mode,k),k.ref=Es(v,g,w),k.return=v,v=k)}return i(v);case yo:e:{for(j=w.key;g!==null;){if(g.key===j)if(g.tag===4&&g.stateNode.containerInfo===w.containerInfo&&g.stateNode.implementation===w.implementation){n(v,g.sibling),g=a(g,w.children||[]),g.return=v,v=g;break e}else{n(v,g);break}else t(v,g);g=g.sibling}g=gd(w,v.mode,k),g.return=v,v=g}return i(v);case na:return j=w._init,b(v,g,j(w._payload),k)}if(Us(w))return y(v,g,w,k);if(_s(w))return x(v,g,w,k);wl(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,g!==null&&g.tag===6?(n(v,g.sibling),g=a(g,w),g.return=v,v=g):(n(v,g),g=hd(w,v.mode,k),g.return=v,v=g),i(v)):n(v,g)}return b}var Jo=Gy(!0),Yy=Gy(!1),yc=Sa(null),bc=null,_o=null,Um=null;function Bm(){Um=_o=bc=null}function Hm(e){var t=yc.current;ot(yc),e._currentValue=t}function Ap(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Fo(e,t){bc=e,Um=_o=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(yn=!0),e.firstContext=null)}function Hn(e){var t=e._currentValue;if(Um!==e)if(e={context:e,memoizedValue:t,next:null},_o===null){if(bc===null)throw Error(ne(308));_o=e,bc.dependencies={lanes:0,firstContext:e}}else _o=_o.next=e;return t}var La=null;function Wm(e){La===null?La=[e]:La.push(e)}function Qy(e,t,n,r){var a=t.interleaved;return a===null?(n.next=n,Wm(t)):(n.next=a.next,a.next=n),t.interleaved=n,Or(e,r)}function Or(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ra=!1;function qm(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Xy(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Er(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ma(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,We&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Or(e,n)}return a=r.interleaved,a===null?(t.next=t,Wm(r)):(t.next=a.next,a.next=t),r.interleaved=t,Or(e,n)}function Wl(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Tm(e,n)}}function $h(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?a=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?a=o=t:o=o.next=t}else a=o=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function wc(e,t,n,r){var a=e.updateQueue;ra=!1;var o=a.firstBaseUpdate,i=a.lastBaseUpdate,l=a.shared.pending;if(l!==null){a.shared.pending=null;var c=l,d=c.next;c.next=null,i===null?o=d:i.next=d,i=c;var p=e.alternate;p!==null&&(p=p.updateQueue,l=p.lastBaseUpdate,l!==i&&(l===null?p.firstBaseUpdate=d:l.next=d,p.lastBaseUpdate=c))}if(o!==null){var m=a.baseState;i=0,p=d=c=null,l=o;do{var f=l.lane,h=l.eventTime;if((r&f)===f){p!==null&&(p=p.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var y=e,x=l;switch(f=t,h=n,x.tag){case 1:if(y=x.payload,typeof y=="function"){m=y.call(h,m,f);break e}m=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=x.payload,f=typeof y=="function"?y.call(h,m,f):y,f==null)break e;m=gt({},m,f);break e;case 2:ra=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=a.effects,f===null?a.effects=[l]:f.push(l))}else h={eventTime:h,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},p===null?(d=p=h,c=m):p=p.next=h,i|=f;if(l=l.next,l===null){if(l=a.shared.pending,l===null)break;f=l,l=f.next,f.next=null,a.lastBaseUpdate=f,a.shared.pending=null}}while(!0);if(p===null&&(c=m),a.baseState=c,a.firstBaseUpdate=d,a.lastBaseUpdate=p,t=a.shared.interleaved,t!==null){a=t;do i|=a.lane,a=a.next;while(a!==t)}else o===null&&(a.shared.lanes=0);Va|=i,e.lanes=i,e.memoizedState=m}}function Uh(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ud.transition;ud.transition={};try{e(!1),t()}finally{Ye=n,ud.transition=r}}function fb(){return Wn().memoizedState}function sj(e,t,n){var r=ha(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},hb(e))gb(t,n);else if(n=Qy(e,t,n,r),n!==null){var a=un();Zn(n,e,r,a),vb(n,t,r)}}function ij(e,t,n){var r=ha(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(hb(e))gb(t,a);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,l=o(i,n);if(a.hasEagerState=!0,a.eagerState=l,er(l,i)){var c=t.interleaved;c===null?(a.next=a,Wm(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}n=Qy(e,t,a,r),n!==null&&(a=un(),Zn(n,e,r,a),vb(n,t,r))}}function hb(e){var t=e.alternate;return e===ht||t!==null&&t===ht}function gb(e,t){Zs=Cc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function vb(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Tm(e,n)}}var Sc={readContext:Hn,useCallback:Zt,useContext:Zt,useEffect:Zt,useImperativeHandle:Zt,useInsertionEffect:Zt,useLayoutEffect:Zt,useMemo:Zt,useReducer:Zt,useRef:Zt,useState:Zt,useDebugValue:Zt,useDeferredValue:Zt,useTransition:Zt,useMutableSource:Zt,useSyncExternalStore:Zt,useId:Zt,unstable_isNewReconciler:!1},lj={readContext:Hn,useCallback:function(e,t){return cr().memoizedState=[e,t===void 0?null:t],e},useContext:Hn,useEffect:Hh,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Vl(4194308,4,cb.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Vl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Vl(4,2,e,t)},useMemo:function(e,t){var n=cr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=cr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=sj.bind(null,ht,e),[r.memoizedState,e]},useRef:function(e){var t=cr();return e={current:e},t.memoizedState=e},useState:Bh,useDebugValue:Zm,useDeferredValue:function(e){return cr().memoizedState=e},useTransition:function(){var e=Bh(!1),t=e[0];return e=oj.bind(null,e[1]),cr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ht,a=cr();if(ct){if(n===void 0)throw Error(ne(407));n=n()}else{if(n=t(),Wt===null)throw Error(ne(349));qa&30||tb(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Hh(rb.bind(null,r,o,e),[e]),r.flags|=2048,ji(9,nb.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=cr(),t=Wt.identifierPrefix;if(ct){var n=Mr,r=Rr;n=(r&~(1<<32-Jn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Si++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[ur]=t,e[wi]=r,Ab(e,t,!1,!1),t.stateNode=e;e:{switch(i=cp(n,r),n){case"dialog":at("cancel",e),at("close",e),a=r;break;case"iframe":case"object":case"embed":at("load",e),a=r;break;case"video":case"audio":for(a=0;ats&&(t.flags|=128,r=!0,Is(o,!1),t.lanes=4194304)}else{if(!r)if(e=kc(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Is(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!ct)return en(t),null}else 2*Nt()-o.renderingStartTime>ts&&n!==1073741824&&(t.flags|=128,r=!0,Is(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Nt(),t.sibling=null,n=ft.current,tt(ft,r?n&1|2:n&1),t):(en(t),null);case 22:case 23:return of(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?An&1073741824&&(en(t),t.subtreeFlags&6&&(t.flags|=8192)):en(t),null;case 24:return null;case 25:return null}throw Error(ne(156,t.tag))}function gj(e,t){switch(zm(t),t.tag){case 1:return wn(t.type)&&hc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Zo(),ot(bn),ot(rn),Gm(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Km(t),null;case 13:if(ot(ft),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ne(340));Xo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ot(ft),null;case 4:return Zo(),null;case 10:return Hm(t.type._context),null;case 22:case 23:return of(),null;case 24:return null;default:return null}}var Cl=!1,tn=!1,vj=typeof WeakSet=="function"?WeakSet:Set,ge=null;function Po(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){wt(e,t,r)}else n.current=null}function Dp(e,t,n){try{n()}catch(r){wt(e,t,r)}}var eg=!1;function xj(e,t){if(yp=dc,e=Iy(),Om(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,l=-1,c=-1,d=0,p=0,m=e,f=null;t:for(;;){for(var h;m!==n||a!==0&&m.nodeType!==3||(l=i+a),m!==o||r!==0&&m.nodeType!==3||(c=i+r),m.nodeType===3&&(i+=m.nodeValue.length),(h=m.firstChild)!==null;)f=m,m=h;for(;;){if(m===e)break t;if(f===n&&++d===a&&(l=i),f===o&&++p===r&&(c=i),(h=m.nextSibling)!==null)break;m=f,f=m.parentNode}m=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(bp={focusedElem:e,selectionRange:n},dc=!1,ge=t;ge!==null;)if(t=ge,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ge=e;else for(;ge!==null;){t=ge;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var x=y.memoizedProps,b=y.memoizedState,v=t.stateNode,g=v.getSnapshotBeforeUpdate(t.elementType===t.type?x:Yn(t.type,x),b);v.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ne(163))}}catch(k){wt(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,ge=e;break}ge=t.return}return y=eg,eg=!1,y}function ei(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&e)===e){var o=a.destroy;a.destroy=void 0,o!==void 0&&Dp(t,n,o)}a=a.next}while(a!==r)}}function ru(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Op(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Tb(e){var t=e.alternate;t!==null&&(e.alternate=null,Tb(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ur],delete t[wi],delete t[Cp],delete t[ej],delete t[tj])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Rb(e){return e.tag===5||e.tag===3||e.tag===4}function tg(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rb(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Fp(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=fc));else if(r!==4&&(e=e.child,e!==null))for(Fp(e,t,n),e=e.sibling;e!==null;)Fp(e,t,n),e=e.sibling}function zp(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(zp(e,t,n),e=e.sibling;e!==null;)zp(e,t,n),e=e.sibling}var Gt=null,Qn=!1;function Xr(e,t,n){for(n=n.child;n!==null;)Mb(e,t,n),n=n.sibling}function Mb(e,t,n){if(fr&&typeof fr.onCommitFiberUnmount=="function")try{fr.onCommitFiberUnmount(Yc,n)}catch{}switch(n.tag){case 5:tn||Po(n,t);case 6:var r=Gt,a=Qn;Gt=null,Xr(e,t,n),Gt=r,Qn=a,Gt!==null&&(Qn?(e=Gt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Gt.removeChild(n.stateNode));break;case 18:Gt!==null&&(Qn?(e=Gt,n=n.stateNode,e.nodeType===8?id(e.parentNode,n):e.nodeType===1&&id(e,n),gi(e)):id(Gt,n.stateNode));break;case 4:r=Gt,a=Qn,Gt=n.stateNode.containerInfo,Qn=!0,Xr(e,t,n),Gt=r,Qn=a;break;case 0:case 11:case 14:case 15:if(!tn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){a=r=r.next;do{var o=a,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&Dp(n,t,i),a=a.next}while(a!==r)}Xr(e,t,n);break;case 1:if(!tn&&(Po(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){wt(n,t,l)}Xr(e,t,n);break;case 21:Xr(e,t,n);break;case 22:n.mode&1?(tn=(r=tn)||n.memoizedState!==null,Xr(e,t,n),tn=r):Xr(e,t,n);break;default:Xr(e,t,n)}}function ng(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new vj),t.forEach(function(r){var a=Aj.bind(null,e,r);n.has(r)||(n.add(r),r.then(a,a))})}}function Gn(e,t){var n=t.deletions;if(n!==null)for(var r=0;ra&&(a=i),r&=~o}if(r=a,r=Nt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*bj(r/1960))-r,10e?16:e,la===null)var r=!1;else{if(e=la,la=null,Ac=0,We&6)throw Error(ne(331));var a=We;for(We|=4,ge=e.current;ge!==null;){var o=ge,i=o.child;if(ge.flags&16){var l=o.deletions;if(l!==null){for(var c=0;cNt()-rf?Fa(e,0):nf|=n),kn(e,t)}function $b(e,t){t===0&&(e.mode&1?(t=fl,fl<<=1,!(fl&130023424)&&(fl=4194304)):t=1);var n=un();e=Or(e,t),e!==null&&(Bi(e,t,n),kn(e,n))}function jj(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),$b(e,n)}function Aj(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ne(314))}r!==null&&r.delete(t),$b(e,n)}var Ub;Ub=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||bn.current)yn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return yn=!1,fj(e,t,n);yn=!!(e.flags&131072)}else yn=!1,ct&&t.flags&1048576&&qy(t,xc,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Kl(e,t),e=t.pendingProps;var a=Qo(t,rn.current);Fo(t,n),a=Qm(null,t,r,e,a,n);var o=Xm();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,wn(r)?(o=!0,gc(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,qm(t),a.updater=nu,t.stateNode=a,a._reactInternals=t,Pp(t,r,e,n),t=Mp(null,t,r,!0,o,n)):(t.tag=0,ct&&o&&Fm(t),cn(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Kl(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=Pj(r),e=Yn(r,e),a){case 0:t=Rp(null,t,r,e,n);break e;case 1:t=Xh(null,t,r,e,n);break e;case 11:t=Yh(null,t,r,e,n);break e;case 14:t=Qh(null,t,r,Yn(r.type,e),n);break e}throw Error(ne(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Yn(r,a),Rp(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Yn(r,a),Xh(e,t,r,a,n);case 3:e:{if(Sb(t),e===null)throw Error(ne(387));r=t.pendingProps,o=t.memoizedState,a=o.element,Xy(e,t),wc(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=es(Error(ne(423)),t),t=Jh(e,t,r,n,a);break e}else if(r!==a){a=es(Error(ne(424)),t),t=Jh(e,t,r,n,a);break e}else for(Tn=pa(t.stateNode.containerInfo.firstChild),Rn=t,ct=!0,Xn=null,n=Yy(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Xo(),r===a){t=Fr(e,t,n);break e}cn(e,t,r,n)}t=t.child}return t;case 5:return Jy(t),e===null&&jp(t),r=t.type,a=t.pendingProps,o=e!==null?e.memoizedProps:null,i=a.children,wp(r,a)?i=null:o!==null&&wp(r,o)&&(t.flags|=32),Cb(e,t),cn(e,t,i,n),t.child;case 6:return e===null&&jp(t),null;case 13:return Nb(e,t,n);case 4:return Vm(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Jo(t,null,r,n):cn(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Yn(r,a),Yh(e,t,r,a,n);case 7:return cn(e,t,t.pendingProps,n),t.child;case 8:return cn(e,t,t.pendingProps.children,n),t.child;case 12:return cn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,o=t.memoizedProps,i=a.value,tt(yc,r._currentValue),r._currentValue=i,o!==null)if(er(o.value,i)){if(o.children===a.children&&!bn.current){t=Fr(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var l=o.dependencies;if(l!==null){i=o.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(o.tag===1){c=Er(-1,n&-n),c.tag=2;var d=o.updateQueue;if(d!==null){d=d.shared;var p=d.pending;p===null?c.next=c:(c.next=p.next,p.next=c),d.pending=c}}o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Ap(o.return,n,t),l.lanes|=n;break}c=c.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(ne(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Ap(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}cn(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,Fo(t,n),a=Hn(a),r=r(a),t.flags|=1,cn(e,t,r,n),t.child;case 14:return r=t.type,a=Yn(r,t.pendingProps),a=Yn(r.type,a),Qh(e,t,r,a,n);case 15:return wb(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:Yn(r,a),Kl(e,t),t.tag=1,wn(r)?(e=!0,gc(t)):e=!1,Fo(t,n),xb(t,r,a),Pp(t,r,a,n),Mp(null,t,r,!0,e,n);case 19:return jb(e,t,n);case 22:return kb(e,t,n)}throw Error(ne(156,t.tag))};function Bb(e,t){return hy(e,t)}function _j(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $n(e,t,n,r){return new _j(e,t,n,r)}function lf(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Pj(e){if(typeof e=="function")return lf(e)?1:0;if(e!=null){if(e=e.$$typeof,e===jm)return 11;if(e===Am)return 14}return 2}function ga(e,t){var n=e.alternate;return n===null?(n=$n(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ql(e,t,n,r,a,o){var i=2;if(r=e,typeof e=="function")lf(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case bo:return za(n.children,a,o,t);case Nm:i=8,a|=8;break;case Zd:return e=$n(12,n,t,a|2),e.elementType=Zd,e.lanes=o,e;case ep:return e=$n(13,n,t,a),e.elementType=ep,e.lanes=o,e;case tp:return e=$n(19,n,t,a),e.elementType=tp,e.lanes=o,e;case Jx:return ou(n,a,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Qx:i=10;break e;case Xx:i=9;break e;case jm:i=11;break e;case Am:i=14;break e;case na:i=16,r=null;break e}throw Error(ne(130,e==null?e:typeof e,""))}return t=$n(i,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function za(e,t,n,r){return e=$n(7,e,r,t),e.lanes=n,e}function ou(e,t,n,r){return e=$n(22,e,r,t),e.elementType=Jx,e.lanes=n,e.stateNode={isHidden:!1},e}function hd(e,t,n){return e=$n(6,e,null,t),e.lanes=n,e}function gd(e,t,n){return t=$n(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Tj(e,t,n,r,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Qu(0),this.expirationTimes=Qu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qu(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function cf(e,t,n,r,a,o,i,l,c){return e=new Tj(e,t,n,l,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=$n(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},qm(o),e}function Rj(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Vb)}catch(e){console.error(e)}}Vb(),Vx.exports=In;var uu=Vx.exports;const Dj=RS(uu);var ug=uu;Xd.createRoot=ug.createRoot,Xd.hydrateRoot=ug.hydrateRoot;/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oj=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Kb=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var Fj={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zj=u.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:o,iconNode:i,...l},c)=>u.createElement("svg",{ref:c,...Fj,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Kb("lucide",a),...l},[...i.map(([d,p])=>u.createElement(d,p)),...Array.isArray(o)?o:[o]]));/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oe=(e,t)=>{const n=u.forwardRef(({className:r,...a},o)=>u.createElement(zj,{ref:o,iconNode:t,className:Kb(`lucide-${Oj(e)}`,r),...a}));return n.displayName=`${e}`,n};/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gb=oe("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $j=oe("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yb=oe("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uj=oe("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bj=oe("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hj=oe("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ri=oe("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qb=oe("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ga=oe("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wj=oe("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jt=oe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rr=oe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mf=oe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xr=oe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qj=oe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ja=oe("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dg=oe("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xb=oe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jb=oe("CircleDashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ff=oe("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vj=oe("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tc=oe("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kj=oe("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gj=oe("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const po=oe("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zb=oe("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yj=oe("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mo=oe("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rc=oe("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ew=oe("Earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tw=oe("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nw=oe("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rw=oe("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aw=oe("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xl=oe("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qj=oe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xj=oe("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ai=oe("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jj=oe("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zj=oe("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e2=oe("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t2=oe("GripVertical",[["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"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pg=oe("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n2=oe("HardDrive",[["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"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hf=oe("Hexagon",[["path",{d:"M21 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r2=oe("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vi=oe("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mg=oe("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _i=oe("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"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a2=oe("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o2=oe("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vt=oe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s2=oe("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ow=oe("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gf=oe("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vf=oe("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i2=oe("Orbit",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M10.4 21.9a10 10 0 0 0 9.941-15.416",key:"eohfx2"}],["path",{d:"M13.5 2.1a10 10 0 0 0-9.841 15.416",key:"19pvbm"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l2=oe("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c2=oe("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hs=oe("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u2=oe("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d2=oe("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ir=oe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p2=oe("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ki=oe("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m2=oe("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const It=oe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ns=oe("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f2=oe("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h2=oe("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sw=oe("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $o=oe("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xf=oe("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g2=oe("SquarePlay",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wp=oe("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iw=oe("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v2=oe("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mc=oe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zr=oe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qp=oe("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x2=oe("Triangle",[["path",{d:"M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"14u9p9"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y2=oe("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b2=oe("Waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lw=oe("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vr=oe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** * @license lucide-react v0.469.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fg=oe("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),je=e=>typeof e=="string",Ds=()=>{let e,t;const n=new Promise((r,a)=>{e=r,t=a});return n.resolve=e,n.reject=t,n},hg=e=>e==null?"":String(e),w2=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},k2=/###/g,gg=e=>e&&e.includes("###")?e.replace(k2,"."):e,vg=e=>!e||je(e),oi=(e,t,n)=>{const r=je(t)?t.split("."):t;let a=0;for(;a{const{obj:r,k:a}=oi(e,t,Object);if(r!==void 0||t.length===1){r[a]=n;return}let o=t[t.length-1],i=t.slice(0,t.length-1),l=oi(e,i,Object);for(;l.obj===void 0&&i.length;)o=`${i[i.length-1]}.${o}`,i=i.slice(0,i.length-1),l=oi(e,i,Object),l!=null&&l.obj&&typeof l.obj[`${l.k}.${o}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${o}`]=n},C2=(e,t,n,r)=>{const{obj:a,k:o}=oi(e,t,Object);a[o]=a[o]||[],a[o].push(n)},Ec=(e,t)=>{const{obj:n,k:r}=oi(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},S2=(e,t,n)=>{const r=Ec(e,n);return r!==void 0?r:Ec(t,n)},cw=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?je(e[r])||e[r]instanceof String||je(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):cw(e[r],t[r],n):e[r]=t[r]);return e},Ar=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),N2={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},j2=e=>je(e)?e.replace(/[&<>"'\/]/g,t=>N2[t]):e;class A2{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const _2=[" ",",","?","!",";"],P2=new A2(20),T2=(e,t,n)=>{t=t||"",n=n||"";const r=_2.filter(i=>!t.includes(i)&&!n.includes(i));if(r.length===0)return!0;const a=P2.getRegExp(`(${r.map(i=>i==="?"?"\\?":i).join("|")})`);let o=!a.test(e);if(!o){const i=e.indexOf(n);i>0&&!a.test(e.substring(0,i))&&(o=!0)}return o},Vp=(e,t,n=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(n);let a=e;for(let o=0;oe==null?void 0:e.replace(/_/g,"-"),R2={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){var n,r;(r=(n=console==null?void 0:console[e])==null?void 0:n.apply)==null||r.call(n,console,t)}};class Ic{constructor(t,n={}){this.init(t,n)}init(t,n={}){this.prefix=n.prefix||"i18next:",this.logger=t||R2,this.options=n,this.debug=n.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,a){return a&&!this.debug?null:(t=t.map(o=>je(o)?o.replace(/[\r\n\x00-\x1F\x7F]/g," "):o),je(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Ic(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Ic(this.logger,t)}}var pr=new Ic;class du{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const a=this.observers[r].get(n)||0;this.observers[r].set(n,a+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}once(t,n){const r=(...a)=>{n(...a),this.off(t,r)};return this.on(t,r),this}emit(t,...n){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([a,o])=>{for(let i=0;i{for(let i=0;i-1&&this.options.ns.splice(n,1)}getResource(t,n,r,a={}){var d,p;const o=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,i=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;t.includes(".")?l=t.split("."):(l=[t,n],r&&(Array.isArray(r)?l.push(...r):je(r)&&o?l.push(...r.split(o)):l.push(r)));const c=Ec(this.data,l);return!c&&!n&&!r&&t.includes(".")&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!i||!je(r)?c:Vp((p=(d=this.data)==null?void 0:d[t])==null?void 0:p[n],r,o)}addResource(t,n,r,a,o={silent:!1}){const i=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let l=[t,n];r&&(l=l.concat(i?r.split(i):r)),t.includes(".")&&(l=t.split("."),a=n,n=l[1]),this.addNamespaces(n),xg(this.data,l,a),o.silent||this.emit("added",t,n,r,a)}addResources(t,n,r,a={silent:!1}){for(const o in r)(je(r[o])||Array.isArray(r[o]))&&this.addResource(t,n,o,r[o],{silent:!0});a.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,a,o,i={silent:!1,skipCopy:!1}){let l=[t,n];t.includes(".")&&(l=t.split("."),a=r,r=n,n=l[1]),this.addNamespaces(n);let c=Ec(this.data,l)||{};i.skipCopy||(r=JSON.parse(JSON.stringify(r))),a?cw(c,r,o):c={...c,...r},xg(this.data,l,c),i.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(a=>n[a]&&Object.keys(n[a]).length>0)}toJSON(){return this.data}}var uw={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,a){return e.forEach(o=>{var i;t=((i=this.processors[o])==null?void 0:i.process(t,n,r,a))??t}),t}};const dw=Symbol("i18next/PATH_KEY");function M2(){const e=[],t=Object.create(null);let n;return t.get=(r,a)=>{var o;return(o=n==null?void 0:n.revoke)==null||o.call(n),a===dw?e:(e.push(a),n=Proxy.revocable(r,t),n.proxy)},Proxy.revocable(Object.create(null),t).proxy}function Uo(e,t){const{[dw]:n}=e(M2()),r=(t==null?void 0:t.keySeparator)??".",a=(t==null?void 0:t.nsSeparator)??":";if(n.length>1&&a){const o=t==null?void 0:t.ns,i=Array.isArray(o)?o:null;if(i&&i.length>1&&i.slice(1).includes(n[0]))return`${n[0]}${a}${n.slice(1).join(r)}`}return n.join(r)}const vd=e=>!je(e)&&typeof e!="boolean"&&typeof e!="number";class Lc extends du{constructor(t,n={}){super(),w2(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=pr.create("translator"),this.checkedLoadedFor={}}changeLanguage(t){t&&(this.language=t)}exists(t,n={interpolation:{}}){const r={...n};if(t==null)return!1;const a=this.resolve(t,r);if((a==null?void 0:a.res)===void 0)return!1;const o=vd(a.res);return!(r.returnObjects===!1&&o)}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const a=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const i=r&&t.includes(r),l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!T2(t,r,a);if(i&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:je(o)?[o]:o};const d=t.split(r);(r!==a||r===a&&this.options.ns.includes(d[0]))&&(o=d.shift()),t=d.join(a)}return{key:t,namespaces:je(o)?[o]:o}}translate(t,n,r){let a=typeof n=="object"?{...n}:n;if(typeof a!="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a=="object"&&(a={...a}),a||(a={}),t==null)return"";typeof t=="function"&&(t=Uo(t,{...this.options,...a})),Array.isArray(t)||(t=[String(t)]),t=t.map(D=>typeof D=="function"?Uo(D,{...this.options,...a}):String(D));const o=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,i=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,{key:l,namespaces:c}=this.extractFromKey(t[t.length-1],a),d=c[c.length-1];let p=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;p===void 0&&(p=":");const m=a.lng||this.language,f=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((m==null?void 0:m.toLowerCase())==="cimode")return f?o?{res:`${d}${p}${l}`,usedKey:l,exactUsedKey:l,usedLng:m,usedNS:d,usedParams:this.getUsedParamsDetails(a)}:`${d}${p}${l}`:o?{res:l,usedKey:l,exactUsedKey:l,usedLng:m,usedNS:d,usedParams:this.getUsedParamsDetails(a)}:l;const h=this.resolve(t,a);let y=h==null?void 0:h.res;const x=(h==null?void 0:h.usedKey)||l,b=(h==null?void 0:h.exactUsedKey)||l,v=["[object Number]","[object Function]","[object RegExp]"],g=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,w=!this.i18nFormat||this.i18nFormat.handleAsObject,k=a.count!==void 0&&!je(a.count),C=Lc.hasDefaultValue(a),j=k?this.pluralResolver.getSuffix(m,a.count,a):"",N=a.ordinal&&k?this.pluralResolver.getSuffix(m,a.count,{ordinal:!1}):"",P=k&&!a.ordinal&&a.count===0,L=P&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${j}`]||a[`defaultValue${N}`]||a.defaultValue;let _=y;w&&!y&&C&&(_=L);const T=vd(_),R=Object.prototype.toString.apply(_);if(w&&_&&T&&!v.includes(R)&&!(je(g)&&Array.isArray(_))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const D=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,_,{...a,ns:c}):`key '${l} (${this.language})' returned an object instead of string.`;return o?(h.res=D,h.usedParams=this.getUsedParamsDetails(a),h):D}if(i){const D=Array.isArray(_),K=D?[]:{},G=D?b:x;for(const W in _)if(Object.prototype.hasOwnProperty.call(_,W)){const H=`${G}${i}${W}`;C&&!y?K[W]=this.translate(H,{...a,defaultValue:vd(L)?L[W]:void 0,joinArrays:!1,ns:c}):K[W]=this.translate(H,{...a,joinArrays:!1,ns:c}),K[W]===H&&(K[W]=_[W])}y=K}}else if(w&&je(g)&&Array.isArray(y))y=y.join(g),y&&(y=this.extendTranslation(y,t,a,r));else{let D=!1,K=!1;!this.isValidLookup(y)&&C&&(D=!0,y=L),this.isValidLookup(y)||(K=!0,y=l);const W=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&K?void 0:y,H=C&&L!==y&&this.options.updateMissing;if(K||D||H){if(this.logger.log(H?"updateKey":"missingKey",m,d,l,H?L:y),i){const Q=this.resolve(l,{...a,keySeparator:!1});Q&&Q.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let E=[];const F=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&F&&F[0])for(let Q=0;Q{var ce;const pe=C&&ue!==y?ue:W;this.options.missingKeyHandler?this.options.missingKeyHandler(Q,d,re,pe,H,a):(ce=this.backendConnector)!=null&&ce.saveMissing&&this.backendConnector.saveMissing(Q,d,re,pe,H,a),this.emit("missingKey",Q,d,re,y)};this.options.saveMissing&&(this.options.saveMissingPlurals&&k?E.forEach(Q=>{const re=this.pluralResolver.getSuffixes(Q,a);P&&a[`defaultValue${this.options.pluralSeparator}zero`]&&!re.includes(`${this.options.pluralSeparator}zero`)&&re.push(`${this.options.pluralSeparator}zero`),re.forEach(ue=>{X([Q],l+ue,a[`defaultValue${ue}`]||L)})}):X(E,l,L))}y=this.extendTranslation(y,t,a,h,r),K&&y===l&&this.options.appendNamespaceToMissingKey&&(y=`${d}${p}${l}`),(K||D)&&this.options.parseMissingKeyHandler&&(y=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${d}${p}${l}`:l,D?y:void 0,a))}return o?(h.res=y,h.usedParams=this.getUsedParamsDetails(a),h):y}extendTranslation(t,n,r,a,o){var c,d;if((c=this.i18nFormat)!=null&&c.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const p=je(t)&&(((d=r==null?void 0:r.interpolation)==null?void 0:d.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let m;if(p){const h=t.match(this.interpolator.nestingRegexp);m=h&&h.length}let f=r.replace&&!je(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(f={...this.options.interpolation.defaultVariables,...f}),t=this.interpolator.interpolate(t,f,r.lng||this.language||a.usedLng,r),p){const h=t.match(this.interpolator.nestingRegexp),y=h&&h.length;m(o==null?void 0:o[0])===h[0]&&!r.context?(this.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):this.translate(...h,n),r)),r.interpolation&&this.interpolator.reset()}const i=r.postProcess||this.options.postProcess,l=je(i)?[i]:i;return t!=null&&(l!=null&&l.length)&&r.applyPostProcessor!==!1&&(t=uw.handle(l,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...a,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t,n={}){let r,a,o,i,l;return je(t)&&(t=[t]),Array.isArray(t)&&(t=t.map(c=>typeof c=="function"?Uo(c,{...this.options,...n}):c)),t.forEach(c=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(c,n),p=d.key;a=p;let m=d.namespaces;this.options.fallbackNS&&(m=m.concat(this.options.fallbackNS));const f=n.count!==void 0&&!je(n.count),h=f&&!n.ordinal&&n.count===0,y=n.context!==void 0&&(je(n.context)||typeof n.context=="number")&&n.context!=="",x=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);m.forEach(b=>{var v,g;this.isValidLookup(r)||(l=b,!this.checkedLoadedFor[`${x[0]}-${b}`]&&((v=this.utils)!=null&&v.hasLoadedNamespace)&&!((g=this.utils)!=null&&g.hasLoadedNamespace(l))&&(this.checkedLoadedFor[`${x[0]}-${b}`]=!0,this.logger.warn(`key "${a}" for languages "${x.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),x.forEach(w=>{var j;if(this.isValidLookup(r))return;i=w;const k=[p];if((j=this.i18nFormat)!=null&&j.addLookupKeys)this.i18nFormat.addLookupKeys(k,p,w,b,n);else{let N;f&&(N=this.pluralResolver.getSuffix(w,n.count,n));const P=`${this.options.pluralSeparator}zero`,L=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(n.ordinal&&N.startsWith(L)&&k.push(p+N.replace(L,this.options.pluralSeparator)),k.push(p+N),h&&k.push(p+P)),y){const _=`${p}${this.options.contextSeparator||"_"}${n.context}`;k.push(_),f&&(n.ordinal&&N.startsWith(L)&&k.push(_+N.replace(L,this.options.pluralSeparator)),k.push(_+N),h&&k.push(_+P))}}let C;for(;C=k.pop();)this.isValidLookup(r)||(o=C,r=this.getResource(w,b,C,n))}))})}),{res:r,usedKey:a,exactUsedKey:o,usedLng:i,usedNS:l}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r,a={}){var o;return(o=this.i18nFormat)!=null&&o.getResource?this.i18nFormat.getResource(t,n,r,a):this.resourceStore.getResource(t,n,r,a)}getUsedParamsDetails(t={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!je(t.replace);let a=r?t.replace:t;if(r&&typeof t.count<"u"&&(a.count=t.count),this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),!r){a={...a};for(const o of n)delete a[o]}return a}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&r.startsWith(n)&&t[r]!==void 0)return!0;return!1}}class bg{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=pr.create("languageUtils")}getScriptPartFromCode(t){if(t=Pi(t),!t||!t.includes("-"))return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Pi(t),!t||!t.includes("-"))return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(je(t)&&t.includes("-")){let n;try{n=Intl.getCanonicalLocales(t)[0]}catch{}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(t)}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const a=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(a))&&(n=a)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const a=this.getScriptPartFromCode(r);if(this.isSupportedCode(a))return n=a;const o=this.getLanguagePartFromCode(r);if(this.isSupportedCode(o))return n=o;n=this.options.supportedLngs.find(i=>i===o?!0:!i.includes("-")&&!o.includes("-")?!1:!!(i.includes("-")&&!o.includes("-")&&i.slice(0,i.indexOf("-"))===o||i.startsWith(o)&&o.length>1))}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),je(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],t),a=[],o=i=>{i&&(this.isSupportedCode(i)?a.push(i):this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`))};return je(t)&&(t.includes("-")||t.includes("_"))?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):je(t)&&o(this.formatLanguageCode(t)),r.forEach(i=>{a.includes(i)||o(this.formatLanguageCode(i))}),a}}const wg={zero:0,one:1,two:2,few:3,many:4,other:5},kg={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class E2{constructor(t,n={}){this.languageUtils=t,this.options=n,this.logger=pr.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,n={}){const r=Pi(t==="dev"?"en":t),a=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:a});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let i;try{i=new Intl.PluralRules(r,{type:a})}catch{if(typeof Intl>"u")return this.logger.error("No Intl support, please use an Intl polyfill!"),kg;if(!t.match(/-|_/))return kg;const c=this.languageUtils.getLanguagePartFromCode(t);i=this.getRule(c,n)}return this.pluralRulesCache[o]=i,i}needsPlural(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),(r==null?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(t,n,r={}){return this.getSuffixes(t,r).map(a=>`${n}${a}`)}getSuffixes(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((a,o)=>wg[a]-wg[o]).map(a=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${a}`):[]}getSuffix(t,n,r={}){const a=this.getRule(t,r);return a?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${a.select(n)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",n,r))}}const Cg=(e,t,n,r=".",a=!0)=>{let o=S2(e,t,n);return!o&&a&&je(n)&&(o=Vp(e,n,r),o===void 0&&(o=Vp(t,n,r))),o},xd=e=>e.replace(/\$/g,"$$$$");class Sg{constructor(t={}){var n;this.logger=pr.create("interpolator"),this.options=t,this.format=((n=t==null?void 0:t.interpolation)==null?void 0:n.format)||(r=>r),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:a,prefix:o,prefixEscaped:i,suffix:l,suffixEscaped:c,formatSeparator:d,unescapeSuffix:p,unescapePrefix:m,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:y,nestingSuffixEscaped:x,nestingOptionsSeparator:b,maxReplaces:v,alwaysFormat:g}=t.interpolation;this.escape=n!==void 0?n:j2,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=a!==void 0?a:!1,this.prefix=o?Ar(o):i||"{{",this.suffix=l?Ar(l):c||"}}",this.formatSeparator=d||",",this.unescapePrefix=p?"":m?Ar(m):"-",this.unescapeSuffix=this.unescapePrefix?"":p?Ar(p):"",this.nestingPrefix=f?Ar(f):h||Ar("$t("),this.nestingSuffix=y?Ar(y):x||Ar(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=v||1e3,this.alwaysFormat=g!==void 0?g:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>(n==null?void 0:n.source)===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,n,r,a){var h;let o,i,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=y=>{if(!y.includes(this.formatSeparator)){const g=Cg(n,c,y,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(g,void 0,r,{...a,...n,interpolationkey:y}):g}const x=y.split(this.formatSeparator),b=x.shift().trim(),v=x.join(this.formatSeparator).trim();return this.format(Cg(n,c,b,this.options.keySeparator,this.options.ignoreJSONStructure),v,r,{...a,...n,interpolationkey:b})};this.resetRegExp(),!this.escapeValue&&typeof t=="string"&&/\$t\([^)]*\{[^}]*\{\{/.test(t)&&this.logger.warn("nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.");const p=(a==null?void 0:a.missingInterpolationHandler)||this.options.missingInterpolationHandler,m=((h=a==null?void 0:a.interpolation)==null?void 0:h.skipOnVariables)!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:y=>xd(y)},{regex:this.regexp,safeValue:y=>this.escapeValue?xd(this.escape(y)):xd(y)}].forEach(y=>{for(l=0;o=y.regex.exec(t);){const x=o[1].trim();if(i=d(x),i===void 0)if(typeof p=="function"){const v=p(t,o,a);i=je(v)?v:""}else if(a&&Object.prototype.hasOwnProperty.call(a,x))i="";else if(m){i=o[0];continue}else this.logger.warn(`missed to pass in variable ${x} for interpolating ${t}`),i="";else!je(i)&&!this.useRawValueToEscape&&(i=hg(i));const b=y.safeValue(i);if(t=t.replace(o[0],b),m?(y.regex.lastIndex+=i.length,y.regex.lastIndex-=o[0].length):y.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),t}nest(t,n,r={}){let a,o,i;const l=(c,d)=>{const p=this.nestingOptionsSeparator;if(!c.includes(p))return c;const m=c.split(new RegExp(`${Ar(p)}[ ]*{`));let f=`{${m[1]}`;c=m[0],f=this.interpolate(f,i);const h=f.match(/'/g),y=f.match(/"/g);(((h==null?void 0:h.length)??0)%2===0&&!y||((y==null?void 0:y.length)??0)%2!==0)&&(f=f.replace(/'/g,'"'));try{i=JSON.parse(f),d&&(i={...d,...i})}catch(x){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,x),`${c}${p}${f}`}return i.defaultValue&&i.defaultValue.includes(this.prefix)&&delete i.defaultValue,c};for(;a=this.nestingRegexp.exec(t);){let c=[];i={...r},i=i.replace&&!je(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;const d=/{.*}/.test(a[1])?a[1].lastIndexOf("}")+1:a[1].indexOf(this.formatSeparator);if(d!==-1&&(c=a[1].slice(d).split(this.formatSeparator).map(p=>p.trim()).filter(Boolean),a[1]=a[1].slice(0,d)),o=n(l.call(this,a[1].trim(),i),i),o&&a[0]===t&&!je(o))return o;je(o)||(o=hg(o)),o||(this.logger.warn(`missed to resolve ${a[1]} for nesting ${t}`),o=""),c.length&&(o=c.reduce((p,m)=>this.format(p,m,r.lng,{...r,interpolationkey:a[1].trim()}),o.trim())),t=t.replace(a[0],o),this.regexp.lastIndex=0}return t}}const I2=e=>{let t=e.toLowerCase().trim();const n={};if(e.includes("(")){const r=e.split("(");t=r[0].toLowerCase().trim();const a=r[1].slice(0,-1);t==="currency"&&!a.includes(":")?n.currency||(n.currency=a.trim()):t==="relativetime"&&!a.includes(":")?n.range||(n.range=a.trim()):a.split(";").forEach(i=>{if(i){const[l,...c]=i.split(":"),d=c.join(":").trim().replace(/^'+|'+$/g,""),p=l.trim();n[p]||(n[p]=d),d==="false"&&(n[p]=!1),d==="true"&&(n[p]=!0),isNaN(d)||(n[p]=parseInt(d,10))}})}return{formatName:t,formatOptions:n}},Ng=e=>{const t={};return(n,r,a)=>{let o=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(o={...o,[a.interpolationkey]:void 0});const i=r+JSON.stringify(o);let l=t[i];return l||(l=e(Pi(r),a),t[i]=l),l(n)}},L2=e=>(t,n,r)=>e(Pi(n),r)(t);class D2{constructor(t={}){this.logger=pr.create("formatter"),this.options=t,this.init(t)}init(t,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const r=n.cacheInBuiltFormats?Ng:L2;this.formats={number:r((a,o)=>{const i=new Intl.NumberFormat(a,{...o});return l=>i.format(l)}),currency:r((a,o)=>{const i=new Intl.NumberFormat(a,{...o,style:"currency"});return l=>i.format(l)}),datetime:r((a,o)=>{const i=new Intl.DateTimeFormat(a,{...o});return l=>i.format(l)}),relativetime:r((a,o)=>{const i=new Intl.RelativeTimeFormat(a,{...o});return l=>i.format(l,o.range||"day")}),list:r((a,o)=>{const i=new Intl.ListFormat(a,{...o});return l=>i.format(l)})}}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Ng(n)}format(t,n,r,a={}){if(!n||t==null)return t;const o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&!o[0].includes(")")&&o.find(l=>l.includes(")"))){const l=o.findIndex(c=>c.includes(")"));o[0]=[o[0],...o.splice(1,l)].join(this.formatSeparator)}return o.reduce((l,c)=>{var m;const{formatName:d,formatOptions:p}=I2(c);if(this.formats[d]){let f=l;try{const h=((m=a==null?void 0:a.formatParams)==null?void 0:m[a.interpolationkey])||{},y=h.locale||h.lng||a.locale||a.lng||r;f=this.formats[d](l,y,{...p,...a,...h})}catch(h){this.logger.warn(h)}return f}else this.logger.warn(`there was no format function for ${d}`);return l},t)}}const O2=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class F2 extends du{constructor(t,n,r,a={}){var o,i;super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=a,this.logger=pr.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],(i=(o=this.backend)==null?void 0:o.init)==null||i.call(o,r,a.backend,a)}queueLoad(t,n,r,a){const o={},i={},l={},c={};return t.forEach(d=>{let p=!0;n.forEach(m=>{const f=`${d}|${m}`;!r.reload&&this.store.hasResourceBundle(d,m)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?i[f]===void 0&&(i[f]=!0):(this.state[f]=1,p=!1,i[f]===void 0&&(i[f]=!0),o[f]===void 0&&(o[f]=!0),c[m]===void 0&&(c[m]=!0)))}),p||(l[d]=!0)}),(Object.keys(o).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(o),pending:Object.keys(i),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const a=t.split("|"),o=a[0],i=a[1];n&&this.emit("failedLoading",o,i,n),!n&&r&&this.store.addResourceBundle(o,i,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const l={};this.queue.forEach(c=>{C2(c.loaded,[o],i),O2(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(d=>{l[d]||(l[d]={});const p=c.loaded[d];p.length&&p.forEach(m=>{l[d][m]===void 0&&(l[d][m]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r,a=0,o=this.retryTimeout,i){if(!t.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:a,wait:o,callback:i});return}this.readingCalls++;const l=(d,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const m=this.waitingReads.shift();this.read(m.lng,m.ns,m.fcName,m.tried,m.wait,m.callback)}if(d&&p&&a{this.read(t,n,r,a+1,o*2,i)},o);return}i(d,p)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const d=c(t,n);d&&typeof d.then=="function"?d.then(p=>l(null,p)).catch(l):l(null,d)}catch(d){l(d)}return}return c(t,n,l)}prepareLoading(t,n,r={},a){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();je(t)&&(t=this.languageUtils.toResolveHierarchy(t)),je(n)&&(n=[n]);const o=this.queueLoad(t,n,r,a);if(!o.toLoad.length)return o.pending.length||a(),null;o.toLoad.forEach(i=>{this.loadOne(i)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t,n=""){const r=t.split("|"),a=r[0],o=r[1];this.read(a,o,"read",void 0,void 0,(i,l)=>{i&&this.logger.warn(`${n}loading namespace ${o} for language ${a} failed`,i),!i&&l&&this.logger.log(`${n}loaded namespace ${o} for language ${a}`,l),this.loaded(t,i,l)})}saveMissing(t,n,r,a,o,i={},l=()=>{}){var c,d,p,m,f;if((d=(c=this.services)==null?void 0:c.utils)!=null&&d.hasLoadedNamespace&&!((m=(p=this.services)==null?void 0:p.utils)!=null&&m.hasLoadedNamespace(n))){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if((f=this.backend)!=null&&f.create){const h={...i,isUpdate:o},y=this.backend.create.bind(this.backend);if(y.length<6)try{let x;y.length===5?x=y(t,n,r,a,h):x=y(t,n,r,a),x&&typeof x.then=="function"?x.then(b=>l(null,b)).catch(l):l(null,x)}catch(x){l(x)}else y(t,n,r,a,l,h)}!t||!t[0]||this.store.addResource(t[0],n,r,a)}}}const yd=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),je(e[1])&&(t.defaultValue=e[1]),je(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),jg=e=>(je(e.ns)&&(e.ns=[e.ns]),je(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),je(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes("cimode")&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),jl=()=>{},z2=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class si extends du{constructor(t={},n){if(super(),this.options=jg(t),this.services={},this.logger=pr,this.modules={external:[]},z2(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(t={},n){this.isInitializing=!0,typeof t=="function"&&(n=t,t={}),t.defaultNS==null&&t.ns&&(je(t.ns)?t.defaultNS=t.ns:t.ns.includes("translation")||(t.defaultNS=t.ns[0]));const r=yd();this.options={...r,...this.options,...jg(t)},this.options.interpolation={...r.interpolation,...this.options.interpolation},t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator),typeof this.options.overloadTranslationOptionHandler!="function"&&(this.options.overloadTranslationOptionHandler=r.overloadTranslationOptionHandler);const a=d=>d?typeof d=="function"?new d:d:null;if(!this.options.isClone){this.modules.logger?pr.init(a(this.modules.logger),this.options):pr.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:d=D2;const p=new bg(this.options);this.store=new yg(this.options.resources,this.options);const m=this.services;m.logger=pr,m.resourceStore=this.store,m.languageUtils=p,m.pluralResolver=new E2(p,{prepend:this.options.pluralSeparator}),d&&(m.formatter=a(d),m.formatter.init&&m.formatter.init(m,this.options),this.options.interpolation.format=m.formatter.format.bind(m.formatter)),m.interpolator=new Sg(this.options),m.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},m.backendConnector=new F2(a(this.modules.backend),m.resourceStore,m,this.options),m.backendConnector.on("*",(f,...h)=>{this.emit(f,...h)}),this.modules.languageDetector&&(m.languageDetector=a(this.modules.languageDetector),m.languageDetector.init&&m.languageDetector.init(m,this.options.detection,this.options)),this.modules.i18nFormat&&(m.i18nFormat=a(this.modules.i18nFormat),m.i18nFormat.init&&m.i18nFormat.init(this)),this.translator=new Lc(this.services,this.options),this.translator.on("*",(f,...h)=>{this.emit(f,...h)}),this.modules.external.forEach(f=>{f.init&&f.init(this)})}if(this.format=this.options.interpolation.format,n||(n=jl),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(d=>{this[d]=(...p)=>this.store[d](...p)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=(...p)=>(this.store[d](...p),this)});const l=Ds(),c=()=>{const d=(p,m)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(m),n(p,m)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),l}loadResources(t,n=jl){var o,i;let r=n;const a=je(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if((a==null?void 0:a.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const l=[],c=d=>{if(!d||d==="cimode")return;this.services.languageUtils.toResolveHierarchy(d).forEach(m=>{m!=="cimode"&&(l.includes(m)||l.push(m))})};a?c(a):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(p=>c(p)),(i=(o=this.options.preload)==null?void 0:o.forEach)==null||i.call(o,d=>c(d)),this.services.backendConnector.load(l,this.options.ns,d=>{!d&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(d)})}else r(null)}reloadResources(t,n,r){const a=Ds();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=jl),this.services.backendConnector.reload(t,n,o=>{a.resolve(),r(o)}),a}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&uw.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!["cimode","dev"].includes(t)){for(let n=0;n{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},o=(l,c)=>{c?this.isLanguageChangingTo===t&&(a(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve((...d)=>this.t(...d)),n&&n(l,(...d)=>this.t(...d))},i=l=>{var p,m;!t&&!l&&this.services.languageDetector&&(l=[]);const c=je(l)?l:l&&l[0],d=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(je(l)?[l]:l);d&&(this.language||a(d),this.translator.language||this.translator.changeLanguage(d),(m=(p=this.services.languageDetector)==null?void 0:p.cacheUserLanguage)==null||m.call(p,d)),this.loadResources(d,f=>{o(f,d)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?i(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(t),r}getFixedT(t,n,r){const a=(o,i,...l)=>{let c;typeof i!="object"?c=this.options.overloadTranslationOptionHandler([o,i].concat(l)):c={...i},c.lng=c.lng||a.lng,c.lngs=c.lngs||a.lngs,c.ns=c.ns||a.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||a.keyPrefix);const d={...this.options,...c};typeof c.keyPrefix=="function"&&(c.keyPrefix=Uo(c.keyPrefix,d));const p=this.options.keySeparator||".";let m;return c.keyPrefix&&Array.isArray(o)?m=o.map(f=>(typeof f=="function"&&(f=Uo(f,d)),`${c.keyPrefix}${p}${f}`)):(typeof o=="function"&&(o=Uo(o,d)),m=c.keyPrefix?`${c.keyPrefix}${p}${o}`:o),this.t(m,c)};return je(t)?a.lng=t:a.lngs=t,a.ns=n,a.keyPrefix=r,a}t(...t){var n;return(n=this.translator)==null?void 0:n.translate(...t)}exists(...t){var n;return(n=this.translator)==null?void 0:n.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],a=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const i=(l,c)=>{const d=this.services.backendConnector.state[`${l}|${c}`];return d===-1||d===0||d===2};if(n.precheck){const l=n.precheck(this,i);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(r,t)&&(!a||i(o,t)))}loadNamespaces(t,n){const r=Ds();return this.options.ns?(je(t)&&(t=[t]),t.forEach(a=>{this.options.ns.includes(a)||this.options.ns.push(a)}),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Ds();je(t)&&(t=[t]);const a=this.options.preload||[],o=t.filter(i=>!a.includes(i)&&this.services.languageUtils.isSupportedCode(i));return o.length?(this.options.preload=a.concat(o),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}dir(t){var a,o;if(t||(t=this.resolvedLanguage||(((a=this.languages)==null?void 0:a.length)>0?this.languages[0]:this.language)),!t)return"rtl";try{const i=new Intl.Locale(t);if(i&&i.getTextInfo){const l=i.getTextInfo();if(l&&l.direction)return l.direction}}catch{}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=((o=this.services)==null?void 0:o.languageUtils)||new bg(yd());return t.toLowerCase().indexOf("-latn")>1?"ltr":n.includes(r.getLanguagePartFromCode(t))||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},n){const r=new si(t,n);return r.createInstance=si.createInstance,r}cloneInstance(t={},n=jl){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const a={...this.options,...t,isClone:!0},o=new si(a);if((t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(l=>{o[l]=this[l]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r){const l=Object.keys(this.store.data).reduce((c,d)=>(c[d]={...this.store.data[d]},c[d]=Object.keys(c[d]).reduce((p,m)=>(p[m]={...c[d][m]},p),c[d]),c),{});o.store=new yg(l,a),o.services.resourceStore=o.store}if(t.interpolation){const c={...yd().interpolation,...this.options.interpolation,...t.interpolation},d={...a,interpolation:c};o.services.interpolator=new Sg(d)}return o.translator=new Lc(o.services,a),o.translator.on("*",(l,...c)=>{o.emit(l,...c)}),o.init(a,n),o.translator.options=a,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const kt=si.createInstance();kt.createInstance;kt.dir;kt.init;kt.loadResources;kt.reloadResources;kt.use;kt.changeLanguage;kt.getFixedT;kt.t;kt.exists;kt.setDefaultNamespace;kt.hasLoadedNamespace;kt.loadNamespaces;kt.loadLanguages;const $2=(e,t,n,r)=>{var o,i,l,c;const a=[n,{code:t,...r||{}}];if((i=(o=e==null?void 0:e.services)==null?void 0:o.logger)!=null&&i.forward)return e.services.logger.forward(a,"warn","react-i18next::",!0);Ya(a[0])&&(a[0]=`react-i18next:: ${a[0]}`),(c=(l=e==null?void 0:e.services)==null?void 0:l.logger)!=null&&c.warn?e.services.logger.warn(...a):console!=null&&console.warn&&console.warn(...a)},Ag={},Kp=(e,t,n,r)=>{Ya(n)&&Ag[n]||(Ya(n)&&(Ag[n]=new Date),$2(e,t,n,r))},pw=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},Gp=(e,t,n)=>{e.loadNamespaces(t,pw(e,n))},_g=(e,t,n,r)=>{if(Ya(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Gp(e,n,r);n.forEach(a=>{e.options.ns.indexOf(a)<0&&e.options.ns.push(a)}),e.loadLanguages(t,pw(e,r))},U2=(e,t,n={})=>!t.languages||!t.languages.length?(Kp(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(r,a)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!a(r.isLanguageChangingTo,e))return!1}}),Ya=e=>typeof e=="string",B2=e=>typeof e=="object"&&e!==null,H2=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,W2={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},q2=e=>W2[e],V2=e=>e.replace(H2,q2);let Yp={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:V2,transDefaultProps:void 0};const K2=(e={})=>{Yp={...Yp,...e}},G2=()=>Yp;let mw;const Y2=e=>{mw=e},Q2=()=>mw,X2={type:"3rdParty",init(e){K2(e.options.react),Y2(e)}},J2=u.createContext();class Z2{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}var fw={exports:{}},hw={};/** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var rs=u;function eA(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var tA=typeof Object.is=="function"?Object.is:eA,nA=rs.useState,rA=rs.useEffect,aA=rs.useLayoutEffect,oA=rs.useDebugValue;function sA(e,t){var n=t(),r=nA({inst:{value:n,getSnapshot:t}}),a=r[0].inst,o=r[1];return aA(function(){a.value=n,a.getSnapshot=t,bd(a)&&o({inst:a})},[e,n,t]),rA(function(){return bd(a)&&o({inst:a}),e(function(){bd(a)&&o({inst:a})})},[e]),oA(n),n}function bd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!tA(e,n)}catch{return!0}}function iA(e,t){return t()}var lA=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?iA:sA;hw.useSyncExternalStore=rs.useSyncExternalStore!==void 0?rs.useSyncExternalStore:lA;fw.exports=hw;var cA=fw.exports;const uA=(e,t)=>{if(Ya(t))return t;if(B2(t)&&Ya(t.defaultValue))return t.defaultValue;if(typeof e=="function")return"";if(Array.isArray(e)){const n=e[e.length-1];return typeof n=="function"?"":n}return e},dA={t:uA,ready:!1},pA=()=>()=>{},se=(e,t={})=>{var L,_,T;const{i18n:n}=t,{i18n:r,defaultNS:a}=u.useContext(J2)||{},o=n||r||Q2();o&&!o.reportNamespaces&&(o.reportNamespaces=new Z2),o||Kp(o,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const i=u.useMemo(()=>{var R;return{...G2(),...(R=o==null?void 0:o.options)==null?void 0:R.react,...t}},[o,t]),{useSuspense:l,keyPrefix:c}=i,d=e||a||((L=o==null?void 0:o.options)==null?void 0:L.defaultNS),p=Ya(d)?[d]:d||["translation"],m=u.useMemo(()=>p,p);(T=(_=o==null?void 0:o.reportNamespaces)==null?void 0:_.addUsedNamespaces)==null||T.call(_,m);const f=u.useRef(0),h=u.useCallback(R=>{if(!o)return pA;const{bindI18n:D,bindI18nStore:K}=i,G=()=>{f.current+=1,R()};return D&&o.on(D,G),K&&o.store.on(K,G),()=>{D&&D.split(" ").forEach(W=>o.off(W,G)),K&&K.split(" ").forEach(W=>o.store.off(W,G))}},[o,i]),y=u.useRef(),x=u.useCallback(()=>{if(!o)return dA;const R=!!(o.isInitialized||o.initializedStoreOnce)&&m.every(E=>U2(E,o,i)),D=t.lng||o.language,K=f.current,G=y.current;if(G&&G.ready===R&&G.lng===D&&G.keyPrefix===c&&G.revision===K)return G;const H={t:o.getFixedT(D,i.nsMode==="fallback"?m:m[0],c),ready:R,lng:D,keyPrefix:c,revision:K};return y.current=H,H},[o,m,c,i,t.lng]),[b,v]=u.useState(0),{t:g,ready:w}=cA.useSyncExternalStore(h,x,x);u.useEffect(()=>{if(o&&!w&&!l){const R=()=>v(D=>D+1);t.lng?_g(o,t.lng,m,R):Gp(o,m,R)}},[o,t.lng,m,w,l,b]);const k=o||{},C=u.useRef(null),j=u.useRef(),N=R=>{const D=Object.getOwnPropertyDescriptors(R);D.__original&&delete D.__original;const K=Object.create(Object.getPrototypeOf(R),D);if(!Object.prototype.hasOwnProperty.call(K,"__original"))try{Object.defineProperty(K,"__original",{value:R,writable:!1,enumerable:!1,configurable:!1})}catch{}return K},P=u.useMemo(()=>{const R=k,D=R==null?void 0:R.language;let K=R;R&&(C.current&&C.current.__original===R?j.current!==D?(K=N(R),C.current=K,j.current=D):K=C.current:(K=N(R),C.current=K,j.current=D));const G=!w&&!l?(...H)=>(Kp(o,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),g(...H)):g,W=[G,K,w];return W.t=G,W.i18n=K,W.ready=w,W},[g,k,w,k.resolvedLanguage,k.language,k.languages]);if(o&&l&&!w)throw new Promise(R=>{const D=()=>R();t.lng?_g(o,t.lng,m,D):Gp(o,m,D)});return P};function mA(e,t){const n=u.createContext(t),r=o=>{const{children:i,...l}=o,c=u.useMemo(()=>l,Object.values(l));return s.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function a(o){const i=u.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,a]}function Aa(e,t=[]){let n=[];function r(o,i){const l=u.createContext(i),c=n.length;n=[...n,i];const d=m=>{var v;const{scope:f,children:h,...y}=m,x=((v=f==null?void 0:f[e])==null?void 0:v[c])||l,b=u.useMemo(()=>y,Object.values(y));return s.jsx(x.Provider,{value:b,children:h})};d.displayName=o+"Provider";function p(m,f){var x;const h=((x=f==null?void 0:f[e])==null?void 0:x[c])||l,y=u.useContext(h);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${o}\``)}return[d,p]}const a=()=>{const o=n.map(i=>u.createContext(i));return function(l){const c=(l==null?void 0:l[e])||o;return u.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return a.scopeName=e,[r,fA(a,...t)]}function fA(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const i=r.reduce((l,{useScope:c,scopeName:d})=>{const m=c(o)[`__scope${d}`];return{...l,...m}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Pg(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function _a(...e){return t=>{let n=!1;const r=e.map(a=>{const o=Pg(a,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let a=0;a{},hA=wm[" useId ".trim().toString()]||(()=>{}),gA=0;function $a(e){const[t,n]=u.useState(hA());return ya(()=>{n(r=>r??String(gA++))},[e]),t?`radix-${t}`:""}var vA=wm[" useInsertionEffect ".trim().toString()]||ya;function pu({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,o,i]=xA({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:a;{const p=u.useRef(e!==void 0);u.useEffect(()=>{const m=p.current;m!==l&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=l},[l,r])}const d=u.useCallback(p=>{var m;if(l){const f=yA(p)?p(e):p;f!==e&&((m=i.current)==null||m.call(i,f))}else o(p)},[l,e,o,i]);return[c,d]}function xA({defaultProp:e,onChange:t}){const[n,r]=u.useState(e),a=u.useRef(n),o=u.useRef(t);return vA(()=>{o.current=t},[t]),u.useEffect(()=>{var i;a.current!==n&&((i=o.current)==null||i.call(o,n),a.current=n)},[n,a]),[n,r,o]}function yA(e){return typeof e=="function"}function bA(e){const t=wA(e),n=u.forwardRef((r,a)=>{const{children:o,...i}=r,l=u.Children.toArray(o),c=l.find(CA);if(c){const d=c.props.children,p=l.map(m=>m===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:m);return s.jsx(t,{...i,ref:a,children:u.isValidElement(d)?u.cloneElement(d,void 0,p):null})}return s.jsx(t,{...i,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}function wA(e){const t=u.forwardRef((n,r)=>{const{children:a,...o}=n;if(u.isValidElement(a)){const i=NA(a),l=SA(o,a.props);return a.type!==u.Fragment&&(l.ref=r?_a(r,i):i),u.cloneElement(a,l)}return u.Children.count(a)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var kA=Symbol("radix.slottable");function CA(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===kA}function SA(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...l)=>{const c=o(...l);return a(...l),c}:a&&(n[r]=a):r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function NA(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var jA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ct=jA.reduce((e,t)=>{const n=bA(`Primitive.${t}`),r=u.forwardRef((a,o)=>{const{asChild:i,...l}=a,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function gw(e,t){e&&uu.flushSync(()=>e.dispatchEvent(t))}function $r(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function AA(e,t=globalThis==null?void 0:globalThis.document){const n=$r(e);u.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var _A="DismissableLayer",Qp="dismissableLayer.update",PA="dismissableLayer.pointerDownOutside",TA="dismissableLayer.focusOutside",Tg,vw=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),mu=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:i,onDismiss:l,...c}=e,d=u.useContext(vw),[p,m]=u.useState(null),f=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=u.useState({}),y=At(t,N=>m(N)),x=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),v=x.indexOf(b),g=p?x.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,k=g>=v,C=EA(N=>{const P=N.target,L=[...d.branches].some(_=>_.contains(P));!k||L||(a==null||a(N),i==null||i(N),N.defaultPrevented||l==null||l())},f),j=IA(N=>{const P=N.target;[...d.branches].some(_=>_.contains(P))||(o==null||o(N),i==null||i(N),N.defaultPrevented||l==null||l())},f);return AA(N=>{g===d.layers.size-1&&(r==null||r(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},f),u.useEffect(()=>{if(p)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Tg=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),Rg(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Tg)}},[p,f,n,d]),u.useEffect(()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),Rg())},[p,d]),u.useEffect(()=>{const N=()=>h({});return document.addEventListener(Qp,N),()=>document.removeEventListener(Qp,N)},[]),s.jsx(Ct.div,{...c,ref:y,style:{pointerEvents:w?k?"auto":"none":void 0,...e.style},onFocusCapture:_e(e.onFocusCapture,j.onFocusCapture),onBlurCapture:_e(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:_e(e.onPointerDownCapture,C.onPointerDownCapture)})});mu.displayName=_A;var RA="DismissableLayerBranch",MA=u.forwardRef((e,t)=>{const n=u.useContext(vw),r=u.useRef(null),a=At(t,r);return u.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),s.jsx(Ct.div,{...e,ref:a})});MA.displayName=RA;function EA(e,t=globalThis==null?void 0:globalThis.document){const n=$r(e),r=u.useRef(!1),a=u.useRef(()=>{});return u.useEffect(()=>{const o=l=>{if(l.target&&!r.current){let c=function(){xw(PA,n,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=c,t.addEventListener("click",a.current,{once:!0})):c()}else t.removeEventListener("click",a.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",o),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function IA(e,t=globalThis==null?void 0:globalThis.document){const n=$r(e),r=u.useRef(!1);return u.useEffect(()=>{const a=o=>{o.target&&!r.current&&xw(TA,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Rg(){const e=new CustomEvent(Qp);document.dispatchEvent(e)}function xw(e,t,n,{discrete:r}){const a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?gw(a,o):a.dispatchEvent(o)}var wd="focusScope.autoFocusOnMount",kd="focusScope.autoFocusOnUnmount",Mg={bubbles:!1,cancelable:!0},LA="FocusScope",yf=u.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...i}=e,[l,c]=u.useState(null),d=$r(a),p=$r(o),m=u.useRef(null),f=At(t,x=>c(x)),h=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(r){let x=function(w){if(h.paused||!l)return;const k=w.target;l.contains(k)?m.current=k:ta(m.current,{select:!0})},b=function(w){if(h.paused||!l)return;const k=w.relatedTarget;k!==null&&(l.contains(k)||ta(m.current,{select:!0}))},v=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&ta(l)};document.addEventListener("focusin",x),document.addEventListener("focusout",b);const g=new MutationObserver(v);return l&&g.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",b),g.disconnect()}}},[r,l,h.paused]),u.useEffect(()=>{if(l){Ig.add(h);const x=document.activeElement;if(!l.contains(x)){const v=new CustomEvent(wd,Mg);l.addEventListener(wd,d),l.dispatchEvent(v),v.defaultPrevented||(DA(UA(yw(l)),{select:!0}),document.activeElement===x&&ta(l))}return()=>{l.removeEventListener(wd,d),setTimeout(()=>{const v=new CustomEvent(kd,Mg);l.addEventListener(kd,p),l.dispatchEvent(v),v.defaultPrevented||ta(x??document.body,{select:!0}),l.removeEventListener(kd,p),Ig.remove(h)},0)}}},[l,d,p,h]);const y=u.useCallback(x=>{if(!n&&!r||h.paused)return;const b=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,v=document.activeElement;if(b&&v){const g=x.currentTarget,[w,k]=OA(g);w&&k?!x.shiftKey&&v===k?(x.preventDefault(),n&&ta(w,{select:!0})):x.shiftKey&&v===w&&(x.preventDefault(),n&&ta(k,{select:!0})):v===g&&x.preventDefault()}},[n,r,h.paused]);return s.jsx(Ct.div,{tabIndex:-1,...i,ref:f,onKeyDown:y})});yf.displayName=LA;function DA(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ta(r,{select:t}),document.activeElement!==n)return}function OA(e){const t=yw(e),n=Eg(t,e),r=Eg(t.reverse(),e);return[n,r]}function yw(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Eg(e,t){for(const n of e)if(!FA(n,{upTo:t}))return n}function FA(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function zA(e){return e instanceof HTMLInputElement&&"select"in e}function ta(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&zA(e)&&t&&e.select()}}var Ig=$A();function $A(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Lg(e,t),e.unshift(t)},remove(t){var n;e=Lg(e,t),(n=e[0])==null||n.resume()}}}function Lg(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function UA(e){return e.filter(t=>t.tagName!=="A")}var BA="Portal",fu=u.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[a,o]=u.useState(!1);ya(()=>o(!0),[]);const i=n||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return i?Dj.createPortal(s.jsx(Ct.div,{...r,ref:t}),i):null});fu.displayName=BA;function HA(e,t){return u.useReducer((n,r)=>t[n][r]??n,e)}var yr=e=>{const{present:t,children:n}=e,r=WA(t),a=typeof n=="function"?n({present:r.isPresent}):u.Children.only(n),o=At(r.ref,qA(a));return typeof n=="function"||r.isPresent?u.cloneElement(a,{ref:o}):null};yr.displayName="Presence";function WA(e){const[t,n]=u.useState(),r=u.useRef(null),a=u.useRef(e),o=u.useRef("none"),i=e?"mounted":"unmounted",[l,c]=HA(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=Al(r.current);o.current=l==="mounted"?d:"none"},[l]),ya(()=>{const d=r.current,p=a.current;if(p!==e){const f=o.current,h=Al(d);e?c("MOUNT"):h==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(p&&f!==h?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,c]),ya(()=>{if(t){let d;const p=t.ownerDocument.defaultView??window,m=h=>{const x=Al(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&x&&(c("ANIMATION_END"),!a.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",d=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},f=h=>{h.target===t&&(o.current=Al(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(d),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:u.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function Al(e){return(e==null?void 0:e.animationName)||"none"}function qA(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Cd=0;function bw(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Dg()),document.body.insertAdjacentElement("beforeend",e[1]??Dg()),Cd++,()=>{Cd===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Cd--}},[])}function Dg(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var dr=function(){return dr=Object.assign||function(t){for(var n,r=1,a=arguments.length;r"u")return l_;var t=c_(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},d_=Sw(),Bo="data-scroll-locked",p_=function(e,t,n,r){var a=e.left,o=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),` .`.concat(KA,` { overflow: hidden `).concat(r,`; padding-right: `).concat(l,"px ").concat(r,`; } body[`).concat(Bo,`] { overflow: hidden `).concat(r,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` padding-left: `.concat(a,`px; padding-top: `).concat(o,`px; padding-right: `).concat(i,`px; margin-left:0; margin-top:0; margin-right: `).concat(l,"px ").concat(r,`; `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),` } .`).concat(Jl,` { right: `).concat(l,"px ").concat(r,`; } .`).concat(Zl,` { margin-right: `).concat(l,"px ").concat(r,`; } .`).concat(Jl," .").concat(Jl,` { right: 0 `).concat(r,`; } .`).concat(Zl," .").concat(Zl,` { margin-right: 0 `).concat(r,`; } body[`).concat(Bo,`] { `).concat(GA,": ").concat(l,`px; } `)},Fg=function(){var e=parseInt(document.body.getAttribute(Bo)||"0",10);return isFinite(e)?e:0},m_=function(){u.useEffect(function(){return document.body.setAttribute(Bo,(Fg()+1).toString()),function(){var e=Fg()-1;e<=0?document.body.removeAttribute(Bo):document.body.setAttribute(Bo,e.toString())}},[])},f_=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r;m_();var o=u.useMemo(function(){return u_(a)},[a]);return u.createElement(d_,{styles:p_(o,!t,a,n?"":"!important")})},Xp=!1;if(typeof window<"u")try{var _l=Object.defineProperty({},"passive",{get:function(){return Xp=!0,!0}});window.addEventListener("test",_l,_l),window.removeEventListener("test",_l,_l)}catch{Xp=!1}var fo=Xp?{passive:!1}:!1,h_=function(e){return e.tagName==="TEXTAREA"},Nw=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!h_(e)&&n[t]==="visible")},g_=function(e){return Nw(e,"overflowY")},v_=function(e){return Nw(e,"overflowX")},zg=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var a=jw(e,r);if(a){var o=Aw(e,r),i=o[1],l=o[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},x_=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},y_=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},jw=function(e,t){return e==="v"?g_(t):v_(t)},Aw=function(e,t){return e==="v"?x_(t):y_(t)},b_=function(e,t){return e==="h"&&t==="rtl"?-1:1},w_=function(e,t,n,r,a){var o=b_(e,window.getComputedStyle(t).direction),i=o*r,l=n.target,c=t.contains(l),d=!1,p=i>0,m=0,f=0;do{if(!l)break;var h=Aw(e,l),y=h[0],x=h[1],b=h[2],v=x-b-o*y;(y||v)&&jw(e,l)&&(m+=v,f+=y);var g=l.parentNode;l=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(p&&Math.abs(m)<1||!p&&Math.abs(f)<1)&&(d=!0),d},Pl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},$g=function(e){return[e.deltaX,e.deltaY]},Ug=function(e){return e&&"current"in e?e.current:e},k_=function(e,t){return e[0]===t[0]&&e[1]===t[1]},C_=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},S_=0,ho=[];function N_(e){var t=u.useRef([]),n=u.useRef([0,0]),r=u.useRef(),a=u.useState(S_++)[0],o=u.useState(Sw)[0],i=u.useRef(e);u.useEffect(function(){i.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var x=VA([e.lockRef.current],(e.shards||[]).map(Ug),!0).filter(Boolean);return x.forEach(function(b){return b.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),x.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=u.useCallback(function(x,b){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!i.current.allowPinchZoom;var v=Pl(x),g=n.current,w="deltaX"in x?x.deltaX:g[0]-v[0],k="deltaY"in x?x.deltaY:g[1]-v[1],C,j=x.target,N=Math.abs(w)>Math.abs(k)?"h":"v";if("touches"in x&&N==="h"&&j.type==="range")return!1;var P=window.getSelection(),L=P&&P.anchorNode,_=L?L===j||L.contains(j):!1;if(_)return!1;var T=zg(N,j);if(!T)return!0;if(T?C=N:(C=N==="v"?"h":"v",T=zg(N,j)),!T)return!1;if(!r.current&&"changedTouches"in x&&(w||k)&&(r.current=C),!C)return!0;var R=r.current||C;return w_(R,b,x,R==="h"?w:k)},[]),c=u.useCallback(function(x){var b=x;if(!(!ho.length||ho[ho.length-1]!==o)){var v="deltaY"in b?$g(b):Pl(b),g=t.current.filter(function(C){return C.name===b.type&&(C.target===b.target||b.target===C.shadowParent)&&k_(C.delta,v)})[0];if(g&&g.should){b.cancelable&&b.preventDefault();return}if(!g){var w=(i.current.shards||[]).map(Ug).filter(Boolean).filter(function(C){return C.contains(b.target)}),k=w.length>0?l(b,w[0]):!i.current.noIsolation;k&&b.cancelable&&b.preventDefault()}}},[]),d=u.useCallback(function(x,b,v,g){var w={name:x,delta:b,target:v,should:g,shadowParent:j_(v)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(k){return k!==w})},1)},[]),p=u.useCallback(function(x){n.current=Pl(x),r.current=void 0},[]),m=u.useCallback(function(x){d(x.type,$g(x),x.target,l(x,e.lockRef.current))},[]),f=u.useCallback(function(x){d(x.type,Pl(x),x.target,l(x,e.lockRef.current))},[]);u.useEffect(function(){return ho.push(o),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:f}),document.addEventListener("wheel",c,fo),document.addEventListener("touchmove",c,fo),document.addEventListener("touchstart",p,fo),function(){ho=ho.filter(function(x){return x!==o}),document.removeEventListener("wheel",c,fo),document.removeEventListener("touchmove",c,fo),document.removeEventListener("touchstart",p,fo)}},[]);var h=e.removeScrollBar,y=e.inert;return u.createElement(u.Fragment,null,y?u.createElement(o,{styles:C_(a)}):null,h?u.createElement(f_,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function j_(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const A_=t_(Cw,N_);var bf=u.forwardRef(function(e,t){return u.createElement(hu,dr({},e,{ref:t,sideCar:A_}))});bf.classNames=hu.classNames;var __=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},go=new WeakMap,Tl=new WeakMap,Rl={},Ad=0,_w=function(e){return e&&(e.host||_w(e.parentNode))},P_=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=_w(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},T_=function(e,t,n,r){var a=P_(t,Array.isArray(e)?e:[e]);Rl[n]||(Rl[n]=new WeakMap);var o=Rl[n],i=[],l=new Set,c=new Set(a),d=function(m){!m||l.has(m)||(l.add(m),d(m.parentNode))};a.forEach(d);var p=function(m){!m||c.has(m)||Array.prototype.forEach.call(m.children,function(f){if(l.has(f))p(f);else try{var h=f.getAttribute(r),y=h!==null&&h!=="false",x=(go.get(f)||0)+1,b=(o.get(f)||0)+1;go.set(f,x),o.set(f,b),i.push(f),x===1&&y&&Tl.set(f,!0),b===1&&f.setAttribute(n,"true"),y||f.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",f,v)}})};return p(t),l.clear(),Ad++,function(){i.forEach(function(m){var f=go.get(m)-1,h=o.get(m)-1;go.set(m,f),o.set(m,h),f||(Tl.has(m)||m.removeAttribute(r),Tl.delete(m)),h||m.removeAttribute(n)}),Ad--,Ad||(go=new WeakMap,go=new WeakMap,Tl=new WeakMap,Rl={})}},Pw=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=__(e);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),T_(r,a,n,"aria-hidden")):function(){return null}};function R_(e){const t=M_(e),n=u.forwardRef((r,a)=>{const{children:o,...i}=r,l=u.Children.toArray(o),c=l.find(I_);if(c){const d=c.props.children,p=l.map(m=>m===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:m);return s.jsx(t,{...i,ref:a,children:u.isValidElement(d)?u.cloneElement(d,void 0,p):null})}return s.jsx(t,{...i,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}function M_(e){const t=u.forwardRef((n,r)=>{const{children:a,...o}=n;if(u.isValidElement(a)){const i=D_(a),l=L_(o,a.props);return a.type!==u.Fragment&&(l.ref=r?_a(r,i):i),u.cloneElement(a,l)}return u.Children.count(a)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var E_=Symbol("radix.slottable");function I_(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===E_}function L_(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...l)=>{const c=o(...l);return a(...l),c}:a&&(n[r]=a):r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function D_(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var gu="Dialog",[Tw,Rw]=Aa(gu),[O_,ar]=Tw(gu),Mw=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:i=!0}=e,l=u.useRef(null),c=u.useRef(null),[d,p]=pu({prop:r,defaultProp:a??!1,onChange:o,caller:gu});return s.jsx(O_,{scope:t,triggerRef:l,contentRef:c,contentId:$a(),titleId:$a(),descriptionId:$a(),open:d,onOpenChange:p,onOpenToggle:u.useCallback(()=>p(m=>!m),[p]),modal:i,children:n})};Mw.displayName=gu;var Ew="DialogTrigger",Iw=u.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=ar(Ew,n),o=At(t,a.triggerRef);return s.jsx(Ct.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Cf(a.open),...r,ref:o,onClick:_e(e.onClick,a.onOpenToggle)})});Iw.displayName=Ew;var wf="DialogPortal",[F_,Lw]=Tw(wf,{forceMount:void 0}),Dw=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=ar(wf,t);return s.jsx(F_,{scope:t,forceMount:n,children:u.Children.map(r,i=>s.jsx(yr,{present:n||o.open,children:s.jsx(fu,{asChild:!0,container:a,children:i})}))})};Dw.displayName=wf;var Dc="DialogOverlay",Ow=u.forwardRef((e,t)=>{const n=Lw(Dc,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=ar(Dc,e.__scopeDialog);return o.modal?s.jsx(yr,{present:r||o.open,children:s.jsx($_,{...a,ref:t})}):null});Ow.displayName=Dc;var z_=R_("DialogOverlay.RemoveScroll"),$_=u.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=ar(Dc,n);return s.jsx(bf,{as:z_,allowPinchZoom:!0,shards:[a.contentRef],children:s.jsx(Ct.div,{"data-state":Cf(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Qa="DialogContent",Fw=u.forwardRef((e,t)=>{const n=Lw(Qa,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=ar(Qa,e.__scopeDialog);return s.jsx(yr,{present:r||o.open,children:o.modal?s.jsx(U_,{...a,ref:t}):s.jsx(B_,{...a,ref:t})})});Fw.displayName=Qa;var U_=u.forwardRef((e,t)=>{const n=ar(Qa,e.__scopeDialog),r=u.useRef(null),a=At(t,n.contentRef,r);return u.useEffect(()=>{const o=r.current;if(o)return Pw(o)},[]),s.jsx(zw,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:_e(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:_e(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&o.preventDefault()}),onFocusOutside:_e(e.onFocusOutside,o=>o.preventDefault())})}),B_=u.forwardRef((e,t)=>{const n=ar(Qa,e.__scopeDialog),r=u.useRef(!1),a=u.useRef(!1);return s.jsx(zw,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,o),o.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),o.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:o=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const i=o.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),zw=u.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,...i}=e,l=ar(Qa,n),c=u.useRef(null),d=At(t,c);return bw(),s.jsxs(s.Fragment,{children:[s.jsx(yf,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o,children:s.jsx(mu,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Cf(l.open),...i,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(W_,{titleId:l.titleId}),s.jsx(V_,{contentRef:c,descriptionId:l.descriptionId})]})]})}),kf="DialogTitle",$w=u.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=ar(kf,n);return s.jsx(Ct.h2,{id:a.titleId,...r,ref:t})});$w.displayName=kf;var Uw="DialogDescription",Bw=u.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=ar(Uw,n);return s.jsx(Ct.p,{id:a.descriptionId,...r,ref:t})});Bw.displayName=Uw;var Hw="DialogClose",Ww=u.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=ar(Hw,n);return s.jsx(Ct.button,{type:"button",...r,ref:t,onClick:_e(e.onClick,()=>a.onOpenChange(!1))})});Ww.displayName=Hw;function Cf(e){return e?"open":"closed"}var qw="DialogTitleWarning",[H_,Vw]=mA(qw,{contentName:Qa,titleName:kf,docsSlug:"dialog"}),W_=({titleId:e})=>{const t=Vw(qw),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return u.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},q_="DialogDescriptionWarning",V_=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Vw(q_).contentName}}.`;return u.useEffect(()=>{var o;const a=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},vu=Mw,K_=Iw,xu=Dw,gs=Ow,vs=Fw,xs=$w,Gi=Bw,Yi=Ww,G_=Symbol("radix.slottable");function Y_(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=G_,t}var Kw="AlertDialog",[Q_]=Aa(Kw,[Rw]),qr=Rw(),Gw=e=>{const{__scopeAlertDialog:t,...n}=e,r=qr(t);return s.jsx(vu,{...r,...n,modal:!0})};Gw.displayName=Kw;var X_="AlertDialogTrigger",J_=u.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=qr(n);return s.jsx(K_,{...a,...r,ref:t})});J_.displayName=X_;var Z_="AlertDialogPortal",Yw=e=>{const{__scopeAlertDialog:t,...n}=e,r=qr(t);return s.jsx(xu,{...r,...n})};Yw.displayName=Z_;var eP="AlertDialogOverlay",Qw=u.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=qr(n);return s.jsx(gs,{...a,...r,ref:t})});Qw.displayName=eP;var Ho="AlertDialogContent",[tP,nP]=Q_(Ho),rP=Y_("AlertDialogContent"),Xw=u.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...a}=e,o=qr(n),i=u.useRef(null),l=At(t,i),c=u.useRef(null);return s.jsx(H_,{contentName:Ho,titleName:Jw,docsSlug:"alert-dialog",children:s.jsx(tP,{scope:n,cancelRef:c,children:s.jsxs(vs,{role:"alertdialog",...o,...a,ref:l,onOpenAutoFocus:_e(a.onOpenAutoFocus,d=>{var p;d.preventDefault(),(p=c.current)==null||p.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[s.jsx(rP,{children:r}),s.jsx(oP,{contentRef:i})]})})})});Xw.displayName=Ho;var Jw="AlertDialogTitle",Zw=u.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=qr(n);return s.jsx(xs,{...a,...r,ref:t})});Zw.displayName=Jw;var e0="AlertDialogDescription",t0=u.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=qr(n);return s.jsx(Gi,{...a,...r,ref:t})});t0.displayName=e0;var aP="AlertDialogAction",n0=u.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=qr(n);return s.jsx(Yi,{...a,...r,ref:t})});n0.displayName=aP;var r0="AlertDialogCancel",a0=u.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=nP(r0,n),o=qr(n),i=At(t,a);return s.jsx(Yi,{...o,...r,ref:i})});a0.displayName=r0;var oP=({contentRef:e})=>{const t=`\`${Ho}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${Ho}\` by passing a \`${e0}\` component as a child, which also benefits sighted users by adding visible context to the dialog. Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ho}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return u.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},sP=Gw,iP=Yw,o0=Qw,s0=Xw,i0=n0,l0=a0,c0=Zw,u0=t0;function d0(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t{const t=uP(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const l=i.split(Sf);return l[0]===""&&l.length!==1&&l.shift(),m0(l,t)||cP(i)},getConflictingClassGroupIds:(i,l)=>{const c=n[i]||[];return l&&r[i]?[...c,...r[i]]:c}}},m0=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),a=r?m0(e.slice(1),r):void 0;if(a)return a;if(t.validators.length===0)return;const o=e.join(Sf);return(i=t.validators.find(({validator:l})=>l(o)))==null?void 0:i.classGroupId},Bg=/^\[(.+)\]$/,cP=e=>{if(Bg.test(e)){const t=Bg.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},uP=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return pP(Object.entries(e.classGroups),n).forEach(([o,i])=>{Jp(i,r,o,t)}),r},Jp=(e,t,n,r)=>{e.forEach(a=>{if(typeof a=="string"){const o=a===""?t:Hg(t,a);o.classGroupId=n;return}if(typeof a=="function"){if(dP(a)){Jp(a(r),t,n,r);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([o,i])=>{Jp(i,Hg(t,o),n,r)})})},Hg=(e,t)=>{let n=e;return t.split(Sf).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},dP=e=>e.isThemeGetter,pP=(e,t)=>t?e.map(([n,r])=>{const a=r.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,l])=>[t+i,l])):o);return[n,a]}):e,mP=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const a=(o,i)=>{n.set(o,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(o){let i=n.get(o);if(i!==void 0)return i;if((i=r.get(o))!==void 0)return a(o,i),i},set(o,i){n.has(o)?n.set(o,i):a(o,i)}}},f0="!",fP=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,a=t[0],o=t.length,i=l=>{const c=[];let d=0,p=0,m;for(let b=0;bp?m-p:void 0;return{modifiers:c,hasImportantModifier:h,baseClassName:y,maybePostfixModifierPosition:x}};return n?l=>n({className:l,parseClassName:i}):i},hP=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},gP=e=>({cache:mP(e.cacheSize),parseClassName:fP(e),...lP(e)}),vP=/\s+/,xP=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=t,o=[],i=e.trim().split(vP);let l="";for(let c=i.length-1;c>=0;c-=1){const d=i[c],{modifiers:p,hasImportantModifier:m,baseClassName:f,maybePostfixModifierPosition:h}=n(d);let y=!!h,x=r(y?f.substring(0,h):f);if(!x){if(!y){l=d+(l.length>0?" "+l:l);continue}if(x=r(f),!x){l=d+(l.length>0?" "+l:l);continue}y=!1}const b=hP(p).join(":"),v=m?b+f0:b,g=v+x;if(o.includes(g))continue;o.push(g);const w=a(x,y);for(let k=0;k0?" "+l:l)}return l};function yP(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rm(p),e());return n=gP(d),r=n.cache.get,a=n.cache.set,o=l,l(c)}function l(c){const d=r(c);if(d)return d;const p=xP(c,n);return a(c,p),p}return function(){return o(yP.apply(null,arguments))}}const rt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},g0=/^\[(?:([a-z-]+):)?(.+)\]$/i,wP=/^\d+\/\d+$/,kP=new Set(["px","full","screen"]),CP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,SP=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,NP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,jP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,AP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_r=e=>Wo(e)||kP.has(e)||wP.test(e),Jr=e=>ys(e,"length",LP),Wo=e=>!!e&&!Number.isNaN(Number(e)),_d=e=>ys(e,"number",Wo),Os=e=>!!e&&Number.isInteger(Number(e)),_P=e=>e.endsWith("%")&&Wo(e.slice(0,-1)),ze=e=>g0.test(e),Zr=e=>CP.test(e),PP=new Set(["length","size","percentage"]),TP=e=>ys(e,PP,v0),RP=e=>ys(e,"position",v0),MP=new Set(["image","url"]),EP=e=>ys(e,MP,OP),IP=e=>ys(e,"",DP),Fs=()=>!0,ys=(e,t,n)=>{const r=g0.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},LP=e=>SP.test(e)&&!NP.test(e),v0=()=>!1,DP=e=>jP.test(e),OP=e=>AP.test(e),FP=()=>{const e=rt("colors"),t=rt("spacing"),n=rt("blur"),r=rt("brightness"),a=rt("borderColor"),o=rt("borderRadius"),i=rt("borderSpacing"),l=rt("borderWidth"),c=rt("contrast"),d=rt("grayscale"),p=rt("hueRotate"),m=rt("invert"),f=rt("gap"),h=rt("gradientColorStops"),y=rt("gradientColorStopPositions"),x=rt("inset"),b=rt("margin"),v=rt("opacity"),g=rt("padding"),w=rt("saturate"),k=rt("scale"),C=rt("sepia"),j=rt("skew"),N=rt("space"),P=rt("translate"),L=()=>["auto","contain","none"],_=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto",ze,t],R=()=>[ze,t],D=()=>["",_r,Jr],K=()=>["auto",Wo,ze],G=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],W=()=>["solid","dashed","dotted","double","none"],H=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],E=()=>["start","end","center","between","around","evenly","stretch"],F=()=>["","0",ze],X=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Q=()=>[Wo,ze];return{cacheSize:500,separator:":",theme:{colors:[Fs],spacing:[_r,Jr],blur:["none","",Zr,ze],brightness:Q(),borderColor:[e],borderRadius:["none","","full",Zr,ze],borderSpacing:R(),borderWidth:D(),contrast:Q(),grayscale:F(),hueRotate:Q(),invert:F(),gap:R(),gradientColorStops:[e],gradientColorStopPositions:[_P,Jr],inset:T(),margin:T(),opacity:Q(),padding:R(),saturate:Q(),scale:Q(),sepia:F(),skew:Q(),space:R(),translate:R()},classGroups:{aspect:[{aspect:["auto","square","video",ze]}],container:["container"],columns:[{columns:[Zr]}],"break-after":[{"break-after":X()}],"break-before":[{"break-before":X()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...G(),ze]}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[x]}],"inset-x":[{"inset-x":[x]}],"inset-y":[{"inset-y":[x]}],start:[{start:[x]}],end:[{end:[x]}],top:[{top:[x]}],right:[{right:[x]}],bottom:[{bottom:[x]}],left:[{left:[x]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Os,ze]}],basis:[{basis:T()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ze]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",Os,ze]}],"grid-cols":[{"grid-cols":[Fs]}],"col-start-end":[{col:["auto",{span:["full",Os,ze]},ze]}],"col-start":[{"col-start":K()}],"col-end":[{"col-end":K()}],"grid-rows":[{"grid-rows":[Fs]}],"row-start-end":[{row:["auto",{span:[Os,ze]},ze]}],"row-start":[{"row-start":K()}],"row-end":[{"row-end":K()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ze]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ze]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...E()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...E(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...E(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[g]}],px:[{px:[g]}],py:[{py:[g]}],ps:[{ps:[g]}],pe:[{pe:[g]}],pt:[{pt:[g]}],pr:[{pr:[g]}],pb:[{pb:[g]}],pl:[{pl:[g]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[N]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[N]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ze,t]}],"min-w":[{"min-w":[ze,t,"min","max","fit"]}],"max-w":[{"max-w":[ze,t,"none","full","min","max","fit","prose",{screen:[Zr]},Zr]}],h:[{h:[ze,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ze,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ze,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ze,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Zr,Jr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",_d]}],"font-family":[{font:[Fs]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ze]}],"line-clamp":[{"line-clamp":["none",Wo,_d]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_r,ze]}],"list-image":[{"list-image":["none",ze]}],"list-style-type":[{list:["none","disc","decimal",ze]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[v]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...W(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",_r,Jr]}],"underline-offset":[{"underline-offset":["auto",_r,ze]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ze]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ze]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[v]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...G(),RP]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",TP]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},EP]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[v]}],"border-style":[{border:[...W(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[v]}],"divide-style":[{divide:W()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...W()]}],"outline-offset":[{"outline-offset":[_r,ze]}],"outline-w":[{outline:[_r,Jr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[v]}],"ring-offset-w":[{"ring-offset":[_r,Jr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Zr,IP]}],"shadow-color":[{shadow:[Fs]}],opacity:[{opacity:[v]}],"mix-blend":[{"mix-blend":[...H(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":H()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Zr,ze]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[m]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[v]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ze]}],duration:[{duration:Q()}],ease:[{ease:["linear","in","out","in-out",ze]}],delay:[{delay:Q()}],animate:[{animate:["none","spin","ping","pulse","bounce",ze]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[Os,ze]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[j]}],"skew-y":[{"skew-y":[j]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ze]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ze]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ze]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[_r,Jr,_d]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},zP=bP(FP);function A(...e){return zP(p0(e))}var $P=Symbol.for("react.lazy"),Oc=wm[" use ".trim().toString()];function UP(e){return typeof e=="object"&&e!==null&&"then"in e}function x0(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===$P&&"_payload"in e&&UP(e._payload)}function y0(e){const t=HP(e),n=u.forwardRef((r,a)=>{let{children:o,...i}=r;x0(o)&&typeof Oc=="function"&&(o=Oc(o._payload));const l=u.Children.toArray(o),c=l.find(qP);if(c){const d=c.props.children,p=l.map(m=>m===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:m);return s.jsx(t,{...i,ref:a,children:u.isValidElement(d)?u.cloneElement(d,void 0,p):null})}return s.jsx(t,{...i,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}var BP=y0("Slot");function HP(e){const t=u.forwardRef((n,r)=>{let{children:a,...o}=n;if(x0(a)&&typeof Oc=="function"&&(a=Oc(a._payload)),u.isValidElement(a)){const i=KP(a),l=VP(o,a.props);return a.type!==u.Fragment&&(l.ref=r?_a(r,i):i),u.cloneElement(a,l)}return u.Children.count(a)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var WP=Symbol("radix.slottable");function qP(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===WP}function VP(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...l)=>{const c=o(...l);return a(...l),c}:a&&(n[r]=a):r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function KP(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Wg=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,qg=p0,b0=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return qg(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:o}=t,i=Object.keys(a).map(d=>{const p=n==null?void 0:n[d],m=o==null?void 0:o[d];if(p===null)return null;const f=Wg(p)||Wg(m);return a[d][f]}),l=n&&Object.entries(n).reduce((d,p)=>{let[m,f]=p;return f===void 0||(d[m]=f),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,p)=>{let{class:m,className:f,...h}=p;return Object.entries(h).every(y=>{let[x,b]=y;return Array.isArray(b)?b.includes({...o,...l}[x]):{...o,...l}[x]===b})?[...d,m,f]:d},[]);return qg(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},Nf=b0("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),fe=u.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...a},o)=>{const i=r?BP:"button";return s.jsx(i,{className:A(Nf({variant:t,size:n,className:e})),ref:o,...a})});fe.displayName="Button";const GP=sP,YP=iP,w0=u.forwardRef(({className:e,...t},n)=>s.jsx(o0,{ref:n,className:A("fixed inset-0 z-50 bg-background/45 backdrop-blur-[3px] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));w0.displayName=o0.displayName;const k0=u.forwardRef(({className:e,...t},n)=>s.jsxs(YP,{children:[s.jsx(w0,{}),s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:s.jsx(s0,{ref:n,className:A("grid w-full max-w-lg origin-center gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",e),...t})})]}));k0.displayName=s0.displayName;const C0=({className:e,...t})=>s.jsx("div",{className:A("flex flex-col space-y-2 text-center sm:text-left",e),...t});C0.displayName="AlertDialogHeader";const S0=({className:e,...t})=>s.jsx("div",{className:A("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});S0.displayName="AlertDialogFooter";const N0=u.forwardRef(({className:e,...t},n)=>s.jsx(c0,{ref:n,className:A("text-lg font-semibold",e),...t}));N0.displayName=c0.displayName;const j0=u.forwardRef(({className:e,...t},n)=>s.jsx(u0,{ref:n,className:A("text-sm text-muted-foreground",e),...t}));j0.displayName=u0.displayName;const A0=u.forwardRef(({className:e,...t},n)=>s.jsx(i0,{ref:n,className:A(Nf(),e),...t}));A0.displayName=i0.displayName;const _0=u.forwardRef(({className:e,...t},n)=>s.jsx(l0,{ref:n,className:A(Nf({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));_0.displayName=l0.displayName;const QP="nanobot.locale",Ti=[{code:"en",label:"English",nativeLabel:"English"},{code:"zh-CN",label:"Chinese (Simplified)",nativeLabel:"简体中文"},{code:"zh-TW",label:"Chinese (Traditional)",nativeLabel:"繁體中文"},{code:"fr",label:"French",nativeLabel:"Français"},{code:"ja",label:"Japanese",nativeLabel:"日本語"},{code:"ko",label:"Korean",nativeLabel:"한국어"},{code:"es",label:"Spanish",nativeLabel:"Español"},{code:"vi",label:"Vietnamese",nativeLabel:"Tiếng Việt"},{code:"id",label:"Indonesian",nativeLabel:"Bahasa Indonesia"}],ii="zh-CN",XP="zh-CN";function P0(e){if(!e)return ii;const t=e.trim();if(!t)return ii;const n=Ti.find(i=>i.code===t);if(n)return n.code;const r=t.toLowerCase();if(r==="zh"||r.startsWith("zh-cn")||r.startsWith("zh-sg"))return"zh-CN";if(r.startsWith("zh-tw")||r.startsWith("zh-hk")||r.startsWith("zh-mo")||r.startsWith("zh-hant"))return"zh-TW";const a=r.split("-")[0],o=Ti.find(i=>i.code.toLowerCase()===a);return(o==null?void 0:o.code)??ii}function JP(){return ii}function ZP(e){if(!(typeof window>"u"))try{window.localStorage.setItem(QP,e)}catch{}}function eT(e){typeof document>"u"||(document.documentElement.lang=e)}function tT(e){return Ti.find(t=>t.code===e)??Ti[0]}const nT={brand:"nanobot",loading:{connecting:"Connecting to nanobot…",boot:"Loading nanobot…"},error:{title:"Couldn't reach nanobot",gatewayHint:"Make sure the gateway is running (`nanobot gateway`) and that this page is open on the same machine."},auth:{title:"Authentication required",hint:"Enter the secret configured as tokenIssueSecret in your gateway config.",placeholder:"Password",submit:"Connect",invalid:"Invalid password. Try again."},account:{section:"Account",logoutHint:"Disconnect this browser from the gateway.",logout:"Sign out"},system:{section:"System",restartHint:"Restart nanobot to apply runtime changes.",restart:"Restart nanobot",restarting:"Restarting...",restartEngine:"Restart engine",restartingEngine:"Restarting engine..."},restart:{completed:"Restart completed in {{seconds}}s."},documentTitle:{base:"nanobot",chat:"{{title}} · nanobot"},meta:{description:"nanobot web UI — chat with your nanobot workspace."}},rT={navigation:"Sidebar navigation",collapse:"Collapse sidebar",newChat:"New chat",searchAria:"Search",searchPlaceholder:"Search",searchResults:"Results",noSearchResults:"No matching chats.",recent:"Recent",settings:"Settings",language:{label:"Language",ariaLabel:"Change language"},apps:"Apps",automations:"Automations",skills:{title:"Skills"}},aT={backToChat:"Back to chat",sidebar:{title:"Settings",ariaLabel:"Settings sections"},nav:{general:"General",byok:"BYOK",overview:"Overview",appearance:"Appearance",models:"Models",providers:"Providers",image:"Image",voice:"Voice",browser:"Web",cliApps:"CLI Apps",mcp:"MCP",runtime:"System",advanced:"Security",apps:"Apps",automations:"Automations",skills:"Skills"},sections:{interface:"Interface",ai:"AI",system:"System",about:"About",status:"Status",localPreferences:"Local preferences",presets:"Presets",imageGeneration:"Image generation",imageDefaults:"Defaults",webSearch:"Web search",webBehavior:"Behavior",cliApps:"CLI apps",mcp:"MCP services",identity:"Identity",webuiSafety:"Web safety",capabilities:"Capabilities",apps:"Apps",nativeHost:"Native host",hostSafety:"App safety",voiceInput:"Voice input"},models:{selectModel:"Select model",addConfiguration:"Add configuration",newConfiguration:"New model configuration",newConfigurationHelp:"Save a provider and model as a one-click option.",configurationName:"Configuration name",configurationNameHelp:"Rename this saved model configuration.",configurationNamePlaceholder:"Fast writing",searchModels:"Search or type model ID",useCustomModel:"Use",loadingModels:"Loading models...",searchCatalog:"Search provider catalog to choose a model.",modelsAvailable:"available",noModelResults:"No matching models.",loadFailed:"Model list unavailable.",unsupportedModelList:"Type a model ID manually.",providerNotConfigured:"Configure this provider before loading models.",autoProviderCustomOnly:"Auto provider mode uses custom model IDs."},rows:{theme:"Theme",language:"Language",provider:"Provider",model:"Model",restart:"Restart nanobot",configPath:"Config path",activePreset:"Active preset",gateway:"Gateway",restartState:"Restart state",pendingChanges:"Pending changes",currentModel:"Current configuration",selectedPreset:"Selected preset",presetModel:"Preset model",density:"Density",activityMode:"Activity detail",codeWrap:"Code wrapping",brandLogos:"Brand logos",maxResults:"Max results",timeout:"Timeout",jinaReader:"Jina reader",imageGeneration:"Image generation",imageProvider:"Image provider",imageProviderStatus:"Provider status",imageProviderBase:"Provider base",imageModel:"Image model",defaultAspectRatio:"Default aspect",defaultImageSize:"Default size",maxImagesPerTurn:"Max images per turn",imageSaveDir:"Save directory",botName:"Bot name",botIcon:"Bot icon",timezone:"Timezone",workspacePath:"Default workspace",localServiceAccess:"Local services",webuiDefaultAccess:"Default access",cliAppsCatalog:"Catalog",cliAppsFilter:"Filter",engine:"Engine",logs:"Logs",diagnostics:"Diagnostics",contextWindow:"Context window",transcription:"Transcription",transcriptionProvider:"Provider",transcriptionProviderStatus:"Provider status",transcriptionModel:"Model",transcriptionLanguage:"Language",voiceLimits:"Limits"},help:{theme:"Switch between light and dark appearance.",language:"Choose the language used by the WebUI.",provider:"Select the provider that should serve new model requests.",model:"Set the default model name used by nanobot.",configPath:"The gateway configuration file currently in use.",currentModel:"Used for new replies.",selectedModelProvider:"Set by the selected model.",selectedModelValue:"Set by the selected model.",selectedPreset:"Named presets are read-only here; edit them in config.json.",presetModel:"Switch to Default to edit model and provider from the WebUI.",density:"Stored only in this browser.",activityMode:"Choose how much agent activity chrome to show by default.",codeWrap:"Keep long code lines readable on smaller screens.",brandLogos:"Show third-party provider and CLI logos in Settings.",maxResults:"Results returned by each web_search call.",timeout:"Seconds before a search provider request times out.",jinaReader:"Use Jina Reader for web_fetch when available.",imageGeneration:"Expose generate_image in chats when a configured image provider is available.",imageProvider:"Choose the registry provider used by generate_image.",imageProviderStatus:"Image generation reuses provider credentials from Providers.",imageModel:"Model name sent to the selected image provider.",defaultAspectRatio:"Used when the prompt does not choose an aspect ratio.",defaultImageSize:"Size hint sent to providers that support it.",maxImagesPerTurn:"Upper bound for one generate_image request.",botName:"Shown wherever nanobot uses a display name.",botIcon:"Short emoji or text shown with the bot name.",timezone:"Used for schedules and time-aware replies.",cliAppsCatalog:"Install only the app-specific CLI adapters nanobot can run locally; native apps stay untouched.",cliAppsFilter:"Search by app, category, or capability.",localServiceAccess:"Allow Full Access shell commands to reach localhost services.",webuiDefaultAccess:"Used by web chats without a project-specific permission.",securityManagedControls:"Web fetches always protect local, private, and metadata services. Core channel safety stays in config.json.",logs:"Open the native engine log folder.",diagnostics:"Export a small runtime report for support.",localServiceAccessNative:"Allow Full Access shell commands to reach services on this Mac.",webuiDefaultAccessNative:"Used by native chats without a project-specific permission.",contextWindow:"Choose the default context budget for this model configuration.",transcription:"Transcribe microphone input before sending it. Chat channel voice messages use the same settings.",transcriptionProvider:"Uses the matching provider credentials from Providers.",transcriptionProviderStatus:"API keys stay under providers, not in transcription settings.",transcriptionModel:"Leave as the resolved default unless your provider needs a custom model id.",transcriptionLanguage:"Optional ISO-639 hint such as en, zh, ja, or ko."},timezone:{select:"Select timezone",search:"Search timezone",empty:"No matching timezones."},cliApps:{allCategories:"All categories",availableCount:"{{count}} apps",installedCount:"{{count}} CLIs installed",summary:"{{installed}} of {{total}} CLIs installed",filterAll:"All",filterInstalled:"Installed CLIs",filterNotInstalled:"Not installed",searchPlaceholder:"Search CLIs",loading:"Loading CLI Apps...",empty:"No CLI Apps match this filter.",statusInstalled:"CLI installed",statusMissing:"Missing",statusAvailable:"Available",statusUnsupported:"Unsupported",statusNotInstalled:"CLI not installed",requires:"Requires",test:"Test CLI",update:"Update CLI",uninstall:"Uninstall CLI",install:"Install CLI",readyTitle:"@{{name}} is ready",readyStatus:"Ready",readyTry:"Try @{{name}}",readyCopied:"Copied",readyPrompt:"Use @{{name}} to inspect what this CLI can do.",openChat:"Open chat",unsupported:"Unsupported",unavailable:"Unavailable",noDescription:"No description available."},about:{version:"Version",checking:"Checking...",checkForUpdates:"Check for updates",upToDate:"You're up to date",updateAvailable:"Update available v{{version}}"},mcp:{allCategories:"All categories",summary:"{{installed}} of {{total}} presets enabled",filterAll:"All",filterInstalled:"Enabled",filterNotInstalled:"Not enabled",searchPlaceholder:"Search MCP presets",moreOptions:"More MCP options",moreOptionsSubtitle:"Add a custom server or import mcp.json.",customTitle:"Custom MCP",customSubtitle:"Add any stdio, HTTP, or SSE MCP server.",customAction:"Custom",importAction:"Import",serverName:"Server name",serverUrl:"URL",transport:"Transport",command:"Command",args:"Args JSON",headers:"Headers JSON",env:"Env JSON",timeout:"Tool timeout",advancedOptions:"Advanced options",hideAdvanced:"Hide advanced",saveCustom:"Save MCP",configImport:"Import mcp.json",importConfig:"Import",restartRequired:"Restart nanobot to connect updated MCP tools.",toolsFound:"{{count}} tools",loading:"Loading MCP presets...",empty:"No MCP presets match this filter.",openDocs:"Open docs",test:"Test",remove:"Remove",enable:"Enable",enabled:"Enabled",setup:"Connect",configure:"Connect",connectTitle:"Connect {{name}}",connectHint:"Add the key from your account settings.",saveAndEnable:"Save and enable",updateSetup:"Update setup",configured:"configured",keepExisting:"Leave blank to keep existing",statusConfigured:"Configured",statusMissingCredentials:"Needs key",statusMissingDependency:"Needs dependency",statusComingSoon:"Coming soon",statusNotInstalled:"Not enabled",toolScope:"Tools",allTools:"All",noTools:"None",testForTools:"Run Test to inspect and choose individual tools."},values:{light:"Light",dark:"Dark",notAvailable:"Not available",enabled:"Enabled",disabled:"Disabled",restartPending:"Restart pending",ready:"Ready",privateEngine:"Private engine",unixSocket:"Unix socket",defaultWorkspace:"Default workspace",comfortable:"Comfortable",compact:"Compact",auto:"Auto",expanded:"Expanded",on:"On",off:"Off",defaultPermission:"Default Permission",fullAccess:"Full Access",configured:"Configured",notConfigured:"Not configured",pending:"Pending",restartingEngine:"Restarting"},status:{loading:"Loading settings...",loadError:"Could not load settings",unsaved:"Unsaved changes.",upToDate:"Up to date.",savedRestart:"Saved. Restart nanobot to apply.",restartAfterSaving:"Save changes, then restart when ready.",savedRestartApply:"Saved. Restart when ready.",imageProviderRestart:"Image provider changes saved. Restart when ready.",hostRestartAfterSaving:"Save changes and nanobot will restart its engine.",hostRestartPending:"Saved. Restarting engine when ready.",hostApiUnavailable:"Host actions are only available inside the native app.",logsOpened:"Opened logs folder.",logsOpenFailed:"Could not open logs folder.",diagnosticsExported:"Diagnostics exported to {{path}}.",diagnosticsExportFailed:"Could not export diagnostics."},actions:{save:"Save",saving:"Saving",edit:"Edit",cancel:"Cancel",open:"Open",export:"Export",opening:"Opening...",exporting:"Exporting..."},byok:{description:"Bring your own provider keys. Nanobot reads these values from the current config and only configured providers can be selected in General.",configured:"Configured",notConfigured:"Not configured",configuredSection:"Configured",notConfiguredSection:"Not configured",showMore:"Show {{count}} more",showLess:"Show fewer",apiKey:"API key",apiBase:"API base",apiKeyPlaceholder:"Enter API key",apiKeyConfiguredPlaceholder:"Leave blank to keep the current key",configuredKeyHint:"Configured key",apiBasePlaceholder:"Use provider default",apiKeyRequired:"API key is required to configure this provider.",showApiKey:"Show API key",hideApiKey:"Hide API key",noConfiguredProviders:"No configured providers",configureFirst:"Configure a provider in BYOK first.",openByok:"Open BYOK",tabs:{ariaLabel:"BYOK credential type",llm:"LLM",webSearch:"Web Search"},webSearch:{provider:"Search provider",providerHelp:"Choose the backend used by the web search tool.",selectProvider:"Select provider",credentials:"Credentials",noCredentialRequired:"No key required",noCredentialHelp:"DuckDuckGo works without a saved API key.",apiKeyHelp:"Stored in config and masked after saving.",baseUrl:"Base URL",baseUrlHelp:"SearXNG needs the URL of your own instance.",baseUrlPlaceholder:"https://search.example.com",apiKeyRequired:"API key is required for this search provider.",baseUrlRequired:"Base URL is required for SearXNG.",missingCredential:"Add the required credential before saving.",saveHint:"Changes apply to new web search requests."}},overview:{model:"Current model",providers:"Providers",configuredCount:"{{count}} configured",totalProviders:"{{count}} available",webSearch:"Web search",imageGeneration:"Image generation",voiceInput:"Voice input",workspace:"Workspace"},usage:{title:"Token activity",shortTitle:"Token Usage",subtitle:"Provider-reported usage over the last 12 months.",empty:"Token activity will appear after new model replies.",totalTokens:"Total tokens",peakTokens:"Peak tokens",thirtyDayTokens:"30-day tokens",currentStreak:"Current streak",longestStreak:"Longest streak",daysValue:"{{count}}d",last30:"30 days",activeDays:"Active days",requests:"Requests",estimated:"estimated",includesEstimates:"includes estimates",cellTitle:"{{date}}: {{tokens}} tokens, {{requests}} requests",sources:{user:"Chat",api:"API",cron:"Automations",dream:"Memory",system:"System"}},providers:{searchPlaceholder:"Search providers",noMatches:"No providers match this search.",saveProvider:"Save provider"},legal:{thirdPartyBrands:"Product names, logos, and brands are property of their respective owners. Use is for identification only and does not imply endorsement."},image:{selectProvider:"Select provider",selectAspect:"Select aspect",selectSize:"Select size",configureProvider:"Configure provider",missingCredential:"Configure this provider before enabling image generation."},apps:{description:"Add app CLIs and MCP services nanobot can use from chat.",cliLabel:"CLI",mcpLabel:"MCP",filterAll:"All",filterCli:"CLI apps",filterMcp:"MCP services",enabledSummary:"{{count}} enabled",caption:"{{cli}} CLI · {{mcp}} MCP",searchPlaceholder:"Search Apps",featured:"Featured",loading:"Loading Apps...",empty:"No apps match this filter."},automations:{filters:{all:"All",active:"Active",paused:"Paused",failed:"Needs attention",system:"System"},sort:{next:"Next run",last:"Last run",updated:"Updated",name:"Name"},search:"Search task, message, linked chat, or schedule",queue:"Queue",loading:"Loading automations...",noMatches:"No automations match this view.",empty:"No automations yet.",emptyHint:"Create one from where it should run so nanobot keeps the right context.",oneShot:"One-time",systemTask:"System-managed automation",labels:{schedule:"Schedule",next:"Next",origin:"Linked chat",created:"Created",updated:"Updated"},runNow:"Run now",pause:"Pause",resume:"Resume",edit:"Edit",delete:"Delete",protected:"Protected",editTitle:"Edit automation",save:"Save",deleteTitle:"Delete automation",deleteDescription:"This removes {{name}} from the cron store. Past chat messages stay in the session.",cancel:"Cancel",status:{system:"System",running:"Running now",paused:"Paused",failed:"Failed",completed:"Completed",noSchedule:"No schedule",active:"Active"},origin:{system:"System",unknown:"No linked chat"},channels:{api:"API",cli:"CLI",dingtalk:"DingTalk",discord:"Discord",email:"Email",feishu:"Feishu",matrix:"Matrix",msteams:"Microsoft Teams",qq:"QQ",slack:"Slack",telegram:"Telegram",wechat:"WeChat",wecom:"WeCom",weixin:"WeChat",whatsapp:"WhatsApp"},schedule:{at:"At {{time}}",every:"Every {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",withTz:"{{summary}} · {{tz}}",dailyAt:"Daily at {{time}}",weekdaysAt:"Weekdays at {{time}}",hourlyAt:"Hourly at :{{minute}}",hourlyWindow:"Hourly {{start}}-{{end}} at :{{minute}}",custom:"Custom schedule"},next:{paused:"Paused",pending:"Running now",none:"No next run"},message:{showMore:"Show full message",showLess:"Show less"},fields:{name:"Name",message:"Message",scheduleType:"Schedule type",every:"Every",unit:"Unit",cronExpression:"Cron expression",timezone:"Timezone",runAt:"Run at"},scheduleTypes:{every:"Interval",cron:"Cron",at:"Once"},everyUnits:{second:"Seconds",minute:"Minutes",hour:"Hours",day:"Days"},validation:{nameRequired:"Name is required.",messageRequired:"Message is required.",intervalRequired:"Interval must be a positive number.",cronRequired:"Cron expression is required.",timeRequired:"Run time is required.",futureRequired:"Run time must be in the future."}},oauth:{authentication:"OAuth authentication",signIn:"Sign in",signingIn:"Signing in...",signInAgain:"Sign in again",signOut:"Sign out",signedInAs:"Signed in as {{account}}",signInHelp:"Sign in from this device; no API key is stored in config.",signInRequired:"Sign in required",signInBeforeSaving:"Sign in before saving this OAuth provider as the active model provider.",signedIn:"Signed in",notSignedIn:"Not signed in"},skills:{description:"Review the instruction skills this agent can load during a conversation.",caption:"{{available}} available · {{total}} total",featured:"Agent skills",empty:"No skills are available.",sourceWorkspace:"Custom",sourceBuiltin:"Built-in",statusAvailable:"Available",statusUnavailable:"Unavailable",unavailableReason:"Missing: {{reason}}",openDetails:"Open details for {{name}}",loadingDetail:"Loading skill details...",loadFailed:"Could not load skill details.",descriptionTitle:"Description",source:"Source",status:"Status",requirements:"Requirements",noRequirements:"No explicit requirements.",commands:"Commands",environment:"Environment variables",missingCommands:"Missing CLI",missingEnvironment:"Missing ENV",unavailableReasonLabel:"Unavailable reason",rawInstructions:"Raw SKILL.md",rawInstructionsEmpty:"No raw instructions.",detailDescription:"Details for {{name}}."},voice:{selectProvider:"Select provider",configureProvider:"Configure provider",languageAuto:"Auto"}},oT={fallbackTitle:"Chat {{id}}",forkTitle:"Fork: {{title}}",loading:"Loading…",noSessions:"No sessions yet.",showMore:"Show {{count}} more",collapsed:"{{count}} hidden chats",showLess:"Show less",actions:"Chat actions for {{title}}",newInProject:"Start a new chat in {{project}}",activity:{running:"Agent running",complete:"Agent finished",updated:"New activity"},pin:"Pin",unpin:"Unpin",rename:"Rename",renameTitle:"Rename chat",renameDescription:"Choose a local sidebar name for this chat.",renamePlaceholder:"Chat name",renameProjectTitle:"Rename project",renameProjectDescription:"Choose a local sidebar name for this project.",renameProjectPlaceholder:"Project name",renameSave:"Save",archive:"Archive",unarchive:"Unarchive",showArchived:"Show archived",hideArchived:"Hide archived",delete:"Delete",newChat:"New chat",groups:{pinned:"Pinned",all:"Chats",projects:"Projects",today:"Today",yesterday:"Yesterday",earlier:"Earlier",archived:"Archived"}},sT={title:"Delete this chat?",description:"This action cannot be undone.",cancel:"Cancel",confirm:"Delete",automationsDescription:"This chat has scheduled automations. Deleting it will also delete them.",moreAutomations:"+ {{count}} more",confirmWithAutomations:"Delete",schedule:{at:"{{time}}",every:"Every {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"Custom schedule"},next:{label:"Next: {{time}}",disabled:"Paused",none:"No next run"}},iT={idle:"Idle",connecting:"Connecting…",open:"Connected",reconnecting:"Reconnecting…",closed:"Disconnected",error:"Connection error"},lT={loadingConversation:"Loading conversation…",empty:{greetings:{workOn:"What should we work on?",start:"Where should we start?",build:"What are we building today?",tackle:"What should we tackle together?"},quickActions:{plan:{title:"Create a project plan",prompt:"Create a concise project plan for what I should build next."},analyze:{title:"Analyze this data",prompt:"Help me analyze this data and call out the most important patterns."},brainstorm:{title:"Brainstorm ideas",prompt:"Brainstorm a few practical ideas and tradeoffs for this problem."},code:{title:"Write code",prompt:"Help me write the code for this task, starting with the smallest useful change."},summarize:{title:"Summarize this document",prompt:"Summarize this document and list the key takeaways."},more:{title:"More",prompt:"Show me a few useful ways you can help in this workspace."}},imageQuickActions:{icon:{title:"Design an app icon",prompt:"Generate a clean 1:1 app icon for nanobot: friendly robot, simple vector style, soft blue and white palette, no text."},sticker:{title:"Make a sticker",prompt:"Generate a cute sticker-style image of a tiny robot assistant, transparent-looking background, expressive and playful."},poster:{title:"Create a poster",prompt:"Generate a polished poster concept for a personal AI assistant, modern composition, strong visual hierarchy, suitable for a landing page."},product:{title:"Product mockup",prompt:"Generate a clean product mockup image for a conversational AI web app, minimal interface, premium lighting, realistic device frame."},portrait:{title:"Stylized portrait",prompt:"Generate a stylized portrait of a friendly AI companion, soft lighting, detailed but approachable, modern illustration style."},edit:{title:"Edit an image",prompt:"Help me edit an image. Ask me to upload or reference the image first, then generate the edited result."}}},header:{toggleSidebar:"Toggle sidebar",newChat:"Start a new chat",toggleTheme:"Toggle theme from header",settings:"Open settings",sessionInfo:"Session details"},sessionInfo:{title:"Session",untitled:"Untitled chat",automations:"Automations",count:"{{count}}",loading:"Loading automations...",loadFailed:"Could not load automations.",empty:"No automations in this session yet.",disabled:"Off",schedule:{at:"{{time}}",every:"Every {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"Custom schedule"},next:{label:"{{time}}",pending:"Runs shortly",disabled:"Paused",none:"No next run"}},composer:{placeholderThread:"Type your message…",placeholderHero:"Ask anything...",placeholderOpening:"Opening a new chat…",placeholderStreaming:"Model is responding…",inputAria:"Message input",sendHint:"Enter to send · Shift+Enter for newline",runRuntimeTitle:"Running · {{elapsed}}",goalStateStrip:"Goal · {{label}}",goalStateFallback:"Goal",goalStateExpandAria:"Show full goal",goalStateSheetTitle:"Goal",goalStateCloseAria:"Close goal",send:"Send message",stop:"Stop response",modelNotConfigured:"Model not configured",configureModel:"Configure model",queued:{label:"Queued guidance",guide:"Guide",delete:"Delete guidance",edit:"Edit guidance",drag:"Drag to reorder"},attachImage:"Attach image",imageMode:{label:"Image Generation",toggle:"Toggle image generation mode",placeholder:"Describe or edit an image…",aspectAria:"Image aspect ratio",aspectLabel:"Image aspect",aspect:{auto:"Auto","1_1":"Square 1:1","3_4":"Portrait 3:4","9_16":"Story 9:16","4_3":"Landscape 4:3","16_9":"Wide 16:9"}},tools:{search:"Search",reason:"Reason",deepResearch:"Deep research",voice:"Voice input"},voice:{hint:"Click to dictate or hold",stop:"Stop recording",transcribing:"Transcribing...",recordingStatus:"Recording {{time}}"},voiceErrors:{unsupported:"Voice input is not supported in this browser.",permission:"Microphone permission is required.",notConfigured:"Configure a transcription provider first.",tooLong:"Recording is too long.",tooShort:"Hold a little longer to record voice.",noInput:"No microphone input detected.",failed:"Could not transcribe audio."},slash:{ariaLabel:"Slash commands",label:"commands",navigateHint:"↑↓ Navigate",selectHint:"Enter/Tab Select",closeHint:"Esc Close",badges:{current:"Current",recent:"Recent"},details:{goalActive:"Goal is running",goalReady:"Start a sustained objective",history:"Show recent messages",stopRunning:"Running now"},commands:{new:{title:"New chat",description:"Stop the current task and start a fresh conversation."},stop:{title:"Stop current task",description:"Cancel the active agent turn for this chat."},restart:{title:"Restart nanobot",description:"Restart the bot process in place."},status:{title:"Show status",description:"Display runtime, provider, and channel status."},model:{title:"Model",description:"Show or switch the active model preset."},history:{title:"Show conversation history",description:"Print the last N persisted conversation messages."},dream:{title:"Run Dream",description:"Manually trigger memory consolidation."},dream_log:{title:"Show Dream log",description:"Show what the last Dream consolidation changed."},dream_restore:{title:"Restore memory",description:"Revert memory to a previous Dream snapshot."},goal:{title:"Long-running goal",description:"Tell the agent to treat this as a sustained multi-step goal."},help:{title:"Show help",description:"List available slash commands."},pairing:{title:"Pairing",description:"Manage pairing requests."}}},mentions:{ariaLabel:"Apps",label:"Apps",cliGroup:"CLI apps",mcpGroup:"MCP services",cliBadge:"CLI",mcpBadge:"MCP",cliDescription:"Use @{{name}} as a local CLI app",mcpDescription:"Use @{{name}} as an MCP server"},encoding:"Encoding…",remove:"Remove attachment",normalizedSizeHint:"{{orig}} → {{current}} (auto)",imageRejected:{unsupported_type:"Unsupported file type",too_many_images:"Max {{max}} images per message",magic_mismatch:"File doesn't look like a real image",decode_failed:"Couldn't decode this image",too_large:"Image is too large — try a smaller one",io:"Couldn't read this file"},workspace:{accessAria:"Workspace access mode",projectAria:"Choose project",projectPlaceholder:"Select project",default:"Default Permission",full:"Full Access"}},scrollToBottom:"Scroll to bottom",loadEarlier:"Load earlier messages",forkedFromHistory:"Forked from history",promptNavigator:{open:"Open prompt navigator",title:"Prompts",search:"Search prompts",noResults:"No matching prompts.",jumpTo:"Jump to prompt: {{label}}"}},cT={streaming:"streaming",assistantTyping:"Assistant is typing",toolSingle:"Using a tool",toolMany:"Used {{count}} tools",toolSummary:"{{count}} tool",toolSummaryMany:"{{count}} tools",reasoningTools:"Reasoning · {{count}} tools",reasoningToolsSingular:"Reasoning · 1 tool",reasoning:"Thinking",reasoningStreaming:"Thinking…",reasoningSummary:"Reasoning",agentActivitySummary:"{{reasoning}} steps · {{tools}} tool calls",agentActivityToolsOnly:"{{tools}} tool calls",agentActivityLiveSummary:"Working… · {{reasoning}} steps · {{tools}} tool calls",agentActivityLiveToolsOnly:"Working… · {{tools}} tool calls",activityThinkingFor:"Thinking for {{duration}}",activityThought:"Thought",activityThoughtFor:"Thought for {{duration}}",activityWorkingFor:"Working for {{duration}}",activityWorked:"Worked",activityWorkedFor:"Worked for {{duration}}",cliActivityRunningOne:"Using @{{name}}",cliActivityRanOne:"Used @{{name}}",cliActivityFailedOne:"Failed @{{name}}",cliActivityRunningMany:"Using {{count}} CLI apps",cliActivityRanMany:"Used {{count}} CLI apps",cliActivityFailedMany:"{{count}} CLI apps failed",cliRunRunning:"Using",cliRunRan:"Used",cliRunFailed:"Failed",imageAttachment:"Image attachment",automationSourceFallback:"Automation",automationTriggered:"Triggered automatically",forkFromHere:"Fork",copyReply:"Copy",copiedReply:"Copied",turnLatencyTitle:"Response time (end-to-end)"},uT={title:"Image preview",open:"View image",prev:"Previous image",next:"Next image",close:"Close image preview"},dT={aria:"File preview",close:"Close file preview",loading:"Loading preview...",failed:"Could not preview this file.",routeMissing:"File preview needs the latest gateway. Restart nanobot gateway and try again.",resize:"Resize file preview",truncated:"Preview is truncated because this file is large."},pT={fallbackLanguage:"code",copyAria:"Copy code",copy:"Copy",copied:"Copied"},mT={dismiss:"Dismiss"},fT={messageTooBig:{title:"Message too large",body:"The server rejected your last message because it exceeded the size limit. Remove some images or try smaller files, then send again."},workspaceScopeRejected:{title:"Workspace was not changed",body:"Nanobot kept the previous workspace because the requested project or access mode was rejected by the gateway."}},hT={dialog:{defaultProject:"Default workspace",manual:"Paste path",manualPlaceholder:"/Users/name/project",usePath:"Use Path",absolutePathRequired:"Enter an absolute folder path on this machine."}},gT={app:nT,sidebar:rT,settings:aT,chat:oT,deleteConfirm:sT,connection:iT,thread:lT,message:cT,lightbox:uT,filePreview:dT,code:pT,common:mT,errors:fT,workspace:hT},vT={brand:"nanobot",loading:{connecting:"正在连接 nanobot…",boot:"正在加载 nanobot…"},error:{title:"无法连接到 nanobot",gatewayHint:"请确认 gateway 已启动(`nanobot gateway`),并且当前页面与 gateway 运行在同一台机器上。"},auth:{title:"需要验证",hint:"请输入 gateway 配置中的 tokenIssueSecret。",placeholder:"密码",submit:"连接",invalid:"密码无效,请重试。"},account:{section:"账户",logoutHint:"断开此浏览器与 gateway 的连接。",logout:"退出登录"},system:{section:"系统",restartHint:"重启 nanobot 以应用运行时更改。",restart:"重启 nanobot",restarting:"正在重启...",restartEngine:"重启引擎",restartingEngine:"正在重启引擎..."},restart:{completed:"重启已完成,用时 {{seconds}} 秒。"},documentTitle:{base:"nanobot",chat:"{{title}} · nanobot"},meta:{description:"nanobot Web UI —— 与你的 nanobot 工作区对话。"}},xT={navigation:"侧边栏导航",collapse:"收起侧边栏",newChat:"新建对话",searchAria:"搜索",searchPlaceholder:"搜索",searchResults:"搜索结果",noSearchResults:"没有匹配的会话。",recent:"最近对话",settings:"设置",language:{label:"语言",ariaLabel:"切换语言"},apps:"应用",automations:"自动任务",skills:{title:"技能"}},yT={backToChat:"返回聊天",sidebar:{title:"设置",ariaLabel:"设置分区"},nav:{general:"通用",byok:"BYOK",overview:"概览",appearance:"外观",models:"模型",providers:"提供商",image:"图片",voice:"语音",browser:"网页",cliApps:"CLI 应用",mcp:"MCP",runtime:"系统",advanced:"安全",apps:"应用",automations:"自动任务",skills:"技能"},sections:{interface:"界面",ai:"AI",system:"系统",about:"关于",status:"状态",localPreferences:"本地偏好",presets:"预设",imageGeneration:"图片生成",imageDefaults:"默认值",webSearch:"网页搜索",webBehavior:"行为",cliApps:"CLI 应用",mcp:"MCP 服务",identity:"身份",webuiSafety:"WebUI 安全",capabilities:"能力",apps:"应用",nativeHost:"原生宿主",hostSafety:"应用安全",voiceInput:"语音识别"},models:{selectModel:"选择模型",addConfiguration:"添加配置",newConfiguration:"新建模型配置",newConfigurationHelp:"把提供商和模型保存成一键选项。",configurationName:"配置名称",configurationNameHelp:"重命名这个已保存的模型配置。",configurationNamePlaceholder:"快速写作",searchModels:"搜索或输入模型 ID",useCustomModel:"使用",loadingModels:"正在加载模型...",searchCatalog:"搜索提供商目录来选择模型。",modelsAvailable:"可用",noModelResults:"没有匹配的模型。",loadFailed:"模型列表不可用。",unsupportedModelList:"手动输入模型 ID。",providerNotConfigured:"加载模型前请先配置此提供商。",autoProviderCustomOnly:"自动提供商模式使用自定义模型 ID。"},rows:{theme:"主题",language:"语言",provider:"提供商",model:"模型",restart:"重启 nanobot",configPath:"配置路径",activePreset:"当前预设",gateway:"网关",restartState:"重启状态",pendingChanges:"待应用更改",currentModel:"当前配置",selectedPreset:"选中的预设",presetModel:"预设模型",density:"密度",activityMode:"活动详情",codeWrap:"代码换行",brandLogos:"品牌 Logo",maxResults:"最大结果数",timeout:"超时",jinaReader:"Jina 阅读器",imageGeneration:"图片生成",imageProvider:"图片提供商",imageProviderStatus:"提供商状态",imageProviderBase:"提供商地址",imageModel:"图片模型",defaultAspectRatio:"默认比例",defaultImageSize:"默认尺寸",maxImagesPerTurn:"每轮最大图片数",imageSaveDir:"保存目录",botName:"Bot 名称",botIcon:"Bot 图标",timezone:"时区",workspacePath:"默认工作区",localServiceAccess:"本机服务",webuiDefaultAccess:"默认权限",cliAppsCatalog:"目录",cliAppsFilter:"筛选",engine:"引擎",logs:"日志",diagnostics:"诊断",contextWindow:"上下文窗口",transcription:"语音转写",transcriptionProvider:"提供商",transcriptionProviderStatus:"提供商状态",transcriptionModel:"模型",transcriptionLanguage:"语言",voiceLimits:"限制"},help:{theme:"在浅色和深色外观之间切换。",language:"选择 WebUI 使用的语言。",provider:"选择处理新模型请求的提供商。",model:"设置 nanobot 默认使用的模型名称。",configPath:"当前网关正在使用的配置文件。",currentModel:"用于新的回复。",selectedModelProvider:"由选中的模型决定。",selectedModelValue:"由选中的模型决定。",selectedPreset:"命名预设在这里只读;请在 config.json 中编辑。",presetModel:"切回 Default 后可在 WebUI 中编辑模型和提供商。",density:"只保存在此浏览器中。",activityMode:"选择默认显示多少 agent 活动细节。",codeWrap:"让长代码行在小屏幕上也易读。",brandLogos:"在设置中显示第三方提供商和 CLI 图标。",maxResults:"每次 web_search 调用返回的结果数。",timeout:"搜索提供商请求超时前的秒数。",jinaReader:"可用时为 web_fetch 使用 Jina Reader。",imageGeneration:"配置图片提供商后,在聊天中开放 generate_image。",imageProvider:"选择 generate_image 使用的注册提供商。",imageProviderStatus:"图片生成会复用「提供商」里的凭据。",imageModel:"发送给所选图片提供商的模型名称。",defaultAspectRatio:"当提示词没有指定比例时使用。",defaultImageSize:"发送给支持此选项的提供商的尺寸提示。",maxImagesPerTurn:"单次 generate_image 请求可生成的图片上限。",botName:"显示在 nanobot 使用展示名称的地方。",botIcon:"显示在 Bot 名称旁的短 emoji 或文字。",timezone:"用于日程和需要时间感知的回复。",cliAppsCatalog:"只安装 nanobot 可本地运行的应用 CLI 适配器;不会改动原生应用。",cliAppsFilter:"按应用、类别或能力搜索。",localServiceAccess:"允许完全访问权限下的 shell 命令访问 localhost 服务。",webuiDefaultAccess:"用于没有单独项目权限的 Web 聊天。",securityManagedControls:"网页抓取始终保护本机、内网和元数据服务。核心渠道安全仍由 config.json 管理。",logs:"打开原生引擎日志文件夹。",diagnostics:"导出一份用于支持排查的小型运行报告。",localServiceAccessNative:"允许完全访问权限下的 shell 命令访问这台 Mac 上的服务。",webuiDefaultAccessNative:"用于没有单独项目权限的原生聊天。",contextWindow:"选择此模型配置的默认上下文预算。",transcription:"发送前先把麦克风输入转写到输入框。聊天渠道里的语音消息也使用同一套设置。",transcriptionProvider:"使用「提供商」中对应提供商的凭据。",transcriptionProviderStatus:"API Key 仍保存在 providers 里,不写进 transcription 设置。",transcriptionModel:"除非提供商需要自定义模型 ID,否则保持解析后的默认值即可。",transcriptionLanguage:"可选 ISO-639 语言提示,例如 en、zh、ja 或 ko。"},timezone:{select:"选择时区",search:"搜索时区",empty:"没有匹配的时区。"},cliApps:{allCategories:"全部分类",availableCount:"{{count}} 个应用",installedCount:"已安装 {{count}} 个 CLI",summary:"CLI 已安装 {{installed}} / {{total}}",filterAll:"全部",filterInstalled:"已装 CLI",filterNotInstalled:"未装 CLI",searchPlaceholder:"搜索 CLI",loading:"正在加载 CLI 应用...",empty:"没有匹配的 CLI 应用。",statusInstalled:"CLI 已安装",statusMissing:"缺失",statusAvailable:"可用",statusUnsupported:"暂不支持",statusNotInstalled:"CLI 未安装",requires:"依赖",test:"测试 CLI",update:"更新 CLI",uninstall:"卸载 CLI",install:"安装 CLI",readyTitle:"@{{name}} 已就绪",readyStatus:"就绪",readyTry:"试试 @{{name}}",readyCopied:"已复制",readyPrompt:"用 @{{name}} 看看这个 CLI 能做什么。",openChat:"回到对话",unsupported:"暂不支持",unavailable:"不可用",noDescription:"暂无描述。"},about:{version:"版本",checking:"正在检查...",checkForUpdates:"检查更新",upToDate:"已是最新版本",updateAvailable:"有可用更新 v{{version}}"},mcp:{allCategories:"全部分类",summary:"已启用 {{installed}} / {{total}} 个预设",filterAll:"全部",filterInstalled:"已启用",filterNotInstalled:"未启用",searchPlaceholder:"搜索 MCP 预设",moreOptions:"更多 MCP 选项",moreOptionsSubtitle:"添加自定义服务,或导入 mcp.json。",customTitle:"自定义 MCP",customSubtitle:"添加任意 stdio、HTTP 或 SSE MCP 服务。",customAction:"自定义",importAction:"导入",serverName:"服务名",serverUrl:"URL",transport:"传输方式",command:"命令",args:"Args JSON",headers:"Headers JSON",env:"Env JSON",timeout:"工具超时",advancedOptions:"高级选项",hideAdvanced:"收起高级",saveCustom:"保存 MCP",configImport:"导入 mcp.json",importConfig:"导入",restartRequired:"重启 nanobot 以连接更新后的 MCP 工具。",toolsFound:"{{count}} 个工具",loading:"正在加载 MCP 预设...",empty:"没有匹配的 MCP 预设。",openDocs:"打开文档",test:"测试",remove:"移除",enable:"启用",enabled:"已启用",setup:"连接",configure:"连接",connectTitle:"连接 {{name}}",connectHint:"填入你账户里的 key。",saveAndEnable:"保存并启用",updateSetup:"更新配置",configured:"已配置",keepExisting:"留空则保留当前值",statusConfigured:"已配置",statusMissingCredentials:"需要 key",statusMissingDependency:"缺少依赖",statusComingSoon:"暂不支持",statusNotInstalled:"未启用",toolScope:"工具",allTools:"全部",noTools:"不暴露",testForTools:"运行测试后,可以查看并选择单个工具。"},values:{light:"浅色",dark:"深色",notAvailable:"不可用",enabled:"已启用",disabled:"已禁用",restartPending:"等待重启",ready:"就绪",privateEngine:"私有引擎",unixSocket:"Unix socket",defaultWorkspace:"默认工作区",comfortable:"舒适",compact:"紧凑",auto:"自动",expanded:"展开",on:"开启",off:"关闭",defaultPermission:"默认权限",fullAccess:"完全访问权限",configured:"已配置",notConfigured:"未配置",pending:"等待中",restartingEngine:"正在重启"},status:{loading:"正在加载设置...",loadError:"无法加载设置",unsaved:"有未保存的更改。",upToDate:"已是最新。",savedRestart:"已保存。重启 nanobot 后生效。",restartAfterSaving:"保存更改后,在合适时重启。",savedRestartApply:"已保存。准备好后重启。",imageProviderRestart:"图片提供商更改已保存。准备好后重启。",hostRestartAfterSaving:"保存后 nanobot 会重启引擎。",hostRestartPending:"已保存。准备好后会重启引擎。",hostApiUnavailable:"宿主操作仅在原生应用中可用。",logsOpened:"已打开日志文件夹。",logsOpenFailed:"无法打开日志文件夹。",diagnosticsExported:"诊断已导出到 {{path}}。",diagnosticsExportFailed:"无法导出诊断。"},actions:{save:"保存",saving:"正在保存",edit:"编辑",cancel:"取消",open:"打开",export:"导出",opening:"正在打开...",exporting:"正在导出..."},byok:{description:"自带服务商密钥。Nanobot 会从当前 config 读取这些值,只有已配置的服务商才能在通用设置里选择。",configured:"已配置",notConfigured:"未配置",configuredSection:"已配置",notConfiguredSection:"未配置",showMore:"再显示 {{count}} 个",showLess:"收起",apiKey:"API key",apiBase:"API base",apiKeyPlaceholder:"输入 API key",apiKeyConfiguredPlaceholder:"留空则保留当前 key",configuredKeyHint:"已配置的 key",apiBasePlaceholder:"使用服务商默认地址",apiKeyRequired:"需要 API key 才能配置此服务商。",showApiKey:"显示 API key",hideApiKey:"隐藏 API key",noConfiguredProviders:"没有已配置的服务商",configureFirst:"请先在 BYOK 里配置服务商。",openByok:"打开 BYOK",tabs:{ariaLabel:"BYOK 凭证类型",llm:"LLM",webSearch:"网页搜索"},webSearch:{provider:"搜索服务商",providerHelp:"选择网页搜索工具使用的后端。",selectProvider:"选择服务商",credentials:"凭证",noCredentialRequired:"无需 key",noCredentialHelp:"DuckDuckGo 不需要保存 API key。",apiKeyHelp:"保存到 config 后只显示掩码提示。",baseUrl:"Base URL",baseUrlHelp:"SearXNG 需要你自己的实例地址。",baseUrlPlaceholder:"https://search.example.com",apiKeyRequired:"这个搜索服务商需要 API key。",baseUrlRequired:"SearXNG 需要 Base URL。",missingCredential:"填写所需凭证后才能保存。",saveHint:"改动会应用到新的网页搜索请求。"}},overview:{model:"当前模型",providers:"提供商",configuredCount:"已配置 {{count}} 个",totalProviders:"共 {{count}} 个可用",webSearch:"网页搜索",imageGeneration:"图片生成",voiceInput:"语音识别",workspace:"工作区"},usage:{title:"Token 活动",shortTitle:"Token Usage",subtitle:"最近 12 个月由提供商上报的 token 用量。",empty:"新的模型回复产生后,这里会显示 token 活动。",totalTokens:"累计 Token 数",peakTokens:"峰值 Token 数",thirtyDayTokens:"30 天 Token 数",currentStreak:"当前连续天数",longestStreak:"最长连续天数",daysValue:"{{count}} 天",last30:"30 天",activeDays:"活跃天数",requests:"请求数",estimated:"估算",includesEstimates:"包含估算",cellTitle:"{{date}}:{{tokens}} tokens,{{requests}} 次请求",sources:{user:"对话",api:"API",cron:"自动任务",dream:"记忆整理",system:"系统"}},providers:{searchPlaceholder:"搜索提供商",noMatches:"没有匹配的提供商。",saveProvider:"保存提供商"},legal:{thirdPartyBrands:"产品名称、Logo 和品牌归各自所有者所有;此处仅用于识别,不代表背书或合作。"},image:{selectProvider:"选择提供商",selectAspect:"选择比例",selectSize:"选择尺寸",configureProvider:"配置提供商",missingCredential:"启用图片生成前请先配置此提供商。"},apps:{description:"添加 nanobot 可在聊天中使用的 App CLI 和 MCP 服务。",cliLabel:"CLI",mcpLabel:"MCP",filterAll:"全部",filterCli:"CLI 应用",filterMcp:"MCP 服务",enabledSummary:"已启用 {{count}} 个",caption:"{{cli}} 个 CLI · {{mcp}} 个 MCP",searchPlaceholder:"搜索应用",featured:"精选",loading:"正在加载应用...",empty:"没有匹配的应用。"},automations:{filters:{all:"全部",active:"运行中",paused:"已暂停",failed:"异常",system:"系统"},sort:{next:"下次运行",last:"上次运行",updated:"更新时间",name:"名称"},search:"搜索任务、消息、关联会话或计划",queue:"任务队列",loading:"正在加载自动任务...",noMatches:"当前视图没有匹配的自动任务。",empty:"暂无自动任务。",emptyHint:"请从它应该运行的来源处创建,这样 nanobot 才能保留正确上下文。",oneShot:"一次性",systemTask:"系统管理的自动任务",labels:{schedule:"计划",next:"下次",origin:"关联会话",created:"创建于",updated:"更新于"},runNow:"立即运行",pause:"暂停",resume:"恢复",edit:"编辑",delete:"删除",protected:"受保护",editTitle:"编辑自动任务",save:"保存",deleteTitle:"删除自动任务",deleteDescription:"这会从 cron 存储中删除 {{name}},历史聊天消息会保留在会话中。",cancel:"取消",status:{system:"系统",running:"正在运行",paused:"已暂停",failed:"失败",completed:"已完成",noSchedule:"无计划",active:"运行中"},origin:{system:"系统",unknown:"未关联会话"},channels:{api:"API",cli:"CLI",dingtalk:"钉钉",discord:"Discord",email:"邮件",feishu:"飞书",matrix:"Matrix",msteams:"Microsoft Teams",qq:"QQ",slack:"Slack",telegram:"Telegram",wechat:"微信",wecom:"企业微信",weixin:"微信",whatsapp:"WhatsApp"},schedule:{at:"在 {{time}}",every:"每 {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",withTz:"{{summary}} · {{tz}}",dailyAt:"每天 {{time}}",weekdaysAt:"工作日 {{time}}",hourlyAt:"每小时第 {{minute}} 分钟",hourlyWindow:"{{start}}-{{end}} 点每小时第 {{minute}} 分钟",custom:"自定义计划"},next:{paused:"已暂停",pending:"正在运行",none:"没有下次运行"},message:{showMore:"查看完整消息",showLess:"收起消息"},fields:{name:"名称",message:"消息",scheduleType:"计划类型",every:"每隔",unit:"单位",cronExpression:"Cron 表达式",timezone:"时区",runAt:"运行时间"},scheduleTypes:{every:"间隔",cron:"Cron",at:"一次性"},everyUnits:{second:"秒",minute:"分钟",hour:"小时",day:"天"},validation:{nameRequired:"名称不能为空。",messageRequired:"消息不能为空。",intervalRequired:"间隔必须是正整数。",cronRequired:"Cron 表达式不能为空。",timeRequired:"运行时间不能为空。",futureRequired:"运行时间必须晚于当前时间。"}},oauth:{authentication:"OAuth 认证",signIn:"登录",signingIn:"登录中...",signInAgain:"重新登录",signOut:"退出登录",signedInAs:"已登录为 {{account}}",signInHelp:"从这台设备登录;不会在配置中保存 API key。",signInRequired:"需要登录",signInBeforeSaving:"将此 OAuth 提供商设为当前模型提供商前,请先登录。",signedIn:"已登录",notSignedIn:"未登录"},skills:{description:"查看此 agent 在对话中可以加载的指令技能。",caption:"{{available}} 个可用 · 共 {{total}} 个",featured:"Agent 技能",empty:"暂无可用技能。",sourceWorkspace:"自定义",sourceBuiltin:"内置",statusAvailable:"可用",statusUnavailable:"不可用",unavailableReason:"缺少:{{reason}}",openDetails:"查看 {{name}} 详情",loadingDetail:"正在加载技能详情...",loadFailed:"无法加载技能详情。",descriptionTitle:"完整描述",source:"来源",status:"状态",requirements:"需求",noRequirements:"没有显式需求。",commands:"命令",environment:"环境变量",missingCommands:"缺 CLI",missingEnvironment:"缺 ENV",unavailableReasonLabel:"不可用原因",rawInstructions:"原始 SKILL.md",rawInstructionsEmpty:"没有原始说明。",detailDescription:"{{name}} 的详情。"},voice:{selectProvider:"选择提供商",configureProvider:"配置提供商",languageAuto:"自动"}},bT={fallbackTitle:"对话 {{id}}",forkTitle:"分叉:{{title}}",loading:"加载中…",noSessions:"还没有会话。",showMore:"再显示 {{count}} 个",collapsed:"已折叠 {{count}} 个对话",showLess:"收起",actions:"“{{title}}” 的会话操作",newInProject:"在 {{project}} 中开始新对话",activity:{running:"Agent 正在运行",complete:"Agent 已完成",updated:"有新内容"},pin:"置顶",unpin:"取消置顶",rename:"重命名",renameTitle:"重命名对话",renameDescription:"为这个对话设置一个仅用于 WebUI 侧边栏的名称。",renamePlaceholder:"对话名称",renameProjectTitle:"重命名项目",renameProjectDescription:"为这个项目设置一个仅用于 WebUI 侧边栏的名称。",renameProjectPlaceholder:"项目名称",renameSave:"保存",archive:"归档",unarchive:"取消归档",showArchived:"显示归档",hideArchived:"隐藏归档",delete:"删除",newChat:"新建对话",groups:{pinned:"置顶",all:"对话",projects:"项目",today:"今天",yesterday:"昨天",earlier:"更早",archived:"已归档"}},wT={title:"删除这个对话?",description:"此操作无法撤销。",cancel:"取消",confirm:"删除",automationsDescription:"这个对话有关联的自动任务。删除对话也会删除这些自动任务。",moreAutomations:"另有 {{count}} 个",confirmWithAutomations:"删除",schedule:{at:"{{time}}",every:"每 {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"自定义计划"},next:{label:"下次:{{time}}",disabled:"已暂停",none:"没有下次运行"}},kT={idle:"空闲",connecting:"连接中…",open:"已连接",reconnecting:"重连中…",closed:"已断开",error:"连接出错"},CT={loadingConversation:"正在加载对话…",empty:{greetings:{workOn:"我们要一起做点什么?",start:"今天从哪里开始?",build:"今天一起构建什么?",tackle:"我们要一起解决什么?"},quickActions:{plan:{title:"创建项目计划",prompt:"帮我为接下来要做的事情写一份简洁的项目计划。"},analyze:{title:"分析这些数据",prompt:"帮我分析这些数据,并指出最重要的模式。"},brainstorm:{title:"头脑风暴想法",prompt:"围绕这个问题头脑风暴几个实用方案,并说明取舍。"},code:{title:"编写代码",prompt:"帮我为这个任务写代码,先从最小可用改动开始。"},summarize:{title:"总结这份文档",prompt:"帮我总结这份文档,并列出关键要点。"},more:{title:"更多",prompt:"展示几个你在这个工作区里可以帮我的实用方式。"}},imageQuickActions:{icon:{title:"设计应用图标",prompt:"生成一个干净的 1:1 nanobot 应用图标:友好的机器人,简洁矢量风格,蓝白柔和配色,不要文字。"},sticker:{title:"制作贴纸",prompt:"生成一张可爱的贴纸风小机器人助手图片,背景像透明贴纸,表情活泼有趣。"},poster:{title:"创建海报",prompt:"生成一张个人 AI 助手的精致海报概念图,现代构图,视觉层级清晰,适合落地页展示。"},product:{title:"产品样机",prompt:"生成一张对话式 AI Web 应用的干净产品样机图,极简界面,高级光影,真实设备边框。"},portrait:{title:"风格化头像",prompt:"生成一个友好的 AI 伙伴风格化头像,柔和光线,细节丰富但亲切,现代插画风格。"},edit:{title:"编辑图片",prompt:"帮我编辑一张图片。先让我上传或指定要编辑的图片,然后生成编辑后的结果。"}}},header:{toggleSidebar:"切换侧边栏",newChat:"从顶部新建对话",toggleTheme:"从顶部切换主题",settings:"打开设置",sessionInfo:"会话详情"},sessionInfo:{title:"会话",untitled:"未命名对话",automations:"自动任务",count:"{{count}}",loading:"正在加载自动任务...",loadFailed:"无法加载自动任务。",empty:"这个会话暂时没有自动任务。",disabled:"已关闭",schedule:{at:"{{time}}",every:"每 {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"自定义计划"},next:{label:"下次 {{time}}",pending:"即将执行",disabled:"已暂停",none:"没有下次运行"}},composer:{placeholderThread:"输入消息…",placeholderHero:"问任何问题...",placeholderOpening:"正在打开新对话…",placeholderStreaming:"模型正在回复…",inputAria:"消息输入框",sendHint:"Enter 发送 · Shift+Enter 换行",runRuntimeTitle:"运行中 · {{elapsed}}",goalStateStrip:"目标 · {{label}}",goalStateFallback:"目标",goalStateExpandAria:"查看完整目标",goalStateSheetTitle:"目标",send:"发送消息",stop:"停止响应",modelNotConfigured:"模型未配置",configureModel:"配置模型",queued:{label:"待引导提示",guide:"引导",delete:"删除引导",edit:"编辑引导",drag:"拖动排序"},attachImage:"添加图片",imageMode:{label:"图片生成",toggle:"切换图片生成模式",placeholder:"描述或编辑图片…",aspectAria:"图片画幅",aspectLabel:"图片画幅",aspect:{auto:"自动","1_1":"方形 1:1","3_4":"竖版 3:4","9_16":"故事版 9:16","4_3":"横版 4:3","16_9":"宽屏 16:9"}},tools:{search:"搜索",reason:"推理",deepResearch:"深度研究",voice:"语音输入"},voice:{hint:"点击进行听写或长按",stop:"停止录音",transcribing:"正在转写...",recordingStatus:"正在录音 {{time}}"},voiceErrors:{unsupported:"当前浏览器不支持语音输入。",permission:"需要麦克风权限。",notConfigured:"请先配置转写提供商。",tooLong:"录音时间太长。",tooShort:"请稍微多录一会儿。",noInput:"没有检测到麦克风输入。",failed:"语音转写失败。"},slash:{ariaLabel:"斜杠命令",label:"命令",navigateHint:"↑↓ 选择",selectHint:"Enter/Tab 填入",closeHint:"Esc 关闭",badges:{current:"当前",recent:"最近"},details:{goalActive:"目标正在运行",goalReady:"开始一个持续目标",history:"查看最近消息",stopRunning:"正在运行"},commands:{new:{title:"新建对话",description:"停止当前任务,并开始一个新的对话。"},stop:{title:"停止当前任务",description:"取消这个对话中正在运行的 agent 回合。"},restart:{title:"重启 nanobot",description:"原地重启 bot 进程。"},status:{title:"查看状态",description:"显示运行时、服务商和通道状态。"},model:{title:"模型",description:"查看或切换当前模型预设。"},history:{title:"查看对话历史",description:"打印最近 N 条已持久化的对话消息。"},dream:{title:"运行 Dream",description:"手动触发记忆整理。"},dream_log:{title:"查看 Dream 日志",description:"查看上一次 Dream 整理改变了什么。"},dream_restore:{title:"恢复记忆",description:"将记忆恢复到之前的 Dream 快照。"},goal:{title:"长期目标",description:"让助手把当前请求当作需要多步骤持续推进的目标。"},help:{title:"查看帮助",description:"列出可用的斜杠命令。"},pairing:{title:"配对",description:"管理配对请求。"}}},mentions:{ariaLabel:"应用",label:"应用",cliGroup:"CLI 应用",mcpGroup:"MCP 服务",cliBadge:"CLI",mcpBadge:"MCP",cliDescription:"使用 @{{name}} 调用本地 CLI",mcpDescription:"使用 @{{name}} 调用 MCP 服务"},encoding:"处理中…",remove:"移除附件",normalizedSizeHint:"{{orig}} → {{current}}(已自动压缩)",imageRejected:{unsupported_type:"不支持的文件类型",too_many_images:"每条消息最多 {{max}} 张图片",magic_mismatch:"文件看起来不像真实的图片",decode_failed:"无法解码这张图片",too_large:"图片太大,请换一张小一点的",io:"无法读取该文件"},goalStateCloseAria:"关闭目标",workspace:{accessAria:"工作区访问权限",projectAria:"选择项目",projectPlaceholder:"选择项目",default:"默认权限",full:"完全访问权限"}},scrollToBottom:"滚动到底部",loadEarlier:"加载更早消息",forkedFromHistory:"从历史消息分叉",promptNavigator:{open:"打开输入导航",title:"输入列表",search:"搜索输入",noResults:"没有匹配的输入。",jumpTo:"跳转到输入:{{label}}"}},ST={streaming:"流式输出中",assistantTyping:"助手正在输入",toolSingle:"正在使用工具",toolMany:"已使用 {{count}} 个工具",toolSummary:"{{count}} 个工具",toolSummaryMany:"{{count}} 个工具",reasoningTools:"推理 · {{count}} 个工具",reasoningToolsSingular:"推理 · 1 个工具",reasoning:"思考过程",reasoningStreaming:"正在思考…",reasoningSummary:"推理",agentActivitySummary:"{{reasoning}} 步 · {{tools}} 次工具调用",agentActivityToolsOnly:"{{tools}} 次工具调用",agentActivityLiveSummary:"进行中… · {{reasoning}} 步 · {{tools}} 次工具调用",agentActivityLiveToolsOnly:"进行中… · {{tools}} 次工具调用",activityThinkingFor:"思考中 {{duration}}",activityThought:"已思考",activityThoughtFor:"思考了 {{duration}}",activityWorkingFor:"处理中 {{duration}}",activityWorked:"已处理",activityWorkedFor:"处理了 {{duration}}",cliActivityRunningOne:"正在使用 @{{name}}",cliActivityRanOne:"已使用 @{{name}}",cliActivityFailedOne:"使用 @{{name}} 失败",cliActivityRunningMany:"正在使用 {{count}} 个 CLI 应用",cliActivityRanMany:"已使用 {{count}} 个 CLI 应用",cliActivityFailedMany:"{{count}} 个 CLI 应用失败",cliRunRunning:"正在使用",cliRunRan:"已使用",cliRunFailed:"失败",imageAttachment:"图片附件",automationSourceFallback:"自动化",automationTriggered:"自动触发",forkFromHere:"分叉",copyReply:"复制",copiedReply:"已复制",turnLatencyTitle:"本轮耗时(端到端)"},NT={title:"图片预览",open:"查看图片",prev:"上一张",next:"下一张",close:"关闭预览"},jT={aria:"文件预览",close:"关闭文件预览",loading:"正在加载预览...",failed:"无法预览这个文件。",routeMissing:"文件预览需要最新的 gateway。请重启 nanobot gateway 后再试。",resize:"调整文件预览宽度",truncated:"文件较大,当前只显示前半部分预览。"},AT={fallbackLanguage:"代码",copyAria:"复制代码",copy:"复制",copied:"已复制"},_T={dismiss:"关闭"},PT={messageTooBig:{title:"消息过大",body:"服务端因超过大小限制拒收了上一条消息。可移除部分图片或使用更小的图片后重试。"},workspaceScopeRejected:{title:"工作区未更改",body:"网关拒绝了请求的项目或访问权限,Nanobot 已继续使用之前的工作区。"}},TT={dialog:{defaultProject:"默认工作区",manual:"粘贴路径",manualPlaceholder:"/Users/name/project",usePath:"使用路径",absolutePathRequired:"请输入这台机器上的绝对文件夹路径。"}},RT={app:vT,sidebar:xT,settings:yT,chat:bT,deleteConfirm:wT,connection:kT,thread:CT,message:ST,lightbox:NT,filePreview:jT,code:AT,common:_T,errors:PT,workspace:TT},MT={brand:"nanobot",loading:{connecting:"正在連線到 nanobot…",boot:"正在載入 nanobot…"},error:{title:"無法連線到 nanobot",gatewayHint:"請確認 gateway 已啟動(`nanobot gateway`),並且目前頁面與 gateway 在同一台機器上開啟。"},auth:{title:"需要驗證",hint:"輸入 gateway 設定中 tokenIssueSecret 配置的密鑰。",placeholder:"密碼",submit:"連線",invalid:"密碼無效,請再試一次。"},account:{section:"帳戶",logoutHint:"中斷此瀏覽器與 gateway 的連線。",logout:"登出"},system:{section:"系統",restartHint:"重新啟動 nanobot 以套用執行階段變更。",restart:"重新啟動 nanobot",restarting:"正在重新啟動...",restartEngine:"重新啟動引擎",restartingEngine:"正在重新啟動引擎..."},restart:{completed:"重新啟動已完成,耗時 {{seconds}} 秒。"},documentTitle:{base:"nanobot",chat:"{{title}} · nanobot"},meta:{description:"nanobot Web UI —— 與你的 nanobot 工作區對話。"}},ET={navigation:"側邊欄導覽",collapse:"收合側邊欄",newChat:"新增對話",searchAria:"搜尋",searchPlaceholder:"搜尋",searchResults:"搜尋結果",noSearchResults:"沒有符合的對話。",recent:"最近對話",settings:"設定",language:{label:"語言",ariaLabel:"切換語言"},apps:"應用",automations:"自動任務",skills:{title:"技能"}},IT={backToChat:"返回聊天",sidebar:{title:"設定",ariaLabel:"設定分區"},nav:{general:"一般",byok:"BYOK",overview:"概覽",appearance:"外觀",models:"模型",providers:"提供商",image:"圖片",voice:"語音",browser:"網頁",runtime:"系統",advanced:"安全",cliApps:"CLI 應用",mcp:"MCP",apps:"應用",automations:"自動任務",skills:"技能"},sections:{interface:"介面",ai:"AI",system:"系統",about:"關於",status:"狀態",localPreferences:"本機偏好",presets:"預設",imageGeneration:"圖片生成",imageDefaults:"預設值",webSearch:"網頁搜尋",webBehavior:"行為",identity:"身分",webuiSafety:"WebUI 安全",capabilities:"能力",cliApps:"CLI 應用",mcp:"MCP 服務",apps:"應用",nativeHost:"原生宿主",hostSafety:"App 安全",voiceInput:"語音辨識"},rows:{theme:"主題",language:"語言",provider:"供應商",model:"模型",restart:"重新啟動 nanobot",configPath:"配置路徑",activePreset:"目前預設",gateway:"閘道",restartState:"重啟狀態",pendingChanges:"待套用更改",selectedPreset:"已選預設",presetModel:"預設模型",density:"密度",activityMode:"活動細節",codeWrap:"程式碼換行",maxResults:"最大結果數",timeout:"逾時",jinaReader:"Jina 閱讀器",imageGeneration:"圖片生成",imageProvider:"圖片供應商",imageProviderStatus:"供應商狀態",imageProviderBase:"供應商位址",imageModel:"圖片模型",defaultAspectRatio:"預設比例",defaultImageSize:"預設尺寸",maxImagesPerTurn:"每輪最大圖片數",imageSaveDir:"儲存目錄",botName:"Bot 名稱",botIcon:"Bot 圖示",timezone:"時區",workspacePath:"預設工作區",localServiceAccess:"本機服務",webuiDefaultAccess:"預設權限",currentModel:"目前設定",brandLogos:"品牌 Logo",cliAppsCatalog:"目錄",cliAppsFilter:"篩選",engine:"引擎",logs:"日誌",diagnostics:"診斷",contextWindow:"上下文視窗",transcription:"語音轉寫",transcriptionProvider:"提供商",transcriptionProviderStatus:"提供商狀態",transcriptionModel:"模型",transcriptionLanguage:"語言",voiceLimits:"限制"},help:{theme:"在淺色與深色外觀之間切換。",language:"選擇 WebUI 使用的語言。",provider:"選擇處理新模型請求的供應商。",model:"設定 nanobot 預設使用的模型名稱。",configPath:"目前閘道使用中的配置檔。",selectedPreset:"命名預設在此為唯讀;請在 config.json 中編輯。",presetModel:"切回 Default 後可在 WebUI 中編輯模型與供應商。",density:"只儲存在此瀏覽器中。",activityMode:"選擇預設顯示多少 agent 活動細節。",codeWrap:"讓長程式碼行在小螢幕上也易讀。",maxResults:"每次 web_search 呼叫返回的結果數。",timeout:"搜尋供應商請求逾時前的秒數。",jinaReader:"可用時為 web_fetch 使用 Jina Reader。",imageGeneration:"配置圖片供應商後,在聊天中開放 generate_image。",imageProvider:"選擇 generate_image 使用的註冊供應商。",imageProviderStatus:"圖片生成會重用「供應商」中的憑證。",imageModel:"傳送給所選圖片供應商的模型名稱。",defaultAspectRatio:"提示詞未指定比例時使用。",defaultImageSize:"傳送給支援此選項的供應商的尺寸提示。",maxImagesPerTurn:"單次 generate_image 請求可生成的圖片上限。",botName:"顯示在 nanobot 使用顯示名稱的位置。",botIcon:"顯示在 Bot 名稱旁的短 emoji 或文字。",timezone:"用於排程和需要時間感知的回覆。",localServiceAccess:"允許完全訪問權限下的 shell 命令訪問 localhost 服務。",webuiDefaultAccess:"用於沒有單獨專案權限的 Web 聊天。",securityManagedControls:"網頁抓取始終保護本機、內網和 metadata 服務。核心渠道安全仍由 config.json 管理。",currentModel:"用於新的回覆。",selectedModelProvider:"由選取的模型決定。",selectedModelValue:"由選取的模型決定。",brandLogos:"在設定中顯示第三方提供商和 CLI 圖示。",cliAppsCatalog:"只安裝 nanobot 可在本機執行的應用 CLI 轉接器;不會改動原生應用。",cliAppsFilter:"按應用、類別或能力搜尋。",logs:"開啟原生引擎日誌資料夾。",diagnostics:"匯出一份用於支援排查的小型執行報告。",localServiceAccessNative:"允許完全訪問權限下的 shell 命令訪問這台 Mac 上的服務。",webuiDefaultAccessNative:"用於沒有單獨專案權限的原生聊天。",contextWindow:"選擇此模型配置的預設上下文預算。",transcription:"送出前先把麥克風輸入轉寫到輸入框。聊天渠道的語音訊息也使用同一組設定。",transcriptionProvider:"使用「提供商」中對應提供商的憑證。",transcriptionProviderStatus:"API Key 仍保存在 providers 裡,不寫進 transcription 設定。",transcriptionModel:"除非提供商需要自訂模型 ID,否則保持解析後的預設值即可。",transcriptionLanguage:"可選 ISO-639 語言提示,例如 en、zh、ja 或 ko。"},values:{light:"淺色",dark:"深色",notAvailable:"不可用",enabled:"已啟用",disabled:"已停用",restartPending:"等待重啟",ready:"就緒",privateEngine:"私有引擎",unixSocket:"Unix socket",defaultWorkspace:"預設工作區",comfortable:"舒適",compact:"緊湊",auto:"自動",expanded:"展開",on:"開啟",off:"關閉",defaultPermission:"預設權限",fullAccess:"完全訪問權限",configured:"已配置",notConfigured:"未配置",pending:"等待中",restartingEngine:"正在重啟"},status:{loading:"正在載入設定...",loadError:"無法載入設定",unsaved:"有未儲存的更改。",upToDate:"已是最新。",savedRestart:"已儲存。重新啟動 nanobot 後生效。",restartAfterSaving:"儲存更改後,在合適時重啟。",savedRestartApply:"已儲存。準備好後重啟。",imageProviderRestart:"圖片供應商更改已儲存。準備好後重啟。",hostRestartAfterSaving:"儲存後 nanobot 會重啟引擎。",hostRestartPending:"已儲存。準備好後會重啟引擎。",hostApiUnavailable:"宿主操作僅在原生應用中可用。",logsOpened:"已開啟日誌資料夾。",logsOpenFailed:"無法開啟日誌資料夾。",diagnosticsExported:"診斷已匯出到 {{path}}。",diagnosticsExportFailed:"無法匯出診斷。"},actions:{save:"儲存",saving:"正在儲存",edit:"編輯",cancel:"取消",open:"開啟",export:"匯出",opening:"正在開啟...",exporting:"正在匯出..."},byok:{description:"自帶 provider key。Nanobot 會從目前 config 讀取這些值,只有已設定的 provider 才能在一般設定中選擇。",configured:"已設定",notConfigured:"未設定",configuredSection:"已設定",notConfiguredSection:"未設定",showMore:"再顯示 {{count}} 個",showLess:"收合",apiKey:"API key",apiBase:"API base",apiKeyPlaceholder:"輸入 API key",apiKeyConfiguredPlaceholder:"留空則保留目前 key",configuredKeyHint:"已設定的 key",apiBasePlaceholder:"使用 provider 預設地址",apiKeyRequired:"需要 API key 才能設定此 provider。",showApiKey:"顯示 API key",hideApiKey:"隱藏 API key",noConfiguredProviders:"沒有已設定的 provider",configureFirst:"請先在 BYOK 設定 provider。",openByok:"開啟 BYOK",tabs:{ariaLabel:"BYOK 憑證類型",llm:"LLM",webSearch:"網頁搜尋"},webSearch:{provider:"搜尋 provider",providerHelp:"選擇 web search 工具使用的後端。",selectProvider:"選擇 provider",credentials:"憑證",noCredentialRequired:"不需要 key",noCredentialHelp:"DuckDuckGo 不需要儲存 API key。",apiKeyHelp:"儲存到 config 後只顯示遮罩提示。",baseUrl:"Base URL",baseUrlHelp:"SearXNG 需要你自己的實例網址。",baseUrlPlaceholder:"https://search.example.com",apiKeyRequired:"此搜尋 provider 需要 API key。",baseUrlRequired:"SearXNG 需要 Base URL。",missingCredential:"填寫必要憑證後才能儲存。",saveHint:"變更會套用到新的 web search 請求。"}},overview:{model:"目前模型",providers:"供應商",configuredCount:"已配置 {{count}} 個",totalProviders:"共 {{count}} 個可用",webSearch:"網頁搜尋",imageGeneration:"圖片生成",voiceInput:"語音辨識",workspace:"工作區"},usage:{title:"Token 活動",shortTitle:"Token Usage",subtitle:"最近 12 個月由供應商回報的 token 用量。",empty:"新的模型回覆產生後,這裡會顯示 token 活動。",totalTokens:"累計 Token 數",peakTokens:"峰值 Token 數",thirtyDayTokens:"30 天 Token 數",currentStreak:"目前連續天數",longestStreak:"最長連續天數",daysValue:"{{count}} 天",last30:"30 天",activeDays:"活躍天數",requests:"請求數",estimated:"估算",includesEstimates:"包含估算",cellTitle:"{{date}}:{{tokens}} tokens,{{requests}} 次請求",sources:{user:"對話",api:"API",cron:"自動任務",dream:"記憶整理",system:"系統"}},providers:{searchPlaceholder:"搜尋供應商",noMatches:"沒有符合的供應商。",saveProvider:"儲存供應商"},image:{selectProvider:"選擇供應商",selectAspect:"選擇比例",selectSize:"選擇尺寸",configureProvider:"配置供應商",missingCredential:"啟用圖片生成前請先配置此供應商。"},models:{selectModel:"選擇模型",addConfiguration:"新增配置",newConfiguration:"新增模型配置",newConfigurationHelp:"將供應商與模型儲存為一鍵選項。",configurationName:"配置名稱",configurationNameHelp:"重新命名這個已儲存的模型配置。",configurationNamePlaceholder:"快速寫作",searchModels:"搜尋或輸入模型 ID",useCustomModel:"使用",loadingModels:"正在載入模型...",searchCatalog:"搜尋供應商目錄來選擇模型。",modelsAvailable:"可用",noModelResults:"沒有符合的模型。",loadFailed:"模型列表不可用。",unsupportedModelList:"手動輸入模型 ID。",providerNotConfigured:"載入模型前請先配置此供應商。",autoProviderCustomOnly:"自動供應商模式使用自訂模型 ID。"},timezone:{select:"選擇時區",search:"搜尋時區",empty:"沒有符合的時區。"},cliApps:{allCategories:"全部分類",availableCount:"{{count}} 個應用",installedCount:"已安裝 {{count}} 個",summary:"已安裝 {{installed}} / {{total}} 個 CLI",filterAll:"全部",filterInstalled:"已安裝的 CLI",filterNotInstalled:"未安裝",searchPlaceholder:"搜尋 CLI",statusInstalled:"已安裝",statusAvailable:"可用",statusMissing:"缺少相依項",statusUnsupported:"不支援",statusNotInstalled:"未安裝",unsupported:"不支援",loading:"正在載入 CLI 應用...",empty:"沒有符合此篩選條件的 CLI 應用。",readyTitle:"@{{name}} 已就緒",readyStatus:"就緒",readyPrompt:"使用 @{{name}} 查看這個 CLI 能做什麼。",readyTry:"試用 @{{name}}",readyCopied:"已複製",openChat:"開啟聊天",requires:"需要",test:"測試 CLI",update:"更新 CLI",uninstall:"解除安裝 CLI",install:"安裝 CLI",unavailable:"不可用",noDescription:"暫無描述。"},about:{version:"版本",checking:"正在檢查...",checkForUpdates:"檢查更新",upToDate:"已是最新版本",updateAvailable:"有可用更新 v{{version}}"},mcp:{allCategories:"全部分類",summary:"已啟用 {{installed}} / {{total}} 個預設",filterAll:"全部",filterInstalled:"已啟用",filterNotInstalled:"未啟用",searchPlaceholder:"搜尋 MCP 預設",moreOptions:"更多 MCP 選項",moreOptionsSubtitle:"新增自訂服務,或匯入 mcp.json。",customTitle:"自訂 MCP",customSubtitle:"新增任意 stdio、HTTP 或 SSE MCP 服務。",customAction:"自訂",importAction:"匯入",serverName:"服務名稱",serverUrl:"URL",transport:"傳輸方式",command:"指令",args:"Args JSON",headers:"Headers JSON",env:"Env JSON",timeout:"工具逾時",advancedOptions:"進階選項",hideAdvanced:"隱藏進階",saveCustom:"儲存 MCP",configImport:"匯入 mcp.json",importConfig:"匯入",restartRequired:"重新啟動 nanobot 以連接更新後的 MCP 工具。",toolsFound:"{{count}} 個工具",loading:"正在載入 MCP 預設...",empty:"沒有符合此篩選條件的 MCP 預設。",openDocs:"開啟文件",test:"測試",remove:"移除",enable:"啟用",enabled:"已啟用",setup:"連接",configure:"連接",connectTitle:"連接 {{name}}",connectHint:"從你的帳號設定中加入金鑰。",saveAndEnable:"儲存並啟用",updateSetup:"更新設定",configured:"已設定",keepExisting:"留空以保留目前值",statusConfigured:"已設定",statusMissingCredentials:"需要金鑰",statusMissingDependency:"需要相依項",statusComingSoon:"即將推出",statusNotInstalled:"未啟用",toolScope:"工具",allTools:"全部",noTools:"無",testForTools:"執行測試以檢查並選擇個別工具。"},legal:{thirdPartyBrands:"產品名稱、標誌與品牌均屬於其各自擁有者。使用僅為識別用途,並不代表背書。"},apps:{description:"新增 nanobot 可在聊天中使用的 App CLI 和 MCP 服務。",cliLabel:"CLI",mcpLabel:"MCP",filterAll:"全部",filterCli:"CLI 應用",filterMcp:"MCP 服務",enabledSummary:"已啟用 {{count}} 個",caption:"{{cli}} 個 CLI · {{mcp}} 個 MCP",searchPlaceholder:"搜尋應用",featured:"精選",loading:"正在載入應用...",empty:"沒有符合的應用。"},automations:{filters:{all:"全部",active:"執行中",paused:"已暫停",failed:"異常",system:"系統"},sort:{next:"下次執行",last:"上次執行",updated:"更新時間",name:"名稱"},search:"搜尋任務、訊息、關聯對話或排程",queue:"任務佇列",loading:"正在載入自動任務...",noMatches:"目前檢視沒有符合的自動任務。",empty:"尚無自動任務。",emptyHint:"請從它應該執行的來源處建立,這樣 nanobot 才能保留正確上下文。",oneShot:"一次性",systemTask:"系統管理的自動任務",labels:{schedule:"排程",next:"下次",origin:"關聯會話",created:"建立於",updated:"更新於"},runNow:"立即執行",pause:"暫停",resume:"恢復",edit:"編輯",delete:"刪除",protected:"受保護",editTitle:"編輯自動任務",save:"儲存",deleteTitle:"刪除自動任務",deleteDescription:"這會從 cron 儲存中刪除 {{name}},歷史聊天訊息會保留在會話中。",cancel:"取消",status:{system:"系統",running:"正在執行",paused:"已暫停",failed:"失敗",completed:"已完成",noSchedule:"無排程",active:"執行中"},origin:{system:"系統",unknown:"未關聯會話"},channels:{api:"API",cli:"CLI",dingtalk:"釘釘",discord:"Discord",email:"電子郵件",feishu:"飛書",matrix:"Matrix",msteams:"Microsoft Teams",qq:"QQ",slack:"Slack",telegram:"Telegram",wechat:"微信",wecom:"企業微信",weixin:"微信",whatsapp:"WhatsApp"},schedule:{at:"於 {{time}}",every:"每 {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",withTz:"{{summary}} · {{tz}}",dailyAt:"每天 {{time}}",weekdaysAt:"工作日 {{time}}",hourlyAt:"每小時第 {{minute}} 分鐘",hourlyWindow:"{{start}}-{{end}} 點每小時第 {{minute}} 分鐘",custom:"自訂排程"},next:{paused:"已暫停",pending:"正在執行",none:"沒有下次執行"},message:{showMore:"查看完整訊息",showLess:"收起訊息"},fields:{name:"名稱",message:"訊息",scheduleType:"排程類型",every:"每隔",unit:"單位",cronExpression:"Cron 表達式",timezone:"時區",runAt:"執行時間"},scheduleTypes:{every:"間隔",cron:"Cron",at:"一次性"},everyUnits:{second:"秒",minute:"分鐘",hour:"小時",day:"天"},validation:{nameRequired:"名稱不能為空。",messageRequired:"訊息不能為空。",intervalRequired:"間隔必須是正整數。",cronRequired:"Cron 表達式不能為空。",timeRequired:"執行時間不能為空。",futureRequired:"執行時間必須晚於目前時間。"}},oauth:{authentication:"OAuth 認證",signIn:"登入",signingIn:"登入中...",signInAgain:"重新登入",signOut:"登出",signedInAs:"已登入為 {{account}}",signInHelp:"從這台裝置登入;不會在配置中儲存 API key。",signInRequired:"需要登入",signInBeforeSaving:"將此 OAuth 供應商設為目前模型供應商前,請先登入。",signedIn:"已登入",notSignedIn:"未登入"},skills:{description:"查看此 agent 在對話中可以載入的指令技能。",caption:"{{available}} 個可用 · 共 {{total}} 個",featured:"Agent 技能",empty:"暫無可用技能。",sourceWorkspace:"自訂",sourceBuiltin:"內建",statusAvailable:"可用",statusUnavailable:"不可用",unavailableReason:"缺少:{{reason}}",openDetails:"查看 {{name}} 詳情",loadingDetail:"正在載入技能詳情...",loadFailed:"無法載入技能詳情。",descriptionTitle:"完整描述",source:"來源",status:"狀態",requirements:"需求",noRequirements:"沒有明確需求。",commands:"命令",environment:"環境變數",missingCommands:"缺 CLI",missingEnvironment:"缺 ENV",unavailableReasonLabel:"不可用原因",rawInstructions:"原始 SKILL.md",rawInstructionsEmpty:"沒有原始說明。",detailDescription:"{{name}} 的詳細資訊。"},voice:{selectProvider:"選擇提供商",configureProvider:"設定提供商",languageAuto:"自動"}},LT={fallbackTitle:"對話 {{id}}",forkTitle:"分叉:{{title}}",loading:"載入中…",noSessions:"目前還沒有會話。",showMore:"再顯示 {{count}} 個",collapsed:"已折疊 {{count}} 個對話",showLess:"收起",actions:"「{{title}}」的會話操作",newInProject:"在 {{project}} 中開始新對話",activity:{running:"Agent 正在執行",complete:"Agent 已完成",updated:"有新內容"},pin:"置頂",unpin:"取消置頂",rename:"重新命名",renameTitle:"重新命名對話",renameDescription:"為這個對話設定僅用於 WebUI 側邊欄的名稱。",renamePlaceholder:"對話名稱",renameProjectTitle:"重新命名專案",renameProjectDescription:"為這個專案設定僅用於 WebUI 側邊欄的名稱。",renameProjectPlaceholder:"專案名稱",renameSave:"儲存",archive:"封存",unarchive:"取消封存",showArchived:"顯示封存",hideArchived:"隱藏封存",delete:"刪除",newChat:"新增對話",groups:{pinned:"置頂",all:"對話",projects:"專案",today:"今天",yesterday:"昨天",earlier:"更早",archived:"已封存"}},DT={title:"刪除這個對話?",description:"此操作無法復原。",cancel:"取消",confirm:"刪除",automationsDescription:"這個對話有關聯的自動任務。刪除對話也會刪除這些自動任務。",moreAutomations:"另有 {{count}} 個",confirmWithAutomations:"刪除",schedule:{at:"{{time}}",every:"每 {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"自訂計畫"},next:{label:"下次:{{time}}",disabled:"已暫停",none:"沒有下次執行"}},OT={idle:"閒置",connecting:"連線中…",open:"已連線",reconnecting:"重新連線中…",closed:"已中斷",error:"連線錯誤"},FT={loadingConversation:"正在載入對話…",empty:{greetings:{workOn:"我們要一起做點什麼?",start:"今天從哪裡開始?",build:"今天一起構建什麼?",tackle:"我們要一起解決什麼?"},quickActions:{plan:{title:"建立專案計畫",prompt:"幫我為接下來要做的事情寫一份簡潔的專案計畫。"},analyze:{title:"分析這些資料",prompt:"幫我分析這些資料,並指出最重要的模式。"},brainstorm:{title:"腦力激盪想法",prompt:"圍繞這個問題腦力激盪幾個實用方案,並說明取捨。"},code:{title:"撰寫程式碼",prompt:"幫我為這個任務撰寫程式碼,先從最小可用改動開始。"},summarize:{title:"總結這份文件",prompt:"幫我總結這份文件,並列出關鍵重點。"},more:{title:"更多",prompt:"展示幾個你在這個工作區裡可以幫我的實用方式。"}},imageQuickActions:{icon:{title:"設計應用程式圖示",prompt:"生成一個乾淨的 1:1 nanobot 應用程式圖示:友善的機器人、簡潔向量風格、柔和藍白配色,不要文字。"},sticker:{title:"製作貼圖",prompt:"生成一張可愛貼圖風格的小型機器人助理圖片,背景像透明貼紙,表情活潑有趣。"},poster:{title:"建立海報",prompt:"生成一張個人 AI 助理的精緻海報概念圖,現代構圖、清楚的視覺層級,適合登陸頁展示。"},product:{title:"產品樣機",prompt:"生成一張對話式 AI Web 應用的乾淨產品樣機圖,極簡介面、高級光影、真實裝置邊框。"},portrait:{title:"風格化頭像",prompt:"生成一個友善 AI 夥伴的風格化頭像,柔和光線、細節豐富但親切,現代插畫風格。"},edit:{title:"編輯圖片",prompt:"幫我編輯一張圖片。先請我上傳或指定要編輯的圖片,然後生成編輯後的結果。"}}},header:{toggleSidebar:"切換側邊欄",newChat:"開始新對話",toggleTheme:"從頂部切換主題",settings:"開啟設定",sessionInfo:"會話詳情"},sessionInfo:{title:"會話",untitled:"未命名對話",automations:"自動任務",count:"{{count}}",loading:"正在載入自動任務...",loadFailed:"無法載入自動任務。",empty:"這個會話暫時沒有自動任務。",disabled:"已關閉",schedule:{at:"{{time}}",every:"每 {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"自訂計畫"},next:{label:"下次 {{time}}",pending:"即將執行",disabled:"已暫停",none:"沒有下次執行"}},composer:{placeholderThread:"輸入訊息…",placeholderHero:"你在想什麼?",placeholderOpening:"正在開啟新對話…",placeholderStreaming:"模型正在回覆…",inputAria:"訊息輸入框",sendHint:"Enter 送出 · Shift+Enter 換行",runRuntimeTitle:"執行中 · {{elapsed}}",goalStateStrip:"目標 · {{label}}",goalStateFallback:"目標",goalStateExpandAria:"查看完整目標",goalStateSheetTitle:"目標",goalStateCloseAria:"關閉目標",send:"送出訊息",stop:"停止回覆",modelNotConfigured:"模型未配置",configureModel:"配置模型",queued:{label:"待引導提示",guide:"引導",delete:"刪除引導",edit:"編輯引導",drag:"拖曳排序"},attachImage:"附加圖片",imageMode:{label:"圖片生成",toggle:"切換圖片生成模式",placeholder:"描述或編輯圖片…",aspectAria:"圖片畫幅",aspectLabel:"圖片畫幅",aspect:{auto:"自動","1_1":"方形 1:1","3_4":"直式 3:4","9_16":"故事版 9:16","4_3":"橫式 4:3","16_9":"寬螢幕 16:9"}},tools:{search:"搜尋",reason:"推理",deepResearch:"深度研究",voice:"語音輸入"},voice:{hint:"點擊進行聽寫或長按",stop:"停止錄音",transcribing:"正在轉寫...",recordingStatus:"正在錄音 {{time}}"},voiceErrors:{unsupported:"目前瀏覽器不支援語音輸入。",permission:"需要麥克風權限。",notConfigured:"請先設定轉寫提供商。",tooLong:"錄音時間太長。",tooShort:"請稍微多錄一會兒。",noInput:"沒有偵測到麥克風輸入。",failed:"語音轉寫失敗。"},slash:{ariaLabel:"斜線命令",label:"命令",navigateHint:"↑↓ 選擇",selectHint:"Enter/Tab 填入",closeHint:"Esc 關閉",commands:{new:{title:"新增對話",description:"停止目前任務,並開始新的對話。"},stop:{title:"停止目前任務",description:"取消這個對話中正在執行的 agent 回合。"},restart:{title:"重新啟動 nanobot",description:"原地重新啟動 bot 進程。"},status:{title:"查看狀態",description:"顯示執行環境、provider 和 channel 狀態。"},model:{title:"模型",description:"查看或切換目前模型預設。"},history:{title:"查看對話歷史",description:"列印最近 N 則已持久化的對話訊息。"},dream:{title:"執行 Dream",description:"手動觸發記憶整理。"},dream_log:{title:"查看 Dream 日誌",description:"查看上一次 Dream 整理變更了什麼。"},dream_restore:{title:"恢復記憶",description:"將記憶恢復到之前的 Dream 快照。"},goal:{title:"長期目標",description:"請助理把這則請求當成需要多步驟持續推進的目標。"},help:{title:"查看說明",description:"列出可用的斜線命令。"},pairing:{title:"配對",description:"管理配對請求。"}},badges:{current:"目前",recent:"最近"},details:{goalActive:"目標正在執行",goalReady:"開始一個持續目標",history:"查看最近訊息",stopRunning:"正在執行"}},encoding:"處理中…",remove:"移除附件",normalizedSizeHint:"{{orig}} → {{current}}(已自動壓縮)",imageRejected:{unsupported_type:"不支援的檔案類型",too_many_images:"每則訊息最多 {{max}} 張圖片",magic_mismatch:"檔案看起來不像真正的圖片",decode_failed:"無法解碼這張圖片",too_large:"圖片太大,請換一張小一點的",io:"無法讀取這個檔案"},mentions:{ariaLabel:"應用",label:"應用",cliGroup:"CLI 應用",mcpGroup:"MCP 服務",cliBadge:"CLI",mcpBadge:"MCP",cliDescription:"使用 @{{name}} 呼叫本機 CLI",mcpDescription:"使用 @{{name}} 呼叫 MCP 服務"},workspace:{accessAria:"工作區存取權限",projectAria:"選擇專案",projectPlaceholder:"選擇專案",default:"預設權限",full:"完全存取權限"}},scrollToBottom:"捲動到底部",loadEarlier:"載入更早訊息",forkedFromHistory:"從歷史訊息分叉",promptNavigator:{open:"開啟輸入導覽",title:"輸入列表",search:"搜尋輸入",noResults:"沒有符合的輸入。",jumpTo:"跳到輸入:{{label}}"}},zT={streaming:"串流輸出中",assistantTyping:"助理正在輸入",toolSingle:"正在使用工具",toolMany:"已使用 {{count}} 個工具",toolSummary:"{{count}} 個工具",toolSummaryMany:"{{count}} 個工具",reasoningTools:"推理 · {{count}} 個工具",reasoningToolsSingular:"推理 · 1 個工具",reasoning:"思考過程",reasoningStreaming:"正在思考…",reasoningSummary:"推理",agentActivitySummary:"{{reasoning}} 步 · {{tools}} 次工具呼叫",agentActivityToolsOnly:"{{tools}} 次工具呼叫",agentActivityLiveSummary:"進行中… · {{reasoning}} 步 · {{tools}} 次工具呼叫",agentActivityLiveToolsOnly:"進行中… · {{tools}} 次工具呼叫",imageAttachment:"圖片附件",forkFromHere:"分叉",copyReply:"複製",copiedReply:"已複製",turnLatencyTitle:"本輪耗時(端到端)",activityThinkingFor:"思考中,已 {{duration}}",activityThought:"已思考",activityThoughtFor:"已思考 {{duration}}",activityWorkingFor:"處理中,已 {{duration}}",activityWorked:"已處理",activityWorkedFor:"已處理 {{duration}}",cliActivityRunningOne:"正在使用 @{{name}}",cliActivityRanOne:"已使用 @{{name}}",cliActivityFailedOne:"@{{name}} 失敗",cliActivityRunningMany:"正在使用 {{count}} 個 CLI 應用",cliActivityRanMany:"已使用 {{count}} 個 CLI 應用",cliActivityFailedMany:"{{count}} 個 CLI 應用失敗",cliRunRunning:"使用中",cliRunRan:"已使用",cliRunFailed:"失敗",automationSourceFallback:"自動化",automationTriggered:"自動觸發"},$T={title:"圖片預覽",open:"檢視圖片",prev:"上一張",next:"下一張",close:"關閉預覽"},UT={aria:"檔案預覽",close:"關閉檔案預覽",loading:"正在載入預覽...",failed:"無法預覽這個檔案。",routeMissing:"檔案預覽需要最新的 gateway。請重啟 nanobot gateway 後再試。",resize:"調整檔案預覽寬度",truncated:"檔案較大,目前只顯示前半部分預覽。"},BT={fallbackLanguage:"程式碼",copyAria:"複製程式碼",copy:"複製",copied:"已複製"},HT={dismiss:"關閉"},WT={messageTooBig:{title:"訊息過大",body:"伺服器因超過大小限制拒收了上一則訊息。可移除部分圖片或改用較小的圖片後再試。"},workspaceScopeRejected:{title:"工作區未變更",body:"閘道拒絕了要求的專案或存取權限,Nanobot 已繼續使用先前的工作區。"}},qT={dialog:{defaultProject:"預設工作區",manual:"貼上路徑",manualPlaceholder:"/Users/name/project",usePath:"使用路徑",absolutePathRequired:"請輸入這台機器上的絕對資料夾路徑。"}},VT={app:MT,sidebar:ET,settings:IT,chat:LT,deleteConfirm:DT,connection:OT,thread:FT,message:zT,lightbox:$T,filePreview:UT,code:BT,common:HT,errors:WT,workspace:qT},KT={brand:"nanobot",loading:{connecting:"Connexion à nanobot…",boot:"Chargement de nanobot…"},error:{title:"Impossible de joindre nanobot",gatewayHint:"Assurez-vous que la gateway est en cours d’exécution (`nanobot gateway`) et que cette page est ouverte sur la même machine."},auth:{title:"Authentification requise",hint:"Saisissez le secret configuré comme tokenIssueSecret dans la configuration de votre gateway.",placeholder:"Mot de passe",submit:"Se connecter",invalid:"Mot de passe invalide. Réessayez."},account:{section:"Compte",logoutHint:"Déconnecter ce navigateur du gateway.",logout:"Se déconnecter"},system:{section:"Système",restartHint:"Redémarrez nanobot pour appliquer les changements d’exécution.",restart:"Redémarrer nanobot",restarting:"Redémarrage...",restartEngine:"Redémarrer le moteur",restartingEngine:"Redémarrage du moteur..."},restart:{completed:"Redémarrage terminé en {{seconds}} s."},documentTitle:{base:"nanobot",chat:"{{title}} · nanobot"},meta:{description:"Interface web nanobot — discutez avec votre espace de travail nanobot."}},GT={navigation:"Navigation de la barre latérale",collapse:"Réduire la barre latérale",newChat:"Nouvelle discussion",searchAria:"Rechercher",searchPlaceholder:"Rechercher",searchResults:"Résultats",noSearchResults:"Aucun chat correspondant.",recent:"Récentes",settings:"Paramètres",language:{label:"Langue",ariaLabel:"Changer de langue"},apps:"Apps",automations:"Automatisations",skills:{title:"Compétences"}},YT={backToChat:"Retour au chat",sidebar:{title:"Réglages",ariaLabel:"Sections des réglages"},nav:{general:"Général",byok:"BYOK",overview:"Aperçu",appearance:"Apparence",models:"Modèles",providers:"Fournisseurs",image:"Images",voice:"Voix",browser:"Internet",runtime:"Système",advanced:"Sécurité",cliApps:"Apps CLI",mcp:"MCP",apps:"Applications",automations:"Automatisations",skills:"Compétences"},sections:{interface:"Interface utilisateur",ai:"AI",system:"Système",about:"À propos",status:"État",localPreferences:"Préférences locales",presets:"Préréglages",imageGeneration:"Génération d’images",imageDefaults:"Valeurs par défaut",webSearch:"Recherche web",webBehavior:"Comportement",identity:"Identité",webuiSafety:"Sécurité WebUI",capabilities:"Capacités",cliApps:"Applications CLI",mcp:"Services MCP",apps:"Applications",nativeHost:"Hôte natif",hostSafety:"Sécurité de l’app",voiceInput:"Saisie vocale"},rows:{theme:"Thème",language:"Langue",provider:"Fournisseur",model:"Modèle",restart:"Redémarrer nanobot",configPath:"Chemin de config",activePreset:"Préréglage actif",gateway:"Passerelle",restartState:"État du redémarrage",pendingChanges:"Modifications en attente",selectedPreset:"Préréglage sélectionné",presetModel:"Modèle du préréglage",density:"Densité",activityMode:"Détail d’activité",codeWrap:"Retour à la ligne du code",maxResults:"Résultats max.",timeout:"Délai d’attente",jinaReader:"Lecteur Jina",imageGeneration:"Génération d’images",imageProvider:"Fournisseur d’images",imageProviderStatus:"État du fournisseur",imageProviderBase:"Base du fournisseur",imageModel:"Modèle d’image",defaultAspectRatio:"Ratio par défaut",defaultImageSize:"Taille par défaut",maxImagesPerTurn:"Images max. par tour",imageSaveDir:"Dossier d’enregistrement",botName:"Nom du bot",botIcon:"Icône du bot",timezone:"Fuseau horaire",workspacePath:"Espace de travail par défaut",localServiceAccess:"Services locaux",webuiDefaultAccess:"Accès par défaut",currentModel:"Configuration actuelle",brandLogos:"Logos de marque",cliAppsCatalog:"Catalogue",cliAppsFilter:"Filtre",engine:"Moteur",logs:"Journaux",diagnostics:"Diagnostic",contextWindow:"Fenêtre de contexte",transcription:"Transcription",transcriptionProvider:"Fournisseur",transcriptionProviderStatus:"Etat du fournisseur",transcriptionModel:"Modele",transcriptionLanguage:"Langue",voiceLimits:"Limites"},help:{theme:"Basculer entre l’apparence claire et sombre.",language:"Choisissez la langue utilisée par WebUI.",provider:"Sélectionnez le fournisseur à utiliser pour les nouvelles requêtes de modèle.",model:"Définissez le nom du modèle utilisé par défaut par nanobot.",configPath:"Le fichier de configuration actuellement utilisé par la passerelle.",selectedPreset:"Les préréglages nommés sont en lecture seule ici ; modifiez-les dans config.json.",presetModel:"Passez à Default pour modifier le modèle et le fournisseur depuis WebUI.",density:"Enregistré seulement dans ce navigateur.",activityMode:"Choisissez le niveau de détail d’activité agent affiché par défaut.",codeWrap:"Garde les longues lignes de code lisibles sur les petits écrans.",maxResults:"Résultats renvoyés par chaque appel web_search.",timeout:"Nombre de secondes avant l’expiration d’une requête de recherche.",jinaReader:"Utilise Jina Reader pour web_fetch lorsque disponible.",imageGeneration:"Expose generate_image dans les chats lorsqu’un fournisseur d’image configuré est disponible.",imageProvider:"Choisissez le fournisseur inscrit utilisé par generate_image.",imageProviderStatus:"La génération d’images réutilise les identifiants des fournisseurs.",imageModel:"Nom du modèle envoyé au fournisseur d’images sélectionné.",defaultAspectRatio:"Utilisé lorsque le prompt ne choisit pas de ratio.",defaultImageSize:"Indication de taille envoyée aux fournisseurs compatibles.",maxImagesPerTurn:"Limite supérieure pour une requête generate_image.",botName:"Affiché là où nanobot utilise un nom visible.",botIcon:"Emoji ou texte court affiché avec le nom du bot.",timezone:"Utilisé pour les horaires et les réponses tenant compte du temps.",localServiceAccess:"Autorise les commandes shell Full Access à atteindre les services localhost.",webuiDefaultAccess:"Utilisé par les chats web sans permission propre au projet.",securityManagedControls:"Les récupérations web protègent toujours les services locaux, privés et de métadonnées. La sécurité des canaux principaux reste gérée dans config.json.",currentModel:"Utilisée pour les nouvelles réponses.",selectedModelProvider:"Défini par le modèle sélectionné.",selectedModelValue:"Défini par le modèle sélectionné.",brandLogos:"Affiche les logos de fournisseurs tiers et CLI dans les Réglages.",cliAppsCatalog:"Installe uniquement les adaptateurs CLI d’apps que nanobot peut exécuter localement ; les apps natives restent inchangées.",cliAppsFilter:"Recherchez par app, catégorie ou capacité.",logs:"Ouvre le dossier des journaux du moteur natif.",diagnostics:"Exporte un petit rapport d’exécution pour le support.",localServiceAccessNative:"Autorise les commandes shell Full Access à atteindre les services sur ce Mac.",webuiDefaultAccessNative:"Utilisé par les chats natifs sans permission propre au projet.",contextWindow:"Choisissez le budget de contexte par défaut pour cette configuration de modèle.",transcription:"Transcrit l'entree micro avant l'envoi. Les messages vocaux des canaux utilisent les memes reglages.",transcriptionProvider:"Utilise les identifiants du fournisseur correspondant dans Fournisseurs.",transcriptionProviderStatus:"Les cles API restent dans les fournisseurs, pas dans les reglages de transcription.",transcriptionModel:"Laissez le modele resolu par defaut sauf si votre fournisseur exige un id personnalise.",transcriptionLanguage:"Indice ISO-639 facultatif, comme en, zh, ja ou ko."},values:{light:"Clair",dark:"Sombre",notAvailable:"Indisponible",enabled:"Activé",disabled:"Désactivé",restartPending:"Redémarrage en attente",ready:"Prêt",privateEngine:"Moteur privé",unixSocket:"Socket Unix",defaultWorkspace:"Espace par défaut",comfortable:"Confortable",compact:"Compacte",auto:"Automatique",expanded:"Développé",on:"Activé",off:"Désactivé",defaultPermission:"Autorisation par défaut",fullAccess:"Accès complet",configured:"Configuré",notConfigured:"Non configuré",pending:"En attente",restartingEngine:"Redémarrage"},status:{loading:"Chargement des réglages...",loadError:"Impossible de charger les réglages",unsaved:"Modifications non enregistrées.",upToDate:"À jour.",savedRestart:"Enregistré. Redémarrez nanobot pour appliquer.",restartAfterSaving:"Enregistrez les changements, puis redémarrez quand vous êtes prêt.",savedRestartApply:"Enregistré. Redémarrez quand vous êtes prêt.",imageProviderRestart:"Changements du fournisseur d’image enregistrés. Redémarrez quand vous êtes prêt.",hostRestartAfterSaving:"En enregistrant, nanobot redémarrera son moteur.",hostRestartPending:"Enregistré. Le moteur redémarrera lorsqu’il sera prêt.",hostApiUnavailable:"Les actions de l’hôte ne sont disponibles que dans l’app native.",logsOpened:"Dossier des journaux ouvert.",logsOpenFailed:"Impossible d’ouvrir le dossier des journaux.",diagnosticsExported:"Diagnostic exporté vers {{path}}.",diagnosticsExportFailed:"Impossible d’exporter le diagnostic."},actions:{save:"Enregistrer",saving:"Enregistrement",edit:"Modifier",cancel:"Annuler",open:"Ouvrir",export:"Exporter",opening:"Ouverture...",exporting:"Exportation..."},byok:{description:"Utilisez vos propres clés de fournisseur. Nanobot lit ces valeurs depuis la configuration actuelle, et seuls les fournisseurs configurés peuvent être sélectionnés dans Général.",configured:"Configuré",notConfigured:"Non configuré",configuredSection:"Configurés",notConfiguredSection:"Non configurés",showMore:"Afficher {{count}} de plus",showLess:"Afficher moins",apiKey:"API key",apiBase:"API base",apiKeyPlaceholder:"Saisir l'API key",apiKeyConfiguredPlaceholder:"Laisser vide pour conserver la key actuelle",configuredKeyHint:"Key configurée",apiBasePlaceholder:"Utiliser la valeur par défaut du fournisseur",apiKeyRequired:"Une API key est requise pour configurer ce fournisseur.",showApiKey:"Afficher l'API key",hideApiKey:"Masquer l'API key",noConfiguredProviders:"Aucun fournisseur configuré",configureFirst:"Configurez d'abord un fournisseur dans BYOK.",openByok:"Ouvrir BYOK",tabs:{ariaLabel:"Type d'identifiants BYOK",llm:"LLM",webSearch:"Recherche web"},webSearch:{provider:"Fournisseur de recherche",providerHelp:"Choisissez le backend utilisé par l'outil web search.",selectProvider:"Choisir un fournisseur",credentials:"Identifiants",noCredentialRequired:"Aucune key requise",noCredentialHelp:"DuckDuckGo fonctionne sans API key enregistrée.",apiKeyHelp:"Enregistrée dans la config et masquée après l'enregistrement.",baseUrl:"Base URL",baseUrlHelp:"SearXNG nécessite l'URL de votre propre instance.",baseUrlPlaceholder:"https://search.example.com",apiKeyRequired:"Ce fournisseur de recherche nécessite une API key.",baseUrlRequired:"SearXNG nécessite une Base URL.",missingCredential:"Ajoutez l'identifiant requis avant d'enregistrer.",saveHint:"Les changements s'appliquent aux nouvelles requêtes web search."}},overview:{model:"Modèle actuel",providers:"Fournisseurs",configuredCount:"{{count}} configurés",totalProviders:"{{count}} disponibles",webSearch:"Recherche web",imageGeneration:"Génération d’images",voiceInput:"Saisie vocale",workspace:"Espace de travail"},usage:{title:"Activité des tokens",shortTitle:"Token Usage",subtitle:"Usage signalé par le fournisseur sur les 12 derniers mois.",empty:"L’activité des tokens apparaîtra après les nouvelles réponses du modèle.",totalTokens:"Tokens cumulés",peakTokens:"Pic de tokens",thirtyDayTokens:"Tokens sur 30 jours",currentStreak:"Série actuelle",longestStreak:"Plus longue série",daysValue:"{{count}} j",last30:"30 jours",activeDays:"Jours actifs",requests:"Requêtes",estimated:"estimé",includesEstimates:"inclut des estimations",cellTitle:"{{date}} : {{tokens}} tokens, {{requests}} requêtes",sources:{user:"Chat",api:"API",cron:"Automatisations",dream:"Mémoire",system:"Système"}},providers:{searchPlaceholder:"Rechercher des fournisseurs",noMatches:"Aucun fournisseur ne correspond.",saveProvider:"Enregistrer le fournisseur"},image:{selectProvider:"Choisir un fournisseur",selectAspect:"Choisir un ratio",selectSize:"Choisir une taille",configureProvider:"Configurer le fournisseur",missingCredential:"Configura este proveedor antes de activar la generación de imágenes."},models:{selectModel:"Choisir un modèle",addConfiguration:"Ajouter une configuration",newConfiguration:"Nouvelle configuration de modèle",newConfigurationHelp:"Enregistre un fournisseur et un modèle comme option en un clic.",configurationName:"Nom de la configuration",configurationNameHelp:"Renomme cette configuration de modèle enregistrée.",configurationNamePlaceholder:"Rédaction rapide",searchModels:"Rechercher ou saisir un ID de modèle",useCustomModel:"Utiliser",loadingModels:"Chargement des modèles...",searchCatalog:"Rechercher dans le catalogue du fournisseur pour choisir un modèle.",modelsAvailable:"disponibles",noModelResults:"Aucun modèle correspondant.",loadFailed:"Liste des modèles indisponible.",unsupportedModelList:"Saisissez manuellement un ID de modèle.",providerNotConfigured:"Configurez ce fournisseur avant de charger les modèles.",autoProviderCustomOnly:"Le mode fournisseur automatique utilise des IDs de modèle personnalisés."},timezone:{select:"Choisir un fuseau horaire",search:"Rechercher un fuseau horaire",empty:"Aucun fuseau horaire correspondant."},cliApps:{allCategories:"Toutes les catégories",availableCount:"{{count}} applications",installedCount:"{{count}} installées",summary:"{{installed}} CLIs installées sur {{total}}",filterAll:"Tout",filterInstalled:"CLIs installées",filterNotInstalled:"Non installées",searchPlaceholder:"Rechercher des CLIs",statusInstalled:"Installée",statusAvailable:"Disponible",statusMissing:"Dépendance manquante",statusUnsupported:"Non compatible",statusNotInstalled:"Non installée",unsupported:"Non compatible",loading:"Chargement des apps CLI...",empty:"Aucune app CLI ne correspond à ce filtre.",readyTitle:"@{{name}} est prêt",readyStatus:"Prêt",readyPrompt:"Utilisez @{{name}} pour voir ce que ce CLI peut faire.",readyTry:"Essayer @{{name}}",readyCopied:"Copié",openChat:"Ouvrir le chat",requires:"Requiert",test:"Tester le CLI",update:"Mettre à jour le CLI",uninstall:"Désinstaller le CLI",install:"Installer le CLI",unavailable:"Indisponible",noDescription:"Aucune description disponible."},about:{version:"Version",checking:"Recherche de mises à jour...",checkForUpdates:"Rechercher les mises à jour",upToDate:"Vous êtes à jour",updateAvailable:"Mise à jour disponible v{{version}}"},mcp:{allCategories:"Toutes les catégories",summary:"{{installed}} presets activés sur {{total}}",filterAll:"Tout",filterInstalled:"Activés",filterNotInstalled:"Non activés",searchPlaceholder:"Rechercher des presets MCP",moreOptions:"Plus d'options MCP",moreOptionsSubtitle:"Ajoutez un serveur personnalisé ou importez mcp.json.",customTitle:"MCP personnalisé",customSubtitle:"Ajoutez n'importe quel serveur MCP stdio, HTTP ou SSE.",customAction:"Personnalisé",importAction:"Importer",serverName:"Nom du serveur",serverUrl:"URL",transport:"Transport",command:"Commande",args:"Args JSON",headers:"Headers JSON",env:"Env JSON",timeout:"Délai d'outil",advancedOptions:"Options avancées",hideAdvanced:"Masquer les options avancées",saveCustom:"Enregistrer MCP",configImport:"Importer mcp.json",importConfig:"Importer",restartRequired:"Redémarrez nanobot pour connecter les outils MCP mis à jour.",toolsFound:"{{count}} outils",loading:"Chargement des presets MCP...",empty:"Aucun preset MCP ne correspond à ce filtre.",openDocs:"Ouvrir la doc",test:"Tester",remove:"Supprimer",enable:"Activer",enabled:"Activé",setup:"Connecter",configure:"Connecter",connectTitle:"Connecter {{name}}",connectHint:"Ajoutez la clé depuis les paramètres de votre compte.",saveAndEnable:"Enregistrer et activer",updateSetup:"Mettre à jour la configuration",configured:"configuré",keepExisting:"Laissez vide pour conserver la valeur actuelle",statusConfigured:"Configuré",statusMissingCredentials:"Clé requise",statusMissingDependency:"Dépendance requise",statusComingSoon:"Bientôt disponible",statusNotInstalled:"Non activé",toolScope:"Outils",allTools:"Tous",noTools:"Aucun",testForTools:"Exécutez Tester pour inspecter et choisir des outils individuels."},legal:{thirdPartyBrands:"Les noms, logos et marques de produits appartiennent à leurs propriétaires respectifs. Leur utilisation sert uniquement à l'identification et n'implique aucune approbation."},apps:{description:"Ajoutez des CLI d’apps et services MCP utilisables par nanobot depuis le chat.",cliLabel:"CLI",mcpLabel:"MCP",filterAll:"Tout",filterCli:"Apps CLI",filterMcp:"Services MCP",enabledSummary:"{{count}} activés",caption:"{{cli}} CLI · {{mcp}} MCP",searchPlaceholder:"Rechercher des apps",featured:"À la une",loading:"Chargement des apps...",empty:"Aucune app ne correspond."},automations:{filters:{all:"Toutes",active:"Actives",paused:"En pause",failed:"À traiter",system:"Système"},sort:{next:"Prochaine exécution",last:"Dernière exécution",updated:"Mise à jour",name:"Nom"},search:"Rechercher tâche, message, discussion liée ou planning",queue:"File",loading:"Chargement des automatisations...",noMatches:"Aucune automatisation ne correspond à cette vue.",empty:"Aucune automatisation pour le moment.",emptyHint:"Créez-la depuis son point d'exécution pour que nanobot conserve le bon contexte.",oneShot:"Ponctuelle",systemTask:"Automatisation gérée par le système",labels:{schedule:"Planning",next:"Prochaine",origin:"Discussion liée",created:"Créée",updated:"Modifiée"},runNow:"Exécuter maintenant",pause:"Mettre en pause",resume:"Reprendre",edit:"Modifier",delete:"Supprimer",protected:"Protégée",editTitle:"Modifier l’automatisation",save:"Enregistrer",deleteTitle:"Supprimer l’automatisation",deleteDescription:"Cela supprime {{name}} du stockage cron. Les anciens messages de chat restent dans la session.",cancel:"Annuler",status:{system:"Système",running:"En cours d’exécution",paused:"En pause",failed:"Échouée",completed:"Terminée",noSchedule:"Aucun planning",active:"En cours"},origin:{system:"Système",unknown:"Aucune discussion liée"},channels:{api:"API",cli:"CLI",dingtalk:"DingTalk",discord:"Discord",email:"Email",feishu:"Feishu",matrix:"Matrix",msteams:"Microsoft Teams",qq:"QQ",slack:"Slack",telegram:"Telegram",wechat:"WeChat",wecom:"WeCom",weixin:"WeChat",whatsapp:"WhatsApp"},schedule:{at:"À {{time}}",every:"Toutes les {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",withTz:"{{summary}} · {{tz}}",dailyAt:"Chaque jour à {{time}}",weekdaysAt:"Jours ouvrés à {{time}}",hourlyAt:"Toutes les heures à :{{minute}}",hourlyWindow:"Toutes les heures {{start}}-{{end}} à :{{minute}}",custom:"Planning personnalisé"},next:{paused:"En pause",pending:"En cours d’exécution",none:"Aucune prochaine exécution"},message:{showMore:"Afficher le message complet",showLess:"Afficher moins"},fields:{name:"Nom",message:"Message",scheduleType:"Type de planning",every:"Toutes les",unit:"Unité",cronExpression:"Expression cron",timezone:"Fuseau horaire",runAt:"Exécuter à"},scheduleTypes:{every:"Intervalle",cron:"Cron",at:"Une fois"},everyUnits:{second:"Secondes",minute:"Minutes",hour:"Heures",day:"Jours"},validation:{nameRequired:"Le nom est obligatoire.",messageRequired:"Le message est obligatoire.",intervalRequired:"L’intervalle doit être un nombre positif.",cronRequired:"L’expression cron est obligatoire.",timeRequired:"L’heure d’exécution est obligatoire.",futureRequired:"L’heure d’exécution doit être dans le futur."}},oauth:{authentication:"Authentification OAuth",signIn:"Se connecter",signingIn:"Connexion...",signInAgain:"Se reconnecter",signOut:"Se déconnecter",signedInAs:"Connecté en tant que {{account}}",signInHelp:"Inicia sesión desde este dispositivo; no se guarda API key en config.",signInRequired:"Connexion requise",signInBeforeSaving:"Inicia sesión antes de guardar este proveedor OAuth como proveedor activo.",signedIn:"Connecté",notSignedIn:"Non connecté"},skills:{description:"Consultez les compétences d’instruction que cet agent peut charger pendant une conversation.",caption:"{{available}} disponibles · {{total}} au total",featured:"Compétences agent",empty:"Aucune compétence disponible.",sourceWorkspace:"Personnalisée",sourceBuiltin:"Intégrée",statusAvailable:"Disponible",statusUnavailable:"Indisponible",unavailableReason:"Manquant : {{reason}}",openDetails:"Ouvrir les détails de {{name}}",loadingDetail:"Chargement des détails...",loadFailed:"Impossible de charger les détails.",descriptionTitle:"Description",source:"Source",status:"Statut",requirements:"Prérequis",noRequirements:"Aucun prérequis explicite.",commands:"Commandes",environment:"Variables d’environnement",missingCommands:"CLI manquant",missingEnvironment:"ENV manquant",unavailableReasonLabel:"Raison d’indisponibilité",rawInstructions:"SKILL.md brut",rawInstructionsEmpty:"Aucune instruction brute.",detailDescription:"Détails de {{name}}."},voice:{selectProvider:"Choisir un fournisseur",configureProvider:"Configurer le fournisseur",languageAuto:"Auto"}},QT={fallbackTitle:"Discussion {{id}}",forkTitle:"Branche : {{title}}",loading:"Chargement…",noSessions:"Aucune session pour le moment.",showMore:"Afficher {{count}} de plus",collapsed:"{{count}} discussions masquées",showLess:"Afficher moins",actions:"Actions de la discussion {{title}}",newInProject:"Démarrer une nouvelle discussion dans {{project}}",activity:{running:"Agent running",complete:"Agent finished",updated:"New activity"},pin:"Pin",unpin:"Unpin",rename:"Rename",renameTitle:"Rename chat",renameDescription:"Choose a local sidebar name for this chat.",renamePlaceholder:"Chat name",renameProjectTitle:"Rename project",renameProjectDescription:"Choose a local sidebar name for this project.",renameProjectPlaceholder:"Project name",renameSave:"Save",archive:"Archive",unarchive:"Unarchive",showArchived:"Show archived",hideArchived:"Hide archived",delete:"Supprimer",newChat:"Nouvelle discussion",groups:{pinned:"Pinned",all:"Chats",projects:"Projects",today:"Today",yesterday:"Yesterday",earlier:"Earlier",archived:"Archived"}},XT={title:"Supprimer cette discussion ?",description:"Cette action est irréversible.",cancel:"Annuler",confirm:"Supprimer",automationsDescription:"Cette discussion contient des automatisations planifiées. La supprimer les supprimera aussi.",moreAutomations:"+ {{count}} autres",confirmWithAutomations:"Supprimer",schedule:{at:"{{time}}",every:"Tous les {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"Planification personnalisée"},next:{label:"Prochaine exécution : {{time}}",disabled:"En pause",none:"Aucune prochaine exécution"}},JT={idle:"Inactif",connecting:"Connexion…",open:"Connecté",reconnecting:"Reconnexion…",closed:"Déconnecté",error:"Erreur de connexion"},ZT={loadingConversation:"Chargement de la conversation…",empty:{greetings:{workOn:"Sur quoi travaillons-nous ensemble ?",start:"Par où commence-t-on ?",build:"Que construisons-nous aujourd'hui ?",tackle:"Que résout-on ensemble ?"},quickActions:{plan:{title:"Créer un plan de projet",prompt:"Créez un plan de projet concis pour ce que je devrais construire ensuite."},analyze:{title:"Analyser ces données",prompt:"Aidez-moi à analyser ces données et à faire ressortir les tendances les plus importantes."},brainstorm:{title:"Trouver des idées",prompt:"Proposez quelques idées pratiques et leurs compromis pour ce problème."},code:{title:"Écrire du code",prompt:"Aidez-moi à écrire le code pour cette tâche, en commençant par le plus petit changement utile."},summarize:{title:"Résumer ce document",prompt:"Résumez ce document et listez les points clés à retenir."},more:{title:"Plus",prompt:"Montrez-moi quelques façons utiles dont vous pouvez m’aider dans cet espace de travail."}},imageQuickActions:{icon:{title:"Créer une icône d’app",prompt:"Générez une icône d’application 1:1 propre pour nanobot : robot sympathique, style vectoriel simple, palette douce bleu et blanc, sans texte."},sticker:{title:"Créer un sticker",prompt:"Générez une image façon sticker d’un petit assistant robot, avec un fond d’apparence transparente, expressive et ludique."},poster:{title:"Créer une affiche",prompt:"Générez un concept d’affiche soigné pour un assistant IA personnel, composition moderne, hiérarchie visuelle forte, adapté à une landing page."},product:{title:"Maquette produit",prompt:"Générez une maquette produit propre pour une application web d’IA conversationnelle, interface minimale, éclairage premium, cadre d’appareil réaliste."},portrait:{title:"Portrait stylisé",prompt:"Générez un portrait stylisé d’un compagnon IA sympathique, lumière douce, détaillé mais accessible, style illustration moderne."},edit:{title:"Modifier une image",prompt:"Aidez-moi à modifier une image. Demandez-moi d’abord de téléverser ou d’indiquer l’image, puis générez le résultat modifié."}}},header:{toggleSidebar:"Afficher ou masquer la barre latérale",newChat:"Démarrer un nouveau chat",toggleTheme:"Changer le thème depuis l’en-tête",settings:"Ouvrir les paramètres",sessionInfo:"Détails de la session"},sessionInfo:{title:"Session",untitled:"Chat sans titre",automations:"Automatisations",count:"{{count}}",loading:"Chargement des automatisations...",loadFailed:"Impossible de charger les automatisations.",empty:"Aucune automatisation dans cette session pour le moment.",disabled:"Désactivé",schedule:{at:"À {{time}}",every:"Toutes les {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"Planification personnalisée"},next:{label:"Prochaine {{time}}",pending:"Exécution imminente",disabled:"En pause",none:"Aucune prochaine exécution"}},composer:{placeholderThread:"Saisissez votre message…",placeholderHero:"Qu’avez-vous en tête ?",placeholderOpening:"Ouverture d’une nouvelle discussion…",placeholderStreaming:"Le modèle est en train de répondre…",inputAria:"Champ de message",sendHint:"Entrée pour envoyer · Maj+Entrée pour un retour à la ligne",runRuntimeTitle:"Exécution · {{elapsed}}",goalStateStrip:"Objectif · {{label}}",goalStateFallback:"Objectif",goalStateExpandAria:"Afficher l’objectif complet",goalStateSheetTitle:"Objectif",goalStateCloseAria:"Fermer l’objectif",send:"Envoyer le message",stop:"Arrêter la réponse",modelNotConfigured:"Modèle non configuré",configureModel:"Configurer le modèle",queued:{label:"Guidage en attente",guide:"Guider",delete:"Supprimer le guidage",edit:"Modifier le guidage",drag:"Faire glisser pour réordonner"},attachImage:"Joindre une image",imageMode:{label:"Génération d’image",toggle:"Activer ou désactiver le mode génération d’image",placeholder:"Décrire ou modifier une image…",aspectAria:"Format de l’image",aspectLabel:"Format de l’image",aspect:{auto:"Auto","1_1":"Carré 1:1","3_4":"Portrait 3:4","9_16":"Story 9:16","4_3":"Paysage 4:3","16_9":"Large 16:9"}},tools:{search:"Rechercher",reason:"Raisonner",deepResearch:"Recherche approfondie",voice:"Entrée vocale"},voice:{hint:"Cliquez pour dicter ou maintenez",stop:"Arrêter l'enregistrement",transcribing:"Transcription...",recordingStatus:"Enregistrement {{time}}"},voiceErrors:{unsupported:"La saisie vocale n'est pas prise en charge par ce navigateur.",permission:"L'autorisation du microphone est requise.",notConfigured:"Configurez d'abord un fournisseur de transcription.",tooLong:"L'enregistrement est trop long.",tooShort:"Maintenez un peu plus longtemps pour enregistrer la voix.",noInput:"Aucune entrée microphone détectée.",failed:"Impossible de transcrire l'audio."},slash:{ariaLabel:"Commandes slash",label:"commandes",navigateHint:"↑↓ Naviguer",selectHint:"Entrée/Tab Insérer",closeHint:"Échap Fermer",commands:{new:{title:"Nouvelle discussion",description:"Arrêter la tâche en cours et démarrer une nouvelle conversation."},stop:{title:"Arrêter la tâche en cours",description:"Annuler le tour agent actif pour cette discussion."},restart:{title:"Redémarrer nanobot",description:"Redémarrer le processus du bot sur place."},status:{title:"Afficher l’état",description:"Afficher l’état du runtime, du provider et des channels."},model:{title:"Modèle",description:"Afficher ou changer le préréglage de modèle actif."},history:{title:"Afficher l’historique",description:"Afficher les N derniers messages persistés de la conversation."},dream:{title:"Lancer Dream",description:"Déclencher manuellement la consolidation de la mémoire."},dream_log:{title:"Afficher le journal Dream",description:"Afficher ce que la dernière consolidation Dream a changé."},dream_restore:{title:"Restaurer la mémoire",description:"Revenir à un instantané Dream précédent."},goal:{title:"Objectif long terme",description:"Demandez à l’agent de traiter ceci comme un objectif multi‑étapes durable."},help:{title:"Afficher l’aide",description:"Lister les commandes slash disponibles."},pairing:{title:"Appairage",description:"Gérer les demandes d’appairage."}},badges:{current:"Actuel",recent:"Récent"},details:{goalActive:"L’objectif est en cours",goalReady:"Démarrer un objectif durable",history:"Afficher les messages récents",stopRunning:"En cours"}},encoding:"Traitement…",remove:"Retirer la pièce jointe",normalizedSizeHint:"{{orig}} → {{current}} (auto)",imageRejected:{unsupported_type:"Type de fichier non pris en charge",too_many_images:"Maximum {{max}} images par message",magic_mismatch:"Ce fichier n'est pas une image",decode_failed:"Impossible de décoder cette image",too_large:"Image trop grande — essayez-en une plus petite",io:"Impossible de lire ce fichier"},mentions:{ariaLabel:"Apps",label:"Apps",cliGroup:"Apps CLI",mcpGroup:"Services MCP",cliBadge:"CLI",mcpBadge:"MCP",cliDescription:"Utiliser @{{name}} comme app CLI locale",mcpDescription:"Utiliser @{{name}} comme serveur MCP"},workspace:{accessAria:"Workspace access mode",projectAria:"Choisir un projet",projectPlaceholder:"Sélectionner un projet",default:"Default Permission",full:"Full Access"}},scrollToBottom:"Faire défiler vers le bas",loadEarlier:"Charger les messages précédents",forkedFromHistory:"Bifurqué depuis l'historique",promptNavigator:{open:"Ouvrir le navigateur de prompts",title:"Prompts",search:"Rechercher des prompts",noResults:"Aucun prompt correspondant.",jumpTo:"Aller au prompt : {{label}}"}},eR={streaming:"en cours de génération",assistantTyping:"L’assistant est en train d’écrire",toolSingle:"Utilisation d’un outil",toolMany:"{{count}} outils utilisés",toolSummary:"{{count}} outil",toolSummaryMany:"{{count}} outils",reasoningTools:"Raisonnement · {{count}} outils",reasoningToolsSingular:"Raisonnement · 1 outil",reasoning:"Raisonnement",reasoningStreaming:"En réflexion…",reasoningSummary:"Raisonnement",agentActivitySummary:"{{reasoning}} étapes · {{tools}} appels d’outils",agentActivityToolsOnly:"{{tools}} appels d’outils",agentActivityLiveSummary:"En cours… · {{reasoning}} étapes · {{tools}} appels d’outils",agentActivityLiveToolsOnly:"En cours… · {{tools}} appels d’outils",imageAttachment:"Pièce jointe image",forkFromHere:"Bifurquer",copyReply:"Copier",copiedReply:"Copié",turnLatencyTitle:"Temps de réponse (de bout en bout)",activityThinkingFor:"Réflexion pendant {{duration}}",activityThought:"Réflexion terminée",activityThoughtFor:"Réflexion terminée en {{duration}}",activityWorkingFor:"Travail en cours depuis {{duration}}",activityWorked:"Travail terminé",activityWorkedFor:"Travail terminé en {{duration}}",cliActivityRunningOne:"Utilisation de @{{name}}",cliActivityRanOne:"@{{name}} utilisé",cliActivityFailedOne:"Échec de @{{name}}",cliActivityRunningMany:"Utilisation de {{count}} apps CLI",cliActivityRanMany:"{{count}} apps CLI utilisées",cliActivityFailedMany:"Échec de {{count}} apps CLI",cliRunRunning:"Utilisation",cliRunRan:"Utilisé",cliRunFailed:"Échec",automationSourceFallback:"Automatisation",automationTriggered:"Déclenché automatiquement"},tR={title:"Aperçu de l’image",open:"Voir l’image",prev:"Image précédente",next:"Image suivante",close:"Fermer l’aperçu"},nR={aria:"Aperçu du fichier",close:"Fermer l’aperçu du fichier",loading:"Chargement de l’aperçu...",failed:"Impossible de prévisualiser ce fichier.",routeMissing:"L’aperçu du fichier nécessite le dernier gateway. Redémarrez nanobot gateway puis réessayez.",resize:"Redimensionner l’aperçu du fichier",truncated:"L’aperçu est tronqué car le fichier est volumineux."},rR={fallbackLanguage:"code",copyAria:"Copier le code",copy:"Copier",copied:"Copié"},aR={dismiss:"Fermer"},oR={messageTooBig:{title:"Message trop volumineux",body:"Le serveur a rejeté votre dernier message car il dépasse la taille autorisée. Retirez des images ou choisissez des fichiers plus légers, puis renvoyez-le."},workspaceScopeRejected:{title:"Workspace was not changed",body:"Nanobot kept the previous workspace because the requested project or access mode was rejected by the gateway."}},sR={dialog:{defaultProject:"Default workspace",manual:"Coller un chemin",manualPlaceholder:"/Users/name/project",usePath:"Use Path",absolutePathRequired:"Enter an absolute folder path on this machine."}},iR={app:KT,sidebar:GT,settings:YT,chat:QT,deleteConfirm:XT,connection:JT,thread:ZT,message:eR,lightbox:tR,filePreview:nR,code:rR,common:aR,errors:oR,workspace:sR},lR={brand:"nanobot",loading:{connecting:"nanobot に接続中…",boot:"nanobot を読み込み中…"},error:{title:"nanobot に接続できませんでした",gatewayHint:"gateway(`nanobot gateway`)が起動しており、このページが同じマシン上で開かれていることを確認してください。"},auth:{title:"認証が必要です",hint:"gateway 設定の tokenIssueSecret に指定されたシークレットを入力してください。",placeholder:"パスワード",submit:"接続",invalid:"パスワードが無効です。もう一度お試しください。"},account:{section:"アカウント",logoutHint:"このブラウザーを gateway から切断します。",logout:"サインアウト"},system:{section:"システム",restartHint:"実行時の変更を適用するには nanobot を再起動します。",restart:"nanobot を再起動",restarting:"再起動中...",restartEngine:"エンジンを再起動",restartingEngine:"エンジンを再起動中..."},restart:{completed:"{{seconds}} 秒で再起動が完了しました。"},documentTitle:{base:"nanobot",chat:"{{title}} · nanobot"},meta:{description:"nanobot Web UI — nanobot ワークスペースと会話します。"}},cR={navigation:"サイドバーのナビゲーション",collapse:"サイドバーを閉じる",newChat:"新しいチャット",searchAria:"検索",searchPlaceholder:"検索",searchResults:"検索結果",noSearchResults:"一致するチャットはありません。",recent:"最近のチャット",settings:"設定",language:{label:"言語",ariaLabel:"言語を変更"},apps:"アプリ",automations:"自動タスク",skills:{title:"スキル"}},uR={backToChat:"チャットに戻る",sidebar:{title:"設定",ariaLabel:"設定セクション"},nav:{general:"一般",byok:"BYOK",overview:"概要",appearance:"外観",models:"モデル",providers:"プロバイダー",image:"画像",voice:"音声",browser:"ウェブ",runtime:"システム",advanced:"セキュリティ",cliApps:"CLI アプリ",mcp:"MCP",apps:"アプリ",automations:"自動タスク",skills:"スキル"},sections:{interface:"インターフェース",ai:"AI",system:"システム",about:"情報",status:"状態",localPreferences:"ローカル設定",presets:"プリセット",imageGeneration:"画像生成",imageDefaults:"既定値",webSearch:"ウェブ検索",webBehavior:"動作",identity:"ID",webuiSafety:"WebUI の安全性",capabilities:"機能",cliApps:"CLI アプリ",mcp:"MCP サービス",apps:"アプリ",nativeHost:"ネイティブホスト",hostSafety:"アプリの安全性",voiceInput:"音声入力"},rows:{theme:"テーマ",language:"言語",provider:"プロバイダー",model:"モデル",restart:"nanobot を再起動",configPath:"設定パス",activePreset:"アクティブなプリセット",gateway:"ゲートウェイ",restartState:"再起動状態",pendingChanges:"保留中の変更",selectedPreset:"選択中のプリセット",presetModel:"プリセットモデル",density:"表示密度",activityMode:"アクティビティ詳細",codeWrap:"コードの折り返し",maxResults:"最大結果数",timeout:"タイムアウト",jinaReader:"Jina リーダー",imageGeneration:"画像生成",imageProvider:"画像プロバイダー",imageProviderStatus:"プロバイダー状態",imageProviderBase:"プロバイダー URL",imageModel:"画像モデル",defaultAspectRatio:"既定の比率",defaultImageSize:"既定のサイズ",maxImagesPerTurn:"1 ターンの最大画像数",imageSaveDir:"保存先ディレクトリ",botName:"Bot 名",botIcon:"Bot アイコン",timezone:"タイムゾーン",workspacePath:"既定のワークスペース",localServiceAccess:"ローカルサービス",webuiDefaultAccess:"既定の権限",currentModel:"現在の設定",brandLogos:"ブランドロゴ",cliAppsCatalog:"カタログ",cliAppsFilter:"フィルター",engine:"エンジン",logs:"ログ",diagnostics:"診断",contextWindow:"コンテキストウィンドウ",transcription:"文字起こし",transcriptionProvider:"プロバイダー",transcriptionProviderStatus:"プロバイダー状態",transcriptionModel:"モデル",transcriptionLanguage:"言語",voiceLimits:"制限"},help:{theme:"ライト表示とダーク表示を切り替えます。",language:"WebUI で使用する言語を選択します。",provider:"新しいモデルリクエストに使うプロバイダーを選択します。",model:"nanobot が既定で使用するモデル名を設定します。",configPath:"現在ゲートウェイが使用している設定ファイルです。",selectedPreset:"名前付きプリセットはここでは読み取り専用です。編集するには config.json を変更してください。",presetModel:"Default に切り替えると、WebUI からモデルとプロバイダーを編集できます。",density:"このブラウザーにのみ保存されます。",activityMode:"既定で表示する agent アクティビティの詳細量を選択します。",codeWrap:"小さな画面でも長いコード行を読みやすくします。",maxResults:"各 web_search 呼び出しで返す結果数です。",timeout:"検索プロバイダーのリクエストがタイムアウトするまでの秒数です。",jinaReader:"利用可能な場合、web_fetch に Jina Reader を使います。",imageGeneration:"画像プロバイダーが設定済みのとき、チャットで generate_image を有効にします。",imageProvider:"generate_image で使用する登録済みプロバイダーを選択します。",imageProviderStatus:"画像生成は「プロバイダー」の認証情報を再利用します。",imageModel:"選択した画像プロバイダーへ送信するモデル名です。",defaultAspectRatio:"プロンプトで比率が指定されていない場合に使用します。",defaultImageSize:"対応しているプロバイダーへ送信するサイズ指定です。",maxImagesPerTurn:"1 回の generate_image リクエストで生成できる画像数の上限です。",botName:"nanobot が表示名を使う場所に表示されます。",botIcon:"Bot 名の横に表示する短い emoji またはテキストです。",timezone:"スケジュールと時刻を考慮する返信に使用します。",localServiceAccess:"Full Access の shell コマンドが localhost サービスにアクセスできるようにします。",webuiDefaultAccess:"プロジェクト固有の権限がない Web チャットで使用します。",securityManagedControls:"Web 取得は常にローカル、プライベート、メタデータサービスを保護します。コアチャネルの安全性は config.json で管理されます。",currentModel:"新しい返信に使用します。",selectedModelProvider:"選択したモデルによって設定されます。",selectedModelValue:"選択したモデルによって設定されます。",brandLogos:"設定で第三者プロバイダーと CLI のロゴを表示します。",cliAppsCatalog:"nanobot がローカルで実行できるアプリ CLI アダプターだけをインストールします。ネイティブアプリは変更しません。",cliAppsFilter:"アプリ、カテゴリ、機能で検索します。",logs:"ネイティブエンジンのログフォルダーを開きます。",diagnostics:"サポート用の小さなランタイムレポートを書き出します。",localServiceAccessNative:"Full Access の shell コマンドがこの Mac 上のサービスにアクセスできるようにします。",webuiDefaultAccessNative:"プロジェクト固有の権限がないネイティブチャットで使用します。",contextWindow:"このモデル設定で使う既定のコンテキスト予算を選択します。",transcription:"マイク入力を送信前に文字起こしします。チャネルの音声メッセージも同じ設定を使います。",transcriptionProvider:"プロバイダー設定にある対応する認証情報を使います。",transcriptionProviderStatus:"APIキーは文字起こし設定ではなくプロバイダー側に保存されます。",transcriptionModel:"プロバイダーがカスタムモデルIDを必要としない限り、解決済みのデフォルトのままにします。",transcriptionLanguage:"en、zh、ja、ko などの任意の ISO-639 ヒント。"},values:{light:"ライト",dark:"ダーク",notAvailable:"利用不可",enabled:"有効",disabled:"無効",restartPending:"再起動待ち",ready:"準備完了",privateEngine:"プライベートエンジン",unixSocket:"Unix ソケット",defaultWorkspace:"デフォルトワークスペース",comfortable:"標準",compact:"コンパクト",auto:"自動",expanded:"展開",on:"オン",off:"オフ",defaultPermission:"既定の権限",fullAccess:"完全アクセス",configured:"設定済み",notConfigured:"未設定",pending:"保留中",restartingEngine:"再起動中"},status:{loading:"設定を読み込んでいます...",loadError:"設定を読み込めませんでした",unsaved:"未保存の変更があります。",upToDate:"最新です。",savedRestart:"保存しました。反映するには nanobot を再起動してください。",restartAfterSaving:"変更を保存してから、準備ができたら再起動してください。",savedRestartApply:"保存しました。準備ができたら再起動してください。",imageProviderRestart:"画像プロバイダーの変更を保存しました。準備ができたら再起動してください。",hostRestartAfterSaving:"保存すると nanobot がエンジンを再起動します。",hostRestartPending:"保存しました。準備ができたらエンジンを再起動します。",hostApiUnavailable:"ホスト操作はネイティブアプリ内でのみ利用できます。",logsOpened:"ログフォルダーを開きました。",logsOpenFailed:"ログフォルダーを開けませんでした。",diagnosticsExported:"診断を {{path}} に書き出しました。",diagnosticsExportFailed:"診断を書き出せませんでした。"},actions:{save:"保存",saving:"保存中",edit:"編集",cancel:"キャンセル",open:"開く",export:"書き出す",opening:"開いています...",exporting:"書き出しています..."},byok:{description:"自分の provider キーを使います。Nanobot は現在の config から値を読み込み、設定済みの provider だけを一般設定で選択できます。",configured:"設定済み",notConfigured:"未設定",configuredSection:"設定済み",notConfiguredSection:"未設定",showMore:"さらに {{count}} 件表示",showLess:"折りたたむ",apiKey:"API key",apiBase:"API base",apiKeyPlaceholder:"API key を入力",apiKeyConfiguredPlaceholder:"空欄のままなら現在の key を保持",configuredKeyHint:"設定済み key",apiBasePlaceholder:"provider の既定値を使用",apiKeyRequired:"この provider を設定するには API key が必要です。",showApiKey:"API key を表示",hideApiKey:"API key を隠す",noConfiguredProviders:"設定済み provider がありません",configureFirst:"先に BYOK で provider を設定してください。",openByok:"BYOK を開く",tabs:{ariaLabel:"BYOK 認証情報タイプ",llm:"LLM",webSearch:"ウェブ検索"},webSearch:{provider:"検索 provider",providerHelp:"web search ツールで使うバックエンドを選択します。",selectProvider:"provider を選択",credentials:"認証情報",noCredentialRequired:"key は不要",noCredentialHelp:"DuckDuckGo は API key を保存せずに使えます。",apiKeyHelp:"config に保存され、保存後はマスク表示されます。",baseUrl:"Base URL",baseUrlHelp:"SearXNG には自分のインスタンス URL が必要です。",baseUrlPlaceholder:"https://search.example.com",apiKeyRequired:"この検索 provider には API key が必要です。",baseUrlRequired:"SearXNG には Base URL が必要です。",missingCredential:"保存する前に必要な認証情報を入力してください。",saveHint:"変更は新しい web search リクエストに適用されます。"}},overview:{model:"現在のモデル",providers:"プロバイダー",configuredCount:"{{count}} 個設定済み",totalProviders:"{{count}} 個利用可能",webSearch:"Web 検索",imageGeneration:"画像生成",voiceInput:"音声入力",workspace:"ワークスペース"},usage:{title:"Token アクティビティ",shortTitle:"Token Usage",subtitle:"直近 12 か月にプロバイダーが報告した使用量。",empty:"新しいモデル返信の後に token アクティビティが表示されます。",totalTokens:"累計 Token 数",peakTokens:"ピーク Token 数",thirtyDayTokens:"30 日 Token 数",currentStreak:"現在の連続日数",longestStreak:"最長連続日数",daysValue:"{{count}} 日",last30:"30 日",activeDays:"アクティブ日数",requests:"リクエスト",estimated:"推定",includesEstimates:"推定を含む",cellTitle:"{{date}}: {{tokens}} tokens, {{requests}} 件のリクエスト",sources:{user:"チャット",api:"API",cron:"自動タスク",dream:"メモリ整理",system:"システム"}},providers:{searchPlaceholder:"プロバイダーを検索",noMatches:"一致するプロバイダーはありません。",saveProvider:"プロバイダーを保存"},image:{selectProvider:"プロバイダーを選択",selectAspect:"比率を選択",selectSize:"サイズを選択",configureProvider:"プロバイダーを設定",missingCredential:"画像生成を有効にする前に、このプロバイダーを設定してください。"},models:{selectModel:"モデルを選択",addConfiguration:"設定を追加",newConfiguration:"新しいモデル設定",newConfigurationHelp:"プロバイダーとモデルをワンクリックの選択肢として保存します。",configurationName:"設定名",configurationNameHelp:"保存済みのモデル設定の名前を変更します。",configurationNamePlaceholder:"高速執筆",searchModels:"モデル ID を検索または入力",useCustomModel:"使用",loadingModels:"モデルを読み込んでいます...",searchCatalog:"プロバイダーのカタログからモデルを選択します。",modelsAvailable:"利用可能",noModelResults:"一致するモデルはありません。",loadFailed:"モデル一覧を利用できません。",unsupportedModelList:"モデル ID を手動で入力してください。",providerNotConfigured:"モデルを読み込む前にこのプロバイダーを設定してください。",autoProviderCustomOnly:"自動プロバイダーモードではカスタムモデル ID を使用します。"},timezone:{select:"タイムゾーンを選択",search:"タイムゾーンを検索",empty:"一致するタイムゾーンはありません。"},cliApps:{allCategories:"すべてのカテゴリ",availableCount:"{{count}} 個のアプリ",installedCount:"{{count}} 個インストール済み",summary:"{{total}} 個中 {{installed}} 個の CLI がインストール済み",filterAll:"すべて",filterInstalled:"インストール済み CLI",filterNotInstalled:"未インストール",searchPlaceholder:"CLI を検索",statusInstalled:"インストール済み",statusAvailable:"利用可能",statusMissing:"依存関係が不足",statusUnsupported:"未対応",statusNotInstalled:"未インストール",unsupported:"未対応",loading:"CLI アプリを読み込み中...",empty:"この条件に一致する CLI アプリはありません。",readyTitle:"@{{name}} の準備ができました",readyStatus:"準備完了",readyPrompt:"@{{name}} を使って、この CLI でできることを確認します。",readyTry:"@{{name}} を試す",readyCopied:"コピーしました",openChat:"チャットを開く",requires:"必要条件",test:"CLI をテスト",update:"CLI を更新",uninstall:"CLI をアンインストール",install:"CLI をインストール",unavailable:"利用不可",noDescription:"説明はありません。"},about:{version:"バージョン",checking:"確認中...",checkForUpdates:"アップデートを確認",upToDate:"最新の状態です",updateAvailable:"アップデートがあります v{{version}}"},mcp:{allCategories:"すべてのカテゴリ",summary:"{{total}} 個中 {{installed}} 個のプリセットが有効",filterAll:"すべて",filterInstalled:"有効",filterNotInstalled:"未有効",searchPlaceholder:"MCP プリセットを検索",moreOptions:"その他の MCP オプション",moreOptionsSubtitle:"カスタムサーバーを追加するか mcp.json をインポートします。",customTitle:"カスタム MCP",customSubtitle:"任意の stdio、HTTP、SSE MCP サーバーを追加します。",customAction:"カスタム",importAction:"インポート",serverName:"サーバー名",serverUrl:"URL",transport:"トランスポート",command:"コマンド",args:"Args JSON",headers:"Headers JSON",env:"Env JSON",timeout:"ツールのタイムアウト",advancedOptions:"詳細オプション",hideAdvanced:"詳細を隠す",saveCustom:"MCP を保存",configImport:"mcp.json をインポート",importConfig:"インポート",restartRequired:"更新された MCP ツールに接続するには nanobot を再起動してください。",toolsFound:"{{count}} 個のツール",loading:"MCP プリセットを読み込み中...",empty:"この条件に一致する MCP プリセットはありません。",openDocs:"ドキュメントを開く",test:"テスト",remove:"削除",enable:"有効化",enabled:"有効",setup:"接続",configure:"接続",connectTitle:"{{name}} に接続",connectHint:"アカウント設定からキーを追加します。",saveAndEnable:"保存して有効化",updateSetup:"設定を更新",configured:"設定済み",keepExisting:"既存の値を維持するには空欄のままにします",statusConfigured:"設定済み",statusMissingCredentials:"キーが必要",statusMissingDependency:"依存関係が必要",statusComingSoon:"近日公開",statusNotInstalled:"未有効",toolScope:"ツール",allTools:"すべて",noTools:"なし",testForTools:"テストを実行して個別のツールを確認・選択します。"},legal:{thirdPartyBrands:"製品名、ロゴ、ブランドはそれぞれの所有者に帰属します。使用は識別のみを目的とし、承認を意味するものではありません。"},apps:{description:"nanobot がチャットで使用できる App CLI と MCP サービスを追加します。",cliLabel:"CLI",mcpLabel:"MCP",filterAll:"すべて",filterCli:"CLI アプリ",filterMcp:"MCP サービス",enabledSummary:"{{count}} 件有効",caption:"CLI {{cli}} 件 · MCP {{mcp}} 件",searchPlaceholder:"アプリを検索",featured:"注目",loading:"アプリを読み込み中...",empty:"一致するアプリはありません。"},automations:{filters:{all:"すべて",active:"実行中",paused:"一時停止",failed:"要対応",system:"システム"},sort:{next:"次回実行",last:"前回実行",updated:"更新日時",name:"名前"},search:"タスク、メッセージ、関連チャット、予定を検索",queue:"キュー",loading:"自動タスクを読み込み中...",noMatches:"この表示に一致する自動タスクはありません。",empty:"自動タスクはまだありません。",emptyHint:"実行元から作成すると、nanobot が正しいコンテキストを保持できます。",oneShot:"一回限り",systemTask:"システム管理の自動タスク",labels:{schedule:"スケジュール",next:"次回",origin:"関連チャット",created:"作成",updated:"更新"},runNow:"今すぐ実行",pause:"一時停止",resume:"再開",edit:"編集",delete:"削除",protected:"保護済み",editTitle:"自動タスクを編集",save:"保存",deleteTitle:"自動タスクを削除",deleteDescription:"{{name}} を cron ストアから削除します。過去のチャットメッセージはセッションに残ります。",cancel:"キャンセル",status:{system:"システム",running:"実行中",paused:"一時停止",failed:"失敗",completed:"完了",noSchedule:"スケジュールなし",active:"実行中"},origin:{system:"システム",unknown:"関連チャットなし"},channels:{api:"API",cli:"CLI",dingtalk:"DingTalk",discord:"Discord",email:"Email",feishu:"Feishu",matrix:"Matrix",msteams:"Microsoft Teams",qq:"QQ",slack:"Slack",telegram:"Telegram",wechat:"WeChat",wecom:"WeCom",weixin:"WeChat",whatsapp:"WhatsApp"},schedule:{at:"{{time}}",every:"{{duration}} ごと",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",withTz:"{{summary}} · {{tz}}",dailyAt:"毎日 {{time}}",weekdaysAt:"平日 {{time}}",hourlyAt:"毎時 :{{minute}}",hourlyWindow:"{{start}}-{{end}} の毎時 :{{minute}}",custom:"カスタムスケジュール"},next:{paused:"一時停止",pending:"実行中",none:"次回実行なし"},message:{showMore:"メッセージ全文を表示",showLess:"折りたたむ"},fields:{name:"名前",message:"メッセージ",scheduleType:"スケジュール種別",every:"間隔",unit:"単位",cronExpression:"Cron 式",timezone:"タイムゾーン",runAt:"実行日時"},scheduleTypes:{every:"間隔",cron:"Cron",at:"一回限り"},everyUnits:{second:"秒",minute:"分",hour:"時間",day:"日"},validation:{nameRequired:"名前は必須です。",messageRequired:"メッセージは必須です。",intervalRequired:"間隔は正の数で指定してください。",cronRequired:"Cron 式は必須です。",timeRequired:"実行日時は必須です。",futureRequired:"実行日時は現在より後にしてください。"}},oauth:{authentication:"OAuth 認証",signIn:"サインイン",signingIn:"サインイン中...",signInAgain:"再度サインイン",signOut:"サインアウト",signedInAs:"{{account}} としてサインイン済み",signInHelp:"このデバイスからサインインします。API key は config に保存されません。",signInRequired:"サインインが必要です",signInBeforeSaving:"この OAuth プロバイダーをアクティブなモデルプロバイダーとして保存する前にサインインしてください。",signedIn:"サインイン済み",notSignedIn:"未サインイン"},skills:{description:"このエージェントが会話中に読み込める指示スキルを確認します。",caption:"{{available}} 利用可能 · 合計 {{total}}",featured:"エージェントスキル",empty:"利用可能なスキルはありません。",sourceWorkspace:"カスタム",sourceBuiltin:"組み込み",statusAvailable:"利用可能",statusUnavailable:"利用不可",unavailableReason:"不足: {{reason}}",openDetails:"{{name}} の詳細を開く",loadingDetail:"スキル詳細を読み込み中...",loadFailed:"スキル詳細を読み込めませんでした。",descriptionTitle:"説明",source:"ソース",status:"状態",requirements:"要件",noRequirements:"明示的な要件はありません。",commands:"コマンド",environment:"環境変数",missingCommands:"CLI 不足",missingEnvironment:"ENV 不足",unavailableReasonLabel:"利用不可の理由",rawInstructions:"元の SKILL.md",rawInstructionsEmpty:"元の説明はありません。",detailDescription:"{{name}} の詳細。"},voice:{selectProvider:"プロバイダーを選択",configureProvider:"プロバイダーを設定",languageAuto:"自動"}},dR={fallbackTitle:"チャット {{id}}",forkTitle:"分岐:{{title}}",loading:"読み込み中…",noSessions:"まだセッションがありません。",showMore:"さらに {{count}} 件表示",collapsed:"{{count}} 件のチャットを折りたたみ中",showLess:"折りたたむ",actions:"「{{title}}」のチャット操作",newInProject:"「{{project}}」で新しいチャットを開始",activity:{running:"Agent running",complete:"Agent finished",updated:"New activity"},pin:"Pin",unpin:"Unpin",rename:"Rename",renameTitle:"Rename chat",renameDescription:"Choose a local sidebar name for this chat.",renamePlaceholder:"Chat name",renameProjectTitle:"Rename project",renameProjectDescription:"Choose a local sidebar name for this project.",renameProjectPlaceholder:"Project name",renameSave:"Save",archive:"Archive",unarchive:"Unarchive",showArchived:"Show archived",hideArchived:"Hide archived",delete:"削除",newChat:"新しいチャット",groups:{pinned:"Pinned",all:"Chats",projects:"Projects",today:"Today",yesterday:"Yesterday",earlier:"Earlier",archived:"Archived"}},pR={title:"このチャットを削除しますか?",description:"この操作は元に戻せません。",cancel:"キャンセル",confirm:"削除",automationsDescription:"このチャットにはスケジュール済みの自動タスクがあります。削除するとそれらも削除されます。",moreAutomations:"他 {{count}} 件",confirmWithAutomations:"削除",schedule:{at:"{{time}}",every:"{{duration}} ごと",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"カスタムスケジュール"},next:{label:"次回: {{time}}",disabled:"一時停止中",none:"次回実行なし"}},mR={idle:"待機中",connecting:"接続中…",open:"接続済み",reconnecting:"再接続中…",closed:"切断済み",error:"接続エラー"},fR={loadingConversation:"会話を読み込み中…",empty:{greetings:{workOn:"一緒に何に取り組みましょうか?",start:"今日はどこから始めましょう?",build:"今日は何を作りましょうか?",tackle:"一緒に何を解決しましょう?"},quickActions:{plan:{title:"プロジェクト計画を作成",prompt:"次に作るものについて、簡潔なプロジェクト計画を作成してください。"},analyze:{title:"このデータを分析",prompt:"このデータを分析し、最も重要なパターンを指摘してください。"},brainstorm:{title:"アイデアを出す",prompt:"この問題について、実用的なアイデアとトレードオフをいくつか出してください。"},code:{title:"コードを書く",prompt:"このタスクのコードを書くのを手伝ってください。まず最小限の有用な変更から始めてください。"},summarize:{title:"この文書を要約",prompt:"この文書を要約し、重要なポイントを列挙してください。"},more:{title:"その他",prompt:"このワークスペースであなたが手伝える便利な方法をいくつか見せてください。"}},imageQuickActions:{icon:{title:"アプリアイコンを作る",prompt:"nanobot のクリーンな 1:1 アプリアイコンを生成してください。親しみやすいロボット、シンプルなベクター風、柔らかい青と白の配色、文字なし。"},sticker:{title:"ステッカーを作る",prompt:"小さなロボットアシスタントのかわいいステッカー風画像を生成してください。透明風の背景で、表情豊かで遊び心のある雰囲気。"},poster:{title:"ポスターを作る",prompt:"個人向け AI アシスタントの洗練されたポスター案を生成してください。モダンな構図、強い視覚階層、ランディングページ向け。"},product:{title:"製品モックアップ",prompt:"会話型 AI Web アプリのクリーンな製品モックアップ画像を生成してください。ミニマルな UI、上質なライティング、リアルなデバイスフレーム。"},portrait:{title:"スタイル付きポートレート",prompt:"親しみやすい AI コンパニオンのスタイル付きポートレートを生成してください。柔らかい光、細部は豊かで近づきやすい、モダンなイラスト風。"},edit:{title:"画像を編集",prompt:"画像編集を手伝ってください。まず編集する画像のアップロードまたは指定を求め、その後に編集後の結果を生成してください。"}}},header:{toggleSidebar:"サイドバーを切り替える",newChat:"新しいチャットを開始",toggleTheme:"ヘッダーからテーマを切り替える",settings:"設定を開く",sessionInfo:"セッション詳細"},sessionInfo:{title:"セッション",untitled:"無題のチャット",automations:"自動タスク",count:"{{count}}",loading:"自動タスクを読み込み中...",loadFailed:"自動タスクを読み込めませんでした。",empty:"このセッションにはまだ自動タスクがありません。",disabled:"オフ",schedule:{at:"{{time}}",every:"{{duration}}ごと",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"カスタムスケジュール"},next:{label:"次回 {{time}}",pending:"まもなく実行",disabled:"一時停止",none:"次回実行なし"}},composer:{placeholderThread:"メッセージを入力…",placeholderHero:"何を考えていますか?",placeholderOpening:"新しいチャットを開いています…",placeholderStreaming:"モデルが応答しています…",inputAria:"メッセージ入力欄",sendHint:"Enter で送信 · Shift+Enter で改行",runRuntimeTitle:"実行中 · {{elapsed}}",goalStateStrip:"目標 · {{label}}",goalStateFallback:"目標",goalStateExpandAria:"目標の全文を表示",goalStateSheetTitle:"目標",goalStateCloseAria:"目標を閉じる",send:"メッセージを送信",stop:"応答を停止",modelNotConfigured:"モデルが未設定です",configureModel:"モデルを設定",queued:{label:"保留中のガイド",guide:"ガイド",delete:"ガイドを削除",edit:"ガイドを編集",drag:"ドラッグして並べ替え"},attachImage:"画像を添付",imageMode:{label:"画像生成",toggle:"画像生成モードを切り替え",placeholder:"画像を説明または編集…",aspectAria:"画像のアスペクト比",aspectLabel:"画像の比率",aspect:{auto:"自動","1_1":"正方形 1:1","3_4":"縦長 3:4","9_16":"ストーリー 9:16","4_3":"横長 4:3","16_9":"ワイド 16:9"}},tools:{search:"検索",reason:"推論",deepResearch:"詳細調査",voice:"音声入力"},voice:{hint:"クリックして音声入力、または長押し",stop:"録音を停止",transcribing:"文字起こし中...",recordingStatus:"録音中 {{time}}"},voiceErrors:{unsupported:"このブラウザーは音声入力に対応していません。",permission:"マイクの許可が必要です。",notConfigured:"先に文字起こしプロバイダーを設定してください。",tooLong:"録音が長すぎます。",tooShort:"もう少し長く録音してください。",noInput:"マイク入力が検出されませんでした。",failed:"音声を文字起こしできませんでした。"},slash:{ariaLabel:"スラッシュコマンド",label:"コマンド",navigateHint:"↑↓ 選択",selectHint:"Enter/Tab 入力",closeHint:"Esc 閉じる",commands:{new:{title:"新しいチャット",description:"現在のタスクを停止して、新しい会話を開始します。"},stop:{title:"現在のタスクを停止",description:"このチャットで実行中の agent ターンをキャンセルします。"},restart:{title:"nanobot を再起動",description:"bot プロセスをその場で再起動します。"},status:{title:"ステータスを表示",description:"ランタイム、provider、channel の状態を表示します。"},model:{title:"モデル",description:"有効なモデルプリセットを表示または切り替えます。"},history:{title:"会話履歴を表示",description:"保存済みの直近 N 件の会話メッセージを表示します。"},dream:{title:"Dream を実行",description:"メモリ統合を手動で開始します。"},dream_log:{title:"Dream ログを表示",description:"直近の Dream 統合で変更された内容を表示します。"},dream_restore:{title:"メモリを復元",description:"以前の Dream スナップショットへメモリを戻します。"},goal:{title:"長期目標",description:"持続的な複数ステップの目標として扱うようエージェントに伝えます。"},help:{title:"ヘルプを表示",description:"利用可能なスラッシュコマンドを一覧表示します。"},pairing:{title:"ペアリング",description:"ペアリングリクエストを管理します。"}},badges:{current:"現在",recent:"最近"},details:{goalActive:"目標が実行中",goalReady:"継続的な目標を開始",history:"最近のメッセージを表示",stopRunning:"実行中"}},encoding:"処理中…",remove:"添付を削除",normalizedSizeHint:"{{orig}} → {{current}}(自動圧縮)",imageRejected:{unsupported_type:"対応していないファイル形式です",too_many_images:"1 メッセージにつき最大 {{max}} 枚です",magic_mismatch:"画像ファイルではないようです",decode_failed:"この画像をデコードできません",too_large:"画像が大きすぎます。小さいものを選んでください",io:"このファイルを読み込めません"},mentions:{ariaLabel:"アプリ",label:"アプリ",cliGroup:"CLI アプリ",mcpGroup:"MCP サービス",cliBadge:"CLI",mcpBadge:"MCP",cliDescription:"@{{name}} をローカル CLI アプリとして使用",mcpDescription:"@{{name}} を MCP サーバーとして使用"},workspace:{accessAria:"Workspace access mode",projectAria:"プロジェクトを選択",projectPlaceholder:"プロジェクトを選択",default:"Default Permission",full:"Full Access"}},scrollToBottom:"一番下へスクロール",loadEarlier:"以前のメッセージを読み込む",forkedFromHistory:"履歴から分岐",promptNavigator:{open:"プロンプトナビゲーターを開く",title:"プロンプト",search:"プロンプトを検索",noResults:"一致するプロンプトがありません。",jumpTo:"プロンプトへ移動: {{label}}"}},hR={streaming:"生成中",assistantTyping:"アシスタントが入力中",toolSingle:"ツールを使用中",toolMany:"{{count}} 個のツールを使用",toolSummary:"{{count}} 個のツール",toolSummaryMany:"{{count}} 個のツール",reasoningTools:"思考 · {{count}} 個のツール",reasoningToolsSingular:"思考 · 1 個のツール",reasoning:"思考",reasoningStreaming:"思考中…",reasoningSummary:"思考",agentActivitySummary:"{{reasoning}} ステップ · ツール呼び出し {{tools}} 回",agentActivityToolsOnly:"ツール呼び出し {{tools}} 回",agentActivityLiveSummary:"実行中… · {{reasoning}} ステップ · ツール呼び出し {{tools}} 回",agentActivityLiveToolsOnly:"実行中… · ツール呼び出し {{tools}} 回",imageAttachment:"画像の添付",forkFromHere:"分岐",copyReply:"コピー",copiedReply:"コピー済み",turnLatencyTitle:"応答時間(全行程)",activityThinkingFor:"{{duration}}考えています",activityThought:"思考しました",activityThoughtFor:"{{duration}}考えました",activityWorkingFor:"{{duration}}作業中",activityWorked:"作業しました",activityWorkedFor:"{{duration}}作業しました",cliActivityRunningOne:"@{{name}} を使用中",cliActivityRanOne:"@{{name}} を使用しました",cliActivityFailedOne:"@{{name}} が失敗しました",cliActivityRunningMany:"{{count}} 個の CLI アプリを使用中",cliActivityRanMany:"{{count}} 個の CLI アプリを使用しました",cliActivityFailedMany:"{{count}} 個の CLI アプリが失敗しました",cliRunRunning:"使用中",cliRunRan:"使用済み",cliRunFailed:"失敗",automationSourceFallback:"自動化",automationTriggered:"自動実行"},gR={title:"画像プレビュー",open:"画像を表示",prev:"前の画像",next:"次の画像",close:"プレビューを閉じる"},vR={aria:"ファイルプレビュー",close:"ファイルプレビューを閉じる",loading:"プレビューを読み込み中...",failed:"このファイルをプレビューできませんでした。",routeMissing:"ファイルプレビューには最新の gateway が必要です。nanobot gateway を再起動してから再試行してください。",resize:"ファイルプレビューの幅を変更",truncated:"ファイルが大きいため、プレビューは途中まで表示されています。"},xR={fallbackLanguage:"コード",copyAria:"コードをコピー",copy:"コピー",copied:"コピーしました"},yR={dismiss:"閉じる"},bR={messageTooBig:{title:"メッセージが大きすぎます",body:"サイズ上限を超えたため、直前のメッセージはサーバーに拒否されました。画像を減らすか、より小さいファイルに差し替えて再送してください。"},workspaceScopeRejected:{title:"Workspace was not changed",body:"Nanobot kept the previous workspace because the requested project or access mode was rejected by the gateway."}},wR={dialog:{defaultProject:"Default workspace",manual:"パスを貼り付け",manualPlaceholder:"/Users/name/project",usePath:"Use Path",absolutePathRequired:"Enter an absolute folder path on this machine."}},kR={app:lR,sidebar:cR,settings:uR,chat:dR,deleteConfirm:pR,connection:mR,thread:fR,message:hR,lightbox:gR,filePreview:vR,code:xR,common:yR,errors:bR,workspace:wR},CR={brand:"nanobot",loading:{connecting:"nanobot에 연결 중…",boot:"nanobot 불러오는 중…"},error:{title:"nanobot에 연결할 수 없습니다",gatewayHint:"gateway(`nanobot gateway`)가 실행 중인지, 그리고 이 페이지가 같은 머신에서 열려 있는지 확인하세요."},auth:{title:"인증이 필요합니다",hint:"gateway 설정의 tokenIssueSecret에 구성된 비밀 값을 입력하세요.",placeholder:"비밀번호",submit:"연결",invalid:"비밀번호가 올바르지 않습니다. 다시 시도하세요."},account:{section:"계정",logoutHint:"이 브라우저를 gateway에서 연결 해제합니다.",logout:"로그아웃"},system:{section:"시스템",restartHint:"런타임 변경 사항을 적용하려면 nanobot을 다시 시작하세요.",restart:"nanobot 다시 시작",restarting:"다시 시작 중...",restartEngine:"엔진 다시 시작",restartingEngine:"엔진 다시 시작 중..."},restart:{completed:"{{seconds}}초 만에 다시 시작되었습니다."},documentTitle:{base:"nanobot",chat:"{{title}} · nanobot"},meta:{description:"nanobot 웹 UI — nanobot 작업공간과 대화하세요."}},SR={navigation:"사이드바 탐색",collapse:"사이드바 접기",newChat:"새 채팅",searchAria:"검색",searchPlaceholder:"검색",searchResults:"결과",noSearchResults:"일치하는 채팅이 없습니다.",recent:"최근 대화",settings:"설정",language:{label:"언어",ariaLabel:"언어 변경"},apps:"앱",automations:"자동화",skills:{title:"스킬"}},NR={backToChat:"채팅으로 돌아가기",sidebar:{title:"설정",ariaLabel:"설정 섹션"},nav:{general:"일반",byok:"BYOK",overview:"개요",appearance:"외관",models:"모델",providers:"제공자",image:"이미지",voice:"음성",browser:"웹",runtime:"시스템",advanced:"보안",cliApps:"CLI 앱",mcp:"MCP",apps:"앱",automations:"자동화",skills:"스킬"},sections:{interface:"인터페이스",ai:"AI",system:"시스템",about:"정보",status:"상태",localPreferences:"로컬 환경설정",presets:"프리셋",imageGeneration:"이미지 생성",imageDefaults:"기본값",webSearch:"웹 검색",webBehavior:"동작",identity:"ID",webuiSafety:"WebUI 보안",capabilities:"기능",cliApps:"CLI 앱",mcp:"MCP 서비스",apps:"앱",nativeHost:"네이티브 호스트",hostSafety:"앱 보안",voiceInput:"음성 입력"},rows:{theme:"테마",language:"언어",provider:"제공자",model:"모델",restart:"nanobot 재시작",configPath:"설정 경로",activePreset:"활성 프리셋",gateway:"게이트웨이",restartState:"재시작 상태",pendingChanges:"대기 중인 변경",selectedPreset:"선택한 프리셋",presetModel:"프리셋 모델",density:"밀도",activityMode:"활동 상세",codeWrap:"코드 줄바꿈",maxResults:"최대 결과 수",timeout:"타임아웃",jinaReader:"Jina 리더",imageGeneration:"이미지 생성",imageProvider:"이미지 제공자",imageProviderStatus:"제공자 상태",imageProviderBase:"제공자 주소",imageModel:"이미지 모델",defaultAspectRatio:"기본 비율",defaultImageSize:"기본 크기",maxImagesPerTurn:"턴당 최대 이미지 수",imageSaveDir:"저장 디렉터리",botName:"Bot 이름",botIcon:"Bot 아이콘",timezone:"시간대",workspacePath:"기본 작업공간",localServiceAccess:"로컬 서비스",webuiDefaultAccess:"기본 권한",currentModel:"현재 구성",brandLogos:"브랜드 로고",cliAppsCatalog:"카탈로그",cliAppsFilter:"필터",engine:"엔진",logs:"로그",diagnostics:"진단",contextWindow:"컨텍스트 창",transcription:"전사",transcriptionProvider:"제공자",transcriptionProviderStatus:"제공자 상태",transcriptionModel:"모델",transcriptionLanguage:"언어",voiceLimits:"제한"},help:{theme:"밝은 모드와 어두운 모드를 전환합니다.",language:"WebUI에서 사용할 언어를 선택합니다.",provider:"새 모델 요청을 처리할 제공자를 선택합니다.",model:"nanobot이 기본으로 사용할 모델 이름을 설정합니다.",configPath:"현재 게이트웨이가 사용하는 설정 파일입니다.",selectedPreset:"이름 있는 프리셋은 여기서 읽기 전용입니다. config.json에서 편집하세요.",presetModel:"Default로 전환하면 WebUI에서 모델과 제공자를 편집할 수 있습니다.",density:"이 브라우저에만 저장됩니다.",activityMode:"기본으로 표시할 agent 활동 세부 수준을 선택합니다.",codeWrap:"작은 화면에서도 긴 코드 줄을 읽기 쉽게 유지합니다.",maxResults:"각 web_search 호출에서 반환되는 결과 수입니다.",timeout:"검색 제공자 요청이 타임아웃되기 전의 초입니다.",jinaReader:"가능할 때 web_fetch에 Jina Reader를 사용합니다.",imageGeneration:"구성된 이미지 제공자가 있을 때 채팅에서 generate_image를 노출합니다.",imageProvider:"generate_image에 사용할 등록 제공자를 선택합니다.",imageProviderStatus:"이미지 생성은 제공자 자격 증명을 재사용합니다.",imageModel:"선택한 이미지 제공자에 보낼 모델 이름입니다.",defaultAspectRatio:"프롬프트가 비율을 선택하지 않을 때 사용됩니다.",defaultImageSize:"지원하는 제공자에 보낼 크기 힌트입니다.",maxImagesPerTurn:"한 번의 generate_image 요청에서 생성할 수 있는 이미지 상한입니다.",botName:"nanobot이 표시 이름을 사용하는 곳에 표시됩니다.",botIcon:"Bot 이름 옆에 표시할 짧은 emoji 또는 텍스트입니다.",timezone:"일정과 시간 인식 답변에 사용됩니다.",localServiceAccess:"Full Access shell 명령이 localhost 서비스에 접근할 수 있게 합니다.",webuiDefaultAccess:"프로젝트별 권한이 없는 Web 채팅에 사용됩니다.",securityManagedControls:"웹 가져오기는 항상 로컬, 사설, 메타데이터 서비스를 보호합니다. 핵심 채널 보안은 config.json에서 관리됩니다.",currentModel:"새 응답에 사용됩니다.",selectedModelProvider:"선택한 모델에 의해 설정됩니다.",selectedModelValue:"선택한 모델에 의해 설정됩니다.",brandLogos:"설정에서 타사 제공자와 CLI 로고를 표시합니다.",cliAppsCatalog:"nanobot이 로컬에서 실행할 수 있는 앱 CLI 어댑터만 설치합니다. 네이티브 앱은 변경하지 않습니다.",cliAppsFilter:"앱, 카테고리 또는 기능으로 검색합니다.",logs:"네이티브 엔진 로그 폴더를 엽니다.",diagnostics:"지원용 작은 런타임 보고서를 내보냅니다.",localServiceAccessNative:"Full Access shell 명령이 이 Mac의 서비스에 접근할 수 있게 합니다.",webuiDefaultAccessNative:"프로젝트별 권한이 없는 네이티브 채팅에 사용됩니다.",contextWindow:"이 모델 구성의 기본 컨텍스트 예산을 선택합니다.",transcription:"마이크 입력을 보내기 전에 텍스트로 변환합니다. 채널 음성 메시지도 같은 설정을 사용합니다.",transcriptionProvider:"Providers에 저장된 해당 제공자의 인증 정보를 사용합니다.",transcriptionProviderStatus:"API 키는 transcription 설정이 아니라 providers 아래에 유지됩니다.",transcriptionModel:"제공자가 사용자 지정 모델 ID를 요구하지 않으면 해석된 기본값을 사용하세요.",transcriptionLanguage:"en, zh, ja, ko 같은 선택적 ISO-639 힌트입니다."},values:{light:"라이트",dark:"다크",notAvailable:"사용 불가",enabled:"활성화됨",disabled:"비활성화됨",restartPending:"재시작 대기",ready:"준비됨",privateEngine:"비공개 엔진",unixSocket:"Unix 소켓",defaultWorkspace:"기본 작업 공간",comfortable:"편안함",compact:"컴팩트",auto:"자동",expanded:"펼침",on:"켜짐",off:"꺼짐",defaultPermission:"기본 권한",fullAccess:"전체 접근",configured:"구성됨",notConfigured:"미구성",pending:"대기 중",restartingEngine:"재시작 중"},status:{loading:"설정을 불러오는 중...",loadError:"설정을 불러올 수 없습니다",unsaved:"저장되지 않은 변경 사항이 있습니다.",upToDate:"최신 상태입니다.",savedRestart:"저장했습니다. 적용하려면 nanobot을 재시작하세요.",restartAfterSaving:"변경 사항을 저장한 뒤 준비되면 재시작하세요.",savedRestartApply:"저장했습니다. 준비되면 재시작하세요.",imageProviderRestart:"이미지 제공자 변경 사항을 저장했습니다. 준비되면 재시작하세요.",hostRestartAfterSaving:"저장하면 nanobot이 엔진을 재시작합니다.",hostRestartPending:"저장했습니다. 준비되면 엔진을 재시작합니다.",hostApiUnavailable:"호스트 작업은 네이티브 앱 안에서만 사용할 수 있습니다.",logsOpened:"로그 폴더를 열었습니다.",logsOpenFailed:"로그 폴더를 열 수 없습니다.",diagnosticsExported:"진단을 {{path}}에 내보냈습니다.",diagnosticsExportFailed:"진단을 내보낼 수 없습니다."},actions:{save:"저장",saving:"저장 중",edit:"편집",cancel:"취소",open:"열기",export:"내보내기",opening:"여는 중...",exporting:"내보내는 중..."},byok:{description:"직접 provider 키를 가져옵니다. Nanobot은 현재 config에서 값을 읽고, 설정된 provider만 일반 설정에서 선택할 수 있습니다.",configured:"설정됨",notConfigured:"설정 안 됨",configuredSection:"설정됨",notConfiguredSection:"설정 안 됨",showMore:"{{count}}개 더 보기",showLess:"접기",apiKey:"API key",apiBase:"API base",apiKeyPlaceholder:"API key 입력",apiKeyConfiguredPlaceholder:"비워 두면 현재 key 유지",configuredKeyHint:"설정된 key",apiBasePlaceholder:"provider 기본값 사용",apiKeyRequired:"이 provider를 설정하려면 API key가 필요합니다.",showApiKey:"API key 표시",hideApiKey:"API key 숨기기",noConfiguredProviders:"설정된 provider가 없습니다",configureFirst:"먼저 BYOK에서 provider를 설정하세요.",openByok:"BYOK 열기",tabs:{ariaLabel:"BYOK 자격 증명 유형",llm:"LLM",webSearch:"웹 검색"},webSearch:{provider:"검색 provider",providerHelp:"web search 도구가 사용할 백엔드를 선택합니다.",selectProvider:"provider 선택",credentials:"자격 증명",noCredentialRequired:"key 필요 없음",noCredentialHelp:"DuckDuckGo는 API key를 저장하지 않고 사용할 수 있습니다.",apiKeyHelp:"config에 저장되며 저장 후에는 마스킹되어 표시됩니다.",baseUrl:"Base URL",baseUrlHelp:"SearXNG에는 자체 인스턴스 URL이 필요합니다.",baseUrlPlaceholder:"https://search.example.com",apiKeyRequired:"이 검색 provider에는 API key가 필요합니다.",baseUrlRequired:"SearXNG에는 Base URL이 필요합니다.",missingCredential:"저장하기 전에 필요한 자격 증명을 입력하세요.",saveHint:"변경 사항은 새 web search 요청에 적용됩니다."}},overview:{model:"현재 모델",providers:"제공자",configuredCount:"{{count}}개 구성됨",totalProviders:"{{count}}개 사용 가능",webSearch:"웹 검색",imageGeneration:"이미지 생성",voiceInput:"음성 입력",workspace:"작업공간"},usage:{title:"Token 활동",shortTitle:"Token Usage",subtitle:"최근 12개월 동안 제공자가 보고한 사용량입니다.",empty:"새 모델 응답 이후 token 활동이 표시됩니다.",totalTokens:"누적 Token 수",peakTokens:"최고 Token 수",thirtyDayTokens:"30일 Token 수",currentStreak:"현재 연속 일수",longestStreak:"최장 연속 일수",daysValue:"{{count}}일",last30:"30일",activeDays:"활성 일수",requests:"요청",estimated:"추정",includesEstimates:"추정 포함",cellTitle:"{{date}}: {{tokens}} tokens, 요청 {{requests}}회",sources:{user:"채팅",api:"API",cron:"자동화",dream:"메모리 정리",system:"시스템"}},providers:{searchPlaceholder:"제공자 검색",noMatches:"일치하는 제공자가 없습니다.",saveProvider:"제공자 저장"},image:{selectProvider:"제공자 선택",selectAspect:"비율 선택",selectSize:"크기 선택",configureProvider:"제공자 구성",missingCredential:"이미지 생성을 활성화하기 전에 이 제공자를 구성하세요."},models:{selectModel:"모델 선택",addConfiguration:"구성 추가",newConfiguration:"새 모델 구성",newConfigurationHelp:"제공자와 모델을 원클릭 옵션으로 저장합니다.",configurationName:"구성 이름",configurationNameHelp:"저장된 모델 구성의 이름을 변경합니다.",configurationNamePlaceholder:"빠른 작성",searchModels:"모델 ID 검색 또는 입력",useCustomModel:"사용",loadingModels:"모델 불러오는 중...",searchCatalog:"제공자 카탈로그에서 모델을 선택합니다.",modelsAvailable:"사용 가능",noModelResults:"일치하는 모델이 없습니다.",loadFailed:"모델 목록을 사용할 수 없습니다.",unsupportedModelList:"모델 ID를 직접 입력하세요.",providerNotConfigured:"모델을 불러오기 전에 이 제공자를 설정하세요.",autoProviderCustomOnly:"자동 제공자 모드는 사용자 지정 모델 ID를 사용합니다."},timezone:{select:"시간대 선택",search:"시간대 검색",empty:"일치하는 시간대가 없습니다."},cliApps:{allCategories:"모든 카테고리",availableCount:"앱 {{count}}개",installedCount:"{{count}}개 설치됨",summary:"CLI {{total}}개 중 {{installed}}개 설치됨",filterAll:"전체",filterInstalled:"설치된 CLI",filterNotInstalled:"미설치",searchPlaceholder:"CLI 검색",statusInstalled:"설치됨",statusAvailable:"사용 가능",statusMissing:"의존성 필요",statusUnsupported:"지원 안 함",statusNotInstalled:"미설치",unsupported:"지원 안 함",loading:"CLI 앱 로드 중...",empty:"이 필터와 일치하는 CLI 앱이 없습니다.",readyTitle:"@{{name}} 준비됨",readyStatus:"준비됨",readyPrompt:"@{{name}}을 사용해 이 CLI가 무엇을 할 수 있는지 확인하세요.",readyTry:"@{{name}} 사용해 보기",readyCopied:"복사됨",openChat:"채팅 열기",requires:"필요 항목",test:"CLI 테스트",update:"CLI 업데이트",uninstall:"CLI 제거",install:"CLI 설치",unavailable:"사용 불가",noDescription:"설명이 없습니다."},about:{version:"버전",checking:"확인 중...",checkForUpdates:"업데이트 확인",upToDate:"최신 버전입니다",updateAvailable:"업데이트 사용 가능 v{{version}}"},mcp:{allCategories:"모든 카테고리",summary:"프리셋 {{total}}개 중 {{installed}}개 활성화됨",filterAll:"전체",filterInstalled:"활성화됨",filterNotInstalled:"비활성",searchPlaceholder:"MCP 프리셋 검색",moreOptions:"추가 MCP 옵션",moreOptionsSubtitle:"사용자 지정 서버를 추가하거나 mcp.json을 가져옵니다.",customTitle:"사용자 지정 MCP",customSubtitle:"stdio, HTTP 또는 SSE MCP 서버를 추가합니다.",customAction:"사용자 지정",importAction:"가져오기",serverName:"서버 이름",serverUrl:"URL",transport:"전송 방식",command:"명령",args:"Args JSON",headers:"Headers JSON",env:"Env JSON",timeout:"도구 제한 시간",advancedOptions:"고급 옵션",hideAdvanced:"고급 숨기기",saveCustom:"MCP 저장",configImport:"mcp.json 가져오기",importConfig:"가져오기",restartRequired:"업데이트된 MCP 도구를 연결하려면 nanobot을 다시 시작하세요.",toolsFound:"도구 {{count}}개",loading:"MCP 프리셋 로드 중...",empty:"이 필터와 일치하는 MCP 프리셋이 없습니다.",openDocs:"문서 열기",test:"테스트",remove:"제거",enable:"활성화",enabled:"활성화됨",setup:"연결",configure:"연결",connectTitle:"{{name}} 연결",connectHint:"계정 설정에서 키를 추가하세요.",saveAndEnable:"저장 후 활성화",updateSetup:"설정 업데이트",configured:"구성됨",keepExisting:"기존 값을 유지하려면 비워 두세요",statusConfigured:"구성됨",statusMissingCredentials:"키 필요",statusMissingDependency:"의존성 필요",statusComingSoon:"곧 제공",statusNotInstalled:"비활성",toolScope:"도구",allTools:"전체",noTools:"없음",testForTools:"테스트를 실행해 개별 도구를 확인하고 선택하세요."},legal:{thirdPartyBrands:"제품 이름, 로고 및 브랜드는 각 소유자의 자산입니다. 사용은 식별 목적일 뿐 보증이나 제휴를 의미하지 않습니다."},apps:{description:"nanobot이 채팅에서 사용할 수 있는 App CLI와 MCP 서비스를 추가합니다.",cliLabel:"CLI",mcpLabel:"MCP",filterAll:"전체",filterCli:"CLI 앱",filterMcp:"MCP 서비스",enabledSummary:"{{count}}개 활성화됨",caption:"CLI {{cli}}개 · MCP {{mcp}}개",searchPlaceholder:"앱 검색",featured:"추천",loading:"앱을 불러오는 중...",empty:"일치하는 앱이 없습니다."},automations:{filters:{all:"전체",active:"활성",paused:"일시 중지",failed:"확인 필요",system:"시스템"},sort:{next:"다음 실행",last:"마지막 실행",updated:"업데이트",name:"이름"},search:"작업, 메시지, 연결된 채팅 또는 일정 검색",queue:"대기열",loading:"자동화를 불러오는 중...",noMatches:"이 보기와 일치하는 자동화가 없습니다.",empty:"아직 자동화가 없습니다.",emptyHint:"실행될 위치에서 만들면 nanobot이 올바른 컨텍스트를 유지합니다.",oneShot:"일회성",systemTask:"시스템 관리 자동화",labels:{schedule:"일정",next:"다음",origin:"연결된 채팅",created:"생성",updated:"업데이트"},runNow:"지금 실행",pause:"일시 중지",resume:"재개",edit:"편집",delete:"삭제",protected:"보호됨",editTitle:"자동화 편집",save:"저장",deleteTitle:"자동화 삭제",deleteDescription:"{{name}}을 cron 저장소에서 삭제합니다. 이전 채팅 메시지는 세션에 남습니다.",cancel:"취소",status:{system:"시스템",running:"실행 중",paused:"일시 중지",failed:"실패",completed:"완료",noSchedule:"일정 없음",active:"활성"},origin:{system:"시스템",unknown:"연결된 채팅 없음"},channels:{api:"API",cli:"CLI",dingtalk:"DingTalk",discord:"Discord",email:"Email",feishu:"Feishu",matrix:"Matrix",msteams:"Microsoft Teams",qq:"QQ",slack:"Slack",telegram:"Telegram",wechat:"WeChat",wecom:"WeCom",weixin:"WeChat",whatsapp:"WhatsApp"},schedule:{at:"{{time}}",every:"{{duration}}마다",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",withTz:"{{summary}} · {{tz}}",dailyAt:"매일 {{time}}",weekdaysAt:"평일 {{time}}",hourlyAt:"매시간 :{{minute}}",hourlyWindow:"{{start}}-{{end}} 사이 매시간 :{{minute}}",custom:"사용자 지정 일정"},next:{paused:"일시 중지",pending:"실행 중",none:"다음 실행 없음"},message:{showMore:"전체 메시지 보기",showLess:"접기"},fields:{name:"이름",message:"메시지",scheduleType:"일정 유형",every:"간격",unit:"단위",cronExpression:"Cron 식",timezone:"시간대",runAt:"실행 시간"},scheduleTypes:{every:"간격",cron:"Cron",at:"일회성"},everyUnits:{second:"초",minute:"분",hour:"시간",day:"일"},validation:{nameRequired:"이름은 필수입니다.",messageRequired:"메시지는 필수입니다.",intervalRequired:"간격은 양수여야 합니다.",cronRequired:"Cron 식은 필수입니다.",timeRequired:"실행 시간은 필수입니다.",futureRequired:"실행 시간은 현재보다 이후여야 합니다."}},oauth:{authentication:"OAuth 인증",signIn:"로그인",signingIn:"로그인 중...",signInAgain:"다시 로그인",signOut:"로그아웃",signedInAs:"{{account}}로 로그인됨",signInHelp:"이 기기에서 로그인합니다. API key는 config에 저장되지 않습니다.",signInRequired:"로그인이 필요합니다",signInBeforeSaving:"이 OAuth 제공자를 활성 모델 제공자로 저장하기 전에 로그인하세요.",signedIn:"로그인됨",notSignedIn:"로그인 안 됨"},skills:{description:"이 에이전트가 대화 중에 불러올 수 있는 지시 스킬을 확인합니다.",caption:"{{available}}개 사용 가능 · 총 {{total}}개",featured:"에이전트 스킬",empty:"사용 가능한 스킬이 없습니다.",sourceWorkspace:"사용자 지정",sourceBuiltin:"내장",statusAvailable:"사용 가능",statusUnavailable:"사용 불가",unavailableReason:"누락: {{reason}}",openDetails:"{{name}} 상세 열기",loadingDetail:"스킬 상세를 불러오는 중...",loadFailed:"스킬 상세를 불러올 수 없습니다.",descriptionTitle:"설명",source:"출처",status:"상태",requirements:"요구 사항",noRequirements:"명시된 요구 사항이 없습니다.",commands:"명령",environment:"환경 변수",missingCommands:"CLI 누락",missingEnvironment:"ENV 누락",unavailableReasonLabel:"사용 불가 이유",rawInstructions:"원본 SKILL.md",rawInstructionsEmpty:"원본 지침이 없습니다.",detailDescription:"{{name}} 세부 정보."},voice:{selectProvider:"제공자 선택",configureProvider:"제공자 설정",languageAuto:"자동"}},jR={fallbackTitle:"채팅 {{id}}",forkTitle:"분기: {{title}}",loading:"불러오는 중…",noSessions:"아직 세션이 없습니다.",showMore:"{{count}}개 더 보기",collapsed:"{{count}}개 채팅 접힘",showLess:"접기",actions:"{{title}} 채팅 작업",newInProject:"{{project}}에서 새 채팅 시작",activity:{running:"Agent running",complete:"Agent finished",updated:"New activity"},pin:"Pin",unpin:"Unpin",rename:"Rename",renameTitle:"Rename chat",renameDescription:"Choose a local sidebar name for this chat.",renamePlaceholder:"Chat name",renameProjectTitle:"Rename project",renameProjectDescription:"Choose a local sidebar name for this project.",renameProjectPlaceholder:"Project name",renameSave:"Save",archive:"Archive",unarchive:"Unarchive",showArchived:"Show archived",hideArchived:"Hide archived",delete:"삭제",newChat:"새 채팅",groups:{pinned:"Pinned",all:"Chats",projects:"Projects",today:"Today",yesterday:"Yesterday",earlier:"Earlier",archived:"Archived"}},AR={title:"이 채팅을 삭제할까요?",description:"이 작업은 되돌릴 수 없습니다.",cancel:"취소",confirm:"삭제",automationsDescription:"이 채팅에는 예약된 자동화가 있습니다. 채팅을 삭제하면 자동화도 함께 삭제됩니다.",moreAutomations:"+ {{count}}개 더",confirmWithAutomations:"삭제",schedule:{at:"{{time}}",every:"{{duration}}마다",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"사용자 지정 일정"},next:{label:"다음: {{time}}",disabled:"일시 중지됨",none:"다음 실행 없음"}},_R={idle:"대기 중",connecting:"연결 중…",open:"연결됨",reconnecting:"재연결 중…",closed:"연결 끊김",error:"연결 오류"},PR={loadingConversation:"대화 불러오는 중…",empty:{greetings:{workOn:"우리 무엇을 함께 해볼까요?",start:"오늘은 어디서 시작할까요?",build:"오늘은 무엇을 만들어볼까요?",tackle:"함께 무엇을 해결할까요?"},quickActions:{plan:{title:"프로젝트 계획 만들기",prompt:"다음에 만들 것에 대한 간결한 프로젝트 계획을 작성해 주세요."},analyze:{title:"이 데이터 분석하기",prompt:"이 데이터를 분석하고 가장 중요한 패턴을 짚어 주세요."},brainstorm:{title:"아이디어 브레인스토밍",prompt:"이 문제에 대한 실용적인 아이디어와 트레이드오프를 몇 가지 제안해 주세요."},code:{title:"코드 작성하기",prompt:"이 작업을 위한 코드를 작성해 주세요. 가장 작은 유용한 변경부터 시작해 주세요."},summarize:{title:"문서 요약하기",prompt:"이 문서를 요약하고 핵심 내용을 정리해 주세요."},more:{title:"더 보기",prompt:"이 워크스페이스에서 도와줄 수 있는 유용한 방법을 몇 가지 보여 주세요."}},imageQuickActions:{icon:{title:"앱 아이콘 디자인",prompt:"nanobot을 위한 깔끔한 1:1 앱 아이콘을 생성해 주세요. 친근한 로봇, 단순한 벡터 스타일, 부드러운 파란색과 흰색 팔레트, 텍스트 없음."},sticker:{title:"스티커 만들기",prompt:"작은 로봇 도우미의 귀여운 스티커 스타일 이미지를 생성해 주세요. 투명해 보이는 배경, 표정이 풍부하고 장난스러운 느낌."},poster:{title:"포스터 만들기",prompt:"개인 AI 도우미를 위한 세련된 포스터 콘셉트를 생성해 주세요. 현대적인 구성, 강한 시각적 계층, 랜딩 페이지에 어울리는 스타일."},product:{title:"제품 목업",prompt:"대화형 AI 웹 앱을 위한 깔끔한 제품 목업 이미지를 생성해 주세요. 미니멀한 인터페이스, 고급스러운 조명, 현실적인 기기 프레임."},portrait:{title:"스타일화된 초상화",prompt:"친근한 AI 동반자의 스타일화된 초상화를 생성해 주세요. 부드러운 조명, 세밀하지만 다가가기 쉬운 분위기, 현대적인 일러스트 스타일."},edit:{title:"이미지 편집",prompt:"이미지 편집을 도와주세요. 먼저 편집할 이미지를 업로드하거나 지정하게 한 뒤, 편집된 결과를 생성해 주세요."}}},header:{toggleSidebar:"사이드바 전환",newChat:"새 채팅 시작",toggleTheme:"헤더에서 테마 전환",settings:"설정 열기",sessionInfo:"세션 세부 정보"},sessionInfo:{title:"세션",untitled:"제목 없는 채팅",automations:"자동화",count:"{{count}}",loading:"자동화를 불러오는 중...",loadFailed:"자동화를 불러오지 못했습니다.",empty:"이 세션에는 아직 자동화가 없습니다.",disabled:"꺼짐",schedule:{at:"{{time}}",every:"{{duration}}마다",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"사용자 지정 일정"},next:{label:"다음 {{time}}",pending:"곧 실행됨",disabled:"일시 중지됨",none:"다음 실행 없음"}},composer:{placeholderThread:"메시지를 입력하세요…",placeholderHero:"무슨 생각을 하고 있나요?",placeholderOpening:"새 채팅을 여는 중…",placeholderStreaming:"모델이 응답 중입니다…",inputAria:"메시지 입력",sendHint:"Enter로 전송 · Shift+Enter로 줄바꿈",runRuntimeTitle:"실행 중 · {{elapsed}}",goalStateStrip:"목표 · {{label}}",goalStateFallback:"목표",goalStateExpandAria:"전체 목표 보기",goalStateSheetTitle:"목표",goalStateCloseAria:"목표 닫기",send:"메시지 보내기",stop:"응답 중지",modelNotConfigured:"모델이 설정되지 않음",configureModel:"모델 설정",queued:{label:"대기 중인 안내",guide:"안내",delete:"안내 삭제",edit:"안내 수정",drag:"드래그하여 순서 변경"},attachImage:"이미지 첨부",imageMode:{label:"이미지 생성",toggle:"이미지 생성 모드 전환",placeholder:"이미지를 설명하거나 편집하세요…",aspectAria:"이미지 화면 비율",aspectLabel:"이미지 비율",aspect:{auto:"자동","1_1":"정사각형 1:1","3_4":"세로 3:4","9_16":"스토리 9:16","4_3":"가로 4:3","16_9":"와이드 16:9"}},tools:{search:"검색",reason:"추론",deepResearch:"심층 조사",voice:"음성 입력"},voice:{hint:"클릭해 받아쓰거나 길게 누르기",stop:"녹음 중지",transcribing:"변환 중...",recordingStatus:"녹음 중 {{time}}"},voiceErrors:{unsupported:"이 브라우저는 음성 입력을 지원하지 않습니다.",permission:"마이크 권한이 필요합니다.",notConfigured:"먼저 음성 변환 제공업체를 설정하세요.",tooLong:"녹음 시간이 너무 깁니다.",tooShort:"음성을 녹음하려면 조금 더 길게 눌러 주세요.",noInput:"마이크 입력이 감지되지 않았습니다.",failed:"오디오를 변환하지 못했습니다."},slash:{ariaLabel:"슬래시 명령",label:"명령",navigateHint:"↑↓ 선택",selectHint:"Enter/Tab 입력",closeHint:"Esc 닫기",commands:{new:{title:"새 채팅",description:"현재 작업을 중지하고 새 대화를 시작합니다."},stop:{title:"현재 작업 중지",description:"이 채팅에서 실행 중인 agent 턴을 취소합니다."},restart:{title:"nanobot 재시작",description:"bot 프로세스를 제자리에서 재시작합니다."},status:{title:"상태 보기",description:"런타임, provider, channel 상태를 표시합니다."},model:{title:"모델",description:"활성 모델 프리셋을 보거나 전환합니다."},history:{title:"대화 기록 보기",description:"저장된 최근 N개의 대화 메시지를 출력합니다."},dream:{title:"Dream 실행",description:"메모리 정리를 수동으로 트리거합니다."},dream_log:{title:"Dream 로그 보기",description:"마지막 Dream 정리에서 변경된 내용을 표시합니다."},dream_restore:{title:"메모리 복원",description:"이전 Dream 스냅샷으로 메모리를 되돌립니다."},goal:{title:"장기 목표",description:"에이전트에게 지속적인 다단계 목표로 처리하도록 지시합니다."},help:{title:"도움말 보기",description:"사용 가능한 슬래시 명령을 나열합니다."},pairing:{title:"페어링",description:"페어링 요청을 관리합니다."}},badges:{current:"현재",recent:"최근"},details:{goalActive:"목표 실행 중",goalReady:"지속 목표 시작",history:"최근 메시지 보기",stopRunning:"실행 중"}},encoding:"처리 중…",remove:"첨부 제거",normalizedSizeHint:"{{orig}} → {{current}} (자동 압축)",imageRejected:{unsupported_type:"지원하지 않는 파일 형식입니다",too_many_images:"메시지당 최대 {{max}}장까지 가능합니다",magic_mismatch:"이미지 파일이 아닌 것 같습니다",decode_failed:"이 이미지를 디코딩할 수 없습니다",too_large:"이미지가 너무 큽니다. 더 작은 걸로 시도해 주세요",io:"이 파일을 읽을 수 없습니다"},mentions:{ariaLabel:"앱",label:"앱",cliGroup:"CLI 앱",mcpGroup:"MCP 서비스",cliBadge:"CLI",mcpBadge:"MCP",cliDescription:"@{{name}}을 로컬 CLI 앱으로 사용",mcpDescription:"@{{name}}을 MCP 서버로 사용"},workspace:{accessAria:"Workspace access mode",projectAria:"프로젝트 선택",projectPlaceholder:"프로젝트 선택",default:"Default Permission",full:"Full Access"}},scrollToBottom:"맨 아래로 스크롤",loadEarlier:"이전 메시지 불러오기",forkedFromHistory:"기록에서 분기됨",promptNavigator:{open:"프롬프트 탐색기 열기",title:"프롬프트",search:"프롬프트 검색",noResults:"일치하는 프롬프트가 없습니다.",jumpTo:"프롬프트로 이동: {{label}}"}},TR={streaming:"생성 중",assistantTyping:"도우미가 입력 중",toolSingle:"도구 사용 중",toolMany:"도구 {{count}}개 사용됨",toolSummary:"도구 {{count}}개",toolSummaryMany:"도구 {{count}}개",reasoningTools:"추론 · 도구 {{count}}개",reasoningToolsSingular:"추론 · 도구 1개",reasoning:"추론",reasoningStreaming:"추론 중…",reasoningSummary:"추론",agentActivitySummary:"{{reasoning}}단계 · 도구 호출 {{tools}}회",agentActivityToolsOnly:"도구 호출 {{tools}}회",agentActivityLiveSummary:"진행 중… · {{reasoning}}단계 · 도구 호출 {{tools}}회",agentActivityLiveToolsOnly:"진행 중… · 도구 호출 {{tools}}회",imageAttachment:"이미지 첨부",forkFromHere:"분기",copyReply:"복사",copiedReply:"복사됨",turnLatencyTitle:"응답 시간(엔드투엔드)",activityThinkingFor:"{{duration}} 동안 생각 중",activityThought:"생각함",activityThoughtFor:"{{duration}} 동안 생각함",activityWorkingFor:"{{duration}} 동안 작업 중",activityWorked:"작업함",activityWorkedFor:"{{duration}} 동안 작업함",cliActivityRunningOne:"@{{name}} 사용 중",cliActivityRanOne:"@{{name}} 사용함",cliActivityFailedOne:"@{{name}} 실패",cliActivityRunningMany:"CLI 앱 {{count}}개 사용 중",cliActivityRanMany:"CLI 앱 {{count}}개 사용함",cliActivityFailedMany:"CLI 앱 {{count}}개 실패",cliRunRunning:"사용 중",cliRunRan:"사용함",cliRunFailed:"실패",automationSourceFallback:"자동화",automationTriggered:"자동 실행됨"},RR={title:"이미지 미리보기",open:"이미지 보기",prev:"이전 이미지",next:"다음 이미지",close:"미리보기 닫기"},MR={aria:"파일 미리보기",close:"파일 미리보기 닫기",loading:"미리보기 로딩 중...",failed:"이 파일을 미리 볼 수 없습니다.",routeMissing:"파일 미리보기에는 최신 gateway가 필요합니다. nanobot gateway를 다시 시작한 뒤 다시 시도하세요.",resize:"파일 미리보기 크기 조절",truncated:"파일이 커서 미리보기가 잘렸습니다."},ER={fallbackLanguage:"코드",copyAria:"코드 복사",copy:"복사",copied:"복사됨"},IR={dismiss:"닫기"},LR={messageTooBig:{title:"메시지가 너무 큽니다",body:"마지막 메시지가 서버의 크기 제한을 초과하여 거부되었습니다. 이미지를 줄이거나 더 작은 파일로 바꿔서 다시 보내 주세요."},workspaceScopeRejected:{title:"Workspace was not changed",body:"Nanobot kept the previous workspace because the requested project or access mode was rejected by the gateway."}},DR={dialog:{defaultProject:"Default workspace",manual:"경로 붙여넣기",manualPlaceholder:"/Users/name/project",usePath:"Use Path",absolutePathRequired:"Enter an absolute folder path on this machine."}},OR={app:CR,sidebar:SR,settings:NR,chat:jR,deleteConfirm:AR,connection:_R,thread:PR,message:TR,lightbox:RR,filePreview:MR,code:ER,common:IR,errors:LR,workspace:DR},FR={brand:"nanobot",loading:{connecting:"Conectando con nanobot…",boot:"Cargando nanobot…"},error:{title:"No se pudo conectar con nanobot",gatewayHint:"Asegúrate de que la gateway esté en ejecución (`nanobot gateway`) y de que esta página esté abierta en la misma máquina."},auth:{title:"Autenticación requerida",hint:"Introduce el secreto configurado como tokenIssueSecret en la configuración del gateway.",placeholder:"Contraseña",submit:"Conectar",invalid:"Contraseña no válida. Inténtalo de nuevo."},account:{section:"Cuenta",logoutHint:"Desconecta este navegador del gateway.",logout:"Cerrar sesión"},system:{section:"Sistema",restartHint:"Reinicia nanobot para aplicar los cambios de ejecución.",restart:"Reiniciar nanobot",restarting:"Reiniciando...",restartEngine:"Reiniciar motor",restartingEngine:"Reiniciando motor..."},restart:{completed:"Reinicio completado en {{seconds}} s."},documentTitle:{base:"nanobot",chat:"{{title}} · nanobot"},meta:{description:"Interfaz web de nanobot: conversa con tu espacio de trabajo de nanobot."}},zR={navigation:"Navegación de la barra lateral",collapse:"Contraer barra lateral",newChat:"Nuevo chat",searchAria:"Buscar",searchPlaceholder:"Buscar",searchResults:"Resultados",noSearchResults:"No hay chats coincidentes.",recent:"Recientes",settings:"Configuración",language:{label:"Idioma",ariaLabel:"Cambiar idioma"},apps:"Apps",automations:"Automatizaciones",skills:{title:"Habilidades"}},$R={backToChat:"Volver al chat",sidebar:{title:"Ajustes",ariaLabel:"Secciones de ajustes"},nav:{general:"General",byok:"BYOK",overview:"Resumen",appearance:"Apariencia",models:"Modelos",providers:"Proveedores",image:"Imagen",voice:"Voz",browser:"Internet",runtime:"Sistema",advanced:"Seguridad",cliApps:"Apps CLI",mcp:"MCP",apps:"Aplicaciones",automations:"Automatizaciones",skills:"Habilidades"},sections:{interface:"Interfaz",ai:"AI",system:"Sistema",about:"Acerca de",status:"Estado",localPreferences:"Preferencias locales",presets:"Preajustes",imageGeneration:"Generación de imágenes",imageDefaults:"Valores predeterminados",webSearch:"Búsqueda web",webBehavior:"Comportamiento",identity:"Identidad",webuiSafety:"Seguridad de WebUI",capabilities:"Capacidades",cliApps:"Aplicaciones CLI",mcp:"Servicios MCP",apps:"Aplicaciones",nativeHost:"Host nativo",hostSafety:"Seguridad de la app",voiceInput:"Entrada de voz"},rows:{theme:"Tema",language:"Idioma",provider:"Proveedor",model:"Modelo",restart:"Reiniciar nanobot",configPath:"Ruta de configuración",activePreset:"Preajuste activo",gateway:"Pasarela",restartState:"Estado de reinicio",pendingChanges:"Cambios pendientes",selectedPreset:"Preajuste seleccionado",presetModel:"Modelo del preajuste",density:"Densidad",activityMode:"Detalle de actividad",codeWrap:"Ajuste de código",maxResults:"Resultados máximos",timeout:"Tiempo de espera",jinaReader:"Lector Jina",imageGeneration:"Generación de imágenes",imageProvider:"Proveedor de imágenes",imageProviderStatus:"Estado del proveedor",imageProviderBase:"Base del proveedor",imageModel:"Modelo de imagen",defaultAspectRatio:"Proporción predeterminada",defaultImageSize:"Tamaño predeterminado",maxImagesPerTurn:"Máx. imágenes por turno",imageSaveDir:"Directorio de guardado",botName:"Nombre del bot",botIcon:"Icono del bot",timezone:"Zona horaria",workspacePath:"Workspace predeterminado",localServiceAccess:"Servicios locales",webuiDefaultAccess:"Acceso predeterminado",currentModel:"Configuración actual",brandLogos:"Logos de marca",cliAppsCatalog:"Catálogo",cliAppsFilter:"Filtro",engine:"Motor",logs:"Registros",diagnostics:"Diagnóstico",contextWindow:"Ventana de contexto",transcription:"Transcripcion",transcriptionProvider:"Proveedor",transcriptionProviderStatus:"Estado del proveedor",transcriptionModel:"Modelo",transcriptionLanguage:"Idioma",voiceLimits:"Limites"},help:{theme:"Cambia entre apariencia clara y oscura.",language:"Elige el idioma usado por WebUI.",provider:"Selecciona el proveedor para nuevas solicitudes de modelo.",model:"Define el nombre de modelo predeterminado de nanobot.",configPath:"Archivo de configuración que usa actualmente el gateway.",selectedPreset:"Los preajustes con nombre son de solo lectura aquí; edítalos en config.json.",presetModel:"Cambia a Default para editar modelo y proveedor desde WebUI.",density:"Solo se guarda en este navegador.",activityMode:"Elige cuánto detalle de actividad del agente se muestra por defecto.",codeWrap:"Mantiene legibles las líneas largas de código en pantallas pequeñas.",maxResults:"Resultados devueltos por cada llamada web_search.",timeout:"Segundos antes de que una solicitud de búsqueda expire.",jinaReader:"Usa Jina Reader para web_fetch cuando esté disponible.",imageGeneration:"Expone generate_image en chats cuando hay un proveedor de imagen configurado.",imageProvider:"Elige el proveedor registrado usado por generate_image.",imageProviderStatus:"La generación de imágenes reutiliza credenciales de Proveedores.",imageModel:"Nombre del modelo enviado al proveedor de imágenes seleccionado.",defaultAspectRatio:"Se usa cuando el prompt no elige una proporción.",defaultImageSize:"Pista de tamaño enviada a proveedores compatibles.",maxImagesPerTurn:"Límite superior para una solicitud generate_image.",botName:"Se muestra donde nanobot usa un nombre visible.",botIcon:"Emoji o texto corto junto al nombre del bot.",timezone:"Se usa para horarios y respuestas con conciencia temporal.",localServiceAccess:"Permite que comandos shell con Full Access alcancen servicios localhost.",webuiDefaultAccess:"Usado por chats web sin permiso específico de proyecto.",securityManagedControls:"Las capturas web siempre protegen servicios locales, privados y metadata. La seguridad de canales core se gestiona en config.json.",currentModel:"Se usa para nuevas respuestas.",selectedModelProvider:"Definido por el modelo seleccionado.",selectedModelValue:"Definido por el modelo seleccionado.",brandLogos:"Muestra logos de proveedores de terceros y CLI en Ajustes.",cliAppsCatalog:"Instala solo adaptadores CLI de apps que nanobot puede ejecutar localmente; las apps nativas no se modifican.",cliAppsFilter:"Busca por app, categoría o capacidad.",logs:"Abre la carpeta de registros del motor nativo.",diagnostics:"Exporta un pequeño informe de runtime para soporte.",localServiceAccessNative:"Permite que comandos shell con Full Access alcancen servicios en este Mac.",webuiDefaultAccessNative:"Usado por chats nativos sin permiso específico de proyecto.",contextWindow:"Elige el presupuesto de contexto predeterminado para esta configuración de modelo.",transcription:"Transcribe la entrada del microfono antes de enviarla. Los mensajes de voz de los canales usan la misma configuracion.",transcriptionProvider:"Usa las credenciales del proveedor correspondiente en Proveedores.",transcriptionProviderStatus:"Las claves API permanecen en proveedores, no en la configuracion de transcripcion.",transcriptionModel:"Dejalo como el valor predeterminado resuelto salvo que el proveedor necesite un id de modelo personalizado.",transcriptionLanguage:"Pista ISO-639 opcional, como en, zh, ja o ko."},values:{light:"Claro",dark:"Oscuro",notAvailable:"No disponible",enabled:"Activado",disabled:"Desactivado",restartPending:"Reinicio pendiente",ready:"Listo",privateEngine:"Motor privado",unixSocket:"Socket Unix",defaultWorkspace:"Espacio predeterminado",comfortable:"Cómodo",compact:"Compacto",auto:"Automático",expanded:"Expandido",on:"Activado",off:"Desactivado",defaultPermission:"Permiso predeterminado",fullAccess:"Acceso completo",configured:"Configurado",notConfigured:"Sin configurar",pending:"Pendiente",restartingEngine:"Reiniciando"},status:{loading:"Cargando ajustes...",loadError:"No se pudieron cargar los ajustes",unsaved:"Cambios sin guardar.",upToDate:"Actualizado.",savedRestart:"Guardado. Reinicia nanobot para aplicar.",restartAfterSaving:"Guarda los cambios y reinicia cuando puedas.",savedRestartApply:"Guardado. Reinicia cuando puedas.",imageProviderRestart:"Cambios del proveedor de imagen guardados. Reinicia cuando puedas.",hostRestartAfterSaving:"Al guardar, nanobot reiniciará su motor.",hostRestartPending:"Guardado. El motor se reiniciará cuando esté listo.",hostApiUnavailable:"Las acciones del host solo están disponibles en la app nativa.",logsOpened:"Carpeta de registros abierta.",logsOpenFailed:"No se pudo abrir la carpeta de registros.",diagnosticsExported:"Diagnóstico exportado a {{path}}.",diagnosticsExportFailed:"No se pudo exportar el diagnóstico."},actions:{save:"Guardar",saving:"Guardando",edit:"Editar",cancel:"Cancelar",open:"Abrir",export:"Exportar",opening:"Abriendo...",exporting:"Exportando..."},byok:{description:"Usa tus propias claves de proveedor. Nanobot lee estos valores desde la configuración actual, y solo los proveedores configurados se pueden elegir en General.",configured:"Configurado",notConfigured:"Sin configurar",configuredSection:"Configurados",notConfiguredSection:"Sin configurar",showMore:"Mostrar {{count}} más",showLess:"Mostrar menos",apiKey:"API key",apiBase:"API base",apiKeyPlaceholder:"Introduce la API key",apiKeyConfiguredPlaceholder:"Deja vacío para conservar la key actual",configuredKeyHint:"Key configurada",apiBasePlaceholder:"Usar el valor predeterminado del proveedor",apiKeyRequired:"Se requiere una API key para configurar este proveedor.",showApiKey:"Mostrar API key",hideApiKey:"Ocultar API key",noConfiguredProviders:"No hay proveedores configurados",configureFirst:"Configura primero un proveedor en BYOK.",openByok:"Abrir BYOK",tabs:{ariaLabel:"Tipo de credencial BYOK",llm:"LLM",webSearch:"Búsqueda web"},webSearch:{provider:"Proveedor de búsqueda",providerHelp:"Elige el backend que usará la herramienta web search.",selectProvider:"Seleccionar proveedor",credentials:"Credenciales",noCredentialRequired:"No requiere key",noCredentialHelp:"DuckDuckGo funciona sin guardar una API key.",apiKeyHelp:"Se guarda en config y se muestra enmascarada después de guardar.",baseUrl:"Base URL",baseUrlHelp:"SearXNG necesita la URL de tu propia instancia.",baseUrlPlaceholder:"https://search.example.com",apiKeyRequired:"Este proveedor de búsqueda requiere una API key.",baseUrlRequired:"SearXNG requiere una Base URL.",missingCredential:"Añade la credencial requerida antes de guardar.",saveHint:"Los cambios se aplican a nuevas solicitudes de web search."}},overview:{model:"Modelo actual",providers:"Proveedores",configuredCount:"{{count}} configurados",totalProviders:"{{count}} disponibles",webSearch:"Búsqueda web",imageGeneration:"Generación de imágenes",voiceInput:"Entrada de voz",workspace:"Espacio de trabajo"},usage:{title:"Actividad de tokens",shortTitle:"Token Usage",subtitle:"Uso reportado por el proveedor durante los últimos 12 meses.",empty:"La actividad de tokens aparecerá después de nuevas respuestas del modelo.",totalTokens:"Tokens totales",peakTokens:"Pico de tokens",thirtyDayTokens:"Tokens en 30 días",currentStreak:"Racha actual",longestStreak:"Racha más larga",daysValue:"{{count}} d",last30:"30 días",activeDays:"Días activos",requests:"Solicitudes",estimated:"estimado",includesEstimates:"incluye estimaciones",cellTitle:"{{date}}: {{tokens}} tokens, {{requests}} solicitudes",sources:{user:"Chat",api:"API",cron:"Automatizaciones",dream:"Memoria",system:"Sistema"}},providers:{searchPlaceholder:"Buscar proveedores",noMatches:"Ningún proveedor coincide con esta búsqueda.",saveProvider:"Guardar proveedor"},image:{selectProvider:"Seleccionar proveedor",selectAspect:"Seleccionar proporción",selectSize:"Seleccionar tamaño",configureProvider:"Configurar proveedor",missingCredential:"Configura este proveedor antes de activar la generación de imágenes."},models:{selectModel:"Seleccionar modelo",addConfiguration:"Agregar configuración",newConfiguration:"Nueva configuración de modelo",newConfigurationHelp:"Guarda un proveedor y modelo como opción de un clic.",configurationName:"Nombre de configuración",configurationNameHelp:"Renombra esta configuración de modelo guardada.",configurationNamePlaceholder:"Escritura rápida",searchModels:"Buscar o escribir ID de modelo",useCustomModel:"Usar",loadingModels:"Cargando modelos...",searchCatalog:"Busca el catálogo del proveedor para elegir un modelo.",modelsAvailable:"disponibles",noModelResults:"No hay modelos coincidentes.",loadFailed:"Lista de modelos no disponible.",unsupportedModelList:"Escribe un ID de modelo manualmente.",providerNotConfigured:"Configura este proveedor antes de cargar modelos.",autoProviderCustomOnly:"El modo de proveedor automático usa IDs de modelo personalizados."},timezone:{select:"Seleccionar zona horaria",search:"Buscar zona horaria",empty:"No hay zonas horarias coincidentes."},cliApps:{allCategories:"Todas las categorías",availableCount:"{{count}} aplicaciones",installedCount:"{{count}} instaladas",summary:"{{installed}} de {{total}} CLIs instaladas",filterAll:"Todas",filterInstalled:"CLIs instaladas",filterNotInstalled:"No instaladas",searchPlaceholder:"Buscar CLIs",statusInstalled:"Instalada",statusAvailable:"Disponible",statusMissing:"Falta dependencia",statusUnsupported:"No compatible",statusNotInstalled:"No instalada",unsupported:"No compatible",loading:"Cargando apps CLI...",empty:"Ninguna app CLI coincide con este filtro.",readyTitle:"@{{name}} está listo",readyStatus:"Listo",readyPrompt:"Usa @{{name}} para ver qué puede hacer este CLI.",readyTry:"Probar @{{name}}",readyCopied:"Copiado",openChat:"Abrir chat",requires:"Requiere",test:"Probar CLI",update:"Actualizar CLI",uninstall:"Desinstalar CLI",install:"Instalar CLI",unavailable:"No disponible",noDescription:"Sin descripción disponible."},about:{version:"Versión",checking:"Buscando actualizaciones...",checkForUpdates:"Buscar actualizaciones",upToDate:"Estás al día",updateAvailable:"Actualización disponible v{{version}}"},mcp:{allCategories:"Todas las categorías",summary:"{{installed}} de {{total}} presets habilitados",filterAll:"Todos",filterInstalled:"Habilitados",filterNotInstalled:"No habilitados",searchPlaceholder:"Buscar presets MCP",moreOptions:"Más opciones de MCP",moreOptionsSubtitle:"Añade un servidor personalizado o importa mcp.json.",customTitle:"MCP personalizado",customSubtitle:"Añade cualquier servidor MCP stdio, HTTP o SSE.",customAction:"Personalizado",importAction:"Importar",serverName:"Nombre del servidor",serverUrl:"URL",transport:"Transporte",command:"Comando",args:"Args JSON",headers:"Headers JSON",env:"Env JSON",timeout:"Tiempo límite de herramienta",advancedOptions:"Opciones avanzadas",hideAdvanced:"Ocultar avanzado",saveCustom:"Guardar MCP",configImport:"Importar mcp.json",importConfig:"Importar",restartRequired:"Reinicia nanobot para conectar las herramientas MCP actualizadas.",toolsFound:"{{count}} herramientas",loading:"Cargando presets MCP...",empty:"Ningún preset MCP coincide con este filtro.",openDocs:"Abrir docs",test:"Probar",remove:"Eliminar",enable:"Habilitar",enabled:"Habilitado",setup:"Conectar",configure:"Conectar",connectTitle:"Conectar {{name}}",connectHint:"Añade la clave desde la configuración de tu cuenta.",saveAndEnable:"Guardar y habilitar",updateSetup:"Actualizar configuración",configured:"configurado",keepExisting:"Déjalo en blanco para conservar el valor actual",statusConfigured:"Configurado",statusMissingCredentials:"Necesita clave",statusMissingDependency:"Necesita dependencia",statusComingSoon:"Próximamente",statusNotInstalled:"No habilitado",toolScope:"Herramientas",allTools:"Todas",noTools:"Ninguna",testForTools:"Ejecuta Probar para inspeccionar y elegir herramientas individuales."},legal:{thirdPartyBrands:"Los nombres, logotipos y marcas de productos pertenecen a sus respectivos propietarios. Su uso es solo identificativo y no implica respaldo."},apps:{description:"Agrega CLI de apps y servicios MCP que nanobot puede usar desde el chat.",cliLabel:"CLI",mcpLabel:"MCP",filterAll:"Todo",filterCli:"Apps CLI",filterMcp:"Servicios MCP",enabledSummary:"{{count}} activados",caption:"{{cli}} CLI · {{mcp}} MCP",searchPlaceholder:"Buscar apps",featured:"Destacadas",loading:"Cargando apps...",empty:"Ninguna app coincide con este filtro."},automations:{filters:{all:"Todas",active:"Activas",paused:"Pausadas",failed:"Requieren atención",system:"Sistema"},sort:{next:"Próxima ejecución",last:"Última ejecución",updated:"Actualizada",name:"Nombre"},search:"Buscar tarea, mensaje, chat vinculado u horario",queue:"Cola",loading:"Cargando automatizaciones...",noMatches:"No hay automatizaciones que coincidan con esta vista.",empty:"Aún no hay automatizaciones.",emptyHint:"Créala desde donde debe ejecutarse para que nanobot conserve el contexto correcto.",oneShot:"Una vez",systemTask:"Automatización administrada por el sistema",labels:{schedule:"Programación",next:"Siguiente",origin:"Chat vinculado",created:"Creada",updated:"Actualizada"},runNow:"Ejecutar ahora",pause:"Pausar",resume:"Reanudar",edit:"Editar",delete:"Eliminar",protected:"Protegida",editTitle:"Editar automatización",save:"Guardar",deleteTitle:"Eliminar automatización",deleteDescription:"Esto elimina {{name}} del almacén cron. Los mensajes de chat anteriores permanecen en la sesión.",cancel:"Cancelar",status:{system:"Sistema",running:"Ejecutándose ahora",paused:"Pausada",failed:"Fallida",completed:"Completada",noSchedule:"Sin programación",active:"Activa"},origin:{system:"Sistema",unknown:"Sin chat vinculado"},channels:{api:"API",cli:"CLI",dingtalk:"DingTalk",discord:"Discord",email:"Email",feishu:"Feishu",matrix:"Matrix",msteams:"Microsoft Teams",qq:"QQ",slack:"Slack",telegram:"Telegram",wechat:"WeChat",wecom:"WeCom",weixin:"WeChat",whatsapp:"WhatsApp"},schedule:{at:"A las {{time}}",every:"Cada {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",withTz:"{{summary}} · {{tz}}",dailyAt:"Diaria a las {{time}}",weekdaysAt:"Días laborables a las {{time}}",hourlyAt:"Cada hora en :{{minute}}",hourlyWindow:"Cada hora {{start}}-{{end}} en :{{minute}}",custom:"Programación personalizada"},next:{paused:"Pausada",pending:"Ejecutándose ahora",none:"Sin próxima ejecución"},message:{showMore:"Mostrar mensaje completo",showLess:"Mostrar menos"},fields:{name:"Nombre",message:"Mensaje",scheduleType:"Tipo de programación",every:"Cada",unit:"Unidad",cronExpression:"Expresión cron",timezone:"Zona horaria",runAt:"Ejecutar a las"},scheduleTypes:{every:"Intervalo",cron:"Cron",at:"Una vez"},everyUnits:{second:"Segundos",minute:"Minutos",hour:"Horas",day:"Días"},validation:{nameRequired:"El nombre es obligatorio.",messageRequired:"El mensaje es obligatorio.",intervalRequired:"El intervalo debe ser un número positivo.",cronRequired:"La expresión cron es obligatoria.",timeRequired:"La hora de ejecución es obligatoria.",futureRequired:"La hora de ejecución debe estar en el futuro."}},oauth:{authentication:"Autenticación OAuth",signIn:"Iniciar sesión",signingIn:"Iniciando sesión...",signInAgain:"Iniciar sesión de nuevo",signOut:"Cerrar sesión",signedInAs:"Sesión iniciada como {{account}}",signInHelp:"Inicia sesión desde este dispositivo; no se guarda API key en config.",signInRequired:"Inicio de sesión requerido",signInBeforeSaving:"Inicia sesión antes de guardar este proveedor OAuth como proveedor activo.",signedIn:"Sesión iniciada",notSignedIn:"Sin sesión"},skills:{description:"Revisa las habilidades de instrucciones que este agente puede cargar durante una conversación.",caption:"{{available}} disponibles · {{total}} en total",featured:"Habilidades del agente",empty:"No hay habilidades disponibles.",sourceWorkspace:"Personalizada",sourceBuiltin:"Integradas",statusAvailable:"Disponible",statusUnavailable:"No disponible",unavailableReason:"Falta: {{reason}}",openDetails:"Abrir detalles de {{name}}",loadingDetail:"Cargando detalles de la habilidad...",loadFailed:"No se pudieron cargar los detalles.",descriptionTitle:"Descripción",source:"Origen",status:"Estado",requirements:"Requisitos",noRequirements:"Sin requisitos explícitos.",commands:"Comandos",environment:"Variables de entorno",missingCommands:"Falta CLI",missingEnvironment:"Falta ENV",unavailableReasonLabel:"Motivo de indisponibilidad",rawInstructions:"SKILL.md original",rawInstructionsEmpty:"No hay instrucciones originales.",detailDescription:"Detalles de {{name}}."},voice:{selectProvider:"Seleccionar proveedor",configureProvider:"Configurar proveedor",languageAuto:"Auto"}},UR={fallbackTitle:"Chat {{id}}",forkTitle:"Bifurcación: {{title}}",loading:"Cargando…",noSessions:"Todavía no hay sesiones.",showMore:"Mostrar {{count}} más",collapsed:"{{count}} chats ocultos",showLess:"Mostrar menos",actions:"Acciones del chat {{title}}",newInProject:"Iniciar un chat nuevo en {{project}}",activity:{running:"Agent running",complete:"Agent finished",updated:"New activity"},pin:"Pin",unpin:"Unpin",rename:"Rename",renameTitle:"Rename chat",renameDescription:"Choose a local sidebar name for this chat.",renamePlaceholder:"Chat name",renameProjectTitle:"Rename project",renameProjectDescription:"Choose a local sidebar name for this project.",renameProjectPlaceholder:"Project name",renameSave:"Save",archive:"Archive",unarchive:"Unarchive",showArchived:"Show archived",hideArchived:"Hide archived",delete:"Eliminar",newChat:"Nuevo chat",groups:{pinned:"Pinned",all:"Chats",projects:"Projects",today:"Today",yesterday:"Yesterday",earlier:"Earlier",archived:"Archived"}},BR={title:"¿Eliminar este chat?",description:"Esta acción no se puede deshacer.",cancel:"Cancelar",confirm:"Eliminar",automationsDescription:"Este chat tiene automatizaciones programadas. Al eliminarlo también se eliminarán.",moreAutomations:"+ {{count}} más",confirmWithAutomations:"Eliminar",schedule:{at:"{{time}}",every:"Cada {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"Programación personalizada"},next:{label:"Siguiente: {{time}}",disabled:"Pausada",none:"Sin próxima ejecución"}},HR={idle:"Inactivo",connecting:"Conectando…",open:"Conectado",reconnecting:"Reconectando…",closed:"Desconectado",error:"Error de conexión"},WR={loadingConversation:"Cargando conversación…",empty:{greetings:{workOn:"¿En qué trabajamos juntos?",start:"¿Por dónde empezamos?",build:"¿Qué construimos hoy?",tackle:"¿Qué resolvemos juntos?"},quickActions:{plan:{title:"Crear un plan de proyecto",prompt:"Crea un plan de proyecto conciso para lo que debería construir después."},analyze:{title:"Analizar estos datos",prompt:"Ayúdame a analizar estos datos y destaca los patrones más importantes."},brainstorm:{title:"Lluvia de ideas",prompt:"Propón algunas ideas prácticas y sus compensaciones para este problema."},code:{title:"Escribir código",prompt:"Ayúdame a escribir el código para esta tarea, empezando por el cambio útil más pequeño."},summarize:{title:"Resumir este documento",prompt:"Resume este documento y enumera las conclusiones clave."},more:{title:"Más",prompt:"Muéstrame algunas formas útiles en las que puedes ayudar en este workspace."}},imageQuickActions:{icon:{title:"Diseñar un icono de app",prompt:"Genera un icono de app 1:1 limpio para nanobot: robot amigable, estilo vectorial simple, paleta suave azul y blanca, sin texto."},sticker:{title:"Crear un sticker",prompt:"Genera una imagen estilo sticker de un pequeño asistente robot, con fondo de apariencia transparente, expresivo y divertido."},poster:{title:"Crear un póster",prompt:"Genera un concepto de póster pulido para un asistente personal de IA, composición moderna, jerarquía visual fuerte, apto para una landing page."},product:{title:"Mockup de producto",prompt:"Genera una imagen limpia de mockup de producto para una app web de IA conversacional, interfaz mínima, iluminación premium, marco de dispositivo realista."},portrait:{title:"Retrato estilizado",prompt:"Genera un retrato estilizado de un compañero de IA amigable, luz suave, detallado pero cercano, estilo de ilustración moderna."},edit:{title:"Editar una imagen",prompt:"Ayúdame a editar una imagen. Primero pídeme que suba o indique la imagen, y luego genera el resultado editado."}}},header:{toggleSidebar:"Mostrar u ocultar la barra lateral",newChat:"Iniciar un chat nuevo",toggleTheme:"Cambiar tema desde el encabezado",settings:"Abrir configuración",sessionInfo:"Detalles de la sesión"},sessionInfo:{title:"Sesión",untitled:"Chat sin título",automations:"Automatizaciones",count:"{{count}}",loading:"Cargando automatizaciones...",loadFailed:"No se pudieron cargar las automatizaciones.",empty:"Esta sesión aún no tiene automatizaciones.",disabled:"Desactivado",schedule:{at:"A las {{time}}",every:"Cada {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"Programación personalizada"},next:{label:"Siguiente {{time}}",pending:"Se ejecutará pronto",disabled:"En pausa",none:"Sin próxima ejecución"}},composer:{placeholderThread:"Escribe tu mensaje…",placeholderHero:"¿Qué tienes en mente?",placeholderOpening:"Abriendo un nuevo chat…",placeholderStreaming:"El modelo está respondiendo…",inputAria:"Entrada de mensaje",sendHint:"Enter para enviar · Shift+Enter para nueva línea",runRuntimeTitle:"En ejecución · {{elapsed}}",goalStateStrip:"Objetivo · {{label}}",goalStateFallback:"Objetivo",goalStateExpandAria:"Ver objetivo completo",goalStateSheetTitle:"Objetivo",goalStateCloseAria:"Cerrar objetivo",send:"Enviar mensaje",stop:"Detener respuesta",modelNotConfigured:"Modelo no configurado",configureModel:"Configurar modelo",queued:{label:"Guía en cola",guide:"Guiar",delete:"Eliminar guía",edit:"Editar guía",drag:"Arrastrar para reordenar"},attachImage:"Adjuntar imagen",imageMode:{label:"Generar imagen",toggle:"Activar o desactivar modo de generación de imágenes",placeholder:"Describe o edita una imagen…",aspectAria:"Relación de aspecto de imagen",aspectLabel:"Formato de imagen",aspect:{auto:"Auto","1_1":"Cuadrado 1:1","3_4":"Vertical 3:4","9_16":"Historia 9:16","4_3":"Horizontal 4:3","16_9":"Panorámico 16:9"}},tools:{search:"Buscar",reason:"Razonar",deepResearch:"Investigación profunda",voice:"Entrada de voz"},voice:{hint:"Haz clic para dictar o mantén",stop:"Detener grabación",transcribing:"Transcribiendo...",recordingStatus:"Grabando {{time}}"},voiceErrors:{unsupported:"Este navegador no admite entrada de voz.",permission:"Se requiere permiso de micrófono.",notConfigured:"Configura primero un proveedor de transcripción.",tooLong:"La grabación es demasiado larga.",tooShort:"Mantén pulsado un poco más para grabar voz.",noInput:"No se detectó entrada del micrófono.",failed:"No se pudo transcribir el audio."},slash:{ariaLabel:"Comandos slash",label:"comandos",navigateHint:"↑↓ Navegar",selectHint:"Enter/Tab Insertar",closeHint:"Esc Cerrar",commands:{new:{title:"Nuevo chat",description:"Detiene la tarea actual e inicia una conversación nueva."},stop:{title:"Detener tarea actual",description:"Cancela el turno activo del agent en este chat."},restart:{title:"Reiniciar nanobot",description:"Reinicia el proceso del bot en el mismo lugar."},status:{title:"Mostrar estado",description:"Muestra el estado del runtime, provider y channels."},model:{title:"Modelo",description:"Muestra o cambia el preset de modelo activo."},history:{title:"Mostrar historial",description:"Imprime los últimos N mensajes persistidos de la conversación."},dream:{title:"Ejecutar Dream",description:"Activa manualmente la consolidación de memoria."},dream_log:{title:"Mostrar registro de Dream",description:"Muestra qué cambió la última consolidación Dream."},dream_restore:{title:"Restaurar memoria",description:"Revierte la memoria a una instantánea Dream anterior."},goal:{title:"Objetivo a largo plazo",description:"Indica al agente que trate esto como un objetivo sostenido en varios pasos."},help:{title:"Mostrar ayuda",description:"Lista los comandos slash disponibles."},pairing:{title:"Emparejamiento",description:"Gestiona solicitudes de emparejamiento."}},badges:{current:"Actual",recent:"Reciente"},details:{goalActive:"El objetivo está en curso",goalReady:"Iniciar un objetivo sostenido",history:"Mostrar mensajes recientes",stopRunning:"En ejecución"}},encoding:"Procesando…",remove:"Quitar adjunto",normalizedSizeHint:"{{orig}} → {{current}} (auto)",imageRejected:{unsupported_type:"Tipo de archivo no compatible",too_many_images:"Máximo {{max}} imágenes por mensaje",magic_mismatch:"El archivo no parece una imagen real",decode_failed:"No se pudo decodificar esta imagen",too_large:"Imagen demasiado grande — prueba una más pequeña",io:"No se pudo leer este archivo"},mentions:{ariaLabel:"Apps",label:"Apps",cliGroup:"Apps CLI",mcpGroup:"Servicios MCP",cliBadge:"CLI",mcpBadge:"MCP",cliDescription:"Usar @{{name}} como app CLI local",mcpDescription:"Usar @{{name}} como servidor MCP"},workspace:{accessAria:"Workspace access mode",projectAria:"Elegir proyecto",projectPlaceholder:"Seleccionar proyecto",default:"Default Permission",full:"Full Access"}},scrollToBottom:"Desplazarse al final",loadEarlier:"Cargar mensajes anteriores",forkedFromHistory:"Bifurcado desde el historial",promptNavigator:{open:"Abrir navegador de prompts",title:"Prompts",search:"Buscar prompts",noResults:"No hay prompts coincidentes.",jumpTo:"Ir al prompt: {{label}}"}},qR={streaming:"transmitiendo",assistantTyping:"El asistente está escribiendo",toolSingle:"Usando una herramienta",toolMany:"Se usaron {{count}} herramientas",toolSummary:"{{count}} herramienta",toolSummaryMany:"{{count}} herramientas",reasoningTools:"Razonamiento · {{count}} herramientas",reasoningToolsSingular:"Razonamiento · 1 herramienta",reasoning:"Razonamiento",reasoningStreaming:"Pensando…",reasoningSummary:"Razonamiento",agentActivitySummary:"{{reasoning}} pasos · {{tools}} llamadas a herramientas",agentActivityToolsOnly:"{{tools}} llamadas a herramientas",agentActivityLiveSummary:"En curso… · {{reasoning}} pasos · {{tools}} llamadas a herramientas",agentActivityLiveToolsOnly:"En curso… · {{tools}} llamadas a herramientas",imageAttachment:"Imagen adjunta",forkFromHere:"Bifurcar",copyReply:"Copiar",copiedReply:"Copiado",turnLatencyTitle:"Tiempo de respuesta (extremo a extremo)",activityThinkingFor:"Pensando durante {{duration}}",activityThought:"Pensamiento completado",activityThoughtFor:"Pensó durante {{duration}}",activityWorkingFor:"Trabajando durante {{duration}}",activityWorked:"Trabajo completado",activityWorkedFor:"Trabajó durante {{duration}}",cliActivityRunningOne:"Usando @{{name}}",cliActivityRanOne:"Usó @{{name}}",cliActivityFailedOne:"Falló @{{name}}",cliActivityRunningMany:"Usando {{count}} apps CLI",cliActivityRanMany:"Usó {{count}} apps CLI",cliActivityFailedMany:"Fallaron {{count}} apps CLI",cliRunRunning:"Usando",cliRunRan:"Usado",cliRunFailed:"Falló",automationSourceFallback:"Automatización",automationTriggered:"Activada automáticamente"},VR={title:"Vista previa de imagen",open:"Ver imagen",prev:"Imagen anterior",next:"Imagen siguiente",close:"Cerrar vista previa"},KR={aria:"Vista previa de archivo",close:"Cerrar vista previa de archivo",loading:"Cargando vista previa...",failed:"No se pudo previsualizar este archivo.",routeMissing:"La vista previa necesita el gateway más reciente. Reinicia nanobot gateway e inténtalo de nuevo.",resize:"Cambiar el tamaño de la vista previa",truncated:"La vista previa está truncada porque el archivo es grande."},GR={fallbackLanguage:"código",copyAria:"Copiar código",copy:"Copiar",copied:"Copiado"},YR={dismiss:"Cerrar"},QR={messageTooBig:{title:"Mensaje demasiado grande",body:"El servidor rechazó tu último mensaje por superar el tamaño permitido. Quita algunas imágenes o usa archivos más pequeños y vuelve a enviarlo."},workspaceScopeRejected:{title:"Workspace was not changed",body:"Nanobot kept the previous workspace because the requested project or access mode was rejected by the gateway."}},XR={dialog:{defaultProject:"Default workspace",manual:"Pegar ruta",manualPlaceholder:"/Users/name/project",usePath:"Use Path",absolutePathRequired:"Enter an absolute folder path on this machine."}},JR={app:FR,sidebar:zR,settings:$R,chat:UR,deleteConfirm:BR,connection:HR,thread:WR,message:qR,lightbox:VR,filePreview:KR,code:GR,common:YR,errors:QR,workspace:XR},ZR={brand:"nanobot",loading:{connecting:"Đang kết nối tới nanobot…",boot:"Đang tải nanobot…"},error:{title:"Không thể kết nối tới nanobot",gatewayHint:"Hãy chắc chắn gateway đang chạy (`nanobot gateway`) và trang này được mở trên cùng máy."},auth:{title:"Cần xác thực",hint:"Nhập secret được cấu hình là tokenIssueSecret trong cấu hình gateway.",placeholder:"Mật khẩu",submit:"Kết nối",invalid:"Mật khẩu không hợp lệ. Hãy thử lại."},account:{section:"Tài khoản",logoutHint:"Ngắt kết nối trình duyệt này khỏi gateway.",logout:"Đăng xuất"},system:{section:"Hệ thống",restartHint:"Khởi động lại nanobot để áp dụng thay đổi runtime.",restart:"Khởi động lại nanobot",restarting:"Đang khởi động lại...",restartEngine:"Khởi động lại engine",restartingEngine:"Đang khởi động lại engine..."},restart:{completed:"Khởi động lại hoàn tất sau {{seconds}} giây."},documentTitle:{base:"nanobot",chat:"{{title}} · nanobot"},meta:{description:"Giao diện web nanobot — trò chuyện với workspace nanobot của bạn."}},eM={navigation:"Điều hướng thanh bên",collapse:"Thu gọn thanh bên",newChat:"Cuộc trò chuyện mới",searchAria:"Tìm kiếm",searchPlaceholder:"Tìm kiếm",searchResults:"Kết quả",noSearchResults:"Không có cuộc trò chuyện phù hợp.",recent:"Gần đây",settings:"Cài đặt",language:{label:"Ngôn ngữ",ariaLabel:"Đổi ngôn ngữ"},apps:"Ứng dụng",automations:"Tự động hóa",skills:{title:"Kỹ năng"}},tM={backToChat:"Quay lại chat",sidebar:{title:"Cài đặt",ariaLabel:"Mục cài đặt"},nav:{general:"Chung",byok:"BYOK",overview:"Tổng quan",appearance:"Giao diện",models:"Mô hình",providers:"Nhà cung cấp",image:"Hình ảnh",voice:"Giọng nói",browser:"Trang web",runtime:"Hệ thống",advanced:"Bảo mật",cliApps:"Ứng dụng CLI",mcp:"MCP",apps:"Ứng dụng",automations:"Tự động hóa",skills:"Kỹ năng"},sections:{interface:"Giao diện",ai:"AI",system:"Hệ thống",about:"Giới thiệu",status:"Trạng thái",localPreferences:"Tùy chọn cục bộ",presets:"Preset",imageGeneration:"Tạo hình ảnh",imageDefaults:"Mặc định",webSearch:"Tìm kiếm web",webBehavior:"Hành vi",identity:"Danh tính",webuiSafety:"An toàn WebUI",capabilities:"Khả năng",cliApps:"Ứng dụng CLI",mcp:"Dịch vụ MCP",apps:"Ứng dụng",nativeHost:"Host gốc",hostSafety:"An toàn ứng dụng",voiceInput:"Nhap giong noi"},rows:{theme:"Chủ đề",language:"Ngôn ngữ",provider:"Nhà cung cấp",model:"Mô hình",restart:"Khởi động lại nanobot",configPath:"Đường dẫn cấu hình",activePreset:"Preset đang dùng",gateway:"Cổng",restartState:"Trạng thái khởi động lại",pendingChanges:"Thay đổi chờ áp dụng",selectedPreset:"Preset đã chọn",presetModel:"Mô hình preset",density:"Mật độ",activityMode:"Chi tiết hoạt động",codeWrap:"Xuống dòng mã",maxResults:"Kết quả tối đa",timeout:"Thời gian chờ",jinaReader:"Trình đọc Jina",imageGeneration:"Tạo hình ảnh",imageProvider:"Nhà cung cấp hình ảnh",imageProviderStatus:"Trạng thái nhà cung cấp",imageProviderBase:"Địa chỉ nhà cung cấp",imageModel:"Mô hình hình ảnh",defaultAspectRatio:"Tỷ lệ mặc định",defaultImageSize:"Kích thước mặc định",maxImagesPerTurn:"Ảnh tối đa mỗi lượt",imageSaveDir:"Thư mục lưu",botName:"Tên bot",botIcon:"Biểu tượng bot",timezone:"Múi giờ",workspacePath:"Workspace mặc định",localServiceAccess:"Dịch vụ cục bộ",webuiDefaultAccess:"Quyền mặc định",currentModel:"Cấu hình hiện tại",brandLogos:"Logo thương hiệu",cliAppsCatalog:"Danh mục",cliAppsFilter:"Bộ lọc",engine:"Bộ máy",logs:"Nhật ký",diagnostics:"Chẩn đoán",contextWindow:"Cửa sổ ngữ cảnh",transcription:"Phien am",transcriptionProvider:"Nha cung cap",transcriptionProviderStatus:"Trang thai nha cung cap",transcriptionModel:"Mo hinh",transcriptionLanguage:"Ngon ngu",voiceLimits:"Gioi han"},help:{theme:"Chuyển giữa giao diện sáng và tối.",language:"Chọn ngôn ngữ dùng trong WebUI.",provider:"Selecciona el proveedor para nuevas solicitudes de modelo.",model:"Define el nombre de modelo predeterminado de nanobot.",configPath:"Archivo de configuración que usa actualmente el gateway.",selectedPreset:"Los preajustes con nombre son de solo lectura aquí; edítalos en config.json.",presetModel:"Chuyển sang Default để chỉnh sửa mô hình và nhà cung cấp từ WebUI.",density:"Chỉ lưu trong trình duyệt này.",activityMode:"Chọn mức chi tiết hoạt động agent hiển thị mặc định.",codeWrap:"Giữ các dòng mã dài dễ đọc trên màn hình nhỏ.",maxResults:"Resultados devueltos por cada llamada web_search.",timeout:"Segundos antes de que una solicitud de búsqueda expire.",jinaReader:"Usa Jina Reader para web_fetch cuando esté disponible.",imageGeneration:"Expone generate_image en chats cuando hay un proveedor de imagen configurado.",imageProvider:"Elige el proveedor registrado usado por generate_image.",imageProviderStatus:"La generación de imágenes reutiliza credenciales de Proveedores.",imageModel:"Nombre del modelo enviado al proveedor de imágenes seleccionado.",defaultAspectRatio:"Se usa cuando el prompt no elige una proporción.",defaultImageSize:"Gợi ý kích thước gửi tới nhà cung cấp hỗ trợ.",maxImagesPerTurn:"Giới hạn trên cho một yêu cầu generate_image.",botName:"Se muestra donde nanobot usa un nombre visible.",botIcon:"Emoji o texto corto junto al nombre del bot.",timezone:"Se usa para horarios y respuestas con conciencia temporal.",localServiceAccess:"Cho phép lệnh shell Full Access truy cập dịch vụ localhost.",webuiDefaultAccess:"Dùng cho chat web không có quyền riêng theo dự án.",securityManagedControls:"Las capturas web siempre protegen servicios locales, privados y metadata. La seguridad de canales core se gestiona en config.json.",currentModel:"Dùng cho các phản hồi mới.",selectedModelProvider:"Definido por el modelo seleccionado.",selectedModelValue:"Definido por el modelo seleccionado.",brandLogos:"Hiển thị logo nhà cung cấp bên thứ ba và CLI trong Cài đặt.",cliAppsCatalog:"Instala solo adaptadores CLI de apps que nanobot puede ejecutar localmente; las apps nativas no se modifican.",cliAppsFilter:"Busca por app, categoría o capacidad.",logs:"Abre la carpeta de registros del motor nativo.",diagnostics:"Exporta un pequeño informe de runtime para soporte.",localServiceAccessNative:"Permite que comandos shell con Full Access alcancen servicios en este Mac.",webuiDefaultAccessNative:"Usado por chats nativos sin permiso específico de proyecto.",contextWindow:"Chọn ngân sách ngữ cảnh mặc định cho cấu hình mô hình này.",transcription:"Phien am dau vao micro truoc khi gui. Tin nhan giong noi tu kenh chat dung cung cai dat.",transcriptionProvider:"Dung thong tin xac thuc cua nha cung cap tu Providers.",transcriptionProviderStatus:"API key nam trong providers, khong nam trong cai dat transcription.",transcriptionModel:"Giu mac dinh da resolve tru khi nha cung cap can id model tuy chinh.",transcriptionLanguage:"Goi y ISO-639 tuy chon, nhu en, zh, ja hoac ko."},values:{light:"Sáng",dark:"Tối",notAvailable:"Không khả dụng",enabled:"Đã bật",disabled:"Đã tắt",restartPending:"Chờ khởi động lại",ready:"Sẵn sàng",privateEngine:"Bộ máy riêng",unixSocket:"Socket Unix",defaultWorkspace:"Workspace mặc định",comfortable:"Thoải mái",compact:"Gọn",auto:"Tự động",expanded:"Mở rộng",on:"Bật",off:"Tắt",defaultPermission:"Quyền mặc định",fullAccess:"Toàn quyền",configured:"Đã cấu hình",notConfigured:"Chưa cấu hình",pending:"Đang chờ",restartingEngine:"Đang khởi động lại"},status:{loading:"Đang tải cài đặt...",loadError:"Không thể tải cài đặt",unsaved:"Có thay đổi chưa lưu.",upToDate:"Đã cập nhật.",savedRestart:"Guardado. Reinicia nanobot para aplicar.",restartAfterSaving:"Guarda los cambios y reinicia cuando puedas.",savedRestartApply:"Guardado. Reinicia cuando puedas.",imageProviderRestart:"Cambios del proveedor de imagen guardados. Reinicia cuando puedas.",hostRestartAfterSaving:"Al guardar, nanobot reiniciará su motor.",hostRestartPending:"Guardado. El motor se reiniciará cuando esté listo.",hostApiUnavailable:"Las acciones del host solo están disponibles en la app nativa.",logsOpened:"Carpeta de registros abierta.",logsOpenFailed:"No se pudo abrir la carpeta de registros.",diagnosticsExported:"Diagnóstico exportado a {{path}}.",diagnosticsExportFailed:"No se pudo exportar el diagnóstico."},actions:{save:"Lưu",saving:"Đang lưu",edit:"Sửa",cancel:"Hủy",open:"Mở",export:"Xuất",opening:"Đang mở...",exporting:"Đang xuất..."},byok:{description:"Dùng key provider của riêng bạn. Nanobot đọc các giá trị này từ config hiện tại, và chỉ provider đã cấu hình mới có thể chọn trong Chung.",configured:"Đã cấu hình",notConfigured:"Chưa cấu hình",configuredSection:"Đã cấu hình",notConfiguredSection:"Chưa cấu hình",showMore:"Hiển thị thêm {{count}}",showLess:"Thu gọn",apiKey:"API key",apiBase:"API base",apiKeyPlaceholder:"Nhập API key",apiKeyConfiguredPlaceholder:"Để trống để giữ key hiện tại",configuredKeyHint:"Key đã cấu hình",apiBasePlaceholder:"Dùng mặc định của provider",apiKeyRequired:"Cần API key để cấu hình provider này.",showApiKey:"Hiển thị API key",hideApiKey:"Ẩn API key",noConfiguredProviders:"Chưa có provider đã cấu hình",configureFirst:"Hãy cấu hình provider trong BYOK trước.",openByok:"Mở BYOK",tabs:{ariaLabel:"Loại thông tin xác thực BYOK",llm:"LLM",webSearch:"Tìm kiếm web"},webSearch:{provider:"Nhà cung cấp tìm kiếm",providerHelp:"Chọn backend mà công cụ web search sẽ dùng.",selectProvider:"Chọn provider",credentials:"Thông tin xác thực",noCredentialRequired:"Không cần key",noCredentialHelp:"DuckDuckGo hoạt động mà không cần lưu API key.",apiKeyHelp:"Được lưu trong config và chỉ hiện dạng che sau khi lưu.",baseUrl:"Base URL",baseUrlHelp:"SearXNG cần URL instance của bạn.",baseUrlPlaceholder:"https://search.example.com",apiKeyRequired:"Provider tìm kiếm này cần API key.",baseUrlRequired:"SearXNG cần Base URL.",missingCredential:"Thêm thông tin bắt buộc trước khi lưu.",saveHint:"Thay đổi áp dụng cho các yêu cầu web search mới."}},overview:{model:"Mô hình hiện tại",providers:"Nhà cung cấp",configuredCount:"{{count}} đã cấu hình",totalProviders:"{{count}} khả dụng",webSearch:"Tìm kiếm web",imageGeneration:"Tạo hình ảnh",voiceInput:"Nhập bằng giọng nói",workspace:"Không gian làm việc"},usage:{title:"Hoạt động token",shortTitle:"Token Usage",subtitle:"Mức dùng do nhà cung cấp báo cáo trong 12 tháng gần nhất.",empty:"Hoạt động token sẽ xuất hiện sau các phản hồi mô hình mới.",totalTokens:"Tổng token",peakTokens:"Đỉnh token",thirtyDayTokens:"Token 30 ngày",currentStreak:"Chuỗi hiện tại",longestStreak:"Chuỗi dài nhất",daysValue:"{{count}} ngày",last30:"30 ngày",activeDays:"Ngày hoạt động",requests:"Yêu cầu",estimated:"ước tính",includesEstimates:"bao gồm ước tính",cellTitle:"{{date}}: {{tokens}} tokens, {{requests}} yêu cầu",sources:{user:"Trò chuyện",api:"API",cron:"Tự động hóa",dream:"Bộ nhớ",system:"Hệ thống"}},providers:{searchPlaceholder:"Tìm nhà cung cấp",noMatches:"Không có nhà cung cấp phù hợp.",saveProvider:"Lưu nhà cung cấp"},image:{selectProvider:"Chọn nhà cung cấp",selectAspect:"Chọn tỷ lệ",selectSize:"Chọn kích thước",configureProvider:"Cấu hình nhà cung cấp",missingCredential:"Configura este proveedor antes de activar la generación de imágenes."},models:{selectModel:"Chọn mô hình",addConfiguration:"Thêm cấu hình",newConfiguration:"Cấu hình mô hình mới",newConfigurationHelp:"Lưu nhà cung cấp và mô hình thành một lựa chọn nhanh.",configurationName:"Tên cấu hình",configurationNameHelp:"Đổi tên cấu hình mô hình đã lưu này.",configurationNamePlaceholder:"Viết nhanh",searchModels:"Tìm kiếm hoặc nhập ID mô hình",useCustomModel:"Dùng",loadingModels:"Đang tải mô hình...",searchCatalog:"Tìm trong danh mục nhà cung cấp để chọn mô hình.",modelsAvailable:"khả dụng",noModelResults:"Không có mô hình phù hợp.",loadFailed:"Không tải được danh sách mô hình.",unsupportedModelList:"Nhập ID mô hình thủ công.",providerNotConfigured:"Hãy cấu hình nhà cung cấp này trước khi tải mô hình.",autoProviderCustomOnly:"Chế độ nhà cung cấp tự động dùng ID mô hình tùy chỉnh."},timezone:{select:"Chọn múi giờ",search:"Tìm múi giờ",empty:"Không có múi giờ phù hợp."},cliApps:{allCategories:"Tất cả danh mục",availableCount:"{{count}} ứng dụng",installedCount:"Đã cài {{count}}",summary:"Đã cài {{installed}} / {{total}} CLI",filterAll:"Tất cả",filterInstalled:"CLI đã cài",filterNotInstalled:"Chưa cài",searchPlaceholder:"Tìm CLI",statusInstalled:"Đã cài",statusAvailable:"Có sẵn",statusMissing:"Thiếu phụ thuộc",statusUnsupported:"Không hỗ trợ",statusNotInstalled:"Chưa cài",unsupported:"Không hỗ trợ",loading:"Đang tải ứng dụng CLI...",empty:"Không có ứng dụng CLI nào khớp bộ lọc này.",readyTitle:"@{{name}} đã sẵn sàng",readyStatus:"Sẵn sàng",readyPrompt:"Dùng @{{name}} để xem CLI này làm được gì.",readyTry:"Thử @{{name}}",readyCopied:"Đã sao chép",openChat:"Mở chat",requires:"Yêu cầu",test:"Kiểm tra CLI",update:"Cập nhật CLI",uninstall:"Gỡ CLI",install:"Cài CLI",unavailable:"Không khả dụng",noDescription:"Không có mô tả."},about:{version:"Phiên bản",checking:"Đang kiểm tra...",checkForUpdates:"Kiểm tra bản cập nhật",upToDate:"Bạn đang dùng phiên bản mới nhất",updateAvailable:"Có bản cập nhật v{{version}}"},mcp:{allCategories:"Tất cả danh mục",summary:"Đã bật {{installed}} / {{total}} preset",filterAll:"Tất cả",filterInstalled:"Đã bật",filterNotInstalled:"Chưa bật",searchPlaceholder:"Tìm preset MCP",moreOptions:"Tùy chọn MCP khác",moreOptionsSubtitle:"Thêm máy chủ tùy chỉnh hoặc nhập mcp.json.",customTitle:"MCP tùy chỉnh",customSubtitle:"Thêm bất kỳ máy chủ MCP stdio, HTTP hoặc SSE nào.",customAction:"Tùy chỉnh",importAction:"Nhập",serverName:"Tên máy chủ",serverUrl:"URL",transport:"Giao thức truyền",command:"Lệnh",args:"Args JSON",headers:"Headers JSON",env:"Env JSON",timeout:"Thời gian chờ công cụ",advancedOptions:"Tùy chọn nâng cao",hideAdvanced:"Ẩn nâng cao",saveCustom:"Lưu MCP",configImport:"Nhập mcp.json",importConfig:"Nhập",restartRequired:"Khởi động lại nanobot để kết nối các công cụ MCP đã cập nhật.",toolsFound:"{{count}} công cụ",loading:"Đang tải preset MCP...",empty:"Không có preset MCP nào khớp bộ lọc này.",openDocs:"Mở tài liệu",test:"Kiểm tra",remove:"Xóa",enable:"Bật",enabled:"Đã bật",setup:"Kết nối",configure:"Kết nối",connectTitle:"Kết nối {{name}}",connectHint:"Thêm khóa từ phần cài đặt tài khoản của bạn.",saveAndEnable:"Lưu và bật",updateSetup:"Cập nhật thiết lập",configured:"đã cấu hình",keepExisting:"Để trống để giữ giá trị hiện tại",statusConfigured:"Đã cấu hình",statusMissingCredentials:"Cần khóa",statusMissingDependency:"Cần phụ thuộc",statusComingSoon:"Sắp ra mắt",statusNotInstalled:"Chưa bật",toolScope:"Công cụ",allTools:"Tất cả",noTools:"Không có",testForTools:"Chạy Kiểm tra để xem và chọn từng công cụ."},legal:{thirdPartyBrands:"Tên sản phẩm, logo và thương hiệu thuộc về chủ sở hữu tương ứng. Việc sử dụng chỉ nhằm nhận diện và không ngụ ý được xác nhận."},apps:{description:"Thêm CLI ứng dụng và dịch vụ MCP mà nanobot có thể dùng trong chat.",cliLabel:"CLI",mcpLabel:"MCP",filterAll:"Tất cả",filterCli:"Ứng dụng CLI",filterMcp:"Dịch vụ MCP",enabledSummary:"{{count}} đã bật",caption:"{{cli}} CLI · {{mcp}} MCP",searchPlaceholder:"Tìm ứng dụng",featured:"Nổi bật",loading:"Đang tải ứng dụng...",empty:"Không có ứng dụng phù hợp."},automations:{filters:{all:"Tất cả",active:"Đang chạy",paused:"Đã tạm dừng",failed:"Cần xử lý",system:"Hệ thống"},sort:{next:"Lần chạy tiếp theo",last:"Lần chạy trước",updated:"Đã cập nhật",name:"Tên"},search:"Tìm tác vụ, tin nhắn, cuộc trò chuyện liên kết hoặc lịch",queue:"Hàng đợi",loading:"Đang tải tự động hóa...",noMatches:"Không có tự động hóa phù hợp với chế độ xem này.",empty:"Chưa có tự động hóa.",emptyHint:"Tạo từ nơi tác vụ sẽ chạy để nanobot giữ đúng ngữ cảnh.",oneShot:"Một lần",systemTask:"Tự động hóa do hệ thống quản lý",labels:{schedule:"Lịch",next:"Tiếp theo",origin:"Cuộc trò chuyện liên kết",created:"Đã tạo",updated:"Đã cập nhật"},runNow:"Chạy ngay",pause:"Tạm dừng",resume:"Tiếp tục",edit:"Sửa",delete:"Xóa",protected:"Được bảo vệ",editTitle:"Sửa tự động hóa",save:"Lưu",deleteTitle:"Xóa tự động hóa",deleteDescription:"Thao tác này xóa {{name}} khỏi kho cron. Tin nhắn chat trước đó vẫn ở trong phiên.",cancel:"Hủy",status:{system:"Hệ thống",running:"Đang chạy",paused:"Đã tạm dừng",failed:"Thất bại",completed:"Hoàn tất",noSchedule:"Không có lịch",active:"Đang chạy"},origin:{system:"Hệ thống",unknown:"Chưa liên kết cuộc trò chuyện"},channels:{api:"API",cli:"CLI",dingtalk:"DingTalk",discord:"Discord",email:"Email",feishu:"Feishu",matrix:"Matrix",msteams:"Microsoft Teams",qq:"QQ",slack:"Slack",telegram:"Telegram",wechat:"WeChat",wecom:"WeCom",weixin:"WeChat",whatsapp:"WhatsApp"},schedule:{at:"Vào {{time}}",every:"Mỗi {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",withTz:"{{summary}} · {{tz}}",dailyAt:"Hằng ngày lúc {{time}}",weekdaysAt:"Ngày làm việc lúc {{time}}",hourlyAt:"Mỗi giờ tại :{{minute}}",hourlyWindow:"Mỗi giờ {{start}}-{{end}} tại :{{minute}}",custom:"Lịch tùy chỉnh"},next:{paused:"Đã tạm dừng",pending:"Đang chạy",none:"Không có lần chạy tiếp theo"},message:{showMore:"Hiển thị toàn bộ tin nhắn",showLess:"Thu gọn"},fields:{name:"Tên",message:"Tin nhắn",scheduleType:"Loại lịch",every:"Mỗi",unit:"Đơn vị",cronExpression:"Biểu thức cron",timezone:"Múi giờ",runAt:"Chạy lúc"},scheduleTypes:{every:"Khoảng lặp",cron:"Cron",at:"Một lần"},everyUnits:{second:"Giây",minute:"Phút",hour:"Giờ",day:"Ngày"},validation:{nameRequired:"Tên là bắt buộc.",messageRequired:"Tin nhắn là bắt buộc.",intervalRequired:"Khoảng lặp phải là số dương.",cronRequired:"Biểu thức cron là bắt buộc.",timeRequired:"Thời gian chạy là bắt buộc.",futureRequired:"Thời gian chạy phải ở tương lai."}},oauth:{authentication:"Xác thực OAuth",signIn:"Đăng nhập",signingIn:"Đang đăng nhập...",signInAgain:"Đăng nhập lại",signOut:"Đăng xuất",signedInAs:"Đã đăng nhập bằng {{account}}",signInHelp:"Inicia sesión desde este dispositivo; no se guarda API key en config.",signInRequired:"Cần đăng nhập",signInBeforeSaving:"Inicia sesión antes de guardar este proveedor OAuth como proveedor activo.",signedIn:"Đã đăng nhập",notSignedIn:"Chưa đăng nhập"},skills:{description:"Xem các kỹ năng chỉ dẫn mà agent này có thể tải trong cuộc trò chuyện.",caption:"{{available}} khả dụng · tổng {{total}}",featured:"Kỹ năng agent",empty:"Không có kỹ năng nào khả dụng.",sourceWorkspace:"Tùy chỉnh",sourceBuiltin:"Tích hợp",statusAvailable:"Khả dụng",statusUnavailable:"Không khả dụng",unavailableReason:"Thiếu: {{reason}}",openDetails:"Mở chi tiết {{name}}",loadingDetail:"Đang tải chi tiết kỹ năng...",loadFailed:"Không tải được chi tiết kỹ năng.",descriptionTitle:"Mô tả",source:"Nguồn",status:"Trạng thái",requirements:"Yêu cầu",noRequirements:"Không có yêu cầu rõ ràng.",commands:"Lệnh",environment:"Biến môi trường",missingCommands:"Thiếu CLI",missingEnvironment:"Thiếu ENV",unavailableReasonLabel:"Lý do không khả dụng",rawInstructions:"SKILL.md gốc",rawInstructionsEmpty:"Không có hướng dẫn gốc.",detailDescription:"Chi tiết cho {{name}}."},voice:{selectProvider:"Chon nha cung cap",configureProvider:"Cau hinh nha cung cap",languageAuto:"Tu dong"}},nM={fallbackTitle:"Trò chuyện {{id}}",forkTitle:"Nhánh: {{title}}",loading:"Đang tải…",noSessions:"Chưa có phiên nào.",showMore:"Hiển thị thêm {{count}}",collapsed:"Đã thu gọn {{count}} cuộc trò chuyện",showLess:"Thu gọn",actions:"Tác vụ cho cuộc trò chuyện {{title}}",newInProject:"Bắt đầu cuộc trò chuyện mới trong {{project}}",activity:{running:"Agent running",complete:"Agent finished",updated:"New activity"},pin:"Pin",unpin:"Unpin",rename:"Rename",renameTitle:"Rename chat",renameDescription:"Choose a local sidebar name for this chat.",renamePlaceholder:"Chat name",renameProjectTitle:"Rename project",renameProjectDescription:"Choose a local sidebar name for this project.",renameProjectPlaceholder:"Project name",renameSave:"Save",archive:"Archive",unarchive:"Unarchive",showArchived:"Show archived",hideArchived:"Hide archived",delete:"Xóa",newChat:"Cuộc trò chuyện mới",groups:{pinned:"Pinned",all:"Chats",projects:"Projects",today:"Today",yesterday:"Yesterday",earlier:"Earlier",archived:"Archived"}},rM={title:"Xóa cuộc trò chuyện này?",description:"Không thể hoàn tác thao tác này.",cancel:"Hủy",confirm:"Xóa",automationsDescription:"Cuộc trò chuyện này có các tự động hóa đã lên lịch. Xóa cuộc trò chuyện cũng sẽ xóa chúng.",moreAutomations:"+ {{count}} mục nữa",confirmWithAutomations:"Xóa",schedule:{at:"{{time}}",every:"Mỗi {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"Lịch tùy chỉnh"},next:{label:"Tiếp theo: {{time}}",disabled:"Đã tạm dừng",none:"Không có lần chạy tiếp theo"}},aM={idle:"Rảnh",connecting:"Đang kết nối…",open:"Đã kết nối",reconnecting:"Đang kết nối lại…",closed:"Đã ngắt kết nối",error:"Lỗi kết nối"},oM={loadingConversation:"Đang tải cuộc trò chuyện…",empty:{greetings:{workOn:"Mình cùng làm gì tiếp?",start:"Hôm nay bắt đầu từ đâu?",build:"Hôm nay mình xây dựng gì?",tackle:"Mình cùng xử lý việc gì?"},quickActions:{plan:{title:"Tạo kế hoạch dự án",prompt:"Tạo một kế hoạch dự án ngắn gọn cho việc tôi nên xây dựng tiếp theo."},analyze:{title:"Phân tích dữ liệu này",prompt:"Giúp tôi phân tích dữ liệu này và chỉ ra các mẫu quan trọng nhất."},brainstorm:{title:"Động não ý tưởng",prompt:"Động não vài ý tưởng thực tế và các đánh đổi cho vấn đề này."},code:{title:"Viết mã",prompt:"Giúp tôi viết mã cho nhiệm vụ này, bắt đầu từ thay đổi hữu ích nhỏ nhất."},summarize:{title:"Tóm tắt tài liệu này",prompt:"Tóm tắt tài liệu này và liệt kê các ý chính."},more:{title:"Thêm",prompt:"Cho tôi xem vài cách hữu ích mà bạn có thể giúp trong workspace này."}},imageQuickActions:{icon:{title:"Thiết kế biểu tượng app",prompt:"Tạo một biểu tượng ứng dụng 1:1 gọn gàng cho nanobot: robot thân thiện, phong cách vector đơn giản, bảng màu xanh trắng dịu, không có chữ."},sticker:{title:"Tạo sticker",prompt:"Tạo một hình kiểu sticker dễ thương của trợ lý robot nhỏ, nền trông như trong suốt, biểu cảm và vui nhộn."},poster:{title:"Tạo poster",prompt:"Tạo một ý tưởng poster chỉn chu cho trợ lý AI cá nhân, bố cục hiện đại, phân cấp thị giác rõ, phù hợp cho landing page."},product:{title:"Mockup sản phẩm",prompt:"Tạo một hình mockup sản phẩm gọn gàng cho ứng dụng web AI hội thoại, giao diện tối giản, ánh sáng cao cấp, khung thiết bị chân thực."},portrait:{title:"Chân dung cách điệu",prompt:"Tạo chân dung cách điệu của một người bạn đồng hành AI thân thiện, ánh sáng mềm, chi tiết nhưng dễ gần, phong cách minh họa hiện đại."},edit:{title:"Chỉnh sửa ảnh",prompt:"Giúp tôi chỉnh sửa một ảnh. Trước tiên hãy yêu cầu tôi tải lên hoặc chỉ định ảnh, rồi tạo kết quả đã chỉnh sửa."}}},header:{toggleSidebar:"Bật/tắt thanh bên",newChat:"Bắt đầu chat mới",toggleTheme:"Chuyển chủ đề từ header",settings:"Mở cài đặt",sessionInfo:"Chi tiết phiên"},sessionInfo:{title:"Phiên",untitled:"Chat chưa đặt tên",automations:"Tự động hóa",count:"{{count}}",loading:"Đang tải tự động hóa...",loadFailed:"Không thể tải tự động hóa.",empty:"Phiên này chưa có tự động hóa.",disabled:"Tắt",schedule:{at:"Lúc {{time}}",every:"Mỗi {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"Lịch tùy chỉnh"},next:{label:"Tiếp theo {{time}}",pending:"Sắp chạy",disabled:"Đã tạm dừng",none:"Không có lần chạy tiếp theo"}},composer:{placeholderThread:"Nhập tin nhắn…",placeholderHero:"Bạn đang nghĩ gì?",placeholderOpening:"Đang mở cuộc trò chuyện mới…",placeholderStreaming:"Mô hình đang trả lời…",inputAria:"Ô nhập tin nhắn",sendHint:"Enter để gửi · Shift+Enter để xuống dòng",runRuntimeTitle:"Đang chạy · {{elapsed}}",goalStateStrip:"Mục tiêu · {{label}}",goalStateFallback:"Mục tiêu",goalStateExpandAria:"Xem đầy đủ mục tiêu",goalStateSheetTitle:"Mục tiêu",goalStateCloseAria:"Đóng mục tiêu",send:"Gửi tin nhắn",stop:"Dừng phản hồi",modelNotConfigured:"Chưa cấu hình mô hình",configureModel:"Cấu hình mô hình",queued:{label:"Hướng dẫn đang chờ",guide:"Hướng dẫn",delete:"Xóa hướng dẫn",edit:"Sửa hướng dẫn",drag:"Kéo để sắp xếp"},attachImage:"Đính kèm ảnh",imageMode:{label:"Tạo ảnh",toggle:"Bật/tắt chế độ tạo ảnh",placeholder:"Mô tả hoặc chỉnh sửa ảnh…",aspectAria:"Tỷ lệ khung hình ảnh",aspectLabel:"Tỷ lệ ảnh",aspect:{auto:"Tự động","1_1":"Vuông 1:1","3_4":"Dọc 3:4","9_16":"Story 9:16","4_3":"Ngang 4:3","16_9":"Rộng 16:9"}},tools:{search:"Tìm kiếm",reason:"Suy luận",deepResearch:"Nghiên cứu sâu",voice:"Nhập bằng giọng nói"},voice:{hint:"Bấm để đọc chính tả hoặc nhấn giữ",stop:"Dừng ghi âm",transcribing:"Đang chép lời...",recordingStatus:"Đang ghi {{time}}"},voiceErrors:{unsupported:"Trình duyệt này không hỗ trợ nhập bằng giọng nói.",permission:"Cần quyền truy cập micrô.",notConfigured:"Hãy cấu hình nhà cung cấp chép lời trước.",tooLong:"Bản ghi âm quá dài.",tooShort:"Giữ lâu hơn một chút để ghi âm giọng nói.",noInput:"Không phát hiện đầu vào micrô.",failed:"Không thể chép lời âm thanh."},slash:{ariaLabel:"Lệnh slash",label:"lệnh",navigateHint:"↑↓ Chọn",selectHint:"Enter/Tab Chèn",closeHint:"Esc Đóng",commands:{new:{title:"Cuộc trò chuyện mới",description:"Dừng tác vụ hiện tại và bắt đầu một cuộc trò chuyện mới."},stop:{title:"Dừng tác vụ hiện tại",description:"Hủy lượt agent đang chạy trong cuộc trò chuyện này."},restart:{title:"Khởi động lại nanobot",description:"Khởi động lại tiến trình bot tại chỗ."},status:{title:"Hiển thị trạng thái",description:"Hiển thị trạng thái runtime, provider và channel."},model:{title:"Mô hình",description:"Hiển thị hoặc chuyển preset mô hình đang hoạt động."},history:{title:"Hiển thị lịch sử",description:"In N tin nhắn hội thoại đã lưu gần nhất."},dream:{title:"Chạy Dream",description:"Kích hoạt thủ công quá trình hợp nhất bộ nhớ."},dream_log:{title:"Hiển thị nhật ký Dream",description:"Hiển thị những gì lần hợp nhất Dream gần nhất đã thay đổi."},dream_restore:{title:"Khôi phục bộ nhớ",description:"Đưa bộ nhớ về một snapshot Dream trước đó."},goal:{title:"Mục tiêu dài hạn",description:"Yêu cầu agent xử lý đây là mục tiêu nhiều bước kéo dài."},help:{title:"Hiển thị trợ giúp",description:"Liệt kê các lệnh slash có sẵn."},pairing:{title:"Ghép nối",description:"Quản lý yêu cầu ghép nối."}},badges:{current:"Hiện tại",recent:"Gần đây"},details:{goalActive:"Mục tiêu đang chạy",goalReady:"Bắt đầu mục tiêu duy trì",history:"Hiển thị tin nhắn gần đây",stopRunning:"Đang chạy"}},encoding:"Đang xử lý…",remove:"Xóa tệp đính kèm",normalizedSizeHint:"{{orig}} → {{current}} (tự động)",imageRejected:{unsupported_type:"Loại tệp không được hỗ trợ",too_many_images:"Tối đa {{max}} ảnh mỗi tin nhắn",magic_mismatch:"Tệp này không phải là một ảnh thực",decode_failed:"Không thể giải mã ảnh này",too_large:"Ảnh quá lớn — hãy thử ảnh nhỏ hơn",io:"Không thể đọc tệp này"},mentions:{ariaLabel:"Ứng dụng",label:"Ứng dụng",cliGroup:"Ứng dụng CLI",mcpGroup:"Dịch vụ MCP",cliBadge:"CLI",mcpBadge:"MCP",cliDescription:"Dùng @{{name}} như ứng dụng CLI cục bộ",mcpDescription:"Dùng @{{name}} như máy chủ MCP"},workspace:{accessAria:"Workspace access mode",projectAria:"Chọn dự án",projectPlaceholder:"Chọn dự án",default:"Default Permission",full:"Full Access"}},scrollToBottom:"Cuộn xuống cuối",loadEarlier:"Tải tin nhắn trước đó",forkedFromHistory:"Tách nhánh từ lịch sử",promptNavigator:{open:"Mở trình điều hướng prompt",title:"Prompt",search:"Tìm prompt",noResults:"Không có prompt phù hợp.",jumpTo:"Nhảy tới prompt: {{label}}"}},sM={streaming:"đang truyền",assistantTyping:"Trợ lý đang nhập",toolSingle:"Đang dùng một công cụ",toolMany:"Đã dùng {{count}} công cụ",toolSummary:"{{count}} công cụ",toolSummaryMany:"{{count}} công cụ",reasoningTools:"Suy luận · {{count}} công cụ",reasoningToolsSingular:"Suy luận · 1 công cụ",reasoning:"Suy luận",reasoningStreaming:"Đang suy nghĩ…",reasoningSummary:"Suy luận",agentActivitySummary:"{{reasoning}} bước · {{tools}} lần gọi công cụ",agentActivityToolsOnly:"{{tools}} lần gọi công cụ",agentActivityLiveSummary:"Đang chạy… · {{reasoning}} bước · {{tools}} lần gọi công cụ",agentActivityLiveToolsOnly:"Đang chạy… · {{tools}} lần gọi công cụ",imageAttachment:"Tệp hình ảnh đính kèm",forkFromHere:"Tách nhánh",copyReply:"Sao chép",copiedReply:"Đã sao chép",turnLatencyTitle:"Thời gian phản hồi (end-to-end)",activityThinkingFor:"Đang suy nghĩ trong {{duration}}",activityThought:"Đã suy nghĩ",activityThoughtFor:"Đã suy nghĩ trong {{duration}}",activityWorkingFor:"Đang xử lý trong {{duration}}",activityWorked:"Đã xử lý",activityWorkedFor:"Đã xử lý trong {{duration}}",cliActivityRunningOne:"Đang dùng @{{name}}",cliActivityRanOne:"Đã dùng @{{name}}",cliActivityFailedOne:"@{{name}} thất bại",cliActivityRunningMany:"Đang dùng {{count}} ứng dụng CLI",cliActivityRanMany:"Đã dùng {{count}} ứng dụng CLI",cliActivityFailedMany:"{{count}} ứng dụng CLI thất bại",cliRunRunning:"Đang dùng",cliRunRan:"Đã dùng",cliRunFailed:"Thất bại",automationSourceFallback:"Tự động hóa",automationTriggered:"Tự động kích hoạt"},iM={title:"Xem trước ảnh",open:"Xem ảnh",prev:"Ảnh trước",next:"Ảnh tiếp theo",close:"Đóng xem trước"},lM={aria:"Xem trước tệp",close:"Đóng xem trước tệp",loading:"Đang tải bản xem trước...",failed:"Không thể xem trước tệp này.",routeMissing:"Xem trước tệp cần gateway mới nhất. Hãy khởi động lại nanobot gateway rồi thử lại.",resize:"Đổi kích thước bản xem trước tệp",truncated:"Bản xem trước bị cắt vì tệp này lớn."},cM={fallbackLanguage:"mã",copyAria:"Sao chép mã",copy:"Sao chép",copied:"Đã sao chép"},uM={dismiss:"Đóng"},dM={messageTooBig:{title:"Tin nhắn quá lớn",body:"Máy chủ đã từ chối tin nhắn trước vì vượt quá giới hạn kích thước. Hãy bớt ảnh hoặc chọn tệp nhỏ hơn rồi thử lại."},workspaceScopeRejected:{title:"Workspace was not changed",body:"Nanobot kept the previous workspace because the requested project or access mode was rejected by the gateway."}},pM={dialog:{defaultProject:"Default workspace",manual:"Dán đường dẫn",manualPlaceholder:"/Users/name/project",usePath:"Use Path",absolutePathRequired:"Enter an absolute folder path on this machine."}},mM={app:ZR,sidebar:eM,settings:tM,chat:nM,deleteConfirm:rM,connection:aM,thread:oM,message:sM,lightbox:iM,filePreview:lM,code:cM,common:uM,errors:dM,workspace:pM},fM={brand:"nanobot",loading:{connecting:"Menghubungkan ke nanobot…",boot:"Memuat nanobot…"},error:{title:"Tidak dapat menjangkau nanobot",gatewayHint:"Pastikan gateway sedang berjalan (`nanobot gateway`) dan halaman ini dibuka pada mesin yang sama."},auth:{title:"Autentikasi diperlukan",hint:"Masukkan secret yang dikonfigurasi sebagai tokenIssueSecret di konfigurasi gateway.",placeholder:"Kata sandi",submit:"Hubungkan",invalid:"Kata sandi tidak valid. Coba lagi."},account:{section:"Akun",logoutHint:"Putuskan browser ini dari gateway.",logout:"Keluar"},system:{section:"Sistem",restartHint:"Mulai ulang nanobot untuk menerapkan perubahan runtime.",restart:"Mulai ulang nanobot",restarting:"Memulai ulang...",restartEngine:"Mulai ulang engine",restartingEngine:"Memulai ulang engine..."},restart:{completed:"Mulai ulang selesai dalam {{seconds}} dtk."},documentTitle:{base:"nanobot",chat:"{{title}} · nanobot"},meta:{description:"UI web nanobot — ngobrol dengan workspace nanobot Anda."}},hM={navigation:"Navigasi bilah samping",collapse:"Ciutkan sidebar",newChat:"Obrolan baru",searchAria:"Cari",searchPlaceholder:"Cari",searchResults:"Hasil",noSearchResults:"Tidak ada chat yang cocok.",recent:"Terbaru",settings:"Pengaturan",language:{label:"Bahasa",ariaLabel:"Ganti bahasa"},apps:"Aplikasi",automations:"Otomasi",skills:{title:"Skill"}},gM={backToChat:"Kembali ke chat",sidebar:{title:"Pengaturan",ariaLabel:"Bagian pengaturan"},nav:{general:"Umum",byok:"BYOK",overview:"Ikhtisar",appearance:"Tampilan",models:"Model",providers:"Penyedia",image:"Gambar",voice:"Suara",browser:"Internet",runtime:"Sistem",advanced:"Keamanan",cliApps:"Aplikasi CLI",mcp:"MCP",apps:"Aplikasi",automations:"Otomasi",skills:"Skill"},sections:{interface:"Antarmuka",ai:"AI",system:"Sistem",about:"Tentang",status:"Status",localPreferences:"Preferensi lokal",presets:"Preset",imageGeneration:"Pembuatan gambar",imageDefaults:"Default",webSearch:"Pencarian web",webBehavior:"Perilaku",identity:"Identitas",webuiSafety:"Keamanan WebUI",capabilities:"Kemampuan",cliApps:"Aplikasi CLI",mcp:"Layanan MCP",apps:"Aplikasi",nativeHost:"Host native",hostSafety:"Keamanan aplikasi",voiceInput:"Input suara"},rows:{theme:"Tema",language:"Bahasa",provider:"Penyedia",model:"Model",restart:"Mulai ulang nanobot",configPath:"Path konfigurasi",activePreset:"Preset aktif",gateway:"Gerbang",restartState:"Status mulai ulang",pendingChanges:"Perubahan tertunda",selectedPreset:"Preset terpilih",presetModel:"Model preset",density:"Kerapatan",activityMode:"Detail aktivitas",codeWrap:"Bungkus kode",maxResults:"Hasil maksimum",timeout:"Batas waktu",jinaReader:"Pembaca Jina",imageGeneration:"Pembuatan gambar",imageProvider:"Penyedia gambar",imageProviderStatus:"Status penyedia",imageProviderBase:"Basis penyedia",imageModel:"Model gambar",defaultAspectRatio:"Rasio default",defaultImageSize:"Ukuran default",maxImagesPerTurn:"Maks. gambar per giliran",imageSaveDir:"Direktori simpan",botName:"Nama bot",botIcon:"Ikon bot",timezone:"Zona waktu",workspacePath:"Workspace default",localServiceAccess:"Layanan lokal",webuiDefaultAccess:"Akses default",currentModel:"Konfigurasi saat ini",brandLogos:"Logo merek",cliAppsCatalog:"Katalog",cliAppsFilter:"Saring",engine:"Mesin",logs:"Log",diagnostics:"Diagnostik",contextWindow:"Jendela konteks",transcription:"Transkripsi",transcriptionProvider:"Penyedia",transcriptionProviderStatus:"Status penyedia",transcriptionModel:"Model",transcriptionLanguage:"Bahasa",voiceLimits:"Batas"},help:{theme:"Beralih antara tampilan terang dan gelap.",language:"Pilih bahasa yang digunakan WebUI.",provider:"Selecciona el proveedor para nuevas solicitudes de modelo.",model:"Define el nombre de modelo predeterminado de nanobot.",configPath:"Archivo de configuración que usa actualmente el gateway.",selectedPreset:"Los preajustes con nombre son de solo lectura aquí; edítalos en config.json.",presetModel:"Beralih ke Default untuk mengedit model dan penyedia dari WebUI.",density:"Hanya disimpan di browser ini.",activityMode:"Pilih seberapa banyak detail aktivitas agen yang ditampilkan secara default.",codeWrap:"Menjaga baris kode panjang tetap terbaca di layar kecil.",maxResults:"Resultados devueltos por cada llamada web_search.",timeout:"Segundos antes de que una solicitud de búsqueda expire.",jinaReader:"Usa Jina Reader para web_fetch cuando esté disponible.",imageGeneration:"Expone generate_image en chats cuando hay un proveedor de imagen configurado.",imageProvider:"Elige el proveedor registrado usado por generate_image.",imageProviderStatus:"La generación de imágenes reutiliza credenciales de Proveedores.",imageModel:"Nombre del modelo enviado al proveedor de imágenes seleccionado.",defaultAspectRatio:"Se usa cuando el prompt no elige una proporción.",defaultImageSize:"Petunjuk ukuran yang dikirim ke penyedia yang mendukungnya.",maxImagesPerTurn:"Batas atas untuk satu permintaan generate_image.",botName:"Se muestra donde nanobot usa un nombre visible.",botIcon:"Emoji o texto corto junto al nombre del bot.",timezone:"Se usa para horarios y respuestas con conciencia temporal.",localServiceAccess:"Izinkan perintah shell Full Access menjangkau layanan localhost.",webuiDefaultAccess:"Digunakan oleh chat web tanpa izin khusus proyek.",securityManagedControls:"Las capturas web siempre protegen servicios locales, privados y metadata. La seguridad de canales core se gestiona en config.json.",currentModel:"Digunakan untuk balasan baru.",selectedModelProvider:"Definido por el modelo seleccionado.",selectedModelValue:"Definido por el modelo seleccionado.",brandLogos:"Tampilkan logo penyedia pihak ketiga dan CLI di Pengaturan.",cliAppsCatalog:"Instala solo adaptadores CLI de apps que nanobot puede ejecutar localmente; las apps nativas no se modifican.",cliAppsFilter:"Busca por app, categoría o capacidad.",logs:"Abre la carpeta de registros del motor nativo.",diagnostics:"Exporta un pequeño informe de runtime para soporte.",localServiceAccessNative:"Permite que comandos shell con Full Access alcancen servicios en este Mac.",webuiDefaultAccessNative:"Usado por chats nativos sin permiso específico de proyecto.",contextWindow:"Pilih anggaran konteks default untuk konfigurasi model ini.",transcription:"Transkripsikan input mikrofon sebelum dikirim. Pesan suara channel memakai pengaturan yang sama.",transcriptionProvider:"Menggunakan kredensial penyedia yang sesuai dari Providers.",transcriptionProviderStatus:"API key tetap berada di providers, bukan di pengaturan transkripsi.",transcriptionModel:"Biarkan memakai default yang teresolusi kecuali penyedia membutuhkan id model khusus.",transcriptionLanguage:"Petunjuk ISO-639 opsional, seperti en, zh, ja, atau ko."},values:{light:"Terang",dark:"Gelap",notAvailable:"Tidak tersedia",enabled:"Aktif",disabled:"Nonaktif",restartPending:"Menunggu mulai ulang",ready:"Siap",privateEngine:"Mesin privat",unixSocket:"Soket Unix",defaultWorkspace:"Workspace default",comfortable:"Nyaman",compact:"Ringkas",auto:"Otomatis",expanded:"Diperluas",on:"Aktif",off:"Nonaktif",defaultPermission:"Izin default",fullAccess:"Akses penuh",configured:"Terkonfigurasi",notConfigured:"Belum dikonfigurasi",pending:"Tertunda",restartingEngine:"Memulai ulang"},status:{loading:"Memuat pengaturan...",loadError:"Tidak dapat memuat pengaturan",unsaved:"Perubahan belum disimpan.",upToDate:"Sudah terbaru.",savedRestart:"Guardado. Reinicia nanobot para aplicar.",restartAfterSaving:"Guarda los cambios y reinicia cuando puedas.",savedRestartApply:"Guardado. Reinicia cuando puedas.",imageProviderRestart:"Cambios del proveedor de imagen guardados. Reinicia cuando puedas.",hostRestartAfterSaving:"Al guardar, nanobot reiniciará su motor.",hostRestartPending:"Guardado. El motor se reiniciará cuando esté listo.",hostApiUnavailable:"Las acciones del host solo están disponibles en la app nativa.",logsOpened:"Carpeta de registros abierta.",logsOpenFailed:"No se pudo abrir la carpeta de registros.",diagnosticsExported:"Diagnóstico exportado a {{path}}.",diagnosticsExportFailed:"No se pudo exportar el diagnóstico."},actions:{save:"Simpan",saving:"Menyimpan",edit:"Edit",cancel:"Batal",open:"Buka",export:"Ekspor",opening:"Membuka...",exporting:"Mengekspor..."},byok:{description:"Gunakan kunci provider Anda sendiri. Nanobot membaca nilai ini dari config saat ini, dan hanya provider yang sudah dikonfigurasi yang bisa dipilih di Umum.",configured:"Terkonfigurasi",notConfigured:"Belum dikonfigurasi",configuredSection:"Terkonfigurasi",notConfiguredSection:"Belum dikonfigurasi",showMore:"Tampilkan {{count}} lagi",showLess:"Tampilkan lebih sedikit",apiKey:"API key",apiBase:"API base",apiKeyPlaceholder:"Masukkan API key",apiKeyConfiguredPlaceholder:"Kosongkan untuk mempertahankan key saat ini",configuredKeyHint:"Key terkonfigurasi",apiBasePlaceholder:"Gunakan default provider",apiKeyRequired:"API key diperlukan untuk mengonfigurasi provider ini.",showApiKey:"Tampilkan API key",hideApiKey:"Sembunyikan API key",noConfiguredProviders:"Belum ada provider terkonfigurasi",configureFirst:"Konfigurasikan provider di BYOK terlebih dahulu.",openByok:"Buka BYOK",tabs:{ariaLabel:"Jenis kredensial BYOK",llm:"LLM",webSearch:"Pencarian web"},webSearch:{provider:"Penyedia pencarian",providerHelp:"Pilih backend yang digunakan alat web search.",selectProvider:"Pilih provider",credentials:"Kredensial",noCredentialRequired:"Tidak perlu key",noCredentialHelp:"DuckDuckGo berfungsi tanpa menyimpan API key.",apiKeyHelp:"Disimpan di config dan ditampilkan tersamarkan setelah disimpan.",baseUrl:"Base URL",baseUrlHelp:"SearXNG memerlukan URL instance Anda sendiri.",baseUrlPlaceholder:"https://search.example.com",apiKeyRequired:"Provider pencarian ini memerlukan API key.",baseUrlRequired:"SearXNG memerlukan Base URL.",missingCredential:"Tambahkan kredensial yang diperlukan sebelum menyimpan.",saveHint:"Perubahan berlaku untuk permintaan web search baru."}},overview:{model:"Model saat ini",providers:"Penyedia",configuredCount:"{{count}} dikonfigurasi",totalProviders:"{{count}} tersedia",webSearch:"Pencarian web",imageGeneration:"Pembuatan gambar",voiceInput:"Input suara",workspace:"Ruang kerja"},usage:{title:"Aktivitas token",shortTitle:"Token Usage",subtitle:"Penggunaan yang dilaporkan penyedia selama 12 bulan terakhir.",empty:"Aktivitas token akan muncul setelah balasan model baru.",totalTokens:"Total token",peakTokens:"Puncak token",thirtyDayTokens:"Token 30 hari",currentStreak:"Rentetan saat ini",longestStreak:"Rentetan terpanjang",daysValue:"{{count}} h",last30:"30 hari",activeDays:"Hari aktif",requests:"Permintaan",estimated:"perkiraan",includesEstimates:"termasuk perkiraan",cellTitle:"{{date}}: {{tokens}} token, {{requests}} permintaan",sources:{user:"Chat",api:"API",cron:"Otomasi",dream:"Memori",system:"Sistem"}},providers:{searchPlaceholder:"Cari penyedia",noMatches:"Tidak ada penyedia yang cocok.",saveProvider:"Simpan penyedia"},image:{selectProvider:"Pilih penyedia",selectAspect:"Pilih rasio",selectSize:"Pilih ukuran",configureProvider:"Konfigurasi penyedia",missingCredential:"Configura este proveedor antes de activar la generación de imágenes."},models:{selectModel:"Pilih model",addConfiguration:"Tambah konfigurasi",newConfiguration:"Konfigurasi model baru",newConfigurationHelp:"Simpan penyedia dan model sebagai opsi sekali klik.",configurationName:"Nama konfigurasi",configurationNameHelp:"Ganti nama konfigurasi model tersimpan ini.",configurationNamePlaceholder:"Menulis cepat",searchModels:"Cari atau ketik ID model",useCustomModel:"Gunakan",loadingModels:"Memuat model...",searchCatalog:"Cari katalog penyedia untuk memilih model.",modelsAvailable:"tersedia",noModelResults:"Tidak ada model yang cocok.",loadFailed:"Daftar model tidak tersedia.",unsupportedModelList:"Ketik ID model secara manual.",providerNotConfigured:"Konfigurasikan penyedia ini sebelum memuat model.",autoProviderCustomOnly:"Mode penyedia otomatis memakai ID model kustom."},timezone:{select:"Pilih zona waktu",search:"Cari zona waktu",empty:"Tidak ada zona waktu yang cocok."},cliApps:{allCategories:"Semua kategori",availableCount:"{{count}} aplikasi",installedCount:"{{count}} terpasang",summary:"{{installed}} dari {{total}} CLI terpasang",filterAll:"Semua",filterInstalled:"CLI terpasang",filterNotInstalled:"Belum terpasang",searchPlaceholder:"Cari CLI",statusInstalled:"Terpasang",statusAvailable:"Tersedia",statusMissing:"Dependensi hilang",statusUnsupported:"Tidak didukung",statusNotInstalled:"Belum terpasang",unsupported:"Tidak didukung",loading:"Memuat aplikasi CLI...",empty:"Tidak ada aplikasi CLI yang cocok dengan filter ini.",readyTitle:"@{{name}} siap",readyStatus:"Siap",readyPrompt:"Gunakan @{{name}} untuk melihat kemampuan CLI ini.",readyTry:"Coba @{{name}}",readyCopied:"Disalin",openChat:"Buka chat",requires:"Membutuhkan",test:"Uji CLI",update:"Perbarui CLI",uninstall:"Copot CLI",install:"Pasang CLI",unavailable:"Tidak tersedia",noDescription:"Tidak ada deskripsi."},about:{version:"Versi",checking:"Memeriksa pembaruan...",checkForUpdates:"Periksa pembaruan",upToDate:"Anda sudah menggunakan versi terbaru",updateAvailable:"Pembaruan tersedia v{{version}}"},mcp:{allCategories:"Semua kategori",summary:"{{installed}} dari {{total}} preset diaktifkan",filterAll:"Semua",filterInstalled:"Aktif",filterNotInstalled:"Tidak aktif",searchPlaceholder:"Cari preset MCP",moreOptions:"Opsi MCP lainnya",moreOptionsSubtitle:"Tambahkan server khusus atau impor mcp.json.",customTitle:"MCP khusus",customSubtitle:"Tambahkan server MCP stdio, HTTP, atau SSE apa pun.",customAction:"Khusus",importAction:"Impor",serverName:"Nama server",serverUrl:"URL",transport:"Transport",command:"Perintah",args:"Args JSON",headers:"Headers JSON",env:"Env JSON",timeout:"Batas waktu alat",advancedOptions:"Opsi lanjutan",hideAdvanced:"Sembunyikan lanjutan",saveCustom:"Simpan MCP",configImport:"Impor mcp.json",importConfig:"Impor",restartRequired:"Mulai ulang nanobot untuk menyambungkan alat MCP yang diperbarui.",toolsFound:"{{count}} alat",loading:"Memuat preset MCP...",empty:"Tidak ada preset MCP yang cocok dengan filter ini.",openDocs:"Buka dokumentasi",test:"Uji",remove:"Hapus",enable:"Aktifkan",enabled:"Aktif",setup:"Hubungkan",configure:"Hubungkan",connectTitle:"Hubungkan {{name}}",connectHint:"Tambahkan kunci dari pengaturan akun Anda.",saveAndEnable:"Simpan dan aktifkan",updateSetup:"Perbarui konfigurasi",configured:"terkonfigurasi",keepExisting:"Biarkan kosong untuk mempertahankan nilai saat ini",statusConfigured:"Terkonfigurasi",statusMissingCredentials:"Butuh kunci",statusMissingDependency:"Butuh dependensi",statusComingSoon:"Segera hadir",statusNotInstalled:"Tidak aktif",toolScope:"Alat",allTools:"Semua",noTools:"Tidak ada",testForTools:"Jalankan Uji untuk memeriksa dan memilih alat individual."},legal:{thirdPartyBrands:"Nama produk, logo, dan merek adalah milik pemiliknya masing-masing. Penggunaan hanya untuk identifikasi dan tidak menyiratkan dukungan."},apps:{description:"Tambahkan CLI aplikasi dan layanan MCP yang dapat digunakan nanobot dari chat.",cliLabel:"CLI",mcpLabel:"MCP",filterAll:"Semua",filterCli:"Aplikasi CLI",filterMcp:"Layanan MCP",enabledSummary:"{{count}} aktif",caption:"{{cli}} CLI · {{mcp}} MCP",searchPlaceholder:"Cari aplikasi",featured:"Unggulan",loading:"Memuat aplikasi...",empty:"Tidak ada aplikasi yang cocok."},automations:{filters:{all:"Semua",active:"Aktif",paused:"Dijeda",failed:"Perlu ditangani",system:"Sistem"},sort:{next:"Jalankan berikutnya",last:"Jalankan terakhir",updated:"Diperbarui",name:"Nama"},search:"Cari tugas, pesan, chat terkait, atau jadwal",queue:"Antrean",loading:"Memuat otomasi...",noMatches:"Tidak ada otomasi yang cocok dengan tampilan ini.",empty:"Belum ada otomasi.",emptyHint:"Buat dari tempat tugas ini berjalan agar nanobot menyimpan konteks yang tepat.",oneShot:"Satu kali",systemTask:"Automasi yang dikelola sistem",labels:{schedule:"Jadwal",next:"Berikutnya",origin:"Chat tertaut",created:"Dibuat",updated:"Diperbarui"},runNow:"Jalankan sekarang",pause:"Jeda",resume:"Lanjutkan",edit:"Edit",delete:"Hapus",protected:"Terlindungi",editTitle:"Edit otomasi",save:"Simpan",deleteTitle:"Hapus otomasi",deleteDescription:"Ini menghapus {{name}} dari penyimpanan cron. Pesan chat sebelumnya tetap ada di sesi.",cancel:"Batal",status:{system:"Sistem",running:"Sedang berjalan",paused:"Dijeda",failed:"Gagal",completed:"Selesai",noSchedule:"Tanpa jadwal",active:"Aktif"},origin:{system:"Sistem",unknown:"Tidak ada chat tertaut"},channels:{api:"API",cli:"CLI",dingtalk:"DingTalk",discord:"Discord",email:"Email",feishu:"Feishu",matrix:"Matrix",msteams:"Microsoft Teams",qq:"QQ",slack:"Slack",telegram:"Telegram",wechat:"WeChat",wecom:"WeCom",weixin:"WeChat",whatsapp:"WhatsApp"},schedule:{at:"Pada {{time}}",every:"Setiap {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",withTz:"{{summary}} · {{tz}}",dailyAt:"Setiap hari pukul {{time}}",weekdaysAt:"Hari kerja pukul {{time}}",hourlyAt:"Setiap jam pada :{{minute}}",hourlyWindow:"Setiap jam {{start}}-{{end}} pada :{{minute}}",custom:"Jadwal khusus"},next:{paused:"Dijeda",pending:"Sedang berjalan",none:"Tidak ada jadwal berikutnya"},message:{showMore:"Tampilkan pesan lengkap",showLess:"Tampilkan lebih sedikit"},fields:{name:"Nama",message:"Pesan",scheduleType:"Jenis jadwal",every:"Setiap",unit:"Unit",cronExpression:"Ekspresi cron",timezone:"Zona waktu",runAt:"Jalankan pada"},scheduleTypes:{every:"Interval",cron:"Cron",at:"Sekali"},everyUnits:{second:"Detik",minute:"Menit",hour:"Jam",day:"Hari"},validation:{nameRequired:"Nama wajib diisi.",messageRequired:"Pesan wajib diisi.",intervalRequired:"Interval harus berupa angka positif.",cronRequired:"Ekspresi cron wajib diisi.",timeRequired:"Waktu eksekusi wajib diisi.",futureRequired:"Waktu eksekusi harus berada di masa depan."}},oauth:{authentication:"Autentikasi OAuth",signIn:"Masuk",signingIn:"Masuk...",signInAgain:"Masuk lagi",signOut:"Keluar",signedInAs:"Masuk sebagai {{account}}",signInHelp:"Inicia sesión desde este dispositivo; no se guarda API key en config.",signInRequired:"Perlu masuk",signInBeforeSaving:"Inicia sesión antes de guardar este proveedor OAuth como proveedor activo.",signedIn:"Sudah masuk",notSignedIn:"Belum masuk"},skills:{description:"Tinjau skill instruksi yang dapat dimuat agent ini selama percakapan.",caption:"{{available}} tersedia · {{total}} total",featured:"Skill agent",empty:"Tidak ada skill yang tersedia.",sourceWorkspace:"Kustom",sourceBuiltin:"Bawaan",statusAvailable:"Tersedia",statusUnavailable:"Tidak tersedia",unavailableReason:"Kurang: {{reason}}",openDetails:"Buka detail {{name}}",loadingDetail:"Memuat detail skill...",loadFailed:"Tidak dapat memuat detail skill.",descriptionTitle:"Deskripsi",source:"Sumber",status:"Status",requirements:"Kebutuhan",noRequirements:"Tidak ada kebutuhan eksplisit.",commands:"Perintah",environment:"Variabel lingkungan",missingCommands:"CLI hilang",missingEnvironment:"ENV hilang",unavailableReasonLabel:"Alasan tidak tersedia",rawInstructions:"SKILL.md mentah",rawInstructionsEmpty:"Tidak ada instruksi mentah.",detailDescription:"Detail untuk {{name}}."},voice:{selectProvider:"Pilih penyedia",configureProvider:"Konfigurasi penyedia",languageAuto:"Auto"}},vM={fallbackTitle:"Obrolan {{id}}",forkTitle:"Cabang: {{title}}",loading:"Memuat…",noSessions:"Belum ada sesi.",showMore:"Tampilkan {{count}} lagi",collapsed:"{{count}} obrolan diciutkan",showLess:"Tampilkan lebih sedikit",actions:"Aksi obrolan untuk {{title}}",newInProject:"Mulai obrolan baru di {{project}}",activity:{running:"Agent running",complete:"Agent finished",updated:"New activity"},pin:"Pin",unpin:"Unpin",rename:"Rename",renameTitle:"Rename chat",renameDescription:"Choose a local sidebar name for this chat.",renamePlaceholder:"Chat name",renameProjectTitle:"Rename project",renameProjectDescription:"Choose a local sidebar name for this project.",renameProjectPlaceholder:"Project name",renameSave:"Save",archive:"Archive",unarchive:"Unarchive",showArchived:"Show archived",hideArchived:"Hide archived",delete:"Hapus",newChat:"Obrolan baru",groups:{pinned:"Pinned",all:"Chats",projects:"Projects",today:"Today",yesterday:"Yesterday",earlier:"Earlier",archived:"Archived"}},xM={title:"Hapus obrolan ini?",description:"Tindakan ini tidak dapat dibatalkan.",cancel:"Batal",confirm:"Hapus",automationsDescription:"Obrolan ini memiliki automasi terjadwal. Menghapusnya juga akan menghapus automasi tersebut.",moreAutomations:"+ {{count}} lagi",confirmWithAutomations:"Hapus",schedule:{at:"{{time}}",every:"Setiap {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"Jadwal khusus"},next:{label:"Berikutnya: {{time}}",disabled:"Dijeda",none:"Tidak ada jadwal berikutnya"}},yM={idle:"Idle",connecting:"Menghubungkan…",open:"Terhubung",reconnecting:"Menyambung ulang…",closed:"Terputus",error:"Kesalahan koneksi"},bM={loadingConversation:"Memuat percakapan…",empty:{greetings:{workOn:"Apa yang kita kerjakan bersama?",start:"Kita mulai dari mana?",build:"Apa yang kita bangun hari ini?",tackle:"Apa yang kita selesaikan bersama?"},quickActions:{plan:{title:"Buat rencana proyek",prompt:"Buat rencana proyek ringkas untuk apa yang sebaiknya saya bangun berikutnya."},analyze:{title:"Analisis data ini",prompt:"Bantu saya menganalisis data ini dan soroti pola yang paling penting."},brainstorm:{title:"Brainstorm ide",prompt:"Brainstorm beberapa ide praktis dan tradeoff untuk masalah ini."},code:{title:"Tulis kode",prompt:"Bantu saya menulis kode untuk tugas ini, mulai dari perubahan berguna yang paling kecil."},summarize:{title:"Ringkas dokumen ini",prompt:"Ringkas dokumen ini dan daftar poin-poin utamanya."},more:{title:"Lainnya",prompt:"Tunjukkan beberapa cara berguna Anda dapat membantu di workspace ini."}},imageQuickActions:{icon:{title:"Desain ikon aplikasi",prompt:"Buat ikon aplikasi 1:1 yang bersih untuk nanobot: robot ramah, gaya vektor sederhana, palet biru dan putih lembut, tanpa teks."},sticker:{title:"Buat stiker",prompt:"Buat gambar gaya stiker yang lucu dari asisten robot kecil, latar terlihat transparan, ekspresif dan menyenangkan."},poster:{title:"Buat poster",prompt:"Buat konsep poster yang rapi untuk asisten AI pribadi, komposisi modern, hierarki visual kuat, cocok untuk landing page."},product:{title:"Mockup produk",prompt:"Buat gambar mockup produk yang bersih untuk aplikasi web AI percakapan, antarmuka minimal, pencahayaan premium, bingkai perangkat realistis."},portrait:{title:"Potret bergaya",prompt:"Buat potret bergaya dari pendamping AI yang ramah, pencahayaan lembut, detail tetapi tetap mudah didekati, gaya ilustrasi modern."},edit:{title:"Edit gambar",prompt:"Bantu saya mengedit gambar. Minta saya mengunggah atau menyebutkan gambar terlebih dahulu, lalu buat hasil editnya."}}},header:{toggleSidebar:"Tampilkan atau sembunyikan sidebar",newChat:"Mulai chat baru",toggleTheme:"Alihkan tema dari header",settings:"Buka pengaturan",sessionInfo:"Detail sesi"},sessionInfo:{title:"Sesi",untitled:"Chat tanpa judul",automations:"Otomasi",count:"{{count}}",loading:"Memuat otomasi...",loadFailed:"Tidak dapat memuat otomasi.",empty:"Belum ada otomasi dalam sesi ini.",disabled:"Mati",schedule:{at:"Pada {{time}}",every:"Setiap {{duration}}",cron:"Cron {{expr}}",cronWithTz:"Cron {{expr}} · {{tz}}",unknown:"Jadwal khusus"},next:{label:"Berikutnya {{time}}",pending:"Segera berjalan",disabled:"Dijeda",none:"Tidak ada jadwal berikutnya"}},composer:{placeholderThread:"Ketik pesan Anda…",placeholderHero:"Apa yang sedang Anda pikirkan?",placeholderOpening:"Membuka obrolan baru…",placeholderStreaming:"Model sedang merespons…",inputAria:"Input pesan",sendHint:"Enter untuk kirim · Shift+Enter untuk baris baru",runRuntimeTitle:"Berjalan · {{elapsed}}",goalStateStrip:"Tujuan · {{label}}",goalStateFallback:"Tujuan",goalStateExpandAria:"Lihat tujuan lengkap",goalStateSheetTitle:"Tujuan",goalStateCloseAria:"Tutup tujuan",send:"Kirim pesan",stop:"Hentikan respons",modelNotConfigured:"Model belum dikonfigurasi",configureModel:"Konfigurasi model",queued:{label:"Panduan antrean",guide:"Pandu",delete:"Hapus panduan",edit:"Edit panduan",drag:"Seret untuk mengurutkan"},attachImage:"Lampirkan gambar",imageMode:{label:"Buat gambar",toggle:"Alihkan mode pembuatan gambar",placeholder:"Deskripsikan atau edit gambar…",aspectAria:"Rasio aspek gambar",aspectLabel:"Rasio gambar",aspect:{auto:"Otomatis","1_1":"Persegi 1:1","3_4":"Potret 3:4","9_16":"Story 9:16","4_3":"Lanskap 4:3","16_9":"Lebar 16:9"}},tools:{search:"Cari",reason:"Bernalar",deepResearch:"Riset mendalam",voice:"Input suara"},voice:{hint:"Klik untuk mendikte atau tahan",stop:"Hentikan rekaman",transcribing:"Mentranskripsi...",recordingStatus:"Merekam {{time}}"},voiceErrors:{unsupported:"Input suara tidak didukung di browser ini.",permission:"Izin mikrofon diperlukan.",notConfigured:"Konfigurasikan penyedia transkripsi terlebih dahulu.",tooLong:"Rekaman terlalu panjang.",tooShort:"Tahan sedikit lebih lama untuk merekam suara.",noInput:"Tidak ada input mikrofon yang terdeteksi.",failed:"Tidak dapat mentranskripsi audio."},slash:{ariaLabel:"Perintah slash",label:"perintah",navigateHint:"↑↓ Pilih",selectHint:"Enter/Tab Sisipkan",closeHint:"Esc Tutup",commands:{new:{title:"Obrolan baru",description:"Hentikan tugas saat ini dan mulai percakapan baru."},stop:{title:"Hentikan tugas saat ini",description:"Batalkan giliran agent yang sedang aktif di chat ini."},restart:{title:"Mulai ulang nanobot",description:"Mulai ulang proses bot di tempat."},status:{title:"Tampilkan status",description:"Tampilkan status runtime, provider, dan channel."},model:{title:"Model",description:"Tampilkan atau ganti preset model aktif."},history:{title:"Tampilkan riwayat",description:"Cetak N pesan percakapan tersimpan terbaru."},dream:{title:"Jalankan Dream",description:"Picu konsolidasi memori secara manual."},dream_log:{title:"Tampilkan log Dream",description:"Tampilkan perubahan dari konsolidasi Dream terakhir."},dream_restore:{title:"Pulihkan memori",description:"Kembalikan memori ke snapshot Dream sebelumnya."},goal:{title:"Tujuan jangka panjang",description:"Instruksikan agen memperlakukan ini sebagai tujuan multi-langkah yang berkelanjutan."},help:{title:"Tampilkan bantuan",description:"Daftar perintah slash yang tersedia."},pairing:{title:"Pemasangan",description:"Kelola permintaan pemasangan."}},badges:{current:"Saat ini",recent:"Terbaru"},details:{goalActive:"Tujuan sedang berjalan",goalReady:"Mulai tujuan berkelanjutan",history:"Tampilkan pesan terbaru",stopRunning:"Sedang berjalan"}},encoding:"Memproses…",remove:"Hapus lampiran",normalizedSizeHint:"{{orig}} → {{current}} (auto)",imageRejected:{unsupported_type:"Tipe file tidak didukung",too_many_images:"Maksimal {{max}} gambar per pesan",magic_mismatch:"File ini tampaknya bukan gambar asli",decode_failed:"Tidak dapat mendekode gambar ini",too_large:"Gambar terlalu besar — coba yang lebih kecil",io:"Tidak dapat membaca file ini"},mentions:{ariaLabel:"Aplikasi",label:"Aplikasi",cliGroup:"App CLI",mcpGroup:"Layanan MCP",cliBadge:"CLI",mcpBadge:"MCP",cliDescription:"Gunakan @{{name}} sebagai aplikasi CLI lokal",mcpDescription:"Gunakan @{{name}} sebagai server MCP"},workspace:{accessAria:"Workspace access mode",projectAria:"Pilih proyek",projectPlaceholder:"Pilih proyek",default:"Default Permission",full:"Full Access"}},scrollToBottom:"Gulir ke bawah",loadEarlier:"Muat pesan sebelumnya",forkedFromHistory:"Fork dari riwayat",promptNavigator:{open:"Buka navigator prompt",title:"Prompt",search:"Cari prompt",noResults:"Tidak ada prompt yang cocok.",jumpTo:"Lompat ke prompt: {{label}}"}},wM={streaming:"sedang mengalir",assistantTyping:"Asisten sedang mengetik",toolSingle:"Menggunakan sebuah alat",toolMany:"Menggunakan {{count}} alat",toolSummary:"{{count}} alat",toolSummaryMany:"{{count}} alat",reasoningTools:"Penalaran · {{count}} alat",reasoningToolsSingular:"Penalaran · 1 alat",reasoning:"Penalaran",reasoningStreaming:"Berpikir…",reasoningSummary:"Penalaran",agentActivitySummary:"{{reasoning}} langkah · {{tools}} panggilan alat",agentActivityToolsOnly:"{{tools}} panggilan alat",agentActivityLiveSummary:"Berjalan… · {{reasoning}} langkah · {{tools}} panggilan alat",agentActivityLiveToolsOnly:"Berjalan… · {{tools}} panggilan alat",imageAttachment:"Lampiran gambar",forkFromHere:"Fork",copyReply:"Salin",copiedReply:"Disalin",turnLatencyTitle:"Waktu respons (ujung ke ujung)",activityThinkingFor:"Berpikir selama {{duration}}",activityThought:"Selesai berpikir",activityThoughtFor:"Selesai berpikir dalam {{duration}}",activityWorkingFor:"Memproses selama {{duration}}",activityWorked:"Selesai memproses",activityWorkedFor:"Diproses selama {{duration}}",cliActivityRunningOne:"Menggunakan @{{name}}",cliActivityRanOne:"Menggunakan @{{name}} selesai",cliActivityFailedOne:"@{{name}} gagal",cliActivityRunningMany:"Menggunakan {{count}} aplikasi CLI",cliActivityRanMany:"{{count}} aplikasi CLI digunakan",cliActivityFailedMany:"{{count}} aplikasi CLI gagal",cliRunRunning:"Menggunakan",cliRunRan:"Digunakan",cliRunFailed:"Gagal",automationSourceFallback:"Otomatisasi",automationTriggered:"Dipicu otomatis"},kM={title:"Pratinjau gambar",open:"Lihat gambar",prev:"Gambar sebelumnya",next:"Gambar berikutnya",close:"Tutup pratinjau"},CM={aria:"Pratinjau file",close:"Tutup pratinjau file",loading:"Memuat pratinjau...",failed:"Tidak dapat mempratinjau file ini.",routeMissing:"Pratinjau file memerlukan gateway terbaru. Mulai ulang nanobot gateway lalu coba lagi.",resize:"Ubah ukuran pratinjau file",truncated:"Pratinjau dipotong karena file ini besar."},SM={fallbackLanguage:"kode",copyAria:"Salin kode",copy:"Salin",copied:"Tersalin"},NM={dismiss:"Tutup"},jM={messageTooBig:{title:"Pesan terlalu besar",body:"Server menolak pesan terakhir karena melebihi batas ukuran. Hapus beberapa gambar atau gunakan berkas yang lebih kecil, lalu coba lagi."},workspaceScopeRejected:{title:"Workspace was not changed",body:"Nanobot kept the previous workspace because the requested project or access mode was rejected by the gateway."}},AM={dialog:{defaultProject:"Default workspace",manual:"Tempel path",manualPlaceholder:"/Users/name/project",usePath:"Use Path",absolutePathRequired:"Enter an absolute folder path on this machine."}},_M={app:fM,sidebar:hM,settings:gM,chat:vM,deleteConfirm:xM,connection:yM,thread:bM,message:wM,lightbox:kM,filePreview:CM,code:SM,common:NM,errors:jM,workspace:AM},Vg={en:{common:gT},"zh-CN":{common:RT},"zh-TW":{common:VT},fr:{common:iR},ja:{common:kR},ko:{common:OR},es:{common:JR},vi:{common:mM},id:{common:_M}};function bs(){return P0(kt.resolvedLanguage??kt.language??ii)}async function PM(e){await kt.changeLanguage(e)}kt.isInitialized||kt.use(X2).init({resources:Vg,lng:JP(),fallbackLng:XP,defaultNS:"common",ns:["common"],interpolation:{escapeValue:!1},returnNull:!1,supportedLngs:Object.keys(Vg)});const T0=e=>{const t=P0(e);eT(t),ZP(t)};T0(bs());kt.on("languageChanged",T0);const TM=new Set(["hi","hello","hey","hello nano","hello nanobot","hi nano","hi nanobot","你好","您好","嗨","哈喽","哈啰","在吗"]);function RM(e){const t=e.toLowerCase().replace(/[.!?。!?~~\s]+$/g,"").trim();return t.startsWith("/")||TM.has(t)}function Qi(e,t){if(!e)return t;const n=e.replace(/\s+/g," ").trim();return!n||RM(n)?t:n.length>60?`${n.slice(0,57)}…`:n}function R0(e){if(e==null||e==="")return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t}const MM=[[60,"second"],[60,"minute"],[24,"hour"],[7,"day"],[4.345,"week"],[12,"month"],[Number.POSITIVE_INFINITY,"year"]],Kg=new Map,Gg=new Map;function jf(e){return e||kt.resolvedLanguage||kt.language||bs()}function EM(e){const t=Kg.get(e);if(t)return t;const n=new Intl.RelativeTimeFormat(e,{numeric:"auto"});return Kg.set(e,n),n}function IM(e){const t=Gg.get(e);if(t)return t;const n=new Intl.DateTimeFormat(e,{dateStyle:"medium",timeStyle:"short"});return Gg.set(e,n),n}function Af(e,t){const n=R0(e);if(!n)return"";let r=(n.getTime()-Date.now())/1e3;const a=EM(jf(t));for(const[o,i]of MM){if(Math.abs(r)0,c=n.slice(0,4),d=Math.max(0,n.length-c.length);return s.jsx(GP,{open:e,onOpenChange:p=>p?void 0:r(),children:s.jsxs(k0,{className:"w-[min(calc(100vw-2rem),24rem)] gap-0 rounded-[28px] border border-white/70 bg-card/95 p-5 text-center shadow-[0_24px_80px_rgba(15,23,42,0.20)] backdrop-blur-xl data-[state=open]:zoom-in-95 sm:rounded-[28px]",children:[s.jsxs(C0,{className:"items-center space-y-0 text-center",children:[s.jsx("div",{className:"mb-5 grid h-16 w-16 place-items-center rounded-full bg-destructive/10 text-destructive",children:s.jsx("div",{className:"grid h-9 w-9 place-items-center rounded-full border border-destructive/20 bg-destructive/5",children:s.jsx(zr,{className:"h-5 w-5",strokeWidth:2.4,"aria-hidden":!0})})}),s.jsx(N0,{className:"text-center text-[20px] font-semibold leading-tight tracking-[-0.02em] text-foreground",children:o("deleteConfirm.title",{title:t})}),s.jsx(j0,{className:"mt-3 max-w-[17rem] text-center text-[14px] leading-6 text-muted-foreground",children:o(l?"deleteConfirm.automationsDescription":"deleteConfirm.description")}),l?s.jsxs("div",{className:"mt-4 max-h-40 w-full overflow-y-auto rounded-2xl bg-muted/55 px-3 py-2 text-left",children:[c.map(p=>s.jsxs("div",{className:"min-w-0 py-1.5",children:[s.jsx("div",{className:"truncate text-[13px] font-medium leading-5 text-foreground",children:p.name||p.id}),s.jsxs("div",{className:"mt-0.5 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-[11.5px] leading-5 text-muted-foreground",children:[s.jsx("span",{className:"truncate",children:OM(p,o,i)}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{className:"truncate",children:FM(p,o,i)})]})]},p.id)),d>0?s.jsx("div",{className:"text-[13px] leading-6 text-muted-foreground",children:o("deleteConfirm.moreAutomations",{count:d})}):null]}):null]}),s.jsxs(S0,{className:"mt-7 !grid grid-cols-1 gap-3 space-x-0 sm:grid-cols-2 sm:space-x-0",children:[s.jsx(_0,{onClick:r,className:"mt-0 h-11 w-full min-w-0 rounded-full border-0 bg-muted/70 px-5 text-[15px] font-semibold text-foreground shadow-none hover:bg-muted",children:o("deleteConfirm.cancel")}),s.jsx(A0,{onClick:a,className:"h-11 w-full min-w-0 !whitespace-normal rounded-full bg-destructive px-5 text-center text-[15px] font-semibold text-destructive-foreground shadow-[0_10px_25px_rgba(239,68,68,0.28)] hover:bg-destructive/90",children:o(l?"deleteConfirm.confirmWithAutomations":"deleteConfirm.confirm")})]})]})})}function OM(e,t,n){return e.schedule.kind==="at"&&e.schedule.at_ms?t("deleteConfirm.schedule.at",{time:Ur(e.schedule.at_ms,n)}):e.schedule.kind==="every"&&e.schedule.every_ms?t("deleteConfirm.schedule.every",{duration:zM(e.schedule.every_ms,n)}):e.schedule.kind==="cron"&&e.schedule.expr?e.schedule.tz?t("deleteConfirm.schedule.cronWithTz",{expr:e.schedule.expr,tz:e.schedule.tz}):t("deleteConfirm.schedule.cron",{expr:e.schedule.expr}):t("deleteConfirm.schedule.unknown")}function FM(e,t,n){if(!e.enabled)return t("deleteConfirm.next.disabled");const r=e.state.next_run_at_ms;return r?t("deleteConfirm.next.label",{time:Ur(r,n)}):t("deleteConfirm.next.none")}function zM(e,t){const n=[["day",864e5],["hour",36e5],["minute",6e4],["second",1e3]];for(const[r,a]of n)if(e>=a&&e%a===0)return new Intl.NumberFormat(t,{style:"unit",unit:r,unitDisplay:"long",maximumFractionDigits:0}).format(e/a);return new Intl.NumberFormat(t,{style:"unit",unit:"minute",unitDisplay:"long",maximumFractionDigits:1}).format(e/6e4)}const Xi=vu,$M=xu,M0=u.forwardRef(({className:e,...t},n)=>s.jsx(gs,{ref:n,className:A("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));M0.displayName=gs.displayName;const ws=u.forwardRef(({className:e,children:t,showCloseButton:n=!0,...r},a)=>s.jsxs($M,{children:[s.jsx(M0,{}),s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:s.jsxs(vs,{ref:a,className:A("grid w-full max-w-lg origin-center gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",e),...r,children:[t,n?s.jsxs(Yi,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[s.jsx(vr,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]}):null]})})]}));ws.displayName=vs.displayName;const Ji=({className:e,...t})=>s.jsx("div",{className:A("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Ji.displayName="DialogHeader";const Zi=({className:e,...t})=>s.jsx("div",{className:A("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Zi.displayName="DialogFooter";const ks=u.forwardRef(({className:e,...t},n)=>s.jsx(xs,{ref:n,className:A("text-lg font-semibold leading-none tracking-tight",e),...t}));ks.displayName=xs.displayName;const el=u.forwardRef(({className:e,...t},n)=>s.jsx(Gi,{ref:n,className:A("text-sm text-muted-foreground",e),...t}));el.displayName=Gi.displayName;const qe=u.forwardRef(({className:e,type:t,...n},r)=>s.jsx("input",{type:t,className:A("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));qe.displayName="Input";function Yg({open:e,title:t,dialogTitle:n,description:r,placeholder:a,onCancel:o,onConfirm:i}){const{t:l}=se(),[c,d]=u.useState(t);u.useEffect(()=>{e&&d(t)},[e,t]);const p=c.trim();return s.jsx(Xi,{open:e,onOpenChange:m=>{m||o()},children:s.jsx(ws,{className:"max-w-sm rounded-[22px] border-border/70 bg-popover p-5 shadow-2xl",children:s.jsxs("form",{className:"grid gap-4",onSubmit:m=>{m.preventDefault(),p&&i(p)},children:[s.jsxs(Ji,{className:"text-left",children:[s.jsx(ks,{children:n??l("chat.renameTitle")}),s.jsx(el,{children:r??l("chat.renameDescription")})]}),s.jsx(qe,{value:c,onChange:m=>d(m.target.value),placeholder:a??l("chat.renamePlaceholder"),autoFocus:!0,maxLength:160}),s.jsxs(Zi,{className:"gap-2 sm:space-x-0",children:[s.jsx(fe,{type:"button",variant:"outline",onClick:o,children:l("deleteConfirm.cancel")}),s.jsx(fe,{type:"submit",disabled:!p,children:l("chat.renameSave")})]})]})})})}function Qg(e){const t=UM(e),n=u.forwardRef((r,a)=>{const{children:o,...i}=r,l=u.Children.toArray(o),c=l.find(HM);if(c){const d=c.props.children,p=l.map(m=>m===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:m);return s.jsx(t,{...i,ref:a,children:u.isValidElement(d)?u.cloneElement(d,void 0,p):null})}return s.jsx(t,{...i,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}function UM(e){const t=u.forwardRef((n,r)=>{const{children:a,...o}=n;if(u.isValidElement(a)){const i=qM(a),l=WM(o,a.props);return a.type!==u.Fragment&&(l.ref=r?_a(r,i):i),u.cloneElement(a,l)}return u.Children.count(a)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var BM=Symbol("radix.slottable");function HM(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===BM}function WM(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...l)=>{const c=o(...l);return a(...l),c}:a&&(n[r]=a):r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function qM(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function E0(e){const t=e+"CollectionProvider",[n,r]=Aa(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=x=>{const{scope:b,children:v}=x,g=Pa.useRef(null),w=Pa.useRef(new Map).current;return s.jsx(a,{scope:b,itemMap:w,collectionRef:g,children:v})};i.displayName=t;const l=e+"CollectionSlot",c=Qg(l),d=Pa.forwardRef((x,b)=>{const{scope:v,children:g}=x,w=o(l,v),k=At(b,w.collectionRef);return s.jsx(c,{ref:k,children:g})});d.displayName=l;const p=e+"CollectionItemSlot",m="data-radix-collection-item",f=Qg(p),h=Pa.forwardRef((x,b)=>{const{scope:v,children:g,...w}=x,k=Pa.useRef(null),C=At(b,k),j=o(p,v);return Pa.useEffect(()=>(j.itemMap.set(k,{ref:k,...w}),()=>void j.itemMap.delete(k))),s.jsx(f,{[m]:"",ref:C,children:g})});h.displayName=p;function y(x){const b=o(e+"CollectionConsumer",x);return Pa.useCallback(()=>{const g=b.collectionRef.current;if(!g)return[];const w=Array.from(g.querySelectorAll(`[${m}]`));return Array.from(b.itemMap.values()).sort((j,N)=>w.indexOf(j.ref.current)-w.indexOf(N.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:i,Slot:d,ItemSlot:h},y,r]}var VM=u.createContext(void 0);function I0(e){const t=u.useContext(VM);return e||t||"ltr"}const KM=["top","right","bottom","left"],ba=Math.min,_n=Math.max,Fc=Math.round,Ml=Math.floor,gr=e=>({x:e,y:e}),GM={left:"right",right:"left",bottom:"top",top:"bottom"};function Zp(e,t,n){return _n(e,ba(t,n))}function Br(e,t){return typeof e=="function"?e(t):e}function Hr(e){return e.split("-")[0]}function Cs(e){return e.split("-")[1]}function _f(e){return e==="x"?"y":"x"}function Pf(e){return e==="y"?"height":"width"}function mr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Tf(e){return _f(mr(e))}function YM(e,t,n){n===void 0&&(n=!1);const r=Cs(e),a=Tf(e),o=Pf(a);let i=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=zc(i)),[i,zc(i)]}function QM(e){const t=zc(e);return[em(e),t,em(t)]}function em(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Xg=["left","right"],Jg=["right","left"],XM=["top","bottom"],JM=["bottom","top"];function ZM(e,t,n){switch(e){case"top":case"bottom":return n?t?Jg:Xg:t?Xg:Jg;case"left":case"right":return t?XM:JM;default:return[]}}function eE(e,t,n,r){const a=Cs(e);let o=ZM(Hr(e),n==="start",r);return a&&(o=o.map(i=>i+"-"+a),t&&(o=o.concat(o.map(em)))),o}function zc(e){const t=Hr(e);return GM[t]+e.slice(t.length)}function tE(e){return{top:0,right:0,bottom:0,left:0,...e}}function L0(e){return typeof e!="number"?tE(e):{top:e,right:e,bottom:e,left:e}}function $c(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function Zg(e,t,n){let{reference:r,floating:a}=e;const o=mr(t),i=Tf(t),l=Pf(i),c=Hr(t),d=o==="y",p=r.x+r.width/2-a.width/2,m=r.y+r.height/2-a.height/2,f=r[l]/2-a[l]/2;let h;switch(c){case"top":h={x:p,y:r.y-a.height};break;case"bottom":h={x:p,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:m};break;case"left":h={x:r.x-a.width,y:m};break;default:h={x:r.x,y:r.y}}switch(Cs(t)){case"start":h[i]-=f*(n&&d?-1:1);break;case"end":h[i]+=f*(n&&d?-1:1);break}return h}async function nE(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:o,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:f=!1,padding:h=0}=Br(t,e),y=L0(h),b=l[f?m==="floating"?"reference":"floating":m],v=$c(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(b)))==null||n?b:b.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:d,rootBoundary:p,strategy:c})),g=m==="floating"?{x:r,y:a,width:i.floating.width,height:i.floating.height}:i.reference,w=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),k=await(o.isElement==null?void 0:o.isElement(w))?await(o.getScale==null?void 0:o.getScale(w))||{x:1,y:1}:{x:1,y:1},C=$c(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:g,offsetParent:w,strategy:c}):g);return{top:(v.top-C.top+y.top)/k.y,bottom:(C.bottom-v.bottom+y.bottom)/k.y,left:(v.left-C.left+y.left)/k.x,right:(C.right-v.right+y.right)/k.x}}const rE=50,aE=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:o=[],platform:i}=n,l=i.detectOverflow?i:{...i,detectOverflow:nE},c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:p,y:m}=Zg(d,r,c),f=r,h=0;const y={};for(let x=0;x({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:o,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:p=0}=Br(e,t)||{};if(d==null)return{};const m=L0(p),f={x:n,y:r},h=Tf(a),y=Pf(h),x=await i.getDimensions(d),b=h==="y",v=b?"top":"left",g=b?"bottom":"right",w=b?"clientHeight":"clientWidth",k=o.reference[y]+o.reference[h]-f[h]-o.floating[y],C=f[h]-o.reference[h],j=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let N=j?j[w]:0;(!N||!await(i.isElement==null?void 0:i.isElement(j)))&&(N=l.floating[w]||o.floating[y]);const P=k/2-C/2,L=N/2-x[y]/2-1,_=ba(m[v],L),T=ba(m[g],L),R=_,D=N-x[y]-T,K=N/2-x[y]/2+P,G=Zp(R,K,D),W=!c.arrow&&Cs(a)!=null&&K!==G&&o.reference[y]/2-(KK<=0)){var T,R;const K=(((T=o.flip)==null?void 0:T.index)||0)+1,G=N[K];if(G&&(!(m==="alignment"?g!==mr(G):!1)||_.every(E=>mr(E.placement)===g?E.overflows[0]>0:!0)))return{data:{index:K,overflows:_},reset:{placement:G}};let W=(R=_.filter(H=>H.overflows[0]<=0).sort((H,E)=>H.overflows[1]-E.overflows[1])[0])==null?void 0:R.placement;if(!W)switch(h){case"bestFit":{var D;const H=(D=_.filter(E=>{if(j){const F=mr(E.placement);return F===g||F==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(F=>F>0).reduce((F,X)=>F+X,0)]).sort((E,F)=>E[1]-F[1])[0])==null?void 0:D[0];H&&(W=H);break}case"initialPlacement":W=l;break}if(a!==W)return{reset:{placement:W}}}return{}}}};function ev(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function tv(e){return KM.some(t=>e[t]>=0)}const iE=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:a="referenceHidden",...o}=Br(e,t);switch(a){case"referenceHidden":{const i=await r.detectOverflow(t,{...o,elementContext:"reference"}),l=ev(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:tv(l)}}}case"escaped":{const i=await r.detectOverflow(t,{...o,altBoundary:!0}),l=ev(i,n.floating);return{data:{escapedOffsets:l,escaped:tv(l)}}}default:return{}}}}},D0=new Set(["left","top"]);async function lE(e,t){const{placement:n,platform:r,elements:a}=e,o=await(r.isRTL==null?void 0:r.isRTL(a.floating)),i=Hr(n),l=Cs(n),c=mr(n)==="y",d=D0.has(i)?-1:1,p=o&&c?-1:1,m=Br(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:y}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return l&&typeof y=="number"&&(h=l==="end"?y*-1:y),c?{x:h*p,y:f*d}:{x:f*d,y:h*p}}const cE=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:o,placement:i,middlewareData:l}=t,c=await lE(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:a+c.x,y:o+c.y,data:{...c,placement:i}}}}},uE=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a,platform:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:v=>{let{x:g,y:w}=v;return{x:g,y:w}}},...d}=Br(e,t),p={x:n,y:r},m=await o.detectOverflow(t,d),f=mr(Hr(a)),h=_f(f);let y=p[h],x=p[f];if(i){const v=h==="y"?"top":"left",g=h==="y"?"bottom":"right",w=y+m[v],k=y-m[g];y=Zp(w,y,k)}if(l){const v=f==="y"?"top":"left",g=f==="y"?"bottom":"right",w=x+m[v],k=x-m[g];x=Zp(w,x,k)}const b=c.fn({...t,[h]:y,[f]:x});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[h]:i,[f]:l}}}}}},dE=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:o,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=Br(e,t),p={x:n,y:r},m=mr(a),f=_f(m);let h=p[f],y=p[m];const x=Br(l,t),b=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(c){const w=f==="y"?"height":"width",k=o.reference[f]-o.floating[w]+b.mainAxis,C=o.reference[f]+o.reference[w]-b.mainAxis;hC&&(h=C)}if(d){var v,g;const w=f==="y"?"width":"height",k=D0.has(Hr(a)),C=o.reference[m]-o.floating[w]+(k&&((v=i.offset)==null?void 0:v[m])||0)+(k?0:b.crossAxis),j=o.reference[m]+o.reference[w]+(k?0:((g=i.offset)==null?void 0:g[m])||0)-(k?b.crossAxis:0);yj&&(y=j)}return{[f]:h,[m]:y}}}},pE=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:o,platform:i,elements:l}=t,{apply:c=()=>{},...d}=Br(e,t),p=await i.detectOverflow(t,d),m=Hr(a),f=Cs(a),h=mr(a)==="y",{width:y,height:x}=o.floating;let b,v;m==="top"||m==="bottom"?(b=m,v=f===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(v=m,b=f==="end"?"top":"bottom");const g=x-p.top-p.bottom,w=y-p.left-p.right,k=ba(x-p[b],g),C=ba(y-p[v],w),j=!t.middlewareData.shift;let N=k,P=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=g),j&&!f){const _=_n(p.left,0),T=_n(p.right,0),R=_n(p.top,0),D=_n(p.bottom,0);h?P=y-2*(_!==0||T!==0?_+T:_n(p.left,p.right)):N=x-2*(R!==0||D!==0?R+D:_n(p.top,p.bottom))}await c({...t,availableWidth:P,availableHeight:N});const L=await i.getDimensions(l.floating);return y!==L.width||x!==L.height?{reset:{rects:!0}}:{}}}};function yu(){return typeof window<"u"}function Ss(e){return O0(e)?(e.nodeName||"").toLowerCase():"#document"}function Mn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function br(e){var t;return(t=(O0(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function O0(e){return yu()?e instanceof Node||e instanceof Mn(e).Node:!1}function tr(e){return yu()?e instanceof Element||e instanceof Mn(e).Element:!1}function Vr(e){return yu()?e instanceof HTMLElement||e instanceof Mn(e).HTMLElement:!1}function nv(e){return!yu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Mn(e).ShadowRoot}function tl(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=nr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&a!=="inline"&&a!=="contents"}function mE(e){return/^(table|td|th)$/.test(Ss(e))}function bu(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const fE=/transform|translate|scale|rotate|perspective|filter/,hE=/paint|layout|strict|content/,Ta=e=>!!e&&e!=="none";let Pd;function Rf(e){const t=tr(e)?nr(e):e;return Ta(t.transform)||Ta(t.translate)||Ta(t.scale)||Ta(t.rotate)||Ta(t.perspective)||!Mf()&&(Ta(t.backdropFilter)||Ta(t.filter))||fE.test(t.willChange||"")||hE.test(t.contain||"")}function gE(e){let t=wa(e);for(;Vr(t)&&!as(t);){if(Rf(t))return t;if(bu(t))return null;t=wa(t)}return null}function Mf(){return Pd==null&&(Pd=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Pd}function as(e){return/^(html|body|#document)$/.test(Ss(e))}function nr(e){return Mn(e).getComputedStyle(e)}function wu(e){return tr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function wa(e){if(Ss(e)==="html")return e;const t=e.assignedSlot||e.parentNode||nv(e)&&e.host||br(e);return nv(t)?t.host:t}function F0(e){const t=wa(e);return as(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vr(t)&&tl(t)?t:F0(t)}function Ri(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=F0(e),o=a===((r=e.ownerDocument)==null?void 0:r.body),i=Mn(a);if(o){const l=tm(i);return t.concat(i,i.visualViewport||[],tl(a)?a:[],l&&n?Ri(l):[])}else return t.concat(a,Ri(a,[],n))}function tm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function z0(e){const t=nr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Vr(e),o=a?e.offsetWidth:n,i=a?e.offsetHeight:r,l=Fc(n)!==o||Fc(r)!==i;return l&&(n=o,r=i),{width:n,height:r,$:l}}function Ef(e){return tr(e)?e:e.contextElement}function qo(e){const t=Ef(e);if(!Vr(t))return gr(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:o}=z0(t);let i=(o?Fc(n.width):n.width)/r,l=(o?Fc(n.height):n.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const vE=gr(0);function $0(e){const t=Mn(e);return!Mf()||!t.visualViewport?vE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Mn(e)?!1:t}function Xa(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),o=Ef(e);let i=gr(1);t&&(r?tr(r)&&(i=qo(r)):i=qo(e));const l=xE(o,n,r)?$0(o):gr(0);let c=(a.left+l.x)/i.x,d=(a.top+l.y)/i.y,p=a.width/i.x,m=a.height/i.y;if(o){const f=Mn(o),h=r&&tr(r)?Mn(r):r;let y=f,x=tm(y);for(;x&&r&&h!==y;){const b=qo(x),v=x.getBoundingClientRect(),g=nr(x),w=v.left+(x.clientLeft+parseFloat(g.paddingLeft))*b.x,k=v.top+(x.clientTop+parseFloat(g.paddingTop))*b.y;c*=b.x,d*=b.y,p*=b.x,m*=b.y,c+=w,d+=k,y=Mn(x),x=tm(y)}}return $c({width:p,height:m,x:c,y:d})}function ku(e,t){const n=wu(e).scrollLeft;return t?t.left+n:Xa(br(e)).left+n}function U0(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ku(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function yE(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const o=a==="fixed",i=br(r),l=t?bu(t.floating):!1;if(r===i||l&&o)return n;let c={scrollLeft:0,scrollTop:0},d=gr(1);const p=gr(0),m=Vr(r);if((m||!m&&!o)&&((Ss(r)!=="body"||tl(i))&&(c=wu(r)),m)){const h=Xa(r);d=qo(r),p.x=h.x+r.clientLeft,p.y=h.y+r.clientTop}const f=i&&!m&&!o?U0(i,c):gr(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+p.x+f.x,y:n.y*d.y-c.scrollTop*d.y+p.y+f.y}}function bE(e){return Array.from(e.getClientRects())}function wE(e){const t=br(e),n=wu(e),r=e.ownerDocument.body,a=_n(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=_n(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+ku(e);const l=-n.scrollTop;return nr(r).direction==="rtl"&&(i+=_n(t.clientWidth,r.clientWidth)-a),{width:a,height:o,x:i,y:l}}const rv=25;function kE(e,t){const n=Mn(e),r=br(e),a=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,l=0,c=0;if(a){o=a.width,i=a.height;const p=Mf();(!p||p&&t==="fixed")&&(l=a.offsetLeft,c=a.offsetTop)}const d=ku(r);if(d<=0){const p=r.ownerDocument,m=p.body,f=getComputedStyle(m),h=p.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,y=Math.abs(r.clientWidth-m.clientWidth-h);y<=rv&&(o-=y)}else d<=rv&&(o+=d);return{width:o,height:i,x:l,y:c}}function CE(e,t){const n=Xa(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,o=Vr(e)?qo(e):gr(1),i=e.clientWidth*o.x,l=e.clientHeight*o.y,c=a*o.x,d=r*o.y;return{width:i,height:l,x:c,y:d}}function av(e,t,n){let r;if(t==="viewport")r=kE(e,n);else if(t==="document")r=wE(br(e));else if(tr(t))r=CE(t,n);else{const a=$0(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return $c(r)}function B0(e,t){const n=wa(e);return n===t||!tr(n)||as(n)?!1:nr(n).position==="fixed"||B0(n,t)}function SE(e,t){const n=t.get(e);if(n)return n;let r=Ri(e,[],!1).filter(l=>tr(l)&&Ss(l)!=="body"),a=null;const o=nr(e).position==="fixed";let i=o?wa(e):e;for(;tr(i)&&!as(i);){const l=nr(i),c=Rf(i);!c&&l.position==="fixed"&&(a=null),(o?!c&&!a:!c&&l.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||tl(i)&&!c&&B0(e,i))?r=r.filter(p=>p!==i):a=l,i=wa(i)}return t.set(e,r),r}function NE(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const i=[...n==="clippingAncestors"?bu(t)?[]:SE(t,this._c):[].concat(n),r],l=av(t,i[0],a);let c=l.top,d=l.right,p=l.bottom,m=l.left;for(let f=1;f{i(!1,1e-7)},1e3)}N===1&&!W0(d,e.getBoundingClientRect())&&i(),k=!1}try{n=new IntersectionObserver(C,{...w,root:a.ownerDocument})}catch{n=new IntersectionObserver(C,w)}n.observe(e)}return i(!0),o}function ME(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=Ef(e),p=a||o?[...d?Ri(d):[],...t?Ri(t):[]]:[];p.forEach(v=>{a&&v.addEventListener("scroll",n,{passive:!0}),o&&v.addEventListener("resize",n)});const m=d&&l?RE(d,n):null;let f=-1,h=null;i&&(h=new ResizeObserver(v=>{let[g]=v;g&&g.target===d&&h&&t&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)})),n()}),d&&!c&&h.observe(d),t&&h.observe(t));let y,x=c?Xa(e):null;c&&b();function b(){const v=Xa(e);x&&!W0(x,v)&&n(),x=v,y=requestAnimationFrame(b)}return n(),()=>{var v;p.forEach(g=>{a&&g.removeEventListener("scroll",n),o&&g.removeEventListener("resize",n)}),m==null||m(),(v=h)==null||v.disconnect(),h=null,c&&cancelAnimationFrame(y)}}const EE=cE,IE=uE,LE=sE,DE=pE,OE=iE,sv=oE,FE=dE,zE=(e,t,n)=>{const r=new Map,a={platform:TE,...n},o={...a.platform,_c:r};return aE(e,t,{...a,platform:o})};var $E=typeof document<"u",UE=function(){},ec=$E?u.useLayoutEffect:UE;function Uc(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Uc(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const o=a[r];if(!(o==="_owner"&&e.$$typeof)&&!Uc(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function q0(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function iv(e,t){const n=q0(e);return Math.round(t*n)/n}function Rd(e){const t=u.useRef(e);return ec(()=>{t.current=e}),t}function BE(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:o,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[p,m]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=u.useState(r);Uc(f,r)||h(r);const[y,x]=u.useState(null),[b,v]=u.useState(null),g=u.useCallback(E=>{E!==j.current&&(j.current=E,x(E))},[]),w=u.useCallback(E=>{E!==N.current&&(N.current=E,v(E))},[]),k=o||y,C=i||b,j=u.useRef(null),N=u.useRef(null),P=u.useRef(p),L=c!=null,_=Rd(c),T=Rd(a),R=Rd(d),D=u.useCallback(()=>{if(!j.current||!N.current)return;const E={placement:t,strategy:n,middleware:f};T.current&&(E.platform=T.current),zE(j.current,N.current,E).then(F=>{const X={...F,isPositioned:R.current!==!1};K.current&&!Uc(P.current,X)&&(P.current=X,uu.flushSync(()=>{m(X)}))})},[f,t,n,T,R]);ec(()=>{d===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,m(E=>({...E,isPositioned:!1})))},[d]);const K=u.useRef(!1);ec(()=>(K.current=!0,()=>{K.current=!1}),[]),ec(()=>{if(k&&(j.current=k),C&&(N.current=C),k&&C){if(_.current)return _.current(k,C,D);D()}},[k,C,D,_,L]);const G=u.useMemo(()=>({reference:j,floating:N,setReference:g,setFloating:w}),[g,w]),W=u.useMemo(()=>({reference:k,floating:C}),[k,C]),H=u.useMemo(()=>{const E={position:n,left:0,top:0};if(!W.floating)return E;const F=iv(W.floating,p.x),X=iv(W.floating,p.y);return l?{...E,transform:"translate("+F+"px, "+X+"px)",...q0(W.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:X}},[n,l,W.floating,p.x,p.y]);return u.useMemo(()=>({...p,update:D,refs:G,elements:W,floatingStyles:H}),[p,D,G,W,H])}const HE=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?sv({element:r.current,padding:a}).fn(n):{}:r?sv({element:r,padding:a}).fn(n):{}}}},WE=(e,t)=>{const n=EE(e);return{name:n.name,fn:n.fn,options:[e,t]}},qE=(e,t)=>{const n=IE(e);return{name:n.name,fn:n.fn,options:[e,t]}},VE=(e,t)=>({fn:FE(e).fn,options:[e,t]}),KE=(e,t)=>{const n=LE(e);return{name:n.name,fn:n.fn,options:[e,t]}},GE=(e,t)=>{const n=DE(e);return{name:n.name,fn:n.fn,options:[e,t]}},YE=(e,t)=>{const n=OE(e);return{name:n.name,fn:n.fn,options:[e,t]}},QE=(e,t)=>{const n=HE(e);return{name:n.name,fn:n.fn,options:[e,t]}};var XE="Arrow",V0=u.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...o}=e;return s.jsx(Ct.svg,{...o,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});V0.displayName=XE;var JE=V0;function ZE(e){const[t,n]=u.useState(void 0);return ya(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const o=a[0];let i,l;if("borderBoxSize"in o){const c=o.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,l=d.blockSize}else i=e.offsetWidth,l=e.offsetHeight;n({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var If="Popper",[K0,Cu]=Aa(If),[eI,G0]=K0(If),Y0=e=>{const{__scopePopper:t,children:n}=e,[r,a]=u.useState(null);return s.jsx(eI,{scope:t,anchor:r,onAnchorChange:a,children:n})};Y0.displayName=If;var Q0="PopperAnchor",X0=u.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,o=G0(Q0,n),i=u.useRef(null),l=At(t,i),c=u.useRef(null);return u.useEffect(()=>{const d=c.current;c.current=(r==null?void 0:r.current)||i.current,d!==c.current&&o.onAnchorChange(c.current)}),r?null:s.jsx(Ct.div,{...a,ref:l})});X0.displayName=Q0;var Lf="PopperContent",[tI,nI]=K0(Lf),J0=u.forwardRef((e,t)=>{var q,O,te,ie,ve,me;const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:o="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:y,...x}=e,b=G0(Lf,n),[v,g]=u.useState(null),w=At(t,Z=>g(Z)),[k,C]=u.useState(null),j=ZE(k),N=(j==null?void 0:j.width)??0,P=(j==null?void 0:j.height)??0,L=r+(o!=="center"?"-"+o:""),_=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},T=Array.isArray(d)?d:[d],R=T.length>0,D={padding:_,boundary:T.filter(aI),altBoundary:R},{refs:K,floatingStyles:G,placement:W,isPositioned:H,middlewareData:E}=BE({strategy:"fixed",placement:L,whileElementsMounted:(...Z)=>ME(...Z,{animationFrame:h==="always"}),elements:{reference:b.anchor},middleware:[WE({mainAxis:a+P,alignmentAxis:i}),c&&qE({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?VE():void 0,...D}),c&&KE({...D}),GE({...D,apply:({elements:Z,rects:ke,availableWidth:ye,availableHeight:be})=>{const{width:Ie,height:Pe}=ke.reference,Le=Z.floating.style;Le.setProperty("--radix-popper-available-width",`${ye}px`),Le.setProperty("--radix-popper-available-height",`${be}px`),Le.setProperty("--radix-popper-anchor-width",`${Ie}px`),Le.setProperty("--radix-popper-anchor-height",`${Pe}px`)}}),k&&QE({element:k,padding:l}),oI({arrowWidth:N,arrowHeight:P}),f&&YE({strategy:"referenceHidden",...D})]}),[F,X]=tk(W),Q=$r(y);ya(()=>{H&&(Q==null||Q())},[H,Q]);const re=(q=E.arrow)==null?void 0:q.x,ue=(O=E.arrow)==null?void 0:O.y,pe=((te=E.arrow)==null?void 0:te.centerOffset)!==0,[ce,z]=u.useState();return ya(()=>{v&&z(window.getComputedStyle(v).zIndex)},[v]),s.jsx("div",{ref:K.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:H?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[(ie=E.transformOrigin)==null?void 0:ie.x,(ve=E.transformOrigin)==null?void 0:ve.y].join(" "),...((me=E.hide)==null?void 0:me.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(tI,{scope:n,placedSide:F,onArrowChange:C,arrowX:re,arrowY:ue,shouldHideArrow:pe,children:s.jsx(Ct.div,{"data-side":F,"data-align":X,...x,ref:w,style:{...x.style,animation:H?void 0:"none"}})})})});J0.displayName=Lf;var Z0="PopperArrow",rI={top:"bottom",right:"left",bottom:"top",left:"right"},ek=u.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,o=nI(Z0,r),i=rI[o.placedSide];return s.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:s.jsx(JE,{...a,ref:n,style:{...a.style,display:"block"}})})});ek.displayName=Z0;function aI(e){return e!==null}var oI=e=>({name:"transformOrigin",options:e,fn(t){var b,v,g;const{placement:n,rects:r,middlewareData:a}=t,i=((b=a.arrow)==null?void 0:b.centerOffset)!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,p]=tk(n),m={start:"0%",center:"50%",end:"100%"}[p],f=(((v=a.arrow)==null?void 0:v.x)??0)+l/2,h=(((g=a.arrow)==null?void 0:g.y)??0)+c/2;let y="",x="";return d==="bottom"?(y=i?m:`${f}px`,x=`${-c}px`):d==="top"?(y=i?m:`${f}px`,x=`${r.floating.height+c}px`):d==="right"?(y=`${-c}px`,x=i?m:`${h}px`):d==="left"&&(y=`${r.floating.width+c}px`,x=i?m:`${h}px`),{data:{x:y,y:x}}}});function tk(e){const[t,n="center"]=e.split("-");return[t,n]}var nk=Y0,rk=X0,ak=J0,ok=ek,Md="rovingFocusGroup.onEntryFocus",sI={bubbles:!1,cancelable:!0},nl="RovingFocusGroup",[nm,sk,iI]=E0(nl),[lI,ik]=Aa(nl,[iI]),[cI,uI]=lI(nl),lk=u.forwardRef((e,t)=>s.jsx(nm.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(nm.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(dI,{...e,ref:t})})}));lk.displayName=nl;var dI=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:o,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:p=!1,...m}=e,f=u.useRef(null),h=At(t,f),y=I0(o),[x,b]=pu({prop:i,defaultProp:l??null,onChange:c,caller:nl}),[v,g]=u.useState(!1),w=$r(d),k=sk(n),C=u.useRef(!1),[j,N]=u.useState(0);return u.useEffect(()=>{const P=f.current;if(P)return P.addEventListener(Md,w),()=>P.removeEventListener(Md,w)},[w]),s.jsx(cI,{scope:n,orientation:r,dir:y,loop:a,currentTabStopId:x,onItemFocus:u.useCallback(P=>b(P),[b]),onItemShiftTab:u.useCallback(()=>g(!0),[]),onFocusableItemAdd:u.useCallback(()=>N(P=>P+1),[]),onFocusableItemRemove:u.useCallback(()=>N(P=>P-1),[]),children:s.jsx(Ct.div,{tabIndex:v||j===0?-1:0,"data-orientation":r,...m,ref:h,style:{outline:"none",...e.style},onMouseDown:_e(e.onMouseDown,()=>{C.current=!0}),onFocus:_e(e.onFocus,P=>{const L=!C.current;if(P.target===P.currentTarget&&L&&!v){const _=new CustomEvent(Md,sI);if(P.currentTarget.dispatchEvent(_),!_.defaultPrevented){const T=k().filter(W=>W.focusable),R=T.find(W=>W.active),D=T.find(W=>W.id===x),G=[R,D,...T].filter(Boolean).map(W=>W.ref.current);dk(G,p)}}C.current=!1}),onBlur:_e(e.onBlur,()=>g(!1))})})}),ck="RovingFocusGroupItem",uk=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:o,children:i,...l}=e,c=$a(),d=o||c,p=uI(ck,n),m=p.currentTabStopId===d,f=sk(n),{onFocusableItemAdd:h,onFocusableItemRemove:y,currentTabStopId:x}=p;return u.useEffect(()=>{if(r)return h(),()=>y()},[r,h,y]),s.jsx(nm.ItemSlot,{scope:n,id:d,focusable:r,active:a,children:s.jsx(Ct.span,{tabIndex:m?0:-1,"data-orientation":p.orientation,...l,ref:t,onMouseDown:_e(e.onMouseDown,b=>{r?p.onItemFocus(d):b.preventDefault()}),onFocus:_e(e.onFocus,()=>p.onItemFocus(d)),onKeyDown:_e(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){p.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const v=fI(b,p.orientation,p.dir);if(v!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let w=f().filter(k=>k.focusable).map(k=>k.ref.current);if(v==="last")w.reverse();else if(v==="prev"||v==="next"){v==="prev"&&w.reverse();const k=w.indexOf(b.currentTarget);w=p.loop?hI(w,k+1):w.slice(k+1)}setTimeout(()=>dk(w))}}),children:typeof i=="function"?i({isCurrentTabStop:m,hasTabStop:x!=null}):i})})});uk.displayName=ck;var pI={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function mI(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function fI(e,t,n){const r=mI(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return pI[r]}function dk(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function hI(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var gI=lk,vI=uk;function xI(e){const t=yI(e),n=u.forwardRef((r,a)=>{const{children:o,...i}=r,l=u.Children.toArray(o),c=l.find(wI);if(c){const d=c.props.children,p=l.map(m=>m===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:m);return s.jsx(t,{...i,ref:a,children:u.isValidElement(d)?u.cloneElement(d,void 0,p):null})}return s.jsx(t,{...i,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}function yI(e){const t=u.forwardRef((n,r)=>{const{children:a,...o}=n;if(u.isValidElement(a)){const i=CI(a),l=kI(o,a.props);return a.type!==u.Fragment&&(l.ref=r?_a(r,i):i),u.cloneElement(a,l)}return u.Children.count(a)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var bI=Symbol("radix.slottable");function wI(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===bI}function kI(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?a&&o?n[r]=(...l)=>{const c=o(...l);return a(...l),c}:a&&(n[r]=a):r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function CI(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var rm=["Enter"," "],SI=["ArrowDown","PageUp","Home"],pk=["ArrowUp","PageDown","End"],NI=[...SI,...pk],jI={ltr:[...rm,"ArrowRight"],rtl:[...rm,"ArrowLeft"]},AI={ltr:["ArrowLeft"],rtl:["ArrowRight"]},rl="Menu",[Mi,_I,PI]=E0(rl),[no,mk]=Aa(rl,[PI,Cu,ik]),Su=Cu(),fk=ik(),[TI,ro]=no(rl),[RI,al]=no(rl),hk=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:o,modal:i=!0}=e,l=Su(t),[c,d]=u.useState(null),p=u.useRef(!1),m=$r(o),f=I0(a);return u.useEffect(()=>{const h=()=>{p.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>p.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),s.jsx(nk,{...l,children:s.jsx(TI,{scope:t,open:n,onOpenChange:m,content:c,onContentChange:d,children:s.jsx(RI,{scope:t,onClose:u.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:p,dir:f,modal:i,children:r})})})};hk.displayName=rl;var MI="MenuAnchor",Df=u.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=Su(n);return s.jsx(rk,{...a,...r,ref:t})});Df.displayName=MI;var Of="MenuPortal",[EI,gk]=no(Of,{forceMount:void 0}),vk=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,o=ro(Of,t);return s.jsx(EI,{scope:t,forceMount:n,children:s.jsx(yr,{present:n||o.open,children:s.jsx(fu,{asChild:!0,container:a,children:r})})})};vk.displayName=Of;var Bn="MenuContent",[II,Ff]=no(Bn),xk=u.forwardRef((e,t)=>{const n=gk(Bn,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,o=ro(Bn,e.__scopeMenu),i=al(Bn,e.__scopeMenu);return s.jsx(Mi.Provider,{scope:e.__scopeMenu,children:s.jsx(yr,{present:r||o.open,children:s.jsx(Mi.Slot,{scope:e.__scopeMenu,children:i.modal?s.jsx(LI,{...a,ref:t}):s.jsx(DI,{...a,ref:t})})})})}),LI=u.forwardRef((e,t)=>{const n=ro(Bn,e.__scopeMenu),r=u.useRef(null),a=At(t,r);return u.useEffect(()=>{const o=r.current;if(o)return Pw(o)},[]),s.jsx(zf,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:_e(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),DI=u.forwardRef((e,t)=>{const n=ro(Bn,e.__scopeMenu);return s.jsx(zf,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),OI=xI("MenuContent.ScrollLock"),zf=u.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:m,onInteractOutside:f,onDismiss:h,disableOutsideScroll:y,...x}=e,b=ro(Bn,n),v=al(Bn,n),g=Su(n),w=fk(n),k=_I(n),[C,j]=u.useState(null),N=u.useRef(null),P=At(t,N,b.onContentChange),L=u.useRef(0),_=u.useRef(""),T=u.useRef(0),R=u.useRef(null),D=u.useRef("right"),K=u.useRef(0),G=y?bf:u.Fragment,W=y?{as:OI,allowPinchZoom:!0}:void 0,H=F=>{var q,O;const X=_.current+F,Q=k().filter(te=>!te.disabled),re=document.activeElement,ue=(q=Q.find(te=>te.ref.current===re))==null?void 0:q.textValue,pe=Q.map(te=>te.textValue),ce=YI(pe,X,ue),z=(O=Q.find(te=>te.textValue===ce))==null?void 0:O.ref.current;(function te(ie){_.current=ie,window.clearTimeout(L.current),ie!==""&&(L.current=window.setTimeout(()=>te(""),1e3))})(X),z&&setTimeout(()=>z.focus())};u.useEffect(()=>()=>window.clearTimeout(L.current),[]),bw();const E=u.useCallback(F=>{var Q,re;return D.current===((Q=R.current)==null?void 0:Q.side)&&XI(F,(re=R.current)==null?void 0:re.area)},[]);return s.jsx(II,{scope:n,searchRef:_,onItemEnter:u.useCallback(F=>{E(F)&&F.preventDefault()},[E]),onItemLeave:u.useCallback(F=>{var X;E(F)||((X=N.current)==null||X.focus(),j(null))},[E]),onTriggerLeave:u.useCallback(F=>{E(F)&&F.preventDefault()},[E]),pointerGraceTimerRef:T,onPointerGraceIntentChange:u.useCallback(F=>{R.current=F},[]),children:s.jsx(G,{...W,children:s.jsx(yf,{asChild:!0,trapped:a,onMountAutoFocus:_e(o,F=>{var X;F.preventDefault(),(X=N.current)==null||X.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:s.jsx(mu,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:m,onInteractOutside:f,onDismiss:h,children:s.jsx(gI,{asChild:!0,...w,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:j,onEntryFocus:_e(c,F=>{v.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(ak,{role:"menu","aria-orientation":"vertical","data-state":Ik(b.open),"data-radix-menu-content":"",dir:v.dir,...g,...x,ref:P,style:{outline:"none",...x.style},onKeyDown:_e(x.onKeyDown,F=>{const Q=F.target.closest("[data-radix-menu-content]")===F.currentTarget,re=F.ctrlKey||F.altKey||F.metaKey,ue=F.key.length===1;Q&&(F.key==="Tab"&&F.preventDefault(),!re&&ue&&H(F.key));const pe=N.current;if(F.target!==pe||!NI.includes(F.key))return;F.preventDefault();const z=k().filter(q=>!q.disabled).map(q=>q.ref.current);pk.includes(F.key)&&z.reverse(),KI(z)}),onBlur:_e(e.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout(L.current),_.current="")}),onPointerMove:_e(e.onPointerMove,Ei(F=>{const X=F.target,Q=K.current!==F.clientX;if(F.currentTarget.contains(X)&&Q){const re=F.clientX>K.current?"right":"left";D.current=re,K.current=F.clientX}}))})})})})})})});xk.displayName=Bn;var FI="MenuGroup",$f=u.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return s.jsx(Ct.div,{role:"group",...r,ref:t})});$f.displayName=FI;var zI="MenuLabel",yk=u.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return s.jsx(Ct.div,{...r,ref:t})});yk.displayName=zI;var Bc="MenuItem",lv="menu.itemSelect",Nu=u.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...a}=e,o=u.useRef(null),i=al(Bc,e.__scopeMenu),l=Ff(Bc,e.__scopeMenu),c=At(t,o),d=u.useRef(!1),p=()=>{const m=o.current;if(!n&&m){const f=new CustomEvent(lv,{bubbles:!0,cancelable:!0});m.addEventListener(lv,h=>r==null?void 0:r(h),{once:!0}),gw(m,f),f.defaultPrevented?d.current=!1:i.onClose()}};return s.jsx(bk,{...a,ref:c,disabled:n,onClick:_e(e.onClick,p),onPointerDown:m=>{var f;(f=e.onPointerDown)==null||f.call(e,m),d.current=!0},onPointerUp:_e(e.onPointerUp,m=>{var f;d.current||(f=m.currentTarget)==null||f.click()}),onKeyDown:_e(e.onKeyDown,m=>{const f=l.searchRef.current!=="";n||f&&m.key===" "||rm.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});Nu.displayName=Bc;var bk=u.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...o}=e,i=Ff(Bc,n),l=fk(n),c=u.useRef(null),d=At(t,c),[p,m]=u.useState(!1),[f,h]=u.useState("");return u.useEffect(()=>{const y=c.current;y&&h((y.textContent??"").trim())},[o.children]),s.jsx(Mi.ItemSlot,{scope:n,disabled:r,textValue:a??f,children:s.jsx(vI,{asChild:!0,...l,focusable:!r,children:s.jsx(Ct.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:d,onPointerMove:_e(e.onPointerMove,Ei(y=>{r?i.onItemLeave(y):(i.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:_e(e.onPointerLeave,Ei(y=>i.onItemLeave(y))),onFocus:_e(e.onFocus,()=>m(!0)),onBlur:_e(e.onBlur,()=>m(!1))})})})}),$I="MenuCheckboxItem",wk=u.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...a}=e;return s.jsx(jk,{scope:e.__scopeMenu,checked:n,children:s.jsx(Nu,{role:"menuitemcheckbox","aria-checked":Hc(n)?"mixed":n,...a,ref:t,"data-state":Bf(n),onSelect:_e(a.onSelect,()=>r==null?void 0:r(Hc(n)?!0:!n),{checkForDefaultPrevented:!1})})})});wk.displayName=$I;var kk="MenuRadioGroup",[UI,BI]=no(kk,{value:void 0,onValueChange:()=>{}}),Ck=u.forwardRef((e,t)=>{const{value:n,onValueChange:r,...a}=e,o=$r(r);return s.jsx(UI,{scope:e.__scopeMenu,value:n,onValueChange:o,children:s.jsx($f,{...a,ref:t})})});Ck.displayName=kk;var Sk="MenuRadioItem",Nk=u.forwardRef((e,t)=>{const{value:n,...r}=e,a=BI(Sk,e.__scopeMenu),o=n===a.value;return s.jsx(jk,{scope:e.__scopeMenu,checked:o,children:s.jsx(Nu,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":Bf(o),onSelect:_e(r.onSelect,()=>{var i;return(i=a.onValueChange)==null?void 0:i.call(a,n)},{checkForDefaultPrevented:!1})})})});Nk.displayName=Sk;var Uf="MenuItemIndicator",[jk,HI]=no(Uf,{checked:!1}),Ak=u.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...a}=e,o=HI(Uf,n);return s.jsx(yr,{present:r||Hc(o.checked)||o.checked===!0,children:s.jsx(Ct.span,{...a,ref:t,"data-state":Bf(o.checked)})})});Ak.displayName=Uf;var WI="MenuSeparator",_k=u.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return s.jsx(Ct.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});_k.displayName=WI;var qI="MenuArrow",Pk=u.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=Su(n);return s.jsx(ok,{...a,...r,ref:t})});Pk.displayName=qI;var VI="MenuSub",[w6,Tk]=no(VI),Ws="MenuSubTrigger",Rk=u.forwardRef((e,t)=>{const n=ro(Ws,e.__scopeMenu),r=al(Ws,e.__scopeMenu),a=Tk(Ws,e.__scopeMenu),o=Ff(Ws,e.__scopeMenu),i=u.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=o,d={__scopeMenu:e.__scopeMenu},p=u.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return u.useEffect(()=>p,[p]),u.useEffect(()=>{const m=l.current;return()=>{window.clearTimeout(m),c(null)}},[l,c]),s.jsx(Df,{asChild:!0,...d,children:s.jsx(bk,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":Ik(n.open),...e,ref:_a(t,a.onTriggerChange),onClick:m=>{var f;(f=e.onClick)==null||f.call(e,m),!(e.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:_e(e.onPointerMove,Ei(m=>{o.onItemEnter(m),!m.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),p()},100))})),onPointerLeave:_e(e.onPointerLeave,Ei(m=>{var h,y;p();const f=(h=n.content)==null?void 0:h.getBoundingClientRect();if(f){const x=(y=n.content)==null?void 0:y.dataset.side,b=x==="right",v=b?-5:5,g=f[b?"left":"right"],w=f[b?"right":"left"];o.onPointerGraceIntentChange({area:[{x:m.clientX+v,y:m.clientY},{x:g,y:f.top},{x:w,y:f.top},{x:w,y:f.bottom},{x:g,y:f.bottom}],side:x}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(m),m.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:_e(e.onKeyDown,m=>{var h;const f=o.searchRef.current!=="";e.disabled||f&&m.key===" "||jI[r.dir].includes(m.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),m.preventDefault())})})})});Rk.displayName=Ws;var Mk="MenuSubContent",Ek=u.forwardRef((e,t)=>{const n=gk(Bn,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,o=ro(Bn,e.__scopeMenu),i=al(Bn,e.__scopeMenu),l=Tk(Mk,e.__scopeMenu),c=u.useRef(null),d=At(t,c);return s.jsx(Mi.Provider,{scope:e.__scopeMenu,children:s.jsx(yr,{present:r||o.open,children:s.jsx(Mi.Slot,{scope:e.__scopeMenu,children:s.jsx(zf,{id:l.contentId,"aria-labelledby":l.triggerId,...a,ref:d,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:p=>{var m;i.isUsingKeyboardRef.current&&((m=c.current)==null||m.focus()),p.preventDefault()},onCloseAutoFocus:p=>p.preventDefault(),onFocusOutside:_e(e.onFocusOutside,p=>{p.target!==l.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:_e(e.onEscapeKeyDown,p=>{i.onClose(),p.preventDefault()}),onKeyDown:_e(e.onKeyDown,p=>{var h;const m=p.currentTarget.contains(p.target),f=AI[i.dir].includes(p.key);m&&f&&(o.onOpenChange(!1),(h=l.trigger)==null||h.focus(),p.preventDefault())})})})})})});Ek.displayName=Mk;function Ik(e){return e?"open":"closed"}function Hc(e){return e==="indeterminate"}function Bf(e){return Hc(e)?"indeterminate":e?"checked":"unchecked"}function KI(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function GI(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function YI(e,t,n){const a=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=GI(e,Math.max(o,0));a.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.toLowerCase().startsWith(a.toLowerCase()));return c!==n?c:void 0}function QI(e,t){const{x:n,y:r}=e;let a=!1;for(let o=0,i=t.length-1;or!=f>r&&n<(m-d)*(r-p)/(f-p)+d&&(a=!a)}return a}function XI(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return QI(n,t)}function Ei(e){return t=>t.pointerType==="mouse"?e(t):void 0}var JI=hk,ZI=Df,e5=vk,t5=xk,n5=$f,r5=yk,a5=Nu,o5=wk,s5=Ck,i5=Nk,l5=Ak,c5=_k,u5=Pk,d5=Rk,p5=Ek,ju="DropdownMenu",[m5]=Aa(ju,[mk]),pn=mk(),[f5,Lk]=m5(ju),Dk=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:o,onOpenChange:i,modal:l=!0}=e,c=pn(t),d=u.useRef(null),[p,m]=pu({prop:a,defaultProp:o??!1,onChange:i,caller:ju});return s.jsx(f5,{scope:t,triggerId:$a(),triggerRef:d,contentId:$a(),open:p,onOpenChange:m,onOpenToggle:u.useCallback(()=>m(f=>!f),[m]),modal:l,children:s.jsx(JI,{...c,open:p,onOpenChange:m,dir:r,modal:l,children:n})})};Dk.displayName=ju;var Ok="DropdownMenuTrigger",Fk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...a}=e,o=Lk(Ok,n),i=pn(n);return s.jsx(ZI,{asChild:!0,...i,children:s.jsx(Ct.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:_a(t,o.triggerRef),onPointerDown:_e(e.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(o.onOpenToggle(),o.open||l.preventDefault())}),onKeyDown:_e(e.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&o.onOpenToggle(),l.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});Fk.displayName=Ok;var h5="DropdownMenuPortal",zk=e=>{const{__scopeDropdownMenu:t,...n}=e,r=pn(t);return s.jsx(e5,{...r,...n})};zk.displayName=h5;var $k="DropdownMenuContent",Uk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Lk($k,n),o=pn(n),i=u.useRef(!1);return s.jsx(t5,{id:a.contentId,"aria-labelledby":a.triggerId,...o,...r,ref:t,onCloseAutoFocus:_e(e.onCloseAutoFocus,l=>{var c;i.current||(c=a.triggerRef.current)==null||c.focus(),i.current=!1,l.preventDefault()}),onInteractOutside:_e(e.onInteractOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,p=c.button===2||d;(!a.modal||p)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Uk.displayName=$k;var g5="DropdownMenuGroup",v5=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=pn(n);return s.jsx(n5,{...a,...r,ref:t})});v5.displayName=g5;var x5="DropdownMenuLabel",Bk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=pn(n);return s.jsx(r5,{...a,...r,ref:t})});Bk.displayName=x5;var y5="DropdownMenuItem",Hk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=pn(n);return s.jsx(a5,{...a,...r,ref:t})});Hk.displayName=y5;var b5="DropdownMenuCheckboxItem",Wk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=pn(n);return s.jsx(o5,{...a,...r,ref:t})});Wk.displayName=b5;var w5="DropdownMenuRadioGroup",qk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=pn(n);return s.jsx(s5,{...a,...r,ref:t})});qk.displayName=w5;var k5="DropdownMenuRadioItem",Vk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=pn(n);return s.jsx(i5,{...a,...r,ref:t})});Vk.displayName=k5;var C5="DropdownMenuItemIndicator",Kk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=pn(n);return s.jsx(l5,{...a,...r,ref:t})});Kk.displayName=C5;var S5="DropdownMenuSeparator",Gk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=pn(n);return s.jsx(c5,{...a,...r,ref:t})});Gk.displayName=S5;var N5="DropdownMenuArrow",j5=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=pn(n);return s.jsx(u5,{...a,...r,ref:t})});j5.displayName=N5;var A5="DropdownMenuSubTrigger",Yk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=pn(n);return s.jsx(d5,{...a,...r,ref:t})});Yk.displayName=A5;var _5="DropdownMenuSubContent",Qk=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=pn(n);return s.jsx(p5,{...a,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Qk.displayName=_5;var P5=Dk,T5=Fk,R5=zk,Xk=Uk,Jk=Bk,Zk=Hk,e1=Wk,M5=qk,t1=Vk,n1=Kk,r1=Gk,a1=Yk,o1=Qk;const mn=P5,fn=T5,E5=M5,s1="z-50 max-h-[min(var(--radix-dropdown-menu-content-available-height),28rem)] min-w-[10rem] overflow-x-hidden overflow-y-auto overscroll-contain rounded-[18px] border border-border/65 bg-popover/96 p-1.5 text-popover-foreground shadow-[0_18px_55px_rgba(15,23,42,0.18)] backdrop-blur-xl scrollbar-thin scrollbar-track-transparent dark:border-white/10 dark:shadow-[0_22px_55px_rgba(0,0,0,0.45)]",Au="relative flex min-h-8 cursor-default select-none items-center gap-2 rounded-[12px] px-2.5 py-2 text-[13px] outline-none transition-colors focus:bg-foreground/[0.055] focus:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-white/[0.08]",I5=u.forwardRef(({className:e,inset:t,children:n,...r},a)=>s.jsxs(a1,{ref:a,className:A(Au,"data-[state=open]:bg-foreground/[0.055] dark:data-[state=open]:bg-white/[0.08]",t&&"pl-8",e),...r,children:[n,s.jsx(xr,{className:"ml-auto h-3.5 w-3.5 text-muted-foreground"})]}));I5.displayName=a1.displayName;const L5=u.forwardRef(({className:e,...t},n)=>s.jsx(o1,{ref:n,className:A(s1,e),...t}));L5.displayName=o1.displayName;const an=u.forwardRef(({className:e,sideOffset:t=4,portalContainer:n,...r},a)=>s.jsx(R5,{container:n??void 0,children:s.jsx(Xk,{ref:a,sideOffset:t,className:A(s1,"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...r})}));an.displayName=Xk.displayName;const ut=u.forwardRef(({className:e,inset:t,...n},r)=>s.jsx(Zk,{ref:r,className:A(Au,t&&"pl-8",e),...n}));ut.displayName=Zk.displayName;const D5=u.forwardRef(({className:e,children:t,checked:n,...r},a)=>s.jsxs(e1,{ref:a,className:A(Au,"pl-8 pr-2.5",e),checked:n,...r,children:[s.jsx("span",{className:"absolute left-2.5 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(n1,{children:s.jsx(jt,{className:"h-3.5 w-3.5"})})}),t]}));D5.displayName=e1.displayName;const i1=u.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(t1,{ref:r,className:A(Au,"pl-8 pr-2.5",e),...n,children:[s.jsx("span",{className:"absolute left-2.5 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(n1,{children:s.jsx(Kj,{className:"h-2 w-2 fill-current"})})}),t]}));i1.displayName=t1.displayName;const l1=u.forwardRef(({className:e,inset:t,...n},r)=>s.jsx(Jk,{ref:r,className:A("px-2.5 pb-1.5 pt-1 text-[12px] font-semibold text-muted-foreground",t&&"pl-8",e),...n}));l1.displayName=Jk.displayName;const Hf=u.forwardRef(({className:e,...t},n)=>s.jsx(r1,{ref:n,className:A("-mx-1.5 my-1.5 h-px bg-border/50",e),...t}));Hf.displayName=r1.displayName;function O5(e,t){return{...e,access_mode:t,restrict_to_workspace:t==="restricted"}}function Vo(e){return e.replace(/\\/g,"/").replace(/\/+$/,"").split("/").filter(Boolean).pop()||e}function c1(e){const n=e.replace(/\\/g,"/").split("/").filter(Boolean);return n.length<=3?e:`.../${n.slice(-3).join("/")}`}function F5(e){const t=e.trim();return t==="~"||t.startsWith("~/")||t.startsWith("~\\")||t.startsWith("/")||/^[A-Za-z]:[\\/]/.test(t)}function z5(e,t){return!e||!t||Wf(e.project_path,t.project_path)?null:e}function cv(e){return(e??"").replace(/\\/g,"/").replace(/\/+$/,"")||"/"}function Wf(e,t){return!e||!t?!1:cv(e)===cv(t)}const qf=8;function $5(e,t,n){const r=new Date,a=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),o=a-24*60*60*1e3,i=new Map,l=new Set(n.pinnedKeys),c=new Set(n.archivedKeys),d=[],p=[],m=[];for(const h of e){if(c.has(h.key)){n.showArchived&&p.push(h);continue}if(l.has(h.key)){d.push(h);continue}if(n.sort==="title_asc"){m.push(h);continue}const y=Date.parse(h.updatedAt??h.createdAt??""),x=Number.isFinite(y)&&y>=a?t.today:Number.isFinite(y)&&y>=o?t.yesterday:t.earlier,b=i.get(x)??[];b.push(h),i.set(x,b)}const f=[t.today,t.yesterday,t.earlier].map(h=>({id:`date:${h}`,label:h,sessions:El(i.get(h)??[],n.sort,n.titleOverrides)})).filter(h=>h.sessions.length>0);return n.sort==="title_asc"&&m.length&&f.push({id:"date:all",label:t.all,sessions:El(m,n.sort,n.titleOverrides)}),d.length&&f.unshift({id:"pinned",label:t.pinned,sessions:El(d,n.sort,n.titleOverrides)}),p.length&&f.push({id:"archived",label:t.archived,sessions:El(p,n.sort,n.titleOverrides)}),f}function U5(e,t,n,r){let a=Math.max(0,t),o=!n;const i=[];for(const l of e){if(am(l,r)){i.push({...l,sessions:[]});continue}const c=a>0?l.sessions.slice(0,a):[];a-=c.length,n&&c.some(d=>d.key===n)&&(o=!0),c.length>0&&i.push({...l,sessions:c})}if(o||!n)return i;for(const l of e){if(am(l,r))continue;const c=l.sessions.find(p=>p.key===n);if(!c)continue;const d=i.find(p=>p.id===l.id);return d?d.sessions=[...d.sessions,c]:i.push({...l,sessions:[c]}),i}return i}function am(e,t){return e.kind==="project"&&!!t[e.id]}function u1(e){return e.id==="workspace:chats"||e.id==="date:all"}function d1(e,t){return u1(e)&&e.sessions.length>qf&&t[e.id]!==!1}function B5(e,t,n){if(!d1(e,n))return e.sessions;const r=e.sessions.slice(0,qf);if(!t||r.some(o=>o.key===t))return r;const a=e.sessions.find(o=>o.key===t);return a?[...r,a]:r}function p1(e,t,n){var r,a;return((r=t[e.key])==null?void 0:r.trim())||((a=e.title)==null?void 0:a.trim())||Qi(e.preview,n)}function El(e,t,n){const r=[...e];return r.sort((a,o)=>{if(t==="title_asc"){const c=uv(a,n).localeCompare(uv(o,n),"en",{numeric:!0,sensitivity:"base"});return c!==0?c:Il(o,"updatedAt")-Il(a,"updatedAt")}const i=Il(a,t==="created_desc"?"createdAt":"updatedAt");return Il(o,t==="created_desc"?"createdAt":"updatedAt")-i}),r}function uv(e,t){var n,r;return(((n=t[e.key])==null?void 0:n.trim())||((r=e.title)==null?void 0:r.trim())||Qi(e.preview,"new chat")).toLocaleLowerCase("en")}function Il(e,t){const n=Date.parse(e[t]??"");return Number.isFinite(n)?n:0}const dv=160,H5=160,m1="w-[8.5rem] min-w-[8.5rem]",qs="grid w-[7.75rem] grid-cols-[1rem_minmax(0,1fr)] items-center gap-2",W5=u.memo(function({sessions:t,activeKey:n,onSelect:r,onRequestDelete:a,onTogglePin:o,onRequestRename:i,onToggleArchive:l,onToggleGroup:c,onRequestRenameProject:d,onNewChatInProject:p,onSelectProjectWorkspace:m,pinnedKeys:f=[],archivedKeys:h=[],titleOverrides:y={},projectNameOverrides:x={},collapsedGroups:b={},runningChatIds:v=[],updatedChatIds:g=[],density:w="comfortable",showPreviews:k=!1,showTimestamps:C=!1,sort:j="updated_desc",showArchived:N=!1,defaultWorkspacePath:P,currentWorkspacePath:L,actionMenuPortalContainer:_,loading:T,emptyLabel:R}){const{t:D}=se(),[K,G]=u.useState(dv),W=u.useMemo(()=>({pinned:D("chat.groups.pinned"),all:D("chat.groups.all"),today:D("chat.groups.today"),yesterday:D("chat.groups.yesterday"),earlier:D("chat.groups.earlier"),archived:D("chat.groups.archived"),projects:D("chat.groups.projects"),fallbackTitle:D("chat.newChat")}),[D]),H=u.useMemo(()=>$5(t,W,{pinnedKeys:f,archivedKeys:h,titleOverrides:y,showArchived:N,sort:j}),[h,W,f,t,N,j,y,x,P]),E=u.useMemo(()=>U5(H,K,n,b),[n,b,H,K]),F=u.useMemo(()=>H.reduce((q,O)=>q+(am(O,b)?0:O.sessions.length),0),[b,H]),X=u.useMemo(()=>E.reduce((q,O)=>q+O.sessions.length,0),[E]),Q=Math.max(0,F-X);if(u.useEffect(()=>{G(dv)},[N,j]),T&&t.length===0)return s.jsx("div",{className:"px-3 py-6 text-[12px] text-muted-foreground",children:D("chat.loading")});if(t.length===0)return s.jsx("div",{className:"px-3 py-6 text-[12px] leading-5 text-muted-foreground/80",children:R??D("chat.noSessions")});const re=new Set(f),ue=new Set(h),pe=new Set(v),ce=new Set(g),z=w==="compact";return s.jsx("div",{className:"h-full min-h-0 min-w-0 overflow-x-hidden overflow-y-auto overscroll-contain scrollbar-thin scrollbar-track-transparent",children:s.jsxs("div",{className:"min-w-0 space-y-3 px-2 py-1.5",children:[E.map(q=>{const O=u1(q),te=d1(q,b),ie=B5(q,n,b),ve=Math.max(0,q.sessions.length-ie.length),me=q.sessions.length>qf;return s.jsxs("section",{"aria-label":q.label,children:[q.kind==="project"?s.jsx(q5,{label:q.label,path:q.projectPath,collapsed:!!b[q.id],active:Wf(q.projectPath,L),onToggle:()=>c==null?void 0:c(q.id),onSelectWorkspace:q.projectPath&&m?()=>m(q.projectPath??"",q.label):void 0,onRequestRename:q.projectKey&&d?()=>d(q.projectKey??"",q.label):void 0,onNewChat:q.projectPath&&p?()=>p(q.projectPath??"",q.label):void 0,actionMenuPortalContainer:_,updatedAt:C?q.updatedAt:null}):s.jsx(V5,{label:q.label}),q.kind==="project"&&b[q.id]?null:s.jsx("ul",{className:"space-y-0.5",children:ie.map(Z=>{var De,Ve;const ke=Z.key===n,ye=D("chat.fallbackTitle",{id:Z.chatId.slice(0,6)}),be=((De=Z.title)==null?void 0:De.trim())||"",Ie=p1(Z,y,D("chat.newChat")),Pe=((Ve=y[Z.key])==null?void 0:Ve.trim())||be||Qi(Z.preview,ye),Le=re.has(Z.key),Te=ue.has(Z.key),J=Z.preview.trim(),ee=k&&J&&J!==Ie,V=C?Af(Z.updatedAt??Z.createdAt):"",xe=q.kind==="project",Se=pe.has(Z.chatId)?"running":ce.has(Z.chatId)&&!ke?"updated":null;return s.jsx("li",{className:"min-w-0",children:s.jsxs("div",{className:A("group flex min-w-0 max-w-full items-center gap-2 rounded-xl px-2 text-[13px] transition-colors",z?"min-h-7":"min-h-8",ke?"bg-sidebar-accent/70 text-sidebar-accent-foreground shadow-[inset_0_0_0_1px_hsl(var(--sidebar-border)/0.28)]":"text-sidebar-foreground/82 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),children:[s.jsxs("button",{type:"button",onClick:()=>r(Z.key),title:Pe,className:A("min-w-0 flex-1 overflow-hidden text-left",z?"py-1":"py-1.5",xe&&"pl-7"),children:[xe?s.jsxs("span",{className:"flex w-full min-w-0 items-baseline gap-2",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium leading-5",children:Ie}),V?s.jsx("span",{className:"shrink-0 text-[11.5px] font-medium text-muted-foreground/58",children:V}):null]}):s.jsx("span",{className:"block w-full truncate font-medium leading-5",children:Ie}),ee?s.jsx("span",{className:"block w-full truncate text-[11.5px] leading-4 text-muted-foreground/72",children:J}):null,V&&!xe?s.jsx("span",{className:"block w-full truncate text-[11px] leading-4 text-muted-foreground/58",children:V}):null]}),s.jsx(G5,{state:Se}),s.jsxs(mn,{modal:!1,children:[s.jsx(fn,{className:A("inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground/75 opacity-40 transition-opacity","hover:bg-sidebar-accent hover:text-sidebar-foreground group-hover:opacity-100","focus-visible:opacity-100",ke&&"opacity-100"),"aria-label":D("chat.actions",{title:Ie}),children:s.jsx(tw,{className:"h-3.5 w-3.5"})}),s.jsxs(an,{align:"end",className:m1,portalContainer:_,onCloseAutoFocus:he=>he.preventDefault(),children:[s.jsxs(ut,{onSelect:()=>o(Z.key),className:qs,children:[Le?s.jsx(u2,{className:"h-4 w-4 shrink-0"}):s.jsx(d2,{className:"h-4 w-4 shrink-0"}),D(Le?"chat.unpin":"chat.pin")]}),s.jsxs(ut,{onSelect:()=>i(Z.key,Ie),className:qs,children:[s.jsx(hs,{className:"h-4 w-4 shrink-0"}),D("chat.rename")]}),s.jsxs(ut,{onSelect:()=>l(Z.key),className:qs,children:[Te?s.jsx($j,{className:"h-4 w-4 shrink-0"}):s.jsx(Yb,{className:"h-4 w-4 shrink-0"}),D(Te?"chat.unarchive":"chat.archive")]}),s.jsxs(ut,{onSelect:()=>{window.setTimeout(()=>a(Z.key,Ie),0)},className:A(qs,"text-destructive focus:text-destructive"),children:[s.jsx(zr,{className:"h-4 w-4 shrink-0"}),D("chat.delete")]})]})]})]})},Z.key)})}),O&&me?s.jsx(K5,{folded:te,hiddenCount:ve,onToggle:()=>c==null?void 0:c(q.id)}):null]},q.id)}),Q>0?s.jsx("div",{className:"px-2 pb-2 pt-1",children:s.jsx("button",{type:"button",onClick:()=>G(q=>Math.min(F,q+H5)),className:"h-8 w-full rounded-full text-[12px] font-medium text-muted-foreground/65 transition-colors hover:bg-sidebar-accent/65 hover:text-muted-foreground",children:D("chat.showMore",{count:Q})})}):null]})})});function q5({label:e,path:t,collapsed:n,active:r,onToggle:a,onSelectWorkspace:o,onRequestRename:i,onNewChat:l,actionMenuPortalContainer:c,updatedAt:d}){const{t:p}=se();return s.jsxs("div",{title:t,className:"group flex min-w-0 items-center gap-1 px-1 pb-1 pt-1 text-[12px] font-medium text-muted-foreground/78",children:[s.jsx("button",{type:"button","aria-expanded":!n,onClick:a,className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-lg text-muted-foreground/72 transition-colors hover:bg-sidebar-accent/45 hover:text-sidebar-foreground","aria-label":n?p("chat.expandProject",{project:e,defaultValue:`Expand ${e}`}):p("chat.collapseProject",{project:e,defaultValue:`Collapse ${e}`}),children:s.jsx(xr,{className:A("h-3.5 w-3.5 transition-transform",!n&&"rotate-90"),"aria-hidden":!0})}),s.jsxs("button",{type:"button",onClick:o,className:A("flex min-w-0 flex-1 items-center gap-2 rounded-lg px-1.5 py-1 text-left transition-colors hover:bg-sidebar-accent/45 hover:text-sidebar-foreground",r&&"bg-sidebar-accent/65 text-sidebar-foreground shadow-[inset_0_0_0_1px_hsl(var(--sidebar-border)/0.28)]"),"aria-current":r?"true":void 0,children:[s.jsx(ai,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:e})]}),d?s.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground/55",children:Af(d)}):null,i?s.jsxs(mn,{modal:!1,children:[s.jsx(fn,{className:A("inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground/70 opacity-40 transition-opacity","hover:bg-sidebar-accent hover:text-sidebar-foreground group-hover:opacity-100 focus-visible:opacity-100"),"aria-label":p("chat.actions",{title:e}),onClick:m=>m.stopPropagation(),children:s.jsx(tw,{className:"h-3.5 w-3.5"})}),s.jsx(an,{align:"end",className:m1,portalContainer:c,onCloseAutoFocus:m=>m.preventDefault(),children:s.jsxs(ut,{onSelect:i,className:qs,children:[s.jsx(hs,{className:"h-4 w-4 shrink-0"}),p("chat.rename")]})})]}):null,l?s.jsx("button",{type:"button","aria-label":p("chat.newInProject",{project:e}),title:p("chat.newInProject",{project:e}),onClick:m=>{m.stopPropagation(),l()},className:A("inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground/70 opacity-40 transition-opacity","hover:bg-sidebar-accent hover:text-sidebar-foreground group-hover:opacity-100 focus-visible:opacity-100"),children:s.jsx(Ir,{className:"h-3.5 w-3.5"})}):null]})}function V5({label:e}){return s.jsx("div",{className:"px-2 pb-1 text-[12px] font-medium text-muted-foreground/65",children:e})}function K5({folded:e,hiddenCount:t,onToggle:n}){var i;const{t:r,i18n:a}=se(),o=(i=a.resolvedLanguage)!=null&&i.startsWith("zh")?`已折叠 ${t} 个对话`:`${t} hidden chats`;return s.jsx("div",{className:"px-2 pb-1 pt-1",children:s.jsx("button",{type:"button",onClick:n,className:"h-7 w-full rounded-xl text-left text-[12px] font-medium text-muted-foreground/65 transition-colors hover:bg-sidebar-accent/50 hover:text-muted-foreground",children:s.jsx("span",{className:"px-2",children:e?r("chat.collapsed",{count:t,defaultValue:o}):r("chat.showLess")})})})}function G5({state:e}){const{t}=se();if(e==="running"){const n=t("chat.activity.running");return s.jsx("span",{"aria-label":n,title:n,className:"grid h-4 w-4 shrink-0 place-items-center",children:s.jsx("span",{className:"h-3 w-3 animate-spin rounded-full border border-blue-500/25 border-t-blue-500 [animation-duration:1.4s] motion-reduce:animate-none dark:border-blue-400/25 dark:border-t-blue-400"})})}if(e==="updated"){const n=t("chat.activity.updated");return s.jsx("span",{"aria-label":n,title:n,className:"grid h-4 w-4 shrink-0 place-items-center",children:s.jsx("span",{className:"h-2 w-2 rounded-full bg-[#ff8a3d] shadow-[0_0_0_2px_rgba(255,138,61,0.16)]"})})}return s.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"})}const f1=u.createContext(null);function Y5({client:e,token:t,modelName:n=null,children:r}){return s.jsx(f1.Provider,{value:{client:e,token:t,modelName:n},children:r})}function wr(){const e=u.useContext(f1);if(!e)throw new Error("useClient must be used within a ClientProvider");return e}const Q5={idle:{color:"text-muted-foreground"},connecting:{color:"text-amber-700 dark:text-amber-300"},open:{color:"text-emerald-700 dark:text-emerald-400"},reconnecting:{color:"text-amber-700 dark:text-amber-300"},closed:{color:"text-muted-foreground"},error:{color:"text-destructive"}};function X5(){const{t:e}=se(),{client:t}=wr(),[n,r]=u.useState(t.status);u.useEffect(()=>t.onStatus(r),[t]);const a=Q5[n],o=n==="connecting"||n==="reconnecting"||n==="error",i=e(`connection.${n}`);return s.jsxs("span",{className:A("inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-colors","text-muted-foreground/70 hover:bg-sidebar-accent/65",a.color),"aria-live":"polite",role:"status",title:i,children:[s.jsxs("span",{className:"relative flex h-2 w-2","aria-hidden":!0,children:[o&&s.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-current opacity-75"}),s.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-current"})]}),s.jsx("span",{className:"sr-only",children:i})]})}var J5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Z5=J5.reduce((e,t)=>{const n=y0(`Primitive.${t}`),r=u.forwardRef((a,o)=>{const{asChild:i,...l}=a,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),eL="Separator",pv="horizontal",tL=["horizontal","vertical"],h1=u.forwardRef((e,t)=>{const{decorative:n,orientation:r=pv,...a}=e,o=nL(r)?r:pv,l=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return s.jsx(Z5.div,{"data-orientation":o,...l,...a,ref:t})});h1.displayName=eL;function nL(e){return tL.includes(e)}var g1=h1;const v1=u.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},a)=>s.jsx(g1,{ref:a,decorative:n,orientation:t,className:A("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));v1.displayName=g1.displayName;function rL(){var n;if(typeof navigator>"u")return!1;const e=navigator.platform||"",t=((n=navigator.userAgentData)==null?void 0:n.platform)||"";return/mac|iphone|ipad|ipod/i.test(`${e} ${t}`)}function aL(){return rL()?"Cmd+Shift+O":"Ctrl+Shift+O"}function Ed(e){var l,c,d,p;const{t}=se(),[n,r]=u.useState(null),a=!!e.collapsed,o=t("thread.header.toggleSidebar"),i=aL();return s.jsxs("nav",{ref:e.containActionMenus?r:void 0,"aria-label":t("sidebar.navigation"),className:A("flex h-full w-full min-w-0 flex-col text-sidebar-foreground",e.hostChromeInset?"bg-transparent":"bg-sidebar",!e.hostChromeInset&&"border-r border-sidebar-border/60"),children:[s.jsxs("div",{className:A("flex items-center px-3 pb-2.5",e.hostChromeInset?"pt-[2.85rem]":"pt-3",a?"w-14 justify-start":"justify-between"),children:[s.jsx("button",{type:"button","aria-label":a?o:void 0,"aria-hidden":a?void 0:!0,title:a?o:void 0,onClick:a?e.onExpand:void 0,tabIndex:a?0:-1,className:A("flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-xl transition-colors",a?"-ml-0.5 hover:bg-sidebar-accent/75":"pointer-events-none -ml-0.5"),children:s.jsx("img",{src:"/brand/nanobot_icon.png",alt:"",className:"h-8 w-8 select-none object-contain",draggable:!1})}),!a&&!e.hostChromeInset&&s.jsx(fe,{variant:"ghost",size:"icon","aria-label":t("sidebar.collapse"),onClick:e.onCollapse,className:"h-7 w-7 rounded-lg text-muted-foreground/85 hover:bg-sidebar-accent/75 hover:text-sidebar-foreground",children:s.jsx(ow,{className:"h-3.5 w-3.5"})})]}),s.jsxs("div",{className:A("space-y-1.5 px-2 pb-2",a&&"flex w-14 flex-col items-center px-0"),children:[s.jsx(Id,{collapsed:a,label:t("sidebar.newChat"),onClick:e.onNewChat,icon:s.jsx(xf,{className:"h-4 w-4"}),shortcut:i,ariaKeyShortcuts:"Meta+Shift+O Control+Shift+O"}),s.jsx(Id,{collapsed:a,label:t("sidebar.searchAria"),onClick:e.onOpenSearch,icon:s.jsx(It,{className:"h-4 w-4"})}),e.archivedCount?s.jsx(Id,{collapsed:a,label:e.showArchived?t("chat.hideArchived"):t("chat.showArchived"),onClick:e.onToggleArchived,icon:s.jsx(Yb,{className:"h-4 w-4"})}):null]}),s.jsx("div",{className:A("flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden transition-opacity duration-200",a&&"pointer-events-none opacity-0"),children:!a&&s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[s.jsx(oL,{projectPaths:e.projectPaths??[],projectNameOverrides:e.projectNameOverrides??{},currentWorkspacePath:e.currentWorkspacePath,onAddProjectWorkspace:e.onAddProjectWorkspace,onRemoveProjectWorkspace:e.onRemoveProjectWorkspace,onSelectProjectWorkspace:e.onSelectProjectWorkspace}),s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(W5,{sessions:e.sessions,activeKey:e.activeKey,loading:e.loading,emptyLabel:t("chat.noSessions"),onSelect:e.onSelect,onRequestDelete:e.onRequestDelete,onTogglePin:e.onTogglePin,onRequestRename:e.onRequestRename,onToggleArchive:e.onToggleArchive,onToggleGroup:e.onToggleGroup,onRequestRenameProject:e.onRequestRenameProject,onNewChatInProject:e.onNewChatInProject,onSelectProjectWorkspace:e.onSelectProjectWorkspace,pinnedKeys:e.pinnedKeys,archivedKeys:e.archivedKeys,titleOverrides:e.titleOverrides,projectNameOverrides:e.projectNameOverrides,collapsedGroups:e.collapsedGroups,runningChatIds:e.runningChatIds,updatedChatIds:e.updatedChatIds,density:(l=e.viewState)==null?void 0:l.density,showPreviews:(c=e.viewState)==null?void 0:c.show_previews,showTimestamps:(d=e.viewState)==null?void 0:d.show_timestamps,sort:(p=e.viewState)==null?void 0:p.sort,showArchived:e.showArchived,defaultWorkspacePath:e.defaultWorkspacePath,currentWorkspacePath:e.currentWorkspacePath,actionMenuPortalContainer:e.containActionMenus?n:void 0})})]})}),s.jsx(v1,{className:"bg-sidebar-border/50"}),s.jsx("div",{className:A("flex items-center gap-1 px-2.5 py-2.5 text-xs",a&&"w-14 flex-col px-0"),children:s.jsx(X5,{})})]})}function oL({projectPaths:e,projectNameOverrides:t,currentWorkspacePath:n,onAddProjectWorkspace:r,onRemoveProjectWorkspace:a,onSelectProjectWorkspace:o}){const{t:i}=se();return s.jsxs("section",{className:"border-b border-sidebar-border/45 px-2 pb-2","aria-label":"Projects",children:[s.jsxs("div",{className:"flex items-center justify-between px-2 pb-1 text-[12px] font-medium text-muted-foreground/65",children:[s.jsx("span",{children:i("chat.groups.projects")}),s.jsx(fe,{type:"button",variant:"ghost",size:"icon",onClick:r,className:"h-6 w-6 rounded-md text-muted-foreground/75 hover:bg-sidebar-accent/70 hover:text-sidebar-foreground","aria-label":"Add project",children:s.jsx(Ir,{className:"h-3.5 w-3.5"})})]}),s.jsx("div",{className:"space-y-0.5",children:e.length===0?s.jsx("div",{className:"px-2 py-1.5 text-[12px] leading-5 text-muted-foreground/60",children:"No projects yet"}):e.map(l=>{const c=t[l]||l.replace(/\\/g,"/").split("/").filter(Boolean).pop()||l,d=Wf(n,l);return s.jsxs("div",{className:"group flex items-center gap-1",children:[s.jsxs("button",{type:"button",onClick:()=>o(l,c),className:A("flex min-w-0 flex-1 items-center gap-2 rounded-xl px-2 py-1.5 text-left text-[13px] transition-colors",d?"bg-sidebar-accent/70 text-sidebar-accent-foreground shadow-[inset_0_0_0_1px_hsl(var(--sidebar-border)/0.28)]":"text-sidebar-foreground/82 hover:bg-sidebar-accent/50 hover:text-sidebar-foreground"),title:l,children:[s.jsx(ai,{className:"h-3.5 w-3.5 shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:c})]}),s.jsx(fe,{type:"button",variant:"ghost",size:"icon",onClick:()=>a(l),className:"h-7 w-7 rounded-md text-muted-foreground/70 opacity-45 hover:bg-sidebar-accent hover:text-destructive group-hover:opacity-100","aria-label":`Remove ${c}`,children:s.jsx(zr,{className:"h-3.5 w-3.5"})})]},l)})})]})}function Id({collapsed:e,label:t,icon:n,onClick:r,active:a=!1,className:o,shortcut:i,ariaKeyShortcuts:l}){const c=i?`${t} (${i})`:e?t:void 0;return s.jsxs(fe,{type:"button",variant:"ghost","aria-label":t,"aria-current":a?"page":void 0,"aria-keyshortcuts":l,title:c,onClick:()=>r(),className:A("group h-8 min-w-0 gap-2 overflow-hidden rounded-full font-medium text-sidebar-foreground/85 hover:bg-sidebar-accent/75 hover:text-sidebar-foreground","transition-[width,padding,border-radius,color,background-color] duration-300 ease-out",e?"w-9 justify-center gap-0 rounded-xl px-0":"w-full justify-start gap-2 px-3 text-[12.5px]",a&&"bg-sidebar-accent text-sidebar-foreground shadow-[inset_0_0_0_1px_hsl(var(--sidebar-border)/0.55)]",o),children:[s.jsx("span",{className:A("flex shrink-0 items-center justify-center transition-transform duration-300 ease-out","translate-x-0"),"aria-hidden":!0,children:n}),s.jsx("span",{className:A("min-w-0 overflow-hidden truncate whitespace-nowrap transition-[max-width,opacity,transform] duration-200 ease-out",e?"max-w-0 -translate-x-1 opacity-0":"max-w-[12rem] translate-x-0 opacity-100"),children:t})]})}function sL({open:e,sessions:t,activeKey:n,loading:r,titleOverrides:a={},onOpenChange:o,onSelect:i}){const{t:l}=se(),c=u.useRef(null),d=u.useRef([]),[p,m]=u.useState(""),[f,h]=u.useState(0),y=p.trim().toLowerCase(),x=u.useMemo(()=>{if(!e)return[];if(!y)return t;const C=y.split(/\s+/).filter(Boolean);return t.filter(j=>iL(j,C,a[j.key]))},[y,e,t,a]),b=x.length;u.useEffect(()=>{e&&(m(""),h(0),window.setTimeout(()=>{var C;return(C=c.current)==null?void 0:C.focus()},0))},[e]),u.useEffect(()=>{h(0)},[y]),u.useEffect(()=>{h(C=>b===0?0:Math.min(C,b-1))},[b]),u.useEffect(()=>{d.current=d.current.slice(0,b)},[b]),u.useEffect(()=>{var C;e&&((C=d.current[f])==null||C.scrollIntoView({block:"nearest",inline:"nearest"}))},[f,e]);const v=C=>{o(!1),i(C)},g=C=>{if(C.key==="ArrowDown"){C.preventDefault(),h(j=>b===0?0:(j+1)%b);return}if(C.key==="ArrowUp"){C.preventDefault(),h(j=>b===0?0:(j-1+b)%b);return}if(C.key==="Enter"){const j=x[f];if(!j)return;C.preventDefault(),v(j.key)}},w=l(y?"sidebar.noSearchResults":"chat.noSessions"),k=l(y?"sidebar.searchResults":"sidebar.recent");return e?s.jsx(Xi,{open:e,onOpenChange:o,children:s.jsxs(ws,{showCloseButton:!1,className:A("flex max-h-[min(40rem,calc(100vh-2rem))] w-[calc(100vw-2rem)] max-w-[42rem] flex-col gap-0 overflow-hidden p-0","rounded-[22px] border border-border bg-background text-foreground shadow-[0_22px_70px_rgba(0,0,0,0.22)]","dark:border-white/14 dark:bg-[#2b2b2b] dark:shadow-[0_26px_90px_rgba(0,0,0,0.44)] sm:rounded-[22px]"),children:[s.jsx(ks,{className:"sr-only",children:l("sidebar.searchAria")}),s.jsx(el,{className:"sr-only",children:l("sidebar.searchPlaceholder")}),s.jsxs("div",{className:"flex h-[62px] shrink-0 items-center gap-3 border-b border-border px-[18px]",children:[s.jsx(It,{className:"h-[18px] w-[18px] shrink-0 text-muted-foreground","aria-hidden":!0}),s.jsx("input",{ref:c,value:p,onChange:C=>m(C.target.value),onKeyDown:g,placeholder:l("sidebar.searchPlaceholder"),"aria-label":l("sidebar.searchAria"),className:"h-full min-w-0 flex-1 bg-transparent text-[19px] font-normal leading-none text-foreground outline-none placeholder:text-muted-foreground"})]}),s.jsx("div",{"data-testid":"session-search-scroll",className:"min-h-0 flex-1 overflow-y-auto overscroll-contain p-2.5 scrollbar-thin scrollbar-track-transparent",children:s.jsxs("section",{children:[s.jsx("div",{className:"px-2.5 pb-1.5 pt-1 text-[12px] font-medium text-muted-foreground",children:k}),r&&t.length===0?s.jsx("div",{className:"px-3 py-7 text-[13px] text-muted-foreground",children:l("chat.loading")}):x.length===0?s.jsx("div",{className:"px-3 py-7 text-[13px] text-muted-foreground",children:w}):s.jsx("ul",{className:"space-y-0.5",children:x.map((C,j)=>{var R,D;const N=((R=a[C.key])==null?void 0:R.trim())||((D=C.title)==null?void 0:D.trim())||Qi(C.preview,l("chat.newChat")),P=C.preview.trim(),L=P.length>0&&P.toLowerCase()!==N.trim().toLowerCase(),_=j===f,T=C.key===n;return s.jsx("li",{children:s.jsxs("button",{ref:K=>{d.current[j]=K},type:"button",onClick:()=>v(C.key),onMouseEnter:()=>h(j),"aria-current":T?"page":void 0,className:A("grid min-h-[54px] w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-[11px] px-3 py-2 text-left transition-colors",_?"bg-muted text-foreground":"text-foreground hover:bg-muted"),children:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-[14px] font-medium leading-5",children:N}),L?s.jsx("span",{className:"block truncate text-[12px] leading-4 text-muted-foreground",children:P}):null]}),T?s.jsx("span",{className:"shrink-0 rounded-full bg-muted-foreground/10 px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:l("common.current",{defaultValue:"Current"})}):null]})},C.key)})})]})})]})}):null}function iL(e,t,n){const r=[n,e.title,e.preview].filter(Boolean).join(" ").toLowerCase();return t.every(a=>r.includes(a))}function lL(){const{t:e}=se(),t=bs(),n=tT(t);return s.jsxs(mn,{children:[s.jsx(fn,{asChild:!0,children:s.jsxs(fe,{variant:"ghost",size:"sm","aria-label":e("sidebar.language.ariaLabel"),className:"h-7 gap-1.5 rounded-md px-2 text-[11px] text-muted-foreground hover:bg-sidebar-accent hover:text-sidebar-foreground",children:[s.jsx(Zj,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"max-w-[7rem] truncate",children:n.nativeLabel})]})}),s.jsxs(an,{align:"end",children:[s.jsx(l1,{children:e("sidebar.language.label")}),s.jsx(Hf,{}),s.jsx(E5,{value:t,onValueChange:r=>{PM(r)},children:Ti.map(r=>s.jsx(i1,{value:r.code,children:s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("span",{children:r.nativeLabel}),r.nativeLabel!==r.label?s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:r.label}):null]})},r.code))})]})]})}const Vf=vu,cL=xu,x1=u.forwardRef(({className:e,...t},n)=>s.jsx(gs,{ref:n,className:A("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));x1.displayName=gs.displayName;const uL=b0("fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out",{variants:{side:{top:A("inset-x-0 top-0 border-b","data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top"),bottom:A("inset-x-0 bottom-0 border-t","data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom"),left:A("inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm","data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left"),right:A("inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm","data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right")}},defaultVariants:{side:"right"}}),_u=u.forwardRef(({side:e="right",className:t,children:n,showCloseButton:r=!0,...a},o)=>s.jsxs(cL,{children:[s.jsx(x1,{}),s.jsxs(vs,{ref:o,className:A(uL({side:e}),"data-[state=open]:animate-in data-[state=closed]:animate-out","duration-300",t),...a,children:[n,r?s.jsxs(Yi,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[s.jsx(vr,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]}):null]})]}));_u.displayName=vs.displayName;const Pu=u.forwardRef(({className:e,...t},n)=>s.jsx(xs,{ref:n,className:A("text-lg font-semibold text-foreground",e),...t}));Pu.displayName=xs.displayName;const y1=u.forwardRef(({className:e,...t},n)=>s.jsx(Gi,{ref:n,className:A("text-sm text-muted-foreground",e),...t}));y1.displayName=Gi.displayName;const dL=2e4;async function Kf(e,t={},n=dL){if(!Number.isFinite(n)||n<=0)return fetch(e,t);const r=typeof AbortController<"u"?new AbortController:null;let a;const o=fetch(e,{...t,signal:(r==null?void 0:r.signal)??t.signal}),i=new Promise((l,c)=>{a=setTimeout(()=>{c(new Error(`Request timed out after ${n}ms`)),r==null||r.abort()},n)});try{return await Promise.race([o,i])}finally{a!==void 0&&clearTimeout(a)}}const qt=2e4;class os extends Error{constructor(n,r){super(r);$e(this,"status");this.status=n,this.name="ApiError"}}async function Be(e,t,n,r=0){var i,l;const a=await Kf(e,{...n??{},headers:{...(n==null?void 0:n.headers)??{},Authorization:`Bearer ${t}`},credentials:"same-origin"},r);if(!a.ok){const c=typeof a.text=="function"?(await a.text()).trim():"";throw new os(a.status,c||`HTTP ${a.status}`)}const o=((l=(i=a.headers)==null?void 0:i.get)==null?void 0:l.call(i,"content-type"))??"";if(o&&!o.toLowerCase().includes("application/json")){const d=(typeof a.text=="function"?await a.text():"").trimStart().toLowerCase().startsWith("{if(r!=null){if(typeof r=="string"){const a=r.trim();a&&(t[n]=a);return}t[n]=r}}),!!Object.keys(t).length)return{"X-Nanobot-MCP-Values":JSON.stringify(t)}}function pL(e){return{"X-Nanobot-Automation-Values":encodeURIComponent(JSON.stringify(e))}}function mL(e){const t=e.indexOf(":");return t===-1?{channel:"",chatId:e}:{channel:e.slice(0,t),chatId:e.slice(t+1)}}async function fL(e,t=""){return(await Be(`${t}/api/sessions`,e,void 0,qt)).sessions.map(r=>({key:r.key,...mL(r.key),createdAt:r.created_at,updatedAt:r.updated_at,title:r.title??"",preview:r.preview??"",runStartedAt:r.run_started_at??null,workspaceScope:r.workspace_scope??null,knowledgeBaseId:r.knowledge_base_id??null}))}async function hL(e,t=""){return Be(`${t}/api/knowledge-bases`,e,void 0,qt)}async function mv(e,t,n,r=""){const a=typeof n=="string"?void 0:n,o=typeof n=="string"?n:r,i=new URLSearchParams;(a==null?void 0:a.limit)!==void 0&&i.set("limit",String(a.limit)),a!=null&&a.direction&&i.set("direction",a.direction),a!=null&&a.before&&i.set("before",a.before);const l=i.toString(),c=l?`?${l}`:"",d=`${o}/api/sessions/${encodeURIComponent(t)}/webui-thread${c}`,p=await Kf(d,{headers:{Authorization:`Bearer ${e}`},credentials:"same-origin"});if(p.status===404)return null;if(!p.ok)throw new os(p.status,`HTTP ${p.status}`);return await p.json()}async function gL(e,t,n,r=""){const a=new URLSearchParams;return a.set("path",n),Be(`${r}/api/sessions/${encodeURIComponent(t)}/file-preview?${a}`,e,void 0,qt)}async function b1(e,t,n=""){return Be(`${n}/api/sessions/${encodeURIComponent(t)}/automations`,e,void 0,qt)}async function fv(e,t=""){return Be(`${t}/api/webui/automations`,e,void 0,qt)}async function vL(e,t,n,r=""){const a=new URLSearchParams;return a.set("id",n),Be(`${r}/api/webui/automations/${t}?${a}`,e,void 0,qt)}async function xL(e,t,n,r=""){const a=new URLSearchParams;return a.set("id",t),Be(`${r}/api/webui/automations/update?${a}`,e,{headers:pL(n)},qt)}async function yL(e,t=""){return Be(`${t}/api/webui/skills`,e,void 0,qt)}async function bL(e,t,n=""){return Be(`${n}/api/webui/skills/${encodeURIComponent(t)}`,e,void 0,qt)}async function wL(e,t,n,r=""){const a=typeof n=="string"?void 0:n,o=typeof n=="string"?n:r,i=new URLSearchParams;a!=null&&a.deleteAutomations&&i.set("delete_automations","true");const l=i.toString()?`?${i}`:"";return Be(`${o}/api/sessions/${encodeURIComponent(t)}/delete${l}`,e)}async function li(e,t=""){return Be(`${t}/api/settings`,e,void 0,qt)}async function kL(e,t=""){return Be(`${t}/api/settings/usage`,e,void 0,qt)}async function CL(e,t=""){return Be(`${t}/api/settings/version-check`,e,void 0,1e4)}async function SL(e,t=""){return Be(`${t}/api/workspaces`,e,void 0,qt)}async function NL(e,t=""){return Be(`${t}/api/settings/cli-apps`,e,void 0,qt)}async function jL(e,t=""){return Be(`${t}/api/settings/cli-apps?installed_only=1`,e,void 0,qt)}async function AL(e,t,n,r=""){const a=new URLSearchParams;return a.set("name",n),Be(`${r}/api/settings/cli-apps/${t}?${a}`,e)}async function w1(e,t=""){return Be(`${t}/api/settings/mcp-presets`,e,void 0,qt)}async function _L(e,t,n=""){const r=new URLSearchParams;return r.set("provider",t),Be(`${n}/api/settings/provider-models?${r}`,e,void 0,qt)}async function PL(e,t,n,r={},a=""){const o=new URLSearchParams;return o.set("name",n),Be(`${a}/api/settings/mcp-presets/${t}?${o}`,e,{headers:Tu(r)})}async function TL(e,t,n=""){return Be(`${n}/api/settings/mcp-presets/custom`,e,{headers:Tu(t)})}async function RL(e,t,n=""){return Be(`${n}/api/settings/mcp-presets/import`,e,{headers:Tu({config:t})})}async function ML(e,t,n,r=""){return Be(`${r}/api/settings/mcp-presets/tools`,e,{headers:Tu({name:t,enabled_tools:n})})}async function EL(e,t=""){return(await Be(`${t}/api/commands`,e,void 0,qt)).commands.filter(r=>!["/stop","/restart"].includes(r.command)).map(r=>({command:r.command,title:r.title,description:r.description,icon:r.icon,argHint:r.arg_hint??""}))}async function IL(e,t=""){return Be(`${t}/api/webui/sidebar-state`,e,void 0,qt)}async function LL(e,t,n=""){const r=new URLSearchParams;return r.set("state",JSON.stringify(t)),Be(`${n}/api/webui/sidebar-state/update?${r}`,e)}async function hv(e,t,n=""){const r=new URLSearchParams;return t.modelPreset!==void 0&&r.set("model_preset",t.modelPreset??"default"),t.model!==void 0&&r.set("model",t.model),t.provider!==void 0&&r.set("provider",t.provider),t.contextWindowTokens!==void 0&&r.set("context_window_tokens",String(t.contextWindowTokens)),t.timezone!==void 0&&r.set("timezone",t.timezone),t.botName!==void 0&&r.set("bot_name",t.botName),t.botIcon!==void 0&&r.set("bot_icon",t.botIcon),t.toolHintMaxLength!==void 0&&r.set("tool_hint_max_length",String(t.toolHintMaxLength)),Be(`${n}/api/settings/update?${r}`,e)}async function DL(e,t,n=""){const r=new URLSearchParams;return t.name!==void 0&&r.set("name",t.name),r.set("label",t.label),r.set("provider",t.provider),r.set("model",t.model),Be(`${n}/api/settings/model-configurations/create?${r}`,e)}async function OL(e,t,n=""){const r=new URLSearchParams;return r.set("name",t.name),t.label!==void 0&&r.set("label",t.label),t.provider!==void 0&&r.set("provider",t.provider),t.model!==void 0&&r.set("model",t.model),t.contextWindowTokens!==void 0&&r.set("context_window_tokens",String(t.contextWindowTokens)),Be(`${n}/api/settings/model-configurations/update?${r}`,e)}async function FL(e,t,n=""){const r=new URLSearchParams;return r.set("provider",t.provider),t.apiKey!==void 0&&r.set("api_key",t.apiKey),t.apiBase!==void 0&&r.set("api_base",t.apiBase),t.apiType!==void 0&&r.set("api_type",t.apiType),Be(`${n}/api/settings/provider/update?${r}`,e)}async function zL(e,t,n=""){const r=new URLSearchParams;return r.set("provider",t),Be(`${n}/api/settings/provider/oauth-login?${r}`,e)}async function $L(e,t,n=""){const r=new URLSearchParams;return r.set("provider",t),Be(`${n}/api/settings/provider/oauth-logout?${r}`,e)}async function UL(e,t,n=""){const r=new URLSearchParams;return r.set("provider",t.provider),t.apiKey!==void 0&&r.set("api_key",t.apiKey),t.baseUrl!==void 0&&r.set("base_url",t.baseUrl),t.maxResults!==void 0&&r.set("max_results",String(t.maxResults)),t.timeout!==void 0&&r.set("timeout",String(t.timeout)),t.useJinaReader!==void 0&&r.set("use_jina_reader",String(t.useJinaReader)),Be(`${n}/api/settings/web-search/update?${r}`,e)}async function BL(e,t,n=""){const r=new URLSearchParams;return r.set("webui_allow_local_service_access",String(t.webuiAllowLocalServiceAccess)),r.set("webui_default_access_mode",t.webuiDefaultAccessMode),Be(`${n}/api/settings/network-safety/update?${r}`,e)}async function HL(e,t,n=""){const r=new URLSearchParams;return r.set("enabled",String(t.enabled)),r.set("provider",t.provider),r.set("model",t.model),r.set("default_aspect_ratio",t.defaultAspectRatio),r.set("default_image_size",t.defaultImageSize),r.set("max_images_per_turn",String(t.maxImagesPerTurn)),Be(`${n}/api/settings/image-generation/update?${r}`,e)}async function WL(e,t,n=""){const r=new URLSearchParams;return r.set("enabled",String(t.enabled)),r.set("provider",t.provider),r.set("model",t.model),r.set("language",t.language),r.set("max_duration_sec",String(t.maxDurationSec)),r.set("max_upload_mb",String(t.maxUploadMb)),Be(`${n}/api/settings/transcription/update?${r}`,e)}function qL({skills:e}){const{t}=se(),n=e.filter(o=>o.available).length,[r,a]=u.useState(null);return s.jsxs("div",{className:"space-y-7",children:[s.jsxs("section",{className:"flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between",children:[s.jsx("p",{className:"max-w-[680px] text-[13px] leading-5 text-muted-foreground",children:t("settings.skills.description",{defaultValue:"Review the instruction skills this agent can load during a conversation."})}),s.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:t("settings.skills.caption",{available:n,total:e.length,defaultValue:"{{available}} available · {{total}} total"})})]}),s.jsxs("section",{children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border/45 pb-3",children:[s.jsx("h2",{className:"mb-2 px-1 text-[13px] font-semibold tracking-[-0.01em] text-foreground/85",children:t("settings.skills.featured",{defaultValue:"Agent skills"})}),s.jsx("span",{className:"rounded-full bg-muted px-2.5 py-1 text-[12px] font-medium text-muted-foreground",children:e.length})]}),e.length?s.jsx("div",{className:"grid gap-x-10 gap-y-1 py-3 md:grid-cols-2",children:e.map(o=>s.jsx(VL,{skill:o,onSelect:a},`${o.source}:${o.name}`))}):s.jsx("div",{className:"px-3 py-12 text-center text-sm text-muted-foreground",children:t("settings.skills.empty",{defaultValue:"No skills are available."})})]}),s.jsx(KL,{skill:r,open:r!==null,onOpenChange:o=>{o||a(null)}})]})}function VL({skill:e,onSelect:t}){const{t:n}=se(),r=k1(e.source,n),a=e.available?jt:ja,o=e.available?n("settings.skills.statusAvailable",{defaultValue:"Available"}):n("settings.skills.statusUnavailable",{defaultValue:"Unavailable"});return s.jsxs("button",{type:"button","aria-label":n("settings.skills.openDetails",{name:e.name,defaultValue:"Open details for {{name}}"}),onClick:()=>t(e),className:A("group flex min-w-0 items-center gap-3 rounded-[16px] px-3 py-3 text-left transition-colors","hover:bg-muted/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",!e.available&&"opacity-65"),children:[s.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-[14px] bg-muted/70 text-muted-foreground",children:s.jsx(Ga,{className:"h-5 w-5",strokeWidth:1.8,"aria-hidden":!0})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("h3",{className:"truncate text-[15px] font-semibold leading-5 text-foreground",children:e.name}),s.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-semibold leading-none text-muted-foreground",children:r})]}),s.jsx("p",{className:"mt-1 line-clamp-2 text-[13px] leading-5 text-muted-foreground",children:e.description}),!e.available&&e.unavailable_reason?s.jsx("p",{className:"mt-1 truncate text-[12px] leading-4 text-muted-foreground/80",children:n("settings.skills.unavailableReason",{reason:e.unavailable_reason,defaultValue:"Missing: {{reason}}"})}):null]}),s.jsxs("span",{title:!e.available&&e.unavailable_reason?e.unavailable_reason:void 0,className:A("hidden shrink-0 items-center gap-1 rounded-full px-2.5 py-1 text-[12px] font-medium sm:inline-flex",e.available?"bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"bg-muted text-muted-foreground"),children:[s.jsx(a,{className:"h-3.5 w-3.5","aria-hidden":!0}),o]})]})}function KL({skill:e,open:t,onOpenChange:n}){const{token:r}=wr(),{t:a}=se(),[o,i]=u.useState(null),[l,c]=u.useState(!1),[d,p]=u.useState(!1);if(u.useEffect(()=>{if(!t||!e)return;let y=!1;return i(null),c(!0),p(!1),bL(r,e.name).then(x=>{y||i(x)}).catch(()=>{y||p(!0)}).finally(()=>{y||c(!1)}),()=>{y=!0}},[t,e,r]),!e)return null;const m=o??e,f=k1(m.source,a),h=m.available?a("settings.skills.statusAvailable",{defaultValue:"Available"}):a("settings.skills.statusUnavailable",{defaultValue:"Unavailable"});return s.jsx(Vf,{open:t,onOpenChange:n,children:s.jsx(_u,{side:"right",className:"w-[min(34rem,calc(100vw-1rem))] max-w-none gap-0 overflow-hidden p-0 sm:max-w-none",children:s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5",children:[s.jsxs("div",{className:"flex items-start gap-3 pr-8",children:[s.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-[15px] bg-muted/70 text-muted-foreground",children:s.jsx(Ga,{className:"h-5 w-5",strokeWidth:1.8,"aria-hidden":!0})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx(Pu,{className:"truncate text-[20px] font-semibold",children:m.name}),s.jsx(y1,{className:"sr-only",children:a("settings.skills.detailDescription",{name:m.name,defaultValue:"Details for {{name}}."})}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-[12px] text-muted-foreground",children:[s.jsx(sm,{children:f}),s.jsx(sm,{tone:m.available?"success":"muted",children:h})]})]})]}),l?s.jsxs("div",{className:"mt-8 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(vt,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),a("settings.skills.loadingDetail",{defaultValue:"Loading skill details..."})]}):d?s.jsx("div",{className:"mt-8 rounded-[16px] bg-destructive/10 px-3 py-3 text-sm text-destructive",children:a("settings.skills.loadFailed",{defaultValue:"Could not load skill details."})}):s.jsxs("div",{className:"mt-7 space-y-6",children:[s.jsx(om,{title:a("settings.skills.descriptionTitle",{defaultValue:"Description"}),children:s.jsx("p",{className:"text-[14px] leading-6 text-muted-foreground",children:m.description})}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(gv,{label:a("settings.skills.source",{defaultValue:"Source"}),value:f}),s.jsx(gv,{label:a("settings.skills.status",{defaultValue:"Status"}),value:h})]}),!m.available&&m.unavailable_reason?s.jsx(om,{title:a("settings.skills.unavailableReasonLabel",{defaultValue:"Unavailable reason"}),children:s.jsx("p",{className:"text-[13px] leading-5 text-destructive/85",children:m.unavailable_reason})}):null,o?s.jsx(YL,{detail:o}):null,o?s.jsx(GL,{markdown:o.raw_markdown}):null]})]})})})}function GL({markdown:e}){const{t}=se(),n=e||t("settings.skills.rawInstructionsEmpty",{defaultValue:"No raw instructions."});return s.jsxs("details",{className:"group rounded-[18px] border border-border/45 bg-muted/20 px-3 py-3",children:[s.jsx("summary",{className:"cursor-pointer select-none text-[13px] font-medium text-foreground/90 transition-colors hover:text-foreground",children:t("settings.skills.rawInstructions",{defaultValue:"Raw SKILL.md"})}),s.jsx("div",{className:"mt-3 overflow-hidden rounded-[14px] border border-border/35 bg-background/70",children:s.jsx("pre",{className:A("max-h-[min(42vh,32rem)] overflow-auto overscroll-contain px-3.5 py-3 pr-4","whitespace-pre-wrap break-words font-mono text-[12px] leading-[1.7] text-foreground/62","scrollbar-thin scrollbar-track-transparent","[&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5","[&::-webkit-scrollbar-thumb]:bg-muted-foreground/25"),children:n})})]})}function gv({label:e,value:t}){return s.jsxs("div",{className:"rounded-[16px] bg-muted/35 px-3 py-2.5",children:[s.jsx("div",{className:"text-[11px] text-muted-foreground",children:e}),s.jsx("div",{className:"mt-0.5 truncate text-[13px] font-medium text-foreground",children:t})]})}function YL({detail:e}){const{t}=se(),{bins:n,env:r,missing_bins:a,missing_env:o}=e.requirements,i=n.length>0||r.length>0;return s.jsx(om,{title:t("settings.skills.requirements",{defaultValue:"Requirements"}),children:i?s.jsxs("div",{className:"space-y-3",children:[a.length?s.jsx(Ll,{title:t("settings.skills.missingCommands",{defaultValue:"Missing CLI"}),items:a,tone:"danger",icon:s.jsx(Mc,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null,o.length?s.jsx(Ll,{title:t("settings.skills.missingEnvironment",{defaultValue:"Missing ENV"}),items:o,tone:"danger",icon:s.jsx(mg,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null,n.length?s.jsx(Ll,{title:t("settings.skills.commands",{defaultValue:"Commands"}),items:n,icon:s.jsx(Mc,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null,r.length?s.jsx(Ll,{title:t("settings.skills.environment",{defaultValue:"Environment variables"}),items:r,icon:s.jsx(mg,{className:"h-3.5 w-3.5","aria-hidden":!0})}):null]}):s.jsx("p",{className:"text-[13px] text-muted-foreground",children:t("settings.skills.noRequirements",{defaultValue:"No explicit requirements."})})})}function om({title:e,children:t}){return s.jsxs("section",{children:[s.jsx("h3",{className:"mb-2 text-[12px] font-medium text-muted-foreground",children:e}),t]})}function Ll({title:e,items:t,icon:n,tone:r="muted"}){return s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:A("flex items-center gap-1.5 text-[12px]",r==="danger"?"text-destructive":"text-muted-foreground"),children:[n,e]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map(a=>s.jsx(sm,{children:a},a))})]})}function sm({children:e,tone:t="muted"}){return s.jsx("span",{className:A("inline-flex max-w-full items-center rounded-full px-2 py-0.5 text-[11px] font-medium",t==="success"?"bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"bg-muted text-muted-foreground"),children:e})}function k1(e,t){return e==="workspace"?t("settings.skills.sourceWorkspace",{defaultValue:"Custom"}):e==="builtin"?t("settings.skills.sourceBuiltin",{defaultValue:"Built-in"}):e}var QL=Symbol("radix.slottable");function XL(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=QL,t}var JL=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),ZL="VisuallyHidden",C1=u.forwardRef((e,t)=>s.jsx(Ct.span,{...e,ref:t,style:{...JL,...e.style}}));C1.displayName=ZL;var e3=C1,[Ru]=Aa("Tooltip",[Cu]),Mu=Cu(),S1="TooltipProvider",t3=700,im="tooltip.open",[n3,Gf]=Ru(S1),N1=e=>{const{__scopeTooltip:t,delayDuration:n=t3,skipDelayDuration:r=300,disableHoverableContent:a=!1,children:o}=e,i=u.useRef(!0),l=u.useRef(!1),c=u.useRef(0);return u.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),s.jsx(n3,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:u.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:u.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:u.useCallback(d=>{l.current=d},[]),disableHoverableContent:a,children:o})};N1.displayName=S1;var Ii="Tooltip",[r3,ol]=Ru(Ii),j1=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:a,onOpenChange:o,disableHoverableContent:i,delayDuration:l}=e,c=Gf(Ii,e.__scopeTooltip),d=Mu(t),[p,m]=u.useState(null),f=$a(),h=u.useRef(0),y=i??c.disableHoverableContent,x=l??c.delayDuration,b=u.useRef(!1),[v,g]=pu({prop:r,defaultProp:a??!1,onChange:N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(im))):c.onClose(),o==null||o(N)},caller:Ii}),w=u.useMemo(()=>v?b.current?"delayed-open":"instant-open":"closed",[v]),k=u.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b.current=!1,g(!0)},[g]),C=u.useCallback(()=>{window.clearTimeout(h.current),h.current=0,g(!1)},[g]),j=u.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{b.current=!0,g(!0),h.current=0},x)},[x,g]);return u.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),s.jsx(nk,{...d,children:s.jsx(r3,{scope:t,contentId:f,open:v,stateAttribute:w,trigger:p,onTriggerChange:m,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?j():k()},[c.isOpenDelayedRef,j,k]),onTriggerLeave:u.useCallback(()=>{y?C():(window.clearTimeout(h.current),h.current=0)},[C,y]),onOpen:k,onClose:C,disableHoverableContent:y,children:n})})};j1.displayName=Ii;var lm="TooltipTrigger",A1=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=ol(lm,n),o=Gf(lm,n),i=Mu(n),l=u.useRef(null),c=At(t,l,a.onTriggerChange),d=u.useRef(!1),p=u.useRef(!1),m=u.useCallback(()=>d.current=!1,[]);return u.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),s.jsx(rk,{asChild:!0,...i,children:s.jsx(Ct.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:c,onPointerMove:_e(e.onPointerMove,f=>{f.pointerType!=="touch"&&!p.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),p.current=!0)}),onPointerLeave:_e(e.onPointerLeave,()=>{a.onTriggerLeave(),p.current=!1}),onPointerDown:_e(e.onPointerDown,()=>{a.open&&a.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:_e(e.onFocus,()=>{d.current||a.onOpen()}),onBlur:_e(e.onBlur,a.onClose),onClick:_e(e.onClick,a.onClose)})})});A1.displayName=lm;var Yf="TooltipPortal",[a3,o3]=Ru(Yf,{forceMount:void 0}),_1=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:a}=e,o=ol(Yf,t);return s.jsx(a3,{scope:t,forceMount:n,children:s.jsx(yr,{present:n||o.open,children:s.jsx(fu,{asChild:!0,container:a,children:r})})})};_1.displayName=Yf;var ss="TooltipContent",P1=u.forwardRef((e,t)=>{const n=o3(ss,e.__scopeTooltip),{forceMount:r=n.forceMount,side:a="top",...o}=e,i=ol(ss,e.__scopeTooltip);return s.jsx(yr,{present:r||i.open,children:i.disableHoverableContent?s.jsx(T1,{side:a,...o,ref:t}):s.jsx(s3,{side:a,...o,ref:t})})}),s3=u.forwardRef((e,t)=>{const n=ol(ss,e.__scopeTooltip),r=Gf(ss,e.__scopeTooltip),a=u.useRef(null),o=At(t,a),[i,l]=u.useState(null),{trigger:c,onClose:d}=n,p=a.current,{onPointerInTransitChange:m}=r,f=u.useCallback(()=>{l(null),m(!1)},[m]),h=u.useCallback((y,x)=>{const b=y.currentTarget,v={x:y.clientX,y:y.clientY},g=d3(v,b.getBoundingClientRect()),w=p3(v,g),k=m3(x.getBoundingClientRect()),C=h3([...w,...k]);l(C),m(!0)},[m]);return u.useEffect(()=>()=>f(),[f]),u.useEffect(()=>{if(c&&p){const y=b=>h(b,p),x=b=>h(b,c);return c.addEventListener("pointerleave",y),p.addEventListener("pointerleave",x),()=>{c.removeEventListener("pointerleave",y),p.removeEventListener("pointerleave",x)}}},[c,p,h,f]),u.useEffect(()=>{if(i){const y=x=>{const b=x.target,v={x:x.clientX,y:x.clientY},g=(c==null?void 0:c.contains(b))||(p==null?void 0:p.contains(b)),w=!f3(v,i);g?f():w&&(f(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,p,i,d,f]),s.jsx(T1,{...e,ref:o})}),[i3,l3]=Ru(Ii,{isInside:!1}),c3=XL("TooltipContent"),T1=u.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:i,...l}=e,c=ol(ss,n),d=Mu(n),{onClose:p}=c;return u.useEffect(()=>(document.addEventListener(im,p),()=>document.removeEventListener(im,p)),[p]),u.useEffect(()=>{if(c.trigger){const m=f=>{const h=f.target;h!=null&&h.contains(c.trigger)&&p()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[c.trigger,p]),s.jsx(mu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:m=>m.preventDefault(),onDismiss:p,children:s.jsxs(ak,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[s.jsx(c3,{children:r}),s.jsx(i3,{scope:n,isInside:!0,children:s.jsx(e3,{id:c.contentId,role:"tooltip",children:a||r})})]})})});P1.displayName=ss;var R1="TooltipArrow",u3=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,a=Mu(n);return l3(R1,n).isInside?null:s.jsx(ok,{...a,...r,ref:t})});u3.displayName=R1;function d3(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,a,o)){case o:return"left";case a:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function p3(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function m3(e){const{top:t,right:n,bottom:r,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:r},{x:a,y:r}]}function f3(e,t){const{x:n,y:r}=e;let a=!1;for(let o=0,i=t.length-1;or!=f>r&&n<(m-d)*(r-p)/(f-p)+d&&(a=!a)}return a}function h3(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),g3(t)}function g3(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const o=t[t.length-1],i=t[t.length-2];if((o.x-i.x)*(a.y-i.y)>=(o.y-i.y)*(a.x-i.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const a=e[r];for(;n.length>=2;){const o=n[n.length-1],i=n[n.length-2];if((o.x-i.x)*(a.y-i.y)>=(o.y-i.y)*(a.x-i.x))n.pop();else break}n.push(a)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var v3=N1,x3=j1,y3=A1,b3=_1,M1=P1;const Eu=v3,Li=x3,Di=y3,is=u.forwardRef(({className:e,sideOffset:t=4,...n},r)=>s.jsx(b3,{children:s.jsx(M1,{ref:r,sideOffset:t,className:A("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95",e),...n})}));is.displayName=M1.displayName;const E1=371,vv=Math.ceil(E1/7),xv=["user","api","cron","dream","system"];function Ld(e,t){const n=new Date(e);return n.setUTCDate(n.getUTCDate()+t),n}function cm(e){return e.toISOString().slice(0,10)}function w3(e){const[t,n,r]=e.split("-").map(Number);return new Date(Date.UTC(t,n-1,r))}function k3(e,t){if(!t)return cm(e);try{const n=new Intl.DateTimeFormat("en",{calendar:"gregory",numberingSystem:"latn",timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(e),r=Object.fromEntries(n.map(a=>[a.type,a.value]));if(r.year&&r.month&&r.day)return[r.year.padStart(4,"0"),r.month.padStart(2,"0"),r.day.padStart(2,"0")].join("-")}catch{}return cm(e)}function C3(e,t,n){const r=new Map((e??[]).map(d=>[d.date,d])),a=w3(k3(new Date,n)),o=Ld(a,6-a.getUTCDay()),i=Ld(o,-370),l=[];return{cells:Array.from({length:E1},(d,p)=>{const m=Ld(i,p),f=cm(m),h=r.get(f);return m.getUTCDate()===1&&l.push({label:t.format(m),column:Math.floor(p/7)+1}),{date:f,total:(h==null?void 0:h.total_tokens)??0,estimated:(h==null?void 0:h.estimated_tokens)??0,requests:(h==null?void 0:h.requests)??0,sources:(h==null?void 0:h.sources)??{},future:m>a}}),monthLabels:l}}function S3(e,t){return e==="user"?t("settings.usage.sources.user","Chat"):e==="api"?t("settings.usage.sources.api","API"):e==="cron"?t("settings.usage.sources.cron","Automations"):e==="dream"?t("settings.usage.sources.dream","Memory"):t("settings.usage.sources.system","System")}function N3(e,t){const n=xv.filter(a=>{var o;return((o=e.sources[a])==null?void 0:o.total_tokens)>0}),r=Object.keys(e.sources).filter(a=>!xv.includes(a)).filter(a=>{var o;return((o=e.sources[a])==null?void 0:o.total_tokens)>0}).sort();return[...n,...r].map(a=>{var l;const o=S3(a,t),i=I1(((l=e.sources[a])==null?void 0:l.total_tokens)??0);return`${o} ${i}`}).join(" · ")}function I1(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}M`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}K`:String(e)}function j3(e,t){if(e<=0||t<=0)return 0;const n=e/t;return n>=.75?4:n>=.45?3:n>=.2?2:1}function A3(e,t){return t?"bg-transparent ring-1 ring-neutral-200/70 dark:ring-white/[0.045]":e===4?"bg-sky-300 dark:bg-sky-300":e===3?"bg-sky-400/85 dark:bg-sky-500/80":e===2?"bg-sky-500/60 dark:bg-sky-700/85":e===1?"bg-sky-500/30 dark:bg-sky-900/80":"bg-neutral-200/70 ring-1 ring-black/[0.025] dark:bg-white/[0.08] dark:ring-white/[0.035]"}function _3({usage:e,timeZone:t}){const{t:n,i18n:r}=se(),a=(d,p,m)=>n(d,{defaultValue:p,...m??{}}),o=u.useMemo(()=>new Intl.DateTimeFormat(r.language,{month:"short",timeZone:"UTC"}),[r.language]),{cells:i,monthLabels:l}=u.useMemo(()=>C3(e==null?void 0:e.days,o,t),[o,t,e==null?void 0:e.days]),c=Math.max(0,...i.map(d=>d.total));return s.jsx("div",{className:"overflow-x-auto pb-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:s.jsxs("div",{className:"mx-auto w-full min-w-0 max-w-[1054px] px-0.5 sm:min-w-[760px]",children:[s.jsx("div",{className:"mb-2 flex justify-end",children:s.jsx("span",{className:"text-[11px] font-normal leading-none text-muted-foreground/64",children:a("settings.usage.shortTitle","Token Usage")})}),s.jsx("div",{className:"relative mb-2 h-4 text-[10px] font-normal leading-4 text-muted-foreground/62","aria-hidden":!0,children:l.map(d=>s.jsx("span",{className:"absolute top-0 whitespace-nowrap",style:{left:`${(d.column-1)/vv*100}%`},children:d.label},`${d.label}-${d.column}`))}),s.jsx("div",{className:"grid grid-flow-col grid-rows-7 gap-[3px] sm:gap-1.5",style:{gridTemplateColumns:`repeat(${vv}, minmax(0, 1fr))`},"aria-label":a("settings.usage.title","Token activity"),children:s.jsx(Eu,{delayDuration:120,skipDelayDuration:80,children:i.map(d=>{const p=j3(d.total,c),m=d.future?d.date:a("settings.usage.cellTitle","{{date}}: {{tokens}} tokens, {{requests}} requests",{date:d.date,tokens:I1(d.total),requests:d.requests}),f=d.future||d.estimated<=0?m:`${m} · ${d.estimated>=d.total?a("settings.usage.estimated","estimated"):a("settings.usage.includesEstimates","includes estimates")}`,h=d.future?"":N3(d,a),y=h?`${f} · ${h}`:f;return s.jsxs(Li,{children:[s.jsx(Di,{asChild:!0,children:s.jsx("span",{"aria-label":y,className:A("aspect-square w-full rounded-[2px] transition-transform hover:scale-110 sm:rounded-[4px]",A3(p,d.future))})}),s.jsxs(is,{side:"top",align:"center",className:"rounded-[10px] border-border/45 bg-popover px-2.5 py-1.5 text-[11px] font-normal text-popover-foreground shadow-lg",children:[s.jsx("span",{className:"block",children:f}),h?s.jsx("span",{className:"mt-1 block text-muted-foreground",children:h}):null]})]},d.date)})})})]})})}const Ro=u.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{className:A("flex min-h-[60px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));Ro.displayName="Textarea";const L1="nanobot:cli-apps-changed";function P3(e){return!!e&&typeof e=="object"&&Array.isArray(e.apps)}function T3(e){return e.apps.filter(t=>t.installed)}function R3(e){typeof window>"u"||window.dispatchEvent(new CustomEvent(L1,{detail:e}))}const M3=0,yv=1,bv=2,Dl=3;function ka(){return typeof window>"u"?null:window.nanobotHost??null}function wv(e){return e==="native"?"native":"browser"}function kv(e,t){const n=ka(),r={can_export_diagnostics:!1,can_open_logs:!1,can_pick_folder:!1,can_restart_engine:!1,...t??{}},a=O1();return{surface:e,capabilities:r,socketFactory:a?D1:void 0,pickFolder:n==null?void 0:n.pickFolder,restartEngine:n==null?void 0:n.restartEngine,openLogs:n==null?void 0:n.openLogs,exportDiagnostics:n==null?void 0:n.exportDiagnostics}}function D1(e){const t=O1();if(!t)throw new Error("Host WebSocket bridge is not available");return new E3(t,e)}function O1(){const e=ka();return!(e!=null&&e.openSocket)||!e.sendSocket||!e.closeSocket||!e.onSocketEvent?null:{closeSocket:e.closeSocket,onSocketEvent:e.onSocketEvent,openSocket:e.openSocket,sendSocket:e.sendSocket}}class E3{constructor(t,n){$e(this,"binaryType","blob");$e(this,"onclose",null);$e(this,"onerror",null);$e(this,"onmessage",null);$e(this,"onopen",null);$e(this,"readyState",M3);$e(this,"url");$e(this,"id",null);$e(this,"queued",[]);$e(this,"unsubscribe");this.api=t,this.url=n,this.unsubscribe=t.onSocketEvent(r=>this.handleEvent(r)),t.openSocket(n).then(r=>{this.id=r},()=>{var r,a;this.readyState=Dl,(r=this.onerror)==null||r.call(this,new Event("error")),(a=this.onclose)==null||a.call(this,Cv()),this.unsubscribe()})}close(){this.readyState===bv||this.readyState===Dl||(this.readyState=bv,this.id?this.api.closeSocket(this.id):(this.readyState=Dl,this.unsubscribe()))}send(t){if(typeof t!="string")throw new Error("Host WebSocket bridge only supports text frames");if(this.readyState===yv&&this.id){this.api.sendSocket(this.id,t);return}this.queued.push(t)}handleEvent(t){var n,r,a,o;if(!(!this.id||t.id!==this.id)){if(t.type==="open"){for(this.readyState=yv,(n=this.onopen)==null||n.call(this,new Event("open"));this.queued.length>0&&this.id;){const i=this.queued.shift();i!==void 0&&this.api.sendSocket(this.id,i)}return}if(t.type==="message"){(r=this.onmessage)==null||r.call(this,new MessageEvent("message",{data:t.data}));return}if(t.type==="error"){(a=this.onerror)==null||a.call(this,new Event("error"));return}this.readyState=Dl,(o=this.onclose)==null||o.call(this,Cv(t.code,t.reason)),this.unsubscribe()}}}function Cv(e=1006,t=""){return typeof CloseEvent<"u"?new CloseEvent("close",{code:e,reason:t}):new Event("close")}const F1="nanobot:mcp-presets-changed";function I3(e){return!!e&&typeof e=="object"&&Array.isArray(e.presets)}function L3(e){return e.presets.filter(t=>t.installed&&t.configured)}function Ol(e){typeof window>"u"||window.dispatchEvent(new CustomEvent(F1,{detail:e}))}function D3(e){return`https://${e}/favicon.ico`}function O3(e){return`https://icons.duckduckgo.com/ip3/${encodeURIComponent(e)}.ico`}function F3(e){return`https://www.google.com/s2/favicons?domain=${encodeURIComponent(e)}&sz=64`}function Wc(e){const t=$3(e);return[D3(t),O3(t),F3(e)]}function Me(e,t,n,r=[]){const a=[...r];return Wc(e).forEach(o=>Vs(a,o)),{logoUrl:a[0],logoUrls:a,color:t,initials:n}}function Vs(e,t){const n=t==null?void 0:t.trim();n&&!e.includes(n)&&e.push(n)}function z3(e){if(e.startsWith("/"))return null;try{const t=new URL(e);if(!/^https?:$/.test(t.protocol))return null;const n=t.hostname.toLowerCase();if(n==="www.google.com"||n==="google.com")return t.searchParams.get("domain");if(n==="icons.duckduckgo.com"){const r=t.pathname.match(/^\/ip3\/(.+)\.ico$/);return r?decodeURIComponent(r[1]):null}return n.replace(/^www\./,"")}catch{return null}}function $3(e){var n;return((n=e.split("/")[0])==null?void 0:n.trim())||e}function ao(e){const t=e==null?void 0:e.trim();if(!t)return[];if(t.startsWith("/"))return[t];const n=[],r=z3(t),a=/^(https?:\/\/)?(www\.google\.com|google\.com|icons\.duckduckgo\.com)\//i.test(t);return r&&a?(Vs(n,t),Wc(r).forEach(o=>Vs(n,o)),n):(Vs(n,t),r&&Wc(r).forEach(o=>Vs(n,o)),n)}const U3={brave_search:"brave",byteplus_coding_plan:"byteplus",mimo:"xiaomi_mimo",minimaxAnthropic:"minimax",minimax_anthropic:"minimax",openai_codex:"openai",xiaomi:"xiaomi_mimo",volcengine_coding_plan:"volcengine"},B3={brave_search:"Brave Search",byteplus_coding_plan:"BytePlus",minimaxAnthropic:"MiniMax",minimax_anthropic:"MiniMax",openai_codex:"OpenAI",volcengine_coding_plan:"Volcengine"},H3={aihubmix:Me("aihubmix.com","#111827","AH"),ant_ling:Me("ant-ling.com","#7C3AED","AL"),anthropic:Me("anthropic.com","#D97757","A"),assemblyai:Me("assemblyai.com","#111827","AA"),atomic_chat:Me("atomic.chat","#111827","AC"),azure_openai:Me("azure.microsoft.com","#0078D4","AZ"),bedrock:Me("aws.amazon.com","#FF9900","AWS"),bocha:Me("bochaai.com","#2563EB","B"),brave:Me("brave.com","#FB542B","B"),byteplus:Me("byteplus.com","#325CFF","BP"),dashscope:Me("dashscope.aliyun.com","#FF6A00","DS"),deepseek:Me("deepseek.com","#4D6BFE","DS"),duckduckgo:Me("duckduckgo.com","#DE5833","DDG"),exa:Me("exa.ai","#5B5BF6","E"),gemini:Me("gemini.google.com","#4285F4","G"),github_copilot:Me("github.com","#24292F","GH"),groq:Me("groq.com","#F55036","GQ"),huggingface:Me("huggingface.co","#FF9D00","HF"),jina:Me("jina.ai","#7C3AED","J"),kagi:Me("kagi.com","#FFB319","K"),keenable:Me("keenable.ai","#0EA5E9","K"),lm_studio:Me("lmstudio.ai","#111827","LM"),longcat:Me("longcatai.org","#4F8CFF","LC",["https://www.longcatai.org/favicon.svg"]),minimax:Me("minimax.io","#111827","MM"),mistral:Me("mistral.ai","#FA520F","M"),moonshot:Me("moonshot.ai","#111827","MS"),novita:Me("novita.ai","#7C3AED","N"),olostep:Me("olostep.com","#111827","O"),nvidia:Me("nvidia.com","#76B900","NV"),ollama:Me("ollama.com","#111827","O"),openai:Me("openai.com","#111827","AI"),openrouter:Me("openrouter.ai","#111827","OR"),ovms:Me("openvino.ai","#0071C5","OV"),qianfan:Me("cloud.baidu.com","#2932E1","QF"),searxng:Me("searxng.org","#3050FF","SX"),siliconflow:Me("siliconflow.cn","#111827","SF"),skywork:Me("skywork.ai","#5B5BF6","SW"),stepfun:Me("stepfun.com","#2F6BFF","SF",["https://www.stepfun.com/step_favicon.svg"]),tavily:Me("tavily.com","#111827","T"),volcengine:Me("volcengine.com","#1664FF","VE"),vllm:Me("vllm.ai","#2563EB","VL"),xiaomi_mimo:Me("mimo.xiaomi.com","#FF6900","MI",["https://mimo.xiaomi.com/mimo-v2-pro/assets/logo.svg"]),zhipu:Me("z.ai","#155EEF","Z",["https://z-cdn.chatglm.cn/z-ai/static/logo.svg","https://www.google.com/s2/favicons?domain=z.ai&sz=64"])};function sl(e){if(!e)return null;const t=U3[e]??e;return H3[t]??null}function Mo(e,t){var n;return t?((n=e.find(r=>r.name===t))==null?void 0:n.label)??B3[t]??t:""}function um(e){const t=(e??"").trim().toLowerCase();if(!t)return null;const n=t.split(/[/:]/)[0];return sl(n)?n:/claude|anthropic/.test(t)?"anthropic":/gpt-|^o\d|chatgpt|openai/.test(t)?"openai":/deepseek/.test(t)?"deepseek":/gemini/.test(t)?"gemini":/qwen|dashscope/.test(t)?"dashscope":/kimi|moonshot/.test(t)?"moonshot":/minimax/.test(t)?"minimax":/mistral|mixtral/.test(t)?"mistral":/skywork|skyclaw/.test(t)?"skywork":/ring-/.test(t)?"ant_ling":null}const W3=[65536,2e5,262144],q3=new Set(["aihubmix","atomic_chat","byteplus","byteplus_coding_plan","huggingface","lm_studio","novita","ollama","openrouter","ovms","siliconflow","vllm","volcengine","volcengine_coding_plan"]),V3=2,K3=2e3,G3=30,Y3=["UTC","Asia/Shanghai","Asia/Hong_Kong","Asia/Tokyo","Asia/Seoul","Asia/Singapore","Asia/Taipei","Asia/Dubai","Asia/Kolkata","Europe/London","Europe/Paris","Europe/Berlin","Europe/Amsterdam","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","America/Toronto","America/Sao_Paulo","Australia/Sydney","Pacific/Auckland"],z1="nanobot-webui.settings-preferences",Sv={density:"comfortable",activityMode:"auto",codeWrap:!0,brandLogos:!0},Nv=[{value:"auto",label:"Auto"},{value:"chat_completions",label:"Chat Completions"},{value:"responses",label:"Responses"}],Q3=new Map(["vllm","ollama","lm_studio","atomic_chat","ovms"].map((e,t)=>[e,t])),X3=["1:1","3:4","9:16","4:3","16:9","3:2","2:3","21:9"],J3=["1K","2K","4K","1024x1024","1536x1024","1024x1536"],Dd={runtime:!1,browser:!1,image:!1},jv={name:"",transport:"stdio",command:"",args:"",url:"",env:"",headers:"",toolTimeout:"30"};function Z3(){try{const e=window.localStorage.getItem(z1);if(!e)return Sv;const t=JSON.parse(e);return{density:t.density==="compact"?"compact":"comfortable",activityMode:t.activityMode==="expanded"?"expanded":"auto",codeWrap:t.codeWrap!==!1,brandLogos:t.brandLogos!==!1}}catch{return Sv}}function $1(e){return e.agent.model_preset||"default"}function Oi(e){return e.model_presets.find(t=>t.is_default)??null}function Fi(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:2e5}function zi(e){const t=Oi(e);return(t==null?void 0:t.provider)??e.agent.provider??e.agent.resolved_provider??""}function dm(e,t){return t?e.providers.find(n=>n.name===t)??null:null}function Iu(e,t){const n=dm(e,t);if(n)return n.configured;if(t==="auto"){const r=dm(e,e.agent.resolved_provider??e.agent.provider);if(r)return r.configured}return e.agent.has_api_key}const eD={model:"",provider:"",modelPreset:"default",presetLabel:"Default",contextWindowTokens:2e5,timezone:"UTC",botName:"nanobot",botIcon:"",toolHintMaxLength:40},tD={provider:"duckduckgo",apiKey:"",baseUrl:"",maxResults:5,timeout:30,useJinaReader:!0},nD={enabled:!1,provider:"openrouter",model:"openai/gpt-5.4-image-2",defaultAspectRatio:"1:1",defaultImageSize:"1K",maxImagesPerTurn:4},rD={enabled:!0,provider:"groq",model:"",language:"",maxDurationSec:120,maxUploadMb:25},Lu={enabled:!0,provider:"groq",provider_configured:!1,model:"whisper-large-v3",language:null,max_duration_sec:120,max_upload_mb:25,providers:[]},aD={webuiAllowLocalServiceAccess:!0,webuiDefaultAccessMode:"default"};function Av(e){const t=Oi(e),n=$1(e),r=e.model_presets.find(a=>a.name===n)??t;return{model:(r==null?void 0:r.model)??e.agent.model,provider:r!=null&&r.is_default?zi(e):(r==null?void 0:r.provider)??zi(e),modelPreset:n,presetLabel:(r==null?void 0:r.label)??n,contextWindowTokens:Fi((r==null?void 0:r.context_window_tokens)??e.agent.context_window_tokens),timezone:e.agent.timezone,botName:e.agent.bot_name,botIcon:e.agent.bot_icon,toolHintMaxLength:e.agent.tool_hint_max_length}}function _v(e,t){return{provider:e.web_search.provider,apiKey:(t==null?void 0:t.provider)===e.web_search.provider?t.apiKey??"":"",baseUrl:e.web_search.base_url??"",maxResults:e.web_search.max_results,timeout:e.web_search.timeout,useJinaReader:e.web.fetch.use_jina_reader}}function ci(e){return(e==null?void 0:e.credential)==="api_key"||(e==null?void 0:e.credential)==="optional_api_key"}function U1(e){return(e==null?void 0:e.credential)==="api_key"}function Pv(e){return{enabled:e.image_generation.enabled,provider:e.image_generation.provider,model:e.image_generation.model,defaultAspectRatio:e.image_generation.default_aspect_ratio,defaultImageSize:e.image_generation.default_image_size,maxImagesPerTurn:e.image_generation.max_images_per_turn}}function Tv(e){const t=e.transcription??Lu;return{enabled:t.enabled,provider:t.provider,model:t.model,language:t.language??"",maxDurationSec:t.max_duration_sec,maxUploadMb:t.max_upload_mb}}function Rv(e){return{webuiAllowLocalServiceAccess:e.advanced.webui_allow_local_service_access??e.advanced.allow_local_preview_access??!0,webuiDefaultAccessMode:H1(e.advanced.webui_default_access_mode)}}function oD(e){const t=e.restart_required_sections??[];return{runtime:t.includes("runtime"),browser:t.includes("browser"),image:t.includes("image")}}function sD({theme:e,initialSection:t="overview",initialSettings:n=null,showSidebar:r=!0,onToggleTheme:a,onBackToChat:o,onModelNameChange:i,onSettingsChange:l,skills:c=[],onWorkspaceSettingsChange:d,onSectionChange:p,onLogout:m,onRestart:f,onNativeEngineRestart:h,isRestarting:y=!1,hostChromeInset:x=!1}){const{t:b}=se(),{token:v}=wr(),[g,w]=u.useState(()=>n),[k,C]=u.useState(null),[j,N]=u.useState(null),[P,L]=u.useState(null),[_,T]=u.useState(()=>n===null),[R,D]=u.useState(!0),[K,G]=u.useState(!0),[W,H]=u.useState(!1),[E,F]=u.useState(!1),[X,Q]=u.useState(!1),[re,ue]=u.useState(!1),[pe,ce]=u.useState({label:"",provider:"",model:""}),[z,q]=u.useState(null),[O,te]=u.useState(null),[ie,ve]=u.useState(null),[me,Z]=u.useState(!1),[ke,ye]=u.useState(!1),[be,Ie]=u.useState(!1),[Pe,Le]=u.useState(!1),[Te,J]=u.useState(!1),[ee,V]=u.useState(null),[xe,Se]=u.useState(t),[De,Ve]=u.useState(null),[he,Xe]=u.useState(""),[dt,xt]=u.useState(""),[Ot,qn]=u.useState(""),[Ke,Ft]=u.useState("all"),[He,Re]=u.useState("next"),[kr,or]=u.useState(null),[Qe,Ge]=u.useState(null),[Vn,on]=u.useState(null),[Jt,Dn]=u.useState("all"),[Vt,Je]=u.useState(null),[sn,pt]=u.useState(null),[zt,st]=u.useState(null),[hn,it]=u.useState(null),[$t,Cn]=u.useState(null),[Sn,gn]=u.useState(null),[Nn,Cr]=u.useState({}),[Ut,Sr]=u.useState(jv),[Kr,Bt]=u.useState(""),[Ce,we]=u.useState({}),[_t,Oe]=u.useState({}),[Rt,yt]=u.useState({}),[lt,nt]=u.useState(Dd),[Ze,vn]=u.useState(()=>Z3()),[Kt,ln]=u.useState(()=>n?_v(n):tD),[Mt,Nr]=u.useState(()=>n?Pv(n):nD),[Et,io]=u.useState(()=>n?Tv(n):rD),[jr,lo]=u.useState(()=>n?Rv(n):aD);u.useEffect(()=>{Se(t)},[t]);const Gr=u.useCallback(I=>{Se(I),p==null||p(I)},[p]),[Ns,Kn]=u.useState(!1),[co,sr]=u.useState(!1),[Ue,Yr]=u.useState(()=>n?Av(n):eD),js=u.useCallback((I,Y,ae)=>b(I,{defaultValue:Y,...ae??{}}),[b]),bt=u.useCallback(I=>{w(I),Yr(Av(I)),ln(Y=>_v(I,Y)),Nr(Pv(I)),io(Tv(I)),lo(Rv(I)),I.restart_required_sections&&nt(oD(I)),l==null||l(I)},[l]);u.useEffect(()=>{!n||g!==null||(bt(n),T(!1))},[bt,n,g]),u.useEffect(()=>{let I=!1;const Y=g===null;return Y&&T(!0),li(v).then(ae=>{I||(bt(ae),V(null))}).catch(ae=>{!I&&Y&&V(ae.message)}).finally(()=>{I||T(!1)}),()=>{I=!0}},[bt,v]);const On=g!==null;u.useEffect(()=>{if(xe!=="overview"||!On)return;let I=!1;const Y=()=>{kL(v).then(Ne=>{I||w(mt=>mt&&{...mt,usage:Ne})}).catch(()=>{})};Y();const ae=window.setInterval(Y,5e3),le=()=>Y(),Ae=()=>{document.visibilityState==="visible"&&Y()};return window.addEventListener("focus",le),document.addEventListener("visibilitychange",Ae),()=>{I=!0,window.clearInterval(ae),window.removeEventListener("focus",le),document.removeEventListener("visibilitychange",Ae)}},[xe,On,v]),u.useEffect(()=>{if(xe!=="apps")return;let I=!1,Y=null,ae=0;const le=Ae=>{Ae&&D(!0),NL(v).then(Ne=>{I||(Ne.catalog_refresh_pending&&ae{Y=null,le(!1)},K3)),C(Ne),Ge(null),D(!1))}).catch(Ne=>{I||(Ge(Ne.message),D(!1))})};return le(!0),()=>{I=!0,Y!==null&&window.clearTimeout(Y)}},[xe,v]),u.useEffect(()=>{if(xe!=="apps")return;let I=!1;return G(!0),w1(v).then(Y=>{I||(N(Y),pt(null))}).catch(Y=>{I||pt(Y.message)}).finally(()=>{I||G(!1)}),()=>{I=!0}},[xe,v]);const $=u.useCallback(async(I=!1)=>{I&&H(!0);try{const Y=await fv(v);L(Y),st(null)}catch(Y){st(Y.message)}finally{I&&H(!1)}},[v]);u.useEffect(()=>{if(xe!=="automations")return;let I=!1;const Y=async(Ae=!1)=>{if(!I){Ae&&H(!0);try{const Ne=await fv(v);if(I)return;L(Ne),st(null)}catch(Ne){I||st(Ne.message)}finally{!I&&Ae&&H(!1)}}};Y(!0);const ae=window.setInterval(()=>void Y(!1),5e3),le=()=>{document.visibilityState!=="hidden"&&Y(!1)};return window.addEventListener("focus",le),document.addEventListener("visibilitychange",le),()=>{I=!0,window.clearInterval(ae),window.removeEventListener("focus",le),document.removeEventListener("visibilitychange",le)}},[xe,v]),u.useEffect(()=>{try{window.localStorage.setItem(z1,JSON.stringify(Ze))}catch{}},[Ze]),u.useEffect(()=>{g&&we(I=>{var ae,le,Ae;const Y={...I};for(const Ne of g.providers)Y[Ne.name]={apiKey:((ae=Y[Ne.name])==null?void 0:ae.apiKey)??"",apiBase:((le=Y[Ne.name])==null?void 0:le.apiBase)??Ne.api_base??Ne.default_api_base??"",apiType:((Ae=Y[Ne.name])==null?void 0:Ae.apiType)??Ne.api_type??"auto"};return Y})},[g]);const B=u.useMemo(()=>{if(!g)return!1;const I=$1(g),Y=g.model_presets.find(le=>le.name===Ue.modelPreset);if(!Y)return Ue.modelPreset!==I;const ae=Y.is_default?zi(g):Y.provider;return Ue.modelPreset!==I||Ue.model!==Y.model||Ue.provider!==ae||Ue.contextWindowTokens!==Fi(Y.context_window_tokens)||!Y.is_default&&Ue.presetLabel.trim()!==Y.label},[Ue,g]),S=u.useMemo(()=>g?Ue.timezone!==g.agent.timezone||Ue.botName!==g.agent.bot_name||Ue.botIcon!==g.agent.bot_icon:!1,[Ue,g]),M=u.useMemo(()=>g?Mt.enabled!==g.image_generation.enabled||Mt.provider!==g.image_generation.provider||Mt.model!==g.image_generation.model||Mt.defaultAspectRatio!==g.image_generation.default_aspect_ratio||Mt.defaultImageSize!==g.image_generation.default_image_size||Mt.maxImagesPerTurn!==g.image_generation.max_images_per_turn:!1,[Mt,g]),U=u.useMemo(()=>{if(!g)return!1;const I=g.transcription??Lu;return Et.enabled!==I.enabled||Et.provider!==I.provider||Et.model!==I.model||Et.language!==(I.language??"")||Et.maxDurationSec!==I.max_duration_sec||Et.maxUploadMb!==I.max_upload_mb},[g,Et]),de=u.useMemo(()=>{if(!g)return!1;const I=g.advanced.webui_allow_local_service_access??g.advanced.allow_local_preview_access??!0,Y=H1(g.advanced.webui_default_access_mode);return jr.webuiAllowLocalServiceAccess!==I||jr.webuiDefaultAccessMode!==Y},[jr,g]),Fe=u.useMemo(()=>(g==null?void 0:g.providers.filter(I=>I.configured&&I.model_selectable!==!1).map(I=>({name:I.name,label:I.label})))??[],[g]),et=u.useMemo(()=>!!(g!=null&&g.requires_restart)||lt.runtime||lt.browser||lt.image,[lt,g==null?void 0:g.requires_restart]),St=u.useCallback(async()=>{var Y;if(((g==null?void 0:g.surface)??(g==null?void 0:g.runtime_surface))==="native"&&((Y=g==null?void 0:g.runtime_capabilities)!=null&&Y.can_restart_engine)&&h){J(!0);try{const ae=await h(),le=await li(ae);bt(le),nt(Dd),V(null)}catch(ae){V(ae.message)}finally{J(!1)}return}f==null||f()},[bt,h,f,g]),Pt=u.useCallback(async I=>{const Y=I.surface??I.runtime_surface??(g==null?void 0:g.surface)??(g==null?void 0:g.runtime_surface),ae=I.runtime_capabilities??(g==null?void 0:g.runtime_capabilities),le=Y==="native";if(!(!I.requires_restart||!le||!(ae!=null&&ae.can_restart_engine)||!h)){J(!0);try{const Ae=await h(),Ne=await li(Ae);bt(Ne),nt(Dd),V(null)}catch(Ae){V(Ae.message)}finally{J(!1)}}},[bt,h,g]),jn=async()=>{var I,Y;if(!(!g||!B||E)){F(!0);try{const ae=g.model_presets.find(Ae=>Ae.name===Ue.modelPreset);let le;if(ae&&!ae.is_default)le=await OL(v,{name:ae.name,label:Ue.presetLabel.trim(),model:Ue.model,provider:Ue.provider,...Ue.contextWindowTokens!==ae.context_window_tokens?{contextWindowTokens:Ue.contextWindowTokens}:{}});else{const Ae=((I=Oi(g))==null?void 0:I.model)??g.agent.model,Ne=zi(g),mt=Fi(((Y=Oi(g))==null?void 0:Y.context_window_tokens)??g.agent.context_window_tokens);le=await hv(v,{modelPreset:Ue.modelPreset,...Ue.model!==Ae?{model:Ue.model}:{},...Ue.provider!==Ne?{provider:Ue.provider}:{},...Ue.contextWindowTokens!==mt?{contextWindowTokens:Ue.contextWindowTokens}:{}})}bt(le),i(le.agent.model||null),V(null)}catch(ae){V(ae.message)}finally{F(!1)}}},cl=()=>{var ae,le;if(!g)return;const I=g.agent.provider,Y=((ae=Fe.find(Ae=>Ae.name===I))==null?void 0:ae.name)??((le=Fe[0])==null?void 0:le.name)??"";ce({label:"",provider:Y,model:""}),Q(!0)},As=async()=>{if(re)return;const I=pe.label.trim(),Y=pe.provider.trim(),ae=pe.model.trim();if(!(!I||!Y||!ae)){ue(!0);try{const le=await DL(v,{label:I,provider:Y,model:ae});bt(le),i(le.agent.model||null),Q(!1),V(null)}catch(le){V(le.message)}finally{ue(!1)}}},dS=async()=>{if(!(!g||!S||E)){F(!0);try{const I=await hv(v,{timezone:Ue.timezone,botName:Ue.botName,botIcon:Ue.botIcon});bt(I),I.requires_restart&&nt(Y=>({...Y,runtime:!0})),await(d==null?void 0:d()),await Pt(I),V(null)}catch(I){V(I.message)}finally{F(!1)}}},pS=async()=>{if(!(!g||!M||ke)){ye(!0);try{const I=await HL(v,Mt);bt(I),I.requires_restart&&nt(Y=>({...Y,image:!0})),await Pt(I),V(null)}catch(I){V(I.message)}finally{ye(!1)}}},mS=async()=>{if(!(!g||!U||be)){Ie(!0);try{const I=await WL(v,Et);bt(I),I.requires_restart&&nt(Y=>({...Y,browser:!0})),await Pt(I),V(null)}catch(I){V(I.message)}finally{Ie(!1)}}},fS=async()=>{if(!(!g||!de||Pe)){Le(!0);try{const I=await BL(v,jr);bt(I),I.requires_restart&&nt(Y=>({...Y,runtime:!0})),await Pt(I),V(null)}catch(I){V(I.message)}finally{Le(!1)}}},hS=async I=>{if(ie)return;const Y=g==null?void 0:g.providers.find(Ne=>Ne.name===I);if(!Y||Y.auth_type==="oauth")return;const ae=Ce[I]??{apiKey:"",apiBase:"",apiType:"auto"},le=ae.apiKey.trim(),Ae=Y.api_key_required??!0;if(!Y.configured&&Ae&&!le){V(b("settings.byok.apiKeyRequired"));return}ve(I);try{const Ne=await FL(v,{provider:I,apiKey:le||void 0,apiBase:ae.apiBase.trim(),apiType:ae.apiType});bt(Ne),Ne.requires_restart&&nt(mt=>({...mt,image:!0})),await Pt(Ne),we(mt=>({...mt,[I]:{apiKey:"",apiBase:ae.apiBase.trim(),apiType:ae.apiType}})),Oe(mt=>({...mt,[I]:!1})),yt(mt=>({...mt,[I]:!1})),V(null)}catch(Ne){V(Ne.message)}finally{ve(null)}},Bu=async(I,Y)=>{if(!ie){ve(I);try{const ae=Y==="login"?await zL(v,I):await $L(v,I);bt(ae),Ve(I),V(null)}catch(ae){V(ae.message)}finally{ve(null)}}},gS=async()=>{var Ae,Ne;if(!g||me)return;const I=g.web_search.providers.find(mt=>mt.name===Kt.provider);if(!I)return;const Y=((Ae=Kt.apiKey)==null?void 0:Ae.trim())??"",ae=((Ne=Kt.baseUrl)==null?void 0:Ne.trim())??"",le=ci(I)&&Kt.provider===g.web_search.provider&&!!g.web_search.api_key_hint;if(U1(I)&&!Y&&!le){V(b("settings.byok.webSearch.apiKeyRequired"));return}if(I.credential==="base_url"&&!ae){V(b("settings.byok.webSearch.baseUrlRequired"));return}Z(!0);try{const mt=(Kt.useJinaReader??g.web.fetch.use_jina_reader)!==g.web.fetch.use_jina_reader,Wu={provider:Kt.provider,maxResults:Kt.maxResults,timeout:Kt.timeout,useJinaReader:Kt.useJinaReader};ci(I)&&(Y||I.credential==="optional_api_key"&&co)&&(Wu.apiKey=Y),I.credential==="base_url"&&(Wu.baseUrl=ae);const Qr=await UL(v,Wu);bt(Qr),(Qr.requires_restart||mt)&&nt(qu=>({...qu,browser:!0})),await Pt(Qr),ln(qu=>({provider:Qr.web_search.provider,apiKey:"",baseUrl:Qr.web_search.base_url??qu.baseUrl??"",maxResults:Qr.web_search.max_results,timeout:Qr.web_search.timeout,useJinaReader:Qr.web.fetch.use_jina_reader})),Kn(!1),sr(!1),V(null)}catch(mt){V(mt.message)}finally{Z(!1)}},Hu=u.useCallback(I=>{const Y=g==null?void 0:g.providers.find(ae=>ae.name===I);Y&&(we(ae=>({...ae,[I]:{apiKey:"",apiBase:Y.api_base??Y.default_api_base??"",apiType:Y.api_type??"auto"}})),Oe(ae=>({...ae,[I]:!1})),yt(ae=>({...ae,[I]:!1})))},[g]),vS=u.useCallback(I=>{De&&Hu(De),Ve(De===I?null:I)},[De,Hu]),xS=u.useCallback(()=>{g&&(ln({provider:g.web_search.provider,apiKey:"",baseUrl:g.web_search.base_url??"",maxResults:g.web_search.max_results,timeout:g.web_search.timeout,useJinaReader:g.web.fetch.use_jina_reader}),Kn(!1),sr(!1))},[g]),yS=u.useCallback(I=>{g&&(ln(Y=>({provider:I,apiKey:"",baseUrl:I===g.web_search.provider?g.web_search.base_url??"":"",maxResults:Y.maxResults??g.web_search.max_results,timeout:Y.timeout??g.web_search.timeout,useJinaReader:Y.useJinaReader??g.web.fetch.use_jina_reader})),Kn(!1),sr(!1))},[g]),bS=I=>{const Y=_t[I];Oe(ae=>({...ae,[I]:!Y}))},wS=I=>{yt(Y=>{const ae=!Y[I];return ae||(we(le=>{var Ae,Ne;return{...le,[I]:{apiKey:"",apiBase:((Ae=le[I])==null?void 0:Ae.apiBase)??"",apiType:((Ne=le[I])==null?void 0:Ne.apiType)??"auto"}}}),Oe(le=>({...le,[I]:!1}))),{...Y,[I]:ae}})},kS=async(I,Y)=>{var le;const ae=`${I}:${Y}`;q(ae),or(null),Ge(null);try{const Ae=await AL(v,I,Y);C(Ae),I!=="test"&&R3(Ae),or(((le=Ae.last_action)==null?void 0:le.message)??null),on(I==="uninstall"?null:Y)}catch(Ae){Ge(Ae.message)}finally{q(null)}},ah=async(I,Y)=>{const ae=`${I}:${Y.id}`;it(ae),st(null);try{const le=await vL(v,I,Y.id);L(le),I==="delete"&&Cn(null),I==="run"&&(window.setTimeout(()=>void $(!1),1200),window.setTimeout(()=>void $(!1),4e3))}catch(le){st(le.message)}finally{it(null)}},CS=async(I,Y)=>{const ae=`update:${I.id}`;it(ae),st(null);try{const le=await xL(v,I.id,Y);L(le),gn(null)}catch(le){st(le.message)}finally{it(null)}},SS=async(I,Y,ae={})=>{var Ae;const le=`${I}:${Y}`;te(le),Je(null),pt(null);try{const Ne=await PL(v,I,Y,ae);N(Ne),Je(((Ae=Ne.last_action)==null?void 0:Ae.message)??null),I!=="test"&&Ol(Ne),Ne.requires_restart&&nt(mt=>({...mt,runtime:!0})),await Pt(Ne),I==="enable"&&Cr(mt=>({...mt,[Y]:{}}))}catch(Ne){pt(Ne.message)}finally{te(null)}},NS=async()=>{var ae;const I=Ut.name.trim(),Y=`custom:${I||"new"}`;te(Y),Je(null),pt(null);try{const le=await TL(v,{name:I,transport:Ut.transport,command:Ut.command,args:Ut.args,url:Ut.url,env:Ut.env,headers:Ut.headers,tool_timeout:Ut.toolTimeout});N(le),Je(((ae=le.last_action)==null?void 0:ae.message)??null),Ol(le),le.requires_restart&&nt(Ae=>({...Ae,runtime:!0})),await Pt(le),Sr(Ae=>({...jv,transport:Ae.transport}))}catch(le){pt(le.message)}finally{te(null)}},jS=async()=>{var I;te("import"),Je(null),pt(null);try{const Y=await RL(v,Kr);N(Y),Je(((I=Y.last_action)==null?void 0:I.message)??null),Ol(Y),Y.requires_restart&&nt(ae=>({...ae,runtime:!0})),await Pt(Y),Bt("")}catch(Y){pt(Y.message)}finally{te(null)}},AS=async(I,Y)=>{var ae;te(`tools:${I}`),Je(null),pt(null);try{const le=await ML(v,I,Y);N(le),Je(((ae=le.last_action)==null?void 0:ae.message)??null),Ol(le),le.requires_restart&&nt(Ae=>({...Ae,runtime:!0})),await Pt(le)}catch(le){pt(le.message)}finally{te(null)}},_S=()=>{if(!g)return null;switch(xe){case"overview":return s.jsx(cD,{settings:g,requiresRestart:et,showBrandLogos:Ze.brandLogos,onSelectSection:Gr});case"appearance":return s.jsx(dD,{theme:e,onToggleTheme:a,localPrefs:Ze,onChangeLocalPrefs:vn});case"models":return s.jsxs("div",{className:"space-y-8",children:[s.jsx(mD,{token:v,form:Ue,setForm:Yr,settings:g,dirty:B,saving:E,showBrandLogos:Ze.brandLogos,providerSaving:ie,onProviderOAuthLogin:I=>Bu(I,"login"),onSave:jn,onCreateConfiguration:cl}),s.jsx(fD,{settings:g,expandedProvider:De,providerForms:Ce,visibleProviderKeys:_t,editingProviderKeys:Rt,providerSaving:ie,query:he,showBrandLogos:Ze.brandLogos,onQueryChange:Xe,onToggleProvider:vS,onToggleProviderKey:bS,onToggleProviderKeyEditing:wS,onChangeProviderForm:(I,Y)=>we(ae=>{var le,Ae,Ne;return{...ae,[I]:{apiKey:((le=ae[I])==null?void 0:le.apiKey)??"",apiBase:((Ae=ae[I])==null?void 0:Ae.apiBase)??"",apiType:((Ne=ae[I])==null?void 0:Ne.apiType)??"auto",...Y}}}),onSaveProvider:hS,onProviderOAuthLogin:I=>Bu(I,"login"),onProviderOAuthLogout:I=>Bu(I,"logout"),onResetProviderDraft:Hu,imageProviderRestartPending:lt.image,onRestart:St,isRestarting:y||Te})]});case"image":return s.jsx(hD,{settings:g,form:Mt,dirty:M,saving:ke,onChangeForm:Nr,onSave:pS,onOpenProviders:()=>Gr("models"),showBrandLogos:Ze.brandLogos,onRestart:St,isRestarting:y||Te,requiresRestartPending:lt.image});case"voice":return s.jsx(gD,{settings:g,form:Et,dirty:U,saving:be,onChangeForm:io,onSave:mS,onOpenProviders:()=>Gr("models"),showBrandLogos:Ze.brandLogos,onRestart:St,isRestarting:y||Te,requiresRestartPending:lt.browser});case"browser":return s.jsx(vD,{settings:g,form:Kt,keyVisible:Ns,keyEditing:co,saving:me,onChangeForm:ln,onChangeProvider:yS,onToggleKey:()=>Kn(I=>!I),onToggleKeyEditing:()=>{sr(I=>!I),Kn(!1),ln(I=>({...I,apiKey:""}))},onReset:xS,onSave:gS,showBrandLogos:Ze.brandLogos,onRestart:St,isRestarting:y||Te,requiresRestartPending:lt.browser});case"apps":return s.jsx(WD,{cliApps:k,mcpPresets:j,cliAppsLoading:R,mcpPresetsLoading:K,query:dt,filter:Jt,cliActionKey:z,mcpActionKey:O,cliMessage:kr,cliError:Qe,cliFocusName:Vn,mcpMessage:Vt,mcpError:sn,mcpFieldValues:Nn,customMcpForm:Ut,mcpConfigImport:Kr,showBrandLogos:Ze.brandLogos,requiresRestartPending:lt.runtime,onQueryChange:xt,onFilterChange:Dn,onCliAction:kS,onMcpAction:SS,onDismissStatus:()=>{or(null),Ge(null),Je(null),pt(null)},onBackToChat:o,onMcpFieldChange:(I,Y,ae)=>{Cr(le=>({...le,[I]:{...le[I]??{},[Y]:ae}}))},onCustomMcpFormChange:Sr,onMcpConfigImportChange:Bt,onSaveCustomMcp:NS,onImportMcpConfig:jS,onMcpToolsChange:AS,onRestart:St,isRestarting:y||Te});case"automations":return s.jsx(xD,{payload:P,loading:W,query:Ot,filter:Ke,sort:He,actionKey:hn,error:zt,onQueryChange:qn,onFilterChange:Ft,onSortChange:Re,onAction:ah,onRequestEdit:gn,onRequestDelete:Cn});case"skills":return s.jsx(qL,{skills:c});case"runtime":return s.jsx(JD,{form:Ue,setForm:Yr,settings:g,dirty:S,saving:E,onSave:dS,onRestart:St,isRestarting:y||Te,requiresRestartPending:lt.runtime});case"advanced":return s.jsx(ZD,{form:jr,dirty:de,saving:Pe,isNativeHostSurface:(g.surface??g.runtime_surface)==="native",onChangeForm:lo,onSave:fS,onRestart:St,isRestarting:y||Te,requiresRestartPending:lt.runtime});default:return null}};return s.jsxs("div",{className:A("flex min-h-0 flex-1 flex-col overflow-hidden md:flex-row",r?"bg-[radial-gradient(circle_at_50%_0%,hsl(var(--muted))_0%,hsl(var(--background))_42%)]":"bg-background"),children:[r?s.jsx(lD,{activeSection:xe,onSelectSection:Gr,onBackToChat:o,onLogout:m,hostChromeInset:x}):null,s.jsx(pD,{open:X,draft:pe,providers:Fe,saving:re,showProviderLogos:Ze.brandLogos,onOpenChange:Q,onChangeDraft:ce,onSave:As}),s.jsx(SD,{job:$t,deleting:hn===`delete:${($t==null?void 0:$t.id)??""}`,onOpenChange:I=>{I||Cn(null)},onConfirm:I=>ah("delete",I)}),s.jsx(CD,{job:Sn,saving:hn===`update:${(Sn==null?void 0:Sn.id)??""}`,onOpenChange:I=>{I||gn(null)},onSave:CS}),s.jsx("main",{className:"min-w-0 flex-1 overflow-y-auto [scrollbar-gutter:stable]",children:s.jsxs("div",{className:A("mx-auto w-full max-w-[920px] px-4 py-6 sm:px-8 sm:py-8 lg:py-12",x&&"pt-[4.25rem] sm:pt-[4.25rem] lg:pt-[4.75rem]"),children:[s.jsxs("div",{className:"mb-7",children:[r?null:s.jsxs("button",{type:"button",onClick:o,className:"mb-4 inline-flex items-center gap-1.5 rounded-full px-2.5 py-1.5 text-[12px] font-medium text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground lg:hidden",children:[s.jsx(mf,{className:"h-3.5 w-3.5","aria-hidden":!0}),b("settings.backToChat")]}),r?s.jsx("p",{className:"mb-2 text-[12px] font-normal text-muted-foreground",children:b("settings.sidebar.title")}):null,s.jsx("h1",{className:"text-[24px] font-normal leading-tight tracking-normal text-foreground sm:text-[28px]",children:js(`settings.nav.${xe}`,iD(xe))})]}),_?s.jsxs("div",{className:"flex h-48 items-center justify-center rounded-[24px] border border-border/50 bg-card/75 text-sm text-muted-foreground shadow-[0_20px_70px_rgba(15,23,42,0.07)]",children:[s.jsx(vt,{className:"mr-2 h-4 w-4 animate-spin"}),b("settings.status.loading")]}):ee&&!g?s.jsx(Yt,{children:s.jsx(Ee,{title:b("settings.status.loadError"),children:s.jsx("span",{className:"max-w-[520px] text-sm text-muted-foreground",children:ee})})}):g?s.jsxs("div",{className:"space-y-5",children:[ee?s.jsx("div",{className:"rounded-[18px] border border-destructive/20 bg-destructive/5 px-4 py-3 text-[13px] text-destructive",children:ee}):null,_S()]}):null]})})]})}const B1=[{key:"overview",icon:Gb,fallback:"Overview"},{key:"appearance",icon:l2,fallback:"Appearance"},{key:"models",icon:sw,fallback:"Models"},{key:"image",icon:Vi,fallback:"Image"},{key:"voice",icon:gf,fallback:"Voice"},{key:"browser",icon:ew,fallback:"Web"},{key:"runtime",icon:ns,fallback:"System"},{key:"advanced",icon:f2,fallback:"Security"}];function H1(e){return e==="full"?"full":"default"}function iD(e){var t;return((t=B1.find(n=>n.key===e))==null?void 0:t.fallback)??"Settings"}function lD({activeSection:e,onSelectSection:t,onBackToChat:n,onLogout:r,hostChromeInset:a}){const{t:o}=se();return s.jsxs("aside",{className:A("flex w-full shrink-0 flex-col border-b border-border/55 bg-card/62 px-3 pb-2 shadow-[inset_0_-1px_0_rgba(255,255,255,0.55)] backdrop-blur-xl dark:bg-card/45 dark:shadow-none md:w-[17rem] md:border-b-0 md:border-r md:px-3 md:pb-4 md:shadow-[inset_-1px_0_0_rgba(255,255,255,0.55)]",a?"pt-[4.25rem] md:pt-[4.25rem]":"pt-4 md:pt-4"),children:[s.jsxs("button",{type:"button",onClick:n,className:"mb-2 inline-flex w-fit items-center gap-1.5 rounded-full px-2.5 py-1.5 text-[12px] font-medium text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground md:mb-3",children:[s.jsx(mf,{className:"h-3.5 w-3.5","aria-hidden":!0}),o("settings.backToChat")]}),s.jsx("div",{className:"mb-3 px-1 md:mb-4 md:px-2",children:s.jsx("h2",{className:"text-[18px] font-normal tracking-normal text-foreground",children:o("settings.sidebar.title")})}),s.jsx("nav",{"aria-label":o("settings.sidebar.ariaLabel"),className:"-mx-1 flex gap-2 overflow-x-auto px-1 pb-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden md:mx-0 md:block md:space-y-1 md:overflow-visible md:px-0 md:pb-0",children:B1.map(({key:i,icon:l,fallback:c})=>{const d=i===e;return s.jsxs("button",{type:"button","aria-current":d?"page":void 0,onClick:()=>t(i),className:A("flex h-9 w-auto shrink-0 items-center gap-2 rounded-full px-3 text-left text-[13px] font-medium transition-colors md:w-full md:rounded-[10px] md:px-2.5",d?"bg-muted/90 text-foreground shadow-[inset_0_0_0_1px_rgba(0,0,0,0.025)]":"text-muted-foreground/78 hover:bg-muted/45 hover:text-foreground"),children:[s.jsx(l,{className:"h-4 w-4 shrink-0",strokeWidth:2,"aria-hidden":!0}),s.jsx("span",{className:"truncate",children:o(`settings.nav.${i}`,{defaultValue:c})})]},i)})}),s.jsx("div",{className:"hidden md:mt-auto md:block md:pt-4",children:r&&!a?s.jsxs(fe,{type:"button",variant:"ghost",onClick:r,className:"h-9 w-full justify-start gap-2 rounded-[10px] px-2.5 text-[13px] font-medium text-muted-foreground hover:bg-destructive/8 hover:text-destructive",children:[s.jsx(s2,{className:"h-4 w-4","aria-hidden":!0}),o("app.account.logout")]}):null})]})}function cD({settings:e,requiresRestart:t,onSelectSection:n,showBrandLogos:r}){var T;const{t:a}=se(),o=(R,D)=>a(R,{defaultValue:D}),i=e.agent.model_preset||"default",l=e.agent.resolved_provider??e.agent.provider,c=Iu(e,l),d=Mo(e.providers,l),p=c?e.agent.model:o("settings.values.notConfigured","Not configured"),m=c?`${l} · ${i}`:d||e.agent.model?[d,e.agent.model].filter(Boolean).join(" · "):o("settings.byok.noConfiguredProviders","No configured providers"),f=e.web.enable?o("settings.values.enabled","Enabled"):o("settings.values.disabled","Disabled"),h=e.web_search.providers.find(R=>R.name===e.web_search.provider)??e.web_search.providers[0],y=Mo(e.web_search.providers,e.web_search.provider),x=(h==null?void 0:h.credential)==="none"?o("settings.byok.webSearch.noCredentialRequired","No key required"):(h==null?void 0:h.credential)==="optional_api_key"?e.web_search.api_key_hint?o("settings.values.configured","Configured"):o("settings.byok.webSearch.noCredentialRequired","No key required"):(h==null?void 0:h.credential)==="base_url"?e.web_search.base_url?o("settings.values.configured","Configured"):o("settings.values.notConfigured","Not configured"):e.web_search.api_key_hint?o("settings.values.configured","Configured"):o("settings.values.notConfigured","Not configured"),b=`${y} · ${x}`,v=e.image_generation.enabled?o("settings.values.enabled","Enabled"):o("settings.values.disabled","Disabled"),g=`${Mo(e.image_generation.providers,e.image_generation.provider)} · ${e.image_generation.provider_configured?o("settings.values.configured","Configured"):o("settings.values.notConfigured","Not configured")}`,w=e.transcription??Lu,k=w.enabled?o("settings.values.enabled","Enabled"):o("settings.values.disabled","Disabled"),C=`${Mo(w.providers,w.provider)} · ${w.provider_configured?o("settings.values.configured","Configured"):o("settings.values.notConfigured","Not configured")}`,j=(e.surface??e.runtime_surface)==="native",N=c1(e.runtime.workspace_path),P=j?o("settings.rows.engine","Engine"):o("settings.rows.gateway","Gateway"),L=j?o("settings.values.privateEngine","Private engine"):`${e.runtime.gateway_host}:${e.runtime.gateway_port}`,_=j?o("settings.values.unixSocket","Unix socket"):t?o("settings.values.restartPending","Restart pending"):o("settings.values.ready","Ready");return s.jsxs("div",{className:"space-y-7",children:[s.jsx("section",{children:s.jsx(_3,{usage:e.usage,timeZone:e.agent.timezone})}),s.jsxs("section",{children:[s.jsx(nn,{children:o("settings.sections.ai","AI")}),s.jsx(Yt,{children:s.jsx(vo,{icon:Qb,valueLogoProvider:l,title:o("settings.overview.model","Current model"),value:p,caption:m,showBrandLogos:r,onClick:()=>n("models")})})]}),s.jsxs("section",{children:[s.jsx(nn,{children:o("settings.sections.capabilities","Capabilities")}),s.jsxs(Yt,{children:[s.jsx(vo,{icon:ew,valueLogoProvider:e.web_search.provider,title:o("settings.overview.webSearch","Web search"),value:f,caption:b,showBrandLogos:r,onClick:()=>n("browser")}),s.jsx(vo,{icon:Vi,valueLogoProvider:e.image_generation.provider,title:o("settings.overview.imageGeneration","Image generation"),value:v,caption:g,showBrandLogos:r,onClick:()=>n("image")}),s.jsx(vo,{icon:gf,valueLogoProvider:w.provider,title:o("settings.overview.voiceInput","Voice input"),value:k,caption:C,showBrandLogos:r,onClick:()=>n("voice")})]})]}),s.jsxs("section",{children:[s.jsx(nn,{children:o("settings.sections.system","System")}),s.jsxs(Yt,{children:[s.jsx(vo,{icon:ns,title:P,value:L,caption:_,onClick:()=>n("runtime")}),s.jsx(vo,{icon:n2,title:o("settings.overview.workspace","Workspace"),value:o("settings.values.defaultWorkspace","Default workspace"),caption:N,onClick:()=>n("runtime")})]})]}),s.jsxs("section",{children:[s.jsx(nn,{children:o("settings.sections.about","About")}),s.jsx(Yt,{children:s.jsx(uD,{currentVersion:(T=e.version)==null?void 0:T.current})})]})]})}function uD({currentVersion:e}){const{t}=se(),n=(d,p)=>t(d,{defaultValue:p}),{token:r}=wr(),[a,o]=u.useState(!1),[i,l]=u.useState(null),c=async()=>{o(!0),l(null);try{const d=await CL(r);d.updateAvailable?l({type:"update",latestVersion:d.updateAvailable.latestVersion,pypiUrl:d.updateAvailable.pypiUrl}):l({type:"up-to-date"})}catch(d){l({type:"error",message:d.message})}finally{o(!1)}};return s.jsxs("div",{className:"flex min-h-[62px] flex-col gap-3 px-4 py-3.5 sm:flex-row sm:items-center sm:justify-between sm:px-5",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[14px] font-medium leading-5 text-foreground",children:n("settings.about.version","Version")}),s.jsx("div",{className:"mt-0.5 text-[12px] leading-5 text-muted-foreground",children:e?`v${e}`:"nanobot"})]}),s.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-2",children:[s.jsxs(fe,{size:"sm",variant:"outline",onClick:()=>void c(),disabled:a,className:"rounded-full",children:[a?s.jsx(vt,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):s.jsx(dg,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),a?n("settings.about.checking","Checking..."):n("settings.about.checkForUpdates","Check for updates")]}),(i==null?void 0:i.type)==="up-to-date"?s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[12px] text-emerald-600 dark:text-emerald-300",children:[s.jsx(jt,{className:"h-3 w-3","aria-hidden":!0}),n("settings.about.upToDate","You're up to date")]}):null,(i==null?void 0:i.type)==="update"?s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[12px] text-blue-600 dark:text-blue-300",children:[s.jsx(dg,{className:"h-3 w-3","aria-hidden":!0}),t("settings.about.updateAvailable",{defaultValue:"Update available v{{version}}",version:i.latestVersion}),i.pypiUrl?s.jsxs("a",{href:i.pypiUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-0.5 underline-offset-2 hover:underline",children:["PyPI",s.jsx(nw,{className:"h-2.5 w-2.5","aria-hidden":!0})]}):null]}):null,(i==null?void 0:i.type)==="error"?s.jsx("span",{className:"text-[12px] text-destructive",children:i.message}):null]})]})}function dD({theme:e,onToggleTheme:t,localPrefs:n,onChangeLocalPrefs:r}){const{t:a}=se(),o=(i,l)=>a(i,{defaultValue:l});return s.jsxs("div",{className:"space-y-7",children:[s.jsxs("section",{children:[s.jsx(nn,{children:a("settings.sections.interface")}),s.jsxs(Yt,{children:[s.jsx(Ee,{title:a("settings.rows.theme"),description:a("settings.help.theme"),children:s.jsxs("button",{type:"button",onClick:t,className:"inline-flex h-8 items-center rounded-full bg-muted p-0.5 text-[12px] font-medium text-muted-foreground",children:[s.jsx("span",{className:A("rounded-full px-3 py-1 transition-colors",e==="light"&&"bg-background text-foreground shadow-sm"),children:a("settings.values.light")}),s.jsx("span",{className:A("rounded-full px-3 py-1 transition-colors",e==="dark"&&"bg-background text-foreground shadow-sm"),children:a("settings.values.dark")})]})}),s.jsx(Ee,{title:a("settings.rows.language"),description:a("settings.help.language"),children:s.jsx(lL,{})})]})]}),s.jsxs("section",{children:[s.jsx(nn,{children:o("settings.sections.localPreferences","Local preferences")}),s.jsxs(Yt,{children:[s.jsx(Ee,{title:o("settings.rows.density","Density"),description:o("settings.help.density","Stored only in this browser."),children:s.jsx(Za,{value:n.density,options:[{value:"comfortable",label:o("settings.values.comfortable","Comfortable")},{value:"compact",label:o("settings.values.compact","Compact")}],onChange:i=>r(l=>({...l,density:i}))})}),s.jsx(Ee,{title:o("settings.rows.activityMode","Activity detail"),description:o("settings.help.activityMode","Choose how much agent activity chrome to show by default."),children:s.jsx(Za,{value:n.activityMode,options:[{value:"auto",label:o("settings.values.auto","Auto")},{value:"expanded",label:o("settings.values.expanded","Expanded")}],onChange:i=>r(l=>({...l,activityMode:i}))})}),s.jsx(Ee,{title:o("settings.rows.codeWrap","Code wrapping"),description:o("settings.help.codeWrap","Keep long code lines readable on smaller screens."),children:s.jsx(ls,{checked:n.codeWrap,onChange:i=>r(l=>({...l,codeWrap:i})),ariaLabel:o("settings.rows.codeWrap","Code wrapping"),label:n.codeWrap?o("settings.values.on","On"):o("settings.values.off","Off")})}),s.jsx(Ee,{title:o("settings.rows.brandLogos","Brand logos"),description:o("settings.help.brandLogos","Show third-party provider and CLI logos in Settings."),children:s.jsx(ls,{checked:n.brandLogos,onChange:i=>r(l=>({...l,brandLogos:i})),ariaLabel:o("settings.rows.brandLogos","Brand logos"),label:n.brandLogos?o("settings.values.on","On"):o("settings.values.off","Off")})})]})]})]})}function pD({open:e,draft:t,providers:n,saving:r,showProviderLogos:a,onOpenChange:o,onChangeDraft:i,onSave:l}){const{t:c}=se(),d=(m,f)=>c(m,{defaultValue:f}),p=!!(t.label.trim()&&t.provider.trim()&&t.model.trim());return s.jsx(Xi,{open:e,onOpenChange:o,children:s.jsx(ws,{className:"max-w-[520px] rounded-[28px] border-border/55 bg-card/95 p-0 shadow-[0_28px_90px_rgba(15,23,42,0.20)] backdrop-blur-xl dark:border-white/10",children:s.jsxs("form",{onSubmit:m=>{m.preventDefault(),l()},children:[s.jsxs(Ji,{className:"border-b border-border/45 px-5 py-4 text-left",children:[s.jsx(ks,{className:"text-[18px] font-semibold tracking-[-0.01em]",children:d("settings.models.newConfiguration","New model configuration")}),s.jsx(el,{className:"text-[12.5px] leading-5",children:d("settings.models.newConfigurationHelp","Save a provider and model as a one-click option.")})]}),s.jsxs("div",{className:"space-y-4 px-5 py-5",children:[s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"mb-1.5 block text-[12px] font-medium text-muted-foreground",children:d("settings.models.configurationName","Configuration name")}),s.jsx(qe,{autoFocus:!0,value:t.label,placeholder:d("settings.models.configurationNamePlaceholder","Fast writing"),onChange:m=>i(f=>({...f,label:m.target.value})),className:"h-10 rounded-full px-4 text-[14px]"})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-[1fr_auto] sm:items-end",children:[s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"mb-1.5 block text-[12px] font-medium text-muted-foreground",children:d("settings.rows.model","Model")}),s.jsx(qe,{value:t.model,placeholder:"openai/gpt-4.1",onChange:m=>i(f=>({...f,model:m.target.value})),className:"h-10 rounded-full px-4 text-[14px]"})]}),s.jsxs("div",{className:"block",children:[s.jsx("span",{className:"mb-1.5 block text-[12px] font-medium text-muted-foreground",children:d("settings.rows.provider","Provider")}),s.jsx(Ua,{providers:n,value:t.provider,emptyLabel:d("settings.byok.noConfiguredProviders","No configured providers"),showProviderLogos:a,onChange:m=>i(f=>({...f,provider:m}))})]})]})]}),s.jsxs(Zi,{className:"border-t border-border/45 px-5 py-4 sm:space-x-2",children:[s.jsx(fe,{type:"button",variant:"ghost",className:"rounded-full",disabled:r,onClick:()=>o(!1),children:d("settings.actions.cancel","Cancel")}),s.jsxs(fe,{type:"submit",variant:"outline",className:"rounded-full",disabled:!p||r||n.length===0,children:[r?s.jsx(vt,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,r?d("settings.actions.saving","Saving..."):d("settings.actions.save","Save")]})]})]})})})}function mD({token:e,form:t,setForm:n,settings:r,dirty:a,saving:o,showBrandLogos:i,providerSaving:l,onProviderOAuthLogin:c,onSave:d,onCreateConfiguration:p}){var P;const{t:m}=se(),f=(L,_)=>m(L,{defaultValue:_}),h=r.providers.filter(L=>L.configured),y=((P=Oi(r))==null?void 0:P.provider)==="auto"||t.provider==="auto",x=s4(h),b=y?[{name:"auto",label:f("settings.values.auto","Auto")},...x]:x,v=b.some(L=>L.name===t.provider)?t.provider:"",g=r.model_presets.find(L=>L.name===t.modelPreset)??null,w=r.providers.find(L=>L.name===t.provider),k=(w==null?void 0:w.auth_type)==="oauth"&&!w.configured,C=l===(w==null?void 0:w.name),j=Iu(r,t.provider),N=!t.model.trim()||!t.provider.trim()||!!(g&&!g.is_default&&!t.presetLabel.trim());return s.jsx("div",{className:"space-y-7",children:s.jsx("section",{children:s.jsxs(Yt,{children:[s.jsx(Ee,{title:f("settings.rows.currentModel","Current configuration"),description:f("settings.help.currentModel","Used for new replies."),children:s.jsx(h4,{presets:r.model_presets,value:t.modelPreset,settings:r,draftModel:t.model,draftProvider:t.provider,providerConfigured:j,showProviderLogos:i,onChange:L=>{const _=r.model_presets.find(T=>T.name===L);n(T=>({...T,modelPreset:L,model:(_==null?void 0:_.model)??T.model,provider:_!=null&&_.is_default?zi(r):(_==null?void 0:_.provider)??T.provider,presetLabel:(_==null?void 0:_.label)??L,contextWindowTokens:Fi((_==null?void 0:_.context_window_tokens)??T.contextWindowTokens)}))},onCreateConfiguration:p})}),g&&!g.is_default?s.jsx(Ee,{title:f("settings.models.configurationName","Configuration name"),description:f("settings.models.configurationNameHelp","Rename this saved model configuration."),children:s.jsx(qe,{value:t.presetLabel,onChange:L=>n(_=>({..._,presetLabel:L.target.value})),className:"h-8 w-[min(280px,70vw)] rounded-full text-[13px]"})}):null,s.jsx(Ee,{title:m("settings.rows.provider"),description:m("settings.help.provider"),children:s.jsx(Ua,{providers:b,value:v,emptyLabel:m("settings.byok.noConfiguredProviders"),showProviderLogos:i,onChange:L=>n(_=>({..._,provider:L,model:L===_.provider?_.model:""}))})}),k?s.jsx(Ee,{title:f("settings.oauth.signInRequired","Sign in required"),description:f("settings.oauth.signInBeforeSaving","Sign in before saving this OAuth provider as the active model provider."),children:s.jsxs(fe,{size:"sm",variant:"outline",onClick:()=>w&&c(w.name),disabled:!(w!=null&&w.oauth_login_supported)||C,className:"rounded-full",children:[C?s.jsx(vt,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,C?f("settings.oauth.signingIn","Signing in..."):f("settings.oauth.signIn","Sign in")]})}):null,s.jsx(Ee,{title:m("settings.rows.model"),description:m("settings.help.model"),children:s.jsx(t4,{token:e,settings:r,provider:t.provider,value:t.model,showProviderLogos:i,onChange:L=>n(_=>({..._,model:L}))})}),s.jsx(Ee,{title:f("settings.rows.contextWindow","Context window"),description:f("settings.help.contextWindow","Choose the default context budget for this model configuration."),children:s.jsx(Za,{value:String(t.contextWindowTokens),options:W3.map(L=>({value:String(L),label:L===262144?"256K":L===2e5?"200K":"64K"})),onChange:L=>n(_=>({..._,contextWindowTokens:Fi(Number(L))}))})}),s.jsx(g4,{dirty:a,saving:o,saved:!1,disabled:k||N,message:k?f("settings.oauth.signInBeforeSaving","Sign in before saving this OAuth provider as the active model provider."):void 0,onSave:d})]})})})}function fD({settings:e,expandedProvider:t,providerForms:n,visibleProviderKeys:r,editingProviderKeys:a,providerSaving:o,query:i,showBrandLogos:l,onQueryChange:c,onToggleProvider:d,onToggleProviderKey:p,onToggleProviderKeyEditing:m,onChangeProviderForm:f,onSaveProvider:h,onProviderOAuthLogin:y,onProviderOAuthLogout:x,onResetProviderDraft:b,imageProviderRestartPending:v,onRestart:g,isRestarting:w}){const{t:k}=se(),C=(T,R)=>k(T,{defaultValue:R}),j=e.providers.filter(T=>T.configured),N=u.useMemo(()=>o4(e.providers.filter(T=>!T.configured)),[e.providers]),P=Uv(j,i),L=Uv(N,i),_=T=>{var ue;const R=t===T.name,D=n[T.name]??{apiKey:"",apiBase:T.api_base??T.default_api_base??"",apiType:T.api_type??"auto"},K=o===T.name,G=T.auth_type==="oauth",W=!!r[T.name],H=!T.configured||!!a[T.name],E=T.api_key_required??!0,F=D.apiKey.trim(),X=D.apiBase.trim(),Q=!G&&E&&!T.configured&&!F,re=!G&&!E&&!T.configured&&!F&&!X;return s.jsxs("div",{className:"divide-y divide-border/45",children:[s.jsxs("button",{type:"button",onClick:()=>d(T.name),className:"flex min-h-[70px] w-full items-center justify-between gap-4 px-4 py-3 text-left transition-colors hover:bg-muted/35 sm:px-5",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[s.jsx(p4,{provider:T.name,showBrandLogos:l}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block truncate text-[15px] font-semibold leading-5 text-foreground",children:T.label}),s.jsx("span",{className:"block truncate text-[12px] text-muted-foreground",children:T.api_base||T.default_api_base||T.name})]})]}),s.jsx(Du,{tone:T.configured?"success":"neutral",children:G?T.configured?C("settings.oauth.signedIn","Signed in"):C("settings.oauth.notSignedIn","Not signed in"):T.configured?k("settings.byok.configured"):k("settings.byok.notConfigured")})]}),R?s.jsx("div",{className:"space-y-3 bg-muted/18 px-4 py-4 sm:px-5",children:G?s.jsxs("div",{className:"flex flex-col gap-3 rounded-[18px] border border-border/45 bg-background/75 px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-[13px] font-semibold text-foreground",children:C("settings.oauth.authentication","OAuth authentication")}),s.jsx("p",{className:"mt-1 truncate text-[12px] text-muted-foreground",children:T.configured?k("settings.oauth.signedInAs",{account:T.oauth_account||T.label,defaultValue:"Signed in as {{account}}"}):C("settings.oauth.signInHelp","Sign in from this device; no API key is stored in config.")})]}),s.jsxs("div",{className:"flex shrink-0 justify-end gap-2",children:[T.configured?s.jsx(fe,{size:"sm",variant:"ghost",onClick:()=>x(T.name),disabled:K,className:"rounded-full",children:C("settings.oauth.signOut","Sign out")}):null,s.jsxs(fe,{size:"sm",variant:"outline",onClick:()=>y(T.name),disabled:K||!T.oauth_login_supported,className:"rounded-full",children:[K?s.jsx(vt,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,K?C("settings.oauth.signingIn","Signing in..."):T.configured?C("settings.oauth.signInAgain","Sign in again"):C("settings.oauth.signIn","Sign in")]})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:k("settings.byok.apiKey")}),s.jsx("div",{className:"relative",children:H?s.jsxs(s.Fragment,{children:[s.jsx(qe,{type:W?"text":"password",value:D.apiKey,onChange:pe=>f(T.name,{apiKey:pe.target.value}),placeholder:T.configured?k("settings.byok.apiKeyConfiguredPlaceholder"):k("settings.byok.apiKeyPlaceholder"),className:"h-9 rounded-full pr-11 text-[13px]"}),s.jsx(fe,{type:"button",variant:"ghost",size:"icon",onClick:()=>p(T.name),"aria-label":k(W?"settings.byok.hideApiKey":"settings.byok.showApiKey"),className:"absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full text-muted-foreground hover:bg-muted hover:text-foreground",children:W?s.jsx(rw,{className:"h-3.5 w-3.5","aria-hidden":!0}):s.jsx(aw,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex h-9 items-center rounded-full border border-input bg-background px-3 pr-11 text-[13px] text-muted-foreground",children:T.api_key_hint??k("settings.byok.configuredKeyHint")}),s.jsx(fe,{type:"button",variant:"ghost",size:"icon",onClick:()=>m(T.name),"aria-label":k("settings.actions.edit"),className:"absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full text-muted-foreground hover:bg-muted hover:text-foreground",children:s.jsx(hs,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})})]}),s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:k("settings.byok.apiBase")}),s.jsx(qe,{value:D.apiBase,onChange:pe=>f(T.name,{apiBase:pe.target.value}),placeholder:T.default_api_base??k("settings.byok.apiBasePlaceholder"),className:"h-9 rounded-full text-[13px]"})]}),T.name==="openai"?s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:C("settings.byok.apiType","API type")}),s.jsxs(mn,{children:[s.jsx(fn,{asChild:!0,children:s.jsxs(fe,{type:"button",variant:"outline",className:"h-9 w-full justify-between rounded-full px-3 text-[13px]",children:[s.jsx("span",{children:((ue=Nv.find(pe=>pe.value===D.apiType))==null?void 0:ue.label)??D.apiType}),s.jsx(rr,{className:"h-3.5 w-3.5 text-muted-foreground","aria-hidden":!0})]})}),s.jsx(an,{align:"start",className:"min-w-[220px]",children:Nv.map(pe=>s.jsx(ut,{onSelect:()=>f(T.name,{apiType:pe.value}),children:pe.label},pe.value))})]})]}):null,s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx(fe,{size:"sm",variant:"ghost",onClick:()=>b(T.name),className:"rounded-full",children:k("settings.actions.cancel")}),s.jsx(fe,{size:"sm",variant:"outline",onClick:()=>h(T.name),disabled:K||Q||re,className:"rounded-full",children:K?k("settings.actions.saving"):C("settings.providers.saveProvider","Save provider")})]})]})}):null]},T.name)};return s.jsxs("div",{className:"space-y-6",children:[s.jsx("p",{className:"max-w-[42rem] text-[13px] leading-6 text-muted-foreground",children:k("settings.byok.description")}),v&&g?s.jsxs("div",{className:"flex min-h-[48px] items-center justify-between gap-3 border-y border-border/55 py-3",children:[s.jsx("p",{className:"text-[13px] leading-5 text-muted-foreground",children:C("settings.status.imageProviderRestart","Image provider changes saved. Restart when ready.")}),s.jsx("div",{className:"shrink-0",children:s.jsxs(fe,{size:"sm",variant:"ghost",onClick:g,disabled:w,className:"rounded-full",children:[w?s.jsx(vt,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):s.jsx(Ki,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),k(w?"app.system.restarting":"app.system.restart")]})})]}):null,s.jsxs("div",{className:"relative",children:[s.jsx(It,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground","aria-hidden":!0}),s.jsx(qe,{value:i,onChange:T=>c(T.target.value),placeholder:C("settings.providers.searchPlaceholder","Search providers"),className:"h-10 rounded-full pl-9 text-[13px]"})]}),s.jsx(zv,{title:k("settings.byok.configuredSection"),count:P.length,empty:k("settings.byok.noConfiguredProviders"),children:P.map(_)}),s.jsx(zv,{title:k("settings.byok.notConfiguredSection"),count:L.length,empty:C("settings.providers.noMatches","No providers match this search."),children:L.map(_)}),s.jsx(eC,{})]})}function hD({settings:e,form:t,dirty:n,saving:r,onChangeForm:a,onSave:o,onOpenProviders:i,showBrandLogos:l,onRestart:c,isRestarting:d,requiresRestartPending:p}){const{t:m}=se(),f=(g,w)=>m(g,{defaultValue:w}),h=e.image_generation.providers.find(g=>g.name===t.provider)??e.image_generation.providers[0],y=!!(h!=null&&h.configured),x=t.enabled&&!y,b=Bv(X3.map(g=>({name:g,label:g})),t.defaultAspectRatio),v=Bv(J3.map(g=>({name:g,label:g})),t.defaultImageSize);return s.jsxs("div",{className:"space-y-7",children:[s.jsxs("section",{children:[s.jsx(nn,{children:f("settings.sections.imageGeneration","Image generation")}),s.jsxs(Yt,{children:[s.jsx(Ee,{title:f("settings.rows.imageGeneration","Image generation"),description:f("settings.help.imageGeneration","Expose generate_image in chats when a configured image provider is available."),children:s.jsx(ls,{checked:t.enabled,onChange:g=>a(w=>({...w,enabled:g})),ariaLabel:f("settings.rows.imageGeneration","Image generation"),label:t.enabled?f("settings.values.on","On"):f("settings.values.off","Off")})}),s.jsx(Ee,{title:f("settings.rows.imageProvider","Image provider"),description:f("settings.help.imageProvider","Choose the registry provider used by generate_image."),children:s.jsx(Ua,{providers:e.image_generation.providers,value:t.provider,emptyLabel:f("settings.image.selectProvider","Select provider"),showProviderLogos:l,onChange:g=>a(w=>({...w,provider:g}))})}),s.jsx(Ee,{title:f("settings.rows.imageProviderStatus","Provider status"),description:f("settings.help.imageProviderStatus","Image generation reuses provider credentials from Providers."),children:s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[s.jsx(Du,{tone:y?"success":"neutral",children:y?f("settings.values.configured","Configured"):f("settings.values.notConfigured","Not configured")}),y?null:s.jsx(fe,{size:"sm",variant:"outline",onClick:i,className:"rounded-full",children:f("settings.image.configureProvider","Configure provider")})]})}),s.jsx(Ee,{title:f("settings.rows.imageProviderBase","Provider base"),children:s.jsx("span",{className:"max-w-[320px] truncate text-right text-[13px] text-muted-foreground",children:(h==null?void 0:h.api_base)||(h==null?void 0:h.default_api_base)||(h==null?void 0:h.name)||f("settings.values.notAvailable","Not available")})})]})]}),s.jsxs("section",{children:[s.jsx(nn,{children:f("settings.sections.imageDefaults","Defaults")}),s.jsxs(Yt,{children:[s.jsx(Ee,{title:f("settings.rows.imageModel","Image model"),description:f("settings.help.imageModel","Model name sent to the selected image provider."),children:s.jsx(qe,{value:t.model,onChange:g=>a(w=>({...w,model:g.target.value})),className:"h-8 w-[min(300px,70vw)] rounded-full text-[13px]"})}),s.jsx(Ee,{title:f("settings.rows.defaultAspectRatio","Default aspect"),description:f("settings.help.defaultAspectRatio","Used when the prompt does not choose an aspect ratio."),children:s.jsx(Ua,{providers:b,value:t.defaultAspectRatio,emptyLabel:f("settings.image.selectAspect","Select aspect"),onChange:g=>a(w=>({...w,defaultAspectRatio:g}))})}),s.jsx(Ee,{title:f("settings.rows.defaultImageSize","Default size"),description:f("settings.help.defaultImageSize","Size hint sent to providers that support it."),children:s.jsx(Ua,{providers:v,value:t.defaultImageSize,emptyLabel:f("settings.image.selectSize","Select size"),onChange:g=>a(w=>({...w,defaultImageSize:g}))})}),s.jsx(Ee,{title:f("settings.rows.maxImagesPerTurn","Max images per turn"),description:f("settings.help.maxImagesPerTurn","Upper bound for one generate_image request."),children:s.jsx(Ui,{value:t.maxImagesPerTurn,min:1,max:8,onChange:g=>a(w=>({...w,maxImagesPerTurn:g}))})}),s.jsx(Ks,{title:f("settings.rows.imageSaveDir","Save directory"),value:e.image_generation.save_dir}),s.jsx(il,{dirty:n,saving:r,pendingRestart:p,disabled:x,message:x?f("settings.image.missingCredential","Configure this provider before enabling image generation."):void 0,dirtyMessage:f("settings.status.restartAfterSaving","Save changes, then restart when ready."),pendingMessage:f("settings.status.savedRestartApply","Saved. Restart when ready."),onSave:o,onRestart:c,isRestarting:d})]})]})]})}function gD({settings:e,form:t,dirty:n,saving:r,onChangeForm:a,onSave:o,onOpenProviders:i,showBrandLogos:l,onRestart:c,isRestarting:d,requiresRestartPending:p}){const{t:m}=se(),f=(b,v)=>m(b,{defaultValue:v}),h=e.transcription??Lu,y=h.providers.find(b=>b.name===t.provider)??h.providers[0],x=!!(y!=null&&y.configured);return s.jsxs("section",{children:[s.jsx(nn,{children:f("settings.sections.voiceInput","Voice input")}),s.jsxs(Yt,{children:[s.jsx(Ee,{title:f("settings.rows.transcription","Transcription"),description:f("settings.help.transcription","Transcribe microphone input before sending it. Chat channel voice messages use the same settings."),children:s.jsx(ls,{checked:t.enabled,onChange:b=>a(v=>({...v,enabled:b})),ariaLabel:f("settings.rows.transcription","Transcription"),label:t.enabled?f("settings.values.on","On"):f("settings.values.off","Off")})}),s.jsx(Ee,{title:f("settings.rows.transcriptionProvider","Provider"),description:f("settings.help.transcriptionProvider","Uses the matching provider credentials from Providers."),children:s.jsx(Ua,{providers:h.providers,value:t.provider,emptyLabel:f("settings.voice.selectProvider","Select provider"),showProviderLogos:l,onChange:b=>a(v=>({...v,provider:b}))})}),s.jsx(Ee,{title:f("settings.rows.transcriptionProviderStatus","Provider status"),description:f("settings.help.transcriptionProviderStatus","API keys stay under providers, not in transcription settings."),children:s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[s.jsx(Du,{tone:x?"success":"neutral",children:x?f("settings.values.configured","Configured"):f("settings.values.notConfigured","Not configured")}),x?null:s.jsx(fe,{size:"sm",variant:"outline",onClick:i,className:"rounded-full",children:f("settings.voice.configureProvider","Configure provider")})]})}),s.jsx(Ee,{title:f("settings.rows.transcriptionModel","Model"),description:f("settings.help.transcriptionModel","Leave as the resolved default unless your provider needs a custom model id."),children:s.jsx(qe,{value:t.model,onChange:b=>a(v=>({...v,model:b.target.value})),className:"h-8 w-[min(300px,70vw)] rounded-full text-[13px]"})}),s.jsx(Ee,{title:f("settings.rows.transcriptionLanguage","Language"),description:f("settings.help.transcriptionLanguage","Optional ISO-639 hint such as en, zh, ja, or ko."),children:s.jsx(qe,{value:t.language,onChange:b=>a(v=>({...v,language:b.target.value})),placeholder:f("settings.voice.languageAuto","Auto"),className:"h-8 w-[min(180px,60vw)] rounded-full text-[13px]"})}),s.jsx(Ee,{title:f("settings.rows.voiceLimits","Limits"),children:s.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[s.jsx(Ui,{value:t.maxDurationSec,min:1,max:600,suffix:"s",onChange:b=>a(v=>({...v,maxDurationSec:b}))}),s.jsx(Ui,{value:t.maxUploadMb,min:1,max:100,suffix:"MB",onChange:b=>a(v=>({...v,maxUploadMb:b}))})]})}),s.jsx(il,{dirty:n,saving:r,pendingRestart:p,dirtyMessage:f("settings.status.restartAfterSaving","Save changes, then restart when ready."),pendingMessage:f("settings.status.savedRestartApply","Saved. Restart when ready."),onSave:o,onRestart:c,isRestarting:d})]})]})}function vD({settings:e,form:t,keyVisible:n,keyEditing:r,saving:a,onChangeForm:o,onChangeProvider:i,onToggleKey:l,onToggleKeyEditing:c,onReset:d,onSave:p,showBrandLogos:m,onRestart:f,isRestarting:h,requiresRestartPending:y}){var _,T;const{t:x}=se(),b=(R,D)=>x(R,{defaultValue:D}),v=e.web_search.providers.find(R=>R.name===t.provider)??e.web_search.providers[0],g=ci(v)&&t.provider===e.web_search.provider&&!!e.web_search.api_key_hint,w=ci(v)&&(!g||r),k=((_=t.apiKey)==null?void 0:_.trim())??"",C=((T=t.baseUrl)==null?void 0:T.trim())??"",j=t.useJinaReader??e.web.fetch.use_jina_reader,N=t.provider!==e.web_search.provider||k.length>0||C!==(e.web_search.base_url??"")||t.maxResults!==e.web_search.max_results||t.timeout!==e.web_search.timeout||j!==e.web.fetch.use_jina_reader,P=j!==e.web.fetch.use_jina_reader,L=U1(v)?!k&&!g:(v==null?void 0:v.credential)==="base_url"?!C:!1;return s.jsxs("div",{className:"space-y-7",children:[s.jsxs("section",{children:[s.jsx(nn,{children:b("settings.sections.webSearch","Web search")}),s.jsxs(Yt,{children:[s.jsx(Ee,{title:x("settings.byok.webSearch.provider"),description:x("settings.byok.webSearch.providerHelp"),children:s.jsx(Ua,{providers:e.web_search.providers,value:t.provider,emptyLabel:x("settings.byok.webSearch.selectProvider"),showProviderLogos:m,onChange:i})}),(v==null?void 0:v.credential)==="none"?s.jsx(Ee,{title:x("settings.byok.webSearch.credentials"),description:x("settings.byok.webSearch.noCredentialHelp"),children:s.jsx(Du,{tone:"success",children:x("settings.byok.webSearch.noCredentialRequired")})}):null,ci(v)?s.jsx(Ee,{title:x("settings.byok.apiKey"),description:x("settings.byok.webSearch.apiKeyHelp"),children:s.jsx("div",{className:"relative w-[280px] max-w-full",children:w?s.jsxs(s.Fragment,{children:[s.jsx(qe,{type:n?"text":"password",value:t.apiKey??"",onChange:R=>o(D=>({...D,apiKey:R.target.value})),placeholder:x(g?"settings.byok.apiKeyConfiguredPlaceholder":"settings.byok.apiKeyPlaceholder"),className:"h-9 rounded-full pr-11 text-[13px]"}),s.jsx(fe,{type:"button",variant:"ghost",size:"icon",onClick:l,"aria-label":x(n?"settings.byok.hideApiKey":"settings.byok.showApiKey"),className:"absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full text-muted-foreground hover:bg-muted hover:text-foreground",children:n?s.jsx(rw,{className:"h-3.5 w-3.5","aria-hidden":!0}):s.jsx(aw,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex h-9 items-center rounded-full border border-input bg-background px-3 pr-11 text-[13px] text-muted-foreground",children:e.web_search.api_key_hint??x("settings.byok.configuredKeyHint")}),s.jsx(fe,{type:"button",variant:"ghost",size:"icon",onClick:c,"aria-label":x("settings.actions.edit"),className:"absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full text-muted-foreground hover:bg-muted hover:text-foreground",children:s.jsx(hs,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})})}):null,(v==null?void 0:v.credential)==="base_url"?s.jsx(Ee,{title:x("settings.byok.webSearch.baseUrl"),description:x("settings.byok.webSearch.baseUrlHelp"),children:s.jsx(qe,{value:t.baseUrl??"",onChange:R=>o(D=>({...D,baseUrl:R.target.value})),placeholder:x("settings.byok.webSearch.baseUrlPlaceholder"),className:"h-9 w-[280px] rounded-full text-[13px]"})}):null]})]}),s.jsxs("section",{children:[s.jsx(nn,{children:b("settings.sections.webBehavior","Behavior")}),s.jsxs(Yt,{children:[s.jsx(Ee,{title:b("settings.rows.maxResults","Max results"),description:b("settings.help.maxResults","Results returned by each web_search call."),children:s.jsx(Ui,{value:t.maxResults??e.web_search.max_results,min:1,max:10,onChange:R=>o(D=>({...D,maxResults:R}))})}),s.jsx(Ee,{title:b("settings.rows.timeout","Timeout"),description:b("settings.help.timeout","Seconds before a search provider request times out."),children:s.jsx(Ui,{value:t.timeout??e.web_search.timeout,min:1,max:120,onChange:R=>o(D=>({...D,timeout:R})),suffix:"s"})}),s.jsx(Ee,{title:b("settings.rows.jinaReader","Jina reader"),description:b("settings.help.jinaReader","Use Jina Reader for web_fetch when available."),children:s.jsx(ls,{checked:j,onChange:R=>o(D=>({...D,useJinaReader:R})),ariaLabel:b("settings.rows.jinaReader","Jina reader"),label:j?b("settings.values.on","On"):b("settings.values.off","Off")})}),s.jsx(il,{dirty:N,saving:a,pendingRestart:y,disabled:L,message:L?x("settings.byok.webSearch.missingCredential"):y&&!N?b("settings.status.savedRestartApply","Saved. Restart when ready."):P?b("settings.status.restartAfterSaving","Save changes, then restart when ready."):N?x("settings.byok.webSearch.saveHint"):void 0,onSave:p,onRestart:f,onReset:d,isRestarting:h})]})]})]})}function xD({payload:e,loading:t,query:n,filter:r,sort:a,actionKey:o,error:i,onQueryChange:l,onFilterChange:c,onSortChange:d,onAction:p,onRequestEdit:m,onRequestDelete:f}){const{t:h,i18n:y}=se(),x=(R,D,K)=>h(R,{defaultValue:D}),b=(e==null?void 0:e.jobs)??[],v=y.resolvedLanguage||y.language,[g,w]=u.useState(null),k=u.useMemo(()=>{const R=TD(n);return ND(b,a).filter(D=>OD(D,r)).filter(D=>!R.length||RD(D,R))},[r,b,n,a]),C=b.filter(R=>{const D=Ja(R);return D==="active"||D==="running"}).length,j=b.filter(R=>Ja(R)==="paused").length,N=b.filter(W1).length,P=b.filter(R=>R.protected).length,L=[{value:"all",label:x("settings.automations.filters.all","All"),count:b.length},{value:"active",label:x("settings.automations.filters.active","Active"),count:C},{value:"paused",label:x("settings.automations.filters.paused","Paused"),count:j},{value:"failed",label:x("settings.automations.filters.failed","Needs attention"),count:N},{value:"system",label:x("settings.automations.filters.system","System"),count:P}],_={next:x("settings.automations.sort.next","Next run"),last:x("settings.automations.sort.last","Last run"),updated:x("settings.automations.sort.updated","Updated"),name:x("settings.automations.sort.name","Name")},T=k.find(R=>R.id===g)??k[0]??null;return u.useEffect(()=>{if(!k.length){g!==null&&w(null);return}(!g||!k.some(R=>R.id===g))&&w(k[0].id)},[k,g]),s.jsxs("div",{className:"space-y-5",children:[s.jsx("section",{className:"shrink-0",children:s.jsxs("div",{className:"mx-auto flex w-full max-w-[56rem] flex-col gap-3",children:[s.jsx("div",{className:"-mx-1 overflow-x-auto px-1 pb-0.5",children:s.jsx("div",{className:"grid w-full min-w-[36rem] grid-cols-5 gap-1 rounded-[15px] bg-muted/42 p-1 shadow-[inset_0_0_0_1px_rgba(15,23,42,0.035)] dark:bg-background/30",children:L.map(R=>s.jsxs("button",{type:"button",onClick:()=>c(R.value),className:A("inline-flex h-8 min-w-0 shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-[11px] px-3 text-[12px] font-medium text-muted-foreground transition-colors",r===R.value&&"bg-background text-foreground shadow-[0_8px_20px_rgba(15,23,42,0.07)] dark:bg-background/80",FD(R.value,R.count,r===R.value)),children:[s.jsx("span",{children:R.label}),s.jsx("span",{className:A("min-w-5 shrink-0 rounded-full bg-background/75 px-1.5 py-0.5 text-center text-[11px] tabular-nums text-muted-foreground",zD(R.value,R.count)),children:R.count})]},R.value))})}),s.jsxs("div",{className:"grid min-w-0 gap-2 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[s.jsxs("div",{className:"relative min-w-0",children:[s.jsx(It,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70"}),s.jsx(qe,{value:n,onChange:R=>l(R.target.value),placeholder:x("settings.automations.search","Search task, message, linked chat, or schedule"),className:"h-9 w-full rounded-[13px] border-border/45 bg-background/85 pl-9 text-[13px] shadow-[0_8px_22px_rgba(15,23,42,0.04)] dark:border-white/10 dark:bg-background/40"})]}),s.jsxs(mn,{children:[s.jsx(fn,{asChild:!0,children:s.jsxs("button",{type:"button",className:"inline-flex h-9 min-w-[8.5rem] items-center justify-center gap-1.5 whitespace-nowrap rounded-[13px] border border-border/45 bg-background/85 px-3 text-[12px] font-medium text-muted-foreground shadow-[0_8px_22px_rgba(15,23,42,0.04)] transition-colors hover:bg-muted/70 hover:text-foreground dark:border-white/10 dark:bg-background/40 sm:w-auto",children:[s.jsx(Bj,{className:"h-3.5 w-3.5","aria-hidden":!0}),s.jsx("span",{children:_[a]}),s.jsx(rr,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),s.jsx(an,{align:"end",className:"min-w-40",children:Object.keys(_).map(R=>s.jsxs(ut,{onClick:()=>d(R),children:[s.jsx("span",{children:_[R]}),a===R?s.jsx(jt,{className:"ml-auto h-3.5 w-3.5","aria-hidden":!0}):null]},R))})]})]})]})}),i?s.jsxs("div",{className:"flex items-center gap-2 rounded-[18px] border border-destructive/20 bg-destructive/5 px-4 py-3 text-[13px] text-destructive",children:[s.jsx(ja,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),s.jsx("span",{children:i})]}):null,t&&!e?s.jsxs("div",{className:"flex h-44 items-center justify-center rounded-[24px] border border-border/45 bg-card/80 text-[13px] text-muted-foreground shadow-[0_22px_70px_rgba(15,23,42,0.055)]",children:[s.jsx(vt,{className:"mr-2 h-4 w-4 animate-spin","aria-hidden":!0}),x("settings.automations.loading","Loading automations...")]}):k.length&&T?s.jsxs("section",{className:"grid min-h-0 overflow-hidden rounded-[22px] border border-border/45 bg-transparent shadow-none dark:border-white/10 xl:grid-cols-[minmax(16rem,18rem)_minmax(0,1fr)] xl:items-stretch",children:[s.jsxs("aside",{className:"flex min-h-0 flex-col overflow-hidden border-b border-border/35 bg-background/36 dark:border-white/10 dark:bg-background/18 xl:border-b-0 xl:border-r",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 px-4 py-3",children:[s.jsx("h2",{className:"text-[13px] font-semibold tracking-[-0.01em] text-foreground/85",children:x("settings.automations.queue","Queue")}),s.jsx("span",{className:"rounded-full bg-orange-100/60 px-2 py-0.5 text-[11px] text-orange-800/70 tabular-nums dark:bg-orange-300/10 dark:text-orange-200/75",children:k.length})]}),s.jsx("div",{className:"max-h-[28rem] space-y-1 overflow-y-auto overscroll-contain px-2 pb-2 xl:max-h-[calc(100vh-24rem)]",role:"list","aria-label":x("settings.automations.queue","Queue"),children:k.map(R=>s.jsx(yD,{job:R,locale:v,selected:R.id===T.id,onSelect:()=>w(R.id)},R.id))})]}),s.jsx(bD,{job:T,locale:v,actionKey:o,onAction:p,onRequestEdit:m,onRequestDelete:f})]}):s.jsxs("div",{className:"rounded-[24px] border border-border/45 bg-card/80 px-5 py-12 text-center text-[13px] text-muted-foreground shadow-[0_22px_70px_rgba(15,23,42,0.055)]",children:[s.jsx("div",{children:b.length?x("settings.automations.noMatches","No automations match this view."):x("settings.automations.empty","No automations yet.")}),b.length?null:s.jsx("div",{className:"mx-auto mt-2 max-w-[28rem] text-[12px] leading-5",children:x("settings.automations.emptyHint","Create one from where it should run so nanobot keeps the right context.")})]})]})}function yD({job:e,locale:t,selected:n,onSelect:r}){const{t:a}=se(),o=(d,p,m)=>a(d,{defaultValue:p,...m??{}}),i=Y1(e,o),l=Q1(e,o),c=Xf(e,o);return s.jsx("div",{role:"listitem",children:s.jsxs("button",{type:"button","aria-pressed":n,onClick:r,className:A("group grid w-full grid-cols-[minmax(0,1fr)_auto] gap-3 rounded-[18px] px-3 py-3.5 text-left transition-colors",n?"bg-background text-foreground shadow-[0_10px_28px_rgba(15,23,42,0.055)] ring-1 ring-border/45 dark:bg-background/45 dark:ring-white/10":"text-muted-foreground hover:bg-white/48 hover:text-foreground dark:hover:bg-background/24"),children:[s.jsxs("span",{className:"min-w-0",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx("span",{className:A("h-2 w-2 shrink-0 rounded-full",BD(e)),"aria-hidden":!0}),s.jsx("span",{className:"truncate text-[13.5px] font-medium text-foreground",children:e.name||e.id})]}),s.jsx("span",{className:"mt-1.5 line-clamp-2 text-[12px] leading-5 text-muted-foreground",children:e.payload.message||o("settings.automations.systemTask","System-managed automation")}),s.jsxs("span",{className:"mt-2.5 flex min-w-0 items-center gap-2 text-[11.5px] leading-none text-muted-foreground",children:[s.jsx("span",{className:"truncate",title:X1(e,t,o),children:c}),s.jsx("span",{className:"h-1 w-1 shrink-0 rounded-full bg-muted-foreground/35","aria-hidden":!0}),s.jsx("span",{className:"truncate",children:l})]})]}),s.jsxs("span",{className:"flex shrink-0 flex-col items-end gap-2 pt-0.5",children:[s.jsx("span",{className:"rounded-full bg-white/65 px-2 py-0.5 text-[11px] font-medium text-muted-foreground shadow-[inset_0_0_0_1px_rgba(120,72,25,0.055)] dark:bg-background/35",children:i.label}),e.delete_after_run?s.jsx("span",{className:"rounded-full bg-background/80 px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:o("settings.automations.oneShot","One-time")}):null,s.jsx(xr,{className:A("h-3.5 w-3.5 text-muted-foreground/55 transition-opacity",n?"opacity-100":"opacity-0 group-hover:opacity-70"),"aria-hidden":!0})]})]})})}function bD({job:e,locale:t,actionKey:n,onAction:r,onRequestEdit:a,onRequestDelete:o}){var g;const{t:i}=se(),l=(w,k,C)=>i(w,{defaultValue:k,...C??{}}),c=Y1(e,l),d=Q1(e,l),p=((g=e.origin)==null?void 0:g.channel)==="websocket"&&e.origin.session_key?`#/chat/${encodeURIComponent(e.origin.session_key)}`:null,m=e.created_at_ms?Ur(e.created_at_ms,t):null,f=e.updated_at_ms?Ur(e.updated_at_ms,t):null,h=e.payload.message||l("settings.automations.systemTask","System-managed automation"),y=$D(e,t,l),[x,b]=u.useState(!1),v=kD(h);return u.useEffect(()=>{b(!1)},[e.id]),s.jsxs("article",{className:"flex min-h-0 min-w-0 flex-col overflow-hidden bg-background/42 dark:bg-background/18",children:[s.jsx("div",{className:"shrink-0 border-b border-border/35 px-4 py-3.5 dark:border-white/10 sm:px-5",children:s.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.jsx("h3",{className:"min-w-0 truncate text-[18px] font-medium leading-7 text-foreground",children:e.name||e.id}),s.jsx(Mv,{tone:c.tone,children:c.label}),e.delete_after_run?s.jsx(Mv,{children:l("settings.automations.oneShot","One-time")}):null]}),s.jsxs("p",{className:"mt-1 truncate text-[12.5px] leading-5 text-muted-foreground",children:[y," · ",d]})]}),s.jsx(wD,{job:e,actionKey:n,onAction:r,onRequestEdit:a,onRequestDelete:o})]})}),s.jsxs("div",{className:"grid min-h-0 min-w-0 flex-1 overflow-hidden lg:grid-cols-[minmax(0,1fr)_14.5rem]",children:[s.jsxs("div",{className:"min-h-0 min-w-0 space-y-3 overflow-y-auto overscroll-contain p-4 sm:p-5",children:[s.jsxs("section",{className:"rounded-[20px] border border-border/35 bg-background/62 px-4 py-3.5 shadow-[inset_0_1px_0_rgba(255,255,255,0.58)] dark:border-white/10 dark:bg-background/24",children:[s.jsx("div",{className:"text-[11px] font-medium leading-none text-muted-foreground/75",children:l("settings.automations.fields.message","Message")}),s.jsx("div",{className:A("mt-3 whitespace-pre-wrap break-words text-[13px] leading-6 text-foreground/85",!x&&v&&"line-clamp-6"),children:h}),v?s.jsx("button",{type:"button",className:"mt-3 inline-flex text-[12px] font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",onClick:()=>b(w=>!w),children:x?l("settings.automations.message.showLess","Show less"):l("settings.automations.message.showMore","Show full message")}):null]}),s.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[s.jsx(Od,{label:l("settings.automations.labels.next","Next"),title:X1(e,t,l),children:Xf(e,l)}),s.jsx(Od,{label:l("settings.automations.labels.origin","Linked chat"),title:d,children:p?s.jsxs("a",{className:"inline-flex max-w-full items-center gap-1 text-foreground/80 underline-offset-2 hover:underline",href:p,children:[s.jsx("span",{className:"truncate",children:d}),s.jsx(nw,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):d})]}),e.state.last_error?s.jsx("div",{className:"rounded-[16px] border border-destructive/20 bg-destructive/8 px-3 py-2 text-[12px] leading-5 text-destructive",children:e.state.last_error}):null]}),s.jsx("aside",{className:"min-h-0 overflow-y-auto overscroll-contain border-t border-border/35 bg-muted/20 p-4 text-[12px] text-muted-foreground dark:border-white/10 dark:bg-background/16 lg:border-l lg:border-t-0",children:s.jsxs("div",{className:"grid gap-3",children:[s.jsx(Od,{label:l("settings.automations.labels.schedule","Schedule"),title:y,children:y}),s.jsx("div",{className:"rounded-[18px] bg-background/55 p-3",children:s.jsxs("div",{className:"grid gap-3",children:[m?s.jsxs("div",{children:[s.jsx("div",{className:"text-[11px] leading-none text-muted-foreground/75",children:l("settings.automations.labels.created","Created")}),s.jsx("div",{className:"mt-1.5 text-[12.5px] leading-5 text-foreground/80",children:m})]}):null,f?s.jsxs("div",{children:[s.jsx("div",{className:"text-[11px] leading-none text-muted-foreground/75",children:l("settings.automations.labels.updated","Updated")}),s.jsx("div",{className:"mt-1.5 text-[12.5px] leading-5 text-foreground/80",children:f})]}):null,s.jsxs("div",{children:[s.jsx("div",{className:"text-[11px] leading-none text-muted-foreground/75",children:"ID"}),s.jsx("div",{className:"mt-1.5 break-all font-mono text-[11.5px] leading-5 text-foreground/70",children:e.id})]})]})})]})})]})]})}function wD({job:e,actionKey:t,onAction:n,onRequestEdit:r,onRequestDelete:a}){const{t:o}=se(),i=(h,y,x)=>o(h,{defaultValue:y}),l=!e.protected,c=!!e.origin,d=l&&c&&e.enabled&&!e.state.pending,p=e.enabled?"disable":"enable",m=l&&(e.enabled||c),f=t===`${p}:${e.id}`;return l?s.jsxs("div",{className:"flex shrink-0 items-center gap-1 rounded-full border border-border/35 bg-background/70 p-1 shadow-[0_10px_26px_rgba(15,23,42,0.055)] dark:border-white/10 dark:bg-background/35",children:[s.jsx(Pn,{ariaLabel:i("settings.automations.edit","Edit"),disabled:!!t,onClick:()=>r(e),children:s.jsx(hs,{className:"h-4 w-4","aria-hidden":!0})}),s.jsx(Pn,{ariaLabel:i("settings.automations.runNow","Run now"),busy:t===`run:${e.id}`,disabled:!d,onClick:()=>void n("run",e),children:s.jsx(Tc,{className:"h-4 w-4","aria-hidden":!0})}),s.jsx(Pn,{ariaLabel:e.enabled?i("settings.automations.pause","Pause"):i("settings.automations.resume","Resume"),busy:f,disabled:!m,onClick:()=>void n(p,e),children:e.enabled?s.jsx(Vj,{className:"h-4 w-4","aria-hidden":!0}):s.jsx(Tc,{className:"h-4 w-4","aria-hidden":!0})}),s.jsx(Pn,{ariaLabel:i("settings.automations.delete","Delete"),tone:"danger",disabled:!!t,onClick:()=>a(e),children:s.jsx(zr,{className:"h-4 w-4","aria-hidden":!0})})]}):s.jsx("span",{className:"inline-flex h-9 items-center rounded-full bg-muted px-3 text-[12px] font-medium text-muted-foreground",children:i("settings.automations.protected","Protected")})}function Mv({tone:e="neutral",children:t}){return s.jsx("span",{className:A("inline-flex h-6 items-center rounded-full px-2.5 text-[11.5px] font-medium shadow-[inset_0_0_0_1px_rgba(120,72,25,0.055)]",e==="success"&&"bg-orange-100/72 text-orange-800 dark:bg-orange-300/12 dark:text-orange-200",e==="warning"&&"bg-amber-100/80 text-amber-800 dark:bg-amber-300/14 dark:text-amber-200",e==="neutral"&&"bg-white/64 text-muted-foreground dark:bg-background/35 dark:text-muted-foreground"),children:t})}function kD(e){return e.length>360||e.split(/\r?\n/).length>6}function Od({label:e,title:t,secondary:n,children:r}){return s.jsxs("div",{className:"min-w-0 rounded-[17px] bg-background/52 px-3 py-3 shadow-[inset_0_0_0_1px_rgba(15,23,42,0.035)] dark:bg-background/22",children:[s.jsx("div",{className:"text-[11px] font-medium leading-none text-muted-foreground/75",children:e}),s.jsxs("div",{className:"mt-1.5 min-w-0",children:[s.jsx("div",{className:"line-clamp-2 text-[13px] leading-5 text-foreground/85",title:t,children:r}),n?s.jsx("div",{className:"mt-0.5 truncate text-[11.5px] leading-4 text-muted-foreground",title:t,children:n}):null]})]})}const Qf=[{value:"second",ms:1e3},{value:"minute",ms:6e4},{value:"hour",ms:36e5},{value:"day",ms:864e5}];function CD({job:e,saving:t,onOpenChange:n,onSave:r}){const{t:a}=se(),o=(f,h,y)=>a(f,{defaultValue:h,...y??{}}),[i,l]=u.useState(()=>Ev(null));u.useEffect(()=>{l(Ev(e))},[e]);const c=AD(i,e,o),d=[{value:"every",label:o("settings.automations.scheduleTypes.every","Interval")},{value:"cron",label:o("settings.automations.scheduleTypes.cron","Cron")},{value:"at",label:o("settings.automations.scheduleTypes.at","Once")}],p={second:o("settings.automations.everyUnits.second","Seconds"),minute:o("settings.automations.everyUnits.minute","Minutes"),hour:o("settings.automations.everyUnits.hour","Hours"),day:o("settings.automations.everyUnits.day","Days")},m=f=>{f.preventDefault();const h=_D(i,e);!e||typeof h=="string"||r(e,h)};return s.jsx(Xi,{open:!!e,onOpenChange:n,children:e?s.jsx(ws,{"aria-describedby":void 0,className:"w-[min(calc(100vw-2rem),34rem)] rounded-[26px]",children:s.jsxs("form",{className:"space-y-5",onSubmit:m,children:[s.jsx(Ji,{children:s.jsx(ks,{children:o("settings.automations.editTitle","Edit automation")})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:o("settings.automations.fields.name","Name")}),s.jsx(qe,{value:i.name,onChange:f=>l(h=>({...h,name:f.target.value})),className:"h-10 rounded-[12px]"})]}),s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:o("settings.automations.fields.message","Message")}),s.jsx(Ro,{value:i.message,onChange:f=>l(h=>({...h,message:f.target.value})),className:"min-h-[160px] resize-none rounded-[12px] text-[13px] leading-5"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:o("settings.automations.fields.scheduleType","Schedule type")}),s.jsx(Za,{value:i.scheduleKind,options:d,onChange:f=>l(h=>({...h,scheduleKind:f}))})]}),i.scheduleKind==="every"?s.jsxs("div",{className:"grid gap-2 sm:grid-cols-[minmax(0,1fr)_10rem]",children:[s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:o("settings.automations.fields.every","Every")}),s.jsx(qe,{type:"number",min:1,step:1,value:i.everyValue,onChange:f=>l(h=>({...h,everyValue:f.target.value})),className:"h-10 rounded-[12px]"})]}),s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:o("settings.automations.fields.unit","Unit")}),s.jsx("select",{value:i.everyUnit,onChange:f=>l(h=>({...h,everyUnit:f.target.value})),className:"h-10 w-full rounded-[12px] border border-input bg-background px-3 text-[13px] text-foreground shadow-sm outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",children:Qf.map(f=>s.jsx("option",{value:f.value,children:p[f.value]},f.value))})]})]}):null,i.scheduleKind==="cron"?s.jsxs("div",{className:"grid gap-2 sm:grid-cols-[minmax(0,1fr)_12rem]",children:[s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:o("settings.automations.fields.cronExpression","Cron expression")}),s.jsx(qe,{value:i.cronExpr,onChange:f=>l(h=>({...h,cronExpr:f.target.value})),placeholder:"0 9 * * *",className:"h-10 rounded-[12px] font-mono text-[13px]"})]}),s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:o("settings.automations.fields.timezone","Timezone")}),s.jsx(qe,{value:i.tz,onChange:f=>l(h=>({...h,tz:f.target.value})),placeholder:"Asia/Shanghai",className:"h-10 rounded-[12px] text-[13px]"})]})]}):null,i.scheduleKind==="at"?s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:o("settings.automations.fields.runAt","Run at")}),s.jsx(qe,{type:"datetime-local",value:i.atLocal,onChange:f=>l(h=>({...h,atLocal:f.target.value})),className:"h-10 rounded-[12px]"})]}):null,c?s.jsx("div",{className:"rounded-[12px] bg-destructive/8 px-3 py-2 text-[12px] text-destructive",children:c}):null]}),s.jsxs(Zi,{children:[s.jsx(fe,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:t,className:"rounded-full",children:o("settings.automations.cancel","Cancel")}),s.jsxs(fe,{type:"submit",disabled:!!c||t,className:"rounded-full",children:[t?s.jsx(vt,{className:"mr-2 h-4 w-4 animate-spin","aria-hidden":!0}):null,o("settings.automations.save","Save")]})]})]})}):null})}function SD({job:e,deleting:t,onOpenChange:n,onConfirm:r}){const{t:a}=se(),o=(i,l,c)=>a(i,{defaultValue:l,...c??{}});return s.jsx(Xi,{open:!!e,onOpenChange:n,children:s.jsxs(ws,{className:"w-[min(calc(100vw-2rem),26rem)] rounded-[26px]",children:[s.jsxs(Ji,{children:[s.jsx(ks,{children:o("settings.automations.deleteTitle","Delete automation")}),s.jsx(el,{children:o("settings.automations.deleteDescription","This removes {{name}} from the cron store. Past chat messages stay in the session.",{name:(e==null?void 0:e.name)||(e==null?void 0:e.id)||""})})]}),s.jsxs(Zi,{children:[s.jsx(fe,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:t,className:"rounded-full",children:o("settings.automations.cancel","Cancel")}),s.jsxs(fe,{type:"button",variant:"destructive",onClick:()=>e&&void r(e),disabled:!e||t,className:"rounded-full",children:[t?s.jsx(vt,{className:"mr-2 h-4 w-4 animate-spin","aria-hidden":!0}):null,o("settings.automations.delete","Delete")]})]})]})})}function W1(e){return e.state.last_status==="error"}function Ja(e){return e.protected?"system":e.state.pending?"running":e.enabled?e.state.last_status==="error"?"failed":e.delete_after_run&&!e.state.next_run_at_ms&&e.state.last_status==="ok"?"completed":e.state.next_run_at_ms?"active":"idle":"paused"}function ND(e,t){const n=(r,a)=>(r.name||r.id).localeCompare(a.name||a.id);return[...e].sort((r,a)=>{if(t==="name")return n(r,a);if(t==="last")return(a.state.last_run_at_ms??0)-(r.state.last_run_at_ms??0)||n(r,a);if(t==="updated")return(a.updated_at_ms??0)-(r.updated_at_ms??0)||n(r,a);const o=r.state.next_run_at_ms??Number.MAX_SAFE_INTEGER,i=a.state.next_run_at_ms??Number.MAX_SAFE_INTEGER;return o-i||n(r,a)})}function Ev(e){const t=jD((e==null?void 0:e.schedule.every_ms)??36e5),n=(e==null?void 0:e.schedule.kind)==="at"||(e==null?void 0:e.schedule.kind)==="cron"?e.schedule.kind:"every";return{name:(e==null?void 0:e.name)??"",message:(e==null?void 0:e.payload.message)??"",scheduleKind:n,everyValue:t.value,everyUnit:t.unit,cronExpr:(e==null?void 0:e.schedule.expr)??"0 9 * * *",tz:(e==null?void 0:e.schedule.tz)??"",atLocal:q1((e==null?void 0:e.schedule.at_ms)??Date.now()+36e5)}}function jD(e){for(const t of[...Qf].reverse())if(e>=t.ms&&e%t.ms===0)return{value:String(e/t.ms),unit:t.value};return{value:String(Math.max(1,Math.round(e/6e4))),unit:"minute"}}function q1(e){const t=new Date(e);return Number.isFinite(t.getTime())?new Date(e-t.getTimezoneOffset()*6e4).toISOString().slice(0,16):""}function AD(e,t,n){if(!e.name.trim())return n("settings.automations.validation.nameRequired","Name is required.");if(!e.message.trim())return n("settings.automations.validation.messageRequired","Message is required.");if(e.scheduleKind==="every"){const r=Number(e.everyValue);if(!Number.isInteger(r)||r<=0)return n("settings.automations.validation.intervalRequired","Interval must be a positive number.")}if(e.scheduleKind==="cron"&&!e.cronExpr.trim())return n("settings.automations.validation.cronRequired","Cron expression is required.");if(e.scheduleKind==="at"){const r=new Date(e.atLocal).getTime();if(!Number.isFinite(r))return n("settings.automations.validation.timeRequired","Run time is required.");if(r<=Date.now()&&K1(e,t))return n("settings.automations.validation.futureRequired","Run time must be in the future.")}return null}function _D(e,t){const n=e.name.trim(),r=e.message.trim();if(!n||!r)return"invalid";const a={name:n,message:r},o=V1(e);return typeof o=="string"?o:(K1(e,t,o)&&(a.schedule=o),a)}function V1(e){if(e.scheduleKind==="every"){const t=Qf.find(r=>r.value===e.everyUnit),n=Number(e.everyValue);return!t||!Number.isInteger(n)||n<=0?"invalid":{kind:"every",every_ms:n*t.ms}}else if(e.scheduleKind==="cron"){const t=e.cronExpr.trim();return t?{kind:"cron",expr:t,...e.tz.trim()?{tz:e.tz.trim()}:{}}:"invalid"}else{const t=new Date(e.atLocal).getTime();return Number.isFinite(t)?{kind:"at",at_ms:t}:"invalid"}}function K1(e,t,n=V1(e)){return!t||typeof n=="string"||n.kind!==t.schedule.kind?!0:n.kind==="every"?n.every_ms!==t.schedule.every_ms:n.kind==="cron"?n.expr!==(t.schedule.expr??"")||(n.tz??null)!==(t.schedule.tz??null):e.atLocal!==q1(t.schedule.at_ms??NaN)}const PD=new Set(["id","name","message","chat","cron","schedule","status"]),pm={api:"API",cli:"CLI",dingtalk:"DingTalk",discord:"Discord",email:"Email",feishu:"Feishu",matrix:"Matrix",msteams:"Microsoft Teams",qq:"QQ",slack:"Slack",telegram:"Telegram",wechat:"WeChat",wecom:"WeCom",weixin:"WeChat",whatsapp:"WhatsApp"};function TD(e){return(e.match(/[^\s:]+:"[^"]+"|"[^"]+"|\S+/g)??[]).map(t=>{const n=Iv(t);if(!n)return null;const r=n.match(/^([A-Za-z]+):(.*)$/);if(!r)return{field:null,value:n.toLowerCase()};const a=r[1].toLowerCase(),o=Iv(r[2]).toLowerCase();return o?PD.has(a)?{field:a,value:o}:{field:null,value:n.toLowerCase()}:null}).filter(t=>!!t)}function Iv(e){return e.trim().replace(/^"|"$/g,"").trim()}function RD(e,t){return t.every(n=>MD(e,n.field).includes(n.value))}function MD(e,t=null){return ED(e,t).filter(Boolean).join(" ").toLowerCase()}function ED(e,t){const n=ID(e),r=LD(e);return t==="id"?[e.id]:t==="name"?[e.name,e.id]:t==="message"?[e.payload.message]:t==="chat"?n:t==="cron"||t==="schedule"?r:t==="status"?[Ja(e),e.enabled?"enabled":"disabled"]:[e.id,e.name,e.payload.message,...r,Ja(e),...n]}function ID(e){const t=e.origin;if(!t)return[];const n=t.channel.trim().toLowerCase();return[t.session_key,t.title,t.preview,t.channel,pm[n]]}function LD(e){const t=e.schedule,n=[t.kind,t.expr,t.tz,t.every_ms,t.at_ms];return t.kind==="cron"&&t.expr&&n.push(...DD(t.expr)),n}function DD(e){const t=e.trim().split(/\s+/);if(t.length!==5)return[];const[n,r,a,o,i]=t,l=a==="*"&&o==="*"&&i==="*",c=qc(n,59),d=qc(r,23);if(c===null)return[];const p=String(c).padStart(2,"0");if(d!==null)return[`${String(d).padStart(2,"0")}:${p}`,`:${p}`];if(l&&r==="*")return[`:${p}`,`hourly at :${p}`];const m=/^(\d{1,2})-(\d{1,2})$/.exec(r);if(!l||!m)return[];const f=Number(m[1]),h=Number(m[2]);if(f>23||h>23)return[];const y=`${String(f).padStart(2,"0")}-${String(h).padStart(2,"0")}`,x=`${f}-${h}`;return[y,x,`:${p}`,`${y} at :${p}`,`hourly ${y} at :${p}`]}function OD(e,t){const n=Ja(e);return t==="active"?n==="active"||n==="running":t==="paused"?n==="paused":t==="failed"?W1(e):t==="system"?!!e.protected:!0}const G1={active:{text:"text-emerald-600 dark:text-emerald-400",selectedText:"text-emerald-700 dark:text-emerald-300",count:"bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"},paused:{text:"text-amber-600 dark:text-amber-400",selectedText:"text-amber-700 dark:text-amber-300",count:"bg-amber-500/10 text-amber-700 dark:text-amber-300"},failed:{text:"text-rose-600 dark:text-rose-400",selectedText:"text-rose-700 dark:text-rose-300",count:"bg-rose-500/10 text-rose-700 dark:text-rose-300"},system:{text:"text-sky-600 dark:text-sky-400",selectedText:"text-sky-700 dark:text-sky-300",count:"bg-sky-500/10 text-sky-700 dark:text-sky-300"}};function FD(e,t,n){const r=G1[e];return t<=0||!r?"":n?r.selectedText:r.text}function zD(e,t){const n=G1[e];return t>0&&n?n.count:""}function Y1(e,t){const n=Ja(e);return n==="system"?{label:t("settings.automations.status.system","System"),tone:"neutral"}:n==="running"?{label:t("settings.automations.status.running","Running now"),tone:"warning"}:n==="paused"?{label:t("settings.automations.status.paused","Paused"),tone:"neutral"}:n==="failed"?{label:t("settings.automations.status.failed","Failed"),tone:"warning"}:n==="completed"?{label:t("settings.automations.status.completed","Completed"),tone:"neutral"}:n==="idle"?{label:t("settings.automations.status.noSchedule","No schedule"),tone:"neutral"}:{label:t("settings.automations.status.active","Active"),tone:"success"}}function Q1(e,t){if(e.protected)return t("settings.automations.origin.system","System");const n=e.origin;return n?n.channel!=="websocket"?Lv(n.channel,t):n.title||n.preview||n.session_key||Lv(n.channel,t):t("settings.automations.origin.unknown","No linked chat")}function Lv(e,t){const n=e.trim().toLowerCase();return pm[n]?t(`settings.automations.channels.${n}`,pm[n]):e}function $D(e,t,n){if(e.schedule.kind==="at"&&e.schedule.at_ms)return n("settings.automations.schedule.at","At {{time}}",{time:Ur(e.schedule.at_ms,t)});if(e.schedule.kind==="every"&&e.schedule.every_ms)return n("settings.automations.schedule.every","Every {{duration}}",{duration:HD(e.schedule.every_ms,t)});if(e.schedule.kind==="cron"&&e.schedule.expr){const r=UD(e.schedule.expr,n);return r?e.schedule.tz?n("settings.automations.schedule.withTz","{{summary}} · {{tz}}",{summary:r,tz:e.schedule.tz}):r:e.schedule.tz?n("settings.automations.schedule.cronWithTz","Cron {{expr}} · {{tz}}",{expr:e.schedule.expr,tz:e.schedule.tz}):n("settings.automations.schedule.cron","Cron {{expr}}",{expr:e.schedule.expr})}return n("settings.automations.schedule.custom","Custom schedule")}function UD(e,t){const n=e.trim().split(/\s+/);if(n.length!==5)return null;const[r,a,o,i,l]=n,c=qc(r,59),d=qc(a,23),p=o==="*"&&i==="*"&&l==="*",m=o==="*"&&i==="*"&&["1-5","MON-FRI","mon-fri"].includes(l);if(c!==null&&d!==null){const h=`${String(d).padStart(2,"0")}:${String(c).padStart(2,"0")}`;if(p)return t("settings.automations.schedule.dailyAt","Daily at {{time}}",{time:h});if(m)return t("settings.automations.schedule.weekdaysAt","Weekdays at {{time}}",{time:h})}if(p&&c!==null&&a==="*")return t("settings.automations.schedule.hourlyAt","Hourly at :{{minute}}",{minute:String(c).padStart(2,"0")});const f=/^(\d{1,2})-(\d{1,2})$/.exec(a);if(p&&c!==null&&f){const h=Number(f[1]),y=Number(f[2]);return h>23||y>23?null:t("settings.automations.schedule.hourlyWindow","Hourly {{start}}-{{end}} at :{{minute}}",{start:String(h).padStart(2,"0"),end:String(y).padStart(2,"0"),minute:String(c).padStart(2,"0")})}return null}function qc(e,t){if(!/^\d{1,2}$/.test(e))return null;const n=Number(e);return n<=t?n:null}function Xf(e,t){return e.enabled?e.state.pending?t("settings.automations.next.pending","Running now"):e.state.next_run_at_ms?Af(e.state.next_run_at_ms):t("settings.automations.next.none","No next run"):t("settings.automations.next.paused","Paused")}function X1(e,t,n){return e.state.next_run_at_ms?Ur(e.state.next_run_at_ms,t):Xf(e,n)}function BD(e){const t=Ja(e);return t==="active"||t==="running"?"bg-orange-500 shadow-[0_0_0_3px_rgba(249,115,22,0.12)]":t==="failed"?"bg-amber-500 shadow-[0_0_0_3px_rgba(245,158,11,0.13)]":"bg-muted-foreground/45"}function Dv(e,t,n,r=0){return new Intl.NumberFormat(n,{style:"unit",unit:t,unitDisplay:"long",maximumFractionDigits:r}).format(e)}function HD(e,t){const n=[["day",864e5],["hour",36e5],["minute",6e4],["second",1e3]];for(const[o,i]of n)if(e>=i&&e%i===0)return Dv(e/i,o,t);const r=e<6e4?"second":"minute";return Dv(e/(r==="second"?1e3:6e4),r,t,1)}function WD({cliApps:e,mcpPresets:t,cliAppsLoading:n,mcpPresetsLoading:r,query:a,filter:o,cliActionKey:i,mcpActionKey:l,cliMessage:c,cliError:d,cliFocusName:p,mcpMessage:m,mcpError:f,mcpFieldValues:h,customMcpForm:y,mcpConfigImport:x,showBrandLogos:b,requiresRestartPending:v,onQueryChange:g,onFilterChange:w,onCliAction:k,onMcpAction:C,onDismissStatus:j,onBackToChat:N,onMcpFieldChange:P,onCustomMcpFormChange:L,onMcpConfigImportChange:_,onSaveCustomMcp:T,onImportMcpConfig:R,onMcpToolsChange:D,onRestart:K,isRestarting:G}){const{t:W}=se(),H=(z,q)=>W(z,{defaultValue:q}),E=[{value:"all",label:H("settings.apps.filterAll","All")},{value:"cli",label:H("settings.apps.filterCli","App CLIs")},{value:"mcp",label:H("settings.apps.filterMcp","MCP services")}],F=a.trim().toLowerCase(),X=[...((e==null?void 0:e.apps)??[]).map(z=>({id:`cli:${z.name}`,kind:"cli",app:z})),...((t==null?void 0:t.presets)??[]).map(z=>({id:`mcp:${z.name}`,kind:"mcp",preset:z}))].filter(z=>o==="all"||z.kind===o).filter(z=>!F||KD(z).includes(F)).sort((z,q)=>+!Fv(z)-+!Fv(q)||Ov(z).localeCompare(Ov(q))),Q=p?((e==null?void 0:e.apps)??[]).find(z=>z.name===p&&z.installed):null,re=(n||r)&&!e&&!t,ue=d||f||(Q?null:c||m),pe=!!(d||f),ce=W("settings.apps.caption",{cli:(e==null?void 0:e.installed_count)??0,mcp:(t==null?void 0:t.installed_count)??0,defaultValue:"{{cli}} CLI · {{mcp}} MCP"});return s.jsxs("div",{className:"space-y-7",children:[s.jsxs("section",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between",children:[s.jsx("p",{className:"max-w-[680px] text-[13px] leading-5 text-muted-foreground",children:H("settings.apps.description","Add local app adapters and connected tool servers that nanobot can use from chat.")}),s.jsx("span",{className:"text-[12px] font-medium text-muted-foreground",children:ce})]}),s.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(It,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground","aria-hidden":!0}),s.jsx(qe,{value:a,onChange:z=>g(z.target.value),placeholder:H("settings.apps.searchPlaceholder","Search Apps"),className:"h-12 rounded-[14px] border-border/70 bg-card/90 pl-11 text-[15px] shadow-sm"})]}),s.jsx(Za,{value:o,options:E,onChange:z=>w(z)})]})]}),ue?s.jsxs("div",{className:A("flex items-center justify-between gap-3 rounded-[12px] border py-2.5 pl-4 pr-2 text-[13px]",pe?"border-destructive/20 bg-destructive/5 text-destructive":"border-border/55 bg-muted/35 text-muted-foreground"),children:[s.jsx("span",{className:"min-w-0",children:ue}),s.jsx("button",{type:"button","aria-label":H("settings.actions.dismiss","Dismiss"),title:H("settings.actions.dismiss","Dismiss"),onClick:j,className:A("flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-colors",pe?"text-destructive/70 hover:bg-destructive/10 hover:text-destructive":"text-muted-foreground/70 hover:bg-muted hover:text-foreground"),children:s.jsx(vr,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):null,Q?s.jsx(XD,{app:Q,showBrandLogos:b,onBackToChat:N}):null,v?s.jsxs("div",{className:"flex flex-col gap-3 rounded-[12px] border border-amber-500/20 bg-amber-500/8 px-4 py-3 text-[12.5px] text-amber-800 dark:text-amber-200 sm:flex-row sm:items-center sm:justify-between",children:[s.jsx("span",{children:H("settings.mcp.restartRequired","Restart nanobot to connect updated MCP tools.")}),K?s.jsxs(fe,{type:"button",size:"sm",variant:"outline",onClick:K,disabled:G,className:"h-8 rounded-full bg-background/80 px-3 text-[12px] font-semibold",children:[G?s.jsx(vt,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):s.jsx(Ki,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),W(G?"app.system.restarting":"app.system.restart")]}):null]}):null,s.jsxs("section",{children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border/45 pb-3",children:[s.jsx(nn,{children:H("settings.apps.featured","Featured")}),s.jsx("span",{className:"rounded-full bg-muted px-2.5 py-1 text-[12px] font-medium text-muted-foreground",children:X.length})]}),re?s.jsxs("div",{className:"flex h-36 items-center justify-center text-sm text-muted-foreground",children:[s.jsx(vt,{className:"mr-2 h-4 w-4 animate-spin","aria-hidden":!0}),H("settings.apps.loading","Loading Apps...")]}):X.length?s.jsx("div",{className:"grid gap-x-10 gap-y-1 py-3 md:grid-cols-2",children:X.map(z=>z.kind==="cli"?s.jsx(qD,{app:z.app,actionKey:i,showBrandLogos:b,onAction:k},z.id):s.jsx(VD,{preset:z.preset,values:h[z.preset.name]??{},actionKey:l,showBrandLogos:b,onFieldChange:P,onAction:C,onToolsChange:D},z.id))}):s.jsx("div",{className:"px-3 py-12 text-center text-sm text-muted-foreground",children:H("settings.apps.empty","No apps match this filter.")})]}),o!=="cli"?s.jsx(GD,{form:y,configImport:x,actionKey:l,onFormChange:L,onConfigImportChange:_,onSave:T,onImportConfig:R}):null,s.jsx(eC,{})]})}function qD({app:e,actionKey:t,showBrandLogos:n,onAction:r}){const{t:a}=se(),o=(f,h)=>a(f,{defaultValue:h}),i=t===`install:${e.name}`,l=t===`update:${e.name}`,c=t===`uninstall:${e.name}`,d=t===`test:${e.name}`,p=i||l||c||d,m=e.description||e.requires||e.entry_point||e.name;return s.jsxs("article",{className:"group flex min-w-0 items-center gap-3 rounded-[14px] px-3 py-3 transition-colors hover:bg-muted/45",children:[s.jsx(Z1,{app:e,showBrandLogos:n}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[s.jsx("h3",{className:"truncate text-[14px] font-semibold leading-5 text-foreground",children:e.display_name}),s.jsx(J1,{children:o("settings.apps.cliLabel","CLI")})]}),s.jsx("p",{className:"mt-0.5 truncate text-[12.5px] leading-5 text-muted-foreground",children:m})]}),s.jsx("div",{className:"flex shrink-0 items-center gap-1",children:e.installed?s.jsxs(s.Fragment,{children:[s.jsxs(mn,{children:[s.jsx(fn,{asChild:!0,children:s.jsx(Pn,{ariaLabel:o("settings.cliApps.statusInstalled","CLI installed"),busy:d||l,disabled:p,tone:"installed",children:s.jsx(jt,{className:"h-4 w-4","aria-hidden":!0})})}),s.jsxs(an,{align:"end",children:[s.jsxs(ut,{disabled:p,onClick:()=>r("test",e.name),children:[s.jsx(Tc,{className:"mr-2 h-3.5 w-3.5","aria-hidden":!0}),o("settings.cliApps.test","Test CLI")]}),s.jsxs(ut,{disabled:p,onClick:()=>r("update",e.name),children:[s.jsx(Ki,{className:"mr-2 h-3.5 w-3.5","aria-hidden":!0}),o("settings.cliApps.update","Update CLI")]}),s.jsxs(ut,{disabled:p,onClick:()=>r("uninstall",e.name),children:[s.jsx(zr,{className:"mr-2 h-3.5 w-3.5","aria-hidden":!0}),o("settings.cliApps.uninstall","Uninstall CLI")]})]})]}),s.jsx(Pn,{ariaLabel:o("settings.cliApps.uninstall","Uninstall CLI"),busy:c,disabled:p&&!c,tone:"danger",onClick:()=>r("uninstall",e.name),children:s.jsx(zr,{className:"h-4 w-4","aria-hidden":!0})})]}):e.install_supported?s.jsx(Pn,{ariaLabel:o("settings.cliApps.install","Install CLI"),busy:i,onClick:()=>r("install",e.name),children:s.jsx(Ir,{className:"h-4 w-4","aria-hidden":!0})}):s.jsx(Pn,{ariaLabel:o("settings.cliApps.unavailable","Unavailable"),disabled:!0,children:s.jsx(Ir,{className:"h-4 w-4","aria-hidden":!0})})})]})}function VD({preset:e,values:t,actionKey:n,showBrandLogos:r,onFieldChange:a,onAction:o,onToolsChange:i}){const{t:l}=se(),c=(H,E)=>l(H,{defaultValue:E}),[d,p]=u.useState(!1),[m,f]=u.useState(!1),h=n===`enable:${e.name}`,y=n===`remove:${e.name}`,x=n===`test:${e.name}`,b=n===`tools:${e.name}`,v=h||y||x||b,g=e.required_fields.filter(H=>H.required&&!H.configured),w=e.required_fields.length>0,k=g.length>0,C=e.installed&&e.configured,j=e.install_supported&&(g.length===0||g.every(H=>{var E;return!!((E=t[H.name])!=null&&E.trim())})),N=e.tool_names??[],P=e.enabled_tools??["*"],L=P.includes("*"),_=new Set(L?N:P),T=e.description||e.note||e.requires||e.name,R=YD(e.status,c);u.useEffect(()=>{(e.configured||!e.install_supported)&&p(!1)},[e.configured,e.install_supported]);const D=()=>{if(k||e.installed&&!e.configured&&w){p(!0);return}o("enable",e.name,t)},K=()=>{j&&o("enable",e.name,t)},G=H=>i(e.name,H),W=H=>{const E=new Set(L?N:P);E.has(H)?E.delete(H):E.add(H);const F=Array.from(E);G(F.length===N.length?["*"]:F)};return s.jsxs("article",{className:"rounded-[14px] transition-colors hover:bg-muted/45",children:[s.jsxs("div",{className:"group flex min-w-0 items-center gap-3 px-3 py-3",children:[s.jsx(QD,{preset:e,showBrandLogos:r}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[s.jsx("h3",{className:"truncate text-[14px] font-semibold leading-5 text-foreground",children:e.display_name}),s.jsx(J1,{children:c("settings.apps.mcpLabel","MCP")})]}),s.jsx("p",{className:"mt-0.5 truncate text-[12.5px] leading-5 text-muted-foreground",children:T})]}),s.jsx("div",{className:"flex shrink-0 items-center gap-1",children:C?s.jsxs(s.Fragment,{children:[s.jsxs(mn,{children:[s.jsx(fn,{asChild:!0,children:s.jsx(Pn,{ariaLabel:R,busy:x||b,disabled:v,tone:"installed",children:s.jsx(jt,{className:"h-4 w-4","aria-hidden":!0})})}),s.jsxs(an,{align:"end",children:[s.jsxs(ut,{disabled:v,onClick:()=>o("test",e.name),children:[s.jsx(Tc,{className:"mr-2 h-3.5 w-3.5","aria-hidden":!0}),c("settings.mcp.test","Test")]}),N.length?s.jsxs(ut,{disabled:v,onClick:()=>f(H=>!H),children:[s.jsx(sw,{className:"mr-2 h-3.5 w-3.5","aria-hidden":!0}),c("settings.mcp.toolScope","Tools")]}):null,s.jsxs(ut,{disabled:v,onClick:()=>o("remove",e.name),children:[s.jsx(zr,{className:"mr-2 h-3.5 w-3.5","aria-hidden":!0}),c("settings.mcp.remove","Remove")]})]})]}),s.jsx(Pn,{ariaLabel:c("settings.mcp.remove","Remove"),busy:y,disabled:v&&!y,tone:"danger",onClick:()=>o("remove",e.name),children:s.jsx(zr,{className:"h-4 w-4","aria-hidden":!0})})]}):e.installed&&!e.configured?s.jsx(Pn,{ariaLabel:w?c("settings.mcp.configure","Configure"):c("settings.mcp.enable","Enable"),busy:h,onClick:()=>{w?p(!0):o("enable",e.name,t)},children:s.jsx(Ir,{className:"h-4 w-4","aria-hidden":!0})}):e.install_supported?s.jsx(Pn,{ariaLabel:k?c("settings.mcp.setup","Set up"):c("settings.mcp.enable","Enable"),busy:h,onClick:D,children:s.jsx(Ir,{className:"h-4 w-4","aria-hidden":!0})}):s.jsx(Pn,{ariaLabel:c("settings.mcp.comingSoon","Coming soon"),disabled:!0,children:s.jsx(Ir,{className:"h-4 w-4","aria-hidden":!0})})})]}),d&&e.install_supported&&w?s.jsxs("div",{className:"mx-3 mb-3 rounded-[14px] border border-border/45 bg-card/85 p-3 shadow-sm",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"truncate text-[12.5px] font-semibold text-foreground",children:l("settings.mcp.connectTitle",{name:e.display_name,defaultValue:"Connect {{name}}"})}),s.jsx("p",{className:"mt-0.5 text-[11.5px] text-muted-foreground",children:c("settings.mcp.connectHint","Add the key from your account settings.")})]}),s.jsx(fe,{type:"button",size:"sm",variant:"ghost",disabled:v,onClick:()=>p(!1),className:"h-7 rounded-full px-2.5 text-[11.5px] font-semibold text-muted-foreground",children:c("actions.cancel","Cancel")})]}),s.jsx("div",{className:"mt-3 grid gap-2",children:e.required_fields.map(H=>s.jsxs("label",{className:"min-w-0",children:[s.jsxs("span",{className:"mb-1 block text-[11.5px] font-medium text-muted-foreground",children:[H.label,H.configured?s.jsx("span",{className:"ml-1 font-normal text-emerald-600 dark:text-emerald-300",children:c("settings.mcp.configured","configured")}):null]}),s.jsx(qe,{type:H.secret?"password":"text",value:t[H.name]??"",onChange:E=>a(e.name,H.name,E.target.value),placeholder:H.configured?c("settings.mcp.keepExisting","Leave blank to keep existing"):H.placeholder,className:"h-9 rounded-full bg-background/80 text-[12.5px]"})]},H.name))}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsxs(fe,{type:"button",size:"sm",disabled:v||!j,onClick:K,className:"h-8 rounded-full px-3 text-[12px] font-semibold",children:[h?s.jsx(vt,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):s.jsx(jt,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),e.installed?c("settings.mcp.updateSetup","Update setup"):c("settings.mcp.saveAndEnable","Save and enable")]})})]}):null,m&&C&&N.length?s.jsxs("div",{className:"mx-3 mb-3 rounded-[14px] border border-border/45 bg-card/85 p-3 shadow-sm",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsx("div",{className:"text-[11.5px] font-medium text-muted-foreground",children:c("settings.mcp.toolScope","Tools")}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(fe,{type:"button",size:"sm",variant:L?"default":"outline",disabled:b,onClick:()=>G(["*"]),className:"h-7 rounded-full px-2.5 text-[11.5px] font-semibold",children:c("settings.mcp.allTools","All")}),s.jsx(fe,{type:"button",size:"sm",variant:!L&&_.size===0?"default":"outline",disabled:b,onClick:()=>G([]),className:"h-7 rounded-full px-2.5 text-[11.5px] font-semibold",children:c("settings.mcp.noTools","None")})]})]}),s.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:N.map(H=>{const E=_.has(H);return s.jsx("button",{type:"button",disabled:b,onClick:()=>W(H),className:A("max-w-full rounded-full border px-2.5 py-1 font-mono text-[11px] transition-colors",E?"border-blue-500/25 bg-blue-500/10 text-blue-700 dark:text-blue-300":"border-border/55 bg-muted/30 text-muted-foreground hover:bg-muted/60"),children:s.jsx("span",{className:"block max-w-[220px] truncate",children:H})},H)})})]}):null]})}function J1({children:e}){return s.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-semibold uppercase leading-none tracking-[0.06em] text-muted-foreground",children:e})}const Pn=u.forwardRef(function({ariaLabel:t,busy:n,disabled:r,tone:a="default",onClick:o,children:i},l){return s.jsx(fe,{ref:l,type:"button",size:"icon",variant:"ghost","aria-label":t,title:t,disabled:r||n,onClick:o,className:A("h-9 w-9 rounded-full text-muted-foreground transition-colors",a==="installed"&&"bg-transparent hover:bg-muted/70 hover:text-foreground",a==="danger"&&"bg-transparent hover:bg-destructive/10 hover:text-destructive",a==="default"&&"bg-muted/70 hover:bg-muted hover:text-foreground"),children:n?s.jsx(vt,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):i})});function Ov(e){return e.kind==="cli"?e.app.display_name:e.preset.display_name}function Fv(e){return e.kind==="cli"?e.app.installed:e.preset.installed&&e.preset.configured}function KD(e){if(e.kind==="cli"){const n=e.app;return[n.display_name,n.name,n.category,n.description,n.requires,n.entry_point,n.source].join(" ").toLowerCase()}const t=e.preset;return[t.display_name,t.name,t.category,t.description,t.requires,t.note,t.transport,t.source??""].join(" ").toLowerCase()}function GD({form:e,configImport:t,actionKey:n,onFormChange:r,onConfigImportChange:a,onSave:o,onImportConfig:i}){const{t:l}=se(),c=(w,k)=>l(w,{defaultValue:k}),[d,p]=u.useState(null),[m,f]=u.useState(!1),h=(n==null?void 0:n.startsWith("custom:"))??!1,y=n==="import"||n==="import-cursor",x=e.transport!=="stdio",b=!!e.name.trim()&&(x?!!e.url.trim():!!e.command.trim()),v=(w,k)=>{r(C=>({...C,[w]:k}))},g=[{value:"stdio",label:"stdio"},{value:"streamableHttp",label:"HTTP"},{value:"sse",label:"SSE"}];return s.jsxs("section",{className:"overflow-hidden rounded-[16px] border border-border/45 bg-card/72 shadow-[0_10px_30px_rgba(15,23,42,0.045)]",children:[s.jsxs("div",{className:"flex flex-col gap-3 px-3 py-3 sm:flex-row sm:items-center sm:justify-between",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("span",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-[11px] bg-muted text-muted-foreground",children:s.jsx(ns,{className:"h-4 w-4","aria-hidden":!0})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("h3",{className:"text-[13px] font-semibold leading-5 text-foreground",children:c("settings.mcp.moreOptions","More MCP options")}),s.jsx("p",{className:"truncate text-[12px] text-muted-foreground",children:c("settings.mcp.moreOptionsSubtitle","Add a custom server or import mcp.json.")})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:flex sm:shrink-0",children:[s.jsxs(fe,{type:"button",size:"sm",variant:d==="custom"?"default":"outline",onClick:()=>p(w=>w==="custom"?null:"custom"),className:"h-8 rounded-full px-3 text-[12px] font-semibold",children:[s.jsx(ns,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),c("settings.mcp.customAction","Custom")]}),s.jsxs(fe,{type:"button",size:"sm",variant:d==="import"?"default":"outline",onClick:()=>p(w=>w==="import"?null:"import"),className:"h-8 rounded-full px-3 text-[12px] font-semibold",children:[s.jsx(Rc,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),c("settings.mcp.importAction","Import")]})]})]}),d==="custom"?s.jsxs("div",{className:"border-t border-border/35 bg-muted/18 px-3 py-3",children:[s.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end",children:[s.jsxs("label",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"mb-1.5 block text-[11.5px] font-medium text-muted-foreground",children:c("settings.mcp.serverName","Server name")}),s.jsx(qe,{value:e.name,onChange:w=>v("name",w.target.value),placeholder:"docs",className:"h-9 rounded-full bg-background/80 text-[12.5px]"})]}),s.jsxs("div",{className:"min-w-[228px]",children:[s.jsx("span",{className:"mb-1.5 block text-[11.5px] font-medium text-muted-foreground",children:c("settings.mcp.transport","Transport")}),s.jsx(Za,{value:e.transport,options:g,onChange:w=>v("transport",w)})]}),x?s.jsxs("label",{className:"min-w-0 flex-[1.4]",children:[s.jsx("span",{className:"mb-1.5 block text-[11.5px] font-medium text-muted-foreground",children:c("settings.mcp.serverUrl","URL")}),s.jsx(qe,{value:e.url,onChange:w=>v("url",w.target.value),placeholder:e.transport==="sse"?"https://example.com/sse":"https://example.com/mcp",className:"h-9 rounded-full bg-background/80 text-[12.5px]"})]}):s.jsxs("label",{className:"min-w-0 flex-[1.4]",children:[s.jsx("span",{className:"mb-1.5 block text-[11.5px] font-medium text-muted-foreground",children:c("settings.mcp.command","Command")}),s.jsx(qe,{value:e.command,onChange:w=>v("command",w.target.value),placeholder:"npx",className:"h-9 rounded-full bg-background/80 text-[12.5px]"})]}),s.jsxs(fe,{type:"button",size:"sm",onClick:o,disabled:!b||h,className:"h-9 shrink-0 rounded-full px-4 text-[12.5px] font-semibold",children:[h?s.jsx(vt,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):s.jsx(jt,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),c("settings.mcp.saveCustom","Save MCP")]})]}),s.jsxs(fe,{type:"button",size:"sm",variant:"ghost",onClick:()=>f(w=>!w),className:"mt-2 h-8 rounded-full px-2 text-[12px] font-medium text-muted-foreground hover:text-foreground",children:[s.jsx(rr,{className:A("mr-1.5 h-3.5 w-3.5 transition-transform",m?"rotate-180":""),"aria-hidden":!0}),m?c("settings.mcp.hideAdvanced","Hide advanced"):c("settings.mcp.advancedOptions","Advanced options")]}),m?s.jsxs("div",{className:"mt-2 grid gap-2 lg:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)_180px]",children:[x?s.jsxs("label",{className:"min-w-0",children:[s.jsx("span",{className:"mb-1 block text-[11.5px] font-medium text-muted-foreground",children:c("settings.mcp.headers","Headers JSON")}),s.jsx(Ro,{value:e.headers,onChange:w=>v("headers",w.target.value),placeholder:'{"Authorization":"Bearer ..."}',className:"min-h-[68px] resize-y rounded-[12px] bg-background/80 font-mono text-[12px]"})]}):s.jsxs("label",{className:"min-w-0",children:[s.jsx("span",{className:"mb-1 block text-[11.5px] font-medium text-muted-foreground",children:c("settings.mcp.args","Args JSON")}),s.jsx(Ro,{value:e.args,onChange:w=>v("args",w.target.value),placeholder:'["-y", "docs-mcp"]',className:"min-h-[68px] resize-y rounded-[12px] bg-background/80 font-mono text-[12px]"})]}),s.jsxs("label",{className:"min-w-0",children:[s.jsx("span",{className:"mb-1 block text-[11.5px] font-medium text-muted-foreground",children:c("settings.mcp.env","Env JSON")}),s.jsx(Ro,{value:e.env,onChange:w=>v("env",w.target.value),placeholder:'{"API_KEY":"..."}',className:"min-h-[68px] resize-y rounded-[12px] bg-background/80 font-mono text-[12px]"})]}),s.jsxs("label",{className:"min-w-0",children:[s.jsx("span",{className:"mb-1 block text-[11.5px] font-medium text-muted-foreground",children:c("settings.mcp.timeout","Tool timeout")}),s.jsx(qe,{value:e.toolTimeout,onChange:w=>v("toolTimeout",w.target.value),inputMode:"numeric",className:"h-9 rounded-full bg-background/80 text-[12.5px]"})]})]}):null]}):null,d==="import"?s.jsx("div",{className:"border-t border-border/35 bg-muted/18 px-3 py-3",children:s.jsxs("div",{className:"flex flex-col gap-2 lg:flex-row lg:items-end",children:[s.jsxs("label",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"mb-1.5 block text-[11.5px] font-medium text-muted-foreground",children:c("settings.mcp.configImport","Import mcp.json")}),s.jsx(Ro,{value:t,onChange:w=>a(w.target.value),placeholder:'{"mcpServers":{"docs":{"command":"npx","args":["-y","docs-mcp"]}}}',className:"min-h-[84px] resize-y rounded-[12px] bg-background/80 font-mono text-[12px]"})]}),s.jsxs(fe,{type:"button",size:"sm",onClick:i,disabled:!t.trim()||y,className:"h-9 shrink-0 rounded-full px-4 text-[12.5px] font-semibold",children:[y?s.jsx(vt,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):s.jsx(Rc,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),c("settings.mcp.importConfig","Import")]})]})}):null]})}function YD(e,t){switch(e){case"configured":return t("settings.mcp.statusConfigured","Configured");case"missing_credentials":return t("settings.mcp.statusMissingCredentials","Needs key");case"missing_dependency":return t("settings.mcp.statusMissingDependency","Needs dependency");case"coming_soon":return t("settings.mcp.statusComingSoon","Coming soon");default:return t("settings.mcp.statusNotInstalled","Not enabled")}}function QD({preset:e,showBrandLogos:t}){const[n,r]=u.useState(0),a=e.brand_color||"hsl(var(--muted))",i=u.useMemo(()=>ao(e.logo_url),[e.logo_url])[n],l=e.display_name.split(/\s+/).filter(Boolean).slice(0,2).map(c=>{var d;return(d=c[0])==null?void 0:d.toUpperCase()}).join("")||e.name.slice(0,2).toUpperCase();return u.useEffect(()=>r(0),[e.logo_url]),t&&i?s.jsx("span",{className:"grid h-11 w-11 shrink-0 place-items-center rounded-[8px] border border-border/45 bg-background",style:{boxShadow:`inset 0 0 0 1px ${e.brand_color??"transparent"}22`},children:s.jsx("img",{src:i,alt:"",className:"h-6 w-6 object-contain",onError:()=>r(c=>c+1)})}):s.jsx("span",{className:"grid h-11 w-11 shrink-0 place-items-center rounded-[8px] text-[13px] font-semibold text-white",style:{backgroundColor:a},children:l})}function XD({app:e,showBrandLogos:t,onBackToChat:n}){const{t:r}=se(),[a,o]=u.useState(!1),i=r("settings.cliApps.readyPrompt",{name:e.name,defaultValue:"Use @{{name}} to inspect what this CLI can do."}),l=()=>{navigator.clipboard&&navigator.clipboard.writeText(i).then(()=>{o(!0),window.setTimeout(()=>o(!1),1400)})};return s.jsx("section",{className:A("rounded-[12px] border border-border/55 bg-card/88 px-4 py-3","shadow-[0_8px_26px_rgba(15,23,42,0.055)]"),children:s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[s.jsx(Z1,{app:e,showBrandLogos:t}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.jsx("h3",{className:"truncate text-[14px] font-semibold leading-5 text-foreground",children:e.display_name}),s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-medium text-muted-foreground",children:[s.jsx(jt,{className:"h-3 w-3 text-emerald-600 dark:text-emerald-300","aria-hidden":!0}),r("settings.cliApps.readyStatus",{defaultValue:"Ready"})]})]}),s.jsxs("div",{className:"mt-0.5 flex min-w-0 flex-wrap items-center gap-1.5 text-[12px] text-muted-foreground",children:[s.jsxs("span",{className:"font-mono",children:["@",e.name]}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{className:"truncate font-mono",children:e.entry_point||e.name}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{children:e.category})]})]}),s.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2",children:[s.jsxs(fe,{type:"button",size:"sm",variant:"ghost",onClick:l,className:"h-8 rounded-full px-3 text-[12px] font-medium text-muted-foreground hover:bg-muted/65 hover:text-foreground",children:[a?s.jsx(jt,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}):null,a?r("settings.cliApps.readyCopied",{defaultValue:"Copied"}):r("settings.cliApps.readyTry",{name:e.name,defaultValue:"Try @{{name}}"})]}),s.jsxs(fe,{type:"button",size:"sm",onClick:n,className:"h-8 rounded-full px-3 text-[12px] font-semibold",children:[r("settings.cliApps.openChat",{defaultValue:"Open chat"}),s.jsx(xr,{className:"ml-1.5 h-3.5 w-3.5","aria-hidden":!0})]})]})]})})}function Z1({app:e,showBrandLogos:t}){const[n,r]=u.useState(0),a=e.brand_color||"hsl(var(--muted))",i=u.useMemo(()=>ao(e.logo_url),[e.logo_url])[n],l=e.display_name.split(/\s+/).filter(Boolean).slice(0,2).map(c=>{var d;return(d=c[0])==null?void 0:d.toUpperCase()}).join("")||e.name.slice(0,2).toUpperCase();return u.useEffect(()=>r(0),[e.logo_url]),t&&i?s.jsx("span",{className:"grid h-11 w-11 shrink-0 place-items-center rounded-[8px] border border-border/45 bg-background",style:{boxShadow:`inset 0 0 0 1px ${e.brand_color??"transparent"}22`},children:s.jsx("img",{src:i,alt:"",className:"h-6 w-6 object-contain",onError:()=>r(c=>c+1)})}):s.jsx("span",{className:"grid h-11 w-11 shrink-0 place-items-center rounded-[8px] text-[13px] font-semibold text-white",style:{backgroundColor:a},children:l})}function JD({form:e,setForm:t,settings:n,dirty:r,saving:a,onSave:o,onRestart:i,isRestarting:l,requiresRestartPending:c}){var N,P,L;const{t:d}=se(),p=(_,T)=>d(_,{defaultValue:T}),m=ka()!==null||(n.surface??n.runtime_surface)==="native",f=m?p("app.system.restartEngine","Restart engine"):d("app.system.restart"),h=m?p("app.system.restartingEngine","Restarting engine..."):d("app.system.restarting"),[y,x]=u.useState(null),[b,v]=u.useState(null),[g,w]=u.useState(null),k=ka(),C=l?p("settings.values.restartingEngine","Restarting"):((N=n.apply_state)==null?void 0:N.status)==="pending"?p("settings.values.pending","Pending"):p("settings.values.ready","Ready"),j=async(_,T,R,D)=>{if(!k){v({target:_,message:p("settings.status.hostApiUnavailable","Host actions are only available inside the native app.")});return}w(_),v(null);try{const K=await T();v({target:_,message:R(K)})}catch{v({target:_,message:D})}finally{w(null)}};return s.jsxs("div",{className:"space-y-7",children:[s.jsxs("section",{children:[s.jsx(nn,{children:p("settings.sections.identity","Identity")}),s.jsxs(Yt,{children:[s.jsx(Ee,{title:p("settings.rows.botName","Bot name"),description:p("settings.help.botName","Shown wherever nanobot uses a display name."),children:s.jsx(qe,{value:e.botName,onChange:_=>t(T=>({...T,botName:_.target.value})),className:"h-8 w-[220px] rounded-full text-[13px]"})}),s.jsx(Ee,{title:p("settings.rows.botIcon","Bot icon"),description:p("settings.help.botIcon","Short emoji or text shown with the bot name."),children:s.jsx(qe,{value:e.botIcon,onChange:_=>t(T=>({...T,botIcon:_.target.value})),className:"h-8 w-[120px] rounded-full text-center text-[13px]"})}),s.jsx(Ee,{title:p("settings.rows.timezone","Timezone"),description:p("settings.help.timezone","Used for schedules and time-aware replies."),children:s.jsx(e4,{value:e.timezone,onChange:_=>t(T=>({...T,timezone:_}))})}),s.jsx(il,{dirty:r,saving:a,pendingRestart:c,dirtyMessage:m?p("settings.status.hostRestartAfterSaving","Save changes and nanobot will restart its engine."):p("settings.status.restartAfterSaving","Save changes, then restart when ready."),pendingMessage:m?p("settings.status.hostRestartPending","Saved. Restarting engine when ready."):p("settings.status.savedRestartApply","Saved. Restart when ready."),onSave:o,onRestart:i,isRestarting:l})]})]}),m?s.jsxs("section",{children:[s.jsx(nn,{children:p("settings.sections.nativeHost","Native host")}),s.jsxs(Yt,{children:[s.jsx(Ks,{title:p("settings.rows.engine","Engine"),value:C}),(P=n.runtime_capabilities)!=null&&P.can_open_logs?s.jsx(Ee,{title:p("settings.rows.logs","Logs"),description:(b==null?void 0:b.target)==="logs"?b.message:p("settings.help.logs","Open the native engine log folder."),children:s.jsx(fe,{size:"sm",variant:"outline",onClick:()=>void j("logs",()=>k.openLogs(),()=>p("settings.status.logsOpened","Opened logs folder."),p("settings.status.logsOpenFailed","Could not open logs folder.")),disabled:g!==null,className:"rounded-full",children:g==="logs"?p("settings.actions.opening","Opening..."):p("settings.actions.open","Open")})}):null,(L=n.runtime_capabilities)!=null&&L.can_export_diagnostics?s.jsx(Ee,{title:p("settings.rows.diagnostics","Diagnostics"),description:(b==null?void 0:b.target)==="diagnostics"?b.message:y||p("settings.help.diagnostics","Export a small runtime report for support."),children:s.jsx(fe,{size:"sm",variant:"outline",onClick:()=>void j("diagnostics",async()=>{const _=await k.exportDiagnostics();return x(_),_},_=>d("settings.status.diagnosticsExported",{path:String(_??""),defaultValue:"Diagnostics exported to {{path}}."}),p("settings.status.diagnosticsExportFailed","Could not export diagnostics.")),disabled:g!==null,className:"rounded-full",children:g==="diagnostics"?p("settings.actions.exporting","Exporting..."):p("settings.actions.export","Export")})}):null]})]}):null,s.jsxs("section",{children:[s.jsx(nn,{children:d("settings.sections.system")}),s.jsxs(Yt,{children:[m?null:s.jsx(Ks,{title:p("settings.rows.gateway","Gateway"),value:`${n.runtime.gateway_host}:${n.runtime.gateway_port}`}),s.jsx(Ks,{title:d("settings.rows.configPath"),value:n.runtime.config_path}),s.jsx(Ks,{title:p("settings.rows.workspacePath","Default workspace"),value:n.runtime.workspace_path}),i&&!c?s.jsx(Ee,{title:d("settings.rows.restart"),description:d("app.system.restartHint"),children:s.jsxs(fe,{size:"sm",variant:"outline",onClick:i,disabled:l,className:"rounded-full",children:[l?s.jsx(vt,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):s.jsx(Ki,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),l?h:f]})}):null]})]})]})}function ZD({form:e,dirty:t,saving:n,requiresRestartPending:r,isNativeHostSurface:a,onChangeForm:o,onSave:i,onRestart:l,isRestarting:c}){const{t:d}=se(),p=(m,f)=>d(m,{defaultValue:f});return s.jsxs("div",{className:"space-y-7",children:[s.jsxs("section",{children:[s.jsx(nn,{children:a?p("settings.sections.hostSafety","App safety"):p("settings.sections.webuiSafety","Web safety")}),s.jsxs(Yt,{children:[s.jsx(Ee,{title:p("settings.rows.localServiceAccess","Local Service Access"),description:p(a?"settings.help.localServiceAccessNative":"settings.help.localServiceAccess",a?"Allow Full Access shell commands to reach services on this Mac.":"Allow Full Access shell commands to reach localhost services."),children:s.jsx(ls,{checked:e.webuiAllowLocalServiceAccess,onChange:m=>o(f=>({...f,webuiAllowLocalServiceAccess:m})),ariaLabel:p("settings.rows.localServiceAccess","Local Service Access"),label:e.webuiAllowLocalServiceAccess?p("settings.values.on","On"):p("settings.values.off","Off")})}),s.jsx(Ee,{title:p("settings.rows.webuiDefaultAccess","Default access"),description:p(a?"settings.help.webuiDefaultAccessNative":"settings.help.webuiDefaultAccess",a?"Used by native chats without a project-specific permission.":"Used by web chats without a project-specific permission."),children:s.jsx(Za,{value:e.webuiDefaultAccessMode,options:[{value:"default",label:p("settings.values.defaultPermission","Default Permission")},{value:"full",label:p("settings.values.fullAccess","Full Access")}],onChange:m=>o(f=>({...f,webuiDefaultAccessMode:m}))})}),s.jsx(il,{dirty:t,saving:n,pendingRestart:r,onSave:i,onRestart:l,isRestarting:c})]})]}),s.jsx("p",{className:"max-w-3xl px-1 text-sm leading-6 text-muted-foreground",children:p("settings.help.securityManagedControls","Web fetches always protect local, private, and metadata services. Core channel safety stays in config.json.")})]})}function e4({value:e,onChange:t}){const{t:n}=se(),r=(c,d)=>n(c,{defaultValue:d}),[a,o]=u.useState(""),i=u.useMemo(()=>i4(e),[e]),l=u.useMemo(()=>c4(i,a),[i,a]);return s.jsxs(mn,{onOpenChange:c=>!c&&o(""),children:[s.jsx(fn,{asChild:!0,children:s.jsxs(fe,{type:"button",variant:"outline",className:A("h-8 w-[220px] justify-between rounded-full border-input bg-background px-3 text-[13px] font-normal shadow-none","hover:bg-accent/55 focus-visible:ring-2 focus-visible:ring-ring"),children:[s.jsx("span",{className:"truncate",children:e||r("settings.timezone.select","Select timezone")}),s.jsx(rr,{className:"ml-2 h-3.5 w-3.5 shrink-0 text-muted-foreground","aria-hidden":!0})]})}),s.jsxs(an,{align:"end",className:"w-[340px] max-w-[calc(100vw-2rem)]",children:[s.jsx("div",{className:"sticky top-0 z-10 bg-popover px-1 pb-1",children:s.jsxs("div",{className:"flex h-9 items-center gap-2 rounded-full border border-input bg-background px-3",children:[s.jsx(It,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground","aria-hidden":!0}),s.jsx(qe,{autoFocus:!0,value:a,onChange:c=>o(c.target.value),onKeyDown:c=>c.stopPropagation(),placeholder:r("settings.timezone.search","Search timezone"),className:"h-7 border-0 bg-transparent px-0 text-[13px] shadow-none focus-visible:ring-0"})]})}),s.jsx("div",{className:"mt-1 max-h-[18rem] overflow-y-auto pr-0.5 scrollbar-thin scrollbar-track-transparent","data-testid":"timezone-picker-list",children:l.length?l.map(c=>{const d=c.name===e;return s.jsxs(ut,{onSelect:()=>t(c.name),className:A("flex h-9 cursor-default items-center justify-between gap-3 rounded-[12px] px-2.5 text-[13px]","focus:bg-muted/85 focus:text-foreground",d&&"bg-muted/80 text-foreground focus:bg-muted"),children:[s.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",children:c.name}),s.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-2",children:[s.jsx("span",{className:"text-[11.5px] font-medium text-muted-foreground/80",children:c.offset}),d?s.jsx(jt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null]})]},c.name)}):s.jsx("div",{className:"px-3 py-5 text-center text-[12px] text-muted-foreground",children:r("settings.timezone.empty","No matching timezones.")})})]})]})}function Ua({providers:e,value:t,emptyLabel:n,showProviderLogos:r=!1,onChange:a}){const o=e.find(l=>l.name===t)??null,i=e.length===0;return s.jsxs(mn,{modal:!1,children:[s.jsx(fn,{asChild:!0,disabled:i,children:s.jsxs(fe,{type:"button",variant:"outline",disabled:i,className:A("h-8 w-[210px] justify-between rounded-full border-input bg-background px-3 text-[13px] font-normal shadow-none","hover:bg-accent/55 focus-visible:ring-2 focus-visible:ring-ring",i&&"text-muted-foreground"),children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[o&&r?s.jsx($i,{provider:o.name,showBrandLogos:r}):null,s.jsx("span",{className:"truncate",children:(o==null?void 0:o.label)??n})]}),s.jsx(rr,{className:"ml-2 h-3.5 w-3.5 shrink-0 text-muted-foreground","aria-hidden":!0})]})}),s.jsx(an,{align:"end",className:"max-h-[18rem] w-[240px] overflow-y-auto scrollbar-thin scrollbar-track-transparent",children:e.map(l=>{const c=l.name===t;return s.jsxs(ut,{onSelect:()=>a(l.name),className:A("flex cursor-default items-center justify-between gap-2 rounded-[12px] px-2.5 py-2 text-[13px]","focus:bg-muted/85 focus:text-foreground",c&&"bg-muted/80 text-foreground focus:bg-muted"),children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r?s.jsx($i,{provider:l.name,showBrandLogos:r}):null,s.jsx("span",{className:"truncate",children:l.label})]}),c?s.jsx(jt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null]},l.name)})})]})}function t4({token:e,settings:t,provider:n,value:r,showProviderLogos:a,onChange:o}){const{t:i}=se(),l=(z,q)=>i(z,{defaultValue:q}),[c,d]=u.useState(!1),[p,m]=u.useState(""),[f,h]=u.useState(null),[y,x]=u.useState(!1),[b,v]=u.useState(null),g=n==="auto"?t.agent.resolved_provider??n:n,w=!!(g&&g!=="auto"),k=dm(t,g),C=Iu(t,g),j=w&&!C,N=w&&C&&(k==null?void 0:k.auth_type)==="oauth",P=w&&C&&!N,L=p.trim().toLowerCase(),_=(f==null?void 0:f.models)??[],T=_.filter(z=>L?[z.id,z.label??"",z.owned_by??""].some(q=>q.toLowerCase().includes(L)):!0).slice(0,80),R=(f==null?void 0:f.catalog_kind)==="catalog",D=q3.has(g),K=L.length>=V3,G=P&&(!D||K),W=c&&P&&D&&!K,E=!!((f==null?void 0:f.status)==="available"&&f&&(!R||L)),F=p.trim(),X=!j,Q=_.some(z=>z.id===F),re=(f==null?void 0:f.model_count)??_.length,ue=!r.trim()||!C;u.useEffect(()=>{c&&m(N||!w?r:"")},[c,g,w,N,r]),u.useEffect(()=>{if(!c||!G){h(null),v(null),x(!1);return}let z=!1;return h(null),v(null),x(!0),_L(e,g).then(q=>{z||h(q)}).catch(q=>{z||v(q.message)}).finally(()=>{z||x(!1)}),()=>{z=!0}},[g,c,G,e]);const pe=z=>{o(z),d(!1)},ce=(z,q={})=>s.jsxs(ut,{onSelect:()=>pe(z.id),className:A("flex cursor-default items-center justify-between gap-2 rounded-[12px] px-2 py-1.5 text-[12px]","focus:bg-muted/85 focus:text-foreground",q.selected&&"bg-muted/80 text-foreground focus:bg-muted"),children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[s.jsx($i,{provider:g,showBrandLogos:a,unconfigured:!C}),s.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",children:z.label??z.id})]}),s.jsxs("span",{className:"ml-2 flex shrink-0 items-center gap-2 text-[11px] text-muted-foreground",children:[z.context_window?s.jsx("span",{children:n4(z.context_window)}):null,q.selected?s.jsx(jt,{className:"h-3.5 w-3.5 text-foreground","aria-hidden":!0}):null]})]},z.id);return s.jsxs(mn,{open:c,onOpenChange:d,children:[s.jsx(fn,{asChild:!0,children:s.jsxs(fe,{type:"button",variant:"outline",className:A("h-9 w-[min(360px,70vw)] justify-between rounded-full border-input bg-background px-3 text-[12px] font-normal shadow-none","hover:bg-accent/55 focus-visible:ring-2 focus-visible:ring-ring"),children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[s.jsx($i,{provider:g,showBrandLogos:a,unconfigured:ue}),s.jsx("span",{className:A("min-w-0 truncate font-medium",r?"text-foreground":"text-muted-foreground"),children:r||l("settings.models.selectModel","Select model")})]}),s.jsx(rr,{className:"ml-2 h-3.5 w-3.5 shrink-0 text-muted-foreground","aria-hidden":!0})]})}),s.jsxs(an,{align:"end",className:"w-[360px] max-w-[calc(100vw-2rem)] p-1.5",children:[s.jsx("div",{className:"p-1 pb-1.5",children:s.jsxs("div",{className:"relative",children:[s.jsx(It,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground","aria-hidden":!0}),s.jsx(qe,{value:p,onChange:z=>m(z.target.value),onKeyDown:z=>z.stopPropagation(),placeholder:l("settings.models.searchModels","Search or type model ID"),className:"h-8 rounded-full pl-8 pr-3 text-[12px]"})]})}),j?s.jsx("div",{className:"px-2 py-1.5 text-[11px] leading-4 text-muted-foreground",children:l("settings.models.providerNotConfigured","Configure this provider before loading models.")}):N?s.jsx("div",{className:"px-2 py-1.5 text-[11px] leading-4 text-muted-foreground",children:l("settings.models.unsupportedModelList","Type a model ID manually.")}):P?W?s.jsx("div",{className:"px-2 py-1.5 text-[11px] leading-4 text-muted-foreground",children:l("settings.models.searchCatalog","Search provider catalog to choose a model.")}):y?s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:[s.jsx(vt,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),l("settings.models.loadingModels","Loading models...")]}):b||(f==null?void 0:f.status)==="error"?s.jsx("div",{className:"px-2 py-1.5 text-[11px] leading-4 text-muted-foreground",children:(f==null?void 0:f.message)||b||l("settings.models.loadFailed","Model list unavailable.")}):(f==null?void 0:f.status)==="not_configured"?s.jsx("div",{className:"px-2 py-1.5 text-[11px] leading-4 text-muted-foreground",children:l("settings.models.providerNotConfigured","Configure this provider before loading models.")}):(f==null?void 0:f.status)==="unsupported"||(f==null?void 0:f.status)==="missing_api_base"?s.jsx("div",{className:"px-2 py-1.5 text-[11px] leading-4 text-muted-foreground",children:f.message||l("settings.models.unsupportedModelList","Type a model ID manually.")}):R&&!L?s.jsxs("div",{className:"px-2 py-1.5 text-[11px] leading-4 text-muted-foreground",children:[l("settings.models.searchCatalog","Search provider catalog to choose a model."),re?` ${re} ${l("settings.models.modelsAvailable","available")}.`:""]}):null:s.jsx("div",{className:"px-2 py-1.5 text-[11px] leading-4 text-muted-foreground",children:l("settings.models.autoProviderCustomOnly","Auto provider mode uses custom model IDs.")}),E&&T.length?s.jsx("div",{className:"max-h-[16rem] overflow-y-auto pr-0.5 scrollbar-thin scrollbar-track-transparent",children:T.map(z=>ce(z,{selected:z.id===r}))}):E?s.jsx("div",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:l("settings.models.noModelResults","No matching models.")}):null,X&&F&&!Q&&F!==r?s.jsxs(s.Fragment,{children:[E?s.jsx(Hf,{}):null,s.jsxs(ut,{onSelect:()=>pe(F),className:"flex cursor-default items-center gap-2 rounded-[12px] px-2 py-1.5 text-[12px] focus:bg-muted/85",children:[s.jsx("span",{className:"grid h-5 w-5 shrink-0 place-items-center rounded-md bg-muted/80 text-muted-foreground",children:s.jsx(hs,{className:"h-3 w-3","aria-hidden":!0})}),s.jsxs("span",{className:"min-w-0 truncate",children:[l("settings.models.useCustomModel","Use")," ",s.jsxs("span",{className:"font-medium text-foreground",children:["“",F,"”"]})]})]})]}):null]})]})}function n4(e){if(e>=1e6){const t=e/1e6;return`${Number.isInteger(t)?t.toFixed(0):t.toFixed(1)}M`}if(e>=1e3){const t=e/1e3;return`${Number.isInteger(t)?t.toFixed(0):t.toFixed(1)}K`}return String(e)}function $i({provider:e,showBrandLogos:t,unconfigured:n=!1}){const[r,a]=u.useState(0),o=sl(e),i=tC[e]??hf,l=o==null?void 0:o.logoUrls[r];return u.useEffect(()=>a(0),[e]),n?s.jsx("span",{"data-testid":"provider-picker-unconfigured-icon",className:"grid h-5 w-5 shrink-0 place-items-center text-amber-700 dark:text-amber-200","aria-hidden":!0,children:s.jsx(ja,{className:"h-4 w-4",strokeWidth:1.8})}):t&&l?s.jsx("span",{"data-testid":`provider-picker-logo-${e}`,className:"grid h-5 w-5 shrink-0 place-items-center overflow-hidden rounded-md border border-border/35 bg-background shadow-[inset_0_0_0_1px_rgba(0,0,0,0.02)]",style:{boxShadow:`inset 0 0 0 1px ${o.color}22`},"aria-hidden":!0,children:s.jsx("img",{src:l,alt:"",className:"h-3.5 w-3.5 object-contain",onError:()=>a(c=>c+1)})}):t&&o?s.jsx("span",{"data-testid":`provider-picker-logo-fallback-${e}`,className:"grid h-5 w-5 shrink-0 place-items-center rounded-md text-[7.5px] font-semibold text-white shadow-[inset_0_0_0_1px_rgba(255,255,255,0.18)]",style:{backgroundColor:o.color},"aria-hidden":!0,children:o.initials}):s.jsx("span",{className:"grid h-5 w-5 shrink-0 place-items-center rounded-md bg-muted text-muted-foreground","aria-hidden":!0,children:s.jsx(i,{className:"h-3 w-3",strokeWidth:2})})}function zv({title:e,count:t,empty:n,children:r}){return s.jsxs("section",{className:"space-y-3",children:[s.jsx(r4,{title:e,count:t}),s.jsx("div",{className:"overflow-hidden rounded-[22px] border border-border/45 bg-card/86 shadow-[0_18px_65px_rgba(15,23,42,0.07)] backdrop-blur-xl dark:border-white/10 dark:shadow-[0_18px_65px_rgba(0,0,0,0.22)]",children:t>0?s.jsx("div",{className:"divide-y divide-border/45",children:r}):s.jsx(a4,{children:n})})]})}function r4({title:e,count:t}){return s.jsxs("div",{className:"flex items-center justify-between px-1",children:[s.jsx("h2",{className:"text-[13px] font-semibold tracking-[-0.01em] text-foreground/85",children:e}),s.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[11.5px] font-medium text-muted-foreground",children:t})]})}function a4({children:e}){return s.jsx("div",{className:"rounded-[18px] border border-dashed border-border/65 bg-card/45 px-4 py-5 text-[13px] text-muted-foreground",children:e})}function eC(){const{t:e}=se();return s.jsx("p",{className:"px-1 text-[11.5px] leading-5 text-muted-foreground/75",children:e("settings.legal.thirdPartyBrands",{defaultValue:"Product names, logos, and brands are property of their respective owners. Use is for identification only and does not imply endorsement."})})}function o4(e){return e.map((t,n)=>({provider:t,index:n})).sort((t,n)=>$v(t.provider)-$v(n.provider)||t.index-n.index).map(({provider:t})=>t)}function s4(e){const t=new Set;return e.filter(n=>t.has(n.name)?!1:(t.add(n.name),!0))}function $v(e){const t=Q3.get(e.name);return t!==void 0?t:(e.api_key_required??!0)===!1?100:200}function Uv(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>`${r.name} ${r.label} ${r.api_base??""} ${r.default_api_base??""}`.toLowerCase().includes(n)):e}function i4(e){return l4(e).map(t=>{const n=u4(t);return{name:t,offset:n,searchText:`${t} ${t.replace(/_/g," ")} ${n}`.toLowerCase()}})}function l4(e){var a;const t=Intl;let n;try{n=((a=t.supportedValuesOf)==null?void 0:a.call(t,"timeZone"))??[]}catch{n=[]}const r=new Set([...Y3,...n,e].filter(Boolean));return Array.from(r).sort((o,i)=>o==="UTC"?-1:i==="UTC"?1:o.localeCompare(i))}function c4(e,t){const n=t.trim().toLowerCase();return n?e.filter(r=>r.searchText.includes(n)):e}function u4(e){var t;try{const r=(t=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"shortOffset",hour:"2-digit",minute:"2-digit"}).formatToParts(new Date).find(a=>a.type==="timeZoneName"))==null?void 0:t.value;return r?r.replace(/^GMT$/,"UTC").replace(/^GMT/,"UTC"):"UTC"}catch{return"Custom timezone"}}function Bv(e,t){return!t||e.some(n=>n.name===t)?e:[{name:t,label:t},...e]}function d4(e,t,n={}){const r=n.draftProvider??e.provider;return r==="auto"?t.agent.resolved_provider||t.agent.provider||e.provider:r}const tC={custom:hf,openrouter:$o,skywork:$o,aihubmix:x2,anthropic:Ga,openai:Qb,deepseek:b2,zhipu:e2,dashscope:po,moonshot:vf,minimax:fg,minimax_anthropic:Ga,groq:mo,huggingface:_i,gemini:Jj,mistral:i2,siliconflow:_i,volcengine:po,volcengine_coding_plan:po,byteplus:po,byteplus_coding_plan:po,qianfan:Rc,ant_ling:$o,azure_openai:po,bedrock:Rc,bocha:It,brave:It,duckduckgo:It,exa:It,jina:It,kagi:It,olostep:It,searxng:It,tavily:It,vllm:mo,ollama:mo,lm_studio:mo,atomic_chat:mo,ovms:mo,nvidia:fg};function p4({provider:e,showBrandLogos:t}){const[n,r]=u.useState(0),a=sl(e),o=tC[e]??hf,i=a==null?void 0:a.logoUrls[n];return u.useEffect(()=>r(0),[e]),t&&i?s.jsx("span",{"data-testid":`provider-logo-${e}`,className:"grid h-10 w-10 shrink-0 place-items-center overflow-hidden rounded-[14px] border border-border/45 bg-background shadow-[inset_0_0_0_1px_rgba(0,0,0,0.025)]",style:{boxShadow:`inset 0 0 0 1px ${a.color}22`},children:s.jsx("img",{src:i,alt:"",className:"h-6 w-6 object-contain",onError:()=>r(l=>l+1)})}):t&&a?s.jsx("span",{"data-testid":`provider-logo-fallback-${e}`,className:"grid h-10 w-10 shrink-0 place-items-center rounded-[14px] text-[11px] font-semibold text-white shadow-[inset_0_0_0_1px_rgba(255,255,255,0.18)]",style:{backgroundColor:a.color},"aria-hidden":!0,children:a.initials}):s.jsx("span",{className:"grid h-10 w-10 shrink-0 place-items-center rounded-2xl bg-muted text-foreground/82 shadow-[inset_0_0_0_1px_rgba(0,0,0,0.025)] dark:bg-muted/70",children:s.jsx(o,{className:"h-5 w-5",strokeWidth:2,"aria-hidden":!0})})}function m4({icon:e}){return s.jsx("span",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-[12px] bg-muted text-foreground/82 transition-colors group-hover:bg-muted/80 dark:bg-muted/70",children:s.jsx(e,{className:"h-4 w-4","aria-hidden":!0})})}function f4({provider:e,showBrandLogos:t}){const[n,r]=u.useState(0),a=e?sl(e):null,o=a==null?void 0:a.logoUrls[n];return u.useEffect(()=>r(0),[e]),!e||!t||!a?null:o?s.jsx("span",{"data-testid":`overview-logo-${e}`,className:"grid h-5 w-5 shrink-0 place-items-center overflow-hidden rounded-md border border-border/35 bg-background shadow-[inset_0_0_0_1px_rgba(0,0,0,0.02)]",style:{boxShadow:`inset 0 0 0 1px ${a.color}22`},"aria-hidden":!0,children:s.jsx("img",{src:o,alt:"",className:"h-3.5 w-3.5 object-contain",onError:()=>r(i=>i+1)})}):s.jsx("span",{"data-testid":`overview-logo-fallback-${e}`,className:"grid h-5 w-5 shrink-0 place-items-center rounded-md text-[7.5px] font-semibold text-white shadow-[inset_0_0_0_1px_rgba(255,255,255,0.18)]",style:{backgroundColor:a.color},"aria-hidden":!0,children:a.initials})}function vo({icon:e,valueLogoProvider:t,title:n,value:r,caption:a,showBrandLogos:o=!1,onClick:i}){return s.jsxs("button",{type:"button",onClick:i,className:"group flex min-h-[68px] w-full items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-muted/30 sm:px-5",children:[s.jsx(m4,{icon:e}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block text-[14px] font-medium leading-5 text-foreground",children:n}),s.jsx("span",{className:"mt-0.5 block truncate text-[12px] leading-5 text-muted-foreground",children:a})]}),s.jsxs("span",{className:"ml-auto flex min-w-0 max-w-[48%] items-center gap-2",children:[s.jsx(f4,{provider:t,showBrandLogos:o}),s.jsx("span",{className:"truncate text-right text-[13px] leading-5 text-muted-foreground",children:r}),s.jsx(xr,{className:"h-4 w-4 shrink-0 text-muted-foreground/60 transition-transform group-hover:translate-x-0.5","aria-hidden":!0})]})]})}function nn({children:e}){return s.jsx("h2",{className:"mb-2 px-1 text-[13px] font-semibold tracking-[-0.01em] text-foreground/85",children:e})}function Yt({children:e}){return s.jsx("div",{className:"overflow-hidden rounded-[22px] border border-border/45 bg-card/86 shadow-[0_18px_65px_rgba(15,23,42,0.075)] backdrop-blur-xl dark:border-white/10 dark:shadow-[0_18px_65px_rgba(0,0,0,0.24)]",children:s.jsx("div",{className:"divide-y divide-border/45",children:e})})}function Ee({title:e,description:t,children:n}){return s.jsxs("div",{className:"flex min-h-[62px] flex-col gap-3 px-4 py-3.5 sm:flex-row sm:items-center sm:justify-between sm:px-5",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[14px] font-medium leading-5 text-foreground",children:e}),t?s.jsx("div",{className:"mt-0.5 max-w-[28rem] text-[12px] leading-5 text-muted-foreground",children:t}):null]}),n?s.jsx("div",{className:"min-w-0 sm:ml-6 sm:shrink-0",children:n}):null]})}function Ks({title:e,value:t,description:n}){return s.jsx(Ee,{title:e,description:n,children:s.jsx("span",{className:"block max-w-full truncate text-left text-[13px] text-muted-foreground sm:max-w-[320px] sm:text-right",children:t})})}function h4({presets:e,value:t,settings:n,draftModel:r,draftProvider:a,providerConfigured:o,showProviderLogos:i,onChange:l,onCreateConfiguration:c}){const{t:d}=se(),p=(f,h)=>d(f,{defaultValue:h}),m=e.find(f=>f.name===t)??e[0]??null;return s.jsxs(mn,{modal:!1,children:[s.jsx(fn,{asChild:!0,disabled:!e.length,children:s.jsxs(fe,{type:"button",variant:"outline","aria-label":p("settings.rows.currentModel","Current configuration"),disabled:!e.length,className:A("h-12 w-[min(430px,72vw)] justify-between rounded-full border-input bg-background px-3.5 text-[13px] font-normal shadow-none","hover:bg-accent/55 focus-visible:ring-2 focus-visible:ring-ring"),children:[m?s.jsx(Hv,{preset:m,settings:n,draftModel:r,draftProvider:a,forceUnconfigured:m!=null&&m.is_default?!o:void 0,showProviderLogos:i,compact:!0}):s.jsx("span",{className:"truncate text-muted-foreground",children:p("settings.models.selectModel","Select model")}),s.jsx(rr,{className:"ml-2 h-3.5 w-3.5 shrink-0 text-muted-foreground","aria-hidden":!0})]})}),s.jsxs(an,{align:"end",className:"max-h-[20rem] w-[430px] max-w-[calc(100vw-2rem)] overflow-y-auto scrollbar-thin scrollbar-track-transparent",children:[e.map(f=>{const h=f.name===t;return s.jsxs(ut,{onSelect:()=>l(f.name),className:A("flex cursor-default items-center justify-between gap-3 rounded-[12px] px-2.5 py-2 text-[13px]","focus:bg-muted/85 focus:text-foreground",h&&"bg-muted/80 text-foreground focus:bg-muted"),children:[s.jsx(Hv,{preset:f,settings:n,draftModel:r,draftProvider:a,showProviderLogos:i}),h?s.jsx(jt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null]},f.name)}),s.jsx("div",{className:"mt-1 border-t border-border/55 pt-1",children:s.jsxs(ut,{onSelect:()=>{window.setTimeout(c,0)},className:A("flex cursor-default items-center gap-2 rounded-[12px] px-2.5 py-2 text-[13px] font-medium","text-foreground focus:bg-muted/85 focus:text-foreground"),children:[s.jsx("span",{className:"grid h-5 w-5 shrink-0 place-items-center rounded-md bg-muted text-muted-foreground",children:s.jsx(Ir,{className:"h-3.5 w-3.5","aria-hidden":!0})}),s.jsx("span",{children:p("settings.models.addConfiguration","Add configuration")})]})})]})]})}function Hv({preset:e,settings:t,draftModel:n,draftProvider:r,forceUnconfigured:a,showProviderLogos:o,compact:i=!1}){const{t:l}=se(),c=(x,b)=>l(x,{defaultValue:b}),d=d4(e,t,{draftProvider:e.is_default?r:void 0}),p=e.is_default?n:e.model,m=Mo(t.providers,d),f=a===void 0?Iu(t,d):!a,h=f?p||e.label:c("settings.values.notConfigured","Not configured"),y=f?`${m}${e.label?` · ${e.label}`:""}`:m||p||e.label?[m,p||e.label].filter(Boolean).join(" · "):c("settings.byok.noConfiguredProviders","No configured providers");return s.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx($i,{provider:d,showBrandLogos:o,unconfigured:!f}),s.jsxs("span",{className:"min-w-0 text-left leading-tight",children:[s.jsx("span",{className:A("block truncate font-medium",f?"text-foreground":"text-amber-800 dark:text-amber-200"),children:h}),s.jsx("span",{className:A("mt-0.5 block truncate text-muted-foreground",i?"text-[11.5px]":"text-[12px]"),children:y})]})]})}function il({dirty:e,saving:t,pendingRestart:n,disabled:r=!1,message:a,dirtyMessage:o,pendingMessage:i,onSave:l,onRestart:c,onReset:d,isRestarting:p}){const{t:m}=se(),f=(g,w)=>m(g,{defaultValue:w}),h=ka()!==null,y=h?f("app.system.restartEngine","Restart engine"):m("app.system.restart"),x=h?f("app.system.restartingEngine","Restarting engine..."):m("app.system.restarting"),b=a??(n&&!e?i??f("settings.status.savedRestartApply","Saved. Restart when ready."):e?o??m("settings.status.unsaved"):void 0),v=r?"danger":e||n?"accent":void 0;return s.jsxs("div",{className:"flex min-h-[58px] flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5",children:[s.jsx("div",{className:"min-w-0 text-[13px] leading-5 text-muted-foreground",children:s.jsx(nC,{tone:v,children:b})}),s.jsxs("div",{className:"flex w-full shrink-0 flex-wrap justify-end gap-2 sm:w-auto",children:[n&&!e&&c?s.jsxs(fe,{size:"sm",variant:"ghost",onClick:c,disabled:p,className:"rounded-full",children:[p?s.jsx(vt,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):s.jsx(Ki,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),p?x:y]}):null,d?s.jsx(fe,{size:"sm",variant:"ghost",onClick:d,disabled:!e||t,className:"rounded-full",children:m("settings.actions.cancel")}):null,s.jsx(fe,{size:"sm",variant:"outline",onClick:l,disabled:!e||r||t,className:"rounded-full",children:m(t?"settings.actions.saving":"settings.actions.save")})]})]})}function g4({dirty:e,saving:t,saved:n,disabled:r=!1,message:a,onSave:o}){const{t:i}=se(),c=a??(e?i("settings.status.unsaved"):n?i("settings.status.savedRestart"):((d,p)=>i(d,{defaultValue:p}))("settings.status.upToDate","Up to date."));return s.jsxs("div",{className:"flex min-h-[58px] flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5",children:[s.jsx("div",{className:"text-[13px] text-muted-foreground",children:s.jsx(nC,{tone:r?"danger":e||n?"accent":void 0,children:c})}),s.jsx("div",{className:"flex justify-end",children:s.jsx(fe,{size:"sm",variant:"outline",onClick:o,disabled:!e||r||t,className:"rounded-full",children:i(t?"settings.actions.saving":"settings.actions.save")})})]})}function nC({children:e,tone:t}){return e?s.jsxs("span",{className:A("inline-flex items-center gap-2",t==="accent"&&"font-medium text-blue-600 dark:text-blue-300",t==="danger"&&"font-medium text-destructive"),children:[t?s.jsx("span",{className:A("h-1.5 w-1.5 shrink-0 rounded-full",t==="accent"&&"bg-blue-500 shadow-[0_0_0_3px_rgba(59,130,246,0.14)] dark:bg-blue-400 dark:shadow-[0_0_0_3px_rgba(96,165,250,0.18)]",t==="danger"&&"bg-destructive/70"),"aria-hidden":!0}):null,s.jsx("span",{children:e})]}):null}function Du({children:e,tone:t="neutral"}){return s.jsx("span",{className:A("inline-flex max-w-[260px] items-center rounded-full px-2.5 py-1 text-[12px] font-medium",t==="success"&&"bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",t==="warning"&&"bg-amber-500/10 text-amber-700 dark:text-amber-300",t==="neutral"&&"bg-muted text-muted-foreground"),children:s.jsx("span",{className:"truncate",children:e})})}function Za({value:e,options:t,onChange:n}){return s.jsx("div",{className:"inline-flex h-8 items-center rounded-full bg-muted p-0.5 text-[12px] font-medium text-muted-foreground",children:t.map(r=>s.jsx("button",{type:"button",onClick:()=>n(r.value),className:A("rounded-full px-3 py-1 transition-colors",e===r.value&&"bg-background text-foreground shadow-sm"),children:r.label},r.value))})}function ls({checked:e,onChange:t,ariaLabel:n,label:r}){return s.jsxs("button",{type:"button",role:"switch","aria-checked":e,"aria-label":n??r,onClick:()=>t(!e),className:A("relative inline-flex h-[22px] w-[38px] shrink-0 items-center rounded-full p-[2px]","transition-colors duration-200 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e?"bg-[#2997FF] shadow-[inset_0_0_0_1px_rgba(0,0,0,0.035)]":"bg-muted shadow-[inset_0_0_0_1px_rgba(0,0,0,0.035)] hover:bg-muted/80"),children:[s.jsx("span",{"aria-hidden":!0,className:A("h-[18px] w-[18px] rounded-full bg-background shadow-[0_1px_2px_rgba(0,0,0,0.18),0_2px_7px_rgba(0,0,0,0.11)]","transition-transform duration-200 ease-out",e?"translate-x-[16px]":"translate-x-0")}),s.jsx("span",{className:"sr-only",children:r})]})}function Ui({value:e,min:t,max:n,onChange:r,suffix:a}){return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(qe,{type:"number",min:t,max:n,value:e,onChange:o=>{const i=Number(o.target.value);Number.isFinite(i)&&r(i)},className:"h-8 w-24 max-w-full rounded-full text-[13px]"}),a?s.jsx("span",{className:"text-[12px] text-muted-foreground",children:a}):null]})}const rC="nanobot-webui.theme",aC=u.createContext("light");function v4(){try{const e=localStorage.getItem(rC);return e==="light"||e==="dark"?e:null}catch{return null}}function x4(e){const t=document.documentElement;e==="dark"?t.classList.add("dark"):t.classList.remove("dark")}function y4(){const[e,t]=u.useState(()=>{const a=v4();return a||(typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")});u.useEffect(()=>{x4(e);try{localStorage.setItem(rC,e)}catch{}},[e]);const n=u.useCallback(a=>t(a),[]),r=u.useCallback(()=>t(a=>a==="dark"?"light":"dark"),[]);return{theme:e,toggle:r,setTheme:n}}function b4({theme:e,children:t}){return u.createElement(aC.Provider,{value:e},t)}function w4(){return u.useContext(aC)}const k4="\x1B",cs=new RegExp(`${k4}\\[[0-?]*[ -/]*[@-~]`,"g"),mm=["#000000","#cd3131","#0dbc79","#e5e510","#2472c8","#bc3fbc","#11a8cd","#e5e5e5"],fm=["#666666","#f14c4c","#23d18b","#f5f543","#3b8eea","#d670d6","#29b8db","#ffffff"],Fd=[0,95,135,175,215,255];function C4(e){return cs.lastIndex=0,cs.test(e)}function S4(e){return cs.lastIndex=0,e.replace(cs,"")}function oC(){return{bold:!1,dim:!1,inverse:!1,italic:!1,underline:!1}}function N4(e){if(e<0||e>255)return;if(e<8)return mm[e];if(e<16)return fm[e-8];if(e<232){const n=e-16,r=Fd[Math.floor(n/36)],a=Fd[Math.floor(n%36/6)],o=Fd[n%6];return`rgb(${r}, ${a}, ${o})`}const t=8+(e-232)*10;return`rgb(${t}, ${t}, ${t})`}function j4(e,t,n){if(![e,t,n].some(r=>!Number.isFinite(r)||r<0||r>255))return`rgb(${e}, ${t}, ${n})`}function A4(e){if(!e.endsWith("m"))return null;const t=e.slice(2,-1).trim();return t?t.split(/[;:]/).map(n=>{const r=Number.parseInt(n||"0",10);return Number.isFinite(r)?r:0}):[0]}function Wv(e,t,n,r){const a=t[n+1];if(a===5){const o=N4(t[n+2]);return o&&(e[r]=o),n+2}if(a===2){const o=j4(t[n+2],t[n+3],t[n+4]);return o&&(e[r]=o),n+4}return n}function _4(e,t){for(let n=0;n=30&&r<=37?e.color=mm[r-30]:r>=40&&r<=47?e.backgroundColor=mm[r-40]:r>=90&&r<=97?e.color=fm[r-90]:r>=100&&r<=107?e.backgroundColor=fm[r-100]:r===38?n=Wv(e,t,n,"color"):r===48&&(n=Wv(e,t,n,"backgroundColor"))}}function qv(e){const t=e.inverse?e.backgroundColor:e.color,n=e.inverse?e.color:e.backgroundColor,r={};return t&&(r.color=t),n&&(r.backgroundColor=n),e.bold&&(r.fontWeight=700),e.dim&&(r.opacity=.72),e.italic&&(r.fontStyle="italic"),e.underline&&(r.textDecorationLine="underline"),Object.keys(r).length?r:void 0}function P4(e){const t=[],n=oC();let r=0;cs.lastIndex=0;for(const a of e.matchAll(cs)){const o=a.index??0;o>r&&t.push({text:e.slice(r,o),style:qv(n)});const i=A4(a[0]);i&&_4(n,i),r=o+a[0].length}return ra.text.length>0)}const zd=['"JetBrains Mono"','"SFMono-Regular"','"SF Mono"','"Fira Code"','"Cascadia Code"','"Source Code Pro"',"Menlo","Consolas","monospace"].join(", "),T4=new Set(["ansi","ansi-output"]),R4="#f4f4f5",M4="#27272a",E4=u.lazy(async()=>{const[{default:e},{default:t},{default:n}]=await Promise.all([$l(()=>import("./syntax-highlight-CQw1bBY6.js").then(r=>r.p),__vite__mapDeps([0,1,2,3])),$l(()=>import("./syntax-highlight-CQw1bBY6.js").then(r=>r.o),__vite__mapDeps([0,1,2,3])),$l(()=>import("./syntax-highlight-CQw1bBY6.js").then(r=>r.b),__vite__mapDeps([0,1,2,3]))]);return{default({language:r,code:a,isDark:o,chrome:i,showLineNumbers:l,wrapLongLines:c}){const d=o?t:n,p=i==="none"?{...d,'pre[class*="language-"]':{...d['pre[class*="language-"]'],background:"transparent"},'code[class*="language-"]':{...d['code[class*="language-"]'],background:"transparent"}}:d;return s.jsx(e,{language:r||"text",style:p,customStyle:{background:i==="none"?"transparent":o?M4:R4,margin:0,padding:i==="none"?"0.75rem 1rem":"1rem",fontFamily:zd,fontSize:i==="none"?"13px":"0.875rem",lineHeight:i==="none"?1.55:1.6,tabSize:2},codeTagProps:{style:{background:"transparent",fontFamily:zd}},lineNumberStyle:{minWidth:"2.6em",paddingRight:"1.15rem",color:o?"rgba(212, 212, 216, 0.45)":"rgba(63, 63, 70, 0.68)",fontFamily:zd,userSelect:"none"},PreTag:"pre",showLineNumbers:l,wrapLongLines:c,children:a})}}});function I4(e){return e}function L4(e){return P4(e).map((t,n)=>s.jsx("span",{style:t.style,children:t.text},n))}function $d({code:e,chrome:t,showLineNumbers:n,testId:r,className:a,renderText:o=I4}){const i=e.split(` `);return s.jsx("pre",{className:A("m-0 overflow-x-auto p-4 font-mono text-sm leading-[1.6] text-foreground/90",n?"whitespace-pre":"whitespace-pre-wrap",t==="default"?"bg-zinc-100 dark:bg-zinc-800":"bg-transparent",t==="none"&&"p-3 text-[13px] leading-[1.55]",a),"data-testid":r,children:s.jsx("code",{className:"text-inherit",children:n?i.map((l,c)=>s.jsxs("span",{className:"flex min-w-max",children:[s.jsx("span",{className:"w-10 shrink-0 select-none pr-4 text-right text-muted-foreground/60",children:c+1}),s.jsx("span",{className:"whitespace-pre",children:o(l||" ")}),c{navigator.clipboard&&navigator.clipboard.writeText(f?S4(t):t).then(()=>{d(!0),setTimeout(()=>d(!1),1500)})},[t,f]);return s.jsxs("div",{className:A("not-prose overflow-hidden",m&&"rounded-lg border",m&&(p?"border-white/10":"border-black/10"),n),children:[m?s.jsxs("div",{className:A("flex items-center justify-between px-4 pb-1.5 pt-2 text-xs font-medium",p?"bg-zinc-800 text-zinc-300":"bg-zinc-100 text-zinc-600"),children:[s.jsx("span",{className:"lowercase font-mono",children:e||l("code.fallbackLanguage")}),s.jsxs("button",{type:"button",onClick:h,className:A("inline-flex items-center gap-1 rounded px-1.5 py-0.5 font-mono transition-colors",p?"text-zinc-400 hover:bg-zinc-700 hover:text-zinc-200":"text-zinc-500 hover:bg-zinc-200 hover:text-zinc-700"),"aria-label":l("code.copyAria"),children:[c?s.jsx(jt,{className:"h-3.5 w-3.5"}):s.jsx(Zb,{className:"h-3.5 w-3.5"}),s.jsx("span",{children:l(c?"code.copied":"code.copy")})]})]}):null,f?s.jsx($d,{code:t,chrome:r,showLineNumbers:o,testId:"ansi-code",renderText:L4}):a?s.jsx(u.Suspense,{fallback:s.jsx($d,{code:t,chrome:r,showLineNumbers:o,testId:"plain-code-fallback"}),children:s.jsx(E4,{language:e,code:t,isDark:p,chrome:r,showLineNumbers:o,wrapLongLines:i})}):s.jsx($d,{code:t,chrome:r,showLineNumbers:o,testId:"plain-code-fallback"})]})}function Jf({path:e,tooltipPath:t,display:n="name",active:r=!1,className:a,textClassName:o,previewPath:i,onOpen:l,testId:c="inline-file-path"}){const{directory:d,name:p}=sC(e),m=z4(e),f=n==="path"?e.replace(/\\/g,"/"):p,h=t||e,y=i||t||e,x=!!l,b=g=>{l&&(g.preventDefault(),g.stopPropagation(),l(y))},v=g=>{g.key!=="Enter"&&g.key!==" "||b(g)};return s.jsx(Eu,{delayDuration:500,skipDelayDuration:100,children:s.jsxs(Li,{children:[s.jsx(Di,{asChild:!0,children:s.jsx("span",{className:A("not-prose inline-flex max-w-full align-baseline leading-[inherit]",a),children:s.jsxs("span",{"data-testid":c,"aria-label":h,role:x?"button":void 0,tabIndex:x?0:void 0,onClick:x?b:void 0,onKeyDown:x?v:void 0,className:A("inline-flex max-w-full items-baseline gap-[0.28em] font-medium leading-[inherit]","text-sky-600 transition-colors hover:text-sky-700","dark:text-sky-300 dark:hover:text-sky-200",x&&["cursor-pointer rounded-[5px]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-400/45"]),children:[s.jsx($4,{kind:m}),s.jsx("span",{"data-sheen-text":r?f:void 0,className:A("min-w-0 max-w-full truncate",r&&"streaming-text-sheen file-reference-sheen",o),children:n==="path"&&d?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-muted-foreground/65",children:d}),s.jsx("span",{className:"font-semibold text-sky-700 dark:text-sky-200",children:p})]}):f})]})})}),s.jsx(is,{side:"top",align:"center",sideOffset:8,collisionPadding:12,className:A("max-w-[min(38rem,calc(100vw-2rem))] rounded-[10px]","border-border/60 bg-popover/95 px-2.5 py-1.5","break-all font-mono text-[11px] leading-snug text-popover-foreground","shadow-lg backdrop-blur"),children:h})]})})}function k6(e){const t=e.trim();if(!t||t.includes(` `)||/^[a-z][a-z0-9+.-]*:\/\//i.test(t)||F4(t)||!/[\\/]/.test(t)&&!/^(dockerfile|makefile|readme|package-lock\.json)$/i.test(t))return!1;const n=t.replace(/\\/g,"/"),r=n.split("/").filter(Boolean).pop()??n;return!r||r==="."||r===".."?!1:/^(dockerfile|makefile|readme|package-lock\.json)$/i.test(r)?!0:/\.[a-z0-9][a-z0-9_-]{0,12}$/i.test(r)}function F4(e){return/[*?[\]{}]/.test(e.trim())}function sC(e){const t=e.replace(/\\/g,"/"),n=t.lastIndexOf("/");return n<0?{directory:"",name:e}:{directory:t.slice(0,n+1),name:t.slice(n+1)||t}}function z4(e){const t=e.toLowerCase(),n=t.split(/[\\/]/).pop()??t,r=n.includes(".")?n.split(".").pop()??"":"";if(n==="dockerfile")return"default";switch(r){case"py":case"pyi":return"python";case"jsx":case"tsx":return"react";case"js":case"mjs":case"cjs":return"javascript";case"ts":case"mts":case"cts":return"typescript";case"html":case"htm":return"html";case"css":case"scss":case"sass":return"css";case"json":case"jsonl":return"json";case"md":case"mdx":return"markdown";case"ipynb":return"notebook";default:return"default"}}function $4({kind:e}){if(e==="python")return s.jsxs("svg",{"aria-hidden":!0,className:"h-[1em] w-[1em] shrink-0 translate-y-[0.12em]",viewBox:"0 0 24 24",children:[s.jsx("path",{d:"M11.9 2.3c-3 0-4.5.8-4.5 2.3v2.1h4.8v.8H5.5C4 7.5 3 8.8 3 10.8v2.1c0 1.8 1.1 3 2.7 3h1.6v-2.3c0-1.7 1.4-3.1 3.1-3.1h4.2c1.3 0 2.3-1 2.3-2.3V4.6c0-1.4-1.5-2.3-4.6-2.3h-.4Z",fill:"#3776AB"}),s.jsx("path",{d:"M12.1 21.7c3 0 4.5-.8 4.5-2.3v-2.1h-4.8v-.8h6.7c1.5 0 2.5-1.3 2.5-3.3v-2.1c0-1.8-1.1-3-2.7-3h-1.6v2.3c0 1.7-1.4 3.1-3.1 3.1H9.4c-1.3 0-2.3 1-2.3 2.3v3.6c0 1.4 1.5 2.3 4.6 2.3h.4Z",fill:"#FFD43B"}),s.jsx("circle",{cx:"9",cy:"5.1",r:"0.8",fill:"#fff"}),s.jsx("circle",{cx:"15",cy:"18.9",r:"0.8",fill:"#5C3B00",opacity:"0.85"})]});if(e==="react")return s.jsxs("svg",{"aria-hidden":!0,className:"h-[0.92em] w-[0.92em] shrink-0 translate-y-[0.11em] text-sky-500 dark:text-sky-300",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("circle",{cx:"12",cy:"12",r:"1.9",fill:"currentColor",stroke:"none"}),s.jsx("ellipse",{cx:"12",cy:"12",rx:"9",ry:"3.7"}),s.jsx("ellipse",{cx:"12",cy:"12",rx:"9",ry:"3.7",transform:"rotate(60 12 12)"}),s.jsx("ellipse",{cx:"12",cy:"12",rx:"9",ry:"3.7",transform:"rotate(120 12 12)"})]});if(e==="default")return s.jsxs("svg",{"aria-hidden":!0,className:"h-[0.92em] w-[0.92em] shrink-0 translate-y-[0.11em] text-sky-500 dark:text-sky-300",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M14 2H7a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7z"}),s.jsx("path",{d:"M14 2v5h5"})]});const t=U4(e);return s.jsxs("svg",{"aria-hidden":!0,className:"h-[0.96em] w-[0.96em] shrink-0 translate-y-[0.12em] text-sky-500 dark:text-sky-300",viewBox:"0 0 24 24",fill:"none",children:[s.jsx("path",{d:"M7 3.5h6.6L18 7.9V19a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 6 19V5a1.5 1.5 0 0 1 1.5-1.5Z",fill:"currentColor",opacity:"0.12"}),s.jsx("path",{d:"M13.5 3.75V8h4.25M7 3.5h6.6L18 7.9V19a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 6 19V5a1.5 1.5 0 0 1 1.5-1.5Z",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("text",{x:"12",y:"15.7",textAnchor:"middle",fill:"currentColor",fontSize:t.length>1?"5.8":"7.2",fontWeight:"800",letterSpacing:"-0.2",children:t})]})}function U4(e){switch(e){case"css":return"#";case"html":return"H";case"javascript":return"JS";case"json":return"{}";case"markdown":return"M";case"notebook":return"N";case"python":return"PY";case"typescript":return"TS";default:return""}}function B4(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(hover: hover) and (pointer: fine)").matches}function H4({sessionKey:e,path:t,token:n,desktopWidth:r=544,isClosing:a=!1,onResizeStart:o,onClose:i}){const{t:l}=se(),[c,d]=u.useState({status:"loading"}),[p,m]=u.useState(!1),[f,h]=u.useState(B4);u.useEffect(()=>{const j=window.requestAnimationFrame(()=>m(!0));return()=>window.cancelAnimationFrame(j)},[]),u.useEffect(()=>{if(typeof window.matchMedia!="function")return;const j=window.matchMedia("(hover: hover) and (pointer: fine)"),N=()=>h(j.matches);return N(),typeof j.addEventListener=="function"?(j.addEventListener("change",N),()=>j.removeEventListener("change",N)):(j.addListener(N),()=>j.removeListener(N))},[]),u.useEffect(()=>{let j=!1;return d({status:"loading"}),gL(n,e,t).then(N=>{j||d({status:"ready",payload:N})}).catch(N=>{if(j)return;const P=N instanceof os?N.status===404&&/API route not found/i.test(N.message)?l("filePreview.routeMissing",{defaultValue:"File preview needs the latest gateway. Restart nanobot gateway and try again."}):N.message:l("filePreview.failed",{defaultValue:"Could not preview this file."});d({status:"error",message:P})}),()=>{j=!0}},[t,e,l,n]);const y=c.status==="ready"?c.payload.display_path:t,x=c.status==="ready"?c.payload.path:y,b=x.replace(/\\/g,"/"),v=b.startsWith("/"),{name:g}=sC(y),w=u.useMemo(()=>b.split("/").filter(Boolean),[b]),k=u.useMemo(()=>w.length>2?w.slice(-2):w,[w]),C=w.length>k.length;return s.jsx("aside",{"aria-label":l("filePreview.aria",{defaultValue:"File preview"}),style:{"--file-preview-width":`${r}px`,"--file-preview-slot-width":!p||a?"0px":`${r}px`},className:A("absolute inset-y-0 right-0 z-30 w-[min(100vw,var(--file-preview-slot-width))] overflow-hidden","transition-[width] duration-300 ease-out will-change-[width]","md:relative md:z-auto md:w-[var(--file-preview-slot-width)] md:min-w-0 md:shrink-0",a&&"pointer-events-none"),"data-testid":"file-preview-panel","data-file-preview-panel":!0,children:s.jsxs("div",{className:A("absolute inset-y-0 right-0 flex w-[min(100vw,var(--file-preview-width))] flex-col overflow-hidden pb-[env(safe-area-inset-bottom)] md:w-[var(--file-preview-width)] md:pb-0","border-l border-border/70 bg-background shadow-2xl md:shadow-none","transition-[opacity,transform] duration-300 ease-out will-change-transform",!p||a?"translate-x-full opacity-0":"translate-x-0 opacity-100","motion-reduce:translate-x-0"),children:[o?s.jsx("button",{type:"button","aria-label":l("filePreview.resize",{defaultValue:"Resize file preview"}),className:A("group absolute inset-y-0 left-0 z-20 hidden w-3 -translate-x-1/2 cursor-col-resize touch-none md:flex","items-stretch justify-center focus-visible:outline-none"),onPointerDown:o,children:s.jsx("span",{"aria-hidden":!0,className:A("h-full w-px bg-foreground/25 opacity-0 transition-opacity","group-hover:opacity-100 group-focus-visible:bg-ring group-focus-visible:opacity-100")})}):null,s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[s.jsx("div",{className:"flex h-12 shrink-0 items-center gap-2 border-b border-border/60 px-3",children:f?s.jsxs("div",{className:A("group inline-flex max-w-full min-w-0 items-center gap-2 rounded-[12px]","bg-muted/70 px-2.5 py-1.5 text-sm font-medium"),title:g||y,children:[s.jsxs("button",{type:"button",onClick:i,className:A("relative inline-flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden rounded-full","text-muted-foreground/75 transition-[background-color,color,opacity] duration-150 ease-out","group-hover:bg-foreground group-hover:text-background group-hover:opacity-100","group-focus-within:bg-foreground group-focus-within:text-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),"aria-label":l("filePreview.close",{defaultValue:"Close file preview"}),children:[s.jsx(Qj,{className:A("absolute h-4 w-4 transition-all duration-150 ease-out","opacity-100 group-hover:scale-75 group-hover:opacity-0","group-focus-within:scale-75 group-focus-within:opacity-0"),"aria-hidden":!0}),s.jsx(vr,{className:A("absolute h-3.5 w-3.5 scale-75 opacity-0 transition-all duration-150 ease-out","group-hover:scale-100 group-hover:opacity-100","group-focus-within:scale-100 group-focus-within:opacity-100"),"aria-hidden":!0})]}),s.jsx("span",{className:"min-w-0 truncate",children:g||y})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onClick:i,className:A("inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full","text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),"aria-label":l("filePreview.close",{defaultValue:"Close file preview"}),children:s.jsx(vr,{className:"h-5 w-5","aria-hidden":!0})}),s.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:g||y})]})}),s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[s.jsx("div",{className:A("flex min-h-10 shrink-0 items-center gap-1.5 overflow-hidden","border-b border-border/45 px-4 text-[13px] text-muted-foreground"),title:x,children:s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[C?s.jsx("span",{className:"shrink-0 text-muted-foreground/55",children:"..."}):v?s.jsx("span",{className:"shrink-0 text-muted-foreground/55",children:"/"}):null,k.length>0?k.map((j,N)=>s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[N>0||C||v?s.jsx(xr,{className:"h-3 w-3 shrink-0 text-muted-foreground/40","aria-hidden":!0}):null,s.jsx("span",{className:A("min-w-0 truncate",N===k.length-1?"font-medium text-foreground":"max-w-[42vw] shrink text-muted-foreground/76"),children:j})]},`${j}-${N}`)):s.jsx("span",{className:"truncate",children:x})]})}),s.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:c.status==="loading"?s.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-sm text-muted-foreground",children:[s.jsx(vt,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),l("filePreview.loading",{defaultValue:"Loading preview..."})]}):c.status==="error"?s.jsx("div",{className:"flex h-full items-center justify-center px-8 text-center text-sm text-muted-foreground",children:s.jsxs("div",{className:"max-w-sm",children:[s.jsx(ja,{className:"mx-auto mb-3 h-5 w-5 text-muted-foreground/70","aria-hidden":!0}),s.jsx("p",{children:c.message})]})}):s.jsxs("div",{className:"min-h-full",children:[c.payload.truncated?s.jsx("div",{className:"mx-4 mt-3 rounded-md border border-amber-500/25 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-200",children:l("filePreview.truncated",{defaultValue:"Preview is truncated because this file is large."})}):null,s.jsx(O4,{language:c.payload.language,code:c.payload.content,chrome:"none",showLineNumbers:!0,wrapLongLines:!1,className:"min-h-full"})]})})]})]})]})})}function iC(e){let t=0;return e.flatMap(n=>{if(n.role!=="user")return[];const r={id:n.id,label:W4(n.content,t),preview:q4(n.content,t),createdAt:n.createdAt,index:t};return t+=1,[r]})}function W4(e,t){const n=e.replace(/\s+/g," ").trim();return n?n.length>80?`${n.slice(0,77)}...`:n:`Prompt ${t+1}`}function q4(e,t){const n=e.replace(/\n{3,}/g,` `).trim();return n?n.length>320?`${n.slice(0,317)}...`:n:`Prompt ${t+1}`}function hm(e,t){if(!e||!t)return;const n=ui(e,t);n&&e.scrollTo({top:Math.max(0,Zf(e,n)-16),behavior:"smooth"})}function ui(e,t){const n=e.querySelectorAll("[data-user-prompt-id]");return Array.from(n).find(r=>r.dataset.userPromptId===t)??null}function Zf(e,t){const n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top!==0||r.top!==0?r.top-n.top+e.scrollTop:t.offsetTop}function V4({messages:e,onJumpToPrompt:t}){const{i18n:n,t:r}=se(),a=u.useMemo(()=>iC(e),[e]),[o,i]=u.useState(!1),[l,c]=u.useState(""),d=u.useMemo(()=>{const m=l.trim().toLocaleLowerCase();return m?a.filter(f=>`${f.label} ${f.preview}`.toLocaleLowerCase().includes(m)):a},[a,l]);if(a.length===0)return null;const p=m=>{i(!1),t(m)};return s.jsxs(s.Fragment,{children:[s.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:A("host-no-drag h-8 w-8 rounded-full text-muted-foreground/80","hover:bg-accent/40 hover:text-foreground"),"aria-label":r("thread.promptNavigator.open"),onClick:()=>i(!0),children:s.jsx(o2,{className:"h-4 w-4"})}),s.jsx(Vf,{open:o,onOpenChange:i,children:s.jsxs(_u,{side:"right","aria-describedby":void 0,className:"w-[min(92vw,24rem)] gap-0 p-0 sm:max-w-[24rem]",children:[s.jsxs("div",{className:"border-b px-5 pb-4 pt-5",children:[s.jsx(Pu,{className:"text-base font-medium",children:r("thread.promptNavigator.title")}),s.jsxs("div",{className:"relative mt-4",children:[s.jsx(It,{"aria-hidden":!0,className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{value:l,onChange:m=>c(m.target.value),"aria-label":r("thread.promptNavigator.search"),placeholder:r("thread.promptNavigator.search"),className:A("h-10 w-full rounded-full border border-border bg-background pl-9 pr-3 text-sm","outline-none transition focus:border-ring focus:ring-2 focus:ring-ring/20")})]})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2",children:d.length>0?s.jsx("div",{className:"space-y-1",children:d.map(m=>s.jsx(K4,{locale:n.resolvedLanguage||n.language,prompt:m,onJump:p},m.id))}):s.jsx("div",{className:"px-3 py-10 text-center text-sm text-muted-foreground",children:r("thread.promptNavigator.noResults")})})]})})]})}function K4({locale:e,onJump:t,prompt:n}){const{t:r}=se(),a=Ur(n.createdAt,e);return s.jsxs("button",{type:"button",className:A("w-full rounded-xl px-3 py-3 text-left transition","hover:bg-accent focus-visible:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30"),"aria-label":r("thread.promptNavigator.jumpTo",{label:n.label}),onClick:()=>t(n.id),children:[s.jsx("div",{className:"max-h-20 overflow-hidden whitespace-pre-wrap break-words text-sm leading-5 text-foreground",children:n.preview}),a?s.jsx("div",{className:"mt-1 text-[10px] leading-4 text-muted-foreground/75",children:a}):null]})}const G4=3e3;function Y4(e,t,n){const[r,a]=u.useState([]),[o,i]=u.useState(!1),[l,c]=u.useState(!1),[d,p]=u.useState(()=>Date.now());return u.useEffect(()=>{if(!e)return;let m=!1,f=!1;const h=async(b=!1)=>{b&&(i(!0),c(!1),a([]));try{const v=await b1(t,n);if(m)return;a(v.jobs),c(!1),f=!0}catch{!m&&!f&&c(!0)}finally{!m&&b&&i(!1)}};h(!0);const y=window.setInterval(()=>void h(!1),G4),x=()=>{document.visibilityState!=="hidden"&&h(!1)};return window.addEventListener("focus",x),document.addEventListener("visibilitychange",x),()=>{m=!0,window.clearInterval(y),window.removeEventListener("focus",x),document.removeEventListener("visibilitychange",x)}},[e,n,t]),u.useEffect(()=>{if(!e)return;p(Date.now());const m=window.setInterval(()=>p(Date.now()),1e3);return()=>window.clearInterval(m)},[e]),{jobs:r,loading:o,loadFailed:l,now:d}}const Q4=[[60,"second"],[60,"minute"],[24,"hour"],[7,"day"],[4.345,"week"],[12,"month"],[Number.POSITIVE_INFINITY,"year"]];function X4({sessionKey:e,token:t,title:n}){const{t:r}=se("common"),[a,o]=u.useState(!1),{jobs:i,loading:l,loadFailed:c,now:d}=Y4(a,t,e),p=l?s.jsxs("div",{className:"flex items-center gap-2 rounded-[16px] bg-muted/45 px-3 py-3 text-[12.5px] text-muted-foreground",children:[s.jsx(p2,{className:"h-3.5 w-3.5 animate-spin"}),r("thread.sessionInfo.loading")]}):c?s.jsxs("div",{className:"flex items-center gap-2 rounded-[16px] bg-destructive/10 px-3 py-3 text-[12.5px] text-destructive",children:[s.jsx(ja,{className:"h-3.5 w-3.5"}),r("thread.sessionInfo.loadFailed")]}):i.length?s.jsx("div",{className:"space-y-1.5",children:i.map(m=>s.jsx(J4,{job:m,now:d},m.id))}):s.jsx("div",{className:"rounded-[16px] bg-muted/35 px-3 py-3 text-[12.5px] leading-relaxed text-muted-foreground",children:r("thread.sessionInfo.empty")});return s.jsxs(mn,{modal:!1,open:a,onOpenChange:o,children:[s.jsx(fn,{asChild:!0,children:s.jsx(fe,{variant:"ghost",size:"icon","aria-label":r("thread.header.sessionInfo"),className:A("host-no-drag h-8 w-8 rounded-full text-muted-foreground/85","hover:bg-accent/40 hover:text-foreground"),children:s.jsx(a2,{className:"h-4 w-4 stroke-[1.75]"})})}),s.jsx(an,{align:"end",sideOffset:8,className:"w-[min(23rem,calc(100vw-1.5rem))] rounded-[24px] p-0",children:s.jsxs("div",{className:"space-y-3 px-4 py-3.5",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[12px] font-normal text-muted-foreground/75",children:r("thread.sessionInfo.title")}),s.jsx("div",{className:"mt-0.5 truncate text-[14px] font-medium text-foreground",children:n||r("thread.sessionInfo.untitled")})]}),s.jsx("div",{className:"h-px bg-border/45"}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx(Wj,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground/80"}),s.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:r("thread.sessionInfo.automations")})]}),s.jsx("span",{className:"rounded-full bg-muted/70 px-2 py-0.5 text-[11px] text-muted-foreground",children:r("thread.sessionInfo.count",{count:i.length})})]}),p]})})]})}function J4({job:e,now:t}){const{t:n}=se("common"),r=Z4(e,n),a=eO(e,n,t),o=e.enabled?e.state.last_status==="error"?"bg-destructive":"bg-emerald-500":"bg-muted-foreground/35";return s.jsx("div",{className:"rounded-[16px] px-3 py-2.5 transition-colors hover:bg-muted/40",children:s.jsxs("div",{className:"flex items-start gap-2.5",children:[s.jsx("span",{className:A("mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full",o)}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:e.name}),e.enabled?null:s.jsx("span",{className:"shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10.5px] text-muted-foreground",children:n("thread.sessionInfo.disabled")})]}),s.jsx("div",{className:"mt-1 line-clamp-2 text-[12px] leading-snug text-muted-foreground",children:e.payload.message}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-[11.5px] text-muted-foreground/80",children:[s.jsx("span",{children:r}),s.jsx("span",{"aria-hidden":!0,children:"·"}),s.jsx("span",{title:a.title,children:a.label})]})]})]})})}function Z4(e,t){const n=bs();return e.schedule.kind==="at"&&e.schedule.at_ms?t("thread.sessionInfo.schedule.at",{time:Ur(e.schedule.at_ms,n)}):e.schedule.kind==="every"&&e.schedule.every_ms?t("thread.sessionInfo.schedule.every",{duration:nO(e.schedule.every_ms,n)}):e.schedule.kind==="cron"&&e.schedule.expr?e.schedule.tz?t("thread.sessionInfo.schedule.cronWithTz",{expr:e.schedule.expr,tz:e.schedule.tz}):t("thread.sessionInfo.schedule.cron",{expr:e.schedule.expr}):t("thread.sessionInfo.schedule.unknown")}function eO(e,t,n){const r=bs();if(!e.enabled)return{label:t("thread.sessionInfo.next.disabled"),title:""};if(e.state.pending)return{label:t("thread.sessionInfo.next.pending"),title:""};const a=e.state.next_run_at_ms;return a?{label:t("thread.sessionInfo.next.label",{time:tO(a,n,r)}),title:Ur(a,r)}:{label:t("thread.sessionInfo.next.none"),title:""}}function tO(e,t,n){let r=(e-t)/1e3;const a=new Intl.RelativeTimeFormat(n,{numeric:"auto"});for(const[o,i]of Q4){if(Math.abs(r)=a&&e%a===0)return new Intl.NumberFormat(t,{style:"unit",unit:r,unitDisplay:"long",maximumFractionDigits:0}).format(e/a);return new Intl.NumberFormat(t,{style:"unit",unit:"minute",unitDisplay:"long",maximumFractionDigits:1}).format(e/6e4)}const lC=()=>$l(()=>import("./MarkdownTextRenderer-CE8hfq6X.js"),__vite__mapDeps([4,1,0,2,3])),rO=u.lazy(lC),aO=u.memo(function({source:t,className:n,highlightCode:r,onOpenFilePreview:a}){return s.jsx(rO,{className:n,highlightCode:r,onOpenFilePreview:a,children:t})}),oO=80,sO=140,iO=220,lO=16e3;class cO extends u.Component{constructor(){super(...arguments);$e(this,"state",{failed:!1})}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}}function Ou(){lC()}function Fu({children:e,className:t,streaming:n=!1,onOpenFilePreview:r}){const a=uO(e,n),o=n?a.length<=lO:a===e;u.useEffect(()=>{n&&Ou()},[n]);const i=s.jsx("div",{className:A("whitespace-pre-wrap break-words leading-relaxed text-foreground/92",t),children:a});return s.jsx(cO,{fallback:i,children:s.jsx(u.Suspense,{fallback:i,children:s.jsx(aO,{source:a,className:t,highlightCode:o,onOpenFilePreview:r})})})}function uO(e,t){const[n,r]=u.useState(e),a=u.useRef(e),o=u.useRef(e),i=u.useRef(null),l=u.useCallback(()=>{i.current!==null&&(window.clearTimeout(i.current),i.current=null)},[]),c=u.useCallback((p,m)=>{if(o.current!==p){if(o.current=p,m){r(p);return}u.startTransition(()=>r(p))}},[]),d=u.useCallback(()=>{i.current===null&&(i.current=window.setTimeout(()=>{i.current=null,c(a.current,!1)},dO(a.current.length)))},[c]);return a.current=e,u.useLayoutEffect(()=>{a.current=e,t||(l(),c(e,!0))},[l,c,e,t]),u.useEffect(()=>{a.current=e,t&&d()},[d,e,t]),u.useEffect(()=>l,[l]),n}function dO(e){return e>24e3?iO:e>8e3?sO:oO}function cC(e){return(e.display_name||e.name).split(/\s+/).filter(Boolean).slice(0,2).map(n=>{var r;return(r=n[0])==null?void 0:r.toUpperCase()}).join("")||e.name.slice(0,2).toUpperCase()}function uC(e){return(e.display_name||e.name).split(/\s+/).filter(Boolean).slice(0,2).map(n=>{var r;return(r=n[0])==null?void 0:r.toUpperCase()}).join("")||e.name.slice(0,2).toUpperCase()}function dC(e,t,n=[]){if(!e||t.length===0&&n.length===0)return e?[{kind:"text",text:e}]:[];const r=new Map(t.filter(d=>d.installed).map(d=>[d.name.toLowerCase(),d])),a=new Map(n.filter(d=>d.installed&&d.configured).map(d=>[d.name.toLowerCase(),d]));if(r.size===0&&a.size===0)return[{kind:"text",text:e}];const o=[],i=/(^|[\s([{])@([a-z0-9_-]+)\b/gi;let l=0,c;for(;(c=i.exec(e))!==null;){const d=c[1]??"",p=c[2]??"",m=p.toLowerCase(),f=r.get(m),h=f?null:a.get(m);if(!f&&!h)continue;const y=c.index+d.length,x=y+p.length+1;y>l&&o.push({kind:"text",text:e.slice(l,y)}),f?o.push({kind:"cli",text:e.slice(y,x),app:f}):h&&o.push({kind:"mcp",text:e.slice(y,x),preset:h}),l=x}return la.kind==="cli"||a.kind==="mcp")?s.jsx(s.Fragment,{children:r.map((a,o)=>a.kind==="text"?s.jsx("span",{children:a.text},`text-${o}`):a.kind==="cli"?s.jsx(pC,{app:a.app,label:a.text,variant:"message"},`cli-${a.app.name}-${o}`):s.jsx(mC,{preset:a.preset,label:a.text,variant:"message"},`mcp-${a.preset.name}-${o}`))}):s.jsx(s.Fragment,{children:e})}function pC({app:e,label:t,variant:n,isHero:r=!1}){const[a,o]=u.useState(0),i=e.brand_color||"hsl(var(--primary))",l=t.startsWith("@")?t.slice(1):t,d=u.useMemo(()=>ao(e.logo_url),[e.logo_url])[a],p=!!d,m=n==="composer"?"composer":"message";return u.useEffect(()=>o(0),[e.logo_url]),s.jsxs("span",{"data-testid":`${m}-cli-mention-${e.name}`,title:`CLI app: ${e.display_name||e.name}`,className:"relative inline transition-[color,text-shadow] duration-150",style:{color:i,textShadow:`0 0 10px ${fC(i,24)}`},children:[s.jsxs("span",{className:A("relative inline-block",p&&"text-transparent"),style:{lineHeight:"inherit"},children:["@",p?s.jsx("span",{"data-testid":`${m}-cli-mention-logo-${e.name}`,className:A("absolute left-1/2 top-1/2 grid place-items-center overflow-hidden rounded-[3px]","-translate-x-1/2 -translate-y-1/2",r?"h-[0.74em] w-[0.74em]":"h-[0.72em] w-[0.72em]"),children:s.jsx("img",{src:d??"",alt:"",className:"h-full w-full object-contain",onError:()=>o(f=>f+1)})}):null]}),l]})}function mC({preset:e,label:t,variant:n,isHero:r=!1}){const[a,o]=u.useState(0),i=e.brand_color||"hsl(var(--primary))",l=t.startsWith("@")?t.slice(1):t,d=u.useMemo(()=>ao(e.logo_url),[e.logo_url])[a],p=!!d,m=n==="composer"?"composer":"message";return u.useEffect(()=>o(0),[e.logo_url]),s.jsxs("span",{"data-testid":`${m}-mcp-mention-${e.name}`,title:`MCP server: ${e.display_name||e.name}`,className:"relative inline transition-[color,text-shadow] duration-150",style:{color:i,textShadow:`0 0 10px ${fC(i,24)}`},children:[s.jsxs("span",{className:A("relative inline-block",p&&"text-transparent"),style:{lineHeight:"inherit"},children:["@",p?s.jsx("span",{"data-testid":`${m}-mcp-mention-logo-${e.name}`,className:A("absolute left-1/2 top-1/2 grid place-items-center overflow-hidden rounded-[3px]","-translate-x-1/2 -translate-y-1/2",r?"h-[0.74em] w-[0.74em]":"h-[0.72em] w-[0.72em]"),children:s.jsx("img",{src:d??"",alt:"",className:"h-full w-full object-contain",onError:()=>o(f=>f+1)})}):null]}),l]})}function fC(e,t){if(/^#[0-9a-f]{6}$/i.test(e)){const n=Math.round(t/100*255).toString(16).padStart(2,"0");return`${e}${n}`}return`color-mix(in srgb, ${e} ${t}%, transparent)`}function mO({isHero:e,disabled:t,scope:n,defaultScope:r,controls:a,error:o,onChange:i}){const{t:l}=se(),[c,d]=u.useState(!1),[p,m]=u.useState(""),[f,h]=u.useState(null),[y,x]=u.useState(!1),b=z5(n,r),v=b?b.project_name||Vo(b.project_path):l("thread.composer.workspace.projectPlaceholder"),g=e&&!!r&&!!i&&(a==null?void 0:a.can_change_project)!==!1,w=ka(),k=!!w;u.useEffect(()=>{c&&(m((b==null?void 0:b.project_path)??""),h(null))},[b==null?void 0:b.project_path,c]),u.useEffect(()=>{o&&g&&d(!0)},[o,g]);const C=u.useCallback((N,P)=>{const L=n??r,_=N.trim();if(!(!L||!i)){if(!_||!F5(_)){h(l("workspace.dialog.absolutePathRequired"));return}i({...L,project_path:_,project_name:P||Vo(_),restrict_to_workspace:L.access_mode==="restricted"}),h(null),d(!1)}},[r,i,n,l]),j=u.useCallback(async()=>{if(!(!w||t)){x(!0);try{const N=await w.pickFolder();N&&C(N)}catch(N){h(N.message)}finally{x(!1)}}},[C,t,w]);return!g||!r||!i?null:k?s.jsxs("div",{className:"flex min-w-0 items-center rounded-b-[28px] border-t border-border/25 bg-muted/60 px-3 py-1.5 dark:bg-white/[0.055] sm:px-4",children:[s.jsxs("button",{type:"button",disabled:t||y,"aria-label":l("thread.composer.workspace.projectAria"),title:b==null?void 0:b.project_path,onClick:()=>void j(),className:A("inline-flex h-7 max-w-full items-center gap-2 rounded-full px-2.5 sm:max-w-[18rem]","text-[12px] font-medium text-muted-foreground/90 transition-colors","hover:bg-background/70 hover:text-foreground disabled:pointer-events-none disabled:opacity-55",b&&"text-foreground/82"),children:[s.jsx(ai,{className:A("h-3.5 w-3.5 shrink-0",b&&"text-primary")}),s.jsx("span",{className:"truncate",children:v})]}),f||o?s.jsx("span",{role:"alert",className:"ml-2 min-w-0 truncate text-[11.5px] font-medium text-destructive",children:f??o}):null]}):s.jsx("div",{className:"flex min-w-0 items-center rounded-b-[28px] border-t border-border/25 bg-muted/60 px-3 py-1.5 dark:bg-white/[0.055] sm:px-4",children:s.jsxs(mn,{open:c,onOpenChange:d,children:[s.jsx(fn,{asChild:!0,children:s.jsxs("button",{type:"button",disabled:t,"aria-label":l("thread.composer.workspace.projectAria"),className:A("inline-flex h-7 max-w-full items-center gap-2 rounded-full px-2.5 sm:max-w-[18rem]","text-[12px] font-medium text-muted-foreground/90 transition-colors","hover:bg-background/70 hover:text-foreground disabled:pointer-events-none disabled:opacity-55",b&&"text-foreground/82"),children:[s.jsx(ai,{className:A("h-3.5 w-3.5 shrink-0",b&&"text-primary")}),s.jsx("span",{className:"truncate",children:v}),s.jsx(rr,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"})]})}),s.jsxs(an,{align:"start",side:"bottom",sideOffset:8,className:"w-[min(25rem,calc(100vw-2rem))] rounded-[22px]",children:[s.jsxs(ut,{onSelect:()=>C(r.project_path,r.project_name),className:"flex min-h-[48px] cursor-default gap-3 rounded-[16px] px-3 py-2.5 focus:bg-muted/55",children:[s.jsx("span",{className:"grid h-8 w-8 shrink-0 place-items-center rounded-[12px] bg-muted text-foreground/80",children:s.jsx(ai,{className:"h-4 w-4"})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-[13px] font-semibold text-foreground",children:l("workspace.dialog.defaultProject")}),s.jsx("span",{className:"block truncate text-[11.5px] text-muted-foreground",children:c1(r.project_path)})]}),b?null:s.jsx(jt,{className:"h-4 w-4 text-foreground/80"})]}),s.jsx("div",{className:"my-1 h-px bg-border/45"}),s.jsxs("div",{className:"space-y-1.5 px-1.5 py-1.5",onKeyDown:N=>{N.key!=="Escape"&&N.stopPropagation()},children:[s.jsxs("form",{className:"flex items-center gap-2",onSubmit:N=>{N.preventDefault(),C(p)},children:[s.jsx(qe,{value:p,disabled:t,onChange:N=>{m(N.target.value),h(null)},placeholder:l("workspace.dialog.manualPlaceholder"),"aria-label":l("workspace.dialog.manual"),className:A("h-9 rounded-full border-border/55 bg-background/80 px-3 text-[12.5px]","focus-visible:ring-1 focus-visible:ring-foreground/10 focus-visible:ring-offset-0")}),s.jsx(fe,{type:"submit",disabled:t||!p.trim(),className:"h-9 shrink-0 rounded-full px-3 text-[12px]",children:l("workspace.dialog.usePath")})]}),f||o?s.jsx("p",{role:"alert",className:"px-1 text-[11.5px] font-medium text-destructive",children:f??o}):null]})]})]})})}function fO({scope:e,disabled:t,canUseFullAccess:n,isHero:r,onChange:a}){const{t:o}=se(),i=e.access_mode,l=i==="full",c=d=>{d==="full"&&!n||d!==i&&(a==null||a(O5(e,d)))};return s.jsxs(mn,{children:[s.jsx(fn,{asChild:!0,disabled:t||!a,children:s.jsxs(fe,{type:"button",variant:"ghost","aria-label":o("thread.composer.workspace.accessAria"),className:A("max-w-[min(12.5rem,42vw)] rounded-[10px] border border-transparent font-semibold shadow-none",r?"h-8 px-2.5 text-[12px]":"h-9 px-3 text-[12.5px]",l?"bg-transparent text-orange-600 hover:bg-orange-500/8 dark:text-orange-300 dark:hover:bg-orange-400/10":"bg-transparent text-muted-foreground hover:bg-foreground/[0.045] hover:text-foreground dark:hover:bg-white/[0.06]"),children:[l?s.jsx(qp,{className:A("mr-1.5 shrink-0","h-3.5 w-3.5")}):s.jsx(pg,{className:A("mr-1.5 shrink-0","h-3.5 w-3.5")}),s.jsx("span",{className:"truncate",children:o(l?"thread.composer.workspace.full":"thread.composer.workspace.default")}),s.jsx(rr,{className:A("ml-1.5 shrink-0","h-3 w-3")})]})}),s.jsxs(an,{align:"start",className:"w-56",children:[s.jsx(Vv,{icon:s.jsx(pg,{className:"h-4 w-4"}),label:o("thread.composer.workspace.default"),selected:i==="restricted",onSelect:()=>c("restricted")}),s.jsx(Vv,{icon:s.jsx(qp,{className:"h-4 w-4"}),label:o("thread.composer.workspace.full"),selected:i==="full",disabled:!n,warning:!0,onSelect:()=>c("full")})]})]})}function hO({knowledgeBases:e,selectedKnowledgeBaseId:t,disabled:n,onChange:r}){const{t:a}=se(),o=e.find(l=>l.knowledge_base_id===t)??null,i=(o==null?void 0:o.title)||(o==null?void 0:o.knowledge_base_id)||a("thread.composer.knowledgeBase.all",{defaultValue:"Knowledge Base"});return s.jsxs(mn,{children:[s.jsx(fn,{asChild:!0,disabled:n||!r,children:s.jsxs(fe,{type:"button",variant:"ghost","aria-label":a("thread.composer.knowledgeBase.aria",{defaultValue:"Select knowledge base"}),className:"h-8 max-w-[min(14rem,42vw)] rounded-[10px] border border-transparent px-2.5 text-[12px] font-semibold text-muted-foreground shadow-none hover:bg-foreground/[0.045] hover:text-foreground dark:hover:bg-white/[0.06]",children:[s.jsx(ri,{className:"mr-1.5 h-3.5 w-3.5 shrink-0"}),s.jsx("span",{className:"truncate",children:i}),s.jsx(rr,{className:"ml-1.5 h-3 w-3 shrink-0"})]})}),s.jsxs(an,{align:"start",className:"w-72",children:[s.jsxs(ut,{onSelect:()=>r==null?void 0:r(null),className:"flex min-h-[42px] items-center gap-3 rounded-xl px-3 text-[13px] font-medium",children:[s.jsx(ri,{className:"h-4 w-4 shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:a("thread.composer.knowledgeBase.all",{defaultValue:"No knowledge base"})}),t?null:s.jsx(jt,{className:"h-4 w-4 shrink-0"})]}),e.map(l=>s.jsxs(ut,{onSelect:()=>r==null?void 0:r(l.knowledge_base_id),className:"flex min-h-[42px] items-center gap-3 rounded-xl px-3 text-[13px] font-medium",children:[s.jsx(ri,{className:"h-4 w-4 shrink-0"}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate",children:l.title||l.knowledge_base_id}),s.jsxs("span",{className:"block truncate text-[11px] text-muted-foreground",children:[l.meeting_count," meetings"]})]}),t===l.knowledge_base_id?s.jsx(jt,{className:"h-4 w-4 shrink-0"}):null]},l.knowledge_base_id))]})]})}function Vv({icon:e,label:t,selected:n,disabled:r,warning:a,onSelect:o}){return s.jsxs(ut,{disabled:r,onSelect:o,className:A("flex h-10 items-center gap-3 rounded-xl px-3 text-[13.5px] font-semibold",a&&"text-orange-600 focus:text-orange-600 dark:text-orange-300 dark:focus:text-orange-300"),children:[s.jsx("span",{className:"grid h-5 w-5 shrink-0 place-items-center text-current","aria-hidden":!0,children:e}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),n?s.jsx(jt,{className:"h-4 w-4 shrink-0","aria-hidden":!0}):null]})}const hC=6*1024*1024,gO=2048,vO=.85,xO=new Set(["image/jpeg","image/webp"]),Kv=new Set(["image/png","image/jpeg","image/webp","image/gif"]);function yO(e){if(e.length>=8&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71&&e[4]===13&&e[5]===10&&e[6]===26&&e[7]===10)return"image/png";if(e.length>=3&&e[0]===255&&e[1]===216&&e[2]===255)return"image/jpeg";if(e.length>=6&&e[0]===71&&e[1]===73&&e[2]===70&&e[3]===56&&e[5]===97&&(e[4]===55||e[4]===57))return"image/gif";if(e.length>=12){const t=e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70,n=e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80;if(t&&n)return"image/webp"}return null}function gC(e){const t=new Uint8Array(e);let n="";const r=32768;for(let a=0;ahC)return{error:"too_large_after_normalize"};const p=await d.arrayBuffer();return{dataUrl:`data:${n};base64,${gC(p)}`,mime:n,bytes:d.size}}catch{try{r.close()}catch{}return{error:"decode_failed"}}}async function vC(e){const{id:t,file:n}=e,r=n.size;let a;try{a=await n.arrayBuffer()}catch{return{id:t,ok:!1,reason:"io"}}const o=new Uint8Array(a.slice(0,12)),i=yO(o);if(!i)return{id:t,ok:!1,reason:"magic_mismatch"};if(!Kv.has(i))return{id:t,ok:!1,reason:"invalid_mime"};if(n.type&&Kv.has(n.type)&&n.type,r<=hC){const c=`data:${i};base64,${gC(a)}`;return{id:t,ok:!0,dataUrl:c,mime:i,bytes:r,origBytes:r,normalized:!1}}const l=await wO(n,i);return"error"in l?{id:t,ok:!1,reason:l.error}:{id:t,ok:!0,dataUrl:l.dataUrl,mime:l.mime,bytes:l.bytes,origBytes:r,normalized:!0}}typeof self<"u"&&typeof self.importScripts=="function"&&self.addEventListener("message",async e=>{const t=await vC(e.data);self.postMessage(t)});let lr=null,Gv=!1;const Eo=new Map;function kO(){if(Gv)return lr;if(Gv=!0,typeof Worker>"u")return null;try{return lr=new Worker(new URL("/assets/imageEncode.worker-Cs1P3eq4.js",import.meta.url),{type:"module"}),lr.addEventListener("message",e=>{const t=Eo.get(e.data.id);t&&(Eo.delete(e.data.id),t.resolve(e.data))}),lr.addEventListener("error",e=>{for(const[,t]of Eo)t.reject(new Error(`image encoder worker error: ${e.message}`));Eo.clear(),lr==null||lr.terminate(),lr=null}),lr}catch{return lr=null,null}}function CO(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`img-${Date.now()}-${Math.random().toString(36).slice(2)}`}async function SO(e){const t=CO(),n=kO();return n?new Promise((r,a)=>{Eo.set(t,{resolve:r,reject:a});try{n.postMessage({id:t,file:e})}catch(o){Eo.delete(t),a(o instanceof Error?o:new Error(String(o)))}}):vC({id:t,file:e})}const Ko=4,Yv=new Set(["image/png","image/jpeg","image/webp","image/gif"]);function xC(e){const t=/^data:([^;,]+)[;,]/.exec(e);return(t==null?void 0:t[1])||"image/png"}function NO(e,t){const n=xC(e),r=`image.${n.split("/")[1]||"png"}`;try{const[,a=""]=e.split(",",2),o=atob(a),i=new Uint8Array(o.length);for(let l=0;l{t(f=>{const h=f.map(y=>y.id===p?{...y,...m}:y);return n.current=h,h})},[]),a=u.useCallback(p=>{const m=[],f=[];let h=Ko-n.current.length;for(const y of p){if(!Yv.has(y.type)){m.push({file:y,reason:"unsupported_type"});continue}if(h<=0){m.push({file:y,reason:"too_many_images"});continue}h-=1,f.push({id:Qv(),file:y,previewUrl:URL.createObjectURL(y),status:"encoding"})}if(f.length>0){const y=[...n.current,...f];n.current=y,t(y);for(const x of f)queueMicrotask(()=>{SO(x.file).then(b=>{b.ok?r(x.id,{status:"ready",dataUrl:b.dataUrl,encodedBytes:b.bytes,normalized:b.normalized}):r(x.id,{status:"error",error:jO(b.reason)})},()=>{r(x.id,{status:"error",error:"decode_failed"})})})}return{rejected:m}},[r]),o=u.useCallback(p=>{let m=null;return t(f=>{const h=f.findIndex(v=>v.id===p);if(h===-1)return f;const y=f[h];try{URL.revokeObjectURL(y.previewUrl)}catch{}const x=[...f.slice(0,h),...f.slice(h+1)];n.current=x;const b=x[h]??x[h-1];return m=(b==null?void 0:b.id)??null,x}),{nextFocusId:m}},[]),i=u.useCallback(()=>{t(p=>{for(const m of p)try{URL.revokeObjectURL(m.previewUrl)}catch{}return n.current=[],[]})},[]),l=u.useCallback(p=>{const m=p.filter(f=>Yv.has(xC(f.dataUrl))).slice(0,Ko).map(f=>{const h=NO(f.dataUrl,f.name);return{id:Qv(),file:h,previewUrl:f.dataUrl,status:"ready",dataUrl:f.dataUrl,encodedBytes:h.size}});t(f=>{for(const h of f)try{URL.revokeObjectURL(h.previewUrl)}catch{}return n.current=m,m})},[]);u.useEffect(()=>()=>{for(const p of n.current)try{URL.revokeObjectURL(p.previewUrl)}catch{}},[]);const c=e.some(p=>p.status==="encoding"),d=e.length>=Ko;return{images:e,enqueue:a,remove:o,clear:i,restoreReadyImages:l,encoding:c,full:d}}function _O(e){const t=e.clipboardData??e.clipboardData;if(!t)return[];const n=[];for(const r of Array.from(t.items)){if(r.kind!=="file"||!r.type.startsWith("image/"))continue;const a=r.getAsFile();a&&n.push(a)}return n}function PO(e){const t=e.dataTransfer??e.dataTransfer;if(!t)return[];const n=[];for(const r of Array.from(t.files))r.type.startsWith("image/")&&n.push(r);return n}function TO(e){const[t,n]=u.useState(!1),r=u.useRef(0),a=u.useCallback(d=>{const p=_O(d);p.length!==0&&(d.preventDefault(),e(p))},[e]),o=u.useCallback(d=>{Array.from(d.dataTransfer.types??[]).includes("Files")&&(d.preventDefault(),r.current+=1,n(!0))},[]),i=u.useCallback(d=>{Array.from(d.dataTransfer.types??[]).includes("Files")&&(d.preventDefault(),d.dataTransfer.dropEffect="copy")},[]),l=u.useCallback(d=>{Array.from(d.dataTransfer.types??[]).includes("Files")&&(d.preventDefault(),r.current=Math.max(0,r.current-1),r.current===0&&n(!1))},[]),c=u.useCallback(d=>{r.current=0,n(!1);const p=PO(d);p.length!==0&&(d.preventDefault(),e(p))},[e]);return{isDragging:t,onPaste:a,onDragEnter:o,onDragOver:i,onDragLeave:l,onDrop:c}}const RO=12e4,MO=650,EO=1100,IO=140,LO=64,yC=3,Xv=7,DO=34,Go=.018,Jv=Array.from({length:LO},()=>yC),OO=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus"];function FO({disabled:e,onClearError:t,onError:n,onTranscript:r,onTranscribeAudio:a}){const o=u.useRef(null),i=u.useRef([]),l=u.useRef(null),c=u.useRef(null),d=u.useRef(0),p=u.useRef(null),m=u.useRef(null),f=u.useRef(null),h=u.useRef(!1),y=u.useRef(!1),x=u.useRef(!1),b=u.useRef(!1),v=u.useRef(null),g=u.useRef(!1),w=u.useRef(!1),k=u.useRef(0),C=u.useRef(!1),j=u.useRef(!1),[N,P]=u.useState("idle"),[L,_]=u.useState(0),[T,R]=u.useState(Jv),D=u.useCallback(()=>xo(m),[]),K=u.useCallback(()=>xo(v),[]),G=u.useCallback(()=>{K(),b.current=!0,v.current=setTimeout(()=>{b.current=!1,v.current=null},500)},[K]),W=u.useCallback(()=>{const O=c.current;c.current=null,O&&(O.frame!==null&&cancelAnimationFrame(O.frame),O.source.disconnect(),O.analyser.disconnect(),O.context.close().catch(()=>{}))},[]),H=u.useCallback(O=>{const te=UO();if(te){W(),R(Jv);try{const ie=new te,ve=ie.createMediaStreamSource(O),me=ie.createAnalyser();me.fftSize=256,me.smoothingTimeConstant=.68,ve.connect(me);const Z={analyser:me,context:ie,data:new Uint8Array(me.fftSize),frame:null,source:ve},ke=()=>{const ye=c.current;if(!ye)return;if(ye.context.state!=="running"){ye.context.resume().catch(()=>{}),ye.frame=requestAnimationFrame(ke);return}ye.analyser.getByteTimeDomainData(ye.data);const be=BO(ye.data);C.current=!0,w.current=!0,k.current=Math.max(k.current,be),be>=Go&&(D(),j.current&&(j.current=!1,t())),R(Ie=>[...Ie.slice(1),HO(be)]),ye.frame=requestAnimationFrame(ke)};c.current=Z,ie.resume().catch(()=>{}),Z.frame=requestAnimationFrame(ke)}catch{W()}}},[D,t,W]),E=u.useCallback(()=>{var O;xo(f),D(),xo(p),W(),(O=l.current)==null||O.getTracks().forEach(te=>te.stop()),l.current=null,o.current=null,y.current=!1,g.current=!1,j.current=!1},[D,W]),F=u.useCallback(()=>{const O=o.current;!O||O.state==="inactive"||O.stop()},[]),X=u.useCallback(()=>{const O=o.current;O&&O.state!=="inactive"?F():y.current&&(x.current=!0)},[F]),Q=u.useCallback(async()=>{var O;if(!(!a||N!=="idle"||y.current)){if(!((O=navigator.mediaDevices)!=null&&O.getUserMedia)||typeof MediaRecorder>"u"){n("unsupported");return}y.current=!0;try{const te=await navigator.mediaDevices.getUserMedia({audio:!0}),ie=new MediaRecorder(te,zO());i.current=[],l.current=te,o.current=ie,d.current=Date.now(),w.current=!1,k.current=0,C.current=!1,j.current=!1,_(0),H(te),ie.ondataavailable=ve=>{ve.data.size>0&&i.current.push(ve.data)},ie.onstop=()=>{const ve=i.current.splice(0),me=Math.max(0,Date.now()-d.current),Z=ie.mimeType||"audio/webm",ke=C.current&&w.current&&k.currenta(ye,{durationMs:me})).then(r).catch(ye=>n(qO(ye))).finally(()=>P("idle"))},ie.start(),P("recording"),t(),p.current=setTimeout(F,RO),m.current=setTimeout(()=>{var me;!(((me=o.current)==null?void 0:me.state)==="recording")||!C.current||!w.current||k.current>=Go||(j.current=!0,n("noInput"))},EO)}catch{E(),P("idle"),n("permission")}}},[E,t,n,a,r,H,N,F]),re=u.useCallback(()=>{x.current=!1,Q().then(()=>{x.current&&(x.current=!1,F())})},[Q,F]),ue=u.useCallback(O=>{if(!(O.pointerType==="mouse"&&O.button!==0)&&!(!a||e||N!=="idle")){xo(f);try{O.currentTarget.setPointerCapture(O.pointerId)}catch{}f.current=setTimeout(()=>{f.current=null,h.current=!0,G(),re()},IO)}},[e,a,re,N,G]),pe=u.useCallback(()=>{const O=h.current;xo(f),O&&(h.current=!1,G(),X())},[X,G]),ce=u.useCallback(()=>{if(b.current){K(),b.current=!1;return}N==="recording"?F():Q()},[K,Q,N,F]),z=u.useCallback(()=>{!a||e||N!=="idle"||g.current||(g.current=!0,re())},[e,a,re,N]),q=u.useCallback(()=>{g.current&&(g.current=!1,X())},[X]);return u.useEffect(()=>{if(N!=="recording"){_(0);return}const O=()=>{_(Math.max(0,Date.now()-d.current))};O();const te=window.setInterval(O,250);return()=>window.clearInterval(te)},[N]),u.useEffect(()=>E,[E]),u.useEffect(()=>()=>K(),[K]),{beginShortcutHold:z,beginPress:ue,buttonDisabled:e||N==="transcribing",elapsedLabel:$O(L),endShortcutHold:q,endPress:pe,handleClick:ce,isRecording:N==="recording",levels:T,state:N}}function xo(e){e.current!==null&&(clearTimeout(e.current),e.current=null)}function zO(){if(typeof MediaRecorder>"u")return;const e=OO.find(t=>MediaRecorder.isTypeSupported(t));return e?{mimeType:e}:void 0}function $O(e){const t=Math.max(0,Math.floor(e/1e3));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function UO(){if(!(typeof window>"u"))return window.AudioContext??window.webkitAudioContext}function BO(e){if(e.length===0)return 0;let t=0;for(let r=0;r{const r=new FileReader;r.onload=()=>{typeof r.result=="string"?t(r.result):n(new Error("invalid_data_url"))},r.onerror=()=>n(r.error??new Error("read_failed")),r.readAsDataURL(e)})}function qO(e){const t=e instanceof Error?e.message:"";return t==="not_configured"?"notConfigured":t==="duration"?"tooLong":"failed"}const VO="image/png,image/jpeg,image/webp,image/gif,.md,.txt,text/markdown,text/plain",gm=6,Zv=2e5,bC="KeyD",KO="Control+Shift+D";function tc(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function GO(e){return e.code===bC&&e.ctrlKey&&e.shiftKey&&!e.altKey&&!e.metaKey}function YO(e){return e.code===bC||e.key==="Control"||e.key==="Shift"}function QO(){if(typeof navigator>"u")return"other";const e=navigator.userAgentData,t=[e==null?void 0:e.platform,navigator.platform,navigator.userAgent].filter(Boolean).join(" ").toLowerCase();return navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1||/mac|iphone|ipad|ipod/.test(t)?"apple":/win/.test(t)?"windows":/cros/.test(t)?"chromeos":/linux|x11|android/.test(t)?"linux":"other"}function XO(){switch(QO()){case"apple":return"⌃⇧D";case"chromeos":case"linux":case"windows":case"other":return"Ctrl ⇧ D"}}const JO={activity:Gb,"book-open":ri,brain:Ga,"circle-help":ff,history:r2,"rotate-cw":m2,shield:h2,sparkles:$o,square:Wp,"square-pen":xf,"undo-2":y2},ex=8,tx=288,ZO=144,wC=12,kC="nanobot.webui.slashCommandRecents",eh=5,eF="nanobot.webui.composerQueuedGuidance.v1:",CC=20,SC=4e3;function tF({ariaLabel:e,className:t,elapsedLabel:n,isHero:r,levels:a}){return s.jsxs("div",{className:A("flex min-w-0 items-center gap-2 text-neutral-700 dark:text-white",r?"h-8":"h-9",t),"aria-live":"polite","aria-label":e,children:[s.jsx("span",{className:"flex h-5 min-w-0 flex-1 items-center justify-between overflow-hidden","aria-hidden":!0,children:a.map((o,i)=>s.jsx("span",{className:"w-[2px] rounded-full bg-current opacity-85 transition-[height] duration-75 ease-linear motion-reduce:transition-none",style:{height:o}},i))}),s.jsx("span",{className:"min-w-[2.1rem] text-right text-[12px] font-medium tabular-nums text-muted-foreground",children:n})]})}function vm(e){return e.replace(/^\//,"").replace(/-/g,"_")}function nF(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(kC),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(n=>typeof n=="string").slice(0,eh):[]}catch{return[]}}function rF(e){if(!(typeof window>"u"))try{window.localStorage.setItem(kC,JSON.stringify(e.slice(0,eh)))}catch{}}function aF(e){const t=e==null?void 0:e.trim();return t?`${eF}${t}`:null}function oF(e,t){if(!e||typeof e!="object")return null;const n=e;if(typeof n.text!="string")return null;const r=n.text.trim().slice(0,SC),a=Array.isArray(n.images)?n.images.flatMap(i=>{if(!i||typeof i!="object")return[];const l=i;return typeof l.dataUrl!="string"||!l.dataUrl.startsWith("data:image/")?[]:[{dataUrl:l.dataUrl,...typeof l.name=="string"&&l.name.trim()?{name:l.name.trim()}:{}}]}).slice(0,Ko):[];return!r&&a.length===0?null:{id:typeof n.id=="string"&&n.id.trim()?n.id:`queued-prompt-restored-${t}`,text:r,...a.length>0?{images:a}:{}}}function sF(e){if(typeof window>"u")return[];try{const t=window.localStorage.getItem(e),n=t?JSON.parse(t):[];return Array.isArray(n)?n.map((r,a)=>oF(r,a)).filter(r=>r!=null).slice(0,CC):[]}catch{return[]}}function iF(e,t){if(!(typeof window>"u"))try{if(t.length===0){window.localStorage.removeItem(e);return}window.localStorage.setItem(e,JSON.stringify(t.slice(0,CC).map(n=>{var r;return{id:n.id,text:n.text.slice(0,SC),...(r=n.images)!=null&&r.length?{images:n.images.slice(0,Ko)}:{}}})))}catch{}}function lF(e){return e.map(t=>({dataUrl:t.dataUrl,name:t.file.name}))}function nx(e){if(e!=null&&e.length)return e.map(t=>({media:{data_url:t.dataUrl,...t.name?{name:t.name}:{}},preview:{url:t.dataUrl,...t.name?{name:t.name}:{}}}))}function cF(e){var n;const t=e.text.trim();return t||((n=e.images)==null?void 0:n.map(r=>r.name).filter(Boolean).join(", "))||"Image attachment"}function NC(e){return e.name.toLowerCase().endsWith(".md")||e.type==="text/markdown"?"text/markdown":"text/plain"}async function uF(e){if(e.length>gm)return{ok:!1,error:`最多添加 ${gm} 个文本附件。`};const t=[];for(const n of e){const r=await n.text();if(r.length>Zv)return{ok:!1,error:`${n.name} 过大,请控制在 ${Math.round(Zv/1e3)}KB 文本以内。`};t.push({id:`${n.name}-${n.size}-${n.lastModified}`,file:n,content:r,kind:NC(n)})}return{ok:!0,attachments:t}}function dF(e){if(typeof document>"u"||typeof e.setDragImage!="function")return;const t=document.createElement("div");t.style.position="fixed",t.style.left="-9999px",t.style.top="-9999px",t.style.width="1px",t.style.height="1px",t.style.opacity="0",document.body.appendChild(t);try{e.setDragImage(t,0,0)}catch{t.remove();return}window.setTimeout(()=>t.remove(),0)}function jC(){const e=window.visualViewport;if(!e)return{top:0,bottom:window.innerHeight,height:window.innerHeight};const t=Math.max(0,e.offsetTop),n=Math.max(0,e.height);return{top:t,bottom:t+n,height:n}}function pF(e){const t=jC();let n=t.top,r=t.bottom,a=e.parentElement;for(;a;){const o=window.getComputedStyle(a);if(/(auto|scroll|hidden|clip)/.test(o.overflowY)){const i=a.getBoundingClientRect();n=Math.max(n,i.top),r=Math.min(r,i.bottom)}a=a.parentElement}return{top:n,bottom:r}}function mF(e,t){var a,o;if(!(e!=null&&e.active))return null;const n=(a=e.ui_summary)==null?void 0:a.trim();if(n)return n;const r=(o=e.objective)==null?void 0:o.trim();return r?r.length>72?`${r.slice(0,72)}…`:r:t("thread.composer.goalStateFallback")}const fF=20,hF=10,gF=112,vF=.62;function xF(e){const t=jC(),n=e-t.top-fF-hF;return Math.min(Math.max(n,gF),Math.floor(t.height*vF))}function yF(e,t){const n=e.trim(),r=t.trim();return n&&r?`${n} --- ${r}`:r||n}function bF(e){return{name:e.name,display_name:e.display_name,category:e.category,entry_point:e.entry_point,logo_url:e.logo_url??null,brand_color:e.brand_color??null}}function wF(e){return{name:e.name,display_name:e.display_name,category:e.category,transport:e.transport,status:e.status,configured:e.configured,logo_url:e.logo_url??null,brand_color:e.brand_color??null}}function kF(){return s.jsxs("span",{className:"run-pulse-icon relative flex h-4 w-4 shrink-0 items-center justify-center","aria-hidden":!0,children:[s.jsx("span",{className:"run-pulse-icon__ring"}),s.jsx("span",{className:"run-pulse-icon__dot"})]})}function CF({startedAt:e,goalState:t}){var Q,re;const{t:n}=se(),[r,a]=u.useState(!1),o=e!=null,i=mF(t,n),l=!!(i!=null&&i.trim()),c=o||l,[d,p]=u.useState(c),[m,f]=u.useState(!1),[,h]=u.useState(0),y=u.useRef(null),x=u.useRef(null),b=u.useRef(null),v=u.useRef(null),[g,w]=u.useState(280);c&&(v.current={startedAt:e,goalState:t,stripLabel:i}),u.useEffect(()=>{if(c){p(!0),f(!1);return}if(a(!1),!d)return;f(!0);const ue=window.setTimeout(()=>{p(!1),f(!1)},180);return()=>window.clearTimeout(ue)},[c,d]),u.useEffect(()=>{if(e==null)return;const ue=window.setInterval(()=>h(pe=>pe+1),1e3);return()=>window.clearInterval(ue)},[e]);const k=c?{startedAt:e,goalState:t,stripLabel:i}:v.current,C=(k==null?void 0:k.startedAt)??null,j=k==null?void 0:k.goalState,N=(k==null?void 0:k.stripLabel)??null,P=C!=null,L=!!(N!=null&&N.trim()),_=((Q=j==null?void 0:j.objective)==null?void 0:Q.trim())??"",T=((re=j==null?void 0:j.ui_summary)==null?void 0:re.trim())??"",R=!!(c&&(j!=null&&j.active)&&(_||T)),D=_||T?yF(T,_):"";if(u.useLayoutEffect(()=>{if(!r)return;function ue(){const z=y.current;if(!z)return;const q=z.getBoundingClientRect().top;w(xF(q))}ue(),Ou();const pe=typeof ResizeObserver<"u"?new ResizeObserver(()=>ue()):null;y.current&&pe&&pe.observe(y.current);const ce=window.visualViewport;return ce==null||ce.addEventListener("resize",ue),ce==null||ce.addEventListener("scroll",ue),window.addEventListener("resize",ue),window.addEventListener("scroll",ue,!0),()=>{pe==null||pe.disconnect(),ce==null||ce.removeEventListener("resize",ue),ce==null||ce.removeEventListener("scroll",ue),window.removeEventListener("resize",ue),window.removeEventListener("scroll",ue,!0)}},[r]),u.useEffect(()=>{if(!r)return;function ue(ce){var q,O;const z=ce.target;z&&((q=x.current)!=null&&q.contains(z)||(O=b.current)!=null&&O.contains(z)||a(!1))}function pe(ce){ce.key==="Escape"&&a(!1)}return window.addEventListener("mousedown",ue),window.addEventListener("keydown",pe),()=>{window.removeEventListener("mousedown",ue),window.removeEventListener("keydown",pe)}},[r]),!d||!k)return null;const K=C!=null?Math.max(0,Math.floor(Date.now()/1e3-C)):0,G=Math.floor(K/60),W=K%60,H=G>0?`${G}:${W.toString().padStart(2,"0")}`:`${W}s`,E=P?n("thread.composer.runRuntimeTitle",{elapsed:H}):null,X=[E,L?N:null].filter(Boolean).join(" · ");return s.jsxs("div",{ref:y,className:"composer-status-strip relative z-30","data-state":m?"exit":"enter",children:[r&&R&&D?s.jsxs("div",{ref:x,id:"nanobot-goal-panel-root",role:"dialog","aria-modal":"false","aria-labelledby":"nanobot-goal-panel-title",tabIndex:-1,className:A("absolute bottom-[calc(100%+8px)] left-3 right-3 z-[50] flex max-w-none flex-col overflow-hidden","rounded-2xl border border-black/[0.08] bg-card shadow-[0_12px_40px_rgba(15,23,42,0.14)]","backdrop-blur-sm dark:border-white/[0.1] dark:shadow-[0_16px_48px_rgba(0,0,0,0.45)]"),style:{maxHeight:`${Math.round(g)}px`},children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-black/[0.06] px-3 py-2 dark:border-white/[0.08]",children:[s.jsx("h2",{id:"nanobot-goal-panel-title",className:"min-w-0 truncate text-[13px] font-semibold tracking-tight text-foreground",children:n("thread.composer.goalStateSheetTitle")}),s.jsx("button",{type:"button",className:A("inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full","text-muted-foreground transition-colors hover:bg-muted/65 hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),"aria-label":n("thread.composer.goalStateCloseAria"),onClick:()=>a(!1),children:s.jsx(vr,{className:"h-4 w-4","aria-hidden":!0})})]}),s.jsx("div",{id:"nanobot-goal-panel-scroll",className:"min-h-0 flex-1 overflow-y-auto scrollbar-thin px-3 pb-3 pt-2",children:s.jsx(Fu,{className:"max-w-none text-[13.5px] leading-relaxed text-foreground/90",children:D})})]}):null,s.jsxs("div",{className:"flex min-h-[36px] items-center gap-2 border-b border-black/[0.04] px-3 py-2 dark:border-white/[0.06]",role:"status","aria-label":X,children:[P?s.jsx(kF,{}):s.jsx(v2,{className:"h-4 w-4 shrink-0 text-primary/75","aria-hidden":!0}),s.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 text-[12px] font-medium text-foreground/75",children:[E?s.jsx("span",{className:"shrink-0",children:E}):null,E&&L?s.jsx("span",{className:"shrink-0 text-muted-foreground/45","aria-hidden":!0,children:"·"}):null,L?s.jsx("span",{className:"truncate",children:n("thread.composer.goalStateStrip",{label:N})}):null]}),R?s.jsx("button",{ref:b,type:"button",className:A("inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full","text-muted-foreground transition-colors hover:bg-muted/55 hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),"aria-expanded":r,"aria-controls":r?"nanobot-goal-panel-root":void 0,"aria-label":n("thread.composer.goalStateExpandAria"),title:n("thread.composer.goalStateExpandAria"),onClick:()=>a(ue=>!ue),children:r?s.jsx(rr,{className:"h-4 w-4","aria-hidden":!0}):s.jsx(qj,{className:"h-4 w-4","aria-hidden":!0})}):null]})]})}function rx({onSend:e,disabled:t,placeholder:n,isStreaming:r=!1,modelLabel:a=null,modelProvider:o=null,modelProviderLabel:i=null,modelNeedsSetup:l=!1,onModelBadgeClick:c,variant:d="thread",slashCommands:p=[],cliApps:m=[],mcpPresets:f=[],onStop:h,onTranscribeAudio:y,runStartedAt:x=null,goalState:b,workspaceScope:v=null,workspaceDefaultScope:g=null,workspaceControls:w=null,workspaceScopeDisabled:k=!1,workspaceError:C=null,onWorkspaceScopeChange:j,knowledgeBases:N=[],selectedKnowledgeBaseId:P=null,onKnowledgeBaseChange:L,pendingQueueKey:_=null}){const{t:T}=se(),[R,D]=u.useState(""),[K,G]=u.useState(null),[W,H]=u.useState(!1),[E,F]=u.useState(0),[X,Q]=u.useState(!1),[re,ue]=u.useState(0),[pe,ce]=u.useState(0),[z,q]=u.useState(()=>nF()),[O,te]=u.useState([]),ie=u.useRef(null),ve=u.useRef(null),me=u.useRef(null),Z=u.useRef(new Map),ke=u.useRef(0),ye=u.useRef(null),be=u.useRef(_),Ie=u.useRef(r),Pe=u.useRef(!1),Le=u.useRef(!1),Te=u.useRef(!1),[J,ee]=u.useState([]),V=d==="hero",xe=u.useMemo(XO,[]),Se=u.useMemo(()=>aF(_),[_]),De=V&&!!g&&!!j&&(w==null?void 0:w.can_change_project)!==!1;u.useEffect(()=>{Le.current=!0,te(Se?sF(Se):[])},[Se]),u.useEffect(()=>{if(Se){if(Le.current){Le.current=!1;return}iF(Se,O)}},[Se,O]);const Ve=r?T("thread.composer.placeholderStreaming"):n??T("thread.composer.placeholderThread"),{images:he,enqueue:Xe,remove:dt,clear:xt,restoreReadyImages:Ot,encoding:qn,full:Ke}=AO(),Ft=u.useCallback(S=>{const M=`thread.composer.imageRejected.${S}`;return T(M,{max:Ko})},[T]),He=u.useCallback(S=>{if(S.length===0)return;const{rejected:M}=Xe(S);M.length>0?G(Ft(M[0].reason)):G(null)},[Xe,Ft]),{isDragging:Re,onPaste:kr,onDragEnter:or,onDragOver:Qe,onDragLeave:Ge,onDrop:Vn}=TO(He);u.useEffect(()=>{if(t)return;const S=ie.current;if(!S)return;const M=requestAnimationFrame(()=>S.focus());return()=>cancelAnimationFrame(M)},[t]);const on=u.useMemo(()=>he.filter(S=>S.status==="ready"&&typeof S.dataUrl=="string"),[he]),Jt=he.some(S=>S.status==="error"),Dn=R.trim().length>0||on.length>0||J.length>0,Vt=!t&&!l&&!qn&&!Jt&&Dn,Je=!!(l&&c&&!t),sn=r&&!t&&!l&&!qn&&!Jt&&J.length===0&&Dn&&!R.trimStart().startsWith("/"),pt=u.useMemo(()=>{if(t||W||!R.startsWith("/"))return null;const S=R.slice(1);return/\s/.test(S)?null:S.toLowerCase()},[t,W,R]),zt=u.useMemo(()=>{const S=p.filter(U=>U.command!=="/stop");return r&&h?[p.find(U=>U.command==="/stop")??{command:"/stop",title:"Stop current task",description:"Cancel the active agent turn for this chat.",icon:"square"},...S]:S},[r,h,p]),st=u.useMemo(()=>pt===null?[]:zt.filter(M=>{const U=vm(M.command),de=T(`thread.composer.slash.commands.${U}.title`,{defaultValue:M.title}),Fe=T(`thread.composer.slash.commands.${U}.description`,{defaultValue:M.description});return[M.command,M.title,M.description,M.argHint??"",de,Fe].join(" ").toLowerCase().includes(pt)}).map(M=>{const U=vm(M.command);let Fe=T(`thread.composer.slash.commands.${U}.description`,{defaultValue:M.description}),et;return M.command==="/model"&&a?(Fe=a,et=T("thread.composer.slash.badges.current")):M.command==="/goal"?Fe=b!=null&&b.active?T("thread.composer.slash.details.goalActive"):T("thread.composer.slash.details.goalReady"):M.command==="/stop"&&r?Fe=T("thread.composer.slash.details.stopRunning"):M.command==="/history"&&(Fe=T("thread.composer.slash.details.history")),{...M,detail:Fe,badge:et,recent:z.includes(M.command)}}).sort((M,U)=>{if(r){if(M.command==="/stop")return-1;if(U.command==="/stop")return 1}if(pt!=="")return 0;const de=z.indexOf(M.command),Fe=z.indexOf(U.command);return de!==-1||Fe!==-1?de===-1?1:Fe===-1?-1:de-Fe:0}).slice(0,8),[b==null?void 0:b.active,r,a,z,pt,T,zt]),hn=st.length>0,it=u.useMemo(()=>{if(t||X)return null;const S=Math.min(Math.max(pe,0),R.length),M=R.slice(0,S),U=/(?:^|\s)@([a-z0-9_-]*)$/i.exec(M);if(!U)return null;const de=U[1].toLowerCase();return{query:de,start:S-de.length-1,end:S}},[X,pe,t,R]),$t=u.useMemo(()=>{if(!it)return[];const S=m.filter(U=>U.installed).filter(U=>[U.name,U.display_name,U.category,U.description,U.entry_point].join(" ").toLowerCase().includes(it.query)).map(U=>({kind:"cli",name:U.name,app:U})),M=f.filter(U=>U.installed&&U.configured).filter(U=>[U.name,U.display_name,U.category,U.description,U.transport].join(" ").toLowerCase().includes(it.query)).map(U=>({kind:"mcp",name:U.name,preset:U}));return[...S,...M].slice(0,8)},[it,m,f]),Cn=$t.length>0,Sn=hn||Cn,gn=u.useMemo(()=>dC(R,m,f),[m,f,R]),Nn=gn.some(S=>S.kind==="cli"||S.kind==="mcp"),Cr=u.useMemo(()=>{const S=new Set;return gn.flatMap(M=>M.kind!=="cli"||S.has(M.app.name)?[]:(S.add(M.app.name),[M.app]))},[gn]),Ut=u.useMemo(()=>{const S=new Set;return gn.flatMap(M=>M.kind!=="mcp"||S.has(M.preset.name)?[]:(S.add(M.preset.name),[M.preset]))},[gn]),[Sr,Kr]=u.useState({placement:"above",maxHeight:tx});u.useEffect(()=>{F(0)},[pt]),u.useEffect(()=>{ue(0)},[it==null?void 0:it.query]),u.useEffect(()=>{E>=st.length&&F(0)},[st.length,E]),u.useEffect(()=>{re>=$t.length&&ue(0)},[$t.length,re]),u.useEffect(()=>{if(!Sn)return;const S=M=>{var de;const U=M.target;U instanceof Node&&((de=ve.current)!=null&&de.contains(U))||(H(!0),Q(!0))};return document.addEventListener("pointerdown",S,!0),()=>{document.removeEventListener("pointerdown",S,!0)}},[Sn]),u.useLayoutEffect(()=>{if(!Sn)return;const S=()=>{const U=ve.current;if(!U)return;const de=U.getBoundingClientRect();if(de.width===0&&de.height===0)return;const Fe=pF(U),et=Math.max(0,de.top-Fe.top-ex),St=Math.max(0,Fe.bottom-de.bottom-ex),Pt=et>=ZO||et>=St?"above":"below",cl=Math.min(tx,Pt==="above"?et:St);Kr(As=>As.placement===Pt&&As.maxHeight===cl?As:{placement:Pt,maxHeight:cl})};S();const M=window.visualViewport;return M==null||M.addEventListener("resize",S),M==null||M.addEventListener("scroll",S),window.addEventListener("resize",S),document.addEventListener("scroll",S,!0),()=>{M==null||M.removeEventListener("resize",S),M==null||M.removeEventListener("scroll",S),window.removeEventListener("resize",S),document.removeEventListener("scroll",S,!0)}},[$t.length,st.length,Sn]);const Bt=u.useCallback(()=>{requestAnimationFrame(()=>{const S=ie.current;S&&(S.style.height="auto",S.style.height=`${Math.min(S.scrollHeight,260)}px`,S.focus())})},[]);u.useLayoutEffect(()=>{be.current!==_&&(be.current=_,D(""),ee([]),G(null),H(!1),Q(!1),ce(0),xt(),requestAnimationFrame(()=>{const S=ie.current;S&&(S.style.height="auto",S.style.height=`${Math.min(S.scrollHeight,260)}px`)}))},[xt,_]);const Ce=u.useCallback(S=>{const M=S.trim();M&&(D(U=>{if(!U.trim())return M;const de=/[\s\n]$/.test(U)?"":" ";return`${U}${de}${M}`}),H(!1),Q(!1),G(null),Bt())},[Bt]),we=u.useCallback(()=>G(null),[]),_t=u.useCallback(S=>{G(T(`thread.composer.voiceErrors.${S}`))},[T]),Oe=FO({disabled:t,onClearError:we,onError:_t,onTranscript:Ce,onTranscribeAudio:y});u.useEffect(()=>{if(!y)return;function S(de){!GO(de)||de.repeat||Te.current||(de.preventDefault(),Te.current=!0,Oe.beginShortcutHold())}function M(de){!Te.current||!YO(de)||(de.preventDefault(),Te.current=!1,Oe.endShortcutHold())}function U(){Te.current&&(Te.current=!1,Oe.endShortcutHold())}return window.addEventListener("keydown",S),window.addEventListener("keyup",M),window.addEventListener("blur",U),()=>{window.removeEventListener("keydown",S),window.removeEventListener("keyup",M),window.removeEventListener("blur",U)}},[y,Oe.beginShortcutHold,Oe.endShortcutHold]);const Rt=u.useCallback(S=>{if(S.command==="/stop"&&r&&h){h(),D(""),H(!0),Q(!1),G(null),Bt();return}const M=[S.command,...z.filter(U=>U!==S.command)].slice(0,eh);q(M),rF(M),D(S.argHint?`${S.command} `:S.command),H(!0),Q(!1),G(null),Bt()},[r,h,z,Bt]),yt=u.useCallback(S=>{if(!it)return;const M=R.slice(it.end),U=`@${S.name}${M.startsWith(" ")?"":" "}`,de=`${R.slice(0,it.start)}${U}${M}`,Fe=it.start+U.length;D(de),ce(Fe),Q(!0),H(!1),G(null),Bt(),requestAnimationFrame(()=>{const et=ie.current;et&&(et.focus(),et.setSelectionRange(Fe,Fe))})},[it,Bt,R]),lt=u.useCallback(()=>{D(""),G(null),H(!1),Q(!1),ce(0),Bt()},[Bt]),nt=u.useCallback(()=>{const S=R.trim();if(!sn||!S&&on.length===0)return;const M=lF(on);ke.current+=1,te(U=>[...U,{id:`queued-prompt-${Date.now()}-${ke.current}`,text:S,...M.length>0?{images:M}:{}}]),xt(),lt()},[sn,xt,lt,on,R]),Ze=u.useCallback(S=>{te(M=>M.filter(U=>U.id!==S)),requestAnimationFrame(()=>{var M;return(M=ie.current)==null?void 0:M.focus()})},[]),vn=u.useCallback(S=>{var M;te(U=>U.filter(de=>de.id!==S.id)),D(S.text),G(null),H(!1),Q(!1),ce(S.text.length),(M=S.images)!=null&&M.length?Ot(S.images):xt(),Bt(),requestAnimationFrame(()=>{const U=ie.current;U&&(U.focus(),U.setSelectionRange(S.text.length,S.text.length))})},[xt,Bt,Ot]),Kt=u.useCallback((S,M)=>{S!==M&&te(U=>{const de=U.findIndex(Pt=>Pt.id===S),Fe=U.findIndex(Pt=>Pt.id===M);if(de===-1||Fe===-1)return U;const et=[...U],[St]=et.splice(de,1);return et.splice(Fe,0,St),et})},[]),ln=u.useCallback(S=>{const M=S.text.trim(),U=nx(S.images);te(de=>de.filter(Fe=>Fe.id!==S.id)),(M||U!=null&&U.length)&&(U!=null&&U.length?e(M,U):e(M)),requestAnimationFrame(()=>{var de;return(de=ie.current)==null?void 0:de.focus()})},[e]),Mt=u.useCallback(()=>{if(O.length===0)return;const S=O.find(U=>U.text.trim());if(!S){te([]);return}te(U=>U.filter(de=>de.id!==S.id));const M=nx(S.images);M!=null&&M.length?e(S.text.trim(),M):e(S.text.trim()),requestAnimationFrame(()=>{var U;return(U=ie.current)==null?void 0:U.focus()})},[e,O]);u.useEffect(()=>{const S=Ie.current;if(Ie.current=r,!(!S||r||O.length===0)){if(Pe.current){Pe.current=!1;return}Mt()}},[Mt,r,O.length]);const Nr=u.useCallback(()=>{O.length>0&&(Pe.current=!0),h==null||h()},[h,O.length]),Et=u.useCallback(()=>{if(l){c==null||c();return}if(!Vt)return;const M=R.trim(),U=on.length>0?on.map(jn=>({media:{data_url:jn.dataUrl,name:jn.file.name},preview:{url:jn.dataUrl,name:jn.file.name}})):void 0,de=Cr.map(bF),Fe=Ut.map(wF),et=J.map(jn=>({name:jn.file.name,content:jn.content,kind:jn.kind})),St=J.map(jn=>({kind:"file",name:jn.file.name})),Pt=de.length>0||Fe.length>0||et.length>0?{...de.length>0?{cliApps:de}:{},...Fe.length>0?{mcpPresets:Fe}:{},...et.length>0?{attachments:et,attachmentMedia:St}:{}}:void 0;e(M,U,Pt),te([]),ee([]),xt(),lt()},[Cr,Ut,Vt,xt,lt,l,c,e,on,J,R]),io=S=>{if(Cn){if(S.key==="ArrowDown"){S.preventDefault(),ue(M=>(M+1)%$t.length);return}if(S.key==="ArrowUp"){S.preventDefault(),ue(M=>(M-1+$t.length)%$t.length);return}if(S.key==="Tab"||S.key==="Enter"&&!S.shiftKey){S.preventDefault(),yt($t[re]);return}if(S.key==="Escape"){S.preventDefault(),Q(!0);return}}if(hn){if(S.key==="ArrowDown"){S.preventDefault(),F(M=>(M+1)%st.length);return}if(S.key==="ArrowUp"){S.preventDefault(),F(M=>(M-1+st.length)%st.length);return}if(S.key==="Tab"||S.key==="Enter"&&!S.shiftKey){S.preventDefault(),Rt(st[E]);return}if(S.key==="Escape"){S.preventDefault(),H(!0);return}}if(S.key==="Enter"&&!S.shiftKey&&!S.nativeEvent.isComposing){if(S.preventDefault(),sn){nt();return}Et()}},jr=S=>{const M=S.currentTarget;M.style.height="auto",M.style.height=`${Math.min(M.scrollHeight,260)}px`},lo=u.useCallback(async S=>{if(S.length===0)return;const M=await uF(S);if(!M.ok){G(M.error);return}ee(U=>{const de=[...U];for(const Fe of M.attachments)if(!de.some(et=>et.id===Fe.id)){if(de.length>=gm)break;de.push(Fe)}return de}),G(null)},[]),Gr=S=>{const M=Array.from(S.target.files??[]);S.target.value="";const U=M.filter(Fe=>Fe.type.startsWith("image/")),de=M.filter(Fe=>NC(Fe)!==null);U.length>0&&He(U),lo(de)},Ns=u.useCallback(S=>{ee(M=>M.filter(U=>U.id!==S)),G(null),requestAnimationFrame(()=>{var M;return(M=ie.current)==null?void 0:M.focus()})},[]),Kn=u.useCallback(S=>{const{nextFocusId:M}=dt(S);G(null),requestAnimationFrame(()=>{var de;const U=M?Z.current.get(M):null;U?U.focus():(de=ie.current)==null||de.focus()})},[dt]),co=u.useCallback(S=>M=>{(M.key==="Delete"||M.key==="Backspace"||M.key==="Enter"||M.key===" ")&&(M.preventDefault(),Kn(S))},[Kn]),sr=t||Ke,Ue=!!y,Yr=T("thread.composer.voice.recordingStatus",{time:Oe.elapsedLabel,defaultValue:`Recording ${Oe.elapsedLabel}`}),js=Oe.state==="recording"?T("thread.composer.voice.stop"):Oe.state==="transcribing"?T("thread.composer.voice.transcribing"):T("thread.composer.tools.voice"),bt=Oe.state==="recording"?T("thread.composer.voice.stop"):Oe.state==="transcribing"?T("thread.composer.voice.transcribing"):T("thread.composer.voice.hint"),On=r&&!!h,$=V&&he.length===0&&!r,B=A("w-full resize-none bg-transparent",V?A("min-h-[78px] px-4 text-[15px] leading-6 sm:px-5",$?"pb-2 pt-[27px]":"pb-1.5 pt-4"):"min-h-[50px] px-3.5 pb-1.5 pt-3 text-[13.5px] leading-5 sm:px-4");return s.jsxs("form",{ref:ve,onSubmit:S=>{S.preventDefault(),Et()},onDragEnter:or,onDragOver:Qe,onDragLeave:Ge,onDrop:Vn,className:A("relative w-full",V?"px-0":"px-1 pb-1.5 pt-1 sm:px-0"),children:[hn?s.jsx(TF,{commands:st,selectedIndex:E,layout:Sr,isHero:V,onHover:F,onChoose:Rt}):null,Cn?s.jsx(_F,{candidates:$t,selectedIndex:re,layout:Sr,isHero:V,onHover:ue,onChoose:yt}):null,s.jsxs("div",{className:A("group/composer relative mx-auto flex w-full flex-col overflow-visible transition-all duration-200","after:pointer-events-none after:absolute after:inset-[-1px] after:rounded-[inherit] after:border after:border-blue-300/75 after:opacity-0 after:transition-opacity after:duration-200 focus-within:after:opacity-100 dark:after:border-blue-400/55",V?"max-w-[58rem] rounded-[28px] border border-black/[0.035] bg-card shadow-[0_20px_55px_rgba(15,23,42,0.08)] dark:border-white/[0.06] dark:shadow-[0_24px_55px_rgba(0,0,0,0.34)]":"max-w-[49.5rem] rounded-[22px] border border-black/[0.035] bg-card shadow-[0_12px_30px_rgba(15,23,42,0.07)] dark:border-white/[0.06] dark:shadow-[0_16px_34px_rgba(0,0,0,0.28)]","focus-within:border-blue-300/75 dark:focus-within:border-blue-400/55",t&&"opacity-60",Re&&"ring-2 ring-primary/40 motion-reduce:ring-0 motion-reduce:border-primary",(b==null?void 0:b.active)&&"goal-shell-glow ring-1 ring-sky-400/35 motion-reduce:ring-sky-400/25 dark:ring-sky-400/45"),children:[O.length>0?s.jsx(SF,{prompts:O,isHero:V,label:T("thread.composer.queued.label"),guideLabel:T("thread.composer.queued.guide"),deleteLabel:T("thread.composer.queued.delete"),dragLabel:T("thread.composer.queued.drag"),editLabel:T("thread.composer.queued.edit"),onGuide:ln,onDelete:Ze,onEdit:vn,onDragStart:S=>{ye.current=S},onDragEnd:()=>{ye.current=null},onDrop:S=>{const M=ye.current;M&&Kt(M,S)}}):null,he.length>0?s.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3","aria-label":T("thread.composer.attachImage"),children:he.map(S=>s.jsx(RF,{image:S,labelRemove:T("thread.composer.remove"),labelEncoding:T("thread.composer.encoding"),normalizedHint:(M,U)=>T("thread.composer.normalizedSizeHint",{orig:tc(M),current:tc(U)}),formatError:Ft,onRemove:()=>Kn(S.id),onKeyDown:co(S.id),registerRef:M=>{M?Z.current.set(S.id,M):Z.current.delete(S.id)}},S.id))}):null,J.length>0?s.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3","aria-label":"Text attachments",children:J.map(S=>s.jsxs("button",{type:"button",onClick:()=>Ns(S.id),className:A("inline-flex items-center gap-2 rounded-[12px] border border-border/70 bg-muted/55 px-3 py-2","text-left text-[12px] text-foreground/88 transition-colors hover:bg-muted/75"),title:`${S.file.name} ${tc(S.file.size)}`,children:[s.jsx(ri,{className:"h-4 w-4 shrink-0 text-sky-600 dark:text-sky-300"}),s.jsx("span",{className:"max-w-[16rem] truncate",children:S.file.name}),s.jsx(vr,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"})]},S.id))}):null,s.jsx(CF,{startedAt:x,goalState:b}),s.jsxs("div",{className:"relative",children:[Nn?s.jsx(AF,{segments:gn,isHero:V,className:B}):null,s.jsx("textarea",{ref:ie,value:R,onChange:S=>{D(S.target.value),H(!1),Q(!1),ce(S.target.selectionStart??S.target.value.length)},onInput:jr,onKeyDown:io,onKeyUp:S=>ce(S.currentTarget.selectionStart??S.currentTarget.value.length),onSelect:S=>ce(S.currentTarget.selectionStart??S.currentTarget.value.length),onClick:S=>ce(S.currentTarget.selectionStart??S.currentTarget.value.length),onPaste:kr,rows:1,placeholder:Ve,disabled:t,"aria-label":T("thread.composer.inputAria"),className:A(B,"relative z-10 caret-foreground placeholder:text-muted-foreground/70","focus:outline-none focus-visible:outline-none","disabled:cursor-not-allowed",Nn&&"text-transparent selection:bg-primary/20")})]}),K?s.jsx("div",{role:"alert",className:A("mx-3 mb-1 rounded-md border border-destructive/40 bg-destructive/8 px-2.5 py-1","text-[11.5px] font-medium text-destructive"),children:K}):null,s.jsxs("div",{className:A("flex flex-wrap items-center justify-between gap-y-2",V?A("gap-x-1.5 px-3 sm:px-4",De?"pb-1.5":"pb-3.5"):"gap-x-2 px-2.5 pb-2 sm:px-3"),children:[s.jsxs("div",{className:A("flex min-w-0 flex-1 basis-[8rem] items-center",V?"gap-1.5":"gap-2"),children:[s.jsx("input",{ref:me,type:"file",accept:VO,multiple:!0,hidden:!0,onChange:Gr}),s.jsx(fe,{type:"button",size:"icon",variant:"ghost",disabled:sr,"aria-label":"Attach files",onClick:()=>{var S;return(S=me.current)==null?void 0:S.click()},className:A("rounded-full text-muted-foreground hover:text-foreground",V?"h-8 w-8 border border-border/55 bg-card shadow-[0_2px_8px_rgba(15,23,42,0.05)] hover:bg-card":"h-9 w-9 border border-border/55 bg-card shadow-[0_2px_8px_rgba(15,23,42,0.05)] hover:bg-card"),children:s.jsx(Ir,{className:A(V?"h-[18px] w-[18px]":"h-4 w-4")})}),Oe.isRecording?s.jsx(tF,{ariaLabel:Yr,className:"mx-1 flex-1",elapsedLabel:Oe.elapsedLabel,isHero:V,levels:Oe.levels}):v?s.jsxs(s.Fragment,{children:[s.jsx(fO,{scope:v,disabled:t||k,canUseFullAccess:(w==null?void 0:w.can_use_full_access)!==!1,isHero:V,onChange:j}),s.jsx(hO,{knowledgeBases:N,selectedKnowledgeBaseId:P,disabled:t,onChange:L})]}):null]}),s.jsxs("div",{className:A("ml-auto flex min-w-0 shrink-0 items-center",V?"gap-1.5":"gap-2"),children:[a&&!Oe.isRecording?s.jsx(jF,{label:a,provider:o,providerLabel:i,needsSetup:l,isHero:V,onClick:l?c:void 0}):null,Ue?s.jsx(Eu,{delayDuration:220,skipDelayDuration:80,children:s.jsxs(Li,{children:[s.jsx(Di,{asChild:!0,children:s.jsx(fe,{type:"button",size:"icon",variant:"ghost",disabled:Oe.buttonDisabled,"aria-label":js,"aria-keyshortcuts":KO,title:bt,onPointerDown:Oe.beginPress,onPointerUp:Oe.endPress,onPointerCancel:Oe.endPress,onClick:Oe.handleClick,className:A("rounded-full border border-transparent text-muted-foreground hover:bg-muted/65 hover:text-foreground",V?"h-8 w-8":"h-9 w-9",Oe.isRecording&&"bg-red-500 text-white shadow-[0_8px_20px_rgba(239,68,68,0.22)] hover:bg-red-500 hover:text-white"),children:Oe.state==="transcribing"?s.jsx(vt,{className:A("h-4 w-4","animate-spin")}):Oe.isRecording?s.jsx(Wp,{className:A("h-3.5 w-3.5"),fill:"currentColor"}):s.jsx(gf,{className:A("h-4 w-4")})})}),s.jsxs(is,{side:"top",align:"center",className:"flex items-center gap-2 rounded-full border border-border/70 bg-background px-3 py-1.5 text-[13px] font-medium text-foreground shadow-[0_8px_24px_rgba(15,23,42,0.13)] dark:border-white/10 dark:bg-neutral-900 dark:text-white",children:[s.jsx("span",{children:bt}),Oe.state==="idle"?s.jsx("kbd",{className:"rounded-full bg-muted px-2 py-0.5 font-sans text-[12px] font-semibold leading-none text-muted-foreground dark:bg-white/10 dark:text-white/80",children:xe}):null]})]})}):null,s.jsx(fe,{type:On||l?"button":"submit",size:"icon",disabled:On?t:!Vt&&!Je,"aria-label":On?T("thread.composer.stop"):l?T("thread.composer.configureModel",{defaultValue:"Configure model"}):T("thread.composer.send"),onClick:On?Nr:l?c:void 0,className:A("rounded-full transition-transform",On?"border border-border/70 bg-card text-foreground/85 shadow-[0_3px_10px_rgba(15,23,42,0.08)] hover:bg-muted/65 hover:text-foreground disabled:text-muted-foreground/50":V?"border border-foreground bg-foreground text-background shadow-[0_4px_12px_rgba(15,23,42,0.20)] hover:bg-foreground/90 disabled:border-foreground disabled:bg-foreground disabled:text-background":"border border-foreground bg-foreground text-background shadow-[0_3px_10px_rgba(15,23,42,0.18)] hover:bg-foreground/90 disabled:border-foreground disabled:bg-foreground disabled:text-background",V?"h-8 w-8":"h-9 w-9",(Vt||Je||On)&&"hover:scale-[1.03] active:scale-95"),children:On?s.jsx(Wp,{className:A("fill-current stroke-current",V?"h-3 w-3":"h-3.5 w-3.5")}):r?s.jsx(vt,{className:A("h-4 w-4","animate-spin")}):s.jsx(Hj,{className:A("h-4 w-4")})})]})]}),s.jsx(mO,{isHero:V,disabled:t||k,scope:v,defaultScope:g,controls:w,error:C,onChange:j})]})]})}function SF({prompts:e,isHero:t,label:n,guideLabel:r,deleteLabel:a,dragLabel:o,editLabel:i,onGuide:l,onDelete:c,onEdit:d,onDragStart:p,onDragEnd:m,onDrop:f}){const h=Math.min(240,14+e.length*34+Math.max(0,e.length-1)*4);return s.jsx("div",{role:"group","data-state":"enter",className:A("composer-status-strip relative z-20 mx-3 mt-3 overflow-hidden rounded-[18px]","border border-black/[0.05] bg-popover/90 p-1.5","shadow-[0_10px_28px_rgba(15,23,42,0.07)] backdrop-blur-md","dark:border-white/[0.08] dark:bg-popover/90 dark:shadow-[0_14px_34px_rgba(0,0,0,0.30)]","max-w-none"),style:{"--composer-strip-max-height":`${h}px`},"aria-label":n,children:s.jsx("div",{className:"flex max-h-[216px] flex-col gap-1 overflow-y-auto",children:e.map(y=>s.jsx(NF,{prompt:y,isHero:t,guideLabel:r,deleteLabel:a,dragLabel:o,editLabel:i,onGuide:l,onDelete:c,onEdit:d,onDragStart:p,onDragEnd:m,onDrop:f},y.id))})})}function NF({prompt:e,isHero:t,guideLabel:n,deleteLabel:r,dragLabel:a,editLabel:o,onGuide:i,onDelete:l,onEdit:c,onDragStart:d,onDragEnd:p,onDrop:m}){const f=cF(e);return s.jsxs("div",{"data-queued-prompt-row":"true",onDragEnter:h=>{h.preventDefault(),m(e.id)},onDragOver:h=>{h.preventDefault(),h.dataTransfer.dropEffect="move"},onDrop:h=>{h.preventDefault(),m(e.id)},onDragEnd:p,className:A("queued-prompt-row group/queued flex min-h-8 items-center gap-1.5 rounded-[12px] px-2 py-0.5","text-[13px] transition-colors hover:bg-muted/55 dark:hover:bg-white/[0.055]",t&&"text-[13.5px]"),children:[s.jsx("span",{draggable:!0,role:"button",tabIndex:0,"aria-label":a,onDragStart:h=>{h.dataTransfer.effectAllowed="move",h.dataTransfer.setData("text/plain",e.id),dF(h.dataTransfer),d(e.id)},onDragEnd:p,className:A("inline-flex h-7 w-7 shrink-0 cursor-grab items-center justify-center rounded-lg","text-muted-foreground/45 transition-colors hover:bg-background/80 hover:text-muted-foreground","active:cursor-grabbing dark:hover:bg-white/[0.06]"),children:s.jsx(t2,{className:"pointer-events-none h-3.5 w-3.5","aria-hidden":!0})}),s.jsx("div",{className:"flex min-h-7 min-w-0 flex-1 items-center",children:s.jsx("p",{title:f,className:A("line-clamp-3 whitespace-pre-wrap break-words font-medium leading-[1.28] text-foreground/88",t&&"text-[13.5px]"),children:f})}),s.jsxs(fe,{type:"button",variant:"ghost",size:"sm",className:"h-7 shrink-0 rounded-full px-2 text-[11.5px] font-medium text-muted-foreground hover:bg-muted/70 hover:text-foreground dark:hover:bg-white/[0.07]",onClick:()=>i(e),children:[s.jsx(Yj,{className:"mr-1 h-3 w-3","aria-hidden":!0}),n]}),s.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":o,title:o,className:"h-7 w-7 shrink-0 rounded-full text-muted-foreground hover:bg-background/85 hover:text-foreground dark:hover:bg-white/[0.07]",onClick:()=>c(e),children:s.jsx(xf,{className:"h-3.5 w-3.5","aria-hidden":!0})}),s.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":r,className:"h-7 w-7 shrink-0 rounded-full text-muted-foreground hover:bg-background/85 hover:text-destructive dark:hover:bg-white/[0.07]",onClick:()=>l(e.id),children:s.jsx(zr,{className:"h-3 w-3","aria-hidden":!0})})]})}function jF({label:e,provider:t,providerLabel:n,needsSetup:r,isHero:a,onClick:o}){const i=r?null:t||um(e),l=sl(i),[c,d]=u.useState(0),p=l==null?void 0:l.logoUrls[c],m=!!p,f=n?`${e} · ${n}`:e,h=!!o,y=h?"button":"span";return u.useEffect(()=>d(0),[i]),s.jsxs(y,{title:f,type:h?"button":void 0,onClick:o,className:A("inline-flex min-w-0 items-center rounded-full border border-border/55 bg-card font-medium text-foreground/82","shadow-[0_2px_8px_rgba(15,23,42,0.045)]",h&&"cursor-pointer hover:bg-accent/55 hover:text-foreground",r&&"border-amber-500/35 bg-amber-50/70 text-amber-900 dark:bg-amber-500/10 dark:text-amber-200",a?"h-8 max-w-[min(12.5rem,44vw)] gap-1.5 px-2 text-[11.5px]":"h-9 max-w-[min(12rem,44vw)] gap-2 px-2.5 text-[12px]"),children:[s.jsx("span",{"data-testid":r?"composer-model-setup-icon":i?`composer-model-logo-${i}`:"composer-model-logo",className:A("grid shrink-0 place-items-center overflow-hidden",r?"text-amber-800 dark:text-amber-200":"rounded-full border bg-background",a?"h-[18px] w-[18px]":"h-5 w-5"),style:{borderColor:!r&&l?`${l.color}28`:void 0,boxShadow:!r&&l?`inset 0 0 0 1px ${l.color}18`:void 0},"aria-hidden":!0,children:r?s.jsx(ff,{className:A(a?"h-3 w-3":"h-3.5 w-3.5"),strokeWidth:1.8}):m?s.jsx("img",{src:p,alt:"",className:A("object-contain",a?"h-3 w-3":"h-3.5 w-3.5"),onError:()=>d(x=>x+1)}):l?s.jsx("span",{className:A("grid h-full w-full place-items-center rounded-full text-white",a?"text-[7.5px]":"text-[8px]"),style:{backgroundColor:l.color},children:l.initials.slice(0,2)}):s.jsx($o,{className:A("text-muted-foreground/65","h-3 w-3")})}),s.jsx("span",{className:"truncate",children:e})]})}function AF({segments:e,isHero:t,className:n}){return s.jsx("div",{"aria-hidden":!0,className:A(n,"pointer-events-none absolute inset-0 z-0 overflow-hidden whitespace-pre-wrap break-words text-foreground"),children:e.map((r,a)=>r.kind==="text"?s.jsx("span",{children:r.text},`text-${a}`):r.kind==="cli"?s.jsx(pC,{app:r.app,label:r.text,variant:"composer",isHero:t},`cli-${r.app.name}-${a}`):s.jsx(mC,{preset:r.preset,label:r.text,variant:"composer",isHero:t},`mcp-${r.preset.name}-${a}`))})}function AC(e){const t=u.useRef(null);return u.useLayoutEffect(()=>{const n=t.current;if(!n)return;const r=n.querySelector(`[data-palette-index="${e}"]`);typeof(r==null?void 0:r.scrollIntoView)=="function"&&r.scrollIntoView({block:"nearest"})},[e]),t}function _F({candidates:e,selectedIndex:t,layout:n,isHero:r,onHover:a,onChoose:o}){const{t:i}=se(),l=Math.max(0,n.maxHeight-wC),c=AC(t);return s.jsxs("div",{role:"listbox","aria-label":i("thread.composer.mentions.ariaLabel"),style:{maxHeight:n.maxHeight},className:A("absolute left-1/2 z-30 w-[calc(100%-0.5rem)] -translate-x-1/2 overflow-hidden rounded-[22px] border",n.placement==="above"?"bottom-full mb-2":"top-full mt-2","border-border/70 bg-popover p-2 text-popover-foreground shadow-[0_20px_60px_rgba(15,23,42,0.12)]","dark:border-white/10 dark:shadow-[0_24px_60px_rgba(0,0,0,0.42)]",r?"max-w-[58rem]":"max-w-[49.5rem]"),children:[s.jsx("div",{className:"px-2 pb-1.5 pt-0.5 text-[13px] font-semibold text-muted-foreground/78",children:i("thread.composer.mentions.label")}),s.jsx("div",{ref:c,className:"overflow-y-auto",style:{maxHeight:l},children:e.map((d,p)=>{const m=p===t,f=d.name,h=d.kind==="cli"?d.app.display_name:d.preset.display_name,y=d.kind==="cli"?i("thread.composer.mentions.cliBadge"):i("thread.composer.mentions.mcpBadge"),x=d.kind==="cli"?i("thread.composer.mentions.cliDescription",{name:f}):i("thread.composer.mentions.mcpDescription",{name:f});return s.jsxs("button",{type:"button",role:"option","data-palette-index":p,"aria-selected":m,"aria-label":`${h} @${f} ${x} ${y}`,onMouseEnter:()=>a(p),onMouseDown:b=>{b.preventDefault(),o(d)},className:A("flex min-h-10 w-full items-center gap-2.5 rounded-[13px] px-2.5 py-1.5 text-left transition-colors",m?"bg-foreground/[0.055] text-foreground":"text-foreground/90 hover:bg-foreground/[0.04]"),children:[s.jsx(PF,{candidate:d,selected:m}),s.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-2",children:[s.jsx("span",{className:"min-w-0 truncate text-[15px] font-medium tracking-normal text-foreground",children:h}),s.jsxs("span",{className:"truncate text-[15px] font-normal tracking-normal text-muted-foreground/72",children:["@",f]})]}),s.jsx("span",{className:A("ml-2 shrink-0 rounded-full px-2 py-0.5 text-[11px] font-semibold tracking-normal",d.kind==="cli"?"bg-orange-500/10 text-orange-600 dark:text-orange-300":"bg-sky-500/10 text-sky-600 dark:text-sky-300"),children:y})]},`${d.kind}-${f}`)})})]})}function PF({candidate:e,selected:t}){const[n,r]=u.useState(0),a=(e.kind==="cli"?e.app.brand_color:e.preset.brand_color)||"hsl(var(--primary))",o=e.kind==="cli"?e.app.logo_url:e.preset.logo_url,l=u.useMemo(()=>ao(o),[o])[n];return u.useEffect(()=>r(0),[o]),l?s.jsx("span",{className:A("flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden rounded-[5px]",t?"bg-background/55":"bg-transparent"),children:s.jsx("img",{src:l,alt:"",className:"h-5 w-5 object-contain",onError:()=>r(c=>c+1)})}):s.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-[5px] text-[7.5px] font-semibold text-white",style:{backgroundColor:a},children:e.kind==="cli"?cC(e.app):uC(e.preset)})}function TF({commands:e,selectedIndex:t,layout:n,isHero:r,onHover:a,onChoose:o}){const{t:i}=se(),l=Math.max(0,n.maxHeight-wC),c=AC(t);return s.jsx("div",{role:"listbox","aria-label":i("thread.composer.slash.ariaLabel"),style:{maxHeight:n.maxHeight},className:A("absolute left-1/2 z-30 w-[calc(100%-0.5rem)] -translate-x-1/2 overflow-hidden rounded-[18px] border",n.placement==="above"?"bottom-full mb-2":"top-full mt-2","border-border/65 bg-popover p-1.5 text-popover-foreground shadow-[0_18px_55px_rgba(15,23,42,0.16)]","dark:border-white/10 dark:shadow-[0_22px_55px_rgba(0,0,0,0.45)]",r?"max-w-[58rem]":"max-w-[49.5rem]"),children:s.jsx("div",{ref:c,className:"overflow-y-auto pr-0.5",style:{maxHeight:l},children:e.map((d,p)=>{const m=JO[d.icon]??ff,f=p===t,h=vm(d.command),y=i(`thread.composer.slash.commands.${h}.title`,{defaultValue:d.title}),x=i(`thread.composer.slash.commands.${h}.description`,{defaultValue:d.description});return s.jsxs("button",{type:"button",role:"option","data-palette-index":p,"aria-selected":f,onMouseEnter:()=>a(p),onMouseDown:b=>{b.preventDefault(),o(d)},className:A("flex min-h-[44px] w-full items-center gap-3 rounded-[13px] px-3 py-2 text-left transition-colors",f?"bg-foreground/[0.065] text-foreground dark:bg-white/[0.09]":"text-foreground/86 hover:bg-foreground/[0.045] dark:hover:bg-white/[0.065]"),children:[s.jsx("span",{className:A("flex h-7 w-7 shrink-0 items-center justify-center text-muted-foreground transition-colors",f&&"text-foreground"),children:s.jsx(m,{className:"h-4 w-4"})}),s.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5 sm:flex-row sm:items-baseline sm:gap-2",children:[s.jsx("span",{className:"min-w-0 truncate text-[13.5px] font-semibold tracking-normal text-foreground",children:y}),s.jsx("span",{className:"min-w-0 truncate text-[13px] text-muted-foreground",children:d.detail||x})]}),s.jsxs("span",{className:"ml-2 flex max-w-[42%] shrink-0 items-center gap-1.5 sm:max-w-none",children:[d.badge||d.recent?s.jsx("span",{className:"hidden rounded-full bg-foreground/[0.055] px-2 py-1 text-[11px] font-medium text-muted-foreground sm:inline-flex",children:d.badge??i("thread.composer.slash.badges.recent")}):null,s.jsx("span",{className:"font-mono text-[12px] text-muted-foreground/60",children:d.argHint?`${d.command} ${d.argHint}`:d.command})]})]},d.command)})})})}function RF({image:e,labelRemove:t,labelEncoding:n,normalizedHint:r,formatError:a,onRemove:o,onKeyDown:i,registerRef:l}){const c=e.status==="ready"&&e.normalized&&e.encodedBytes?r(e.file.size,e.encodedBytes):tc(e.file.size),d=e.status==="error"?"border-destructive/40 bg-destructive/5 text-destructive":"border-border/70 bg-muted/60";return s.jsxs("div",{className:A("group relative flex items-center gap-2 rounded-[12px] border px-2 py-1.5","transition-colors motion-reduce:transition-none",d),"data-testid":"composer-chip",children:[s.jsxs("div",{className:"relative h-10 w-10 overflow-hidden rounded-md bg-background",children:[e.previewUrl?s.jsx("img",{src:e.previewUrl,alt:"","aria-hidden":!0,loading:"eager",draggable:!1,className:"h-full w-full object-cover"}):s.jsx("div",{className:"flex h-full w-full items-center justify-center",children:s.jsx(Vi,{className:"h-4 w-4 text-muted-foreground","aria-hidden":!0})}),e.status==="encoding"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60","aria-label":n,children:s.jsx(vt,{className:"h-4 w-4 animate-spin motion-reduce:animate-none","aria-hidden":!0})}):null]}),s.jsxs("div",{className:"flex min-w-0 flex-col text-[11.5px] leading-4",children:[s.jsx("span",{className:"max-w-[min(14rem,calc(100vw-8rem))] truncate font-medium",title:e.file.name,children:e.file.name}),s.jsx("span",{className:"truncate text-muted-foreground",children:e.status==="error"&&e.error?a(e.error):c})]}),s.jsx("button",{type:"button",ref:l,onClick:o,onKeyDown:i,"aria-label":t,className:A("ml-1 grid h-5 w-5 flex-none place-items-center rounded-full","text-muted-foreground/80 hover:bg-foreground/8 hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground/30"),children:s.jsx(vr,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function MF({title:e,onToggleSidebar:t,theme:n,onToggleTheme:r,hideSidebarToggleForHostChrome:a=!1,hostChromeTitleInset:o=!1,hideThemeButton:i=!1,minimal:l=!1,promptNavigatorAction:c,sessionInfoAction:d}){const{t:p}=se();return s.jsxs("div",{className:A("relative z-10 flex items-center justify-between gap-3 px-3 py-2",l&&"h-11",!l&&o&&"lg:pl-[128px]"),children:[s.jsxs("div",{className:"relative flex min-w-0 items-center gap-2",children:[s.jsx(fe,{variant:"ghost",size:"icon","aria-label":p("thread.header.toggleSidebar"),onClick:t,className:A("h-7 w-7 rounded-md text-muted-foreground hover:bg-accent/35 hover:text-foreground",a&&"lg:hidden"),children:s.jsx(ow,{className:"h-3.5 w-3.5"})}),l?null:s.jsx("div",{className:"flex min-w-0 items-center rounded-md px-1.5 py-1 text-[12px] font-medium text-muted-foreground",children:s.jsx("span",{className:"max-w-[min(60vw,32rem)] truncate",children:e})})]}),s.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[d,c,i?null:s.jsx(EF,{theme:n,onToggleTheme:r,label:p("thread.header.toggleTheme")})]}),l?null:s.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 top-full h-4"})]})}function EF({theme:e,onToggleTheme:t,label:n,className:r}){return s.jsx(fe,{variant:"ghost",size:"icon","aria-label":n,onClick:t,className:A("host-no-drag h-8 w-8 rounded-full text-muted-foreground/85 hover:bg-accent/40 hover:text-foreground",r),children:e==="dark"?s.jsx(iw,{className:"h-4 w-4"}):s.jsx(vf,{className:"h-4 w-4"})})}function IF({error:e,onDismiss:t}){const{t:n}=se(),{title:r,body:a}=LF(e,n);return s.jsxs("div",{role:"alert","aria-live":"assertive",className:A("mb-2 flex items-start gap-2 rounded-lg border border-destructive/30","bg-destructive/10 px-3 py-2 text-[12px] leading-5 text-destructive","animate-in fade-in-0 slide-in-from-bottom-1"),children:[s.jsx(qp,{className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"font-medium",children:r}),s.jsx("p",{className:"mt-0.5 text-destructive/80",children:a})]}),s.jsx(fe,{variant:"ghost",size:"icon",onClick:t,"aria-label":n("common.dismiss"),className:"h-6 w-6 shrink-0 text-destructive hover:bg-destructive/15 hover:text-destructive",children:s.jsx(vr,{className:"h-3.5 w-3.5"})})]})}function LF(e,t){switch(e.kind){case"message_too_big":return{title:t("errors.messageTooBig.title"),body:t("errors.messageTooBig.body")};case"workspace_scope_rejected":return{title:t("errors.workspaceScopeRejected.title"),body:t("errors.workspaceScopeRejected.body")};default:return{title:String(e),body:""}}}const DF=3,OF=80,FF=30,zF=12,$F=32,UF=42,BF=9,Ud=16,HF=28,WF=4,qF=1400;function VF({bottomOffset:e,messages:t,scrollRef:n}){const r=u.useRef(null),a=u.useMemo(()=>iC(t),[t]),[o,i]=u.useState([]),[l,c]=u.useState(null),[d,p]=u.useState(!1),m=u.useRef(null),f=u.useCallback(()=>{p(!0),m.current!==null&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>{p(!1),m.current=null},qF)},[]),h=u.useCallback(()=>{var w;const b=n.current;if(!b||a.length{let b=0,v=WF;const g=()=>{h(),v-=1,v>0&&(b=window.requestAnimationFrame(g))};return g(),()=>window.cancelAnimationFrame(b)},[e,h]),u.useEffect(()=>{const b=n.current;if(!b)return;let v=0;const g=()=>{window.cancelAnimationFrame(v),f(),v=window.requestAnimationFrame(h)};return b.addEventListener("scroll",g,{passive:!0}),window.addEventListener("resize",g),()=>{window.cancelAnimationFrame(v),b.removeEventListener("scroll",g),window.removeEventListener("resize",g)}},[f,n,h]),u.useEffect(()=>{const b=n.current;if(!b||typeof ResizeObserver>"u")return;const v=new ResizeObserver(()=>h());return v.observe(b),b.firstElementChild&&v.observe(b.firstElementChild),()=>v.disconnect()},[n,h]),u.useEffect(()=>()=>{m.current!==null&&window.clearTimeout(m.current)},[]),o.length===0)return null;const y=Math.max(...o.map(b=>b.count)),x=o.findIndex(b=>b.ids.includes(l??""));return s.jsx("div",{ref:r,"aria-label":"User prompt navigation",className:A("group pointer-events-auto absolute right-4 top-14 z-20 hidden w-8 opacity-70 md:block","transition-opacity duration-200 hover:opacity-100","motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-200"),style:{bottom:Math.max(80,e)},children:o.map((b,v)=>{const g=b.ids.includes(l??""),w=x<0||Math.abs(v-x)<=1;return s.jsxs("button",{type:"button","aria-label":`Jump to prompt: ${b.label}`,onClick:()=>hm(n.current,b.ids[b.ids.length-1]),className:A("group/marker absolute right-0 h-5 -translate-y-1/2 overflow-visible rounded-full","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400/60"),style:{top:`${b.topPercent}%`,width:XF(b.count,y,g)},children:[s.jsx("span",{"aria-hidden":!0,className:A("absolute right-0 top-1/2 h-[3px] w-full -translate-y-1/2 rounded-full","bg-foreground/20 transition-[background-color,opacity,transform,height] duration-200","group-hover/marker:bg-blue-500/70 group-hover/marker:opacity-100 group-hover/marker:scale-x-110","group-focus-visible/marker:bg-blue-500 group-focus-visible/marker:opacity-100 group-focus-visible/marker:scale-x-110",b.count>1&&"bg-foreground/30",g&&"h-1 bg-foreground/65 opacity-80 shadow-sm",!g&&w&&"opacity-25 group-hover:opacity-55",!g&&!w&&!d&&"opacity-0 group-hover:opacity-40",!g&&!w&&d&&"opacity-35")}),s.jsx("span",{"aria-hidden":!0,className:A("pointer-events-none absolute right-9 top-1/2 z-30 w-64 -translate-y-1/2 rounded-lg px-3 py-2 text-left","bg-background/95 text-xs leading-5 text-foreground shadow-lg ring-1 ring-border/80 backdrop-blur","opacity-0 translate-x-1 transition-[opacity,transform] duration-150","group-hover/marker:opacity-100 group-hover/marker:translate-x-0","group-focus-visible/marker:opacity-100 group-focus-visible/marker:translate-x-0"),children:s.jsx("span",{className:"block max-h-24 overflow-hidden whitespace-pre-wrap break-words",children:b.preview})})]},b.ids.join("|"))})})}function KF(e,t,n){return t.flatMap(r=>{const a=ui(e,r.id);if(!a)return[];const o=Math.max(0,Math.min(n,Zf(e,a)-16));return[{...r,top:o,topPercent:xm(o/n*100,2,98)}]})}function GF(e,t){if(e.length===0)return[];if(e.length>=FF)return YF(e,t);const n=t>0?BF/t*100:2,r=[];for(const a of e){const o=r[r.length-1];if(o&&a.topPercent-o.topPercent0?xm(Math.floor(t/zF),1,UF):$F,r=Array.from({length:n},()=>[]);for(const a of e){const o=xm(Math.floor(a.topPercent/100*n),0,n-1);r[o].push(a)}return r.flatMap(a=>{if(a.length===0)return[];const o=a[a.length-1],i=a.reduce((l,c)=>l+c.topPercent,0)/a.length;return[{count:a.length,ids:a.map(l=>l.id),label:a.length===1?o.label:_C(a.length,o.label),preview:a.length===1?o.preview:PC(a.length,o.preview),topPercent:i}]})}function QF(e,t){if(e.length===0)return null;let n=e[0];const r=t+96;for(const a of e){if(a.top<=r){n=a;continue}break}return n.id}function _C(e,t){return`${e} prompts, latest: ${t}`}function PC(e,t){return`${e} prompts ${t}`}function XF(e,t,n){if(t<=1)return n?34:Ud;const r=Math.log2(e+1)/Math.log2(t+1),a=Ud+(HF-Ud)*r;return Math.round(n?a+4:a)}function xm(e,t,n){return Math.max(t,Math.min(n,e))}function TC({attachment:e,className:t,inline:n=!1,variant:r="default"}){const{t:a}=se(),[o,i]=u.useState(!1),l=typeof e.url=="string"&&e.url.length>0,c=JF(e,a);if(e.kind==="image"&&l&&!o)return s.jsx(ax,{attachment:e,className:t,inline:n,variant:r,children:s.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",className:"block bg-muted/20","aria-label":e.name?`Open ${e.name}`:a("lightbox.open",{defaultValue:"Open image"}),children:s.jsx("img",{src:e.url,alt:e.name??"",loading:"lazy",decoding:"async",draggable:!1,onError:()=>i(!0),className:A("block h-auto max-w-full bg-background object-contain",r==="compact"?"max-h-40":"max-h-[34rem]")})})});if(e.kind==="video"&&l)return s.jsx(ax,{attachment:e,className:t,inline:n,variant:r,children:s.jsx("video",{src:e.url,controls:!0,preload:"auto",className:A("block w-full bg-black",r==="compact"?"max-h-40":"max-h-[26rem]"),"aria-label":e.name?`${a("message.videoAttachment",{defaultValue:"Video attachment"})}: ${e.name}`:a("message.videoAttachment",{defaultValue:"Video attachment"})})});const d=e.kind==="video"?g2:e.kind==="image"?Vi:Xj,p=s.jsxs(s.Fragment,{children:[s.jsx(d,{className:"h-4 w-4 flex-none","aria-hidden":!0}),s.jsx("span",{className:"min-w-0 truncate",children:e.name??c})]});return l&&!o?s.jsx("a",{href:e.url,download:e.name??c,title:e.name??void 0,"aria-label":c,className:A("flex max-w-[18rem] items-center gap-2 rounded-[14px]","border border-border/60 bg-muted/40 px-3 py-2 text-xs text-muted-foreground","transition-colors hover:bg-muted/55 hover:text-foreground",r==="compact"&&"max-w-[14rem] rounded-xl px-2.5 py-1.5 text-[11.5px]",t),children:p}):s.jsxs("div",{className:A("flex max-w-[18rem] items-center gap-2 rounded-[14px]","border border-border/60 bg-muted/35 px-3 py-2 text-xs text-muted-foreground",r==="compact"&&"max-w-[14rem] rounded-xl px-2.5 py-1.5 text-[11.5px]",t),title:e.name??void 0,"aria-label":c,children:[p,s.jsx("span",{className:"sr-only",children:a("message.attachmentUnavailable",{defaultValue:"Attachment unavailable"})})]})}function ax({attachment:e,children:t,className:n,inline:r=!1,variant:a="default"}){const o=A("not-prose my-3 block w-fit max-w-full overflow-hidden rounded-[14px]","border border-border/60 bg-muted/40",e.kind==="image"&&"bg-background/85",e.kind==="video"?"w-[min(100%,32rem)]":"",a==="compact"&&"my-1 rounded-xl shadow-none",a==="compact"&&e.kind==="video"&&"w-[min(100%,20rem)]",n),i="block max-w-full",l=r?s.jsx("span",{className:i,children:t}):s.jsx("div",{className:i,children:t});return r?s.jsx("span",{className:o,children:l}):s.jsx("figure",{className:o,children:l})}function JF(e,t){return e.kind==="video"?t("message.videoAttachment",{defaultValue:"Video attachment"}):e.kind==="image"?t("message.imageAttachment",{defaultValue:"Image attachment"}):t("message.fileAttachment",{defaultValue:"File attachment"})}function ZF({images:e,index:t,onIndexChange:n,onOpenChange:r}){const{t:a}=se(),o=t!==null,i=e.length,l=t!==null?e[t]:null,c=u.useCallback(f=>{if(t===null||i<=1)return;const h=(t+f+i)%i;n(h)},[t,n,i]);u.useEffect(()=>{if(!o)return;const f=h=>{h.key==="ArrowLeft"?(h.preventDefault(),c(-1)):h.key==="ArrowRight"?(h.preventDefault(),c(1)):h.key==="Home"?(h.preventDefault(),n(0)):h.key==="End"&&(h.preventDefault(),n(i-1))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[c,n,o,i]);const d=u.useMemo(()=>{if(t===null||i<=1)return[];const f=e[(t-1+i)%i],h=e[(t+1)%i];return[f,h].filter(y=>y&&y.url)},[e,t,i]);if(!l||!l.url)return null;const p=i>1,m=p?`${t+1} / ${i}`:null;return s.jsx(vu,{open:o,onOpenChange:r,children:s.jsxs(xu,{children:[s.jsx(gs,{className:A("fixed inset-0 z-50 bg-black/80 backdrop-blur-sm","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none")}),s.jsxs(vs,{"aria-label":l.name??a("lightbox.title"),className:A("fixed inset-0 z-50 flex items-center justify-center","focus:outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none"),children:[s.jsx(xs,{className:"sr-only",children:l.name??a("lightbox.title")}),s.jsx("div",{className:"relative flex max-h-[92vh] max-w-[94vw] items-center justify-center",style:{transform:"translate3d(0,0,0)",willChange:"transform"},children:s.jsx("img",{src:l.url,alt:l.name??"",decoding:"async",draggable:!1,className:"max-h-[92vh] max-w-[94vw] select-none rounded-[6px] object-contain shadow-2xl"},l.url)}),p?s.jsxs(s.Fragment,{children:[s.jsx(ox,{side:"left",label:a("lightbox.prev"),onClick:f=>{f.stopPropagation(),c(-1)}}),s.jsx(ox,{side:"right",label:a("lightbox.next"),onClick:f=>{f.stopPropagation(),c(1)}}),s.jsx("div",{className:"pointer-events-none absolute bottom-5 left-1/2 -translate-x-1/2 rounded-full bg-black/55 px-3 py-1 text-xs font-medium text-white/90 tabular-nums",children:m})]}):null,s.jsx(Yi,{"aria-label":a("lightbox.close"),className:A("absolute right-4 top-4 grid h-9 w-9 place-items-center rounded-full","bg-black/55 text-white/90 hover:bg-black/70 hover:text-white","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70","transition-colors motion-reduce:transition-none"),children:s.jsx(vr,{className:"h-4 w-4","aria-hidden":!0})}),s.jsx("div",{"aria-hidden":!0,className:"hidden",children:d.map((f,h)=>s.jsx("img",{src:f.url,alt:""},`${f.url}-${h}`))})]})]})})}function ox({side:e,label:t,onClick:n}){const r=e==="left"?mf:xr;return s.jsx("button",{type:"button",onClick:n,"aria-label":t,className:A("absolute top-1/2 -translate-y-1/2 grid h-11 w-11 place-items-center rounded-full","bg-black/55 text-white/90 hover:bg-black/70 hover:text-white","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70","transition-colors motion-reduce:transition-none",e==="left"?"left-4":"right-4"),children:s.jsx(r,{className:"h-5 w-5","aria-hidden":!0})})}async function ez(e){var t;try{if((t=navigator.clipboard)!=null&&t.writeText)return await navigator.clipboard.writeText(e),!0}catch{}return tz(e)}function tz(e){if(typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select(),t.setSelectionRange(0,t.value.length);try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}const nz=new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico",".svg",".tif",".tiff"]),rz=new Set([".mp4",".webm",".mov",".m4v",".avi",".mkv",".3gp"]);function az(e){var t;return((t=e.split(/[?#]/,1)[0])==null?void 0:t.toLowerCase())??""}function sx(e){if(!e)return"";const t=az(e),n=t.lastIndexOf(".");return n<0?"":t.slice(n)}function RC(e){const t=e.url??"";if(t.startsWith("data:image/"))return"image";if(t.startsWith("data:video/"))return"video";const n=sx(e.name)||sx(t);return n?nz.has(n)?"image":rz.has(n)?"video":"file":null}function C6(e){return RC(e)??"file"}function us(e){return{kind:RC(e)??e.kind??"file",url:e.url,name:e.name}}function oz({className:e}){return s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":!0,children:[s.jsx("path",{d:"M16 3h5v5"}),s.jsx("path",{d:"M8 3H3v5"}),s.jsx("path",{d:"m21 3-7.536 7.536A5 5 0 0 0 12 14.07V21"}),s.jsx("path",{d:"m3 3 7.536 7.536A5 5 0 0 1 12 14.07V15"})]})}function sz({message:e,showAssistantCopyAction:t=!0,cliApps:n=[],mcpPresets:r=[],onOpenFilePreview:a,onForkFromHere:o}){var D,K;const{t:i}=se(),[l,c]=u.useState(!1),d=u.useRef(null),p="animate-in fade-in-0 slide-in-from-bottom-1 duration-300",m=u.useMemo(()=>cz(n,e.cliApps),[n,e.cliApps]),f=u.useMemo(()=>lz(r,e.mcpPresets),[r,e.mcpPresets]);u.useEffect(()=>()=>{d.current!==null&&window.clearTimeout(d.current)},[]);const h=u.useCallback(()=>{ez(e.content).then(G=>{G&&(c(!0),d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{c(!1),d.current=null},1500))})},[e.content]);if(e.kind==="trace")return s.jsx(mz,{message:e,animClass:p});if(e.role==="user"){const G=e.images??[],W=e.media??[],H=G.length>0,E=W.length>0,F=e.content.trim().length>0;return s.jsxs("div",{className:A("group ml-auto flex max-w-[min(85%,36rem)] flex-col items-end gap-1.5",p),children:[H?s.jsx(MC,{images:G,align:"right"}):null,E?s.jsx(ix,{media:W,align:"right"}):null,F?s.jsx("p",{className:A("ml-auto w-fit rounded-[18px] bg-secondary/70 px-4 py-2","text-left text-[16px]/[1.75] whitespace-pre-wrap break-words"),children:s.jsx(pO,{text:e.content,cliApps:m,mcpPresets:f})}):null]})}const y=e.content.trim().length===0,x=e.media??[],b=e.role==="assistant"?e.reasoning??"":"",v=!!(e.role==="assistant"&&e.reasoningStreaming),g=b.length>0||v,w=((D=e.source)==null?void 0:D.kind)==="cron"?((K=e.source.label)==null?void 0:K.trim())||i("message.automationSourceFallback"):"",k=i("message.automationTriggered"),C=e.role==="assistant"&&!e.isStreaming&&!y,j=t&&C,N=C&&!!o,P=i(l?"message.copiedReply":"message.copyReply"),L=i("message.forkFromHere"),_=e.latencyMs,T=e.role==="assistant"&&_!=null&&!e.isStreaming&&(!y||g||x.length>0),R=j||N||T;return s.jsxs("div",{className:A("w-full text-[15px]",p),style:{lineHeight:"var(--cjk-line-height)"},children:[g?s.jsx(pz,{text:b,streaming:v,hasBodyBelow:!y,onOpenFilePreview:a}):null,y&&e.isStreaming&&!g?s.jsx(dz,{}):y&&e.isStreaming?null:s.jsxs(s.Fragment,{children:[w?s.jsx(iz,{label:w,triggerLabel:k}):null,s.jsx(Fu,{streaming:!!e.isStreaming,onOpenFilePreview:a,children:e.content}),x.length>0?s.jsx(ix,{media:x,align:"left"}):null,R?s.jsx(Eu,{delayDuration:220,skipDelayDuration:80,children:s.jsxs("div",{className:"mt-2 flex min-h-8 flex-wrap items-center gap-x-2 gap-y-1 text-muted-foreground",children:[j?s.jsxs(Li,{children:[s.jsx(Di,{asChild:!0,children:s.jsx("button",{type:"button",onClick:h,"aria-label":P,className:A("inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full","transition-colors hover:bg-muted/55 hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:l?s.jsx(jt,{className:"h-4 w-4","aria-hidden":!0}):s.jsx(Zb,{className:"h-4 w-4","aria-hidden":!0})})}),s.jsx(is,{side:"top",align:"center",children:P})]}):null,N?s.jsxs(Li,{children:[s.jsx(Di,{asChild:!0,children:s.jsx("button",{type:"button",onClick:o,"aria-label":L,className:A("inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full","transition-colors hover:bg-muted/55 hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),children:s.jsx(oz,{className:"h-4 w-4"})})}),s.jsx(is,{side:"top",align:"center",children:L})]}):null,T?s.jsx("span",{className:"text-[11px] leading-none text-muted-foreground/70 tabular-nums",title:i("message.turnLatencyTitle"),children:LM(_)}):null]})}):null]})]})}function iz({label:e,triggerLabel:t}){return s.jsxs("div",{className:A("mb-2 inline-flex max-w-full items-center gap-1.5 rounded-full px-2 py-1","border border-sky-500/15 bg-sky-500/[0.06]","text-[11px] font-medium leading-none text-sky-700","dark:border-sky-300/15 dark:bg-sky-300/[0.08] dark:text-sky-200/80"),title:t,children:[s.jsx(Gj,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"min-w-0 truncate",children:e}),s.jsx("span",{className:"text-current/45","aria-hidden":!0,children:"·"}),s.jsx("span",{className:"shrink-0",children:t})]})}function lz(e,t){var r;if(!(t!=null&&t.length))return e;const n=new Map(e.map(a=>[a.name.toLowerCase(),a]));for(const a of t){const o=(r=a.name)==null?void 0:r.trim();if(!o)continue;const i=n.get(o.toLowerCase());n.set(o.toLowerCase(),{name:o,display_name:a.display_name||(i==null?void 0:i.display_name)||o,category:a.category||(i==null?void 0:i.category)||"mcp",description:(i==null?void 0:i.description)||"",docs_url:(i==null?void 0:i.docs_url)||"",transport:a.transport||(i==null?void 0:i.transport)||"mcp",requires:(i==null?void 0:i.requires)||"",note:(i==null?void 0:i.note)||"",install_supported:(i==null?void 0:i.install_supported)??!0,installed:!0,configured:a.configured??(i==null?void 0:i.configured)??!0,available:(i==null?void 0:i.available)??!0,status:a.status||(i==null?void 0:i.status)||"configured",logo_url:a.logo_url??(i==null?void 0:i.logo_url)??null,brand_color:a.brand_color??(i==null?void 0:i.brand_color)??null,required_fields:(i==null?void 0:i.required_fields)||[],connection_summary:(i==null?void 0:i.connection_summary)||""})}return Array.from(n.values())}function cz(e,t){var r;if(!(t!=null&&t.length))return e;const n=new Map(e.map(a=>[a.name.toLowerCase(),a]));for(const a of t){const o=(r=a.name)==null?void 0:r.trim();if(!o)continue;const i=n.get(o.toLowerCase());n.set(o.toLowerCase(),{name:o,display_name:a.display_name||(i==null?void 0:i.display_name)||o,category:a.category||(i==null?void 0:i.category)||"cli",description:(i==null?void 0:i.description)||"",requires:(i==null?void 0:i.requires)||"",source:(i==null?void 0:i.source)||"attached",entry_point:a.entry_point||(i==null?void 0:i.entry_point)||"",install_supported:(i==null?void 0:i.install_supported)??!0,installed:!0,available:(i==null?void 0:i.available)??!0,status:(i==null?void 0:i.status)||"installed",logo_url:a.logo_url??(i==null?void 0:i.logo_url)??null,brand_color:a.brand_color??(i==null?void 0:i.brand_color)??null,skill_installed:(i==null?void 0:i.skill_installed)??!0})}return Array.from(n.values())}function ix({media:e,align:t}){if(e.length===0)return null;const n=[],r=[];for(const a of e){const o=us(a);o.kind==="image"?n.push({url:o.url,name:o.name}):r.push(o)}return s.jsxs("div",{className:A("mt-2 flex flex-wrap gap-2",t==="right"?"justify-end":"justify-start"),children:[n.length>0?s.jsx(MC,{images:n,align:t,size:t==="left"?"large":"compact"}):null,r.map((a,o)=>s.jsx(TC,{attachment:a},`${a.url??a.name??a.kind}-${o}`))]})}function MC({images:e,align:t="right",size:n="compact"}){const{t:r}=se(),a=[],o=new Map;for(let c=0;cs.jsx(uz,{image:c,size:n,placeholderLabel:r("message.imageAttachment"),openLabel:r("lightbox.open"),onOpen:o.has(d)?()=>l(o.get(d)):void 0},`${c.url??"placeholder"}-${d}`))}),s.jsx(ZF,{images:a,index:i,onIndexChange:l,onOpenChange:c=>{c||l(null)}})]})}function uz({image:e,size:t,placeholderLabel:n,openLabel:r,onOpen:a}){const o=typeof e.url=="string"&&e.url.length>0,i=A("relative overflow-hidden border border-border/60 bg-muted/40",t==="large"?"w-[min(100%,34rem)] rounded-[20px] bg-transparent":"h-24 w-24 rounded-[14px]","shadow-[0_6px_18px_-14px_rgba(0,0,0,0.45)]");return o&&a?s.jsx("button",{type:"button",onClick:a,"aria-label":e.name?`${r}: ${e.name}`:r,className:A(i,"block cursor-zoom-in p-0 transition-transform duration-150 motion-reduce:transition-none","hover:scale-[1.01] hover:ring-2 hover:ring-primary/25","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50"),children:s.jsx("img",{src:e.url,alt:e.name??"",loading:"lazy",decoding:"async",draggable:!1,className:A("block",t==="large"?"h-auto max-h-[36rem] w-full rounded-[inherit] object-contain":"h-full w-full object-cover")})}):s.jsx("div",{className:i,title:e.name??void 0,children:s.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 px-2 text-[11px] text-muted-foreground","aria-label":n,children:[s.jsx(Vi,{className:"h-4 w-4 flex-none","aria-hidden":!0}),s.jsx("span",{className:"line-clamp-2 text-center leading-tight",children:e.name??n})]})})}function dz(){const{t:e}=se();return s.jsxs("span",{"aria-label":e("message.assistantTyping"),className:"inline-flex items-center gap-1 py-1",children:[s.jsx(Bd,{delay:"0ms"}),s.jsx(Bd,{delay:"150ms"}),s.jsx(Bd,{delay:"300ms"})]})}function Bd({delay:e}){return s.jsx("span",{style:{animationDelay:e},className:A("inline-block h-1.5 w-1.5 rounded-full bg-muted-foreground/60","animate-bounce")})}function zu({children:e,active:t,className:n}){const r=typeof e=="string"||typeof e=="number"?String(e):void 0;return s.jsx("span",{className:A("block min-w-0 overflow-hidden py-px",n),children:s.jsx("span",{"data-sheen-text":t?r:void 0,className:A("block w-fit max-w-full truncate font-medium leading-normal",t?"streaming-text-sheen":"text-muted-foreground"),children:e})})}function pz({text:e,streaming:t,hasBodyBelow:n,embeddedInCluster:r=!1,onOpenFilePreview:a}){const{t:o}=se(),[i,l]=u.useState(!1),[c,d]=u.useState(!0),p=i?c:t,m=()=>{l(!0),d(f=>i?!f:!p)};return u.useEffect(()=>{p&&e.length>0&&Ou()},[p,e.length]),s.jsxs("div",{className:A("w-full",!r&&"animate-in fade-in-0 slide-in-from-top-1 duration-200",n&&"mb-2"),children:[s.jsxs("button",{type:"button",onClick:m,className:A("group flex w-full items-center gap-2 rounded-md px-2 py-1.5","text-xs text-muted-foreground transition-colors hover:bg-muted/45"),"aria-expanded":p,"aria-live":t?"polite":void 0,children:[s.jsx($o,{className:A("h-3.5 w-3.5",t&&"animate-pulse"),"aria-hidden":!0}),s.jsx(zu,{active:t,className:"min-w-0 flex-1 text-left",children:t?o("message.reasoningStreaming",{defaultValue:"Thinking…"}):o("message.reasoning",{defaultValue:"Thinking"})}),s.jsx(xr,{"aria-hidden":!0,className:A("ml-auto h-3.5 w-3.5 transition-transform duration-200",p&&"rotate-90")})]}),p&&e.length>0&&s.jsx("div",{className:A("mt-1 min-w-0 border-l border-muted-foreground/20 pl-3",!r&&"animate-in fade-in-0 slide-in-from-top-1 duration-200"),children:s.jsx(Fu,{streaming:t,onOpenFilePreview:a,className:A("text-[12.5px] italic text-muted-foreground/88","prose-p:my-1.5 prose-li:my-0.5","prose-headings:mt-2 prose-headings:mb-1 prose-headings:font-medium","prose-headings:text-muted-foreground/92 prose-strong:text-muted-foreground","prose-h1:text-[15px] prose-h2:text-[13.5px] prose-h3:text-[12.5px] prose-h4:text-[12px]","prose-a:text-blue-500 prose-a:underline hover:prose-a:text-blue-600 dark:prose-a:text-blue-300 dark:hover:prose-a:text-blue-200","prose-code:text-[0.92em]"),children:e})})]})}function mz({message:e,animClass:t}){const{t:n}=se(),r=e.traces??[e.content],a=r.length,[o,i]=u.useState(!1);return s.jsxs("div",{className:A("w-full",t),children:[s.jsxs("button",{type:"button",onClick:()=>i(l=>!l),className:A("group flex w-full items-center gap-2 rounded-md px-2 py-1.5","text-xs text-muted-foreground transition-colors hover:bg-muted/45"),"aria-expanded":o,children:[s.jsx(lw,{className:"h-3.5 w-3.5","aria-hidden":!0}),s.jsx("span",{className:"font-medium",children:a===1?n("message.toolSingle"):n("message.toolMany",{count:a})}),s.jsx(xr,{"aria-hidden":!0,className:A("ml-auto h-3.5 w-3.5 transition-transform duration-200",o&&"rotate-90")})]}),o&&s.jsx("ul",{className:A("mt-1 space-y-0.5 border-l border-muted-foreground/20 pl-3","animate-in fade-in-0 slide-in-from-top-1 duration-200"),children:r.map((l,c)=>s.jsx("li",{className:"whitespace-pre-wrap break-words font-mono text-[11.5px] leading-relaxed text-muted-foreground/90",children:l},c))})]})}function EC({evidence:e,className:t}){return e.length===0?null:s.jsx("div",{"data-testid":"activity-evidence-preview",className:A("flex max-w-full flex-wrap items-start gap-2 pt-0.5","motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-1 motion-safe:duration-200",t),children:e.slice(0,4).map(n=>s.jsx(TC,{attachment:n.attachment,variant:"compact",className:A(n.attachment.kind==="image"||n.attachment.kind==="video"?"max-w-[min(100%,20rem)]":"max-w-[14rem]")},n.id))})}function IC({title:e,icon:t,children:n,className:r}){return s.jsxs("section",{className:A("min-w-0 py-1 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-1 motion-safe:duration-200",r),children:[s.jsxs("div",{className:"mb-1 flex min-w-0 items-center gap-1.5 pl-0.5 text-[12px] font-medium text-muted-foreground/70",children:[t?s.jsx(t,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null,s.jsx("span",{className:"min-w-0 truncate",children:e})]}),s.jsx("div",{className:"min-w-0",children:n})]})}function oo({as:e="div",icon:t,marker:n,label:r,detail:a,aside:o,children:i,active:l=!1,tone:c=l?"active":"neutral",title:d,className:p,contentClassName:m,markerClassName:f,style:h}){return s.jsxs(e,{className:A("group/activity-step relative grid min-w-0 grid-cols-[1.125rem_minmax(0,1fr)] gap-2 py-0.5 text-[13px] leading-5",p),title:d,style:h,children:[s.jsx("span",{className:A("relative flex h-5 w-[1.125rem] shrink-0 items-start justify-center pt-[3px]","after:absolute after:left-1/2 after:top-[1.25rem] after:h-[calc(100%+0.375rem)] after:w-px after:-translate-x-1/2 after:bg-muted-foreground/14 group-last/activity-step:after:hidden"),"aria-hidden":!0,children:n??s.jsx("span",{className:A("grid h-3.5 w-3.5 place-items-center rounded-full border bg-background transition-colors",c==="active"&&"border-muted-foreground/28 text-muted-foreground/72",c==="success"&&"border-emerald-500/28 text-emerald-500/78",c==="error"&&"border-destructive/30 text-destructive/78",c==="neutral"&&"border-muted-foreground/18 text-muted-foreground/50",f),children:t?s.jsx(t,{className:"h-2.5 w-2.5",strokeWidth:2.15}):null})}),s.jsxs("div",{className:A("min-w-0",m),children:[s.jsxs("div",{className:"flex min-w-0 items-baseline gap-1.5",children:[s.jsx(zu,{active:l,className:A("min-w-0 shrink-0 font-medium",c==="error"?"text-destructive/78":"text-muted-foreground/85"),children:r}),a?s.jsx("span",{className:"min-w-0 break-words text-foreground/82",children:a}):null,o?s.jsx("span",{className:"ml-auto shrink-0",children:o}):null]}),i?s.jsx("div",{className:"mt-1 min-w-0",children:i}):null]})]})}function th({added:e,deleted:t}){return s.jsxs("span",{className:"inline-flex shrink-0 items-baseline gap-1.5 leading-[inherit] tabular-nums","data-testid":"activity-diff-pair",children:[s.jsx(lx,{sign:"+",value:e,className:"text-emerald-600/75 dark:text-emerald-300/75"}),s.jsx(lx,{sign:"-",value:t,className:"text-rose-600/70 dark:text-rose-300/75"})]})}function lx({sign:e,value:t,className:n}){const r=Number.isFinite(t)?Math.max(0,Math.round(t)):0;return s.jsxs("span",{className:A("inline-flex items-baseline leading-[inherit]",n),"aria-label":`${e}${r}`,children:[s.jsxs("span",{className:"inline-flex items-baseline leading-none","aria-hidden":!0,children:[e,s.jsx(fz,{value:r})]}),s.jsxs("span",{className:"sr-only",children:[e,r]})]})}function fz({value:e}){const t=Number.isFinite(e)?Math.max(0,Math.round(e)):0,[n,r]=u.useState(0),a=u.useRef(0),o=u.useCallback(i=>{a.current=i,r(i)},[]);return u.useEffect(()=>{var h;if((h=window.matchMedia)==null?void 0:h.call(window,"(prefers-reduced-motion: reduce)").matches){o(t);return}const l=a.current,c=t-l;if(c===0){o(t);return}const d=260,p=performance.now();let m=0;const f=y=>{const x=Math.min(1,(y-p)/d),b=1-Math.pow(1-x,3);if(o(Math.round(l+c*b)),x<1){m=window.requestAnimationFrame(f);return}a.current=t};return m=window.requestAnimationFrame(f),()=>window.cancelAnimationFrame(m)},[t,o]),s.jsx(hz,{value:n})}function hz({value:e}){const t=String(e).split("");return s.jsx("span",{className:"inline-flex items-baseline leading-none","aria-hidden":!0,children:t.map((n,r)=>s.jsx(gz,{digit:Number(n)},`${t.length}-${r}`))})}function gz({digit:e}){const t=Number.isFinite(e)?Math.min(9,Math.max(0,e)):0;return s.jsxs("span",{className:"relative inline-block h-[1em] w-[0.62em] overflow-hidden align-baseline leading-none",children:[s.jsx("span",{className:"invisible block h-[1em] leading-none",children:"0"}),s.jsx("span",{className:"absolute inset-x-0 top-0 flex flex-col transition-transform duration-200 ease-out will-change-transform",style:{transform:`translateY(-${t}em)`},children:Array.from({length:10},(n,r)=>s.jsx("span",{className:"block h-[1em] leading-none",children:r},r))})]})}function LC({edits:e,onOpenFilePreview:t}){return e.length===0?null:s.jsx("ul",{className:"space-y-1",children:e.map(n=>s.jsx(vz,{edit:n,onOpenFilePreview:t},n.key))})}function vz({edit:e,onOpenFilePreview:t}){const{t:n}=se(),r=e.status==="editing",a=e.status==="error",o=!a&&!e.binary&&DC(e),i=a?OC(e.error):"",l=a?xz(e.error)||n("message.fileEditFailedFallback",{defaultValue:"File change was not applied."}):"",c=a?s.jsx(ja,{className:"h-3 w-3","aria-hidden":!0}):r?s.jsx(Jb,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):s.jsx(Xb,{className:"h-3 w-3","aria-hidden":!0});return s.jsx(oo,{as:"li",marker:s.jsx("span",{className:A("grid h-3.5 w-3.5 place-items-center rounded-full border bg-background transition-colors",a&&"border-destructive/30 text-destructive/78",r&&"border-muted-foreground/24 text-muted-foreground/65",!a&&!r&&"border-emerald-500/28 text-emerald-500/78"),children:c}),active:r,tone:a?"error":r?"active":"success",className:"text-xs",contentClassName:a?"min-w-0":"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3",title:i||e.absolute_path||e.path,label:e.pending&&!e.path?n("message.fileEditPreparing",{defaultValue:"Preparing file edit…"}):s.jsx(Jf,{path:e.path,tooltipPath:e.absolute_path,previewPath:e.absolute_path||e.path,onOpen:t,display:"path",active:r,className:"min-w-0",textClassName:"text-[12px]",testId:"activity-file-reference"}),detail:null,aside:o?s.jsx(th,{added:e.added,deleted:e.deleted}):null,children:a?s.jsx("span",{className:"block max-w-[42rem] truncate text-[11px] leading-4 text-destructive/75",children:l}):null})}function DC(e){return e.added>0||e.deleted>0}function OC(e){const t=(e||"").replace(/\s+/g," ").trim();return t?t.replace(/^Error applying patch:\s*/i,"").replace(/^Error writing file:\s*/i,"").replace(/^Error editing file:\s*/i,"").replace(/^Error:\s*/i,""):""}function xz(e){const t=OC(e);return t?/\bpermission denied\b/i.test(t)||/\boperation not permitted\b/i.test(t)?"No permission to change this location.":t.replace(/^old_text not found in (.+)$/i,"Target text was not found in $1.").replace(/^old_text appears multiple times in (.+)$/i,"Target text matched multiple places in $1.").replace(/^file to (?:update|delete) does not exist: (.+)$/i,"File does not exist: $1.").replace(/^path to (?:update|delete) is not a file: (.+)$/i,"Path is not a file: $1.").slice(0,180):""}function yz({text:e,streaming:t,onOpenFilePreview:n}){const{t:r}=se();return u.useEffect(()=>{e.length>0&&Ou()},[e.length]),s.jsx(oo,{marker:s.jsx(bz,{streaming:t}),active:t,tone:t?"active":"success",label:t?r("message.reasoningStreaming",{defaultValue:"Thinking…"}):r("message.reasoning",{defaultValue:"Thinking"}),children:e.trim()?s.jsx(Fu,{streaming:t,onOpenFilePreview:n,className:A("min-w-0 text-[12.5px] italic text-muted-foreground/78","prose-p:my-1 prose-li:my-0.5","prose-headings:mt-2 prose-headings:mb-1 prose-headings:font-medium","prose-headings:text-muted-foreground/88 prose-strong:text-muted-foreground","prose-h1:text-[15px] prose-h2:text-[13.5px] prose-h3:text-[12.5px] prose-h4:text-[12px]","prose-a:text-blue-500 prose-a:underline hover:prose-a:text-blue-600 dark:prose-a:text-blue-300 dark:hover:prose-a:text-blue-200","prose-code:text-[0.92em]"),children:e}):null})}function bz({streaming:e}){const t=u.useRef(e),[n,r]=u.useState(!1);return u.useEffect(()=>{if(t.current&&!e){r(!0);const a=window.setTimeout(()=>r(!1),650);return t.current=e,()=>window.clearTimeout(a)}t.current=e},[e]),e?s.jsx(Jb,{"data-testid":"activity-reasoning-marker","data-state":"thinking",className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground/55",strokeWidth:1.8,"aria-hidden":!0}):s.jsx("span",{"data-testid":"activity-reasoning-marker","data-state":"done",className:A("grid h-3.5 w-3.5 shrink-0 place-items-center rounded-full border border-emerald-500/28 text-emerald-500/78","bg-emerald-500/[0.035] transition-[border-color,background-color,box-shadow,transform] duration-300 ease-out",n&&"animate-in fade-in-0 zoom-in-75 shadow-[0_0_0_3px_rgba(16,185,129,0.10)] motion-reduce:animate-none"),"aria-hidden":!0,children:s.jsx(jt,{className:A("h-2.5 w-2.5 stroke-[2.4]",n&&"animate-in fade-in-0 zoom-in-50 duration-300 motion-reduce:animate-none")})})}function $u(e){var t;return e.role!=="assistant"||e.kind==="trace"||e.content.trim().length>0?!1:!!((t=e.reasoning)!=null&&t.length||e.reasoningStreaming||e.isStreaming)}function Ba(e){return $u(e)||e.kind==="trace"}function Vc(e){if(e.length===0)return!1;const t=e[e.length-1];if(!Ba(t))return!1;let n=e.length-1;for(;n>0&&Ba(e[n-1]);)n-=1;const r=e.slice(n);if(r.some(i=>i.isStreaming||i.reasoningStreaming))return!0;const a=e[n-1];if(!a||a.role!=="assistant"||Ba(a))return!0;const o=new Set(r.map(i=>i.turnId).filter(i=>typeof i=="string"&&i.length>0));return a.turnId?o.size>0&&!o.has(a.turnId):o.size>0}function wz(e,t={}){const n=[];let r=[],a;const o=(i={})=>{if(r.length===0)return;const l=[],c=kz(r),d=Sz(c);let p=0,m=[];const f=()=>{m.length&&(Nz(l,m,d.slice(p)),m=[])};for(const h of c){if(Ba(h)){m.push(h);continue}if(FC(h)){m.push(Az(h)),f(),l.push({type:"message",message:zC(h)}),p+=1;continue}f(),l.push({type:"message",message:h}),p+=1}f(),n.push(...Cz(l,i)),r=[],a=void 0};for(const i of e){if(i.role==="user"){o(),n.push({type:"message",message:i}),a=i.turnId;continue}i.turnId&&a&&i.turnId!==a&&o(),i.turnId&&(a=i.turnId),r.push(i)}return o(t),n}function kz(e){return e.length<2?e:e.map((t,n)=>({message:t,index:n})).sort((t,n)=>{const r=t.message.createdAt,a=n.message.createdAt;if(Number.isFinite(r)&&Number.isFinite(a)&&r!==a)return r-a;const i=t.message.turnSeq,l=n.message.turnSeq;return Number.isFinite(i)&&Number.isFinite(l)&&i!==l?Number(i)-Number(l):t.index-n.index}).map(({message:t})=>t)}function Cz(e,t){var a,o;if(t.preserveTrailingActivity||e.length<2||((a=e[e.length-1])==null?void 0:a.type)!=="activity")return e;let n=e.length-1;for(;n>0&&((o=e[n-1])==null?void 0:o.type)==="activity";)n-=1;const r=e[n-1];return!r||r.type!=="message"||r.message.role!=="assistant"?e:[...e.slice(0,n-1),...e.slice(n),r]}function Sz(e){const t=[];for(const n of e)Ba(n)||t.push(FC(n)?zC(n):n);return t}function Nz(e,t,n){let r=[],a,o;const i=()=>{r.length&&(e.push({type:"activity",messages:r,items:r.flatMap(_z),turnLatencyMs:Pz(r,n)}),r=[],a=void 0,o=void 0)};for(const l of t){const c=jz(l)?"file":"other",d=l.activitySegmentId;(a&&c!==a||c==="file"&&a==="file"&&!!o&&!!d&&o!==d)&&i(),a=c,d&&(o=d),r.push(l)}i()}function jz(e){var t;return e.kind==="trace"&&!!((t=e.fileEdits)!=null&&t.length)}function FC(e){var t;return e.role==="assistant"&&e.kind!=="trace"&&e.content.trim().length>0&&(!!((t=e.reasoning)!=null&&t.trim())||!!e.reasoningStreaming)}function Az(e){return{id:`${e.id}-reasoning`,role:"assistant",content:"",createdAt:e.createdAt,reasoning:e.reasoning,reasoningStreaming:e.reasoningStreaming,isStreaming:e.reasoningStreaming,activitySegmentId:e.activitySegmentId,latencyMs:e.latencyMs}}function zC(e){const t={...e};return delete t.reasoning,delete t.reasoningStreaming,t}function _z(e){var n,r,a;if($u(e))return[{type:"reasoning",message:e}];if(e.kind!=="trace")return[];const t=[];(n=e.fileEdits)!=null&&n.length&&t.push({type:"file_edit",message:e});for(const o of e.toolEvents??[]){const i=String(o.name??"").toLowerCase();i==="run_cli_app"?t.push({type:"cli",message:e}):i==="mcp"?t.push({type:"mcp",message:e}):t.push({type:"tool",message:e})}return t.length===0&&((r=e.traces)!=null&&r.length||e.content.trim())&&t.push({type:"tool",message:e}),(a=e.media)!=null&&a.length&&t.push({type:"media",message:e}),t}function Pz(e,t){for(let n=t.length-1;n>=0;n-=1){const r=t[n].latencyMs;if(cx(r))return r}for(let n=e.length-1;n>=0;n-=1){const r=e[n].latencyMs;if(cx(r))return r}}function cx(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}function Tz(e){const t=Mz(dx(e)),n=[];return[...ux(e.embeds),...ux(e.files)].forEach((a,o)=>{const i=Ez(a);i&&n.push({id:`${e.call_id||dx(e)||"tool"}:${o}:${i.url||i.name||i.kind}`,attachment:i,caption:i.name,source:t})}),n}function Rz(e){return(e.media??[]).map((t,n)=>({id:`${e.id}:media:${n}:${t.url||t.name||t.kind}`,attachment:t,caption:t.name,source:"media"}))}function ux(e){return Array.isArray(e)?e:[]}function dx(e){var t,n;return typeof((t=e.function)==null?void 0:t.name)=="string"?String((n=e.function)==null?void 0:n.name):typeof e.name=="string"?e.name:""}function Mz(e){const t=e.toLowerCase();return t.includes("browser")||t.includes("screenshot")?"browser":t.includes("web")||t.includes("search")||t.includes("fetch")||t.includes("read")?"web":t.includes("exec")||t.includes("shell")||t.includes("cli")?"shell":t.startsWith("mcp_")||t==="mcp"?"mcp":t.includes("file")||t.includes("patch")?"file":t.includes("image")||t.includes("video")||t.includes("media")?"media":"tool"}function Ez(e){if(typeof e=="string"){const i=e.trim();return i?us({url:Lz(i)?i:void 0,name:px(i)}):null}if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=nc(t,["url","href","src","uri","signed_url","thumbnail_url"]),r=nc(t,["path","absolute_path","file","filename"]),a=nc(t,["name","filename","title","label"])??px(n??r??""),o=Iz(t,n,a);return us({url:n,name:a,kind:o})}function nc(e,t){for(const n of t){const r=e[n];if(typeof r=="string"&&r.trim())return r.trim()}}function Iz(e,t,n){var a;const r=((a=nc(e,["kind","type","mime","mime_type","content_type"]))==null?void 0:a.toLowerCase())??"";return r.includes("image")||r.includes("screenshot")?"image":r.includes("video")||r.includes("mp4")||r.includes("quicktime")?"video":r.includes("file")||r.includes("document")?"file":us({url:t,name:n}).kind}function Lz(e){return/^(https?:|data:|\/api\/|blob:)/i.test(e)}function px(e){return(e.split(/[?#]/,1)[0]??"").split(/[\\/]/).filter(Boolean).pop()||void 0}function ll(e){var a,o;if(!e||typeof e!="object")return null;const t=e,n=typeof((a=t.function)==null?void 0:a.name)=="string"?t.function.name:typeof t.name=="string"?t.name:"";if(!n)return null;const r=((o=t.function)==null?void 0:o.arguments)??t.arguments;return typeof r=="string"&&r.trim()?`${n}(${r})`:r&&typeof r=="object"?`${n}(${JSON.stringify(r)})`:`${n}()`}const Dz=new Set(["start","end","error"]),mx={start:1,end:2,error:3};function $C(e){var n,r;if(!Array.isArray(e))return[];const t=[];for(const a of e){if(!a||typeof a!="object")continue;const o=a,i=o.phase;if(!(i&&typeof i=="string"&&Dz.has(i)))continue;const l=typeof o.name=="string"?o.name:"",c=typeof((n=o.function)==null?void 0:n.name)=="string"?String((r=o.function)==null?void 0:r.name):"";!l&&!c||t.push(o)}return t}function fx(e){return e.call_id?`call:${e.call_id}`:ll(e)??JSON.stringify(e)}function Oz(e,t){if(!(e!=null&&e.length))return t;if(!t.length)return e;const n=[...e],r=new Map(n.map((a,o)=>[fx(a),o]));for(const a of t){const o=fx(a),i=r.get(o);if(i===void 0){r.set(o,n.length),n.push(a);continue}const l=n[i],c=mx[String(a.phase)]??0,d=mx[String(l.phase)]??0;n[i]=c>=d?{...l,...a}:l}return n}function UC(e){const t=new Set,n=[];for(const r of $C(e)){const a=r.call_id;if(a&&typeof a=="string"){if(t.has(a))continue;t.add(a)}const o=ll(r);o&&n.push(o)}return n}function Fz(e,t){const n=new Set(e),r=[...e];let a=!1;for(const o of t)n.has(o)||(n.add(o),r.push(o),a=!0);return{traces:r,added:a}}const zz="max-h-52",$z=24;function Uz(e,t,n,r){let a=0,o=0;const i=n.length,l=r.length,c=n[n.length-1],d=c==null?void 0:c.name,p=c==null?void 0:c.status,m=r[r.length-1];for(const k of e){if($u(k)){a+=1;continue}if(k.kind==="trace"){const C=so(k);for(const j of C)!v$(j)&&!x$(j)&&(o+=1)}}let f=0,h=0,y=!1,x=!1,b=0,v=0,g,w;for(const k of t)g=k.path,w=k.absolute_path||k.path,k.status==="editing"&&(x=!0),k.status==="error"&&(b+=1),k.operation==="delete"&&(v+=1),!(k.status==="error"||k.binary)&&DC(k)&&(y=!0,f+=k.added,h+=k.deleted);return{reasoningSteps:a,toolCalls:o,cliCount:i,mcpCount:l,fileCount:t.length,added:f,deleted:h,hasDiffStats:y,hasEditingFiles:x,hasFailedFiles:t.length>0&&b===t.length,hasDeletedFiles:t.length>0&&v===t.length,primaryFilePath:g,primaryFileTooltipPath:w,primaryCliName:d,primaryCliStatus:p,primaryMcpName:m==null?void 0:m.presetName,primaryMcpDisplayName:m==null?void 0:m.displayName,primaryMcpStatus:m==null?void 0:m.status}}function Bz({messages:e,isTurnStreaming:t,hasBodyBelow:n,turnLatencyMs:r,cliApps:a=[],mcpPresets:o=[],onOpenFilePreview:i}){const{t:l}=se(),c=u.useMemo(()=>W$(B$(e),t),[e,t]),d=u.useMemo(()=>w$(e),[e]),p=u.useMemo(()=>S$(e),[e]),m=u.useMemo(()=>new Map(a.map(he=>[he.name.toLowerCase(),he])),[a]),f=u.useMemo(()=>new Map(o.map(he=>[he.name.toLowerCase(),he])),[o]),{reasoningSteps:h,toolCalls:y,cliCount:x,mcpCount:b,fileCount:v,added:g,deleted:w,hasDiffStats:k,hasEditingFiles:C,hasFailedFiles:j,hasDeletedFiles:N,primaryFilePath:P,primaryFileTooltipPath:L,primaryCliName:_,primaryCliStatus:T,primaryMcpDisplayName:R,primaryMcpStatus:D}=Uz(e,c,d,p),K=c.some(he=>he.pending),[G,W]=u.useState(!1),[H,E]=u.useState(!1),[F,X]=u.useState(!1),[Q,re]=u.useState(()=>Date.now()),ue=u.useRef(null),pe=u.useRef(null),ce=u.useRef(!0),z=u.useRef(null),q=u.useRef(t),O=q.current,te=G?H:t||F||O&&!t,ie=t&&C,ve=v===1?P:void 0,me=v===1?L:void 0,Z=h>0||y>0||x>0||b>0||v>0,ke=v>0&&e.every(Hz),ye=y>0||x>0||b>0||v>0,be=Vz(e,t,Q,r),Ie=Kz(be),Pe=ye?t?l("message.activityWorkingFor",{duration:Ie,defaultValue:"Working for {{duration}}"}):be<=0?l("message.activityWorked",{defaultValue:"Worked"}):l("message.activityWorkedFor",{duration:Ie,defaultValue:"Worked for {{duration}}"}):t?l("message.activityThinkingFor",{duration:Ie,defaultValue:"Thinking for {{duration}}"}):be<=0?l("message.activityThought",{defaultValue:"Thought"}):l("message.activityThoughtFor",{duration:Ie,defaultValue:"Thought for {{duration}}"}),Le=v>0?K&&!ve?l("message.fileActivityPreparing",{defaultValue:"Preparing edit…"}):ve?l(z$(ie,j,N),{file:qz(ve),defaultValue:`${rc(ie,j,N)} {{file}}`}):l($$(ie,j,N),{count:v,defaultValue:`${rc(ie,j,N)} {{count}} files`}):"",Te=x>0?x===1&&_?l(A$(T,t),{name:_,defaultValue:_$(T,t)}):l(P$(d,t),{count:x,defaultValue:T$(d,t)}):"",J=b>0?b===1&&R?l(E$(D,t),{name:R,defaultValue:I$(D,t)}):l(L$(p,t),{count:b,defaultValue:D$(p,t)}):"",ee=v>0?Le:x>0?Te:b>0?J:t?h>0?l("message.agentActivityLiveSummary",{reasoning:h,tools:y,defaultValue:"Working… · {{reasoning}} steps · {{tools}} tool calls"}):y===0&&v>0?l("message.agentActivityLiveFilesOnly",{defaultValue:"Working…"}):l("message.agentActivityLiveToolsOnly",{tools:y,defaultValue:"Working… · {{tools}} tool calls"}):h>0?l("message.agentActivitySummary",{reasoning:h,tools:y,defaultValue:"{{reasoning}} steps · {{tools}} tool calls"}):y===0&&v>0?l("message.agentActivityFilesOnly",{defaultValue:"File changes"}):l("message.agentActivityToolsOnly",{tools:y,defaultValue:"{{tools}} tool calls"}),V=u.useCallback(()=>{z.current!==null&&(window.cancelAnimationFrame(z.current),z.current=null)},[]),xe=u.useCallback(()=>{const he=ue.current;he&&(he.scrollTop=Math.max(0,he.scrollHeight-he.clientHeight))},[]),Se=u.useCallback(()=>{V(),z.current=window.requestAnimationFrame(()=>{z.current=null,xe()})},[V,xe]),De=()=>{const he=G?!H:!te;he&&(ce.current=!0),W(!0),E(he)};u.useLayoutEffect(()=>{!te||!ce.current||Se()},[te,e,t,Se]),u.useEffect(()=>{if(!te){ce.current=!0;return}const he=pe.current;if(!he||typeof ResizeObserver>"u")return;const Xe=new ResizeObserver(()=>{ce.current&&Se()});return Xe.observe(he),()=>Xe.disconnect()},[te,Se]),u.useEffect(()=>V,[V]),u.useEffect(()=>{if(!t)return;const he=window.setInterval(()=>re(Date.now()),500);return()=>window.clearInterval(he)},[t]),u.useEffect(()=>{const he=q.current;if(q.current=t,t){X(!1);return}if(!he||G)return;X(!0);const Xe=window.setTimeout(()=>X(!1),900);return()=>window.clearTimeout(Xe)},[t,G]);const Ve=u.useCallback(()=>{const he=ue.current;if(!he)return;const Xe=he.scrollHeight-he.scrollTop-he.clientHeight;ce.current=Xe<$z},[]);return Z?ke?s.jsx(Wz,{edits:c,active:t,hasBodyBelow:n,summary:ee,singleFilePath:ve,singleFileTooltipPath:me,hasLiveEditingFiles:ie,hasFailedFiles:j,hasDeletedFiles:N,added:g,deleted:w,hasDiffStats:k,onOpenFilePreview:i}):s.jsxs("div",{className:A("w-full",n&&"mb-2"),children:[s.jsxs("button",{type:"button",onClick:De,className:A("group flex max-w-full items-center gap-1.5 overflow-hidden rounded-md px-1 py-1","text-[12.5px] text-muted-foreground/72 transition-colors hover:text-muted-foreground"),"aria-expanded":te,"aria-label":ee,children:[s.jsx(zu,{active:t,className:"min-w-0",children:ve?rc(ie,j,N):Pe}),ve?s.jsx(Jf,{path:ve,tooltipPath:me,previewPath:me||ve,onOpen:i,active:ie,className:"-my-0.5 min-w-0",textClassName:"text-xs",testId:"activity-header-file-reference"}):null,s.jsx("span",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-0.5 text-left",children:v>0&&k&&s.jsx("span",{className:"inline-flex min-w-0 items-center gap-1 text-muted-foreground/85",children:s.jsx(th,{added:g,deleted:w})})}),s.jsx(xr,{"aria-hidden":!0,className:A("h-3.5 w-3.5 shrink-0 transition-transform duration-200",te&&"rotate-90")})]}),te&&s.jsx("div",{className:A("ml-1 mt-1 overflow-hidden pl-1"),children:s.jsx("div",{ref:ue,"data-testid":"agent-activity-scroll",onScroll:Ve,className:A(zz,"overflow-y-auto py-1 pr-1 scrollbar-thin scrollbar-track-transparent"),children:s.jsxs("div",{ref:pe,className:"flex flex-col gap-0.5",children:[e.map(he=>$u(he)?s.jsx(yz,{text:he.reasoning??"",streaming:t&&!!he.reasoningStreaming,onOpenFilePreview:i},he.id):he.kind==="trace"?s.jsx(Qz,{message:he,active:t,cliAppsByName:m,mcpPresetsByName:f},he.id):null),c.length?s.jsx(LC,{edits:c,onOpenFilePreview:i}):null]})})})]}):null}function Hz(e){var t;return e.kind!=="trace"||!((t=e.fileEdits)!=null&&t.length)?!1:so(e).every(n=>!n.trim()||y$(n))}function Wz({edits:e,active:t,hasBodyBelow:n,summary:r,singleFilePath:a,singleFileTooltipPath:o,hasLiveEditingFiles:i,hasFailedFiles:l,hasDeletedFiles:c,added:d,deleted:p,hasDiffStats:m,onOpenFilePreview:f}){const h=e.length>1||e.some(y=>y.status==="error"||y.pending);return s.jsxs("div",{className:A("w-full",n&&"mb-2"),"aria-label":r,children:[s.jsxs("div",{className:A("flex max-w-full items-center gap-1.5 px-1 py-1","text-[12.5px] text-muted-foreground/72"),children:[s.jsx(zu,{active:t,className:"min-w-0",children:a?rc(i,l,c):r}),a?s.jsx(Jf,{path:a,tooltipPath:o,previewPath:o||a,onOpen:f,active:i,className:"-my-0.5 min-w-0",textClassName:"text-xs",testId:"activity-header-file-reference"}):null,m?s.jsx("span",{className:"inline-flex min-w-0 items-center gap-1 text-muted-foreground/85",children:s.jsx(th,{added:d,deleted:p})}):null]}),h?s.jsx("div",{className:"mt-0.5 pl-4",children:s.jsx(LC,{edits:e,onOpenFilePreview:f})}):null]})}function qz(e){return e.split(/[\\/]/).pop()||e}function Vz(e,t,n,r){if(!t&&Number.isFinite(r)&&r>=0)return Math.round(r);const a=e.map(l=>l.createdAt).filter(l=>Number.isFinite(l));if(!a.length)return 0;const o=Math.min(...a),i=t&&o>1e12?n:Math.max(...a);return Math.max(0,i-o)}function Kz(e){const t=e>0&&e<1e3?1:Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;return r?`${n}m ${r}s`:`${n}m`}function so(e){var t;return(t=e.traces)!=null&&t.length?e.traces:e.content.trim()?[e.content]:[]}function BC(e){return(e.agentUi??[]).filter(t=>t.kind.startsWith("subagent_"))}function Gz(e){return BC(e).length>0}function Yz({lines:e,active:t,evidenceByLine:n}){return s.jsx("ul",{className:"space-y-1",children:e.map((r,a)=>s.jsx(Jz,{line:r,active:t&&a===e.length-1,evidence:(n==null?void 0:n.get(r))??[]},`${r}-${a}`))})}function Qz({message:e,active:t,cliAppsByName:n,mcpPresetsByName:r}){if(Gz(e))return s.jsx(Xz,{message:e,active:t});const a=so(e),o=b$(e),i=C$(e),l=e$(e),c=Rz(e),d=new Set,p=[];let m=[];const f=y=>{m.length&&(p.push(s.jsx(Yz,{lines:m,active:t,evidenceByLine:l},`${e.id}:trace:${y}`)),m=[])};a.forEach((y,x)=>{const b=o.get(y)??qC(y);if(b){f(String(x)),d.add(b.key),p.push(s.jsx(yx,{runs:[b],active:t,cliAppsByName:n},`${e.id}:cli:${b.key}:${x}`));const g=l.get(y)??[];g.length&&p.push(s.jsx(Hd,{evidence:g},`${e.id}:cli-evidence:${b.key}:${x}`));return}const v=i.get(y)??tS(y);if(v){f(String(x)),d.add(v.key),p.push(s.jsx(bx,{runs:[v],active:t,mcpPresetsByName:r},`${e.id}:mcp:${v.key}:${x}`));const g=l.get(y)??[];g.length&&p.push(s.jsx(Hd,{evidence:g},`${e.id}:mcp-evidence:${v.key}:${x}`));return}m.push(y)}),f("tail");for(const y of o.values())d.has(y.key)||p.push(s.jsx(yx,{runs:[y],active:t,cliAppsByName:n},`${e.id}:cli:${y.key}:event`));for(const y of i.values())d.has(y.key)||p.push(s.jsx(bx,{runs:[y],active:t,mcpPresetsByName:r},`${e.id}:mcp:${y.key}:event`));if(c.length&&p.push(s.jsx(Hd,{evidence:c},`${e.id}:media-evidence`)),!p.length)return null;const h=n$(e,l,c);return s.jsx(IC,{title:h.title,icon:h.icon,children:p})}function Xz({message:e,active:t}){const n=BC(e),r=so(e),a=r.map((o,i)=>{const l=n[Math.min(i,Math.max(n.length-1,0))],c=(l==null?void 0:l.kind)??"subagent_status",d=typeof(l==null?void 0:l.data)=="object"&&(l!=null&&l.data)&&"phase"in l.data?String(l.data.phase??""):"",p=c==="subagent_reasoning"?"Agent 分析":c==="subagent_output"?"Agent 输出":"Agent 状态";return s.jsx(oo,{as:"li",icon:Ga,active:t&&i===r.length-1,tone:c==="subagent_output"?"success":"active",label:p,detail:d?`${d} · ${o}`:o,className:"subagent-activity-step",contentClassName:"subagent-activity-content",markerClassName:"subagent-activity-marker"},`${e.id}:subagent:${i}`)});return s.jsx(IC,{title:"Agent",icon:Ga,children:s.jsx("ul",{className:"space-y-1",children:a})})}function Jz({line:e,active:t,evidence:n=[]}){const r=o$(e),a=r.kind==="search"?It:r.kind==="done"?Xb:r.kind==="tool"?lw:_i;return s.jsx(oo,{as:"li",marker:s.jsx(a$,{trace:r,fallbackIcon:a,active:t}),active:t&&r.kind!=="done",tone:r.kind==="done"?"success":t?"active":"neutral",label:r.label,detail:r.detail,title:`${r.label}${r.detail?` ${r.detail}`:""}`,children:s.jsx(EC,{evidence:n})})}function Hd({evidence:e}){return s.jsx("ul",{className:"space-y-1",children:s.jsx(oo,{as:"li",icon:Xl,tone:"success",label:Zz(e),children:s.jsx(EC,{evidence:e})})})}function Zz(e){var n;const t=(n=e[0])==null?void 0:n.attachment.kind;return t==="image"?e.length>1?"Found images":"Found image":t==="video"?e.length>1?"Found videos":"Found video":e.length>1?"Found files":"Found file"}function e$(e){const t=new Map;for(const n of e.toolEvents??[]){const r=Tz(n);if(!r.length)continue;const a=ll(n);if(!a)continue;const o=t.get(a)??[];t.set(a,[...o,...r])}return t}function t$(e){return[...e.values()].flat()}function n$(e,t,n){var i;const r=[...so(e).map(l=>{var c;return((c=/^([a-zA-Z0-9_.-]+)\(/.exec(l.trim()))==null?void 0:c[1])??l}),...(e.toolEvents??[]).map(r$)].map(l=>l.toLowerCase()),a=[...t$(t),...n];return a.some(l=>l.attachment.kind==="image"||l.attachment.kind==="video")&&r.some(l=>/browser|screenshot|vision|image|video/.test(l))?{title:"Vision",icon:Xl}:r.some(l=>/browser|screenshot/.test(l))?{title:"Browser",icon:Xl}:r.some(l=>/web|search|fetch|read|open/.test(l))?{title:"Web",icon:It}:r.some(l=>/exec|shell|terminal|bash|run_cli_app|cli_anything/.test(l))?{title:"Shell",icon:Mc}:r.some(l=>/^mcp_|mcp/.test(l))?{title:"MCP",icon:ns}:(i=e.fileEdits)!=null&&i.length?{title:"Files",icon:_i}:a.length?{title:"Media",icon:Xl}:{title:"Working",icon:_i}}function r$(e){var t,n;return typeof((t=e.function)==null?void 0:t.name)=="string"?String((n=e.function)==null?void 0:n.name):typeof e.name=="string"?e.name:""}function a$({trace:e,fallbackIcon:t,active:n}){const[r,a]=u.useState(0),o=e.host?Wc(e.host)[r]:void 0;return u.useEffect(()=>a(0),[e.host]),e.url&&e.host&&o?s.jsx("span",{"data-testid":`activity-web-favicon-${e.host}`,className:A("grid h-4 w-4 shrink-0 place-items-center overflow-hidden rounded-[4px] border border-border/45 bg-background shadow-[inset_0_0_0_1px_rgba(0,0,0,0.02)]",n&&"animate-pulse"),"aria-hidden":!0,children:s.jsx("img",{src:o,alt:"",className:"h-3.5 w-3.5 object-contain",onError:()=>a(i=>i+1)})}):s.jsx(t,{className:A("h-3.5 w-3.5 shrink-0",e.kind==="done"?"text-emerald-500/75":n?"text-muted-foreground/75":"text-muted-foreground/45"),"aria-hidden":!0})}function o$(e){const t=e.trim(),n=/^([a-zA-Z0-9_.-]+)\((.*)\)$/.exec(t),r=(n==null?void 0:n[1])??"",a=(n==null?void 0:n[2])??"",o=m$(a,t),i=o?h$(o):"",l=!!o&&/\b(fetch(?:ing|ed)?|read(?:ing)?|opened?|opening)\b/i.test(t);return/search/i.test(r)?{kind:"search",label:"Searching",detail:gx(a,t)}:/fetch|read|open/i.test(r)||l?{kind:"tool",label:"Reading",detail:i||gx(a,t),url:o==null?void 0:o.href,host:o?WC(o.hostname):void 0}:s$(r)?{kind:"tool",label:"Command",detail:i$(a,t)}:r?{kind:"tool",label:"Using",detail:r}:/done|complete|success/i.test(t)?{kind:"done",label:"Done",detail:t}:{kind:"trace",label:"Working",detail:t}}function s$(e){const t=e.toLowerCase().split(".").pop()||e.toLowerCase();return new Set(["exec","exec_command","execute_command","run_command","run_shell","shell","terminal","bash","sh"]).has(t)}function i$(e,t){const n=l$(e)||t;return c$(n)}function l$(e){const t=e.trim();if(!t)return"";try{const n=JSON.parse(t);if(typeof n=="string")return n;if(!n||typeof n!="object"||Array.isArray(n))return"";const r=n;for(const a of["command","cmd","script","input"]){const o=r[a];if(typeof o=="string"&&o.trim())return o}}catch{return t.replace(/^["']|["']$/g,"")}return""}function c$(e){const n=u$(e.replace(/\r\n/g,` `)).split(` `).map(o=>o.trim()).filter(Boolean),r=d$(n[0]||"command"),a=p$(r,92);return n.length<=1?a:`${a} · script, ${n.length} lines`}function u$(e){return e.replace(/\b((?:[A-Z0-9_]*)(?:API[_-]?KEY|TOKEN|SECRET|PASSWORD|PASS|AUTH)(?:[A-Z0-9_]*))=(?:"[^"]*"|'[^']*'|[^\s]+)/gi,"$1=••••").replace(/\b(Bearer)\s+[A-Za-z0-9._~+/=-]+/gi,"$1 ••••").replace(/(--(?:api-?key|token|secret|password)(?:=|\s+))(?:"[^"]*"|'[^']*'|[^\s]+)/gi,"$1••••").replace(/([?&](?:api_?key|token|secret|password)=)[^&\s]+/gi,"$1••••")}function d$(e){return e.replace(/\/Users\/[^/\s"']+/g,"~").replace(/\/private\/tmp\/[^\s"']+/g,"/tmp/…").replace(/\/var\/folders\/[^\s"']+/g,"/var/folders/…")}function p$(e,t){if(e.length<=t)return e;const n=Math.ceil((t-1)*.62),r=Math.floor((t-1)*.38);return`${e.slice(0,n)}…${e.slice(-r)}`}function m$(e,t){var a;const n=[],r=e.trim();if(r)try{HC(JSON.parse(r),n)}catch{n.push(r.replace(/^["']|["']$/g,""))}n.push(t);for(const o of n){const i=hx(o);if(i)return i;const l=(a=o.match(/https?:\/\/[^\s"'<>),]+/i))==null?void 0:a[0];if(l){const c=hx(l);if(c)return c}}return null}function HC(e,t){if(typeof e=="string"){t.push(e);return}if(!e||typeof e!="object")return;if(Array.isArray(e)){for(const r of e.slice(0,6))HC(r,t);return}const n=e;for(const r of["url","uri","href","link"])typeof n[r]=="string"&&t.push(n[r])}function hx(e){try{const t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"||f$(t.hostname)?null:t}catch{return null}}function f$(e){const t=e.replace(/^\[|\]$/g,"").toLowerCase();if(!t||t==="localhost"||t.endsWith(".local")||!t.includes(".")&&!t.includes(":"))return!0;const n=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(t);if(n){const[,r,a]=n,o=Number(r),i=Number(a);return o===0||o===10||o===127||o===100&&i>=64&&i<=127||o===169&&i===254||o===172&&i>=16&&i<=31||o===192&&i===168}return t==="::1"||t.startsWith("fc")||t.startsWith("fd")||t.startsWith("fe80:")}function WC(e){return e.replace(/^www\./i,"").toLowerCase()}function h$(e){const t=WC(e.hostname),n=e.pathname&&e.pathname!=="/"?e.pathname:"";return`${t}${n}`}function gx(e,t){const n=e.trim();if(!n)return t;try{const r=JSON.parse(n),a=ZC(r);if(a)return a}catch{}return n.replace(/^["']|["']$/g,"")}const g$=new Set(["run_cli_app","cli_anything_run"]),vx={running:1,done:2,error:3},xx={running:1,done:2,error:3},Uu=/^mcp_([a-z0-9_-]+?)_(.+)$/i;function v$(e){return/^(run_cli_app|cli_anything_run)\(/.test(e.trim())}function x$(e){return Uu.test(e.trim().split("(",1)[0]??"")}function y$(e){return/^(write_file|edit_file|apply_patch)\(/.test(e.trim())}function qC(e,t="running"){const n=/^(run_cli_app|cli_anything_run)\((.*)\)$/.exec(e.trim());if(!n)return null;const r=n[2].trim();let a={};if(r)try{a=JSON.parse(r)}catch{return{key:e,name:"cli",args:[r],json:!1,status:t}}return QC(a,{key:e,status:t})}function VC(e){var r;const n=((r=e.function)==null?void 0:r.arguments)??e.arguments;if(typeof n!="string")return n??{};if(!n.trim())return{};try{return JSON.parse(n)}catch{return{args:[n]}}}function KC(e){return e==="error"?"error":e==="end"?"done":"running"}function GC(e){const t=e.error;if(typeof t=="string")return t;if(t&&typeof t=="object")return JSON.stringify(t)}function YC(e){var t,n;return typeof((t=e.function)==null?void 0:t.name)=="string"?String((n=e.function)==null?void 0:n.name):typeof e.name=="string"?e.name:""}function QC(e,t){if(!e||typeof e!="object"||Array.isArray(e))return{key:t.key,name:"cli",args:[],json:!1,status:t.status,error:t.error};const n=e,r=typeof n.name=="string"&&n.name.trim()?n.name.trim():"cli",o=(Array.isArray(n.args)?n.args:[]).filter(i=>typeof i=="string");return{key:t.key,name:r,args:o,json:n.json===!0||n.json==="true",workingDir:typeof n.working_dir=="string"?n.working_dir:void 0,status:t.status,error:t.error}}function XC(e){const t=YC(e);if(!g$.has(t))return null;const n=VC(e),r=e.call_id?`call:${e.call_id}`:`${t}:${JSON.stringify(n)}`;return QC(n,{key:r,status:KC(e.phase),error:GC(e)})}function b$(e){const t=new Map;for(const n of e.toolEvents??[]){const r=XC(n);if(!r)continue;const a=ll(n);a&&t.set(a,JC(t.get(a),r))}return t}function JC(e,t){return e?vx[t.status]>=vx[e.status]?{...e,...t}:e:t}function w$(e){const t=new Map;for(const n of e){if(n.kind!=="trace")continue;let r=!1;for(const a of n.toolEvents??[]){const o=XC(a);o&&(r=!0,t.set(o.key,JC(t.get(o.key),o)))}if(!r)for(const a of so(n)){const o=qC(a);!o||t.has(o.key)||t.set(o.key,o)}}return[...t.values()]}function k$(e){return e.split(/[-_]/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")||e}function Fl(e){return typeof e=="string"&&e.trim()?e.trim():typeof e=="number"||typeof e=="boolean"?String(e):null}function ZC(e){if(!e||typeof e!="object"||Array.isArray(e))return Fl(e)??"";const t=e;for(const r of["url","query","q","path","name","id","title","message","text"]){const a=Fl(t[r]);if(a)return`${r}: ${a}`}return Object.entries(t).filter(([,r])=>Fl(r)!==null).slice(0,2).map(([r,a])=>`${r}: ${Fl(a)}`).join(" · ")}function eS(e,t,n){const r=Uu.exec(e);if(!r)return null;const a=r[1].toLowerCase();return{key:n.key,presetName:a,displayName:k$(a),toolName:r[2],argsPreview:ZC(t),status:n.status,error:n.error}}function tS(e,t="running"){const n=/^([a-z0-9_-]+)\((.*)\)$/i.exec(e.trim());if(!n||!Uu.test(n[1]))return null;const r=n[2].trim();let a={};if(r)try{a=JSON.parse(r)}catch{a=r}return eS(n[1],a,{key:e,status:t})}function nS(e){const t=YC(e);if(!Uu.test(t))return null;const n=VC(e),r=e.call_id?`call:${e.call_id}`:`${t}:${JSON.stringify(n)}`;return eS(t,n,{key:r,status:KC(e.phase),error:GC(e)})}function C$(e){const t=new Map;for(const n of e.toolEvents??[]){const r=nS(n);if(!r)continue;const a=ll(n);a&&t.set(a,rS(t.get(a),r))}return t}function rS(e,t){return e?xx[t.status]>=xx[e.status]?{...e,...t}:e:t}function S$(e){const t=new Map;for(const n of e){if(n.kind!=="trace")continue;let r=!1;for(const a of n.toolEvents??[]){const o=nS(a);o&&(r=!0,t.set(o.key,rS(t.get(o.key),o)))}if(!r)for(const a of so(n)){const o=tS(a);!o||t.has(o.key)||t.set(o.key,o)}}return[...t.values()]}function N$(e){return/\s/.test(e)?JSON.stringify(e):e}function j$(e){return[...e.json?["--json"]:[],...e.args].map(N$).join(" ")}function A$(e,t){return e==="error"?"message.cliActivityFailedOne":t&&e==="running"?"message.cliActivityRunningOne":"message.cliActivityRanOne"}function _$(e,t){return e==="error"?"Failed @{{name}}":`${t&&e==="running"?"Using":"Used"} @{{name}}`}function P$(e,t){return e.some(n=>n.status==="error")?"message.cliActivityFailedMany":t&&e.some(n=>n.status==="running")?"message.cliActivityRunningMany":"message.cliActivityRanMany"}function T$(e,t){return e.some(n=>n.status==="error")?"{{count}} CLI apps failed":`${t&&e.some(n=>n.status==="running")?"Using":"Used"} {{count}} CLI apps`}function R$(e,t){return e.status==="error"?"message.cliRunFailed":t&&e.status==="running"?"message.cliRunRunning":"message.cliRunRan"}function M$(e,t){return e.status==="error"?"Failed":t&&e.status==="running"?"Using":"Used"}function E$(e,t){return e==="error"?"message.mcpActivityFailedOne":t&&e==="running"?"message.mcpActivityRunningOne":"message.mcpActivityRanOne"}function I$(e,t){return e==="error"?"Failed {{name}}":`${t&&e==="running"?"Using":"Used"} {{name}}`}function L$(e,t){return e.some(n=>n.status==="error")?"message.mcpActivityFailedMany":t&&e.some(n=>n.status==="running")?"message.mcpActivityRunningMany":"message.mcpActivityRanMany"}function D$(e,t){return e.some(n=>n.status==="error")?"{{count}} MCP calls failed":`${t&&e.some(n=>n.status==="running")?"Using":"Used"} {{count}} MCP tools`}function O$(e,t){return e.status==="error"?"message.mcpRunFailed":t&&e.status==="running"?"message.mcpRunRunning":"message.mcpRunRan"}function F$(e,t){return e.status==="error"?"Failed":t&&e.status==="running"?"Using":"Used"}function rc(e,t,n){return t?"Failed":n?e?"Deleting":"Deleted":e?"Editing":"Edited"}function z$(e,t,n){return t?"message.fileActivityFailedOne":n?e?"message.fileActivityDeletingOne":"message.fileActivityDeletedOne":e?"message.fileActivityEditingOne":"message.fileActivityEditedOne"}function $$(e,t,n){return t?"message.fileActivityFailedMany":n?e?"message.fileActivityDeletingMany":"message.fileActivityDeletedMany":e?"message.fileActivityEditingMany":"message.fileActivityEditedMany"}function U$(e){return e.call_id?`${e.call_id}|${e.tool}`:`${e.tool}|${e.path}`}function B$(e){var n;const t=[];for(const r of e)r.kind==="trace"&&((n=r.fileEdits)!=null&&n.length)&&t.push(...r.fileEdits);return t}function H$(e){const t=[],n=new Map;for(const r of e){const a=U$(r);n.has(a)||t.push(a),n.set(a,r)}return t.map(r=>n.get(r)).filter(Boolean)}function W$(e,t){const n=[],r=new Map;for(const a of H$(e)){const o=a.path||a.call_id||a.tool;let i=r.get(o);if(i||(i={key:o,path:a.path||"",absolute_path:a.absolute_path,added:0,deleted:0,approximate:!1,binary:!1,pending:!1,hasSuccessfulChange:!1,hasActiveEditing:!1,hasFailed:!1,operation:void 0},r.set(o,i),n.push(o)),a.path&&!i.path&&(i.path=a.path),a.absolute_path&&(i.absolute_path=a.absolute_path),a.operation==="delete"&&(i.operation="delete"),i.pending=i.pending||!!a.pending||!a.path,!a.path&&a.pending){t&&a.status==="editing"&&(i.hasActiveEditing=!0,i.approximate=i.approximate||!!a.approximate,a.binary||(i.added+=a.added,i.deleted+=a.deleted));continue}if(t&&a.status==="editing"){i.hasActiveEditing=!0,i.binary=i.binary||!!a.binary,i.approximate=i.approximate||!!a.approximate,a.binary||(i.added+=a.added,i.deleted+=a.deleted);continue}if(a.status==="error"){i.hasFailed=!0,i.error=a.error??i.error;continue}i.hasSuccessfulChange=!0,i.binary=i.binary||!!a.binary,i.approximate=t&&(i.approximate||!!a.approximate),a.binary||(i.added+=a.added,i.deleted+=a.deleted)}return n.flatMap(a=>{const o=r.get(a);if(!o.path&&!o.hasActiveEditing&&!o.hasSuccessfulChange&&!o.hasFailed)return[];const i=o.hasActiveEditing?"editing":o.hasSuccessfulChange?"done":o.hasFailed?"error":"done";return[{key:o.key,path:o.path,absolute_path:o.absolute_path,added:o.added,deleted:o.deleted,approximate:o.approximate,binary:o.binary,status:i,operation:o.operation,pending:o.pending&&!o.path,error:o.error}]})}function yx({runs:e,active:t,cliAppsByName:n}){return e.length===0?null:s.jsx("ul",{className:"space-y-1","data-testid":"activity-cli-runs",children:e.map(r=>s.jsx(q$,{run:r,active:t,app:n.get(r.name.toLowerCase())},r.key))})}function q$({run:e,active:t,app:n}){const{t:r}=se(),[a,o]=u.useState(0),i=j$(e),l=e.status==="error",c=t&&e.status==="running",d=l?"#DC2626":(n==null?void 0:n.brand_color)||"#0891B2",m=u.useMemo(()=>ao(n==null?void 0:n.logo_url),[n==null?void 0:n.logo_url])[a],f=r(R$(e,t),{defaultValue:M$(e,t)});return u.useEffect(()=>o(0),[n==null?void 0:n.logo_url]),s.jsx(oo,{as:"li",active:c,tone:l?"error":c?"active":e.status==="done"?"success":"neutral",title:`${f} @${e.name}${i?` ${i}`:""}${e.error?` ${e.error}`:""}`,label:f,marker:s.jsx("span",{"data-testid":`activity-cli-logo-${e.name.toLowerCase()}`,className:A("grid h-4 w-4 shrink-0 place-items-center overflow-hidden rounded-[4px] border text-[6.5px] font-semibold text-white",c&&"animate-pulse"),style:{borderColor:Kc(d,22),backgroundColor:m?"hsl(var(--background))":d,boxShadow:c?`0 0 0 3px ${Kc(d,9)}`:void 0},"aria-hidden":!0,children:m?s.jsx("img",{src:m,alt:"",className:"h-[78%] w-[78%] object-contain",onError:()=>o(h=>h+1)}):n?cC(n).slice(0,2):s.jsx(Mc,{className:"h-3 w-3","aria-hidden":!0})}),children:s.jsxs("div",{className:"-mt-0.5 flex min-w-0 flex-wrap items-baseline gap-x-1.5 gap-y-0.5",children:[s.jsxs("span",{className:"max-w-[11rem] shrink-0 truncate font-mono text-[12.5px] font-semibold text-foreground/90",children:["@",e.name]}),l?s.jsx(ja,{className:"h-3 w-3 shrink-0 translate-y-[0.16em] text-destructive/75","aria-hidden":!0}):null,i?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"shrink-0 text-muted-foreground/36",children:"·"}),s.jsx("span",{className:"min-w-0 truncate font-mono text-[12px] text-muted-foreground/72",children:i})]}):null,e.error?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"shrink-0 text-muted-foreground/30",children:"·"}),s.jsx("span",{className:"min-w-0 truncate text-[12px] text-destructive/72",children:e.error})]}):null,e.workingDir&&!e.error?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"shrink-0 text-muted-foreground/30",children:"·"}),s.jsx("span",{className:"min-w-0 truncate text-[12px] text-muted-foreground/55",children:e.workingDir})]}):null]})})}function bx({runs:e,active:t,mcpPresetsByName:n}){return e.length===0?null:s.jsx("ul",{className:"space-y-1","data-testid":"activity-mcp-runs",children:e.map(r=>s.jsx(V$,{run:r,active:t,preset:n.get(r.presetName.toLowerCase())},r.key))})}function V$({run:e,active:t,preset:n}){const{t:r}=se(),[a,o]=u.useState(0),i=e.status==="error",l=t&&e.status==="running",c=i?"#DC2626":(n==null?void 0:n.brand_color)||"#6D5DF6",p=u.useMemo(()=>ao(n==null?void 0:n.logo_url),[n==null?void 0:n.logo_url])[a],m=(n==null?void 0:n.display_name)||e.displayName,f=r(O$(e,t),{defaultValue:F$(e,t)});return u.useEffect(()=>o(0),[n==null?void 0:n.logo_url]),s.jsx(oo,{as:"li",active:l,tone:i?"error":l?"active":e.status==="done"?"success":"neutral",title:`${f} ${m} ${e.toolName}${e.argsPreview?` ${e.argsPreview}`:""}${e.error?` ${e.error}`:""}`,label:f,marker:s.jsx("span",{"data-testid":`activity-mcp-logo-${e.presetName.toLowerCase()}`,className:A("grid h-4 w-4 shrink-0 place-items-center overflow-hidden rounded-[4px] border text-[6.5px] font-semibold text-white",l&&"animate-pulse"),style:{borderColor:Kc(c,22),backgroundColor:p?"hsl(var(--background))":c,boxShadow:l?`0 0 0 3px ${Kc(c,9)}`:void 0},"aria-hidden":!0,children:p?s.jsx("img",{src:p,alt:"",className:"h-[78%] w-[78%] object-contain",onError:()=>o(h=>h+1)}):n?uC(n).slice(0,2):s.jsx(ns,{className:"h-3 w-3","aria-hidden":!0})}),children:s.jsxs("div",{className:"-mt-0.5 flex min-w-0 flex-wrap items-baseline gap-x-1.5 gap-y-0.5",children:[s.jsx("span",{className:"max-w-[12rem] shrink-0 truncate text-[12.5px] font-semibold text-foreground/90",children:m}),i?s.jsx(ja,{className:"h-3 w-3 shrink-0 translate-y-[0.16em] text-destructive/75","aria-hidden":!0}):null,s.jsx("span",{className:"shrink-0 text-muted-foreground/36",children:"·"}),s.jsxs("span",{className:"min-w-0 truncate font-mono text-[12px] text-muted-foreground/72",children:[e.toolName,e.argsPreview?` · ${e.argsPreview}`:""]}),e.error?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"shrink-0 text-muted-foreground/30",children:"·"}),s.jsx("span",{className:"min-w-0 truncate text-[12px] text-destructive/72",children:e.error})]}):null]})})}function Kc(e,t){if(/^#[0-9a-f]{6}$/i.test(e)){const n=Math.round(t/100*255).toString(16).padStart(2,"0");return`${e}${n}`}return`color-mix(in srgb, ${e} ${t}%, transparent)`}function K$(e,t=!1){const n=wz(e,{preserveTrailingActivity:t});return t?Z$(n):n}function G$(e){const t=new Array(e.length).fill(!0);let n=!1;for(let r=e.length-1;r>=0;r-=1){const a=e[r];if(a.type==="message"&&a.message.role==="user"){n=!1;continue}a.type==="message"&&a.message.role==="assistant"&&(t[r]=!n),n=!0}return t}function Y$({messages:e,isStreaming:t=!1,hiddenUserMessageCount:n=0,cliApps:r=[],mcpPresets:a=[],forkBoundaryMessageCount:o=null,onOpenFilePreview:i,onForkFromMessage:l}){const{t:c}=se(),d=u.useMemo(()=>K$(e,t),[t,e]),p=u.useMemo(()=>Q$(d,o),[o,d]),m=u.useMemo(()=>G$(d),[d]),f=u.useMemo(()=>t?J$(d):new Set,[t,d]),h=u.useMemo(()=>e8(d),[d]);let y=n;return s.jsx("div",{className:"flex w-full flex-col",children:d.map((x,b)=>{const v=d[b-1],g=b>0?n8(v):"",w=d[b+1],k=x.type==="activity"&&(w==null?void 0:w.type)==="message"&&w.message.role==="assistant",C=x.type==="message"&&x.message.role==="user"?x.message.id:void 0,j=x.type==="message"&&x.message.role==="assistant"&&m[b]?y:void 0;return x.type==="message"&&x.message.role==="user"&&(y+=1),s.jsxs(u.Fragment,{children:[s.jsx("div",{className:g,"data-user-prompt-id":C,children:x.type==="activity"?s.jsx(Bz,{messages:x.messages,isTurnStreaming:f.has(b),hasBodyBelow:k,turnLatencyMs:x.turnLatencyMs,cliApps:r,mcpPresets:a,onOpenFilePreview:i}):s.jsx(sz,{message:x.message,showAssistantCopyAction:x.message.role==="assistant"?m[b]:!0,cliApps:r,mcpPresets:a,onOpenFilePreview:i,onForkFromHere:l&&j!==void 0?()=>l(j):void 0})}),b===p?s.jsx(X$,{label:c("thread.forkedFromHistory")}):null]},h[b])})})}function Q$(e,t){if(t==null||t<=0)return null;let n=0;for(let r=0;r=t)return r}return null}function X$({label:e}){return s.jsxs("div",{className:"my-5 flex items-center gap-3 text-[11px] text-muted-foreground/80",children:[s.jsx("span",{"aria-hidden":!0,className:"h-px flex-1 bg-border/70"}),s.jsx("span",{className:"shrink-0",children:e}),s.jsx("span",{"aria-hidden":!0,className:"h-px flex-1 bg-border/70"})]})}function J$(e){const t=new Set;let n=!1;for(let r=e.length-1;r>=0;r-=1){const a=e[r];if(a.type==="activity"){n||(t.add(r),n=!0);continue}if(!(a.message.role==="assistant"&&a.message.isStreaming)&&a.message.role==="user")break}return t}function Z$(e){var l;if(e.length<2)return e;let t=e.length-1;for(;t>0;){const c=e[t-1];if(c.type==="message"&&c.message.role==="user")break;t-=1}const n=e.slice(t);let r=-1;for(let c=n.length-1;c>=0;c-=1)if(((l=n[c])==null?void 0:l.type)==="activity"){r=c;break}if(r===-1||r===n.length-1||n.slice(r+1).some(c=>c.type!=="activity"))return e;const o=n[r];if(!o||o.type!=="activity")return e;const i=[...n.slice(0,r),...n.slice(r+1),o];return[...e.slice(0,t),...i]}function e8(e){const t=new Map;return e.map((n,r)=>{const a=t8(n,r);if(!a.startsWith("turn-")||a.endsWith("-user"))return a;const o=(t.get(a)??0)+1;return t.set(a,o),`${a}-${o}`})}function t8(e,t){if(e.type==="activity"){const r=e.messages[0],a=wx(r,"activity");if(a)return a;const o=r==null?void 0:r.id;return o!=null?`activity-${o}`:`activity-idx-${t}`}const n=wx(e.message);return n||e.message.id}function wx(e,t){if(!(e!=null&&e.turnId))return null;const n=e.turnPhase??t??e.kind??e.role;return e.role==="user"?`turn-${e.turnId}-user`:e.kind==="trace"?`turn-${e.turnId}-${n}-${e.activitySegmentId??"activity"}`:`turn-${e.turnId}-${n}`}function n8(e){if(e.type==="activity")return"mt-4";const t=e.message;return t.kind==="trace"||t.role==="assistant"&&t.content.trim().length===0&&(!!t.reasoning||!!t.reasoningStreaming)?"mt-2":"mt-5"}const kx=48,r8=96,a8=192,o8=16,s8=80,Wd=18,Cx=160,Sx=120;function i8(e,t){if(e.length<=t)return e;let n=Math.max(0,e.length-t);for(;n>0&&Ba(e[n])&&Ba(e[n-1]);)n-=1;return e.slice(n)}function ym(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLTextAreaElement?!0:e instanceof HTMLInputElement?!["button","checkbox","color","file","hidden","image","radio","range","reset","submit"].includes(e.type):!1:!1}function l8(e){const t=window.visualViewport;if(!t)return 0;const n=document.activeElement;if(!ym(n)||!(e!=null&&e.contains(n)))return 0;const a=(window.innerHeight||document.documentElement.clientHeight)-t.height-t.offsetTop;return a>=s8?Math.ceil(a):0}const c8=u.forwardRef(function({messages:t,isStreaming:n,composer:r,emptyState:a,scrollToBottomSignal:o=0,scrollToLatestUserPromptSignal:i=0,conversationKey:l=null,showScrollToBottomButton:c=!0,cliApps:d=[],mcpPresets:p=[],forkBoundaryMessageCount:m=null,hasMoreBefore:f=!1,loadingOlder:h=!1,userMessageOffset:y=0,onLoadOlder:x,onOpenFilePreview:b,onForkFromMessage:v},g){const{t:w}=se(),k=u.useRef(null),C=u.useRef(null),j=u.useRef(null),N=u.useRef(null),P=u.useRef(l),L=u.useRef(!0),_=u.useRef(null),T=u.useRef([]),R=u.useRef(null),D=u.useRef(0),K=u.useRef(null),G=u.useRef(null),W=u.useRef(!1),[H,E]=u.useState(!0),[F,X]=u.useState(0),[Q,re]=u.useState(0),[ue,pe]=u.useState(Cx),ce=t.length>0,z=u.useMemo(()=>i8(t,ue),[t,ue]),q=t.length-z.length,O=y+(q>0?t.slice(0,q).filter(J=>J.role==="user").length:0),te=m!==null&&m>q?m-q:null,ie=Q+(F>0?F+o8:a8),ve=Q>0?{bottom:Q}:void 0,me=u.useCallback(()=>{for(const J of T.current)window.cancelAnimationFrame(J);T.current=[]},[]),Z=u.useCallback(J=>{R.current=J},[]),ke=u.useCallback((J=!1)=>{var Se;const ee=k.current,V=N.current,xe=J?"smooth":"auto";if(ee){const De=Math.max(0,ee.scrollHeight-ee.clientHeight);try{(Se=ee.scrollTo)==null||Se.call(ee,{top:De,behavior:xe}),J||(ee.scrollTop=De)}catch{try{ee.scrollTop=De}catch{}}}else V&&V.scrollIntoView({block:"end",behavior:xe});W.current=!1,E(!0)},[]),ye=u.useCallback(J=>{var De;const ee=k.current;if(!ee)return!1;const V=ui(ee,J);if(!V)return!1;const xe=Math.max(0,Zf(ee,V)-16);Z(xe);try{(De=ee.scrollTo)==null||De.call(ee,{top:xe,behavior:"auto"}),ee.scrollTop=xe}catch{try{ee.scrollTop=xe}catch{}}const Se=ee.scrollHeight-xe-ee.clientHeight{const xe=(V==null?void 0:V.force)??!1;me();const Se=()=>{!xe&&W.current||ke(J)},De=Ve=>{if(Ve<=0)return;const he=window.requestAnimationFrame(()=>{T.current=T.current.filter(Xe=>Xe!==he),!(!xe&&W.current)&&(ke(J),De(Ve-1))});T.current.push(he)};Se(),De(ee-1)},[me,ke]),Ie=u.useCallback(()=>{const J=k.current;if(J&&(G.current={height:J.scrollHeight,top:J.scrollTop}),W.current=!0,K.current=null,E(!1),q>0){pe(ee=>Math.min(t.length,ee+Sx));return}f&&x&&!h&&(pe(ee=>ee+Sx),x())},[f,q,h,t.length,x]),Pe=u.useCallback(()=>{const J=k.current;!J||!ce||L.current||W.current&&(J.scrollTop>r8||q<=0&&!f||Ie())},[ce,f,q,Ie]),Le=u.useCallback(J=>{const ee=k.current;if(ee&&ui(ee,J)){hm(ee,J);return}const V=t.findIndex(xe=>xe.id===J);V<0||(_.current=J,W.current=!0,K.current=null,E(!1),pe(xe=>Math.max(xe,t.length-V)))},[t]);u.useImperativeHandle(g,()=>({jumpToUserPrompt:Le}),[Le]);const Te=u.useCallback(()=>{const J=j.current;if(!J)return;const ee=J.getBoundingClientRect().height||J.offsetHeight;X(V=>Math.abs(V-ee)<1?V:ee)},[]);return u.useLayoutEffect(()=>{const J=()=>{const V=k.current,xe=l8(V),Se=document.activeElement,De=ce&&ym(Se)&&!!(V!=null&&V.contains(Se));re(Ve=>Math.abs(Ve-xe)<1?Ve:xe),De&&(W.current=!1,be(!1,Wd,{force:!0}))};J();const ee=window.visualViewport;return ee==null||ee.addEventListener("resize",J),ee==null||ee.addEventListener("scroll",J),window.addEventListener("resize",J),document.addEventListener("focusin",J),document.addEventListener("focusout",J),()=>{ee==null||ee.removeEventListener("resize",J),ee==null||ee.removeEventListener("scroll",J),window.removeEventListener("resize",J),document.removeEventListener("focusin",J),document.removeEventListener("focusout",J)}},[ce,be]),u.useLayoutEffect(()=>{if(Q>0){W.current=!1,be(!1,Wd,{force:!0});return}W.current||be(!1,4)},[Q,be]),u.useEffect(()=>{const J=k.current;if(!J)return;const ee=()=>{const V=document.activeElement;!ce||!ym(V)||!J.contains(V)||(W.current=!1,be(!1,Wd,{force:!0}))};return document.addEventListener("focusin",ee),()=>document.removeEventListener("focusin",ee)},[ce,be]),u.useEffect(()=>{o<=0||(W.current=!1,be(!1,8))},[o,be]),u.useLayoutEffect(()=>{if(i<=D.current)return;const J=t[t.length-1];!J||J.role!=="user"||(D.current=i,me(),K.current=J.id,ye(J.id)||(K.current=null))},[me,t,i,ye]),u.useLayoutEffect(()=>{P.current!==l&&(P.current=l,L.current=!0,W.current=!1,K.current=null,E(!0),pe(Cx))},[l]),u.useLayoutEffect(()=>{const J=K.current;if(!J||W.current)return;const ee=t.findIndex(xe=>xe.id===J);if(ee<0){K.current=null;return}t.slice(ee+1).some(xe=>xe.role!=="user")&&be(!1,n?3:1)},[n,t,be]),u.useLayoutEffect(()=>{ce&&(W.current||be(!1,n?4:2,{force:!0}))},[ce,n,be,z]),u.useLayoutEffect(()=>{var Se;const J=G.current;if(!J)return;const ee=k.current;if(G.current=null,!ee)return;const V=ee.scrollHeight-J.height,xe=J.top+V;try{ee.scrollTop=xe}catch{try{(Se=ee.scrollTo)==null||Se.call(ee,{top:xe,behavior:"auto"})}catch{}}},[z.length,t.length]),u.useLayoutEffect(()=>{const J=_.current,ee=k.current;if(!J||!ee||!ui(ee,J))return;_.current=null;const V=window.requestAnimationFrame(()=>hm(ee,J));return()=>window.cancelAnimationFrame(V)},[z.length]),u.useLayoutEffect(()=>{if(L.current){if(!l){L.current=!1,be(!1,4);return}be(!1,8),ce&&(L.current=!1)}},[l,ce,t,be]),u.useLayoutEffect(()=>{Te()},[r,ce,Te]),u.useEffect(()=>me,[me]),u.useEffect(()=>{const J=j.current;if(!J||typeof ResizeObserver>"u")return;const ee=new ResizeObserver(()=>Te());return ee.observe(J),()=>ee.disconnect()},[ce,Te]),u.useEffect(()=>{const J=k.current;if(!J)return;const ee=(xe=!0)=>{const De=J.scrollHeight-J.scrollTop-J.clientHeightee(!0);return J.addEventListener("scroll",V,{passive:!0}),()=>J.removeEventListener("scroll",V)},[Pe]),s.jsxs("div",{className:"relative flex min-h-0 flex-1 overflow-hidden",children:[s.jsxs("div",{ref:k,className:A("thread-viewport-scrollbar absolute inset-0 overflow-y-auto scroll-auto scrollbar-thin","[&::-webkit-scrollbar]:w-1.5","[&::-webkit-scrollbar-thumb]:rounded-full","[&::-webkit-scrollbar-thumb]:bg-muted-foreground/30","[&::-webkit-scrollbar-track]:bg-transparent"),style:ve,children:[ce?s.jsxs("div",{ref:C,className:"mx-auto flex min-h-full w-full max-w-[64rem] flex-col",children:[s.jsx("div",{"data-testid":"thread-message-region",className:"flex min-h-0 flex-1 flex-col justify-start px-3 pb-4 pt-4 sm:px-4",children:s.jsx("div",{className:"mx-auto w-full max-w-[49.5rem]",children:s.jsx(Y$,{messages:z,isStreaming:n,hiddenUserMessageCount:O,cliApps:d,mcpPresets:p,forkBoundaryMessageCount:te,onOpenFilePreview:b,onForkFromMessage:v})})}),s.jsx("div",{ref:j,"data-testid":"thread-composer-dock",className:"sticky bottom-0 z-10 bg-background",children:s.jsx("div",{className:"px-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] sm:px-4",children:r})})]}):s.jsx("div",{ref:C,className:"mx-auto flex min-h-full w-full max-w-[72rem] flex-col px-3 sm:px-4",children:s.jsx("div",{className:"flex w-full flex-1 items-center justify-center py-6 sm:py-12",children:s.jsxs("div",{className:"relative flex w-full max-w-[58rem] flex-col items-center gap-5 sm:block",children:[s.jsx("div",{className:"flex justify-center sm:absolute sm:inset-x-0 sm:bottom-[calc(100%+1.5rem)]",children:a}),s.jsx("div",{className:"w-full",children:r})]})})}),s.jsx("div",{ref:N,"aria-hidden":!0,className:"h-px"})]}),s.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 top-0 h-6 bg-gradient-to-b from-background to-transparent"}),ce?s.jsx(VF,{messages:z,scrollRef:k,bottomOffset:ie}):null,c&&!H&&s.jsx("div",{className:"absolute left-1/2 z-20 -translate-x-1/2",style:{bottom:ie},children:s.jsx(fe,{variant:"outline",size:"icon",onClick:()=>be(!0,1,{force:!0}),className:A("h-8 w-8 rounded-full shadow-md","bg-background/90 backdrop-blur","animate-in fade-in-0 zoom-in-95"),"aria-label":w("thread.scrollToBottom"),children:s.jsx(Uj,{className:"h-4 w-4"})})})]})}),u8=new Set(["write_file","edit_file","apply_patch"]);function Ra(e,t){const n={};typeof e.turn_id=="string"&&e.turn_id.length>0&&(n.turnId=e.turn_id);const r=e.turn_phase??t;return r&&(n.turnPhase=r),typeof e.turn_seq=="number"&&Number.isFinite(e.turn_seq)&&(n.turnSeq=e.turn_seq),n}function ds(e,t){return!t.turnId||!e.turnId||e.turnId===t.turnId}function Nx(e,t,n={}){for(let r=e.length-1;r>=0;r-=1){const a=e[r];if(a.kind!=="trace"){if(a.role==="assistant"&&a.isStreaming&&!t.has(a.id)&&ds(a,n))return r;if(a.role==="user")break}}return null}function jx(e,t,n,r={}){for(let o=e.length-1;o>=0;o-=1){const i=e[o];if(i.role==="user"||i.kind==="trace")break;if(i.role!=="assistant")continue;if(!ds(i,r))break;const l=i.activitySegmentId??(n==null?void 0:n.ensure());if(i.content.length>0)break;if(i.reasoningStreaming||i.reasoning!==void 0||i.isStreaming){const d={...i,reasoning:(i.reasoning??"")+t,reasoningStreaming:!0,...l?{activitySegmentId:l}:{},...r};return[...e.slice(0,o),d,...e.slice(o+1)]}break}const a=n==null?void 0:n.ensure();return[...e,{id:crypto.randomUUID(),role:"assistant",content:"",isStreaming:!0,reasoning:t,reasoningStreaming:!0,...a?{activitySegmentId:a}:{},...r,createdAt:Date.now()}]}function d8(e,t={}){const n=e[e.length-1];return!n||n.role!=="assistant"||n.kind==="trace"||n.content.length>0||!n.isStreaming||!ds(n,t)?null:e.length-1}function qd(e,t,n){const r=e.slice();return r[t]=n,r}function Ax(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(!n.reasoningStreaming)continue;const r=n.latencyMs===void 0&&Number.isFinite(n.createdAt)&&n.createdAt>1e12?Math.max(0,Math.round(Date.now()-n.createdAt)):n.latencyMs,a={...n,reasoningStreaming:!1,...r!==void 0?{latencyMs:r}:{}};return[...e.slice(0,t),a,...e.slice(t+1)]}return e}function aS(e){var t;return e.role==="assistant"&&e.kind!=="trace"&&e.content.trim().length===0&&!!e.reasoning&&!e.reasoningStreaming&&!((t=e.media)!=null&&t.length)}function p8(e){return(e==null?void 0:e.kind)==="trace"}function _x(e){return e.filter((t,n)=>aS(t)?p8(e[n+1]):!0)}function m8(e,t,n){for(let r=e.length-1;r>=0;r-=1){const a=e[r];if(a.role==="assistant"&&a.kind!=="trace"&&(!n||!a.turnId||a.turnId===n)){const o={...a,latencyMs:t,isStreaming:!1};return[...e.slice(0,r),o,...e.slice(r+1)]}}return e}function f8(e,t){const n=e[e.length-1];return!n||!aS(n)||!ds(n,t)?[...e,{id:crypto.randomUUID(),role:"assistant",createdAt:Date.now(),...t}]:[...e.slice(0,-1),{...n,...t,isStreaming:!1,reasoningStreaming:!1}]}function ps(e){return e.call_id?`${e.call_id}|${e.tool}`:`${e.tool}|${e.path}`}function nh(e){const t=e.function,n=typeof e.name=="string"?e.name:typeof(t==null?void 0:t.name)=="string"?t.name:"",r=typeof e.call_id=="string"?e.call_id:"";return!n||!r||!u8.has(n)?null:`${r}|${n}`}function h8(e,t){const n=nh(t);return n?e.some(r=>{var a;return(a=r.fileEdits)==null?void 0:a.some(o=>ps(o)===n)}):!1}function g8(e,t){return t.length===0?t:t.filter(n=>!h8(e,n))}function v8(e,t){var d;const n=new Set(t.map(ps)),r=e.toolEvents??[];if(!r.length||n.size===0)return e;const a=new Set,o=[];let i=!1;for(const p of r){const m=nh(p);if(m&&n.has(m)){i=!0;for(const f of UC([p]))a.add(f);continue}o.push(p)}if(!i)return e;const c=((d=e.traces)!=null&&d.length?e.traces:e.content?[e.content]:[]).filter(p=>!a.has(p));return{...e,traces:c,content:c[c.length-1]??"",toolEvents:o.length?o:void 0}}function x8(e){if(!e||!e.tool||!e.path&&!e.pending)return null;const t=e.phase==="error"?"error":e.phase==="end"?"done":"editing",n={...e,call_id:e.call_id||`${e.tool}:${e.path}`,added:Number.isFinite(e.added)?Math.max(0,Math.round(e.added)):0,deleted:Number.isFinite(e.deleted)?Math.max(0,Math.round(e.deleted)):0,status:e.status==="error"||e.status==="done"||e.status==="editing"?e.status:t};return e.pending&&!e.path&&(n.pending=!0),n}function Px(e,t){const n=[...e??[]],r=new Map(n.map((a,o)=>[ps(a),o]));for(const a of t){const o=x8(a);if(!o)continue;const i=ps(o),l=r.get(i);if(l===void 0){r.set(i,n.length),n.push(o);continue}const c={...n[l],...o};o.path&&!o.pending&&delete c.pending,n[l]=c}return n}function y8(e,t,n){const r=new Set(n.map(ps));for(let a=e.length-1;a>=0;a-=1){const o=e[a];if(o.role==="user")break;if(o.kind==="trace"){if(t&&o.activitySegmentId===t)return a;for(const i of o.fileEdits??[])if(r.has(ps(i)))return a;for(const i of o.toolEvents??[]){const l=nh(i);if(l&&r.has(l))return a}}}return null}function b8(e,t){const n=[...e??[]];for(const r of t??[])n.push(r);return n.length?n:void 0}function w8(e,t=[],n=!1,r){const{client:a}=wr(),[o,i]=u.useState(t),l=Vc(t),[c,d]=u.useState(l||n),[p,m]=u.useState(null),[f,h]=u.useState(void 0),[y,x]=u.useState(null),b=u.useRef(null),v=u.useRef(null),g=u.useRef(new Set),w=u.useRef(null),k=u.useRef(null),C=u.useRef(0),j=u.useRef([]),N=u.useRef(null),P=u.useRef(!1),L=u.useRef(null);u.useEffect(()=>a.onError(z=>x(z)),[a]);const _=u.useCallback(()=>x(null),[]),T=u.useCallback(()=>{N.current!==null&&(window.cancelAnimationFrame(N.current),N.current=null),j.current=[]},[]),R=u.useCallback((z=!0)=>{C.current+=1;const q=`activity-${C.current}`;return z&&(w.current=q),q},[]),D=u.useCallback(()=>R(!0),[R]),K=u.useCallback(()=>R(!1),[R]),G=u.useCallback(()=>w.current?w.current:D(),[D]),W=u.useCallback(()=>{w.current=null,k.current=null},[]),H=u.useCallback(()=>{var q,O;const z=((q=b.current)==null?void 0:q.messageId)??((O=v.current)==null?void 0:O.id);return z&&g.current.add(z),b.current=null,v.current=null,!!z},[]),E=u.useCallback((z,q={})=>{const O=v.current;if(!O)return null;const te=z[O.index];if((te==null?void 0:te.id)===O.id&&te.role==="assistant"&&te.kind!=="trace"&&te.isStreaming&&ds(te,q))return O.index;const ie=z.findIndex(me=>me.id===O.id);if(ie===-1)return v.current=null,null;const ve=z[ie];return ve.role!=="assistant"||ve.kind==="trace"||!ve.isStreaming||!ds(ve,q)?(v.current=null,null):(v.current={id:O.id,index:ie},ie)},[]),F=u.useCallback((z,q,O={})=>{let te=z,ie=E(te,O);if(ie===null&&(ie=d8(te,O)),ie===null&&(ie=Nx(te,g.current,O)),ie===null){const Z=crypto.randomUUID();te=[...te,{id:Z,role:"assistant",content:"",isStreaming:!0,createdAt:Date.now()}],ie=te.length-1}const ve=te[ie],me={...ve,content:ve.content+q,isStreaming:!0,...O};return g.current.delete(me.id),v.current={id:me.id,index:ie},b.current={messageId:me.id},qd(te,ie,me)},[E]),X=u.useCallback((z,q)=>{let O=z;for(const te of q)te.kind==="delta"?O=F(O,te.text,te.turn):(H()&&W(),O=jx(O,te.text,{ensure:G},te.turn));return O},[F,W,H,G]),Q=u.useCallback(z=>{N.current!==null&&(window.cancelAnimationFrame(N.current),N.current=null);const q=j.current,O=z==null?void 0:z.finalAnswerText,te=(z==null?void 0:z.turn)??{};if(q.length===0&&O===void 0){z!=null&&z.closeAnswerSegment&&H();return}j.current=[],i(ie=>{let ve=q.length>0?X(ie,q):ie;if(O!==void 0){const me=E(ve,te)??Nx(ve,g.current,te);if(me!==null){const Z=ve[me];ve=qd(ve,me,{...Z,content:O,isStreaming:!0,...te})}else{const Z=crypto.randomUUID();g.current.add(Z),ve=[...ve,{id:Z,role:"assistant",content:O,isStreaming:!0,...te,createdAt:Date.now()}]}}return z!=null&&z.closeAnswerSegment&&H(),ve})},[X,H,E]),re=u.useCallback(()=>{N.current===null&&(N.current=window.requestAnimationFrame(()=>{N.current=null;const z=j.current;z.length!==0&&(j.current=[],i(q=>X(q,z)))}))},[X]);u.useEffect(()=>{i(t),d(Vc(t)||n),x(null),m(e?a.getRunStartedAt(e):null),h(e?a.getGoalState(e):void 0),b.current=null,v.current=null,g.current.clear(),W(),T(),P.current=!1,L.current!==null&&(clearTimeout(L.current),L.current=null)},[e,a,W,T]),u.useEffect(()=>{n&&d(!0)},[n]),u.useEffect(()=>{if(!e)return;const z=O=>{var ie,ve;if(L.current!==null&&(clearTimeout(L.current),L.current=null),O.event==="delta"){if(P.current)return;const me=typeof O.text=="string"?O.text:"";if(!me)return;W(),d(!0),j.current.push({kind:"delta",text:me,turn:Ra(O,"answer")}),re();return}if(O.event==="reasoning_delta"){if(P.current)return;const me=O.text;if(!me)return;k.current&&W(),d(!0),j.current.push({kind:"reasoning",text:me,turn:Ra(O,"reasoning")}),re();return}if(O.event==="stream_end")return Q({closeAnswerSegment:!0,...typeof O.text=="string"?{finalAnswerText:O.text}:{},turn:Ra(O,"answer")}),P.current,void 0;const te=O.event==="file_edit"||O.event==="message"&&(O.kind==="tool_hint"||O.kind==="progress");if(Q({closeAnswerSegment:te}),O.event==="reasoning_end"){if(P.current)return;i(me=>Ax(me));return}if(O.event==="goal_state"){h(O.goal_state);return}if(O.event==="goal_status"){O.status==="running"&&typeof O.started_at=="number"?m(O.started_at):m(null);return}if(O.event==="turn_end"){"goal_state"in O&&O.goal_state!=null&&typeof O.goal_state=="object"&&h(O.goal_state),m(null),L.current!==null&&(clearTimeout(L.current),L.current=null),d(!1),i(me=>{let Z=me.map(ke=>ke.isStreaming?{...ke,isStreaming:!1}:ke);return Z=_x(Z),typeof O.latency_ms=="number"&&O.latency_ms>=0&&(Z=m8(Z,Math.round(O.latency_ms),O.turn_id)),b.current=null,v.current=null,W(),g.current.clear(),Z}),P.current=!1,r==null||r();return}if(O.event==="message"){if(P.current&&(O.kind==="tool_hint"||O.kind==="progress"||O.kind==="reasoning"))return;if(O.kind==="reasoning"){const ke=O.text;if(!ke)return;k.current&&W(),i(ye=>Ax(jx(ye,ke,{ensure:G},Ra(O,"reasoning"))));return}if(O.kind==="tool_hint"||O.kind==="progress"){const ke=$C(O.tool_events),ye=Ra(O,"activity"),be=O.agent_ui?[O.agent_ui]:[];i(Ie=>{var xe,Se,De,Ve,he,Xe;const Pe=G(),Le=Ie,Te=g8(Le,ke),J=UC(Te),ee=J.length>0?J:ke.length>0?[]:O.text?[O.text]:[];if(ee.length===0)return Le;const V=Le[Le.length-1];if(V&&V.kind==="trace"&&!V.isStreaming&&(!V.activitySegmentId||V.activitySegmentId===Pe)){const dt=(xe=V.traces)!=null&&xe.length?V.traces:V.content?[V.content]:[],xt=be.length>0&&ee.length===1&&dt.length>0&&(((De=(Se=be[0])==null?void 0:Se.kind)==null?void 0:De.startsWith("subagent_"))??!1)&&((he=(Ve=V.agentUi)==null?void 0:Ve[V.agentUi.length-1])==null?void 0:he.kind)===((Xe=be[0])==null?void 0:Xe.kind),Ot=Te.length>0?Fz(dt,J):null,qn=Ot?Ot.traces:xt?[...dt.slice(0,-1),`${dt[dt.length-1]}${ee[0]}`]:[...dt,...ee],Ke={...V,traces:qn,content:qn[qn.length-1],toolEvents:Te.length?Oz(V.toolEvents,Te):V.toolEvents,agentUi:b8(V.agentUi,be),activitySegmentId:V.activitySegmentId??Pe,...ye};return[...Le.slice(0,-1),Ke]}return[...Le,{id:crypto.randomUUID(),role:"tool",kind:"trace",content:ee[ee.length-1],traces:ee,...Te.length?{toolEvents:Te}:{},...be.length?{agentUi:be}:{},activitySegmentId:Pe,...ye,createdAt:Date.now()}]});return}const me=(ie=O.media_urls)!=null&&ie.length?O.media_urls.map(ke=>us(ke)):(ve=O.media)==null?void 0:ve.map(ke=>us({url:ke})),Z=!!me&&me.length>0;W(),i(ke=>{var Le;const ye=(Le=b.current)==null?void 0:Le.messageId;b.current=null,v.current=null;const be=ye?ke.filter(Te=>Te.id!==ye):ke,Ie=O.text,Pe=typeof O.latency_ms=="number"&&O.latency_ms>=0?Math.round(O.latency_ms):void 0;return f8(be,{content:Ie,...Z?{media:me}:{},...Pe!==void 0?{latencyMs:Pe}:{},...O.source?{source:O.source}:{},...Ra(O,"answer")})}),Z&&(P.current=!0);return}if(O.event==="file_edit"){const me=Array.isArray(O.edits)?O.edits:[];if(me.length===0)return;const Z=Px(void 0,me);if(Z.length===0)return;const ke=Ra(O,"activity"),ye=Z.some(Ie=>Ie.status==="editing"||Ie.phase==="start");let be=k.current;!be&&ye&&(be=K(),k.current=be),i(Ie=>{let Pe=be;const Le=Ie,Te=y8(Le,Pe,Z);if(Te!==null){const J=Le[Te];Pe=J.activitySegmentId??Pe??K(),ye&&(k.current=Pe);const ee=v8(J,Z),V={...ee,fileEdits:Px(ee.fileEdits,Z),activitySegmentId:Pe,...ke};return qd(Le,Te,V)}return Pe=Pe??K(),ye&&(k.current=Pe),[...Le,{id:crypto.randomUUID(),role:"tool",kind:"trace",content:"",traces:[],fileEdits:Z,activitySegmentId:Pe,...ke,createdAt:Date.now()}]});return}},q=a.onChat(e,z);return()=>{q(),b.current=null,v.current=null,g.current.clear(),W(),T(),L.current!==null&&(clearTimeout(L.current),L.current=null)}},[e,a,W,T,K,G,Q,r,re]);const ue=u.useCallback((z,q,O)=>{if(!e)return;const te=!!q&&q.length>0;if(!te&&!z.trim())return;Q();const ie=crypto.randomUUID(),ve=te?q.map(Z=>Z.preview):void 0;i(Z=>{var ke,ye,be;return b.current=null,v.current=null,g.current.clear(),W(),[..._x(Z),{id:crypto.randomUUID(),role:"user",content:z,turnId:ie,turnPhase:"user",turnSeq:0,createdAt:Date.now(),...ve?{images:ve}:{},...(ke=O==null?void 0:O.attachmentMedia)!=null&&ke.length?{media:O.attachmentMedia}:{},...(ye=O==null?void 0:O.cliApps)!=null&&ye.length?{cliApps:O.cliApps}:{},...(be=O==null?void 0:O.mcpPresets)!=null&&be.length?{mcpPresets:O.mcpPresets}:{}}]}),d(!0);const me=te?q.map(Z=>Z.media):void 0;a.sendMessage(e,z,me,{...O,turnId:ie})},[e,W,a,Q]),pe=u.useCallback(()=>{e&&(Q(),d(!1),i(z=>(b.current=null,v.current=null,g.current.clear(),W(),z.map(q=>q.isStreaming?{...q,isStreaming:!1}:q))),P.current=!1,a.sendMessage(e,"/stop"))},[e,W,a,Q]),ce=u.useCallback((z,q)=>a.transcribeAudio(z,q),[a]);return{messages:o,isStreaming:c,runStartedAt:p,goalState:f,send:ue,transcribeAudio:ce,stop:pe,setMessages:i,streamError:y,dismissStreamError:_}}const Tx=[],k8=160,C8=120,Rx=6e4;function Mx(e){return e.map((t,n)=>({...t,id:t.id??`hist-${n}`,createdAt:typeof t.createdAt=="number"?t.createdAt:Date.now()}))}function S8(e,t){return typeof(e==null?void 0:e.has_pending_tool_calls)=="boolean"?e.has_pending_tool_calls:Vc(t)}function N8(){const{client:e,token:t}=wr(),[n,r]=u.useState([]),[a,o]=u.useState(!0),[i,l]=u.useState(null),c=u.useRef(t),d=u.useRef(new Set);c.current=t;const p=u.useCallback(async()=>{try{o(!0);const x=await fL(c.current),b=new Set(x.map(v=>v.key));r(v=>[...x,...v.filter(g=>d.current.has(g.key)&&!b.has(g.key))]);for(const v of Array.from(d.current))b.has(v)&&d.current.delete(v);l(null)}catch(x){const b=x instanceof os?`HTTP ${x.status}`:x.message;l(b)}finally{o(!1)}},[]);u.useEffect(()=>{p()},[p]),u.useEffect(()=>e.onSessionUpdate(()=>{p()}),[e,p]);const m=u.useCallback(async(x,b)=>{const v=await e.newChat(Rx,x,b),g=`websocket:${v}`;return d.current.add(g),r(w=>[{key:g,channel:"websocket",chatId:v,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),title:"",preview:"",workspaceScope:x??null,knowledgeBaseId:b??null},...w.filter(k=>k.key!==g)]),v},[e]),f=u.useCallback(async(x,b,v)=>{const g=await e.forkChat(x,b,v,Rx),w=`websocket:${g}`;return d.current.add(w),r(k=>[{key:w,channel:"websocket",chatId:g,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),title:v??"",preview:"",workspaceScope:null},...k.filter(C=>C.key!==w)]),g},[e]),h=u.useCallback(async(x,b)=>{const v=await wL(c.current,x,b);return v.deleted&&(d.current.delete(x),r(g=>g.filter(w=>w.key!==x))),v},[]),y=u.useCallback(async x=>(await b1(c.current,x)).jobs,[]);return{sessions:n,loading:a,error:i,refresh:p,createChat:m,forkChat:f,deleteChat:h,getSessionAutomations:y}}function j8(e){const{token:t}=wr(),n=u.useRef(!1),[r,a]=u.useState(0),o=u.useCallback(()=>{a(d=>d+1)},[]),[i,l]=u.useState({key:null,messages:[],loading:!1,loadingOlder:!1,error:null,hasPendingToolCalls:!1,forkBoundaryMessageCount:null,beforeCursor:null,hasMoreBefore:!1,userMessageOffset:0,version:0});u.useEffect(()=>{if(!e){l({key:null,messages:[],loading:!1,loadingOlder:!1,error:null,hasPendingToolCalls:!1,forkBoundaryMessageCount:null,beforeCursor:null,hasMoreBefore:!1,userMessageOffset:0,version:0});return}let d=!1;return l(p=>p.key===e?{...p,loading:!0,loadingOlder:!1,error:null}:{key:e,messages:[],loading:!0,loadingOlder:!1,error:null,hasPendingToolCalls:!1,forkBoundaryMessageCount:null,beforeCursor:null,hasMoreBefore:!1,userMessageOffset:0,version:0}),(async()=>{var p;try{const m=await mv(t,e,{limit:k8,direction:"latest"});if(d)return;if(!((p=m==null?void 0:m.messages)!=null&&p.length)){l(x=>({key:e,messages:[],loading:!1,loadingOlder:!1,error:null,hasPendingToolCalls:!1,forkBoundaryMessageCount:null,beforeCursor:null,hasMoreBefore:!1,userMessageOffset:0,version:x.key===e?x.version+1:1}));return}const f=Mx(m.messages),h=S8(m,f),y=typeof m.fork_boundary_message_count=="number"?Math.max(0,Math.min(m.fork_boundary_message_count,f.length)):null;l(x=>{var b,v,g;return{key:e,messages:f,loading:!1,loadingOlder:!1,error:null,hasPendingToolCalls:h,forkBoundaryMessageCount:y,beforeCursor:((b=m.page)==null?void 0:b.before_cursor)??null,hasMoreBefore:((v=m.page)==null?void 0:v.has_more_before)===!0,userMessageOffset:Math.max(0,((g=m.page)==null?void 0:g.user_message_offset)??0),version:x.key===e?x.version+1:1}})}catch(m){if(d)return;m instanceof os&&m.status===404?l(f=>({key:e,messages:[],loading:!1,loadingOlder:!1,error:null,hasPendingToolCalls:!1,forkBoundaryMessageCount:null,beforeCursor:null,hasMoreBefore:!1,userMessageOffset:0,version:f.key===e?f.version+1:1})):l(f=>({key:e,messages:[],loading:!1,loadingOlder:!1,error:m.message,hasPendingToolCalls:!1,forkBoundaryMessageCount:null,beforeCursor:null,hasMoreBefore:!1,userMessageOffset:0,version:f.key===e?f.version:0}))}})(),()=>{d=!0}},[e,t,r]);const c=u.useCallback(async()=>{if(!e||n.current)return;const d=i.key===e?i.beforeCursor:null;if(!(!d||!i.hasMoreBefore)){n.current=!0,l(p=>p.key===e?{...p,loadingOlder:!0,error:null}:p);try{const p=await mv(t,e,{limit:C8,before:d});l(m=>{var b,v,g,w;if(m.key!==e)return m;if(!((b=p==null?void 0:p.messages)!=null&&b.length))return{...m,loadingOlder:!1,hasMoreBefore:!1,beforeCursor:null};const f=Mx(p.messages),h=typeof p.fork_boundary_message_count=="number"?Math.max(0,Math.min(p.fork_boundary_message_count,f.length)):null,y=m.forkBoundaryMessageCount===null?null:m.forkBoundaryMessageCount+f.length,x=[...f,...m.messages];return{...m,messages:x,loadingOlder:!1,error:null,hasPendingToolCalls:Vc(x),forkBoundaryMessageCount:h??y,beforeCursor:((v=p.page)==null?void 0:v.before_cursor)??null,hasMoreBefore:((g=p.page)==null?void 0:g.has_more_before)===!0,userMessageOffset:Math.max(0,((w=p.page)==null?void 0:w.user_message_offset)??0),version:m.version+1}})}catch(p){l(m=>m.key===e?{...m,loadingOlder:!1,error:p.message}:m)}finally{n.current=!1}}},[e,i.beforeCursor,i.hasMoreBefore,i.key,t]);return e?i.key!==e?{messages:Tx,loading:!0,loadingOlder:!1,error:null,refresh:o,loadOlder:c,hasMoreBefore:!1,userMessageOffset:0,version:0,forkBoundaryMessageCount:null,hasPendingToolCalls:!1}:{messages:i.messages,loading:i.loading,loadingOlder:i.loadingOlder,error:i.error,refresh:o,loadOlder:c,hasMoreBefore:i.hasMoreBefore,userMessageOffset:i.userMessageOffset,version:i.version,forkBoundaryMessageCount:i.forkBoundaryMessageCount,hasPendingToolCalls:i.hasPendingToolCalls}:{messages:Tx,loading:!1,loadingOlder:!1,error:null,refresh:o,loadOlder:c,hasMoreBefore:!1,userMessageOffset:0,version:0,forkBoundaryMessageCount:null,hasPendingToolCalls:!1}}function A8(e){return e.map(t=>{if(t.kind!=="long_task")return t;const r=(t.content??"").trim()||"(legacy thread activity)";return{id:t.id,role:"tool",kind:"trace",content:r,traces:[r],createdAt:t.createdAt}})}const _8=800;function P8(e,t=_8){const n=e.replace(/\r\n/g,` `).trim(),r=n.split(` `);let a="";r.length>0&&r[0].startsWith("[Subagent")&&(a=r[0].trim());const o=n.toLowerCase();let i=` result: `,l=o.indexOf(i);if(l===-1&&(i=` result:`,l=o.indexOf(i)),l===-1)return a||n;let c=n.slice(l+i.length).replace(/^\s+/,"");const p=c.toLowerCase().indexOf("summarize this naturally");p!==-1&&(c=c.slice(0,p).trimEnd());let m=c.trim();return t>0&&m.length>t&&(m=`${m.slice(0,t-1).trimEnd()}…`),a&&m?`${a} ${m}`:a||m||n}function T8(e){return e.map(t=>{if(t.role!=="assistant"||typeof t.content!="string"||!t.content.includes("[Subagent"))return t;const n=P8(t.content);return n===t.content?t:{...t,content:n}})}function ea(e){return T8(A8(e))}function oS(e,t){return e.role===t.role&&(e.kind??"")===(t.kind??"")&&e.content===t.content}function Ex(e){var t;return e.kind==="trace"||e.role!=="user"&&e.role!=="assistant"||e.role==="assistant"&&!e.content.trim()&&!((t=e.media)!=null&&t.length)?null:{role:e.role,kind:e.kind,content:e.content}}function R8(e,t){const n=e.map(Ex).filter(o=>o!==null);if(n.length===0)return!0;const r=t.map(Ex).filter(o=>o!==null);let a=0;for(const o of n){let i=!1;for(;a=e.length?!1:t.every((n,r)=>oS(e[r],n))}const Ix=544,sS=360,M8=860,E8=420,I8=320;function Lx(e,t){return Math.min(Math.max(e,sS),t)}function Dx(e){return Math.max(sS,Math.min(M8,e-E8))}function L8(e){if(!e)return null;const t=e.trim();return t?(t.split("/").pop()??t)||t:null}function D8(e){if(!e)return null;const t=e.agent.model_preset||"default";return e.model_presets.find(n=>n.name===t)??e.model_presets.find(n=>n.active)??null}function O8(e,t){const n=D8(e),r=(n==null?void 0:n.provider)||(e==null?void 0:e.agent.provider)||null;return r==="auto"?(e==null?void 0:e.agent.resolved_provider)||um(t)||null:r||um(t)}function F8(e,t){const n=e||(t==null?void 0:t.agent.model)||null,r=L8(n),a=O8(t,n),o=a?t==null?void 0:t.providers.find(l=>l.name===a):null,i=!!(t&&(!n||!a||!o||!o.configured));return{label:r,provider:a,providerLabel:a?Mo((t==null?void 0:t.providers)??[],a):null,needsSetup:i}}const Vd=["thread.empty.greetings.workOn","thread.empty.greetings.start","thread.empty.greetings.build","thread.empty.greetings.tackle"];function Ox(){const e=Math.floor(Math.random()*Vd.length);return Vd[e]??Vd[0]}function Fx({token:e,eventName:t,fetchPayload:n,isPayload:r,selectItems:a}){const[o,i]=u.useState([]),l=u.useCallback(async c=>{try{const d=await n(e);c!=null&&c()||i(a(d))}catch{c!=null&&c()||i([])}},[n,a,e]);return u.useEffect(()=>{let c=!1;l(()=>c);const d=()=>{document.visibilityState!=="hidden"&&l()},p=m=>{const f=m.detail;if(r(f)){i(a(f));return}l()};return window.addEventListener("focus",d),document.addEventListener("visibilitychange",d),window.addEventListener(t,p),()=>{c=!0,window.removeEventListener("focus",d),document.removeEventListener("visibilitychange",d),window.removeEventListener(t,p)}},[t,r,l,a]),o}function z8({session:e,title:t,onToggleSidebar:n,onCreateChat:r,onForkChat:a,onTurnEnd:o,theme:i="light",onToggleTheme:l=()=>{},hideSidebarToggleForHostChrome:c=!1,hostChromeTitleInset:d=!1,hideThemeButton:p=!1,hideHeader:m=!1,workspaceScope:f=null,workspaceDefaultScope:h=null,workspaceControls:y=null,workspaceScopeDisabled:x=!1,workspaceError:b=null,onWorkspaceScopeChange:v,knowledgeBases:g=[],selectedKnowledgeBaseId:w=null,onKnowledgeBaseChange:k,settingsSnapshot:C=null,onOpenModelSettings:j}){const{t:N}=se(),P=(e==null?void 0:e.chatId)??null,L=(e==null?void 0:e.key)??null,{messages:_,loading:T,loadingOlder:R,loadOlder:D,hasMoreBefore:K,userMessageOffset:G,hasPendingToolCalls:W,refresh:H,version:E,forkBoundaryMessageCount:F}=j8(L),{client:X,modelName:Q,token:re}=wr(),[ue,pe]=u.useState(!1),[ce,z]=u.useState([]),q=Fx({token:re,eventName:L1,fetchPayload:jL,isPayload:P3,selectItems:T3}),O=Fx({token:re,eventName:F1,fetchPayload:w1,isPayload:I3,selectItems:L3}),[te,ie]=u.useState(C),[ve,me]=u.useState(Ox),[Z,ke]=u.useState(0),[ye,be]=u.useState(0),[Ie,Pe]=u.useState(null),[Le,Te]=u.useState(!1),[J,ee]=u.useState(Ix),V=u.useRef(null),xe=u.useRef(Ix),Se=u.useRef(null),De=u.useRef(null),Ve=u.useRef(null),he=u.useRef(new Map),Xe=u.useRef(null),dt=u.useRef(!1),xt=u.useRef(new Map),Ot=u.useRef(new Set),qn=u.useRef(new Map),Ke=u.useRef(null),Ft=u.useMemo(()=>P?he.current.get(P)??_:_,[P,_]),He=u.useCallback(()=>{o==null||o()},[o]),{messages:Re,isStreaming:kr,runStartedAt:or,goalState:Qe,send:Ge,transcribeAudio:Vn,stop:on,setMessages:Jt,streamError:Dn,dismissStreamError:Vt}=w8(P,Ft,W,He);u.useEffect(()=>{P&&L&&qn.current.set(P,L)},[P,L]),u.useEffect(()=>{xe.current=J},[J]),u.useEffect(()=>{Se.current!==null&&(window.clearTimeout(Se.current),Se.current=null),Te(!1),Pe(null)},[L]),u.useEffect(()=>()=>{Se.current!==null&&window.clearTimeout(Se.current)},[]);const Je=u.useMemo(()=>ea(Re),[Re]),sn=Re.length===0&&!T,pt=u.useRef(sn),zt=u.useMemo(()=>F8(Q,te),[Q,te]),st=zt.needsSetup?N("thread.composer.modelNotConfigured",{defaultValue:"Model not configured"}):zt.label;u.useEffect(()=>{sn&&!pt.current&&me(Ox()),pt.current=sn},[sn]);const hn=u.useCallback(Ce=>{const we={...Ce??{}};return f&&(we.workspaceScope=f),w&&(we.knowledgeBaseId=w),Object.keys(we).length?{...we}:Ce},[w,f]),it=u.useCallback(async()=>{try{ie(await li(re))}catch{C||ie(null)}},[C,re]);u.useEffect(()=>{if(C){ie(C);return}it()},[it,C]),u.useEffect(()=>X.onRuntimeModelUpdate(()=>{it()}),[X,it]),u.useEffect(()=>{if(!P||T)return;const Ce=he.current.get(P),we=xt.current.get(P)??0,Oe=Ot.current.has(P)&&E>we;Jt(Rt=>{const yt=ea(_),lt=nt=>{const Ze=ea(nt);return he.current.set(P,Ze),Ze};if(Oe&&_.length>0)return zl(Rt,yt)?lt(Rt):(Ot.current.delete(P),xt.current.set(P,E),he.current.set(P,yt),yt);if(Ce&&Ce.length>0){const nt=ea(Ce);return yt.length>nt.length&&!zl(Rt,yt)?(he.current.set(P,yt),xt.current.set(P,E),yt):zl(Rt,nt)?lt(Rt):nt}return zl(Rt,yt)?lt(Rt):(xt.current.set(P,E),yt.length>0&&he.current.set(P,yt),yt)})},[T,P,_,E]),u.useEffect(()=>{if(P)return X.onSessionUpdate((Ce,we)=>{Ce===P&&we!=="metadata"&&(Ot.current.add(P),H())})},[P,X,H]),u.useEffect(()=>{if(!P){Ke.current=null;return}T||Ke.current===P||(Ke.current=P,ke(Ce=>Ce+1))},[P,T]),u.useEffect(()=>{P||Jt(ea(_))},[P,_,Jt]),u.useLayoutEffect(()=>{if(P){const Ce=Xe.current;Ce&&Ce!==P&&(he.current.set(Ce,ea(Re)),dt.current=!0),Xe.current=P}else Xe.current&&(he.current.set(Xe.current,ea(Re)),dt.current=!0),Xe.current=null},[P,Re]),u.useEffect(()=>{if(P){if(dt.current){dt.current=!1;return}T||he.current.set(P,ea(Re))}},[P,T,Re]),u.useEffect(()=>{if(!P)return;const Ce=De.current;Ce&&(De.current=null,be(we=>we+1),Ge(Ce.content,Ce.images,Ce.options),pe(!1))},[P,Ge]),u.useEffect(()=>{let Ce=!1;return(async()=>{try{const we=await EL(re);Ce||z(we)}catch{Ce||z([])}})(),()=>{Ce=!0}},[re]);const $t=u.useCallback(async(Ce,we,_t)=>{if(ue)return;pe(!0),De.current={content:Ce,images:we,options:hn(_t)},await(r==null?void 0:r(f,w))||(De.current=null,pe(!1))},[ue,r,w,hn,f]),Cn=u.useCallback((Ce,we,_t)=>{be(Oe=>Oe+1),Ge(Ce,we,hn(_t))},[Ge,hn]),Sn=u.useCallback(Ce=>{Se.current!==null&&(window.clearTimeout(Se.current),Se.current=null),Te(!1),Pe(Ce)},[]),gn=u.useCallback(()=>{!Ie||Le||(Te(!0),Se.current=window.setTimeout(()=>{Se.current=null,Pe(null),Te(!1)},I8))},[Le,Ie]),Nn=u.useCallback(Ce=>{var Nr;Ce.preventDefault(),Ce.stopPropagation();const we=Ce.currentTarget.closest("[data-file-preview-panel]"),_t=(Nr=V.current)==null?void 0:Nr.getBoundingClientRect(),Oe=(_t==null?void 0:_t.right)??window.innerWidth,Rt=Dx((_t==null?void 0:_t.width)??window.innerWidth),yt=document.body.style.cursor,lt=document.body.style.userSelect,nt=(we==null?void 0:we.style.transition)??"";let Ze=xe.current,vn=null;document.body.style.cursor="col-resize",document.body.style.userSelect="none",we&&(we.style.transition="none");const Kt=Et=>{Ze=Lx(Oe-Et,Rt),xe.current=Ze,vn===null&&(vn=window.requestAnimationFrame(()=>{vn=null,we==null||we.style.setProperty("--file-preview-width",`${Ze}px`),we==null||we.style.setProperty("--file-preview-slot-width",`${Ze}px`)}))},ln=Et=>{Et.preventDefault(),Kt(Et.clientX)},Mt=()=>{vn!==null&&(window.cancelAnimationFrame(vn),vn=null),we==null||we.style.setProperty("--file-preview-width",`${Ze}px`),we==null||we.style.setProperty("--file-preview-slot-width",`${Ze}px`),we&&(we.style.transition=nt),ee(Ze),document.body.style.cursor=yt,document.body.style.userSelect=lt,window.removeEventListener("pointermove",ln),window.removeEventListener("pointerup",Mt),window.removeEventListener("pointercancel",Mt)};Kt(Ce.clientX),window.addEventListener("pointermove",ln),window.addEventListener("pointerup",Mt),window.addEventListener("pointercancel",Mt)},[]);u.useEffect(()=>{if(!Ie)return;const Ce=()=>{var Rt;const we=((Rt=V.current)==null?void 0:Rt.getBoundingClientRect().width)??window.innerWidth,_t=Dx(we),Oe=Lx(xe.current,_t);xe.current=Oe,ee(Oe)};return Ce(),window.addEventListener("resize",Ce),()=>{window.removeEventListener("resize",Ce)}},[Ie]);const Cr=u.useCallback(async Ce=>{if(!P||!a)return;const we=await a(P,Ce);we&&(he.current.delete(we),xt.current.delete(we),Ot.current.add(we))},[P,a]),Ut=s.jsxs(s.Fragment,{children:[Dn?s.jsx(IF,{error:Dn,onDismiss:Vt}):null,e?s.jsx(rx,{onSend:Cn,disabled:!P,isStreaming:kr,placeholder:N(sn?"thread.composer.placeholderHero":"thread.composer.placeholderThread"),modelLabel:st,modelProvider:zt.provider,modelProviderLabel:zt.providerLabel,modelNeedsSetup:zt.needsSetup,onModelBadgeClick:zt.needsSetup?j:void 0,variant:sn?"hero":"thread",slashCommands:ce,cliApps:q,mcpPresets:O,onStop:on,onTranscribeAudio:Vn,runStartedAt:or,goalState:Qe,workspaceScope:f,workspaceDefaultScope:h,workspaceControls:y,workspaceScopeDisabled:x,workspaceError:b,onWorkspaceScopeChange:v,knowledgeBases:g,selectedKnowledgeBaseId:w,onKnowledgeBaseChange:k,pendingQueueKey:P}):s.jsx(rx,{onSend:$t,disabled:ue,isStreaming:kr,placeholder:N(ue?"thread.composer.placeholderOpening":"thread.composer.placeholderHero"),modelLabel:st,modelProvider:zt.provider,modelProviderLabel:zt.providerLabel,modelNeedsSetup:zt.needsSetup,onModelBadgeClick:zt.needsSetup?j:void 0,variant:"hero",slashCommands:ce,cliApps:q,mcpPresets:O,runStartedAt:or,onTranscribeAudio:Vn,goalState:Qe,workspaceScope:f,workspaceDefaultScope:h,workspaceControls:y,workspaceScopeDisabled:x,workspaceError:b,onWorkspaceScopeChange:v,knowledgeBases:g,selectedKnowledgeBaseId:w,onKnowledgeBaseChange:k})]}),Sr=T?s.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:N("thread.loadingConversation")}):s.jsx("div",{className:"flex w-full flex-col items-center text-center animate-in fade-in-0 slide-in-from-bottom-2 duration-500",children:s.jsx("h1",{className:"max-w-[44rem] text-balance text-[34px] font-normal leading-[1.08] tracking-normal text-foreground sm:text-[48px] sm:leading-tight",children:N(ve)})}),Kr=L?s.jsx(X4,{sessionKey:L,token:re,title:t}):void 0,Bt=L?s.jsx(V4,{messages:Je,onJumpToPrompt:Ce=>{var we;return(we=Ve.current)==null?void 0:we.jumpToUserPrompt(Ce)}}):void 0;return s.jsxs("section",{ref:V,className:"relative flex min-h-0 flex-1 overflow-hidden",children:[s.jsxs("div",{className:"relative flex min-w-0 flex-1 flex-col overflow-hidden",children:[m?null:s.jsx(MF,{title:t,onToggleSidebar:n,theme:i,onToggleTheme:l,hideSidebarToggleForHostChrome:c,hostChromeTitleInset:d,hideThemeButton:p,minimal:!e&&!T,promptNavigatorAction:Bt,sessionInfoAction:Kr}),s.jsx(c8,{ref:Ve,messages:Je,isStreaming:kr,emptyState:Sr,composer:Ut,scrollToBottomSignal:Z,scrollToLatestUserPromptSignal:ye,conversationKey:L,showScrollToBottomButton:!!e,cliApps:q,mcpPresets:O,forkBoundaryMessageCount:F,hasMoreBefore:K,loadingOlder:R,userMessageOffset:G,onLoadOlder:D,onOpenFilePreview:L?Sn:void 0,onForkFromMessage:a?Cr:void 0})]}),Ie&&L?s.jsx(H4,{sessionKey:L,path:Ie,token:re,desktopWidth:J,isClosing:Le,onResizeStart:Nn,onClose:gn}):null]})}const $8=[1e3,3e3,7e3];function Kd(e){var t;return!!((t=e==null?void 0:e.title)!=null&&t.trim())}function U8(e,t,n=$8){const r=u.useRef(e),a=u.useRef([]);r.current=e;const o=u.useCallback(()=>{for(const i of a.current)clearTimeout(i);a.current=[]},[]);return u.useEffect(()=>o,[o]),u.useEffect(()=>{o()},[e==null?void 0:e.key,o]),u.useEffect(()=>{Kd(e)&&o()},[e,o]),u.useCallback(()=>{t();const i=r.current;if(!(!i||Kd(i))){o();for(const l of n){const c=setTimeout(()=>{const d=r.current;!d||d.key!==i.key||Kd(d)||t()},l);a.current.push(c)}}},[o,t,n])}const Oa={schema_version:1,project_paths:[],pinned_keys:[],archived_keys:[],title_overrides:{},project_name_overrides:{},tags_by_key:{},collapsed_groups:{},view:{density:"comfortable",show_previews:!1,show_timestamps:!1,show_archived:!1,sort:"updated_desc"},updated_at:null};function ac(e){if(!Array.isArray(e))return[];const t=[],n=new Set;for(const r of e){if(typeof r!="string")continue;const a=r.trim();!a||n.has(a)||(n.add(a),t.push(a))}return t}function zx(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e)){if(typeof r!="string")continue;const a=n.trim(),o=r.trim();!a||!o||(t[a]=o)}return t}function B8(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e)){const a=n.trim();if(!a)continue;const o=ac(r).slice(0,12);o.length&&(t[a]=o)}return t}function H8(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e)){const a=n.trim();a&&(t[a]=!!r)}return t}function Gd(e){if(!e||typeof e!="object"||Array.isArray(e))return{...Oa,view:{...Oa.view}};const t=e,n=t.view&&typeof t.view=="object"?t.view:Oa.view,r=n.density==="compact"?"compact":"comfortable",a=["updated_desc","created_desc","title_asc"].includes(n.sort)?n.sort:"updated_desc";return{schema_version:1,project_paths:ac(t.project_paths),pinned_keys:ac(t.pinned_keys),archived_keys:ac(t.archived_keys),title_overrides:zx(t.title_overrides),project_name_overrides:zx(t.project_name_overrides),tags_by_key:B8(t.tags_by_key),collapsed_groups:H8(t.collapsed_groups),view:{density:r,show_previews:!!n.show_previews,show_timestamps:!!n.show_timestamps,show_archived:!!n.show_archived,sort:a},updated_at:typeof t.updated_at=="string"?t.updated_at:null}}function W8(e,t){const n=new Set(t.map(o=>o.key)),r=o=>o.filter(i=>n.has(i)),a=o=>{const i={};for(const[l,c]of Object.entries(o))n.has(l)&&(i[l]=c);return i};return{...e,pinned_keys:r(e.pinned_keys),archived_keys:r(e.archived_keys),title_overrides:a(e.title_overrides),tags_by_key:a(e.tags_by_key)}}function q8(e,t){return JSON.stringify(e)===JSON.stringify(t)}function V8(e,t){const{token:n}=wr(),r=u.useRef(n),a=u.useRef(Oa),o=u.useRef(0),[i,l]=u.useState(Oa),[c,d]=u.useState(!0);r.current=n,a.current=i,u.useEffect(()=>{let f=!1;return d(!0),(async()=>{try{const h=Gd(await IL(r.current));if(f)return;a.current=h,l(h)}catch{if(f)return;a.current=Oa,l(Oa)}finally{f||d(!1)}})(),()=>{f=!0}},[]);const p=u.useCallback(async f=>{const h=Gd(f(a.current)),y=o.current+1;o.current=y,a.current=h,l(h);try{const x=Gd(await LL(r.current,h));if(o.current!==y)return;a.current=x,l(x)}catch{}},[]),m=u.useMemo(()=>!t||c?i:W8(i,e),[c,e,t,i]);return u.useEffect(()=>{!t||c||q8(m,i)||p(()=>m)},[c,m,t,i,p]),{state:i,loading:c,update:p}}function K8(e){const[t,n]=u.useState([]);return u.useEffect(()=>{let r=!1;return yL(e).then(({skills:a})=>!r&&n(a)).catch(()=>!r&&n([])),()=>{r=!0}},[e]),t}const rh="nanobot-webui.bootstrap-secret";function G8(){if(typeof window>"u")return"";try{return window.localStorage.getItem(rh)??""}catch{return""}}function Y8(e){try{window.localStorage.setItem(rh,e)}catch{}}function Q8(){try{window.localStorage.removeItem(rh)}catch{}}async function $x(e="",t="",n){const r={};t&&(r["X-Nanobot-Auth"]=t);const a=await Kf(`${e}/webui/bootstrap`,{method:"GET",credentials:"same-origin",headers:r},n);if(!a.ok)throw new Error(`bootstrap failed: HTTP ${a.status}`);const o=await a.json();if(!o.token||!o.ws_path)throw new Error("bootstrap response missing token or ws_path");return o}function Ux(e,t,n){const r=`?token=${encodeURIComponent(t)}`,a=e&&e.startsWith("/")?e:`/${e||""}`;if(typeof window<"u"&&window.location.port==="5173")return`ws://${window.location.hostname.includes(":")?`[${window.location.hostname}]`:window.location.hostname}:8765${a}${r}`;if(n&&/^(wss?|nanobot-host):\/\//i.test(n)){const l=n.includes("?")?"&":"?";return`${n}${l}token=${encodeURIComponent(t)}`}if(typeof window>"u")return`ws://127.0.0.1:8765${a}${r}`;const o=window.location.protocol==="https:"?"wss":"ws",i=window.location.host;return`${o}://${i}${a}${r}`}const Bx=1,X8=2,J8="nanobot-host://";function Z8(e){return e.startsWith(J8)?D1(e):new WebSocket(e)}function Hx(){var e;if(typeof globalThis>"u")return!1;try{const t=globalThis.localStorage,n=((e=t==null?void 0:t.getItem("nanobot_debug_ws"))==null?void 0:e.trim().toLowerCase())??"";return n==="0"||n==="false"||n==="off"||n==="no"?!1:n==="1"||n==="true"||n==="on"||n==="yes"}catch{return!1}}function e6(e){const t=e.event;if(t!=="delta"&&t!=="reasoning_delta")return e;const n={...e},r=typeof n.text=="string"?n.text:"",a=240;return r.length>a&&(n.text=`${r.slice(0,a)}… (${r.length} chars)`),n}const Gc=class Gc{constructor(t){$e(this,"socket",null);$e(this,"statusHandlers",new Set);$e(this,"runtimeModelHandlers",new Set);$e(this,"sessionUpdateHandlers",new Set);$e(this,"runStatusHandlers",new Set);$e(this,"errorHandlers",new Set);$e(this,"chatHandlers",new Map);$e(this,"pendingInboundByChat",new Map);$e(this,"knownChats",new Set);$e(this,"runStartedAtByChatId",new Map);$e(this,"goalStateByChatId",new Map);$e(this,"pendingNewChat",null);$e(this,"pendingTranscriptions",new Map);$e(this,"sendQueue",[]);$e(this,"reconnectAttempts",0);$e(this,"reconnectTimer",null);$e(this,"shouldReconnect");$e(this,"maxBackoffMs");$e(this,"socketFactory");$e(this,"currentUrl");$e(this,"status_","idle");$e(this,"readyChatId",null);$e(this,"intentionallyClosed",!1);this.options=t,this.shouldReconnect=t.reconnect??!0,this.maxBackoffMs=t.maxBackoffMs??15e3,this.socketFactory=t.socketFactory??Z8,this.currentUrl=t.url}get status(){return this.status_}get defaultChatId(){return this.readyChatId}updateUrl(t,n){this.currentUrl=t,n&&(this.socketFactory=n)}onStatus(t){return this.statusHandlers.add(t),t(this.status_),()=>{this.statusHandlers.delete(t)}}onRuntimeModelUpdate(t){return this.runtimeModelHandlers.add(t),()=>{this.runtimeModelHandlers.delete(t)}}onSessionUpdate(t){return this.sessionUpdateHandlers.add(t),()=>{this.sessionUpdateHandlers.delete(t)}}onRunStatus(t){this.runStatusHandlers.add(t);for(const[n,r]of this.runStartedAtByChatId)t(n,r);return()=>{this.runStatusHandlers.delete(t)}}onError(t){return this.errorHandlers.add(t),()=>{this.errorHandlers.delete(t)}}getRunStartedAt(t){const n=this.runStartedAtByChatId.get(t);return n===void 0?null:n}getGoalState(t){return this.goalStateByChatId.get(t)}recordGoalStatusForRunStrip(t,n){if(n.event==="turn_end"){this.runStartedAtByChatId.has(t)&&(this.runStartedAtByChatId.delete(t),this.emitRunStatus(t,null));return}if(n.event==="goal_status")if(n.status==="running"&&typeof n.started_at=="number"){const r=this.runStartedAtByChatId.get(t);this.runStartedAtByChatId.set(t,n.started_at),r!==n.started_at&&this.emitRunStatus(t,n.started_at)}else this.runStartedAtByChatId.has(t)&&(this.runStartedAtByChatId.delete(t),this.emitRunStatus(t,null))}recordGoalStateSnapshot(t,n){if(n.event==="goal_state"){this.goalStateByChatId.set(t,n.goal_state);return}n.event==="turn_end"&&n.goal_state!=null&&typeof n.goal_state=="object"&&this.goalStateByChatId.set(t,n.goal_state)}onChat(t,n){let r=this.chatHandlers.get(t);r||(r=new Set,this.chatHandlers.set(t,r)),r.add(n);const a=this.pendingInboundByChat.get(t);if(a!==void 0&&a.length>0){const o=a.splice(0);this.pendingInboundByChat.delete(t);for(const i of o)n(i)}return this.attach(t),()=>{const o=this.chatHandlers.get(t);o&&(o.delete(n),o.size===0&&this.chatHandlers.delete(t))}}connect(){if(this.socket&&this.socket.readyStatethis.handleOpen(),t.onmessage=n=>this.handleMessage(n),t.onerror=()=>this.setStatus("error"),t.onclose=n=>this.handleClose(n)}close(){this.intentionallyClosed=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null);const t=this.socket;this.socket=null;try{t==null||t.close()}catch{}this.setStatus("closed")}newChat(t=5e3,n,r){return this.pendingNewChat?Promise.reject(new Error("newChat already in flight")):new Promise((a,o)=>{const i=setTimeout(()=>{this.pendingNewChat=null,o(new Error("newChat timed out"))},t);this.pendingNewChat={resolve:a,reject:o,timer:i},this.queueSend({type:"new_chat",...n?{workspace_scope:n}:{},...r?{knowledge_base_id:r}:{}})})}transcribeAudio(t,n){const r=crypto.randomUUID(),a=(n==null?void 0:n.timeoutMs)??12e4;return new Promise((o,i)=>{const l=setTimeout(()=>{this.pendingTranscriptions.delete(r),i(new Error("transcription timed out"))},a);this.pendingTranscriptions.set(r,{resolve:o,reject:i,timer:l}),this.queueSend({type:"transcribe_audio",request_id:r,data_url:t,...(n==null?void 0:n.durationMs)!==void 0?{duration_ms:n.durationMs}:{}})})}forkChat(t,n,r,a=5e3){return this.pendingNewChat?Promise.reject(new Error("newChat already in flight")):new Promise((o,i)=>{const l=setTimeout(()=>{this.pendingNewChat=null,i(new Error("forkChat timed out"))},a);this.pendingNewChat={resolve:o,reject:i,timer:l},this.queueSend({type:"fork_chat",source_chat_id:t,before_user_index:n,...r!=null&&r.trim()?{title:r.trim()}:{}})})}attach(t){var n;this.knownChats.add(t),((n=this.socket)==null?void 0:n.readyState)===Bx&&this.queueSend({type:"attach",chat_id:t})}sendMessage(t,n,r,a){var i,l,c;this.knownChats.add(t);const o={type:"message",chat_id:t,content:n,...r&&r.length>0?{media:r}:{},...(i=a==null?void 0:a.attachments)!=null&&i.length?{attachments:a.attachments}:{},...a!=null&&a.imageGeneration?{image_generation:a.imageGeneration}:{},...(l=a==null?void 0:a.cliApps)!=null&&l.length?{cli_apps:a.cliApps}:{},...(c=a==null?void 0:a.mcpPresets)!=null&&c.length?{mcp_presets:a.mcpPresets}:{},...a!=null&&a.workspaceScope?{workspace_scope:a.workspaceScope}:{},...a!=null&&a.knowledgeBaseId?{knowledge_base_id:a.knowledgeBaseId}:{},...a!=null&&a.turnId?{turn_id:a.turnId}:{},webui:!0};this.queueSend(o)}setWorkspaceScope(t,n){this.knownChats.add(t),this.queueSend({type:"set_workspace_scope",chat_id:t,workspace_scope:n})}setStatus(t){if(this.status_!==t){this.status_=t;for(const n of this.statusHandlers)n(t)}}handleOpen(){this.setStatus("open"),this.reconnectAttempts=0;for(const n of this.knownChats)this.rawSend({type:"attach",chat_id:n});const t=this.sendQueue.splice(0);for(const n of t)this.rawSend(n)}handleMessage(t){let n;try{n=JSON.parse(typeof t.data=="string"?t.data:"")}catch{if(Hx()){const a=typeof t.data=="string"?t.data:String(t.data);console.warn("[nanobot ws inbound] invalid JSON",a.length>400?`${a.slice(0,400)}… (${a.length} chars)`:a)}return}if(Hx()&&console.log("[nanobot ws inbound]",e6(n)),n.event==="ready"){this.readyChatId=n.chat_id,this.knownChats.add(n.chat_id);return}if(n.event==="attached"){this.knownChats.add(n.chat_id),this.pendingNewChat&&(clearTimeout(this.pendingNewChat.timer),this.pendingNewChat.resolve(n.chat_id),this.pendingNewChat=null),this.dispatch(n.chat_id,n);return}if(n.event==="runtime_model_updated"){this.emitRuntimeModelUpdate(n.model_name||null,n.model_preset??null);return}if(n.event==="transcription_result"){this.resolveTranscription(n.request_id,n.text);return}if(n.event==="transcription_error"){this.rejectTranscription(n.request_id,n.detail||"error");return}if(n.event==="session_updated"){this.emitSessionUpdate(n.chat_id,n.scope,n.workspace_scope,n.knowledge_base_id??null);return}if(n.event==="error"&&n.detail==="workspace_scope_rejected"&&(this.emitError({kind:"workspace_scope_rejected",reason:n.reason,chatId:n.chat_id}),this.pendingNewChat&&(clearTimeout(this.pendingNewChat.timer),this.pendingNewChat.reject(new Error(`workspace_scope_rejected:${n.reason||""}`)),this.pendingNewChat=null)),n.event==="error"&&this.pendingNewChat){clearTimeout(this.pendingNewChat.timer);const a=typeof n.detail=="string"?n.detail:"server error",o=typeof n.reason=="string"&&n.reason?`:${n.reason}`:"";this.pendingNewChat.reject(new Error(`${a}${o}`)),this.pendingNewChat=null}const r=n.chat_id;r&&(this.recordGoalStatusForRunStrip(r,n),this.recordGoalStateSnapshot(r,n),this.dispatch(r,n))}emitRuntimeModelUpdate(t,n){for(const r of this.runtimeModelHandlers)r(t,n)}emitSessionUpdate(t,n,r,a){for(const o of this.sessionUpdateHandlers)o(t,n,r,a)}emitRunStatus(t,n){for(const r of this.runStatusHandlers)r(t,n)}dispatch(t,n){const r=this.chatHandlers.get(t);if(r!==void 0&&r.size>0){for(const i of r)i(n);return}let a=this.pendingInboundByChat.get(t);a||(a=[],this.pendingInboundByChat.set(t,a)),a.push(n);const o=a.length-Gc.PENDING_INBOUND_MAX;o>0&&a.splice(0,o)}handleClose(t){if(this.socket=null,this.pendingNewChat&&(clearTimeout(this.pendingNewChat.timer),this.pendingNewChat.reject(new Error("socket closed")),this.pendingNewChat=null),this.rejectAllTranscriptions("socket closed"),(t==null?void 0:t.code)===1009&&this.emitError({kind:"message_too_big"}),this.intentionallyClosed||!this.shouldReconnect){this.setStatus("closed");return}this.scheduleReconnect()}emitError(t){for(const n of this.errorHandlers)try{n(t)}catch{}}resolveTranscription(t,n){const r=this.pendingTranscriptions.get(t);r&&(clearTimeout(r.timer),this.pendingTranscriptions.delete(t),r.resolve(n))}rejectTranscription(t,n){if(!t){this.rejectAllTranscriptions(n);return}const r=this.pendingTranscriptions.get(t);r&&(clearTimeout(r.timer),this.pendingTranscriptions.delete(t),r.reject(new Error(n)))}rejectAllTranscriptions(t){for(const[n,r]of this.pendingTranscriptions)clearTimeout(r.timer),r.reject(new Error(t)),this.pendingTranscriptions.delete(n)}scheduleReconnect(){this.setStatus("reconnecting");const t=this.reconnectAttempts++,n=Math.min(500*2**t,this.maxBackoffMs);this.reconnectTimer=setTimeout(async()=>{if(this.reconnectTimer=null,this.options.onReauth)try{const r=await this.options.onReauth();r&&(this.currentUrl=r)}catch{}this.connect()},n)}queueSend(t){var n;((n=this.socket)==null?void 0:n.readyState)===Bx?this.rawSend(t):this.sendQueue.push(t)}rawSend(t){if(this.socket)try{this.socket.send(JSON.stringify(t))}catch{this.sendQueue.push(t)}}};$e(Gc,"PENDING_INBOUND_MAX",2e3);let bm=Gc;const iS="nanobot-webui.sidebar",lS="nanobot-webui.sidebar.session-updates.v1",t6="nanobot-webui.sidebar.completed-runs.v1",Yd="nanobot-webui.restartStartedAt",oc=272,n6=56,Wx=`min(${oc}px, calc(100vw - 0.75rem))`,r6=3e4,a6=5e3,o6=["overview","appearance","models","image","voice","browser","apps","automations","skills","runtime","advanced"];function s6(e){return o6.includes(e)}function sa(){return{view:"chat",activeKey:null,settingsSection:"overview"}}function cS(e){return e==="apps"||e==="automations"||e==="skills"?e:"settings"}function Qd(){var l;if(typeof window>"u")return sa();const e=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash;if(!e||e==="/"||e==="/new")return sa();const[t,n=""]=e.split("?",2),r=new URLSearchParams(n),a=r.get("section"),o=s6(a)?a:"overview",i=((l=r.get("chat"))==null?void 0:l.trim())||null;if(t==="/settings")return{view:cS(o),activeKey:i,settingsSection:o};if(t==="/apps")return{view:"apps",activeKey:i,settingsSection:"apps"};if(t==="/automations")return{view:"automations",activeKey:i,settingsSection:"automations"};if(t==="/skills")return{view:"skills",activeKey:i,settingsSection:"skills"};if(t.startsWith("/chat/")){const c=t.slice(6);try{const d=decodeURIComponent(c).trim();return d?{view:"chat",activeKey:d,settingsSection:"overview"}:sa()}catch{return sa()}}return sa()}function i6(e){if(e.view==="chat")return e.activeKey?`#/chat/${encodeURIComponent(e.activeKey)}`:"#/new";const t=new URLSearchParams;e.activeKey&&t.set("chat",e.activeKey),e.view==="settings"&&e.settingsSection!=="overview"&&t.set("section",e.settingsSection);const n=t.toString();return`#/${e.view}${n?`?${n}`:""}`}function l6(e,t=!1){if(typeof window>"u")return;const n=i6(e);if(window.location.hash!==n){if(t){window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}${n}`);return}window.location.hash=n}}function qx(e){return Date.now()+Math.max(0,e)*1e3}function c6(e){const t=Math.max(0,e-Date.now()),n=Math.min(r6,Math.max(1e3,t/2));return Math.max(a6,t-n)}function u6({failed:e,onSecret:t}){const{t:n}=se(),[r,a]=u.useState(""),[o,i]=u.useState(!1),l=c=>{c.preventDefault();const d=r.trim();d&&(i(!0),t(d))};return s.jsx("div",{className:"flex h-full w-full items-center justify-center px-6",children:s.jsxs("form",{onSubmit:l,className:"flex w-full max-w-sm flex-col gap-4",children:[s.jsxs("div",{className:"flex flex-col items-center gap-1 text-center",children:[s.jsx("p",{className:"text-lg font-semibold",children:n("app.auth.title")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:n("app.auth.hint")})]}),e&&s.jsx("p",{className:"text-center text-sm text-destructive",children:n("app.auth.invalid")}),s.jsx(qe,{type:"password",placeholder:n("app.auth.placeholder"),value:r,onChange:c=>a(c.target.value),disabled:o,autoFocus:!0}),s.jsx(fe,{type:"submit",className:"w-full",disabled:!r.trim()||o,children:n("app.auth.submit")})]})})}function d6(){if(typeof window>"u")return!0;try{const e=window.localStorage.getItem(iS);return e===null?!0:e==="1"}catch{return!0}}function p6(){if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(lS)??window.localStorage.getItem(t6),t=e?JSON.parse(e):[];return Array.isArray(t)?new Set(t.filter(n=>typeof n=="string")):new Set}catch{return new Set}}function m6(e){try{window.localStorage.setItem(lS,JSON.stringify(Array.from(e)))}catch{}}function zs(e){const t=e.access_mode==="restricted"?"restricted":"full";return{...e,project_name:e.project_name??Vo(e.project_path),access_mode:t,restrict_to_workspace:t==="restricted"}}function f6({onToggleSidebar:e,onSidebarPreviewEnter:t,onSidebarPreviewLeave:n,sidebarOpen:r=!0,rightAction:a}){const{t:o}=se();return s.jsxs("header",{className:"host-drag-region pointer-events-none absolute inset-x-0 top-0 z-40 h-11 bg-transparent text-foreground/90",children:[e?s.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":o("thread.header.toggleSidebar"),"data-testid":"host-sidebar-toggle",onClick:e,onFocus:r?void 0:t,onBlur:r?void 0:n,onMouseEnter:r?void 0:t,onMouseLeave:r?void 0:n,className:"host-no-drag pointer-events-auto absolute left-[88px] top-[8px] h-7 w-7 rounded-lg bg-transparent text-muted-foreground/85 shadow-none hover:bg-transparent hover:text-foreground",children:s.jsx(c2,{className:"h-[15px] w-[15px]",strokeWidth:1.75})}):null,a?s.jsx("div",{className:"host-no-drag pointer-events-auto absolute right-3 top-2",children:a}):null]})}function h6(){const{t:e}=se(),[t,n]=u.useState({status:"loading"}),r=u.useRef(""),a=u.useCallback(async(d,p)=>{const m=await $x("",r.current),f=Ux(m.ws_path,m.token,m.ws_url),h=m.runtime_surface?wv(m.runtime_surface):p,y=kv(h,m.runtime_capabilities),x=qx(m.expires_in);return y.socketFactory?d.updateUrl(f,y.socketFactory):d.updateUrl(f),n(b=>b.status==="ready"&&b.client===d?{...b,token:m.token,tokenExpiresAt:x,modelName:m.model_name??b.modelName,runtimeSurface:h}:b),{token:m.token,url:f}},[]),o=u.useCallback(d=>{let p=!1;return(async()=>{n({status:"loading"});try{const m=await $x("",d);if(p)return;d&&Y8(d);const f=Ux(m.ws_path,m.token,m.ws_url),h=wv(m.runtime_surface),y=kv(h,m.runtime_capabilities),x=new bm({url:f,socketFactory:y.socketFactory,onReauth:async()=>{try{return(await a(x,h)).url}catch{return null}}});r.current=d,x.connect(),n({status:"ready",client:x,token:m.token,tokenExpiresAt:qx(m.expires_in),modelName:m.model_name??null,runtimeSurface:h})}catch(m){if(p)return;const f=m.message;f.includes("HTTP 401")||f.includes("HTTP 403")?n({status:"auth",failed:!!d}):n({status:"error",message:f})}})(),()=>{p=!0}},[a]);if(u.useEffect(()=>{if(t.status!=="ready")return;const d=t.client,p=window.setTimeout(async()=>{try{await a(d,t.runtimeSurface)}catch(m){const f=m.message;(f.includes("HTTP 401")||f.includes("HTTP 403"))&&n({status:"auth",failed:!!r.current})}},c6(t.tokenExpiresAt));return()=>window.clearTimeout(p)},[a,t]),u.useEffect(()=>{const d=G8();return o(d)},[o]),t.status==="loading")return s.jsx("div",{className:"flex h-full w-full items-center justify-center",children:s.jsx("div",{className:"flex flex-col items-center gap-3 animate-in fade-in-0 duration-300",children:s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsxs("span",{className:"relative flex h-2 w-2",children:[s.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-foreground/40"}),s.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-foreground/60"})]}),e("app.loading.connecting")]})})});if(t.status==="auth")return s.jsx(u6,{failed:!!t.failed,onSecret:d=>o(d)});if(t.status==="error")return s.jsx("div",{className:"flex h-full w-full items-center justify-center px-4 text-center",children:s.jsxs("div",{className:"flex max-w-md flex-col items-center gap-3",children:[s.jsx("p",{className:"text-lg font-semibold",children:e("app.error.title")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:t.message}),s.jsx("p",{className:"text-xs text-muted-foreground",children:e("app.error.gatewayHint")})]})});const i=d=>{n(p=>p.status==="ready"?{...p,modelName:d}:p)},l=()=>{t.status==="ready"&&t.client.close(),Q8(),n({status:"auth"})},c=async()=>{const d=ka();if(!(d!=null&&d.restartEngine))throw new Error("native engine restart is unavailable");return await d.restartEngine(),(await a(t.client,t.runtimeSurface)).token};return s.jsx(Y5,{client:t.client,token:t.token,modelName:t.modelName,children:s.jsx(g6,{runtimeSurface:t.runtimeSurface,onModelNameChange:i,onLogout:l,onNativeEngineRestart:c})})}function g6({runtimeSurface:e,onModelNameChange:t,onLogout:n,onNativeEngineRestart:r}){const{t:a,i18n:o}=se(),{client:i,token:l}=wr(),{theme:c,toggle:d}=y4(),{sessions:p,loading:m,refresh:f,createChat:h,forkChat:y,deleteChat:x,getSessionAutomations:b}=N8(),{state:v,update:g}=V8(p,!m),w=u.useRef(null);w.current||(w.current=Qd());const[k,C]=u.useState(w.current.activeKey),[j,N]=u.useState(w.current.view),[P,L]=u.useState(w.current.settingsSection),[_,T]=u.useState(d6),[R,D]=u.useState(!1),[K,G]=u.useState(!1),[W,H]=u.useState(!1),[E,F]=u.useState(null),[X,Q]=u.useState(null),[re,ue]=u.useState(null),pe=u.useRef(!1),[ce,z]=u.useState(null),[q,O]=u.useState(!1),[te,ie]=u.useState(()=>new Set),[ve,me]=u.useState(p6),[Z,ke]=u.useState(null),[ye,be]=u.useState(null),Ie=K8(l),[Pe,Le]=u.useState(null),[Te,J]=u.useState(null),[ee,V]=u.useState(null),[xe,Se]=u.useState({}),[De,Ve]=u.useState(null),[he,Xe]=u.useState({}),dt=u.useRef(new Set),xt=u.useRef(null),Ot=u.useRef(null),Ke=((Pe==null?void 0:Pe.surface)??(Pe==null?void 0:Pe.runtime_surface)??e)==="native",Ft=j!=="settings",He=u.useCallback(($,B)=>{C($.activeKey),N($.view),L($.settingsSection),l6($,B==null?void 0:B.replace)},[]);u.useEffect(()=>{const $=()=>{const B=Qd();C(B.activeKey),N(B.view),L(B.settingsSection),J(null),B.view==="chat"&&!B.activeKey&&V(null)};return window.addEventListener("hashchange",$),()=>window.removeEventListener("hashchange",$)},[]),u.useEffect(()=>{let $=!1;return li(l).then(B=>{$||Le(B)}).catch(()=>{$||Le(null)}),()=>{$=!0}},[l]),u.useEffect(()=>{try{window.localStorage.setItem(iS,_?"1":"0")}catch{}},[_]),u.useEffect(()=>{m6(ve)},[ve]);const Re=u.useMemo(()=>k?p.find($=>$.key===k)??null:null,[p,k]),kr=u.useMemo(()=>Array.from(te),[te]),or=u.useMemo(()=>Array.from(ve),[ve]),Qe=(Re==null?void 0:Re.chatId)??null;u.useEffect(()=>{xt.current=Qe,Qe&&me($=>{if(!$.has(Qe))return $;const B=new Set($);return B.delete(Qe),B})},[Qe]);const Ge=u.useMemo(()=>Qe&&xe[Qe]?xe[Qe]:Re!=null&&Re.workspaceScope?Re.workspaceScope:ee??(Z==null?void 0:Z.default_scope)??null,[Qe,Re==null?void 0:Re.workspaceScope,ee,xe,Z==null?void 0:Z.default_scope]),Vn=u.useMemo(()=>Qe&&Object.prototype.hasOwnProperty.call(he,Qe)?he[Qe]??null:Re!=null&&Re.knowledgeBaseId?Re.knowledgeBaseId:De??(ye==null?void 0:ye.default_knowledge_base_id)??null,[Qe,Re==null?void 0:Re.knowledgeBaseId,De,he,ye==null?void 0:ye.default_knowledge_base_id]),on=Qe?te.has(Qe):!1,Jt=u.useCallback(async()=>{try{const $=await SL(l);ke($)}catch{ke(null)}},[l]),Dn=u.useCallback(async()=>{try{const $=await hL(l);be($)}catch{be(null)}},[l]);u.useEffect(()=>{Jt(),Dn()},[Dn,Jt]),u.useEffect(()=>{if(m)return;const $=new Set(p.map(B=>B.chatId));me(B=>{const S=new Set(Array.from(B).filter(M=>$.has(M)));return S.size===B.size?B:S}),Se(B=>{const S=Object.entries(B).filter(([M])=>$.has(M));return S.length===Object.keys(B).length?B:Object.fromEntries(S)}),Xe(B=>{const S=Object.entries(B).filter(([M])=>$.has(M));return S.length===Object.keys(B).length?B:Object.fromEntries(S)})},[m,p]),u.useEffect(()=>{if(m||!k||p.some(B=>B.key===k))return;const $=Qd();He($.view==="chat"?sa():{...$,activeKey:null},{replace:!0})},[k,m,He,p]),u.useEffect(()=>i.onSessionUpdate(($,B,S,M)=>{if(B==="thread"&&me(U=>{const de=new Set(U);return xt.current===$?de.delete($):de.add($),de.size===U.size&&de.has($)===U.has($)?U:de}),S){const U=zs(S);Se(de=>({...de,[$]:U})),V(U)}M!==void 0&&(Xe(U=>({...U,[$]:M??null})),Ve(M??null)),J(null),Jt(),Dn()}),[i,Dn,Jt]),u.useEffect(()=>i.onError($=>{$.kind==="workspace_scope_rejected"&&(J(a("errors.workspaceScopeRejected.body")),Jt())}),[i,Jt,a]),u.useEffect(()=>{if(m)return;const $=p.filter(B=>typeof B.runStartedAt=="number").map(B=>B.chatId);if($.length!==0){for(const B of $)i.attach(B);ie(B=>{let S=!1;const M=new Set(B);for(const U of $)M.has(U)||(S=!0),M.add(U);return S?(dt.current=M,M):B}),me(B=>{let S=!1;const M=new Set(B);for(const U of $)M.delete(U)&&(S=!0);return S?M:B})}},[i,m,p]);const Vt=u.useCallback(()=>{Ot.current!==null&&(window.clearTimeout(Ot.current),Ot.current=null)},[]),Je=u.useCallback(()=>{Vt(),D(!1)},[Vt]),sn=u.useCallback(()=>{!Ke||!Ft||_||(Vt(),D(!0))},[Vt,_,Ke,Ft]),pt=u.useCallback(()=>{if(Vt(),!Ke||!Ft||_){D(!1);return}Ot.current=window.setTimeout(()=>{D(!1),Ot.current=null},160)},[Vt,_,Ke,Ft]);u.useEffect(()=>()=>Vt(),[Vt]),u.useEffect(()=>{(!Ke||!Ft||_)&&Je()},[Je,_,Ke,Ft]);const zt=u.useCallback(()=>{Je(),T(!1)},[Je]),st=u.useCallback(()=>{Je(),T(!0)},[Je]),hn=u.useCallback(()=>{Je(),T($=>!$)},[Je]),it=u.useCallback(()=>{G(!1)},[]),$t=u.useCallback(()=>{typeof window<"u"&&window.matchMedia("(min-width: 1024px)").matches?(Je(),T(B=>!B)):G(B=>!B)},[Je]),Cn=u.useCallback($=>{const B=zs($);if(J(null),Qe){on||i.setWorkspaceScope(Qe,B);return}V(B)},[Qe,on,i]),Sn=u.useCallback(async $=>{try{const B=$??Ge,S=await h(B,Vn);return He({view:"chat",activeKey:`websocket:${S}`,settingsSection:"overview"}),G(!1),B&&Se(M=>({...M,[S]:zs(B)})),Xe(M=>({...M,[S]:Vn??null})),S}catch(B){return console.error("Failed to create chat",B),B instanceof Error&&B.message.startsWith("workspace_scope_rejected:")&&J(a("errors.workspaceScopeRejected.body")),null}},[Vn,Ge,h,He,a]),gn=u.useCallback(async($,B)=>{try{const S=p.find(de=>de.chatId===$),M=S?p1(S,v.title_overrides,a("chat.newChat")):a("chat.newChat"),U=await y($,B,a("chat.forkTitle",{title:M}));return He({view:"chat",activeKey:`websocket:${U}`,settingsSection:"overview"}),G(!1),U}catch(S){return console.error("Failed to fork chat",S),null}},[y,He,p,v.title_overrides,a]),Nn=u.useCallback(()=>{He(sa()),V(null),Ve((ye==null?void 0:ye.default_knowledge_base_id)??null),J(null),H(!1),G(!1)},[ye==null?void 0:ye.default_knowledge_base_id,He]),Cr=u.useCallback(($,B)=>{const S=(Z==null?void 0:Z.default_scope)??Ge,M=$.trim();if(!S||!M){Nn();return}He(sa()),V(zs({project_path:M,project_name:B||Vo(M),access_mode:S.access_mode,restrict_to_workspace:S.access_mode==="restricted"})),J(null),G(!1)},[Ge,He,Nn,Z==null?void 0:Z.default_scope]),Ut=u.useCallback(($,B)=>{const S=$.trim(),M=Ge??(Z==null?void 0:Z.default_scope);!S||!M||(Cn({project_path:S,project_name:B||Vo(S),access_mode:M.access_mode,restrict_to_workspace:M.access_mode==="restricted"}),J(null),G(!1))},[Ge,Cn,Z==null?void 0:Z.default_scope]),Sr=u.useCallback(async()=>{let $="";const B=ka();B!=null&&B.pickFolder?$=await B.pickFolder()??"":typeof window<"u"&&($=window.prompt("输入本地项目目录绝对路径",(Ge==null?void 0:Ge.project_path)??"")??"");const S=$.trim();S&&(g(M=>({...M,project_paths:Array.from(new Set([...M.project_paths,S]))})),Ut(S,Vo(S)))},[Ge==null?void 0:Ge.project_path,Ut,g]),Kr=u.useCallback($=>{const B=$.trim();B&&g(S=>({...S,project_paths:S.project_paths.filter(M=>M!==B)}))},[g]),Bt=u.useCallback($=>{if(Qe){Xe(B=>({...B,[Qe]:$}));return}Ve($)},[Qe]),Ce=u.useCallback($=>{const B=p.find(M=>M.key===$),S=B==null?void 0:B.chatId;S&&me(M=>{if(!M.has(S))return M;const U=new Set(M);return U.delete(S),U}),B!=null&&B.workspaceScope?V(zs(B.workspaceScope)):V(null),Ve((B==null?void 0:B.knowledgeBaseId)??null),J(null),He({view:"chat",activeKey:$,settingsSection:"overview"}),G(!1)},[He,p]),we=u.useCallback($=>{g(B=>{const S=new Set(B.pinned_keys);return S.has($)?S.delete($):S.add($),{...B,pinned_keys:Array.from(S)}})},[g]),_t=u.useCallback(($,B)=>{Q({key:$,label:B})},[]),Oe=u.useCallback($=>{if(!X)return;const B=X.key;Q(null),g(S=>{const M={...S.title_overrides},U=$.trim();return U?M[B]=U:delete M[B],{...S,title_overrides:M}})},[X,g]),Rt=u.useCallback($=>{g(B=>{const S={...B.collapsed_groups};return $==="workspace:chats"||$==="date:all"?(S[$]===!1?delete S[$]:S[$]=!1,{...B,collapsed_groups:S}):(S[$]?delete S[$]:S[$]=!0,{...B,collapsed_groups:S})})},[g]),yt=u.useCallback(($,B)=>{ue({key:$,label:B})},[]),lt=u.useCallback($=>{if(!re)return;const B=re.key;ue(null),g(S=>{const M={...S.project_name_overrides},U=$.trim();return U?M[B]=U:delete M[B],{...S,project_name_overrides:M}})},[re,g]),nt=u.useCallback($=>{if(g(B=>{const S=new Set(B.archived_keys),M=B.pinned_keys.filter(U=>U!==$);return S.has($)?S.delete($):S.add($),{...B,pinned_keys:M,archived_keys:Array.from(S)}}),k===$&&!v.archived_keys.includes($)){const B=new Set([...v.archived_keys,$]),S=p.find(M=>!B.has(M.key));He({view:"chat",activeKey:(S==null?void 0:S.key)??null,settingsSection:"overview"})}},[k,He,p,v.archived_keys,g]),Ze=u.useCallback(()=>{g($=>({...$,view:{...$.view,show_archived:!$.view.show_archived}}))},[g]),vn=u.useCallback(()=>{G(!1),H(!0)},[]);u.useEffect(()=>{const $=B=>{if(B.defaultPrevented)return;if((B.metaKey||B.ctrlKey)&&B.shiftKey&&!B.altKey&&B.key.toLowerCase()==="o"){B.preventDefault(),Nn();return}(B.metaKey||B.ctrlKey)&&!B.altKey&&!B.shiftKey&&B.key.toLowerCase()==="k"&&(B.preventDefault(),vn())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[Nn,vn]);const Kt=u.useCallback($=>{H(!1),Ce($)},[Ce]),ln=u.useCallback(($="overview")=>{H(!1),He({view:"settings",activeKey:k,settingsSection:$}),G(!1)},[k,He]),Mt=u.useCallback(()=>{ln("models")},[ln]),Nr=u.useCallback(()=>{H(!1),He({view:"apps",activeKey:k,settingsSection:"apps"}),G(!1)},[k,He]),Et=u.useCallback(()=>{H(!1),He({view:"automations",activeKey:k,settingsSection:"automations"}),G(!1)},[k,He]),io=u.useCallback(()=>{H(!1),He({view:"skills",activeKey:k,settingsSection:"skills"}),G(!1)},[k,He]),jr=u.useCallback($=>{He({view:cS($),activeKey:k,settingsSection:$})},[k,He]),lo=u.useCallback(()=>{G(!1);const $=(()=>{var B;return k?p.some(S=>S.key===k)?k:((B=p[0])==null?void 0:B.key)??null:null})();He({view:"chat",activeKey:$,settingsSection:"overview"})},[k,He,p]),Gr=u.useCallback(()=>{const $=(Re==null?void 0:Re.chatId)??i.defaultChatId;if($){pe.current=!1,O(!0);try{window.localStorage.setItem(Yd,String(Date.now()))}catch{}i.sendMessage($,"/restart")}},[Re==null?void 0:Re.chatId,i]);u.useEffect(()=>i.onRuntimeModelUpdate($=>{t($)}),[i,t]),u.useEffect(()=>i.onRunStatus(($,B)=>{if(B!=null){const M=new Set(dt.current);M.add($),dt.current=M,ie(M),me(U=>{if(!U.has($))return U;const de=new Set(U);return de.delete($),de});return}if(!dt.current.has($))return;const S=new Set(dt.current);S.delete($),dt.current=S,ie(S),me(M=>{const U=new Set(M);return xt.current===$?U.delete($):U.add($),U})}),[i]),u.useEffect(()=>i.onStatus($=>{const B=(()=>{try{return Number(window.localStorage.getItem(Yd)??"0")}catch{return 0}})();if(!B)return;if($!=="open"){pe.current=!0;return}const S=Date.now()-B;if(!(!pe.current&&S<1500)){try{window.localStorage.removeItem(Yd)}catch{}O(!1),z(a("app.restart.completed",{seconds:(S/1e3).toFixed(1)})),window.setTimeout(()=>z(null),3500)}}),[i,a]);const Ns=U8(Re,f),Kn=u.useCallback(async()=>{var de,Fe,et;if(!E)return;const $=E.key,B=(((de=E.automations)==null?void 0:de.length)??0)>0,S=k===$,M=p.findIndex(St=>St.key===$),U=S?((Fe=p[M+1])==null?void 0:Fe.key)??((et=p[M-1])==null?void 0:et.key)??null:k;try{const St=await x($,B?{deleteAutomations:!0}:void 0);if(St.blocked_by_automations){F({...E,automations:St.automations??[]});return}F(null),S&&He({view:"chat",activeKey:U,settingsSection:"overview"},{replace:!0})}catch(St){console.error("Failed to delete session",St)}},[E,x,k,He,p]),co=u.useCallback(async($,B)=>{let S=[];try{S=await b($)}catch{}F({key:$,label:B,automations:S})},[b]),sr=Re?v.title_overrides[Re.key]||Re.title||Qi(Re.preview,a("chat.newChat")):a("app.brand");u.useEffect(()=>{if(j==="settings"){document.title=a("app.documentTitle.chat",{title:a("settings.sidebar.title")});return}if(j==="apps"){document.title=a("app.documentTitle.chat",{title:a("settings.nav.apps",{defaultValue:"Apps"})});return}if(j==="automations"){document.title=a("app.documentTitle.chat",{title:a("settings.nav.automations",{defaultValue:"Automations"})});return}if(j==="skills"){document.title=a("app.documentTitle.chat",{title:a("settings.nav.skills",{defaultValue:"Skills"})});return}document.title=Re?a("app.documentTitle.chat",{title:sr}):a("app.documentTitle.base")},[Re,sr,o.resolvedLanguage,a,j]);const Ue={sessions:p,activeKey:k,loading:m,onNewChat:Nn,onSelect:Ce,onRequestDelete:co,onTogglePin:we,onRequestRename:_t,onToggleArchive:nt,onToggleGroup:Rt,onRequestRenameProject:yt,onNewChatInProject:Cr,onSelectProjectWorkspace:Ut,onAddProjectWorkspace:Sr,onRemoveProjectWorkspace:Kr,onOpenSettings:ln,onOpenApps:Nr,onOpenAutomations:Et,onOpenSkills:io,onOpenSearch:vn,activeUtility:j==="apps"||j==="automations"||j==="skills"?j:null,onToggleArchived:Ze,pinnedKeys:v.pinned_keys,archivedKeys:v.archived_keys,titleOverrides:v.title_overrides,projectNameOverrides:v.project_name_overrides,projectPaths:v.project_paths,collapsedGroups:v.collapsed_groups,runningChatIds:kr,updatedChatIds:or,viewState:v.view,showArchived:v.view.show_archived,archivedCount:v.archived_keys.length,defaultWorkspacePath:(Z==null?void 0:Z.default_scope.project_path)??null,currentWorkspacePath:(Ge==null?void 0:Ge.project_path)??null},Yr=Ke&&!_,js=Ft&&Yr&&R,bt=Ke?_?oc:0:_?oc:n6,On=!Ke||_;return u.useEffect(()=>(document.documentElement.classList.toggle("native-host",Ke),()=>{document.documentElement.classList.remove("native-host")}),[Ke]),s.jsx(b4,{theme:c,children:s.jsxs("div",{className:A("relative h-full w-full overflow-hidden",Ke&&"host-window-shell"),children:[Ke?s.jsx(f6,{onToggleSidebar:Ft?hn:void 0,onSidebarPreviewEnter:sn,onSidebarPreviewLeave:pt,sidebarOpen:_,rightAction:j==="chat"?void 0:s.jsx(fe,{type:"button",variant:"ghost",size:"icon","aria-label":a("thread.header.toggleTheme"),onClick:d,className:"h-8 w-8 rounded-full text-muted-foreground/85 hover:bg-accent/40 hover:text-foreground",children:c==="dark"?s.jsx(iw,{className:"h-4 w-4"}):s.jsx(vf,{className:"h-4 w-4"})})}):null,s.jsxs("div",{className:A("relative flex h-full w-full overflow-hidden"),children:[Ft?s.jsx("aside",{"data-testid":"host-sidebar-flow",className:A("relative z-20 hidden shrink-0 overflow-hidden lg:block","transition-[width] duration-300 ease-out"),style:{width:bt},children:On?s.jsx("div",{className:A("absolute inset-y-0 left-0 h-full w-full overflow-hidden",Ke?"host-sidebar-glass":"bg-sidebar shadow-inner-right"),children:s.jsx(Ed,{...Ue,collapsed:!Ke&&!_,hostChromeInset:Ke,onCollapse:zt,onExpand:st})}):null}):null,js?s.jsx("aside",{"data-testid":"host-sidebar-preview",className:"absolute inset-y-0 left-0 z-30 hidden overflow-hidden lg:block animate-in fade-in-0 slide-in-from-left-2 duration-150",style:{width:oc},onMouseEnter:sn,onMouseLeave:pt,children:s.jsx("div",{className:"h-full w-full overflow-hidden host-sidebar-glass shadow-2xl",children:s.jsx(Ed,{...Ue,hostChromeInset:Ke,onCollapse:zt,onExpand:st})})}):null,Ft?s.jsx(Vf,{open:K,onOpenChange:$=>G($),children:s.jsxs(_u,{side:"left",showCloseButton:!1,"aria-describedby":void 0,className:"p-0 lg:hidden",style:{width:Wx,maxWidth:Wx},children:[s.jsx(Pu,{className:"sr-only",children:a("sidebar.navigation")}),s.jsx(Ed,{...Ue,onCollapse:it,containActionMenus:!0})]})}):null,s.jsx(sL,{open:W,onOpenChange:H,sessions:p,activeKey:k,loading:m,titleOverrides:v.title_overrides,onSelect:Kt}),s.jsxs("main",{className:A("relative flex h-full min-w-0 flex-1 flex-col overflow-hidden bg-background",Ke&&_&&"border-l border-border/55"),children:[s.jsx("div",{className:A("absolute inset-0 flex flex-col",j!=="chat"&&"invisible pointer-events-none"),children:s.jsx(z8,{session:Re,title:sr,onToggleSidebar:$t,onNewChat:Nn,onCreateChat:Sn,onForkChat:gn,onTurnEnd:Ns,theme:c,onToggleTheme:d,hideSidebarToggleForHostChrome:!0,hostChromeTitleInset:Yr,hideHeader:!1,workspaceScope:Ge,workspaceDefaultScope:(Z==null?void 0:Z.default_scope)??null,workspaceControls:(Z==null?void 0:Z.controls)??null,workspaceScopeDisabled:on,workspaceError:Te,onWorkspaceScopeChange:Cn,knowledgeBases:(ye==null?void 0:ye.knowledge_bases)??[],selectedKnowledgeBaseId:Vn,onKnowledgeBaseChange:Bt,settingsSnapshot:Pe,onOpenModelSettings:Mt})}),j!=="chat"&&s.jsx("div",{className:"absolute inset-0 flex flex-col",children:s.jsx(sD,{theme:c,initialSection:P,initialSettings:Pe,showSidebar:j==="settings",onToggleTheme:d,onBackToChat:lo,onModelNameChange:t,onSettingsChange:Le,skills:Ie,onWorkspaceSettingsChange:Jt,onSectionChange:jr,onLogout:n,onRestart:Gr,onNativeEngineRestart:r,isRestarting:q,hostChromeInset:Ke})})]})]}),s.jsx(DM,{open:!!E,title:(E==null?void 0:E.label)??"",automations:E==null?void 0:E.automations,onCancel:()=>F(null),onConfirm:Kn}),s.jsx(Yg,{open:!!X,title:(X==null?void 0:X.label)??"",onCancel:()=>Q(null),onConfirm:Oe}),s.jsx(Yg,{open:!!re,title:(re==null?void 0:re.label)??"",dialogTitle:a("chat.renameProjectTitle"),description:a("chat.renameProjectDescription"),placeholder:a("chat.renameProjectPlaceholder"),onCancel:()=>ue(null),onConfirm:lt}),ce?s.jsx("div",{role:"status",className:"fixed left-1/2 top-[calc(0.75rem+env(safe-area-inset-top))] z-50 max-w-[calc(100vw-1rem)] -translate-x-1/2 rounded-full border border-border/70 bg-popover px-4 py-2 text-sm font-medium text-popover-foreground shadow-lg",children:ce}):null]})})}typeof globalThis.crypto<"u"&&!("randomUUID"in globalThis.crypto)&&Object.defineProperty(globalThis.crypto,"randomUUID",{value:()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),configurable:!0});const uS=document.getElementById("root");if(!uS)throw new Error("root element missing");Xd.createRoot(uS).render(s.jsx(h6,{}));export{TC as A,jt as C,ew as E,Jf as F,O4 as a,C6 as b,A as c,F4 as d,Wc as f,k6 as i};