codex-mobile-re 0.1.133 → 0.1.136

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,98 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-BiyKia_7.js","assets/sanitizeHtml-Bd3No2dT.js","assets/ThreadConversation-DynLmaDw.css","assets/ThreadTerminalPanel-BlisDnyv.js","assets/ThreadTerminalPanel-DkX7vTl_.css","assets/ReviewPane-BzcuGGZz.js","assets/ReviewPane-BFBDQWlW.css","assets/DirectoryHub-CbWz81wr.js","assets/DirectoryHub-DcMzIMOW.css","assets/AutomationsPanel-BrxpYd3F.js","assets/AutomationsPanel-Dz1E0PMi.css","assets/SettingsDialog-D34lKAxd.js","assets/SettingsDialog-C6mYdSFF.css","assets/RightGitPanel-BsVCibLZ.js","assets/RightGitPanel-CQgG9pXB.css","assets/RightFilesPanel-mG5aaeVI.js","assets/RightFilesPanel-ev__hRb5.css","assets/RightFilePreview-BRXbHofi.js","assets/RightFilePreview-DNZDBkBr.css","assets/ThreadPendingRequestPanel-Bg_3qi-T.js","assets/ThreadPendingRequestPanel-BlBoJVzv.css","assets/QueuedMessages-BYByp2ES.js","assets/QueuedMessages-D6bvkQIC.css"])))=>i.map(i=>d[i]);
2
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();/**
3
+ * @vue/shared v3.5.40
4
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
5
+ * @license MIT
6
+ **/function nh(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const zt={},il=[],Ta=()=>{},Cv=()=>!1,Nc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),$c=e=>e.startsWith("onUpdate:"),yn=Object.assign,rh=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},aS=Object.prototype.hasOwnProperty,$t=(e,t)=>aS.call(e,t),lt=Array.isArray,ll=e=>hu(e)==="[object Map]",Oc=e=>hu(e)==="[object Set]",qp=e=>hu(e)==="[object Date]",pt=e=>typeof e=="function",Xt=e=>typeof e=="string",Do=e=>typeof e=="symbol",Ot=e=>e!==null&&typeof e=="object",xv=e=>(Ot(e)||pt(e))&&pt(e.then)&&pt(e.catch),Iv=Object.prototype.toString,hu=e=>Iv.call(e),sS=e=>hu(e).slice(8,-1),Av=e=>hu(e)==="[object Object]",oh=e=>Xt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Yl=nh(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Dc=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},iS=/-\w/g,hr=Dc(e=>e.replace(iS,t=>t.slice(1).toUpperCase())),lS=/\B([A-Z])/g,Vs=Dc(e=>e.replace(lS,"-$1").toLowerCase()),Fc=Dc(e=>e.charAt(0).toUpperCase()+e.slice(1)),Pd=Dc(e=>e?`on${Fc(e)}`:""),Lo=(e,t)=>!Object.is(e,t),tc=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},_v=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},ah=e=>{const t=parseFloat(e);return isNaN(t)?e:t},uS=e=>{const t=Xt(e)?Number(e):NaN;return isNaN(t)?e:t};let Gp;const Bc=()=>Gp||(Gp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Zr(e){if(lt(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=Xt(r)?hS(r):Zr(r);if(o)for(const a in o)t[a]=o[a]}return t}else if(Xt(e)||Ot(e))return e}const cS=/;(?![^(]*\))/g,dS=/:([^]+)/,fS=/\/\*[^]*?\*\//g;function hS(e){const t={};return e.replace(fS,"").split(cS).forEach(n=>{if(n){const r=n.split(dS);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function ct(e){let t="";if(Xt(e))t=e;else if(lt(e))for(let n=0;n<e.length;n++){const r=ct(e[n]);r&&(t+=r+" ")}else if(Ot(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const pS="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",mS=nh(pS);function Pv(e){return!!e||e===""}function gS(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=pu(e[r],t[r]);return n}function pu(e,t){if(e===t)return!0;let n=qp(e),r=qp(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=Do(e),r=Do(t),n||r)return e===t;if(n=lt(e),r=lt(t),n||r)return n&&r?gS(e,t):!1;if(n=Ot(e),r=Ot(t),n||r){if(!n||!r)return!1;const o=Object.keys(e).length,a=Object.keys(t).length;if(o!==a)return!1;for(const s in e){const i=e.hasOwnProperty(s),l=t.hasOwnProperty(s);if(i&&!l||!i&&l||!pu(e[s],t[s]))return!1}}return String(e)===String(t)}function Ev(e,t){return e.findIndex(n=>pu(n,t))}const Mv=e=>!!(e&&e.__v_isRef===!0),O=e=>Xt(e)?e:e==null?"":lt(e)||Ot(e)&&(e.toString===Iv||!pt(e.toString))?Mv(e)?O(e.value):JSON.stringify(e,Rv,2):String(e),Rv=(e,t)=>Mv(t)?Rv(e,t.value):ll(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],a)=>(n[Ed(r,a)+" =>"]=o,n),{})}:Oc(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Ed(n))}:Do(t)?Ed(t):Ot(t)&&!lt(t)&&!Av(t)?String(t):t,Ed=(e,t="")=>{var n;return Do(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
7
+ * @vue/reactivity v3.5.40
8
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
9
+ * @license MIT
10
+ **/let Hn;class vS{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&Hn&&(Hn.active?(this.parent=Hn,this.index=(Hn.scopes||(Hn.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes){const r=this.scopes.slice();for(t=0,n=r.length;t<n;t++)r[t].pause()}for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes){const o=this.scopes.slice();for(t=0,n=o.length;t<n;t++)o[t].resume()}const r=this.effects.slice();for(t=0,n=r.length;t<n;t++)r[t].resume()}}run(t){if(this._active){const n=Hn;try{return Hn=this,t()}finally{Hn=n}}}on(){++this._on===1&&(this.prevScope=Hn,Hn=this)}off(){if(this._on>0&&--this._on===0){if(Hn===this)Hn=this.prevScope;else{let t=Hn;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){const o=this.scopes.slice();for(n=0,r=o.length;n<r;n++)o[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const o=this.parent.scopes.pop();o&&o!==this&&(this.parent.scopes[this.index]=o,o.index=this.index)}this.parent=void 0}}}function yS(){return Hn}let Kt;const Md=new WeakSet;class Lv{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Hn&&(Hn.active?Hn.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Md.has(this)&&(Md.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Nv(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Vp(this),$v(this);const t=Kt,n=$o;Kt=this,$o=!0;try{return this.fn()}finally{Ov(this),Kt=t,$o=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)lh(t);this.deps=this.depsTail=void 0,Vp(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Md.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){pf(this)&&this.run()}get dirty(){return pf(this)}}let jv=0,Jl,Ql;function Nv(e,t=!1){if(e.flags|=8,t){e.next=Ql,Ql=e;return}e.next=Jl,Jl=e}function sh(){jv++}function ih(){if(--jv>0)return;if(Ql){let t=Ql;for(Ql=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Jl;){let t=Jl;for(Jl=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function $v(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Ov(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),lh(r),wS(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function pf(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Dv(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Dv(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===ru)||(e.globalVersion=ru,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!pf(e))))return;e.flags|=2;const t=e.dep,n=Kt,r=$o;Kt=e,$o=!0;try{$v(e);const o=e.fn(e._value);(t.version===0||Lo(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{Kt=n,$o=r,Ov(e),e.flags&=-3}}function lh(e,t=!1){const{dep:n,prevSub:r,nextSub:o}=e;if(r&&(r.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let a=n.computed.deps;a;a=a.nextDep)lh(a,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function wS(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let $o=!0;const Fv=[];function ts(){Fv.push($o),$o=!1}function ns(){const e=Fv.pop();$o=e===void 0?!0:e}function Vp(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Kt;Kt=void 0;try{t()}finally{Kt=n}}}let ru=0;class bS{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class uh{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!Kt||!$o||Kt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Kt)n=this.activeLink=new bS(Kt,this),Kt.deps?(n.prevDep=Kt.depsTail,Kt.depsTail.nextDep=n,Kt.depsTail=n):Kt.deps=Kt.depsTail=n,Bv(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=Kt.depsTail,n.nextDep=void 0,Kt.depsTail.nextDep=n,Kt.depsTail=n,Kt.deps===n&&(Kt.deps=r)}return n}trigger(t){this.version++,ru++,this.notify(t)}notify(t){sh();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{ih()}}}function Bv(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)Bv(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const mf=new WeakMap,Si=Symbol(""),gf=Symbol(""),ou=Symbol("");function Xn(e,t,n){if($o&&Kt){let r=mf.get(e);r||mf.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new uh),o.map=r,o.key=n),o.track()}}function Ka(e,t,n,r,o,a){const s=mf.get(e);if(!s){ru++;return}const i=l=>{l&&l.trigger()};if(sh(),t==="clear")s.forEach(i);else{const l=lt(e),u=l&&oh(n);if(l&&n==="length"){const d=Number(r);s.forEach((m,f)=>{(f==="length"||f===ou||!Do(f)&&f>=d)&&i(m)})}else switch((n!==void 0||s.has(void 0))&&i(s.get(n)),u&&i(s.get(ou)),t){case"add":l?u&&i(s.get("length")):(i(s.get(Si)),ll(e)&&i(s.get(gf)));break;case"delete":l||(i(s.get(Si)),ll(e)&&i(s.get(gf)));break;case"set":ll(e)&&i(s.get(Si));break}}ih()}function Xi(e){const t=Lt(e);return t===e?t:(Xn(t,"iterate",ou),eo(e)?t:t.map(Fo))}function Uc(e){return Xn(e=Lt(e),"iterate",ou),e}function ya(e,t){return rs(e)?yl(ki(e)?Fo(t):t):Fo(t)}const TS={__proto__:null,[Symbol.iterator](){return Rd(this,Symbol.iterator,e=>ya(this,e))},concat(...e){return Xi(this).concat(...e.map(t=>lt(t)?Xi(t):t))},entries(){return Rd(this,"entries",e=>(e[1]=ya(this,e[1]),e))},every(e,t){return za(this,"every",e,t,void 0,arguments)},filter(e,t){return za(this,"filter",e,t,n=>n.map(r=>ya(this,r)),arguments)},find(e,t){return za(this,"find",e,t,n=>ya(this,n),arguments)},findIndex(e,t){return za(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return za(this,"findLast",e,t,n=>ya(this,n),arguments)},findLastIndex(e,t){return za(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return za(this,"forEach",e,t,void 0,arguments)},includes(...e){return Ld(this,"includes",e)},indexOf(...e){return Ld(this,"indexOf",e)},join(e){return Xi(this).join(e)},lastIndexOf(...e){return Ld(this,"lastIndexOf",e)},map(e,t){return za(this,"map",e,t,void 0,arguments)},pop(){return Fl(this,"pop")},push(...e){return Fl(this,"push",e)},reduce(e,...t){return Kp(this,"reduce",e,t)},reduceRight(e,...t){return Kp(this,"reduceRight",e,t)},shift(){return Fl(this,"shift")},some(e,t){return za(this,"some",e,t,void 0,arguments)},splice(...e){return Fl(this,"splice",e)},toReversed(){return Xi(this).toReversed()},toSorted(e){return Xi(this).toSorted(e)},toSpliced(...e){return Xi(this).toSpliced(...e)},unshift(...e){return Fl(this,"unshift",e)},values(){return Rd(this,"values",e=>ya(this,e))}};function Rd(e,t,n){const r=Uc(e),o=r[t]();return r!==e&&!eo(e)&&(o._next=o.next,o.next=()=>{const a=o._next();return a.done||(a.value=n(a.value)),a}),o}const SS=Array.prototype;function za(e,t,n,r,o,a){const s=Uc(e),i=s!==e&&!eo(e),l=s[t];if(l!==SS[t]){const m=l.apply(e,a);return i?Fo(m):m}let u=n;s!==e&&(i?u=function(m,f){return n.call(this,ya(e,m),f,e)}:n.length>2&&(u=function(m,f){return n.call(this,m,f,e)}));const d=l.call(s,u,r);return i&&o?o(d):d}function Kp(e,t,n,r){const o=Uc(e),a=o!==e&&!eo(e);let s=n,i=!1;o!==e&&(a?(i=r.length===0,s=function(u,d,m){return i&&(i=!1,u=ya(e,u)),n.call(this,u,ya(e,d),m,e)}):n.length>3&&(s=function(u,d,m){return n.call(this,u,d,m,e)}));const l=o[t](s,...r);return i?ya(e,l):l}function Ld(e,t,n){const r=Lt(e);Xn(r,"iterate",ou);const o=r[t](...n);return(o===-1||o===!1)&&fh(n[0])?(n[0]=Lt(n[0]),r[t](...n)):o}function Fl(e,t,n=[]){ts(),sh();const r=Lt(e)[t].apply(e,n);return ih(),ns(),r}const kS=nh("__proto__,__v_isRef,__isVue"),Uv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Do));function CS(e){Do(e)||(e=String(e));const t=Lt(this);return Xn(t,"has",e),t.hasOwnProperty(e)}class zv{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const o=this._isReadonly,a=this._isShallow;if(n==="__v_isReactive")return!o;if(n==="__v_isReadonly")return o;if(n==="__v_isShallow")return a;if(n==="__v_raw")return r===(o?a?jS:Gv:a?qv:Wv).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const s=lt(t);if(!o){let l;if(s&&(l=TS[n]))return l;if(n==="hasOwnProperty")return CS}const i=Reflect.get(t,n,Nn(t)?t:r);if((Do(n)?Uv.has(n):kS(n))||(o||Xn(t,"get",n),a))return i;if(Nn(i)){const l=s&&oh(n)?i:i.value;return o&&Ot(l)?yf(l):l}return Ot(i)?o?yf(i):zc(i):i}}class Hv extends zv{constructor(t=!1){super(!1,t)}set(t,n,r,o){let a=t[n];const s=lt(t)&&oh(n);if(!this._isShallow){const u=rs(a);if(!eo(r)&&!rs(r)&&(a=Lt(a),r=Lt(r)),!s&&Nn(a)&&!Nn(r))return u||(a.value=r),!0}const i=s?Number(n)<t.length:$t(t,n),l=Reflect.set(t,n,r,Nn(t)?t:o);return t===Lt(o)&&l&&(i?Lo(r,a)&&Ka(t,"set",n,r):Ka(t,"add",n,r)),l}deleteProperty(t,n){const r=$t(t,n);t[n];const o=Reflect.deleteProperty(t,n);return o&&r&&Ka(t,"delete",n,void 0),o}has(t,n){const r=Reflect.has(t,n);return(!Do(n)||!Uv.has(n))&&Xn(t,"has",n),r}ownKeys(t){return Xn(t,"iterate",lt(t)?"length":Si),Reflect.ownKeys(t)}}class xS extends zv{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const IS=new Hv,AS=new xS,_S=new Hv(!0);const vf=e=>e,Du=e=>Reflect.getPrototypeOf(e);function PS(e,t,n){return function(...r){const o=this.__v_raw,a=Lt(o),s=ll(a),i=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,u=o[e](...r),d=n?vf:t?yl:Fo;return!t&&Xn(a,"iterate",l?gf:Si),yn(Object.create(u),{next(){const{value:m,done:f}=u.next();return f?{value:m,done:f}:{value:i?[d(m[0]),d(m[1])]:d(m),done:f}}})}}function Fu(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function ES(e,t){const n={get(o){const a=this.__v_raw,s=Lt(a),i=Lt(o);e||(Lo(o,i)&&Xn(s,"get",o),Xn(s,"get",i));const{has:l}=Du(s),u=t?vf:e?yl:Fo;if(l.call(s,o))return u(a.get(o));if(l.call(s,i))return u(a.get(i));a!==s&&a.get(o)},get size(){const o=this.__v_raw;return!e&&Xn(Lt(o),"iterate",Si),o.size},has(o){const a=this.__v_raw,s=Lt(a),i=Lt(o);return e||(Lo(o,i)&&Xn(s,"has",o),Xn(s,"has",i)),o===i?a.has(o):a.has(o)||a.has(i)},forEach(o,a){const s=this,i=s.__v_raw,l=Lt(i),u=t?vf:e?yl:Fo;return!e&&Xn(l,"iterate",Si),i.forEach((d,m)=>o.call(a,u(d),u(m),s))}};return yn(n,e?{add:Fu("add"),set:Fu("set"),delete:Fu("delete"),clear:Fu("clear")}:{add(o){const a=Lt(this),s=Du(a),i=Lt(o),l=!t&&!eo(o)&&!rs(o)?i:o;return s.has.call(a,l)||Lo(o,l)&&s.has.call(a,o)||Lo(i,l)&&s.has.call(a,i)||(a.add(l),Ka(a,"add",l,l)),this},set(o,a){!t&&!eo(a)&&!rs(a)&&(a=Lt(a));const s=Lt(this),{has:i,get:l}=Du(s);let u=i.call(s,o);u||(o=Lt(o),u=i.call(s,o));const d=l.call(s,o);return s.set(o,a),u?Lo(a,d)&&Ka(s,"set",o,a):Ka(s,"add",o,a),this},delete(o){const a=Lt(this),{has:s,get:i}=Du(a);let l=s.call(a,o);l||(o=Lt(o),l=s.call(a,o)),i&&i.call(a,o);const u=a.delete(o);return l&&Ka(a,"delete",o,void 0),u},clear(){const o=Lt(this),a=o.size!==0,s=o.clear();return a&&Ka(o,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(o=>{n[o]=PS(o,e,t)}),n}function ch(e,t){const n=ES(e,t);return(r,o,a)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get($t(n,o)&&o in r?n:r,o,a)}const MS={get:ch(!1,!1)},RS={get:ch(!1,!0)},LS={get:ch(!0,!1)};const Wv=new WeakMap,qv=new WeakMap,Gv=new WeakMap,jS=new WeakMap;function NS(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function zc(e){return rs(e)?e:dh(e,!1,IS,MS,Wv)}function Vv(e){return dh(e,!1,_S,RS,qv)}function yf(e){return dh(e,!0,AS,LS,Gv)}function dh(e,t,n,r,o){if(!Ot(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const a=o.get(e);if(a)return a;const s=NS(sS(e));if(s===0)return e;const i=new Proxy(e,s===2?r:n);return o.set(e,i),i}function ki(e){return rs(e)?ki(e.__v_raw):!!(e&&e.__v_isReactive)}function rs(e){return!!(e&&e.__v_isReadonly)}function eo(e){return!!(e&&e.__v_isShallow)}function fh(e){return e?!!e.__v_raw:!1}function Lt(e){const t=e&&e.__v_raw;return t?Lt(t):e}function $S(e){return!$t(e,"__v_skip")&&Object.isExtensible(e)&&_v(e,"__v_skip",!0),e}const Fo=e=>Ot(e)?zc(e):e,yl=e=>Ot(e)?yf(e):e;function Nn(e){return e?e.__v_isRef===!0:!1}function S(e){return Kv(e,!1)}function OS(e){return Kv(e,!0)}function Kv(e,t){return Nn(e)?e:new DS(e,t)}class DS{constructor(t,n){this.dep=new uh,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Lt(t),this._value=n?t:Fo(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||eo(t)||rs(t);t=r?t:Lt(t),Lo(t,n)&&(this._rawValue=t,this._value=r?t:Fo(t),this.dep.trigger())}}function g(e){return Nn(e)?e.value:e}const FS={get:(e,t,n)=>t==="__v_raw"?e:g(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return Nn(o)&&!Nn(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}};function Yv(e){return ki(e)?e:new Proxy(e,FS)}class BS{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new uh(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ru-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Kt!==this)return Nv(this,!0),!0}get value(){const t=this.dep.track();return Dv(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function US(e,t,n=!1){let r,o;return pt(e)?r=e:(r=e.get,o=e.set),new BS(r,o,n)}const Bu={},cc=new WeakMap;let gi;function zS(e,t=!1,n=gi){if(n){let r=cc.get(n);r||cc.set(n,r=[]),r.push(e)}}function HS(e,t,n=zt){const{immediate:r,deep:o,once:a,scheduler:s,augmentJob:i,call:l}=n,u=K=>o?K:eo(K)||o===!1||o===0?Ya(K,1):Ya(K);let d,m,f,v,T=!1,k=!1;if(Nn(e)?(m=()=>e.value,T=eo(e)):ki(e)?(m=()=>u(e),T=!0):lt(e)?(k=!0,T=e.some(K=>ki(K)||eo(K)),m=()=>e.map(K=>{if(Nn(K))return K.value;if(ki(K))return u(K);if(pt(K))return l?l(K,2):K()})):pt(e)?t?m=l?()=>l(e,2):e:m=()=>{if(f){ts();try{f()}finally{ns()}}const K=gi;gi=d;try{return l?l(e,3,[v]):e(v)}finally{gi=K}}:m=Ta,t&&o){const K=m,U=o===!0?1/0:o;m=()=>Ya(K(),U)}const R=yS(),E=()=>{d.stop(),R&&R.active&&rh(R.effects,d)};if(a&&t){const K=t;t=(...U)=>{const ce=K(...U);return E(),ce}}let N=k?new Array(e.length).fill(Bu):Bu;const q=K=>{if(!(!(d.flags&1)||!d.dirty&&!K))if(t){const U=d.run();if(K||o||T||(k?U.some((ce,G)=>Lo(ce,N[G])):Lo(U,N))){f&&f();const ce=gi;gi=d;try{const G=[U,N===Bu?void 0:k&&N[0]===Bu?[]:N,v];N=U,l?l(t,3,G):t(...G)}finally{gi=ce}}}else d.run()};return i&&i(q),d=new Lv(m),d.scheduler=s?()=>s(q,!1):q,v=K=>zS(K,!1,d),f=d.onStop=()=>{const K=cc.get(d);if(K){if(l)l(K,4);else for(const U of K)U();cc.delete(d)}},t?r?q(!0):N=d.run():s?s(q.bind(null,!0),!0):d.run(),E.pause=d.pause.bind(d),E.resume=d.resume.bind(d),E.stop=E,E}function Ya(e,t=1/0,n){if(t<=0||!Ot(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Nn(e))Ya(e.value,t,n);else if(lt(e))for(let r=0;r<e.length;r++)Ya(e[r],t,n);else if(Oc(e)||ll(e))e.forEach(r=>{Ya(r,t,n)});else if(Av(e)){for(const r in e)Ya(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Ya(e[r],t,n)}return e}/**
11
+ * @vue/runtime-core v3.5.40
12
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
13
+ * @license MIT
14
+ **/function mu(e,t,n,r){try{return r?e(...r):e()}catch(o){gu(o,t,n)}}function no(e,t,n,r){if(pt(e)){const o=mu(e,t,n,r);return o&&xv(o)&&o.catch(a=>{gu(a,t,n)}),o}if(lt(e)){const o=[];for(let a=0;a<e.length;a++)o.push(no(e[a],t,n,r));return o}}function gu(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||zt;if(t){let i=t.parent;const l=t.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;i;){const d=i.ec;if(d){for(let m=0;m<d.length;m++)if(d[m](e,l,u)===!1)return}i=i.parent}if(a){ts(),mu(a,null,10,[e,l,u]),ns();return}}WS(e,n,o,r,s)}function WS(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}const dr=[];let va=-1;const ul=[];let $s=null,nl=0;const Jv=Promise.resolve();let dc=null;function Et(e){const t=dc||Jv;return e?t.then(this?e.bind(this):e):t}function qS(e){let t=va+1,n=dr.length;for(;t<n;){const r=t+n>>>1,o=dr[r],a=au(o);a<e||a===e&&o.flags&2?t=r+1:n=r}return t}function hh(e){if(!(e.flags&1)){const t=au(e),n=dr[dr.length-1];!n||!(e.flags&2)&&t>=au(n)?dr.push(e):dr.splice(qS(t),0,e),e.flags|=1,Qv()}}function Qv(){dc||(dc=Jv.then(Zv))}function GS(e){lt(e)?ul.push(...e):$s&&e.id===-1?$s.splice(nl+1,0,e):e.flags&1||(ul.push(e),e.flags|=1),Qv()}function Yp(e,t,n=va+1){for(;n<dr.length;n++){const r=dr[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;dr.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Xv(e){if(ul.length){const t=[...new Set(ul)].sort((n,r)=>au(n)-au(r));if(ul.length=0,$s){$s.push(...t);return}for($s=t,nl=0;nl<$s.length;nl++){const n=$s[nl];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}$s=null,nl=0}}const au=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Zv(e){try{for(va=0;va<dr.length;va++){const t=dr[va];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),mu(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;va<dr.length;va++){const t=dr[va];t&&(t.flags&=-2)}va=-1,dr.length=0,Xv(),dc=null,(dr.length||ul.length)&&Zv()}}let Gn=null,ey=null;function fc(e){const t=Gn;return Gn=e,ey=e&&e.type.__scopeId||null,t}function ht(e,t=Gn,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&mc(-1);const a=fc(t),s=Qa.length;let i;try{i=e(...o)}finally{for(let l=Qa.length;l>s;l--)wh();fc(a),r._d&&mc(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function In(e,t){if(Gn===null)return e;const n=Gc(Gn),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[a,s,i,l=zt]=t[o];a&&(pt(a)&&(a={mounted:a,updated:a}),a.deep&&Ya(s),r.push({dir:a,instance:n,value:s,oldValue:void 0,arg:i,modifiers:l}))}return e}function di(e,t,n,r){const o=e.dirs,a=t&&t.dirs;for(let s=0;s<o.length;s++){const i=o[s];a&&(i.oldValue=a[s].value);let l=i.dir[r];l&&(ts(),no(l,n,8,[e.el,i,e,t]),ns())}}function nc(e,t){if(qn){let n=qn.provides;const r=qn.parent&&qn.parent.provides;r===n&&(n=qn.provides=Object.create(r)),n[e]=t}}function Oo(e,t,n=!1){const r=Th();if(r||dl){let o=dl?dl._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&pt(t)?t.call(r&&r.proxy):t}}const VS=Symbol.for("v-scx"),KS=()=>Oo(VS);function ot(e,t,n){return ty(e,t,n)}function ty(e,t,n=zt){const{immediate:r,deep:o,flush:a,once:s}=n,i=yn({},n),l=t&&r||!t&&a!=="post";let u;if(bl){if(a==="sync"){const v=KS();u=v.__watcherHandles||(v.__watcherHandles=[])}else if(!l){const v=()=>{};return v.stop=Ta,v.resume=Ta,v.pause=Ta,v}}const d=qn;i.call=(v,T,k)=>no(v,d,T,k);let m=!1;a==="post"?i.scheduler=v=>{ur(v,d&&d.suspense)}:a!=="sync"&&(m=!0,i.scheduler=(v,T)=>{T?v():hh(v)}),i.augmentJob=v=>{t&&(v.flags|=4),m&&(v.flags|=2,d&&(v.id=d.uid,v.i=d))};const f=HS(e,t,i);return bl&&(u?u.push(f):l&&f()),f}function YS(e,t,n){const r=this.proxy,o=Xt(e)?e.includes(".")?ny(r,e):()=>r[e]:e.bind(r,r);let a;pt(t)?a=t:(a=t.handler,n=t);const s=wu(this),i=ty(o,a.bind(r),n);return s(),i}function ny(e,t){const n=t.split(".");return()=>{let r=e;for(let o=0;o<n.length&&r;o++)r=r[n[o]];return r}}const Ls=new WeakMap,ry=Symbol("_vte"),oy=e=>e.__isTeleport,yi=e=>e&&(e.disabled||e.disabled===""),JS=e=>e&&(e.defer||e.defer===""),Jp=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Qp=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,wf=(e,t)=>{const n=e&&e.to;return Xt(n)?t?t(n):null:n},QS={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,a,s,i,l,u){const{mc:d,pc:m,pbc:f,o:{insert:v,querySelector:T,createText:k,createComment:R,parentNode:E}}=u,N=yi(t.props);let{dynamicChildren:q}=t;const K=(G,le,ye)=>{G.shapeFlag&16&&d(G.children,le,ye,o,a,s,i,l)},U=(G=t)=>{const le=yi(G.props),ye=G.target=wf(G.props,T),_e=bf(ye,G,k,v);ye&&(s!=="svg"&&Jp(ye)?s="svg":s!=="mathml"&&Qp(ye)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(ye),le||(K(G,ye,_e),ql(G,!1)))},ce=G=>{const le=()=>{if(Ls.get(G)===le){if(Ls.delete(G),yi(G.props)){const ye=E(G.el)||n;K(G,ye,G.anchor),ql(G,!0)}U(G)}};Ls.set(G,le),ur(le,a)};if(e==null){const G=t.el=k(""),le=t.anchor=k("");if(v(G,n,r),v(le,n,r),JS(t.props)||a&&a.pendingBranch){ce(t);return}N&&(K(t,n,le),ql(t,!0)),U()}else{t.el=e.el;const G=t.anchor=e.anchor,le=Ls.get(e);if(le){le.flags|=8,Ls.delete(e),ce(t);return}t.targetStart=e.targetStart;const ye=t.target=e.target,_e=t.targetAnchor=e.targetAnchor,we=yi(e.props),ee=we?n:ye,he=we?G:_e;if(s==="svg"||Jp(ye)?s="svg":(s==="mathml"||Qp(ye))&&(s="mathml"),q?(f(e.dynamicChildren,q,ee,o,a,s,i),yh(e,t,!0)):l||m(e,t,ee,he,o,a,s,i,!1),N)we?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Uu(t,n,G,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const te=wf(t.props,T);te&&(t.target=te,Uu(t,te,null,u,0))}else we&&Uu(t,ye,_e,u,1);ql(t,N)}},remove(e,t,n,{um:r,o:{remove:o}},a){const{shapeFlag:s,children:i,anchor:l,targetStart:u,targetAnchor:d,target:m,props:f}=e,v=yi(f),T=a||!v,k=Ls.get(e);if(k&&(k.flags|=8,Ls.delete(e)),m&&(o(u),o(d)),a&&o(l),!k&&(v||m)&&s&16)for(let R=0;R<i.length;R++){const E=i[R];r(E,t,n,T,!!E.dynamicChildren)}},move:Uu,hydrate:XS};function Uu(e,t,n,{o:{insert:r},m:o},a=2){a===0&&r(e.targetAnchor,t,n);const{el:s,anchor:i,shapeFlag:l,children:u,props:d}=e,m=a===2;if(m&&r(s,t,n),!Ls.has(e)&&(!m||yi(d))&&l&16)for(let f=0;f<u.length;f++)o(u[f],t,n,2);m&&r(i,t,n)}function XS(e,t,n,r,o,a,{o:{nextSibling:s,parentNode:i,querySelector:l,insert:u,createText:d}},m){function f(R,E){let N=E;for(;N;){if(N&&N.nodeType===8){if(N.data==="teleport start anchor")t.targetStart=N;else if(N.data==="teleport anchor"){t.targetAnchor=N,R._lpa=t.targetAnchor&&s(t.targetAnchor);break}}N=s(N)}}function v(R,E){E.anchor=m(s(R),E,i(R),n,r,o,a)}const T=t.target=wf(t.props,l),k=yi(t.props);if(T){const R=T._lpa||T.firstChild;t.shapeFlag&16&&(k?(v(e,t),f(T,R),t.targetAnchor||bf(T,t,d,u,i(e)===T?e:null)):(t.anchor=s(e),f(T,R),t.targetAnchor||bf(T,t,d,u),m(R&&s(R),t,T,n,r,o,a))),ql(t,k)}else k&&t.shapeFlag&16&&(v(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}const Ws=QS;function ql(e,t){const n=e.ctx;if(n&&n.ut){let r,o;for(t?(r=e.el,o=e.anchor):(r=e.targetStart,o=e.targetAnchor);r&&r!==o;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function bf(e,t,n,r,o=null){const a=t.targetStart=n(""),s=t.targetAnchor=n("");return a[ry]=s,e&&(r(a,e,o),r(s,e,o)),s}const Xr=Symbol("_leaveCb"),Bl=Symbol("_enterCb");function ZS(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return ss(()=>{e.isMounted=!0}),Ks(()=>{e.isUnmounting=!0}),e}const Qr=[Function,Array],ay={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Qr,onEnter:Qr,onAfterEnter:Qr,onEnterCancelled:Qr,onBeforeLeave:Qr,onLeave:Qr,onAfterLeave:Qr,onLeaveCancelled:Qr,onBeforeAppear:Qr,onAppear:Qr,onAfterAppear:Qr,onAppearCancelled:Qr},sy=e=>{const t=e.subTree;return t.component?sy(t.component):t},ek={name:"BaseTransition",props:ay,setup(e,{slots:t}){const n=Th(),r=ZS();return()=>{const o=t.default&&uy(t.default(),!0),a=o&&o.length?iy(o):n.subTree?ve():void 0;if(!a)return;const s=Lt(e),{mode:i}=s;if(r.isLeaving)return jd(a);const l=Xp(a);if(!l)return jd(a);let u=Tf(l,s,r,n,m=>u=m);l.type!==Zn&&su(l,u);let d=n.subTree&&Xp(n.subTree);if(d&&d.type!==Zn&&!wi(d,l)&&sy(n).type!==Zn){let m=Tf(d,s,r,n);if(su(d,m),i==="out-in"&&l.type!==Zn)return r.isLeaving=!0,m.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete m.afterLeave,d=void 0},jd(a);i==="in-out"&&l.type!==Zn?m.delayLeave=(f,v,T)=>{const k=ly(r,d);k[String(d.key)]=d,f[Xr]=()=>{v(),f[Xr]=void 0,delete u.delayedLeave,d=void 0},u.delayedLeave=()=>{T(),delete u.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return a}}};function iy(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Zn){t=n;break}}return t}const tk=ek;function ly(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Tf(e,t,n,r,o){const{appear:a,mode:s,persisted:i=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:d,onEnterCancelled:m,onBeforeLeave:f,onLeave:v,onAfterLeave:T,onLeaveCancelled:k,onBeforeAppear:R,onAppear:E,onAfterAppear:N,onAppearCancelled:q}=t,K=String(e.key),U=ly(n,e),ce=(ye,_e)=>{ye&&no(ye,r,9,_e)},G=(ye,_e)=>{const we=_e[1];ce(ye,_e),lt(ye)?ye.every(ee=>ee.length<=1)&&we():ye.length<=1&&we()},le={mode:s,persisted:i,beforeEnter(ye){let _e=l;if(!n.isMounted)if(a)_e=R||l;else return;ye[Xr]&&ye[Xr](!0);const we=U[K];we&&wi(e,we)&&we.el[Xr]&&we.el[Xr](),ce(_e,[ye])},enter(ye){if(U[K]===e)return;let _e=u,we=d,ee=m;if(!n.isMounted)if(a)_e=E||u,we=N||d,ee=q||m;else return;let he=!1;ye[Bl]=Ae=>{he||(he=!0,Ae?ce(ee,[ye]):ce(we,[ye]),le.delayedLeave&&le.delayedLeave(),ye[Bl]=void 0)};const te=ye[Bl].bind(null,!1);_e?G(_e,[ye,te]):te()},leave(ye,_e){const we=String(e.key);if(ye[Bl]&&ye[Bl](!0),n.isUnmounting)return _e();ce(f,[ye]);let ee=!1;ye[Xr]=te=>{ee||(ee=!0,_e(),te?ce(k,[ye]):ce(T,[ye]),ye[Xr]=void 0,U[we]===e&&delete U[we])};const he=ye[Xr].bind(null,!1);U[we]=e,v?G(v,[ye,he]):he()},clone(ye){const _e=Tf(ye,t,n,r,o);return o&&o(_e),_e}};return le}function jd(e){if(vu(e))return e=qs(e),e.children=null,e}function Xp(e){if(!vu(e))return oy(e.type)&&e.children?iy(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&pt(n.default))return n.default()}}function su(e,t){e.shapeFlag&6&&e.component?(e.transition=t,su(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function uy(e,t=!1,n){let r=[],o=0;for(let a=0;a<e.length;a++){let s=e[a];const i=n==null?s.key:String(n)+String(s.key!=null?s.key:a);s.type===at?(s.patchFlag&128&&o++,r=r.concat(uy(s.children,t,i))):(t||s.type!==Zn)&&r.push(i!=null?qs(s,{key:i}):s)}if(o>1)for(let a=0;a<r.length;a++)r[a].patchFlag=-2;return r}function fn(e,t){return pt(e)?yn({name:e.name},t,{setup:e}):e}function ph(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Zp(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const hc=new WeakMap;function Xl(e,t,n,r,o=!1){if(lt(e)){e.forEach((k,R)=>Xl(k,t&&(lt(t)?t[R]:t),n,r,o));return}if(cl(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Xl(e,t,n,r.component.subTree);return}const a=r.shapeFlag&4?Gc(r.component):r.el,s=o?null:a,{i,r:l}=e,u=t&&t.r,d=i.refs===zt?i.refs={}:i.refs,m=i.setupState,f=Lt(m),v=m===zt?Cv:k=>Zp(d,k)?!1:$t(f,k),T=(k,R)=>!(R&&Zp(d,R));if(u!=null&&u!==l){if(em(t),Xt(u))d[u]=null,v(u)&&(m[u]=null);else if(Nn(u)){const k=t;T(u,k.k)&&(u.value=null),k.k&&(d[k.k]=null)}}if(pt(l))mu(l,i,12,[s,d]);else{const k=Xt(l),R=Nn(l);if(k||R){const E=()=>{if(e.f){const N=k?v(l)?m[l]:d[l]:T()||!e.k?l.value:d[e.k];if(o)lt(N)&&rh(N,a);else if(lt(N))N.includes(a)||N.push(a);else if(k)d[l]=[a],v(l)&&(m[l]=d[l]);else{const q=[a];T(l,e.k)&&(l.value=q),e.k&&(d[e.k]=q)}}else k?(d[l]=s,v(l)&&(m[l]=s)):R&&(T(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s))};if(s){const N=()=>{E(),hc.delete(e)};N.id=-1,hc.set(e,N),ur(N,n)}else em(e),E()}}}function em(e){const t=hc.get(e);t&&(t.flags|=8,hc.delete(e))}const tm=e=>e.nodeType===8;Bc().requestIdleCallback;Bc().cancelIdleCallback;function nk(e,t){if(tm(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(tm(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}const cl=e=>!!e.type.__asyncLoader;function Eo(e){pt(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:o=200,hydrate:a,timeout:s,suspensible:i=!0,onError:l}=e;let u=null,d,m=0;const f=()=>(m++,u=null,v()),v=()=>{let T;return u||(T=u=t().catch(k=>{if(k=k instanceof Error?k:new Error(String(k)),l)return new Promise((R,E)=>{l(k,()=>R(f()),()=>E(k),m+1)});throw k}).then(k=>T!==u&&u?u:(k&&(k.__esModule||k[Symbol.toStringTag]==="Module")&&(k=k.default),d=k,k)))};return fn({name:"AsyncComponentWrapper",__asyncLoader:v,__asyncHydrate(T,k,R){const E=T.isConnected;let N=!1;(k.bu||(k.bu=[])).push(()=>N=!0);const q=()=>{N||!T.parentNode||E&&!T.isConnected||R()},K=a?()=>{const U=a(q,ce=>nk(T,ce));U&&(k.bum||(k.bum=[])).push(U)}:q;d?K():v().then(()=>!k.isUnmounted&&K())},get __asyncResolved(){return d},setup(){const T=qn;if(ph(T),d)return()=>zu(d,T);const k=U=>{u=null,gu(U,T,13,!r)};if(i&&T.suspense||bl)return v().then(U=>()=>zu(U,T)).catch(U=>(k(U),()=>r?Fe(r,{error:U}):null));const R=S(!1),E=S(),N=S(!!o);let q,K;return yu(()=>{q!=null&&clearTimeout(q),K!=null&&clearTimeout(K)}),o&&(K=setTimeout(()=>{T.isUnmounted||(N.value=!1)},o)),s!=null&&(q=setTimeout(()=>{if(!T.isUnmounted&&!R.value&&!E.value){const U=new Error(`Async component timed out after ${s}ms.`);k(U),E.value=U}},s)),v().then(()=>{T.isUnmounted||(R.value=!0,T.parent&&vu(T.parent.vnode)&&T.parent.update())}).catch(U=>{if(T.isUnmounted){u=null;return}k(U),E.value=U}),()=>{if(R.value&&d)return zu(d,T);if(E.value&&r)return Fe(r,{error:E.value});if(n&&!N.value)return zu(n,T)}}})}function zu(e,t){const{ref:n,props:r,children:o,ce:a}=t.vnode,s=Fe(e,r,o);return s.ref=n,s.ce=a,delete t.vnode.ce,s}const vu=e=>e.type.__isKeepAlive;function rk(e,t){cy(e,"a",t)}function ok(e,t){cy(e,"da",t)}function cy(e,t,n=qn){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(Hc(t,r,n),n){let o=n.parent;for(;o&&o.parent;)vu(o.parent.vnode)&&ak(r,t,n,o),o=o.parent}}function ak(e,t,n,r){const o=Hc(t,e,r,!0);yu(()=>{rh(r[t],o)},n)}function Hc(e,t,n=qn,r=!1){if(n){const o=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=(...s)=>{ts();const i=wu(n),l=no(t,n,e,s);return i(),ns(),l});return r?o.unshift(a):o.push(a),a}}const as=e=>(t,n=qn)=>{(!bl||e==="sp")&&Hc(e,(...r)=>t(...r),n)},sk=as("bm"),ss=as("m"),ik=as("bu"),lk=as("u"),Ks=as("bum"),yu=as("um"),uk=as("sp"),ck=as("rtg"),dk=as("rtc");function fk(e,t=qn){Hc("ec",e,t)}const hk="components",dy=Symbol.for("v-ndc");function mh(e){return Xt(e)?pk(hk,e,!1)||e:e||dy}function pk(e,t,n=!0,r=!1){const o=Gn||qn;if(o){const a=o.type;{const i=Qk(a,!1);if(i&&(i===t||i===hr(t)||i===Fc(hr(t))))return a}const s=nm(o[e]||a[e],t)||nm(o.appContext[e],t);return!s&&r?a:s}}function nm(e,t){return e&&(e[t]||e[hr(t)]||e[Fc(hr(t))])}function Ht(e,t,n,r){let o;const a=n,s=lt(e);if(s||Xt(e)){const i=s&&ki(e);let l=!1,u=!1;i&&(l=!eo(e),u=rs(e),e=Uc(e)),o=new Array(e.length);for(let d=0,m=e.length;d<m;d++)o[d]=t(l?u?yl(Fo(e[d])):Fo(e[d]):e[d],d,void 0,a)}else if(typeof e=="number"){o=new Array(e);for(let i=0;i<e;i++)o[i]=t(i+1,i,void 0,a)}else if(Ot(e))if(e[Symbol.iterator])o=Array.from(e,(i,l)=>t(i,l,void 0,a));else{const i=Object.keys(e);o=new Array(i.length);for(let l=0,u=i.length;l<u;l++){const d=i[l];o[l]=t(e[d],d,l,a)}}else o=[];return o}function Cr(e,t,n={},r,o,a){if(Gn.ce||Gn.parent&&cl(Gn.parent)&&Gn.parent.ce){const u=a!=null&&n.key==null?yn({},n,{key:a}):n,d=Object.keys(u).length>0;return t!=="default"&&(u.name=t),_(),Ze(at,null,[Fe("slot",u,r)],d?-2:64)}let s=e[t];s&&s._c&&(s._d=!1);const i=Qa.length;_();let l;try{const u=s&&fy(s(n)),d=n.key||a||u&&u.key;l=Ze(at,{key:(d&&!Do(d)?d:`_${t}`)+(!u&&r?"_fb":"")},u||(r?r():[]),u&&e._===1?64:-2)}catch(u){for(let d=Qa.length;d>i;d--)wh();throw u}finally{s&&s._c&&(s._d=!0)}return l}function fy(e){return e.some(t=>iu(t)?!(t.type===Zn||t.type===at&&!fy(t.children)):!0)?e:null}const Sf=e=>e?My(e)?Gc(e):Sf(e.parent):null,Zl=yn(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Sf(e.parent),$root:e=>Sf(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>py(e),$forceUpdate:e=>e.f||(e.f=()=>{hh(e.update)}),$nextTick:e=>e.n||(e.n=Et.bind(e.proxy)),$watch:e=>YS.bind(e)}),Nd=(e,t)=>e!==zt&&!e.__isScriptSetup&&$t(e,t),mk={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:o,props:a,accessCache:s,type:i,appContext:l}=e;if(t[0]!=="$"){const f=s[t];if(f!==void 0)switch(f){case 1:return r[t];case 2:return o[t];case 4:return n[t];case 3:return a[t]}else{if(Nd(r,t))return s[t]=1,r[t];if(o!==zt&&$t(o,t))return s[t]=2,o[t];if($t(a,t))return s[t]=3,a[t];if(n!==zt&&$t(n,t))return s[t]=4,n[t];kf&&(s[t]=0)}}const u=Zl[t];let d,m;if(u)return t==="$attrs"&&Xn(e.attrs,"get",""),u(e);if((d=i.__cssModules)&&(d=d[t]))return d;if(n!==zt&&$t(n,t))return s[t]=4,n[t];if(m=l.config.globalProperties,$t(m,t))return m[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:a}=e;return Nd(o,t)?(o[t]=n,!0):r!==zt&&$t(r,t)?(r[t]=n,!0):$t(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:o,props:a,type:s}},i){let l;return!!(n[i]||e!==zt&&i[0]!=="$"&&$t(e,i)||Nd(t,i)||$t(a,i)||$t(r,i)||$t(Zl,i)||$t(o.config.globalProperties,i)||(l=s.__cssModules)&&l[i])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:$t(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function gk(){return vk().slots}function vk(e){const t=Th();return t.setupContext||(t.setupContext=Ly(t))}function rm(e){return lt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let kf=!0;function yk(e){const t=py(e),n=e.proxy,r=e.ctx;kf=!1,t.beforeCreate&&om(t.beforeCreate,e,"bc");const{data:o,computed:a,methods:s,watch:i,provide:l,inject:u,created:d,beforeMount:m,mounted:f,beforeUpdate:v,updated:T,activated:k,deactivated:R,beforeDestroy:E,beforeUnmount:N,destroyed:q,unmounted:K,render:U,renderTracked:ce,renderTriggered:G,errorCaptured:le,serverPrefetch:ye,expose:_e,inheritAttrs:we,components:ee,directives:he,filters:te}=t;if(u&&wk(u,r,null),s)for(const $e in s){const De=s[$e];pt(De)&&(r[$e]=De.bind(n))}if(o){const $e=o.call(n,n);Ot($e)&&(e.data=zc($e))}if(kf=!0,a)for(const $e in a){const De=a[$e],Se=pt(De)?De.bind(n,n):pt(De.get)?De.get.bind(n,n):Ta,Te=!pt(De)&&pt(De.set)?De.set.bind(n):Ta,xe=Y({get:Se,set:Te});Object.defineProperty(r,$e,{enumerable:!0,configurable:!0,get:()=>xe.value,set:Ee=>xe.value=Ee})}if(i)for(const $e in i)hy(i[$e],r,n,$e);if(l){const $e=pt(l)?l.call(n):l;Reflect.ownKeys($e).forEach(De=>{nc(De,$e[De])})}d&&om(d,e,"c");function Oe($e,De){lt(De)?De.forEach(Se=>$e(Se.bind(n))):De&&$e(De.bind(n))}if(Oe(sk,m),Oe(ss,f),Oe(ik,v),Oe(lk,T),Oe(rk,k),Oe(ok,R),Oe(fk,le),Oe(dk,ce),Oe(ck,G),Oe(Ks,N),Oe(yu,K),Oe(uk,ye),lt(_e))if(_e.length){const $e=e.exposed||(e.exposed={});_e.forEach(De=>{Object.defineProperty($e,De,{get:()=>n[De],set:Se=>n[De]=Se,enumerable:!0})})}else e.exposed||(e.exposed={});U&&e.render===Ta&&(e.render=U),we!=null&&(e.inheritAttrs=we),ee&&(e.components=ee),he&&(e.directives=he),ye&&ph(e)}function wk(e,t,n=Ta){lt(e)&&(e=Cf(e));for(const r in e){const o=e[r];let a;Ot(o)?"default"in o?a=Oo(o.from||r,o.default,!0):a=Oo(o.from||r):a=Oo(o),Nn(a)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>a.value,set:s=>a.value=s}):t[r]=a}}function om(e,t,n){no(lt(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function hy(e,t,n,r){let o=r.includes(".")?ny(n,r):()=>n[r];if(Xt(e)){const a=t[e];pt(a)&&ot(o,a)}else if(pt(e))ot(o,e.bind(n));else if(Ot(e))if(lt(e))e.forEach(a=>hy(a,t,n,r));else{const a=pt(e.handler)?e.handler.bind(n):t[e.handler];pt(a)&&ot(o,a,e)}}function py(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:a,config:{optionMergeStrategies:s}}=e.appContext,i=a.get(t);let l;return i?l=i:!o.length&&!n&&!r?l=t:(l={},o.length&&o.forEach(u=>pc(l,u,s,!0)),pc(l,t,s)),Ot(t)&&a.set(t,l),l}function pc(e,t,n,r=!1){const{mixins:o,extends:a}=t;a&&pc(e,a,n,!0),o&&o.forEach(s=>pc(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const i=bk[s]||n&&n[s];e[s]=i?i(e[s],t[s]):t[s]}return e}const bk={data:am,props:sm,emits:sm,methods:Gl,computed:Gl,beforeCreate:lr,created:lr,beforeMount:lr,mounted:lr,beforeUpdate:lr,updated:lr,beforeDestroy:lr,beforeUnmount:lr,destroyed:lr,unmounted:lr,activated:lr,deactivated:lr,errorCaptured:lr,serverPrefetch:lr,components:Gl,directives:Gl,watch:Sk,provide:am,inject:Tk};function am(e,t){return t?e?function(){return yn(pt(e)?e.call(this,this):e,pt(t)?t.call(this,this):t)}:t:e}function Tk(e,t){return Gl(Cf(e),Cf(t))}function Cf(e){if(lt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function lr(e,t){return e?[...new Set([].concat(e,t))]:t}function Gl(e,t){return e?yn(Object.create(null),e,t):t}function sm(e,t){return e?lt(e)&&lt(t)?[...new Set([...e,...t])]:yn(Object.create(null),rm(e),rm(t??{})):t}function Sk(e,t){if(!e)return t;if(!t)return e;const n=yn(Object.create(null),e);for(const r in t)n[r]=lr(e[r],t[r]);return n}function my(){return{app:null,config:{isNativeTag:Cv,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let kk=0;function Ck(e,t){return function(r,o=null){pt(r)||(r=yn({},r)),o!=null&&!Ot(o)&&(o=null);const a=my(),s=new WeakSet,i=[];let l=!1;const u=a.app={_uid:kk++,_component:r,_props:o,_container:null,_context:a,_instance:null,version:eC,get config(){return a.config},set config(d){},use(d,...m){return s.has(d)||(d&&pt(d.install)?(s.add(d),d.install(u,...m)):pt(d)&&(s.add(d),d(u,...m))),u},mixin(d){return a.mixins.includes(d)||a.mixins.push(d),u},component(d,m){return m?(a.components[d]=m,u):a.components[d]},directive(d,m){return m?(a.directives[d]=m,u):a.directives[d]},mount(d,m,f){if(!l){const v=u._ceVNode||Fe(r,o);return v.appContext=a,f===!0?f="svg":f===!1&&(f=void 0),e(v,d,f),l=!0,u._container=d,d.__vue_app__=u,Gc(v.component)}},onUnmount(d){i.push(d)},unmount(){l&&(no(i,u._instance,16),e(null,u._container),delete u._container.__vue_app__)},provide(d,m){return a.provides[d]=m,u},runWithContext(d){const m=dl;dl=u;try{return d()}finally{dl=m}}};return u}}let dl=null;const xk=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${hr(t)}Modifiers`]||e[`${Vs(t)}Modifiers`];function Ik(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||zt;let o=n;const a=t.startsWith("update:"),s=a&&xk(r,t.slice(7));s&&(s.trim&&(o=n.map(d=>Xt(d)?d.trim():d)),s.number&&(o=n.map(ah)));let i,l=r[i=Pd(t)]||r[i=Pd(hr(t))];!l&&a&&(l=r[i=Pd(Vs(t))]),l&&no(l,e,6,o);const u=r[i+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[i])return;e.emitted[i]=!0,no(u,e,6,o)}}const Ak=new WeakMap;function gy(e,t,n=!1){const r=n?Ak:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const a=e.emits;let s={},i=!1;if(!pt(e)){const l=u=>{const d=gy(u,t,!0);d&&(i=!0,yn(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!a&&!i?(Ot(e)&&r.set(e,null),null):(lt(a)?a.forEach(l=>s[l]=null):yn(s,a),Ot(e)&&r.set(e,s),s)}function Wc(e,t){return!e||!Nc(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),$t(e,t[0].toLowerCase()+t.slice(1))||$t(e,Vs(t))||$t(e,t))}function im(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[a],slots:s,attrs:i,emit:l,render:u,renderCache:d,props:m,data:f,setupState:v,ctx:T,inheritAttrs:k}=e,R=fc(e);let E,N;try{if(n.shapeFlag&4){const K=o||r,U=K;E=wa(u.call(U,K,d,m,v,f,T)),N=i}else{const K=t;E=wa(K.length>1?K(m,{attrs:i,slots:s,emit:l}):K(m,null)),N=t.props?i:_k(i)}}catch(K){Qa.length=0,gu(K,e,1),E=Fe(Zn)}let q=E;if(N&&k!==!1){const K=Object.keys(N),{shapeFlag:U}=q;K.length&&U&7&&(a&&K.some($c)&&(N=Pk(N,a)),q=qs(q,N,!1,!0))}return n.dirs&&(q=qs(q,null,!1,!0),q.dirs=q.dirs?q.dirs.concat(n.dirs):n.dirs),n.transition&&su(q,n.transition),E=q,fc(R),E}const _k=e=>{let t;for(const n in e)(n==="class"||n==="style"||Nc(n))&&((t||(t={}))[n]=e[n]);return t},Pk=(e,t)=>{const n={};for(const r in e)(!$c(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Ek(e,t,n){const{props:r,children:o,component:a}=e,{props:s,children:i,patchFlag:l}=t,u=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?lm(r,s,u):!!s;if(l&8){const d=t.dynamicProps;for(let m=0;m<d.length;m++){const f=d[m];if(vy(s,r,f)&&!Wc(u,f))return!0}}}else return(o||i)&&(!i||!i.$stable)?!0:r===s?!1:r?s?lm(r,s,u):!0:!!s;return!1}function lm(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let o=0;o<r.length;o++){const a=r[o];if(vy(t,e,a)&&!Wc(n,a))return!0}return!1}function vy(e,t,n){const r=e[n],o=t[n];return n==="style"&&Ot(r)&&Ot(o)?!pu(r,o):r!==o}function Mk({vnode:e,parent:t,suspense:n},r){for(;t;){const o=t.subTree;if(o.suspense&&o.suspense.activeBranch===e&&(o.suspense.vnode.el=o.el=r,e=o),o===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const yy={},wy=()=>Object.create(yy),by=e=>Object.getPrototypeOf(e)===yy;function Rk(e,t,n,r=!1){const o={},a=wy();e.propsDefaults=Object.create(null),Ty(e,t,o,a);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:Vv(o):e.type.props?e.props=o:e.props=a,e.attrs=a}function Lk(e,t,n,r){const{props:o,attrs:a,vnode:{patchFlag:s}}=e,i=Lt(o),[l]=e.propsOptions;let u=!1;if((r||s>0)&&!(s&16)){if(s&8){const d=e.vnode.dynamicProps;for(let m=0;m<d.length;m++){let f=d[m];if(Wc(e.emitsOptions,f))continue;const v=t[f];if(l)if($t(a,f))v!==a[f]&&(a[f]=v,u=!0);else{const T=hr(f);o[T]=xf(l,i,T,v,e,!1)}else v!==a[f]&&(a[f]=v,u=!0)}}}else{Ty(e,t,o,a)&&(u=!0);let d;for(const m in i)(!t||!$t(t,m)&&((d=Vs(m))===m||!$t(t,d)))&&(l?n&&(n[m]!==void 0||n[d]!==void 0)&&(o[m]=xf(l,i,m,void 0,e,!0)):delete o[m]);if(a!==i)for(const m in a)(!t||!$t(t,m))&&(delete a[m],u=!0)}u&&Ka(e.attrs,"set","")}function Ty(e,t,n,r){const[o,a]=e.propsOptions;let s=!1,i;if(t)for(let l in t){if(Yl(l))continue;const u=t[l];let d;o&&$t(o,d=hr(l))?!a||!a.includes(d)?n[d]=u:(i||(i={}))[d]=u:Wc(e.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,s=!0)}if(a){const l=Lt(n),u=i||zt;for(let d=0;d<a.length;d++){const m=a[d];n[m]=xf(o,l,m,u[m],e,!$t(u,m))}}return s}function xf(e,t,n,r,o,a){const s=e[n];if(s!=null){const i=$t(s,"default");if(i&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&pt(l)){const{propsDefaults:u}=o;if(n in u)r=u[n];else{const d=wu(o);r=u[n]=l.call(null,t),d()}}else r=l;o.ce&&o.ce._setProp(n,r)}s[0]&&(a&&!i?r=!1:s[1]&&(r===""||r===Vs(n))&&(r=!0))}return r}const jk=new WeakMap;function Sy(e,t,n=!1){const r=n?jk:t.propsCache,o=r.get(e);if(o)return o;const a=e.props,s={},i=[];let l=!1;if(!pt(e)){const d=m=>{l=!0;const[f,v]=Sy(m,t,!0);yn(s,f),v&&i.push(...v)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!a&&!l)return Ot(e)&&r.set(e,il),il;if(lt(a))for(let d=0;d<a.length;d++){const m=hr(a[d]);um(m)&&(s[m]=zt)}else if(a)for(const d in a){const m=hr(d);if(um(m)){const f=a[d],v=s[m]=lt(f)||pt(f)?{type:f}:yn({},f),T=v.type;let k=!1,R=!0;if(lt(T))for(let E=0;E<T.length;++E){const N=T[E],q=pt(N)&&N.name;if(q==="Boolean"){k=!0;break}else q==="String"&&(R=!1)}else k=pt(T)&&T.name==="Boolean";v[0]=k,v[1]=R,(k||$t(v,"default"))&&i.push(m)}}const u=[s,i];return Ot(e)&&r.set(e,u),u}function um(e){return e[0]!=="$"&&!Yl(e)}const gh=e=>e==="_"||e==="_ctx"||e==="$stable",vh=e=>lt(e)?e.map(wa):[wa(e)],Nk=(e,t,n)=>{if(t._n)return t;const r=ht((...o)=>vh(t(...o)),n);return r._c=!1,r},ky=(e,t,n)=>{const r=e._ctx;for(const o in e){if(gh(o))continue;const a=e[o];if(pt(a))t[o]=Nk(o,a,r);else if(a!=null){const s=vh(a);t[o]=()=>s}}},Cy=(e,t)=>{const n=vh(t);e.slots.default=()=>n},xy=(e,t,n)=>{for(const r in t)(n||!gh(r))&&(e[r]=t[r])},$k=(e,t,n)=>{const r=e.slots=wy();if(e.vnode.shapeFlag&32){const o=t._;o?(xy(r,t,n),n&&_v(r,"_",o,!0)):ky(t,r)}else t&&Cy(e,t)},Ok=(e,t,n)=>{const{vnode:r,slots:o}=e;let a=!0,s=zt;if(r.shapeFlag&32){const i=t._;i?n&&i===1?a=!1:xy(o,t,n):(a=!t.$stable,ky(t,o)),s=t}else t&&(Cy(e,t),s={default:1});if(a)for(const i in o)!gh(i)&&s[i]==null&&delete o[i]},ur=zk;function Dk(e){return Fk(e)}function Fk(e,t){const n=Bc();n.__VUE__=!0;const{insert:r,remove:o,patchProp:a,createElement:s,createText:i,createComment:l,setText:u,setElementText:d,parentNode:m,nextSibling:f,setScopeId:v=Ta,insertStaticContent:T}=e,k=(P,j,W,ue=null,ae=null,ie=null,Pe=void 0,je=null,Ie=!!j.dynamicChildren)=>{if(P===j)return;P&&!wi(P,j)&&(ue=D(P),Ee(P,ae,ie,!0),P=null),j.patchFlag===-2&&(Ie=!1,j.dynamicChildren=null);const{type:ge,ref:Ke,shapeFlag:Ne}=j;switch(ge){case qc:R(P,j,W,ue);break;case Zn:E(P,j,W,ue);break;case Od:P==null&&N(j,W,ue,Pe);break;case at:ee(P,j,W,ue,ae,ie,Pe,je,Ie);break;default:Ne&1?U(P,j,W,ue,ae,ie,Pe,je,Ie):Ne&6?he(P,j,W,ue,ae,ie,Pe,je,Ie):(Ne&64||Ne&128)&&ge.process(P,j,W,ue,ae,ie,Pe,je,Ie,Le)}Ke!=null&&ae?Xl(Ke,P&&P.ref,ie,j||P,!j):Ke==null&&P&&P.ref!=null&&Xl(P.ref,null,ie,P,!0)},R=(P,j,W,ue)=>{if(P==null)r(j.el=i(j.children),W,ue);else{const ae=j.el=P.el;j.children!==P.children&&u(ae,j.children)}},E=(P,j,W,ue)=>{P==null?r(j.el=l(j.children||""),W,ue):j.el=P.el},N=(P,j,W,ue)=>{[P.el,P.anchor]=T(P.children,j,W,ue,P.el,P.anchor)},q=({el:P,anchor:j},W,ue)=>{let ae;for(;P&&P!==j;)ae=f(P),r(P,W,ue),P=ae;r(j,W,ue)},K=({el:P,anchor:j})=>{let W;for(;P&&P!==j;)W=f(P),o(P),P=W;o(j)},U=(P,j,W,ue,ae,ie,Pe,je,Ie)=>{if(j.type==="svg"?Pe="svg":j.type==="math"&&(Pe="mathml"),P==null)ce(j,W,ue,ae,ie,Pe,je,Ie);else{const ge=P.el&&P.el._isVueCE?P.el:null;try{ge&&ge._beginPatch(),ye(P,j,ae,ie,Pe,je,Ie)}finally{ge&&ge._endPatch()}}},ce=(P,j,W,ue,ae,ie,Pe,je)=>{let Ie,ge;const{props:Ke,shapeFlag:Ne,transition:qe,dirs:Ge}=P;if(Ie=P.el=s(P.type,ie,Ke&&Ke.is,Ke),Ne&8?d(Ie,P.children):Ne&16&&le(P.children,Ie,null,ue,ae,$d(P,ie),Pe,je),Ge&&di(P,null,ue,"created"),G(Ie,P,P.scopeId,Pe,ue),Ke){for(const St in Ke)St!=="value"&&!Yl(St)&&a(Ie,St,null,Ke[St],ie,ue);"value"in Ke&&a(Ie,"value",null,Ke.value,ie),(ge=Ke.onVnodeBeforeMount)&&ga(ge,ue,P)}Ge&&di(P,null,ue,"beforeMount");const dt=Bk(ae,qe);dt&&qe.beforeEnter(Ie),r(Ie,j,W),((ge=Ke&&Ke.onVnodeMounted)||dt||Ge)&&ur(()=>{try{ge&&ga(ge,ue,P),dt&&qe.enter(Ie),Ge&&di(P,null,ue,"mounted")}finally{}},ae)},G=(P,j,W,ue,ae)=>{if(W&&v(P,W),ue)for(let ie=0;ie<ue.length;ie++)v(P,ue[ie]);if(ae){let ie=ae.subTree;if(j===ie||_y(ie.type)&&(ie.ssContent===j||ie.ssFallback===j)){const Pe=ae.vnode;G(P,Pe,Pe.scopeId,Pe.slotScopeIds,ae.parent)}}},le=(P,j,W,ue,ae,ie,Pe,je,Ie=0)=>{for(let ge=Ie;ge<P.length;ge++){const Ke=P[ge]=je?Va(P[ge]):wa(P[ge]);k(null,Ke,j,W,ue,ae,ie,Pe,je)}},ye=(P,j,W,ue,ae,ie,Pe)=>{const je=j.el=P.el;let{patchFlag:Ie,dynamicChildren:ge,dirs:Ke}=j;Ie|=P.patchFlag&16;const Ne=P.props||zt,qe=j.props||zt;let Ge;if(W&&fi(W,!1),(Ge=qe.onVnodeBeforeUpdate)&&ga(Ge,W,j,P),Ke&&di(j,P,W,"beforeUpdate"),W&&fi(W,!0),ge&&(!P.dynamicChildren||P.dynamicChildren.length!==ge.length)&&(Ie=0,Pe=!1,ge=null),(Ne.innerHTML&&qe.innerHTML==null||Ne.textContent&&qe.textContent==null)&&d(je,""),ge?_e(P.dynamicChildren,ge,je,W,ue,$d(j,ae),ie):Pe||De(P,j,je,null,W,ue,$d(j,ae),ie,!1),Ie>0){if(Ie&16)we(je,Ne,qe,W,ae);else if(Ie&2&&Ne.class!==qe.class&&a(je,"class",null,qe.class,ae),Ie&4&&a(je,"style",Ne.style,qe.style,ae),Ie&8){const dt=j.dynamicProps;for(let St=0;St<dt.length;St++){const st=dt[St],ut=Ne[st],X=qe[st];(X!==ut||st==="value")&&a(je,st,ut,X,ae,W)}}Ie&1&&P.children!==j.children&&d(je,j.children)}else!Pe&&ge==null&&we(je,Ne,qe,W,ae);((Ge=qe.onVnodeUpdated)||Ke)&&ur(()=>{Ge&&ga(Ge,W,j,P),Ke&&di(j,P,W,"updated")},ue)},_e=(P,j,W,ue,ae,ie,Pe)=>{for(let je=0;je<j.length;je++){const Ie=P[je],ge=j[je],Ke=Ie.el&&(Ie.type===at||!wi(Ie,ge)||Ie.shapeFlag&198)?m(Ie.el):W;k(Ie,ge,Ke,null,ue,ae,ie,Pe,!0)}},we=(P,j,W,ue,ae)=>{if(j!==W){if(j!==zt)for(const ie in j)!Yl(ie)&&!(ie in W)&&a(P,ie,j[ie],null,ae,ue);for(const ie in W){if(Yl(ie))continue;const Pe=W[ie],je=j[ie];Pe!==je&&ie!=="value"&&a(P,ie,je,Pe,ae,ue)}"value"in W&&a(P,"value",j.value,W.value,ae)}},ee=(P,j,W,ue,ae,ie,Pe,je,Ie)=>{const ge=j.el=P?P.el:i(""),Ke=j.anchor=P?P.anchor:i("");let{patchFlag:Ne,dynamicChildren:qe,slotScopeIds:Ge}=j;Ge&&(je=je?je.concat(Ge):Ge),P==null?(r(ge,W,ue),r(Ke,W,ue),le(j.children||[],W,Ke,ae,ie,Pe,je,Ie)):Ne>0&&Ne&64&&qe&&P.dynamicChildren&&P.dynamicChildren.length===qe.length?(_e(P.dynamicChildren,qe,W,ae,ie,Pe,je),(j.key!=null||ae&&j===ae.subTree)&&yh(P,j,!0)):De(P,j,W,Ke,ae,ie,Pe,je,Ie)},he=(P,j,W,ue,ae,ie,Pe,je,Ie)=>{j.slotScopeIds=je,P==null?j.shapeFlag&512?ae.ctx.activate(j,W,ue,Pe,Ie):te(j,W,ue,ae,ie,Pe,Ie):Ae(P,j,Ie)},te=(P,j,W,ue,ae,ie,Pe)=>{const je=P.component=Vk(P,ue,ae);if(vu(P)&&(je.ctx.renderer=Le),Kk(je,!1,Pe),je.asyncDep){if(ae&&ae.registerDep(je,Oe,Pe),!P.el){const Ie=je.subTree=Fe(Zn);E(null,Ie,j,W),P.placeholder=Ie.el}}else Oe(je,P,j,W,ae,ie,Pe)},Ae=(P,j,W)=>{const ue=j.component=P.component;if(Ek(P,j,W))if(ue.asyncDep&&!ue.asyncResolved){$e(ue,j,W);return}else ue.next=j,ue.update();else j.el=P.el,ue.vnode=j},Oe=(P,j,W,ue,ae,ie,Pe)=>{const je=()=>{if(P.isMounted){let{next:Ne,bu:qe,u:Ge,parent:dt,vnode:St}=P;{const Ce=Iy(P);if(Ce){Ne&&(Ne.el=St.el,$e(P,Ne,Pe)),Ce.asyncDep.then(()=>{ur(()=>{P.isUnmounted||ge()},ae)});return}}let st=Ne,ut;fi(P,!1),Ne?(Ne.el=St.el,$e(P,Ne,Pe)):Ne=St,qe&&tc(qe),(ut=Ne.props&&Ne.props.onVnodeBeforeUpdate)&&ga(ut,dt,Ne,St),fi(P,!0);const X=im(P),pe=P.subTree;P.subTree=X,k(pe,X,m(pe.el),D(pe),P,ae,ie),Ne.el=X.el,st===null&&Mk(P,X.el),Ge&&ur(Ge,ae),(ut=Ne.props&&Ne.props.onVnodeUpdated)&&ur(()=>ga(ut,dt,Ne,St),ae)}else{let Ne;const{el:qe,props:Ge}=j,{bm:dt,m:St,parent:st,root:ut,type:X}=P,pe=cl(j);fi(P,!1),dt&&tc(dt),!pe&&(Ne=Ge&&Ge.onVnodeBeforeMount)&&ga(Ne,st,j),fi(P,!0);{ut.ce&&ut.ce._hasShadowRoot()&&ut.ce._injectChildStyle(X,P.parent?P.parent.type:void 0);const Ce=P.subTree=im(P);k(null,Ce,W,ue,P,ae,ie),j.el=Ce.el}if(St&&ur(St,ae),!pe&&(Ne=Ge&&Ge.onVnodeMounted)){const Ce=j;ur(()=>ga(Ne,st,Ce),ae)}(j.shapeFlag&256||st&&cl(st.vnode)&&st.vnode.shapeFlag&256)&&P.a&&ur(P.a,ae),P.isMounted=!0,j=W=ue=null}};P.scope.on();const Ie=P.effect=new Lv(je);P.scope.off();const ge=P.update=Ie.run.bind(Ie),Ke=P.job=Ie.runIfDirty.bind(Ie);Ke.i=P,Ke.id=P.uid,Ie.scheduler=()=>hh(Ke),fi(P,!0),ge()},$e=(P,j,W)=>{j.component=P;const ue=P.vnode.props;P.vnode=j,P.next=null,Lk(P,j.props,ue,W),Ok(P,j.children,W),ts(),Yp(P),ns()},De=(P,j,W,ue,ae,ie,Pe,je,Ie=!1)=>{const ge=P&&P.children,Ke=P?P.shapeFlag:0,Ne=j.children,{patchFlag:qe,shapeFlag:Ge}=j;if(qe>0){if(qe&128){Te(ge,Ne,W,ue,ae,ie,Pe,je,Ie);return}else if(qe&256){Se(ge,Ne,W,ue,ae,ie,Pe,je,Ie);return}}Ge&8?(Ke&16&&de(ge,ae,ie),Ne!==ge&&d(W,Ne)):Ke&16?Ge&16?Te(ge,Ne,W,ue,ae,ie,Pe,je,Ie):de(ge,ae,ie,!0):(Ke&8&&d(W,""),Ge&16&&le(Ne,W,ue,ae,ie,Pe,je,Ie))},Se=(P,j,W,ue,ae,ie,Pe,je,Ie)=>{P=P||il,j=j||il;const ge=P.length,Ke=j.length,Ne=Math.min(ge,Ke);let qe;for(qe=0;qe<Ne;qe++){const Ge=j[qe]=Ie?Va(j[qe]):wa(j[qe]);k(P[qe],Ge,W,null,ae,ie,Pe,je,Ie)}ge>Ke?de(P,ae,ie,!0,!1,Ne):le(j,W,ue,ae,ie,Pe,je,Ie,Ne)},Te=(P,j,W,ue,ae,ie,Pe,je,Ie)=>{let ge=0;const Ke=j.length;let Ne=P.length-1,qe=Ke-1;for(;ge<=Ne&&ge<=qe;){const Ge=P[ge],dt=j[ge]=Ie?Va(j[ge]):wa(j[ge]);if(wi(Ge,dt))k(Ge,dt,W,null,ae,ie,Pe,je,Ie);else break;ge++}for(;ge<=Ne&&ge<=qe;){const Ge=P[Ne],dt=j[qe]=Ie?Va(j[qe]):wa(j[qe]);if(wi(Ge,dt))k(Ge,dt,W,null,ae,ie,Pe,je,Ie);else break;Ne--,qe--}if(ge>Ne){if(ge<=qe){const Ge=qe+1,dt=Ge<Ke?j[Ge].el:ue;for(;ge<=qe;)k(null,j[ge]=Ie?Va(j[ge]):wa(j[ge]),W,dt,ae,ie,Pe,je,Ie),ge++}}else if(ge>qe)for(;ge<=Ne;)Ee(P[ge],ae,ie,!0),ge++;else{const Ge=ge,dt=ge,St=new Map;for(ge=dt;ge<=qe;ge++){const wt=j[ge]=Ie?Va(j[ge]):wa(j[ge]);wt.key!=null&&St.set(wt.key,ge)}let st,ut=0;const X=qe-dt+1;let pe=!1,Ce=0;const Be=new Array(X);for(ge=0;ge<X;ge++)Be[ge]=0;for(ge=Ge;ge<=Ne;ge++){const wt=P[ge];if(ut>=X){Ee(wt,ae,ie,!0);continue}let Dt;if(wt.key!=null)Dt=St.get(wt.key);else for(st=dt;st<=qe;st++)if(Be[st-dt]===0&&wi(wt,j[st])){Dt=st;break}Dt===void 0?Ee(wt,ae,ie,!0):(Be[Dt-dt]=ge+1,Dt>=Ce?Ce=Dt:pe=!0,k(wt,j[Dt],W,null,ae,ie,Pe,je,Ie),ut++)}const yt=pe?Uk(Be):il;for(st=yt.length-1,ge=X-1;ge>=0;ge--){const wt=dt+ge,Dt=j[wt],Uo=j[wt+1],Jt=wt+1<Ke?Uo.el||Ay(Uo):ue;Be[ge]===0?k(null,Dt,W,Jt,ae,ie,Pe,je,Ie):pe&&(st<0||ge!==yt[st]?xe(Dt,W,Jt,2):st--)}}},xe=(P,j,W,ue,ae=null)=>{const{el:ie,type:Pe,transition:je,children:Ie,shapeFlag:ge}=P;if(ge&6){xe(P.component.subTree,j,W,ue);return}if(ge&128){P.suspense.move(j,W,ue);return}if(ge&64){Pe.move(P,j,W,Le);return}if(Pe===at){r(ie,j,W);for(let Ne=0;Ne<Ie.length;Ne++)xe(Ie[Ne],j,W,ue);r(P.anchor,j,W);return}if(Pe===Od){q(P,j,W);return}if(ue!==2&&ge&1&&je)if(ue===0)je.persisted&&!ie[Xr]?r(ie,j,W):(je.beforeEnter(ie),r(ie,j,W),ur(()=>je.enter(ie),ae));else{const{leave:Ne,delayLeave:qe,afterLeave:Ge}=je,dt=()=>{P.ctx.isUnmounted?o(ie):r(ie,j,W)},St=()=>{const st=ie._isLeaving||!!ie[Xr];ie._isLeaving&&ie[Xr](!0),je.persisted&&!st?dt():Ne(ie,()=>{dt(),Ge&&Ge()})};qe?qe(ie,dt,St):St()}else r(ie,j,W)},Ee=(P,j,W,ue=!1,ae=!1)=>{const{type:ie,props:Pe,ref:je,children:Ie,dynamicChildren:ge,shapeFlag:Ke,patchFlag:Ne,dirs:qe,cacheIndex:Ge,memo:dt}=P;if(Ne===-2&&(ae=!1),je!=null&&(ts(),Xl(je,null,W,P,!0),ns()),Ge!=null&&(j.renderCache[Ge]=void 0),Ke&256){j.ctx.deactivate(P);return}const St=Ke&1&&qe,st=!cl(P);let ut;if(st&&(ut=Pe&&Pe.onVnodeBeforeUnmount)&&ga(ut,j,P),Ke&6)nt(P.component,W,ue);else{if(Ke&128){P.suspense.unmount(W,ue);return}St&&di(P,null,j,"beforeUnmount"),Ke&64?P.type.remove(P,j,W,Le,ue):ge&&!ge.hasOnce&&(ie!==at||Ne>0&&Ne&64)?de(ge,j,W,!1,!0):(ie===at&&Ne&384||!ae&&Ke&16)&&de(Ie,j,W),ue&&Je(P)}const X=dt!=null&&Ge==null;(st&&(ut=Pe&&Pe.onVnodeUnmounted)||St||X)&&ur(()=>{ut&&ga(ut,j,P),St&&di(P,null,j,"unmounted"),X&&(P.el=null)},W)},Je=P=>{const{type:j,el:W,anchor:ue,transition:ae}=P;if(j===at){Xe(W,ue);return}if(j===Od){K(P);return}const ie=()=>{o(W),ae&&!ae.persisted&&ae.afterLeave&&ae.afterLeave()};if(P.shapeFlag&1&&ae&&!ae.persisted){const{leave:Pe,delayLeave:je}=ae,Ie=()=>Pe(W,ie);je?je(P.el,ie,Ie):Ie()}else ie()},Xe=(P,j)=>{let W;for(;P!==j;)W=f(P),o(P),P=W;o(j)},nt=(P,j,W)=>{const{bum:ue,scope:ae,job:ie,subTree:Pe,um:je,m:Ie,a:ge}=P;cm(Ie),cm(ge),ue&&tc(ue),ae.stop(),ie&&(ie.flags|=8,Ee(Pe,P,j,W)),je&&ur(je,j),ur(()=>{P.isUnmounted=!0},j)},de=(P,j,W,ue=!1,ae=!1,ie=0)=>{for(let Pe=ie;Pe<P.length;Pe++)Ee(P[Pe],j,W,ue,ae)},D=P=>{if(P.shapeFlag&6)return D(P.component.subTree);if(P.shapeFlag&128)return P.suspense.next();const j=f(P.anchor||P.el),W=j&&j[ry];return W?f(W):j};let ne=!1;const se=(P,j,W)=>{let ue;P==null?j._vnode&&(Ee(j._vnode,null,null,!0),ue=j._vnode.component):k(j._vnode||null,P,j,null,null,null,W),j._vnode=P,ne||(ne=!0,Yp(ue),Xv(),ne=!1)},Le={p:k,um:Ee,m:xe,r:Je,mt:te,mc:le,pc:De,pbc:_e,n:D,o:e};return{render:se,hydrate:void 0,createApp:Ck(se)}}function $d({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function fi({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Bk(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function yh(e,t,n=!1){const r=e.children,o=t.children;if(lt(r)&&lt(o))for(let a=0;a<r.length;a++){const s=r[a];let i=o[a];i.shapeFlag&1&&!i.dynamicChildren&&((i.patchFlag<=0||i.patchFlag===32)&&(i=o[a]=Va(o[a]),i.el=s.el),!n&&i.patchFlag!==-2&&yh(s,i)),i.type===qc&&(i.patchFlag===-1&&(i=o[a]=Va(i)),i.el=s.el),i.type===Zn&&!i.el&&(i.el=s.el)}}function Uk(e){const t=e.slice(),n=[0];let r,o,a,s,i;const l=e.length;for(r=0;r<l;r++){const u=e[r];if(u!==0){if(o=n[n.length-1],e[o]<u){t[r]=o,n.push(r);continue}for(a=0,s=n.length-1;a<s;)i=a+s>>1,e[n[i]]<u?a=i+1:s=i;u<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,s=n[a-1];a-- >0;)n[a]=s,s=t[s];return n}function Iy(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Iy(t)}function cm(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Ay(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Ay(t.subTree):null}const _y=e=>e.__isSuspense;function zk(e,t){t&&t.pendingBranch?lt(e)?t.effects.push(...e):t.effects.push(e):GS(e)}const at=Symbol.for("v-fgt"),qc=Symbol.for("v-txt"),Zn=Symbol.for("v-cmt"),Od=Symbol.for("v-stc"),Qa=[];let fr=null;function _(e=!1){Qa.push(fr=e?null:[])}function wh(){Qa.pop(),fr=Qa[Qa.length-1]||null}let wl=1;function mc(e,t=!1){wl+=e,e<0&&fr&&t&&(fr.hasOnce=!0)}function Py(e){return e.dynamicChildren=wl>0?fr||il:null,wh(),wl>0&&fr&&fr.push(e),e}function B(e,t,n,r,o,a){return Py(w(e,t,n,r,o,a,!0))}function Ze(e,t,n,r,o){return Py(Fe(e,t,n,r,o,!0))}function iu(e){return e?e.__v_isVNode===!0:!1}function wi(e,t){return e.type===t.type&&e.key===t.key}const Ey=({key:e})=>e??null,rc=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Xt(e)||Nn(e)||pt(e)?{i:Gn,r:e,k:t,f:!!n}:e:null);function w(e,t=null,n=null,r=0,o=null,a=e===at?0:1,s=!1,i=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ey(t),ref:t&&rc(t),scopeId:ey,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:Gn};return i?(gc(l,n),a&128&&e.normalize(l)):n&&(l.shapeFlag|=Xt(n)?8:16),wl>0&&!s&&fr&&(l.patchFlag>0||a&6)&&l.patchFlag!==32&&fr.push(l),l}const Fe=Hk;function Hk(e,t=null,n=null,r=0,o=null,a=!1){if((!e||e===dy)&&(e=Zn),iu(e)){const i=qs(e,t,!0);return n&&gc(i,n),wl>0&&!a&&fr&&(i.shapeFlag&6?fr[fr.indexOf(e)]=i:fr.push(i)),i.patchFlag=-2,i}if(Xk(e)&&(e=e.__vccOpts),t){t=Wk(t);let{class:i,style:l}=t;i&&!Xt(i)&&(t.class=ct(i)),Ot(l)&&(fh(l)&&!lt(l)&&(l=yn({},l)),t.style=Zr(l))}const s=Xt(e)?1:_y(e)?128:oy(e)?64:Ot(e)?4:pt(e)?2:0;return w(e,t,n,r,o,s,a,!0)}function Wk(e){return e?fh(e)||by(e)?yn({},e):e:null}function qs(e,t,n=!1,r=!1){const{props:o,ref:a,patchFlag:s,children:i,transition:l}=e,u=t?bh(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&Ey(u),ref:t&&t.ref?n&&a?lt(a)?a.concat(rc(t)):[a,rc(t)]:rc(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:i,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==at?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&qs(e.ssContent),ssFallback:e.ssFallback&&qs(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&su(d,l.clone(d)),d}function Fs(e=" ",t=0){return Fe(qc,null,e,t)}function ve(e="",t=!1){return t?(_(),Ze(Zn,null,e)):Fe(Zn,null,e)}function wa(e){return e==null||typeof e=="boolean"?Fe(Zn):lt(e)?Fe(at,null,e.slice()):iu(e)?Va(e):Fe(qc,null,String(e))}function Va(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:qs(e)}function gc(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(lt(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),gc(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!by(t)?t._ctx=Gn:o===3&&Gn&&(Gn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(pt(t)){if(r&65){gc(e,{default:t});return}t={default:t,_ctx:Gn},n=32}else t=String(t),r&64?(n=16,t=[Fs(t)]):n=8;e.children=t,e.shapeFlag|=n}function bh(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const o in r)if(o==="class")t.class!==r.class&&(t.class=ct([t.class,r.class]));else if(o==="style")t.style=Zr([t.style,r.style]);else if(Nc(o)){const a=t[o],s=r[o];s&&a!==s&&!(lt(a)&&a.includes(s))?t[o]=a?[].concat(a,s):s:s==null&&a==null&&!$c(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function ga(e,t,n,r=null){no(e,t,7,[n,r])}const qk=my();let Gk=0;function Vk(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||qk,a={uid:Gk++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new vS(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Sy(r,o),emitsOptions:gy(r,o),emit:null,emitted:null,propsDefaults:zt,inheritAttrs:r.inheritAttrs,ctx:zt,data:zt,props:zt,attrs:zt,slots:zt,refs:zt,setupState:zt,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=Ik.bind(null,a),e.ce&&e.ce(a),a}let qn=null;const Th=()=>qn||Gn;let vc,If;{const e=Bc(),t=(n,r)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(r),a=>{o.length>1?o.forEach(s=>s(a)):o[0](a)}};vc=t("__VUE_INSTANCE_SETTERS__",n=>qn=n),If=t("__VUE_SSR_SETTERS__",n=>bl=n)}const wu=e=>{const t=qn;return vc(e),e.scope.on(),()=>{e.scope.off(),vc(t)}},dm=()=>{qn&&qn.scope.off(),vc(null)};function My(e){return e.vnode.shapeFlag&4}let bl=!1;function Kk(e,t=!1,n=!1){t&&If(t);const{props:r,children:o}=e.vnode,a=My(e);Rk(e,r,a,t),$k(e,o,n||t);const s=a?Yk(e,t):void 0;return t&&If(!1),s}function Yk(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,mk);const{setup:r}=n;if(r){ts();const o=e.setupContext=r.length>1?Ly(e):null,a=wu(e),s=mu(r,e,0,[e.props,o]),i=xv(s);if(ns(),a(),(i||e.sp)&&!cl(e)&&ph(e),i){if(s.then(dm,dm),t)return s.then(l=>{fm(e,l)}).catch(l=>{gu(l,e,0)});e.asyncDep=s}else fm(e,s)}else Ry(e)}function fm(e,t,n){pt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Ot(t)&&(e.setupState=Yv(t)),Ry(e)}function Ry(e,t,n){const r=e.type;e.render||(e.render=r.render||Ta);{const o=wu(e);ts();try{yk(e)}finally{ns(),o()}}}const Jk={get(e,t){return Xn(e,"get",""),e[t]}};function Ly(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Jk),slots:e.slots,emit:e.emit,expose:t}}function Gc(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Yv($S(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Zl)return Zl[n](e)},has(t,n){return n in t||n in Zl}})):e.proxy}function Qk(e,t=!0){return pt(e)?e.displayName||e.name:e.name||t&&e.__name}function Xk(e){return pt(e)&&"__vccOpts"in e}const Y=(e,t)=>US(e,t,bl);function Sh(e,t,n){try{mc(-1);const r=arguments.length;return r===2?Ot(t)&&!lt(t)?iu(t)?Fe(e,null,[t]):Fe(e,t):Fe(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&iu(n)&&(n=[n]),Fe(e,t,n))}finally{mc(1)}}function sU(e,t,n,r){const o=n[r];if(o&&Zk(o,e))return o;const a=t();return a.memo=e.slice(),a.cacheIndex=r,n[r]=a}function Zk(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(Lo(n[r],t[r]))return!1;return wl>0&&fr&&fr.push(e),!0}const eC="3.5.40";/**
15
+ * @vue/runtime-dom v3.5.40
16
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
17
+ * @license MIT
18
+ **/let Af;const hm=typeof window<"u"&&window.trustedTypes;if(hm)try{Af=hm.createPolicy("vue",{createHTML:e=>e})}catch{}const jy=Af?e=>Af.createHTML(e):e=>e,tC="http://www.w3.org/2000/svg",nC="http://www.w3.org/1998/Math/MathML",Ga=typeof document<"u"?document:null,pm=Ga&&Ga.createElement("template"),rC={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const o=t==="svg"?Ga.createElementNS(tC,e):t==="mathml"?Ga.createElementNS(nC,e):n?Ga.createElement(e,{is:n}):Ga.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>Ga.createTextNode(e),createComment:e=>Ga.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ga.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,o,a){const s=n?n.previousSibling:t.lastChild;if(o&&(o===a||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===a||!(o=o.nextSibling)););else{pm.innerHTML=jy(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const i=pm.content;if(r==="svg"||r==="mathml"){const l=i.firstChild;for(;l.firstChild;)i.appendChild(l.firstChild);i.removeChild(l)}t.insertBefore(i,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Ms="transition",Ul="animation",lu=Symbol("_vtc"),Ny={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},oC=yn({},ay,Ny),aC=e=>(e.displayName="Transition",e.props=oC,e),bu=aC((e,{slots:t})=>Sh(tk,sC(e),t)),hi=(e,t=[])=>{lt(e)?e.forEach(n=>n(...t)):e&&e(...t)},mm=e=>e?lt(e)?e.some(t=>t.length>1):e.length>1:!1;function sC(e){const t={};for(const ee in e)ee in Ny||(t[ee]=e[ee]);if(e.css===!1)return t;const{name:n="v",type:r,duration:o,enterFromClass:a=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:i=`${n}-enter-to`,appearFromClass:l=a,appearActiveClass:u=s,appearToClass:d=i,leaveFromClass:m=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:v=`${n}-leave-to`}=e,T=iC(o),k=T&&T[0],R=T&&T[1],{onBeforeEnter:E,onEnter:N,onEnterCancelled:q,onLeave:K,onLeaveCancelled:U,onBeforeAppear:ce=E,onAppear:G=N,onAppearCancelled:le=q}=t,ye=(ee,he,te,Ae)=>{ee._enterCancelled=Ae,pi(ee,he?d:i),pi(ee,he?u:s),te&&te()},_e=(ee,he)=>{ee._isLeaving=!1,pi(ee,m),pi(ee,v),pi(ee,f),he&&he()},we=ee=>(he,te)=>{const Ae=ee?G:N,Oe=()=>ye(he,ee,te);hi(Ae,[he,Oe]),gm(()=>{pi(he,ee?l:a),Ha(he,ee?d:i),mm(Ae)||vm(he,r,k,Oe)})};return yn(t,{onBeforeEnter(ee){hi(E,[ee]),Ha(ee,a),Ha(ee,s)},onBeforeAppear(ee){hi(ce,[ee]),Ha(ee,l),Ha(ee,u)},onEnter:we(!1),onAppear:we(!0),onLeave(ee,he){ee._isLeaving=!0;const te=()=>_e(ee,he);Ha(ee,m),ee._enterCancelled?(Ha(ee,f),bm(ee)):(bm(ee),Ha(ee,f)),gm(()=>{ee._isLeaving&&(pi(ee,m),Ha(ee,v),mm(K)||vm(ee,r,R,te))}),hi(K,[ee,te])},onEnterCancelled(ee){ye(ee,!1,void 0,!0),hi(q,[ee])},onAppearCancelled(ee){ye(ee,!0,void 0,!0),hi(le,[ee])},onLeaveCancelled(ee){_e(ee),hi(U,[ee])}})}function iC(e){if(e==null)return null;if(Ot(e))return[Dd(e.enter),Dd(e.leave)];{const t=Dd(e);return[t,t]}}function Dd(e){return uS(e)}function Ha(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[lu]||(e[lu]=new Set)).add(t)}function pi(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[lu];n&&(n.delete(t),n.size||(e[lu]=void 0))}function gm(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let lC=0;function vm(e,t,n,r){const o=e._endId=++lC,a=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(a,n);const{type:s,timeout:i,propCount:l}=uC(e,t);if(!s)return r();const u=s+"end";let d=0;const m=()=>{e.removeEventListener(u,f),a()},f=v=>{v.target===e&&++d>=l&&m()};setTimeout(()=>{d<l&&m()},i+1),e.addEventListener(u,f)}function uC(e,t){const n=window.getComputedStyle(e),r=T=>(n[T]||"").split(", "),o=r(`${Ms}Delay`),a=r(`${Ms}Duration`),s=ym(o,a),i=r(`${Ul}Delay`),l=r(`${Ul}Duration`),u=ym(i,l);let d=null,m=0,f=0;t===Ms?s>0&&(d=Ms,m=s,f=a.length):t===Ul?u>0&&(d=Ul,m=u,f=l.length):(m=Math.max(s,u),d=m>0?s>u?Ms:Ul:null,f=d?d===Ms?a.length:l.length:0);const v=d===Ms&&/\b(?:transform|all)(?:,|$)/.test(r(`${Ms}Property`).toString());return{type:d,timeout:m,propCount:f,hasTransform:v}}function ym(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>wm(n)+wm(e[r])))}function wm(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function bm(e){return(e?e.ownerDocument:document).body.offsetHeight}function cC(e,t,n){const r=e[lu];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const yc=Symbol("_vod"),$y=Symbol("_vsh"),iU={name:"show",beforeMount(e,{value:t},{transition:n}){e[yc]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):zl(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),zl(e,!0),r.enter(e)):r.leave(e,()=>{zl(e,!1)}):zl(e,t))},beforeUnmount(e,{value:t}){zl(e,t)}};function zl(e,t){e.style.display=t?e[yc]:"none",e[$y]=!t}const dC=Symbol(""),fC=/(?:^|;)\s*display\s*:/;function hC(e,t,n){const r=e.style,o=Xt(n);let a=!1;if(n&&!o){if(t)if(Xt(t))for(const s of t.split(";")){const i=s.slice(0,s.indexOf(":")).trim();n[i]==null&&Vl(r,i,"")}else for(const s in t)n[s]==null&&Vl(r,s,"");for(const s in n){s==="display"&&(a=!0);const i=n[s];i!=null?mC(e,s,!Xt(t)&&t?t[s]:void 0,i)||Vl(r,s,i):Vl(r,s,"")}}else if(o){if(t!==n){const s=r[dC];s&&(n+=";"+s),r.cssText=n,a=fC.test(n)}}else t&&e.removeAttribute("style");yc in e&&(e[yc]=a?r.display:"",e[$y]&&(r.display="none"))}const Tm=/\s*!important$/;function Vl(e,t,n){if(lt(n))n.forEach(r=>Vl(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=pC(e,t);Tm.test(n)?e.setProperty(Vs(r),n.replace(Tm,""),"important"):e[r]=n}}const Sm=["Webkit","Moz","ms"],Fd={};function pC(e,t){const n=Fd[t];if(n)return n;let r=hr(t);if(r!=="filter"&&r in e)return Fd[t]=r;r=Fc(r);for(let o=0;o<Sm.length;o++){const a=Sm[o]+r;if(a in e)return Fd[t]=a}return t}function mC(e,t,n,r){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Xt(r)&&n===r}const km="http://www.w3.org/1999/xlink";function Cm(e,t,n,r,o,a=mS(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(km,t.slice(6,t.length)):e.setAttributeNS(km,t,n):n==null||a&&!Pv(n)?e.removeAttribute(t):e.setAttribute(t,a?"":Do(n)?String(n):n)}function xm(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?jy(n):n);return}const a=e.tagName;if(t==="value"&&a!=="PROGRESS"&&!a.includes("-")){const i=a==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(i!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const i=typeof e[t];i==="boolean"?n=Pv(n):n==null&&i==="string"?(n="",s=!0):i==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(o||t)}function bi(e,t,n,r){e.addEventListener(t,n,r)}function gC(e,t,n,r){e.removeEventListener(t,n,r)}const Im=Symbol("_vei");function vC(e,t,n,r,o=null){const a=e[Im]||(e[Im]={}),s=a[t];if(r&&s)s.value=r;else{const[i,l]=bC(t);if(r){const u=a[t]=kC(r,o);bi(e,i,u,l)}else s&&(gC(e,i,s,l),a[t]=void 0)}}const yC=/(Once|Passive|Capture)$/,wC=/^on:?(?:Once|Passive|Capture)$/;function bC(e){let t,n;for(;(n=e.match(yC))&&!wC.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):Vs(e.slice(2)),t]}let Bd=0;const TC=Promise.resolve(),SC=()=>Bd||(TC.then(()=>Bd=0),Bd=Date.now());function kC(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;const o=n.value;if(lt(o)){const a=r.stopImmediatePropagation;r.stopImmediatePropagation=()=>{a.call(r),r._stopped=!0};const s=o.slice(),i=[r];for(let l=0;l<s.length&&!r._stopped;l++){const u=s[l];u&&no(u,t,5,i)}}else no(o,t,5,[r])};return n.value=e,n.attached=SC(),n}const Am=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,CC=(e,t,n,r,o,a)=>{const s=o==="svg";t==="class"?cC(e,r,s):t==="style"?hC(e,n,r):Nc(t)?$c(t)||vC(e,t,n,r,a):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):xC(e,t,r,s))?(xm(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Cm(e,t,r,s,a,t!=="value")):e._isVueCE&&(IC(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Xt(r)))?xm(e,hr(t),r,a,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Cm(e,t,r,s))};function xC(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Am(t)&&pt(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return Am(t)&&Xt(n)?!1:t in e}function IC(e,t){const n=e._def.props;if(!n)return!1;const r=hr(t);return Array.isArray(n)?n.some(o=>hr(o)===r):Object.keys(n).some(o=>hr(o)===r)}const wc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return lt(t)?n=>tc(t,n):t};function AC(e){e.target.composing=!0}function _m(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const fl=Symbol("_assign");function Pm(e,t,n){return t&&(e=e.trim()),n&&(e=ah(e)),e}const jn={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[fl]=wc(o);const a=r||o.props&&o.props.type==="number";bi(e,t?"change":"input",s=>{s.target.composing||e[fl](Pm(e.value,n,a))}),(n||a)&&bi(e,"change",()=>{e.value=Pm(e.value,n,a)}),t||(bi(e,"compositionstart",AC),bi(e,"compositionend",_m),bi(e,"change",_m))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:a}},s){if(e[fl]=wc(s),e.composing)return;const i=(a||e.type==="number")&&!/^0\d/.test(e.value)?ah(e.value):e.value,l=t??"";if(i===l)return;const u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!=="range"&&(r&&t===n||o&&e.value.trim()===l)||(e.value=l)}},_C={deep:!0,created(e,t,n){e[fl]=wc(n),bi(e,"change",()=>{const r=e._modelValue,o=PC(e),a=e.checked,s=e[fl];if(lt(r)){const i=Ev(r,o),l=i!==-1;if(a&&!l)s(r.concat(o));else if(!a&&l){const u=[...r];u.splice(i,1),s(u)}}else if(Oc(r)){const i=new Set(r);a?i.add(o):i.delete(o),s(i)}else s(Oy(e,a))})},mounted:Em,beforeUpdate(e,t,n){e[fl]=wc(n),Em(e,t,n)}};function Em(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(lt(t))o=Ev(t,r.props.value)>-1;else if(Oc(t))o=t.has(r.props.value);else{if(t===n)return;o=pu(t,Oy(e,!0))}e.checked!==o&&(e.checked=o)}function PC(e){return"_value"in e?e._value:e.value}function Oy(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const EC=["ctrl","shift","alt","meta"],MC={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>EC.some(n=>e[`${n}Key`]&&!t.includes(n))},mt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=(o,...a)=>{for(let s=0;s<t.length;s++){const i=MC[t[s]];if(i&&i(o,t))return}return e(o,...a)})},RC={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},kr=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=o=>{if(!("key"in o))return;const a=Vs(o.key);if(t.some(s=>s===a||RC[s]===a))return e(o)})},LC=yn({patchProp:CC},rC);let Mm;function jC(){return Mm||(Mm=Dk(LC))}const NC=(...e)=>{const t=jC().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=OC(r);if(!o)return;const a=t._component;!pt(a)&&!a.render&&!a.template&&(a.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,$C(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t};function $C(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function OC(e){return Xt(e)?document.querySelector(e):e}const DC="modulepreload",FC=function(e){return"/"+e},Rm={},Mo=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let s=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));o=s(n.map(u=>{if(u=FC(u),u in Rm)return;Rm[u]=!0;const d=u.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${m}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":DC,d||(f.as="script"),f.crossOrigin="",f.href=u,l&&f.setAttribute("nonce",l),document.head.appendChild(f),d)return new Promise((v,T)=>{f.addEventListener("load",v),f.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${u}`)))})}))}function a(s){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=s,window.dispatchEvent(i),!i.defaultPrevented)throw s}return o.then(s=>{for(const i of s||[])i.status==="rejected"&&a(i.reason);return t().catch(a)})};/*!
19
+ * vue-router v4.6.4
20
+ * (c) 2025 Eduardo San Martin Morote
21
+ * @license MIT
22
+ */const rl=typeof document<"u";function Dy(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function BC(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Dy(e.default)}const Nt=Object.assign;function Ud(e,t){const n={};for(const r in t){const o=t[r];n[r]=Bo(o)?o.map(e):e(o)}return n}const eu=()=>{},Bo=Array.isArray;function Lm(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const Fy=/#/g,UC=/&/g,zC=/\//g,HC=/=/g,WC=/\?/g,By=/\+/g,qC=/%5B/g,GC=/%5D/g,Uy=/%5E/g,VC=/%60/g,zy=/%7B/g,KC=/%7C/g,Hy=/%7D/g,YC=/%20/g;function kh(e){return e==null?"":encodeURI(""+e).replace(KC,"|").replace(qC,"[").replace(GC,"]")}function JC(e){return kh(e).replace(zy,"{").replace(Hy,"}").replace(Uy,"^")}function _f(e){return kh(e).replace(By,"%2B").replace(YC,"+").replace(Fy,"%23").replace(UC,"%26").replace(VC,"`").replace(zy,"{").replace(Hy,"}").replace(Uy,"^")}function QC(e){return _f(e).replace(HC,"%3D")}function XC(e){return kh(e).replace(Fy,"%23").replace(WC,"%3F")}function ZC(e){return XC(e).replace(zC,"%2F")}function uu(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const ex=/\/$/,tx=e=>e.replace(ex,"");function zd(e,t,n="/"){let r,o={},a="",s="";const i=t.indexOf("#");let l=t.indexOf("?");return l=i>=0&&l>i?-1:l,l>=0&&(r=t.slice(0,l),a=t.slice(l,i>0?i:t.length),o=e(a.slice(1))),i>=0&&(r=r||t.slice(0,i),s=t.slice(i,t.length)),r=ax(r??t,n),{fullPath:r+a+s,path:r,query:o,hash:uu(s)}}function nx(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function jm(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function rx(e,t,n){const r=t.matched.length-1,o=n.matched.length-1;return r>-1&&r===o&&Tl(t.matched[r],n.matched[o])&&Wy(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Tl(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Wy(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!ox(e[n],t[n]))return!1;return!0}function ox(e,t){return Bo(e)?Nm(e,t):Bo(t)?Nm(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Nm(e,t){return Bo(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function ax(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),o=r[r.length-1];(o===".."||o===".")&&r.push("");let a=n.length-1,s,i;for(s=0;s<r.length;s++)if(i=r[s],i!==".")if(i==="..")a>1&&a--;else break;return n.slice(0,a).join("/")+"/"+r.slice(s).join("/")}const Rs={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Pf=function(e){return e.pop="pop",e.push="push",e}({}),Hd=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function sx(e){if(!e)if(rl){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),tx(e)}const ix=/^[^#]+#/;function lx(e,t){return e.replace(ix,"#")+t}function ux(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const Vc=()=>({left:window.scrollX,top:window.scrollY});function cx(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),o=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!o)return;t=ux(o,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function $m(e,t){return(history.state?history.state.position-t:-1)+e}const Ef=new Map;function dx(e,t){Ef.set(e,t)}function fx(e){const t=Ef.get(e);return Ef.delete(e),t}function hx(e){return typeof e=="string"||e&&typeof e=="object"}function qy(e){return typeof e=="string"||typeof e=="symbol"}let dn=function(e){return e[e.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",e[e.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",e[e.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",e[e.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",e[e.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",e}({});const Gy=Symbol("");dn.MATCHER_NOT_FOUND+"",dn.NAVIGATION_GUARD_REDIRECT+"",dn.NAVIGATION_ABORTED+"",dn.NAVIGATION_CANCELLED+"",dn.NAVIGATION_DUPLICATED+"";function Sl(e,t){return Nt(new Error,{type:e,[Gy]:!0},t)}function Wa(e,t){return e instanceof Error&&Gy in e&&(t==null||!!(e.type&t))}const px=["params","query","hash"];function mx(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of px)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function gx(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<n.length;++r){const o=n[r].replace(By," "),a=o.indexOf("="),s=uu(a<0?o:o.slice(0,a)),i=a<0?null:uu(o.slice(a+1));if(s in t){let l=t[s];Bo(l)||(l=t[s]=[l]),l.push(i)}else t[s]=i}return t}function Om(e){let t="";for(let n in e){const r=e[n];if(n=QC(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(Bo(r)?r.map(o=>o&&_f(o)):[r&&_f(r)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+n,o!=null&&(t+="="+o))})}return t}function vx(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=Bo(r)?r.map(o=>o==null?null:""+o):r==null?r:""+r)}return t}const yx=Symbol(""),Dm=Symbol(""),Kc=Symbol(""),Ch=Symbol(""),Mf=Symbol("");function Hl(){let e=[];function t(r){return e.push(r),()=>{const o=e.indexOf(r);o>-1&&e.splice(o,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Os(e,t,n,r,o,a=s=>s()){const s=r&&(r.enterCallbacks[o]=r.enterCallbacks[o]||[]);return()=>new Promise((i,l)=>{const u=f=>{f===!1?l(Sl(dn.NAVIGATION_ABORTED,{from:n,to:t})):f instanceof Error?l(f):hx(f)?l(Sl(dn.NAVIGATION_GUARD_REDIRECT,{from:t,to:f})):(s&&r.enterCallbacks[o]===s&&typeof f=="function"&&s.push(f),i())},d=a(()=>e.call(r&&r.instances[o],t,n,u));let m=Promise.resolve(d);e.length<3&&(m=m.then(u)),m.catch(f=>l(f))})}function Wd(e,t,n,r,o=a=>a()){const a=[];for(const s of e)for(const i in s.components){let l=s.components[i];if(!(t!=="beforeRouteEnter"&&!s.instances[i]))if(Dy(l)){const u=(l.__vccOpts||l)[t];u&&a.push(Os(u,n,r,s,i,o))}else{let u=l();a.push(()=>u.then(d=>{if(!d)throw new Error(`Couldn't resolve component "${i}" at "${s.path}"`);const m=BC(d)?d.default:d;s.mods[i]=d,s.components[i]=m;const f=(m.__vccOpts||m)[t];return f&&Os(f,n,r,s,i,o)()}))}}return a}function wx(e,t){const n=[],r=[],o=[],a=Math.max(t.matched.length,e.matched.length);for(let s=0;s<a;s++){const i=t.matched[s];i&&(e.matched.find(u=>Tl(u,i))?r.push(i):n.push(i));const l=e.matched[s];l&&(t.matched.find(u=>Tl(u,l))||o.push(l))}return[n,r,o]}/*!
23
+ * vue-router v4.6.4
24
+ * (c) 2025 Eduardo San Martin Morote
25
+ * @license MIT
26
+ */let bx=()=>location.protocol+"//"+location.host;function Vy(e,t){const{pathname:n,search:r,hash:o}=t,a=e.indexOf("#");if(a>-1){let s=o.includes(e.slice(a))?e.slice(a).length:1,i=o.slice(s);return i[0]!=="/"&&(i="/"+i),jm(i,"")}return jm(n,e)+r+o}function Tx(e,t,n,r){let o=[],a=[],s=null;const i=({state:f})=>{const v=Vy(e,location),T=n.value,k=t.value;let R=0;if(f){if(n.value=v,t.value=f,s&&s===T){s=null;return}R=k?f.position-k.position:0}else r(v);o.forEach(E=>{E(n.value,T,{delta:R,type:Pf.pop,direction:R?R>0?Hd.forward:Hd.back:Hd.unknown})})};function l(){s=n.value}function u(f){o.push(f);const v=()=>{const T=o.indexOf(f);T>-1&&o.splice(T,1)};return a.push(v),v}function d(){if(document.visibilityState==="hidden"){const{history:f}=window;if(!f.state)return;f.replaceState(Nt({},f.state,{scroll:Vc()}),"")}}function m(){for(const f of a)f();a=[],window.removeEventListener("popstate",i),window.removeEventListener("pagehide",d),document.removeEventListener("visibilitychange",d)}return window.addEventListener("popstate",i),window.addEventListener("pagehide",d),document.addEventListener("visibilitychange",d),{pauseListeners:l,listen:u,destroy:m}}function Fm(e,t,n,r=!1,o=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:o?Vc():null}}function Sx(e){const{history:t,location:n}=window,r={value:Vy(e,n)},o={value:t.state};o.value||a(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(l,u,d){const m=e.indexOf("#"),f=m>-1?(n.host&&document.querySelector("base")?e:e.slice(m))+l:bx()+e+l;try{t[d?"replaceState":"pushState"](u,"",f),o.value=u}catch(v){console.error(v),n[d?"replace":"assign"](f)}}function s(l,u){a(l,Nt({},t.state,Fm(o.value.back,l,o.value.forward,!0),u,{position:o.value.position}),!0),r.value=l}function i(l,u){const d=Nt({},o.value,t.state,{forward:l,scroll:Vc()});a(d.current,d,!0),a(l,Nt({},Fm(r.value,l,null),{position:d.position+1},u),!1),r.value=l}return{location:r,state:o,push:i,replace:s}}function kx(e){e=sx(e);const t=Sx(e),n=Tx(e,t.state,t.location,t.replace);function r(a,s=!0){s||n.pauseListeners(),history.go(a)}const o=Nt({location:"",base:e,go:r,createHref:lx.bind(null,e)},t,n);return Object.defineProperty(o,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(o,"state",{enumerable:!0,get:()=>t.state.value}),o}function Cx(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),kx(e)}let Ti=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var xn=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.ParamRegExp=2]="ParamRegExp",e[e.ParamRegExpEnd=3]="ParamRegExpEnd",e[e.EscapeNext=4]="EscapeNext",e}(xn||{});const xx={type:Ti.Static,value:""},Ix=/[a-zA-Z0-9_]/;function Ax(e){if(!e)return[[]];if(e==="/")return[[xx]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(v){throw new Error(`ERR (${n})/"${u}": ${v}`)}let n=xn.Static,r=n;const o=[];let a;function s(){a&&o.push(a),a=[]}let i=0,l,u="",d="";function m(){u&&(n===xn.Static?a.push({type:Ti.Static,value:u}):n===xn.Param||n===xn.ParamRegExp||n===xn.ParamRegExpEnd?(a.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),a.push({type:Ti.Param,value:u,regexp:d,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),u="")}function f(){u+=l}for(;i<e.length;){if(l=e[i++],l==="\\"&&n!==xn.ParamRegExp){r=n,n=xn.EscapeNext;continue}switch(n){case xn.Static:l==="/"?(u&&m(),s()):l===":"?(m(),n=xn.Param):f();break;case xn.EscapeNext:f(),n=r;break;case xn.Param:l==="("?n=xn.ParamRegExp:Ix.test(l)?f():(m(),n=xn.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--);break;case xn.ParamRegExp:l===")"?d[d.length-1]=="\\"?d=d.slice(0,-1)+l:n=xn.ParamRegExpEnd:d+=l;break;case xn.ParamRegExpEnd:m(),n=xn.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--,d="";break;default:t("Unknown state");break}}return n===xn.ParamRegExp&&t(`Unfinished custom RegExp for param "${u}"`),m(),s(),o}const Bm="[^/]+?",_x={sensitive:!1,strict:!1,start:!0,end:!0};var cr=function(e){return e[e._multiplier=10]="_multiplier",e[e.Root=90]="Root",e[e.Segment=40]="Segment",e[e.SubSegment=30]="SubSegment",e[e.Static=40]="Static",e[e.Dynamic=20]="Dynamic",e[e.BonusCustomRegExp=10]="BonusCustomRegExp",e[e.BonusWildcard=-50]="BonusWildcard",e[e.BonusRepeatable=-20]="BonusRepeatable",e[e.BonusOptional=-8]="BonusOptional",e[e.BonusStrict=.7000000000000001]="BonusStrict",e[e.BonusCaseSensitive=.25]="BonusCaseSensitive",e}(cr||{});const Px=/[.+*?^${}()[\]/\\]/g;function Ex(e,t){const n=Nt({},_x,t),r=[];let o=n.start?"^":"";const a=[];for(const u of e){const d=u.length?[]:[cr.Root];n.strict&&!u.length&&(o+="/");for(let m=0;m<u.length;m++){const f=u[m];let v=cr.Segment+(n.sensitive?cr.BonusCaseSensitive:0);if(f.type===Ti.Static)m||(o+="/"),o+=f.value.replace(Px,"\\$&"),v+=cr.Static;else if(f.type===Ti.Param){const{value:T,repeatable:k,optional:R,regexp:E}=f;a.push({name:T,repeatable:k,optional:R});const N=E||Bm;if(N!==Bm){v+=cr.BonusCustomRegExp;try{`${N}`}catch(K){throw new Error(`Invalid custom RegExp for param "${T}" (${N}): `+K.message)}}let q=k?`((?:${N})(?:/(?:${N}))*)`:`(${N})`;m||(q=R&&u.length<2?`(?:/${q})`:"/"+q),R&&(q+="?"),o+=q,v+=cr.Dynamic,R&&(v+=cr.BonusOptional),k&&(v+=cr.BonusRepeatable),N===".*"&&(v+=cr.BonusWildcard)}d.push(v)}r.push(d)}if(n.strict&&n.end){const u=r.length-1;r[u][r[u].length-1]+=cr.BonusStrict}n.strict||(o+="/?"),n.end?o+="$":n.strict&&!o.endsWith("/")&&(o+="(?:/|$)");const s=new RegExp(o,n.sensitive?"":"i");function i(u){const d=u.match(s),m={};if(!d)return null;for(let f=1;f<d.length;f++){const v=d[f]||"",T=a[f-1];m[T.name]=v&&T.repeatable?v.split("/"):v}return m}function l(u){let d="",m=!1;for(const f of e){(!m||!d.endsWith("/"))&&(d+="/"),m=!1;for(const v of f)if(v.type===Ti.Static)d+=v.value;else if(v.type===Ti.Param){const{value:T,repeatable:k,optional:R}=v,E=T in u?u[T]:"";if(Bo(E)&&!k)throw new Error(`Provided param "${T}" is an array but it is not repeatable (* or + modifiers)`);const N=Bo(E)?E.join("/"):E;if(!N)if(R)f.length<2&&(d.endsWith("/")?d=d.slice(0,-1):m=!0);else throw new Error(`Missing required param "${T}"`);d+=N}}return d||"/"}return{re:s,score:r,keys:a,parse:i,stringify:l}}function Mx(e,t){let n=0;for(;n<e.length&&n<t.length;){const r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?e.length===1&&e[0]===cr.Static+cr.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===cr.Static+cr.Segment?1:-1:0}function Ky(e,t){let n=0;const r=e.score,o=t.score;for(;n<r.length&&n<o.length;){const a=Mx(r[n],o[n]);if(a)return a;n++}if(Math.abs(o.length-r.length)===1){if(Um(r))return 1;if(Um(o))return-1}return o.length-r.length}function Um(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const Rx={strict:!1,end:!0,sensitive:!1};function Lx(e,t,n){const r=Ex(Ax(e.path),n),o=Nt(r,{record:e,parent:t,children:[],alias:[]});return t&&!o.record.aliasOf==!t.record.aliasOf&&t.children.push(o),o}function jx(e,t){const n=[],r=new Map;t=Lm(Rx,t);function o(m){return r.get(m)}function a(m,f,v){const T=!v,k=Hm(m);k.aliasOf=v&&v.record;const R=Lm(t,m),E=[k];if("alias"in m){const K=typeof m.alias=="string"?[m.alias]:m.alias;for(const U of K)E.push(Hm(Nt({},k,{components:v?v.record.components:k.components,path:U,aliasOf:v?v.record:k})))}let N,q;for(const K of E){const{path:U}=K;if(f&&U[0]!=="/"){const ce=f.record.path,G=ce[ce.length-1]==="/"?"":"/";K.path=f.record.path+(U&&G+U)}if(N=Lx(K,f,R),v?v.alias.push(N):(q=q||N,q!==N&&q.alias.push(N),T&&m.name&&!Wm(N)&&s(m.name)),Yy(N)&&l(N),k.children){const ce=k.children;for(let G=0;G<ce.length;G++)a(ce[G],N,v&&v.children[G])}v=v||N}return q?()=>{s(q)}:eu}function s(m){if(qy(m)){const f=r.get(m);f&&(r.delete(m),n.splice(n.indexOf(f),1),f.children.forEach(s),f.alias.forEach(s))}else{const f=n.indexOf(m);f>-1&&(n.splice(f,1),m.record.name&&r.delete(m.record.name),m.children.forEach(s),m.alias.forEach(s))}}function i(){return n}function l(m){const f=Ox(m,n);n.splice(f,0,m),m.record.name&&!Wm(m)&&r.set(m.record.name,m)}function u(m,f){let v,T={},k,R;if("name"in m&&m.name){if(v=r.get(m.name),!v)throw Sl(dn.MATCHER_NOT_FOUND,{location:m});R=v.record.name,T=Nt(zm(f.params,v.keys.filter(q=>!q.optional).concat(v.parent?v.parent.keys.filter(q=>q.optional):[]).map(q=>q.name)),m.params&&zm(m.params,v.keys.map(q=>q.name))),k=v.stringify(T)}else if(m.path!=null)k=m.path,v=n.find(q=>q.re.test(k)),v&&(T=v.parse(k),R=v.record.name);else{if(v=f.name?r.get(f.name):n.find(q=>q.re.test(f.path)),!v)throw Sl(dn.MATCHER_NOT_FOUND,{location:m,currentLocation:f});R=v.record.name,T=Nt({},f.params,m.params),k=v.stringify(T)}const E=[];let N=v;for(;N;)E.unshift(N.record),N=N.parent;return{name:R,path:k,params:T,matched:E,meta:$x(E)}}e.forEach(m=>a(m));function d(){n.length=0,r.clear()}return{addRoute:a,resolve:u,removeRoute:s,clearRoutes:d,getRoutes:i,getRecordMatcher:o}}function zm(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Hm(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:Nx(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,"mods",{value:{}}),t}function Nx(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function Wm(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function $x(e){return e.reduce((t,n)=>Nt(t,n.meta),{})}function Ox(e,t){let n=0,r=t.length;for(;n!==r;){const a=n+r>>1;Ky(e,t[a])<0?r=a:n=a+1}const o=Dx(e);return o&&(r=t.lastIndexOf(o,r-1)),r}function Dx(e){let t=e;for(;t=t.parent;)if(Yy(t)&&Ky(e,t)===0)return t}function Yy({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function qm(e){const t=Oo(Kc),n=Oo(Ch),r=Y(()=>{const l=g(e.to);return t.resolve(l)}),o=Y(()=>{const{matched:l}=r.value,{length:u}=l,d=l[u-1],m=n.matched;if(!d||!m.length)return-1;const f=m.findIndex(Tl.bind(null,d));if(f>-1)return f;const v=Gm(l[u-2]);return u>1&&Gm(d)===v&&m[m.length-1].path!==v?m.findIndex(Tl.bind(null,l[u-2])):f}),a=Y(()=>o.value>-1&&Hx(n.params,r.value.params)),s=Y(()=>o.value>-1&&o.value===n.matched.length-1&&Wy(n.params,r.value.params));function i(l={}){if(zx(l)){const u=t[g(e.replace)?"replace":"push"](g(e.to)).catch(eu);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:r,href:Y(()=>r.value.href),isActive:a,isExactActive:s,navigate:i}}function Fx(e){return e.length===1?e[0]:e}const Bx=fn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:qm,setup(e,{slots:t}){const n=zc(qm(e)),{options:r}=Oo(Kc),o=Y(()=>({[Vm(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Vm(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&Fx(t.default(n));return e.custom?a:Sh("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:o.value},a)}}}),Ux=Bx;function zx(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function Hx(e,t){for(const n in t){const r=t[n],o=e[n];if(typeof r=="string"){if(r!==o)return!1}else if(!Bo(o)||o.length!==r.length||r.some((a,s)=>a.valueOf()!==o[s].valueOf()))return!1}return!0}function Gm(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Vm=(e,t,n)=>e??t??n,Wx=fn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=Oo(Mf),o=Y(()=>e.route||r.value),a=Oo(Dm,0),s=Y(()=>{let u=g(a);const{matched:d}=o.value;let m;for(;(m=d[u])&&!m.components;)u++;return u}),i=Y(()=>o.value.matched[s.value]);nc(Dm,Y(()=>s.value+1)),nc(yx,i),nc(Mf,o);const l=S();return ot(()=>[l.value,i.value,e.name],([u,d,m],[f,v,T])=>{d&&(d.instances[m]=u,v&&v!==d&&u&&u===f&&(d.leaveGuards.size||(d.leaveGuards=v.leaveGuards),d.updateGuards.size||(d.updateGuards=v.updateGuards))),u&&d&&(!v||!Tl(d,v)||!f)&&(d.enterCallbacks[m]||[]).forEach(k=>k(u))},{flush:"post"}),()=>{const u=o.value,d=e.name,m=i.value,f=m&&m.components[d];if(!f)return Km(n.default,{Component:f,route:u});const v=m.props[d],T=v?v===!0?u.params:typeof v=="function"?v(u):v:null,R=Sh(f,Nt({},T,t,{onVnodeUnmounted:E=>{E.component.isUnmounted&&(m.instances[d]=null)},ref:l}));return Km(n.default,{Component:R,route:u})||R}}});function Km(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const qx=Wx;function Gx(e){const t=jx(e.routes,e),n=e.parseQuery||gx,r=e.stringifyQuery||Om,o=e.history,a=Hl(),s=Hl(),i=Hl(),l=OS(Rs);let u=Rs;rl&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const d=Ud.bind(null,D=>""+D),m=Ud.bind(null,ZC),f=Ud.bind(null,uu);function v(D,ne){let se,Le;return qy(D)?(se=t.getRecordMatcher(D),Le=ne):Le=D,t.addRoute(Le,se)}function T(D){const ne=t.getRecordMatcher(D);ne&&t.removeRoute(ne)}function k(){return t.getRoutes().map(D=>D.record)}function R(D){return!!t.getRecordMatcher(D)}function E(D,ne){if(ne=Nt({},ne||l.value),typeof D=="string"){const W=zd(n,D,ne.path),ue=t.resolve({path:W.path},ne),ae=o.createHref(W.fullPath);return Nt(W,ue,{params:f(ue.params),hash:uu(W.hash),redirectedFrom:void 0,href:ae})}let se;if(D.path!=null)se=Nt({},D,{path:zd(n,D.path,ne.path).path});else{const W=Nt({},D.params);for(const ue in W)W[ue]==null&&delete W[ue];se=Nt({},D,{params:m(W)}),ne.params=m(ne.params)}const Le=t.resolve(se,ne),We=D.hash||"";Le.params=d(f(Le.params));const P=nx(r,Nt({},D,{hash:JC(We),path:Le.path})),j=o.createHref(P);return Nt({fullPath:P,hash:We,query:r===Om?vx(D.query):D.query||{}},Le,{redirectedFrom:void 0,href:j})}function N(D){return typeof D=="string"?zd(n,D,l.value.path):Nt({},D)}function q(D,ne){if(u!==D)return Sl(dn.NAVIGATION_CANCELLED,{from:ne,to:D})}function K(D){return G(D)}function U(D){return K(Nt(N(D),{replace:!0}))}function ce(D,ne){const se=D.matched[D.matched.length-1];if(se&&se.redirect){const{redirect:Le}=se;let We=typeof Le=="function"?Le(D,ne):Le;return typeof We=="string"&&(We=We.includes("?")||We.includes("#")?We=N(We):{path:We},We.params={}),Nt({query:D.query,hash:D.hash,params:We.path!=null?{}:D.params},We)}}function G(D,ne){const se=u=E(D),Le=l.value,We=D.state,P=D.force,j=D.replace===!0,W=ce(se,Le);if(W)return G(Nt(N(W),{state:typeof W=="object"?Nt({},We,W.state):We,force:P,replace:j}),ne||se);const ue=se;ue.redirectedFrom=ne;let ae;return!P&&rx(r,Le,se)&&(ae=Sl(dn.NAVIGATION_DUPLICATED,{to:ue,from:Le}),xe(Le,Le,!0,!1)),(ae?Promise.resolve(ae):_e(ue,Le)).catch(ie=>Wa(ie)?Wa(ie,dn.NAVIGATION_GUARD_REDIRECT)?ie:Te(ie):De(ie,ue,Le)).then(ie=>{if(ie){if(Wa(ie,dn.NAVIGATION_GUARD_REDIRECT))return G(Nt({replace:j},N(ie.to),{state:typeof ie.to=="object"?Nt({},We,ie.to.state):We,force:P}),ne||ue)}else ie=ee(ue,Le,!0,j,We);return we(ue,Le,ie),ie})}function le(D,ne){const se=q(D,ne);return se?Promise.reject(se):Promise.resolve()}function ye(D){const ne=Xe.values().next().value;return ne&&typeof ne.runWithContext=="function"?ne.runWithContext(D):D()}function _e(D,ne){let se;const[Le,We,P]=wx(D,ne);se=Wd(Le.reverse(),"beforeRouteLeave",D,ne);for(const W of Le)W.leaveGuards.forEach(ue=>{se.push(Os(ue,D,ne))});const j=le.bind(null,D,ne);return se.push(j),de(se).then(()=>{se=[];for(const W of a.list())se.push(Os(W,D,ne));return se.push(j),de(se)}).then(()=>{se=Wd(We,"beforeRouteUpdate",D,ne);for(const W of We)W.updateGuards.forEach(ue=>{se.push(Os(ue,D,ne))});return se.push(j),de(se)}).then(()=>{se=[];for(const W of P)if(W.beforeEnter)if(Bo(W.beforeEnter))for(const ue of W.beforeEnter)se.push(Os(ue,D,ne));else se.push(Os(W.beforeEnter,D,ne));return se.push(j),de(se)}).then(()=>(D.matched.forEach(W=>W.enterCallbacks={}),se=Wd(P,"beforeRouteEnter",D,ne,ye),se.push(j),de(se))).then(()=>{se=[];for(const W of s.list())se.push(Os(W,D,ne));return se.push(j),de(se)}).catch(W=>Wa(W,dn.NAVIGATION_CANCELLED)?W:Promise.reject(W))}function we(D,ne,se){i.list().forEach(Le=>ye(()=>Le(D,ne,se)))}function ee(D,ne,se,Le,We){const P=q(D,ne);if(P)return P;const j=ne===Rs,W=rl?history.state:{};se&&(Le||j?o.replace(D.fullPath,Nt({scroll:j&&W&&W.scroll},We)):o.push(D.fullPath,We)),l.value=D,xe(D,ne,se,j),Te()}let he;function te(){he||(he=o.listen((D,ne,se)=>{if(!nt.listening)return;const Le=E(D),We=ce(Le,nt.currentRoute.value);if(We){G(Nt(We,{replace:!0,force:!0}),Le).catch(eu);return}u=Le;const P=l.value;rl&&dx($m(P.fullPath,se.delta),Vc()),_e(Le,P).catch(j=>Wa(j,dn.NAVIGATION_ABORTED|dn.NAVIGATION_CANCELLED)?j:Wa(j,dn.NAVIGATION_GUARD_REDIRECT)?(G(Nt(N(j.to),{force:!0}),Le).then(W=>{Wa(W,dn.NAVIGATION_ABORTED|dn.NAVIGATION_DUPLICATED)&&!se.delta&&se.type===Pf.pop&&o.go(-1,!1)}).catch(eu),Promise.reject()):(se.delta&&o.go(-se.delta,!1),De(j,Le,P))).then(j=>{j=j||ee(Le,P,!1),j&&(se.delta&&!Wa(j,dn.NAVIGATION_CANCELLED)?o.go(-se.delta,!1):se.type===Pf.pop&&Wa(j,dn.NAVIGATION_ABORTED|dn.NAVIGATION_DUPLICATED)&&o.go(-1,!1)),we(Le,P,j)}).catch(eu)}))}let Ae=Hl(),Oe=Hl(),$e;function De(D,ne,se){Te(D);const Le=Oe.list();return Le.length?Le.forEach(We=>We(D,ne,se)):console.error(D),Promise.reject(D)}function Se(){return $e&&l.value!==Rs?Promise.resolve():new Promise((D,ne)=>{Ae.add([D,ne])})}function Te(D){return $e||($e=!D,te(),Ae.list().forEach(([ne,se])=>D?se(D):ne()),Ae.reset()),D}function xe(D,ne,se,Le){const{scrollBehavior:We}=e;if(!rl||!We)return Promise.resolve();const P=!se&&fx($m(D.fullPath,0))||(Le||!se)&&history.state&&history.state.scroll||null;return Et().then(()=>We(D,ne,P)).then(j=>j&&cx(j)).catch(j=>De(j,D,ne))}const Ee=D=>o.go(D);let Je;const Xe=new Set,nt={currentRoute:l,listening:!0,addRoute:v,removeRoute:T,clearRoutes:t.clearRoutes,hasRoute:R,getRoutes:k,resolve:E,options:e,push:K,replace:U,go:Ee,back:()=>Ee(-1),forward:()=>Ee(1),beforeEach:a.add,beforeResolve:s.add,afterEach:i.add,onError:Oe.add,isReady:Se,install(D){D.component("RouterLink",Ux),D.component("RouterView",qx),D.config.globalProperties.$router=nt,Object.defineProperty(D.config.globalProperties,"$route",{enumerable:!0,get:()=>g(l)}),rl&&!Je&&l.value===Rs&&(Je=!0,K(o.location).catch(Le=>{}));const ne={};for(const Le in Rs)Object.defineProperty(ne,Le,{get:()=>l.value[Le],enumerable:!0});D.provide(Kc,nt),D.provide(Ch,Vv(ne)),D.provide(Mf,l);const se=D.unmount;Xe.add(D),D.unmount=function(){Xe.delete(D),Xe.size<1&&(u=Rs,he&&he(),he=null,l.value=Rs,Je=!1,$e=!1),se()}}};function de(D){return D.reduce((ne,se)=>ne.then(()=>ye(se)),Promise.resolve())}return nt}function Vx(){return Oo(Kc)}function Kx(e){return Oo(Ch)}const Ym=768;function xh(){const e=S(typeof window<"u"?window.innerWidth<Ym:!1);let t=null;function n(r){e.value=r.matches}return ss(()=>{t=window.matchMedia(`(max-width: ${Ym-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),yu(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const Yx={key:0,class:"desktop-sidebar"},Jx={class:"desktop-main"},Jm="codex-web-local.sidebar-width.v1",Qx=260,Xx=620,Qm=320,Zx=fn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=xh();function r(u){return Math.min(Xx,Math.max(Qx,u))}function o(){if(typeof window>"u")return Qm;const u=window.localStorage.getItem(Jm),d=Number(u);return Number.isFinite(d)?r(d):Qm}const a=S(o()),s=Y(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${a.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function i(u){typeof window>"u"||window.localStorage.setItem(Jm,String(u))}function l(u){u.preventDefault();const d=u.clientX,m=a.value,f=T=>{const k=T.clientX-d;a.value=r(m+k)},v=()=>{i(a.value),window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",v)};window.addEventListener("mousemove",f),window.addEventListener("mouseup",v)}return(u,d)=>(_(),B("div",{class:ct(["desktop-layout",{"is-mobile":g(n)}]),style:Zr(s.value)},[g(n)?(_(),Ze(Ws,{key:0,to:"body"},[Fe(bu,{name:"drawer"},{default:ht(()=>[e.isSidebarCollapsed?ve("",!0):(_(),B("div",{key:0,class:"mobile-drawer-backdrop",onClick:d[1]||(d[1]=m=>u.$emit("close-sidebar"))},[w("aside",{class:"mobile-drawer",onClick:d[0]||(d[0]=mt(()=>{},["stop"]))},[Cr(u.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):ve("",!0),g(n)?ve("",!0):(_(),B(at,{key:1},[e.isSidebarCollapsed?ve("",!0):(_(),B("aside",Yx,[Cr(u.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?ve("",!0):(_(),B("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),w("section",Jx,[Cr(u.$slots,"content",{},void 0)])],6))}}),Tt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n},eI=Tt(Zx,[["__scopeId","data-v-336d0207"]]);function Xm(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class $r extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function oo(e,t){if(typeof e=="string"&&e.length>0)return e;const n=Xm(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const o=Xm(r);return o&&typeof o.message=="string"&&o.message.length>0?o.message:typeof n.message=="string"&&n.message.length>0?n.message:typeof n.detail=="string"&&n.detail.length>0?n.detail:t}function ro(e,t,n){return e instanceof $r?e:e instanceof Error?new $r(e.message||t,{code:"unknown_error",method:n}):new $r(t,{code:"unknown_error",method:n})}function Jy(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function tI(e,t){const n={method:e,params:t??null};let r;try{r=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(i){throw new $r(i instanceof Error?i.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let o=null,a=null;try{a=await r.text(),o=JSON.parse(a)}catch{o=null}if(!r.ok){const i=oo(o,"")||(a==null?void 0:a.slice(0,500))||"",l=`RPC ${e} failed with HTTP ${r.status}`;throw new $r(i?`${l}: ${i}`:l,{code:"http_error",method:e,status:r.status})}const s=o;if(!s||typeof s!="object"||!("result"in s))throw new $r(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return s.result}async function nI(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new $r(oo(t,`Method catalog failed with HTTP ${e.status}`),{code:"http_error",method:"meta/methods",status:e.status});const n=t;return Array.isArray(n.data)?n.data:[]}function rI(e){const t=Jy(e);if(!t||typeof t.method!="string"||t.method.length===0)return null;const n=typeof t.atIso=="string"&&t.atIso.length>0?t.atIso:new Date().toISOString();return{method:t.method,params:t.params??null,atIso:n}}function Zm(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function oI(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const o=()=>{r!==null&&(window.clearTimeout(r),r=null)},a=(u,d)=>{if(n||r!==null)return;const m=Math.min(1e3*2**d,1e4);r=window.setTimeout(()=>{r=null,!n&&u()},m)},s=u=>{const d=rI(u);d&&e(d)},i=(u=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const d=new EventSource("/codex-api/events");let m=!1;d.onmessage=f=>{try{s(JSON.parse(f.data))}catch{}},d.addEventListener("ready",f=>{try{const v=f.data?JSON.parse(f.data):{ok:!0};Zm(e,v)}catch{Zm(e)}}),d.onerror=()=>{n||m||d.readyState===EventSource.CLOSED&&(m=!0,d.close(),a(()=>i(u+1),u))},t=()=>{m=!0,d.close()}},l=(u=0)=>{if(typeof WebSocket>"u"||n){i();return}t==null||t();const d=window.location.protocol==="https:"?"wss:":"ws:",m=new WebSocket(`${d}//${window.location.host}/codex-api/ws`);let f=!1,v=!1,T=window.setTimeout(()=>{f||n||v||(v=!0,m.close(),i())},2500);m.onopen=()=>{f=!0,o(),T!==null&&(window.clearTimeout(T),T=null)},m.onmessage=k=>{try{s(JSON.parse(String(k.data)))}catch{}},m.onerror=()=>{},m.onclose=()=>{if(T!==null&&(window.clearTimeout(T),T=null),!(n||v)){if(!f){i();return}a(()=>l(u+1),u)}},t=()=>{v=!0,T!==null&&(window.clearTimeout(T),T=null),m.close()}};return typeof WebSocket<"u"?l():i(),()=>{n=!0,o(),t==null||t()}}async function aI(e){let t;try{t=await fetch("/codex-api/server-requests/respond",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(r){throw new $r(r instanceof Error?r.message:"Failed to reply to server request",{code:"network_error",method:"server-requests/respond"})}let n=null;try{n=await t.json()}catch{n=null}if(!t.ok)throw new $r(oo(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function sI(){const e=await fetch("/codex-api/server-requests/pending");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new $r(oo(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Jy(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}async function it(e,t){try{return await tI(e,t)}catch(n){throw ro(n,`RPC ${e} failed`,e)}}function en(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},r=n.message;if(typeof r=="string"&&r.trim().length>0)return r;const o=n.error;return typeof o=="string"&&o.trim().length>0?o:t}function Ye(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function re(e){return typeof e=="string"&&e.length>0?e:null}function Yt(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function er(e){return typeof e=="boolean"?e:null}function jo(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}async function Ai(e){const t=await e.text();if(!t)return{};try{return JSON.parse(t)}catch{throw new Error(`Expected JSON response from ${e.url||"request"}`)}}function bc(e){const t=Ye(e);if(!t)return null;const n=re(t.id),r=re(t.kind),o=re(t.name),a=re(t.prompt),s=re(t.rrule),i=re(t.status);return!n||!o||!a||!s||r!=="heartbeat"&&r!=="cron"||i!=="ACTIVE"&&i!=="PAUSED"?null:{id:n,kind:r,name:o,prompt:a,rrule:s,status:i,targetThreadId:re(t.targetThreadId),cwds:Array.isArray(t.cwds)?t.cwds.filter(l=>typeof l=="string"&&l.trim().length>0):[],createdAtMs:Yt(t.createdAtMs),updatedAtMs:Yt(t.updatedAtMs),nextRunAtMs:Yt(t.nextRunAtMs)}}function Qy(e){if(Array.isArray(e))return e.flatMap(n=>{const r=bc(n);return r?[r]:[]});const t=bc(e);return t?[t]:[]}async function iI(){var o;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(oo(t,"Failed to load thread automations"));const n=Ye((o=Ye(t))==null?void 0:o.data),r={};if(!n)return r;for(const[a,s]of Object.entries(n)){const i=Qy(s);i.length>0&&(r[a]=i)}return r}async function lI(){var o;const e=await fetch("/codex-api/project-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(oo(t,"Failed to load project automations"));const n=Ye((o=Ye(t))==null?void 0:o.data),r={};if(!n)return r;for(const[a,s]of Object.entries(n)){const i=Qy(s);i.length>0&&(r[a]=i)}return r}async function uI(e){var o;const t=await fetch("/codex-api/thread-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(oo(n,"Failed to save thread automation"));const r=bc((o=Ye(n))==null?void 0:o.data);if(!r)throw new Error("Thread automation response was malformed");return r}async function cI(e){var o;const t=await fetch("/codex-api/project-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(oo(n,"Failed to save project automation"));const r=bc((o=Ye(n))==null?void 0:o.data);if(!r)throw new Error("Project automation response was malformed");return r}async function eg(e,t){const n=new URLSearchParams({threadId:e});t&&n.set("automationId",t);const r=await fetch(`/codex-api/thread-automation?${n.toString()}`,{method:"DELETE"}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error(oo(o,"Failed to delete thread automation"))}async function Xy(e,t){const n=new URLSearchParams({projectName:e});t&&n.set("automationId",t);const r=await fetch(`/codex-api/project-automation?${n.toString()}`,{method:"DELETE"}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error(oo(o,"Failed to delete project automation"))}async function dI(e,t){const n=await fetch("/codex-api/thread-automation/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,automationId:t})}),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(oo(r,"Failed to run thread automation"))}const fI=new Set(["node_modules","dist","build","out",".next",".nuxt","coverage","__pycache__",".cache",".turbo","target",".venv","venv",".idea",".vscode","output"]);function Zy(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>n.startsWith(".")||fI.has(n))}function hI(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=Array.isArray(t.files)?t.files:[],r=[];for(const o of n){if(!o||typeof o!="object"||Array.isArray(o))continue;const s=o.path,i=typeof s=="string"?s.trim():"";!i||Zy(i)||r.push({path:i})}return r}async function pI(e,t){await it("fuzzyFileSearch/sessionStart",{sessionId:t,roots:e})}async function mI(e,t){await it("fuzzyFileSearch/sessionUpdate",{sessionId:e,query:t})}async function gI(e){await it("fuzzyFileSearch/sessionStop",{sessionId:e}).catch(()=>{})}async function tg(e,t,n=20){const r=e.trim();if(!r)return[];const o=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:r,query:t.trim(),limit:n})}),a=await o.json();if(!o.ok){const u=en(a,"Failed to search files");throw new Error(u)}const s=a&&typeof a=="object"&&!Array.isArray(a)?a:{},i=Array.isArray(s.data)?s.data:[],l=[];for(const u of i){if(!u||typeof u!="object"||Array.isArray(u))continue;const m=u.path,f=typeof m=="string"?m.trim():"";!f||Zy(f)||l.push({path:f})}return l}async function vI(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to search threads");return r.data??{threadIds:[],indexedThreadCount:0}}function yI(e){const t=Ye(e);if(!t)return null;const n=re(t.id),r=re(t.threadId),o=re(t.cwd),a=re(t.shell);return!n||!r||!o||!a?null:{id:n,threadId:r,cwd:o,shell:a,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:er(t.truncated)??!1}}async function Il(e,t){const n=await fetch(e,t),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(oo(r,`Terminal request failed with HTTP ${n.status}`));return r}async function lU(e){var r;const t=await Il("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=yI((r=Ye(t))==null?void 0:r.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function wI(){const e=await Il("/codex-api/thread-terminal/status"),t=Ye(e);return{available:er(t==null?void 0:t.available)??!1,reason:re(t==null?void 0:t.reason)||null}}async function uU(e){const t=await Il(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=Ye(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(o=>{const a=Ye(o),s=re(a==null?void 0:a.label),i=re(a==null?void 0:a.value),l=re(a==null?void 0:a.source);return!s||!i||l!=="package"&&l!=="script"&&l!=="make"?[]:[{label:s,value:i,source:l}]})}async function cU(e,t){await Il("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function dU(e,t,n){await Il("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function fU(e){await Il("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}function bI(e,t=[],n=[]){if(e.trim().length>0)return e;const r=t.map(o=>(o.label??"").trim()).find(o=>o.length>0);return r||(n.some(o=>(o??"").trim().length>0)?"[Image]":"[Attachment]")}const ew=["none","minimal","low","medium","high","xhigh","max","ultra"];function kl(e){return typeof e=="string"&&ew.some(t=>t===e)}function TI(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function et(e){return TI(e)}function tw(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function SI(e){const t=et(e);return t.startsWith("/")||tw(t)}function kI(e){const t=et(e).replace(/[\\/]+/gu,"/");return tw(t)?t.toLowerCase():t}function Nr(e){const t=et(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function hl(e){const t=et(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function to(e){return Nr(e)||et(e)||"Projectless"}function Tc(e){const t=et(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function ng(e){return new Date(e*1e3).toISOString()}function CI(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return null;const t=e>1e11?e:e*1e3,n=new Date(t);return Number.isNaN(n.getTime())?null:n.toISOString()}function xI(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function II(e){const t=e.error;return typeof(t==null?void 0:t.message)=="string"?t.message.trim():""}const AI=/^##\s+(.+?):\s+(.+?)\s*$/,_I=/^#\s*files mentioned by the user\s*:?\s*$/i;function PI(e){var o,a;const t=e.split(`
27
+ `).findIndex(s=>_I.test(s.trim()));if(t<0)return[];const n=e.split(`
28
+ `).slice(t+1),r=[];for(const s of n){const i=s.trim();if(!i)continue;const l=i.match(AI);if(!l)break;const u=(o=l[1])==null?void 0:o.trim(),d=(a=l[2])==null?void 0:a.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");u&&d&&r.push({label:u,path:d})}return r}function EI(e){const t=/(?:^|\n)\s{0,3}#{0,6}\s*my request for codex\s*:?\s*/giu,n=Array.from(e.matchAll(t));if(n.length===0)return e.trim();const r=n.at(-1);if(!r||typeof r.index!="number")return e.trim();const o=r.index+r[0].length;return e.slice(o).trim()}const MI=new Set(["text","image","localImage","audio","localAudio","skill","mention"]);function nw(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function RI(e){return`/codex-local-file?path=${encodeURIComponent(e)}`}function LI(e){const t=e.trim();if(!t)return"";if(t.startsWith("data:")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/codex-local-image?"))return t;const n=t.replace(/\s+/gu,"");return/^[A-Za-z0-9+/]+={0,2}$/u.test(n)?`data:image/png;base64,${n}`:""}function jI(e){const t=e.aggregatedOutputSpill;if(!t||typeof t!="object"||Array.isArray(t))return;const n=t,r=typeof n.ref=="string"?n.ref.trim():"",o=i=>typeof i=="number"&&Number.isFinite(i)&&i>0?Math.trunc(i):0,a=o(n.totalBytes),s=o(n.omittedBytes);if(!(s<=0))return{ref:r,totalBytes:a,omittedBytes:s}}function NI(e){return e.replace(/&lt;/giu,"<").replace(/&gt;/giu,">").replace(/&amp;/giu,"&")}function qd(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?NI(n[1].trim()):""}function $I(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=qd(t,"current_time_iso"),r=qd(t,"instructions");return!n||!r?null:{automationId:qd(t,"automation_id"),currentTimeIso:n,instructions:r}}function OI(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],imageAttachmentIds:[],audioSources:[],mentions:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],r=[],o=[],a=[],s=[],i=[],l=[];for(const[f,v]of t.entries()){if(v.type==="text"&&typeof v.text=="string"&&v.text.length>0&&n.push(v.text),v.type==="image"&&"url"in v&&typeof v.url=="string"&&v.url.trim().length>0&&r.push(v.url.trim()),v.type==="image"&&!("url"in v)&&"fileId"in v&&typeof v.fileId=="string"&&v.fileId.trim().length>0&&o.push(v.fileId.trim()),v.type==="localImage"&&typeof v.path=="string"&&v.path.trim().length>0&&r.push(nw(v.path.trim())),v.type==="skill"){const k=typeof v.name=="string"?v.name.trim():"",R=typeof v.path=="string"?v.path.trim():"";k&&R&&i.push({name:k,path:R})}if(v.type==="audio"&&typeof v.url=="string"&&v.url.trim().length>0&&a.push(v.url.trim()),v.type==="localAudio"&&typeof v.path=="string"&&v.path.trim().length>0&&a.push(RI(v.path.trim())),v.type==="mention"){const k=typeof v.name=="string"?v.name.trim():"",R=typeof v.path=="string"?v.path.trim():"";k&&s.push({name:k,path:R})}const T=v.type;MI.has(T)||l.push({id:`${e}:user-content:${f}`,role:"user",text:"",messageType:`userContent.${T}`,rawPayload:xI(v),isUnhandled:!0})}const u=n.join(`
29
+ `),d=PI(u),m=$I(u);return{text:(m==null?void 0:m.instructions)??EI(u),images:r,skills:i,fileAttachments:d,imageAttachmentIds:o,audioSources:a,mentions:s,rawBlocks:l,isAutomationRun:m!==null,automationDisplayName:(m==null?void 0:m.automationId)||null}}function DI(e){var a;const t=e.replace(/\r\n/g,`
30
+ `).trim();if(!t)return null;const n=t.split(`
31
+ `),r=[],o=[];for(const s of n){const i=s.trim();if(!i){r.length===0&&o.push("");continue}const l=i.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(l){const u=(l[1]??" ").toLowerCase(),d=(a=l[2])==null?void 0:a.trim();if(!d)continue;let m="pending";u==="x"&&(m="completed"),(u==="~"||u===">"||u==="-")&&(m="inProgress"),r.push({step:d,status:m});continue}o.push(i)}return r.length===0?null:{explanation:o.join(`
32
+ `).trim()||void 0,steps:r}}function rg(e){if(!e)return 0;const t=e.replace(/\r\n/g,`
33
+ `),n=t.endsWith(`
34
+ `)?t.slice(0,-1):t;return n?n.split(`
35
+ `).length:0}function FI(e){let t=0,n=0;for(const r of e.replace(/\r\n/g,`
36
+ `).split(`
37
+ `))if(r&&!(r.startsWith("+++")||r.startsWith("---")||r.startsWith("@@"))){if(r.startsWith("+")){t+=1;continue}r.startsWith("-")&&(n+=1)}return{addedLineCount:t,removedLineCount:n}}function rw(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function Rf(e){const t=Array.isArray(e)?e:[],n=[];for(const r of t){const o=r,a=typeof o.path=="string"?o.path:"",s=typeof o.diff=="string"?o.diff:"",i=o.kind,l=i==null?void 0:i.type;if(!a||l!=="add"&&l!=="delete"&&l!=="update")continue;const u=l==="update"&&typeof(i==null?void 0:i.move_path)=="string"?i.move_path:null,d=l==="update"?FI(s):l==="add"?{addedLineCount:rg(s),removedLineCount:0}:{addedLineCount:0,removedLineCount:rg(s)};n.push({path:a,operation:l,movedToPath:u,diff:s,...d})}return n}function BI(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=OI(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0||t.skills.length>0||t.imageAttachmentIds.length>0||t.audioSources.length>0||t.mentions.length>0)&&n.push({id:e.id,role:"user",text:t.text,images:t.images,skills:t.skills.length>0?t.skills:void 0,fileAttachments:t.fileAttachments.length>0?t.fileAttachments:void 0,imageAttachmentIds:t.imageAttachmentIds.length>0?t.imageAttachmentIds:void 0,audioSources:t.audioSources.length>0?t.audioSources:void 0,mentions:t.mentions.length>0?t.mentions:void 0,messageType:e.type,clientId:typeof e.clientId=="string"&&e.clientId.length>0?e.clientId:null,isAutomationRun:t.isAutomationRun,automationDisplayName:t.automationDisplayName}),n.push(...t.rawBlocks),n.length===0?[]:n}if(e.type==="imageView"){const t=typeof e.path=="string"?e.path.trim():"";return t?[{id:e.id,role:"assistant",text:"",images:[nw(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?LI(t.result):"";return n?[{id:e.id,role:"assistant",text:"",images:[n],messageType:"imageView"}]:[]}}if(e.type==="reasoning"){const t=e,n=Array.isArray(t.summary)?t.summary.filter(i=>typeof i=="string"):[],r=Array.isArray(t.content)?t.content.filter(i=>typeof i=="string"):[],o=n.join(`
38
+ `).trim(),s=r.join(`
39
+ `).trim()||o;return s?[{id:e.id,role:"assistant",text:s,messageType:"reasoning",reasoning:{summary:n,content:r}}]:[]}if(e.type==="mcpToolCall"){const t=e,n=typeof t.server=="string"?t.server:"",r=typeof t.tool=="string"?t.tool:"";if(!n&&!r)return[];const o=t.status;let a="completed";const s=typeof o=="string"?o:o==null?void 0:o.type;(s==="inProgress"||s==="in_progress")&&(a="inProgress"),(s==="failed"||s==="error")&&(a="failed");const i=typeof t.error=="object"&&t.error!==null?String(t.error.message??""):"",l=typeof t.durationMs=="number"?t.durationMs:null;return[{id:e.id,role:"system",text:r,messageType:"toolCall",toolCall:{server:n,tool:r,status:a,error:i,durationMs:l}}]}if(e.type==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:DI(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=UI(t.status),r=typeof t.command=="string"?t.command:"",o=typeof t.cwd=="string"?t.cwd:null,a=typeof t.aggregatedOutput=="string"?t.aggregatedOutput:"",s=typeof t.exitCode=="number"?t.exitCode:null;return[{id:e.id,role:"system",text:r,messageType:"commandExecution",commandExecution:{command:r,cwd:o,status:n,aggregatedOutput:a,exitCode:s,outputSpill:jI(t)}}]}if(e.type==="fileChange"){const t=Rf(e.changes),n=rw(e.status);return t.length===0||n!=="completed"?[]:[{id:e.id,role:"system",text:"",messageType:"fileChange",fileChangeStatus:n,fileChanges:t}]}return e.type==="contextCompaction"?[{id:e.id,role:"system",text:"",messageType:"compaction.done"}]:[]}function UI(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function zI(e){const t=e,n=[t.name,t.title,e.preview];for(const r of n)if(typeof r=="string"&&r.trim().length>0)return r.trim();return""}function HI(e){const t=zI(e);return t.length>0?t:"Untitled thread"}function Ih(e){return(e==null?void 0:e.status)==="inProgress"}function Ah(e){const n=e.externalSession;if(!n||typeof n!="object"||Array.isArray(n))return null;const r=n,o=typeof r.origin=="string"&&r.origin.trim().length>0?r.origin.trim():"";return o?{origin:o,active:r.active===!0,lastWriteAt:typeof r.lastWriteAt=="string"?r.lastWriteAt:null}:null}function WI(e){var t;return((t=Ah(e))==null?void 0:t.active)===!0}function ow(e){const t=e;if(t.inProgress===!0||t.status==="inProgress"||t.turnStatus==="inProgress")return!0;const n=t.status;if(n&&typeof n=="object"){const a=n.type;if(a==="active"||a==="inProgress")return!0}const o=(Array.isArray(e.turns)?e.turns:[]).at(-1);return Ih(o)||WI(e)}function aw(e){const t=e,n=et(typeof t.cwd=="string"?t.cwd:e.cwd),r=kI(n),o=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||r.includes("/.codex/worktrees/")||r.includes("/.git/worktrees/");return{id:e.id,title:HI(e),projectName:to(n),cwd:n,hasWorktree:o,createdAtIso:ng(e.createdAt),updatedAtIso:ng(e.updatedAt),preview:e.preview,historyMode:t.historyMode==="legacy"?"legacy":"paginated",originator:typeof t.originator=="string"&&t.originator.trim().length>0?t.originator.trim():null,unread:!1,inProgress:ow(e),externalSession:Ah(e)}}function qI(e){return aw(e.thread)}function GI(e){const t=new Map;for(const n of e){const r=t.get(n.projectName);r?r.push(n):t.set(n.projectName,[n])}return Array.from(t.entries()).map(([n,r])=>({projectName:n,threads:r.sort((o,a)=>new Date(a.updatedAtIso).getTime()-new Date(o.updatedAtIso).getTime())})).sort((n,r)=>{var s,i;const o=new Date(((s=n.threads[0])==null?void 0:s.updatedAtIso)??0).getTime();return new Date(((i=r.threads[0])==null?void 0:i.updatedAtIso)??0).getTime()-o})}function VI(e){const t=e.data.map(aw);return GI(t)}const KI=["<subagent_notification>","<environment_context>"];function YI(e,t){const n=e.text.trimStart();return KI.some(r=>n.startsWith(r))?!0:t<=0?!1:(e.clientId??null)===null}function Tu(e,t=0){return iw(sw(e,t))}function sw(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],r=[];for(let o=0;o<n.length;o++){const a=t+o,s=n[o],i=typeof(s==null?void 0:s.id)=="string"?s.id.trim():"",l=i.length>0?i:void 0,u=Array.isArray(s.items)?s.items:[],d=CI(s==null?void 0:s.startedAt),m=[];for(const T of u)for(const k of BI(T))m.push({...k,turnId:l,turnIndex:a,turnStartedAtIso:d??void 0});let f=0;for(const T of m)T.role!=="user"||T.isUnhandled===!0||(YI(T,f)&&(T.isAgentNote=!0),f+=1);const v=II(s);if(s.status==="failed"&&v){const T=l??`turn-${a}`;m.push({id:`${T}-error`,role:"system",text:v,messageType:"turnError",turnId:l,turnIndex:a,turnStartedAtIso:d??void 0})}r.push(...m)}return r}function iw(e){return ZI(XI(e))}const Gd=30;function JI(){return new Promise(e=>{setTimeout(e,0)})}async function QI(e,t=0,n){const r=Array.isArray(e.thread.turns)?e.thread.turns:[];if(!n||r.length<=Gd)return Tu(e,t);let o=[],a=!0;for(let s=r.length;s>0;s-=Gd){const i=Math.max(0,s-Gd),l={...e,thread:{...e.thread,turns:r.slice(i,s)}},u=sw(l,t+i);o=a?u:[...u,...o],a=!1,n(o),i>0&&await JI()}return iw(o)}function XI(e){var n;let t=-1;for(let r=e.length-1;r>=0;r-=1)if(((n=e[r])==null?void 0:n.messageType)==="compaction.done"){t=r;break}return t<0?e:e.filter((r,o)=>r.messageType!=="compaction.done"||o===t)}function ZI(e){var s;let t=-1;for(let i=0;i<e.length;i+=1)if(((s=e[i])==null?void 0:s.messageType)==="compaction.done"){t=i;break}if(t<0)return e;const n=e[t],r=n.turnIndex;let o=-1;for(let i=0;i<e.length;i+=1){const l=e[i];if((l==null?void 0:l.turnIndex)===r&&(l==null?void 0:l.role)==="user"&&(l==null?void 0:l.isAgentNote)!==!0){o=i;break}}if(o<0||t<=o)return e;const a=e.filter((i,l)=>l!==t);return a.splice(o+1,0,n),a}function _h(e){if(ow(e.thread))return!0;const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Ih(t.at(-1))}function lw(e){return Ah(e.thread)}function Ph(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];for(let n=t.length-1;n>=0;n-=1){const r=t[n];if(Ih(r)&&typeof r.id=="string"&&r.id.trim().length>0)return r.id.trim()}return""}const eA=50,tA=3e4,Zi=new Map,nA=5e3;function Vd(e){return e&&e.length>0?e:null}function Kd(e){return e&&e.length>0?e:null}function rA(e){return kl(e)?e:""}function oA(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}function Eh(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],r={};for(let o=0;o<n.length;o+=1){const a=t+o,s=n[o];typeof(s==null?void 0:s.id)!="string"||s.id.length===0||(r[s.id]=a)}return r}function Mh(e){const t=Ye(e),n=t==null?void 0:t.threadTurnStartIndex;return Math.max(0,Math.floor(typeof n=="number"?n:0))}function Lf(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.id;if(typeof r=="string"&&r.length>0)return r}return""}function aA(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.cwd;if(typeof r=="string"&&r.length>0)return r}return""}function cu(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}function Yc(e){var o,a;const t=Ye(e);if(!t)return"";const n=((o=re(t.modelProvider))==null?void 0:o.trim())??"";if(n)return n;const r=Ye(t.thread);return((a=re(r==null?void 0:r.modelProvider))==null?void 0:a.trim())??""}function og(e){var t;if(!e)return null;try{const n=new URL(e,"http://localhost");if(n.pathname!=="/codex-local-image")return null;const r=((t=n.searchParams.get("path"))==null?void 0:t.trim())??"";return r.length>0?r:null}catch{return null}}function sA(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
40
+ `;for(const r of t)n+=`
41
+ ## ${r.label}: ${r.path}
42
+ `;return`${n}
43
+ ## My request for Codex:
44
+
45
+ ${e}
46
+ `}function iA(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function lA(e){try{const t=(e==null?void 0:e.trim())??"",n=t?`/codex-api/provider-models?provider=${encodeURIComponent(t)}`:"/codex-api/provider-models",r=await fetch(n,{signal:AbortSignal.timeout(nA)});let o=null;try{o=await r.json()}catch{o=null}if(r.ok&&Array.isArray(o==null?void 0:o.data))return{ids:o.data.map(a=>typeof a=="string"?a.trim():"").filter((a,s,i)=>a.length>0&&i.indexOf(a)===s),exclusive:o.exclusive===!0}}catch{}return null}function uA(e){var s;const t=Ye(e);if(!t)return null;const n=((s=re(t.id??t.model))==null?void 0:s.trim())??"";if(!n)return null;const r=t.supportedReasoningEfforts??t.supported_reasoning_efforts,o=Array.isArray(r)?r.flatMap(i=>{const l=Ye(i),u=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return kl(u)?[u]:[]}).filter((i,l,u)=>u.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:o,defaultReasoningEffort:kl(a)?a:null}}function ag(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function cA(e={}){const t=e.includeProviderModels!==!1,n=t?await lA(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(ag);const r=await it("model/list",{}),o=[];for(const a of r.data){const s=uA(a);!s||o.some(i=>i.id===s.id)||o.push(s)}if(!t||!n)return o;for(const a of n.ids)o.some(s=>s.id===a)||o.push(ag(a));return o}async function dA(e={}){return(await cA(e)).map(t=>t.id)}async function fA(){const e=await it("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=rA(e.config.model_reasoning_effort),o=oA(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:o}}async function hA(e,t,n){var l;const r=(t==null?void 0:t.trim())??"";if(r)return{model:r,reasoningEffort:e==="plan"?Vd(n):Kd(n)};let o=null;try{o=await fA()}catch{o=null}const a=(o==null?void 0:o.model.trim())??"";if(a)return{model:a,reasoningEffort:e==="plan"?Vd(n??(o==null?void 0:o.reasoningEffort)):Kd(n??(o==null?void 0:o.reasoningEffort))};let s=[];try{s=await dA()}catch{s=[]}const i=((l=s.find(u=>u.trim().length>0))==null?void 0:l.trim())??"";if(i)return{model:i,reasoningEffort:e==="plan"?Vd(n??(o==null?void 0:o.reasoningEffort)):Kd(n??(o==null?void 0:o.reasoningEffort))};throw new Error(`${e==="plan"?"Plan":"Default"} mode requires an available model. Wait for models to load and try again.`)}async function pA(e,t){const n=await it("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:VI(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function mA(e){const t=await it("thread/read",{threadId:e,includeTurns:!1});return qI(t)}async function gA(e){const t=await it("thread/read",{threadId:e,includeTurns:!0}),n=Mh(t),r=Tu(t,n);return{model:cu(t),modelProvider:Yc(t),messages:r,inProgress:_h(t),activeTurnId:Ph(t),hasMoreOlder:n>0,turnIndexByTurnId:Eh(t,n),externalSession:lw(t)}}async function vA(e,t,n=10){const r=new URLSearchParams({threadId:e,beforeTurnId:t,limit:String(n)}),o=await fetch(`/codex-api/thread-turn-page?${r.toString()}`);if(!o.ok)throw new Error(`Older thread page request failed with ${o.status}`);const a=await o.json();if(a.olderTurnsUnavailable===!0)throw new $r("当前 codex-cli 版本暂不支持加载更早的消息",{code:"older_turns_unavailable",method:"thread/turns/list"});if(!a.result)throw new Error("Older thread page response did not include a thread result");const s=Math.max(0,Math.floor(typeof a.startTurnIndex=="number"?a.startTurnIndex:0));return{messages:Tu(a.result,s),inProgress:_h(a.result),activeTurnId:Ph(a.result),hasMoreOlder:a.hasMoreOlder===!0,startTurnIndex:s,turnIndexByTurnId:Eh(a.result,s)}}async function sg(e=null,t=eA){try{return await pA(e,t)}catch(n){throw ro(n,"Failed to load thread groups","thread/list")}}async function yA(e){try{return await mA(e)}catch(t){throw ro(t,`Failed to load thread ${e}`,"thread/read")}}async function jf(e){try{return await gA(e)}catch(t){throw ro(t,`Failed to load thread ${e}`,"thread/read")}}async function wA(e,t,n){try{return await vA(e,t,n)}catch(r){throw ro(r,`Failed to load earlier messages for thread ${e}`,"thread/read")}}async function hU(e){const t=new URLSearchParams({ref:e}),n=await fetch(`/codex-api/command-output?${t.toString()}`);if(!n.ok)throw new Error(`Command output request failed with ${n.status}`);const r=await n.json();return typeof r.text=="string"?r.text:""}async function Nf(e,t){const n=Zi.get(e);if(n)return n;const r=(async()=>{const a=await it("thread/resume",{threadId:e}),s=Mh(a),i=await QI(a,s,t);return{model:cu(a),modelProvider:Yc(a),messages:i,inProgress:_h(a),activeTurnId:Ph(a),hasMoreOlder:s>0,turnIndexByTurnId:Eh(a,s),externalSession:lw(a)}})();Zi.set(e,r);const o=globalThis.setTimeout(()=>{Zi.get(e)===r&&Zi.delete(e)},tA);return r.finally(()=>{globalThis.clearTimeout(o),globalThis.setTimeout(()=>{Zi.get(e)===r&&Zi.delete(e)},2e3)}).catch(()=>{}),r}async function bA(e){await it("thread/archive",{threadId:e})}async function TA(e){await it("thread/unarchive",{threadId:e})}async function SA(e){await it("thread/compact/start",{threadId:e})}async function kA(e,t){await it("thread/name/set",{threadId:e,name:t})}async function Yd(e,t){const n=await it("thread/revert",{threadId:e,beforeTurnId:t});if(!n.turnsBackwardsCursor)return[];const r=await it("thread/turns/list",{threadId:e,cursor:n.turnsBackwardsCursor,sortDirection:"desc",limit:200,itemsView:"full"});return Tu({thread:{...n.thread,turns:[...r.data].reverse()}},0)}async function CA(e){const t=await it("thread/turns/list",{threadId:e,limit:1e4,sortDirection:"desc",itemsView:"notLoaded"});return{turnIds:(Array.isArray(t.data)?t.data:[]).map(o=>{var a;return re((a=Ye(o))==null?void 0:a.id)}).filter(o=>typeof o=="string"&&o.length>0),complete:!re(t.nextCursor)}}async function ig(e,t){try{const n={};typeof e=="string"&&e.trim().length>0&&(n.cwd=e.trim()),typeof t=="string"&&t.trim().length>0&&(n.model=t.trim());const r=await it("thread/start",n),o=Lf(r);if(!o)throw new Error("thread/start did not return a thread id");return{threadId:o,model:cu(r),modelProvider:Yc(r)}}catch(n){throw ro(n,"Failed to start a new thread","thread/start")}}async function Jd(e,t,n){if(t===void 0||typeof t=="object"&&t!==null){const o=t&&typeof t=="object"?(t.beforeTurnId??"").trim():"";try{const a=await it("thread/fork",{threadId:e,persistExtendedHistory:!0,...o?{beforeTurnId:o}:{}}),s=Lf(a);if(!s)throw new Error("thread/fork did not return a thread id");return{threadId:s,cwd:aA(a),model:cu(a),messages:Tu(a,Mh(a))}}catch(a){throw ro(a,`Failed to fork thread ${e}`,"thread/fork")}}try{const o=e.trim();if(!o)throw new Error("thread/fork requires threadId");const a={threadId:o};typeof t=="string"&&t.trim().length>0&&(a.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(a.model=n.trim());const s=await it("thread/fork",a),i=Lf(s);if(!i)throw new Error("thread/fork did not return a thread id");return{threadId:i,model:cu(s),modelProvider:Yc(s)}}catch(o){throw ro(o,`Failed to fork thread ${e}`,"thread/fork")}}function uw(e,t,n,r=[]){const o=[];for(const u of t){const d=og(u.trim());d&&o.push({label:iA(d),path:d,fsPath:d})}const a=[...r,...o],s=a.filter((u,d)=>a.findIndex(m=>m.fsPath===u.fsPath)===d),l=[{type:"text",text:sA(bI(e,s,t),s)}];for(const u of t){const d=u.trim();if(!d)continue;const m=og(d);if(m){l.push({type:"localImage",path:m});continue}l.push({type:"image",url:d,image_url:d})}if(n)for(const u of n)l.push({type:"skill",name:u.name,path:u.path});return{input:l,dedupedFileAttachments:s}}function cw(){const e=typeof globalThis>"u"?void 0:globalThis.crypto;if(e&&typeof e.randomUUID=="function")try{return e.randomUUID()}catch{}const t="0123456789abcdef";let n="";for(let r=0;r<36;r+=1){if(r===8||r===13||r===18||r===23){n+="-";continue}if(r===14){n+="4";continue}const o=Math.floor(Math.random()*16);n+=r===19?t[o&3|8]:t[o]}return n}async function Qd(e,t,n=[],r,o,a,s=[],i,l){var u;try{const d=(r==null?void 0:r.trim())??"",{input:m,dedupedFileAttachments:f}=uw(t,n,a,s),v=f.map(R=>({label:R.label,path:R.path,fsPath:R.fsPath})),T={threadId:e,input:m,clientUserMessageId:cw()};if(typeof l=="string"&&l.trim().length>0&&(T.turnTrigger=l.trim()),v.length>0&&(T.attachments=v),d&&(T.model=d),typeof o=="string"&&o.length>0&&(T.effort=o),i){const R=await hA(i,d,o);T.collaborationMode={mode:i,settings:{model:R.model,reasoning_effort:R.reasoningEffort,developer_instructions:null}}}const k=await it("turn/start",T);return typeof((u=k==null?void 0:k.turn)==null?void 0:u.id)=="string"?k.turn.id.trim():""}catch(d){throw ro(d,`Failed to start turn for thread ${e}`,"turn/start")}}async function xA(e,t,n,r=[],o,a=[]){const s=e.trim(),i=t.trim();try{const{input:l}=uw(n,r,o,a),u=await it("turn/steer",{threadId:s,input:l,expectedTurnId:i,clientUserMessageId:cw()});return typeof(u==null?void 0:u.turnId)=="string"&&u.turnId.trim().length>0?u.turnId.trim():i}catch(l){throw ro(l,`Failed to steer turn for thread ${s}`,"turn/steer")}}async function IA(e,t){const n=e.trim(),r=(t==null?void 0:t.trim())||"";if(n)try{if(!r)throw new Error("turn/interrupt requires turnId");await it("turn/interrupt",{threadId:n,turnId:r})}catch(o){throw ro(o,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}const AA=5e3,_A=5*6e4,PA=3e3,dw=new Map,Xd=new Map,lg=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function EA(e){return kl(e)?e:""}function MA(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}async function RA(e){const t=e==="fast"?"fast":"standard";await it("config/batchWrite",{edits:[{keyPath:"features.fast_mode",value:!0,mergeStrategy:"upsert"},{keyPath:"service_tier",value:t==="fast"?"fast":null,mergeStrategy:t==="fast"?"upsert":"replace"}],filePath:null,expectedVersion:null})}async function ug(){return await(await fetch("/codex-api/free-mode/status")).json()}async function cg(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function dg(e){return await(await fetch("/codex-api/free-mode/custom-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e})})).json()}async function el(e,t,n){return await(await fetch("/codex-api/free-mode/custom-provider",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:e,apiKey:t,wireApi:n==null?void 0:n.wireApi,provider:n==null?void 0:n.provider})})).json()}async function fg(e){const t=Xd.get(e);if(t)return t;const n=(async()=>{let r=null;try{const o=e?`/codex-api/provider-models?provider=${encodeURIComponent(e)}`:"/codex-api/provider-models",a=await fetch(o,{signal:AbortSignal.timeout(AA)});let s=null;try{s=await a.json()}catch{s=null}a.ok&&Array.isArray(s==null?void 0:s.data)&&(r={ids:s.data.map(i=>typeof i=="string"?i.trim():"").filter((i,l,u)=>i.length>0&&u.indexOf(i)===l),exclusive:s.exclusive===!0})}catch{}return dw.set(e,{fetchedAt:Date.now(),result:r}),r})();Xd.set(e,n);try{return await n}finally{Xd.delete(e)}}async function LA(e){const n=(e==null?void 0:e.trim())??"",r=dw.get(n);if(r){const o=r.result===null?PA:_A;if(Date.now()-r.fetchedAt<o)return r.result;if(r.result!==null)return fg(n).catch(()=>{}),r.result}return await fg(n)}function jA(e){var s;const t=Ye(e);if(!t)return null;const n=((s=re(t.id??t.model))==null?void 0:s.trim())??"";if(!n)return null;const r=t.supportedReasoningEfforts??t.supported_reasoning_efforts,o=Array.isArray(r)?r.flatMap(i=>{const l=Ye(i),u=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return kl(u)?[u]:[]}).filter((i,l,u)=>u.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:o,defaultReasoningEffort:kl(a)?a:null}}function hg(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function NA(e={}){const t=e.includeProviderModels!==!1,n=t?await LA(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(hg);const r=await it("model/list",{}),o=[];for(const a of r.data){const s=jA(a);!s||o.some(i=>i.id===s.id)||o.push(s)}if(!t||!n)return o;for(const a of n.ids)o.some(s=>s.id===a)||o.push(hg(a));return o}async function $A(){const e=await it("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=EA(e.config.model_reasoning_effort),o=MA(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:o}}function OA(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function DA(){try{const e=await it("collaborationMode/list",{}),t=new Set,n=[];for(const r of e.data){const o=r.mode;o!=="default"&&o!=="plan"&&o!=="execplans"||t.has(o)||(t.add(o),n.push({value:o,label:OA(r.name||o)||(o==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of lg)t.has(r.value)||n.push(r);return n.sort((r,o)=>r.value===o.value?0:r.value==="default"?-1:1)}}catch{}return lg}async function FA(){return nI()}function BA(e){const t=Ye(e);if(!t)return null;const n=re(t.event??t.name??t.hookName),r=re(t.command??t.cmd);return!n||!r?null:{event:n,command:r,timeout:Yt(t.timeout??t.timeout_ms),enabled:er(t.enabled??t.active)}}async function UA(){const e=await it("hooks/list",{}),t=[];for(const n of e.data??[]){const r=Ye(n);r&&t.push({cwd:re(r.cwd)??"",hooks:Array.isArray(r.hooks)?r.hooks.map(BA).filter(o=>o!==null):[],warnings:jo(r.warnings),errors:jo(r.errors)})}return t}async function pU(e){await it("marketplace/add",{source:e})}async function mU(e){await it("marketplace/remove",{marketplaceName:e})}async function gU(){const e=await it("marketplace/upgrade",{});return{selectedMarketplaces:jo(e.selectedMarketplaces??e.selected_marketplaces),upgradedRoots:jo(e.upgradedRoots??e.upgraded_roots),errors:jo(e.errors)}}function zA(e){const t=Ye(e);if(!t)return null;const n=re(t.remotePluginId??t.remote_plugin_id??t.id);return n?{remotePluginId:n,pluginName:re(t.pluginName??t.plugin_name??t.name)??n,shareUrl:re(t.shareUrl??t.share_url??t.url)??"",createdAt:re(t.createdAt??t.created_at)??""}:null}async function vU(e){const t=await it("plugin/share/save",{pluginPath:e});return{remotePluginId:re(t.remotePluginId??t.remote_plugin_id)??"",shareUrl:re(t.shareUrl??t.share_url??t.url)??""}}async function yU(){const e=await it("plugin/share/list",{});return(e.data??e.shares??[]).map(zA).filter(n=>n!==null)}async function wU(e){await it("plugin/share/delete",{remotePluginId:e})}async function bU(e){await it("plugin/share/checkout",{remotePluginId:e})}function fw(e){const t=Ye(e);if(!t)return null;const n=re(t.id),r=re(t.name);return!n||!r?null:{id:n,name:r,description:re(t.description)??"",installUrl:re(t.installUrl??t.install_url)??"",needsAuth:er(t.needsAuth??t.needs_auth)??!1}}function HA(e){const t=Ye(e);if(!t)return null;const n=re(t.name),r=re(t.path);if(!n||!r)return null;const o=Ye(t.interface);return{name:n,path:r,description:re(t.description)??"",enabled:er(t.enabled)??!0,displayName:re((o==null?void 0:o.displayName)??(o==null?void 0:o.display_name))??n,shortDescription:re(t.shortDescription??t.short_description)??""}}function hw(e,t={}){const n=Ye(e);if(!n)return null;const r=re(n.id),o=re(n.name);if(!r||!o)return null;const a=Ye(n.interface),s=Ye(n.source),i=re(s==null?void 0:s.type)??"",l=re(s==null?void 0:s.path),u=re(s==null?void 0:s.url)??"",d=i==="remote"?t.name??null:null,m=t.path??(i==="local"?l:null),f=re((a==null?void 0:a.displayName)??(a==null?void 0:a.display_name))??o,v=re((a==null?void 0:a.shortDescription)??(a==null?void 0:a.short_description)),T=re((a==null?void 0:a.longDescription)??(a==null?void 0:a.long_description))??"";return{id:r,name:o,displayName:f,description:v??T,longDescription:T,developerName:re((a==null?void 0:a.developerName)??(a==null?void 0:a.developer_name))??"",category:re(a==null?void 0:a.category)??"",marketplaceName:t.name??"",marketplaceDisplayName:t.displayName??t.name??"",marketplacePath:m,remoteMarketplaceName:d,sourceType:i,sourceUrl:u,installed:er(n.installed)??!1,enabled:er(n.enabled)??!0,installPolicy:re(n.installPolicy??n.install_policy)??"",authPolicy:re(n.authPolicy??n.auth_policy)??"",logoUrl:re((a==null?void 0:a.logoUrl)??(a==null?void 0:a.logo_url))??"",logoPath:re(a==null?void 0:a.logo)??"",composerIconUrl:re((a==null?void 0:a.composerIconUrl)??(a==null?void 0:a.composer_icon_url))??"",composerIconPath:re((a==null?void 0:a.composerIcon)??(a==null?void 0:a.composer_icon))??"",brandColor:re((a==null?void 0:a.brandColor)??(a==null?void 0:a.brand_color))??"",capabilities:jo(a==null?void 0:a.capabilities),defaultPrompt:jo((a==null?void 0:a.defaultPrompt)??(a==null?void 0:a.default_prompt)),screenshotUrls:jo((a==null?void 0:a.screenshotUrls)??(a==null?void 0:a.screenshot_urls)),screenshots:jo(a==null?void 0:a.screenshots),websiteUrl:re((a==null?void 0:a.websiteUrl)??(a==null?void 0:a.website_url))??"",privacyPolicyUrl:re((a==null?void 0:a.privacyPolicyUrl)??(a==null?void 0:a.privacy_policy_url))??"",termsOfServiceUrl:re((a==null?void 0:a.termsOfServiceUrl)??(a==null?void 0:a.terms_of_service_url))??""}}function WA(e,t=0){const n=Ye(e);if(!n)return null;const r=re(n.id),o=re(n.name);if(!r||!o)return null;const a=Ye(n.branding),s=Ye(n.appMetadata??n.app_metadata);return{id:r,name:o,description:re(n.description)??re((s==null?void 0:s.seoDescription)??(s==null?void 0:s.seo_description))??"",logoUrl:re(n.logoUrl??n.logo_url)??"",logoUrlDark:re(n.logoUrlDark??n.logo_url_dark)??"",distributionChannel:re(n.distributionChannel??n.distribution_channel)??"",installUrl:re(n.installUrl??n.install_url)??"",isAccessible:er(n.isAccessible??n.is_accessible)??!1,isEnabled:er(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:jo(n.pluginDisplayNames??n.plugin_display_names),category:re(a==null?void 0:a.category)??"",developer:re(a==null?void 0:a.developer)??re(s==null?void 0:s.developer)??"",website:re(a==null?void 0:a.website)??"",privacyPolicy:re((a==null?void 0:a.privacyPolicy)??(a==null?void 0:a.privacy_policy))??"",termsOfService:re((a==null?void 0:a.termsOfService)??(a==null?void 0:a.terms_of_service))??"",catalogRank:t}}function qA(e){const t=Ye(e);if(!t)return null;const n=re(t.name);if(!n)return null;const r=Ye(t.tools)??{},o=Object.entries(r).map(([l,u])=>{const d=Ye(u);return{name:re(d==null?void 0:d.name)??l,title:re(d==null?void 0:d.title)??"",description:re(d==null?void 0:d.description)??""}}),a=Array.isArray(t.resources)?t.resources.map(l=>{const u=Ye(l);return{name:re(u==null?void 0:u.name)??"",title:re(u==null?void 0:u.title)??"",uri:re(u==null?void 0:u.uri)??"",description:re(u==null?void 0:u.description)??""}}).filter(l=>l.name||l.uri):[],s=t.resourceTemplates??t.resource_templates,i=Array.isArray(s)?s.map(l=>{const u=Ye(l);return{name:re(u==null?void 0:u.name)??"",title:re(u==null?void 0:u.title)??"",uriTemplate:re((u==null?void 0:u.uriTemplate)??(u==null?void 0:u.uri_template))??"",description:re(u==null?void 0:u.description)??""}}).filter(l=>l.name||l.uriTemplate):[];return{name:n,authStatus:re(t.authStatus??t.auth_status)??"unsupported",tools:o,resources:a,resourceTemplates:i}}async function TU(e){const t={};e&&e.length>0&&(t.cwds=e);const n=await it("plugin/list",t),r=[];for(const o of n.marketplaces??[]){const a=Ye(o);if(!a)continue;const s=Ye(a.interface),i={name:re(a.name)??"",displayName:re((s==null?void 0:s.displayName)??(s==null?void 0:s.display_name))??"",path:re(a.path)},l=Array.isArray(a.plugins)?a.plugins:[];for(const u of l){const d=hw(u,i);d&&r.push(d)}}return r}async function SU(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await it("plugin/read",t),r=Ye(n.plugin);if(!r)throw new Error("Plugin detail response is empty");const o=hw(r.summary,{name:re(r.marketplaceName)??e.marketplaceName,displayName:e.marketplaceDisplayName,path:re(r.marketplacePath)??e.marketplacePath})??e;return{summary:o,description:re(r.description)??o.longDescription,apps:Array.isArray(r.apps)?r.apps.map(fw).filter(a=>a!==null):[],skills:Array.isArray(r.skills)?r.skills.map(HA).filter(a=>a!==null):[],mcpServers:jo(r.mcpServers??r.mcp_servers)}}async function kU(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await it("plugin/install",t),r=n.appsNeedingAuth??n.apps_needing_auth??[];return{authPolicy:re(n.authPolicy??n.auth_policy)??"",appsNeedingAuth:r.map(fw).filter(o=>o!==null)}}async function CU(e){await it("plugin/uninstall",{pluginId:e})}async function xU(e,t){await it("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function IU(e){const t=[];let n=null,r=0;do{const o={limit:100};n&&(o.cursor=n),e&&(o.threadId=e);const a=await it("app/list",o);for(const s of a.data??[]){const i=WA(s,r);i&&t.push(i),r+=1}n=re(a.nextCursor??a.next_cursor)}while(n);return t}async function AU(e,t){await it("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function _U(){const e=[];let t=null;do{const n={};t&&(n.cursor=t);const r=await it("mcpServerStatus/list",n);for(const o of r.data??[]){const a=qA(o);a&&e.push(a)}t=re(r.nextCursor??r.next_cursor)}while(t);return e}async function PU(){await it("config/mcpServer/reload",{})}async function EU(e){const t=await it("mcpServer/oauth/login",{name:e});return{authorizationUrl:re(t.authorizationUrl??t.authorization_url)??""}}async function MU(){const e=await fetch("/codex-api/composio/status");if(!e.ok)throw new Error(`Failed to load Composio status (${e.status})`);return await e.json()}async function RU(e="",t=null,n=50){const r=new URLSearchParams;e.trim()&&r.set("query",e.trim()),t&&r.set("cursor",t),n&&Number.isFinite(n)&&r.set("limit",String(Math.max(1,Math.floor(n))));const o=r.toString(),a=await fetch(`/codex-api/composio/connectors${o?`?${o}`:""}`);if(!a.ok)throw new Error(`Failed to list Composio connectors (${a.status})`);const s=await a.json();return{data:Array.isArray(s.data)?s.data:[],nextCursor:typeof s.nextCursor=="string"&&s.nextCursor.length>0?s.nextCursor:null,total:typeof s.total=="number"&&Number.isFinite(s.total)?Math.max(0,Math.floor(s.total)):0}}async function LU(e){const t=await fetch(`/codex-api/composio/connector?slug=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`Failed to load Composio connector (${t.status})`);return await t.json()}async function jU(e){const t=await fetch("/codex-api/composio/link",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e})});if(!t.ok)throw new Error(`Failed to start Composio login (${t.status})`);return await t.json()}async function NU(){const e=await fetch("/codex-api/composio/login",{method:"POST"});if(!e.ok)throw new Error(`Failed to start Composio CLI login (${e.status})`);return await e.json()}async function $U(){const e=await fetch("/codex-api/composio/install",{method:"POST"});if(!e.ok)throw new Error(`Failed to install Composio CLI (${e.status})`);return await e.json()}function pg(e){const t=Ye(e);if(!t)return null;const n=Yt(t.usedPercent??t.used_percent);if(n===null)return null;const r=Yt(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:Yt(t.resetsAt??t.resets_at)}}function GA(e){const t=Ye(e);if(!t)return null;const n=er(t.hasCredits??t.has_credits),r=er(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:re(t.balance)}}function mg(e){const t=Ye(e);if(!t)return null;const n=pg(t.primary),r=pg(t.secondary),o=GA(t.credits);return!n&&!r&&!o?null:{limitId:re(t.limitId??t.limit_id),limitName:re(t.limitName??t.limit_name),primary:n,secondary:r,credits:o,planType:re(t.planType??t.plan_type)}}function pw(e){const t=Ye(e);if(!t)return null;const n=Ye(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=mg(n==null?void 0:n.codex);return r||mg(t.rateLimits??t.rate_limits)}const VA=100;function KA(){return VA}function YA(e){return oI(e)}async function JA(e,t){await aI({id:e,...t})}async function gg(){return sI()}function QA(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=typeof t.id=="string"?t.id.trim():"";if(!n)return null;const r=Array.isArray(t.imageUrls)?t.imageUrls.filter(s=>typeof s=="string"&&s.trim().length>0):[],o=Array.isArray(t.skills)?t.skills.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const i=s,l=typeof i.name=="string"?i.name.trim():"",u=typeof i.path=="string"?i.path.trim():"";return l&&u?[{name:l,path:u}]:[]}):[],a=Array.isArray(t.fileAttachments)?t.fileAttachments.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const i=s,l=typeof i.label=="string"?i.label.trim():"",u=typeof i.path=="string"?i.path.trim():"",d=typeof i.fsPath=="string"?i.fsPath.trim():"";return l&&u&&d?[{label:l,path:u,fsPath:d}]:[]}):[];return{id:n,text:typeof t.text=="string"?t.text:"",imageUrls:r,skills:o,fileAttachments:a,collaborationMode:t.collaborationMode==="plan"?"plan":"default"}}function mw(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e)){const o=n.trim();if(!o||!Array.isArray(r))continue;const a=r.flatMap(s=>{const i=QA(s);return i?[i]:[]});a.length>0&&(t[o]=a)}return t}async function vg(){const e=await fetch("/codex-api/thread-queue-state"),t=await e.json();if(!e.ok)throw new Error("Failed to load thread queue state");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return mw(n.data)}async function XA(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(mw(e))})).ok)throw new Error("Failed to save thread queue state")}async function ZA(e,t){const n=await fetch("/codex-api/telegram/configure-bot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botToken:e,allowedUserIds:t})}),r=await n.json();if(!n.ok){const o=en(r,"Failed to connect Telegram bot");throw new Error(o)}}async function e_(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const s=en(t,"Failed to load Telegram configuration");throw new Error(s)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{},o=Array.isArray(r.allowedUserIds)?r.allowedUserIds:[],a=[];for(const s of o){if(s==="*"){a.push("*");continue}typeof s=="number"&&Number.isFinite(s)&&a.push(Math.trunc(s))}return{botToken:typeof r.botToken=="string"?r.botToken:"",allowedUserIds:a}}async function t_(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const o=en(t,"Failed to load Telegram status");throw new Error(o)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return{configured:r.configured===!0,active:r.active===!0,mappedChats:typeof r.mappedChats=="number"?r.mappedChats:0,mappedThreads:typeof r.mappedThreads=="number"?r.mappedThreads:0,allowedUsers:typeof r.allowedUsers=="number"?r.allowedUsers:0,allowAllUsers:r.allowAllUsers===!0,lastError:typeof r.lastError=="string"?r.lastError:""}}async function n_(){try{const e=await fetch("/codex-api/thread-titles");return e.ok?(await e.json()).data??{titles:{},order:[]}:{titles:{},order:[]}}catch{return{titles:{},order:[]}}}async function Sc(e,t){try{await fetch("/codex-api/thread-titles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,title:t})})}catch{}}async function r_(){try{const e=await fetch("/codex-api/thread-reasoning");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function o_(e,t){try{await fetch("/codex-api/thread-reasoning",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,messages:t})})}catch{}}async function a_(){try{const e=await fetch("/codex-api/thread-turn-durations");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function s_(e,t,n){try{await fetch("/codex-api/thread-turn-durations",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,turnId:t,durationMs:n})})}catch{}}async function i_(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function l_(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function u_(){var e;try{const t=await fetch("/codex-api/preferences/first-launch-plugins-card");return t.ok?{dismissed:((e=(await t.json()).data)==null?void 0:e.dismissed)===!0}:{dismissed:!1}}catch{return{dismissed:!1}}}async function c_(e){try{await fetch("/codex-api/preferences/first-launch-plugins-card",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dismissed:e})})}catch{}}async function d_(e,t){var n;try{return((n=(await it("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}function $f(e){return e?e.endsWith("/SKILL.md")?e:`${e}/SKILL.md`:""}function f_(e,t){const n=$f(e),r=n.split("/").filter(Boolean);if(r.length<2)return null;const o=r.lastIndexOf("skills");if(o>=2){const l=r[o-2]??"";if(l){const u=`/${[...r.slice(0,o+1),l,"SKILL.md"].join("/")}`;if(t.has(u))return{rootPath:u,rootName:l,isNested:u!==n}}}const a=r.indexOf("skills");if(a<0||a+1>=r.length-1)return null;const s=r[a+1]??"";if(!s)return null;const i=`/${[...r.slice(0,a+2),"SKILL.md"].join("/")}`;return t.has(i)?{rootPath:i,rootName:s,isNested:i!==n}:{rootPath:i,rootName:s,isNested:i!==n}}async function h_(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await it("skills/list",t),r=n.data.flatMap(s=>s.skills),o=new Set(r.map(s=>$f(s.path)).filter(Boolean)),a=new Map;for(const s of n.data)for(const i of s.skills){if(!i.name)continue;const l=f_(i.path,o),u=$f(i.path),m=!!(l!=null&&l.isNested&&o.has(l.rootPath))?l.rootPath:u,f=u===m,v=a.get(m),T={name:i.name,displayName:l&&m===l.rootPath?l.rootName:void 0,description:i.shortDescription||i.description||"",path:m,scope:i.scope,enabled:i.enabled,__hasRoot:f};if(!v){a.set(m,T);continue}if(v.enabled=v.enabled||i.enabled,!v.__hasRoot&&f){a.set(m,T);continue}!v.displayName&&T.displayName&&(v.displayName=T.displayName),!v.description&&T.description&&(v.description=T.description)}return Array.from(a.values()).map(({__hasRoot:s,...i})=>i)}catch{return[]}}const p_=6e4;async function Hu(e){const t=new AbortController,n=setTimeout(()=>t.abort(),p_);try{const r=new FormData;r.append("file",e);const o=await fetch("/codex-api/upload-file",{method:"POST",body:r,signal:t.signal});return o.ok?(await o.json()).path??null:null}catch{return null}finally{clearTimeout(n)}}function m_(e){return e==="payment_required"?e:null}function g_(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function yg(e){const t=Ye(e);if(!t)return null;const n=Yt(t.usedPercent??t.used_percent);if(n===null)return null;const r=Yt(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:Yt(t.resetsAt??t.resets_at)}}function v_(e){const t=Ye(e);if(!t)return null;const n=er(t.hasCredits??t.has_credits),r=er(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:re(t.balance)}}function y_(e){const t=Ye(e);if(!t)return null;const n=yg(t.primary),r=yg(t.secondary),o=v_(t.credits);return!n&&!r&&!o?null:{limitId:re(t.limitId??t.limit_id),limitName:re(t.limitName??t.limit_name),primary:n,secondary:r,credits:o,planType:re(t.planType??t.plan_type)}}function gw(e,t=null,n=null){const r=Ye(e);if(!r)return null;const o=re(r.accountId),a=re(r.storageId)??o,s=re(r.quotaStatus),i=s==="loading"||s==="ready"||s==="error"?s:"idle";return o?{accountId:o,storageId:a??o,userId:re(r.userId),authMode:re(r.authMode),email:re(r.email),planType:re(r.planType),lastRefreshedAtIso:re(r.lastRefreshedAtIso)??"",lastActivatedAtIso:re(r.lastActivatedAtIso),quotaSnapshot:y_(r.quotaSnapshot),quotaUpdatedAtIso:re(r.quotaUpdatedAtIso),quotaStatus:i,quotaError:re(r.quotaError),unavailableReason:m_(r.unavailableReason)??(g_(re(r.quotaError))?"payment_required":null),isActive:er(r.isActive)??(a===n||o===t)}:null}function vw(e){const t=Ye(e);if(!t)return null;const n=re(t.clientId??t.client_id??t.id);return n?{clientId:n,deviceName:re(t.deviceName??t.device_name??t.name)??"",lastSeenAt:re(t.lastSeenAt??t.last_seen_at??t.lastSeen)}:null}async function w_(){const e=await it("remoteControl/status/read",{}),t=Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[];return{enabled:er(e.enabled)??!1,clients:t.map(vw).filter(n=>n!==null)}}async function b_(){var r;const e=await fetch("/codex-api/approval-policy"),t=await e.json();if(!e.ok)throw new Error(t.error||"Failed to read approval policy");const n=re((r=t.data)==null?void 0:r.policy)??"";return n==="untrusted"||n==="on-failure"||n==="on-request"||n==="never"?n:"never"}async function T_(e){const t=await fetch("/codex-api/approval-policy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({policy:e})}),n=await t.json();if(!t.ok)throw new Error(n.error||"Failed to save approval policy")}async function S_(e){await it(e?"remoteControl/enable":"remoteControl/disable",{})}async function k_(){const e=await it("remoteControl/pairing/start",{});return{pairingCode:re(e.pairingCode??e.pairing_code??e.code)??"",expiresAt:re(e.expiresAt??e.expires_at)}}async function C_(){const e=await it("remoteControl/client/list",{});return(Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[]).map(vw).filter(n=>n!==null)}async function x_(e){await it("remoteControl/client/revoke",{clientId:e})}async function I_(){try{const e=await it("account/rateLimits/read");return pw(e)}catch(e){throw ro(e,"Failed to load account rate limits","account/rateLimits/read")}}function Jc(e){const t=Ye(e),n=re(t==null?void 0:t.activeAccountId),r=re(t==null?void 0:t.activeStorageId),o=Array.isArray(t==null?void 0:t.accounts)?t==null?void 0:t.accounts:[];return{activeAccountId:n,activeStorageId:r,importedAccountId:re(t==null?void 0:t.importedAccountId)??void 0,importedStorageId:re(t==null?void 0:t.importedStorageId)??void 0,accounts:o.map(a=>gw(a,n,r)).filter(a=>a!==null)}}async function A_(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(en(t,"Failed to load accounts"));const n=Ye(t);return Jc(n==null?void 0:n.data)}async function wg(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(en(t,"Failed to refresh accounts"));const n=Ye(t);return Jc(n==null?void 0:n.data)}async function __(){const e=await fetch("/codex-api/accounts/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(en(t,"Failed to start Codex login"));const n=Ye(t),r=Ye(n==null?void 0:n.data),o=re(r==null?void 0:r.loginUrl);if(!o)throw new Error("Failed to start Codex login");return o}async function P_(e){const t=await fetch("/codex-api/accounts/login/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callbackUrl:e})}),n=await t.json();if(!t.ok)throw new Error(en(n,"Failed to complete Codex login"));const r=Ye(n);return Jc(r==null?void 0:r.data)}async function E_(e){const t=await fetch("/codex-api/accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storageId:e})}),n=await t.json();if(!t.ok)throw new Error(en(n,"Failed to switch account"));const r=Ye(n),o=Ye(r==null?void 0:r.data),a=gw(o==null?void 0:o.account,re(o==null?void 0:o.activeAccountId),re(o==null?void 0:o.activeStorageId));if(!a)throw new Error("Failed to switch account");return a}async function M_(e){const t=await fetch("/codex-api/accounts/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storageId:e})}),n=await t.json();if(!t.ok)throw new Error(en(n,"Failed to remove account"));const r=Ye(n);return Jc(r==null?void 0:r.data)}let Wu=null,tu=null;function R_(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=a=>{if(!Array.isArray(a))return[];const s=[];for(const i of a)typeof i=="string"&&i.length>0&&!s.includes(i)&&s.push(i);return s},r=t.labels,o={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[a,s]of Object.entries(r)){const i=typeof a=="string"?et(a):"";i.length>0&&typeof s=="string"&&(o[i]=s)}return{order:n(t.order).map(a=>et(a)),labels:o,active:n(t.active).map(a=>et(a)),projectOrder:n(t.projectOrder).map(a=>et(a)),remoteProjects:Array.isArray(t.remoteProjects)?t.remoteProjects.flatMap(a=>{if(!a||typeof a!="object"||Array.isArray(a))return[];const s=a,i=typeof s.id=="string"?s.id.trim():"";return i?[{id:i,hostId:typeof s.hostId=="string"?s.hostId.trim():"",remotePath:typeof s.remotePath=="string"?et(s.remotePath):"",label:typeof s.label=="string"?s.label.trim():""}]:[]}):[]}}async function sl(){return tu?Of(tu):(Wu||(Wu=L_().then(e=>(tu=e,e)).finally(()=>{Wu=null})),Of(await Wu))}async function L_(){const e=await fetch("/codex-api/workspace-roots-state"),t=await e.json();if(!e.ok)throw new Error("Failed to load workspace roots state");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return R_(n.data)}function Of(e){var t;return{order:[...e.order],labels:{...e.labels},active:[...e.active],projectOrder:[...e.projectOrder],remoteProjects:((t=e.remoteProjects)==null?void 0:t.map(n=>({...n})))??[]}}function Rh(){tu=null}async function j_(e,t){const n=(t??"").trim(),r=await fetch("/codex-api/worktree/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,baseBranch:n||void 0})}),o=await r.json();if(!r.ok||!o.data)throw new Error(o.error||"Failed to create worktree");return{...o.data,cwd:et(o.data.cwd),gitRoot:et(o.data.gitRoot)}}async function N_(e,t){const n=await fetch("/codex-api/worktree/create-permanent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,worktreeName:t})}),r=await n.json();if(!n.ok||!r.data)throw new Error(r.error||"Failed to create worktree");return{...r.data,cwd:et(r.data.cwd),gitRoot:et(r.data.gitRoot)}}async function $_(e){const t=e.trim();if(!t)return[];const n=new URLSearchParams({sourceCwd:t}),r=await fetch(`/codex-api/worktree/branches?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to load branches");const a=Array.isArray(o.data)?o.data:[],s=[],i=new Set;for(const l of a){if(!l||typeof l!="object"||Array.isArray(l))continue;const u=l,d=typeof u.value=="string"?u.value.trim():"",m=typeof u.label=="string"?u.label.trim():"";!d||i.has(d)||(i.add(d),s.push({value:d,label:m||d}))}return s}async function O_(e){const t=e.trim();if(!t)return{currentBranch:null,headSha:null,headSubject:null,headDate:null,detached:!1,dirty:!1,gitRoot:"",options:[],changedFiles:[]};const n=new URLSearchParams({cwd:t}),r=await fetch(`/codex-api/git/branches?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to load Git branch state");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=a.currentBranch,i=typeof s=="string"&&s.trim()?s.trim():null,l=Array.isArray(a.options)?a.options:[],u=[],d=new Set;for(const R of l){if(!R||typeof R!="object"||Array.isArray(R))continue;const E=R,N=typeof E.value=="string"?E.value.trim():"",q=typeof E.label=="string"?E.label.trim():"";!N||d.has(N)||(d.add(N),u.push({value:N,label:q||N,isCurrent:E.isCurrent===!0,isRemote:E.isRemote===!0}))}i&&!d.has(i)&&u.unshift({value:i,label:i,isCurrent:!0});const m=a.headSha,f=a.headSubject,v=a.headDate,T=a.gitRoot,k=yw(a.changedFiles);return{currentBranch:i,headSha:typeof m=="string"&&m.trim()?m.trim():null,headSubject:typeof f=="string"&&f.trim()?f.trim():null,headDate:typeof v=="string"&&v.trim()?v.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof T=="string"?et(T):"",options:u,changedFiles:k}}function yw(e){const t=Array.isArray(e)?e:[],n=[];for(const r of t){if(!r||typeof r!="object"||Array.isArray(r))continue;const o=r,a=o.path,s=typeof a=="string"?et(a.trim()):"";if(!s)continue;const i=o.status,l=typeof i=="string"?i.trim():"",u=o.label,d=typeof u=="string"&&u.trim()?u.trim():l;n.push({path:s,previousPath:typeof o.previousPath=="string"&&o.previousPath.trim()?et(o.previousPath.trim()):null,status:l,label:d,addedLineCount:typeof o.addedLineCount=="number"?o.addedLineCount:null,removedLineCount:typeof o.removedLineCount=="number"?o.removedLineCount:null})}return n}async function D_(e){const t=e.trim();if(!t)return{isGitRepo:!1,gitRoot:""};const n=new URLSearchParams({cwd:t}),r=await fetch(`/codex-api/git/repository-status?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to read Git repository status");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{isGitRepo:a.isGitRepo===!0,gitRoot:typeof a.gitRoot=="string"?et(a.gitRoot):""}}async function F_(e,t){var a;const n=await fetch("/codex-api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim()})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to switch branch");const o=(a=r.data)==null?void 0:a.currentBranch;return typeof o=="string"&&o.trim()?o.trim():null}async function B_(e,t,n={}){const r=e.trim(),o=t.trim();if(!r||!o)return[];const a=new URLSearchParams({cwd:r,branch:o,includeResetHistory:n.includeResetHistory===!1?"false":"true"}),s=await fetch(`/codex-api/git/branch-commits?${a.toString()}`),i=await s.json();if(!s.ok)throw new Error(i.error||"Failed to load branch commits");return(Array.isArray(i.data)?i.data:[]).flatMap(u=>{if(!u||typeof u!="object"||Array.isArray(u))return[];const d=u,m=typeof d.sha=="string"?d.sha.trim():"",f=typeof d.shortSha=="string"?d.shortSha.trim():"",v=typeof d.subject=="string"?d.subject.trim():"",T=typeof d.date=="string"?d.date.trim():"";return!m||!f?[]:[{sha:m,shortSha:f,subject:v||f,date:T}]})}async function U_(e,t){const n=e.trim(),r=t.trim();if(!n||!r)return[];const o=new URLSearchParams({cwd:n,sha:r}),a=await fetch(`/codex-api/git/commit-files?${o.toString()}`),s=await a.json();if(!a.ok)throw new Error(s.error||"Failed to load commit files");return(Array.isArray(s.data)?s.data:[]).flatMap(l=>{if(!l||typeof l!="object"||Array.isArray(l))return[];const u=l,d=typeof u.path=="string"?u.path:"",m=typeof u.previousPath=="string"&&u.previousPath.length>0?u.previousPath:null,f=typeof u.status=="string"?u.status.trim():"",v=typeof u.label=="string"?u.label.trim():"",T=typeof u.addedLineCount=="number"&&Number.isFinite(u.addedLineCount)?u.addedLineCount:null,k=typeof u.removedLineCount=="number"&&Number.isFinite(u.removedLineCount)?u.removedLineCount:null;return!d||!f?[]:[{path:d,previousPath:m,status:f,label:v||f,addedLineCount:T,removedLineCount:k}]})}async function z_(e,t,n){const r=await fetch("/codex-api/git/reset-to-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim(),sha:n.trim()})}),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to reset branch to commit");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{currentBranch:typeof a.currentBranch=="string"&&a.currentBranch.trim()?a.currentBranch.trim():null,headSha:typeof a.headSha=="string"&&a.headSha.trim()?a.headSha.trim():null,headSubject:typeof a.headSubject=="string"&&a.headSubject.trim()?a.headSubject.trim():null,headDate:typeof a.headDate=="string"&&a.headDate.trim()?a.headDate.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof a.gitRoot=="string"?et(a.gitRoot):"",options:[],changedFiles:yw(a.changedFiles)}}async function Zd(e){if(!(await fetch("/codex-api/workspace-roots-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save workspace roots state");tu=Of(e)}async function qu(e,t){const n=await fetch("/codex-api/project-root",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,createIfMissing:(t==null?void 0:t.createIfMissing)===!0,label:(t==null?void 0:t.label)??""})}),r=await n.json();if(!n.ok){const i=en(r,"Failed to open project root");throw new Error(i)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=typeof a.path=="string"?et(a.path):"";return Rh(),s}function H_(e){return`/codex-api/project-zip?${new URLSearchParams({cwd:e}).toString()}`}function W_(e,t){var a;const n=e.headers.get("content-disposition")??"",r=n.match(/filename\*=UTF-8''([^;]+)/iu);if(r!=null&&r[1])try{return decodeURIComponent(r[1])}catch{return r[1]}const o=n.match(/filename="?([^";]+)"?/iu);return((a=o==null?void 0:o[1])==null?void 0:a.trim())||t}async function q_(e,t){var d;const n=await fetch(H_(e));if(!n.ok){const m=await n.json().catch(()=>null),f="Failed to export project",v=en(m,f),T=[n.status?String(n.status):"",n.statusText].filter(Boolean).join(" "),k=v!==f?v:T?`Failed to export project: ${T}`:f;throw new Error(k)}const r=Number(n.headers.get("content-length")??""),o=Number.isFinite(r)&&r>0?r:null,a=W_(n,"project.zip"),s=(d=n.body)==null?void 0:d.getReader();if(!s){const m=await n.blob();return t==null||t({loaded:m.size,total:m.size||o}),{blob:m,fileName:a}}const i=[];let l=0;for(t==null||t({loaded:l,total:o});;){const{done:m,value:f}=await s.read();if(m)break;f&&(i.push(new Uint8Array(f)),l+=f.byteLength,t==null||t({loaded:l,total:o}))}const u=i.map(m=>{const f=new Uint8Array(m.byteLength);return f.set(m),f.buffer});return{blob:new Blob(u,{type:n.headers.get("content-type")??"application/zip"}),fileName:a}}async function G_(e,t){const n=new URLSearchParams({parent:t}),r=await fetch(`/codex-api/project-import?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e}),o=await Ai(r);if(!r.ok){const l=en(o,"Failed to import project");throw new Error(l)}const a=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=typeof s.path=="string"?et(s.path):"";return i&&Rh(),{path:i,importedSessions:typeof s.importedSessions=="number"?s.importedSessions:0}}async function bg(){const e=await fetch("/codex-api/home-directory"),t=await e.json();if(!e.ok)throw new Error("Failed to load home directory");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return typeof r.path=="string"?r.path.trim():""}async function V_(e,t){const n=new URLSearchParams({path:e});(t==null?void 0:t.showHidden)===!0&&n.set("showHidden","1");const r=await fetch(`/codex-local-directories?${n.toString()}`),o=await Ai(r);if(!r.ok){const l=en(o,"Failed to load local directories");throw new Error(l)}const a=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=Array.isArray(s.entries)?s.entries:[];return{path:typeof s.path=="string"?et(s.path):"",parentPath:typeof s.parentPath=="string"?et(s.parentPath):"",entries:i.flatMap(l=>{if(!l||typeof l!="object"||Array.isArray(l))return[];const u=l,d=typeof u.name=="string"?u.name.trim():"",m=typeof u.path=="string"?et(u.path):"";return d&&m?[{name:d,path:m}]:[]})}}async function OU(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-files?${t.toString()}`),r=await Ai(n);if(!n.ok){const i=en(r,"Failed to load workspace files");throw new Error(i)}const a=(r&&typeof r=="object"&&!Array.isArray(r)?r:{}).data;return(Array.isArray(a)?a:[]).flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const l=i,u=typeof l.path=="string"?et(l.path):"",d=typeof l.relativePath=="string"?l.relativePath.trim():"";return!u||!d?[]:[{path:u,relativePath:d,isDirectory:l.isDirectory===!0}]})}async function DU(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-preview?${t.toString()}`),r=await Ai(n);if(!n.ok){const i=en(r,"Failed to preview file");throw new Error(i)}const a=(r&&typeof r=="object"&&!Array.isArray(r)?r:{}).data,s=a&&typeof a=="object"&&!Array.isArray(a)?a:{};return{path:typeof s.path=="string"?s.path:e,name:typeof s.name=="string"?s.name:"",size:typeof s.size=="number"?s.size:0,isText:s.isText===!0,isImage:s.isImage===!0,content:typeof s.content=="string"?s.content:void 0,truncated:s.truncated===!0}}async function K_(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await Ai(t);if(!t.ok){const s=en(n,"Failed to create local directory");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},o=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=typeof o.path=="string"?et(o.path):"";return a&&Rh(),a}async function Y_(e,t){const n=await fetch("/codex-api/github-clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e,basePath:t})}),r=await Ai(n);if(!n.ok){const s=en(r,"Failed to clone GitHub repository");throw new Error(s)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return typeof a.path=="string"?et(a.path):""}async function J_(e){const t=await fetch("/codex-api/projectless-thread-cwd",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e??null})}),n=await Ai(t);if(!t.ok){const s=en(n,"Failed to create new chat folder");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},o=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=typeof o.cwd=="string"?et(o.cwd):"";if(!a)throw new Error("Failed to create new chat folder");return{cwd:a,outputDirectory:typeof o.outputDirectory=="string"?et(o.outputDirectory):a,workspaceRoot:typeof o.workspaceRoot=="string"?et(o.workspaceRoot):""}}async function Q_(e){const t=new URLSearchParams({basePath:e}),n=await fetch(`/codex-api/project-root-suggestion?${t.toString()}`),r=await n.json();if(!n.ok){const s=en(r,"Failed to suggest project name");throw new Error(s)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{name:typeof a.name=="string"?a.name.trim():"",path:typeof a.path=="string"?et(a.path):""}}function X_(e){const t=Ye(e);if(!t)return null;const n=re(t.key),r=typeof t.text=="string"?t.text:"",o=re(t.kind);return!n||!o||o!=="meta"&&o!=="hunk"&&o!=="add"&&o!=="remove"&&o!=="context"?null:{key:n,kind:o,text:r,oldLine:Yt(t.oldLine),newLine:Yt(t.newLine)}}function Z_(e){const t=Ye(e);if(!t)return null;const n=re(t.id),r=typeof t.header=="string"?t.header:"",o=typeof t.patch=="string"?t.patch:"";return n?{id:n,header:r,patch:o,addedLineCount:Yt(t.addedLineCount)??0,removedLineCount:Yt(t.removedLineCount)??0,oldStart:Yt(t.oldStart),oldLineCount:Yt(t.oldLineCount)??0,newStart:Yt(t.newStart),newLineCount:Yt(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(a=>X_(a)).filter(a=>a!==null):[]}:null}function eP(e){const t=Ye(e);if(!t)return null;const n=re(t.id),r=re(t.path),o=re(t.absolutePath),a=re(t.operation);return!n||!r||!o||!a||a!=="add"&&a!=="delete"&&a!=="update"&&a!=="rename"?null:{id:n,path:r,absolutePath:o,previousPath:re(t.previousPath),previousAbsolutePath:re(t.previousAbsolutePath),operation:a,addedLineCount:Yt(t.addedLineCount)??0,removedLineCount:Yt(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(s=>Z_(s)).filter(s=>s!==null):[]}}function ww(e){const t=Ye(e),n=Ye(t==null?void 0:t.data),r=Ye(n==null?void 0:n.summary),o=re(n==null?void 0:n.scope),a=o==="baseBranch"||o==="commit"?o:"workspace",s=re(n==null?void 0:n.workspaceView)==="staged"?"staged":"unstaged";return{cwd:re(n==null?void 0:n.cwd)??"",gitRoot:re(n==null?void 0:n.gitRoot),isGitRepo:er(n==null?void 0:n.isGitRepo)??!1,scope:a,workspaceView:s,baseBranch:re(n==null?void 0:n.baseBranch),baseBranchOptions:Array.isArray(n==null?void 0:n.baseBranchOptions)?n.baseBranchOptions.map(i=>re(i)).filter(i=>typeof i=="string"&&i.length>0):[],commitSha:re(n==null?void 0:n.commitSha),headBranch:re(n==null?void 0:n.headBranch),mergeBaseSha:re(n==null?void 0:n.mergeBaseSha),generatedAtIso:re(n==null?void 0:n.generatedAtIso)??"",summary:{fileCount:Yt(r==null?void 0:r.fileCount)??0,addedLineCount:Yt(r==null?void 0:r.addedLineCount)??0,removedLineCount:Yt(r==null?void 0:r.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(i=>eP(i)).filter(i=>i!==null):[]}}function tP(e){const t=Ye(e),n=Ye(t==null?void 0:t.data);return{fileCount:Yt(n==null?void 0:n.fileCount)??0,addedLineCount:Yt(n==null?void 0:n.addedLineCount)??0,removedLineCount:Yt(n==null?void 0:n.removedLineCount)??0}}async function FU(e,t,n,r,o){const a=new URLSearchParams({cwd:e,scope:t,workspaceView:n});r&&r.trim()&&a.set("baseBranch",r.trim()),o&&o.trim()&&a.set("commitSha",o.trim());const s=await fetch(`/codex-api/review/snapshot?${a.toString()}`),i=await s.json();if(!s.ok)throw new Error(en(i,"Failed to load review snapshot"));return ww(i)}async function nP(e,t){const n=new URLSearchParams({cwd:e,workspaceView:t}),r=await fetch(`/codex-api/review/summary?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(en(o,"Failed to load review summary"));return tP(o)}async function BU(e){const t=await fetch("/codex-api/review/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();if(!t.ok)throw new Error(en(n,"Failed to apply review action"));return ww(n)}async function UU(e){const t=await fetch("/codex-api/review/git/init",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e})}),n=await t.json();if(!t.ok)throw new Error(en(n,"Failed to initialize Git"))}async function rP(e,t,n,r,o,a,s){try{const i=await fetch("/codex-api/thread/rollback-files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,turnId:t,cwd:n,action:r,patchIds:o,scope:a,filePaths:s})}),l=await i.json().catch(()=>({}));if(!i.ok){const u=typeof l.message=="string"&&l.message.trim()?l.message.trim():typeof l.error=="string"&&l.error.trim()?l.error.trim():"Server error";return{changed:0,errors:Array.isArray(l.errors)&&l.errors.length>0?l.errors:[u],message:l.message}}return{changed:l.changed??l.reverted??l.applied??0,errors:Array.isArray(l.errors)?l.errors:[],message:l.message,revertedPatchIds:Array.isArray(l.revertedPatchIds)?l.revertedPatchIds:[],appliedPatchIds:Array.isArray(l.appliedPatchIds)?l.appliedPatchIds:[]}}catch(i){return{changed:0,errors:[i instanceof Error?i.message:"Network error"]}}}async function oP(e,t,n){const r=await rP(e,t,n,"undo");return{reverted:r.changed,errors:r.errors}}const aP={},sP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function iP(e,t){return _(),B("svg",sP,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const zs=Tt(aP,[["render",iP]]),lP={},uP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function cP(e,t){return _(),B("svg",uP,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const Gu=Tt(lP,[["render",cP]]),dP={},fP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function hP(e,t){return _(),B("svg",fP,[...t[0]||(t[0]=[w("path",{fill:"currentColor",d:"M6 12a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4"},null,-1)])])}const Df=Tt(dP,[["render",hP]]),pP={},mP={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function gP(e,t){return _(),B("svg",mP,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 20h4L18.5 9.5a2.828 2.828 0 1 0-4-4L4 16zm9.5-13.5l4 4"},null,-1)])])}const Cl=Tt(pP,[["render",gP]]),vP={},yP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function wP(e,t){return _(),B("svg",yP,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"},null,-1)])])}const Lh=Tt(vP,[["render",wP]]),bP={},TP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function SP(e,t){return _(),B("svg",TP,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m5 19l2.757-7.351A1 1 0 0 1 8.693 11H21a1 1 0 0 1 .986 1.164l-.996 5.211A2 2 0 0 1 19.026 19za2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v2"},null,-1)])])}const kP=Tt(bP,[["render",SP]]),CP={},xP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function IP(e,t){return _(),B("svg",xP,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 3L4 14h6l-1 7l9-11h-6z"},null,-1)])])}const Qc=Tt(CP,[["render",IP]]),bw="codex-web-local.ui-language.v1",AP={English:"English","Simplified Chinese":"简体中文",Commands:"命令",Command:"命令",Local:"本地","Compact the current thread context":"压缩当前线程上下文","Open the code review pane":"打开代码审查面板","Rename the current thread":"重命名当前线程","Archive the current thread":"归档当前线程","Fork the current thread":"派生当前线程","Start a new thread":"新建线程","Open the skills page":"打开技能页面","Generate or update AGENTS.md":"生成或更新 AGENTS.md","Show help about Codex":"显示 Codex 使用帮助","Mention files with @":"使用 @ 提及文件","Show the current git diff":"显示当前 git diff","Clear the input":"清空输入","Search threads":"搜索线程","Filter threads...":"筛选线程...","Clear search":"清除搜索",Chats:"聊天",Projects:"项目",Pinned:"已固定","Chats first":"聊天优先","Sort by":"排序",Created:"创建时间",Updated:"更新时间","New chat":"新聊天","No chats":"没有聊天","Skills Hub":"技能中心","Expand accounts":"展开账户","Collapse accounts":"折叠账户",Accounts:"账户","Reloading…":"重新加载中…",Reload:"重新加载","Run `codex login`, then click reload.":"先运行 `codex login`,然后点击重新加载。",Account:"账户",Workspace:"工作区","Require ⌘ + enter to send":"需要 ⌘ + Enter 才发送","When busy, send as":"忙碌时发送方式",Steer:"引导",Queue:"排队",Appearance:"外观",System:"跟随系统",Dark:"深色",Light:"浅色","Chat width":"聊天宽度","Click to toggle dictation":"点击切换语音输入","Auto send dictation":"语音输入后自动发送",Provider:"提供方","Choose the API provider for the Codex backend":"选择 Codex 后端使用的 API 提供方","OpenRouter API key":"OpenRouter API Key","Get API key":"获取 API Key","Remove custom key, use community keys":"移除自定义 key,改用社区 key",Set:"设置",Save:"保存","API format":"API 格式","OpenRouter API format":"OpenRouter API 格式",Responses:"Responses",Completions:"Completions","OpenCode Zen API key":"OpenCode Zen API Key","Custom endpoint URL":"自定义端点 URL","API key":"API Key","Custom endpoint API format":"自定义端点 API 格式","UI language":"界面语言","Choose the interface language for the app.":"选择应用界面语言。","Dictation language":"听写语言","Auto-detect":"自动检测","Search language...":"搜索语言...",Telegram:"Telegram","Bot token":"Bot Token","Allowed Telegram user IDs":"允许的 Telegram 用户 ID","Put one Telegram user ID per line or separate them with commas. Use `*` to allow all Telegram users. Unauthorized users will see their own ID in the rejection message so they can copy it here.":"每行填写一个 Telegram 用户 ID,或用逗号分隔。使用 `*` 可允许所有 Telegram 用户。未授权用户会在拒绝消息中看到自己的 ID,方便复制到这里。","Saving…":"保存中…","Save Telegram config":"保存 Telegram 配置",Context:"上下文","Worktree name and version":"工作树名称和版本",Settings:"设置","General settings":"常规","Models & providers":"模型与提供商",Integrations:"集成","Usage & about":"用量与关于","Thinking process":"思考过程","Turn process":"本轮过程","Collapse turn process":"收起本轮过程","Expand turn process":"展开本轮过程","{n} process items":"{n} 个过程项","Working…":"执行中…",Processed:"已处理","{n} tools":"{n} 个工具","{n} thoughts":"{n} 条思考","{n} commands":"{n} 个命令","Question navigation":"问题导航","Jump to question {n}":"跳转到问题 {n}","Read {n} files":"已读 {n} 个文件","Search {n} files":"搜索 {n} 个文件","{n} read calls":"{n} 次只读调用","Modified {n} files":"已修改 {n} 个文件","Delegated {n} tasks":"已委派 {n} 个任务","Explored {n} items":"已探索 {n} 项","Stopped: message not submitted, restored to input.":"已停止:消息未提交,已回填到输入框。","Stopped: message not submitted.":"已停止:消息未提交。","Load earlier ({n} turns)":"展开前 {n} 轮对话","Load earlier messages":"加载更早的消息",Steps:"步骤","Implement plan":"执行计划","Plan executed":"计划已执行","Implementing…":"执行中…","Toggle terminal":"切换终端","Open terminal":"打开终端","Terminal command":"终端命令","No commands":"没有命令","Search branches...":"搜索分支...","Let's build":"开始构建","Choose folder":"选择文件夹","Quick search project":"快速搜索项目","Selected folder":"已选文件夹","Select folder":"选择文件夹","Create Project":"创建项目","Create or clone":"创建或克隆","Create or clone project":"创建或克隆项目","Project source":"项目来源","New project":"新项目","Destination folder":"目标文件夹","New project name":"新项目名称","GitHub repository URL":"GitHub 仓库 URL","Create project":"创建项目","Creating…":"创建中…","Clone repository":"克隆仓库","Clone from GitHub":"从 GitHub 克隆","Cloning…":"克隆中…","Current folder":"当前文件夹",Unavailable:"不可用","Opening…":"打开中…",Open:"打开","Show hidden folders":"显示隐藏文件夹","New folder":"新建文件夹","Folder name":"文件夹名称","Filter folders...":"筛选文件夹...",Retry:"重试","Loading folders…":"加载文件夹中…","No folders match this filter.":"没有匹配此筛选条件的文件夹。","No subfolders found here.":"这里没有子文件夹。","Base branch":"基础分支","Select branch":"选择分支","Loading branches…":"加载分支中…","No Git branches found for this folder.":"此文件夹未找到 Git 分支。","Local project":"本地项目","New worktree":"新工作树","Service worker registration failed.":"Service Worker 注册失败。","No matching files":"没有匹配的文件","Add photos & files":"添加图片和文件","Add folder":"添加文件夹","Take photo":"拍照","In-progress send":"执行中发送","Fast mode":"快速模式","Plan mode":"规划模式","Agent proposes a plan before acting":"代理在执行前先提出计划",Model:"模型","Search models...":"搜索模型...",Skills:"技能","Search skills...":"搜索技能...","Search skills and prompts...":"搜索技能和提示词...",Thinking:"思考强度","Saving thread before stop is available":"线程保存后才能停止",Stop:"停止","This thread is running in the Codex TUI":"该线程正在 Codex TUI 中运行","Queue message":"加入队列","Send message":"发送消息",Send:"发送","Drop images or files":"拖放图片或文件","Selected image":"已选图片","Loading messages...":"加载消息中...","Still loading — the first open of a large history can take a while.":"仍在加载——较大的历史会话首次打开可能需要较长时间。",Plan:"计划",Updating:"更新中",Step:"步骤","Edit this message":"编辑此消息","Edit message":"编辑消息","Saving rolls this turn back and resends it with your changes. Later replies will be removed.":"保存后将回退此轮并以修改后的文本重发。之后的回复将被移除。",Rollback:"回退","Fork thread from this response":"从此回复分叉线程",Fork:"分叉","Response copied":"回复已复制","Copy last code block":"复制最后一个代码块","Copy response":"复制回复","Jump to latest":"跳转到最新","Jump to latest output":"跳转到最新输出",Today:"今天",Yesterday:"昨天","Close image preview":"关闭图片预览","Expanded message image":"放大消息图片","Changed files":"已更改文件","Close diff viewer":"关闭 diff 查看器","No diff available":"没有可用 diff","This summary was restored from the final answer text, but the thread history does not include patch diff content for this file.":"此摘要是从最终回答文本恢复的,但线程历史中不包含该文件的补丁 diff 内容。",Review:"审查",Commit:"提交","Close review pane":"关闭审查面板",Compare:"比较",Branch:"分支",Changes:"更改","Loading review state":"加载审查状态中","This folder is not a Git repository":"此文件夹不是 Git 仓库","Initialize Git to review local changes and run Codex review.":"初始化 Git 后即可审查本地更改并运行 Codex review。","Initializing…":"初始化中…","Initialize Git":"初始化 Git","Base branch unavailable":"基础分支不可用","Could not resolve `origin/HEAD`, `main`, or `master` for this repository.":"无法为此仓库解析 `origin/HEAD`、`main` 或 `master`。","No changes in this scope":"此范围内没有更改","No file changes in this commit.":"此提交中没有文件更改。","Your current workspace is clean.":"当前工作区很干净。","No merge diff found against the base branch.":"未找到相对基础分支的合并 diff。","No unified diff available.":"没有可用的统一 diff。",Summary:"摘要",Added:"新增",Deleted:"删除",Renamed:"重命名",Modified:"修改","Repository review":"仓库审查","Staged changes":"已暂存更改","Workspace changes":"工作区更改","Unstage all":"全部取消暂存","Stage all":"全部暂存","Revert all":"全部还原","Unstage file":"取消暂存文件","Stage file":"暂存文件","Revert file":"还原文件","Unstage hunk":"取消暂存代码块","Stage hunk":"暂存代码块","Revert hunk":"还原代码块","Failed to load review snapshot":"加载审查快照失败","Failed to apply review action":"应用审查操作失败","Failed to initialize Git":"初始化 Git 失败","Reviewing current changes":"正在审查当前更改","Failed to start review":"启动审查失败","Review in progress":"审查进行中","Failed to load review result":"加载审查结果失败",pin:"固定","Worktree thread":"工作树线程",Threads:"线程","Organize threads":"整理线程",Organize:"整理","By project":"按项目","Chronological list":"按时间顺序","No matching threads. Clear the search to see all threads.":"没有匹配的线程。清除搜索即可查看全部线程。","Loading threads...":"加载线程中...","Edit name":"编辑名称",Remove:"移除","Project name":"项目名称","No threads yet. Start a new thread to begin.":"还没有线程。新建一个线程即可开始。","Thread title":"线程标题","Rename thread":"重命名线程","Make it short and recognizable.":"尽量简短且易识别。","Add title...":"输入标题...",Cancel:"取消","Delete thread":"删除线程","Thread automation":"线程自动化","This creates a heartbeat automation attached to the selected thread.":"这会创建一个附加到所选线程的心跳自动化。",Name:"名称","Automation name":"自动化名称",Prompt:"提示词","Search prompt...":"搜索提示词...","Describe what the automation should do":"描述自动化需要执行的内容","Schedule (RRULE)":"计划(RRULE)",Status:"状态",Active:"启用",Paused:"暂停","Expand sidebar":"展开侧边栏","Collapse sidebar":"折叠侧边栏","Start new thread":"新建线程","No skills found":"未找到技能","No results":"没有结果","Approval choices":"审批选项","No, and tell Codex what to do differently":"不允许,并告诉 Codex 应如何调整",Skip:"跳过",Yes:"是","Yes for Session":"本次会话内允许",pending:"条待处理","Do you want to run this command?":"是否运行此命令?","Do you want to make these changes?":"是否进行这些更改?","Do you want to grant these permissions?":"是否授予这些权限?","An MCP server needs your input before Codex can continue.":"MCP 服务器需要你的输入,Codex 才能继续。","Codex needs your answer before it can continue.":"Codex 需要你的回答才能继续。","Codex is waiting for a response before it can continue.":"Codex 正在等待你的回复,然后才能继续。",Server:"服务器","Open authorization link":"打开授权链接",Value:"值",Choice:"选项","Select true or false":"选择 true 或 false",True:"True",False:"False","Select an option":"选择一个选项",Decline:"拒绝",Continue:"继续","Other answer":"其他答案","Fail Tool Call":"使工具调用失败","Success (Empty)":"成功(空结果)","Return Empty Result":"返回空结果","New terminal":"新终端","Hide terminal":"隐藏终端",Close:"关闭","Edit queued message":"编辑排队消息","Send now without interrupting work":"立即发送且不中断当前工作","Delete queued message":"删除排队消息","AppServer API":"AppServer API","Loading method catalog...":"加载方法目录中...",Disabled:"已禁用",Installed:"已安装","Browse files":"浏览文件","Loading skill contents...":"加载技能内容中...","View on GitHub":"在 GitHub 查看","Show all":"显示全部","Hide all":"隐藏全部","No types yet":"还没有类型","Manage installed skills on this machine":"管理此机器上已安装的技能","Skills Sync (GitHub)":"技能同步(GitHub)",Connected:"已连接","Logged in as":"已登录为","Not connected":"未连接",Startup:"启动",Action:"动作",Skill:"技能","Manual sync":"手动同步","GitHub device login":"GitHub 设备登录","and enter code:":"并输入代码:","Login with GitHub":"使用 GitHub 登录","Device Login":"设备登录","Logout GitHub":"退出 GitHub","Syncing...":"同步中...","Startup Sync":"启动同步","Pulling...":"拉取中...",Pull:"拉取","Pushing...":"推送中...",Push:"推送","Installed ({count})":"已安装({count})","Find skills":"查找技能","Search the Skills registry with npx skills find.":"使用 npx skills find 搜索 Skills 注册表。","Searching...":"搜索中...","Search results ({count})":"搜索结果({count})","No matching skills found.":"未找到匹配的技能。","No installed skills found.":"未找到已安装的技能。","Continue in":"运行方式","Search daily":"搜索(日)","Search weekly":"搜索(周)","Search monthly":"搜索(月)","Trending daily":"热门(日)","Trending weekly":"热门(周)","Trending monthly":"热门(月)",Newest:"最新","A-Z":"A-Z","Loading skills...":"加载技能中...","Choose a thread":"选择一个线程","New worktree branch will start from {branch}.":"新工作树分支将从 {branch} 开始。","Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.":"本地项目会直接使用所选文件夹。新工作树会在第一次提问前创建一个隔离的 Git worktree。","Not configured":"未配置",Online:"在线","Configured (offline)":"已配置(离线)","allow all users":"允许所有用户","allowed user(s)":"个允许用户","chat(s)":"个聊天","thread(s)":"个线程",error:"错误",unknown:"未知","Switching…":"切换中…",Switch:"切换","Removing…":"移除中…","Click again to remove":"再次点击以移除","402 Payment Required":"402 需要付费","weekly remaining":"周剩余额度","Unlimited credits":"无限额度",credits:"额度","Loading quota…":"加载额度中…","Quota unavailable":"额度不可用","Fetching account details…":"获取账户详情中…","Unavailable account":"不可用账户","Waiting for Codex thread/tokenUsage/updated events for this thread.":"等待此线程的 Codex tokenUsage 更新事件。","Current context usage":"当前上下文使用量","Cumulative thread usage":"累计线程使用量","Model context window":"模型上下文窗口","Remaining context":"剩余上下文",tokens:"tokens","Model context window is unavailable in the latest usage event.":"最新使用事件中未提供模型上下文窗口。","Awaiting data":"等待数据中",left:"剩余",used:"已用","Updates after the next token usage event":"下次 token 使用事件后更新","Window size unavailable":"窗口大小不可用","Telegram bot token is required.":"需要填写 Telegram Bot Token。","At least one allowed Telegram user ID or * is required.":"至少需要一个允许的 Telegram 用户 ID 或 `*`。","Telegram bot configured. Only allowlisted Telegram users can use the bridge.":"Telegram 机器人已配置。只有白名单中的 Telegram 用户可以使用桥接。","Failed to connect Telegram bot":"连接 Telegram 机器人失败","Failed to load accounts":"加载账户失败","Failed to refresh accounts":"刷新账户失败",Login:"登录","Starting login…":"正在启动登录…","Open login URL":"打开登录链接","Paste localhost callback URL":"粘贴 localhost 回调 URL","Complete Codex login":"完成 Codex 登录","Finish login in the browser, then paste the localhost callback URL here.":"在浏览器中完成登录,然后在这里粘贴 localhost 回调 URL。",Complete:"完成","Completing…":"正在完成…","Failed to start Codex login":"启动 Codex 登录失败","Failed to complete Codex login":"完成 Codex 登录失败","Click Login, or run `codex login`, then click reload.":"点击登录,或运行 `codex login`,然后点击重新加载。","Finish the current turn and pending requests before switching accounts.":"请先完成当前轮次并处理待处理请求后再切换账户。","Failed to switch account":"切换账户失败","Finish the current turn and pending requests before removing the active account.":"请先完成当前轮次并处理待处理请求后再移除当前活动账户。","Failed to remove account":"移除账户失败",enabled:"已启用",disabled:"已禁用","Saving speed setting...":"保存速度设置中...","About 1.5x faster, with credits used at 2x":"速度约提升 1.5 倍,额度消耗为 2 倍","Default speed with normal credit usage":"默认速度,按正常额度消耗","Stop dictation":"停止听写","Click to dictate":"点击开始听写","Hold to dictate":"按住听写",failed:"失败",attaching:"正在附加",Attaching:"正在附加","Attaching file...":"正在附加文件...","files...":"个文件...",attached:"已附加","Could not attach file.":"无法附加文件。","Could not attach":"无法附加","files.":"个文件。","Select a thread to send a message":"选择一个线程后才能发送消息","Loading models for plan mode...":"正在为规划模式加载模型...","Ask Codex anything, @ to add files, / for commands":"向 Codex 提问,@ 添加文件,/ 执行命令",Hide:"隐藏",Terminal:"终端","Terminal input failed":"终端输入失败","Terminal attach failed":"终端附加失败","Creating worktree":"创建工作树","Creating a worktree and running setup.":"正在创建工作树并执行初始化。","Worktree setup failed":"工作树初始化失败","Unable to create worktree. Try again or switch to Local project.":"无法创建工作树。请重试,或切换到本地项目。",Edit:"编辑","Edit failed: the original message could not be rolled back. Try again.":"编辑保存失败:原消息未能回退。请重试。","Edit automation":"编辑自动化",image:"图片",images:"图片",file:"文件",files:"文件",skill:"技能",skills:"技能","(empty queued message)":"(空的排队消息)",Files:"文件",Unstaged:"未暂存",Staged:"已暂存",Refresh:"刷新",Against:"对比",selected:"已选","Reject Request":"拒绝请求","Uninstalling...":"卸载中...",Uninstall:"卸载","Installing...":"安装中...",Install:"安装",Disable:"禁用",Enable:"启用","When enabled, press Enter to send. When disabled, use Command+Enter to send.":"启用时按 Enter 发送;禁用时使用 Command+Enter 发送。","If a turn is still running, choose whether a new prompt should steer the current turn or be queued.":"如果当前轮次仍在运行,选择新提示是引导当前轮次还是加入队列。","Switch between system theme, light mode, and dark mode.":"在跟随系统、浅色和深色主题之间切换。","Choose how wide the conversation column and composer can grow on desktop screens.":"选择桌面端会话列和输入框的最大宽度。","Use click-to-start and click-to-stop dictation instead of hold-to-talk.":"使用点击开始/停止听写,而不是按住说话。","Automatically send transcribed dictation when recording stops.":"录音停止后自动发送转写结果。","Show or hide GitHub trending project cards on the new thread screen.":"显示或隐藏新线程页面上的 GitHub 热门项目卡片。","Choose transcription language or keep auto-detect.":"选择转写语言,或保持自动检测。",Standard:"标准",Wide:"宽","Extra wide":"超宽",Hooks:"Hooks","Reload lifecycle hooks":"重新加载生命周期 Hooks","Hooks are not supported by this Codex version.":"当前 Codex 版本不支持 Hooks。","Loading hooks…":"加载 Hooks 中…","No hooks registered.":"未注册任何 Hooks。",Global:"全局",Enabled:"已启用","Compacting thread context…":"正在压缩上下文…","Context compacted":"上下文已压缩","Agent note":"代理注记","Approval policy":"审批策略","Choose when Codex asks for your permission before running commands or changing files.":"选择 Codex 在执行命令或修改文件前何时征求你的许可。","Only untrusted commands":"仅不受信任的命令","After a command fails":"命令失败后","When Codex requests it":"请求时",Never:"从不","Unless trusted":"除非信任",Default:"默认","Execution plans":"执行计划","Not supported by this Codex version":"当前 Codex 版本不支持","Remote control":"远程控制","Enable or disable remote control":"启用或禁用远程控制","Remote control is not supported by this Codex version.":"当前 Codex 版本不支持远程控制。","Pair a new device":"配对新设备","Generate code":"生成配对码","Paired devices":"已配对设备","No paired devices.":"暂无已配对设备。",Revoke:"撤销","Starting…":"启动中…","Add panel":"添加面板","Approval policy saved":"审批策略已保存",Automations:"自动化","Bearer token (optional)":"Bearer Token(可选)","Close panel":"关闭面板","Close side panel":"关闭侧边面板",Codex:"Codex",Compact:"压缩","Compacting…":"正在压缩…","Compacts context before send":"发送前压缩上下文","Auto-compact before send":"发送前自动压缩","Compacting context — the message will send after compaction":"正在压缩上下文——消息将在压缩完成后发送","Auto-compact at or below remaining context percentage. 0 disables auto-compaction and falls back to server-side compaction.":"当剩余上下文占比等于或低于该百分比时,发送前先自动压缩上下文。0 表示关闭,退回服务端自动压缩。","Custom endpoint":"自定义端点","Failed to resolve model from custom endpoint; check the URL and try again":"无法从自定义端点获取模型,请检查 URL 后重试",Off:"关闭",Dismiss:"忽略",Download:"下载","Drag to reorder queued message":"拖动可重新排列排队消息","Exit full screen composer":"退出全屏输入框","Expand composer":"展开输入框","Explore Plugins & Apps":"探索插件与应用","Export Project":"导出项目",Exporting:"正在导出","Failed to share project. Use Download instead.":"项目分享失败,请改用下载。","Files panel":"文件面板","Filter files...":"筛选文件...",Git:"Git","Git panel":"Git 面板","Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.":"将 Codex 接入 Gmail、日历、GitHub、Slack、Browser Use 等应用,让它可以立即帮你处理实际工作。","Import Project":"导入项目","Importing…":"正在导入…","Issue detected":"发现问题","Loading files...":"加载文件中...","Loading…":"加载中…","New in Codex":"Codex 新功能","No files in workspace.":"工作区中没有文件。","No searchable directory for this thread":"此线程没有可搜索的目录","Open side panel":"打开侧边面板","OpenCode Zen":"OpenCode Zen",OpenRouter:"OpenRouter",Plugin:"插件","Plugins are here":"插件来了","Plugins, apps, MCPs":"插件、应用、MCP","Preparing project ZIP...":"正在准备项目 ZIP...","Preparing...":"正在准备...",Ready:"就绪",Repo:"仓库","Scheduled work":"定时任务",Search:"搜索","Search options...":"搜索选项...","Send feedback":"发送反馈",Share:"分享","Skills directory":"技能目录","Terminal panel":"终端面板","This browser blocked sharing the ZIP. Use Download instead.":"浏览器阻止了分享 ZIP,请改用下载。",User:"用户","sk-or-v1-... (optional, uses free keys if empty)":"sk-or-v1-...(可选,留空则使用免费 key)","File preview":"文件预览","Loading file…":"正在加载文件…","Failed to preview file":"文件预览失败","This file type cannot be previewed.":"此文件类型无法预览。","Open in browser":"在浏览器中打开","File is large; showing the first part.":"文件较大,仅显示开头部分。","Confirm delete":"确认删除",Confirm:"确认",Authenticated:"已认证",Failed:"失败","Logged in":"已登录",Unknown:"未知","No auth":"无需认证","No auth required":"无需认证","Connection required":"需要连接","Composio workspace":"Composio 工作区","Apps needing auth":"需要认证的应用","Plugin shares":"插件分享",Connector:"连接器",connected:"已连接",account:"个账户",accounts:"个账户",Manage:"管理",Reconnect:"重新连接",Connect:"连接",App:"应用",Plugins:"插件",Apps:"应用","Composio CLI shares the login and connections from this machine.":"Composio CLI 共享本机的登录状态与连接。","Bearer token":"Bearer Token","Login required":"需要登录","Auth unsupported":"不支持认证","Status unknown":"状态未知","OpenAI catalog":"OpenAI 目录","Ecosystem directory":"生态系统目录",Expired:"已过期",Pending:"待处理","Plugins make Codex work your way.":"插件让 Codex 按你的方式工作。","Connect Codex to external apps and services.":"将 Codex 连接到外部应用与服务。","Browse Composio connectors, auth state, and ready-to-try integrations.":"浏览 Composio 连接器、认证状态与可直接尝试的集成。","MCPs first, then installed skills and GitHub sync state.":"先看 MCP,再是已安装技能与 GitHub 同步状态。","Close plugin detail":"关闭插件详情","Close plugin shares":"关闭插件分享","Close Composio detail":"关闭 Composio 详情","Add another automation":"再添加一个自动化","New thread":"新建线程",methods:"个方法",Schedule:"计划",Daily:"每天",days:"天",Interval:"间隔","Run every day at":"每天运行时间","Run every":"每隔",Unit:"单位","Running…":"运行中…","Run now":"立即运行","Archive and remove":"归档并移除",Delete:"删除",'This will archive the thread "{title}" and remove the attached heartbeat automations.':"这将归档线程「{title}」并移除其关联的心跳自动化。",'This will archive the thread "{title}". You can find it later in archived threads.':"这将归档线程「{title}」。你之后可以在已归档线程中找到它。","Recycle bin":"回收站","Threads you removed are kept here so you can restore them.":"被移除的线程会保存在这里,你可以随时还原。","Recycle bin is empty.":"回收站是空的。",Restore:"还原","Restoring…":"还原中…","Delete permanently":"永久删除","Delete thread?":"删除线程?","Archive chat and remove automations?":"归档聊天并移除自动化?",active:"个进行中",added:"已新增","Add automation":"添加自动化","Add automation…":"添加自动化…",ago:"前","Answer the required field":"请填写必填字段",app:"应用",automations:"个自动化",cached:"缓存",changed:"已更改",Checkout:"检出","Checking out...":"检出中…","command:":"命令:","Context window":"上下文窗口","Copy path":"复制路径",Credits:"额度","cwd:":"工作目录:","day(s)":"天",deleted:"已删除",Detached:"已分离",edited:"已编辑",Edited:"已编辑",Every:"每","exitCode:":"退出码:","Failed to connect {name}":"连接 {name} 失败","Failed to start login for {name}":"为 {name} 启动登录失败","file changed":"个文件已更改","files changed":"个文件已更改","hour(s)":"小时",hours:"小时",Image:"图片",input:"输入","Last turn":"上一轮","Manage automations…":"管理自动化…","minute(s)":"分钟",minutes:"分钟",moved:"已移动","Network access":"网络访问",Next:"下次","Next run":"下次运行","Not scheduled":"未计划",RRULE:"规则","No login URL returned for {name}":"未返回 {name} 的登录链接","Opened {name} authorization":"已打开 {name} 授权",output:"输出",plugin:"插件","plugin installed":"插件已安装","plugin uninstalled":"插件已卸载",Preferred:"首选","Primary window":"主窗口","Project automation":"项目自动化",Read:"读取",reasoning:"推理","Removing...":"移除中…","resets in":"重置于","Resets in":"重置于","runs every":"每","Secondary window":"次窗口","Session total":"会话总计","Share this plugin":"共享此插件","Sharing...":"共享中…",Show:"显示","skill installed":"技能已安装","skill uninstalled":"技能已卸载","start new thread":"新建线程","status:":"状态:",total:"总计","Weekly refresh":"每周刷新",Write:"写入","Current branch":"当前分支","Credits available":"额度可用","Custom schedule":"自定义计划","Detached HEAD":"已分离 HEAD","Every minute":"每分钟",Hourly:"每小时","In context":"上下文内","Loading branch...":"加载分支中...","Rate limits":"速率限制","Resetting now":"正在重置",unlimited:"无限",Weekly:"每周",Window:"窗口","Automation details":"自动化详情","Automation run queued.":"自动化运行已排队。","Automation saved.":"自动化已保存。","Awaiting approval":"等待审批","Awaiting response":"等待响应",Branches:"分支",command:"个命令",commands:"个命令","Command approval required":"需要命令审批",Commits:"提交",Completed:"已完成","Copied commit ref":"已复制提交引用",Copied:"已复制",Copy:"复制","Copy chat":"复制聊天","Create a new automation":"创建新自动化","Create chat fork":"创建聊天分叉",current:"当前",Declined:"已拒绝",Done:"完成",Exit:"退出","Failed to delete project automation":"删除项目自动化失败","Failed to install skill":"安装技能失败","Failed to load automations":"加载自动化失败","Failed to load skills":"加载技能失败","Failed to remove automation":"移除自动化失败","Failed to run automation":"运行自动化失败","Failed to save automation":"保存自动化失败","Failed to search skills":"搜索技能失败","Failed to uninstall skill":"卸载技能失败","Failed to update file changes.":"更新文件变更失败。","Failed to update skill":"更新技能失败","File change approval required":"需要文件变更审批",Heartbeat:"心跳","Input required":"需要输入","Install completed but no local skill path was returned":"安装完成,但未返回本地技能路径","Install completed but the local skill was not found after refresh":"安装完成,但刷新后未找到本地技能","Install failed":"安装失败",Interrupted:"已中断","latest:":"最新:","Loading automations...":"加载自动化中...","Loading commits...":"加载提交中...","MCP server input required":"需要 MCP 服务器输入","Modified files":"修改的文件","New automation":"新自动化","No automations yet":"还没有自动化","No branches found.":"未找到分支。","No commits found.":"未找到提交。","No file changes.":"无文件更改。","No file changes to redo.":"没有可重做的文件变更。","No file changes to undo.":"没有可撤销的文件变更。","No messages in this thread yet. Type a message below to get started.":"此线程还没有消息。在下方输入消息即可开始。","Image attachment (preview unavailable)":"图片附件(无法预览)",now:"刚刚","Open this chat before copying":"请先打开此聊天再复制","Pin thread":"固定线程","Unpin thread":"取消固定线程",paused:"个已暂停","Permissions approval required":"需要权限审批",Project:"项目","Project automation requires a resolved absolute project path.":"项目自动化需要已解析的绝对项目路径。",Redo:"重做","Redo file changes?":"重做文件变更?","Redo the file changes from this turn? This reapplies the edits to the working tree.":"重做本轮的文件变更?这会重新将修改应用到工作树。",Redoing:"正在重做","Refreshing...":"刷新中...","Rejected from codex-web-local UI.":"已在 codex-web-local 界面中拒绝。","Rename project":"重命名项目",Reset:"重置","Reset-history refs":"重置历史引用",remote:"远程","Review Worktree Changes":"审查工作树更改","Review Worktree Changes (Open)":"审查工作树更改(打开)",Running:"运行中","Search commits...":"搜索提交...","Search skills":"搜索技能","Select a branch.":"请选择一个分支。","Select a chat target for this automation":"为此自动化选择一个聊天目标","Select a project target for this automation":"为此自动化选择一个项目目标",Stopped:"已停止","Command blocked by a permission or sandbox restriction; no approval prompt was shown. Check the approval policy or trusted directories if you expected one.":"命令因权限或沙箱限制被拦截,未弹出审批提示。如预期应出现审批,请检查审批策略或受信任目录。","Output trimmed: {omitted} omitted of {total}.":"输出已截断:省略 {omitted}(共 {total})。","Show full output":"查看完整输出","Loading full output…":"正在加载完整输出…","Could not load the full output.":"无法加载完整输出。",Target:"目标","This creates a heartbeat automation attached to the selected chat.":"这会在所选聊天上创建一个心跳自动化。","This creates a project automation attached to the selected project folder.":"这会在所选项目文件夹上创建一个项目自动化。","This creates heartbeat automations attached to the selected thread.":"这会在所选线程上创建心跳自动化。","This creates project automations attached to the selected project folder.":"这会在所选项目文件夹上创建项目自动化。","Tool call rejected from codex-web-local UI.":"工具调用已在 codex-web-local 界面中拒绝。","Tool call waiting for response":"工具调用等待响应","Tracked changes must be committed, stashed, or discarded before switching or resetting. Untracked files are allowed unless Git would overwrite them.":"切换或重置前,必须提交、暂存或丢弃已跟踪的更改。除非 Git 会覆盖,否则允许存在未跟踪的文件。",Undo:"撤销","Undo file changes?":"撤销文件变更?","Undo the file changes from this turn? This modifies the working tree and Codex cannot revert it automatically.":"撤销本轮的文件变更?这会修改工作树,Codex 无法自动还原。","Undo the changes to {file}? This modifies the working tree and Codex cannot revert it automatically.":"撤销对 {file} 的变更?这会修改工作树,Codex 无法自动还原。","Redo the changes to {file}? This reapplies the edits to the working tree.":"重做对 {file} 的变更?这会重新应用对工作树的编辑。",Undoing:"正在撤销","Uninstall failed":"卸载失败","Use a thread or project menu to add an automation.":"请通过线程或项目菜单添加自动化。","Command palette":"命令面板","Type a command...":"输入命令…","No matching commands":"没有匹配的命令",Thread:"线程",Panel:"面板",View:"视图",Navigate:"导航","Open the Git panel":"打开 Git 面板","Open the files panel":"打开文件面板","Toggle the terminal panel":"切换终端面板","Toggle the side panel":"切换侧边面板","Close the side panel":"关闭侧边面板","Toggle the sidebar":"切换侧栏","Cycle the color theme":"循环切换主题","Cycle the chat width":"循环切换聊天宽度","Switch the interface language":"切换界面语言","Toggle send with Enter":"切换回车发送","Cycle the in-progress send mode":"循环切换进行中发送方式","Open the automations page":"打开自动化页面","Open the recycle bin":"打开回收站","Open settings":"打开设置","Copy the conversation as Markdown":"复制对话为 Markdown","Stop the running turn":"停止正在运行的轮次","Implement the current plan":"执行当前计划","Keyboard shortcuts":"键盘快捷键","Press Esc to close":"按 Esc 关闭",Composer:"输入框",Navigation:"导航","Open the command palette":"打开命令面板","Close dialogs and popovers":"关闭弹窗与浮层","Send the message":"发送消息",'When "send with Enter" is on':"当「回车发送」开启时",'When "send with Enter" is off':"当「回车发送」关闭时","Insert a line break":"插入换行","Open the slash command menu":"打开斜杠命令菜单","Mention a file":"提及文件","Move through the menu":"在菜单中移动","Accept the highlighted suggestion":"接受高亮的候选","Dismiss the menu":"关闭菜单","Move the selection":"移动选择","Activate the focused item":"激活当前项","Jump to the first or last item":"跳到第一项 / 最后一项"},Tg={en:"English","zh-CN":"简体中文"};function _P(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(bw))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const Xc=S(_P());function Tw(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}Tw(Xc.value);function PP(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??"")):e}function EP(e){Xc.value=e,Tw(e),typeof window<"u"&&window.localStorage.setItem(bw,e)}function Sw(e,t){const n=Xc.value==="zh-CN"?AP[e]??e:e;return PP(n,t)}function ao(){return{uiLanguage:Xc,uiLanguageOptions:[{value:"en",label:Tg.en},{value:"zh-CN",label:Tg["zh-CN"]}],t:Sw,setUiLanguage:EP}}const kw="brutalstrikedevs@gmail.com",MP=20,RP=6500,Sg=1800,ef=12,kg=240,Cg=/token|secret|password|passwd|credential|authorization|auth|bearer|cookie|session|key/i,pl=S([]);let xg=!1,tf=!1,nf=null;function Kl(e){if(e instanceof Error)return e.stack||e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function LP(e){return typeof e=="string"?e:e instanceof URL?e.toString():e.url}function jP(e,t){var r;const n=(r=t==null?void 0:t.method)==null?void 0:r.trim();return n?n.toUpperCase():typeof e=="object"&&"method"in e&&typeof e.method=="string"&&e.method.trim()?e.method.trim().toUpperCase():"GET"}function Cw(e){return((e||"").split(/\r?\n/,1)[0]??"").replace(/\s+/g," ").trim().slice(0,80)||"issue report"}function Ig(e){return encodeURIComponent(e)}function NP(){return`mailto:${kw}`}function $P(){var t;if(typeof document>"u")return"unknown";const e=((t=document.body)==null?void 0:t.innerText.replace(/\r\n/g,`
47
+ `).replace(/[ \t]+/g," ").replace(/\n{3,}/g,`
48
+
49
+ `).trim())??"";return e?e.length>Sg?`${e.slice(0,Sg)}
50
+ ...[truncated]`:e:"No visible page text captured."}function OP(e,t){const n=t.replace(/\r\n/g,`
51
+ `).replace(/[ \t]+/g," ").trim();return n?Cg.test(e)||Cg.test(n)?`[omitted sensitive value, ${n.length} chars]`:n.length>kg?`${n.slice(0,kg)}...[truncated, ${n.length} chars total]`:n:""}function Ag(e,t){if(!e)return`${t}: unavailable`;try{const n=[],r=Math.min(e.length,ef);for(let a=0;a<r;a+=1){const s=e.key(a);s&&n.push(`${s}=${OP(s,e.getItem(s)??"")}`)}const o=e.length>ef?`
52
+ ...${e.length-ef} more item(s)`:"";return`${t}:
53
+ ${n.join(`
54
+ `)||"empty"}${o}`}catch(n){return`${t}: unavailable (${Cw(Kl(n))})`}}function DP(){return typeof window>"u"?"unknown":[`Path: ${window.location.pathname||"/"}`,`Hash: ${window.location.hash||"(none)"}`,`Search: ${window.location.search||"(none)"}`,`Online: ${typeof navigator>"u"?"unknown":String(navigator.onLine)}`,`Language: ${typeof navigator>"u"?"unknown":navigator.language}`,`Platform: ${typeof navigator>"u"?"unknown":navigator.platform}`,Ag(window.localStorage,"localStorage"),Ag(window.sessionStorage,"sessionStorage")].join(`
55
+ `)}function vi(e){const t=e.message.trim();if(!t)return;const n=pl.value[0];if(n&&n.kind===e.kind&&n.message===t&&n.url===e.url&&n.method===e.method&&n.status===e.status)return;const r={...e,message:t,atIso:e.atIso??new Date().toISOString()};pl.value=[r,...pl.value].slice(0,MP)}function xw(e=pl.value){var u;const t=typeof window>"u"?"unknown":`${window.innerWidth}x${window.innerHeight} @${window.devicePixelRatio||1}x`,n=typeof window>"u"?"unknown":window.location.href,r=typeof navigator>"u"?"unknown":navigator.userAgent,o="0.1.136",a="codex-mobile",s=e.slice(0,12).map((d,m)=>[`${m+1}. [${d.atIso}] ${d.kind}`,d.method?`${d.method}`:"",d.url??"",typeof d.status=="number"?`${d.status} ${d.statusText??""}`.trim():"",d.message].filter(Boolean).join(" | ")).join(`
56
+ `),i=["What happened?","","","Context",`URL: ${n}`,`User agent: ${r}`,`Viewport: ${t}`,`App version: ${o}`,`Worktree: ${a}`,"","Browser/app state",DP(),"","Recent diagnostics",s||"No diagnostics captured.","","Visible page text",$P()].join(`
57
+ `).slice(0,RP),l=`Codex Web feedback: ${Cw((u=e[0])==null?void 0:u.message)}`;return`mailto:${kw}?subject=${Ig(l)}&body=${Ig(i)}`}function FP(){typeof window>"u"||(window.location.href=xw())}function BP(){if(!(typeof window>"u")&&(xg||(xg=!0,window.addEventListener("error",e=>{vi({kind:"window-error",message:e.error?Kl(e.error):e.message,url:e.filename||window.location.href})}),window.addEventListener("unhandledrejection",e=>{vi({kind:"unhandled-rejection",message:Kl(e.reason),url:window.location.href})})),!tf)){if(typeof window.fetch!="function"){vi({kind:"fetch-error",message:"Feedback diagnostics could not monitor fetch: window.fetch is unavailable",url:window.location.href});return}try{nf=window.fetch.bind(window),window.fetch=async(e,t)=>{const n=LP(e),r=jP(e,t);try{const o=await nf(e,t);return o.ok||vi({kind:n.includes("/codex-api/")?"api-response":"fetch-error",message:`Request failed with HTTP ${o.status}`,url:n,method:r,status:o.status,statusText:o.statusText}),o}catch(o){throw vi({kind:"fetch-error",message:Kl(o),url:n,method:r}),o}},tf=!0}catch(e){nf=null,tf=!1;try{vi({kind:"fetch-error",message:`Feedback diagnostics could not monitor fetch: ${Kl(e)}`,url:window.location.href})}catch{}}}}function Iw(){const e=Y(()=>pl.value.length>0);function t(n,r){vi({kind:"visible-error",message:n,url:r||(typeof window>"u"?void 0:window.location.href)})}return{diagnostics:pl,hasFeedbackDiagnostics:e,recordVisibleFailure:t,openFeedbackMail:FP,buildFeedbackMailto:xw,feedbackMailtoBase:NP}}const Aw="codex-web-local.recycle-bin.v1";function _w(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Aw);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>!!n&&typeof n.id=="string"&&typeof n.title=="string"):[]}catch{return[]}}function _g(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Aw,JSON.stringify(e))}catch{}}const qa=S(_w());function UP(){function e(){qa.value=_w()}function t(o){qa.value=[{...o,archivedAtIso:new Date().toISOString()},...qa.value.filter(a=>a.id!==o.id)],_g(qa.value)}function n(o){qa.value=qa.value.filter(a=>a.id!==o),_g(qa.value)}async function r(o){if(!qa.value.some(a=>a.id===o))return{ok:!1,error:"Thread is not in the recycle bin"};try{return await TA(o),n(o),{ok:!0}}catch(a){return{ok:!1,error:a instanceof Error?a.message:"Failed to restore thread"}}}return{records:qa,loadRecords:e,recordArchivedThread:t,removeArchivedRecord:n,restoreArchivedThread:r}}function Pg(e){const t=Date.parse(e.updatedAtIso);return Number.isFinite(t)?t:0}function zP(e){let t=!1;const n=e.map(r=>{const o=[],a=new Map;for(const s of r.threads){const i=a.get(s.id);if(i===void 0){a.set(s.id,o.length),o.push(s);continue}t=!0,Pg(s)>Pg(o[i])&&(o[i]=s)}return o.length===r.threads.length?r:{...r,threads:o}});return t?n:e}const HP=["title","aria-label","disabled"],WP={key:1,class:"composer-dropdown-value"},qP={key:0,class:"composer-dropdown-search-wrap"},GP=["placeholder","onKeydown"],VP={class:"composer-dropdown-options",role:"listbox"},KP=["onClick"],YP={key:0,class:"composer-dropdown-empty"},JP=fn({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},selectedPrefixIcon:{},iconOnly:{type:Boolean},openDirection:{},menuAlign:{},enableSearch:{type:Boolean},searchPlaceholder:{},emptyLabel:{},variant:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,o=S(null),a=S(null),s=S(null),i=S(null),l=S(!1),u=S(""),d=S({});let m=!1;const f=Y(()=>{var Ae;const te=n.options.find(Oe=>Oe.value===n.modelValue);return te?te.label:((Ae=n.placeholder)==null?void 0:Ae.trim())||""}),v=Y(()=>n.openDirection??"down"),T=Y(()=>n.menuAlign??"start"),k=Y(()=>n.iconOnly===!0),R=Y(()=>n.enableSearch===!0),E=Y(()=>n.variant==="pill"?"composer-dropdown-trigger--pill":""),N=Y(()=>{var te;return((te=n.searchPlaceholder)==null?void 0:te.trim())||"Quick search projects"}),q=Y(()=>{var te;return((te=n.emptyLabel)==null?void 0:te.trim())||"No results"}),K=Y(()=>{var te;return f.value||((te=n.placeholder)==null?void 0:te.trim())||"Select option"}),U=Y(()=>{const te=u.value.trim().toLowerCase();return te?n.options.filter(Ae=>Ae.label.toLowerCase().includes(te)||Ae.value.toLowerCase().includes(te)):n.options});function ce(){n.disabled||(l.value=!l.value)}function G(te,Ae,Oe){return Math.min(Oe,Math.max(Ae,te))}function le(){var ne,se,Le,We;if(!l.value)return;const te=o.value;if(!te||typeof window>"u")return;const Ae=te.getBoundingClientRect(),Oe=window.innerWidth,$e=window.innerHeight,De=8,Se=8,Te=Math.max(0,Oe-De*2),xe=((ne=s.value)==null?void 0:ne.offsetWidth)??((se=a.value)==null?void 0:se.offsetWidth)??224,Ee=((Le=s.value)==null?void 0:Le.offsetHeight)??((We=a.value)==null?void 0:We.offsetHeight)??0,Je=Math.min(xe,Te),Xe=Math.max(De,Oe-Je-De),nt=T.value==="end"?Ae.right-Je:Ae.left,de=G(nt,De,Xe);let D=v.value==="up"?Ae.top-Ee-Se:Ae.bottom+Se;Ee>0&&D+Ee>$e-De&&(D=$e-Ee-De),D=Math.max(De,D),d.value={position:"fixed",left:`${de}px`,right:"auto",top:`${D}px`,bottom:"auto",width:`${Je}px`}}function ye(){m||typeof window>"u"||(window.addEventListener("resize",le),window.addEventListener("scroll",le,!0),m=!0)}function _e(){!m||typeof window>"u"||(window.removeEventListener("resize",le),window.removeEventListener("scroll",le,!0),m=!1)}function we(te){r("update:modelValue",te),l.value=!1,u.value=""}function ee(){if(u.value.length>0){u.value="";return}l.value=!1}function he(te){if(!l.value)return;const Ae=o.value;if(!Ae)return;const Oe=te.target;Oe instanceof Node&&(Ae.contains(Oe)||(l.value=!1,u.value=""))}return ot(l,te=>{if(!te){_e(),d.value={};return}ye(),Et(()=>{var Ae;le(),window.requestAnimationFrame(le),R.value&&((Ae=i.value)==null||Ae.focus())})}),ss(()=>{window.addEventListener("pointerdown",he)}),Ks(()=>{window.removeEventListener("pointerdown",he),_e()}),(te,Ae)=>(_(),B("div",{ref_key:"rootRef",ref:o,class:"composer-dropdown"},[w("button",{class:ct(["composer-dropdown-trigger",E.value]),type:"button",title:K.value,"aria-label":K.value,disabled:e.disabled,onClick:ce},[e.selectedPrefixIcon?(_(),Ze(mh(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):ve("",!0),k.value?ve("",!0):(_(),B("span",WP,O(f.value),1)),Fe(zs,{class:"composer-dropdown-chevron"})],10,HP),l.value?(_(),B("div",{key:0,ref_key:"menuWrapRef",ref:a,class:ct(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":v.value==="up","composer-dropdown-menu-wrap-down":v.value==="down"}]),style:Zr(d.value)},[w("div",{ref_key:"menuRef",ref:s,class:"composer-dropdown-menu"},[R.value?(_(),B("div",qP,[In(w("input",{ref_key:"searchInputRef",ref:i,"onUpdate:modelValue":Ae[0]||(Ae[0]=Oe=>u.value=Oe),class:"composer-dropdown-search-input",type:"text",placeholder:N.value,onKeydown:kr(mt(ee,["prevent"]),["esc"])},null,40,GP),[[jn,u.value]])])):ve("",!0),w("ul",VP,[(_(!0),B(at,null,Ht(U.value,Oe=>(_(),B("li",{key:Oe.value},[w("button",{class:ct(["composer-dropdown-option",{"is-selected":Oe.value===e.modelValue}]),type:"button",onClick:$e=>we(Oe.value)},O(Oe.label),11,KP)]))),128)),U.value.length===0?(_(),B("li",YP,O(q.value),1)):ve("",!0)])],512)],6)):ve("",!0)],512))}}),Ci=Tt(JP,[["__scopeId","data-v-58b5aa2e"]]),QP={},XP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ZP(e,t){return _(),B("svg",XP,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const kc=Tt(QP,[["render",ZP]]),e1=["aria-label","onKeydown"],t1={class:"app-dialog-header"},n1={class:"app-dialog-title-wrap"},r1={class:"app-dialog-title"},o1={key:0,class:"app-dialog-subtitle"},a1=["aria-label","title"],s1={class:"app-dialog-body"},i1={key:0,class:"app-dialog-footer"},l1=fn({__name:"AppDialog",props:{open:{type:Boolean},title:{},subtitle:{default:""},ariaLabel:{default:""},size:{default:"sm"}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,{t:o}=ao();function a(){r("close")}function s(i){n.open&&i.key==="Escape"&&(i.preventDefault(),a())}return ot(()=>n.open,i=>{typeof window>"u"||(i?window.addEventListener("keydown",s):window.removeEventListener("keydown",s))},{immediate:!0}),Ks(()=>{typeof window>"u"||window.removeEventListener("keydown",s)}),(i,l)=>(_(),Ze(Ws,{to:"body"},[e.open?(_(),B("div",{key:0,class:"app-dialog-overlay",onClick:mt(a,["self"])},[w("div",{class:ct(["app-dialog-panel",`app-dialog-panel--${e.size}`]),role:"dialog","aria-modal":"true","aria-label":e.ariaLabel||e.title,onKeydown:kr(mt(a,["prevent"]),["esc"])},[w("div",t1,[w("div",n1,[w("h3",r1,O(e.title),1),e.subtitle?(_(),B("p",o1,O(e.subtitle),1)):ve("",!0)]),w("button",{class:"app-dialog-close",type:"button","aria-label":g(o)("Close"),title:g(o)("Close"),onClick:a},[Fe(kc,{class:"app-dialog-close-icon"})],8,a1)]),w("div",s1,[Cr(i.$slots,"default",{},void 0)]),i.$slots.footer?(_(),B("div",i1,[Cr(i.$slots,"footer",{},void 0)])):ve("",!0)],42,e1)])):ve("",!0)]))}}),rf=Tt(l1,[["__scopeId","data-v-3405af9b"]]),u1={key:0,class:"sidebar-menu-row-left"},c1={class:"sidebar-menu-row-main"},d1={key:1,class:"sidebar-menu-row-right"},f1={key:0,class:"sidebar-menu-row-right-default"},h1={key:1,class:"sidebar-menu-row-right-hover"},p1=fn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=gk(),r=Y(()=>!!n.left),o=Y(()=>!!n.right),a=Y(()=>!!n["right-hover"]),s=Y(()=>o.value||a.value);return(i,l)=>(_(),Ze(mh(t.as),bh({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":s.value,"data-has-right-hover":a.value,"data-force-right-hover":t.forceRightHover},i.$attrs),{default:ht(()=>[r.value?(_(),B("span",u1,[Cr(i.$slots,"left",{},void 0,!0)])):ve("",!0),w("span",c1,[Cr(i.$slots,"default",{},void 0,!0)]),s.value?(_(),B("span",d1,[o.value?(_(),B("span",f1,[Cr(i.$slots,"right",{},void 0,!0)])):ve("",!0),a.value?(_(),B("span",h1,[Cr(i.$slots,"right-hover",{},void 0,!0)])):ve("",!0)])):ve("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),js=Tt(p1,[["__scopeId","data-v-06eaad4c"]]),m1={},g1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function v1(e,t){return _(),B("svg",g1,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 18v-6m0 0a4 4 0 0 1 4-4h2m-6 4a4 4 0 0 0-4-4H6m0-4a2 2 0 1 0 0 4a2 2 0 0 0 0-4m12 0a2 2 0 1 0 0 4a2 2 0 0 0 0-4m-6 14a2 2 0 1 0 0 4a2 2 0 0 0 0-4"},null,-1)])])}const Cc=Tt(m1,[["render",v1]]),y1={},w1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function b1(e,t){return _(),B("svg",w1,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"},null,-1)])])}const Pw=Tt(y1,[["render",b1]]),T1=["data-menu-open"],S1={class:"thread-left-stack"},k1=["data-state"],C1=["data-confirming","title"],x1={key:0,class:"thread-delete-confirm-label"},I1=["title"],A1={class:"thread-row-title-wrap"},_1={class:"thread-row-title-line"},P1={class:"thread-row-title"},E1={key:0,class:"thread-row-originator"},M1=["title"],R1={key:0,class:"thread-row-automation-count"},L1=["data-state"],j1={class:"thread-row-time"},N1=fn({__name:"SidebarThreadRow",props:{thread:{},selected:{type:Boolean},pinned:{type:Boolean},menuOpen:{type:Boolean},showStatusIndicator:{type:Boolean},threadState:{},inlineDeleteConfirming:{type:Boolean},automationCount:{},automationTooltip:{},requestLabel:{},relativeTime:{},deleteLabel:{},confirmDeleteLabel:{},confirmLabel:{},worktreeLabel:{},setMenuWrapRef:{type:Function}},emits:["select","inline-delete","menu-toggle","row-leave","row-contextmenu"],setup(e,{emit:t}){const n=e,r=t,o=Y(()=>n.thread.originator?`${n.thread.originator}`:"");function a(s){n.setMenuWrapRef(s instanceof HTMLDivElement?s:null)}return(s,i)=>(_(),B("li",{class:"thread-row-item","data-menu-open":n.menuOpen?"true":"false"},[Fe(js,{class:"thread-row","data-thread-id":n.thread.id,"data-active":n.selected,"data-live":n.threadState==="working"?"true":"false","data-pinned":n.pinned,"data-menu-open":n.menuOpen?"true":"false","force-right-hover":n.menuOpen,onClick:i[3]||(i[3]=l=>r("select")),onMouseleave:i[4]||(i[4]=l=>r("row-leave",l)),onContextmenu:i[5]||(i[5]=l=>r("row-contextmenu",l))},{left:ht(()=>[w("span",S1,[n.showStatusIndicator?(_(),B("span",{key:0,class:"thread-status-indicator","data-state":n.threadState},null,8,k1)):ve("",!0),w("button",{class:"thread-delete-button",type:"button","data-confirming":n.inlineDeleteConfirming,title:n.inlineDeleteConfirming?n.confirmDeleteLabel:n.deleteLabel,onClick:i[0]||(i[0]=mt(l=>r("inline-delete"),["stop"]))},[n.inlineDeleteConfirming?(_(),B("span",x1,O(n.confirmLabel),1)):(_(),Ze(Pw,{key:1,class:"thread-icon"}))],8,C1)])]),right:ht(()=>[w("span",j1,O(n.relativeTime),1)]),"right-hover":ht(()=>[w("div",{ref:a,class:"thread-menu-wrap"},[w("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:i[2]||(i[2]=mt(l=>r("menu-toggle"),["stop"]))},[Fe(Df,{class:"thread-icon"})])])]),default:ht(()=>[w("button",{class:"thread-main-button",type:"button",title:o.value,onClick:i[1]||(i[1]=mt(l=>r("select"),["stop"]))},[w("span",A1,[w("span",_1,[w("span",P1,O(n.thread.title),1),n.thread.originator?(_(),B("span",E1,O(n.thread.originator),1)):ve("",!0),n.thread.hasWorktree?(_(),Ze(Cc,{key:1,class:"thread-row-worktree-icon",title:n.worktreeLabel},null,8,["title"])):ve("",!0),n.automationCount>0?(_(),B("span",{key:2,class:"thread-row-automation-chip",title:n.automationTooltip},[Fe(Qc,{class:"thread-row-automation-icon"}),n.automationCount>1?(_(),B("span",R1,O(n.automationCount),1)):ve("",!0)],8,M1)):ve("",!0),n.thread.pendingRequestState?(_(),B("span",{key:3,class:"thread-row-request-chip","data-state":n.thread.pendingRequestState},O(n.requestLabel),9,L1)):ve("",!0)])])],8,I1)]),_:1},8,["data-thread-id","data-active","data-live","data-pinned","data-menu-open","force-right-hover"])],8,T1))}}),Vu=Tt(N1,[["__scopeId","data-v-d01c8f46"]]);function $1(e,t,n){return n.canPruneMissing?e.filter(r=>t.has(r)):e}function O1(e){const{getGroups:t,t:n}=e,r=S({}),o=S({}),a=S(!1),s=S("thread"),i=S(""),l=S(""),u=S(""),d=S("create"),m=S(!1),f=S("thread"),v=S(""),T=S(""),k=S(""),R=S(""),E=S(!1),N=S(!1),q=S({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),K=S({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),U=Y(()=>{if(s.value==="project"){const pe=l.value;return pe?o.value[pe]??[]:[]}const X=i.value;return X?r.value[X]??[]:[]}),ce=Y(()=>de(q.value.rrule)),G=Y(()=>m.value&&d.value==="create"?f.value==="thread"?n("This creates a heartbeat automation attached to the selected chat."):n("This creates a project automation attached to the selected project folder."):s.value==="project"?n("This creates project automations attached to the selected project folder."):n("This creates heartbeat automations attached to the selected thread.")),le=Y(()=>{var pe;const X=[];for(const Ce of t())for(const Be of Ce.threads){const yt=((pe=Be.title)==null?void 0:pe.trim())||Be.id,wt=e.getProjectDisplayName(Ce.projectName);X.push({value:Be.id,label:`${yt} · ${wt}`,searchText:`${yt} ${wt} ${Be.id}`.toLowerCase()})}return X}),ye=Y(()=>{const X=[];for(const pe of t()){const Ce=e.getProjectAutomationKey(pe.projectName);if(!Ce)continue;const Be=e.getProjectDisplayName(pe.projectName);X.push({value:Ce,label:Be,searchText:`${Be} ${Ce}`.toLowerCase()})}return X}),_e=Y(()=>(f.value==="project"?ye.value:le.value).map(pe=>({value:pe.value,label:pe.label}))),we=[{value:"minutes",label:n("minutes")},{value:"hours",label:n("hours")},{value:"days",label:n("days")}],ee=Y(()=>[{value:"ACTIVE",label:n("Active")},{value:"PAUSED",label:n("Paused")}]);ot(_e,X=>{var pe;m.value&&(X.some(Ce=>Ce.value===v.value)||(v.value=((pe=X[0])==null?void 0:pe.value)??""))});function he(X){var pe;return((pe=r.value[X])==null?void 0:pe.length)??0}function te(X){return he(X)>0}function Ae(X){var Ce;const pe=e.getProjectAutomationKey(X);return pe?((Ce=o.value[pe])==null?void 0:Ce.length)??0:0}function Oe(X){return Ae(X)>0}function $e(X){if(X.length===0)return"";if(X.length>1){const Be=X.filter(yt=>yt.status==="ACTIVE").length;return`${X.length} ${n("automations")} • ${Be} ${n("active")}`}const[pe]=X,Ce=pe.status==="PAUSED"?"-":pe.nextRunAtMs?new Date(pe.nextRunAtMs).toLocaleString():n("Not scheduled");return`${pe.name} • ${n("Next run")}: ${Ce}`}function De(X){return $e(r.value[X]??[])}function Se(X){const pe=e.getProjectAutomationKey(X);return $e(pe?o.value[pe]??[]:[])}function Te(X){return String(Math.max(0,X)).padStart(2,"0")}function xe(X,pe){const Ce=typeof X=="number"?X:Number(X);return Number.isFinite(Ce)?Math.max(1,Math.floor(Ce)):pe}function Ee(X){const[pe,Ce]=X.split(":"),Be=Math.min(23,Math.max(0,Number(pe)||0)),yt=Math.min(59,Math.max(0,Number(Ce)||0));return`FREQ=DAILY;BYHOUR=${Be};BYMINUTE=${yt}`}function Je(X,pe){const Ce=xe(X,1);return pe==="minutes"?`FREQ=MINUTELY;INTERVAL=${Ce}`:pe==="hours"?`FREQ=HOURLY;INTERVAL=${Ce}`:`FREQ=DAILY;INTERVAL=${Ce}`}function Xe(X){return Object.fromEntries(X.split(";").map(pe=>pe.trim()).filter(Boolean).map(pe=>{const[Ce,...Be]=pe.split("=");return[Ce.toUpperCase(),Be.join("=").trim()]}).filter(([pe,Ce])=>pe&&Ce))}function nt(X){var yt;const pe=Xe(X),Ce=(yt=pe.FREQ)==null?void 0:yt.toUpperCase(),Be=xe(pe.INTERVAL,1);if(Ce==="DAILY"&&pe.BYHOUR!==void 0&&pe.BYMINUTE!==void 0&&Be===1){const wt=Math.min(23,Math.max(0,Number(pe.BYHOUR)||0)),Dt=Math.min(59,Math.max(0,Number(pe.BYMINUTE)||0));return{mode:"daily",dailyTime:`${Te(wt)}:${Te(Dt)}`,interval:1,intervalUnit:"hours"}}return Ce==="MINUTELY"||Ce==="HOURLY"||Ce==="DAILY"&&pe.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:Be,intervalUnit:Ce==="MINUTELY"?"minutes":Ce==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function de(X){var yt;const pe=Xe(X),Ce=(yt=pe.FREQ)==null?void 0:yt.toUpperCase(),Be=xe(pe.INTERVAL,1);if(Ce==="DAILY"&&pe.BYHOUR!==void 0&&pe.BYMINUTE!==void 0&&Be===1){const wt=Math.min(23,Math.max(0,Number(pe.BYHOUR)||0)),Dt=Math.min(59,Math.max(0,Number(pe.BYMINUTE)||0));return`${n("RRULE")}: ${X} · ${n("runs daily at")} ${Te(wt)}:${Te(Dt)}`}return Ce==="MINUTELY"?`${n("RRULE")}: ${X} · ${n("runs every")} ${Be} ${n("minute(s)")}`:Ce==="HOURLY"?`${n("RRULE")}: ${X} · ${n("runs every")} ${Be} ${n("hour(s)")}`:Ce==="DAILY"&&pe.INTERVAL!==void 0?`${n("RRULE")}: ${X} · ${n("runs every")} ${Be} ${n("day(s)")}`:X?`${n("RRULE")}: ${X}`:n("RRULE is required.")}function D(){const X=K.value;X.mode==="daily"?q.value.rrule=Ee(X.dailyTime):X.mode==="interval"&&(q.value.rrule=Je(X.interval,X.intervalUnit))}function ne(X){X!=="minutes"&&X!=="hours"&&X!=="days"||(K.value={...K.value,intervalUnit:X},D())}function se(X){X!=="ACTIVE"&&X!=="PAUSED"||(q.value={...q.value,status:X})}function Le(){K.value=nt(q.value.rrule)}function We(X){K.value={...K.value,mode:X},D()}function P(X){var Ce;s.value="thread",i.value=X,l.value="",m.value=!1,T.value="",k.value="";const pe=(Ce=r.value[X])==null?void 0:Ce[0];pe?Pe(pe.id):ie(),a.value=!0,e.closeThreadMenu()}function j(X){var Be;const pe=e.getProjectAutomationKey(X);if(!pe){s.value="project",i.value="",l.value="",m.value=!1,T.value=n("Project automation requires a resolved absolute project path."),k.value="",a.value=!0,e.closeProjectMenu();return}s.value="project",i.value="",l.value=pe,m.value=!1,T.value="",k.value="";const Ce=(Be=o.value[pe])==null?void 0:Be[0];Ce?Pe(Ce.id):ie(),a.value=!0,e.closeProjectMenu()}function W(X){s.value=X.scope,i.value=X.scope==="thread"?X.target:"",l.value=X.scope==="project"?X.target:"",m.value=!1,T.value="",k.value="",X.scope==="project"?o.value=qe(o.value,X.target,X.automation):r.value=ge(r.value,X.target,X.automation),Pe(X.automation.id),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function ue(){var X;m.value=!0,f.value="thread",v.value=((X=le.value[0])==null?void 0:X.value)??"",s.value="thread",i.value="",l.value="",T.value="",k.value="",ie(),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function ae(X){var pe;f.value=X,v.value="",s.value=X==="project"?"project":"thread",v.value=((pe=_e.value[0])==null?void 0:pe.value)??""}function ie(){u.value="",d.value="create",T.value="",k.value="",q.value={name:s.value==="project"?"Project automation":"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},K.value=nt(q.value.rrule)}function Pe(X){const pe=U.value.find(Ce=>Ce.id===X);pe&&(u.value=pe.id,d.value="edit",T.value="",k.value="",q.value={name:pe.name,prompt:pe.prompt,rrule:pe.rrule,status:pe.status},K.value=nt(pe.rrule))}function je(){a.value=!1,s.value="thread",i.value="",l.value="",u.value="",T.value="",k.value="",E.value=!1,N.value=!1}function Ie(X,pe){return Object.fromEntries(Object.entries(X).filter(([Ce])=>Ce!==pe))}function ge(X,pe,Ce){const Be=X[pe]??[],yt=Be.findIndex(Dt=>Dt.id===Ce.id),wt=[...Be];return yt>=0?wt.splice(yt,1,Ce):wt.push(Ce),{...X,[pe]:wt}}function Ke(X,pe,Ce){const Be=(X[pe]??[]).filter(yt=>yt.id!==Ce);return Be.length>0?{...X,[pe]:Be}:Ie(X,pe)}function Ne(X,pe){return Object.fromEntries(Object.entries(X).filter(([Ce])=>Ce!==pe))}function qe(X,pe,Ce){const Be=X[pe]??[],yt=Be.findIndex(Dt=>Dt.id===Ce.id),wt=[...Be];return yt>=0?wt.splice(yt,1,Ce):wt.push(Ce),{...X,[pe]:wt}}async function Ge(){o.value=await lI()}async function dt(X){await eg(X).catch(()=>{}),r.value=Ie(r.value,X)}async function St(){let X=i.value,pe=l.value;E.value=!0,T.value="",k.value="";try{if(D(),m.value&&d.value==="create"&&(f.value==="thread"?(X=v.value,pe="",s.value="thread",i.value=X,l.value=""):(pe=v.value,X="",s.value="project",i.value="",l.value=pe)),s.value==="thread"&&!X)throw new Error(n("Select a chat target for this automation"));if(s.value==="project"&&!pe)throw new Error(n("Select a project target for this automation"));const Ce={id:u.value||void 0,name:q.value.name,prompt:q.value.prompt,rrule:q.value.rrule,status:q.value.status},Be=s.value==="project"?await cI({...Ce,projectName:pe}):await uI({...Ce,threadId:X});s.value==="project"?await Ge():r.value=ge(r.value,X,Be),e.onAutomationsChanged(),Pe(Be.id),k.value=n("Automation saved."),E.value=!1}catch(Ce){T.value=Ce instanceof Error?Ce.message:n("Failed to save automation"),E.value=!1}}async function st(){const X=i.value,pe=l.value,Ce=u.value;if(Ce&&!(s.value==="thread"&&!X)&&!(s.value==="project"&&!pe)){E.value=!0,T.value="",k.value="";try{s.value==="project"?(await Xy(pe,Ce),await Ge()):(await eg(X,Ce),r.value=Ke(r.value,X,Ce));const Be=U.value[0];Be?Pe(Be.id):ie(),e.onAutomationsChanged(),E.value=!1}catch(Be){T.value=Be instanceof Error?Be.message:n("Failed to remove automation"),E.value=!1}}}async function ut(){const X=i.value,pe=u.value;if(!(!X||!pe)){N.value=!0,T.value="",k.value="";try{await dI(X,pe),k.value=n("Automation run queued.")}catch(Ce){T.value=Ce instanceof Error?Ce.message:n("Failed to run automation")}finally{N.value=!1}}}return{automationByThreadId:r,automationByProjectName:o,automationDialogVisible:a,automationDialogScope:s,automationDialogThreadId:i,automationDialogProjectName:l,automationDialogAutomationId:u,automationDialogMode:d,automationTargetPickerVisible:m,automationTargetMode:f,automationTargetValue:v,automationDialogError:T,automationDialogNotice:k,projectAutomationActionError:R,isSavingAutomation:E,isRunningAutomation:N,automationDraft:q,automationScheduleDraft:K,automationDialogAutomations:U,automationSchedulePreview:ce,automationDialogSubtitle:G,automationThreadTargetOptions:le,automationProjectTargetOptions:ye,automationTargetDropdownOptions:_e,automationIntervalUnitOptions:we,automationStatusOptions:ee,threadAutomationCount:he,threadHasAutomation:te,projectAutomationCount:Ae,projectHasAutomation:Oe,threadAutomationTooltip:De,projectAutomationTooltip:Se,syncAutomationRruleFromScheduleDraft:D,onAutomationIntervalUnitChange:ne,onAutomationStatusChange:se,syncAutomationScheduleDraftFromRrule:Le,setAutomationScheduleMode:We,openAutomationDialog:P,openProjectAutomationDialog:j,openAutomationEditorFromPanel:W,openAutomationCreatorFromPanel:ue,setAutomationTargetMode:ae,startNewAutomationDraft:ie,selectAutomationForEditing:Pe,closeAutomationDialog:je,omitAutomationProject:Ne,reloadProjectAutomations:Ge,removeAutomationsForThread:dt,submitAutomationDialog:St,onDeleteAutomationFromDialog:st,onRunAutomationFromDialog:ut}}const D1=4,Eg=6;function F1(e,t,n){if(e===null||n===0)return null;const r=Math.max(0,Math.min(e,n)),o=r>t?r-1:r,a=Math.max(0,Math.min(o,n-1));return a===t?null:a}function B1(e){const{getGroups:t,getFilteredGroups:n,isSearchActive:r,isCollapsed:o,getElevatedProjectName:a,onReorderProject:s,closeProjectMenu:i}=e,l=S(null),u=S(null),d=S(null);let m=null,f=null;const v=S(""),T=S({}),k=new Map,R=new WeakMap,E=typeof window<"u"?new ResizeObserver(de=>{for(const D of de){const ne=D.target,se=R.get(ne);se&&q(se,ne)}}):null,N=()=>{var de,D;return((de=d.value)==null?void 0:de.projectName)??((D=u.value)==null?void 0:D.projectName)??""};function q(de,D){const ne=D.getBoundingClientRect().height;if(!Number.isFinite(ne)||ne<=0)return;const se=T.value[de];se!==void 0&&Math.abs(se-ne)<.5||(T.value={...T.value,[de]:ne})}function K(de,D){const ne=k.get(de);ne&&ne!==D&&E&&E.unobserve(ne);const se=D instanceof HTMLElement?D:D&&"$el"in D&&D.$el instanceof HTMLElement?D.$el:null;if(se){k.set(de,se),R.set(se,de),q(de,se),E==null||E.observe(se);return}ne&&(E==null||E.unobserve(ne)),k.delete(de)}function U(de){const D=T.value[de]??0,ne=d.value,Le=((ne==null?void 0:ne.projectName)===de?ne.groupHeight:null)??D,We=o(de)?0:Eg;return Math.max(0,Le+We)}const ce=Y(()=>{const de=d.value;return de?F1(de.dropTargetIndexFull,de.fromIndex,t().length):null}),G=Y(()=>{const D=(r()?n():t()).map(P=>P.projectName),ne=d.value,se=ce.value;if(!ne||se===null)return D;const Le=[...D],[We]=Le.splice(ne.fromIndex,1);return We?(Le.splice(se,0,We),Le):D}),le=Y(()=>{const de={};let D=0;for(const ne of G.value)de[ne]=D,D+=U(ne);return de}),ye=Y(()=>{let de=0;for(const D of G.value)de+=U(D);return{height:`${Math.max(0,de)}px`}});function _e(de,D){if(de.button!==0||r()||u.value||d.value)return;const se=t().findIndex(j=>j.projectName===D),Le=k.get(D);if(se<0||!Le)return;const We=Le.getBoundingClientRect(),P=o(D)?0:Eg;u.value={projectName:D,fromIndex:se,startClientX:de.clientX,startClientY:de.clientY,pointerOffsetY:de.clientY-We.top,groupLeft:We.left,groupWidth:We.width,groupHeight:We.height,groupOuterHeight:We.height+P},de.preventDefault(),we()}function we(){window.addEventListener("mousemove",he),window.addEventListener("mouseup",te),window.addEventListener("keydown",Ae)}function ee(){window.removeEventListener("mousemove",he),window.removeEventListener("mouseup",te),window.removeEventListener("keydown",Ae)}function he(de){m={clientX:de.clientX,clientY:de.clientY},$e()}function te(de){De({clientX:de.clientX,clientY:de.clientY});const D=d.value;if(D&&ce.value!==null){const ne=t().findIndex(se=>se.projectName===D.projectName);if(ne>=0){const se=ce.value;se!==ne&&s(D.projectName,se)}}Oe({preserveToggleSuppression:!!D})}function Ae(de){de.key==="Escape"&&(!u.value&&!d.value||(de.preventDefault(),Oe()))}function Oe(de={}){f!==null&&(window.cancelAnimationFrame(f),f=null),m=null,u.value=null,d.value=null,de.preserveToggleSuppression||(v.value=""),ee()}function $e(){f===null&&(f=window.requestAnimationFrame(()=>{if(f=null,!m)return;const de=m;m=null,De(de)}))}function De(de){const D=u.value;if(!d.value&&D){const ne=de.clientX-D.startClientX,se=de.clientY-D.startClientY;if(Math.hypot(ne,se)<D1)return;i(),v.value=D.projectName,d.value={projectName:D.projectName,fromIndex:D.fromIndex,pointerOffsetY:D.pointerOffsetY,groupLeft:D.groupLeft,groupWidth:D.groupWidth,groupHeight:D.groupHeight,groupOuterHeight:D.groupOuterHeight,ghostTop:de.clientY-D.pointerOffsetY,dropTargetIndexFull:null}}d.value&&Se(de)}function Se(de){const D=d.value;if(!D)return;if(D.ghostTop=de.clientY-D.pointerOffsetY,!Te(de)){D.dropTargetIndexFull=null;return}const ne=de.clientY,se=l.value;if(!se){D.dropTargetIndexFull=null;return}const Le=t(),We=se.getBoundingClientRect(),P=new Map(Le.map((ae,ie)=>[ae.projectName,ie])),j=Le.map(ae=>ae.projectName).filter(ae=>ae!==D.projectName);let W=0,ue=Le.length;for(const ae of j){const ie=P.get(ae);if(ie===void 0)continue;const Pe=U(ae),je=We.top+W+Pe/2;if(ne<je){ue=ie;break}W+=Pe}D.dropTargetIndexFull=ue}function Te(de){const D=l.value;if(!D)return!1;const ne=D.getBoundingClientRect(),se=de.clientX>=ne.left&&de.clientX<=ne.right,Le=de.clientY>=ne.top-32&&de.clientY<=ne.bottom+32;return se&&Le}function xe(de){var D;return((D=d.value)==null?void 0:D.projectName)===de}function Ee(de){const D=d.value,ne=le.value[de]??0,se=a()===de;return!D||D.projectName!==de?{position:"absolute",top:"0",left:"0",right:"0",zIndex:se?"40":"1",transform:`translate3d(0, ${ne}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${D.groupLeft}px`,width:`${D.groupWidth}px`,height:`${D.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${D.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Je(de){return v.value===de?(v.value="",!0):!1}function Xe(de){const D=N();D&&!de.includes(D)&&Oe();const ne=new Set(de),se=Object.fromEntries(Object.entries(T.value).filter(([Le])=>ne.has(Le)));Object.keys(se).length!==Object.keys(T.value).length&&(T.value=se)}function nt(){for(const de of k.values())E==null||E.unobserve(de);k.clear(),Oe()}return{groupsContainerRef:l,groupsContainerStyle:ye,setProjectGroupRef:K,isDraggingProject:xe,projectGroupStyle:Ee,onProjectHandleMouseDown:_e,takeToggleSuppression:Je,pruneProjectGroups:Xe,dispose:nt}}const U1={key:0,class:"pinned-section"},z1={class:"thread-tree-header"},H1={key:0,class:"thread-list"},W1={class:"projects-section"},q1={class:"thread-tree-header"},G1=["aria-expanded","aria-label","title"],V1={class:"organize-menu-title"},K1=["data-active"],Y1={key:0},J1=["data-active"],Q1={key:0},X1=["data-active"],Z1={key:0},eE={class:"organize-menu-title"},tE=["data-active"],nE={key:0},rE=["data-active"],oE={key:0},aE={key:0,class:"thread-tree-action-error"},sE={key:1,class:"thread-tree-no-results"},iE={key:2,class:"thread-tree-loading"},lE={key:3,class:"thread-list thread-list-global"},uE=["data-project-name","data-expanded","data-dragging"],cE={class:"project-icon-stack"},dE={class:"project-icon-folder"},fE={class:"project-icon-chevron"},hE=["data-dragging-handle","onMousedown"],pE=["title"],mE=["title"],gE={key:0,class:"thread-row-automation-count"},vE={class:"project-hover-controls"},yE=["onClick"],wE=["data-open-direction"],bE=["onClick"],TE=["onClick"],SE=["onClick"],kE=["onClick"],CE=["onClick"],xE=["onClick"],IE={class:"project-menu-label"},AE=["onInput"],_E=["aria-label","title","onClick"],PE={key:0,class:"thread-list"},EE={class:"project-empty"},ME=["onClick"],RE={class:"chats-section"},LE={class:"thread-tree-header"},jE={class:"chats-section-actions"},NE=["aria-label","title"],$E={key:0,class:"thread-tree-no-results"},OE={key:1,class:"thread-list thread-list-global"},DE=["data-open-direction"],FE=["disabled","title"],BE=["placeholder","onKeydown"],UE={class:"recycle-bin-content"},zE={key:0,class:"recycle-bin-empty"},HE={key:1,class:"recycle-bin-list"},WE={class:"recycle-bin-item-copy"},qE={class:"recycle-bin-item-title"},GE={key:0,class:"recycle-bin-item-meta"},VE={class:"recycle-bin-item-time"},KE={class:"recycle-bin-item-actions"},YE=["disabled","onClick"],JE=["onClick"],QE={key:2,class:"recycle-bin-error",role:"alert"},XE=["aria-label"],ZE={class:"rename-thread-title"},eM={class:"rename-thread-subtitle"},tM={key:0,class:"automation-target-picker"},nM={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},rM={class:"automation-target-dropdown"},oM=["aria-label"],aM=["onClick"],sM={class:"automation-thread-field"},iM={class:"automation-thread-label"},lM=["placeholder"],uM={class:"automation-thread-field"},cM={class:"automation-thread-label"},dM=["placeholder"],fM={class:"automation-thread-field"},hM={class:"automation-thread-label"},pM={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},mM={key:0,class:"automation-schedule-row"},gM={class:"automation-schedule-copy"},vM={key:1,class:"automation-schedule-row"},yM={class:"automation-schedule-copy"},wM={class:"automation-schedule-preview"},bM={class:"automation-thread-field"},TM={class:"automation-thread-label"},SM={key:2,class:"rename-thread-subtitle automation-thread-error"},kM={key:3,class:"rename-thread-subtitle automation-thread-notice"},CM={class:"rename-thread-actions"},xM=["disabled"],IM=["disabled"],AM=["disabled"],_M=["disabled"],Mg="codex-web-local.sidebar-section-expansion.v1",Rg="codex-web-local.sidebar-chats-first.v1",Lg="codex-web-local.sidebar-chat-sort-mode.v1",jg="codex-web-local.thread-view-mode.v1",Ng="codex-web-local.collapsed-projects.v1",PM=fn({__name:"SidebarThreadTree",props:{groups:{},projectDisplayNameById:{},projectGitRepoByName:{},projectCwdByName:{},selectedThreadId:{},isLoading:{type:Boolean},isThreadListFullyLoaded:{type:Boolean},searchQuery:{},searchMatchedThreadIds:{}},emits:["select","archive","start-new-thread","browse-thread-files","save-thread-project","browse-project-files","save-project","request-project-git-status","create-project-worktree","rename-project","rename-thread","remove-project","reorder-project","copy-thread-chat","fork-thread","start-new-chat","automations-changed","restore-thread"],setup(e,{expose:t,emit:n}){const r=e,{t:o}=ao(),{recordVisibleFailure:a}=Iw(),s=n,{records:i,loadRecords:l,recordArchivedThread:u,removeArchivedRecord:d,restoreArchivedThread:m}=UP(),f=S(!1),v=S(""),T=S("");function k(){pn.value=!1,v.value="",l(),f.value=!0}async function R(C){if(!T.value){T.value=C,v.value="";try{const M=await m(C);M.ok?s("restore-thread",C):v.value=M.error??"Failed to restore thread"}finally{T.value=""}}}const E=S({}),N=S({}),q=S(!0),K=S(!0),U=S(!0),ce=S(!1),G=S(co(Rg,!1)),le=S(rr());let ye=!1;const _e=S([]),we=S({}),ee=S(""),he=S([]),te=S(""),Ae=S(""),Oe=S("hover"),$e=S({}),De=S({}),Se=S({}),Te=S("actions"),xe=S(""),Ee=S(!1),Je=S(""),Xe=S(""),nt=S(null),de=S(!1),D=S(""),ne=S(""),se=O1({getGroups:()=>r.groups,t:o,getProjectDisplayName:Pn,getProjectAutomationKey:Ei,closeThreadMenu:ze,closeProjectMenu:on,onAutomationsChanged:()=>s("automations-changed")}),{automationByThreadId:Le,automationByProjectName:We,automationDialogVisible:P,automationDialogScope:j,automationDialogAutomationId:W,automationDialogMode:ue,automationTargetPickerVisible:ae,automationTargetMode:ie,automationTargetValue:Pe,automationDialogError:je,automationDialogNotice:Ie,projectAutomationActionError:ge,isSavingAutomation:Ke,isRunningAutomation:Ne,automationDraft:qe,automationScheduleDraft:Ge,automationDialogAutomations:dt,automationSchedulePreview:St,automationDialogSubtitle:st,automationTargetDropdownOptions:ut,automationIntervalUnitOptions:X,automationStatusOptions:pe,threadAutomationCount:Ce,threadHasAutomation:Be,projectAutomationCount:yt,projectHasAutomation:wt,threadAutomationTooltip:Dt,projectAutomationTooltip:Uo,syncAutomationRruleFromScheduleDraft:Jt,onAutomationIntervalUnitChange:so,onAutomationStatusChange:tr,syncAutomationScheduleDraftFromRrule:Sa,setAutomationScheduleMode:io,openAutomationDialog:Ys,openProjectAutomationDialog:ka,openAutomationEditorFromPanel:is,openAutomationCreatorFromPanel:Or,setAutomationTargetMode:ls,startNewAutomationDraft:Dr,selectAutomationForEditing:zo,closeAutomationDialog:Ho,omitAutomationProject:Js,reloadProjectAutomations:Wo,removeAutomationsForThread:Fr,submitAutomationDialog:us,onDeleteAutomationFromDialog:Ca,onRunAutomationFromDialog:qo}=se,lo=B1({getGroups:()=>r.groups,getFilteredGroups:()=>fo.value,isSearchActive:()=>An.value,isCollapsed:Ft,getElevatedProjectName:()=>te.value?te.value:Ae.value?Ut.value.get(Ae.value)??"":"",onReorderProject:(C,M)=>s("reorder-project",{projectName:C,toIndex:M}),closeProjectMenu:on}),{groupsContainerRef:uo,groupsContainerStyle:xr,setProjectGroupRef:cs,isDraggingProject:xa,projectGroupStyle:vt,onProjectHandleMouseDown:kt,takeToggleSuppression:It,pruneProjectGroups:tn,dispose:$n}=lo,hn=new Map,Ir=new Map,pr=S(null),Go=S(null),pn=S(!1),nr=S(Mt());function Ar(){if(typeof window>"u")return{};try{const C=window.localStorage.getItem(Ng);if(!C)return{};const M=JSON.parse(C);return!M||typeof M!="object"||Array.isArray(M)?{}:M}catch{return{}}}function Mt(){return typeof window>"u"?"project":window.localStorage.getItem(jg)==="chronological"?"chronological":"project"}function co(C,M){if(typeof window>"u")return M;const x=window.localStorage.getItem(C);return x==="true"?!0:x==="false"?!1:M}function rr(){return typeof window>"u"?"updated":window.localStorage.getItem(Lg)==="created"?"created":"updated"}N.value=Ar();function wn(){if(!(typeof window>"u"))try{const C=JSON.parse(window.localStorage.getItem(Mg)||"{}");typeof C.pinned=="boolean"&&(q.value=C.pinned),typeof C.projects=="boolean"&&(K.value=C.projects),typeof C.chats=="boolean"&&(U.value=C.chats)}catch{}}function Br(){typeof window>"u"||window.localStorage.setItem(Mg,JSON.stringify({pinned:q.value,projects:K.value,chats:U.value}))}wn(),ot(N,C=>{typeof window>"u"||window.localStorage.setItem(Ng,JSON.stringify(C))},{deep:!0}),ot(nr,C=>{typeof window>"u"||window.localStorage.setItem(jg,C)}),ot(G,C=>{typeof window>"u"||window.localStorage.setItem(Rg,String(C))}),ot(le,C=>{typeof window>"u"||window.localStorage.setItem(Lg,C)}),ot([q,K,U],Br);const On=Y(()=>r.searchQuery.trim().toLowerCase()),An=Y(()=>On.value.length>0),bn=Y(()=>r.searchMatchedThreadIds?new Set(r.searchMatchedThreadIds):null),Ia=Y(()=>new Set(_e.value)),mr=Y(()=>new Set(he.value));function Ur(C){if(mr.value.has(C.id))return!1;if(!An.value)return!0;if(bn.value)return bn.value.has(C.id);const M=On.value;return C.title.toLowerCase().includes(M)||C.preview.toLowerCase().includes(M)}const Bt=Y(()=>zP(r.groups)),fo=Y(()=>Bt.value.flatMap(C=>{const M=C.threads.filter(x=>!Tc(x.cwd)&&Ur(x));return M.length>0?[{...C,threads:M}]:!An.value&&C.threads.length===0?[{...C,threads:M}]:[]})),Vo=Y(()=>nr.value==="chronological"),Ko=Y(()=>{const C=[];for(const M of Bt.value)for(const x of M.threads)Ia.value.has(x.id)||Ur(x)&&C.push(x);return C.sort((M,x)=>{const Z=new Date(M.updatedAtIso||M.createdAtIso).getTime();return new Date(x.updatedAtIso||x.createdAtIso).getTime()-Z})}),Tn=Y(()=>{const C=Ko.value.filter(x=>Tc(x.cwd)),M=le.value==="created"?"createdAtIso":"updatedAtIso";return C.sort((x,Z)=>{const Qe=new Date(x[M]||x.updatedAtIso||x.createdAtIso).getTime();return new Date(Z[M]||Z.updatedAtIso||Z.createdAtIso).getTime()-Qe})}),Zt=Y(()=>An.value||ce.value?Tn.value:Tn.value.slice(0,10)),gr=Y(()=>An.value?!1:Tn.value.length>10),un=Y(()=>{const C=new Map;for(const M of Bt.value)for(const x of M.threads)mr.value.has(x.id)||C.set(x.id,x);return C});ot(_e,C=>{ye&&l_(C)}),ot([un,()=>r.isThreadListFullyLoaded],([C])=>{const M=$1(_e.value,new Set(C.keys()),{canPruneMissing:r.isThreadListFullyLoaded});if(M.length===_e.value.length)return;const x=new Set(M),Z=Object.fromEntries(Object.entries(we.value).filter(([Qe])=>x.has(Qe)));we.value=Z,_e.value=M});let Yo=0;async function nn(){if(r.isLoading)return;const C=_e.value.filter(Qe=>!un.value.has(Qe)&&!we.value[Qe]);if(C.length===0)return;const M=Yo+=1,x=await Promise.all(C.map(async Qe=>{try{return await yA(Qe)}catch{return null}}));if(M!==Yo)return;const Z={...we.value};for(const Qe of x)Qe&&(Z[Qe.id]=Qe);we.value=Z}ot([_e,un,()=>r.isLoading],()=>{ye&&nn()}),ss(async()=>{const{threadIds:C}=await i_(),M=Array.isArray(C)?C.filter(x=>typeof x=="string").map(x=>x.trim()).filter((x,Z,Qe)=>x.length>0&&Qe.indexOf(x)===Z):[];M.length>0&&(_e.value=M);try{Le.value=await iI()}catch{Le.value={}}try{await Wo()}catch{We.value={}}ye=!0,nn()});const zr=Y(()=>Be(D.value)),Jo=Y(()=>{const C=ne.value;return zr.value?o('This will archive the thread "{title}" and remove the attached heartbeat automations.',{title:C}):o('This will archive the thread "{title}". You can find it later in archived threads.',{title:C})}),Ut=Y(()=>{const C=new Map;for(const M of r.groups)for(const x of M.threads)C.set(x.id,M.projectName);return C}),Qo=Y(()=>{const C=new Map;for(const M of r.groups){const x=M.threads.filter(Z=>!Ia.value.has(Z.id)&&!mr.value.has(Z.id));C.set(M.projectName,x)}return C}),Xo=Y(()=>{const C=new Map;for(const M of r.groups)for(const x of M.threads){const Z=new Date(x.updatedAtIso||x.createdAtIso).getTime();C.set(x.id,Z)}return C}),_t=Y(()=>{const C=Ae.value;return C?un.value.get(C)??null:null}),mn=Y(()=>_e.value.map(C=>un.value.get(C)??we.value[C]??null).filter(C=>C!==null).filter(Ur));function ho(){q.value=!q.value}function _r(){K.value=!K.value}function Pr(){U.value=!U.value}function Zo(C){if(Number.isNaN(C))return"n/a";const M=Math.abs(Date.now()-C);if(M<6e4)return o("now");const x=Math.floor(M/6e4);if(x<60)return`${x}m`;const Z=Math.floor(x/60);return Z<24?`${Z}h`:`${Math.floor(Z/24)}d`}function Hr(C){const M=Xo.value.get(C.id);return Zo(typeof M=="number"?M:new Date(C.updatedAtIso||C.createdAtIso).getTime())}function ea(C){const M=new Date(C).getTime();return Number.isNaN(M)?"":new Date(M).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function or(C){return Ia.value.has(C)}function po(C){if(or(C)){_e.value=_e.value.filter(M=>M!==C);return}_e.value=[C,..._e.value]}function ta(C){po(C),ze()}function Er(C){ee.value="",s("select",C)}function gt(C){C===r.selectedThreadId&&(s("copy-thread-chat",C),ze())}function _n(C){s("fork-thread",C),ze()}function Sn(C){return`${o("start new thread")} ${Pn(C)}`}function Aa(C){s("start-new-thread",C)}function Vn(C){s("browse-thread-files",C),ze()}function I(C){s("save-thread-project",C),ze()}async function $(C){var x,Z;const M=((Z=(x=un.value.get(C))==null?void 0:x.cwd)==null?void 0:Z.trim())??"";if(ze(),!(!M||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(M)}catch{}}function Q(C,M){if(Ae.value===C&&Oe.value==="hover"){if(M){const x=M.relatedTarget,Z=Go.value;if(x instanceof Node&&Z&&Z.contains(x))return}ze()}}function ke(C){return Ae.value===C}function ze(){Ae.value="",Oe.value="hover",Se.value={}}function jt(C){if(ee.value="",Ae.value===C){ze();return}Oe.value="hover",on(),pn.value=!1,Ae.value=C,Et(()=>{wr(C)})}function At(C,M){C.preventDefault(),ee.value="",Oe.value="contextmenu",Ae.value=M}function rn(C,M){Je.value=C,Xe.value=M,Ee.value=!0,ze(),Et(()=>{var x,Z;(x=nt.value)==null||x.focus(),(Z=nt.value)==null||Z.select()})}function Qt(){Ee.value=!1,Je.value="",Xe.value=""}function Mr(){const C=Je.value,M=Xe.value.trim();!C||!M||(s("rename-thread",{threadId:C,title:M}),Qt())}function _a(C,M){ee.value="",D.value=C,ne.value=M,de.value=!0,ze()}function ds(){de.value=!1,D.value="",ne.value=""}async function cn(){const C=D.value;C&&(Qs(C),ds())}function na(C){return ee.value===C}function Pa(C){if(ee.value!==C){ee.value=C,ze();return}Qs(C),ee.value=""}function Qs(C){var x,Z;const M=un.value.get(C)??null;mr.value.has(C)||(he.value=[C,...he.value]),ee.value="",ze(),u({id:C,title:((x=M==null?void 0:M.title)==null?void 0:x.trim())||"(untitled)",cwd:((Z=M==null?void 0:M.cwd)==null?void 0:Z.trim())??"",projectName:Ut.value.get(C)??""}),_e.value=_e.value.filter(Qe=>Qe!==C),s("archive",C),Be(C)&&Fr(C)}function Pn(C){return r.projectDisplayNameById[C]??C}t({openAutomationEditorFromPanel:is,openAutomationCreatorFromPanel:Or,openRenameThreadDialog:rn,openRecycleBin:k});function fs(C){return C.includes("/")||C.includes("\\")}function Xs(C){return fs(C)?C:Pn(C)}function hs(C){const M=Nr(C);if(!M)return!1;let x=0;for(const Z of r.groups)if(fs(Z.projectName)&&Nr(Z.projectName)===M&&(x+=1,x>1))return!0;return!1}function Ea(C){const M=r.projectDisplayNameById[C.projectName],x=Pn(C.projectName),Z=C.projectName;if(M&&!fs(Z)&&Z!==x)return x.includes(Z)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(Z)?x:`${x} ${Z}`;if(M&&fs(Z)){const Kn=Nr(Z),br=Nr(hl(Z)),sn=hs(Z)?br:Kn;return sn&&sn!==x?`${x} ${sn}`:x}if(!x.includes("/")&&!x.includes("\\"))return x;const Qe=Nr(x)||x,qt=Nr(hl(x));return qt.startsWith(".")&&qt!==Qe?`${Qe} ${qt}`:C.threads.length>0||!hs(Z)?Qe:qt?`${Qe} ${qt}`:Qe}function ra(C){return te.value===C}function on(){te.value="",Te.value="actions",xe.value=""}function oa(){const C=!pn.value;C&&(on(),ze()),pn.value=C}function Wr(C){nr.value=C,pn.value=!1}function gn(){G.value=!G.value}function mo(C){le.value=C}function go(C){s("request-project-git-status",C),Et(()=>{gs(C)})}function ps(C){if(te.value===C){on();return}ze(),pn.value=!1,te.value=C,Te.value="actions",xe.value=Pn(C),go(C)}function an(C){ze(),pn.value=!1,te.value=C,Te.value="actions",xe.value=Pn(C),go(C)}function _i(C){return r.projectDisplayNameById[C.projectName]??Ea(C)}function Ma(C){ze();const M=C.projectName;te.value=M,Te.value="rename",xe.value=_i(C),Et(()=>{gs(M)})}function En(C){s("browse-project-files",C),on()}function Dn(C){s("save-project",C),on()}function Zs(C){s("create-project-worktree",C),on()}function ms(C){s("rename-project",{projectName:C,displayName:xe.value})}function Pi(C){const M=Ei(C);if(s("remove-project",C),M&&wt(C)){ge.value="";const x=We.value;We.value=Js(We.value,M),Xy(M).then(Wo).catch(async Z=>{We.value=x;const Qe=Z instanceof Error?Z.message:o("Failed to delete project automation");ge.value=Qe,a(Qe);try{await Wo()}catch{We.value=x}}).finally(()=>{s("automations-changed")})}on()}function Ei(C){var x;const M=((x=r.projectCwdByName[C])==null?void 0:x.trim())??"";return SI(M)?M:""}function Mi(C,M){if(!C.altKey||C.key!=="ArrowUp"&&C.key!=="ArrowDown")return;const x=r.groups.findIndex(qt=>qt.projectName===M);if(x<0)return;const Z=C.key==="ArrowUp"?-1:1,Qe=Math.max(0,Math.min(x+Z,r.groups.length-1));Qe!==x&&(C.preventDefault(),s("reorder-project",{projectName:M,toIndex:Qe}))}function Fn(C){return E.value[C]===!0}function Ft(C){return N.value[C]===!0}function Wt(C){E.value={...E.value,[C]:!Fn(C)}}function vr(){ce.value=!ce.value}function ar(C){It(C)||(N.value={...N.value,[C]:!Ft(C)})}function qr(C,M){const x=M instanceof HTMLElement?M:M&&"$el"in M&&M.$el instanceof HTMLElement?M.$el:null;if(x){hn.set(C,x);return}hn.delete(C)}function vo(C,M){const x=M instanceof HTMLElement?M:M&&"$el"in M&&M.$el instanceof HTMLElement?M.$el:null;if(x){Ir.set(C,x);return}Ir.delete(C)}function aa(C){let M=C.parentElement;for(;M;){const x=window.getComputedStyle(M),Z=x.overflowY||x.overflow;if(Z==="auto"||Z==="scroll"||Z==="hidden"||Z==="clip")return M.getBoundingClientRect();M=M.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function yr(C,M){const x=C.getBoundingClientRect(),Z=aa(C),Qe=6,qt=Z.bottom-x.bottom,Kn=x.top-Z.top;return qt>=M+Qe?"down":Kn>qt?"up":"down"}function yo(C,M){const x=Ir.get(C);if(!x)return"down";const Z=yr(x,M);return De.value={...De.value,[C]:Z},Z}function Gr(C){return De.value[C]??"down"}function gs(C){const M=hn.get(C);if(!M)return;const x=M.querySelector(".project-menu-panel"),Z=(x==null?void 0:x.getBoundingClientRect().height)??0;$e.value={...$e.value,[C]:yr(M,Z)}}function Vr(C,M,x){return Math.min(Math.max(C,M),x)}function wr(C){const M=Ir.get(C);if(!M)return;const x=Go.value,Z=x==null?void 0:x.getBoundingClientRect(),Qe=(Z==null?void 0:Z.height)||(x==null?void 0:x.offsetHeight)||112,qt=(Z==null?void 0:Z.width)||(x==null?void 0:x.offsetWidth)||160,Kn=yo(C,Qe),br=M.getBoundingClientRect(),sn=8,To=4,So=Math.max(sn,window.innerWidth-qt-sn),ia=Vr(br.right-qt,sn,So),ys=Vr(Kn==="up"?br.top-Qe-To:br.bottom+To,sn,Math.max(sn,window.innerHeight-Qe-sn));Se.value={left:`${Math.round(ia)}px`,top:`${Math.round(ys)}px`}}function Kr(){const C=Ae.value;C&&wr(C)}function Ri(){window.addEventListener("resize",Kr),document.addEventListener("scroll",Kr,!0)}function Li(){window.removeEventListener("resize",Kr),document.removeEventListener("scroll",Kr,!0)}function ei(C){const M=te.value;if(!M)return!1;const x=hn.get(M);if(!x)return!1;if((typeof C.composedPath=="function"?C.composedPath():[]).includes(x))return!0;const Qe=C.target;return Qe instanceof Node?x.contains(Qe):!1}function vs(C){const M=Ae.value;if(!M)return!1;const x=Ir.get(M);if(!x)return!1;const Z=typeof C.composedPath=="function"?C.composedPath():[];if(Z.includes(x))return!0;const Qe=Go.value;if(Qe&&Z.includes(Qe))return!0;const qt=C.target;return qt instanceof Node?!!(x.contains(qt)||Qe&&Qe.contains(qt)):!1}function Yr(C){if(pn.value){const M=pr.value,x=typeof C.composedPath=="function"?C.composedPath():[];!!M&&(x.includes(M)||C.target instanceof Node&&M.contains(C.target))||(pn.value=!1)}te.value&&(ei(C)||on(),Ae.value&&(vs(C)||ze()))}function wo(C){te.value&&!ei(C)&&on(),Ae.value&&!vs(C)&&ze()}function ti(){pn.value&&(pn.value=!1),te.value&&on(),Ae.value&&ze()}function ji(){window.addEventListener("pointerdown",Yr,{capture:!0}),window.addEventListener("focusin",wo,{capture:!0}),window.addEventListener("blur",ti)}function ni(){window.removeEventListener("pointerdown",Yr,{capture:!0}),window.removeEventListener("focusin",wo,{capture:!0}),window.removeEventListener("blur",ti)}function Ra(C){return Qo.value.get(C.projectName)??[]}function Al(C){if(An.value)return Ra(C);if(Ft(C.projectName))return[];const M=Ra(C);return Fn(C.projectName)?M:M.slice(0,10)}function Ni(C){return An.value?!1:!Ft(C.projectName)&&Ra(C).length>10}function kn(C){return Ra(C).length>0}function Bn(C){var M;return!!C.pendingRequestState||C.inProgress||C.unread||((M=C.externalSession)==null?void 0:M.active)===!0}function bo(C){return C.pendingRequestState==="approval"?o("Awaiting approval"):o("Awaiting response")}function sr(C){var M;return((M=C.externalSession)==null?void 0:M.active)===!0?"external":C.pendingRequestState==="approval"?"awaiting-approval":C.pendingRequestState==="response"?"awaiting-response":C.inProgress?"working":C.unread?"unread":"idle"}ot(()=>r.groups.map(C=>C.projectName),C=>{tn(C)}),ot(()=>{const C=te.value;return C?r.projectGitRepoByName[C]:void 0},()=>{const C=te.value;C&&Et(()=>{te.value===C&&gs(C)})});const sa=Y(()=>pn.value||te.value!==""||Ae.value!=="");return ot(sa,C=>{if(C){ji();return}ni()}),ot(Ae,C=>{if(!C){Li();return}Ri(),Et(()=>{wr(C)})}),Ks(()=>{hn.clear(),Li(),ni(),$n()}),(C,M)=>(_(),B("section",{class:ct(["thread-tree-root",{"chats-first":G.value}])},[mn.value.length>0?(_(),B("section",U1,[Fe(js,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":q.value,onClick:ho},{left:ht(()=>[q.value?(_(),Ze(zs,{key:1,class:"thread-icon"})):(_(),Ze(Gu,{key:0,class:"thread-icon"}))]),default:ht(()=>[w("span",z1,O(g(o)("Pinned")),1)]),_:1},8,["aria-expanded"]),q.value?(_(),B("ul",H1,[(_(!0),B(at,null,Ht(mn.value,x=>(_(),Ze(Vu,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:or(x.id),"menu-open":ke(x.id),"show-status-indicator":Bn(x),"thread-state":sr(x),"inline-delete-confirming":na(x.id),"automation-count":g(Ce)(x.id),"automation-tooltip":g(Dt)(x.id),"request-label":bo(x),"relative-time":Hr(x),"delete-label":g(o)("Delete thread"),"confirm-delete-label":g(o)("Confirm delete"),"confirm-label":g(o)("Confirm"),"worktree-label":g(o)("Worktree thread"),"set-menu-wrap-ref":Z=>vo(x.id,Z),onSelect:Z=>Er(x.id),onInlineDelete:Z=>Pa(x.id),onMenuToggle:Z=>jt(x.id),onRowLeave:Z=>Q(x.id,Z),onRowContextmenu:Z=>At(Z,x.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):ve("",!0)])):ve("",!0),w("section",W1,[Fe(js,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":K.value,onClick:_r},{left:ht(()=>[K.value?(_(),Ze(zs,{key:1,class:"thread-icon"})):(_(),Ze(Gu,{key:0,class:"thread-icon"}))]),right:ht(()=>[w("div",{ref_key:"organizeMenuWrapRef",ref:pr,class:"organize-menu-wrap"},[w("button",{class:"organize-menu-trigger",type:"button","aria-expanded":pn.value,"aria-label":g(o)("Organize threads"),title:g(o)("Organize threads"),onClick:mt(oa,["stop"])},[Fe(Df,{class:"thread-icon"})],8,G1),pn.value?(_(),B("div",{key:0,class:"organize-menu-panel",onClick:M[4]||(M[4]=mt(()=>{},["stop"]))},[w("p",V1,O(g(o)("Organize")),1),w("button",{class:"organize-menu-item","data-active":nr.value==="project",type:"button",onClick:M[0]||(M[0]=x=>Wr("project"))},[w("span",null,O(g(o)("By project")),1),nr.value==="project"?(_(),B("span",Y1,"✓")):ve("",!0)],8,K1),w("button",{class:"organize-menu-item","data-active":nr.value==="chronological",type:"button",onClick:M[1]||(M[1]=x=>Wr("chronological"))},[w("span",null,O(g(o)("Chronological list")),1),nr.value==="chronological"?(_(),B("span",Q1,"✓")):ve("",!0)],8,J1),w("button",{class:"organize-menu-item","data-active":G.value,type:"button",onClick:gn},[w("span",null,O(g(o)("Chats first")),1),G.value?(_(),B("span",Z1,"✓")):ve("",!0)],8,X1),M[40]||(M[40]=w("div",{class:"organize-menu-separator"},null,-1)),w("p",eE,O(g(o)("Sort by")),1),w("button",{class:"organize-menu-item","data-active":le.value==="created",type:"button",onClick:M[2]||(M[2]=x=>mo("created"))},[w("span",null,O(g(o)("Created")),1),le.value==="created"?(_(),B("span",nE,"✓")):ve("",!0)],8,tE),w("button",{class:"organize-menu-item","data-active":le.value==="updated",type:"button",onClick:M[3]||(M[3]=x=>mo("updated"))},[w("span",null,O(g(o)("Updated")),1),le.value==="updated"?(_(),B("span",oE,"✓")):ve("",!0)],8,rE),M[41]||(M[41]=w("div",{class:"organize-menu-separator"},null,-1)),w("button",{class:"organize-menu-item",type:"button",onClick:k},[w("span",null,O(g(o)("Recycle bin")),1)])])):ve("",!0)],512)]),default:ht(()=>[w("span",q1,O(g(o)("Projects")),1)]),_:1},8,["aria-expanded"]),K.value?(_(),B(at,{key:0},[g(ge)?(_(),B("p",aE,O(g(ge)),1)):ve("",!0),An.value&&fo.value.length===0?(_(),B("p",sE,O(g(o)("No matching threads. Clear the search to see all threads.")),1)):e.isLoading&&e.groups.length===0?(_(),B("p",iE,O(g(o)("Loading threads...")),1)):Vo.value?(_(),B("ul",lE,[(_(!0),B(at,null,Ht(Ko.value,x=>(_(),Ze(Vu,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:or(x.id),"menu-open":ke(x.id),"show-status-indicator":Bn(x),"thread-state":sr(x),"inline-delete-confirming":na(x.id),"automation-count":g(Ce)(x.id),"automation-tooltip":g(Dt)(x.id),"request-label":bo(x),"relative-time":Hr(x),"delete-label":g(o)("Delete thread"),"confirm-delete-label":g(o)("Confirm delete"),"confirm-label":g(o)("Confirm"),"worktree-label":g(o)("Worktree thread"),"set-menu-wrap-ref":Z=>vo(x.id,Z),onSelect:Z=>Er(x.id),onInlineDelete:Z=>Pa(x.id),onMenuToggle:Z=>jt(x.id),onRowLeave:Z=>Q(x.id,Z),onRowContextmenu:Z=>At(Z,x.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):(_(),B("div",{key:4,ref_key:"groupsContainerRef",ref:uo,class:"thread-tree-groups",style:Zr(g(xr))},[(_(!0),B(at,null,Ht(fo.value,x=>(_(),B("article",{key:x.projectName,ref_for:!0,ref:Z=>g(cs)(x.projectName,Z),class:"project-group","data-project-name":x.projectName,"data-expanded":!Ft(x.projectName),"data-dragging":g(xa)(x.projectName),style:Zr(g(vt)(x.projectName))},[Fe(js,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:Z=>ar(x.projectName),onContextmenu:mt(Z=>an(x.projectName),["prevent"]),onKeydown:[Z=>Mi(Z,x.projectName),kr(mt(Z=>ar(x.projectName),["prevent"]),["enter"]),kr(mt(Z=>ar(x.projectName),["prevent"]),["space"])]},{left:ht(()=>[w("span",cE,[w("span",dE,[Ft(x.projectName)?(_(),Ze(Lh,{key:0,class:"thread-icon"})):(_(),Ze(kP,{key:1,class:"thread-icon"}))]),w("span",fE,[Ft(x.projectName)?(_(),Ze(Gu,{key:0,class:"thread-icon"})):(_(),Ze(zs,{key:1,class:"thread-icon"}))])])]),right:ht(()=>[w("div",vE,[w("div",{ref_for:!0,ref:Z=>qr(x.projectName,Z),class:"project-menu-wrap"},[w("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:mt(Z=>ps(x.projectName),["stop"])},[Fe(Df,{class:"thread-icon"})],8,yE),ra(x.projectName)?(_(),B("div",{key:0,class:"project-menu-panel","data-open-direction":$e.value[x.projectName]??"down",onClick:M[6]||(M[6]=mt(()=>{},["stop"]))},[Te.value==="actions"?(_(),B(at,{key:0},[w("button",{class:"project-menu-item",type:"button",onClick:Z=>En(x.projectName)},O(g(o)("Browse files")),9,bE),w("button",{class:"project-menu-item",type:"button",onClick:Z=>Dn(x.projectName)},O(g(o)("Export Project")),9,TE),w("button",{class:"project-menu-item",type:"button",onClick:Z=>g(ka)(x.projectName)},O(g(wt)(x.projectName)?g(o)("Manage automations…"):g(o)("Add automation…")),9,SE),e.projectGitRepoByName[x.projectName]?(_(),B("button",{key:0,class:"project-menu-item",type:"button",onClick:Z=>Zs(x.projectName)},O(g(o)("New worktree")),9,kE)):ve("",!0),w("button",{class:"project-menu-item",type:"button",onClick:Z=>Ma(x)},O(g(o)("Rename project")),9,CE),w("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:Z=>Pi(x.projectName)},O(g(o)("Remove")),9,xE)],64)):(_(),B(at,{key:1},[w("label",IE,O(g(o)("Project name")),1),In(w("input",{"onUpdate:modelValue":M[5]||(M[5]=Z=>xe.value=Z),class:"project-menu-input",type:"text",onInput:Z=>ms(x.projectName)},null,40,AE),[[jn,xe.value]])],64))],8,wE)):ve("",!0)],512),w("button",{class:"thread-start-button",type:"button","aria-label":Sn(x.projectName),title:Sn(x.projectName),onClick:mt(Z=>Aa(x.projectName),["stop"])},[Fe(Cl,{class:"thread-icon"})],8,_E)])]),default:ht(()=>[w("span",{class:"project-main-button","data-dragging-handle":g(xa)(x.projectName),onMousedown:mt(Z=>g(kt)(Z,x.projectName),["left"])},[w("span",{class:"project-title",title:Xs(x.projectName)},O(Ea(x)),9,pE),g(wt)(x.projectName)?(_(),B("span",{key:0,class:"thread-row-automation-chip",title:g(Uo)(x.projectName)},[Fe(Qc,{class:"thread-row-automation-icon"}),g(yt)(x.projectName)>1?(_(),B("span",gE,O(g(yt)(x.projectName)),1)):ve("",!0)],8,mE)):ve("",!0)],40,hE)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),kn(x)?(_(),B("ul",PE,[(_(!0),B(at,null,Ht(Al(x),Z=>(_(),Ze(Vu,{key:Z.id,thread:Z,selected:Z.id===e.selectedThreadId,pinned:or(Z.id),"menu-open":ke(Z.id),"show-status-indicator":Bn(Z),"thread-state":sr(Z),"inline-delete-confirming":na(Z.id),"automation-count":g(Ce)(Z.id),"automation-tooltip":g(Dt)(Z.id),"request-label":bo(Z),"relative-time":Hr(Z),"delete-label":g(o)("Delete thread"),"confirm-delete-label":g(o)("Confirm delete"),"confirm-label":g(o)("Confirm"),"worktree-label":g(o)("Worktree thread"),"set-menu-wrap-ref":Qe=>vo(Z.id,Qe),onSelect:Qe=>Er(Z.id),onInlineDelete:Qe=>Pa(Z.id),onMenuToggle:Qe=>jt(Z.id),onRowLeave:Qe=>Q(Z.id,Qe),onRowContextmenu:Qe=>At(Qe,Z.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):(_(),Ze(js,{key:1,as:"p",class:"project-empty-row"},{left:ht(()=>[...M[42]||(M[42]=[w("span",{class:"project-empty-spacer"},null,-1)])]),default:ht(()=>[w("span",EE,O(g(o)("No threads yet. Start a new thread to begin.")),1)]),_:1})),Ni(x)?(_(),Ze(js,{key:2,class:"thread-show-more-row"},{left:ht(()=>[...M[43]||(M[43]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:ht(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:Z=>Wt(x.projectName)},O(Fn(x.projectName)?"Show less":"Show more"),9,ME)]),_:2},1024)):ve("",!0)],12,uE))),128))],4))],64)):ve("",!0)]),w("section",RE,[Fe(js,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":U.value,onClick:Pr},{left:ht(()=>[U.value?(_(),Ze(zs,{key:1,class:"thread-icon"})):(_(),Ze(Gu,{key:0,class:"thread-icon"}))]),right:ht(()=>[w("div",jE,[w("button",{class:"chats-section-action",type:"button","aria-label":g(o)("New chat"),title:g(o)("New chat"),onClick:M[7]||(M[7]=mt(x=>C.$emit("start-new-chat"),["stop"]))},[Fe(Cl,{class:"thread-icon"})],8,NE)])]),default:ht(()=>[w("span",LE,O(g(o)("Chats")),1)]),_:1},8,["aria-expanded"]),U.value&&Tn.value.length===0?(_(),B("p",$E,O(g(o)("No chats")),1)):U.value?(_(),B("ul",OE,[(_(!0),B(at,null,Ht(Zt.value,x=>(_(),Ze(Vu,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:or(x.id),"menu-open":ke(x.id),"show-status-indicator":Bn(x),"thread-state":sr(x),"inline-delete-confirming":na(x.id),"automation-count":g(Ce)(x.id),"automation-tooltip":g(Dt)(x.id),"request-label":bo(x),"relative-time":Hr(x),"delete-label":g(o)("Delete thread"),"confirm-delete-label":g(o)("Confirm delete"),"confirm-label":g(o)("Confirm"),"worktree-label":g(o)("Worktree thread"),"set-menu-wrap-ref":Z=>vo(x.id,Z),onSelect:Z=>Er(x.id),onInlineDelete:Z=>Pa(x.id),onMenuToggle:Z=>jt(x.id),onRowLeave:Z=>Q(x.id,Z),onRowContextmenu:Z=>At(Z,x.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):ve("",!0),U.value&&gr.value?(_(),Ze(js,{key:2,class:"thread-show-more-row"},{left:ht(()=>[...M[44]||(M[44]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:ht(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:vr},O(ce.value?"Show less":"Show more"),1)]),_:1})):ve("",!0)]),(_(),Ze(Ws,{to:"body"},[_t.value?(_(),B("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:Go,class:"thread-menu-panel thread-menu-panel-fixed",style:Zr(Se.value),"data-open-direction":Gr(_t.value.id),onClick:M[17]||(M[17]=mt(()=>{},["stop"]))},[w("button",{class:"thread-menu-item",type:"button",onClick:M[8]||(M[8]=x=>g(Ys)(_t.value.id))},O(g(Be)(_t.value.id)?g(o)("Manage automations…"):g(o)("Add automation…")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[9]||(M[9]=x=>Vn(_t.value.id))},O(g(o)("Browse files")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[10]||(M[10]=x=>I(_t.value.id))},O(g(o)("Export Project")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[11]||(M[11]=x=>$(_t.value.id))},O(g(o)("Copy path")),1),w("button",{class:"thread-menu-item",type:"button",disabled:_t.value.id!==e.selectedThreadId,title:_t.value.id===e.selectedThreadId?g(o)("Copy chat"):g(o)("Open this chat before copying"),onClick:M[12]||(M[12]=x=>gt(_t.value.id))},O(g(o)("Copy chat")),9,FE),w("button",{class:"thread-menu-item",type:"button",onClick:M[13]||(M[13]=x=>_n(_t.value.id))},O(g(o)("Create chat fork")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[14]||(M[14]=x=>ta(_t.value.id))},O(or(_t.value.id)?g(o)("Unpin thread"):g(o)("Pin thread")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[15]||(M[15]=x=>rn(_t.value.id,_t.value.title))},O(g(o)("Rename thread")),1),w("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:M[16]||(M[16]=x=>_a(_t.value.id,_t.value.title))},O(g(o)("Delete thread")),1)],12,DE)):ve("",!0)])),Fe(rf,{open:Ee.value,title:g(o)("Rename thread"),subtitle:g(o)("Make it short and recognizable."),onClose:Qt},{footer:ht(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:Qt},O(g(o)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Mr},O(g(o)("Save")),1)]),default:ht(()=>[In(w("input",{ref_key:"renameThreadInputRef",ref:nt,"onUpdate:modelValue":M[18]||(M[18]=x=>Xe.value=x),class:"rename-thread-input",type:"text",placeholder:g(o)("Add title..."),onKeydown:kr(mt(Mr,["prevent"]),["enter"])},null,40,BE),[[jn,Xe.value]])]),_:1},8,["open","title","subtitle"]),Fe(rf,{open:de.value,title:zr.value?g(o)("Archive chat and remove automations?"):g(o)("Delete thread?"),subtitle:Jo.value,onClose:ds},{footer:ht(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:ds},O(g(o)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:cn},O(zr.value?g(o)("Archive and remove"):g(o)("Delete")),1)]),_:1},8,["open","title","subtitle"]),Fe(rf,{open:f.value,title:g(o)("Recycle bin"),subtitle:g(o)("Threads you removed are kept here so you can restore them."),size:"md",onClose:M[19]||(M[19]=x=>f.value=!1)},{default:ht(()=>[w("div",UE,[g(i).length===0?(_(),B("div",zE,O(g(o)("Recycle bin is empty.")),1)):(_(),B("ul",HE,[(_(!0),B(at,null,Ht(g(i),x=>(_(),B("li",{key:x.id,class:"recycle-bin-item"},[w("div",WE,[w("span",qE,O(x.title),1),x.projectName?(_(),B("span",GE,O(x.projectName),1)):ve("",!0),w("span",VE,O(ea(x.archivedAtIso)),1)]),w("div",KE,[w("button",{class:"recycle-bin-button recycle-bin-button-primary",type:"button",disabled:T.value===x.id,onClick:Z=>R(x.id)},O(T.value===x.id?g(o)("Restoring…"):g(o)("Restore")),9,YE),w("button",{class:"recycle-bin-button recycle-bin-button-danger",type:"button",onClick:Z=>g(d)(x.id)},O(g(o)("Delete permanently")),9,JE)])]))),128))])),v.value?(_(),B("p",QE,O(v.value),1)):ve("",!0)])]),_:1},8,["open","title","subtitle"]),(_(),Ze(Ws,{to:"body"},[g(P)?(_(),B("div",{key:0,class:"rename-thread-overlay",onClick:M[39]||(M[39]=mt((...x)=>g(Ho)&&g(Ho)(...x),["self"]))},[w("div",{class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":g(j)==="project"?g(o)("Project automation"):g(o)("Thread automation")},[w("h3",ZE,O(g(ue)==="edit"?g(o)("Edit automation"):g(o)("Add automation")),1),w("p",eM,O(g(st)),1),g(ae)&&g(ue)==="create"?(_(),B("div",tM,[M[45]||(M[45]=w("span",{class:"automation-thread-label"},"Target",-1)),w("div",nM,[w("button",{class:ct(["automation-target-mode",{"is-active":g(ie)==="thread"}]),type:"button",onClick:M[20]||(M[20]=x=>g(ls)("thread"))}," Existing chat ",2),w("button",{class:ct(["automation-target-mode",{"is-active":g(ie)==="project"}]),type:"button",onClick:M[21]||(M[21]=x=>g(ls)("project"))}," Project ",2)]),w("div",rM,[Fe(Ci,{modelValue:g(Pe),"onUpdate:modelValue":M[22]||(M[22]=x=>Nn(Pe)?Pe.value=x:null),class:"automation-thread-dropdown",options:g(ut),placeholder:g(ie)==="project"?"Select project":"Select chat","enable-search":"","search-placeholder":g(ie)==="project"?"Search projects":"Search chats"},null,8,["modelValue","options","placeholder","search-placeholder"])])])):ve("",!0),g(dt).length>0?(_(),B("div",{key:1,class:"automation-thread-list","aria-label":g(j)==="project"?"Project automations":"Thread automations"},[(_(!0),B(at,null,Ht(g(dt),x=>(_(),B("button",{key:x.id,class:ct(["automation-thread-list-item",{"is-active":x.id===g(W)}]),type:"button",onClick:Z=>g(zo)(x.id)},[w("span",null,O(x.name),1),w("small",null,O(x.status==="PAUSED"?"Paused":"Active"),1)],10,aM))),128)),w("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:M[23]||(M[23]=(...x)=>g(Dr)&&g(Dr)(...x))},O(g(o)("Add another automation")),1)],8,oM)):ve("",!0),w("label",sM,[w("span",iM,O(g(o)("Name")),1),In(w("input",{"onUpdate:modelValue":M[24]||(M[24]=x=>g(qe).name=x),class:"rename-thread-input",type:"text",placeholder:g(o)("Automation name")},null,8,lM),[[jn,g(qe).name]])]),w("label",uM,[w("span",cM,O(g(o)("Prompt")),1),In(w("textarea",{"onUpdate:modelValue":M[25]||(M[25]=x=>g(qe).prompt=x),class:"automation-thread-textarea",rows:"6",placeholder:g(o)("Describe what the automation should do")},null,8,dM),[[jn,g(qe).prompt]])]),w("div",fM,[w("span",hM,O(g(o)("Schedule")),1),w("div",pM,[w("button",{class:ct(["automation-schedule-mode",{"is-active":g(Ge).mode==="daily"}]),type:"button",onClick:M[26]||(M[26]=x=>g(io)("daily"))},O(g(o)("Daily")),3),w("button",{class:ct(["automation-schedule-mode",{"is-active":g(Ge).mode==="interval"}]),type:"button",onClick:M[27]||(M[27]=x=>g(io)("interval"))},O(g(o)("Interval")),3),w("button",{class:ct(["automation-schedule-mode",{"is-active":g(Ge).mode==="advanced"}]),type:"button",onClick:M[28]||(M[28]=x=>g(io)("advanced"))}," RRULE ",2)]),g(Ge).mode==="daily"?(_(),B("div",mM,[w("span",gM,O(g(o)("Run every day at")),1),In(w("input",{"onUpdate:modelValue":M[29]||(M[29]=x=>g(Ge).dailyTime=x),class:"automation-schedule-time",type:"time",onInput:M[30]||(M[30]=(...x)=>g(Jt)&&g(Jt)(...x))},null,544),[[jn,g(Ge).dailyTime]])])):g(Ge).mode==="interval"?(_(),B("div",vM,[w("span",yM,O(g(o)("Run every")),1),In(w("input",{"onUpdate:modelValue":M[31]||(M[31]=x=>g(Ge).interval=x),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:M[32]||(M[32]=(...x)=>g(Jt)&&g(Jt)(...x))},null,544),[[jn,g(Ge).interval,void 0,{number:!0}]]),Fe(Ci,{class:"automation-schedule-unit-dropdown","model-value":g(Ge).intervalUnit,options:g(X),placeholder:g(o)("Unit"),"onUpdate:modelValue":g(so)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):ve("",!0),g(Ge).mode==="advanced"?In((_(),B("input",{key:2,"onUpdate:modelValue":M[33]||(M[33]=x=>g(qe).rrule=x),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:M[34]||(M[34]=(...x)=>g(Sa)&&g(Sa)(...x))},null,544)),[[jn,g(qe).rrule]]):ve("",!0),w("p",wM,O(g(St)),1)]),w("div",bM,[w("span",TM,O(g(o)("Status")),1),Fe(Ci,{class:"automation-thread-dropdown","model-value":g(qe).status,options:g(pe),placeholder:g(o)("Status"),"onUpdate:modelValue":g(tr)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),g(je)?(_(),B("p",SM,O(g(je)),1)):g(Ie)?(_(),B("p",kM,O(g(Ie)),1)):ve("",!0),w("div",CM,[g(ue)==="edit"&&g(j)==="thread"?(_(),B("button",{key:0,class:"rename-thread-button",type:"button",disabled:g(Ke)||g(Ne),onClick:M[35]||(M[35]=(...x)=>g(qo)&&g(qo)(...x))},O(g(Ne)?g(o)("Running…"):g(o)("Run now")),9,xM)):ve("",!0),g(ue)==="edit"?(_(),B("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:g(Ke)||g(Ne),onClick:M[36]||(M[36]=(...x)=>g(Ca)&&g(Ca)(...x))},O(g(o)("Remove")),9,IM)):ve("",!0),w("button",{class:"rename-thread-button",type:"button",disabled:g(Ke)||g(Ne),onClick:M[37]||(M[37]=(...x)=>g(Ho)&&g(Ho)(...x))},O(g(o)("Cancel")),9,AM),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:g(Ke)||g(Ne),onClick:M[38]||(M[38]=(...x)=>g(us)&&g(us)(...x))},O(g(Ke)?g(o)("Saving…"):g(o)("Save")),9,_M)])],8,XE)])):ve("",!0)]))],2))}}),EM=Tt(PM,[["__scopeId","data-v-0b490210"]]),MM={class:"content-header"},RM=["title"],LM={class:"content-actions"},jM=fn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(_(),B("header",MM,[w("div",{class:ct(["content-leading",{"is-accent":e.accent}])},[Cr(t.$slots,"leading",{},void 0)],2),w("h1",{class:ct(["content-title",{"is-accent":e.accent}]),title:e.title},O(e.title),11,RM),w("div",LM,[Cr(t.$slots,"actions",{},void 0)])]))}}),NM=Tt(jM,[["__scopeId","data-v-413c4c2d"]]),$M={},OM={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function DM(e,t){return _(),B("svg",OM,[...t[0]||(t[0]=[w("circle",{cx:"11",cy:"11",r:"8"},null,-1),w("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const oc=Tt($M,[["render",DM]]),FM=["thread","panel","view","navigate"],BM={thread:"Thread",panel:"Panel",view:"View",navigate:"Navigate"},UM=[{id:"thread.new",title:"Start a new thread",group:"thread",keywords:["new","chat","新建","新线程"]},{id:"thread.rename",title:"Rename the current thread",group:"thread",keywords:["title","重命名","标题"],requiresThread:!0},{id:"thread.archive",title:"Archive the current thread",group:"thread",keywords:["delete","归档","删除"],requiresThread:!0},{id:"thread.fork",title:"Fork the current thread",group:"thread",keywords:["branch","copy","派生","分叉"],requiresThread:!0},{id:"thread.copy-markdown",title:"Copy the conversation as Markdown",group:"thread",keywords:["export","md","导出","复制对话"],requiresThread:!0},{id:"thread.copy-last-code-block",title:"Copy last code block",group:"thread",keywords:["code","snippet","clipboard","代码块","复制代码"],requiresThread:!0},{id:"thread.compact",title:"Compact the current thread context",group:"thread",keywords:["compress","summarize","压缩","上下文"],requiresThread:!0},{id:"thread.interrupt",title:"Stop the running turn",group:"thread",keywords:["cancel","abort","interrupt","中断","停止"],requiresThread:!0},{id:"thread.implement-plan",title:"Implement the current plan",group:"thread",keywords:["execute","approve","执行","计划"],requiresThread:!0},{id:"panel.git",title:"Open the Git panel",group:"panel",keywords:["diff","changes","git","变更"]},{id:"panel.files",title:"Open the files panel",group:"panel",keywords:["explorer","files","文件"]},{id:"panel.terminal",title:"Toggle the terminal panel",group:"panel",keywords:["shell","console","终端"],shortcut:"Mod+J"},{id:"panel.toggle",title:"Toggle the side panel",group:"panel",keywords:["right","layout","侧边栏"]},{id:"panel.close",title:"Close the side panel",group:"panel",keywords:["hide","right","关闭"]},{id:"view.toggle-sidebar",title:"Toggle the sidebar",group:"view",keywords:["collapse","sidebar","侧栏"],shortcut:"Mod+B"},{id:"view.search-threads",title:"Search threads",group:"view",keywords:["filter","find","搜索","筛选"]},{id:"view.cycle-theme",title:"Cycle the color theme",group:"view",keywords:["dark","light","system","theme","暗色","亮色","主题"]},{id:"view.cycle-chat-width",title:"Cycle the chat width",group:"view",keywords:["wide","layout","宽度"]},{id:"view.toggle-language",title:"Switch the interface language",group:"view",keywords:["language","chinese","english","语言","中文"]},{id:"view.send-with-enter",title:"Toggle send with Enter",group:"view",keywords:["keyboard","enter","回车"]},{id:"view.in-progress-send-mode",title:"Cycle the in-progress send mode",group:"view",keywords:["steer","queue","队列"]},{id:"view.shortcuts",title:"Keyboard shortcuts",group:"view",keywords:["keys","bindings","help","快捷键","帮助"]},{id:"nav.skills",title:"Open the skills page",group:"navigate",keywords:["plugins","mcp","技能"]},{id:"nav.automations",title:"Open the automations page",group:"navigate",keywords:["schedule","cron","自动化"]},{id:"nav.recycle-bin",title:"Open the recycle bin",group:"navigate",keywords:["trash","deleted","回收站"]},{id:"nav.settings",title:"Open settings",group:"navigate",keywords:["preferences","config","设置"]}];function zM(e,t){if(t<=0)return!0;const n=e[t-1]??"";return n===" "||n==="-"||n==="/"||n==="."||n==="_"}function $g(e,t){const n=t.trim().toLowerCase();if(!n)return 0;const r=e.toLowerCase();if(!r)return null;let o=0,a=0,s=0,i=-1;for(let l=0;l<n.length;l+=1){const u=n[l];if(u===" ")continue;let d=-1;for(let m=a;m<r.length;m+=1)if(r[m]===u){d=m;break}if(d<0)return null;i<0&&(i=d),s=d===a?s+1:1,o+=10+s*6,zM(e,d)&&(o+=12),a=d+1}return o-=i*2,o-=Math.floor((r.length-n.length)/4),o}function HM(e,t){const n=t.trim();if(!n)return[...e];const r=[];return e.forEach((o,a)=>{const s=$g(o.title,n);if(s!==null){r.push({command:o,score:s,keywordOnly:!1,index:a});return}let i=null;for(const l of o.keywords??[]){const u=$g(l,n);u!==null&&(i===null||u>i)&&(i=u)}i!==null&&r.push({command:o,score:i,keywordOnly:!0,index:a})}),r.sort((o,a)=>Number(o.keywordOnly)-Number(a.keywordOnly)||a.score-o.score||o.index-a.index),r.map(o=>o.command)}function WM(e){return FM.map(t=>({group:t,label:BM[t],commands:e.filter(n=>n.group===t)})).filter(t=>t.commands.length>0)}const qM=["aria-label"],GM={class:"command-palette-search"},VM=["placeholder"],KM={class:"command-palette-count","aria-hidden":"true"},YM={class:"command-palette-group-label"},JM=["aria-selected","onClick"],QM={class:"command-palette-row-title"},XM={key:0,class:"command-palette-row-shortcut"},ZM={key:0,class:"command-palette-empty"},eR=fn({__name:"CommandPalette",props:{commands:{}},emits:["close","run"],setup(e,{emit:t}){const n=e,r=t,{t:o}=ao(),a=S(""),s=S(0),i=S(null),l=S(null),u=Y(()=>HM(n.commands,a.value)),d=Y(()=>WM(u.value)),m=Y(()=>d.value.flatMap(E=>E.commands));ot(u,()=>{s.value=0}),ot(s,async()=>{var q;await Et();const N=Array.from(((q=l.value)==null?void 0:q.querySelectorAll(".command-palette-row"))??[])[s.value];N instanceof HTMLElement&&N.scrollIntoView({block:"nearest"})});function f(E){return m.value.indexOf(E)}function v(E){const N=m.value.length;N!==0&&(s.value=(s.value+E+N)%N)}function T(E){r("run",E.id)}function k(){const E=m.value[s.value];E&&T(E)}function R(E){if(E.key==="ArrowDown"){E.preventDefault(),v(1);return}if(E.key==="ArrowUp"){E.preventDefault(),v(-1);return}if(E.key==="Tab"){E.preventDefault(),v(E.shiftKey?-1:1);return}if(E.key==="Enter"){E.preventDefault(),k();return}E.key==="Escape"&&(E.preventDefault(),r("close"))}return ss(async()=>{var E;await Et(),(E=i.value)==null||E.focus()}),(E,N)=>(_(),Ze(Ws,{to:"body"},[w("div",{class:"command-palette-backdrop",role:"presentation",onClick:N[2]||(N[2]=q=>r("close"))},[w("section",{class:"command-palette",role:"dialog","aria-modal":"true","aria-label":g(o)("Command palette"),onClick:N[1]||(N[1]=mt(()=>{},["stop"]))},[w("div",GM,[Fe(oc,{class:"command-palette-search-icon"}),In(w("input",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":N[0]||(N[0]=q=>a.value=q),class:"command-palette-input",type:"text",role:"combobox","aria-expanded":"true","aria-controls":"command-palette-list",placeholder:g(o)("Type a command..."),autocomplete:"off",spellcheck:"false",onKeydown:R},null,40,VM),[[jn,a.value]]),w("span",KM,O(u.value.length)+"/"+O(n.commands.length),1)]),w("div",{id:"command-palette-list",ref_key:"listRef",ref:l,class:"command-palette-list",role:"listbox"},[(_(!0),B(at,null,Ht(d.value,q=>(_(),B(at,{key:q.group},[w("div",YM,O(g(o)(q.label)),1),(_(!0),B(at,null,Ht(q.commands,K=>(_(),B("button",{key:K.id,class:ct(["command-palette-row",{"is-active":f(K)===s.value}]),type:"button",tabindex:"-1",role:"option","aria-selected":f(K)===s.value,onClick:U=>T(K)},[w("span",QM,O(g(o)(K.title)),1),K.shortcut?(_(),B("span",XM,O(K.shortcut),1)):ve("",!0)],10,JM))),128))],64))),128)),u.value.length===0?(_(),B("p",ZM,O(g(o)("No matching commands")),1)):ve("",!0)],512)],8,qM)])]))}}),tR=Tt(eR,[["__scopeId","data-v-d7a0f5d2"]]),nR="Mod",Ew=[{id:"global",label:"Global",entries:[{id:"global.palette",keys:["Mod","/"],label:"Open the command palette"},{id:"global.sidebar",keys:["Mod","B"],label:"Toggle the sidebar"},{id:"global.terminal",keys:["Mod","J"],label:"Toggle the terminal panel"},{id:"global.dismiss",keys:["Esc"],label:"Close dialogs and popovers"}]},{id:"composer",label:"Composer",entries:[{id:"composer.send-enter",keys:["Enter"],label:"Send the message",note:'When "send with Enter" is on'},{id:"composer.send-mod-enter",keys:["Mod","Enter"],label:"Send the message",note:'When "send with Enter" is off'},{id:"composer.newline",keys:["Shift","Enter"],label:"Insert a line break"},{id:"composer.slash",keys:["/"],label:"Open the slash command menu"},{id:"composer.mention",keys:["@"],label:"Mention a file"},{id:"composer.move",keys:["↑"],alsoKeys:["↓"],label:"Move through the menu"},{id:"composer.accept",keys:["Enter"],alsoKeys:["Tab"],label:"Accept the highlighted suggestion"},{id:"composer.dismiss",keys:["Esc"],label:"Dismiss the menu"}]},{id:"navigation",label:"Navigation",entries:[{id:"navigation.move",keys:["↑"],alsoKeys:["↓"],label:"Move the selection"},{id:"navigation.activate",keys:["Enter"],alsoKeys:["Space"],label:"Activate the focused item"},{id:"navigation.ends",keys:["Home"],alsoKeys:["End"],label:"Jump to the first or last item"}]}];function rR(e,t){return e.map(n=>n===nR?t?"⌘":"Ctrl":t&&n==="Shift"?"⇧":n)}function Og(e,t){return rR(e,t).join(t?"":" + ")}function oR(e,t){const n=[Og(e.keys,t)];return e.alsoKeys&&e.alsoKeys.length>0&&n.push(Og(e.alsoKeys,t)),n.join(" / ")}function aR(e=Ew){return e.reduce((t,n)=>t+n.entries.length,0)}const sR=["aria-label"],iR={class:"shortcut-help-header"},lR={class:"shortcut-help-title"},uR={class:"shortcut-help-count","aria-hidden":"true"},cR=["aria-label","title"],dR={class:"shortcut-help-body"},fR={class:"shortcut-help-group-label"},hR={class:"shortcut-help-list"},pR={class:"shortcut-help-keys"},mR={class:"shortcut-help-key"},gR={class:"shortcut-help-label"},vR={class:"shortcut-help-label-text"},yR={key:0,class:"shortcut-help-note"},wR={class:"shortcut-help-footer"},bR=fn({__name:"ShortcutHelpPanel",props:{isMac:{type:Boolean,default:!1}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,{t:o}=ao(),a=Ew,s=aR(),i=S(null);return ss(async()=>{var l;await Et(),(l=i.value)==null||l.focus()}),(l,u)=>(_(),Ze(Ws,{to:"body"},[w("div",{class:"shortcut-help-backdrop",role:"presentation",onClick:u[2]||(u[2]=d=>r("close"))},[w("section",{class:"shortcut-help",role:"dialog","aria-modal":"true","aria-label":g(o)("Keyboard shortcuts"),onClick:u[1]||(u[1]=mt(()=>{},["stop"]))},[w("header",iR,[w("h2",lR,O(g(o)("Keyboard shortcuts")),1),w("span",uR,O(g(s)),1),w("button",{ref_key:"closeButtonRef",ref:i,class:"shortcut-help-close",type:"button","aria-label":g(o)("Close"),title:g(o)("Close"),onClick:u[0]||(u[0]=d=>r("close"))},[Fe(kc,{class:"shortcut-help-close-icon"})],8,cR)]),w("div",dR,[(_(!0),B(at,null,Ht(g(a),d=>(_(),B("section",{key:d.id,class:"shortcut-help-group"},[w("h3",fR,O(g(o)(d.label)),1),w("dl",hR,[(_(!0),B(at,null,Ht(d.entries,m=>(_(),B("div",{key:m.id,class:"shortcut-help-row"},[w("dt",pR,[w("kbd",mR,O(g(oR)(m,n.isMac)),1)]),w("dd",gR,[w("span",vR,O(g(o)(m.label)),1),m.note?(_(),B("span",yR,O(g(o)(m.note)),1)):ve("",!0)])]))),128))])]))),128))]),w("footer",wR,O(g(o)("Press Esc to close")),1)],8,sR)])]))}}),TR=Tt(bR,[["__scopeId","data-v-31a7bebc"]]),Dg=.0025,of=3,Fg=2,SR=256;function kR(e){var we;const t=S("idle"),n=S(typeof navigator<"u"&&!!((we=navigator.mediaDevices)!=null&&we.getUserMedia)),r=S(0),o=S(null);let a=null,s=null,i=[],l=null,u=null,d=null,m=null,f=[],v=!1,T=!1,k=null;function R(){k&&(k.abort(),k=null),t.value==="transcribing"&&(t.value="idle")}function E(){const ee=o.value;if(!ee||typeof window>"u")return;const he=ee.getContext("2d");if(!he)return;const te=Math.max(1,Math.floor(ee.clientWidth)),Ae=Math.max(1,Math.floor(ee.clientHeight||36)),Oe=window.devicePixelRatio||1,$e=Math.max(1,Math.floor(te*Oe)),De=Math.max(1,Math.floor(Ae*Oe));(ee.width!==$e||ee.height!==De)&&(ee.width=$e,ee.height=De),he.setTransform(Oe,0,0,Oe,0,0),he.clearRect(0,0,te,Ae);const Se=Math.max(12,Math.floor(te/(of+Fg))),Te=f.slice(-Se),xe=Math.max(0,Se-Te.length),Ee=Ae/2,Je=getComputedStyle(ee).color||"#000000";for(let Xe=0;Xe<Se;Xe+=1){const nt=Te[Xe-xe]??0,D=Math.max(.08,Math.min(1,nt*18))*Ee,ne=Xe*(of+Fg);he.globalAlpha=nt<=Dg?.35:1,he.fillStyle=Je,he.fillRect(ne,Ee-D,of,D*2)}he.globalAlpha=1}function N(){f=[],r.value=0,E()}function q(){d&&(d.disconnect(),d.onaudioprocess=null,d=null),u&&(u.disconnect(),u=null),l&&(l.close(),l=null),m=null}function K(ee){if(typeof window>"u")return;const he=window.webkitAudioContext,te=window.AudioContext??he;te&&(q(),N(),l=new te,u=l.createMediaStreamSource(ee),d=l.createScriptProcessor(2048,1,1),m=performance.now(),d.onaudioprocess=Ae=>{const Oe=Ae.inputBuffer.getChannelData(0);let $e=0;for(let De=0;De<Oe.length;De+=1){const Se=Math.abs(Oe[De]??0);$e+=Se<Dg?0:Se}f.push($e/Oe.length),f.length>SR&&f.shift(),m!==null&&(r.value=Math.max(0,performance.now()-m)),E()},u.connect(d),d.connect(l.destination),E())}async function U(){var ee;if(t.value==="transcribing"&&R(),!(t.value!=="idle"||!n.value||v)){v=!0,T=!1;try{s=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),i=[],a=new MediaRecorder(s),a.ondataavailable=he=>{he.data.size>0&&i.push(he.data)},a.onstop=()=>{var Ae;const he=i,te=(a==null?void 0:a.mimeType)||((Ae=he[0])==null?void 0:Ae.type)||"audio/webm";ye(),le(he,te)},K(s),a.start(250),t.value="recording",T&&ce()}catch(he){ye(),t.value="idle",(ee=e.onError)==null||ee.call(e,he)}finally{v=!1}}}function ce(){if(v&&t.value==="idle"){T=!0;return}if(!(t.value!=="recording"||!a)&&a.state!=="inactive"){t.value="transcribing";try{a.requestData()}catch{}a.stop()}}function G(){T=!1,R(),ye(),t.value="idle"}async function le(ee,he){var Oe,$e,De,Se,Te;if(ee.length===0){(Oe=e.onEmpty)==null||Oe.call(e),t.value="idle";return}const te=new Blob(ee,{type:he});t.value="transcribing";let Ae=null;try{const xe=he.split(/[/;]/)[1]??"webm",Ee=new FormData;Ee.append("file",te,`codex.${xe}`);const Je=(($e=e.getLanguage)==null?void 0:$e.call(e).trim())??"";Je&&Je.toLowerCase()!=="auto"&&Ee.append("language",Je),Ae=new AbortController,k=Ae;const Xe=await fetch("/codex-api/transcribe",{method:"POST",body:Ee,signal:Ae.signal}),nt=await Xe.text();let de=null;try{de=nt.trim()?JSON.parse(nt):null}catch{de=null}if(!Xe.ok){const ne=(De=de==null?void 0:de.error)==null?void 0:De.trim(),se=nt.trim();throw new Error(ne||se||`Transcription failed: ${Xe.status}`)}const D=((de==null?void 0:de.text)??"").trim();D.length>0?e.onTranscript(D):(Se=e.onEmpty)==null||Se.call(e)}catch(xe){if(xe instanceof DOMException&&xe.name==="AbortError")return;(Te=e.onError)==null||Te.call(e,xe)}finally{Ae&&k===Ae&&(k=null),t.value==="transcribing"&&(t.value="idle")}}function ye(){q(),N(),a&&(a.ondataavailable=null,a.onstop=null,a=null),s&&(s.getTracks().forEach(ee=>ee.stop()),s=null),i=[]}Ks(()=>{G()});function _e(){if(t.value==="recording"){ce();return}(t.value==="idle"||t.value==="transcribing")&&U()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:o,startRecording:U,stopRecording:ce,toggleRecording:_e,cancel:G}}const CR={},xR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function IR(e,t){return _(),B("svg",xR,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m12 5l0 14m-6-8l6-6l6 6"},null,-1)])])}const AR=Tt(CR,[["render",IR]]),_R={},PR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function ER(e,t){return _(),B("svg",PR,[...t[0]||(t[0]=[w("path",{d:"M4 8V4h4"},null,-1),w("path",{d:"M20 8V4h-4"},null,-1),w("path",{d:"M4 16v4h4"},null,-1),w("path",{d:"M20 16v4h-4"},null,-1)])])}const MR=Tt(_R,[["render",ER]]),RR={},LR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function jR(e,t){return _(),B("svg",LR,[...t[0]||(t[0]=[w("path",{d:"M8 4v4H4"},null,-1),w("path",{d:"M16 4v4h4"},null,-1),w("path",{d:"M8 20v-4H4"},null,-1),w("path",{d:"M16 20v-4h4"},null,-1)])])}const NR=Tt(RR,[["render",jR]]),$R={},OR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function DR(e,t){return _(),B("svg",OR,[...t[0]||(t[0]=[w("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),w("path",{fill:"currentColor",d:"M8 5a3 3 0 0 0 -3 3v8a3 3 0 0 0 3 3h8a3 3 0 0 0 3 -3v-8a3 3 0 0 0 -3 -3h-8z"},null,-1)])])}const FR=Tt($R,[["render",DR]]),BR=["aria-label"],UR=8,mi=8,zR=fn({__name:"ComposerPopover",props:{open:{type:Boolean},align:{},width:{},panelClass:{},ariaLabel:{}},emits:["update:open"],setup(e,{expose:t,emit:n}){const r=e,o=n,a=S(null),s=S(null),i=S({});let l=!1;const u=Y(()=>r.open),d=Y(()=>r.width==="lg"?"composer-popover-panel--lg":"composer-popover-panel--md");function m(E,N,q){return Math.min(Math.max(N,E),q)}function f(){var _e,we;if(!u.value)return;const E=a.value;if(!E||typeof window>"u")return;const N=E.getBoundingClientRect(),q=window.innerWidth,K=window.innerHeight,U=Math.max(0,q-mi*2),ce=Math.min(((_e=s.value)==null?void 0:_e.offsetWidth)??288,U),G=((we=s.value)==null?void 0:we.offsetHeight)??0;let le;r.align==="end"?le=N.right-ce:r.align==="center"?le=N.left+(N.width-ce)/2:le=N.left,le=m(le,mi,Math.max(mi,q-ce-mi));let ye=N.top-G-UR;ye=m(ye,mi,Math.max(mi,K-G-mi)),i.value={position:"fixed",left:`${le}px`,right:"auto",top:`${ye}px`,bottom:"auto",width:`${ce}px`}}function v(){l||typeof window>"u"||(window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),window.addEventListener("orientationchange",f),l=!0)}function T(){!l||typeof window>"u"||(window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0),window.removeEventListener("orientationchange",f),l=!1)}ot(u,E=>{if(!E){T(),i.value={};return}v(),Et(()=>{var N;(N=s.value)==null||N.focus(),f(),window.requestAnimationFrame(f)})}),Ks(()=>{T()});function k(){o("update:open",!r.open)}function R(E){var G,le,ye;if(E.key==="Escape"){o("update:open",!1);return}const N=s.value;if(!N)return;const q=Array.from(N.querySelectorAll("button")).filter(_e=>!_e.disabled&&_e.offsetParent!==null);if(q.length===0)return;if(E.key==="Home"){E.preventDefault(),(G=q[0])==null||G.focus();return}if(E.key==="End"){E.preventDefault(),(le=q[q.length-1])==null||le.focus();return}if(E.key!=="ArrowDown"&&E.key!=="ArrowUp")return;E.preventDefault();let K=q.findIndex(_e=>_e===document.activeElement);K<0&&(K=E.key==="ArrowDown"?-1:0);const U=E.key==="ArrowDown"?1:-1,ce=(K+U+q.length)%q.length;(ye=q[ce])==null||ye.focus()}return t({root:a}),(E,N)=>(_(),B("div",{ref_key:"rootRef",ref:a,class:"composer-popover-anchor"},[Cr(E.$slots,"trigger",{toggle:k,isOpen:u.value},void 0),Fe(bu,{name:"composer-popover"},{default:ht(()=>[u.value?(_(),B("div",{key:0,ref_key:"panelRef",ref:s,class:ct(["composer-popover-panel",[d.value,e.panelClass]]),style:Zr(i.value),role:"menu",tabindex:"-1","aria-label":e.ariaLabel,onKeydown:R},[Cr(E.$slots,"default",{},void 0,!0)],46,BR)):ve("",!0)]),_:3})],512))}}),xc=Tt(zR,[["__scopeId","data-v-1fb1570a"]]),HR=["aria-label"],WR={class:"composer-popover-group-label"},qR=["aria-selected","onMousedown"],GR={class:"thread-composer-slash-body"},VR={class:"thread-composer-slash-name"},KR={class:"thread-composer-slash-desc"},YR={class:"thread-composer-slash-kind"},JR={class:"composer-popover-group-label composer-popover-group-label--skills"},QR=["aria-selected","onMousedown"],XR=["aria-label","title"],ZR={class:"thread-composer-slash-body thread-composer-slash-body--skill"},eL={class:"thread-composer-slash-skill-name"},tL={class:"thread-composer-slash-desc thread-composer-slash-desc--skill"},nL=fn({__name:"ComposerSlashMenu",props:{commands:{},highlightedIndex:{}},emits:["select"],setup(e,{emit:t}){const n=e,r=t,{t:o}=ao(),a=S(null),s=Y(()=>n.commands.filter(m=>m.group!=="skill")),i=Y(()=>n.commands.filter(m=>m.group==="skill"));ot(()=>n.highlightedIndex,async()=>{var m,f;await Et(),(f=(m=a.value)==null?void 0:m.querySelector(".is-active"))==null||f.scrollIntoView({block:"nearest"})});function l(m){return o(m==="rpc"?"Action":m==="text"?"Prompt":m==="skill"?"Skill":"Local")}function u(m){return m==="system"?"S":m==="repo"?"R":m==="plugin"?"P":"U"}function d(m){return o(m==="system"?"System":m==="repo"?"Repo":m==="plugin"?"Plugin":"User")}return(m,f)=>(_(),B("div",{ref_key:"rootRef",ref:a,class:"composer-popover",role:"listbox","aria-label":g(o)("Commands")},[s.value.length>0?(_(),B(at,{key:0},[w("div",WR,O(g(o)("Commands")),1),(_(!0),B(at,null,Ht(s.value,(v,T)=>(_(),B("button",{key:v.id,class:ct(["thread-composer-slash-row",{"is-active":T===e.highlightedIndex}]),type:"button",role:"option","aria-selected":T===e.highlightedIndex,onMousedown:mt(k=>r("select",v),["prevent"])},[f[0]||(f[0]=w("span",{class:"thread-composer-slash-prefix","aria-hidden":"true"},"/",-1)),w("span",GR,[w("span",VR,O(v.id),1),w("span",KR,O(g(o)(v.description)),1)]),w("span",YR,O(l(v.kind)),1)],42,qR))),128))],64)):ve("",!0),i.value.length>0?(_(),B(at,{key:1},[w("div",JR,O(g(o)("Skills")),1),(_(!0),B(at,null,Ht(i.value,(v,T)=>(_(),B("button",{key:v.skillPath||v.id,class:ct(["thread-composer-slash-row thread-composer-slash-row--skill",{"is-active":s.value.length+T===e.highlightedIndex}]),type:"button",role:"option","aria-selected":s.value.length+T===e.highlightedIndex,onMousedown:mt(k=>r("select",v),["prevent"])},[w("span",{class:ct(["thread-composer-slash-skill-icon",`is-${v.scope||"user"}`]),"aria-label":d(v.scope),title:d(v.scope)},O(u(v.scope)),11,XR),w("span",ZR,[w("span",eL,O(v.displayName||v.id),1),w("span",tL,O(v.description),1)])],42,QR))),128))],64)):ve("",!0)],8,HR))}}),rL=Tt(nL,[["__scopeId","data-v-bc518c3f"]]),oL=["data-streaming"],aL=["aria-expanded"],sL={class:"thread-composer-plan-panel-title"},iL={key:0,class:"thread-composer-plan-panel-badge"},lL={class:"thread-composer-plan-panel-progress"},uL=["title"],cL=["data-status"],dL={class:"thread-composer-plan-panel-latest-text"},fL={class:"thread-composer-plan-panel-popover-content"},hL={class:"thread-composer-plan-panel-popover-scroll"},pL={class:"thread-composer-plan-panel-popover-head"},mL={class:"thread-composer-plan-panel-title"},gL={class:"thread-composer-plan-panel-progress"},vL={key:0,class:"thread-composer-plan-panel-popover-section"},yL={class:"thread-composer-plan-panel-section-label"},wL=["title"],bL={class:"thread-composer-plan-panel-popover-section"},TL={class:"thread-composer-plan-panel-section-label"},SL={class:"thread-composer-plan-panel-steps"},kL=["data-status"],CL=["data-status"],xL=["title"],IL={class:"thread-composer-plan-panel-popover-footer"},AL=["disabled","data-state"],_L=fn({__name:"ThreadComposerPlanPanel",props:{planPanel:{}},emits:["implement-plan"],setup(e,{emit:t}){const n=e,r=t,{t:o}=ao(),a=S(!1),s=Y(()=>{var f;return(((f=n.planPanel)==null?void 0:f.steps)??[]).filter(v=>v.status==="completed").length}),i=Y(()=>{var f;const m=((f=n.planPanel)==null?void 0:f.steps)??[];if(m.length===0)return null;for(let v=m.length-1;v>=0;v-=1){const T=m[v];if(T.status==="inProgress")return T}return m[m.length-1]}),l=Y(()=>{var T,k,R;const m=((k=(T=n.planPanel)==null?void 0:T.explanation)==null?void 0:k.trim())??"";if(!m)return"";const f=((R=m.split(/[。!?!?\n]/u)[0])==null?void 0:R.trim())??"";if(!f)return m;const v=80;return f.length>v?`${f.slice(0,v)}…`:f});function u(m){switch(m){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function d(){a.value=!1,r("implement-plan")}return(m,f)=>(_(),B("div",{class:"thread-composer-plan-panel","data-streaming":e.planPanel.streaming},[Fe(xc,{open:a.value,align:"center",width:"lg","panel-class":"thread-composer-plan-panel-popover","aria-label":g(o)("Plan"),"onUpdate:open":f[1]||(f[1]=v=>a.value=v)},{trigger:ht(()=>{var v,T;return[w("button",{type:"button",class:"thread-composer-plan-panel-header","aria-expanded":a.value,onClick:f[0]||(f[0]=k=>a.value=!a.value)},[f[2]||(f[2]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",sL,O(g(o)("Plan")),1),e.planPanel.streaming?(_(),B("span",iL,O(g(o)("Updating")),1)):ve("",!0),w("span",lL,O(s.value)+"/"+O(e.planPanel.steps.length),1),w("span",{class:"thread-composer-plan-panel-latest",title:((v=i.value)==null?void 0:v.step)??""},[i.value?(_(),B("span",{key:0,class:"thread-composer-plan-panel-latest-status","data-status":i.value.status},O(u(i.value.status)),9,cL)):ve("",!0),w("span",dL,O(((T=i.value)==null?void 0:T.step)??""),1)],8,uL),Fe(zs,{class:"thread-composer-plan-panel-chevron"})],8,aL)]}),default:ht(()=>[w("div",fL,[w("div",hL,[w("header",pL,[f[3]||(f[3]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",mL,O(g(o)("Plan")),1),w("span",gL,O(s.value)+"/"+O(e.planPanel.steps.length),1)]),e.planPanel.explanation?(_(),B("section",vL,[w("p",yL,O(g(o)("Summary")),1),w("p",{class:"thread-composer-plan-panel-explanation",title:e.planPanel.explanation},O(l.value),9,wL)])):ve("",!0),w("section",bL,[w("p",TL,O(g(o)("Steps"))+" ("+O(e.planPanel.steps.length)+")",1),w("ol",SL,[(_(!0),B(at,null,Ht(e.planPanel.steps,(v,T)=>(_(),B("li",{key:`composer-plan-${e.planPanel.id}-${T}`,class:"thread-composer-plan-panel-step","data-status":v.status},[w("span",{class:"thread-composer-plan-panel-step-status","data-status":v.status},O(u(v.status)),9,CL),w("span",{class:"thread-composer-plan-panel-step-text",title:v.step},O(v.step),9,xL)],8,kL))),128))])])]),w("footer",IL,[w("button",{type:"button",class:"thread-composer-plan-panel-implement",disabled:e.planPanel.streaming||e.planPanel.implemented,"data-state":e.planPanel.implemented?"done":e.planPanel.streaming?"running":"idle",onClick:d},O(e.planPanel.implemented?g(o)("Plan executed"):e.planPanel.streaming?g(o)("Implementing…"):g(o)("Implement plan")),9,AL)])])]),_:1},8,["open","aria-label"])],8,oL))}}),PL=Tt(_L,[["__scopeId","data-v-970a9351"]]),EL={key:0,class:"thread-composer-attachments"},ML=["src"],RL=["src","alt"],LL=["aria-label","disabled","onClick"],jL={key:1,class:"thread-composer-folder-chips"},NL=["title"],$L={class:"thread-composer-folder-chip-meta"},OL=["aria-label","disabled","onClick"],DL={key:2,class:"thread-composer-file-chips"},FL=["title"],BL=["aria-label","disabled","onClick"],UL={key:3,class:"thread-composer-skill-chips"},zL=["title","aria-label","onClick"],HL=["aria-label","onClick"],WL=fn({__name:"ThreadComposerAttachments",props:{selectedImages:{},folderUploadGroups:{},standaloneFileAttachments:{},selectedSkills:{},isInteractionDisabled:{type:Boolean}},emits:["remove-image","remove-folder","remove-file","remove-skill"],setup(e,{emit:t}){const n=t,r=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function o(l){const u=l.trim();return u?!!(/^video\/|^data:video\//i.test(u)||r.test(u)):!1}function a(l){return l.total<=0?0:Math.round(l.processed/l.total*100)}function s(l){const u=l.trim();return u?u.endsWith("/SKILL.md")?u:`${u.replace(/\/+$/,"")}/SKILL.md`:""}function i(l){const u=s(l.path);!u||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(u)}`,"_blank","noopener,noreferrer")}return(l,u)=>(_(),B(at,null,[e.selectedImages.length>0?(_(),B("div",EL,[(_(!0),B(at,null,Ht(e.selectedImages,d=>(_(),B("div",{key:d.id,class:"thread-composer-attachment"},[o(d.url)?(_(),B("video",{key:0,class:"thread-composer-attachment-image",src:d.url,controls:"",preload:"metadata"},null,8,ML)):(_(),B("img",{key:1,class:"thread-composer-attachment-image",src:d.url,alt:d.name||"Selected image"},null,8,RL)),w("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${d.name||"image"}`,disabled:e.isInteractionDisabled,onClick:m=>n("remove-image",d.id)}," x ",8,LL)]))),128))])):ve("",!0),e.folderUploadGroups.length>0?(_(),B("div",jL,[(_(!0),B(at,null,Ht(e.folderUploadGroups,d=>(_(),B("span",{key:d.id,class:"thread-composer-folder-chip"},[Fe(Lh,{class:"thread-composer-folder-chip-icon"}),w("span",{class:"thread-composer-folder-chip-name",title:d.name},O(d.name),9,NL),w("span",$L,[d.isUploading?(_(),B(at,{key:0},[Fs(O(a(d))+"% uploading ("+O(d.processed)+"/"+O(d.total)+") ",1)],64)):(_(),B(at,{key:1},[Fs(O(d.filePaths.length)+" file"+O(d.filePaths.length===1?"":"s"),1)],64))]),w("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${d.name}`,disabled:e.isInteractionDisabled,onClick:m=>n("remove-folder",d.id)},"×",8,OL)]))),128))])):ve("",!0),e.standaloneFileAttachments.length>0?(_(),B("div",DL,[(_(!0),B(at,null,Ht(e.standaloneFileAttachments,d=>(_(),B("span",{key:d.fsPath,class:"thread-composer-file-chip"},[Fe(Cl,{class:"thread-composer-file-chip-icon"}),w("span",{class:"thread-composer-file-chip-name",title:d.fsPath},O(d.label),9,FL),w("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${d.label}`,disabled:e.isInteractionDisabled,onClick:m=>n("remove-file",d.fsPath)},"×",8,BL)]))),128))])):ve("",!0),e.selectedSkills.length>0?(_(),B("div",UL,[(_(!0),B(at,null,Ht(e.selectedSkills,d=>(_(),B("span",{key:d.path,class:"thread-composer-skill-chip"},[w("button",{class:"thread-composer-skill-chip-name",type:"button",title:s(d.path),"aria-label":`Open ${d.displayName||d.name} SKILL.md`,onClick:m=>i(d)},O(d.displayName||d.name),9,zL),w("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${d.displayName||d.name}`,onClick:m=>n("remove-skill",d.path)},"×",8,HL)]))),128))])):ve("",!0)],64))}}),qL=Tt(WL,[["__scopeId","data-v-7ba5474c"]]),GL=fn({__name:"ThreadComposerModelControls",props:{models:{},selectedModel:{},modelReasoningEfforts:{},selectedReasoningEffort:{},selectedSpeedMode:{},disabled:{type:Boolean},activeThreadId:{}},emits:["update:selected-model","update:selected-reasoning-effort"],setup(e,{emit:t}){const n=e,r=t,{t:o}=ao(),a=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],s=Y(()=>{var R;const T=(R=n.modelReasoningEfforts)==null?void 0:R[n.selectedModel];if(T===void 0)return a;const k=new Set(T);return a.filter(E=>k.has(E.value))});function i(T){return T.trim().replace(/^gpt/i,"GPT")}const l=Y(()=>n.models.map(T=>({value:T,label:i(T)}))),u=Y(()=>n.disabled||!n.activeThreadId),d=Y(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(n.selectedModel.trim())),m=Y(()=>n.selectedSpeedMode==="fast"&&d.value);function f(T){r("update:selected-model",T)}function v(T){r("update:selected-reasoning-effort",T)}return(T,k)=>(_(),B(at,null,[Fe(Ci,{class:"thread-composer-control thread-composer-model-control","model-value":e.selectedModel,options:l.value,"selected-prefix-icon":m.value?Qc:null,placeholder:g(o)("Model"),"open-direction":"up",variant:"pill",disabled:u.value||e.models.length===0,"enable-search":"","search-placeholder":g(o)("Search models..."),"onUpdate:modelValue":f},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Fe(Ci,{class:"thread-composer-control thread-composer-thinking-control","model-value":e.selectedReasoningEffort,options:s.value,placeholder:g(o)("Thinking"),"open-direction":"up",variant:"pill",disabled:u.value||s.value.length===0,"onUpdate:modelValue":v},null,8,["model-value","options","placeholder","disabled"])],64))}}),VL=Tt(GL,[["__scopeId","data-v-245f3391"]]),KL=["aria-label","disabled"],YL=["disabled"],JL=["disabled"],QL=["disabled"],XL={class:"thread-composer-attach-mode"},ZL={class:"thread-composer-attach-mode-label"},ej={class:"thread-composer-attach-mode-buttons"},tj=["disabled"],nj=["disabled"],rj={class:"thread-composer-attach-mode"},oj={class:"thread-composer-attach-mode-label"},aj={class:"thread-composer-attach-mode-buttons"},sj=["disabled","onClick"],ij={class:"thread-composer-attach-mode"},lj={class:"thread-composer-attach-mode-label"},uj={class:"thread-composer-attach-mode-buttons"},cj=["disabled","onClick"],dj={key:0,class:"thread-composer-menu-error",role:"alert"},fj={key:0,class:"thread-composer-approval-tip",role:"status"},hj=fn({__name:"ThreadComposerAttachMenu",props:{open:{type:Boolean},isMobile:{type:Boolean},isInteractionDisabled:{type:Boolean},isComposerConfigDisabled:{type:Boolean},isApprovalPolicySaving:{type:Boolean},approvalPolicy:{},approvalPolicyError:{},approvalPolicyNotice:{},selectedCollaborationMode:{},collaborationModeChoices:{},approvalPolicyChoices:{},activeInProgressMode:{}},emits:["update:open","toggle","set-active-mode","select-photo","select-folder","capture-camera","select-collaboration-mode","select-approval-policy"],setup(e,{emit:t}){const n=t,{t:r}=ao();function o(){n("toggle")}function a(m){n("set-active-mode",m)}function s(){n("select-photo")}function i(){n("select-folder")}function l(){n("capture-camera")}function u(m){n("select-collaboration-mode",m)}function d(m){n("select-approval-policy",m)}return(m,f)=>(_(),Ze(xc,{open:e.open,align:"start",width:"lg","aria-label":g(r)("Add photos & files"),"onUpdate:open":f[2]||(f[2]=v=>n("update:open",v))},{trigger:ht(()=>[w("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":g(r)("Add photos & files"),disabled:e.isInteractionDisabled,onClick:o}," + ",8,KL)]),default:ht(()=>[w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:s},O(g(r)("Add photos & files")),9,YL),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:i},O(g(r)("Add folder")),9,JL),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:l},O(g(r)("Take photo")),9,QL),f[5]||(f[5]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",XL,[w("span",ZL,O(g(r)("In-progress send")),1),w("div",ej,[w("button",{class:ct(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="steer"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[0]||(f[0]=v=>a("steer"))},O(g(r)("Steer")),11,tj),w("button",{class:ct(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="queue"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[1]||(f[1]=v=>a("queue"))},O(g(r)("Queue")),11,nj)])]),e.isMobile?(_(),B(at,{key:0},[f[3]||(f[3]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",rj,[w("span",oj,O(g(r)("Plan mode")),1),w("div",aj,[(_(!0),B(at,null,Ht(e.collaborationModeChoices,v=>(_(),B("button",{key:`mobile-plan-${v.value}`,class:ct(["thread-composer-attach-mode-button",{"is-active":e.selectedCollaborationMode===v.value}]),type:"button",disabled:v.disabled||e.isComposerConfigDisabled,onClick:T=>u(v.value)},O(g(r)(v.labelKey)),11,sj))),128))])]),f[4]||(f[4]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",ij,[w("span",lj,O(g(r)("Approval policy")),1),w("div",uj,[(_(!0),B(at,null,Ht(e.approvalPolicyChoices,v=>(_(),B("button",{key:`mobile-approval-${v.value}`,class:ct(["thread-composer-attach-mode-button",{"is-active":e.approvalPolicy===v.value}]),type:"button",disabled:e.isApprovalPolicySaving,onClick:T=>d(v.value)},O(g(r)(v.label)),11,cj))),128))])]),e.approvalPolicyError?(_(),B("p",dj,O(e.approvalPolicyError),1)):ve("",!0),Fe(bu,{name:"approval-tip"},{default:ht(()=>[e.approvalPolicyNotice?(_(),B("span",fj,O(e.approvalPolicyNotice),1)):ve("",!0)]),_:1})],64)):ve("",!0)]),_:1},8,["open","aria-label"]))}}),pj=Tt(hj,[["__scopeId","data-v-4d71ea67"]]),mj=/(^|\s)(\/[a-zA-Z]*)$/,Bg=[{id:"compact",description:"Compact the current thread context",kind:"rpc",group:"builtin"},{id:"review",description:"Open the code review pane",kind:"rpc",group:"builtin"},{id:"rename",description:"Rename the current thread",kind:"rpc",group:"builtin"},{id:"archive",description:"Archive the current thread",kind:"rpc",group:"builtin"},{id:"fork",description:"Fork the current thread",kind:"rpc",group:"builtin"},{id:"new",description:"Start a new thread",kind:"rpc",group:"builtin"},{id:"skills",description:"Open the skills page",kind:"rpc",group:"builtin"},{id:"init",description:"Generate or update AGENTS.md",kind:"text",group:"builtin",insertText:"Create or update the AGENTS.md file for this project: include an overview, architecture notes, development conventions, and a workflow guide based on the codebase."},{id:"help",description:"Show help about Codex",kind:"text",group:"builtin",insertText:"How do I use Codex? Point me to the official documentation and explain the available commands."},{id:"mention",description:"Mention files with @",kind:"text",group:"builtin",insertText:"Please review the files I mention with @, starting with: "},{id:"diff",description:"Show the current git diff",kind:"text",group:"builtin",insertText:"Show the current git diff of this project and summarize the changes."},{id:"clear",description:"Clear the input",kind:"local",group:"builtin"}];function gj(e){var r,o,a;const t=[],n=new Set;for(const s of e){const i=s.name.trim().replace(/^\//u,"").toLowerCase().replace(/\s+/gu,"-");if(!i)continue;const l=s.path.trim()||i;n.has(l)||(n.add(l),t.push({id:i,description:((r=s.description)==null?void 0:r.trim())||"Run this skill",kind:"skill",group:"skill",skillPath:s.path,displayName:((o=s.displayName)==null?void 0:o.trim())||s.name.trim(),scope:((a=s.scope)==null?void 0:a.trim())||"user"}))}return t.sort((s,i)=>s.id.localeCompare(i.id))}function vj(e){const t=e.match(mj);if(!t)return null;const n=t[2]??"";return{query:n.slice(1).toLowerCase(),token:n,startIndex:e.length-n.length}}function yj(e,t){const n=t.trim().toLowerCase();if(!n)return e;const r=e.filter(o=>o.id===n);return r.length>0?r:e.filter(o=>o.id.startsWith(n))}const wj={class:"thread-composer-main"},bj={class:"thread-composer-input-row"},Tj={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},Sj={class:"thread-composer-drop-overlay-copy"},kj={key:1,class:"composer-popover"},Cj=["onMousedown"],xj={key:1,class:"thread-composer-file-mention-icon-markdown"},Ij={class:"thread-composer-file-mention-text"},Aj={class:"thread-composer-file-mention-name"},_j={key:0,class:"thread-composer-file-mention-dir"},Pj={key:1,class:"thread-composer-file-mention-empty"},Ej={key:2,class:"thread-composer-file-mention-empty"},Mj=["placeholder","disabled"],Rj=["aria-label","title","disabled"],Lj={class:"thread-composer-actions"},jj=["aria-label","title","disabled"],Nj={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},$j=["aria-label","title","disabled"],Oj={key:0,class:"thread-composer-secondary"},Dj=["aria-label","disabled"],Fj={class:"thread-composer-plan-trigger-label"},Bj=["aria-checked","disabled","onClick"],Uj={class:"thread-composer-menu-item-copy"},zj={class:"thread-composer-menu-item-title"},Hj={key:0,class:"thread-composer-menu-item-sub"},Wj={key:1,class:"thread-composer-menu-item-hint"},qj={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},Gj=["aria-label","disabled"],Vj={class:"thread-composer-approval-trigger-label"},Kj=["aria-checked","disabled","onClick"],Yj={class:"thread-composer-menu-item-copy"},Jj={class:"thread-composer-menu-item-title"},Qj={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},Xj={key:0,class:"thread-composer-menu-error",role:"alert"},Zj={key:0,class:"thread-composer-approval-tip",role:"status"},eN=["title","aria-label"],tN={class:"thread-composer-context-usage-value"},nN={key:0,class:"thread-composer-context-usage-compact"},rN=["disabled"],oN=["disabled"],aN=["disabled"],af=12e3,sN=2e3,iN="codex-web-local.thread-draft.v1.",lN=fn({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},fuzzyFileSearchResults:{},collaborationModes:{},selectedCollaborationMode:{},models:{},modelReasoningEfforts:{},selectedModel:{},selectedReasoningEffort:{},selectedSpeedMode:{},skills:{},threadTokenUsage:{},codexQuota:{},isTurnInProgress:{type:Boolean},isStopPending:{type:Boolean},isInterruptingTurn:{type:Boolean},isCompacting:{type:Boolean},externalSessionActive:{type:Boolean},isUpdatingSpeedMode:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean},dictationAutoSend:{type:Boolean},dictationLanguage:{},approvalPolicy:{},isApprovalPolicySaving:{type:Boolean},approvalPolicyError:{},approvalPolicyNotice:{},planPanel:{}},emits:["submit","interrupt","register-fuzzy-session","slash-command","update:selected-collaboration-mode","update:selected-model","update:selected-reasoning-effort","update:selected-speed-mode","update:approval-policy","save-approval-policy","implement-plan","compact-context"],setup(e,{expose:t,emit:n}){const r=e,o=n,{t:a}=ao(),s=S(""),i=S([]),l=S([]),u=S([]),d=S([]),m=S(""),f=S(0),v=S(null),T=S(!1),{state:k,cancel:R}=kR({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:I=>{if(s.value=s.value?`${s.value}
58
+ ${I}`:I,m.value="",r.dictationAutoSend!==!1){const $=r.isTurnInProgress?Ne.value:"steer";Jt($);return}Et(()=>{var $;return($=K.value)==null?void 0:$.focus()})},onEmpty:()=>{m.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:I=>{if(I instanceof DOMException&&I.name==="NotAllowedError"){m.value="Microphone access was denied.";return}m.value=I instanceof Error?I.message:"Dictation failed."}}),E=S(null),N=S(null),q=S(null),K=S(null),{isMobile:U}=xh(),ce=S(!1),G=S(!1),le=S(!1),ye=S(null),_e=S(""),we=S([]),ee=S(!1),he=S(0),te=S(!1),Ae=S(null),Oe=S(""),$e=S(0),De=S(Bg),Se=Y(()=>[...Bg,...gj(r.skills??[])]),Te=S(!1),xe=S(!1);let Ee=!1;const Je=S(0);let Xe=0,nt=null,de="",D=!1,ne=0,se=0;const Le=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let We="";const P=Y(()=>{const I=new Set((r.collaborationModes??[]).map($=>$.value));return[{value:"default",labelKey:"Default",subLabel:"",disabled:!1},{value:"plan",labelKey:"Plan mode",subLabel:a("Agent proposes a plan before acting"),disabled:!1},{value:"execplans",labelKey:"Execution plans",subLabel:"",disabled:!I.has("execplans")}]}),j=[{value:"on-request",label:"When Codex requests it"},{value:"untrusted",label:"Unless trusted"},{value:"never",label:"Never"}],W=Y(()=>{const I=P.value.find($=>$.value===r.selectedCollaborationMode);return a(I?I.labelKey:"Plan mode")}),ue=Y(()=>{const I=j.find($=>$.value===r.approvalPolicy);return a(I?I.label:"Approval policy")}),ae=Y(()=>r.selectedCollaborationMode==="plan"&&r.selectedModel.trim().length===0),ie=Y(()=>r.disabled||r.isUpdatingSpeedMode||!r.activeThreadId||ae.value||f.value>0?!1:s.value.trim().length>0||i.value.length>0||u.value.length>0),Pe=Y(()=>s.value.trim().length>0||i.value.length>0||l.value.length>0||u.value.length>0||d.value.length>0),je=Y(()=>{const I=new Set;for(const $ of d.value)for(const Q of $.filePaths)I.add(Q);return u.value.filter($=>!I.has($.fsPath))}),Ie=Y(()=>r.disabled||!r.activeThreadId||r.externalSessionActive===!0),ge=Y(()=>r.disabled||!r.activeThreadId),Ke=Y(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),Ne=S(Ke.value),qe=Y(()=>k.value==="recording"),Ge=Y(()=>r.activeThreadId?ae.value?a("Loading models for plan mode..."):a("Ask Codex anything, @ to add files, / for commands"):a("Select a thread to send a message")),dt=Y(()=>s.value.trim().length>0||i.value.length>0||u.value.length>0),St=Y(()=>s.value.split(`
59
+ `).length),st=Y(()=>Te.value||St.value>=6||xe.value),ut=Y(()=>Uo(r.threadTokenUsage??null)),X=Y(()=>{var I;return((I=ut.value)==null?void 0:I.summaryText)??""}),pe=Y(()=>{var I;return((I=ut.value)==null?void 0:I.tooltipText)??""}),Ce=Y(()=>{var I;return((I=ut.value)==null?void 0:I.tone)??"healthy"});function Be(){Ce.value!=="healthy"&&o("compact-context")}function yt(I){if(!Number.isFinite(I))return"0";const $=Math.abs(I);return $>=1e6?`${($>=1e7?(I/1e6).toFixed(0):(I/1e6).toFixed(1)).replace(/\.0$/,"")}M`:$>=1e3?`${($>=1e5?(I/1e3).toFixed(0):(I/1e3).toFixed(1)).replace(/\.0$/,"")}k`:String(Math.round(I))}function wt(I){const $=Math.max(0,I.inputTokens-I.cachedInputTokens),Q=[`${yt(I.totalTokens)} ${a("total")}`,`${yt($)} ${a("input")}`];return I.cachedInputTokens>0&&Q.push(`${yt(I.cachedInputTokens)} ${a("cached")}`),I.outputTokens>0&&Q.push(`${yt(I.outputTokens)} ${a("output")}`),I.reasoningOutputTokens>0&&Q.push(`${yt(I.reasoningOutputTokens)} ${a("reasoning")}`),Q.join(" · ")}function Dt(I,$){if(!Number.isFinite(I)||!Number.isFinite($)||$<=0)return 0;if($<=af){const jt=Math.max(0,$-Math.max(0,I));return Math.max(0,Math.min(100,Math.round(jt/$*100)))}const Q=$-af,ke=Math.max(0,I-af),ze=Math.max(0,Q-ke);return Math.max(0,Math.min(100,Math.round(ze/Q*100)))}function Uo(I){if(!I)return null;const $=I.modelContextWindow??null;if(typeof $!="number"||!Number.isFinite($)||$<=0)return null;const Q=Math.max(0,I.last.totalTokens),ke=Dt(Q,$),ze=Math.max(0,Math.min(100,100-ke)),jt=ke<=15?"danger":ke<=35?"warning":"healthy";return{summaryText:`${ke}% · ${yt(Q)} / ${yt($)}`,tooltipText:[`${a("Context window")}: ${ke}% ${a("left")} (${ze}% ${a("used")})`,`${a("In context")}: ${Q.toLocaleString()} / ${$.toLocaleString()} tokens`,`${a("Last turn")}: ${wt(I.last)}`,`${a("Session total")}: ${wt(I.total)}`].join(`
60
+ `),percentRemaining:ke,tone:jt}}function Jt(I="steer"){var Q;const $=s.value.trim();if(ie.value){if(o("submit",{text:$,imageUrls:i.value.map(ke=>ke.url),fileAttachments:[...u.value],skills:l.value.map(ke=>({name:ke.name,path:ke.path})),mode:I}),is(r.activeThreadId),Sa(),Te.value=!1,d.value=[],ce.value=!1,mn(),Le||U.value){(Q=K.value)==null||Q.blur();return}Et(()=>{var ke;return(ke=K.value)==null?void 0:ke.focus()})}}function so(I){Ne.value=I}function tr(I){Je.value+=1,s.value=I.text,i.value=I.imageUrls.map(($,Q)=>({id:`queued-${Date.now()}-${Q}-${Math.random().toString(36).slice(2,8)}`,name:`${a("Image")} ${Q+1}`,url:$})),l.value=I.skills.map($=>(r.skills??[]).find(Q=>Q.path===$.path)??{name:$.name,displayName:void 0,description:"",path:$.path}),u.value=I.fileAttachments.map($=>({...$})),d.value=[],m.value="",v.value=null,f.value=0,ce.value=!1,mn(),_r(),se+=1}function Sa(){tr({text:"",imageUrls:[],fileAttachments:[],skills:[]}),Te.value=!1}function io(I){return`${iN}${I}`}function Ys(I){if(typeof window>"u")return null;const $=I.trim();if(!$)return null;try{const Q=window.localStorage.getItem(io($));if(!Q)return null;const ke=JSON.parse(Q);return typeof ke=="string"?{text:ke,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof ke.text=="string"?ke.text:"",imageUrls:Array.isArray(ke.imageUrls)?ke.imageUrls.filter(ze=>typeof ze=="string"):[],fileAttachments:Array.isArray(ke.fileAttachments)?ke.fileAttachments.filter(ze=>!!ze&&typeof ze.label=="string"&&typeof ze.path=="string"&&typeof ze.fsPath=="string"):[],skills:Array.isArray(ke.skills)?ke.skills.filter(ze=>!!ze&&typeof ze.name=="string"&&typeof ze.path=="string"):[]}}catch{return null}}function ka(I,$){if(typeof window>"u")return;const Q=I.trim();if(Q)try{if($.text.trim().length>0||$.imageUrls.length>0||$.fileAttachments.length>0||$.skills.length>0){window.localStorage.setItem(io(Q),JSON.stringify($));return}window.localStorage.removeItem(io(Q))}catch{}}function is(I){ka(I,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Or(){return{text:s.value,imageUrls:i.value.map(I=>I.url),fileAttachments:u.value.map(I=>({...I})),skills:l.value.map(I=>({name:I.name,path:I.path}))}}function ls(){o("interrupt")}function Dr(){const I=K.value;if(!I){xe.value=!1;return}xe.value=I.scrollHeight>I.clientHeight+2}function zo(){Ee||(Ee=!0,Et(()=>{Ee=!1,Dr()}))}function Ho(){Ie.value||(Te.value=!Te.value,zo(),Et(()=>{var I;return(I=K.value)==null?void 0:I.focus()}))}function Js(I){o("update:selected-model",I)}function Wo(I){if(I===r.selectedCollaborationMode){G.value=!1;return}o("update:selected-collaboration-mode",I),G.value=!1}function Fr(I){if(I===r.selectedCollaborationMode){ce.value=!1;return}o("update:selected-collaboration-mode",I),ce.value=!1}function us(I){o("update:selected-reasoning-effort",I)}function Ca(I){r.approvalPolicy===I||r.isApprovalPolicySaving===!0||(o("update:approval-policy",I),o("save-approval-policy"))}function qo(){r.dictationClickToToggle}function lo(){Ie.value||(ce.value=!ce.value,G.value=!1,le.value=!1)}function uo(){ge.value||(G.value=!G.value,ce.value=!1,le.value=!1)}function xr(){ge.value||(le.value=!le.value,ce.value=!1,G.value=!1)}function cs(){var I;(I=E.value)==null||I.click()}function xa(){var I;(I=N.value)==null||I.click()}function vt(){var I;(I=q.value)==null||I.click()}function kt(I){const $=i.value.find(Q=>Q.id===I);if($&&pn($.url)){const Q=nr($.url);Q&&tn(Q)}i.value=i.value.filter(Q=>Q.id!==I)}function It(I){l.value=l.value.filter($=>$.path!==I)}function tn(I){u.value=u.value.filter($=>$.fsPath!==I)}function $n(I){const $=d.value.find(ke=>ke.id===I);if(!$)return;const Q=new Set($.filePaths);u.value=u.value.filter(ke=>!Q.has(ke.fsPath)),d.value=d.value.filter(ke=>ke.id!==I)}function hn(I,$){const Q=I.replace(/\\/g,"/");if(u.value.some(jt=>jt.fsPath===Q))return;const ke=Q.split("/").filter(Boolean),ze=($==null?void 0:$.trim())||ke[ke.length-1]||Q;u.value=[...u.value,{label:ze,path:Q,fsPath:Q}]}function Ir(I){return I.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(I.name)}const pr=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function Go(I){return I.type.startsWith("video/")?!0:pr.test(I.name)}function pn(I){const $=I.trim();if(!$)return!1;if($.startsWith("data:video/"))return!0;try{const Q=new URL($,window.location.href);return pr.test(Q.pathname)?!0:Q.pathname==="/codex-local-image"?pr.test(Q.searchParams.get("path")??""):!1}catch{return pr.test($)}}function nr(I){try{const $=new URL(I,window.location.href);return $.pathname!=="/codex-local-image"?"":decodeURIComponent($.searchParams.get("path")??"").replace(/\\/g,"/")}catch{return""}}function Ar(I){return I?Array.from(I):[]}function Mt(I){return I!==se?!1:(f.value+=1,!0)}function co(I){I===se&&(f.value=Math.max(0,f.value-1))}function rr(I){if(I<=0)return;const $=v.value,Q=$?$.succeeded+$.failed:0;if(!$||Q>=$.total){v.value={total:I,succeeded:0,failed:0};return}v.value={...$,total:$.total+I}}function wn(I){const $=v.value;$&&(v.value={...$,succeeded:$.succeeded+(I==="success"?1:0),failed:$.failed+(I==="failure"?1:0)})}function Br(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function On(I){const $=new Date,Q=[$.getFullYear(),String($.getMonth()+1).padStart(2,"0"),String($.getDate()).padStart(2,"0"),String($.getHours()).padStart(2,"0"),String($.getMinutes()).padStart(2,"0"),String($.getSeconds()).padStart(2,"0")].join("-"),ke=I.type.startsWith("image/")&&I.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${Q}.${ke}`}function An(){const I=new Date;return`pasted-text-${[I.getFullYear(),String(I.getMonth()+1).padStart(2,"0"),String(I.getDate()).padStart(2,"0"),String(I.getHours()).padStart(2,"0"),String(I.getMinutes()).padStart(2,"0"),String(I.getSeconds()).padStart(2,"0")].join("-")}.txt`}function bn(I){return I.name.trim()?I:new File([I],On(I),{type:I.type||"image/png",lastModified:Date.now()})}async function Ia(I,$){if(Mt($))try{const Q=bn(I),ke=await Hu(Q);if($!==se)return;if(!ke){wn("failure");return}i.value=[...i.value,{id:Br(),name:Q.name,url:`/codex-local-image?path=${encodeURIComponent(ke)}`}],wn("success")}catch{$===se&&wn("failure")}finally{co($)}}async function mr(I,$){if(Mt($))try{const Q=await Hu(I);if($!==se)return;if(!Q){wn("failure");return}hn(Q),wn("success")}catch{$===se&&wn("failure")}finally{co($)}}async function Ur(I,$){if(Mt($))try{const Q=bn(I),ke=await Hu(Q);if($!==se)return;if(!ke){wn("failure");return}const ze=ke.replace(/\\/g,"/");i.value=[...i.value,{id:Br(),name:Q.name,url:`/codex-local-image?path=${encodeURIComponent(ze)}`}],hn(ze),wn("success")}catch{$===se&&wn("failure")}finally{co($)}}function Bt(I){const $=Ar(I);if($.length===0)return;rr($.length),ce.value=!1,mn();const Q=se;for(const ke of $)Ir(ke)?Ia(ke,Q):Go(ke)?Ur(ke,Q):mr(ke,Q)}function fo(){ne=0,T.value=!1}function Vo(I){return I?Array.from(I.types??[]).includes("Files"):!1}async function Ko(I){if(!I||I.length===0)return;const $=Je.value,Q=Array.from(I),ze=(Q[0].webkitRelativePath||Q[0].name).split("/").filter(Boolean)[0]||"Folder",jt=`${Date.now()}-${Math.random().toString(36).slice(2)}`;d.value=[...d.value,{id:jt,name:ze,total:Q.length,processed:0,filePaths:[],isUploading:!0}];const At=rn=>{$===Je.value&&(d.value=d.value.map(Qt=>Qt.id===jt?rn(Qt):Qt))};for(const rn of Q)try{const Qt=await Hu(rn);if($!==Je.value)return;if(Qt){const Mr=rn.webkitRelativePath||rn.name;hn(Qt,Mr),At(_a=>({..._a,processed:_a.processed+1,filePaths:[..._a.filePaths,Qt]}));continue}At(Mr=>({...Mr,processed:Mr.processed+1}))}catch{At(Qt=>({...Qt,processed:Qt.processed+1}))}At(rn=>({...rn,isUploading:!1}))}function Tn(I){I&&(I.value="")}function Zt(I){const $=I.target;Bt(($==null?void 0:$.files)??null),Tn($),ce.value=!1}function gr(I){const $=I.target;Bt(($==null?void 0:$.files)??null),Tn($),ce.value=!1}function un(I){const $=I.target;Ko(($==null?void 0:$.files)??null),Tn($),ce.value=!1}function Yo(I){Ie.value||!Vo(I.dataTransfer)||(I.preventDefault(),ne+=1,T.value=!0)}function nn(I){Ie.value||!Vo(I.dataTransfer)||(I.preventDefault(),I.dataTransfer&&(I.dataTransfer.dropEffect="copy"),T.value=!0)}function zr(I){T.value&&(I.preventDefault(),ne=Math.max(0,ne-1),ne===0&&fo())}function Jo(I){var $;Ie.value||!Vo(I.dataTransfer)||(I.preventDefault(),fo(),Bt((($=I.dataTransfer)==null?void 0:$.files)??null))}function Ut(){!T.value&&ne===0||fo()}function Qo(I){var jt,At;if(Ie.value)return;const $=((jt=I.clipboardData)==null?void 0:jt.getData("text/plain"))??"";if($.length>=sN){I.preventDefault();const rn=new File([$],An(),{type:"text/plain",lastModified:Date.now()});Bt([rn]);return}const Q=Array.from(((At=I.clipboardData)==null?void 0:At.items)??[]);if(Q.length===0)return;const ke=$.length>0,ze=Q.filter(rn=>rn.kind==="file"&&rn.type.startsWith("image/")).map(rn=>rn.getAsFile()).filter(rn=>rn instanceof File);ze.length!==0&&(ke||I.preventDefault(),Bt(ze))}function Xo(){m.value&&(m.value=""),zo(),ho(),Pr()}function _t(I){if(I.isComposing||I.keyCode===229)return;if(ee.value){if(I.key==="Escape"){I.preventDefault(),mn();return}if(I.key==="ArrowDown"){I.preventDefault(),we.value.length>0&&(he.value=(he.value+1)%we.value.length);return}if(I.key==="ArrowUp"){if(I.preventDefault(),we.value.length>0){const Q=we.value.length;he.value=(he.value+Q-1)%Q}return}if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();const Q=we.value[he.value];Q?ea(Q):mn();return}}if(te.value){if(I.key==="Escape"){I.preventDefault(),_r();return}if(I.key==="ArrowDown"){I.preventDefault(),De.value.length>0&&($e.value=($e.value+1)%De.value.length);return}if(I.key==="ArrowUp"){if(I.preventDefault(),De.value.length>0){const Q=De.value.length;$e.value=($e.value+Q-1)%Q}return}if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();const Q=De.value[$e.value];Q?Zo(Q):_r();return}}if(r.sendWithEnter!==!1?I.key==="Enter"&&!I.shiftKey:I.key==="Enter"&&(I.metaKey||I.ctrlKey)){I.preventDefault(),Jt(r.isTurnInProgress?Ne.value:"steer");return}}function mn(){if(ee.value=!1,ye.value=null,_e.value="",we.value=[],he.value=0,D=!1,de){const I=de;de="",gI(I)}}function ho(){const I=K.value;if(!I){mn();return}const $=I.selectionStart??s.value.length,ke=s.value.slice(0,$).match(/(^|\s)(@[^\s@]*)$/);if(!ke){mn();return}const ze=ke[2]??"",jt=ze.length,At=$-jt;te.value&&_r(),ye.value=At,_e.value=ze.slice(1),ee.value=!0,Hr()}function _r(){te.value=!1,Ae.value=null,Oe.value="",$e.value=0,De.value=Se.value}function Pr(){const I=K.value;if(!I){_r();return}const $=I.selectionStart??s.value.length,Q=s.value.slice(0,$),ke=vj(Q);if(!ke){_r();return}ee.value&&mn(),Ae.value=ke.startIndex,Oe.value=ke.query,De.value=yj(Se.value,ke.query),$e.value=0,te.value=!0}function Zo(I){const $=K.value,Q=Ae.value;if(Q!==null&&$){const ke=$.selectionStart??s.value.length;s.value=`${s.value.slice(0,Q)}${s.value.slice(ke)}`}if(_r(),I.kind==="skill"){const ke=(r.skills??[]).find(jt=>jt.path===I.skillPath||jt.name===I.id);ke&&!l.value.some(jt=>jt.path===ke.path)&&(l.value=[...l.value,{...ke}]);const ze=s.value.trim();s.value=ze.length>0?`${ze} (Use the ${I.id} skill.)`:`Use the ${I.id} skill.`,Et(()=>{$==null||$.focus(),Dr()});return}if(I.kind==="rpc"){o("slash-command",I.id);return}I.kind==="text"&&I.insertText&&(s.value=s.value.trimEnd(),s.value=s.value.length>0?`${s.value} ${I.insertText}`:I.insertText),I.kind==="local"&&I.id==="clear"&&(s.value=""),Et(()=>{$==null||$.focus(),Dr()})}async function Hr(){if(!ee.value)return;const I=(r.cwd??"").trim();if(!I){we.value=[],D=!0;return}D=!1,nt&&clearTimeout(nt);const $=++Xe;nt=setTimeout(async()=>{const Q=`composer-${$}`,ke=_e.value;try{if(de||(await pI([I],Q),de=Q,o("register-fuzzy-session",Q)),await mI(de,ke),!ee.value||$!==Xe)return;if(we.value=(r.fuzzyFileSearchResults??[]).map(ze=>({path:ze.path})),he.value=0,we.value.length===0)try{const ze=await tg(I,ke,20);if(!ee.value||$!==Xe)return;we.value=ze,he.value=0}catch{if(!ee.value||$!==Xe)return;we.value=[]}}catch{if(!ee.value||$!==Xe)return;de="";try{const ze=await tg(I,ke,20);if(!ee.value||$!==Xe)return;we.value=ze,he.value=0}catch{if(!ee.value||$!==Xe)return;we.value=[]}}},120)}function ea(I){const $=K.value,Q=ye.value;if(Q!==null&&$){const ke=$.selectionStart??s.value.length;s.value=`${s.value.slice(0,Q)}${s.value.slice(ke)}`.trimEnd()}hn(I.path),mn(),Et(()=>$==null?void 0:$.focus())}function or(I){R(),tr(I),Et(()=>{var $;($=K.value)==null||$.focus(),Dr()})}function po(I){const $=I.trim();$&&(s.value=s.value.trim()?`${s.value.trim()}
61
+ ${$}`:$,Et(()=>{var Q;(Q=K.value)==null||Q.focus(),Dr()}))}function ta(I){const $=I.lastIndexOf("/");return $<0?I:I.slice($+1)}function Er(I){const $=I.lastIndexOf("/");return $<=0?"":I.slice(0,$)}function gt(I){const $=ta(I),Q=$.lastIndexOf(".");return Q<=0?"":$.slice(Q+1).toLowerCase()}function _n(I){const $=gt(I);return $==="ts"?"TS":$==="tsx"?"TSX":$==="js"?"JS":$==="jsx"?"JSX":$==="json"?"{}":""}function Sn(I){const $=gt(I);return $.startsWith("ts")?"ts":$.startsWith("js")?"js":$==="json"?"json":"default"}function Aa(I){const $=gt(I);return $==="md"||$==="mdx"}function Vn(I){if(!ce.value&&!G.value&&!le.value)return;const $=I.target;$&&(typeof $.closest=="function"&&$.closest(".composer-popover-anchor")||(ce.value=!1,G.value=!1,le.value=!1))}return ss(()=>{document.addEventListener("click",Vn),window.addEventListener("drop",Ut),window.addEventListener("dragend",Ut),window.addEventListener("blur",Ut),zo()}),t({hydrateDraft:or,appendTextToDraft:po,hasUnsavedDraft:()=>Pe.value}),Ks(()=>{document.removeEventListener("click",Vn),window.removeEventListener("drop",Ut),window.removeEventListener("dragend",Ut),window.removeEventListener("blur",Ut),window.removeEventListener("pointerup",qo),window.removeEventListener("pointercancel",qo),window.removeEventListener("blur",qo),nt&&clearTimeout(nt)}),ot(()=>r.activeThreadId,I=>{R(),We&&ka(We,Or()),Sa();const $=Ys(I);$&&(tr($),Xo()),We=I.trim()},{immediate:!0}),ot([s,i,u,l],()=>{We&&ka(We,Or())},{deep:!0}),ot(s,()=>{zo()}),ot(()=>r.cwd,()=>{ee.value&&Hr()}),ot(()=>r.fuzzyFileSearchResults,I=>{!ee.value||!de||(we.value=(I??[]).map($=>({path:$.path})),he.value=0)}),ot(Ke,I=>{Ne.value=I}),(I,$)=>(_(),B("form",{class:"thread-composer",onSubmit:$[6]||($[6]=mt(Q=>Jt(e.isTurnInProgress?Ne.value:"steer"),["prevent"]))},[w("div",{class:ct(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":T.value}])},[e.planPanel?(_(),Ze(PL,{key:0,"plan-panel":e.planPanel,onImplementPlan:$[0]||($[0]=Q=>I.$emit("implement-plan"))},null,8,["plan-panel"])):ve("",!0),Fe(qL,{"selected-images":i.value,"folder-upload-groups":d.value,"standalone-file-attachments":je.value,"selected-skills":l.value,"is-interaction-disabled":Ie.value,onRemoveImage:kt,onRemoveFolder:$n,onRemoveFile:tn,onRemoveSkill:It},null,8,["selected-images","folder-upload-groups","standalone-file-attachments","selected-skills","is-interaction-disabled"]),w("div",wj,[w("div",bj,[w("div",{class:ct(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":T.value,"thread-composer-input-wrap--expanded":Te.value}]),onDragenter:Yo,onDragover:nn,onDragleave:zr,onDrop:Jo},[T.value?(_(),B("div",Tj,[w("span",Sj,O(g(a)("Drop images or files")),1)])):ve("",!0),ee.value?(_(),B("div",kj,[we.value.length>0?(_(!0),B(at,{key:0},Ht(we.value,(Q,ke)=>(_(),B("button",{key:Q.path,class:ct(["thread-composer-file-mention-row",{"is-active":ke===he.value}]),type:"button",onMousedown:mt(ze=>ea(Q),["prevent"])},[_n(Q.path)?(_(),B("span",{key:0,class:ct(["thread-composer-file-mention-icon-badge",`is-${Sn(Q.path)}`])},O(_n(Q.path)),3)):Aa(Q.path)?(_(),B("span",xj,"↓")):(_(),Ze(Cl,{key:2,class:"thread-composer-file-mention-icon-file"})),w("span",Ij,[w("span",Aj,O(ta(Q.path)),1),Er(Q.path)?(_(),B("span",_j,O(Er(Q.path)),1)):ve("",!0)])],42,Cj))),128)):g(D)?(_(),B("div",Pj,O(g(a)("No searchable directory for this thread")),1)):(_(),B("div",Ej,O(g(a)("No matching files")),1))])):ve("",!0),te.value?(_(),Ze(rL,{key:2,commands:De.value,"highlighted-index":$e.value,onSelect:Zo},null,8,["commands","highlighted-index"])):ve("",!0),In(w("textarea",{ref_key:"inputRef",ref:K,"onUpdate:modelValue":$[1]||($[1]=Q=>s.value=Q),class:"thread-composer-input",placeholder:Ge.value,disabled:Ie.value,onInput:Xo,onKeydown:_t,onPaste:Qo},null,40,Mj),[[jn,s.value]]),st.value?(_(),B("button",{key:3,class:"thread-composer-expand",type:"button","aria-label":Te.value?g(a)("Exit full screen composer"):g(a)("Expand composer"),title:Te.value?g(a)("Exit full screen composer"):g(a)("Expand composer"),disabled:Ie.value,onClick:Ho},[Te.value?(_(),Ze(NR,{key:0,class:"thread-composer-expand-icon"})):(_(),Ze(MR,{key:1,class:"thread-composer-expand-icon"}))],8,Rj)):ve("",!0)],34),w("div",Lj,[e.isTurnInProgress&&!dt.value?(_(),B("button",{key:0,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?g(a)("Saving thread before stop is available"):g(a)("Stop"),title:e.isStopPending?g(a)("Saving thread before stop is available"):g(a)("Stop"),disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending||e.externalSessionActive===!0,onClick:ls},[e.isStopPending?(_(),B("span",Nj)):(_(),Ze(FR,{key:1,class:"thread-composer-stop-icon"}))],8,jj)):(_(),B("button",{key:1,class:ct(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&Ne.value==="queue"}]),type:"button","aria-label":e.isCompacting?g(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress&&Ne.value==="queue"?g(a)("Queue message"):g(a)("Send message"),title:e.isCompacting?g(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress?`${g(a)("Send")} ${Ne.value==="queue"?g(a)("Queue"):g(a)("Steer")}`:g(a)("Send"),disabled:!ie.value,onClick:$[2]||($[2]=Q=>Jt(e.isTurnInProgress?Ne.value:"steer"))},[Fe(AR,{class:"thread-composer-submit-icon"})],10,$j))])]),w("div",{class:ct(["thread-composer-controls",{"thread-composer-controls--recording":qe.value}])},[Fe(pj,{open:ce.value,"is-mobile":g(U),"is-interaction-disabled":Ie.value,"is-composer-config-disabled":ge.value,"is-approval-policy-saving":e.isApprovalPolicySaving,"approval-policy":e.approvalPolicy,"approval-policy-error":e.approvalPolicyError,"approval-policy-notice":e.approvalPolicyNotice,"selected-collaboration-mode":e.selectedCollaborationMode,"collaboration-mode-choices":P.value,"approval-policy-choices":j,"active-in-progress-mode":Ne.value,"onUpdate:open":$[3]||($[3]=Q=>ce.value=Q),onToggle:lo,onSetActiveMode:so,onSelectPhoto:cs,onSelectFolder:vt,onCaptureCamera:xa,onSelectCollaborationMode:Fr,onSelectApprovalPolicy:Ca},null,8,["open","is-mobile","is-interaction-disabled","is-composer-config-disabled","is-approval-policy-saving","approval-policy","approval-policy-error","approval-policy-notice","selected-collaboration-mode","collaboration-mode-choices","active-in-progress-mode"]),Fe(VL,{models:e.models,"selected-model":e.selectedModel,"model-reasoning-efforts":e.modelReasoningEfforts,"selected-reasoning-effort":e.selectedReasoningEffort,"selected-speed-mode":e.selectedSpeedMode,disabled:e.disabled,"active-thread-id":e.activeThreadId,"onUpdate:selectedModel":Js,"onUpdate:selectedReasoningEffort":us},null,8,["models","selected-model","model-reasoning-efforts","selected-reasoning-effort","selected-speed-mode","disabled","active-thread-id"]),g(U)?ve("",!0):(_(),B("div",Oj,[Fe(xc,{open:G.value,align:"start",width:"md","aria-label":g(a)("Plan mode"),"onUpdate:open":$[4]||($[4]=Q=>G.value=Q)},{trigger:ht(()=>[w("button",{class:ct(["thread-composer-plan-trigger",{"is-active":G.value}]),type:"button","aria-label":g(a)("Plan mode"),disabled:ge.value,onClick:uo},[w("span",Fj,O(W.value),1),Fe(zs,{class:"thread-composer-plan-trigger-chevron"})],10,Dj)]),default:ht(()=>[(_(!0),B(at,null,Ht(P.value,Q=>(_(),B("button",{key:Q.value,class:ct(["thread-composer-menu-item",{"is-active":e.selectedCollaborationMode===Q.value}]),type:"button",role:"menuitemradio","aria-checked":e.selectedCollaborationMode===Q.value,disabled:Q.disabled||ge.value,onClick:ke=>Wo(Q.value)},[w("span",Uj,[w("span",zj,O(g(a)(Q.labelKey)),1),Q.subLabel?(_(),B("span",Hj,O(Q.subLabel),1)):ve("",!0),Q.disabled?(_(),B("span",Wj,O(g(a)("Not supported by this Codex version")),1)):ve("",!0)]),e.selectedCollaborationMode===Q.value?(_(),B("span",qj,"✓")):ve("",!0)],10,Bj))),128))]),_:1},8,["open","aria-label"]),Fe(xc,{open:le.value,align:"center",width:"md","aria-label":g(a)("Approval policy"),"onUpdate:open":$[5]||($[5]=Q=>le.value=Q)},{trigger:ht(()=>[w("button",{class:ct(["thread-composer-approval-trigger",{"is-active":le.value}]),type:"button","aria-label":g(a)("Approval policy"),disabled:ge.value,onClick:xr},[w("span",Vj,O(ue.value),1),Fe(zs,{class:"thread-composer-approval-trigger-chevron"})],10,Gj)]),default:ht(()=>[(_(),B(at,null,Ht(j,Q=>w("button",{key:Q.value,class:ct(["thread-composer-menu-item",{"is-active":e.approvalPolicy===Q.value}]),type:"button",role:"menuitemradio","aria-checked":e.approvalPolicy===Q.value,disabled:e.isApprovalPolicySaving,onClick:ke=>Ca(Q.value)},[w("span",Yj,[w("span",Jj,O(g(a)(Q.label)),1)]),e.approvalPolicy===Q.value?(_(),B("span",Qj,"✓")):ve("",!0)],10,Kj)),64)),e.approvalPolicyError?(_(),B("p",Xj,O(e.approvalPolicyError),1)):ve("",!0),Fe(bu,{name:"approval-tip"},{default:ht(()=>[e.approvalPolicyNotice?(_(),B("span",Zj,O(e.approvalPolicyNotice),1)):ve("",!0)]),_:1})]),_:1},8,["open","aria-label"])])),ut.value?(_(),B("button",{key:1,type:"button",class:ct(["thread-composer-context-usage-inline",{"is-warning":Ce.value==="warning","is-danger":Ce.value==="danger"}]),title:pe.value,"aria-label":g(a)("Context"),onClick:Be},[w("span",tN,O(X.value),1),Ce.value!=="healthy"?(_(),B("span",nN,O(g(a)("Compact")),1)):ve("",!0)],10,eN)):ve("",!0)],2)])],2),w("input",{ref_key:"photoLibraryInputRef",ref:E,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:Ie.value,onChange:Zt},null,40,rN),w("input",{ref_key:"cameraCaptureInputRef",ref:N,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:Ie.value,onChange:gr},null,40,oN),w("input",{ref_key:"folderPickerInputRef",ref:q,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:Ie.value,onChange:un},null,40,aN)],32))}}),Ug=Tt(lN,[["__scopeId","data-v-c87250dc"]]),zg={hooks:{methods:["hooks/list"]},remoteControl:{methods:["remoteControl/status/read","remoteControl/enable","remoteControl/pairing/start","remoteControl/client/list"]},plugins:{methods:["plugin/list","plugin/read","plugin/install","plugin/uninstall"]},apps:{methods:["app/list"]},mcps:{methods:["mcpServerStatus/list"]},mcpReload:{methods:["config/mcpServer/reload"]},mcpLogin:{methods:["mcpServer/oauth/login"]},marketplace:{methods:["marketplace/add","marketplace/remove","marketplace/upgrade"]},pluginShare:{methods:["plugin/share/save","plugin/share/list","plugin/share/delete"]}};function Hg(e,t){return t.methods.every(n=>e.has(n))}const uN=["aria-label"],cN=["aria-checked","onClick"],dN={class:"runtime-toggle-option-label"},fN=fn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:r}=ao(),o=[{value:"local",label:r("Local project"),icon:Lh},{value:"worktree",label:r("New worktree"),icon:Cc}];function a(s){n("update:modelValue",s)}return(s,i)=>(_(),B("div",{class:"runtime-toggle",role:"radiogroup","aria-label":g(r)("Continue in")},[(_(),B(at,null,Ht(o,l=>w("button",{key:l.value,class:ct(["runtime-toggle-option",{"is-selected":e.modelValue===l.value}]),type:"button",role:"radio","aria-checked":e.modelValue===l.value,onClick:u=>a(l.value)},[(_(),Ze(mh(l.icon),{class:"runtime-toggle-option-icon"})),w("span",dN,O(l.label),1)],10,cN)),64))],8,uN))}}),hN=Tt(fN,[["__scopeId","data-v-b3c220d3"]]),pN={},mN={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function gN(e,t){return _(),B("svg",mN,[...t[0]||(t[0]=[w("path",{d:"M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12"},null,-1),w("path",{d:"M9 4l0 16"},null,-1)])])}const Mw=Tt(pN,[["render",gN]]),vN={},yN={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function wN(e,t){return _(),B("svg",yN,[...t[0]||(t[0]=[w("path",{d:"M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm12 -16h-8v14h8a1 1 0 0 0 1 -1v-12a1 1 0 0 0 -1 -1"},null,-1)])])}const bN=Tt(vN,[["render",wN]]),TN={class:"sidebar-thread-controls"},SN=["aria-label","title"],kN=["aria-label","title"],CN=fn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=ao();return(n,r)=>(_(),B("div",TN,[w("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?g(t)("Expand sidebar"):g(t)("Collapse sidebar"),title:e.isSidebarCollapsed?g(t)("Expand sidebar"):g(t)("Collapse sidebar"),onClick:r[0]||(r[0]=o=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(_(),Ze(bN,{key:0,class:"sidebar-thread-controls-icon"})):(_(),Ze(Mw,{key:1,class:"sidebar-thread-controls-icon"}))],8,SN),Cr(n.$slots,"default",{},void 0),e.showNewThreadButton?(_(),B("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":g(t)("Start new thread"),title:g(t)("Start new thread"),onClick:r[1]||(r[1]=o=>n.$emit("start-new-thread"))},[Fe(Cl,{class:"sidebar-thread-controls-icon"})],8,kN)):ve("",!0)]))}}),Wg=Tt(CN,[["__scopeId","data-v-de38b7ee"]]),xN={},IN={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function AN(e,t){return _(),B("svg",IN,[...t[0]||(t[0]=[w("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.9"},null,-1),w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.9",d:"M12 8v4l3 2"},null,-1)])])}const qg=Tt(xN,[["render",AN]]),_N={},PN={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function EN(e,t){return _(),B("svg",PN,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.9",d:"M4 7h16M4 12h16M4 17h10"},null,-1)])])}const Gg=Tt(_N,[["render",EN]]),MN={},RN={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function LN(e,t){return _(),B("svg",RN,[...t[0]||(t[0]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065"}),w("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const jN=Tt(MN,[["render",LN]]),NN={},$N={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function ON(e,t){return _(),B("svg",$N,[...t[0]||(t[0]=[w("path",{d:"M5 7l5 5-5 5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),w("path",{d:"M12 17h7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])])}const DN=Tt(NN,[["render",ON]]),FN={},BN={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function UN(e,t){return _(),B("svg",BN,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 7a2 2 0 0 1 2-2h2.586A2 2 0 0 1 14 5.586L15.414 7H18a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2zm-4 4V5a2 2 0 0 1 2-2h2"},null,-1)])])}const Vg=Tt(FN,[["render",UN]]);function Rw(e){var o;const t=e.replace(/\r\n/g,`
62
+ `).trim();if(!t)return null;const n=[],r=[];for(const a of t.split(`
63
+ `)){const s=a.trim();if(!s){n.length===0&&r.push("");continue}const i=s.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(i){const l=(i[1]??" ").toLowerCase();let u="pending";l==="x"&&(u="completed"),(l==="~"||l===">"||l==="-")&&(u="inProgress"),n.push({step:((o=i[2])==null?void 0:o.trim())??"",status:u});continue}r.push(s)}if(n.length===0){const a=zN(t);return a||null}return{explanation:r.join(`
64
+ `).trim(),steps:n.filter(a=>a.step.length>0)}}function zN(e){var a,s;const t=[],n=[],r=[];for(const i of e.split(`
65
+ `)){const l=i.trim();if(!l){t.length===0&&n.length===0&&r.push("");continue}const u=l.match(/^\d+[.)]\s+(.+)$/);if(u){t.push({step:((a=u[1])==null?void 0:a.trim())??"",status:"pending"});continue}const d=l.match(/^[-*]\s+(.+)$/);if(d){n.push({step:((s=d[1])==null?void 0:s.trim())??"",status:"pending"});continue}r.push(l)}const o=t.length>0?t:n;return o.length===0?null:{explanation:HN(r.join(`
66
+ `)),steps:o.filter(i=>i.step.length>0)}}function HN(e){return e.split(`
67
+ `).map(t=>t.replace(/^\s*#{1,6}\s*/,"")).join(`
68
+ `).trim()}function Kg(e){var t;return e.plan&&e.plan.steps.length>0?{explanation:((t=e.plan.explanation)==null?void 0:t.trim())??"",steps:e.plan.steps}:Rw(e.text)}function WN(e,t){var r;const n=e.find(o=>{var a;return typeof o.turnIndex=="number"&&o.turnIndex>t&&!!((a=o.turnId)!=null&&a.trim())});return((r=n==null?void 0:n.turnId)==null?void 0:r.trim())??""}function qN(e,t,n){return t?!e.some(r=>{var o;return((o=r.turnId)==null?void 0:o.trim())===t||typeof r.turnIndex=="number"&&r.turnIndex>n}):!0}const Lw="modelSwitch",jw=20;function GN(e){return e.messageType===Lw}function Gs(e){return e.role==="user"&&e.isAgentNote!==!0}function VN(e){return e.isAgentNote===!0?"agent-note":e.role==="user"?"user":e.messageType==="reasoning"?"reasoning":e.messageType==="plan"||e.messageType==="plan.live"?"plan":e.messageType==="fileChange"?"file-change":e.messageType==="commandExecution"||e.messageType==="toolCall"||e.messageType==="worked"?"process":"assistant"}function KN(e,t=!1){var n;return e.role==="assistant"&&e.messageType!=="reasoning"&&e.messageType!=="commandExecution"&&e.messageType!=="toolCall"&&e.messageType!=="worked"&&e.messageType!=="plan"&&e.messageType!=="plan.live"&&e.messageType!=="fileChange"&&(t||!((n=e.messageType)!=null&&n.endsWith(".live")))&&e.text.trim().length>0}function zU(e,t){var a,s;const n=[];let r=null;for(const i of e)(Gs(i)||!r)&&(r={key:`turn-${i.id}`,items:[]},n.push(r)),r.items.push({message:i,kind:VN(i)});const o=n.length-1;for(let i=0;i<n.length;i+=1){const l=n[i],u=(s=(a=l.items.find(v=>{var T;return(T=v.message.turnId)==null?void 0:T.trim()}))==null?void 0:a.message.turnId)==null?void 0:s.trim(),d=t!==void 0&&"liveTurnId"in t;if((t==null?void 0:t.liveOverlayActive)===!0&&(d?u===(t==null?void 0:t.liveTurnId):i===o))continue;const f=[...l.items].reverse().find(v=>KN(v.message,(t==null?void 0:t.liveOverlayActive)===!1));f&&((t==null?void 0:t.liveOverlayActive)!==!1&&l.items.some(T=>typeof T.message.messageType=="string"&&T.message.messageType.endsWith(".live"))||(f.kind="final-assistant"))}return n}function Nw(e){return e.replace(/\s+/g," ").trim()}function HU(e){const t=Nw(e);return t.length<=80?t:t.slice(0,80)}function YN(e){const t=Nw(e);return t.length<=80?t:t.slice(0,77)+"..."}function JN(e){return{sessionKey:e,expandedWarmTurns:new Set,coldPage:0}}function jh(e,t){return e.sessionKey===t?e:JN(t)}function WU(e,t){const n=jh(e,t);return{...n,coldPage:n.coldPage+1}}function qU(e,t,n){const r=jh(e,t),o=Math.max(0,Math.floor(n));return r.coldPage>=o?r:{...r,coldPage:o}}function GU(e,t,n,r){const o=jh(e,t),a=new Set(o.expandedWarmTurns);return r?a.add(n):a.delete(n),{...o,expandedWarmTurns:a}}function QN(e){return Gs(e)}function XN(e){var t;return((t=e.messageType)==null?void 0:t.endsWith(".live"))===!0}function VU(e){var a;const t=[];let n=-1,r=0;const o=(s,i)=>{t.push({userItem:s,assistantPreview:"",toolCount:0,startIdx:i,endIdx:e.length})};for(let s=0;s<e.length;s+=1){const i=e[s];if(QN(i)){if(n>=0)t[t.length-1].endIdx=s;else{t.push({userItem:i,assistantPreview:"",toolCount:0,startIdx:r,endIdx:e.length}),n=s,r=s;continue}n=s,o(i,s)}else if(n>=0&&t.length>0){const l=t[t.length-1],u=((a=i.text)==null?void 0:a.trim())||"";i.role==="assistant"&&!XN(i)&&u&&(l.assistantPreview=YN(u)),i.messageType==="toolCall"&&(l.toolCount+=1)}}return t}function KU({turnCount:e,hotTurns:t,pageSize:n,coldPage:r}){const o=Math.max(0,e),a=Math.max(0,t),s=Math.max(0,o-Math.min(o,a));if(s===0)return{warmStartTurn:0,warmEndTurn:0,coldTurnCount:0};const i=Math.max(0,n),l=Math.max(0,Math.floor(r)),u=Math.min(s,i*(l+1));return{warmStartTurn:s-u,warmEndTurn:s,coldTurnCount:s-u}}function YU({turn:e,turnCount:t,hotTurns:n,pageSize:r}){const o=Math.max(0,t),a=Math.max(0,n),s=Math.max(0,o-Math.min(o,a));if(s===0||e>=s)return 0;const i=Math.max(1,r),l=Math.max(0,Math.floor(e)),u=s-l;return Math.max(0,Math.ceil(u/i)-1)}function JU(e,t,n){if(t.length===0)return e.slice(0);if(n>=t.length)return[];const r=t[n].startIdx;return e.slice(r)}const ba="__new-thread__",$w="__new-thread-provider__::";function Ow(e){return e==="plan"?"plan":"default"}function xi(e){return typeof e=="string"?e.trim():""}function No(){return Object.create(null)}function ac(e){const t=No();for(const[n,r]of Object.entries(e))t[n]=r;return t}function nu(e,t){if(!(t in e))return e;const n=No();for(const[r,o]of Object.entries(e))r!==t&&(n[r]=o);return n}function Dw(e,t){let n=!1;const r=No();for(const[o,a]of Object.entries(e)){if(o===ba||o.startsWith($w)||t.has(o)){r[o]=a;continue}n=!0}return n?r:e}function Ns(e){const t=e.trim().toLowerCase().replace(/_/g,"-");return!t||t==="openai"?"codex":t}function ZN(e){return e===ba}function Ku(e){const t=Ns(e);return t?`${$w}${t}`:""}function Ja(e){return e.trim()||ba}function sf(e,t){const n=Ja(t),r=xi(e[n]);return r||xi(e[ba])}function lf(e,t){const n=Ja(t);return Ow(e[n])}function Yg(e,t,n){const r=Ja(t);if(ZN(r))return nu(e,r);if(n==="plan"){const o=ac(e);return o[r]="plan",o}return nu(e,r)}function e$(e){return new Promise(t=>{typeof window<"u"?window.setTimeout(t,e):globalThis.setTimeout(t,e)})}function Qn(e){return e.flatMap(t=>t.threads)}function t$(e,t){var r,o;const n=e.findIndex(a=>a.id===t);return n<0?"":((r=e[n+1])==null?void 0:r.id)??((o=e[n-1])==null?void 0:o.id)??""}function Fw(e){return(e instanceof Error?e.message:String(e??"")).includes("Codex CLI is not available")}function n$(e){if(e instanceof $r&&e.status===404)return!0;const t=e instanceof Error?e.message:String(e??"");return/\b404\b|thread.*not found|conversation.*not found|no such thread|no rollout found for thread id/i.test(t)}function r$(e,t){if(!e||!t)return!1;const n=new Date(e).getTime(),r=new Date(t).getTime();return!Number.isFinite(n)||!Number.isFinite(r)?!1:n>r}function o$(e,t,n){return r$(e,t??n)}function Bw(e,t,n){return Math.min(Math.max(e,t),n)}function ol(e){if(typeof e=="number"&&Number.isFinite(e))return Math.max(0,Math.trunc(e));if(typeof e=="string"&&e.trim().length>0){const t=Number(e);if(Number.isFinite(t))return Math.max(0,Math.trunc(t))}return null}function Jg(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:ol(t.totalTokens)??0,inputTokens:ol(t.inputTokens)??0,cachedInputTokens:ol(t.cachedInputTokens)??0,outputTokens:ol(t.outputTokens)??0,reasoningOutputTokens:ol(t.reasoningOutputTokens)??0}}function a$(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=Jg(t.total),r=Jg(t.last);if(!n||!r)return null;const o=ol(t.modelContextWindow),a=r.totalTokens,s=typeof o=="number"?Math.max(o-a,0):null,i=typeof o=="number"&&o>0?Bw(Math.round((s??0)/o*100),0,100):null;return{total:n,last:r,modelContextWindow:o,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function al(e,t){const n=[];for(const r of e)n.includes(r)||n.push(r);for(const r of t)n.includes(r.projectName)||n.push(r.projectName);return Xa(e,n)?e:n}function Ff(e,t){const n=new Map(e.map(o=>[o.projectName,o])),r=t.map(o=>n.get(o)??null).filter(o=>o!==null);for(const o of e)t.includes(o.projectName)||r.push(o);return r}function Xa(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];if(n.length!==r.length)return!1;for(let o=0;o<n.length;o+=1)if(n[o]!==r[o])return!1;return!0}function s$(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const r=[...e],[o]=r.splice(t,1);return r.splice(n,0,o),r}function i$(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function l$(e=[],t=[]){var n,r,o,a;if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1)if(((n=e[s])==null?void 0:n.step)!==((r=t[s])==null?void 0:r.step)||((o=e[s])==null?void 0:o.status)!==((a=t[s])==null?void 0:a.status))return!1;return!0}function u$(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&l$(e.steps,t.steps)}function Yu(e){if(!(e instanceof Error))return!1;const t=e.message.toLowerCase();return t.includes("not supported when using codex with a chatgpt account")||t.includes("model is not supported")||t.includes("requires a newer version of codex")}function Bf(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Xa(e.images,t.images)&&c$(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&i$(e.commandExecution,t.commandExecution)&&u$(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function xl(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Qg(e,t,n={}){var T;const r=new Map(e.map(k=>[k.id,k])),o=new Map(t.map(k=>[k.id,k])),a=t.map(k=>{const R=r.get(k.id);return R&&Bf(R,k)?R:k});if(n.preserveMissing!==!0)return xl(e,a)?e:a;const s=e.map(k=>{const R=o.get(k.id);return!R||Bf(k,R)?k:R}).filter(k=>!ml(k)||!Xg(k,t)),i=new Set(e.map(k=>k.id)),l=a.filter(k=>!i.has(k.id)),u=e.filter(ml);let d=[],m=l;if(u.length>0){const k=a.findIndex(R=>u.some(E=>Xg(E,[R])));if(k>=0){const R=l.findIndex(E=>E.id===a[k].id);R>=0?(d=l.slice(0,R),m=l.slice(R)):(d=[],m=l)}else{const R=new Set(e.map(E=>{var N;return((N=E.turnId)==null?void 0:N.trim())??""}).filter(E=>E!==""));if(R.size>0){const E=[],N=[];for(const q of l){const K=((T=q.turnId)==null?void 0:T.trim())??"";K!==""&&R.has(K)?E.push(q):N.push(q)}d=E,m=N}}}const f=s.findIndex(ml),v=f>=0?[...s.slice(0,f),...d,...s.slice(f),...m]:[...s,...d,...m];return xl(e,v)?e:v}function c$(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){const r=e[n],o=t[n];if(r.path!==o.path||r.operation!==o.operation||r.movedToPath!==o.movedToPath||r.diff!==o.diff||r.addedLineCount!==o.addedLineCount||r.removedLineCount!==o.removedLineCount)return!1}return!0}function os(e){return e.replace(/\s+/gu," ").trim()}function ml(e){return e.messageType==="userMessage.optimistic"}function d$(e){return e.some(ml)}function Xg(e,t){if(!Gs(e))return!1;const n=os(e.text),r=Array.isArray(e.images)?e.images:[],o=Array.isArray(e.fileAttachments)?e.fileAttachments.length:0,a=Array.isArray(e.skills)?e.skills.length:0;return t.some(s=>{if(s===e||!Gs(s)||ml(s))return!1;const i=os(s.text),l=Array.isArray(s.images)?s.images:[],u=Array.isArray(s.fileAttachments)?s.fileAttachments.length:0,d=Array.isArray(s.skills)?s.skills.length:0;return i===n&&Xa(l,r)&&u===o&&d===a})}function f$(e){const t=[];let n=new Map;for(const r of e){if(!(r.role==="assistant"&&typeof r.messageType=="string"&&(r.messageType==="agentMessage"||r.messageType==="agentMessage.live"))){Gs(r)&&(n=new Map),t.push(r);continue}const a=os(r.text);if(a.length===0){t.push(r);continue}const s=n.get(a);if(typeof s=="number"){t.splice(s,1);for(const[i,l]of n)l>s&&n.set(i,l-1);n.set(a,t.length),t.push(r)}else n.set(a,t.length),t.push(r)}return t}function h$(e,t){const n=new Set(t.map(a=>a.id)),r=new Set(t.filter(a=>a.role==="assistant").map(a=>os(a.text)).filter(a=>a.length>0));if(r.size===0)return e;const o=e.filter(a=>{if(a.messageType!=="agentMessage.live")return!0;if(n.has(a.id))return!1;const s=os(a.text);return s.length===0?!1:!r.has(s)});return o.length===e.length?e:o}function Zc(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const r=e[n];if(Bf(r,t))return e;const o=[...e];return o.splice(n,1,t),o}const Nh="worked";function Bs(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function p$(e){if(!Number.isFinite(e)||e<=0)return"<1s";const t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),o=t%60,a=[];n>0&&a.push(`${n}h`),(r>0||n>0)&&a.push(`${r}m`);const s=o>0||a.length===0?o:0;return a.push(`${s}s`),a.join(" ")}function m$(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function g$(e,t){if(!e&&!t)return!0;if(!e||!t||e.label!==t.label||e.details.length!==t.details.length)return!1;for(let n=0;n<e.details.length;n+=1)if(e.details[n]!==t.details[n])return!1;return!0}function Uw(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${p$(e.durationMs)}`,messageType:Nh,turnId:e.turnId,durationMs:e.durationMs}}function v$(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function y$(e,t){const n=Uw(t),r=e.filter(s=>s.messageType!==Nh),o=v$(r);if(o<0)return[...r,n];const a=[...r];return a.splice(o,0,n),a}function w$(e,t){var a;if(!t)return e;const n=new Set;for(const s of e)s.messageType===Nh&&s.turnId&&n.add(s.turnId);const r=new Set;for(const s of e){const i=((a=s.turnId)==null?void 0:a.trim())??"";i&&r.add(i)}const o=[];for(const[s,i]of Object.entries(t))!s||n.has(s)||r.has(s)&&(typeof i!="number"||!Number.isFinite(i)||i<=0||(o.push(Uw({turnId:s,durationMs:Math.round(i)})),n.add(s)));return o.length===0?e:[...e,...o]}function bt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function b$(e,t){if(t.size===0)return e;let n=!1;const r={};for(const[o,a]of Object.entries(e)){if(t.has(o)){n=!0;continue}r[o]=a}return n?r:e}function T$(e,t){return e.id===t.id&&e.title===t.title&&e.projectName===t.projectName&&e.cwd===t.cwd&&e.createdAtIso===t.createdAtIso&&e.updatedAtIso===t.updatedAtIso&&e.preview===t.preview&&e.unread===t.unread&&e.inProgress===t.inProgress&&e.pendingRequestState===t.pendingRequestState}function S$(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function k$(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function ln(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function zw(e,t){const n=t.trim();if(!n)return e;let r=!1;const o=[];for(const a of e){const s=a.threads.filter(l=>l.id!==n),i=s.length!==a.threads.length;i&&(r=!0),s.length>0?o.push(i?{...a,threads:s}:a):a.threads.length===0&&o.push(a)}return r?o:e}function Ic(e,t){const n=new Map(e.map(o=>[o.projectName,o])),r=t.map(o=>{const a=n.get(o.projectName),s=new Map((a==null?void 0:a.threads.map(l=>[l.id,l]))??[]),i=o.threads.map(l=>{const u=s.get(l.id);return u&&T$(u,l)?u:l});return a&&a.projectName===o.projectName&&S$(a.threads,i)?a:{projectName:o.projectName,threads:i}});return k$(e,r)?e:r}function C$(e,t,n){const r=new Set(Qn(t).map(i=>i.id)),o=Qn(e).filter(i=>n[i.id]===!0&&!r.has(i.id));if(o.length===0)return t;const a=new Map(t.map(i=>[i.projectName,i])),s=t.map(i=>({projectName:i.projectName,threads:[...i.threads]}));for(const i of o){if(a.get(i.projectName)){const u=s.findIndex(d=>d.projectName===i.projectName);u>=0&&(s[u]={projectName:s[u].projectName,threads:[i,...s[u].threads]});continue}s.push({projectName:i.projectName,threads:[i]})}return s}function Ii(e){return to(e)}function x$(e){const t=e.trim();if(!t)return"";const n=t.lastIndexOf(":");return n>=0?t.slice(n+1):t}function I$(e){const t=e.label||to(e.remotePath),n=x$(e.hostId);return n?`${t} ${n}`:t}function Hw(e){const t=(e==null?void 0:e.remoteProjects)??[];return new Map(t.map(n=>[n.id,n]))}function ed(e){if(!e)return[];const t=new Set(e.order),n=new Set((e.remoteProjects??[]).map(o=>o.id)),r=e.projectOrder.filter(o=>t.has(o)||n.has(o));for(const o of e.order)r.includes(o)||r.push(o);for(const o of n)r.includes(o)||r.push(o);return r}function Uf(e,t){const n=Hw(e);return ed(e).map(r=>{if(n.has(r))return r;const o=et(r).trim(),a=Ii(o);return t.has(a)?o:a})}function sc(e,t){return et(e).trim()===t||Ii(e)===t}function A$(e,t){const n=new Set;for(const r of e.order)sc(r,t)&&n.add(r);for(const r of e.active)sc(r,t)&&n.add(r);for(const r of Object.keys(e.labels))sc(r,t)&&n.add(r);return n}function _$(e,t,n){var u,d;const r=new Set((e.remoteProjects??[]).map(m=>m.id)),o=new Map;for(const m of e.order){const f=Ii(m);o.has(f)||o.set(f,m)}for(const m of n){const f=((d=(u=m.threads[0])==null?void 0:u.cwd)==null?void 0:d.trim())??"";f&&o.set(m.projectName,f)}const a=[],s=m=>{m&&!a.includes(m)&&a.push(m)};for(const m of t){if(r.has(m)){s(m);continue}const f=o.get(m);f&&s(f)}for(const m of ed(e))s(m);const i=a.filter(m=>e.order.includes(m));for(const m of e.order)i.includes(m)||i.push(m);const l=e.active.filter(m=>i.includes(m));return l.length===0&&i.length>0&&l.push(i[0]),{order:i,active:l,projectOrder:a}}function P$(e,t,n){const r=Uf(t,n);if(r.length===0)return e;const o=new Map(r.map((a,s)=>[a,s]));return[...e].sort((a,s)=>{if(Wf(a)||Wf(s))return 0;const i=o.get(a.projectName)??Number.POSITIVE_INFINITY,l=o.get(s.projectName)??Number.POSITIVE_INFINITY;return i===l?0:i-l})}function zf(e,t){const n=new Map,r=new Map,o=s=>{const i=et(s).trim();if(!i)return;const l=to(i),u=n.get(l)??new Set;u.add(i),n.set(l,u)};for(const s of(t==null?void 0:t.order)??[]){const i=et(s).trim();if(!i)continue;const l=to(i);Ac(i)||r.set(l,(r.get(l)??0)+1),o(s)}for(const s of e)for(const i of s.threads){const l=et(i.cwd).trim(),u=to(l),d=(t==null?void 0:t.order.some(m=>et(m).trim()===l))===!0;Ac(l)&&!d&&r.get(u)===1||o(i.cwd)}const a=new Set;for(const[s,i]of n.entries())i.size>1&&a.add(s);return a}function Ac(e){return e.includes("/.codex/worktrees/")}function E$(e,t){const n=zf(e,t);if(n.size===0)return e;const r=new Set,o=new Set,a=new Map,s=new Set;for(const u of(t==null?void 0:t.order)??[]){const d=et(u).trim();if(!d||(s.add(d),Ac(d)))continue;const m=to(d);r.has(m)?(r.delete(m),o.add(m),a.delete(m)):o.has(m)||(r.add(m),a.set(m,d))}const i=[],l=new Map;for(const u of e)for(const d of u.threads){const m=et(d.cwd).trim(),f=to(m),v=s.has(m),T=Ac(m)&&!v&&r.has(f);let k=u.projectName;T&&n.has(f)?k=a.get(f)??u.projectName:m&&n.has(f)&&(k=m);const R=d.projectName===k?d:{...d,projectName:k},E=l.get(k);if(E)E.threads.push(R);else{const N={projectName:k,threads:[R]};l.set(k,N),i.push(N)}}return i}function M$(e,t,n){if(!t||t.order.length===0&&(t.remoteProjects??[]).length===0)return e;const r=new Set(e.map(s=>s.projectName)),o=[...e],a=Hw(t);for(const s of ed(t)){if(a.has(s)){if(r.has(s))continue;o.push({projectName:s,threads:[]}),r.add(s);continue}const i=et(s).trim();if(!i)continue;const l=Ii(i),u=n.has(l)?i:l;r.has(u)||(o.push({projectName:u,threads:[]}),r.add(u))}return o}const Hf=20;function Ds(e){const t=e.split(`
69
+ `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,Hf):"Untitled thread"}function R$(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function Wf(e){return e.threads.some(t=>t.cwd.trim().length===0||Tc(t.cwd))}const Hs=new Map;let ic=0;function uf(e,t){const n=`${e}:${t.id}`,r=Hs.get(n);return r!==void 0?r:(ic+=1,Hs.set(n,ic),ic)}function L$(e){const t=`${e}:`;for(const n of[...Hs.keys()])n.startsWith(t)&&Hs.delete(n)}function j$(){Hs.clear(),ic=0}function N$(e){if(Hs.size!==0)for(const t of[...Hs.keys()]){const n=t.indexOf(":"),r=n>0?t.slice(0,n):"";e.has(r)||Hs.delete(t)}}function Zg(e,t){const n=t.trim();if(!n)return-1;const r=e.findIndex(i=>i.id===n);if(r>=0)return r;const o=`session-cmd-${n}`,a=e.findIndex(i=>i.id===o);if(a>=0)return a;const s="session-cmd-";if(n.startsWith(s)){const i=e.findIndex(l=>l.id===n.slice(s.length));if(i>=0)return i}return-1}function $$(e,t){var s,i,l;if(t.length===0)return e;const n=[...e],r=[],o=new Set(e.map(u=>{var d;return((d=u.turnId)==null?void 0:d.trim())??""}).filter(u=>u.length>0)),a=new Map;for(const u of t){const d=((s=u.reasoningAnchorMessageId)==null?void 0:s.trim())??"";if(d&&Zg(n,d)>=0)continue;const m=u.turnIndex;if(typeof m!="number"||!Number.isFinite(m))continue;const f=a.get(m)??[];f.push(u),a.set(m,f)}for(const u of[...t].reverse()){const d=((i=u.reasoningAnchorMessageId)==null?void 0:i.trim())??"";if(d){const R=Zg(n,d);if(R>=0){n.splice(R+1,0,u);continue}}const m=u.turnIndex;if(typeof m!="number"||!Number.isFinite(m)){const R=((l=u.turnId)==null?void 0:l.trim())??"";if(R&&!o.has(R))continue;r.push(u);continue}let f=-1,v=-1;const T=[];for(let R=0;R<n.length;R+=1)n[R].turnIndex===m&&(v=R,Gs(n[R])?f=R:n[R].messageType!=="reasoning"&&T.push(R));if(T.some(R=>{const E=n[R].messageType;return E==="commandExecution"||E==="toolCall"||E==="fileChange"||E==="worked"})){const E=(a.get(m)??[]).indexOf(u),N=E>=0?E:0;n.splice(T[Math.min(N,T.length-1)]+1,0,u)}else if(f>=0)n.splice(f+1,0,u);else if(v>=0)n.splice(v+1,0,u);else continue}return r.length>0?[...n,...r.reverse()]:n}function O$(e,t,n){const r=new Set(n.map(s=>s.id)),o=new Map;for(const s of t)for(const i of s)r.has(i.id)||o.has(i.id)||o.set(i.id,i);const a=Array.from(o.values());for(const s of a)uf(e,s);return a.sort((s,i)=>uf(e,s)-uf(e,i))}function D$(e,t,n,r,o){const a=O$(e,r,t),s=new Map;let i;for(let f=0;f<t.length;f+=1){const v=t[f];!Gs(v)||!Number.isInteger(v.turnIndex)||v.turnIndex<0||(i!==void 0&&s.set(i,f),i=v.turnIndex)}if(i!==void 0){const f=t.findIndex(ml);s.set(i,f>=0?f:t.length)}const l=new Map,u=[];for(const f of a){const v=f.turnIndex,T=Number.isInteger(v)&&v>=0?s.get(v):void 0;if(T===void 0){u.push(f);continue}const k=l.get(T);k?k.push(f):l.set(T,[f])}const d=[];for(let f=0;f<=t.length;f+=1)d.push(...l.get(f)??[]),f<t.length&&d.push(t[f]);d.push(...u);const m=f$(d);return[...$$(m,n),...o]}const Ww="codex-web-local.thread-read-state.v1",ev="codex-web-local.thread-unread-cutoff.v1",qw="codex-web-local.thread-token-usage.v1",Gw="codex-web-local.thread-reasoning.v1",qf="codex-web-local.thread-turn-durations.v1",Vw="codex-web-local.thread-last-plan.v1",Kw="codex-web-local.live-reasoning-snapshot.v1",Yw="codex-web-local.thread-terminal-open.v1",Gf="codex-web-local.selected-thread-id.v1",Vf="codex-web-local.selected-model-by-context.v1",Jw="codex-web-local.selected-model-id.v1",Qw="codex-web-local.project-order.v1",Xw="codex-web-local.project-display-name.v1",Kf="codex-web-local.collaboration-mode-by-context.v1",F$="codex-web-local.collaboration-mode.v1";function B$(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ww);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function tv(e){typeof window>"u"||window.localStorage.setItem(Ww,JSON.stringify(e))}function U$(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Gw);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Wl(e){if(!(typeof window>"u")){try{window.localStorage.setItem(Gw,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e))t&&n.length>0&&o_(t,n)}}function z$(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(qf);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r||!o||typeof o!="object"||Array.isArray(o))continue;const a={};for(const[s,i]of Object.entries(o))!s||typeof i!="number"||!Number.isFinite(i)||i<=0||(a[s]=Math.round(i));Object.keys(a).length>0&&(n[r]=a)}return n}catch{return{}}}let Zw={};function eb(e){const t={};for(const[n,r]of Object.entries(e))n&&Object.keys(r).length>0&&(t[n]={...r});Zw=t}function cf(e){if(!(typeof window>"u")){try{Object.keys(e).length===0?window.localStorage.removeItem(qf):window.localStorage.setItem(qf,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e)){if(!t)continue;const r=Zw[t]??{};for(const[o,a]of Object.entries(n))!o||typeof a!="number"||a<=0||r[o]!==a&&s_(t,o,a)}eb(e)}}function H$(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Vw);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function tb(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Vw,JSON.stringify(e))}catch{}}function W$(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Kw);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){const a=o;typeof(a==null?void 0:a.text)=="string"&&a.text.trim()&&typeof a.ts=="number"&&(n[r]={text:a.text,ts:a.ts})}return n}catch{return{}}}function q$(){if(typeof window>"u")return"";const e=window.localStorage.getItem(ev);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(ev,t),t}function G$(){if(typeof window>"u")return No();try{const n=window.localStorage.getItem(Vf);if(n){const r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))return No();const o=No();for(const[a,s]of Object.entries(r)){if(typeof a!="string"||a.length===0)continue;const i=xi(s);i&&(o[a]=i)}return o}}catch{}const e=xi(window.localStorage.getItem(Jw)),t=No();return e&&(t[ba]=e),t}function Ju(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Vf):window.localStorage.setItem(Vf,JSON.stringify(e)),window.localStorage.removeItem(Jw)}catch{}}function V$(){if(typeof window>"u")return No();try{const e=window.localStorage.getItem(Kf);if(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return No();const n=No();for(const[r,o]of Object.entries(t)){if(typeof r!="string"||r.length===0)continue;const a=Ow(o);a==="plan"&&(n[r]=a)}return n}}catch{}return No()}function df(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Kf):window.localStorage.setItem(Kf,JSON.stringify(e)),window.localStorage.removeItem(F$)}catch{}}function K$(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(qw);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r)continue;const a=a$(o);a&&(n[r]=a)}return n}catch{return{}}}function ff(e){typeof window>"u"||window.localStorage.setItem(qw,JSON.stringify(e))}const Yf="codex-web-local.thread-model-switch-markers.v1",Jf="codex-web-local.thread-scroll-state.v1",Y$=24,J$=200;function nb(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;if(t.v!==1)return null;const n=t.coldPage;if(typeof n!="number"||!Number.isInteger(n)||n<0)return null;const r=t.distanceFromBottomPx;if(typeof r!="number"||!Number.isFinite(r)||r<0)return null;const o=t.savedAt;if(typeof o!="number"||!Number.isFinite(o)||o<=0)return null;const a=Array.isArray(t.expandedWarmTurns)?t.expandedWarmTurns:[],s=[];for(const u of a)typeof u=="number"&&Number.isInteger(u)&&u>=0&&!s.includes(u)&&s.push(u);const i=t.hotHeights,l={};if(i&&typeof i=="object"&&!Array.isArray(i)){for(const[u,d]of Object.entries(i))if(!(!u||typeof d!="number"||!Number.isFinite(d)||d<=0)&&(l[u]=d,Object.keys(l).length>=J$))break}return{v:1,coldPage:n,expandedWarmTurns:s,distanceFromBottomPx:r,hotHeights:l,savedAt:o}}function QU(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Jf);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r)continue;const a=nb(o);a&&(n[r]=a)}return n}catch{return{}}}function XU(e){if(!(typeof window>"u"))try{const t=Object.entries(e).filter(n=>!!n[0]&&nb(n[1])!==null).sort((n,r)=>r[1].savedAt-n[1].savedAt).slice(0,Y$);if(t.length===0)window.localStorage.removeItem(Jf);else{const n={};for(const[r,o]of t)n[r]=o;window.localStorage.setItem(Jf,JSON.stringify(n))}}catch{}}function Q$(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Yf);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r||!Array.isArray(o))continue;const a=o.filter(s=>!!s&&typeof s=="object"&&GN(s)).slice(0,jw);a.length>0&&(n[r]=a)}return n}catch{return{}}}function X$(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Yf):window.localStorage.setItem(Yf,JSON.stringify(e))}catch{}}function Z$(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Yw);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t))r&&typeof o=="boolean"&&(n[r]=o);return n}catch{return{}}}function eO(e){typeof window>"u"||window.localStorage.setItem(Yw,JSON.stringify(e))}function tO(){return typeof window>"u"?"":window.localStorage.getItem(Gf)??""}function nO(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Gf);return}window.localStorage.setItem(Gf,e)}}function rO(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Qw);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const r of t){if(typeof r!="string"||r.length===0)continue;const o=to(r);o.length>0&&!n.includes(o)&&n.push(o)}return n}catch{return[]}}function oO(e){typeof window>"u"||window.localStorage.setItem(Qw,JSON.stringify(e))}function aO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Xw);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){const a=typeof r=="string"?to(r):"";a.length>0&&typeof o=="string"&&(n[a]=o)}return n}catch{return{}}}function sO(e){typeof window>"u"||window.localStorage.setItem(Xw,JSON.stringify(e))}const $h="codex-web-local.thread-message-snapshot.v1",iO=6,lO=384*1024;function Oh(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem($h);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){const a=o;!r||!a||typeof a!="object"||a.v!==1||!Array.isArray(a.messages)||a.messages.length===0||typeof a.savedAt!="number"||!Number.isFinite(a.savedAt)||(n[r]={v:1,savedAt:a.savedAt,hasMoreOlder:a.hasMoreOlder===!0,messages:a.messages,turnIndexByTurnId:a.turnIndexByTurnId&&typeof a.turnIndexByTurnId=="object"?a.turnIndexByTurnId:{}})}return n}catch{return{}}}function uO(e){return e?Oh()[e]??null:null}function nv(e){if(!(!e||typeof window>"u"))try{const t=Oh();if(!(e in t))return;delete t[e],window.localStorage.setItem($h,JSON.stringify(t))}catch{}}function cO(e,t,n,r){if(!(!e||t.length===0||typeof window>"u"))try{const o=Oh(),a=dO(t);if(a.length===0)return;o[e]={v:1,savedAt:Date.now(),hasMoreOlder:r,messages:a,turnIndexByTurnId:n};const s=Object.entries(o).sort((l,u)=>u[1].savedAt-l[1].savedAt).slice(0,iO),i={};for(const[l,u]of s)i[l]=u;window.localStorage.setItem($h,JSON.stringify(i))}catch{}}function dO(e){const t=[];let n=2;for(let r=e.length-1;r>=0;r-=1){let o="";try{o=JSON.stringify(e[r])??""}catch{continue}const a=o.length+1;if(t.length>0&&n+a>lO)break;n+=a,t.push(e[r])}return t.reverse(),t.length>0?t:e.slice(-1)}function fO(e){return e==="completed"?"completed":e==="inProgress"||e==="in_progress"?"inProgress":"pending"}function hO(e){var n;const t=[];(n=e.explanation)!=null&&n.trim()&&t.push(e.explanation.trim());for(const r of e.steps){const o=r.status==="completed"?"x":r.status==="inProgress"?"~":" ";t.push(`- [${o}] ${r.step}`)}return t.join(`
70
+ `).trim()}function Ve(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function Re(e){return typeof e=="string"?e:""}function Us(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function rv(e){const t=Ve(e);if(!t)return null;const n=Us(t.totalTokens??t.total_tokens),r=Us(t.inputTokens??t.input_tokens),o=Us(t.cachedInputTokens??t.cached_input_tokens),a=Us(t.outputTokens??t.output_tokens),s=Us(t.reasoningOutputTokens??t.reasoning_output_tokens);return n===null||r===null||o===null||a===null||s===null?null:{totalTokens:n,inputTokens:r,cachedInputTokens:o,outputTokens:a,reasoningOutputTokens:s}}function pO(e){const t=Ve(e);if(!t)return null;const n=rv(t.total),r=rv(t.last);if(!n||!r)return null;const o=Us(t.modelContextWindow??t.model_context_window),a=r.totalTokens,s=typeof o=="number"?Math.max(o-a,0):null,i=typeof o=="number"&&o>0?Bw(Math.round((s??0)/o*100),0,100):null;return{total:n,last:r,modelContextWindow:o,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function mO(e){if(e.method!=="thread/tokenUsage/updated")return null;const t=Ve(e.params),n=Wn(e),r=pO((t==null?void 0:t.tokenUsage)??(t==null?void 0:t.token_usage));return!n||!r?null:{threadId:n,usage:r}}function Wn(e){const t=Ve(e.params);if(!t)return"";const n=Re(t.threadId);if(n)return n;const r=Re(t.thread_id);if(r)return r;const o=Re(t.conversationId);if(o)return o;const a=Re(t.conversation_id);if(a)return a;const s=Ve(t.thread),i=Re(s==null?void 0:s.id);if(i)return i;const l=Ve(t.turn),u=Re(l==null?void 0:l.threadId);if(u)return u;const d=Re(l==null?void 0:l.thread_id);return d||""}function gO(e){if(e.method!=="turn/completed")return"";const t=Ve(e.params),n=Ve(t==null?void 0:t.turn);if(!n||n.status!=="failed")return"";const r=Ve(n.error);return Re(r==null?void 0:r.message)}function vO(e){var r;if(e.method!=="error")return null;const t=Ve(e.params),n=Re(t==null?void 0:t.message)||Re((r=Ve(t==null?void 0:t.error))==null?void 0:r.message);return n?{message:n,transient:(t==null?void 0:t.willRetry)===!0}:null}function yO(e){const t=Wn(e);if(!t)return null;if(e.method==="turn/started")return{threadId:t,activity:{label:"Thinking",details:[]}};if(e.method==="item/started"){const n=Ve(e.params),r=Ve(n==null?void 0:n.item),o=Re(r==null?void 0:r.type).toLowerCase();if(o==="reasoning")return{threadId:t,activity:{label:"Thinking",details:[]}};if(o==="agentmessage")return{threadId:t,activity:{label:"Writing response",details:[]}};if(o==="commandexecution"){const a=Re(r==null?void 0:r.command);return{threadId:t,activity:{label:"Running command",details:a?[a]:[]}}}if(o==="filechange"){const s=(Array.isArray(r==null?void 0:r.changes)?r.changes:[])[0],i=Re(s==null?void 0:s.path);return{threadId:t,activity:{label:"Applying changes",details:i?[i]:[]}}}}return e.method==="item/commandExecution/outputDelta"?{threadId:t,activity:{label:"Running command",details:[]}}:e.method==="item/fileChange/outputDelta"?{threadId:t,activity:{label:"Applying changes",details:[]}}:e.method==="item/reasoning/summaryTextDelta"||e.method==="item/reasoning/summaryPartAdded"||e.method==="item/reasoning/textDelta"?{threadId:t,activity:{label:"Thinking",details:[]}}:e.method==="item/agentMessage/delta"?{threadId:t,activity:{label:"Writing response",details:[]}}:null}function wO(e){if(e.method!=="turn/started")return null;const t=Ve(e.params);if(!t)return null;const n=Wn(e);if(!n)return null;const r=Ve(t.turn),o=Re(r==null?void 0:r.id)||Re(t.turnId)||`${n}:unknown`;if(!o)return null;const a=Bs(Re(r==null?void 0:r.startedAt))??Bs(Re(t.startedAt))??Bs(e.atIso)??Date.now();return{threadId:n,turnId:o,startedAtMs:a}}function bO(e){if(e.method!=="turn/completed")return null;const t=Ve(e.params);if(!t)return null;const n=Wn(e);if(!n)return null;const r=Ve(t.turn),o=Re(r==null?void 0:r.id)||Re(t.turnId)||`${n}:unknown`;if(!o)return null;const a=Bs(Re(r==null?void 0:r.completedAt))??Bs(Re(t.completedAt))??Bs(e.atIso)??Date.now(),s=Bs(Re(r==null?void 0:r.startedAt))??Bs(Re(t.startedAt))??void 0;return{threadId:n,turnId:o,completedAtMs:a,startedAtMs:s}}function _c(e){return`${e}:live-reasoning`}function TO(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/started"){const n=Ve(t.item);return!n||n.type!=="reasoning"?"":Re(n.id)}return""}function SO(e){const t=Ve(e.params);if(!t)return null;if(e.method==="item/reasoning/summaryTextDelta"){const n=Re(t.itemId),r=Re(t.delta);return!n||!r?null:{messageId:_c(n),itemId:n,delta:r}}if(e.method==="item/reasoning/textDelta"){const n=Re(t.itemId),r=Re(t.delta);return!n||!r?null:{messageId:_c(n),itemId:n,delta:r}}return null}function kO(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/reasoning/summaryPartAdded"){const n=Re(t.itemId);return n?_c(n):""}return""}function CO(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/completed"){const n=Ve(t.item);return!n||n.type!=="reasoning"?"":_c(Re(n.id))}return""}function xO(e){var n;const t=[];for(const r of["content","summary"]){const o=Array.isArray(e[r])?e[r]:[];for(const a of o){const s=typeof a=="string"?a:(n=Ve(a))==null?void 0:n.text;typeof s=="string"&&s.trim()&&t.push(s)}}return t.join(`
71
+ `).trim()}function IO(e){if(e.method!=="item/started"&&e.method!=="item/completed")return null;const t=Ve(e.params),n=Ve(t==null?void 0:t.item);if(!n||Re(n.type).toLowerCase()!=="reasoning")return null;const r=Re(n.id);return r?{itemId:r,text:xO(n)}:null}function AO(e){const t=Ve(e.params);if(!t)return"";if(e.method==="item/started"){const n=Ve(t.item);return!n||n.type!=="agentMessage"?"":Re(n.id)}return""}function _O(e){const t=Ve(e.params);if(!t)return null;if(e.method==="item/agentMessage/delta"){const n=Re(t.itemId),r=Re(t.delta);if(!n||!r)return null;const o=Re(t.turnId)||Re(t.turn_id);return{messageId:n,delta:r,turnId:o||void 0}}return null}function PO(e){const t=Ve(e.params);if(!t)return null;if(e.method==="item/completed"){const n=Ve(t.item);if(!n||n.type!=="agentMessage")return null;const r=Re(n.id),o=Re(n.text);if(!r||!o)return null;const a=Re(t.turnId)||Re(t.turn_id);return{id:r,role:"assistant",text:o,messageType:"agentMessage",turnId:a||void 0}}return null}function EO(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function MO(e){const t=e.trim();if(!t)return"";if(t.startsWith("data:")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/codex-local-image?"))return t;const n=t.replace(/\s+/gu,"");return/^[A-Za-z0-9+/]+={0,2}$/u.test(n)?`data:image/png;base64,${n}`:""}function RO(e){if(e.method!=="item/completed")return null;const t=Ve(e.params),n=Ve(t==null?void 0:t.item);if(!n)return null;const r=Re(n.id);if(!r)return null;if(n.type==="imageView"){const s=Re(n.path);return s?{id:r,role:"assistant",text:"",images:[EO(s)],messageType:"imageView"}:null}if(n.type!=="imageGeneration"&&n.type!=="image_generation")return null;const o=Re(n.result),a=o?MO(o):"";return a?{id:r,role:"assistant",text:"",images:[a],messageType:"imageView"}:null}function LO(e){if(e.method!=="item/commandExecution/outputDelta")return null;const t=Ve(e.params);if(!t)return null;const n=Re(t.itemId),r=Re(t.delta);return!n||!r?null:{itemId:n,delta:r}}const gl="__global__";function jO(e){return e==="item/commandExecution/requestApproval"||e==="item/fileChange/requestApproval"||e==="item/permissions/requestApproval"||e==="execCommandApproval"||e==="applyPatchApproval"}function rb(e){const t=Ve(e);if(!t)return null;const n=t.id,r=Re(t.method),o=t.params;if(typeof n!="number"||!Number.isInteger(n)||!r)return null;const a=Ve(o),s=NO(r,a),i=Re(a==null?void 0:a.threadId)||Re(a==null?void 0:a.thread_id)||Re(a==null?void 0:a.conversationId)||Re(a==null?void 0:a.conversation_id)||gl,l=Re(a==null?void 0:a.turnId)||Re(a==null?void 0:a.turn_id),u=Re(a==null?void 0:a.itemId)||Re(a==null?void 0:a.item_id)||Re(a==null?void 0:a.callId)||Re(a==null?void 0:a.call_id),d=Re(t.receivedAtIso)||new Date().toISOString();return{id:n,method:s,threadId:i,turnId:l,itemId:u,receivedAtIso:d,params:o??null}}function NO(e,t){const n=e.trim();return n&&(n==="item/commandExecution/requestApproval"||n==="execCommandApproval"||n==="exec_approval_request"||$O(t)?"item/commandExecution/requestApproval":n==="item/fileChange/requestApproval"||n==="applyPatchApproval"||n==="apply_patch_approval_request"||OO(t)?"item/fileChange/requestApproval":n==="item/tool/requestUserInput"||n==="request_user_input"||DO(t)?"item/tool/requestUserInput":n==="mcpServer/elicitation/request"||n==="elicitation_request"||BO(t)?"mcpServer/elicitation/request":n==="item/permissions/requestApproval"||UO(t)?"item/permissions/requestApproval":n==="item/tool/call"||n==="dynamic_tool_call_request"||FO(t)?"item/tool/call":n)}function $O(e){if(!e)return!1;const t=e.command;return Array.isArray(t)&&t.some(n=>typeof n=="string"&&n.trim().length>0)||typeof t=="string"&&t.trim().length>0?!0:Array.isArray(e.commandActions)}function OO(e){return e?typeof e.grantRoot=="string"&&e.grantRoot.trim().length>0||typeof e.grant_root=="string"&&e.grant_root.trim().length>0||Ve(e.fileChanges)?!0:Ve(e.changes)!==null:!1}function DO(e){return!!(e&&Array.isArray(e.questions))}function FO(e){return e?typeof e.toolName=="string"||typeof e.tool_name=="string"||typeof e.name=="string"||Array.isArray(e.arguments):!1}function BO(e){if(!e)return!1;const t=Re(e.mode);return typeof e.serverName=="string"&&typeof e.threadId=="string"&&typeof e.message=="string"&&(t==="form"||t==="url")}function UO(e){return e?typeof e.threadId=="string"&&typeof e.turnId=="string"&&typeof e.itemId=="string"&&Ve(e.permissions)!==null:!1}function zO(e){if(e.method!=="item/tool/requestUserInput")return[];const t=Ve(e.params),n=Array.isArray(t==null?void 0:t.questions)?t.questions:[],r=[];for(const o of n){const a=Ve(o),s=Re(a==null?void 0:a.id).trim();s&&r.push(s)}return r}function HO(e,t){const n=t.threadId||gl,r=e.pendingServerRequestsByThreadId.value[n]??[],o=r.findIndex(s=>s.id===t.id),a=[...r];o>=0?a.splice(o,1,t):a.push(t),e.pendingServerRequestsByThreadId.value={...e.pendingServerRequestsByThreadId.value,[n]:a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso))},e.applyThreadFlags()}function WO(e,t){const n={};for(const[r,o]of Object.entries(e.pendingServerRequestsByThreadId.value)){const a=o.filter(s=>s.id!==t);a.length>0&&(n[r]=a)}e.pendingServerRequestsByThreadId.value=n,e.pendingReplyErrorByRequestId.value[String(t)]&&(e.pendingReplyErrorByRequestId.value=bt(e.pendingReplyErrorByRequestId.value,String(t))),e.applyThreadFlags()}function qO(e,t){return e.pendingReplyErrorByRequestId.value[String(t)]??""}function GO(e,t){const n={},r=new Set;for(const a of t){const s=a.threadId||gl,i=n[s]??[];i.push(a),n[s]=i,r.add(a.id)}for(const a of Object.values(n))a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso));e.pendingServerRequestsByThreadId.value=n;const o={};for(const[a,s]of Object.entries(e.pendingReplyErrorByRequestId.value))r.has(Number(a))&&(o[a]=s);e.pendingReplyErrorByRequestId.value=o}function ob(e,t,n){const r=e.liveAgentMessagesByThreadId.value[t]??[];xl(r,n)||(e.liveAgentMessagesByThreadId.value={...e.liveAgentMessagesByThreadId.value,[t]:n})}function VO(e,t){t&&t in e.liveAgentMessagesByThreadId.value&&(e.liveAgentMessagesByThreadId.value=bt(e.liveAgentMessagesByThreadId.value,t))}function KO(e,t,n){const r=e.livePlanMessagesByThreadId.value[t]??[];xl(r,n)||(e.livePlanMessagesByThreadId.value={...e.livePlanMessagesByThreadId.value,[t]:n})}function YO(e,t,n){!t||!n||(e.lastPlanByThreadId.value={...e.lastPlanByThreadId.value,[t]:n},tb(e.lastPlanByThreadId.value))}function JO(e,t,n){const r=e.livePlanMessagesByThreadId.value[t]??[],o=Zc(r,n);KO(e,t,o),YO(e,t,n)}function QO(e,t,n){const r=e.liveFileChangeMessagesByThreadId.value[t]??[],o=Zc(r,n);Dh(e,t,o)}function XO(e,t,n){const r=e.liveAgentMessagesByThreadId.value[t]??[];let o=Zc(r,n);const a=os(n.text);if(n.role==="assistant"&&a.length>0){const s=o.filter(i=>i.id===n.id||os(i.text)!==a);s.length!==o.length&&(o=s)}ob(e,t,o)}function Dh(e,t,n){const r=e.liveFileChangeMessagesByThreadId.value[t]??[];xl(r,n)||(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:n})}function ZO(e,t,n){const r=e.liveCommandsByThreadId.value[t]??[],o=Zc(r,n);o!==r&&(e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:o})}function eD(e,t,n){const r=e.liveCommandsByThreadId.value[t];if(!r||r.length===0)return;const o=new Set(n.map(s=>s.id)),a=r.filter(s=>!o.has(s.id));a.length!==r.length&&(a.length===0?e.liveCommandsByThreadId.value=bt(e.liveCommandsByThreadId.value,t):e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:a})}function tD(e,t,n){const r=e.liveFileChangeMessagesByThreadId.value[t];if(!r||r.length===0)return;const o=new Set(n.map(l=>l.id)),a=new Set(n.filter(l=>l.messageType==="fileChange"&&typeof l.turnId=="string"&&l.turnId.length>0).map(l=>l.turnId)),s=new Set(n.filter(l=>l.messageType==="fileChange"&&typeof l.turnIndex=="number").map(l=>l.turnIndex)),i=r.filter(l=>!o.has(l.id)&&!(l.turnId&&a.has(l.turnId))&&!(typeof l.turnIndex=="number"&&s.has(l.turnIndex)));i.length!==r.length&&(i.length===0?e.liveFileChangeMessagesByThreadId.value=bt(e.liveFileChangeMessagesByThreadId.value,t):e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:i})}function nD(e,t,n,r){if(!t||!n)return;const o=e.liveFileChangeMessagesByThreadId.value[t];if(!o)return;const a=o.findIndex(i=>i.id===n||i.turnId===n);if(a<0)return;const s=[...o];s[a]={...s[a],fileChanges:r},Dh(e,t,s)}function rD(e,t,n,r){if(!t||!n)return;const o=e.liveFileChangeMessagesByThreadId.value[t];if(!o)return;const a=o.findIndex(l=>l.turnId===n);if(a<0)return;const s=[...o],i=s[a];s[a]={...i,fileChanges:(i.fileChanges??[]).map(l=>({...l,diff:r}))},Dh(e,t,s)}function oD(e,t){const n=e.persistedMessagesByThreadId.value[t]??[];let r=-1;for(const o of n)typeof o.turnIndex=="number"&&Number.isFinite(o.turnIndex)&&(r=Math.max(r,o.turnIndex));return r+1}function aD(e,t,n,r){if(!t||!n||!Number.isInteger(r)||r<0)return;const o=e.turnIndexByTurnIdByThreadId.value[t]??{};o[n]!==r&&(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...o,[n]:r}})}function sD(e,t,n){const r=e.turnIndexByTurnIdByThreadId.value[t]??{},o=Object.entries(r),a=Object.entries(n);o.length===a.length&&o.every(([s,i])=>n[s]===i)||(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...n}})}function iD(e,t,n){var o;if(!t||!n)return;const r=(o=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:o[n];return typeof r=="number"?r:void 0}function lD(e,t){const n=e.liveFileChangeMessagesByThreadId.value[t];if(!n||n.length===0)return;const r=e.turnIndexByTurnIdByThreadId.value[t]??{};let o=!1;const a=n.map(s=>{if(typeof s.turnIndex=="number"||!s.turnId)return s;const i=r[s.turnId];return typeof i!="number"?s:(o=!0,{...s,turnIndex:i})});o&&(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:a})}const ov=8e3,uD=1500,cD=15*60*1e3;function dD(e){let t=W$(),n=!1,r=null;function o(){r===null&&(r=setTimeout(()=>{if(r=null,n&&(n=!1,typeof window<"u"))try{window.localStorage.setItem(Kw,JSON.stringify(t))}catch{}n&&o()},uD))}function a(d,m){if(!d||e.inProgressById.value[d]!==!0)return;const f=m.length>ov?m.slice(-ov):m;t[d]={text:f,ts:Date.now()},n=!0,o()}function s(d,m){if(!d)return;const f=m.trim(),v=e.liveReasoningTextByThreadId.value[d]??"";if(f.length===0){if(!v)return;e.liveReasoningTextByThreadId.value=bt(e.liveReasoningTextByThreadId.value,d);return}v!==f&&(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[d]:f},a(d,f))}function i(d,m){if(!d)return;const f=e.liveReasoningTextByThreadId.value[d]??"";s(d,`${f}${m}`)}function l(d){var v;if(!d||((v=e.liveReasoningTextByThreadId.value[d])==null?void 0:v.trim()))return;const f=t[d];f!=null&&f.text&&(Date.now()-f.ts>cD||(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[d]:f.text}))}function u(d){d&&d in t&&(delete t[d],n=!0,o())}return{setLiveReasoningText:s,appendLiveReasoningText:i,restoreLiveReasoningSnapshot:l,clearLiveReasoningSnapshot:u}}function fD(e,t){if(!t)return;const n=e.activeTurnIdByThreadId.value[t]??"";n&&e.activeReasoningTurnIdByThreadId.set(t,n)}function hD(e,t,n=!1){var l;if(!t)return;const r=e.liveReasoningTextByThreadId.value[t];if(r===void 0){n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear());return}const o=e.activeReasoningTurnIdByThreadId.get(t)??e.activeTurnIdByThreadId.value[t]??"";e.activeReasoningTurnIdByThreadId.delete(t);const a=o?(l=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:l[o]:void 0,s=yD(e,t),i=o||void 0;s.length>0?mD(e,t,s,i,a):n||pD(e,t,r,i,a),e.liveReasoningTextByThreadId.value=bt(e.liveReasoningTextByThreadId.value,t),n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear(),e.clearLiveReasoningSnapshot(t))}function pD(e,t,n,r,o){if(!t)return;const a=n.trim();if(!a)return;const s=e.persistedReasoningByThreadId.value[t]??[];if(s.some(u=>u.text===a))return;const i={id:`reasoning:local:${t}:${Date.now()}`,role:"system",text:a,messageType:"reasoning",reasoning:{summary:[],content:[a]},turnId:r||void 0,turnIndex:typeof o=="number"?o:void 0},l=[...s,i].slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:l},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function mD(e,t,n,r,o){if(!t||n.length===0)return;const s=[...e.persistedReasoningByThreadId.value[t]??[]];for(const l of n){const u=l.text.trim();if(!u)continue;const d=`reasoning:item:${t}:${l.itemId}`,m=s.findIndex(f=>f.id===d);if(m>=0){const f=s[m],v=l.anchorMessageId||f.reasoningAnchorMessageId,T=typeof o=="number"?o:f.turnIndex;if(f.text===u&&f.turnIndex===T&&f.reasoningAnchorMessageId===v)continue;s[m]={...f,text:u,reasoning:{summary:[],content:[u]},turnId:r||f.turnId,turnIndex:T,reasoningAnchorMessageId:v};continue}s.some(f=>f.text===u)||s.push({id:d,role:"system",text:u,messageType:"reasoning",reasoning:{summary:[],content:[u]},turnId:r||void 0,turnIndex:typeof o=="number"?o:void 0,reasoningAnchorMessageId:l.anchorMessageId||void 0})}const i=s.slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:i},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function gD(e,t,n,r){if(!t||!r)return;r.trim()&&e.reasoningItemTextByItemId.set(n,r.trim());const o=e.liveReasoningTextByThreadId.value[t]??"",a=e.reasoningAppendedTextByItemId.get(n)??"";if(o.endsWith(r)||a&&r===a){e.reasoningAppendedTextByItemId.set(n,r);return}if(a&&r.startsWith(a)){const i=r.slice(a.length);i&&e.appendLiveReasoningText(t,i),e.reasoningAppendedTextByItemId.set(n,r);return}const s=o.length>0&&!o.endsWith(`
72
+ `)?`
73
+
74
+ `:"";e.appendLiveReasoningText(t,`${s}${r}`),e.reasoningAppendedTextByItemId.set(n,r)}function vD(e,t){const n=Ve(t.params);if(!n)return;const r=t.method==="item/started"||t.method==="item/completed",o=t.method==="item/reasoning/textDelta"||t.method==="item/reasoning/summaryTextDelta";if(!r&&!o)return;const a=Ve(n.item),s=Re(o?n.itemId:a==null?void 0:a.id);if(!s)return;const i=Wn(t);if(!i)return;const l=o||Re(a==null?void 0:a.type).toLowerCase()==="reasoning"?"reasoning":"other",u=e.turnItemSequenceByThreadId.get(i)??[];u.some(d=>d.itemId===s)||e.turnItemSequenceByThreadId.set(i,[...u,{itemId:s,kind:l}])}function yD(e,t){var a;const n=e.turnItemSequenceByThreadId.get(t)??[],r=[];let o="";for(const s of n)if(s.kind==="reasoning"){const i=((a=e.reasoningItemTextByItemId.get(s.itemId))==null?void 0:a.trim())??"";i&&r.push({text:i,anchorMessageId:o,itemId:s.itemId})}else o=s.itemId;return r}function wD(e,t,n){if(!t||!n)return;const r=e.reasoningItemTextByItemId.get(t)??"";r.endsWith(n)||e.reasoningItemTextByItemId.set(t,`${r}${n}`)}function av(e){e.reasoningItemTextByItemId.clear()}const Ro="gpt-5.4-mini",ab="Codex CLI not found. Install @openai/codex or set CODEXUI_CODEX_COMMAND.",bD="big-pickle",TD=ew;function SD(e){const t=S([]),n=S({}),r=S({}),o=S(G$()),a=S(sf(o.value,e.selectedThreadId.value)),s=S("medium"),i=S("standard"),l=S(""),u=S(""),d=S(!1),m=S({});let f=!1;function v(Se){if(Ja(Se)===ba){const xe=Ns(l.value),Ee=Ku(xe),Je=Ee?xi(o.value[Ee]):"";if(Je)return Je}return sf(o.value,Se).trim()}function T(Se){const Te=Se.trim();return Ns(Te?m.value[Te]??l.value:l.value)}function k(Se){const Te=Se.trim();return!Te||Ja(Te)===ba?!1:sf(o.value,Te).trim().length>0}function R(Se){const Te=Se.trim();if(!Te)return!1;const xe=Ja(Te);return xe===ba?!1:xi(o.value[xe]).length>0}function E(Se){return n.value[Se.trim()]??TD}function N(Se,Te=s.value){const xe=Se.trim(),Ee=E(xe);if(Te&&Ee.includes(Te))return Te;if(Ee.includes("medium"))return"medium";const Je=r.value[xe];return Je&&Ee.includes(Je)?Je:Ee[0]??""}function q(Se){s.value=N(Se)}function K(Se){const Te={},xe={};for(const Ee of Se)Ee.supportedReasoningEfforts!==null&&(Te[Ee.id]=[...Ee.supportedReasoningEfforts]),Ee.defaultReasoningEffort&&(xe[Ee.id]=Ee.defaultReasoningEffort);n.value=Te,r.value=xe}function U(...Se){const Te=[...t.value];for(const xe of Se){const Ee=xe.trim();Ee&&!Te.includes(Ee)&&Te.push(Ee)}Xa(t.value,Te)||(t.value=Te)}function ce(Se){const Te=Se.trim();return t.value.length===0||Te&&t.value.includes(Te)?Te:Te?(U(Te),Te):t.value[0]??""}function G(Se,Te){const xe=Te.trim(),Ee=Ja(Se),Je=Ns(l.value),Xe=Ee===ba?Ku(Je):"",nt=Xe||Ee;if(xe){const de=ac(o.value);de[nt]=xe,Xe&&delete de[Ee],o.value=de}else{let de=nu(o.value,nt);Xe&&(de=nu(de,Ee)),o.value=de}Ee===Ja(e.selectedThreadId.value)?(a.value=v(e.selectedThreadId.value),U(a.value),q(a.value)):U(xe),Ju(o.value)}function le(Se){G(e.selectedThreadId.value,Se)}function ye(Se,Te){const xe=Se.trim();if(!xe)return;const Ee=Te.trim();if(Ee){const Je=ac(o.value);Je[xe]=Ee,o.value=Je}else o.value=nu(o.value,xe);U(Ee),e.selectedThreadId.value===xe&&(a.value=v(e.selectedThreadId.value),q(a.value)),Ju(o.value)}function _e(Se,Te){const xe=Se.trim();if(!xe)return;const Ee=Ns(Te);Ee?m.value={...m.value,[xe]:Ee}:m.value[xe]&&(m.value=bt(m.value,xe))}function we(Se,Te,xe){const Ee=Te.trim();if(Ns(xe)!=="opencode-zen")return Ee;const Xe=v(Se).trim();return Xe&&!/^gpt-/i.test(Xe)?Xe:Ee&&!/^gpt-/i.test(Ee)?Ee:bD}async function ee(Se=e.selectedThreadId.value){var xe;const Te=Se.trim();Te?(ye(Te,Ro),(xe=e.onThreadModelChanged)==null||xe.call(e,Te)):le(Ro),U(Ro)}function he(Se){Se&&!E(a.value).includes(Se)||(f=!0,s.value=Se)}async function te(Se){const Te=Se==="fast"?"fast":"standard";if(d.value||i.value===Te)return;const xe=i.value;i.value=Te,d.value=!0,e.error.value="";try{await RA(Te)}catch(Ee){i.value=xe,e.error.value=Ee instanceof Error?Ee.message:"Failed to update Fast mode"}finally{d.value=!1}}function Ae(Se,Te,xe){const Ee=Se.trim()||"default",Je=Te||"default",Xe=xe==="plan"?"Plan":"Default",nt=i.value==="fast"?"Fast":"Standard";return[`Mode: ${Xe}`,`Model: ${Ee}`,`Thinking: ${Je}`,`Speed: ${nt}`]}async function Oe(Se){u.value="";try{const Te=await $A(),xe=Te.model.trim(),Ee=Ns(Te.providerId);l.value=Ee;const Je=T(e.selectedThreadId.value),Xe=Je!=="codex"&&Je!=="custom",nt=v(e.selectedThreadId.value),de=await NA({includeProviderModels:Xe||(Se==null?void 0:Se.includeProviderModels)!==!1,requireProviderModels:Xe,providerId:Xe?Je:void 0}),D=de.map(j=>j.id);K(de);const ne=Ku(Je),se=ne?xi(o.value[ne]):"",Le=[...D];!(Se!=null&&Se.providerChanged)&&Xe&&Je===Ee&&xe&&!Le.includes(xe)&&Le.push(xe),t.value=Le;const We=nt&&D.includes(nt),P=R(e.selectedThreadId.value);if(!nt||!We||Se!=null&&Se.providerChanged?Se!=null&&Se.providerChanged&&Le.length>0?se&&D.includes(se)?le(se):Je===Ee&&xe&&Le.includes(xe)?le(xe):le(Le[0]):P&&nt?U(nt):Je===Ee&&xe&&Le.includes(xe)?le(Te.model):Le.length>0?le(Le[0]):le(""):a.value.trim()!==nt&&le(nt),ne&&a.value.trim().length>0){const j=ac(o.value);j[ne]=a.value.trim();const W=Ku(Ee);W&&W!==ne&&xe&&(j[W]=xe),o.value=j,Ju(o.value)}s.value=N(a.value,f?s.value:"medium"),i.value=Te.speedMode}catch(Te){u.value=Fw(Te)?ab:""}}function $e(Se){a.value=ce(v(Se)),q(a.value)}function De(Se){const Te=Dw(o.value,Se);Te!==o.value&&(o.value=Te,$e(e.selectedThreadId.value),Ju(Te)),m.value=ln(m.value,Se)}return{activeProviderId:l,availableModelIds:t,availableModelReasoningEfforts:n,codexCliMissingError:u,isUpdatingSpeedMode:d,selectedModelId:a,selectedReasoningEffort:s,selectedSpeedMode:i,applyFallbackModelSelection:ee,buildPendingTurnDetails:Ae,hasThreadModelSelection:k,hasThreadOwnModelSelection:R,pruneThreadModelState:De,readModelIdForThread:v,refreshModelPreferences:Oe,resolveThreadModelForProvider:we,setSelectedModelId:le,setSelectedModelIdForThread:G,setSelectedReasoningEffort:he,setThreadModelId:ye,setThreadModelProviderId:_e,syncSelectedThreadModel:$e,updateSelectedSpeedMode:te}}function kD(e){const t=S([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),n=S(V$()),r=S(lf(n.value,e.value));function o(u){const d=u==="plan"?"plan":"default",m=Ja(e.value);lf(n.value,e.value)===d&&r.value===d||(r.value=d,n.value=Yg(n.value,m,d),df(n.value))}function a(u,d){const m=d==="plan"?"plan":"default";n.value=Yg(n.value,u,m),u.trim()===e.value&&(r.value=m),df(n.value)}function s(u){r.value=lf(n.value,u)}function i(u){const d=Dw(n.value,u);d!==n.value&&(n.value=d,s(e.value),df(d))}async function l(){try{const u=await DA();t.value=u,u.some(d=>d.value===r.value)||o("default")}catch{}}return{availableCollaborationModes:t,selectedCollaborationMode:r,pruneThreadCollaborationState:i,refreshCollaborationModes:l,setSelectedCollaborationMode:o,setSelectedCollaborationModeForThread:a,syncSelectedThreadCollaborationMode:s}}const CD=500;function xD(){const e=S(null),t=S([]),n=Y(()=>e.value);let r=null,o=null;function a(u){e.value=u}async function s(){if(o){await o;return}o=(async()=>{try{const u=await I_();a(u),t.value=u?[u]:[]}catch{}finally{o=null}})(),await o}function i(){if(typeof window>"u"){s();return}r!==null&&window.clearTimeout(r),r=window.setTimeout(()=>{r=null,s()},CD)}function l(){r===null||typeof window>"u"||(window.clearTimeout(r),r=null)}return{accountRateLimitSnapshots:t,codexQuota:n,refreshRateLimits:s,scheduleRateLimitRefresh:i,setCodexRateLimit:a,stopRateLimitRefresh:l}}function ID(e){const t=S(rO()),n=S(aO());let r=null;function o(f,v={}){t.value=f,v.persist!==!1&&oO(f)}function a(f,v={}){n.value=f,v.persist!==!1&&sO(f)}async function s(f,v){try{const T=await sl(),k={...T.labels};let R=!1;for(const E of T.order){if(!sc(E,f))continue;const N=v.trim();N.length===0?k[E]!==void 0&&(delete k[E],R=!0):k[E]!==N&&(k[E]=N,R=!0)}R&&await Zd({order:T.order,labels:k,active:T.active,projectOrder:T.projectOrder})}catch{}}function i(f,v){f.length===0||(n.value[f]??"")===v||(a({...n.value,[f]:v}),r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,s(f,v)},500))}async function l(){try{const f=await sl(),v=_$(f,t.value,e.sourceGroups.value);await Zd({order:v.order,labels:f.labels,active:v.active,projectOrder:v.projectOrder})}catch{}}async function u(f){var E;if(f.length===0)return;const v=t.value.filter(N=>N!==f);if(Xa(t.value,v)||o(v),e.sourceGroups.value=e.sourceGroups.value.filter(N=>N.projectName!==f),n.value[f]!==void 0){const N={...n.value};delete N[f],a(N)}e.applyThreadFlags();const T=Qn(e.projectGroups.value);e.pruneThreadScopedState(T),T.some(N=>N.id===e.selectedThreadId.value)||e.setSelectedThreadId(((E=T[0])==null?void 0:E.id)??"");const R=new Set;try{const N=await sl();A$(N,f).forEach(q=>{R.add(q)})}catch{}if(R.size>0)try{const N=await sl(),q=N.order.filter(ce=>!R.has(ce)),K=N.active.filter(ce=>!R.has(ce)),U=K.length===0&&q.length>0?[q[0]]:K;await Zd({order:q,labels:b$(N.labels,R),active:U,projectOrder:N.projectOrder.filter(ce=>ce!==f&&!R.has(ce))});return}catch{}await l()}function d(f,v){if(f.length===0||e.sourceGroups.value.length===0)return;const T=e.sourceGroups.value.map(q=>q.projectName),k=T.indexOf(f);if(k===-1)return;const R=Math.max(0,Math.min(v,T.length-1)),E=s$(T,k,R);if(E===T)return;o(al(E,e.sourceGroups.value));const N=Ff(e.sourceGroups.value,t.value);e.sourceGroups.value=Ic(e.sourceGroups.value,N),e.applyThreadFlags(),l()}function m(f){const v=f.trim();if(!v)return;const T=[v,...t.value.filter(R=>R!==v)];if(Xa(t.value,T))return;o(T);const k=Ff(e.sourceGroups.value,t.value);e.sourceGroups.value=Ic(e.sourceGroups.value,k),e.applyThreadFlags(),l()}return{projectDisplayNameById:n,projectOrder:t,persistProjectOrderToWorkspaceRoots:l,pinProjectToTop:m,removeProject:u,renameProject:i,reorderProject:d,setProjectDisplayNames:a,setProjectOrder:o}}const AD=2e3;function _D(e){const t=S([]),n=S([]),r=S(!1);let o=null,a=null,s=!1,i=!1,l=0,u="";async function d(f={}){const v=e.getSelectedCwd().trim(),T=v||"__global__";if(o){await o;return}f.force!==!0&&s&&u===T&&Date.now()-l<AD||(o=(async()=>{try{t.value=await h_(v?[v]:void 0),s=!0,l=Date.now(),u=T}catch{}finally{o=null}})(),await o)}async function m(f={}){if(a){await a;return}f.force!==!0&&i||(r.value=!0,a=(async()=>{try{n.value=await UA(),i=!0}catch{}finally{r.value=!1,a=null}})(),await a)}return{hooksList:n,installedSkills:t,isHooksLoading:r,refreshHooks:m,refreshSkills:d}}const sb="codex-web-local.stashed-messages.v1",ib="codex-web-local.auto-compact-threshold.v1",Qu=10,PD=650;function ED(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(sb);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r||!Array.isArray(o))continue;const a=o.filter(s=>!!s&&typeof s=="object"&&typeof s.id=="string"&&typeof s.text=="string");a.length>0&&(n[r]=a)}return n}catch{return{}}}function MD(){if(typeof window>"u")return Qu;try{const e=window.localStorage.getItem(ib);if(e===null)return Qu;const t=Number(e);return Number.isFinite(t)&&t>=0?Math.round(t):Qu}catch{return Qu}}function RD(e){const t={};for(const[n,r]of Object.entries(e)){const o=n.trim();!o||r.length===0||(t[o]=r.map(a=>({id:a.id,text:a.text,imageUrls:[...a.imageUrls],skills:a.skills.map(s=>({name:s.name,path:s.path})),fileAttachments:a.fileAttachments.map(s=>({label:s.label,path:s.path,fsPath:s.fsPath})),collaborationMode:a.collaborationMode})))}return t}function LD(e){const t=S({}),n=S({}),r=S(ED()),o=S(MD());let a=!1;const s=Y(()=>{const G=e.value;if(!G)return[];const le=t.value[G]??[];return[...(r.value[G]??[]).map(we=>({...we,awaitingCompaction:!0})),...le]});function i(){typeof window>"u"||window.localStorage.setItem(sb,JSON.stringify(r.value))}function l(){XA(RD(t.value)).catch(()=>{})}async function u(){if(!a){a=!0;try{t.value=await vg()}catch{}}}async function d(G){if(n.value[G]!==!0){n.value={...n.value,[G]:!0};try{t.value=await vg()}catch{}finally{n.value=bt(n.value,G)}}}function m(G){d(G),!(typeof window>"u")&&window.setTimeout(()=>{d(G)},PD)}function f(G){const le=Number.isFinite(G)&&G>0?Math.round(G):0;le!==o.value&&(o.value=le,!(typeof window>"u")&&window.localStorage.setItem(ib,String(le)))}function v(G){return r.value[G]??[]}function T(G,le){r.value={...r.value,[G]:[...v(G),le]},i()}function k(G){const le=[...v(G)];return le.length===0||(r.value=bt(r.value,G),i()),le}function R(G,le,ye){const we=[...t.value[G]??[]],ee=typeof ye=="number"?Math.max(0,Math.min(ye,we.length)):we.length;we.splice(ee,0,le),t.value={...t.value,[G]:we},l()}function E(G,le){return v(G).find(ye=>ye.id===le)}function N(G,le){var ye;return(ye=t.value[G])==null?void 0:ye.find(_e=>_e.id===le)}function q(G){const le=e.value;if(!le)return;if(E(le,G)){const we=v(le).filter(ee=>ee.id!==G);r.value=we.length>0?{...r.value,[le]:we}:bt(r.value,le),i();return}const ye=t.value[le];if(!ye)return;const _e=ye.filter(we=>we.id!==G);t.value=_e.length>0?{...t.value,[le]:_e}:bt(t.value,le),l()}function K(G,le){const ye=e.value;if(!ye)return;const _e=t.value[ye];if(!_e||E(ye,G)||E(ye,le))return;const we=_e.findIndex(Ae=>Ae.id===G),ee=_e.findIndex(Ae=>Ae.id===le);if(we<0||ee<0||we===ee)return;const he=[..._e],[te]=he.splice(we,1);he.splice(ee,0,te),t.value={...t.value,[ye]:he},l()}function U(G){const le=ln(t.value,G);le!==t.value&&(t.value=le,l())}function ce(){t.value={},n.value={},r.value={},i(),l()}return{appendStashedMessage:T,autoCompactThreshold:o,clearQueueState:ce,enqueueQueuedMessage:R,findQueuedMessage:N,findStashedMessage:E,getStashedMessages:v,loadPersistedQueueStateIfNeeded:u,processQueuedMessages:d,pruneQueueState:U,removeQueuedMessage:q,reorderQueuedMessage:K,scheduleQueueStateRefresh:m,selectedThreadQueuedMessages:s,setAutoCompactThreshold:f,takeStashedMessages:k}}const jD=1e4,ND=2e3;function $D(e){const{selectedThreadId:t,projectGroups:n,inProgressById:r,applyThreadGroups:o,hydrateWorkspaceRootsStateIfNeeded:a,loadThreadTitleCacheIfNeeded:s,loadWorkspaceRootsStateForThreadList:i,pruneThreadScopedState:l,setSelectedThreadId:u}=e,d=S(!1),m=S(!1),f=S(!1);let v=null,T=0,k=null,R=null,E=!1,N=!1,q=[],K=null;function U(he,te){if(he.length===0)return te;if(te.length===0)return he;const Ae=new Map;for(const $e of Qn(he))Ae.set($e.id,$e);for(const $e of Qn(te))Ae.set($e.id,$e);const Oe=new Map;for(const $e of Ae.values()){const De=Oe.get($e.projectName);De?De.push($e):Oe.set($e.projectName,[$e])}return Array.from(Oe.entries()).map(([$e,De])=>({projectName:$e,threads:De.sort((Se,Te)=>new Date(Te.updatedAtIso).getTime()-new Date(Se.updatedAtIso).getTime())})).sort(($e,De)=>{var xe,Ee;const Se=new Date(((xe=$e.threads[0])==null?void 0:xe.updatedAtIso)??0).getTime();return new Date(((Ee=De.threads[0])==null?void 0:Ee.updatedAtIso)??0).getTime()-Se})}function ce(){return Object.values(r.value).some(he=>he===!0)}function G(he=K){if(!(!k||E||ce())){if(K=he,typeof window>"u"){le(he);return}R!==null&&window.clearTimeout(R),R=window.setTimeout(()=>{R=null,!(!k||ce())&&le(K)},jD)}}async function le(he){if(!(E||!k||ce())){E=!0;try{const te=await sg(k,KA());k=te.nextCursor,N=te.nextCursor===null,f.value=N,q=U(q,te.groups),o(q,he)}catch{}finally{E=!1,k&&!ce()&&G(he)}}}async function ye(he={}){if(v){await v;return}he.force!==!0&&d.value&&Date.now()-T<ND||(v=(async()=>{var te;d.value||(m.value=!0);try{const[Ae,Oe]=await Promise.all([sg(),i(),s({force:he.force===!0})]);K=Oe;const $e=Ae.groups;q=$e,k=Ae.nextCursor,N=Ae.nextCursor===null,f.value=N,await a($e,Oe),o(q,Oe),d.value=!0,T=Date.now(),N||G(Oe);const De=Qn(n.value);l(De),!De.some(Te=>Te.id===t.value)&&!t.value&&u(((te=De[0])==null?void 0:te.id)??"")}finally{m.value=!1}})().finally(()=>{v=null}),await v)}function _e(he){q=zw(q,he)}function we(){return k!==null}function ee(){R!==null&&typeof window<"u"&&(window.clearTimeout(R),R=null)}return{dispose:ee,hasActiveInProgressThreads:ce,hasLoadedThreads:d,hasRemainingThreadPages:we,isLoadingThreads:m,isThreadListFullyLoaded:f,loadThreads:ye,removeThreadFromLoadedLists:_e,scheduleRemainingThreadPages:G}}const sv=2e3;function OD(e){const t=S({}),n=S({}),r=S({}),o=S({}),a=S(!1),s=5e3,i=S(null);let l=0,u=null;function d(){l&&(clearTimeout(l),l=0),u=null,i.value=null}function m(U){d(),u=U,l=window.setTimeout(()=>{l=0,i.value=u},s)}const f=new Map,v=new Map,T=new Map;let k=0;function R(U,ce,G,le){var we;const ye=(we=ce[ce.length-1])==null?void 0:we.id;if(!ye)return;const _e=()=>{(e.persistedMessagesByThreadId.value[U]??[]).some(he=>he.id===ye)&&cO(U,ce,G,le)};if(typeof window<"u"&&typeof window.requestAnimationFrame=="function"){window.requestAnimationFrame(()=>{window.setTimeout(_e,0)});return}setTimeout(_e,0)}async function E(U,ce={}){var ee;if(!U)return;const G=Date.now()-(T.get(U)??0)<sv;if((ee=e.turnErrorByThreadId.value[U])!=null&&ee.transient&&(ce.silent===!0||G))return;const le=f.get(U);if(le&&ce.force!==!0){await le;return}const ye=n.value[U]===!0,_e=ce.silent!==!0&&!ye;_e&&(k+=1,a.value=!0),m(U);const we=(async()=>{try{const he=e.currentThreadVersion(U),te=t.value[U]??"",Ae=Date.now()-(v.get(U)??0)<sv;if(ce.force===!0?!1:ye&&(Ae||(he.length===0||te===he)&&e.inProgressById.value[U]!==!0)){e.markThreadAsRead(U);return}if(!ye&&e.inProgressById.value[U]!==!0&&(e.persistedMessagesByThreadId.value[U]??[]).length===0){const se=uO(U);se&&(e.setPersistedMessagesForThread(U,se.messages),Object.keys(se.turnIndexByTurnId).length>0&&e.replaceTurnIndexLookupForThread(U,se.turnIndexByTurnId),se.hasMoreOlder&&(r.value={...r.value,[U]:!0}))}const De=e.resumedThreadById.value[U]!==!0?await Nf(U,ne=>{e.setPersistedMessagesForThread(U,ne)}):null,Se=De??await jf(U);Se.modelProvider&&e.setThreadModelProviderId(U,Se.modelProvider),Se.model&&!e.hasThreadOwnModelSelection(U)&&e.setThreadModelId(U,e.resolveThreadModelForProvider(U,Se.model,Se.modelProvider)),De&&(e.resumedThreadById.value={...e.resumedThreadById.value,[U]:!0});const{messages:Te,inProgress:xe,activeTurnId:Ee,turnIndexByTurnId:Je}=Se,Xe=e.persistedMessagesByThreadId.value[U]??[],nt=Te.length===0&&Xe.length>0;nt&&console.warn(`[thread-load] ${U}: server returned 0 messages while ${Xe.length} are persisted locally; keeping local history`),r.value={...r.value,[U]:Se.hasMoreOlder===!0},e.markThreadMessagesPersisted(U,Te),nt||e.replaceTurnIndexLookupForThread(U,Je),e.rebindLiveFileChangeTurnIndices(U);const de=Qg(Xe,Te,{preserveMissing:ce.silent===!0||d$(Xe)||nt});e.setPersistedMessagesForThread(U,de);const D=e.liveAgentMessagesByThreadId.value[U]??[];if(xe){const ne=h$(D,Te);e.setLiveAgentMessagesForThread(U,ne)}else e.clearLiveAgentMessagesForThread(U);e.removeLiveCommandsPersistedIn(U,Te),e.removeLiveFileChangesPersistedIn(U,Te),n.value={...n.value,[U]:!0},v.set(U,Date.now()),T.delete(U),!nt&&!xe&&R(U,de,Je,Se.hasMoreOlder===!0),he&&(t.value={...t.value,[U]:he}),e.setThreadInProgress(U,xe),Se.externalSession&&(e.externalSessionByThreadId.value={...e.externalSessionByThreadId.value,[U]:Se.externalSession}),e.clearTransientTurnErrorForThread(U),Ee?e.activeTurnIdByThreadId.value={...e.activeTurnIdByThreadId.value,[U]:Ee}:e.activeTurnIdByThreadId.value[U]&&(e.activeTurnIdByThreadId.value=bt(e.activeTurnIdByThreadId.value,U)),xe||e.clearCompletedTurnLiveState(U),e.markThreadAsRead(U)}catch(he){const te=he instanceof Error?he.message:"Unknown application error";throw e.selectedThreadId.value===U&&e.setTurnErrorForThread(U,te,{transient:!0}),T.set(U,Date.now()),he}finally{_e&&(k=Math.max(0,k-1),k===0&&(a.value=!1))}})().finally(()=>{u===U&&d(),f.delete(U)});f.set(U,we),await we}async function N(U=e.selectedThreadId.value){if(!U||o.value[U]===!0||r.value[U]!==!0)return;const ce=e.getFirstPersistedTurnId(U);if(!ce){r.value={...r.value,[U]:!1};return}o.value={...o.value,[U]:!0};try{const G=await wA(U,ce),le=e.persistedMessagesByThreadId.value[U]??[],ye=Qg(G.messages,le,{preserveMissing:!0});e.setPersistedMessagesForThread(U,ye),e.replaceTurnIndexLookupForThread(U,{...e.turnIndexByTurnIdByThreadId.value[U]??{},...G.turnIndexByTurnId}),e.rebindLiveFileChangeTurnIndices(U),r.value={...r.value,[U]:G.hasMoreOlder}}catch(G){throw G instanceof $r&&G.code==="older_turns_unavailable"&&(r.value={...r.value,[U]:!1}),e.error.value=G instanceof Error?G.message:"Failed to load earlier messages",G}finally{o.value={...o.value,[U]:!1}}}async function q(U,ce={}){var G;U&&n.value[U]!==!0&&(ce.silent===!0&&((G=e.turnErrorByThreadId.value[U])!=null&&G.transient)||await E(U,ce))}function K(U){n.value=ln(n.value,U),t.value=ln(t.value,U)}return{ensureThreadMessagesLoaded:q,hasMoreOlderMessagesByThreadId:r,isLoadingMessages:a,loadMessages:E,loadOlderMessages:N,loadedMessagesByThreadId:n,loadedVersionByThreadId:t,loadingOlderMessagesByThreadId:o,pruneMessageHistoryState:K,slowOpenThreadId:i}}function DD(e){const t=S({});function n(s){const i=t.value;return Object.keys(i).length===0?s.map(l=>({projectName:l.projectName,threads:l.threads.map(u=>({...u,title:Ds(u.title)}))})):s.map(l=>({projectName:l.projectName,threads:l.threads.map(u=>{const d=i[u.id];return{...u,title:Ds(d??u.title)}})}))}async function r(s={}){if(!(s.force!==!0&&Object.keys(t.value).length>0))try{const i=await n_();if(Object.keys(i.titles).length>0){const l={};for(const[u,d]of Object.entries(i.titles))l[u]=Ds(d);t.value=l}}catch{}}function o(s,i,l){const u=s.trim();if(u)return Ds(u);const d=l.map(m=>m.label.trim()).find(m=>m.length>0);return d?Ds(d):i.length>0?Ds("[Image]"):"Untitled thread"}async function a(s,i,l,u=[],d=[]){if(t.value[s])return;const m=i.trim();if(!m){const v=o(i,u,d);t.value={...t.value,[s]:v},e.applyThreadFlags(),Sc(s,v);return}const f=m.length>300?m.slice(0,300):m;try{const v=await d_(f,l);if(!v||t.value[s])return;const T=v.length>Hf?v.slice(0,Hf):v;t.value={...t.value,[s]:T},e.applyThreadFlags(),Sc(s,T)}catch{}}return{applyCachedTitlesToGroups:n,loadThreadTitleCacheIfNeeded:r,requestThreadTitleGeneration:a,resolveFallbackThreadTitle:o,threadTitleById:t}}function FD(e){const t=S({}),n=S({});function r(){return{pendingServerRequestsByThreadId:t,pendingReplyErrorByRequestId:n,applyThreadFlags:e.applyThreadFlags}}function o(T){HO(r(),T)}function a(T){WO(r(),T)}function s(T){GO(r(),T)}function i(T){return qO(r(),T)}const l=Y(()=>{const T=[],k=e.getSelectedThreadId();return k&&Array.isArray(t.value[k])&&T.push(...t.value[k]),Array.isArray(t.value[gl])&&T.push(...t.value[gl]),T.sort((R,E)=>R.receivedAtIso.localeCompare(E.receivedAtIso))});function u(T){return T?Array.isArray(t.value[T])?t.value[T]:[]:[]}function d(T){return T.some(k=>jO(k.method))?"approval":T.length>0?"response":null}function m(T){const k={};for(const[R,E]of Object.entries(t.value))(R===gl||T.has(R))&&(k[R]=E);t.value=k}async function f(){try{const k=(await gg()).map(R=>rb(R)).filter(R=>R!==null);s(k)}catch{}}async function v(T){try{const k=await gg();for(const R of k){const E=Ve(R);if((E==null?void 0:E.id)===T)return!0}return!1}catch{return!0}}return{getThreadPendingRequests:u,loadPendingServerRequestsFromBridge:f,pendingReplyErrorByRequestId:n,pendingReplyErrorForRequest:i,pendingRequestStillExistsOnServer:v,pendingServerRequestsByThreadId:t,prunePendingServerRequestsByActiveThreads:m,readPendingRequestState:d,removePendingServerRequestById:a,replacePendingServerRequests:s,selectedThreadServerRequests:l,upsertPendingServerRequest:o}}const Xu=220,BD=3e3,UD=1500,zD=new Set(["account/login/completed","account/updated","authStatusChange","command/exec/outputDelta","configWarning","deprecationNotice","externalAgentConfig/import/completed","externalAgentConfig/import/progress","fs/changed","guardianWarning","item/autoApprovalReview/completed","item/autoApprovalReview/started","item/mcpToolCall/progress","loginChatGptComplete","model/rerouted","model/safetyBuffering/updated","model/verification","process/exited","process/outputDelta","sessionConfigured","thread/environment/connected","thread/environment/disconnected","thread/goal/cleared","thread/goal/updated","thread/realtime/closed","thread/realtime/error","thread/realtime/itemAdded","thread/realtime/outputAudio/delta","thread/realtime/sdp","thread/realtime/started","thread/realtime/transcript/delta","thread/realtime/transcript/done","thread/settings/updated","thread/started","turn/moderationMetadata","warning","windows/worldWritableWarning","windowsSandbox/setupCompleted"]);function HD(e,t){if(t.length===0)return e;const n=new Set(e.map(s=>s.id)),r=new Map,o=[];for(const s of t){const i=s.modelSwitchInsertAfterId;if(i&&n.has(i)){const l=r.get(i)??[];l.push(s),r.set(i,l)}else o.push(s)}const a=[];for(const s of e){a.push(s);const i=r.get(s.id);i&&i.length>0&&a.push(...i)}return o.length>0&&a.push(...o),a}function WD(){const e=S([]),t=S([]),n=S(tO()),r=S(""),o=S({}),a=S({}),s=S(H$()),i=S({}),l=S({}),u=S(U$()),d=S(z$()),m=S({}),f=new Map,v=new Map,T=new Map,k=new Map,R=S({}),E=S({}),N=S({}),K=dD({liveReasoningTextByThreadId:m,inProgressById:N}),U=S({});let ce=!1;const G=S({}),{activeProviderId:le,availableModelIds:ye,availableModelReasoningEfforts:_e,codexCliMissingError:we,isUpdatingSpeedMode:ee,selectedModelId:he,selectedReasoningEffort:te,selectedSpeedMode:Ae,applyFallbackModelSelection:Oe,buildPendingTurnDetails:$e,hasThreadModelSelection:De,hasThreadOwnModelSelection:Se,pruneThreadModelState:Te,readModelIdForThread:xe,refreshModelPreferences:Ee,resolveThreadModelForProvider:Je,setSelectedModelId:Xe,setSelectedModelIdForThread:nt,setSelectedReasoningEffort:de,setThreadModelId:D,setThreadModelProviderId:ne,syncSelectedThreadModel:se,updateSelectedSpeedMode:Le}=SD({selectedThreadId:n,error:r,onThreadModelChanged:p=>Ea(p)}),{availableCollaborationModes:We,selectedCollaborationMode:P,pruneThreadCollaborationState:j,refreshCollaborationModes:W,setSelectedCollaborationMode:ue,setSelectedCollaborationModeForThread:ae,syncSelectedThreadCollaborationMode:ie}=kD(n),Pe=S(B$()),je=S(q$()),{projectDisplayNameById:Ie,projectOrder:ge,pinProjectToTop:Ke,removeProject:Ne,renameProject:qe,reorderProject:Ge,setProjectDisplayNames:dt,setProjectOrder:St}=ID({sourceGroups:t,projectGroups:e,selectedThreadId:n,applyThreadFlags:gn,pruneThreadScopedState:go,setSelectedThreadId:Pn}),st=S({}),ut=S({}),X=S({}),pe=S({}),Ce=S({}),Be=S({}),yt=OD({selectedThreadId:n,error:r,persistedMessagesByThreadId:o,liveAgentMessagesByThreadId:i,inProgressById:N,externalSessionByThreadId:U,resumedThreadById:st,turnIndexByTurnIdByThreadId:ut,turnErrorByThreadId:Ce,activeTurnIdByThreadId:Be,markThreadAsRead:ps,markThreadMessagesPersisted:Mi,replaceTurnIndexLookupForThread:M,rebindLiveFileChangeTurnIndices:Z,setPersistedMessagesForThread:yr,setLiveAgentMessagesForThread:Gr,clearLiveAgentMessagesForThread:gs,removeLiveCommandsPersistedIn:ia,removeLiveFileChangesPersistedIn:ys,setThreadInProgress:En,setThreadModelProviderId:ne,setThreadModelId:D,resolveThreadModelForProvider:Je,hasThreadOwnModelSelection:Se,clearTransientTurnErrorForThread:vr,clearCompletedTurnLiveState:ni,setTurnErrorForThread:Wt,getFirstPersistedTurnId:Qs,currentThreadVersion:qr}),{ensureThreadMessagesLoaded:wt,hasMoreOlderMessagesByThreadId:Dt,isLoadingMessages:Uo,loadMessages:Jt,loadOlderMessages:so,loadedMessagesByThreadId:tr,loadedVersionByThreadId:Sa,loadingOlderMessagesByThreadId:io,pruneMessageHistoryState:Ys,slowOpenThreadId:ka}=yt,is=DD({applyThreadFlags:gn}),{threadTitleById:Or,applyCachedTitlesToGroups:ls,loadThreadTitleCacheIfNeeded:Dr,requestThreadTitleGeneration:zo}=is,Ho=FD({applyThreadFlags:gn,getSelectedThreadId:()=>n.value}),{getThreadPendingRequests:Js,loadPendingServerRequestsFromBridge:Wo,pendingReplyErrorByRequestId:Fr,pendingReplyErrorForRequest:us,pendingRequestStillExistsOnServer:Ca,pendingServerRequestsByThreadId:qo,prunePendingServerRequestsByActiveThreads:lo,readPendingRequestState:uo,removePendingServerRequestById:xr,selectedThreadServerRequests:cs,upsertPendingServerRequest:xa}=Ho,vt={liveReasoningTextByThreadId:m,persistedReasoningByThreadId:u,turnIndexByTurnIdByThreadId:ut,activeTurnIdByThreadId:Be,activeReasoningTurnIdByThreadId:k,reasoningItemTextByItemId:v,reasoningAppendedTextByItemId:f,turnItemSequenceByThreadId:T,appendLiveReasoningText:(p,y)=>K.appendLiveReasoningText(p,y),clearLiveReasoningSnapshot:p=>K.clearLiveReasoningSnapshot(p),savePersistedReasoningMap:Wl},kt=S({}),It=S({}),tn=S({}),$n=S({}),hn=S({}),{accountRateLimitSnapshots:Ir,codexQuota:pr,refreshRateLimits:Go,scheduleRateLimitRefresh:pn,setCodexRateLimit:nr,stopRateLimitRefresh:Ar}=xD(),Mt=S(K$()),co=S(Z$()),rr=S(Q$()),wn=S({}),Br=S(!1),On=S(!1),An=S(!1),bn=S(new Set),Ia=6e4,mr=S([]);let Ur="";const Bt=S(!1);function fo(p){var y;try{const A=new URL(p,"http://localhost");return A.pathname!=="/codex-local-image"?"":((y=A.searchParams.get("path"))==null?void 0:y.trim())??""}catch{return""}}function Vo(p){const y=p.trim().toLowerCase();return y?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(y):!1}function Ko(p){var A;const y=o.value[p]??[];for(let L=y.length-1;L>=0;L-=1){const H=y[L];if(!(H.role!=="user"||!Array.isArray(H.images)||H.images.length===0))for(let V=H.images.length-1;V>=0;V-=1){const z=((A=H.images[V])==null?void 0:A.trim())??"";if(z&&fo(z))return z}}return""}let Tn=null,Zt=null;const gr=new Map;let un=!1,Yo=!1;const nn=new Set,zr=new Set;let Jo=!1,Ut=!1;const Qo=new Map,Xo=new Set,_t=$D({selectedThreadId:n,projectGroups:e,inProgressById:N,applyThreadGroups:La,hydrateWorkspaceRootsStateIfNeeded:Un,loadThreadTitleCacheIfNeeded:Dr,loadWorkspaceRootsStateForThreadList:Oi,pruneThreadScopedState:go,setSelectedThreadId:Pn}),mn=Y(()=>Qn(e.value)),ho=Y(()=>mn.value.find(p=>p.id===n.value)??null),{appendStashedMessage:_r,autoCompactThreshold:Pr,clearQueueState:Zo,enqueueQueuedMessage:Hr,findQueuedMessage:ea,findStashedMessage:or,getStashedMessages:po,loadPersistedQueueStateIfNeeded:ta,pruneQueueState:Er,removeQueuedMessage:gt,reorderQueuedMessage:_n,scheduleQueueStateRefresh:Sn,selectedThreadQueuedMessages:Aa,setAutoCompactThreshold:Vn,takeStashedMessages:I}=LD(n),{hooksList:$,installedSkills:Q,isHooksLoading:ke,refreshHooks:ze,refreshSkills:jt}=_D({getSelectedCwd:()=>{var p;return((p=ho.value)==null?void 0:p.cwd)??""}}),At=Y(()=>{const p=n.value;return!!(p&&co.value[p]===!0)}),rn=Y(()=>{const p=n.value;return p?kt.value[p]===!0:!1}),Qt=Y(()=>{const p=n.value;return p?Be.value[p]??"":""}),Mr=Y(()=>{var oe;const p=n.value;if(!p)return null;const y=N.value[p]===!0,A=y?pe.value[p]:void 0,L=y?(m.value[p]??"").trim():"",H=(((oe=Ce.value[p])==null?void 0:oe.message)??"").trim();let V="";if(!y&&H){const me=o.value[p]??[];for(let fe=me.length-1;fe>=0;fe-=1){const He=me[fe];if(He.messageType==="turnError"){V=os(He.text);break}}}const z=!y&&H&&V===H?"":H;return!y&&!A&&!L&&!z?null:{activityLabel:(A==null?void 0:A.label)||"Thinking",activityDetails:(A==null?void 0:A.details)??[],reasoningText:L,errorText:z}}),_a=Y(()=>{const p=n.value;return p?Mt.value[p]??null:null}),ds=Y(()=>{const p=n.value;if(!p)return[];const y=o.value[p]??[],A=a.value[p]??[],L=i.value[p]??[],H=R.value[p]??[],V=E.value[p]??[],z=l.value[p]??[],oe=u.value[p]??[],me=y.some(ft=>ft.messageType==="compaction.done"),fe=bn.value.has(p),He=me&&!fe?z.filter(ft=>ft.messageType!=="compaction.pending"&&ft.messageType!=="compaction.done"):z,rt=D$(p,y,oe,[A,H,V,L],He),Ct=X.value[p],tt=Ct?y$(rt,Ct):rt,Rt=w$(tt,d.value[p]),xt=rr.value[p]??[];return HD(Rt,xt)}),cn=Y(()=>{const p=n.value;return p?$n.value[p]??null:null}),na=Y(()=>{const p=n.value;return p?Dt.value[p]===!0:!1}),Pa=Y(()=>{const p=n.value;return p?io.value[p]===!0:!1});function Qs(p){var A;const y=o.value[p]??[];for(const L of y){const H=((A=L.turnId)==null?void 0:A.trim())??"";if(H)return H}return""}function Pn(p,y={}){n.value!==p&&(n.value=p,y.persist!==!1&&nO(p),se(p),ie(p),Ut=!1)}function fs(p,y){const A=p.trim();if(!A)return;if(!y){if(!(A in Mt.value))return;Mt.value=bt(Mt.value,A),ff(Mt.value);return}const L=Mt.value[A];if(L&&JSON.stringify(L)===JSON.stringify(y))return;Mt.value={...Mt.value,[A]:y},ff(Mt.value);const H=po(A);H&&H.length>0&&Pr.value>0&&(y.remainingContextPercent!==null&&y.remainingContextPercent<=Pr.value?bn.value.has(A)||Oa(A):si(A))}function Xs(p,y){hn.value={...hn.value,[p]:y}}function hs(p,y,A){var Ct;const L=p.trim(),H=y.trim(),V=A.trim();if(!L||!V||H===V)return;const z=rr.value[L]??[],oe=o.value[L]??[],me=oe.length,fe=wn.value[L],He=z.length>0&&fe!==void 0&&fe===me;let rt;if(He){const tt=z[z.length-1];rt=[...z.slice(0,-1),{...tt,modelSwitchFrom:H||void 0,modelSwitchTo:V}]}else{const tt=(Ct=oe[oe.length-1])==null?void 0:Ct.id,Rt={id:`model-switch:${L}:${Date.now()}:${z.length}`,role:"system",text:"",messageType:Lw,modelSwitchFrom:H||void 0,modelSwitchTo:V,...tt?{modelSwitchInsertAfterId:tt}:{}};rt=[...z,Rt].slice(-jw)}rr.value={...rr.value,[L]:rt},wn.value={...wn.value,[L]:me},X$(rr.value)}function Ea(p){const y=p.trim(),A=Mt.value[y];A&&A.modelContextWindow!==null&&(Mt.value={...Mt.value,[y]:{...A,modelContextWindow:null,remainingContextTokens:null,remainingContextPercent:null}},ff(Mt.value))}function ra(p){hn.value[p]&&(hn.value=bt(hn.value,p))}async function on(p){var A,L;if(Xo.has(p))return;const y=hn.value[p];if(!(!y||y.fallbackRetried)){Xo.add(p),Xs(p,{...y,fallbackRetried:!0});try{await Oe(p);try{const H=((L=(A=(o.value[p]??[]).reduce((V,z)=>{const oe=typeof z.turnIndex=="number"?z.turnIndex:-1,me=V!==null&&typeof V.turnIndex=="number"?V.turnIndex:-1;return oe>=0&&oe>me?z:V},null))==null?void 0:A.turnId)==null?void 0:L.trim())??"";if(H){const V=await Yd(p,H);yr(p,V),wo(p),Gr(p,[]),Yr(p),R.value[p]&&(R.value=bt(R.value,p))}}catch{}if(Wt(p,null),r.value="",an(p,null),Ft(p,{label:"Thinking",details:$e(Ro,y.effort,y.collaborationMode)}),En(p,!0),st.value[p]!==!0){const H=await Nf(p);H.model&&D(p,Je(p,H.model,H.modelProvider)),H.modelProvider&&ne(p,H.modelProvider),st.value={...st.value,[p]:!0}}await Qd(p,y.text,y.imageUrls,Ro,y.effort||void 0,y.skills.length>0?y.skills:void 0,y.fileAttachments,y.collaborationMode),pn(),nn.add(p),await ir()}catch(H){const V=H instanceof Error?H.message:"Unknown application error";Wt(p,V),r.value=V,En(p,!1),Ft(p,null)}finally{Xo.delete(p)}}}function oa(p){if(!p||typeof window>"u")return;const y=gr.get(p);y!==void 0&&(window.clearTimeout(y),gr.delete(p))}function Wr(p){if(!p||typeof window>"u")return;oa(p);const y=window.setTimeout(()=>{gr.delete(p),nn.add(p),ir()},BD);gr.set(p,y)}function gn(){const y=ls(t.value).map(A=>({projectName:A.projectName,threads:A.threads.map(L=>{const H=U.value[L.id]??L.externalSession??null,V=N.value[L.id]===!0||(H==null?void 0:H.active)===!0,z=uo(Js(L.id)),oe=n.value===L.id,me=G.value[L.id]===!0,fe=o$(L.updatedAtIso,Pe.value[L.id],je.value);return{...L,inProgress:V,unread:!oe&&!V&&(me||fe),pendingRequestState:z,...H?{externalSession:H}:{}}})}));e.value=Ic(e.value,y)}function mo(p,y,A){const L=new Date().toISOString(),H=et(y),V=to(H),z={id:p,title:Ds(A),projectName:V,cwd:H,hasWorktree:H.includes("/.codex/worktrees/")||H.includes("/.git/worktrees/"),createdAtIso:L,updatedAtIso:L,preview:A,unread:!1,inProgress:!1},oe=t.value.findIndex(fe=>fe.projectName===V);if(oe>=0){const He=t.value[oe].threads.filter(tt=>tt.id!==p),rt={projectName:V,threads:[z,...He]},Ct=[...t.value];Ct.splice(oe,1,rt),t.value=Ct}else t.value=[{projectName:V,threads:[z]},...t.value];const me=al(ge.value,t.value);Xa(ge.value,me)||St(me),gn()}function go(p){const y=new Set(p.map(H=>H.id)),A=n.value.trim();A&&y.add(A),Te(y),j(y);const L=ln(Pe.value,y);if(L!==Pe.value&&(Pe.value=L,tv(L)),Ys(y),st.value=ln(st.value,y),ut.value=ln(ut.value,y),o.value=ln(o.value,y),i.value=ln(i.value,y),m.value=ln(m.value,y),R.value=ln(R.value,y),E.value=ln(E.value,y),X.value=ln(X.value,y),pe.value=ln(pe.value,y),Ce.value=ln(Ce.value,y),Be.value=ln(Be.value,y),k.size>0)for(const H of[...k.keys()])y.has(H)||k.delete(H);N$(y),kt.value=ln(kt.value,y),It.value=ln(It.value,y),tn.value=ln(tn.value,y),Er(y),Mt.value=ln(Mt.value,y),G.value=ln(G.value,y),N.value=ln(N.value,y),lo(y)}function ps(p){const y=Qn(t.value).find(A=>A.id===p);y&&(Pe.value={...Pe.value,[p]:y.updatedAtIso},tv(Pe.value),G.value[p]&&(G.value=bt(G.value,p)),gn())}function an(p,y){if(!p)return;const A=X.value[p];if(y){if(m$(A,y))return;X.value={...X.value,[p]:y}}else A&&(X.value=bt(X.value,p))}function _i(p,y,A){if(!p||!y)return;const L={...d.value[p]??{}},H=Number.isFinite(A)?Math.max(0,Math.round(A)):0;H<=0?delete L[y]:L[y]=H,Object.keys(L).length===0?d.value=bt(d.value,p):d.value={...d.value,[p]:L},cf(d.value)}function Ma(p,y){if(!p||y.length===0)return;const A=d.value[p];if(!A)return;const L=new Set(y.map(V=>V.trim()).filter(V=>V.length>0));if(L.size===0)return;const H={};for(const[V,z]of Object.entries(A))L.has(V)||(H[V]=z);Object.keys(H).length!==Object.keys(A).length&&(Object.keys(H).length===0?d.value=bt(d.value,p):d.value={...d.value,[p]:H},cf(d.value))}function En(p,y,A={}){!p||N.value[p]===!0===y||(y?(N.value={...N.value,[p]:!0},ei(p)):(N.value=bt(N.value,p),ni(p,{keepLiveCommands:A.keepDeferredLiveCommands===!0}),Dn(p),Ss(p)?Oa(p):si(p)),gn(),!y&&!_t.hasActiveInProgressThreads()&&_t.hasRemainingThreadPages()&&_t.scheduleRemainingThreadPages())}function Dn(p){p&&(kt.value[p]&&(kt.value=bt(kt.value,p)),It.value[p]&&(It.value=bt(It.value,p)),tn.value[p]&&(tn.value=bt(tn.value,p)))}function Zs(p){p&&(kt.value={...kt.value,[p]:!0},It.value[p]&&(It.value=bt(It.value,p)),tn.value[p]&&(tn.value=bt(tn.value,p)))}function ms(p){p&&kt.value[p]===!0&&It.value[p]===!0&&tn.value[p]===!0&&Dn(p)}function Pi(p,y){!p||!y||kt.value[p]===!0&&Dn(p)}function Ei(p){const y=Object.keys(kt.value);if(y.length===0)return;let A=It.value,L=!1;for(const H of y)!p.has(H)||A[H]===!0||(A={...A,[H]:!0},L=!0);if(L){It.value=A;for(const H of y)ms(H)}}function Mi(p,y){p&&kt.value[p]===!0&&y.some(A=>A.role==="user")&&(tn.value[p]!==!0&&(tn.value={...tn.value,[p]:!0}),ms(p))}function Fn(p){p&&p!==n.value&&G.value[p]!==!0&&(G.value={...G.value,[p]:!0},gn())}function Ft(p,y){if(!p)return;const A=pe.value[p];if(!y){A&&(pe.value=bt(pe.value,p));return}const L=sr(y.label)||"Thinking",H=y.details.map(oe=>sr(oe)).filter(oe=>oe.length>0&&oe!==L),V=Array.from(new Set([...(A==null?void 0:A.details)??[],...H])).slice(-3),z={label:L,details:V};g$(A,z)||(pe.value={...pe.value,[p]:z})}function Wt(p,y,A={}){if(!p)return;const L=Ce.value[p],H=y?os(y):"";if(!H){L&&(Ce.value=bt(Ce.value,p));return}const V=A.transient===!0;(L==null?void 0:L.message)===H&&L.transient===V||(Ce.value={...Ce.value,[p]:{message:H,transient:V}})}function vr(p){var y;p&&(y=Ce.value[p])!=null&&y.transient&&Wt(p,null)}function ar(){const p=Object.entries(Ce.value).filter(([,A])=>A==null?void 0:A.transient).map(([A])=>A);if(p.length===0)return;let y=Ce.value;for(const A of p)y=bt(y,A);Ce.value=y}function qr(p){const y=Qn(t.value).find(A=>A.id===p);return(y==null?void 0:y.updatedAtIso)??""}function vo(p,y){if(!p)return;const A={...co.value};y?A[p]=!0:delete A[p],co.value=A,eO(A)}function aa(){const p=n.value;p&&vo(p,!At.value)}function yr(p,y){const A=o.value[p]??[];xl(A,y)||(o.value={...o.value,[p]:y})}function yo(p,y,A=[],L=[],H=[]){const V=o.value[p]??[],z={id:`optimistic-user:${p}:${Date.now()}`,role:"user",text:y,images:A.length>0?[...A]:void 0,skills:L.length>0?L.map(oe=>({name:oe.name,path:oe.path})):void 0,fileAttachments:H.length>0?H.map(oe=>({...oe})):void 0,messageType:"userMessage.optimistic"};yr(p,[...V,z])}function Gr(p,y){ob(kn,p,y)}function gs(p){VO(kn,p)}function Vr(p,y){JO(kn,p,y)}function wr(p,y){XO(kn,p,y)}function Kr(p,y){QO(kn,p,y)}function Ri(p,y){K.setLiveReasoningText(p,y)}function Li(p,y){K.appendLiveReasoningText(p,y)}function ei(p){K.restoreLiveReasoningSnapshot(p)}function vs(p){fD(vt,p)}function Yr(p,y=!1){hD(vt,p,y)}function wo(p){p&&p in a.value&&(a.value=bt(a.value,p))}function ti(p){p&&p in E.value&&(E.value=bt(E.value,p))}function ji(p){p&&(zr.delete(p),R.value[p]&&(R.value=bt(R.value,p)))}function ni(p,y={}){if(!p)return;wo(p);const A=s.value[p];if(A&&A.messageType==="plan.live"){const L={...A,messageType:"plan",plan:A.plan?{...A.plan,isStreaming:!1}:A.plan};s.value={...s.value,[p]:L},tb(s.value)}Yr(p),L$(p),Ft(p,null),n.value,y.keepLiveCommands===!0&&R.value[p]?zr.add(p):ji(p),Be.value[p]&&(Be.value=bt(Be.value,p)),ra(p)}function Ra(p){if(!p)return;const y=p===n.value;En(p,!1,{keepDeferredLiveCommands:y}),!(!y||typeof window>"u")&&window.setTimeout(()=>{zr.has(p)&&N.value[p]!==!0&&ji(p)},UD)}function Al(p){var fe;if(p.method!=="turn/plan/updated")return null;const y=Ve(p.params),A=Wn(p),L=Re(y==null?void 0:y.turnId)||Re(y==null?void 0:y.turn_id),V=(Array.isArray(y==null?void 0:y.plan)?y==null?void 0:y.plan:[]).map(He=>Ve(He)).map(He=>({step:Re(He==null?void 0:He.step),status:fO(He==null?void 0:He.status)})).filter(He=>He.step.length>0);if(!A||!L)return null;const oe={explanation:Re(y==null?void 0:y.explanation).trim()||void 0,steps:V,isStreaming:!0},me=(fe=ut.value[A])==null?void 0:fe[L];return{threadId:A,message:{id:`${L}:plan`,role:"assistant",text:hO(oe),messageType:"plan.live",plan:oe,turnId:L||void 0,turnIndex:typeof me=="number"?me:void 0}}}function Ni(p){var He;if(p.method!=="item/plan/delta")return null;const y=Ve(p.params),A=Wn(p),L=Re(y==null?void 0:y.turnId)||Re(y==null?void 0:y.turn_id),H=Re(y==null?void 0:y.delta);if(!A||!L||!H)return null;const V=`${L}:plan`,z=(a.value[A]??[]).find(rt=>rt.id===V),oe=`${(z==null?void 0:z.text)??""}${H}`,me=z!=null&&z.plan?{...z.plan,isStreaming:!0}:void 0,fe=(He=ut.value[A])==null?void 0:He[L];return{threadId:A,message:{id:V,role:"assistant",text:oe,messageType:"plan.live",plan:me,turnId:L||void 0,turnIndex:typeof fe=="number"?fe:void 0}}}const kn={liveCommandsByThreadId:R,liveFileChangeMessagesByThreadId:E,liveAgentMessagesByThreadId:i,livePlanMessagesByThreadId:a,lastPlanByThreadId:s},Bn={turnIndexByTurnIdByThreadId:ut,persistedMessagesByThreadId:o,liveFileChangeMessagesByThreadId:E};function bo(p){if(p.method==="server/request"){const y=rb(p.params);return y&&xa(y),!0}if(p.method==="server/request/resolved"){const y=Ve(p.params),A=y==null?void 0:y.id;return typeof A=="number"&&Number.isInteger(A)&&xr(A),!0}return!1}function sr(p){return p.replace(/\s+/gu," ").trim()}function sa(p){return oD(Bn,p)}function C(p,y,A){aD(Bn,p,y,A)}function M(p,y){sD(Bn,p,y)}function x(p,y){return iD(Bn,p,y)}function Z(p){lD(Bn,p)}function Qe(p,y,A){gD(vt,p,y,A)}function qt(p){vD(vt,p)}function Kn(p){var me;if(p.method!=="item/started"&&p.method!=="item/completed")return null;const y=Ve(p.params),A=Ve(y==null?void 0:y.item);if(!A||Re(A.type).toLowerCase()!=="plan")return null;const L=Wn(p),H=Re(y==null?void 0:y.turnId)||Re(y==null?void 0:y.turn_id),V=Re(A.id),z=Re(A.text);if(!L||!V||!z)return null;const oe=L&&H?(me=ut.value[L])==null?void 0:me[H]:void 0;return{threadId:L,message:{id:V,role:"assistant",text:z,messageType:p.method==="item/completed"?"plan":"plan.live",plan:Rw(z)??void 0,turnId:H||void 0,turnIndex:typeof oe=="number"?oe:void 0}}}function br(p){var fe;if(p.method!=="item/started")return null;const y=Ve(p.params),A=Ve(y==null?void 0:y.item);if(!A||A.type!=="commandExecution")return null;const L=Re(A.id),H=Re(A.command);if(!L)return null;const V=typeof A.cwd=="string"?A.cwd:null,z=Wn(p),oe=Re(y==null?void 0:y.turnId)||Re(y==null?void 0:y.turn_id),me=z&&oe?(fe=ut.value[z])==null?void 0:fe[oe]:void 0;return{id:L,role:"system",text:H,messageType:"commandExecution",commandExecution:{command:H,cwd:V,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:oe||void 0,turnIndex:typeof me=="number"?me:void 0}}function sn(p){var tt;if(p.method!=="item/completed")return null;const y=Ve(p.params),A=Ve(y==null?void 0:y.item);if(!A||A.type!=="commandExecution")return null;const L=Re(A.id),H=Re(A.command);if(!L)return null;const V=typeof A.cwd=="string"?A.cwd:null,z=Re(A.status),oe=z==="failed"?"failed":z==="declined"?"declined":z==="interrupted"?"interrupted":"completed",me=typeof A.aggregatedOutput=="string"?A.aggregatedOutput:"",fe=typeof A.exitCode=="number"?A.exitCode:null,He=Wn(p),rt=Re(y==null?void 0:y.turnId)||Re(y==null?void 0:y.turn_id),Ct=He&&rt?(tt=ut.value[He])==null?void 0:tt[rt]:void 0;return{id:L,role:"system",text:H,messageType:"commandExecution",commandExecution:{command:H,cwd:V,status:oe,aggregatedOutput:me,exitCode:fe},turnId:rt||void 0,turnIndex:typeof Ct=="number"?Ct:void 0}}function To(p){var fe;if(p.method!=="item/completed")return null;const y=Ve(p.params),A=Ve(y==null?void 0:y.item);if(!A||A.type!=="fileChange")return null;const L=Re(A.id);if(!L)return null;const H=Re(y==null?void 0:y.threadId),V=Re(y==null?void 0:y.turnId),z=H&&V?(fe=ut.value[H])==null?void 0:fe[V]:void 0,oe=Rf(A.changes),me=rw(A.status);return oe.length===0||me!=="completed"?null:{id:L,role:"system",text:"",messageType:"fileChange",fileChangeStatus:me,fileChanges:oe,turnId:V||void 0,turnIndex:typeof z=="number"?z:void 0}}function So(p,y){ZO(kn,p,y)}function ia(p,y){eD(kn,p,y)}function ys(p,y){tD(kn,p,y)}function $i(p){if(p.method==="item/agentMessage/delta")return!0;const y=Ve(p.params);if(!y)return!1;if(p.method==="item/completed"){const A=Ve(y.item);return(A==null?void 0:A.type)==="agentMessage"}return!1}const ko=new Set;function td(p){for(const y of ko)try{y(p)}catch{}}function Su(p){return ko.add(p),()=>{ko.delete(p)}}function Yn(p,y,A){nD(kn,p,y,A)}function la(p,y,A){rD(kn,p,y,A)}function Co(p){var Hi,Wi,ma,qi,Cs,Ao,Gi,Vi;if(bo(p))return;if(qt(p),p.method==="turn/started"){const Me=Wn(p);Me&&T.delete(Me)}if(zD.has(p.method))return;if(p.method==="app/list/updated"||p.method==="mcpServer/startupStatus/updated"||p.method==="mcpServer/oauthLogin/completed"||p.method==="remoteControl/status/changed"){td(p.method);return}if(p.method==="skills/changed"){jt({force:!0});return}if(p.method==="hook/started"||p.method==="hook/completed"){ze({force:!0});return}if(p.method==="thread/status/changed"){const Me=Wn(p);Me&&Me===n.value&&nn.add(Me);return}if(p.method==="thread/archived"||p.method==="thread/unarchived"||p.method==="thread/deleted"||p.method==="thread/closed")return;if(p.method==="item/fileChange/patchUpdated"||p.method==="turn/diff/updated"){const Me=Ve(p.params),Pt=Re(Me==null?void 0:Me.threadId);Pt&&(p.method==="item/fileChange/patchUpdated"?Yn(Pt,Re(Me==null?void 0:Me.itemId),Rf(Me==null?void 0:Me.changes)):la(Pt,Re(Me==null?void 0:Me.turnId),Re(Me==null?void 0:Me.diff)??""),Pt===n.value&&nn.add(Pt));return}if(p.method==="account/rateLimits/updated"&&pn(),p.method==="thread/name/updated"){const Me=Ve(p.params),Pt=Re(Me==null?void 0:Me.threadId),zn=Re(Me==null?void 0:Me.threadName);if(Pt&&zn){const Gt=Ds(zn);Or.value={...Or.value,[Pt]:Gt},gn(),Sc(Pt,Gt)}}if(p.method==="thread/compacted"){const Me=Ve(p.params),Pt=Re(Me==null?void 0:Me.threadId);Pt&&(Io(Pt,!1),xo(Pt,"done"),nn.add(Pt));return}if(p.method==="fuzzyFileSearch/sessionUpdated"){const Me=Ve(p.params),Pt=Re(Me==null?void 0:Me.sessionId);Pt&&Pt===Ur&&(mr.value=hI(Me));return}if(p.method==="fuzzyFileSearch/sessionCompleted"){const Me=Ve(p.params),Pt=Re(Me==null?void 0:Me.sessionId);Pt&&Pt===Ur&&(Ur="");return}if(p.method==="account/rateLimits/updated"){nr(pw(p.params));return}const y=mO(p);if(y){fs(y.threadId,y.usage);return}const A=yO(p);A&&Ft(A.threadId,A.activity);const L=Wn(p),H=vO(p);!H&&L&&vr(L);const V=wO(p);V&&(Qo.set(V.turnId,V),C(V.threadId,V.turnId,sa(V.threadId)),Be.value={...Be.value,[V.threadId]:V.turnId},Pi(V.threadId,V.turnId),wo(V.threadId),ti(V.threadId),an(V.threadId,null),Wt(V.threadId,null),En(V.threadId,!0),Sn(V.threadId),G.value[V.threadId]&&(G.value=bt(G.value,V.threadId)));const z=bO(p),oe=gO(p),me=(z==null?void 0:z.threadId)??Wn(p),fe=me?xe(me):"",He=!!me&&!!oe&&fe!==Ro&&Yu(new Error(oe));if(z){hn.value[z.threadId];const Me=Qo.get(z.turnId);Me&&Qo.delete(z.turnId);const Pt=Us((Hi=Ve(p.params))==null?void 0:Hi.durationMs)??Us((ma=Ve((Wi=Ve(p.params))==null?void 0:Wi.turn))==null?void 0:ma.durationMs)??(typeof z.startedAtMs=="number"?z.completedAtMs-z.startedAtMs:null)??(Me?z.completedAtMs-Me.startedAtMs:null),zn=typeof Pt=="number"?Math.max(0,Pt):0;an(z.threadId,{turnId:z.turnId,durationMs:zn}),_i(z.threadId,z.turnId,zn),Be.value[z.threadId]&&(Be.value=bt(Be.value,z.threadId)),Ra(z.threadId),Ft(z.threadId,null),Fn(z.threadId),He||(ra(z.threadId),Sn(z.threadId))}if(oe){const Me=(z==null?void 0:z.threadId)||Wn(p);Me&&Wt(Me,oe),r.value=oe,Me&&He&&on(Me)}else z&&Wt(z.threadId,null);if(H){const Me=L,Pt=Me?xe(Me):he.value.trim();Me&&Wt(Me,H.message,{transient:H.transient}),r.value=H.message,Pt!==Ro&&Yu(new Error(H.message))&&(Me?on(Me):Oe())}const rt=Al(p);rt&&(Vr(rt.threadId,rt.message),Ft(rt.threadId,{label:"Planning",details:((qi=rt.message.plan)==null?void 0:qi.steps.map(Me=>Me.step).slice(0,2))??[]}));const Ct=Ni(p);Ct&&(Vr(Ct.threadId,Ct.message),Ft(Ct.threadId,{label:"Planning",details:[]}));const tt=Kn(p);if(tt&&(Vr(tt.threadId,tt.message),Ft(tt.threadId,{label:"Planning",details:((Cs=tt.message.plan)==null?void 0:Cs.steps.map(Me=>Me.step).slice(0,2))??[]})),!L||L!==n.value)return;AO(p);const Rt=_O(p);if(Rt){const Me=(i.value[L]??[]).find(_o=>_o.id===Rt.messageId),Pt=`${(Me==null?void 0:Me.text)??""}${Rt.delta}`,zn=Rt.turnId??(Me==null?void 0:Me.turnId),Gt=zn?(Ao=ut.value[L])==null?void 0:Ao[zn]:Me==null?void 0:Me.turnIndex;wr(L,{id:Rt.messageId,role:"assistant",text:Pt,messageType:"agentMessage.live",turnId:zn,turnIndex:typeof Gt=="number"?Gt:void 0})}const xt=PO(p);if(xt){const Me=xt.turnId?(Gi=ut.value[L])==null?void 0:Gi[xt.turnId]:void 0;wr(L,{...xt,turnIndex:typeof Me=="number"?Me:void 0})}const ft=RO(p);ft&&wr(L,ft),TO(p)&&vs(L);const Ln=SO(p);Ln&&(Li(L,Ln.delta),wD(vt,Ln.itemId,Ln.delta));const Ba=IO(p);if(Ba&&(Qe(L,Ba.itemId,Ba.text),vs(L)),kO(p)){const Me=m.value[L]??"";Me.trim().length>0&&!Me.endsWith(`
75
+
76
+ `)&&Ri(L,`${Me}
77
+
78
+ `)}CO(p);const Ui=br(p);Ui&&(So(L,Ui),Ft(L,{label:"Running command",details:[((Vi=Ui.commandExecution)==null?void 0:Vi.command)??""]}));const El=LO(p);if(El){const Me=(R.value[L]??[]).find(Pt=>Pt.id===El.itemId);Me!=null&&Me.commandExecution&&So(L,{...Me,commandExecution:{...Me.commandExecution,aggregatedOutput:`${Me.commandExecution.aggregatedOutput}${El.delta}`}})}const jr=sn(p);jr&&So(L,jr);const zi=To(p);if(zi&&Kr(L,zi),$i(p)&&Yr(L,!0),p.method==="turn/completed"){Ut=!1,Yr(L),av(vt);const Me=Wn(p);Me&&(oa(Me),Ra(Me),Ft(Me,null),Fn(Me),He||(ra(Me),Sn(Me)))}}function ua(p){if(p.method==="thread/tokenUsage/updated"||p.method.startsWith("thread/realtime/"))return;const y=p.method,A=y==="turn/started"||y==="turn/completed"||y==="error",L=y.startsWith("thread/")||y==="turn/completed";if(!A&&!L)return;const H=Wn(p);H&&A&&nn.add(H),L&&(un=!0,Yo=!0),!(Zt!==null||typeof window>"u")&&(Zt=window.setTimeout(()=>{Zt=null,ir()},Xu))}async function Un(p,y){if(!Jo){Jo=!0;try{if(!y)return;const A=[];for(const L of ed(y)){const H=Ii(L);A.includes(H)||A.push(H)}if(A.length>0){const L=y.projectOrder.length>0?al(A,p):al(ge.value,p);Xa(ge.value,L)||St(L,{persist:!1})}if(Object.keys(y.labels).length>0||(y.remoteProjects??[]).length>0){const L={...Ie.value};let H=!1;for(const[V,z]of Object.entries(y.labels)){const oe=et(V).trim(),me=[Ii(V)];oe&&me.push(oe);for(const fe of me)L[fe]!==z&&(L[fe]=z,H=!0)}for(const V of y.order){const z=Ii(V),oe=to(hl(V));if(!oe.startsWith(".")||oe===z)continue;const me=`${z} ${oe}`;L[z]!==void 0||L[z]===me||(L[z]=me,H=!0)}for(const V of y.remoteProjects??[]){const z=I$(V);L[V.id]!==z&&(L[V.id]=z,H=!0)}H&&dt(L,{persist:!1})}}catch{}}}async function Oi(){try{return await sl()}catch{return null}}function ri(p,y){const A=zf(p,y),L=E$(p,y),H=M$(L,y,A);if(!y||y.order.length===0&&(y.remoteProjects??[]).length===0)return H;const V=new Set;for(const oe of Uf(y,A))V.add(oe);const z=H.filter(oe=>V.has(oe.projectName)?!0:Wf(oe));return P$(z,y,A)}function La(p,y){const A=ri(p,y),L=!!(y&&(y.order.length>0||y.projectOrder.length>0||(y.remoteProjects??[]).length>0)),H=y!=null&&y.projectOrder.length?al(Uf(y,zf(p,y)),A):al(ge.value,A);Xa(ge.value,H)||St(H,{persist:!L});const V=Ff(A,ge.value);Ei(new Set(Qn(V).map(me=>me.id)));const z=C$(t.value,V,N.value);t.value=Ic(t.value,z),N.value=ln(N.value,new Set(Qn(t.value).map(me=>me.id))),new Set(Qn(t.value).map(me=>me.id));const oe={};for(const me of Qn(t.value))oe[me.id]=me.externalSession??U.value[me.id]??null;U.value=oe,gn()}function ku(p){_t.removeThreadFromLoadedLists(p),t.value=zw(t.value,p),N.value=bt(N.value,p),gn()}async function ca(p={}){await Promise.allSettled([Ee({providerChanged:p.providerChanged,includeProviderModels:p.includeProviderModels}),Go(),W(),jt()])}function Jr(p={}){const y=()=>{ca(p)};if(typeof window>"u"){y();return}window.setTimeout(y,0)}async function da(p={}){r.value="",we.value="";const y=p.includeSelectedThreadMessages!==!1,A=p.awaitAncillaryRefreshes===!0;try{if(await ta(),await _t.loadThreads({force:p.forceThreadRefresh===!0}),y)try{await Jt(n.value)}catch(L){r.value=L instanceof Error?L.message:"Unknown application error"}A?await ca({providerChanged:p.providerChanged,includeProviderModels:p.providerChanged===!0||A}):Jr({providerChanged:p.providerChanged,includeProviderModels:!1})}catch(L){r.value=L instanceof Error?L.message:"Unknown application error",Fw(L)?we.value=ab:we.value=""}}async function vn(p){Pn(p);try{return await Jt(p),Ee({includeProviderModels:!0}),jt(),"ok"}catch(y){const A=y instanceof Error?y.message:"Unknown application error";r.value=A;const L=n$(y)?"not-found":"error";return p.trim()&&Wt(p,A,{transient:!0}),L}}async function ws(p){const y=n.value===p,A=y?t$(Qn(e.value),p):"";y&&(Pn(A),A&&Jt(A,{silent:!0}));try{await bA(p),ku(p),await _t.loadThreads(),y&&A&&n.value===A&&await wt(A,{silent:!0})}catch(L){r.value=L instanceof Error?L.message:"Unknown application error"}}async function ja(p,y){const A=y.trim();if(!(!p||!A))try{await kA(p,A),Or.value={...Or.value,[p]:A},gn(),Sc(p,A)}catch(L){r.value=L instanceof Error?L.message:"Unknown application error"}}async function bs(p){var z,oe;const y=p.trim();if(!y)return"";const A=Qn(t.value).find(me=>me.id===y),L=((z=A==null?void 0:A.cwd)==null?void 0:z.trim())??"",H=((oe=A==null?void 0:A.title)==null?void 0:oe.trim())??"Forked chat",V=xe(y);r.value="";try{const me=await Jd(y,L||void 0,V||void 0),fe=me.threadId.trim();return fe?(mo(fe,L,H),D(fe,me.model),st.value={...st.value,[fe]:!0},Pn(fe),await _t.loadThreads(),await Jt(fe),fe):""}catch(me){return r.value=me instanceof Error?me.message:"Unknown application error",""}}async function oi(p,y){var z;const A=p.trim();if(!A||!Number.isInteger(y)||y<0)return"";if(N.value[A]===!0)return r.value="Finish the current turn before forking from a response.","";if(tr.value[A]!==!0)try{await Jt(A)}catch(oe){return r.value=oe instanceof Error?oe.message:"Unknown application error",""}const L=o.value[A]??[];let H=-1;for(const oe of L)typeof oe.turnIndex=="number"&&Number.isFinite(oe.turnIndex)&&(H=Math.max(H,oe.turnIndex));if(H>=0&&y>H)return"";const V=Qn(t.value).find(oe=>oe.id===A)??null;try{r.value="";const oe=WN(L,y),me=oe?await Jd(A,{beforeTurnId:oe}):await Jd(A),fe=me.threadId.trim();if(!fe)return"";const He=me.cwd.trim()||((z=V==null?void 0:V.cwd)==null?void 0:z.trim())||"",rt=R$((V==null?void 0:V.title)||(V==null?void 0:V.preview)||"Untitled thread");if(mo(fe,He,rt),D(fe,me.model),yr(fe,me.messages),tr.value={...tr.value,[fe]:!0},st.value={...st.value,[fe]:!0},wo(fe),Gr(fe,[]),Yr(fe),R.value[fe]&&(R.value=bt(R.value,fe)),an(fe,null),Ft(fe,null),Wt(fe,null),En(fe,!1),!qN(me.messages,oe,y)){const Ct=await Yd(fe,oe);yr(fe,Ct)}return await ja(fe,rt),Pn(fe),_t.loadThreads().catch(()=>{}),fe}catch(oe){return r.value=oe instanceof Error?oe.message:"Unknown application error",""}}async function Ts(p,y,A=[],L=[],H=[]){if(!p||!y.trim()||A.length>0||L.length>0||H.length>0)return!1;const z=(qo.value[p]??[]).filter(fe=>fe.method==="item/tool/requestUserInput");if(z.length!==1)return!1;const[oe]=z,me=zO(oe);return me.length!==1?!1:Da({id:oe.id,result:{answers:{[me[0]]:{answers:[y.trim()]}}}})}function Ss(p){if(Pr.value<=0||bn.value.has(p))return!1;const y=Mt.value[p];return!y||y.remainingContextPercent===null?!1:y.remainingContextPercent<=Pr.value}async function ai(p,y,A,L,H,V){if(ce||Pr.value<=0||N.value[p]===!0)return!1;const z=Mt.value[p];if(!z||z.remainingContextPercent===null||z.remainingContextPercent>Pr.value)return!1;const oe=`stash-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,me=V==="plan"?"plan":V==="default"?"default":P.value;return _r(p,{id:oe,text:y,imageUrls:A,skills:L,fileAttachments:H,collaborationMode:me}),bn.value.has(p)||Oa(p),!0}async function si(p){const y=po(p);if(!y||y.length===0||N.value[p]===!0)return;const A=I(p);ce=!0;try{for(const L of A)try{await Rr(L.text,L.imageUrls,L.skills,"steer",L.fileAttachments,void 0,L.collaborationMode)}catch{}}finally{ce=!1}}function nd(p){return p instanceof Error&&/ActiveTurnNotSteerable|cannot steer a \S+ turn|same-turn steering/i.test(p.message)}function rd(p){return p instanceof Error&&/expected active turn id/i.test(p.message)}async function Di(p,y,A,L,H,V){const z=Be.value[p]??"";if(z)try{await xA(p,z,y,A,L,H),yo(p,y,A,L,H),nn.add(p),await ir(),Wr(p);return}catch(oe){if(nd(oe)){const me=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;Hr(p,{id:me,text:y,imageUrls:A,skills:L,fileAttachments:H,collaborationMode:V==="plan"?"plan":V==="default"?"default":P.value});return}if(!rd(oe))throw oe}yo(p,y,A,L,H),await Na(p,y,A,L,H,V)}async function Rr(p,y=[],A=[],L="steer",H=[],V,z,oe){if(ee.value)return;const me=n.value,fe=p.trim();if(!me||!fe&&y.length===0&&H.length===0||await Ts(me,fe,y,A,H)||await ai(me,fe,y,A,H,z))return;const He=N.value[me]===!0;if(He&&L==="queue"){const rt=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;Hr(me,{id:rt,text:fe,imageUrls:y,skills:A,fileAttachments:H,collaborationMode:z==="plan"?"plan":z==="default"?"default":P.value},V);return}if(He){Ut=!0,Di(me,fe,y,A,H,z).catch(rt=>{const Ct=rt instanceof Error?rt.message:"Unknown application error";Wt(me,Ct),r.value=Ct});return}r.value="",Ut=!0,an(me,null),yo(me,fe,y,A,H),Ft(me,{label:"Thinking",details:$e(xe(me),te.value,z==="plan"?"plan":z==="default"?"default":P.value)}),Wt(me,null),En(me,!0);try{await Na(me,fe,y,A,H,z,oe)}catch(rt){Ut=!1,En(me,!1),Ft(me,null);const Ct=rt instanceof Error?rt.message:"Unknown application error";throw Wt(me,Ct),r.value=Ct,rt}}async function ii(p,y,A=[],L=[],H=[]){if(ee.value)return"";const V=p.trim(),z=y.trim(),oe=xe(ba).trim(),me=P.value;if(!V&&A.length===0&&H.length===0)return"";Br.value=!0,r.value="";let fe="";try{try{const tt=await ig(z||void 0,oe||void 0);fe=tt.threadId,D(fe,tt.model),ne(fe,tt.modelProvider||le.value),ae(fe,me)}catch(tt){if(oe&&oe!==Ro&&Yu(tt)){await Oe();const Rt=await ig(z||void 0,Ro);fe=Rt.threadId,D(fe,Rt.model),ne(fe,Rt.modelProvider||le.value),ae(fe,me)}else throw tt}if(!fe)return"";mo(fe,z,V||"[Image]"),yo(fe,V,A,L,H),Zs(fe),st.value={...st.value,[fe]:!0},Pn(fe),Ut=!0,an(fe,null),Ft(fe,{label:"Thinking",details:$e(xe(fe),te.value,me)}),Wt(fe,null),En(fe,!0);const He=fe,rt=z||null,Ct=V;return Na(fe,V,A,L,H,me).catch(tt=>{Ut=!1,En(fe,!1),Ft(fe,null);const Rt=tt instanceof Error?tt.message:"Unknown application error";Wt(fe,Rt),r.value=Rt}).finally(()=>{Br.value=!1}),zo(He,Ct,rt,A,H),fe}catch(He){Ut=!1,fe&&(En(fe,!1),Ft(fe,null));const rt=He instanceof Error?He.message:"Unknown application error";throw fe&&Wt(fe,rt),r.value=rt,Br.value=!1,He}}async function Na(p,y,A=[],L=[],H=[],V,z){const oe=te.value,me=V==="plan"?"plan":V==="default"?"default":P.value,fe=y.trim(),He=[...A];if(He.length===0&&Vo(fe)){const tt=Ko(p);tt&&He.push(tt)}const rt=L.map(tt=>({name:tt.name,path:tt.path})),Ct=H.map(tt=>({...tt}));Xs(p,{text:fe,imageUrls:[...He],skills:rt,fileAttachments:Ct,effort:oe,collaborationMode:me,fallbackRetried:!1});try{if(st.value[p]!==!0){const xt=De(p),ft=await Nf(p);ft.model&&!xt&&D(p,Je(p,ft.model,ft.modelProvider)),ft.modelProvider&&ne(p,ft.modelProvider),st.value={...st.value,[p]:!0}}const tt=xe(p);let Rt="";try{Rt=await Qd(p,y,He,tt||void 0,oe||void 0,L.length>0?L:void 0,H,me,...z?[z]:[])}catch(xt){if(tt&&tt!==Ro&&Yu(xt))await Oe(p),Xs(p,{text:fe,imageUrls:[...He],skills:rt,fileAttachments:Ct,effort:oe,collaborationMode:me,fallbackRetried:!0}),Rt=await Qd(p,y,He,Ro,oe||void 0,L.length>0?L:void 0,H,me,...z?[z]:[]);else throw xt}Rt&&(Be.value={...Be.value,[p]:Rt},Pi(p,Rt)),nn.add(p),await ir(),Wr(p)}catch(tt){throw tt}}async function _l(){const p=n.value;if(!p||N.value[p]!==!0||kt.value[p]===!0)return;let y=Be.value[p];if(!y){const{activeTurnId:V}=await jf(p);y=V,y&&(Be.value={...Be.value,[p]:y})}if(!y)throw new Error("Could not determine active turn id for interrupt");const A=ds.value.filter(V=>V.turnId===y),L=A.find(V=>V.role==="user"&&V.isAgentNote!==!0),H=A.some(V=>{if(V.role==="assistant")return!0;const z=V.messageType??"";return z==="commandExecution"||z==="toolCall"||z==="worked"||z==="fileChange"||z==="plan"||z==="plan.live"||z==="compaction.done"||z==="turnError"});On.value=!0,r.value="";try{if(await IA(p,y),En(p,!1),Ft(p,null),Wt(p,null),Be.value[p]&&(Be.value=bt(Be.value,p)),nn.add(p),un=!0,await ir(),L&&!H){const V=(o.value[p]??[]).filter(oe=>oe.turnId!==y);yr(p,V);const z=u.value[p];if(z){const oe=z.filter(me=>me.turnId!==y);oe.length!==z.length&&(u.value={...u.value,[p]:oe},Wl(u.value))}$n.value={...$n.value,[p]:{text:L.text??"",imageUrls:L.images??[],fileAttachments:(L.fileAttachments??[]).map(oe=>({label:oe.label,path:oe.path,fsPath:oe.fsPath??oe.path})),skills:L.skills??[]}}}}catch(V){const z=V instanceof Error?V.message:"Failed to interrupt active turn";Wt(p,z),r.value=z}finally{On.value=!1}}function Cu(p){p&&$n.value[p]&&($n.value=bt($n.value,p))}async function Mn(p,y){if(!y)throw new Error("Cannot roll back: failed to resolve the turn id where the removal starts");return await Yd(p,y)}async function Lr(p,y){if(!p||!y||N.value[p]===!0||y===(Be.value[p]??""))return!1;let A;try{A=await CA(p)}catch{return!1}return A.complete&&!A.turnIds.includes(y)}function Tr(p,y){const A=o.value[p]??[],L=A.filter(z=>{var oe;return(((oe=z.turnId)==null?void 0:oe.trim())??"")!==y});L.length!==A.length&&yr(p,L);const H=u.value[p];if(!H)return;const V=H.filter(z=>{var oe;return(((oe=z.turnId)==null?void 0:oe.trim())??"")!==y});V.length!==H.length&&(u.value={...u.value,[p]:V},Wl(u.value))}function od(p,y,A){const L=u.value[p];if(!L||L.length===0)return;const H=new Set(y.map(z=>z.trim()).filter(z=>z.length>0)),V=L.filter(z=>{var fe;const oe=((fe=z.turnId)==null?void 0:fe.trim())??"";if(oe&&H.has(oe))return!1;const me=z.turnIndex;return!(A>=0&&typeof me=="number"&&Number.isFinite(me)&&me>=A)});V.length!==L.length&&(u.value={...u.value,[p]:V},Wl(u.value))}async function ks(p){var A,L,H,V,z;const y=n.value;if(y&&!An.value&&p.trim()){An.value=!0,r.value="";try{N.value[y]===!0&&await _l();const oe=o.value[y]??[],me=oe.find(xt=>xt.turnId===p),fe=oe.reduce((xt,ft)=>typeof ft.turnIndex=="number"&&ft.turnIndex>xt?ft.turnIndex:xt,-1);if(fe<0)return;let He=typeof(me==null?void 0:me.turnIndex)=="number"?me.turnIndex:((A=ut.value[y])==null?void 0:A[p])??-1;(He<0||He>fe)&&(console.warn(`[rollback] turn ${p} not resolvable (index=${He}), clamping to newest turn`),He=fe);let rt=((L=me==null?void 0:me.turnId)==null?void 0:L.trim())??"";if(!rt&&He>=0){const xt=ut.value[y]??{};rt=Object.keys(xt).find(ft=>xt[ft]===He)??""}if(!rt){const xt=oe.reduce((ft,Rn)=>{const Ln=typeof Rn.turnIndex=="number"?Rn.turnIndex:-1,Ba=ft!==null&&typeof ft.turnIndex=="number"?ft.turnIndex:-1;return Ln>=0&&Ln>Ba?Rn:ft},null);rt=((H=xt==null?void 0:xt.turnId)==null?void 0:H.trim())??""}if(await Lr(y,rt)){console.warn(`[rollback] ${y}: turn ${rt} is already gone on the server; reconciling locally instead of sending thread/revert`),Tr(y,rt),nv(y),Ma(y,[rt]),un=!0;try{await Jt(y,{force:!0}),await ir()}catch{}return}const Ct=await Mn(y,rt),tt=((z=(V=ho.value)==null?void 0:V.cwd)==null?void 0:z.trim())??"";if(tt){const xt=await oP(y,p,tt);xt.errors.length>0&&console.warn(`[rollback] file revert for ${y} left errors: ${xt.errors.join("; ")}`)}const Rt=oe.filter(xt=>typeof xt.turnIndex=="number"&&xt.turnIndex>=He).map(xt=>{var ft;return((ft=xt.turnId)==null?void 0:ft.trim())??""}).filter(xt=>xt.length>0);yr(y,Ct),nv(y),Gr(y,[]),Yr(y),od(y,[...Rt,rt],He),Ma(y,[...Rt,rt]),R.value[y]&&(R.value=bt(R.value,y)),an(y,null),Ft(y,null),Wt(y,null),un=!0,await ir()}catch(oe){const me=oe instanceof Error?oe.message:"Failed to rollback thread";r.value=me,Wt(y,me);try{await Jt(y,{force:!0})}catch{}}finally{An.value=!1}}}function xo(p,y){const L=(l.value[p]??[]).filter(H=>H.messageType!=="compaction.pending"&&H.messageType!=="compaction.done");L.push({id:`compaction:${y}:${p}:${Date.now()}`,role:"system",text:"",messageType:y==="pending"?"compaction.pending":"compaction.done"}),l.value={...l.value,[p]:L}}function Io(p,y){const A=new Set(bn.value);y?A.add(p):A.delete(p),bn.value=A}function $a(p){Ur=p.trim(),mr.value=[]}async function Oa(p){const y=p.trim();if(!(!y||bn.value.has(y))){Io(y,!0),xo(y,"pending");try{await SA(y);const A=2e3,L=14,H=Date.now()+Ia;let V=0;for(;Date.now()<H&&V<L&&bn.value.has(y);){if((await jf(y)).messages.some(me=>me.messageType==="compaction.done")){Io(y,!1),n.value===y&&await Jt(y,{silent:!0,force:!0}),xo(y,"done"),si(y);break}V+=1,await e$(A)}bn.value.has(y)&&(Io(y,!1),xo(y,"done"),si(y))}catch(A){r.value=A instanceof Error?A.message:"Failed to compact thread",Io(y,!1),xo(y,"done"),si(y)}}}async function ir(){if(Bt.value){typeof window<"u"&&Zt===null&&(Zt=window.setTimeout(()=>{Zt=null,ir()},Xu));return}Bt.value=!0;const p=un,y=Yo,A=new Set(nn);un=!1,Yo=!1,nn.clear();try{p&&await _t.loadThreads({force:y});const L=n.value;if(!L)return;const H=A.has(L),V=N.value[L]===!0,z=qr(L),oe=Sa.value[L]??"";(z.length>0&&z!==oe||H||V&&tr.value[L]!==!0||p&&tr.value[L]!==!0)&&await Jt(L,{silent:!0,force:H})}catch{}finally{Bt.value=!1,(un||nn.size>0)&&typeof window<"u"&&Zt===null&&(Zt=window.setTimeout(()=>{Zt=null,ir()},Xu))}}async function Fi(){await Wo(),un=!_t.hasLoadedThreads.value,n.value&&tr.value[n.value]!==!0&&nn.add(n.value),await ir()}function li(p){const y=Ve(p.params),A=typeof(y==null?void 0:y.threadId)=="string"?y.threadId.trim():"";if(!A)return;const L=Ve(y==null?void 0:y.externalSession),H=L&&typeof L.origin=="string"&&L.origin.trim().length>0?{origin:L.origin.trim(),active:L.active===!0,lastWriteAt:typeof L.lastWriteAt=="string"?L.lastWriteAt:null}:null;U.value={...U.value,[A]:H},En(A,(H==null?void 0:H.active)===!0),gn(),un=!0,n.value===A&&nn.add(A),Zt===null&&typeof window<"u"&&(Zt=window.setTimeout(()=>{Zt=null,ir()},Xu))}function fa(){typeof window>"u"||Tn||(Wo(),Pl(),ha(),Tn=YA(p=>{if(p.method==="ready"){ar(),Fi();return}if(p.method==="externalSessionChanged"){li(p);return}Co(p),ua(p)}))}async function Pl(){try{const p=await r_(),y=Object.entries(p);if(y.length===0)return;const A={...u.value};let L=!1;for(const[H,V]of y){const z=V.filter(He=>!!He&&typeof He.id=="string");if(z.length===0)continue;const oe=A[H]??[],me=new Set(oe.map(He=>He.text)),fe=[...oe];for(const He of z)me.has(He.text)||(fe.push(He),me.add(He.text));A[H]=fe.slice(-20),L=!0}L&&(u.value=A,Wl(A))}catch{}}async function ha(){try{const p=await a_(),y=Object.entries(p);if(y.length===0)return;const A={...d.value};let L=!1;for(const[H,V]of y){if(!H||!V||typeof V!="object"||Array.isArray(V))continue;const z={};for(const[fe,He]of Object.entries(V))!fe||typeof He!="number"||!Number.isFinite(He)||He<=0||(z[fe]=Math.round(He));if(Object.keys(z).length===0)continue;const oe={...A[H]??{},...z},me=Object.keys(oe);A[H]=me.length>200?Object.fromEntries(me.slice(-200).map(fe=>[fe,oe[fe]])):oe,L=!0}L&&(d.value=A,eb(p),cf(A))}catch{}}async function Da(p){try{return await JA(p.id,{result:p.result,error:p.error}),xr(p.id),Fr.value=bt(Fr.value,String(p.id)),!0}catch(y){const A=y instanceof Error?y.message:"Failed to reply to server request";return await Ca(p.id)?(r.value=A,Fr.value={...Fr.value,[String(p.id)]:A},!1):(xr(p.id),Fr.value=bt(Fr.value,String(p.id)),!0)}}function Jn(){if(Tn&&(Tn(),Tn=null),un=!1,nn.clear(),Qo.clear(),Zt!==null&&typeof window<"u"&&(window.clearTimeout(Zt),Zt=null),Ar(),_t.dispose(),typeof window<"u")for(const p of gr.values())window.clearTimeout(p);gr.clear(),Ut=!1,o.value={},a.value={},i.value={},m.value={},u.value={},d.value={},R.value={},E.value={},ut.value={},pe.value={},X.value={},Ce.value={},Be.value={},k.clear(),av(vt),T.clear(),j$(),kt.value={},It.value={},tn.value={},Zo(),nr(null),Mt.value={}}function Fa(p){const y=n.value;if(!y)return;const A=or(y,p);if(A){gt(p),ue(A.collaborationMode),ce=!0,Rr(A.text,A.imageUrls,A.skills,"steer",A.fileAttachments).finally(()=>{ce=!1});return}const L=ea(y,p);L&&(gt(p),ue(L.collaborationMode),Rr(L.text,L.imageUrls,L.skills,"steer",L.fileAttachments))}function Bi(p,y={}){Pn(p,y)}return{projectGroups:e,projectDisplayNameById:Ie,selectedThread:ho,selectedThreadTokenUsage:_a,selectedThreadTerminalOpen:At,isSelectedThreadInterruptPending:rn,selectedThreadServerRequests:cs,selectedLiveOverlay:Mr,selectedActiveTurnId:Qt,lastPlanByThreadId:s,resolveThreadTurnIndex:x,codexQuota:pr,selectedThreadId:n,availableCollaborationModes:We,availableModelIds:ye,availableModelReasoningEfforts:_e,selectedCollaborationMode:P,selectedModelId:he,selectedReasoningEffort:te,selectedSpeedMode:Ae,codexCliMissingError:we,installedSkills:Q,accountRateLimitSnapshots:Ir,messages:ds,hasMoreOlderMessages:na,isLoadingThreads:_t.isLoadingThreads,isThreadListFullyLoaded:_t.isThreadListFullyLoaded,isLoadingMessages:Uo,slowOpenThreadId:ka,isLoadingOlderMessages:Pa,isSendingMessage:Br,isInterruptingTurn:On,isUpdatingSpeedMode:ee,isRollingBack:An,compactingThreadIds:bn,fuzzyFileSearchResults:mr,registerFuzzyFileSearchSession:$a,error:r,refreshAll:da,refreshSkills:jt,refreshHooks:ze,hooksList:$,isHooksLoading:ke,onRealtimeEvent:Su,selectThread:vn,loadMessages:Jt,loadOlderMessages:so,ensureThreadMessagesLoaded:wt,setThreadTerminalOpen:vo,toggleSelectedThreadTerminal:aa,archiveThreadById:ws,compactThreadById:Oa,renameThreadById:ja,forkThreadById:bs,forkThreadFromTurn:oi,rollbackSelectedThread:ks,sendMessageToSelectedThread:Rr,sendMessageToNewThread:ii,interruptSelectedThreadTurn:_l,interruptedUnsubmittedMessage:cn,clearInterruptedUnsubmittedMessage:Cu,selectedThreadQueuedMessages:Aa,removeQueuedMessage:gt,reorderQueuedMessage:_n,steerQueuedMessage:Fa,autoCompactThreshold:Pr,setAutoCompactThreshold:Vn,setSelectedCollaborationMode:ue,readModelIdForThread:xe,setSelectedModelIdForThread:nt,injectModelSwitchDivision:hs,invalidateThreadContextWindow:Ea,setSelectedModelId:Xe,setSelectedReasoningEffort:de,updateSelectedSpeedMode:Le,respondToPendingServerRequest:Da,pendingReplyErrorForRequest:us,renameProject:qe,removeProject:Ne,reorderProject:Ge,pinProjectToTop:Ke,startPolling:fa,stopPolling:Jn,primeSelectedThread:Bi}}const lb="codex-web-local.sidebar-collapsed.v1",ub="codex-web-local.accounts-section-collapsed.v1";function qD(){return typeof window>"u"?!1:window.localStorage.getItem(lb)==="1"}function GD(e){typeof window>"u"||window.localStorage.setItem(lb,e?"1":"0")}function VD(){if(typeof window>"u")return!0;const e=window.localStorage.getItem(ub);return e===null?!0:e==="1"}function KD(){const e=S(qD()),t=S(VD()),n=S(""),r=S(!1),o=S(null),a=S(null);let s=0,i=0,l=!1;function u(E){var N;if(e.value!==E){if(E){const q=(N=f())==null?void 0:N.scrollTop;typeof q=="number"&&(q>0||s===0)&&(s=q)}e.value=E,GD(E),E||T()}}function d(){r.value=!r.value,r.value?Et(()=>{var E;return(E=a.value)==null?void 0:E.focus()}):n.value=""}function m(){var E;n.value="",(E=a.value)==null||E.focus()}function f(){return o.value?o.value:typeof document>"u"?null:document.querySelector(".mobile-drawer .sidebar-scrollable, .sidebar-scrollable")}function v(E){if(e.value||l)return;const q=(E==null?void 0:E.currentTarget)&&typeof HTMLElement<"u"&&E.currentTarget instanceof HTMLElement?E.currentTarget:f();s=(q==null?void 0:q.scrollTop)??s}function T(){const E=++i,N=s,q=90;l=!0;const K=()=>{E===i&&(s=N,l=!1)},U=ce=>{if(E!==i)return;if(e.value){K();return}const G=f();if(G&&(G.scrollTop=N,Math.abs(G.scrollTop-N)<=1||ce>=q)){K();return}if(ce>=q||typeof window>"u"){K();return}window.requestAnimationFrame(()=>U(ce+1))};Et(()=>U(0))}function k(E){E.key==="Escape"&&(r.value=!1,n.value="")}function R(){t.value=!t.value,!(typeof window>"u")&&window.localStorage.setItem(ub,t.value?"1":"0")}return{isSidebarCollapsed:e,isAccountsSectionCollapsed:t,sidebarSearchQuery:n,isSidebarSearchVisible:r,sidebarScrollableRef:o,sidebarSearchInputRef:a,setSidebarCollapsed:u,toggleSidebarSearch:d,clearSidebarSearch:m,onSidebarScroll:v,onSidebarSearchKeydown:k,restoreSidebarScrollPosition:T,toggleAccountsSectionCollapsed:R}}const cb="codex-web-local.right-panel-width.v1",YD=260,JD=640,iv=320;function db(e){return Math.min(JD,Math.max(YD,e))}function QD(){if(typeof window>"u")return iv;const e=window.localStorage.getItem(cb),t=Number(e);return Number.isFinite(t)?db(t):iv}function XD(e){typeof window>"u"||window.localStorage.setItem(cb,String(e))}function ZD(e){const{isMobile:t,canShowRightPanel:n,isVirtualKeyboardOpen:r}=e,o=S("git"),a=S([]),s=S(""),i=Y(()=>a.value.find(we=>we.key===s.value)??null),l=S(!1),u=S(!1),d=S(!1),m=S(QD()),f=S(!1),v=S(!1);let T=null;function k(){T&&(clearTimeout(T),T=null)}function R(){f.value=!1,v.value=!1,k()}function E(we){we.preventDefault();const ee=we.clientX,he=m.value,te=Oe=>{const $e=ee-Oe.clientX;m.value=db(he+$e)},Ae=()=>{XD(m.value),window.removeEventListener("mousemove",te),window.removeEventListener("mouseup",Ae)};window.addEventListener("mousemove",te),window.addEventListener("mouseup",Ae)}function N(){n()&&(t()&&!u.value&&(u.value=!0),t()||(d.value=!1),o.value=o.value==="terminal"?"git":"terminal",o.value!=="terminal"&&R())}function q(we){o.value=we,l.value=!1,t()||(d.value=!1),t()&&(u.value=!0),we!=="terminal"&&R()}function K(we){const ee=a.value.find(he=>he.path===we.path);if(ee)s.value=ee.key;else{const he={key:`preview-${Date.now()}`,path:we.path,label:we.label};a.value=[...a.value,he],s.value=he.key}q("preview")}function U(we){a.value.some(ee=>ee.key===we)&&(s.value=we,q("preview"))}function ce(we){const ee=a.value.findIndex(Ae=>Ae.key===we);if(ee<0)return;const he=a.value.filter(Ae=>Ae.key!==we);if(a.value=he,s.value!==we)return;if(he.length===0){s.value="",o.value="files";return}const te=he[Math.min(ee,he.length-1)];s.value=te.key}function G(){if(t()){u.value=!1;return}d.value=!0,l.value=!1,R()}function le(){if(t()){u.value=!u.value;return}d.value=!d.value,d.value&&(l.value=!1,R())}function ye(){o.value="git",t()&&(u.value=!1),R()}function _e(we){if(f.value=we,!we){v.value=!1,k();return}v.value=!0,k(),T=setTimeout(()=>{T=null,r()||(v.value=!1)},1500)}return{activeRightPanelTab:o,filePreviewTabs:a,activeFilePreviewTabKey:s,activeFilePreviewTab:i,isRightPanelMenuOpen:l,isMobileRightPanelOpen:u,isRightPanelCollapsed:d,rightPanelWidth:m,isTerminalInputFocused:f,isTerminalKeyboardFocusFallbackActive:v,onRightResizeHandleMouseDown:E,toggleRightPanelTerminal:N,selectRightPanelTab:q,onOpenFilePreview:K,selectFilePreviewTab:U,closeFilePreviewTab:ce,onCloseRightPanel:G,onToggleRightPanelToggle:le,onHideRightPanelTerminal:ye,onTerminalFocusChange:_e,resetTerminalKeyboardFocusState:R,clearTerminalKeyboardFocusFallbackTimer:k}}function eF(e){if(typeof document>"u")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.left="-9999px",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.focus(),t.select(),t.setSelectionRange(0,e.length);try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function lv(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!eF(e))throw new Error("Copy failed")}const tF=400;function nF(e,t,n,r){return e==="visible"&&!n&&t!==null&&r-t>=tF}function rF(e){if(!e||/[\r\n]/u.test(e)||e.endsWith("/")||e.endsWith("\\")||/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(e))return!1;const t=e.startsWith("/"),n=/^[A-Za-z]:[\\/]/u.test(e),r=e.startsWith("./")||e.startsWith("../")||e.startsWith("~/");return t||n||r||/^[A-Za-z0-9._@() -]+\.[A-Za-z0-9]{1,12}$/u.test(e)?!0:/^[A-Za-z0-9._@() -]+(?:[\\/][A-Za-z0-9._@() -]+)+$/u.test(e)}function Pc(e){return e.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||e}function Ec(e){return e.replace(/\\/gu,"/")}function fb(e){if(!e.startsWith("file://"))return e;let t=e.replace(/^file:\/\//u,"");try{t=decodeURIComponent(t)}catch{}return/^\/[A-Za-z]:\//u.test(t)&&(t=t.slice(1)),t}function oF(e){const t=Ec(e),n=t.match(/^\/Users\/([^/]+)/u);if(n)return`/Users/${n[1]}`;const r=t.match(/^\/home\/([^/]+)/u);return r?`/home/${r[1]}`:""}function Zu(e){const t=Ec(e);if(!t)return t;let n="",r=t;const o=r.match(/^([A-Za-z]:)(\/.*)?$/u);o?(n=`${o[1]}/`,r=(o[2]??"").replace(/^\/+/u,"")):r.startsWith("/")&&(n="/",r=r.slice(1));const a=r.split("/").filter(Boolean),s=[];for(const l of a)if(l!=="."){if(l===".."){s.length>0&&s.pop();continue}s.push(l)}const i=s.join("/");return n?`${n}${i}`.replace(/\/+$/u,"")||n:i||t}function ZU(e,t){const n=Ec(fb(e.trim()));if(!n)return"";if(n.startsWith("/")||/^[A-Za-z]:\//u.test(n))return Zu(n);if(n.startsWith("~/")){const a=oF(t);if(a)return Zu(`${a}/${n.slice(2)}`)}const o=Ec(t.trim());return Zu(o?`${o.replace(/\/+$/u,"")}/${n}`:n)}function Mc(e){let t=e,n="",r="";const o={"(":")","[":"]","{":"}","<":">",'"':'"',"'":"'","`":"`","“":"”","‘":"’"};for(;t.length>0;){const a=t[0],s=Object.prototype.hasOwnProperty.call(o,a)?o[a]:"";if(!s||!t.endsWith(s))break;n+=a,r+=s,t=t.slice(1,-1)}return{core:t,leading:n,trailing:r}}function Rc(e){if(!e)return null;let t=e.trim();t=Mc(t).core.trim();let r=null;const o=t.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(o)t=o[1],r=Number(o[2]);else{const a=t.match(/^(.*):(\d+)(?::\d+)?$/u);a&&(t=a[1],r=Number(a[2]))}return t=fb(t),rF(t)?{path:t,line:r}:null}function uv(e,t,n){let r=0,o=t-1;for(;o>=n&&e[o]==="*";)r+=1,o-=1;return r}function aF(e,t){let n=0,r=t;for(;r<e.length&&e[r]==="*";)n+=1,r+=1;return n}function hb(e,t,n,r,o){const a=uv(e,t,r);return a<2?null:aF(e,n)>=a?{segmentStart:t-a,segmentEnd:n+a,tokenEndTrim:0}:uv(o,o.length,0)>=a?{segmentStart:t-a,segmentEnd:n,tokenEndTrim:a}:null}function Qf(e){const t=e.trim();if(!t.startsWith("[")||!t.endsWith(")"))return null;const n=t.indexOf("]");if(n<=1||t[n+1]!=="(")return null;const r=t.slice(1,n).trim(),o=t.slice(n+2,-1).trim();if(r.includes(`
79
+ `)||o.includes(`
80
+ `))return null;const a=Mc(r).core.trim()||r,s=Mc(o).core.trim();return s?{label:a,target:s}:null}function Lc(e){const t=e.trim().match(/^codex:\/\/threads\/([A-Za-z0-9-]+)$/u);if(!t)return null;if(typeof window>"u")return`/#/thread/${t[1]}`;const n=window.location.pathname.replace(/\/?$/u,"/");return`${window.location.origin}${n}#/thread/${t[1]}`}function ez(e){const t=Math.min(6,Math.max(1,Math.trunc(e)));return`h${String(t)}`}function tz(e){switch(Math.min(6,Math.max(1,Math.trunc(e)))){case 1:return"message-heading-h1";case 2:return"message-heading-h2";case 3:return"message-heading-h3";case 4:return"message-heading-h4";case 5:return"message-heading-h5";default:return"message-heading-h6"}}function sF(e){const t=e.trim();if(!t)return"";if(t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/codex-local-image?"))return t;if(t.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(t)}`;const n=t.startsWith("/"),r=/^[A-Za-z]:[\\/]/u.test(t);return n||r?`/codex-local-image?path=${encodeURIComponent(t)}`:t}function vl(e,t={}){const n=[],r=/codex:\/\/threads\/[A-Za-z0-9-]+|https?:\/\/[^\s<>"'`,。;:!?、()[\]{}「」『』《》]+|file:\/\/[^\n<>"'`,。;:!?、[\]{}「」『』《》]+|["'](?:[A-Za-z]:[\\/]|~\/|\.{1,2}\/|\/)[^\n"']+["']|`(?:[A-Za-z]:[\\/]|~\/|\.{1,2}\/|\/)[^`\n]+`/gu;let o=0;for(const a of e.matchAll(r)){if(typeof a.index!="number")continue;const s=a.index,i=s+a[0].length;let l=a[0],u="";for(;/[.,;:!?,。;:!?、]$/u.test(l);)u=l.slice(-1)+u,l=l.slice(0,-1);const d=hb(e,s,i,o,l),m=(d==null?void 0:d.segmentStart)??s,f=(d==null?void 0:d.segmentEnd)??i;m>o&&n.push({kind:"text",value:e.slice(o,m)}),d!=null&&d.tokenEndTrim&&(l=l.slice(0,-d.tokenEndTrim));const v=Mc(l);l=v.core;const T=v.leading,k=v.trailing+u;T&&n.push({kind:"text",value:T});const R=Lc(l);if(R)n.push({kind:"url",value:R,href:R}),k&&n.push({kind:"text",value:k});else if(l.startsWith("**")&&l.endsWith("**")&&l.length>4)n.push({kind:"bold",value:l.slice(2,-2)}),k&&n.push({kind:"text",value:k});else if(/^https?:\/\//u.test(l))n.push({kind:"url",value:l,href:l}),k&&n.push({kind:"text",value:k});else{const E=Rc(l);E?(n.push({kind:"file",value:l,path:E.path,displayPath:l,downloadName:Pc(E.path)}),k&&n.push({kind:"text",value:k})):n.push({kind:"text",value:a[0]})}o=f}return o<e.length&&n.push({kind:"text",value:e.slice(o)}),t.applyMarkdownMarkers===!1?n:pb(n)}function hf(e,t){const n=[];let r=!1,o="";const a=s=>{s&&n.push({kind:"text",value:s})};for(const s of e){if(s.kind!=="text"){r&&(a(`${t.marker}${o}`),r=!1,o=""),n.push(s);continue}let i=s.value;for(;i.length>0;){const l=i.indexOf(t.marker);if(l<0){r?o+=i:a(i);break}const u=i.slice(0,l);if(r?o+=u:a(u),i=i.slice(l+t.marker.length),r){const d=o;d.length>0&&(!t.isValidContent||t.isValidContent(d))?n.push({kind:t.kind,value:d}):a(`${t.marker}${d}${t.marker}`),o="",r=!1}else r=!0}}return r&&a(`${t.marker}${o}`),n}function pb(e){const t=r=>r.trim().length>0&&!/^\s/u.test(r)&&!/\s$/u.test(r);let n=hf(e,{marker:"**",kind:"bold",isValidContent:t});return n=hf(n,{marker:"~~",kind:"strikethrough",isValidContent:t}),n=hf(n,{marker:"*",kind:"italic",isValidContent:t}),n}function iF(e,t={}){const n=[];let r=0,o=0;const a=(s,i)=>{let l=s.indexOf("[",i);for(;l>=0;){const u=s.indexOf("]",l+1);if(u<0)return null;if(s[u+1]!=="("){l=s.indexOf("[",l+1);continue}let d=1,m=u+2,f=!1;for(;m<s.length;){const v=s[m];if(v===`
81
+ `){f=!0;break}if(v==="("&&(d+=1),v===")"&&(d-=1,d===0)){const T=s.slice(l,m+1);if(Qf(T))return{start:l,end:m+1,token:T};break}m+=1}if(f){l=s.indexOf("[",l+1);continue}l=s.indexOf("[",l+1)}return null};for(;o<e.length;){const s=a(e,o);if(!s)break;const{start:i,end:l,token:u}=s,d=hb(e,i,l,r,u),m=(d==null?void 0:d.segmentStart)??i,f=(d==null?void 0:d.segmentEnd)??l;m>r&&n.push(...vl(e.slice(r,m),t));const v=Qf(u);if(!v){n.push(...vl(e.slice(m,f),t)),r=f,o=f;continue}const T=v.label,k=v.target,R=Lc(k);if(R)n.push({kind:"url",value:T||R,href:R});else if(/^https?:\/\//u.test(k))n.push({kind:"url",value:T||k,href:k});else{const E=Rc(k);E?n.push({kind:"file",value:k,path:E.path,displayPath:T||k,downloadName:Pc(E.path)}):n.push({kind:"text",value:u})}r=f,o=f}return r<e.length&&n.push(...vl(e.slice(r),t)),n}function nz(e){const t=e.includes("`"),n=iF(e,{applyMarkdownMarkers:!t});if(!t)return n;if(!n.some(o=>o.kind==="text"&&o.value.includes("`")))return pb(n);const r=o=>{if(!o.includes("`"))return vl(o);const a=[];let s=0,i=0;for(;s<o.length;){if(o[s]!=="`"){s+=1;continue}let l=1;for(;s+l<o.length&&o[s+l]==="`";)l+=1;const u="`".repeat(l);let d=s+l,m=-1;for(;d<o.length;){const v=o.indexOf(u,d);if(v<0)break;const T=v>0&&o[v-1]==="`",k=v+l<o.length&&o[v+l]==="`",R=o.slice(s+l,v).includes(`
82
+ `);if(!T&&!k&&!R){m=v;break}d=v+1}if(m<0){s+=l;continue}s>i&&a.push(...vl(o.slice(i,s)));const f=o.slice(s+l,m);if(f.length>0){const v=Qf(f);if(v){const T=Lc(v.target);if(T)a.push({kind:"url",value:v.label||T,href:T});else if(/^https?:\/\//u.test(v.target))a.push({kind:"url",value:v.label||v.target,href:v.target});else{const k=Rc(v.target);k?a.push({kind:"file",value:v.target,path:k.path,displayPath:v.label||v.target,downloadName:Pc(k.path)}):a.push({kind:"code",value:f})}}else{const T=Lc(f);if(T)a.push({kind:"url",value:T,href:T});else if(/^https?:\/\/[^\s]+$/u.test(f))a.push({kind:"url",value:f,href:f});else{const k=Rc(f);if(k){const R=k.line?`${k.path}:${String(k.line)}`:k.path;a.push({kind:"file",value:f,path:k.path,displayPath:R,downloadName:Pc(k.path)})}else a.push({kind:"code",value:f})}}}else a.push({kind:"text",value:`${u}${u}`});s=m+l,i=s}return i<o.length&&a.push(...vl(o.slice(i))),a};return n.flatMap(o=>o.kind==="text"?r(o.value):[o])}function mb(e){return e.replace(/\r\n/gu,`
83
+ `)}function Za(e){var n;return(((n=e.match(/^\s*/u))==null?void 0:n[0])??"").replace(/\t/gu," ").length}function gb(e,t){if(t<=0)return e.trimStart();let n=0,r=0;for(;n<e.length&&r<t;){const o=e[n];r+=o===" "?4:1,n+=1}return e.slice(n)}function es(e){return e.trim().length===0}function Xf(e){const t=e.match(/^\s{0,3}(#{1,6})\s+(.+)$/u);return t?{level:t[1].length,value:t[2].trim()}:null}function lc(e){const t=e.match(/^\s{0,3}>\s?(.*)$/u);return t?t[1]??"":null}function du(e){var n;const t=e.match(/^\s*[-*+]\s+(.+)$/u);return((n=t==null?void 0:t[1])==null?void 0:n.trim())??null}function lF(e){var n;const t=e.match(/^(\s*)[-*+]\s+(.+)$/u);return t?{indent:Za(t[1]??""),text:((n=t[2])==null?void 0:n.trim())??""}:null}function fu(e){var n;const t=e.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.+)$/u);return t?{checked:(t[1]??" ").toLowerCase()==="x",text:((n=t[2])==null?void 0:n.trim())??""}:null}function cv(e){var n;const t=e.match(/^(\s*)[-*+]\s+\[([ xX])\]\s+(.+)$/u);return t?{indent:Za(t[1]??""),item:{checked:(t[2]??" ").toLowerCase()==="x",text:((n=t[3])==null?void 0:n.trim())??""}}:null}function vb(e){var n;const t=e.match(/^(\s*)(\d+)[.)]\s+(.+)$/u);return t?{indent:Za(t[1]??""),start:Number.parseInt(t[2]??"1",10)||1,text:((n=t[3])==null?void 0:n.trim())??""}:null}function Zf(e){var t;return((t=vb(e))==null?void 0:t.text)??null}function dv(e){return vb(e)}function eh(e){const t=e.trim();if(!t.includes("|"))return null;let n=t;n.startsWith("|")&&(n=n.slice(1)),n.endsWith("|")&&(n=n.slice(0,-1));const r=[];let o="",a=0;for(let s=0;s<n.length;s+=1){const i=n[s];if(i==="\\"&&n[s+1]==="|"){o+="|",s+=1;continue}if(i==="`"){let l=1;for(;n[s+l]==="`";)l+=1;o+=n.slice(s,s+l),a===0?a=l:a===l&&(a=0),s+=l-1;continue}if(i==="|"&&a===0){r.push(o.trim()),o="";continue}o+=i}return r.push(o.trim()),r.some(s=>s.length>0)?r:null}function uF(e){const t=eh(e);if(!t||t.length===0)return null;const n=t.map(r=>{const o=r.replace(/\s+/gu,"");if(!/^:?-{3,}:?$/u.test(o))return null;const a=o.startsWith(":"),s=o.endsWith(":");return a&&s?"center":s?"right":a?"left":null});return n.every((r,o)=>r!==null||/^-+$/u.test(t[o].replace(/\s+/gu,"")))?n:null}function fv(e,t){return e.length===t?e:e.length>t?e.slice(0,t):[...e,...Array.from({length:t-e.length},()=>"")]}function hv(e,t){var d;if(t+1>=e.length)return null;const n=e[t],r=e[t+1],o=eh(n),a=uF(r);if(!o||!a||o.length!==a.length)return null;const s=n.trim();if(!s.startsWith("|")&&(((d=s.match(/\|/gu))==null?void 0:d.length)??0)<2)return null;const i=o.length,l=[];let u=t+2;for(;u<e.length&&!es(e[u]);){const m=eh(e[u]);if(!m)break;l.push(fv(m,i)),u+=1}return{kind:"table",headers:fv(o,i),rows:l,alignments:a}}function cF(e){return es(e)||jc(e)!==null||th(e)||Xf(e)!==null||lc(e)!==null||fu(e)!==null||du(e)!==null||Zf(e)!==null}function dF(e,t,n=-1){const r=[];let o=t;for(;o<e.length&&!(cF(e[o])||n>=0&&Za(e[o])<=n);)r.push(n>=0?gb(e[o],n+1):e[o]),o+=1;const a=r.join(`
84
+ `).trim();return a?{value:a,nextIndex:o}:null}function yb(e,t){for(let n=t;n<e.length;n+=1)if(!es(e[n]))return n;return-1}function fF(e,t,n,r=null,o=!1){const a=[];let s=t;for(;s<e.length;){const i=e[s];if(es(i)){const m=yb(e,s+1);if(m===-1){a.push(""),s=e.length;break}const f=r==null?void 0:r(e[m]);if(f&&f.indent===n||Za(e[m])<=n)break;a.push(""),s+=1;continue}const l=r==null?void 0:r(i);if(l&&l.indent===n)break;const u=Za(i),d=o&&(fu(i)!==null||du(i)!==null);if(u<=n&&!d)break;a.push(u>n?gb(i,n+1):i.trimStart()),s+=1}for(;a.length>0&&es(a[0]);)a.shift();for(;a.length>0&&es(a[a.length-1]);)a.pop();return a.length===0?null:{blocks:uc(a.join(`
85
+ `)),nextIndex:s}}function pv(e,t,n,r=!1){const o=[];let a=t;const s=n(e[t]);if(!s)return null;const i=s.indent;for(;a<e.length;){const l=n(e[a]);if(l===null||l.indent!==i)break;const u=[l.text],d=[];for(a+=1;a<e.length;){if(es(e[a])){const k=yb(e,a+1);if(k===-1){a=e.length;break}const R=n(e[k]);if(R&&R.indent===i){a=k;break}if(Za(e[k])<=i){a=k;break}a+=1;continue}const m=n(e[a]);if(m&&m.indent===i)break;const f=Za(e[a])>i,v=r&&(fu(e[a])!==null||du(e[a])!==null);if(f||v){const k=fF(e,a,i,n,r);if(k){d.push(...k.blocks),a=k.nextIndex;continue}}if(Za(e[a])<=i)break;const T=dF(e,a,i);if(!T)break;u.push(T.value),a=T.nextIndex}o.push(d.length>0?{paragraphs:u,children:d}:{paragraphs:u})}return o.length>0?{items:o,nextIndex:a}:null}function th(e){return/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(e.trim())}const wb="^\\s{0,3}(```+|~~~+)\\s*([^\\s`~][^`]*)?\\s*$",hF=new RegExp(wb,"u"),mv=new RegExp(wb,"gmu");function jc(e){const t=e.match(hF);return t?{marker:t[1],language:(t[2]??"").trim()}:null}function pF(e){return e?(mv.lastIndex=0,mv.test(e.replace(/\r\n/gu,`
86
+ `))):!1}function uc(e){var a;const n=mb(e).split(`
87
+ `),r=[];let o=0;for(;o<n.length;){if(es(n[o])){o+=1;continue}const s=jc(n[o]);if(s){o+=1;const k=[];for(;o<n.length;){if(n[o].trim()===s.marker){o+=1;break}k.push(n[o]),o+=1}r.push({kind:"codeBlock",language:s.language,value:k.join(`
88
+ `)});continue}if(th(n[o])){r.push({kind:"thematicBreak"}),o+=1;continue}const i=Xf(n[o]);if(i){r.push({kind:"heading",level:i.level,value:i.value}),o+=1;continue}if(lc(n[o])!==null){const k=[];for(;o<n.length;){const R=lc(n[o]);if(R===null)break;k.push(R),o+=1}r.push({kind:"blockquote",value:k.join(`
89
+ `).trim()});continue}const u=hv(n,o);if(u){r.push(u),o+=2+u.rows.length;continue}if(fu(n[o])!==null){const k=[],R=((a=cv(n[o]))==null?void 0:a.indent)??0;for(;o<n.length;){const E=cv(n[o]);if(E===null||E.indent!==R)break;k.push(E.item),o+=1}if(k.length>0){r.push({kind:"taskList",items:k});continue}}const m=du(n[o]);if(m!==null){const k=pv(n,o,lF);if(k){r.push({kind:"unorderedList",items:k.items}),o=k.nextIndex;continue}if(m.length>0){r.push({kind:"unorderedList",items:[{paragraphs:[m]}]}),o+=1;continue}}const f=Zf(n[o]);if(f!==null){const k=dv(n[o]),R=pv(n,o,dv,!0);if(R){r.push({kind:"orderedList",items:R.items,start:(k==null?void 0:k.start)??1}),o=R.nextIndex;continue}if(f.length>0){r.push({kind:"orderedList",items:[{paragraphs:[f]}],start:(k==null?void 0:k.start)??1}),o+=1;continue}}const v=[];for(;o<n.length&&!(es(n[o])||jc(n[o])||th(n[o])||Xf(n[o])||hv(n,o)||lc(n[o])!==null||fu(n[o])!==null||du(n[o])!==null||Zf(n[o])!==null);)v.push(n[o]),o+=1;const T=v.join(`
90
+ `).trim();T&&r.push({kind:"paragraph",value:T})}return r}function mF(e){if(!e.includes("![")||!e.includes("]("))return uc(e);const t=[],n=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let r=0;for(const o of e.matchAll(n)){const[a,s,i]=o;if(typeof o.index!="number")continue;const l=o.index,u=l+a.length,d=sF(i.trim());d&&(l>r&&t.push(...uc(e.slice(r,l))),t.push({kind:"image",url:d,alt:s.trim(),markdown:a}),r=u)}return r<e.length&&t.push(...uc(e.slice(r))),t}function gF(e){const n=mb(e).split(`
91
+ `),r=[];let o=0,a=0;const s=i=>{if(i<=a)return;const l=n.slice(a,i).join(`
92
+ `);r.push(...mF(l))};for(;o<n.length;){const i=jc(n[o]);if(!i){o+=1;continue}s(o),o+=1;const l=[];for(;o<n.length;){if(n[o].trim()===i.marker){o+=1;break}l.push(n[o]),o+=1}r.push({kind:"codeBlock",language:i.language,value:l.join(`
93
+ `)}),a=o}return s(n.length),r.length>0?r:[{kind:"paragraph",value:e}]}function bb(e){return e.role==="assistant"&&!(e.messageType==="commandExecution"&&e.commandExecution)&&e.messageType!=="worked"&&!(e.messageType??"").endsWith(".live")}function Tb(e,t){for(const n of e){if(n.kind==="codeBlock"){t.push({language:n.language,value:n.value});continue}if(n.kind==="unorderedList"||n.kind==="orderedList")for(const r of n.items)r.children&&r.children.length>0&&Tb(r.children,t)}}function vF(e){const t=e.text;if(!t||!t.trim())return[];const n=[];return Tb(gF(t),n),n}function yF(e,t=bb){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(t(r)&&pF(r.text??""))return!0}return!1}function wF(e,t=bb){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(!t(r))continue;const o=vF(r),a=o[o.length-1];if(a)return{messageId:r.id,turnIndex:typeof r.turnIndex=="number"?r.turnIndex:null,language:a.language,value:a.value}}return null}const bF=[[/(gmail|google calendar|google docs|google sheets|google drive|github|slack|notion|linear|outlook|supabase)/i,140],[/(email|calendar|document|sheet|drive|repo|issue|message|project|database|crm|deploy)/i,50]];function Sb(e){return e.trim().toLowerCase()}function TF(e,t){return t.reduce((n,[r,o])=>n+(r.test(e)?o:0),0)}function gv(e){return e.activeCount*1e3+(e.isNoAuth?300:0)+e.toolsCount*3+e.triggersCount*4+TF(`${e.name} ${e.slug} ${e.description}`,bF)}function SF(e,t){const n=Sb(t);if(!n)return 0;const r=e.name.toLowerCase(),o=e.slug.toLowerCase();return r===n||o===n?1e6:r.replace(/\s+/gu,"")===n.replace(/\s+/gu,"")?9e5:r.startsWith(n)||o.startsWith(n)?8e5:r.includes(n)||o.includes(n)?7e5:0}function tl(e){return e.activeCount>0?0:e.totalConnections>0?1:e.isNoAuth?2:3}function rz(e,t,n=""){const r=Sb(n),o=a=>SF(a,r);return t==="name"?[...e].sort((a,s)=>o(s)-o(a)||tl(a)-tl(s)||a.name.localeCompare(s.name)):t==="date"?[...e].sort((a,s)=>o(s)-o(a)||tl(a)-tl(s)||a.name.localeCompare(s.name)):[...e].sort((a,s)=>o(s)-o(a)||tl(a)-tl(s)||gv(s)-gv(a)||a.name.localeCompare(s.name))}function kF(e,t){var a;const n=e.lastIndexOf(":"),r=n>=0?e.slice(n+1):e,o=t.find(s=>s.name===e)??t.find(s=>s.name===r||s.name.endsWith(`:${r}`));return((a=o==null?void 0:o.path)==null?void 0:a.trim())??""}function CF(e,t){const n=[];for(const r of e){const o=r.name.trim();if(!o)continue;const a=(r.path??"").trim()||kF(o,t);a&&n.push({name:o,path:a})}return n}const xF={class:"sidebar-root"},IF=["aria-pressed","aria-label","title"],AF={key:1,class:"sidebar-search-bar"},_F=["placeholder"],PF=["aria-label"],EF={class:"sidebar-skills-link-icon","aria-hidden":"true"},MF={class:"sidebar-skills-link-copy"},RF={class:"sidebar-skills-link-title"},LF={class:"sidebar-skills-link-subtitle"},jF={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},NF={class:"sidebar-skills-link-copy"},$F={class:"sidebar-skills-link-title"},OF={class:"sidebar-skills-link-subtitle"},DF={class:"sidebar-settings-actions"},FF=["title","aria-label"],BF=["title","aria-label"],UF={class:"content-root-wrap"},zF={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},HF={key:1,class:"skills-route-header-icon","aria-hidden":"true"},WF={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},qF=["aria-label","title"],GF=["aria-label","title"],VF={class:"content-body"},KF={key:2,class:"content-grid content-grid-home"},YF={class:"new-thread-empty"},JF={class:"new-thread-hero"},QF=["title"],XF={class:"new-thread-folder-actions"},ZF=["disabled"],eB={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},tB={class:"new-thread-launch-card-copy"},nB={class:"new-thread-launch-card-topline"},rB={class:"new-thread-launch-card-badge","aria-hidden":"true"},oB={class:"new-thread-launch-card-eyebrow"},aB={class:"new-thread-launch-card-title"},sB={class:"new-thread-launch-card-text"},iB={class:"new-thread-launch-card-actions"},lB=["aria-label","onKeydown"],uB={class:"new-thread-open-folder-header"},cB={class:"new-thread-open-folder-title"},dB={class:"new-thread-open-folder-label"},fB={class:"new-thread-open-folder-current"},hB=["placeholder","title","disabled","onKeydown"],pB=["disabled"],mB={class:"new-thread-open-folder-actions"},gB={class:"new-thread-open-folder-toggle"},vB=["aria-pressed","disabled"],yB={key:0,class:"new-thread-open-folder-create"},wB={class:"new-thread-open-folder-create-composer"},bB=["placeholder","onKeydown"],TB=["disabled"],SB={key:0,class:"new-thread-open-folder-error visible-error-with-feedback"},kB=["href"],CB=["placeholder","onKeydown"],xB={key:1,class:"new-thread-open-folder-error-actions"},IB={class:"new-thread-open-folder-error visible-error-with-feedback"},AB=["href"],_B=["disabled"],PB={key:2,class:"new-thread-open-folder-status"},EB={key:3,class:"new-thread-open-folder-status"},MB={key:4,class:"new-thread-open-folder-list"},RB=["title","disabled","onClick"],LB={class:"new-thread-open-folder-item-name"},jB=["disabled","onClick"],NB=["aria-label","onKeydown"],$B={class:"new-thread-open-folder-header"},OB={class:"new-thread-open-folder-title"},DB=["disabled"],FB=["aria-label"],BB=["aria-selected","disabled"],UB=["aria-selected","disabled"],zB={class:"new-thread-project-field"},HB={class:"new-thread-open-folder-label"},WB=["disabled","placeholder"],qB={key:0,class:"new-thread-project-field"},GB={class:"new-thread-open-folder-label"},VB=["disabled","placeholder","onKeydown"],KB={key:1,class:"new-thread-project-field"},YB={class:"new-thread-open-folder-label"},JB=["disabled","onKeydown"],QB={key:2,class:"new-thread-open-folder-error visible-error-with-feedback"},XB=["href"],ZB={class:"new-thread-project-modal-actions"},e2=["disabled"],t2=["disabled"],n2={key:3,class:"new-thread-branch-select"},r2={class:"new-thread-branch-select-label"},o2={class:"new-thread-branch-select-help"},a2={key:4,class:"new-thread-runtime-help"},s2={class:"worktree-init-status-title"},i2={class:"worktree-init-status-message"},l2={class:"composer-with-queue"},u2={key:0,class:"composer-runtime-error",role:"alert"},c2=["href"],d2={key:3,class:"content-grid"},f2={class:"content-thread"},h2={key:0,class:"external-session-banner",role:"alert"},p2={key:1,class:"composer-runtime-error",role:"alert"},m2=["href"],g2={key:2,class:"interrupt-recovered-banner",role:"status"},v2=["aria-label"],y2={class:"content-right-panel-header"},w2={class:"content-right-panel-tabs",role:"tablist"},b2=["aria-selected"],T2=["aria-selected"],S2=["aria-selected","title","onClick"],k2={class:"content-right-panel-tab-label"},C2=["aria-label","title","onClick"],x2={class:"content-right-panel-actions"},I2={class:"content-right-panel-add-wrap"},A2=["aria-label","title"],_2={key:0,class:"content-right-panel-menu"},P2=["aria-label","title"],E2={class:"content-right-panel-body"},M2={key:2,class:"project-zip-modal-backdrop",role:"presentation"},R2=["aria-label"],L2={class:"project-zip-modal-header"},j2={class:"project-zip-modal-title"},N2=["aria-label","disabled"],$2={class:"project-zip-modal-copy"},O2={class:"project-zip-progress-label",role:"status","aria-live":"polite"},D2={class:"project-zip-progress-track"},F2={key:0,class:"project-zip-modal-error",role:"alert"},B2={class:"project-zip-modal-actions"},U2=["disabled"],z2=["disabled"],H2=["disabled"],W2=["aria-label"],q2={class:"codex-login-modal-header"},G2={class:"codex-login-modal-title"},V2=["aria-label","disabled"],K2={class:"codex-login-modal-copy"},Y2=["href"],J2=["placeholder","disabled"],Q2={key:1,class:"codex-login-modal-error visible-error-with-feedback"},X2=["href"],Z2={class:"codex-login-modal-actions"},eU=["disabled"],tU=["disabled"],nU=400,vv="codex-web-local.send-with-enter.v1",yv="codex-web-local.in-progress-send-mode.v1",wv="codex-web-local.dark-mode.v1",bv="codex-web-local.dictation-click-to-toggle.v1",Tv="codex-web-local.dictation-auto-send.v1",Sv="codex-web-local.dictation-language.v1",kv="codex-web-local.chat-width.v1",rU=fn({__name:"App",setup(e){var Hp,Wp;const t=Eo(()=>Mo(()=>import("./ThreadConversation-BiyKia_7.js"),__vite__mapDeps([0,1,2]))),n=Eo(()=>Mo(()=>import("./ThreadTerminalPanel-BlisDnyv.js"),__vite__mapDeps([3,4]))),r=Eo(()=>Mo(()=>import("./ReviewPane-BzcuGGZz.js"),__vite__mapDeps([5,6]))),o=Eo(()=>Mo(()=>import("./DirectoryHub-CbWz81wr.js"),__vite__mapDeps([7,1,8]))),a=Eo(()=>Mo(()=>import("./AutomationsPanel-BrxpYd3F.js"),__vite__mapDeps([9,10]))),s=Eo(()=>Mo(()=>import("./SettingsDialog-D34lKAxd.js"),__vite__mapDeps([11,12]))),i=Eo(()=>Mo(()=>import("./RightGitPanel-BsVCibLZ.js"),__vite__mapDeps([13,14]))),l=Eo(()=>Mo(()=>import("./RightFilesPanel-mG5aaeVI.js"),__vite__mapDeps([15,16]))),u=Eo(()=>Mo(()=>import("./RightFilePreview-BRXbHofi.js"),__vite__mapDeps([17,18]))),d=Eo(()=>Mo(()=>import("./ThreadPendingRequestPanel-Bg_3qi-T.js"),__vite__mapDeps([19,20]))),m=Eo(()=>Mo(()=>import("./QueuedMessages-BYByp2ES.js"),__vite__mapDeps([21,22]))),{t:f,uiLanguage:v,uiLanguageOptions:T,setUiLanguage:k}=ao(),R="codex-mobile",E="0.1.136",N={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},q={en:"english",zh:"chinese",de:"german",es:"spanish",ru:"russian",ko:"korean",fr:"french",ja:"japanese",pt:"portuguese",tr:"turkish",pl:"polish",ca:"catalan",nl:"dutch",ar:"arabic",sv:"swedish",it:"italian",id:"indonesian",hi:"hindi",fi:"finnish",vi:"vietnamese",he:"hebrew",uk:"ukrainian",el:"greek",ms:"malay",cs:"czech",ro:"romanian",da:"danish",hu:"hungarian",ta:"tamil",no:"norwegian",th:"thai",ur:"urdu",hr:"croatian",bg:"bulgarian",lt:"lithuanian",la:"latin",mi:"maori",ml:"malayalam",cy:"welsh",sk:"slovak",te:"telugu",fa:"persian",lv:"latvian",bn:"bengali",sr:"serbian",az:"azerbaijani",sl:"slovenian",kn:"kannada",et:"estonian",mk:"macedonian",br:"breton",eu:"basque",is:"icelandic",hy:"armenian",ne:"nepali",mn:"mongolian",bs:"bosnian",kk:"kazakh",sq:"albanian",sw:"swahili",gl:"galician",mr:"marathi",pa:"punjabi",si:"sinhala",km:"khmer",sn:"shona",yo:"yoruba",so:"somali",af:"afrikaans",oc:"occitan",ka:"georgian",be:"belarusian",tg:"tajik",sd:"sindhi",gu:"gujarati",am:"amharic",yi:"yiddish",lo:"lao",uz:"uzbek",fo:"faroese",ht:"haitian creole",ps:"pashto",tk:"turkmen",nn:"nynorsk",mt:"maltese",sa:"sanskrit",lb:"luxembourgish",my:"myanmar",bo:"tibetan",tl:"tagalog",mg:"malagasy",as:"assamese",tt:"tatar",haw:"hawaiian",ln:"lingala",ha:"hausa",ba:"bashkir",jw:"javanese",su:"sundanese",yue:"cantonese"},{projectGroups:K,projectDisplayNameById:U,selectedThread:ce,selectedThreadTokenUsage:G,selectedThreadServerRequests:le,selectedLiveOverlay:ye,lastPlanByThreadId:_e,resolveThreadTurnIndex:we,selectedActiveTurnId:ee,codexQuota:he,selectedThreadId:te,availableCollaborationModes:Ae,availableModelIds:Oe,availableModelReasoningEfforts:$e,selectedCollaborationMode:De,selectedReasoningEffort:Se,selectedSpeedMode:Te,codexCliMissingError:xe,installedSkills:Ee,accountRateLimitSnapshots:Je,messages:Xe,hasMoreOlderMessages:nt,isLoadingThreads:de,isThreadListFullyLoaded:D,isLoadingMessages:ne,slowOpenThreadId:se,isLoadingOlderMessages:Le,isSendingMessage:We,isInterruptingTurn:P,isSelectedThreadInterruptPending:j,isUpdatingSpeedMode:W,error:ue,refreshAll:ae,refreshSkills:ie,refreshHooks:Pe,hooksList:je,isHooksLoading:Ie,onRealtimeEvent:ge,selectThread:Ke,ensureThreadMessagesLoaded:Ne,loadMessages:qe,loadOlderMessages:Ge,archiveThreadById:dt,compactThreadById:St,compactingThreadIds:st,fuzzyFileSearchResults:ut,registerFuzzyFileSearchSession:X,forkThreadById:pe,renameThreadById:Ce,forkThreadFromTurn:Be,sendMessageToSelectedThread:yt,sendMessageToNewThread:wt,interruptSelectedThreadTurn:Dt,interruptedUnsubmittedMessage:Uo,clearInterruptedUnsubmittedMessage:Jt,selectedThreadQueuedMessages:so,removeQueuedMessage:tr,reorderQueuedMessage:Sa,steerQueuedMessage:io,autoCompactThreshold:Ys,setAutoCompactThreshold:ka,setSelectedCollaborationMode:is,readModelIdForThread:Or,setSelectedModelIdForThread:ls,injectModelSwitchDivision:Dr,invalidateThreadContextWindow:zo,setSelectedReasoningEffort:Ho,updateSelectedSpeedMode:Js,respondToPendingServerRequest:Wo,pendingReplyErrorForRequest:Fr,renameProject:us,removeProject:Ca,reorderProject:qo,pinProjectToTop:lo,startPolling:uo,stopPolling:xr,primeSelectedThread:cs,rollbackSelectedThread:xa}=WD(),vt=Kx(),kt=Vx(),{isMobile:It}=xh();function tn(){return typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}const $n=S(null),hn=S(null),Ir=S(null);let pr=null;const{buildFeedbackMailto:Go,feedbackMailtoBase:pn,recordVisibleFailure:nr}=Iw(),Ar=pn();function Mt(c,h){h&&nr(h);const b=c.currentTarget;b instanceof HTMLAnchorElement&&(b.href=Go())}const co=S(null),rr=S(null),wn=S(null),Br=S(0);let On=null;function An(){const c=wn.value;if(!c)return;const h=window.getComputedStyle(c),b=Number.parseFloat(h.paddingLeft)+Number.parseFloat(h.paddingRight),F=Math.max(0,c.clientWidth-(Number.isFinite(b)?b:0)),J=h.getPropertyValue("--chat-column-max").trim(),be=Number.parseFloat(J)*(J.endsWith("rem")?16:1),Ue=Number.isFinite(be)&&be>0?Math.min(F,be):F;Br.value=Ue}const bn=S(null),Ia=S(null),mr=S(!0),Ur=ZD({isMobile:()=>It.value,canShowRightPanel:()=>Ml.value,isVirtualKeyboardOpen:()=>Rl.value}),{activeRightPanelTab:Bt,filePreviewTabs:fo,activeFilePreviewTabKey:Vo,activeFilePreviewTab:Ko,isRightPanelMenuOpen:Tn,isMobileRightPanelOpen:Zt,isRightPanelCollapsed:gr,rightPanelWidth:un,isTerminalInputFocused:Yo,isTerminalKeyboardFocusFallbackActive:nn,onRightResizeHandleMouseDown:zr,toggleRightPanelTerminal:Jo,selectRightPanelTab:Ut,onOpenFilePreview:Qo,selectFilePreviewTab:Xo,closeFilePreviewTab:_t,onCloseRightPanel:mn,onToggleRightPanelToggle:ho,onHideRightPanelTerminal:_r,onTerminalFocusChange:Pr,resetTerminalKeyboardFocusState:Zo,clearTerminalKeyboardFocusFallbackTimer:Hr}=Ur,ea=S(null),or=S(!1),po=S("");let ta=!1;const Er=S(!1),gt=S(""),_n=S("local"),Sn=S({}),Aa=new Map,Vn=S(""),I=S([]),$=S(!1),Q=S({order:[],labels:{},projectOrder:[]}),ke=S({phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""}),ze=S({phase:"idle",title:"",message:""}),jt=KD(),{isSidebarCollapsed:At,isAccountsSectionCollapsed:rn,sidebarSearchQuery:Qt,isSidebarSearchVisible:Mr,sidebarScrollableRef:_a,sidebarSearchInputRef:ds,setSidebarCollapsed:cn,toggleSidebarSearch:na,clearSidebarSearch:Pa,onSidebarScroll:Qs,onSidebarSearchKeydown:Pn,toggleAccountsSectionCollapsed:fs}=jt,Xs=S(null),hs=S(null),Ea=S(null),ra=S(null);let on=null,oa=0,Wr=0,gn=0,mo=0;const go=S("New Project (1)"),ps=S(""),an=S(!1),_i=S("general");let Ma=0;function En(){if(an.value){Ma=Date.now(),an.value=!1;return}Date.now()-Ma<nU||(an.value=!0)}const Dn=S(!1),Zs=S(!1),ms=S(new Set);async function Pi(){try{ms.value=new Set(await FA())}catch{}finally{Zs.value=!0}}const Ei=Y(()=>!Zs.value||Hg(ms.value,zg.hooks)),Mi=Y(()=>!Zs.value||Hg(ms.value,zg.remoteControl));ot(an,c=>{c&&(Pe(),ei(),Mi.value&&ti())});const Fn=S({enabled:!1,clients:[]}),Ft=S(null),Wt=S(!1),vr=S(!1),ar=S(""),qr=S(""),vo=S("");let aa=null,yr=!1,yo=null;const Gr=S("never"),gs=S(!1),Vr=S(!1),wr=S(""),Kr=S("");let Ri=!1;const Li=S(!1);async function ei(c={}){if(!(c.force!==!0&&Ri)){gs.value=!0,wr.value="";try{Gr.value=await b_(),Ri=!0}catch(h){wr.value=h instanceof Error?h.message:"Failed to load approval policy"}finally{gs.value=!1}}}function vs(c){Gr.value=c}async function Yr(){Vr.value=!0,wr.value="",Kr.value="";try{await T_(Gr.value),Li.value=!0,Kr.value=f("Approval policy saved"),wo&&clearTimeout(wo),wo=setTimeout(()=>{Kr.value=""},2200)}catch(c){wr.value=c instanceof Error?c.message:"Failed to save approval policy"}finally{Vr.value=!1}}let wo=null;async function ti(c={}){if(!(c.force!==!0&&yr)){Wt.value=!0,qr.value="";try{const h=await w_();Fn.value=h,yr=!0}catch(h){qr.value=h instanceof Error?h.message:"Failed to load remote control status"}finally{Wt.value=!1}}}async function ji(){const c=!Fn.value.enabled;vr.value=!0,ar.value=c?"enable":"disable";try{await S_(c),Fn.value={...Fn.value,enabled:c},Ni(c?"Remote control enabled":"Remote control disabled")}catch(h){qr.value=h instanceof Error?h.message:"Failed to update remote control"}finally{vr.value=!1,ar.value=""}}async function ni(){vr.value=!0,ar.value="pairing";try{Ft.value=await k_()}catch(c){qr.value=c instanceof Error?c.message:"Failed to start pairing"}finally{vr.value=!1,ar.value=""}}async function Ra(){vr.value=!0,ar.value="clients";try{Fn.value={...Fn.value,clients:await C_()}}catch(c){qr.value=c instanceof Error?c.message:"Failed to load remote clients"}finally{vr.value=!1,ar.value=""}}async function Al(c){vr.value=!0,ar.value=`revoke:${c}`;try{await x_(c),Fn.value={...Fn.value,clients:Fn.value.clients.filter(h=>h.clientId!==c)},Ni("Remote client removed")}catch(h){qr.value=h instanceof Error?h.message:"Failed to remove remote client"}finally{vr.value=!1,ar.value=""}}function Ni(c){vo.value=c,aa&&clearTimeout(aa),aa=setTimeout(()=>{vo.value=""},3e3)}const kn=S(""),Bn=S(""),bo=S([]),sr=S(null),sa=S(null),C=S(null),M=S(null),x=S(!1),Z=S(!1),Qe=S({addedLineCount:0,removedLineCount:0}),qt=S([]),Kn=S(""),br=S({}),sn=S(""),To=S(""),So=S({}),ia=S(""),ys=S(""),$i=S(!1),ko=S(!1);function td(c,h){return`${c}\0${h?"with-reset-history":"without-reset-history"}`}const Su=S(null),Yn=S([]),la=S(!1),Co=S(!1),ua=S(!1),Un=S(!1),Oi=S(!1),ri=S(""),La=S(""),ku=S(null),ca=S(""),Jr=S(""),da=S(""),vn=S(""),ws=S(xd(vv,!0)),ja=S($0()),bs=S(N0()),oi=S(O0()),Ts=S(xd(bv,!1)),Ss=S(xd(Tv,!0)),ai=S(Y0()),si=Y(()=>J0()),nd=Y(()=>{const{loaded:c,total:h}=ke.value,b=ip(c);return h&&h>0?`${b} / ${ip(h)}`:c>0?b:f("Preparing...")}),rd=Y(()=>{const{loaded:c,total:h,phase:b}=ke.value;return b==="ready"?"100%":!h||h<=0?c>0?"55%":"20%":`${Math.min(100,Math.max(5,Math.round(c/h*100)))}%`}),Di=S(!1),Rr=S(!1),ii=S(!1),Na=S(""),_l=S(!1),Cu=S(null),Mn=S(!1),Lr=S(""),Tr=S("codex"),od=Y(()=>[{value:"codex",label:f("Codex")},{value:"openrouter",label:f("OpenRouter")},{value:"opencode-zen",label:f("OpenCode Zen")},{value:"custom",label:f("Custom endpoint")}]),ks=S(""),xo=S(""),Io=S("responses"),$a=S("responses"),Oa=S(""),ir=S(!1),Fi=S(""),li=S(""),fa=S(""),Pl=S(!1),ha=S(!1),Da=S(""),Jn=S(""),Fa=S(!1),Bi=S(!1),p=S("create"),y=S(""),A=S(""),L=S(""),H=S(!1),V=S(""),z=S(!1),oe=S(null),me=S(null),fe=S(!1),He=S(null),rt=S(null),Ct=S(""),tt=S(""),Rt=S(""),xt=S([]),ft=S(""),Rn=S(!1),Ln=S(!1),Ba=S(!1),pa=S(""),Ui=[ue,xe,Kn,To,vn,Lr,fa,Jn,V,ft],El=Y(()=>Ui.some(c=>c.value.trim().length>0)),jr=S({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),zi=S(null),Hi=S(!1),Wi=S(!1),ma=S(typeof window<"u"?((Hp=window.visualViewport)==null?void 0:Hp.height)??window.innerHeight:0),qi=S(typeof window<"u"?((Wp=window.visualViewport)==null?void 0:Wp.offsetTop)??0:0),Cs=S(typeof window<"u"?window.innerHeight:0);let Ao=null,Gi=!1,Vi=!1,Me=!1,Pt=0;const zn=Y(()=>{const c=vt.params.threadId;return typeof c=="string"?c:""}),Gt=Y(()=>vt.name==="home"),_o=Y(()=>vt.name==="skills"),xs=Y(()=>vt.name==="automations"),Fh=Y(()=>{const c=vt.query.automationId;return typeof c=="string"?c:""}),kb=Y(()=>{var c;return xs.value?f("Automations"):_o.value?f("Skills"):Gt.value?f("Start new thread"):((c=ce.value)==null?void 0:c.title)??f("Choose a thread")}),Cb=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",xb=Y(()=>{var h,b;return(((b=(h=ce.value)==null?void 0:h.title)==null?void 0:b.trim())??"")||Cb}),Ua=Y(()=>Xe.value.filter(c=>{const h=Bp(c.messageType,c.role);return h==="worked"?!0:!(h==="turnActivity.live"||h==="turnError.live"||h==="agentReasoning.live")})),ad=S([]);ot(()=>[Ua.value,ne.value],([c,h])=>{h||(ad.value=c)},{immediate:!0});const Ib=Y(()=>ne.value&&ad.value.length>0?ad.value:Ua.value),Bh=new Set(["commandExecution","worked","toolCall","fileChange","agentMessage","agentMessage.live","plan"]),sd=S(null);function Ab(c,h,b){const F=typeof h.turnIndex=="number"?h.turnIndex:-1;return F<0?!1:c.some((J,be)=>be>b&&typeof J.turnIndex=="number"&&J.turnIndex>=F&&Bh.has(J.messageType??""))}function _b(c,h){return c.some(b=>typeof b.turnIndex=="number"&&b.turnIndex>=h&&Bh.has(b.messageType??""))}const xu=Y(()=>{const c=Ua.value,h=ne.value;for(let be=c.length-1;be>=0;be-=1){const Ue=c[be];if(Ue.messageType!=="plan"&&Ue.messageType!=="plan.live")continue;const Vt=Kg(Ue);if(!Vt||sd.value!==null&&Ue.id===sd.value)return null;const oS=h?!0:Ab(c,Ue,be);return{id:Ue.id,streaming:Ue.messageType==="plan.live",explanation:Vt.explanation,steps:Vt.steps,implemented:oS}}const b=te.value?_e.value[te.value]??null:null;if(!b)return null;const F=Kg(b);if(!F)return null;const J=typeof b.turnIndex=="number"?b.turnIndex:b.turnId?we(te.value,b.turnId)??-1:-1;return{id:b.id,streaming:b.messageType==="plan.live",explanation:F.explanation,steps:F.steps,implemented:h?!0:J>=0?_b(c,J):!1}}),Pb=Y(()=>ye.value),Is=Y(()=>Gt.value?"__new-thread__":te.value),Uh=Y(()=>Or(Is.value)),Iu=Y(()=>{const c=le.value;return c.length>0?c[c.length-1]:null}),Eb=Y(()=>Iu.value?Fr(Iu.value.id):""),Cn=Y(()=>{var c,h;return Gt.value?gt.value.trim():((h=(c=ce.value)==null?void 0:c.cwd)==null?void 0:h.trim())??""}),Ml=Y(()=>mr.value&&(Gt.value&&Cn.value.length>0||vt.name==="thread"&&te.value.length>0)),Mb=Y(()=>Ml.value&&Bt.value==="terminal"),Rl=Y(()=>!It.value||ma.value<=0||Cs.value<=0?!1:Cs.value-ma.value>120),Rb=Y(()=>Rl.value||Mb.value&&nn.value),zh=Y(()=>{var c,h;return((h=(c=ce.value)==null?void 0:c.cwd)==null?void 0:h.trim())??gt.value.trim()}),Au=Y(()=>{var c;return!Gt.value&&((c=ce.value)==null?void 0:c.inProgress)===!0}),Lb=Y(()=>{const c=te.value;return!!c&&st.value.has(c)}),Hh=Y(()=>{var c,h;return!Gt.value&&((h=(c=ce.value)==null?void 0:c.externalSession)==null?void 0:h.active)===!0}),id=Y(()=>We.value||P.value||Au.value||le.value.length>0);function Wh(){Di.value&&(Di.value=!1,c_(!0))}function jb(){Wh(),kt.push({name:"skills",query:{tab:"plugins"}})}function qh(){const c=te.value;c&&St(c)}function ld(c,h){const b=et(c).trim(),F=Nr(b);return!b||!F?!1:h.some(J=>{const be=et(J).trim();return be!==b&&Nr(be)===F})}function ud(c,h=""){const b=et(c).trim(),F=h.trim();if(F)return F;const J=Nr(b),be=[...Q.value.order,...K.value.map(Ue=>{var Vt,Sr;return((Sr=(Vt=Ue.threads[0])==null?void 0:Vt.cwd)==null?void 0:Sr.trim())??""}).filter(Boolean)];return ld(b,be)?b:J}function Nb(){const c=new Set(Q.value.order),h=Q.value.projectOrder.filter(b=>c.has(b));for(const b of Q.value.order)h.includes(b)||h.push(b);return h}function Ll(c){const h=et(c).trim(),b=[...Q.value.order,...K.value.map(F=>{var J,be;return((be=(J=F.threads[0])==null?void 0:J.cwd)==null?void 0:be.trim())??""}).filter(Boolean)];return ld(h,b)?h:Nr(h)}function Gh(c){const h=et(c).trim();if(!h)return"";const b=[...Q.value.order,...K.value.map(F=>{var J,be;return((be=(J=F.threads[0])==null?void 0:J.cwd)==null?void 0:be.trim())??""}).filter(Boolean)];for(const F of Q.value.order){const J=et(F).trim();if(!J)continue;const be=Nr(J),Ue=ld(J,b)?J:be;if(J===h||Ue===h||be===h)return J}return""}const cd=Y(()=>{var F,J;const c=[],h=new Set;for(const be of Nb()){const Ue=be.trim();!Ue||h.has(Ue)||(h.add(Ue),c.push({value:Ue,label:ud(Ue,Q.value.labels[Ue])}))}for(const be of K.value){const Ue=((J=(F=be.threads[0])==null?void 0:F.cwd)==null?void 0:J.trim())??"";!Ue||h.has(Ue)||Tc(Ue)||(h.add(Ue),c.push({value:Ue,label:ud(Ue,U.value[be.projectName])}))}const b=gt.value.trim();return b&&!h.has(b)&&c.unshift({value:b,label:ud(b)}),c}),ui=Y(()=>{const c=gt.value.trim();return c?Sn.value[c]===!0:!1}),$b=Y(()=>{var h,b;const c={};for(const F of K.value){const J=Yi(F.projectName,((b=(h=F.threads[0])==null?void 0:h.cwd)==null?void 0:b.trim())??"");c[F.projectName]=J?Sn.value[J]===!0:!1}return c}),dd=Y(()=>{const c=Vn.value.trim(),h=[...I.value];return c&&!h.some(b=>b.value===c)&&h.unshift({value:c,label:c}),h}),Vh=Y(()=>{const c=Vn.value.trim();if(!c)return"";const h=dd.value.find(b=>b.value===c);return(h==null?void 0:h.label)??c}),Kh=Y(()=>tt.value.trim()),Yh=Y(()=>{const c=Da.value.trim();return!c||c==="."||c===".."?!1:!/[\\/]/u.test(c)}),Ob=Y(()=>Yh.value&&Kh.value.trim().length>0&&!ft.value),Jh=Y(()=>{const c=A.value.trim();return!c||c==="."||c===".."?!1:!/[\\/]/u.test(c)}),Qh=Y(()=>y.value.trim()?p.value==="create"?Jh.value:L.value.trim().length>0:!1),jl=Y(()=>{const c=et(Ct.value).trim();return c||tt.value.trim()}),Db=Y(()=>Fa.value?"Creating…":"Create"),Fb=Y(()=>z.value?p.value==="clone"?f("Cloning…"):f("Creating…"):p.value==="clone"?f("Clone repository"):f("Create project")),Bb=Y(()=>{const c=tt.value.trim(),h=Rt.value.trim();return!!(c&&h&&c!==h)}),Xh=Y(()=>{const c=[];Bb.value&&c.push({key:`parent:${Rt.value}`,name:"..",path:Rt.value,kind:"parent"});for(const h of xt.value)c.push({key:`directory:${h.path}`,name:h.name,path:h.path,kind:"directory"});return c}),fd=Y(()=>{const c=pa.value.trim().toLowerCase();return c?Xh.value.filter(h=>h.kind==="parent"||h.name.toLowerCase().includes(c)):Xh.value}),Ki=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,Ub=Y(()=>f(N[oi.value].label)),zb=Y(()=>{const c=N[oi.value],h=Math.max(0,Cs.value-ma.value-qi.value);return{"--chat-column-max":c.columnMax,"--chat-card-max":c.cardMax,"--visual-viewport-height":ma.value>0?`${ma.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,qi.value)}px`,"--virtual-keyboard-inset":`${h}px`}}),Hb=Y(()=>{if(!jr.value.configured)return f("Not configured");const c=jr.value.active?f("Online"):f("Configured (offline)"),h=jr.value.allowAllUsers?f("allow all users"):`${jr.value.allowedUsers} ${f("allowed user(s)")}`,b=`${jr.value.mappedChats} ${f("chat(s)")}, ${jr.value.mappedThreads} ${f("thread(s)")}, ${h}`,F=jr.value.lastError?`, ${f("error")}: ${jr.value.lastError}`:"";return`${c}, ${b}${F}`});ss(()=>{var c,h;document.addEventListener("pointerdown",gp),window.addEventListener("keydown",mp),document.addEventListener("visibilitychange",yp),window.addEventListener("pageshow",wp),window.addEventListener("focus",bp),window.addEventListener("resize",ci),(c=window.visualViewport)==null||c.addEventListener("resize",ci),(h=window.visualViewport)==null||h.addEventListener("scroll",ci),ci(),Ou(),Ki==null||Ki.addEventListener("change",Ou),pr=ge(b=>{Ir.value&&Ir.value.refreshFromNotification(b)}),yo=ge(b=>{b==="remoteControl/status/changed"&&ti({force:!0})}),Z0(),_0(),Pi(),Gb(),Ps(),Po(),ep(),hd(),Id(),JT(),ei()}),ot(Ui,(c,h)=>{c.forEach((b,F)=>{if(b===h[F])return;const J=b.trim();J&&nr(J)})}),ot(wn,c=>{if(On&&(On.disconnect(),On=null),typeof ResizeObserver<"u"){On=new ResizeObserver(An),c&&On.observe(c);return}An()},{immediate:!0}),yu(()=>{var c,h;document.removeEventListener("pointerdown",gp),window.removeEventListener("keydown",mp),document.removeEventListener("visibilitychange",yp),window.removeEventListener("pageshow",wp),window.removeEventListener("focus",bp),window.removeEventListener("resize",ci),(c=window.visualViewport)==null||c.removeEventListener("resize",ci),(h=window.visualViewport)==null||h.removeEventListener("scroll",ci),Ki==null||Ki.removeEventListener("change",Ou),On&&(On.disconnect(),On=null),Ao!==null&&(window.clearInterval(Ao),Ao=null),on&&(clearTimeout(on),on=null),Hr(),xr(),pr&&(pr(),pr=null),yo&&(yo(),yo=null),aa&&(clearTimeout(aa),aa=null)});function ci(){var c,h;typeof window>"u"||(Cs.value=Math.max(Cs.value,window.innerHeight),ma.value=((c=window.visualViewport)==null?void 0:c.height)??window.innerHeight,qi.value=((h=window.visualViewport)==null?void 0:h.offsetTop)??0)}ot(Qt,c=>{const h=c.trim();if(on&&(clearTimeout(on),on=null),!h){ra.value=null;return}on=setTimeout(()=>{vI(h,1e3).then(b=>{Qt.value.trim()===h&&(ra.value=b.threadIds)}).catch(()=>{Qt.value.trim()===h&&(ra.value=null)})},220)}),ot(Rl,c=>{c||(nn.value=!1)}),ot(Yn,()=>{if(typeof window>"u")return;if(!Yn.value.some(h=>h.quotaStatus==="loading")){Ao!==null&&(window.clearInterval(Ao),Ao=null);return}Ao===null&&(Ao=window.setInterval(()=>{Gi||(Gi=!0,Nl({silent:!0}).finally(()=>{Gi=!1}))},1500))},{deep:!0}),ot(Je,()=>{Zh().then(c=>{c&&ae({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})})},{deep:!0});async function Zh(){if(!Vi||Me||Tr.value!=="codex"||Yn.value.length>0||Je.value.length===0)return!1;Me=!0;const c=JSON.stringify(Yn.value.map(b=>b.accountId).sort());try{const b=await wg();Yn.value=b.accounts}catch{await Nl({silent:!0})}const h=JSON.stringify(Yn.value.map(b=>b.accountId).sort());return c!==h}function Wb(){ie({force:!0})}function qb(c){c&&qe(c,{silent:!0,force:!0})}async function hd(){try{jr.value=await t_()}catch(c){const h=c instanceof Error?c.message:"Failed to load Telegram status";jr.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:h}}}async function ep(){try{const c=await e_();Fi.value=c.botToken,li.value=c.allowedUserIds.map(h=>String(h)).join(`
94
+ `),fa.value=""}catch(c){fa.value=c instanceof Error?c.message:"Failed to load Telegram configuration"}}async function Gb(){const c=await u_();Di.value=c.dismissed!==!0}function Vb(c){const h=c.split(/[\n,]/).map(J=>J.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),b=h.includes("*"),F=Array.from(new Set(h.filter(J=>/^-?\d+$/.test(J)).map(J=>Number.parseInt(J,10))));return b?["*",...F]:F}async function Kb(){const c=Fi.value.trim(),h=Vb(li.value);if(!c){fa.value=f("Telegram bot token is required.");return}if(h.length===0){fa.value=f("At least one allowed Telegram user ID or * is required.");return}Pl.value=!0,fa.value="";try{await ZA(c,h),li.value=h.map(b=>String(b)).join(`
95
+ `),await Promise.all([ep(),hd()]),window.alert(f("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(b){fa.value=b instanceof Error?b.message:f("Failed to connect Telegram bot"),hd()}finally{Pl.value=!1}}const _u=S(""),Yb=Y(()=>_u.value||te.value);ot(te,()=>{_u.value=""});function Jb(){return new Promise(c=>{let h=!1;const b=()=>{h||(h=!0,c())};requestAnimationFrame(()=>setTimeout(b,0)),setTimeout(b,80)})}let pd=0;function Qb(c){if(!c)return;if(vt.name==="thread"&&zn.value===c){pd+=1,_u.value="";return}_u.value=c;const h=pd+=1;Jb().then(()=>{h===pd&&kt.push({name:"thread",params:{threadId:c}})}),It.value&&cn(!0)}function Xb(c){vt.name==="automations"&&Fh.value!==c&&kt.replace({name:"automations",query:c?{automationId:c}:{}})}async function Zb(c){var h;At.value&&(cn(!1),await Et()),(h=$n.value)==null||h.openAutomationEditorFromPanel(c)}async function eT(){var c;At.value&&(cn(!1),await Et()),(c=$n.value)==null||c.openAutomationCreatorFromPanel()}function tT(){var c;vt.name==="automations"&&((c=hn.value)==null||c.loadAutomations())}async function nT(c){c&&te.value===c&&await Np()}function rT(c){return c.length>8?c.slice(-8):c}function tp(c){const h=[c.planType||f("unknown")];return c.authMode&&h.unshift(c.authMode),h.join(" · ")}function oT(c){if(!c)return!1;const h=c.toLowerCase();return h.includes("payment required")||/\b402\b/.test(h)}function Pu(c){return c.unavailableReason==="payment_required"||oT(c.quotaError)}function aT(c){return la.value||Co.value||ua.value||Un.value||ca.value.length>0||c.isActive&&ca.value!==c.storageId&&id.value}function md(c){return Jr.value===c.storageId}function sT(c){return da.value===c.storageId||md(c)}function iT(c){return Pu(c)?f("Unavailable"):c.isActive?f("Active"):Co.value?f("Switching…"):f("Switch")}function lT(c){return ca.value===c.storageId?f("Removing…"):md(c)?f("Click again to remove"):f("Remove")}function uT(c){da.value=c}function cT(c){da.value===c&&(da.value=""),ca.value!==c&&Jr.value===c&&(Jr.value="")}function dT(c){const h=c.quotaSnapshot;if(!h)return null;const b=[h==null?void 0:h.primary,h==null?void 0:h.secondary].filter(be=>be!==null),F=b.find(be=>be.windowMinutes===7*24*60);if(F)return F;const J=b.filter(be=>typeof be.windowMinutes=="number"&&be.windowMinutes>=7*24*60).sort((be,Ue)=>(be.windowMinutes??0)-(Ue.windowMinutes??0))[0]??null;return J||(h.secondary??null)}function fT(c){if(typeof c!="number"||!Number.isFinite(c))return"";const h=new Date(c*1e3);return`${h.getMonth()+1}月${h.getDate()}日`}function np(c){var be,Ue;if(Pu(c))return c.quotaError||f("402 Payment Required");const h=c.quotaSnapshot,b=dT(c),F=(h==null?void 0:h.primary)??(h==null?void 0:h.secondary)??null,J=b??F;if(J){const Vt=Math.max(0,Math.min(100,100-Math.round(J.usedPercent))),Sr=fT(J.resetsAt);return Sr?`${Vt}% ${f("weekly remaining")} · ${Sr}`:`${Vt}% ${f("weekly remaining")}`}return(be=h==null?void 0:h.credits)!=null&&be.unlimited?f("Unlimited credits"):(Ue=h==null?void 0:h.credits)!=null&&Ue.hasCredits&&h.credits.balance?`${h.credits.balance} ${f("credits")}`:c.quotaStatus==="loading"?f("Loading quota…"):c.quotaStatus==="error"?c.quotaError||f("Quota unavailable"):c.quotaStatus==="ready"||c.quotaStatus==="idle"?f("Quota unavailable"):f("Fetching account details…")}function hT(c){return[c.email||f("Account"),tp(c),Pu(c)?f("Unavailable account"):null,np(c),`${f("Workspace")} ${c.accountId}`].filter(Boolean).join(`
96
+ `)}async function Nl(c={}){try{const h=await A_();Yn.value=h.accounts,h.accounts.some(b=>b.storageId===da.value)||(da.value=""),h.accounts.some(b=>b.storageId===Jr.value)||(Jr.value="")}catch(h){if(c.silent===!0)return;vn.value=h instanceof Error?h.message:f("Failed to load accounts")}}async function pT(){if(!(la.value||Co.value||ua.value||Un.value)){vn.value="",da.value="",Jr.value="",la.value=!0;try{const c=await wg();Yn.value=c.accounts,xr(),uo(),ae({includeSelectedThreadMessages:!0})}catch(c){vn.value=c instanceof Error?c.message:f("Failed to refresh accounts")}finally{la.value=!1}}}async function mT(c){if(!(Co.value||la.value||ua.value||Un.value)){if(id.value){vn.value=f("Finish the current turn and pending requests before switching accounts.");return}vn.value="",da.value="",Jr.value="",Co.value=!0;try{const h=await E_(c);Yn.value=Yn.value.map(b=>b.storageId===c?h:{...b,isActive:!1}),xr(),uo(),ae({includeSelectedThreadMessages:!0}),Nl({silent:!0})}catch(h){vn.value=h instanceof Error?h.message:f("Failed to switch account")}finally{Co.value=!1}}}async function gT(){var c;if(!(la.value||Co.value||ua.value||Un.value)){vn.value="",La.value="",ua.value=!0;try{const h=await __();ri.value=h,Oi.value=!0,window.open(h,"_blank","noopener,noreferrer"),await Et(),(c=ku.value)==null||c.focus()}catch(h){vn.value=h instanceof Error?h.message:f("Failed to start Codex login")}finally{ua.value=!1}}}function gd(){Un.value||(Oi.value=!1,La.value="")}async function vT(){const c=La.value.trim();c&&await yT(c)}async function yT(c){if(!(Un.value||c.length===0)){vn.value="",Un.value=!0;try{const h=await P_(c);Yn.value=h.accounts,ri.value="",La.value="",Oi.value=!1,xr(),uo(),ae({includeSelectedThreadMessages:!0})}catch(h){vn.value=h instanceof Error?h.message:f("Failed to complete Codex login")}finally{Un.value=!1}}}async function wT(c){if(la.value||Co.value||ua.value||Un.value||ca.value.length>0)return;const h=Yn.value.find(F=>F.storageId===c)??null;if(!h)return;if(Jr.value!==c){Jr.value=c;return}if(h.isActive&&id.value){vn.value=f("Finish the current turn and pending requests before removing the active account.");return}const b=h.isActive;vn.value="",Jr.value="",ca.value=c;try{const F=await M_(c);Yn.value=F.accounts,xr(),uo(),b&&ae({includeSelectedThreadMessages:!0}),Nl({silent:!0})}catch(F){vn.value=F instanceof Error?F.message:f("Failed to remove account")}finally{ca.value=""}}function rp(c){dt(c)}function bT(c){ae({includeSelectedThreadMessages:!1,forceThreadRefresh:!0})}async function op(c){const h=await pe(c);h&&(Gt.value?await kt.replace({name:"thread",params:{threadId:h}}):await kt.push({name:"thread",params:{threadId:h}}),It.value&&cn(!0))}function ap(c){const h=c.trim().replace(/\\/gu,"/");return h?h.includes("/.codex/worktrees/")||h.includes("/.git/worktrees/"):!1}function Yi(c,h=""){var be,Ue,Vt;const b=K.value.find(Sr=>Sr.projectName===c);if(!b)return Gh(c)||h.trim();const F=b.threads.find(Sr=>!ap(Sr.cwd));return(((be=F==null?void 0:F.cwd)==null?void 0:be.trim())??((Vt=(Ue=b.threads[0])==null?void 0:Ue.cwd)==null?void 0:Vt.trim())??"")||Gh(c)||h.trim()}function TT(c){var F,J;const h=K.value.find(be=>be.projectName===c),b=Yi(c,((J=(F=h==null?void 0:h.threads[0])==null?void 0:F.cwd)==null?void 0:J.trim())??"");b&&(gt.value=b),It.value&&cn(!0),!Gt.value&&kt.push({name:"home"})}function ST(c){var b;let h="";for(const F of K.value){const J=F.threads.find(be=>be.id===c);if((b=J==null?void 0:J.cwd)!=null&&b.trim()){h=J.cwd.trim();break}}!h||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(h)}`,"_blank","noopener,noreferrer")}function Eu(c){var b,F;const h=K.value.find(J=>J.projectName===c);return Yi(c,((F=(b=h==null?void 0:h.threads[0])==null?void 0:b.cwd)==null?void 0:F.trim())??"")}const sp=Y(()=>Object.fromEntries(K.value.map(c=>[c.projectName,Eu(c.projectName).trim()]).filter(([,c])=>c.length>0)));function kT(c){return(U.value[c]??c).trim()||c}function CT(c){return kT(c).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function xT(c){const h=Eu(c);!h||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(h)}`,"_blank","noopener,noreferrer")}async function IT(c){const h=Eu(c);await up(h)}async function AT(c){const h=_T(c);await up(h)}function _T(c){var h;for(const b of K.value){const F=b.threads.find(J=>J.id===c);if((h=F==null?void 0:F.cwd)!=null&&h.trim())return F.cwd.trim()}return""}function ip(c){if(!Number.isFinite(c)||c<=0)return"0 B";const h=["B","KB","MB","GB"];let b=c,F=0;for(;b>=1024&&F<h.length-1;)b/=1024,F+=1;return`${b>=10||F===0?b.toFixed(0):b.toFixed(1)} ${h[F]}`}function PT(c,h){const b=URL.createObjectURL(c),F=document.createElement("a");F.href=b,F.download=h,document.body.appendChild(F),F.click(),document.body.removeChild(F),window.setTimeout(()=>URL.revokeObjectURL(b),3e4)}async function ET(c,h){const F={files:[new File([c],h,{type:c.type||"application/zip"})],title:h};if(!(typeof navigator<"u"&&typeof navigator.share=="function"&&(typeof navigator.canShare!="function"||navigator.canShare(F))))throw new Error("File sharing is not supported in this browser.");await navigator.share(F)}function lp(){ke.value.phase!=="exporting"&&(ke.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""})}function MT(){const{blob:c,fileName:h}=ke.value;!c||!h||(ke.value={...ke.value,error:""},PT(c,h))}async function RT(){const{blob:c,fileName:h}=ke.value;if(!(!c||!h))try{ke.value={...ke.value,error:""},await ET(c,h)}catch(b){if(b instanceof DOMException&&b.name==="AbortError")return;const F=b instanceof Error?b.message:"",J=b instanceof DOMException&&b.name==="NotAllowedError"||/permission denied|notallowed|not allowed|gesture/iu.test(F);ke.value={...ke.value,error:J?f("This browser blocked sharing the ZIP. Use Download instead."):F||f("Failed to share project. Use Download instead.")}}}async function up(c){if(!(!c||typeof document>"u")){ke.value={phase:"exporting",loaded:0,total:null,blob:null,fileName:"",error:""};try{const{blob:h,fileName:b}=await q_(c,({loaded:F,total:J})=>{ke.value={...ke.value,phase:"exporting",loaded:F,total:J}});ke.value={phase:"ready",loaded:h.size,total:h.size,blob:h,fileName:b,error:""}}catch(h){if(ke.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""},h instanceof DOMException&&h.name==="AbortError")return;const b=h instanceof Error?h.message:"Failed to export project.";window.alert(b)}}}async function LT(c){const h=Eu(c);if(!h||typeof window>"u"||(await Ru(h),Sn.value[h]!==!0))return;const b=`${CT(c)}-`,F=window.prompt("New worktree folder name",b);if(F===null)return;const J=F.trim();if(J){if(J.includes("/")||J.includes("\\")||J==="."||J===".."){window.alert("Worktree name must be a single folder name.");return}try{const be=await N_(h,J),Ue=await qu(be.cwd,{createIfMissing:!1,label:""});if(!Ue)return;gt.value=Ue,_n.value="local",lo(Ll(Ue)),await Ps(),await Po(),It.value&&cn(!0),Gt.value||await kt.push({name:"home"})}catch(be){const Ue=be instanceof Error?be.message:"Failed to create worktree.";window.alert(Ue)}}}function jT(){var b,F,J;const c=ce.value;if(!c)return"";const h=((b=c.projectName)==null?void 0:b.trim())??"";return h?Yi(h,((J=c.cwd)==null?void 0:J.trim())??""):((F=c.cwd)==null?void 0:F.trim())??""}function Mu(){const c=jT();c&&(gt.value=c),_n.value="local",It.value&&cn(!0),!Gt.value&&kt.push({name:"home"})}function NT(){gt.value="",_n.value="local",It.value&&cn(!0),!Gt.value&&kt.push({name:"home"})}async function Ru(c){const h=c.trim();if(!h||Object.prototype.hasOwnProperty.call(Sn.value,h))return;const b=Aa.get(h);if(b){const be=await b;Object.prototype.hasOwnProperty.call(Sn.value,h)||(Sn.value={...Sn.value,[h]:be});return}const F=D_(h).then(be=>be.isGitRepo).catch(()=>!1).finally(()=>{Aa.delete(h)});Aa.set(h,F);const J=await F;Object.prototype.hasOwnProperty.call(Sn.value,h)||(Sn.value={...Sn.value,[h]:J})}function $T(c){us(c.projectName,c.displayName)}function OT(c){Ce(c.threadId,c.title)}async function DT(c){await Ca(c),await Ps(),Po()}function FT(c){qo(c.projectName,c.toIndex)}function BT(c){var F,J;const h=K.value.find(be=>be.projectName===c),b=Yi(c,((J=(F=h==null?void 0:h.threads[0])==null?void 0:F.cwd)==null?void 0:J.trim())??"");Ru(b)}function cp(c){UT(c)}async function UT(c){var F;const h=await Wo(c),b=((F=c.followUpMessageText)==null?void 0:F.trim())??"";if(!(!h||!b||Gt.value))try{await yt(b,[],[],"steer",[])}catch{}}async function zT(c){const h=await Be(c.threadId,c.turnIndex);h&&(await kt.push({name:"thread",params:{threadId:h}}),te.value!==h&&await Ke(h),It.value&&cn(!0))}const As=S(!1),dp=S(null),HT=Y(()=>tn()?"⌘/":"Ctrl+/"),WT=Y(()=>`${f("Command palette")} · ${HT.value}`);let vd=null;function qT(){const c=document.activeElement;vd=c instanceof HTMLElement?c:null}function fp(){const c=vd;vd=null,Et(()=>{var h;if(c!=null&&c.isConnected){c.focus();return}(h=dp.value)==null||h.focus()})}function hp(){qT(),Ji.value=!1,As.value=!0}function GT(){if(As.value){Lu();return}hp()}const Ji=S(!1);function VT(){As.value=!1,Ji.value=!0}function pp(){Ji.value&&(Ji.value=!1,fp())}function Lu(){As.value&&(As.value=!1,fp())}const KT=Y(()=>{const c=!Gt.value&&!_o.value&&!xs.value&&te.value.trim().length>0,h=tn()?"⌘":"Ctrl+";return UM.filter(b=>!(b.requiresThread&&!c||b.id==="thread.interrupt"&&!Au.value||b.id==="thread.implement-plan"&&!xu.value||b.id==="thread.copy-last-code-block"&&!yF(Ua.value)||b.group==="panel"&&!Ml.value)).map(b=>b.shortcut?{...b,shortcut:b.shortcut.replace("Mod+",h)}:b)});function YT(c){var b,F;Lu();const h=te.value.trim();switch(c){case"thread.new":Mu();break;case"thread.rename":h&&((F=$n.value)==null||F.openRenameThreadDialog(h,((b=ce.value)==null?void 0:b.title)??""));break;case"thread.archive":h&&rp(h);break;case"thread.fork":h&&op(h);break;case"thread.copy-markdown":Np();break;case"thread.copy-last-code-block":R0();break;case"thread.compact":qh();break;case"thread.interrupt":Rp();break;case"thread.implement-plan":jp();break;case"panel.git":Ut("git");break;case"panel.files":Ut("files");break;case"panel.terminal":Jo();break;case"panel.toggle":ho();break;case"panel.close":mn();break;case"view.toggle-sidebar":cn(!At.value);break;case"view.search-threads":At.value&&cn(!1),Mr.value||na();break;case"view.cycle-theme":Dp();break;case"view.cycle-chat-width":Fp();break;case"view.toggle-language":k(v.value==="zh-CN"?"en":"zh-CN");break;case"view.send-with-enter":$p();break;case"view.in-progress-send-mode":Op();break;case"view.shortcuts":VT();break;case"nav.skills":kt.push({name:"skills"});break;case"nav.automations":kt.push({name:"automations"});break;case"nav.recycle-bin":vp();break;case"nav.settings":an.value||En();break}}function mp(c){if(c.defaultPrevented)return;if(c.key==="Escape"&&Ji.value){pp();return}if(c.key==="Escape"&&As.value){Lu();return}if(c.key==="Escape"&&an.value){an.value=!1;return}if(!c.ctrlKey&&!c.metaKey||c.shiftKey||c.altKey)return;const h=c.key.toLowerCase();if(h==="/"){c.preventDefault(),GT();return}if(!As.value){if(h==="b"){if(!(tn()?c.metaKey&&!c.ctrlKey:c.ctrlKey&&!c.metaKey))return;c.preventDefault(),cn(!At.value);return}if(h==="j"&&vt.name==="thread"&&te.value){c.preventDefault(),Jo();return}h==="j"&&Gt.value&&Cn.value&&(c.preventDefault(),Jo())}}async function JT(){try{const c=await wI();mr.value=c.available,!c.available&&Bt.value==="terminal"&&(Bt.value="git",Zo())}catch{mr.value=!1,Bt.value==="terminal"&&(Bt.value="git")}}function gp(c){var b,F;const h=c.target;if(h instanceof Node){if(Yo.value){const J=h instanceof Element?h:h.parentElement;J!=null&&J.closest(".thread-terminal-panel")||Zo()}an.value&&((b=hs.value)!=null&&b.containsTarget(h)||(F=Ea.value)!=null&&F.contains(h)||(Ma=Date.now(),an.value=!1))}}function QT(c){var b,F;if(!an.value)return;const h=c.target;h instanceof Node&&((b=hs.value)!=null&&b.containsTarget(h)||(F=Ea.value)!=null&&F.contains(h)||(Ma=Date.now(),an.value=!1))}function vp(){var c;(c=$n.value)==null||c.openRecycleBin()}function yp(){if(!(typeof document>"u")){if(document.visibilityState==="hidden"){zi.value=Date.now(),Hi.value=!1;return}yd()}}function wp(c){c.persisted&&yd()}function bp(){vt.name==="home"&&(Ps(),Po()),yd()}function yd(){typeof window>"u"||typeof document>"u"||nF(document.visibilityState,zi.value,Hi.value,Date.now())&&(Hi.value=!0,zi.value=null,XT())}async function XT(){if(!Wi.value){Wi.value=!0;try{await ae({includeSelectedThreadMessages:!1}),await _d()}finally{Wi.value=!1}}}function Tp(c){const h=c.text;ju();const b=ea.value,F=c.mode==="queue"&&b&&b.threadId===te.value?b.queueIndex:void 0;if(ea.value=null,Gt.value){eS(h,c.imageUrls,c.skills,c.fileAttachments);return}yt(h,c.imageUrls,c.skills,c.mode,c.fileAttachments,F)}function ZT(c){const h=so.value.findIndex(be=>be.id===c),b=h>=0?so.value[h]:void 0,F=rr.value;if(!b||!F||F.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;ea.value=te.value?{threadId:te.value,queueIndex:h}:null;const J={text:b.text,imageUrls:[...b.imageUrls],fileAttachments:b.fileAttachments.map(be=>({...be})),skills:b.skills.map(be=>({...be}))};F.hydrateDraft(J),tr(c)}function ju(){if(!It.value||Gt.value)return;const c=()=>{var h;(h=bn.value)==null||h.jumpToLatest()};c(),Et(()=>{c(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{c(),window.requestAnimationFrame(c)})})}function e0(c){gt.value=c.trim(),Jn.value=""}function t0(c){Vn.value=c.trim()}function _s(c){const h=Cn.value.trim();return!c||h!==c?!1:vt.name==="thread"||vt.name==="home"&&ui.value}function Sp(){oa+=1,Wr+=1,gn+=1,mo+=1,bo.value=[],sr.value=null,sa.value=null,C.value=null,M.value=null,x.value=!1,Z.value=!1,Qe.value={addedLineCount:0,removedLineCount:0},qt.value=[],br.value={},sn.value="",To.value="",So.value={},ia.value="",ys.value="",Kn.value="",$i.value=!1}function kp(c){const h=c.trim();if(!h){Qe.value={addedLineCount:0,removedLineCount:0};return}const b=++mo;nP(h,"unstaged").then(F=>{b!==mo||!_s(h)||(Qe.value={addedLineCount:F.addedLineCount,removedLineCount:F.removedLineCount})}).catch(()=>{b!==mo||!_s(h)||(Qe.value={addedLineCount:0,removedLineCount:0})})}async function $l(c){var F,J,be;const h=c.trim();if(!h){Sp();return}const b=++oa;$i.value=!0,Kn.value="";try{const Ue=await O_(h);if(b!==oa||!_s(h))return;bo.value=Ue.options,sr.value=Ue.currentBranch,sa.value=Ue.headSha,C.value=Ue.headSubject,M.value=Ue.headDate,x.value=Ue.detached,Z.value=Ue.dirty,qt.value=Ue.changedFiles,kp(h);const Vt=((F=Ue.currentBranch)==null?void 0:F.trim())||((be=(J=Ue.options[0])==null?void 0:J.value)==null?void 0:be.trim())||"";Vt&&Cp({branch:Vt,includeResetHistory:!0})}catch{if(b!==oa||!_s(h))return;bo.value=[],sr.value=null,sa.value=null,C.value=null,M.value=null,x.value=!1,Z.value=!1,Qe.value={addedLineCount:0,removedLineCount:0},qt.value=[]}finally{b===oa&&($i.value=!1)}}function n0(c){sr.value=c.currentBranch,sa.value=c.headSha,C.value=c.headSubject,M.value=c.headDate,x.value=c.detached,Z.value=c.dirty,qt.value=c.changedFiles,kp(Cn.value)}function r0(c){if(ko.value)return;const h=c.trim();if(!h||h===(sr.value??""))return;const b=Cn.value.trim();b&&(ko.value=!0,Kn.value="",F_(b,h).then(F=>(sr.value=F||h,sa.value=null,C.value=null,M.value=null,x.value=!1,Dn.value=!1,$l(b))).catch(F=>{const J=F instanceof Error?F.message:"Failed to switch branch";$l(b).finally(()=>{Kn.value=J})}).finally(()=>{ko.value=!1}))}function o0(c){if(ko.value)return;const h=c.branch.trim(),b=c.sha.trim(),F=Cn.value.trim();!h||!b||!F||(ko.value=!0,Kn.value="",z_(F,h,b).then(J=>(n0(J),Dn.value=!1,$l(F))).catch(J=>{const be=J instanceof Error?J.message:"Failed to reset branch to commit";$l(F).finally(()=>{Kn.value=be})}).finally(()=>{ko.value=!1}))}function Cp(c){const h=(typeof c=="string"?c:c.branch).trim(),b=typeof c=="string"?!0:c.includeResetHistory!==!1,F=Cn.value.trim(),J=td(h,b);if(!h||!F||sn.value===J||(To.value="",br.value[J]))return;const be=++Wr;sn.value=J,B_(F,h,{includeResetHistory:b}).then(Ue=>{be!==Wr||!_s(F)||(br.value={...br.value,[J]:Ue})}).catch(Ue=>{be!==Wr||!_s(F)||(To.value=Ue instanceof Error?Ue.message:"Failed to load branch commits")}).finally(()=>{be===Wr&&sn.value===J&&(sn.value="")})}function a0(c){const h=c.trim(),b=Cn.value.trim();if(!h||!b||ia.value===h||(ys.value="",So.value[h]))return;const F=++gn;ia.value=h,U_(b,h).then(J=>{F!==gn||!_s(b)||(So.value={...So.value,[h]:J})}).catch(J=>{F!==gn||!_s(b)||(ys.value=J instanceof Error?J.message:"Failed to load commit files")}).finally(()=>{F===gn&&ia.value===h&&(ia.value="")})}function s0(c){const h=c.path.trim(),b=c.sha.trim();!h||!b||(kn.value=h,Bn.value=b,Dn.value=!0)}function i0(){kn.value="",Bn.value="",Dn.value=!Dn.value}function l0(){!kn.value&&!Bn.value||(kn.value="",Bn.value="",Dn.value=!1)}async function u0(){const c=await $u();c&&(await Po(),y.value=c,A.value=go.value.trim()||"New Project (1)",L.value="",V.value="",p.value="create",Bi.value=!0,Et(()=>{var h;return(h=oe.value)==null?void 0:h.focus()}))}function Nu(){z.value||(Bi.value=!1,V.value="")}let wd=!1,bd=!1;function c0(){wd=!0}function d0(){wd&&(wd=!1,Qi())}function f0(){bd=!0}function h0(){bd&&(bd=!1,Nu())}async function p0(){const c=y.value.trim(),h=A.value.trim();if(!Jh.value)throw new Error("Enter a single project folder name.");const b=_p(Ap(c,h));return b?qu(b,{createIfMissing:!0,label:""}):""}async function m0(){const c=y.value.trim(),h=L.value.trim();return h?Y_(h,c):""}async function Td(){if(!(!Qh.value||z.value)){V.value="",z.value=!0;try{const c=p.value==="clone"?await m0():await p0();if(!c)return;gt.value=c,lo(Ll(c)),await Ps(),await Po(),Bi.value=!1}catch(c){V.value=c instanceof Error?c.message:"Failed to create or clone project."}finally{z.value=!1}}}function g0(){v0(me.value)}function v0(c){H.value||!c||(c.value="",c.click())}async function y0(c,h,b){H.value=!0;try{const F=await $u();if(!F)return;const J=await h(F);if(!J.path)return;gt.value=J.path,lo(Ll(J.path)),await Ps(),await ae({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Po()}catch(F){const J=F instanceof Error?F.message:b;window.alert(J)}finally{H.value=!1,c&&(c.value="")}}async function w0(c){var F;const h=c.target instanceof HTMLInputElement?c.target:null,b=((F=h==null?void 0:h.files)==null?void 0:F[0])??null;!b||H.value||await y0(h,J=>G_(b,J),"Failed to import project.")}async function b0(){const c=gt.value.trim()||await $u();c&&(ha.value=!1,fe.value=!0,pa.value="",await Es(c),ft.value||Et(()=>{var h;return(h=He.value)==null?void 0:h.focus()}))}function Qi(){Pt+=1,fe.value=!1,Rn.value=!1,ft.value="",pa.value="",Ct.value="",Ol()}async function T0(c){!c||Rn.value||(pa.value="",await Es(c))}function S0(){const c=tt.value.trim();!fe.value||!c||Es(c)}function k0(){const c=jl.value;!fe.value||!c||Rn.value||Es(c)}function C0(){if(!fe.value||Rn.value||Ln.value)return;const c=jl.value,h=tt.value.trim();!c||c===h||Es(c)}function x0(){const c=jl.value,h=tt.value.trim();if(c){if(c!==h){Es(c);return}Sd(c)}}async function Sd(c=jl.value){const h=et(c).trim();if(h){ft.value="",Ln.value=!0;try{const b=await qu(h,{createIfMissing:!1,label:""});if(!b){ft.value="Failed to open the selected folder.";return}gt.value=b,lo(Ll(b)),await Ps(),await ae({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Po(),Qi()}catch(b){ft.value=b instanceof Error?b.message:"Failed to open the selected folder."}finally{Ln.value=!1}}}async function I0(){if(Jn.value="",ha.value){Ol();return}if(!fe.value){const c=gt.value.trim()||await $u();if(!c||(fe.value=!0,pa.value="",await Es(c),ft.value))return}ft.value||(Da.value=go.value,ha.value=!0,Et(()=>{var c;return(c=Su.value)==null?void 0:c.focus()}))}function Ol(){Jn.value="",Da.value="",ha.value=!1}async function xp(){const c=Da.value.trim();if(!c)return;if(Jn.value="",ft.value){Jn.value="Reload the current folder before creating a new one.";return}Fa.value=!0;const h=Kh.value.trim(),b=_p(Ap(h,c));if(!b){Jn.value="Unable to determine where the new folder should be created.",Fa.value=!1;return}if(!Yh.value){Jn.value="Enter a single folder name.",Fa.value=!1;return}try{const F=await K_(b);if(!F){Jn.value="Failed to create the folder.";return}Jn.value="",pa.value="",await Es(F),Ol()}catch(F){Jn.value=F instanceof Error?F.message:"Failed to create folder."}finally{Fa.value=!1}}async function A0(){var h;if(typeof window>"u")return!1;const c=((h=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:h.trim())??"";if(!c)return!1;try{const b=await qu(c,{createIfMissing:!1,label:""});if(!b)return!1;gt.value=b,lo(Ll(b)),await kt.replace({name:"home"}),await Ps();const F=new URL(window.location.href);return F.searchParams.delete("openProjectPath"),window.history.replaceState({},"",F.toString()),!0}catch{return!1}}async function $u(){const c=Ip();if(c)return c;try{const h=await bg();if(h)return ps.value=h,h}catch{}return""}async function Po(){const c=Ip();if(!c){go.value="New Project (1)";return}try{const h=await Q_(c);go.value=h.name||"New Project (1)"}catch{go.value="New Project (1)"}}function Ip(){var b,F;const c=gt.value.trim();if(c)return hl(c);const h=((F=(b=cd.value[0])==null?void 0:b.value)==null?void 0:F.trim())??"";return h?hl(h):ps.value.trim()}async function _0(){try{ps.value=await bg()}catch{ps.value=""}}async function Ps(){try{const c=await sl();Q.value={order:[...c.order],labels:{...c.labels},projectOrder:[...c.projectOrder]}}catch{Q.value={order:[],labels:{},projectOrder:[]}}}async function Es(c){const h=++Pt,b=et(c).trim();Ct.value=b,tt.value=b,ft.value="",Rn.value=!0;try{const F=await V_(c,{showHidden:Ba.value});if(h!==Pt)return;Ct.value=F.path,tt.value=F.path,Rt.value=F.parentPath,xt.value=F.entries}catch(F){if(h!==Pt)return;ft.value=F instanceof Error?F.message:"Failed to load local folders.",Rt.value=hl(tt.value),xt.value=[],Ol()}finally{h===Pt&&(Rn.value=!1)}}function Ap(c,h){const b=et(c).trim(),F=et(h).trim().replace(/^[\\/]+/u,"");if(!b||!F)return"";const J=b.includes("\\")&&!b.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(b))return`${b.slice(0,2)}${J}${F}`;if(/^\/+$/u.test(b))return`/${F}`;const be=b.replace(/[\\/]+$/u,"");return be?`${be}${J}${F}`:""}function _p(c){const h=et(c).trim();if(!h)return"";const b=h.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(b){const[,J,be,Ue=""]=b,Vt=kd(Ue.split(/[\\/]+/u));return Vt.length>0?`\\\\${J}\\${be}\\${Vt.join("\\")}`:`\\\\${J}\\${be}`}const F=h.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(F){const[,J,be=""]=F,Ue=h.includes("\\")&&!h.includes("/")?"\\":"/",Vt=kd(be.split(/[\\/]+/u));return Vt.length>0?`${J}${Ue}${Vt.join(Ue)}`:`${J}${Ue}`}if(h.startsWith("/")){const J=kd(h.split("/"));return J.length>0?`/${J.join("/")}`:"/"}return h}function kd(c){const h=[];for(const b of c){const F=b.trim();if(!(!F||F===".")){if(F===".."){h.length>0&&h.pop();continue}h.push(F)}}return h}function P0(c){Sa(c.draggedId,c.targetId)}function Pp(c){const h=Is.value,b=Or(h);ls(h,c),b&&b!==c&&(Dr(h,b,c),zo(h))}function Ep(c){Ho(c)}function Mp(c){Js(c)}function Rp(){Dt()}const Dl=S("");let Cd=null;ot(Uo,c=>{var h;c&&(c.text&&((h=rr.value)==null||h.hydrateDraft({text:c.text,imageUrls:c.imageUrls,fileAttachments:c.fileAttachments,skills:c.skills})),Dl.value=c.text?f("Stopped: message not submitted, restored to input."):f("Stopped: message not submitted."),Cd&&clearTimeout(Cd),Cd=setTimeout(()=>{Dl.value=""},6e3),Jt(Is.value))});function Lp(c){var b,F;const h=te.value.trim();switch(c){case"compact":h&&St(h);break;case"review":if(!h)return;kn.value="",Bn.value="",Dn.value=!0;break;case"rename":h&&((F=$n.value)==null||F.openRenameThreadDialog(h,((b=ce.value)==null?void 0:b.title)??""));break;case"archive":h&&dt(h);break;case"fork":h&&pe(h);break;case"new":Mu();break;case"skills":_o.value||kt.push({name:"skills"});break}}function E0(c){const h=c.turnId.trim();if(h.length>0){const b=[...Ua.value].reverse().find(F=>{var J;return Gs(F)&&(((J=F.turnId)==null?void 0:J.trim())??"")===h&&F.text.trim().length>0});b!=null&&b.text&&rr.value&&rr.value.appendTextToDraft(b.text)}xa(c.turnId)}async function M0(c){const h=c.turnId.trim();if(!te.value||!h||c.text.trim().length===0)return;if(await xa(h),Ua.value.some(F=>{var be;if((((be=F.turnId)==null?void 0:be.trim())??"")!==h||F.role!=="user"&&F.role!=="assistant")return!1;const J=Bp(F.messageType,F.role);return J!=="worked"&&J!=="turnActivity.live"&&J!=="turnError.live"&&J!=="agentReasoning.live"})){ue.value=ue.value.trim().length>0?ue.value:f("Edit failed: the original message could not be rolled back. Try again.");return}await yt(c.text,[],[],"steer",[],void 0,void 0,"edit_user_message")}function jp(){Gt.value||!te.value||(xu.value&&(sd.value=xu.value.id),is("default"),ju(),yt("Implement",[],[],"steer",[],void 0,"default"))}async function Np(){if(Gt.value||_o.value||xs.value||!ce.value||Ua.value.length===0)return;const c=L0();try{await lv(c)}catch{}}async function R0(){const c=wF(Ua.value);if(c)try{await lv(c.value)}catch{}}function L0(){var b,F,J;const c=[],h=((F=(b=ce.value)==null?void 0:b.title)==null?void 0:F.trim())||"Untitled thread";c.push(`# ${j0(h)}`),c.push(""),c.push(`- Exported: ${new Date().toISOString()}`),c.push(`- Thread ID: ${((J=ce.value)==null?void 0:J.id)??""}`),c.push(""),c.push("---"),c.push("");for(const be of Ua.value){const Ue=be.role?be.role.toUpperCase():"MESSAGE";c.push(`## ${Ue}`),c.push("");const Vt=be.text.trim();if(Vt&&(c.push(Vt),c.push("")),be.commandExecution&&(c.push("```text"),c.push(`command: ${be.commandExecution.command}`),c.push(`status: ${be.commandExecution.status}`),be.commandExecution.cwd&&c.push(`cwd: ${be.commandExecution.cwd}`),be.commandExecution.exitCode!==null&&c.push(`exitCode: ${be.commandExecution.exitCode}`),c.push(be.commandExecution.aggregatedOutput||"(no output)"),c.push("```"),c.push("")),be.fileAttachments&&be.fileAttachments.length>0){c.push("Attachments:");for(const Sr of be.fileAttachments)c.push(`- ${Sr.path}`);c.push("")}if(be.images&&be.images.length>0){c.push("Images:");for(const Sr of be.images)c.push(`- ${Sr}`);c.push("")}}return`${c.join(`
97
+ `).trimEnd()}
98
+ `}function j0(c){return c.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function xd(c,h){if(typeof window>"u")return h;const b=window.localStorage.getItem(c);return b===null?h:b==="1"}function N0(){if(typeof window>"u")return"system";const c=window.localStorage.getItem(wv);return c==="light"||c==="dark"?c:"system"}function $0(){if(typeof window>"u")return"steer";const c=window.localStorage.getItem(yv);return c==="steer"||c==="queue"?c:"queue"}function O0(){if(typeof window>"u")return"standard";const c=window.localStorage.getItem(kv);return c==="standard"||c==="wide"||c==="extra-wide"?c:"standard"}function $p(){ws.value=!ws.value,window.localStorage.setItem(vv,ws.value?"1":"0")}function Op(){ja.value=ja.value==="steer"?"queue":"steer",window.localStorage.setItem(yv,ja.value)}function Dp(){const c=["system","light","dark"],h=c.indexOf(bs.value);bs.value=c[(h+1)%c.length],window.localStorage.setItem(wv,bs.value),Ou()}function Fp(){const c=["standard","wide","extra-wide"],h=c.indexOf(oi.value);oi.value=c[(h+1)%c.length],window.localStorage.setItem(kv,oi.value)}function D0(){Ts.value=!Ts.value,window.localStorage.setItem(bv,Ts.value?"1":"0")}function F0(){Ss.value=!Ss.value,window.localStorage.setItem(Tv,Ss.value?"1":"0")}async function B0(c){if(!ii.value){ii.value=!0;try{if(c==="codex"){Tr.value="codex";const h=await cg(!1);Rr.value=h.enabled}else if(c==="openrouter"){Tr.value="openrouter";const h=await cg(!0);Rr.value=h.enabled,await el("","",{wireApi:$a.value,provider:"openrouter"})}else c==="opencode-zen"?(Tr.value="opencode-zen",await el("",Oa.value.trim(),{wireApi:"responses",provider:"opencode-zen"}),Rr.value=!0):c==="custom"&&(Tr.value="custom",ks.value.trim()&&xo.value.trim()&&(await el(ks.value.trim(),xo.value.trim(),{wireApi:Io.value}),Rr.value=!0));Lr.value="",await ae({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(h){Lr.value=h instanceof Error?h.message:"Failed to switch provider"}finally{ii.value=!1}}}async function U0(){if(Mn.value)return;const c=ks.value.trim();if(c){Mn.value=!0;try{Lr.value="",await el(c,xo.value.trim(),{wireApi:Io.value}),Rr.value=!0;const h=await ug();h.provider==="custom"&&!h.currentModel&&(Lr.value=f("Failed to resolve model from custom endpoint; check the URL and try again")),await ae({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(h){Lr.value=h instanceof Error?h.message:"Failed to save custom endpoint"}finally{Mn.value=!1}}}async function z0(c){if(Mn.value||ii.value||$a.value===c)return;const h=$a.value;$a.value=c,Mn.value=!0;try{Lr.value="",await el("","",{wireApi:c,provider:"openrouter"}),Rr.value=!0,await ae({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(b){$a.value=h,Lr.value=b instanceof Error?b.message:"Failed to save OpenRouter API format"}finally{Mn.value=!1}}async function H0(){if(Mn.value)return;const c=Oa.value.trim();if(c){Mn.value=!0;try{Lr.value="",await el("",c,{wireApi:"responses",provider:"opencode-zen"}),Rr.value=!0,await ae({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(h){Lr.value=h instanceof Error?h.message:"Failed to save OpenCode Zen config"}finally{Mn.value=!1}}}async function W0(){if(!Mn.value){Mn.value=!0;try{const c=Na.value.trim();await dg(c),Na.value="",await Id(),await ae({includeSelectedThreadMessages:!1})}catch{}finally{Mn.value=!1}}}async function q0(){if(!Mn.value){Mn.value=!0;try{await dg(""),Na.value="",await Id(),await ae({includeSelectedThreadMessages:!1})}catch{}finally{Mn.value=!1}}}async function Id(){try{const c=Tr.value,h=await ug();Rr.value=h.enabled,_l.value=h.customKey??!1,Cu.value=h.maskedKey??null,h.enabled?h.provider==="opencode-zen"?Tr.value="opencode-zen":h.provider==="custom"?(Tr.value="custom",ks.value=h.customBaseUrl??"",Io.value=h.wireApi==="chat"?"chat":"responses"):(Tr.value="openrouter",$a.value=h.wireApi==="chat"?"chat":"responses"):Tr.value="codex",Vi=h.hasCodexAuth===!0,Vi||(Me=!1);const b=Tr.value!==c;b&&await ae({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0});const F=await Zh();F&&await ae({includeSelectedThreadMessages:!1,providerChanged:b||F,awaitAncillaryRefreshes:!0})}catch{}}function G0(c){const b=Ad(c.trim())||"auto";ai.value=b,window.localStorage.setItem(Sv,b)}function V0(c){ka(Number(c))}const K0=[{value:"0",label:f("Off")},{value:"5",label:"5%"},{value:"10",label:"10%"},{value:"15",label:"15%"},{value:"20",label:"20%"},{value:"25",label:"25%"}];function Y0(){var b;if(typeof window>"u")return"auto";const c=((b=window.localStorage.getItem(Sv))==null?void 0:b.trim())||"auto";return Ad(c)||"auto"}function J0(){const c=[{value:"auto",label:f("Auto-detect")}],h=new Set(["auto"]);function b(J){const be=q[J]||J;return`${be.charAt(0).toUpperCase()+be.slice(1)} (${J})`}for(const J of typeof navigator<"u"?navigator.languages??[]:[]){const be=Ad(J);!be||h.has(be)||(h.add(be),c.push({value:be,label:`${f("Preferred")}: ${b(be)}`}))}for(const J of Object.keys(q))h.has(J)||(h.add(J),c.push({value:J,label:b(J)}));const F=ai.value.trim();return F&&!h.has(F)&&c.push({value:F,label:b(F)}),c}function Ad(c){const h=c.trim().toLowerCase();if(!h||h==="auto")return"";if(h in q)return h;const b=h.split("-")[0]??h;return b in q?b:""}function Ou(){const c=document.documentElement;if(bs.value==="dark")c.classList.add("dark");else if(bs.value==="light")c.classList.remove("dark");else{const h=window.matchMedia("(prefers-color-scheme: dark)").matches;c.classList.toggle("dark",h)}Q0()}function Q0(){const c=document.querySelector('meta[name="theme-color"]');if(!c)return;const h=window.getComputedStyle(document.documentElement).getPropertyValue("--s0").trim();h&&c.setAttribute("content",h)}const X0=Y(()=>({activeSettingsGroup:_i.value,accounts:Yn.value,isAccountsSectionCollapsed:rn.value,isRefreshingAccounts:la.value,isSwitchingAccounts:Co.value,isStartingCodexLogin:ua.value,isCompletingCodexLogin:Un.value,accountActionError:vn.value,codexLoginUrl:ri.value,feedbackMailto:Ar,isAccountUnavailable:Pu,isRemoveConfirmationActive:md,isRemoveVisible:sT,buildAccountTitle:hT,formatAccountMeta:tp,formatAccountQuota:np,shortAccountId:rT,isAccountActionDisabled:aT,getAccountSwitchLabel:iT,getAccountRemoveLabel:lT,onRefreshAccounts:pT,onStartCodexLogin:gT,onSwitchAccount:mT,onRemoveAccount:wT,onAccountCardPointerEnter:uT,onAccountCardPointerLeave:cT,toggleAccountsSectionCollapsed:fs,prepareFeedbackLink:Mt,sendWithEnter:ws.value,inProgressSendMode:ja.value,darkMode:bs.value,uiLanguage:v.value,uiLanguageOptions:T,chatWidthLabel:Ub.value,dictationClickToToggle:Ts.value,dictationAutoSend:Ss.value,dictationLanguage:ai.value,dictationLanguageOptions:si.value,autoCompactThreshold:Ys.value,autoCompactThresholdOptions:K0,hasVisibleFeedbackError:El.value,selectedProvider:Tr.value,providerDropdownOptions:od.value,freeModeLoading:ii.value,providerError:Lr.value,freeModeHasCustomKey:_l.value,freeModeCustomKey:Na.value,freeModeCustomKeyMasked:Cu.value,freeModeCustomKeySaving:Mn.value,openRouterWireApi:$a.value,opencodeZenKey:Oa.value,customEndpointUrl:ks.value,customEndpointKey:xo.value,customEndpointWireApi:Io.value,isTelegramConfigOpen:ir.value,telegramStatusText:Hb.value,telegramBotTokenDraft:Fi.value,telegramAllowedUserIdsDraft:li.value,telegramConfigError:fa.value,isTelegramSaving:Pl.value,supportsHooks:Ei.value,isHooksLoading:Ie.value,hooksList:je.value,supportsRemoteControl:Mi.value,remoteControlStatus:Fn.value,isRemoteControlActionInFlight:vr.value,remoteControlError:qr.value,remoteControlNotice:vo.value,isRemoteControlLoading:Wt.value,remoteControlActionName:ar.value,pairingCode:Ft.value,accountRateLimitSnapshots:Je.value,worktreeName:R,appVersion:E,onClose:()=>{an.value=!1},onActiveSettingsGroupChange:c=>{_i.value=c},toggleSendWithEnter:$p,cycleInProgressSendMode:Op,cycleDarkMode:Dp,onUiLanguageChange:k,cycleChatWidth:Fp,toggleDictationClickToToggle:D0,toggleDictationAutoSend:F0,onDictationLanguageChange:G0,onAutoCompactThresholdChange:V0,onProviderChange:B0,onFreeModeCustomKeyChange:c=>{Na.value=c},clearFreeModeCustomKey:q0,saveFreeModeCustomKey:W0,setOpenRouterWireApi:z0,onOpencodeZenKeyChange:c=>{Oa.value=c},saveOpencodeZen:H0,onCustomEndpointUrlChange:c=>{ks.value=c},onCustomEndpointKeyChange:c=>{xo.value=c},saveCustomEndpoint:U0,onCustomEndpointWireApiChange:c=>{Io.value=c},onTelegramConfigOpenChange:c=>{ir.value=c},onTelegramBotTokenDraftChange:c=>{Fi.value=c},onTelegramAllowedUserIdsDraftChange:c=>{li.value=c},saveTelegramConfig:Kb,refreshHooks:Pe,toggleRemoteControl:ji,startRemotePairing:ni,refreshRemoteClients:Ra,revokeRemoteClient:Al}));function Bp(c,h){const b=(c??"").trim();return b.length>0?b:h.trim()||"message"}function Up(c){is(c)}async function Z0(){await kt.isReady(),vt.name==="thread"&&zn.value?cs(zn.value):(vt.name==="home"||vt.name==="skills"||vt.name==="automations")&&cs("",{persist:!1}),await ae({includeSelectedThreadMessages:vt.name==="thread"}),Nl({silent:!0}),await A0(),Er.value=!0,await _d(),uo()}async function _d(){if(or.value){ta=!0;return}or.value=!0;try{do{if(ta=!1,vt.name==="home"||vt.name==="skills"||vt.name==="automations"){te.value!==""&&await Ke("");continue}if(vt.name==="thread"){const c=zn.value;if(!c)continue;if(te.value!==c){if(await Ke(c)==="not-found")continue}else Ne(c,{silent:!0}).catch(()=>{})}}while(ta)}finally{or.value=!1}}ot(()=>[vt.name,zn.value,de.value,te.value],async()=>{Er.value&&await _d()}),ot(()=>[te.value,Cn.value],()=>{l0()}),ot(()=>[vt.name,Cn.value],([c,h])=>{c==="thread"&&Ru(h)},{immediate:!0}),ot(()=>te.value,async c=>{if(Er.value&&!or.value&&!(Gt.value||_o.value||xs.value)){if(!c){vt.name!=="home"&&await kt.replace({name:"home"});return}vt.name==="thread"&&zn.value===c||await kt.replace({name:"thread",params:{threadId:c}})}}),ot(()=>cd.value,c=>{if(c.length===0){gt.value="",Po();return}const h=gt.value.trim();h&&(c.some(F=>F.value===h)||(gt.value="")),Po()},{immediate:!0}),ot(()=>gt.value,()=>{ze.value={phase:"idle",title:"",message:""},Po()}),ot(()=>[vt.name,gt.value],([c,h])=>{c==="home"&&Ru(h)},{immediate:!0}),ot(ui,c=>{!c&&_n.value==="worktree"&&(_n.value="local")},{immediate:!0}),ot(()=>[_n.value,gt.value],([c,h])=>{c!=="worktree"||!ui.value||zp(h)},{immediate:!0}),ot(()=>_n.value,c=>{var h;if(c==="local"){ze.value={phase:"idle",title:"",message:""};const b=gt.value.trim();if(b&&ap(b)){const F=((h=ce.value)==null?void 0:h.projectName)??Nr(b),J=Yi(F,"");J&&(gt.value=J)}return}ui.value&&zp(gt.value)}),ot(()=>vt.name,c=>{c!=="home"&&(ze.value={phase:"idle",title:"",message:""}),c!=="thread"&&(Dn.value=!1)}),ot(()=>te.value,()=>{ze.value={phase:"idle",title:"",message:""}}),ot(()=>[vt.name,Cn.value,ui.value],([c,h,b])=>{if(!(c==="thread"||c==="home"&&b)){Sp();return}Wr+=1,br.value={},sn.value="",To.value="",$l(h)},{immediate:!0}),ot(xb,c=>{typeof document>"u"||(document.title=c)},{immediate:!0}),ot(It,c=>{c&&!At.value&&cn(!0)},{immediate:!0});async function eS(c,h=[],b=[],F=[]){try{ze.value={phase:"idle",title:"",message:""};let J=gt.value;if(_n.value==="worktree"){ze.value={phase:"running",title:f("Creating worktree"),message:f("Creating a worktree and running setup.")};try{const Ue=await j_(gt.value,Vn.value);J=Ue.cwd,gt.value=Ue.cwd,ze.value={phase:"idle",title:"",message:""}}catch{ze.value={phase:"error",title:f("Worktree setup failed"),message:f("Unable to create worktree. Try again or switch to Local project.")};return}}else if(!J.trim()){const Ue=await J_(c);J=Ue.cwd,gt.value=Ue.cwd}const be=await wt(c,J,h,b,F);if(!be)return;await kt.replace({name:"thread",params:{threadId:be}}),ju()}catch{}}function tS(c){var F;if((F=c.prompt)!=null&&F.trim())return c.prompt.trim();const h=c.displayName.trim()||c.name.trim(),b=c.kind==="skill"?"skill":c.kind==="plugin"?"plugin":c.kind==="composio"?"Composio connector":"app";return`Test ${h} ${b}. Give me a list of what it can do and one useful example.`}function nS(c){return`${c.kind}:${c.name}:${c.skillPath??""}`}async function rS(c){var J;if(po.value)return;po.value=nS(c);const h=tS(c),b=(J=c.attachedSkills)!=null&&J.length?c.attachedSkills:c.kind==="skill"&&c.skillPath?[{name:c.name,path:c.skillPath}]:[],F=CF(b,Ee.value);try{const be=zh.value.trim()||Cn.value.trim(),Ue=await wt(h,be,[],F,[]);if(!Ue)return;await kt.replace({name:"thread",params:{threadId:Ue}}),ju()}catch{}finally{po.value=""}}async function zp(c){var b;const h=c.trim();if(!h){I.value=[],Vn.value="";return}$.value=!0;try{const F=await $_(h);I.value=F;const J=Vn.value.trim();if(!(J.length>0&&F.some(Ue=>Ue.value===J))){const Ue=F.find(Vt=>Vt.value.trim()==="main");Vn.value=(Ue==null?void 0:Ue.value)??((b=F[0])==null?void 0:b.value)??""}}catch{I.value=[],Vn.value=""}finally{$.value=!1}}return(c,h)=>(_(),B(at,null,[Fe(eI,{"is-sidebar-collapsed":g(At),onCloseSidebar:h[37]||(h[37]=b=>g(cn)(!0))},{sidebar:ht(()=>[w("section",xF,[w("div",{ref_key:"sidebarScrollableRef",ref:_a,class:"sidebar-scrollable",onScroll:h[7]||(h[7]=(...b)=>g(Qs)&&g(Qs)(...b))},[g(At)?ve("",!0):(_(),Ze(Wg,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":g(At),"show-new-thread-button":!0,onToggleSidebar:h[1]||(h[1]=b=>g(cn)(!g(At))),onStartNewThread:Mu},{default:ht(()=>[w("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":g(Mr),"aria-label":g(f)("Search threads"),title:g(f)("Search threads"),onClick:h[0]||(h[0]=(...b)=>g(na)&&g(na)(...b))},[Fe(oc,{class:"sidebar-search-toggle-icon"})],8,IF)]),_:1},8,["is-sidebar-collapsed"])),!g(At)&&g(Mr)?(_(),B("div",AF,[Fe(oc,{class:"sidebar-search-bar-icon"}),In(w("input",{ref_key:"sidebarSearchInputRef",ref:ds,"onUpdate:modelValue":h[2]||(h[2]=b=>Nn(Qt)?Qt.value=b:null),class:"sidebar-search-input",type:"text",placeholder:g(f)("Filter threads..."),onKeydown:h[3]||(h[3]=(...b)=>g(Pn)&&g(Pn)(...b))},null,40,_F),[[jn,g(Qt)]]),g(Qt).length>0?(_(),B("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":g(f)("Clear search"),onClick:h[4]||(h[4]=(...b)=>g(Pa)&&g(Pa)(...b))},[Fe(kc,{class:"sidebar-search-clear-icon"})],8,PF)):ve("",!0)])):ve("",!0),g(At)?ve("",!0):(_(),B("button",{key:2,class:ct(["sidebar-skills-link",{"is-active":_o.value}]),type:"button",onClick:h[5]||(h[5]=b=>{g(kt).push({name:"skills"}),g(It)&&g(cn)(!0)})},[w("span",EF,[Fe(Gg)]),w("span",MF,[w("span",RF,O(g(f)("Skills")),1),w("span",LF,O(g(f)("Plugins, apps, MCPs")),1)])],2)),g(At)?ve("",!0):(_(),B("button",{key:3,class:ct(["sidebar-skills-link",{"is-active":xs.value}]),type:"button",onClick:h[6]||(h[6]=b=>{g(kt).push({name:"automations"}),g(It)&&g(cn)(!0)})},[w("span",jF,[Fe(qg)]),w("span",NF,[w("span",$F,O(g(f)("Automations")),1),w("span",OF,O(g(f)("Scheduled work")),1)])],2)),g(At)?ve("",!0):(_(),Ze(EM,{key:4,ref_key:"sidebarThreadTreeRef",ref:$n,groups:g(K),"project-display-name-by-id":g(U),"project-git-repo-by-name":$b.value,"project-cwd-by-name":sp.value,"selected-thread-id":Yb.value,"is-loading":g(de),"is-thread-list-fully-loaded":g(D),"search-query":g(Qt),"search-matched-thread-ids":ra.value,onSelect:Qb,onArchive:rp,onStartNewThread:TT,onRenameProject:$T,onBrowseThreadFiles:ST,onSaveThreadProject:AT,onBrowseProjectFiles:xT,onSaveProject:IT,onRequestProjectGitStatus:BT,onCreateProjectWorktree:LT,onRenameThread:OT,onForkThread:op,onRemoveProject:DT,onReorderProject:FT,onCopyThreadChat:nT,onAutomationsChanged:tT,onRestoreThread:bT,onStartNewChat:NT},null,8,["groups","project-display-name-by-id","project-git-repo-by-name","project-cwd-by-name","selected-thread-id","is-loading","is-thread-list-fully-loaded","search-query","search-matched-thread-ids"]))],544),g(At)?ve("",!0):(_(),B("div",{key:0,ref_key:"settingsAreaRef",ref:Xs,class:"sidebar-settings-area",onClick:QT},[an.value?(_(),Ze(g(s),bh({key:0,ref_key:"settingsDialogRef",ref:hs},X0.value),null,16)):ve("",!0),w("div",DF,[w("button",{ref_key:"settingsButtonRef",ref:Ea,class:"sidebar-settings-icon-button",type:"button",title:g(f)("Settings"),"aria-label":g(f)("Settings"),onClick:mt(En,["stop"])},[Fe(jN,{class:"sidebar-settings-icon"})],8,FF),w("button",{ref:"recycleBinButtonRef",class:"sidebar-settings-icon-button",type:"button",title:g(f)("Recycle bin"),"aria-label":g(f)("Recycle bin"),onClick:mt(vp,["stop"])},[Fe(Pw,{class:"sidebar-settings-icon"})],8,BF)])],512))])]),content:ht(()=>[w("div",UF,[w("section",{class:ct(["content-root",{"is-virtual-keyboard-open":Rb.value}]),style:Zr(zb.value)},[Rl.value?(_(),B("span",zF)):ve("",!0),Fe(NM,{title:kb.value,accent:_o.value||xs.value},{leading:ht(()=>[g(At)||g(It)?(_(),Ze(Wg,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":g(At),"show-new-thread-button":!0,onToggleSidebar:h[8]||(h[8]=b=>g(cn)(!g(At))),onStartNewThread:Mu},null,8,["is-sidebar-collapsed"])):ve("",!0),_o.value?(_(),B("span",HF,[Fe(Gg)])):xs.value?(_(),B("span",WF,[Fe(qg)])):ve("",!0)]),actions:ht(()=>[w("button",{ref_key:"commandPaletteButtonRef",ref:dp,class:"content-header-command-button",type:"button","aria-label":g(f)("Command palette"),title:WT.value,onClick:hp},[Fe(oc,{class:"content-header-command-button-icon"})],8,qF),Ml.value?(_(),B("button",{key:0,class:"content-header-right-panel-toggle",type:"button","aria-label":g(It)?g(Zt)?g(f)("Close side panel"):g(f)("Open side panel"):g(gr)?g(f)("Open side panel"):g(f)("Close side panel"),title:g(It)?g(Zt)?g(f)("Close side panel"):g(f)("Open side panel"):g(gr)?g(f)("Open side panel"):g(f)("Close side panel"),onClick:h[9]||(h[9]=(...b)=>g(ho)&&g(ho)(...b))},[Fe(Mw,{class:"content-header-right-panel-toggle-icon"})],8,GF)):ve("",!0)]),_:1},8,["title","accent"]),w("section",VF,[_o.value?(_(),Ze(g(o),{key:0,ref_key:"directoryHubRef",ref:Ir,cwd:zh.value,"thread-id":zn.value,"try-in-flight-key":po.value,onSkillsChanged:Wb,onTryItem:rS},null,8,["cwd","thread-id","try-in-flight-key"])):xs.value?(_(),Ze(g(a),{key:1,ref_key:"automationsPanelRef",ref:hn,groups:g(K),"project-cwd-by-name":sp.value,"project-display-name-by-id":g(U),"selected-automation-id":Fh.value,onSelectAutomation:Xb,onEditAutomation:Zb,onCreateAutomation:eT},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):Gt.value?(_(),B("div",KF,[w("div",YF,[w("p",JF,O(g(f)("Let's build")),1),Fe(Ci,{class:"new-thread-folder-dropdown","model-value":gt.value,options:cd.value,placeholder:g(f)("Choose folder"),"enable-search":!0,"search-placeholder":g(f)("Quick search project"),disabled:!1,"onUpdate:modelValue":e0},null,8,["model-value","options","placeholder","search-placeholder"]),gt.value?(_(),B("p",{key:0,class:"new-thread-folder-selected",title:gt.value},O(g(f)("Selected folder"))+": "+O(gt.value),9,QF)):ve("",!0),w("div",XF,[w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:b0},O(g(f)("Select folder")),1),w("button",{class:"new-thread-folder-action",type:"button",onClick:u0},O(g(f)("Create Project")),1),w("button",{class:"new-thread-folder-action",type:"button",disabled:H.value,onClick:g0},O(H.value?g(f)("Importing…"):g(f)("Import Project")),9,ZF),w("input",{ref_key:"projectImportInputRef",ref:me,class:"new-thread-project-import-input",type:"file",accept:".zip,application/zip",tabindex:"-1","aria-hidden":"true",onChange:w0},null,544)]),Di.value?(_(),B("section",eB,[w("div",tB,[w("div",nB,[w("span",rB,[Fe(Qc)]),w("p",oB,O(g(f)("New in Codex")),1)]),w("h2",aB,O(g(f)("Plugins are here")),1),w("p",sB,O(g(f)("Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.")),1),h[42]||(h[42]=w("div",{class:"new-thread-launch-card-pills","aria-label":"Example integrations"},[w("span",{class:"new-thread-launch-card-pill"},"Gmail"),w("span",{class:"new-thread-launch-card-pill"},"Calendar"),w("span",{class:"new-thread-launch-card-pill"},"GitHub"),w("span",{class:"new-thread-launch-card-pill"},"Slack"),w("span",{class:"new-thread-launch-card-pill"},"Browser Use")],-1))]),w("div",iB,[w("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:jb},O(g(f)("Explore Plugins & Apps")),1),w("button",{class:"new-thread-launch-card-button",type:"button",onClick:Wh},O(g(f)("Dismiss")),1)])])):ve("",!0),(_(),Ze(Ws,{to:"body"},[fe.value?(_(),B("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:mt(c0,["self"]),onMouseup:d0},[w("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":g(f)("Select folder"),onKeydown:kr(mt(Qi,["prevent"]),["esc"])},[w("div",uB,[w("p",cB,O(g(f)("Select folder")),1),w("button",{class:"new-thread-open-folder-close",type:"button",onClick:Qi},O(g(f)("Cancel")),1)]),w("p",dB,O(g(f)("Current folder")),1),w("div",fB,[In(w("input",{ref_key:"existingFolderPathInputRef",ref:He,"onUpdate:modelValue":h[10]||(h[10]=b=>Ct.value=b),class:"new-thread-open-folder-path",type:"text",placeholder:g(f)("Current folder"),title:Ct.value||g(f)("Unavailable"),disabled:Rn.value||Ln.value,onBlur:C0,onKeydown:[kr(mt(x0,["prevent"]),["enter"]),kr(mt(Qi,["prevent"]),["esc"])]},null,40,hB),[[jn,Ct.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!jl.value||Rn.value||Ln.value,onClick:h[11]||(h[11]=b=>Sd())},O(Ln.value?g(f)("Opening…"):g(f)("Open")),9,pB)]),w("div",mB,[w("label",gB,[In(w("input",{"onUpdate:modelValue":h[12]||(h[12]=b=>Ba.value=b),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:S0},null,544),[[_C,Ba.value]]),w("span",null,O(g(f)("Show hidden folders")),1)]),w("button",{class:ct(["new-thread-folder-action",{"new-thread-folder-action-primary":ha.value}]),type:"button","aria-pressed":ha.value,disabled:!tt.value||Rn.value||Ln.value||Fa.value||!!ft.value&&!ha.value,onClick:I0},O(g(f)("New folder")),11,vB)]),ha.value?(_(),B("div",yB,[w("div",wB,[In(w("input",{ref_key:"createFolderInputRef",ref:Su,"onUpdate:modelValue":h[13]||(h[13]=b=>Da.value=b),class:"new-thread-open-folder-create-input",type:"text",placeholder:g(f)("Folder name"),onKeydown:[kr(mt(xp,["prevent"]),["enter"]),kr(mt(Ol,["prevent"]),["esc"])]},null,40,bB),[[jn,Da.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!Ob.value||Fa.value,onClick:xp},O(Db.value),9,TB)]),Jn.value?(_(),B("div",SB,[w("span",null,O(Jn.value),1),w("a",{class:"visible-error-feedback",href:g(Ar),onClick:h[14]||(h[14]=b=>Mt(b,Jn.value))},O(g(f)("Send feedback")),9,kB)])):ve("",!0)])):ve("",!0),In(w("input",{ref_key:"existingFolderFilterInputRef",ref:rt,"onUpdate:modelValue":h[15]||(h[15]=b=>pa.value=b),class:"new-thread-open-folder-filter",type:"text",placeholder:g(f)("Filter folders..."),onKeydown:kr(mt(Qi,["prevent"]),["esc"])},null,40,CB),[[jn,pa.value]]),ft.value?(_(),B("div",xB,[w("div",IB,[w("span",null,O(ft.value),1),w("a",{class:"visible-error-feedback",href:g(Ar),onClick:h[16]||(h[16]=b=>Mt(b,ft.value))},O(g(f)("Send feedback")),9,AB)]),w("button",{class:"new-thread-folder-action",type:"button",disabled:Rn.value||Ln.value,onClick:k0},O(g(f)("Retry")),9,_B)])):ve("",!0),Rn.value?(_(),B("p",PB,O(g(f)("Loading folders…")),1)):!ft.value&&fd.value.length===0?(_(),B("p",EB,O(pa.value.trim()?g(f)("No folders match this filter."):g(f)("No subfolders found here.")),1)):fd.value.length>0?(_(),B("ul",MB,[(_(!0),B(at,null,Ht(fd.value,b=>(_(),B("li",{key:b.key,class:"new-thread-open-folder-item"},[w("button",{class:"new-thread-open-folder-item-main",type:"button",title:b.path,disabled:Rn.value||Ln.value,onClick:F=>T0(b.path)},[w("span",LB,O(b.name),1)],8,RB),b.kind==="directory"?(_(),B("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:Rn.value||Ln.value,onClick:F=>Sd(b.path)},O(g(f)("Open")),9,jB)):ve("",!0)]))),128))])):ve("",!0)],40,lB)],32)):ve("",!0)])),(_(),Ze(Ws,{to:"body"},[Bi.value?(_(),B("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:mt(f0,["self"]),onMouseup:h0},[w("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":g(f)("Create or clone project"),onKeydown:kr(mt(Nu,["prevent"]),["esc"])},[w("div",$B,[w("p",OB,O(g(f)("Create or clone project")),1),w("button",{class:"new-thread-open-folder-close",type:"button",disabled:z.value,onClick:Nu},O(g(f)("Cancel")),9,DB)]),w("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":g(f)("Project source")},[w("button",{class:ct(["new-thread-project-mode-tab",{"is-active":p.value==="create"}]),type:"button",role:"tab","aria-selected":p.value==="create",disabled:z.value,onClick:h[17]||(h[17]=b=>p.value="create")},O(g(f)("New project")),11,BB),w("button",{class:ct(["new-thread-project-mode-tab",{"is-active":p.value==="clone"}]),type:"button",role:"tab","aria-selected":p.value==="clone",disabled:z.value,onClick:h[18]||(h[18]=b=>p.value="clone")},O(g(f)("Clone from GitHub")),11,UB)],8,FB),w("label",zB,[w("span",HB,O(g(f)("Destination folder")),1),In(w("input",{"onUpdate:modelValue":h[19]||(h[19]=b=>y.value=b),class:"new-thread-open-folder-path",type:"text",disabled:z.value,placeholder:g(f)("Destination folder")},null,8,WB),[[jn,y.value]])]),p.value==="create"?(_(),B("label",qB,[w("span",GB,O(g(f)("Project name")),1),In(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:oe,"onUpdate:modelValue":h[20]||(h[20]=b=>A.value=b),class:"new-thread-open-folder-create-input",type:"text",disabled:z.value,placeholder:g(f)("Project name"),onKeydown:kr(mt(Td,["prevent"]),["enter"])},null,40,VB),[[jn,A.value]])])):p.value==="clone"?(_(),B("label",KB,[w("span",YB,O(g(f)("GitHub repository URL")),1),In(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:oe,"onUpdate:modelValue":h[21]||(h[21]=b=>L.value=b),class:"new-thread-open-folder-create-input",type:"url",disabled:z.value,placeholder:"https://github.com/owner/repo",onKeydown:kr(mt(Td,["prevent"]),["enter"])},null,40,JB),[[jn,L.value]])])):ve("",!0),V.value?(_(),B("div",QB,[w("span",null,O(V.value),1),w("a",{class:"visible-error-feedback",href:g(Ar),onClick:h[22]||(h[22]=b=>Mt(b,V.value))},O(g(f)("Send feedback")),9,XB)])):ve("",!0),w("div",ZB,[w("button",{class:"new-thread-folder-action",type:"button",disabled:z.value,onClick:Nu},O(g(f)("Cancel")),9,e2),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!Qh.value||z.value,onClick:Td},O(Fb.value),9,t2)])],40,NB)],32)):ve("",!0)])),ui.value?(_(),Ze(hN,{key:2,class:"new-thread-runtime-dropdown",modelValue:_n.value,"onUpdate:modelValue":h[23]||(h[23]=b=>_n.value=b)},null,8,["modelValue"])):ve("",!0),_n.value==="worktree"?(_(),B("div",n2,[w("p",r2,O(g(f)("Base branch")),1),Fe(Ci,{class:"new-thread-branch-dropdown","model-value":Vn.value,options:dd.value,placeholder:g(f)("Select branch"),"enable-search":!0,"search-placeholder":g(f)("Search branches..."),disabled:$.value||dd.value.length===0,"onUpdate:modelValue":t0},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),w("p",o2,O($.value?g(f)("Loading branches…"):Vh.value?g(f)("New worktree branch will start from {branch}.",{branch:Vh.value}):g(f)("No Git branches found for this folder.")),1)])):ve("",!0),ui.value?(_(),B("p",a2,O(g(f)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):ve("",!0),ze.value.phase!=="idle"?(_(),B("div",{key:5,class:ct(["worktree-init-status",{"is-running":ze.value.phase==="running","is-error":ze.value.phase==="error"}])},[w("strong",s2,O(ze.value.title),1),w("span",i2,O(ze.value.message),1)],2)):ve("",!0)]),w("div",l2,[g(xe)?(_(),B("div",u2,[w("span",null,O(g(f)(g(xe))),1),w("a",{class:"visible-error-feedback",href:g(Ar),onClick:h[24]||(h[24]=b=>Mt(b,g(xe)))},O(g(f)("Send feedback")),9,c2)])):ve("",!0),Fe(Ug,{ref_key:"homeThreadComposerRef",ref:co,"active-thread-id":Is.value,cwd:Cn.value,"fuzzy-file-search-results":g(ut),onRegisterFuzzySession:g(X),"collaboration-modes":g(Ae),"selected-collaboration-mode":g(De),models:g(Oe),"model-reasoning-efforts":g($e),"selected-model":Uh.value,"selected-reasoning-effort":g(Se),"selected-speed-mode":g(Te),"is-updating-speed-mode":g(W),skills:g(Ee),"thread-token-usage":g(G),"codex-quota":g(he),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":ws.value,"in-progress-submit-mode":ja.value,"dictation-click-to-toggle":Ts.value,"dictation-auto-send":Ss.value,"dictation-language":ai.value,onSubmit:Tp,"onUpdate:selectedCollaborationMode":Up,"onUpdate:selectedModel":Pp,"onUpdate:selectedReasoningEffort":Ep,"onUpdate:selectedSpeedMode":Mp,"approval-policy":Gr.value,"is-approval-policy-saving":Vr.value,"approval-policy-error":wr.value,"approval-policy-notice":Kr.value,"onUpdate:approvalPolicy":vs,onSaveApprovalPolicy:Yr,onSlashCommand:Lp},null,8,["active-thread-id","cwd","fuzzy-file-search-results","onRegisterFuzzySession","collaboration-modes","selected-collaboration-mode","models","model-reasoning-efforts","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","thread-token-usage","codex-quota","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","dictation-language","approval-policy","is-approval-policy-saving","approval-policy-error","approval-policy-notice"])])])):(_(),B("div",d2,[Dn.value&&g(te)&&Cn.value?(_(),Ze(g(r),{key:0,"thread-id":g(te),cwd:Cn.value,"is-thread-in-progress":Au.value,"initial-file-path":kn.value,"commit-sha":Bn.value,onClose:h[25]||(h[25]=b=>Dn.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress","initial-file-path","commit-sha"])):ve("",!0),w("div",f2,[Fe(g(t),{ref_key:"threadConversationRef",ref:bn,messages:Ib.value,"is-loading":g(ne),"is-slow-open":g(se)!==null&&g(se)===Is.value,"active-thread-id":Is.value,cwd:Cn.value,"live-overlay":Pb.value,"live-turn-id":g(ee),"pending-requests":g(le),"has-more-persisted-above":g(nt),"is-loading-persisted-above":g(Le),"load-earlier-messages":g(Ge),onForkThread:zT,onRollback:E0,onEditMessage:M0,onFileChangesChanged:qb,onRespondServerRequest:cp},null,8,["messages","is-loading","is-slow-open","active-thread-id","cwd","live-overlay","live-turn-id","pending-requests","has-more-persisted-above","is-loading-persisted-above","load-earlier-messages"])]),w("div",{class:"composer-with-queue",ref_key:"composerQueueRef",ref:wn},[Hh.value?(_(),B("div",h2,O(g(f)("This thread is running in the Codex TUI")),1)):ve("",!0),g(xe)?(_(),B("div",p2,[w("span",null,O(g(f)(g(xe))),1),w("a",{class:"visible-error-feedback",href:g(Ar),onClick:h[26]||(h[26]=b=>Mt(b,g(xe)))},O(g(f)("Send feedback")),9,m2)])):ve("",!0),Fe(g(m),{messages:g(so),onEdit:ZT,onSteer:g(io),onDelete:g(tr),onReorder:P0},null,8,["messages","onSteer","onDelete"]),Dl.value?(_(),B("div",g2,[w("span",null,O(Dl.value),1),w("button",{type:"button",class:"interrupt-recovered-dismiss","aria-label":g(f)("Dismiss"),onClick:h[27]||(h[27]=b=>Dl.value="")}," × ",8,v2)])):ve("",!0),Iu.value?(_(),Ze(g(d),{key:3,request:Iu.value,"request-count":g(le).length,"has-queue-above":g(so).length>0,"panel-width":Br.value,"visual-viewport-height":Rl.value?ma.value:0,"panel-error":Eb.value,onRespondServerRequest:cp},null,8,["request","request-count","has-queue-above","panel-width","visual-viewport-height","panel-error"])):(_(),Ze(Ug,{key:4,ref_key:"threadComposerRef",ref:rr,"active-thread-id":Is.value,cwd:Cn.value,"fuzzy-file-search-results":g(ut),onRegisterFuzzySession:g(X),"collaboration-modes":g(Ae),"selected-collaboration-mode":g(De),models:g(Oe),"model-reasoning-efforts":g($e),"selected-model":Uh.value,"selected-reasoning-effort":g(Se),"selected-speed-mode":g(Te),"is-updating-speed-mode":g(W),skills:g(Ee),"thread-token-usage":g(G),"codex-quota":g(he),"is-turn-in-progress":Au.value,"is-stop-pending":g(j),"is-interrupting-turn":g(P),"is-compacting":Lb.value,"external-session-active":Hh.value,"has-queue-above":g(so).length>0,"send-with-enter":ws.value,"in-progress-submit-mode":ja.value,"dictation-click-to-toggle":Ts.value,"dictation-auto-send":Ss.value,"dictation-language":ai.value,"onUpdate:selectedCollaborationMode":Up,onSubmit:Tp,"onUpdate:selectedModel":Pp,"onUpdate:selectedReasoningEffort":Ep,"onUpdate:selectedSpeedMode":Mp,"approval-policy":Gr.value,"is-approval-policy-saving":Vr.value,"approval-policy-error":wr.value,"approval-policy-notice":Kr.value,"onUpdate:approvalPolicy":vs,onSaveApprovalPolicy:Yr,"plan-panel":xu.value,onInterrupt:Rp,onSlashCommand:Lp,onImplementPlan:jp,onCompactContext:qh},null,8,["active-thread-id","cwd","fuzzy-file-search-results","onRegisterFuzzySession","collaboration-modes","selected-collaboration-mode","models","model-reasoning-efforts","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","thread-token-usage","codex-quota","is-turn-in-progress","is-stop-pending","is-interrupting-turn","is-compacting","external-session-active","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","dictation-language","approval-policy","is-approval-policy-saving","approval-policy-error","approval-policy-notice","plan-panel"]))],512)]))])],6),g(It)&&g(Zt)?(_(),B("div",{key:0,class:"content-right-panel-backdrop",role:"presentation",onClick:h[28]||(h[28]=(...b)=>g(mn)&&g(mn)(...b))})):ve("",!0),Ml.value&&(g(It)||!g(gr))?(_(),B("aside",{key:1,class:ct(["content-right-panel",{"is-mobile-open":g(Zt)}]),style:Zr({"--right-panel-width":`${g(un)}px`})},[g(It)?ve("",!0):(_(),B("div",{key:0,class:"content-right-panel-resize-handle","aria-hidden":"true",onMousedown:h[29]||(h[29]=(...b)=>g(zr)&&g(zr)(...b))},null,32)),w("div",y2,[w("div",w2,[w("button",{class:ct(["content-right-panel-tab",{"is-active":g(Bt)==="git"}]),type:"button",role:"tab","aria-selected":g(Bt)==="git",onClick:h[30]||(h[30]=b=>g(Ut)("git"))},[Fe(Cc,{class:"content-right-panel-tab-icon"}),Fs(" "+O(g(f)("Git")),1)],10,b2),w("button",{class:ct(["content-right-panel-tab",{"is-active":g(Bt)==="files"}]),type:"button",role:"tab","aria-selected":g(Bt)==="files",onClick:h[31]||(h[31]=b=>g(Ut)("files"))},[Fe(Vg,{class:"content-right-panel-tab-icon"}),Fs(" "+O(g(f)("Files")),1)],10,T2),(_(!0),B(at,null,Ht(g(fo),b=>(_(),B("button",{key:b.key,class:ct(["content-right-panel-tab content-right-panel-tab--preview",{"is-active":g(Bt)==="preview"&&g(Vo)===b.key}]),type:"button",role:"tab","aria-selected":g(Bt)==="preview"&&g(Vo)===b.key,title:b.path,onClick:F=>g(Xo)(b.key)},[Fe(Cl,{class:"content-right-panel-tab-icon"}),w("span",k2,O(b.label),1),w("span",{class:"content-right-panel-tab-close",role:"button","aria-label":g(f)("Close"),title:g(f)("Close"),onClick:mt(F=>g(_t)(b.key),["stop"])},"×",8,C2)],10,S2))),128))]),w("div",x2,[w("div",I2,[w("button",{ref:"rightPanelAddButtonRef",class:"content-right-panel-add",type:"button","aria-label":g(f)("Add panel"),title:g(f)("Add panel"),onClick:h[32]||(h[32]=mt(b=>Tn.value=!g(Tn),["stop"]))},"+",8,A2),Fe(bu,{name:"right-panel-menu"},{default:ht(()=>[g(Tn)?(_(),B("div",_2,[w("button",{type:"button",onClick:h[33]||(h[33]=b=>g(Ut)("terminal"))},[Fe(DN,{class:"content-right-panel-menu-icon"}),Fs(" "+O(g(f)("Terminal panel")),1)]),w("button",{type:"button",onClick:h[34]||(h[34]=b=>g(Ut)("git"))},[Fe(Cc,{class:"content-right-panel-menu-icon"}),Fs(" "+O(g(f)("Git panel")),1)]),w("button",{type:"button",onClick:h[35]||(h[35]=b=>g(Ut)("files"))},[Fe(Vg,{class:"content-right-panel-menu-icon"}),Fs(" "+O(g(f)("Files panel")),1)])])):ve("",!0)]),_:1})]),w("button",{class:"content-right-panel-close",type:"button","aria-label":g(f)("Close panel"),title:g(f)("Close panel"),onClick:h[36]||(h[36]=(...b)=>g(mn)&&g(mn)(...b))},[Fe(kc,{class:"content-right-panel-close-icon"})],8,P2)])]),w("div",E2,[g(Bt)==="git"?(_(),Ze(g(i),{key:0,"current-branch":sr.value,"head-sha":sa.value,"head-subject":C.value,"head-date":M.value,detached:x.value,dirty:Z.value,"worktree-change-summary":Qe.value,"worktree-changes":qt.value,branches:bo.value,"commits-by-branch":br.value,"commits-loading-for":sn.value,"commits-error":To.value,"commit-files-by-sha":So.value,"commit-files-loading-for":ia.value,"commit-files-error":ys.value,loading:$i.value,busy:ko.value,error:Kn.value,"review-open":Dn.value,"show-review":g(vt).name==="thread"&&g(te).length>0,onToggleReview:i0,onCheckoutBranch:r0,onResetBranchToCommit:o0,onLoadCommits:Cp,onLoadCommitFiles:a0,onOpenCommitFile:s0},null,8,["current-branch","head-sha","head-subject","head-date","detached","dirty","worktree-change-summary","worktree-changes","branches","commits-by-branch","commits-loading-for","commits-error","commit-files-by-sha","commit-files-loading-for","commit-files-error","loading","busy","error","review-open","show-review"])):g(Bt)==="files"?(_(),Ze(g(l),{key:1,cwd:Cn.value,onOpenPreview:g(Qo)},null,8,["cwd","onOpenPreview"])):g(Bt)==="preview"&&g(Ko)?(_(),Ze(g(u),{key:2,"file-path":g(Ko).path,name:g(Ko).label},null,8,["file-path","name"])):(_(),Ze(g(n),{key:3,ref_key:"threadTerminalPanelRef",ref:Ia,"thread-id":Is.value,cwd:Cn.value,onHide:g(_r),onTerminalFocusChange:g(Pr)},null,8,["thread-id","cwd","onHide","onTerminalFocusChange"]))])],6)):ve("",!0)])]),_:1},8,["is-sidebar-collapsed"]),As.value?(_(),Ze(tR,{key:0,commands:KT.value,onClose:Lu,onRun:YT},null,8,["commands"])):ve("",!0),Ji.value?(_(),Ze(TR,{key:1,"is-mac":tn(),onClose:pp},null,8,["is-mac"])):ve("",!0),ke.value.phase!=="idle"?(_(),B("div",M2,[w("div",{class:"project-zip-modal",role:"dialog","aria-modal":"true","aria-label":g(f)("Export Project"),onClick:h[38]||(h[38]=mt(()=>{},["stop"]))},[w("div",L2,[w("h2",j2,O(g(f)("Export Project")),1),w("button",{class:"project-zip-modal-close",type:"button","aria-label":g(f)("Close"),disabled:ke.value.phase==="exporting",onClick:lp}," × ",8,N2)]),w("p",$2,O(ke.value.phase==="exporting"?g(f)("Preparing project ZIP..."):ke.value.fileName),1),w("div",O2,[w("span",null,O(ke.value.phase==="exporting"?g(f)("Exporting"):g(f)("Ready")),1),w("span",null,O(nd.value),1)]),w("div",D2,[w("div",{class:"project-zip-progress-fill",style:Zr({width:rd.value})},null,4)]),ke.value.error?(_(),B("p",F2,O(ke.value.error),1)):ve("",!0),w("div",B2,[w("button",{class:"project-zip-modal-cancel",type:"button",disabled:ke.value.phase==="exporting",onClick:lp},O(g(f)("Close")),9,U2),w("button",{class:"project-zip-modal-action",type:"button",disabled:!ke.value.blob,onClick:MT},O(g(f)("Download")),9,z2),w("button",{class:"project-zip-modal-action project-zip-modal-action-primary",type:"button",disabled:!ke.value.blob,onClick:RT},O(g(f)("Share")),9,H2)])],8,R2)])):ve("",!0),Oi.value?(_(),B("div",{key:3,class:"codex-login-modal-backdrop",role:"presentation",onClick:gd},[w("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":g(f)("Complete Codex login"),onSubmit:mt(vT,["prevent"]),onClick:h[41]||(h[41]=mt(()=>{},["stop"]))},[w("div",q2,[w("h2",G2,O(g(f)("Complete Codex login")),1),w("button",{class:"codex-login-modal-close",type:"button","aria-label":g(f)("Close"),disabled:Un.value,onClick:gd}," × ",8,V2)]),w("p",K2,O(g(f)("Finish login in the browser, then paste the localhost callback URL here.")),1),ri.value?(_(),B("a",{key:0,class:"codex-login-modal-link",href:ri.value,target:"_blank",rel:"noreferrer"},O(g(f)("Open login URL")),9,Y2)):ve("",!0),In(w("input",{ref_key:"codexLoginCallbackInputRef",ref:ku,"onUpdate:modelValue":h[39]||(h[39]=b=>La.value=b),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:g(f)("Paste localhost callback URL"),disabled:Un.value},null,8,J2),[[jn,La.value]]),vn.value?(_(),B("div",Q2,[w("span",null,O(vn.value),1),w("a",{class:"visible-error-feedback",href:g(Ar),onClick:h[40]||(h[40]=b=>Mt(b,vn.value))},O(g(f)("Send feedback")),9,X2)])):ve("",!0),w("div",Z2,[w("button",{class:"codex-login-modal-cancel",type:"button",disabled:Un.value,onClick:gd},O(g(f)("Cancel")),9,eU),w("button",{class:"codex-login-modal-submit",type:"submit",disabled:Un.value||La.value.trim().length===0},O(Un.value?g(f)("Completing…"):g(f)("Complete")),9,tU)])],40,W2)])):ve("",!0)],64))}}),oU=Tt(rU,[["__scopeId","data-v-a7821fec"]]),ec={render:()=>null},aU=Gx({history:Cx(),routes:[{path:"/",name:"home",component:ec},{path:"/thread/:threadId",name:"thread",component:ec},{path:"/skills",name:"skills",component:ec},{path:"/automations",name:"automations",component:ec},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codex-mobile-re. github: https://github.com/cattails-lgao/codex-mobile");BP();NC(oU).use(aU).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(Sw("Service worker registration failed."),e)})});export{jn as $,ot as A,Zr as B,Iw as C,Cc as D,Cr as E,at as F,zs as G,Gu as H,kc as I,p$ as J,hU as K,gF as L,Rc as M,nz as N,Mo as O,ez as P,tz as Q,xh as R,JN as S,Ws as T,Et as U,ss as V,sU as W,mh as X,In as Y,kr as Z,Tt as _,Ec as a,OU as a$,AR as a0,QU as a1,XU as a2,YN as a3,JU as a4,zU as a5,WU as a6,GU as a7,HU as a8,YU as a9,gU as aA,IU as aB,MU as aC,RU as aD,SU as aE,EU as aF,yU as aG,vU as aH,wU as aI,bU as aJ,LU as aK,NU as aL,$U as aM,kU as aN,CU as aO,xU as aP,AU as aQ,PU as aR,_U as aS,jU as aT,iI as aU,lI as aV,Qc as aW,FR as aX,iU as aY,Cl as aZ,_C as a_,qU as aa,VU as ab,KU as ac,Gs as ad,jh as ae,rP as af,YA as ag,cU as ah,lU as ai,dU as aj,uU as ak,fU as al,Ci as am,FU as an,UU as ao,BU as ap,Lh as aq,Kx as ar,Vx as as,Hg as at,zg as au,rz as av,FA as aw,TU as ax,pU as ay,mU as az,S as b,DU as b0,Y as c,lv as d,eF as e,Kg as f,Th as g,fn as h,_ as i,Ze as j,B as k,w as l,ct as m,Zu as n,Ks as o,ve as p,Ht as q,ZU as r,Fs as s,O as t,g as u,Fe as v,mt as w,bu as x,ht as y,ao as z};