codex-mobile-re 0.1.102 → 0.1.104

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,86 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-Cq7_5T10.js","assets/sanitizeHtml-Bd3No2dT.js","assets/ThreadConversation-lQVNzD-y.css","assets/ThreadTerminalPanel-BGadHi4n.js","assets/ThreadTerminalPanel-O7IxAyfy.css","assets/ReviewPane-mi7B5jTv.js","assets/ReviewPane-ZrWfZEd_.css","assets/DirectoryHub-DOxPtme6.js","assets/DirectoryHub-DmZLEiwB.css","assets/AutomationsPanel-B_WavWrg.js","assets/AutomationsPanel-VRBbmMYW.css"])))=>i.map(i=>d[i]);
2
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&o(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?a.credentials="include":r.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function o(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();/**
3
+ * @vue/shared v3.5.40
4
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
5
+ * @license MIT
6
+ **/function Cf(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Zt={},nl=[],za=()=>{},Tv=()=>!1,Su=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),_u=e=>e.startsWith("onUpdate:"),zn=Object.assign,Sf=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},b0=Object.prototype.hasOwnProperty,Vt=(e,t)=>b0.call(e,t),lt=Array.isArray,ol=e=>pc(e)==="[object Map]",xu=e=>pc(e)==="[object Set]",Wp=e=>pc(e)==="[object Date]",vt=e=>typeof e=="function",cn=e=>typeof e=="string",pa=e=>typeof e=="symbol",Kt=e=>e!==null&&typeof e=="object",kv=e=>(Kt(e)||vt(e))&&vt(e.then)&&vt(e.catch),Cv=Object.prototype.toString,pc=e=>Cv.call(e),T0=e=>pc(e).slice(8,-1),Sv=e=>pc(e)==="[object Object]",_f=e=>cn(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ql=Cf(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Au=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},k0=/-\w/g,Do=Au(e=>e.replace(k0,t=>t.slice(1).toUpperCase())),C0=/\B([A-Z])/g,ti=Au(e=>e.replace(C0,"-$1").toLowerCase()),Iu=Au(e=>e.charAt(0).toUpperCase()+e.slice(1)),fd=Au(e=>e?`on${Iu(e)}`:""),ia=(e,t)=>!Object.is(e,t),eu=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},_v=(e,t,n,o=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:o,value:n})},xf=e=>{const t=parseFloat(e);return isNaN(t)?e:t},S0=e=>{const t=cn(e)?Number(e):NaN;return isNaN(t)?e:t};let Vp;const Pu=()=>Vp||(Vp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function kr(e){if(lt(e)){const t={};for(let n=0;n<e.length;n++){const o=e[n],r=cn(o)?I0(o):kr(o);if(r)for(const a in r)t[a]=r[a]}return t}else if(cn(e)||Kt(e))return e}const _0=/;(?![^(]*\))/g,x0=/:([^]+)/,A0=/\/\*[^]*?\*\//g;function I0(e){const t={};return e.replace(A0,"").split(_0).forEach(n=>{if(n){const o=n.split(x0);o.length>1&&(t[o[0].trim()]=o[1].trim())}}),t}function Ye(e){let t="";if(cn(e))t=e;else if(lt(e))for(let n=0;n<e.length;n++){const o=Ye(e[n]);o&&(t+=o+" ")}else if(Kt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const P0="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",R0=Cf(P0);function xv(e){return!!e||e===""}function E0(e,t){if(e.length!==t.length)return!1;let n=!0;for(let o=0;n&&o<e.length;o++)n=hc(e[o],t[o]);return n}function hc(e,t){if(e===t)return!0;let n=Wp(e),o=Wp(t);if(n||o)return n&&o?e.getTime()===t.getTime():!1;if(n=pa(e),o=pa(t),n||o)return e===t;if(n=lt(e),o=lt(t),n||o)return n&&o?E0(e,t):!1;if(n=Kt(e),o=Kt(t),n||o){if(!n||!o)return!1;const r=Object.keys(e).length,a=Object.keys(t).length;if(r!==a)return!1;for(const s in e){const i=e.hasOwnProperty(s),u=t.hasOwnProperty(s);if(i&&!u||!i&&u||!hc(e[s],t[s]))return!1}}return String(e)===String(t)}function Av(e,t){return e.findIndex(n=>hc(n,t))}const Iv=e=>!!(e&&e.__v_isRef===!0),k=e=>cn(e)?e:e==null?"":lt(e)||Kt(e)&&(e.toString===Cv||!vt(e.toString))?Iv(e)?k(e.value):JSON.stringify(e,Pv,2):String(e),Pv=(e,t)=>Iv(t)?Pv(e,t.value):ol(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[o,r],a)=>(n[pd(o,a)+" =>"]=r,n),{})}:xu(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>pd(n))}:pa(t)?pd(t):Kt(t)&&!lt(t)&&!Sv(t)?String(t):t,pd=(e,t="")=>{var n;return pa(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 oo;class M0{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&&oo&&(oo.active?(this.parent=oo,this.index=(oo.scopes||(oo.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 o=this.scopes.slice();for(t=0,n=o.length;t<n;t++)o[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 r=this.scopes.slice();for(t=0,n=r.length;t<n;t++)r[t].resume()}const o=this.effects.slice();for(t=0,n=o.length;t<n;t++)o[t].resume()}}run(t){if(this._active){const n=oo;try{return oo=this,t()}finally{oo=n}}}on(){++this._on===1&&(this.prevScope=oo,oo=this)}off(){if(this._on>0&&--this._on===0){if(oo===this)oo=this.prevScope;else{let t=oo;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,o;for(n=0,o=this.effects.length;n<o;n++)this.effects[n].stop();for(this.effects.length=0,n=0,o=this.cleanups.length;n<o;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){const r=this.scopes.slice();for(n=0,o=r.length;n<o;n++)r[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}}function $0(){return oo}let an;const hd=new WeakSet;class Rv{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,oo&&(oo.active?oo.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,hd.has(this)&&(hd.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Mv(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Gp(this),$v(this);const t=an,n=ua;an=this,ua=!0;try{return this.fn()}finally{jv(this),an=t,ua=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Pf(t);this.deps=this.depsTail=void 0,Gp(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?hd.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Wd(this)&&this.run()}get dirty(){return Wd(this)}}let Ev=0,Xl,Zl;function Mv(e,t=!1){if(e.flags|=8,t){e.next=Zl,Zl=e;return}e.next=Xl,Xl=e}function Af(){Ev++}function If(){if(--Ev>0)return;if(Zl){let t=Zl;for(Zl=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Xl;){let t=Xl;for(Xl=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(o){e||(e=o)}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 jv(e){let t,n=e.depsTail,o=n;for(;o;){const r=o.prevDep;o.version===-1?(o===n&&(n=r),Pf(o),j0(o)):t=o,o.dep.activeLink=o.prevActiveLink,o.prevActiveLink=void 0,o=r}e.deps=t,e.depsTail=n}function Wd(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Lv(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Lv(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===ac)||(e.globalVersion=ac,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Wd(e))))return;e.flags|=2;const t=e.dep,n=an,o=ua;an=e,ua=!0;try{$v(e);const r=e.fn(e._value);(t.version===0||ia(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{an=n,ua=o,jv(e),e.flags&=-3}}function Pf(e,t=!1){const{dep:n,prevSub:o,nextSub:r}=e;if(o&&(o.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=o,e.nextSub=void 0),n.subs===e&&(n.subs=o,!o&&n.computed)){n.computed.flags&=-5;for(let a=n.computed.deps;a;a=a.nextDep)Pf(a,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function j0(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let ua=!0;const Nv=[];function ys(){Nv.push(ua),ua=!1}function ws(){const e=Nv.pop();ua=e===void 0?!0:e}function Gp(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=an;an=void 0;try{t()}finally{an=n}}}let ac=0;class L0{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 Rf{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(!an||!ua||an===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==an)n=this.activeLink=new L0(an,this),an.deps?(n.prevDep=an.depsTail,an.depsTail.nextDep=n,an.depsTail=n):an.deps=an.depsTail=n,Ov(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const o=n.nextDep;o.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=o),n.prevDep=an.depsTail,n.nextDep=void 0,an.depsTail.nextDep=n,an.depsTail=n,an.deps===n&&(an.deps=o)}return n}trigger(t){this.version++,ac++,this.notify(t)}notify(t){Af();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{If()}}}function Ov(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let o=t.deps;o;o=o.nextDep)Ov(o)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Vd=new WeakMap,Mi=Symbol(""),Gd=Symbol(""),sc=Symbol("");function bo(e,t,n){if(ua&&an){let o=Vd.get(e);o||Vd.set(e,o=new Map);let r=o.get(n);r||(o.set(n,r=new Rf),r.map=o,r.key=n),r.track()}}function hs(e,t,n,o,r,a){const s=Vd.get(e);if(!s){ac++;return}const i=u=>{u&&u.trigger()};if(Af(),t==="clear")s.forEach(i);else{const u=lt(e),h=u&&_f(n);if(u&&n==="length"){const p=Number(o);s.forEach((g,w)=>{(w==="length"||w===sc||!pa(w)&&w>=p)&&i(g)})}else switch((n!==void 0||s.has(void 0))&&i(s.get(n)),h&&i(s.get(sc)),t){case"add":u?h&&i(s.get("length")):(i(s.get(Mi)),ol(e)&&i(s.get(Gd)));break;case"delete":u||(i(s.get(Mi)),ol(e)&&i(s.get(Gd)));break;case"set":ol(e)&&i(s.get(Mi));break}}If()}function Ki(e){const t=qt(e);return t===e?t:(bo(t,"iterate",sc),Hr(e)?t:t.map(ha))}function Ru(e){return bo(e=qt(e),"iterate",sc),e}function Ua(e,t){return bs(e)?dl($i(e)?ha(t):t):ha(t)}const N0={__proto__:null,[Symbol.iterator](){return md(this,Symbol.iterator,e=>Ua(this,e))},concat(...e){return Ki(this).concat(...e.map(t=>lt(t)?Ki(t):t))},entries(){return md(this,"entries",e=>(e[1]=Ua(this,e[1]),e))},every(e,t){return is(this,"every",e,t,void 0,arguments)},filter(e,t){return is(this,"filter",e,t,n=>n.map(o=>Ua(this,o)),arguments)},find(e,t){return is(this,"find",e,t,n=>Ua(this,n),arguments)},findIndex(e,t){return is(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return is(this,"findLast",e,t,n=>Ua(this,n),arguments)},findLastIndex(e,t){return is(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return is(this,"forEach",e,t,void 0,arguments)},includes(...e){return vd(this,"includes",e)},indexOf(...e){return vd(this,"indexOf",e)},join(e){return Ki(this).join(e)},lastIndexOf(...e){return vd(this,"lastIndexOf",e)},map(e,t){return is(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 is(this,"some",e,t,void 0,arguments)},splice(...e){return Fl(this,"splice",e)},toReversed(){return Ki(this).toReversed()},toSorted(e){return Ki(this).toSorted(e)},toSpliced(...e){return Ki(this).toSpliced(...e)},unshift(...e){return Fl(this,"unshift",e)},values(){return md(this,"values",e=>Ua(this,e))}};function md(e,t,n){const o=Ru(e),r=o[t]();return o!==e&&!Hr(e)&&(r._next=r.next,r.next=()=>{const a=r._next();return a.done||(a.value=n(a.value)),a}),r}const O0=Array.prototype;function is(e,t,n,o,r,a){const s=Ru(e),i=s!==e&&!Hr(e),u=s[t];if(u!==O0[t]){const g=u.apply(e,a);return i?ha(g):g}let h=n;s!==e&&(i?h=function(g,w){return n.call(this,Ua(e,g),w,e)}:n.length>2&&(h=function(g,w){return n.call(this,g,w,e)}));const p=u.call(s,h,o);return i&&r?r(p):p}function Kp(e,t,n,o){const r=Ru(e),a=r!==e&&!Hr(e);let s=n,i=!1;r!==e&&(a?(i=o.length===0,s=function(h,p,g){return i&&(i=!1,h=Ua(e,h)),n.call(this,h,Ua(e,p),g,e)}):n.length>3&&(s=function(h,p,g){return n.call(this,h,p,g,e)}));const u=r[t](s,...o);return i?Ua(e,u):u}function vd(e,t,n){const o=qt(e);bo(o,"iterate",sc);const r=o[t](...n);return(r===-1||r===!1)&&$f(n[0])?(n[0]=qt(n[0]),o[t](...n)):r}function Fl(e,t,n=[]){ys(),Af();const o=qt(e)[t].apply(e,n);return If(),ws(),o}const D0=Cf("__proto__,__v_isRef,__isVue"),Dv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(pa));function F0(e){pa(e)||(e=String(e));const t=qt(this);return bo(t,"has",e),t.hasOwnProperty(e)}class Fv{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,o){if(n==="__v_skip")return t.__v_skip;const r=this._isReadonly,a=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return a;if(n==="__v_raw")return o===(r?a?Y0:zv:a?qv:Uv).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(o)?t:void 0;const s=lt(t);if(!r){let u;if(s&&(u=N0[n]))return u;if(n==="hasOwnProperty")return F0}const i=Reflect.get(t,n,ko(t)?t:o);if((pa(n)?Dv.has(n):D0(n))||(r||bo(t,"get",n),a))return i;if(ko(i)){const u=s&&_f(n)?i:i.value;return r&&Kt(u)?Yd(u):u}return Kt(i)?r?Yd(i):Eu(i):i}}class Bv extends Fv{constructor(t=!1){super(!1,t)}set(t,n,o,r){let a=t[n];const s=lt(t)&&_f(n);if(!this._isShallow){const h=bs(a);if(!Hr(o)&&!bs(o)&&(a=qt(a),o=qt(o)),!s&&ko(a)&&!ko(o))return h||(a.value=o),!0}const i=s?Number(n)<t.length:Vt(t,n),u=Reflect.set(t,n,o,ko(t)?t:r);return t===qt(r)&&u&&(i?ia(o,a)&&hs(t,"set",n,o):hs(t,"add",n,o)),u}deleteProperty(t,n){const o=Vt(t,n);t[n];const r=Reflect.deleteProperty(t,n);return r&&o&&hs(t,"delete",n,void 0),r}has(t,n){const o=Reflect.has(t,n);return(!pa(n)||!Dv.has(n))&&bo(t,"has",n),o}ownKeys(t){return bo(t,"iterate",lt(t)?"length":Mi),Reflect.ownKeys(t)}}class B0 extends Fv{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const U0=new Bv,q0=new B0,z0=new Bv(!0);const Kd=e=>e,jc=e=>Reflect.getPrototypeOf(e);function H0(e,t,n){return function(...o){const r=this.__v_raw,a=qt(r),s=ol(a),i=e==="entries"||e===Symbol.iterator&&s,u=e==="keys"&&s,h=r[e](...o),p=n?Kd:t?dl:ha;return!t&&bo(a,"iterate",u?Gd:Mi),zn(Object.create(h),{next(){const{value:g,done:w}=h.next();return w?{value:g,done:w}:{value:i?[p(g[0]),p(g[1])]:p(g),done:w}}})}}function Lc(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function W0(e,t){const n={get(r){const a=this.__v_raw,s=qt(a),i=qt(r);e||(ia(r,i)&&bo(s,"get",r),bo(s,"get",i));const{has:u}=jc(s),h=t?Kd:e?dl:ha;if(u.call(s,r))return h(a.get(r));if(u.call(s,i))return h(a.get(i));a!==s&&a.get(r)},get size(){const r=this.__v_raw;return!e&&bo(qt(r),"iterate",Mi),r.size},has(r){const a=this.__v_raw,s=qt(a),i=qt(r);return e||(ia(r,i)&&bo(s,"has",r),bo(s,"has",i)),r===i?a.has(r):a.has(r)||a.has(i)},forEach(r,a){const s=this,i=s.__v_raw,u=qt(i),h=t?Kd:e?dl:ha;return!e&&bo(u,"iterate",Mi),i.forEach((p,g)=>r.call(a,h(p),h(g),s))}};return zn(n,e?{add:Lc("add"),set:Lc("set"),delete:Lc("delete"),clear:Lc("clear")}:{add(r){const a=qt(this),s=jc(a),i=qt(r),u=!t&&!Hr(r)&&!bs(r)?i:r;return s.has.call(a,u)||ia(r,u)&&s.has.call(a,r)||ia(i,u)&&s.has.call(a,i)||(a.add(u),hs(a,"add",u,u)),this},set(r,a){!t&&!Hr(a)&&!bs(a)&&(a=qt(a));const s=qt(this),{has:i,get:u}=jc(s);let h=i.call(s,r);h||(r=qt(r),h=i.call(s,r));const p=u.call(s,r);return s.set(r,a),h?ia(a,p)&&hs(s,"set",r,a):hs(s,"add",r,a),this},delete(r){const a=qt(this),{has:s,get:i}=jc(a);let u=s.call(a,r);u||(r=qt(r),u=s.call(a,r)),i&&i.call(a,r);const h=a.delete(r);return u&&hs(a,"delete",r,void 0),h},clear(){const r=qt(this),a=r.size!==0,s=r.clear();return a&&hs(r,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=H0(r,e,t)}),n}function Ef(e,t){const n=W0(e,t);return(o,r,a)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?o:Reflect.get(Vt(n,r)&&r in o?n:o,r,a)}const V0={get:Ef(!1,!1)},G0={get:Ef(!1,!0)},K0={get:Ef(!0,!1)};const Uv=new WeakMap,qv=new WeakMap,zv=new WeakMap,Y0=new WeakMap;function J0(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Eu(e){return bs(e)?e:Mf(e,!1,U0,V0,Uv)}function Hv(e){return Mf(e,!1,z0,G0,qv)}function Yd(e){return Mf(e,!0,q0,K0,zv)}function Mf(e,t,n,o,r){if(!Kt(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const a=r.get(e);if(a)return a;const s=J0(T0(e));if(s===0)return e;const i=new Proxy(e,s===2?o:n);return r.set(e,i),i}function $i(e){return bs(e)?$i(e.__v_raw):!!(e&&e.__v_isReactive)}function bs(e){return!!(e&&e.__v_isReadonly)}function Hr(e){return!!(e&&e.__v_isShallow)}function $f(e){return e?!!e.__v_raw:!1}function qt(e){const t=e&&e.__v_raw;return t?qt(t):e}function Q0(e){return!Vt(e,"__v_skip")&&Object.isExtensible(e)&&_v(e,"__v_skip",!0),e}const ha=e=>Kt(e)?Eu(e):e,dl=e=>Kt(e)?Yd(e):e;function ko(e){return e?e.__v_isRef===!0:!1}function x(e){return Wv(e,!1)}function X0(e){return Wv(e,!0)}function Wv(e,t){return ko(e)?e:new Z0(e,t)}class Z0{constructor(t,n){this.dep=new Rf,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:qt(t),this._value=n?t:ha(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,o=this.__v_isShallow||Hr(t)||bs(t);t=o?t:qt(t),ia(t,n)&&(this._rawValue=t,this._value=o?t:ha(t),this.dep.trigger())}}function v(e){return ko(e)?e.value:e}const eT={get:(e,t,n)=>t==="__v_raw"?e:v(Reflect.get(e,t,n)),set:(e,t,n,o)=>{const r=e[t];return ko(r)&&!ko(n)?(r.value=n,!0):Reflect.set(e,t,n,o)}};function Vv(e){return $i(e)?e:new Proxy(e,eT)}class tT{constructor(t,n,o){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Rf(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ac-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=o}notify(){if(this.flags|=16,!(this.flags&8)&&an!==this)return Mv(this,!0),!0}get value(){const t=this.dep.track();return Lv(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function nT(e,t,n=!1){let o,r;return vt(e)?o=e:(o=e.get,r=e.set),new tT(o,r,n)}const Nc={},lu=new WeakMap;let _i;function oT(e,t=!1,n=_i){if(n){let o=lu.get(n);o||lu.set(n,o=[]),o.push(e)}}function rT(e,t,n=Zt){const{immediate:o,deep:r,once:a,scheduler:s,augmentJob:i,call:u}=n,h=q=>r?q:Hr(q)||r===!1||r===0?ms(q,1):ms(q);let p,g,w,A,M=!1,U=!1;if(ko(e)?(g=()=>e.value,M=Hr(e)):$i(e)?(g=()=>h(e),M=!0):lt(e)?(U=!0,M=e.some(q=>$i(q)||Hr(q)),g=()=>e.map(q=>{if(ko(q))return q.value;if($i(q))return h(q);if(vt(q))return u?u(q,2):q()})):vt(e)?t?g=u?()=>u(e,2):e:g=()=>{if(w){ys();try{w()}finally{ws()}}const q=_i;_i=p;try{return u?u(e,3,[A]):e(A)}finally{_i=q}}:g=za,t&&r){const q=g,me=r===!0?1/0:r;g=()=>ms(q(),me)}const Y=$0(),ue=()=>{p.stop(),Y&&Y.active&&Sf(Y.effects,p)};if(a&&t){const q=t;t=(...me)=>{const we=q(...me);return ue(),we}}let F=U?new Array(e.length).fill(Nc):Nc;const H=q=>{if(!(!(p.flags&1)||!p.dirty&&!q))if(t){const me=p.run();if(q||r||M||(U?me.some((we,ve)=>ia(we,F[ve])):ia(me,F))){w&&w();const we=_i;_i=p;try{const ve=[me,F===Nc?void 0:U&&F[0]===Nc?[]:F,A];F=me,u?u(t,3,ve):t(...ve)}finally{_i=we}}}else p.run()};return i&&i(H),p=new Rv(g),p.scheduler=s?()=>s(H,!1):H,A=q=>oT(q,!1,p),w=p.onStop=()=>{const q=lu.get(p);if(q){if(u)u(q,4);else for(const me of q)me();lu.delete(p)}},t?o?H(!0):F=p.run():s?s(H.bind(null,!0),!0):p.run(),ue.pause=p.pause.bind(p),ue.resume=p.resume.bind(p),ue.stop=ue,ue}function ms(e,t=1/0,n){if(t<=0||!Kt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,ko(e))ms(e.value,t,n);else if(lt(e))for(let o=0;o<e.length;o++)ms(e[o],t,n);else if(xu(e)||ol(e))e.forEach(o=>{ms(o,t,n)});else if(Sv(e)){for(const o in e)ms(e[o],t,n);for(const o of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,o)&&ms(e[o],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 mc(e,t,n,o){try{return o?e(...o):e()}catch(r){vc(r,t,n)}}function Vr(e,t,n,o){if(vt(e)){const r=mc(e,t,n,o);return r&&kv(r)&&r.catch(a=>{vc(a,t,n)}),r}if(lt(e)){const r=[];for(let a=0;a<e.length;a++)r.push(Vr(e[a],t,n,o));return r}}function vc(e,t,n,o=!0){const r=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Zt;if(t){let i=t.parent;const u=t.proxy,h=`https://vuejs.org/error-reference/#runtime-${n}`;for(;i;){const p=i.ec;if(p){for(let g=0;g<p.length;g++)if(p[g](e,u,h)===!1)return}i=i.parent}if(a){ys(),mc(a,null,10,[e,u,h]),ws();return}}aT(e,n,r,o,s)}function aT(e,t,n,o=!0,r=!1){if(r)throw e;console.error(e)}const No=[];let Ba=-1;const rl=[];let Ws=null,Xi=0;const Gv=Promise.resolve();let cu=null;function Gt(e){const t=cu||Gv;return e?t.then(this?e.bind(this):e):t}function sT(e){let t=Ba+1,n=No.length;for(;t<n;){const o=t+n>>>1,r=No[o],a=ic(r);a<e||a===e&&r.flags&2?t=o+1:n=o}return t}function jf(e){if(!(e.flags&1)){const t=ic(e),n=No[No.length-1];!n||!(e.flags&2)&&t>=ic(n)?No.push(e):No.splice(sT(t),0,e),e.flags|=1,Kv()}}function Kv(){cu||(cu=Gv.then(Jv))}function iT(e){lt(e)?rl.push(...e):Ws&&e.id===-1?Ws.splice(Xi+1,0,e):e.flags&1||(rl.push(e),e.flags|=1),Kv()}function Yp(e,t,n=Ba+1){for(;n<No.length;n++){const o=No[n];if(o&&o.flags&2){if(e&&o.id!==e.uid)continue;No.splice(n,1),n--,o.flags&4&&(o.flags&=-2),o(),o.flags&4||(o.flags&=-2)}}}function Yv(e){if(rl.length){const t=[...new Set(rl)].sort((n,o)=>ic(n)-ic(o));if(rl.length=0,Ws){Ws.push(...t);return}for(Ws=t,Xi=0;Xi<Ws.length;Xi++){const n=Ws[Xi];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Ws=null,Xi=0}}const ic=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Jv(e){try{for(Ba=0;Ba<No.length;Ba++){const t=No[Ba];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),mc(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Ba<No.length;Ba++){const t=No[Ba];t&&(t.flags&=-2)}Ba=-1,No.length=0,Yv(),cu=null,(No.length||rl.length)&&Jv()}}let so=null,Qv=null;function uu(e){const t=so;return so=e,Qv=e&&e.type.__scopeId||null,t}function mt(e,t=so,n){if(!t||e._n)return e;const o=(...r)=>{o._d&&pu(-1);const a=uu(t),s=gs.length;let i;try{i=e(...r)}finally{for(let u=gs.length;u>s;u--)Bf();uu(a),o._d&&pu(1)}return i};return o._n=!0,o._c=!0,o._d=!0,o}function Nt(e,t){if(so===null)return e;const n=Lu(so),o=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[a,s,i,u=Zt]=t[r];a&&(vt(a)&&(a={mounted:a,updated:a}),a.deep&&ms(s),o.push({dir:a,instance:n,value:s,oldValue:void 0,arg:i,modifiers:u}))}return e}function Ti(e,t,n,o){const r=e.dirs,a=t&&t.dirs;for(let s=0;s<r.length;s++){const i=r[s];a&&(i.oldValue=a[s].value);let u=i.dir[o];u&&(ys(),Vr(u,n,8,[e.el,i,e,t]),ws())}}function tu(e,t){if(ao){let n=ao.provides;const o=ao.parent&&ao.parent.provides;o===n&&(n=ao.provides=Object.create(o)),n[e]=t}}function da(e,t,n=!1){const o=Uf();if(o||sl){let r=sl?sl._context.provides:o?o.parent==null||o.ce?o.vnode.appContext&&o.vnode.appContext.provides:o.parent.provides:void 0;if(r&&e in r)return r[e];if(arguments.length>1)return n&&vt(t)?t.call(o&&o.proxy):t}}const lT=Symbol.for("v-scx"),cT=()=>da(lT);function tt(e,t,n){return Xv(e,t,n)}function Xv(e,t,n=Zt){const{immediate:o,deep:r,flush:a,once:s}=n,i=zn({},n),u=t&&o||!t&&a!=="post";let h;if(pl){if(a==="sync"){const A=cT();h=A.__watcherHandles||(A.__watcherHandles=[])}else if(!u){const A=()=>{};return A.stop=za,A.resume=za,A.pause=za,A}}const p=ao;i.call=(A,M,U)=>Vr(A,p,M,U);let g=!1;a==="post"?i.scheduler=A=>{jo(A,p&&p.suspense)}:a!=="sync"&&(g=!0,i.scheduler=(A,M)=>{M?A():jf(A)}),i.augmentJob=A=>{t&&(A.flags|=4),g&&(A.flags|=2,p&&(A.id=p.uid,A.i=p))};const w=rT(e,t,i);return pl&&(h?h.push(w):u&&w()),w}function uT(e,t,n){const o=this.proxy,r=cn(e)?e.includes(".")?Zv(o,e):()=>o[e]:e.bind(o,o);let a;vt(t)?a=t:(a=t.handler,n=t);const s=wc(this),i=Xv(r,a.bind(o),n);return s(),i}function Zv(e,t){const n=t.split(".");return()=>{let o=e;for(let r=0;r<n.length&&o;r++)o=o[n[r]];return o}}const qs=new WeakMap,eg=Symbol("_vte"),tg=e=>e.__isTeleport,Ai=e=>e&&(e.disabled||e.disabled===""),dT=e=>e&&(e.defer||e.defer===""),Jp=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Qp=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Jd=(e,t)=>{const n=e&&e.to;return cn(n)?t?t(n):null:n},fT={name:"Teleport",__isTeleport:!0,process(e,t,n,o,r,a,s,i,u,h){const{mc:p,pc:g,pbc:w,o:{insert:A,querySelector:M,createText:U,createComment:Y,parentNode:ue}}=h,F=Ai(t.props);let{dynamicChildren:H}=t;const q=(ve,je,ge)=>{ve.shapeFlag&16&&p(ve.children,je,ge,r,a,s,i,u)},me=(ve=t)=>{const je=Ai(ve.props),ge=ve.target=Jd(ve.props,M),Ie=Qd(ge,ve,U,A);ge&&(s!=="svg"&&Jp(ge)?s="svg":s!=="mathml"&&Qp(ge)&&(s="mathml"),r&&r.isCE&&(r.ce._teleportTargets||(r.ce._teleportTargets=new Set)).add(ge),je||(q(ve,ge,Ie),Gl(ve,!1)))},we=ve=>{const je=()=>{if(qs.get(ve)===je){if(qs.delete(ve),Ai(ve.props)){const ge=ue(ve.el)||n;q(ve,ge,ve.anchor),Gl(ve,!0)}me(ve)}};qs.set(ve,je),jo(je,a)};if(e==null){const ve=t.el=U(""),je=t.anchor=U("");if(A(ve,n,o),A(je,n,o),dT(t.props)||a&&a.pendingBranch){we(t);return}F&&(q(t,n,je),Gl(t,!0)),me()}else{t.el=e.el;const ve=t.anchor=e.anchor,je=qs.get(e);if(je){je.flags|=8,qs.delete(e),we(t);return}t.targetStart=e.targetStart;const ge=t.target=e.target,Ie=t.targetAnchor=e.targetAnchor,De=Ai(e.props),fe=De?n:ge,Se=De?ve:Ie;if(s==="svg"||Jp(ge)?s="svg":(s==="mathml"||Qp(ge))&&(s="mathml"),H?(w(e.dynamicChildren,H,fe,r,a,s,i),Ff(e,t,!0)):u||g(e,t,fe,Se,r,a,s,i,!1),F)De?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Oc(t,n,ve,h,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const _e=Jd(t.props,M);_e&&(t.target=_e,Oc(t,_e,null,h,0))}else De&&Oc(t,ge,Ie,h,1);Gl(t,F)}},remove(e,t,n,{um:o,o:{remove:r}},a){const{shapeFlag:s,children:i,anchor:u,targetStart:h,targetAnchor:p,target:g,props:w}=e,A=Ai(w),M=a||!A,U=qs.get(e);if(U&&(U.flags|=8,qs.delete(e)),g&&(r(h),r(p)),a&&r(u),!U&&(A||g)&&s&16)for(let Y=0;Y<i.length;Y++){const ue=i[Y];o(ue,t,n,M,!!ue.dynamicChildren)}},move:Oc,hydrate:pT};function Oc(e,t,n,{o:{insert:o},m:r},a=2){a===0&&o(e.targetAnchor,t,n);const{el:s,anchor:i,shapeFlag:u,children:h,props:p}=e,g=a===2;if(g&&o(s,t,n),!qs.has(e)&&(!g||Ai(p))&&u&16)for(let w=0;w<h.length;w++)r(h[w],t,n,2);g&&o(i,t,n)}function pT(e,t,n,o,r,a,{o:{nextSibling:s,parentNode:i,querySelector:u,insert:h,createText:p}},g){function w(Y,ue){let F=ue;for(;F;){if(F&&F.nodeType===8){if(F.data==="teleport start anchor")t.targetStart=F;else if(F.data==="teleport anchor"){t.targetAnchor=F,Y._lpa=t.targetAnchor&&s(t.targetAnchor);break}}F=s(F)}}function A(Y,ue){ue.anchor=g(s(Y),ue,i(Y),n,o,r,a)}const M=t.target=Jd(t.props,u),U=Ai(t.props);if(M){const Y=M._lpa||M.firstChild;t.shapeFlag&16&&(U?(A(e,t),w(M,Y),t.targetAnchor||Qd(M,t,p,h,i(e)===M?e:null)):(t.anchor=s(e),w(M,Y),t.targetAnchor||Qd(M,t,p,h),g(Y&&s(Y),t,M,n,o,r,a))),Gl(t,U)}else U&&t.shapeFlag&16&&(A(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}const Qs=fT;function Gl(e,t){const n=e.ctx;if(n&&n.ut){let o,r;for(t?(o=e.el,r=e.anchor):(o=e.targetStart,r=e.targetAnchor);o&&o!==r;)o.nodeType===1&&o.setAttribute("data-v-owner",n.uid),o=o.nextSibling;n.ut()}}function Qd(e,t,n,o,r=null){const a=t.targetStart=n(""),s=t.targetAnchor=n("");return a[eg]=s,e&&(o(a,e,r),o(s,e,r)),s}const zr=Symbol("_leaveCb"),Bl=Symbol("_enterCb");function hT(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Cs(()=>{e.isMounted=!0}),Ni(()=>{e.isUnmounting=!0}),e}const qr=[Function,Array],ng={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},og=e=>{const t=e.subTree;return t.component?og(t.component):t},mT={name:"BaseTransition",props:ng,setup(e,{slots:t}){const n=Uf(),o=hT();return()=>{const r=t.default&&sg(t.default(),!0),a=r&&r.length?rg(r):n.subTree?Z():void 0;if(!a)return;const s=qt(e),{mode:i}=s;if(o.isLeaving)return gd(a);const u=Xp(a);if(!u)return gd(a);let h=Xd(u,s,o,n,g=>h=g);u.type!==To&&lc(u,h);let p=n.subTree&&Xp(n.subTree);if(p&&p.type!==To&&!Ii(p,u)&&og(n).type!==To){let g=Xd(p,s,o,n);if(lc(p,g),i==="out-in"&&u.type!==To)return o.isLeaving=!0,g.afterLeave=()=>{o.isLeaving=!1,n.job.flags&8||n.update(),delete g.afterLeave,p=void 0},gd(a);i==="in-out"&&u.type!==To?g.delayLeave=(w,A,M)=>{const U=ag(o,p);U[String(p.key)]=p,w[zr]=()=>{A(),w[zr]=void 0,delete h.delayedLeave,p=void 0},h.delayedLeave=()=>{M(),delete h.delayedLeave,p=void 0}}:p=void 0}else p&&(p=void 0);return a}}};function rg(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==To){t=n;break}}return t}const vT=mT;function ag(e,t){const{leavingVNodes:n}=e;let o=n.get(t.type);return o||(o=Object.create(null),n.set(t.type,o)),o}function Xd(e,t,n,o,r){const{appear:a,mode:s,persisted:i=!1,onBeforeEnter:u,onEnter:h,onAfterEnter:p,onEnterCancelled:g,onBeforeLeave:w,onLeave:A,onAfterLeave:M,onLeaveCancelled:U,onBeforeAppear:Y,onAppear:ue,onAfterAppear:F,onAppearCancelled:H}=t,q=String(e.key),me=ag(n,e),we=(ge,Ie)=>{ge&&Vr(ge,o,9,Ie)},ve=(ge,Ie)=>{const De=Ie[1];we(ge,Ie),lt(ge)?ge.every(fe=>fe.length<=1)&&De():ge.length<=1&&De()},je={mode:s,persisted:i,beforeEnter(ge){let Ie=u;if(!n.isMounted)if(a)Ie=Y||u;else return;ge[zr]&&ge[zr](!0);const De=me[q];De&&Ii(e,De)&&De.el[zr]&&De.el[zr](),we(Ie,[ge])},enter(ge){if(me[q]===e)return;let Ie=h,De=p,fe=g;if(!n.isMounted)if(a)Ie=ue||h,De=F||p,fe=H||g;else return;let Se=!1;ge[Bl]=Pe=>{Se||(Se=!0,Pe?we(fe,[ge]):we(De,[ge]),je.delayedLeave&&je.delayedLeave(),ge[Bl]=void 0)};const _e=ge[Bl].bind(null,!1);Ie?ve(Ie,[ge,_e]):_e()},leave(ge,Ie){const De=String(e.key);if(ge[Bl]&&ge[Bl](!0),n.isUnmounting)return Ie();we(w,[ge]);let fe=!1;ge[zr]=_e=>{fe||(fe=!0,Ie(),_e?we(U,[ge]):we(M,[ge]),ge[zr]=void 0,me[De]===e&&delete me[De])};const Se=ge[zr].bind(null,!1);me[De]=e,A?ve(A,[ge,Se]):Se()},clone(ge){const Ie=Xd(ge,t,n,o,r);return r&&r(Ie),Ie}};return je}function gd(e){if(gc(e))return e=ei(e),e.children=null,e}function Xp(e){if(!gc(e))return tg(e.type)&&e.children?rg(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&&vt(n.default))return n.default()}}function lc(e,t){e.shapeFlag&6&&e.component?(e.transition=t,lc(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 sg(e,t=!1,n){let o=[],r=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===qe?(s.patchFlag&128&&r++,o=o.concat(sg(s.children,t,i))):(t||s.type!==To)&&o.push(i!=null?ei(s,{key:i}):s)}if(r>1)for(let a=0;a<o.length;a++)o[a].patchFlag=-2;return o}function en(e,t){return vt(e)?zn({name:e.name},t,{setup:e}):e}function Lf(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 du=new WeakMap;function ec(e,t,n,o,r=!1){if(lt(e)){e.forEach((U,Y)=>ec(U,t&&(lt(t)?t[Y]:t),n,o,r));return}if(al(o)&&!r){o.shapeFlag&512&&o.type.__asyncResolved&&o.component.subTree.component&&ec(e,t,n,o.component.subTree);return}const a=o.shapeFlag&4?Lu(o.component):o.el,s=r?null:a,{i,r:u}=e,h=t&&t.r,p=i.refs===Zt?i.refs={}:i.refs,g=i.setupState,w=qt(g),A=g===Zt?Tv:U=>Zp(p,U)?!1:Vt(w,U),M=(U,Y)=>!(Y&&Zp(p,Y));if(h!=null&&h!==u){if(eh(t),cn(h))p[h]=null,A(h)&&(g[h]=null);else if(ko(h)){const U=t;M(h,U.k)&&(h.value=null),U.k&&(p[U.k]=null)}}if(vt(u))mc(u,i,12,[s,p]);else{const U=cn(u),Y=ko(u);if(U||Y){const ue=()=>{if(e.f){const F=U?A(u)?g[u]:p[u]:M()||!e.k?u.value:p[e.k];if(r)lt(F)&&Sf(F,a);else if(lt(F))F.includes(a)||F.push(a);else if(U)p[u]=[a],A(u)&&(g[u]=p[u]);else{const H=[a];M(u,e.k)&&(u.value=H),e.k&&(p[e.k]=H)}}else U?(p[u]=s,A(u)&&(g[u]=s)):Y&&(M(u,e.k)&&(u.value=s),e.k&&(p[e.k]=s))};if(s){const F=()=>{ue(),du.delete(e)};F.id=-1,du.set(e,F),jo(F,n)}else eh(e),ue()}}}function eh(e){const t=du.get(e);t&&(t.flags|=8,du.delete(e))}const th=e=>e.nodeType===8;Pu().requestIdleCallback;Pu().cancelIdleCallback;function gT(e,t){if(th(e)&&e.data==="["){let n=1,o=e.nextSibling;for(;o;){if(o.nodeType===1){if(t(o)===!1)break}else if(th(o))if(o.data==="]"){if(--n===0)break}else o.data==="["&&n++;o=o.nextSibling}}else t(e)}const al=e=>!!e.type.__asyncLoader;function Ul(e){vt(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:o,delay:r=200,hydrate:a,timeout:s,suspensible:i=!0,onError:u}=e;let h=null,p,g=0;const w=()=>(g++,h=null,A()),A=()=>{let M;return h||(M=h=t().catch(U=>{if(U=U instanceof Error?U:new Error(String(U)),u)return new Promise((Y,ue)=>{u(U,()=>Y(w()),()=>ue(U),g+1)});throw U}).then(U=>M!==h&&h?h:(U&&(U.__esModule||U[Symbol.toStringTag]==="Module")&&(U=U.default),p=U,U)))};return en({name:"AsyncComponentWrapper",__asyncLoader:A,__asyncHydrate(M,U,Y){const ue=M.isConnected;let F=!1;(U.bu||(U.bu=[])).push(()=>F=!0);const H=()=>{F||!M.parentNode||ue&&!M.isConnected||Y()},q=a?()=>{const me=a(H,we=>gT(M,we));me&&(U.bum||(U.bum=[])).push(me)}:H;p?q():A().then(()=>!U.isUnmounted&&q())},get __asyncResolved(){return p},setup(){const M=ao;if(Lf(M),p)return()=>Dc(p,M);const U=me=>{h=null,vc(me,M,13,!o)};if(i&&M.suspense||pl)return A().then(me=>()=>Dc(me,M)).catch(me=>(U(me),()=>o?Me(o,{error:me}):null));const Y=x(!1),ue=x(),F=x(!!r);let H,q;return yc(()=>{H!=null&&clearTimeout(H),q!=null&&clearTimeout(q)}),r&&(q=setTimeout(()=>{M.isUnmounted||(F.value=!1)},r)),s!=null&&(H=setTimeout(()=>{if(!M.isUnmounted&&!Y.value&&!ue.value){const me=new Error(`Async component timed out after ${s}ms.`);U(me),ue.value=me}},s)),A().then(()=>{M.isUnmounted||(Y.value=!0,M.parent&&gc(M.parent.vnode)&&M.parent.update())}).catch(me=>{if(M.isUnmounted){h=null;return}U(me),ue.value=me}),()=>{if(Y.value&&p)return Dc(p,M);if(ue.value&&o)return Me(o,{error:ue.value});if(n&&!F.value)return Dc(n,M)}}})}function Dc(e,t){const{ref:n,props:o,children:r,ce:a}=t.vnode,s=Me(e,o,r);return s.ref=n,s.ce=a,delete t.vnode.ce,s}const gc=e=>e.type.__isKeepAlive;function yT(e,t){ig(e,"a",t)}function wT(e,t){ig(e,"da",t)}function ig(e,t,n=ao){const o=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(Mu(t,o,n),n){let r=n.parent;for(;r&&r.parent;)gc(r.parent.vnode)&&bT(o,t,n,r),r=r.parent}}function bT(e,t,n,o){const r=Mu(t,e,o,!0);yc(()=>{Sf(o[t],r)},n)}function Mu(e,t,n=ao,o=!1){if(n){const r=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=(...s)=>{ys();const i=wc(n),u=Vr(t,n,e,s);return i(),ws(),u});return o?r.unshift(a):r.push(a),a}}const ks=e=>(t,n=ao)=>{(!pl||e==="sp")&&Mu(e,(...o)=>t(...o),n)},TT=ks("bm"),Cs=ks("m"),kT=ks("bu"),CT=ks("u"),Ni=ks("bum"),yc=ks("um"),ST=ks("sp"),_T=ks("rtg"),xT=ks("rtc");function AT(e,t=ao){Mu("ec",e,t)}const IT="components",lg=Symbol.for("v-ndc");function Nf(e){return cn(e)?PT(IT,e,!1)||e:e||lg}function PT(e,t,n=!0,o=!1){const r=so||ao;if(r){const a=r.type;{const i=fk(a,!1);if(i&&(i===t||i===Do(t)||i===Iu(Do(t))))return a}const s=nh(r[e]||a[e],t)||nh(r.appContext[e],t);return!s&&o?a:s}}function nh(e,t){return e&&(e[t]||e[Do(t)]||e[Iu(Do(t))])}function At(e,t,n,o){let r;const a=n,s=lt(e);if(s||cn(e)){const i=s&&$i(e);let u=!1,h=!1;i&&(u=!Hr(e),h=bs(e),e=Ru(e)),r=new Array(e.length);for(let p=0,g=e.length;p<g;p++)r[p]=t(u?h?dl(ha(e[p])):ha(e[p]):e[p],p,void 0,a)}else if(typeof e=="number"){r=new Array(e);for(let i=0;i<e;i++)r[i]=t(i+1,i,void 0,a)}else if(Kt(e))if(e[Symbol.iterator])r=Array.from(e,(i,u)=>t(i,u,void 0,a));else{const i=Object.keys(e);r=new Array(i.length);for(let u=0,h=i.length;u<h;u++){const p=i[u];r[u]=t(e[p],p,u,a)}}else r=[];return r}function er(e,t,n={},o,r,a){if(so.ce||so.parent&&al(so.parent)&&so.parent.ce){const h=a!=null&&n.key==null?zn({},n,{key:a}):n,p=Object.keys(h).length>0;return t!=="default"&&(h.name=t),C(),Ze(qe,null,[Me("slot",h,o)],p?-2:64)}let s=e[t];s&&s._c&&(s._d=!1);const i=gs.length;C();let u;try{const h=s&&cg(s(n)),p=n.key||a||h&&h.key;u=Ze(qe,{key:(p&&!pa(p)?p:`_${t}`)+(!h&&o?"_fb":"")},h||(o?o():[]),h&&e._===1?64:-2)}catch(h){for(let p=gs.length;p>i;p--)Bf();throw h}finally{s&&s._c&&(s._d=!0)}return u}function cg(e){return e.some(t=>cc(t)?!(t.type===To||t.type===qe&&!cg(t.children)):!0)?e:null}const Zd=e=>e?Pg(e)?Lu(e):Zd(e.parent):null,tc=zn(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=>Zd(e.parent),$root:e=>Zd(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>dg(e),$forceUpdate:e=>e.f||(e.f=()=>{jf(e.update)}),$nextTick:e=>e.n||(e.n=Gt.bind(e.proxy)),$watch:e=>uT.bind(e)}),yd=(e,t)=>e!==Zt&&!e.__isScriptSetup&&Vt(e,t),RT={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:o,data:r,props:a,accessCache:s,type:i,appContext:u}=e;if(t[0]!=="$"){const w=s[t];if(w!==void 0)switch(w){case 1:return o[t];case 2:return r[t];case 4:return n[t];case 3:return a[t]}else{if(yd(o,t))return s[t]=1,o[t];if(r!==Zt&&Vt(r,t))return s[t]=2,r[t];if(Vt(a,t))return s[t]=3,a[t];if(n!==Zt&&Vt(n,t))return s[t]=4,n[t];ef&&(s[t]=0)}}const h=tc[t];let p,g;if(h)return t==="$attrs"&&bo(e.attrs,"get",""),h(e);if((p=i.__cssModules)&&(p=p[t]))return p;if(n!==Zt&&Vt(n,t))return s[t]=4,n[t];if(g=u.config.globalProperties,Vt(g,t))return g[t]},set({_:e},t,n){const{data:o,setupState:r,ctx:a}=e;return yd(r,t)?(r[t]=n,!0):o!==Zt&&Vt(o,t)?(o[t]=n,!0):Vt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:o,appContext:r,props:a,type:s}},i){let u;return!!(n[i]||e!==Zt&&i[0]!=="$"&&Vt(e,i)||yd(t,i)||Vt(a,i)||Vt(o,i)||Vt(tc,i)||Vt(r.config.globalProperties,i)||(u=s.__cssModules)&&u[i])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Vt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function ET(){return MT().slots}function MT(e){const t=Uf();return t.setupContext||(t.setupContext=Eg(t))}function oh(e){return lt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let ef=!0;function $T(e){const t=dg(e),n=e.proxy,o=e.ctx;ef=!1,t.beforeCreate&&rh(t.beforeCreate,e,"bc");const{data:r,computed:a,methods:s,watch:i,provide:u,inject:h,created:p,beforeMount:g,mounted:w,beforeUpdate:A,updated:M,activated:U,deactivated:Y,beforeDestroy:ue,beforeUnmount:F,destroyed:H,unmounted:q,render:me,renderTracked:we,renderTriggered:ve,errorCaptured:je,serverPrefetch:ge,expose:Ie,inheritAttrs:De,components:fe,directives:Se,filters:_e}=t;if(h&&jT(h,o,null),s)for(const Ue in s){const Le=s[Ue];vt(Le)&&(o[Ue]=Le.bind(n))}if(r){const Ue=r.call(n,n);Kt(Ue)&&(e.data=Eu(Ue))}if(ef=!0,a)for(const Ue in a){const Le=a[Ue],gt=vt(Le)?Le.bind(n,n):vt(Le.get)?Le.get.bind(n,n):za,ft=!vt(Le)&&vt(Le.set)?Le.set.bind(n):za,at=X({get:gt,set:ft});Object.defineProperty(o,Ue,{enumerable:!0,configurable:!0,get:()=>at.value,set:it=>at.value=it})}if(i)for(const Ue in i)ug(i[Ue],o,n,Ue);if(u){const Ue=vt(u)?u.call(n):u;Reflect.ownKeys(Ue).forEach(Le=>{tu(Le,Ue[Le])})}p&&rh(p,e,"c");function Re(Ue,Le){lt(Le)?Le.forEach(gt=>Ue(gt.bind(n))):Le&&Ue(Le.bind(n))}if(Re(TT,g),Re(Cs,w),Re(kT,A),Re(CT,M),Re(yT,U),Re(wT,Y),Re(AT,je),Re(xT,we),Re(_T,ve),Re(Ni,F),Re(yc,q),Re(ST,ge),lt(Ie))if(Ie.length){const Ue=e.exposed||(e.exposed={});Ie.forEach(Le=>{Object.defineProperty(Ue,Le,{get:()=>n[Le],set:gt=>n[Le]=gt,enumerable:!0})})}else e.exposed||(e.exposed={});me&&e.render===za&&(e.render=me),De!=null&&(e.inheritAttrs=De),fe&&(e.components=fe),Se&&(e.directives=Se),ge&&Lf(e)}function jT(e,t,n=za){lt(e)&&(e=tf(e));for(const o in e){const r=e[o];let a;Kt(r)?"default"in r?a=da(r.from||o,r.default,!0):a=da(r.from||o):a=da(r),ko(a)?Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get:()=>a.value,set:s=>a.value=s}):t[o]=a}}function rh(e,t,n){Vr(lt(e)?e.map(o=>o.bind(t.proxy)):e.bind(t.proxy),t,n)}function ug(e,t,n,o){let r=o.includes(".")?Zv(n,o):()=>n[o];if(cn(e)){const a=t[e];vt(a)&&tt(r,a)}else if(vt(e))tt(r,e.bind(n));else if(Kt(e))if(lt(e))e.forEach(a=>ug(a,t,n,o));else{const a=vt(e.handler)?e.handler.bind(n):t[e.handler];vt(a)&&tt(r,a,e)}}function dg(e){const t=e.type,{mixins:n,extends:o}=t,{mixins:r,optionsCache:a,config:{optionMergeStrategies:s}}=e.appContext,i=a.get(t);let u;return i?u=i:!r.length&&!n&&!o?u=t:(u={},r.length&&r.forEach(h=>fu(u,h,s,!0)),fu(u,t,s)),Kt(t)&&a.set(t,u),u}function fu(e,t,n,o=!1){const{mixins:r,extends:a}=t;a&&fu(e,a,n,!0),r&&r.forEach(s=>fu(e,s,n,!0));for(const s in t)if(!(o&&s==="expose")){const i=LT[s]||n&&n[s];e[s]=i?i(e[s],t[s]):t[s]}return e}const LT={data:ah,props:sh,emits:sh,methods:Kl,computed:Kl,beforeCreate:$o,created:$o,beforeMount:$o,mounted:$o,beforeUpdate:$o,updated:$o,beforeDestroy:$o,beforeUnmount:$o,destroyed:$o,unmounted:$o,activated:$o,deactivated:$o,errorCaptured:$o,serverPrefetch:$o,components:Kl,directives:Kl,watch:OT,provide:ah,inject:NT};function ah(e,t){return t?e?function(){return zn(vt(e)?e.call(this,this):e,vt(t)?t.call(this,this):t)}:t:e}function NT(e,t){return Kl(tf(e),tf(t))}function tf(e){if(lt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function $o(e,t){return e?[...new Set([].concat(e,t))]:t}function Kl(e,t){return e?zn(Object.create(null),e,t):t}function sh(e,t){return e?lt(e)&&lt(t)?[...new Set([...e,...t])]:zn(Object.create(null),oh(e),oh(t??{})):t}function OT(e,t){if(!e)return t;if(!t)return e;const n=zn(Object.create(null),e);for(const o in t)n[o]=$o(e[o],t[o]);return n}function fg(){return{app:null,config:{isNativeTag:Tv,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 DT=0;function FT(e,t){return function(o,r=null){vt(o)||(o=zn({},o)),r!=null&&!Kt(r)&&(r=null);const a=fg(),s=new WeakSet,i=[];let u=!1;const h=a.app={_uid:DT++,_component:o,_props:r,_container:null,_context:a,_instance:null,version:mk,get config(){return a.config},set config(p){},use(p,...g){return s.has(p)||(p&&vt(p.install)?(s.add(p),p.install(h,...g)):vt(p)&&(s.add(p),p(h,...g))),h},mixin(p){return a.mixins.includes(p)||a.mixins.push(p),h},component(p,g){return g?(a.components[p]=g,h):a.components[p]},directive(p,g){return g?(a.directives[p]=g,h):a.directives[p]},mount(p,g,w){if(!u){const A=h._ceVNode||Me(o,r);return A.appContext=a,w===!0?w="svg":w===!1&&(w=void 0),e(A,p,w),u=!0,h._container=p,p.__vue_app__=h,Lu(A.component)}},onUnmount(p){i.push(p)},unmount(){u&&(Vr(i,h._instance,16),e(null,h._container),delete h._container.__vue_app__)},provide(p,g){return a.provides[p]=g,h},runWithContext(p){const g=sl;sl=h;try{return p()}finally{sl=g}}};return h}}let sl=null;const BT=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Do(t)}Modifiers`]||e[`${ti(t)}Modifiers`];function UT(e,t,...n){if(e.isUnmounted)return;const o=e.vnode.props||Zt;let r=n;const a=t.startsWith("update:"),s=a&&BT(o,t.slice(7));s&&(s.trim&&(r=n.map(p=>cn(p)?p.trim():p)),s.number&&(r=n.map(xf)));let i,u=o[i=fd(t)]||o[i=fd(Do(t))];!u&&a&&(u=o[i=fd(ti(t))]),u&&Vr(u,e,6,r);const h=o[i+"Once"];if(h){if(!e.emitted)e.emitted={};else if(e.emitted[i])return;e.emitted[i]=!0,Vr(h,e,6,r)}}const qT=new WeakMap;function pg(e,t,n=!1){const o=n?qT:t.emitsCache,r=o.get(e);if(r!==void 0)return r;const a=e.emits;let s={},i=!1;if(!vt(e)){const u=h=>{const p=pg(h,t,!0);p&&(i=!0,zn(s,p))};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}return!a&&!i?(Kt(e)&&o.set(e,null),null):(lt(a)?a.forEach(u=>s[u]=null):zn(s,a),Kt(e)&&o.set(e,s),s)}function $u(e,t){return!e||!Su(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),Vt(e,t[0].toLowerCase()+t.slice(1))||Vt(e,ti(t))||Vt(e,t))}function ih(e){const{type:t,vnode:n,proxy:o,withProxy:r,propsOptions:[a],slots:s,attrs:i,emit:u,render:h,renderCache:p,props:g,data:w,setupState:A,ctx:M,inheritAttrs:U}=e,Y=uu(e);let ue,F;try{if(n.shapeFlag&4){const q=r||o,me=q;ue=qa(h.call(me,q,p,g,A,w,M)),F=i}else{const q=t;ue=qa(q.length>1?q(g,{attrs:i,slots:s,emit:u}):q(g,null)),F=t.props?i:zT(i)}}catch(q){gs.length=0,vc(q,e,1),ue=Me(To)}let H=ue;if(F&&U!==!1){const q=Object.keys(F),{shapeFlag:me}=H;q.length&&me&7&&(a&&q.some(_u)&&(F=HT(F,a)),H=ei(H,F,!1,!0))}return n.dirs&&(H=ei(H,null,!1,!0),H.dirs=H.dirs?H.dirs.concat(n.dirs):n.dirs),n.transition&&lc(H,n.transition),ue=H,uu(Y),ue}const zT=e=>{let t;for(const n in e)(n==="class"||n==="style"||Su(n))&&((t||(t={}))[n]=e[n]);return t},HT=(e,t)=>{const n={};for(const o in e)(!_u(o)||!(o.slice(9)in t))&&(n[o]=e[o]);return n};function WT(e,t,n){const{props:o,children:r,component:a}=e,{props:s,children:i,patchFlag:u}=t,h=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&u>=0){if(u&1024)return!0;if(u&16)return o?lh(o,s,h):!!s;if(u&8){const p=t.dynamicProps;for(let g=0;g<p.length;g++){const w=p[g];if(hg(s,o,w)&&!$u(h,w))return!0}}}else return(r||i)&&(!i||!i.$stable)?!0:o===s?!1:o?s?lh(o,s,h):!0:!!s;return!1}function lh(e,t,n){const o=Object.keys(t);if(o.length!==Object.keys(e).length)return!0;for(let r=0;r<o.length;r++){const a=o[r];if(hg(t,e,a)&&!$u(n,a))return!0}return!1}function hg(e,t,n){const o=e[n],r=t[n];return n==="style"&&Kt(o)&&Kt(r)?!hc(o,r):o!==r}function VT({vnode:e,parent:t,suspense:n},o){for(;t;){const r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.suspense.vnode.el=r.el=o,e=r),r===e)(e=t.vnode).el=o,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=o)}const mg={},vg=()=>Object.create(mg),gg=e=>Object.getPrototypeOf(e)===mg;function GT(e,t,n,o=!1){const r={},a=vg();e.propsDefaults=Object.create(null),yg(e,t,r,a);for(const s in e.propsOptions[0])s in r||(r[s]=void 0);n?e.props=o?r:Hv(r):e.type.props?e.props=r:e.props=a,e.attrs=a}function KT(e,t,n,o){const{props:r,attrs:a,vnode:{patchFlag:s}}=e,i=qt(r),[u]=e.propsOptions;let h=!1;if((o||s>0)&&!(s&16)){if(s&8){const p=e.vnode.dynamicProps;for(let g=0;g<p.length;g++){let w=p[g];if($u(e.emitsOptions,w))continue;const A=t[w];if(u)if(Vt(a,w))A!==a[w]&&(a[w]=A,h=!0);else{const M=Do(w);r[M]=nf(u,i,M,A,e,!1)}else A!==a[w]&&(a[w]=A,h=!0)}}}else{yg(e,t,r,a)&&(h=!0);let p;for(const g in i)(!t||!Vt(t,g)&&((p=ti(g))===g||!Vt(t,p)))&&(u?n&&(n[g]!==void 0||n[p]!==void 0)&&(r[g]=nf(u,i,g,void 0,e,!0)):delete r[g]);if(a!==i)for(const g in a)(!t||!Vt(t,g))&&(delete a[g],h=!0)}h&&hs(e.attrs,"set","")}function yg(e,t,n,o){const[r,a]=e.propsOptions;let s=!1,i;if(t)for(let u in t){if(Ql(u))continue;const h=t[u];let p;r&&Vt(r,p=Do(u))?!a||!a.includes(p)?n[p]=h:(i||(i={}))[p]=h:$u(e.emitsOptions,u)||(!(u in o)||h!==o[u])&&(o[u]=h,s=!0)}if(a){const u=qt(n),h=i||Zt;for(let p=0;p<a.length;p++){const g=a[p];n[g]=nf(r,u,g,h[g],e,!Vt(h,g))}}return s}function nf(e,t,n,o,r,a){const s=e[n];if(s!=null){const i=Vt(s,"default");if(i&&o===void 0){const u=s.default;if(s.type!==Function&&!s.skipFactory&&vt(u)){const{propsDefaults:h}=r;if(n in h)o=h[n];else{const p=wc(r);o=h[n]=u.call(null,t),p()}}else o=u;r.ce&&r.ce._setProp(n,o)}s[0]&&(a&&!i?o=!1:s[1]&&(o===""||o===ti(n))&&(o=!0))}return o}const YT=new WeakMap;function wg(e,t,n=!1){const o=n?YT:t.propsCache,r=o.get(e);if(r)return r;const a=e.props,s={},i=[];let u=!1;if(!vt(e)){const p=g=>{u=!0;const[w,A]=wg(g,t,!0);zn(s,w),A&&i.push(...A)};!n&&t.mixins.length&&t.mixins.forEach(p),e.extends&&p(e.extends),e.mixins&&e.mixins.forEach(p)}if(!a&&!u)return Kt(e)&&o.set(e,nl),nl;if(lt(a))for(let p=0;p<a.length;p++){const g=Do(a[p]);ch(g)&&(s[g]=Zt)}else if(a)for(const p in a){const g=Do(p);if(ch(g)){const w=a[p],A=s[g]=lt(w)||vt(w)?{type:w}:zn({},w),M=A.type;let U=!1,Y=!0;if(lt(M))for(let ue=0;ue<M.length;++ue){const F=M[ue],H=vt(F)&&F.name;if(H==="Boolean"){U=!0;break}else H==="String"&&(Y=!1)}else U=vt(M)&&M.name==="Boolean";A[0]=U,A[1]=Y,(U||Vt(A,"default"))&&i.push(g)}}const h=[s,i];return Kt(e)&&o.set(e,h),h}function ch(e){return e[0]!=="$"&&!Ql(e)}const Of=e=>e==="_"||e==="_ctx"||e==="$stable",Df=e=>lt(e)?e.map(qa):[qa(e)],JT=(e,t,n)=>{if(t._n)return t;const o=mt((...r)=>Df(t(...r)),n);return o._c=!1,o},bg=(e,t,n)=>{const o=e._ctx;for(const r in e){if(Of(r))continue;const a=e[r];if(vt(a))t[r]=JT(r,a,o);else if(a!=null){const s=Df(a);t[r]=()=>s}}},Tg=(e,t)=>{const n=Df(t);e.slots.default=()=>n},kg=(e,t,n)=>{for(const o in t)(n||!Of(o))&&(e[o]=t[o])},QT=(e,t,n)=>{const o=e.slots=vg();if(e.vnode.shapeFlag&32){const r=t._;r?(kg(o,t,n),n&&_v(o,"_",r,!0)):bg(t,o)}else t&&Tg(e,t)},XT=(e,t,n)=>{const{vnode:o,slots:r}=e;let a=!0,s=Zt;if(o.shapeFlag&32){const i=t._;i?n&&i===1?a=!1:kg(r,t,n):(a=!t.$stable,bg(t,r)),s=t}else t&&(Tg(e,t),s={default:1});if(a)for(const i in r)!Of(i)&&s[i]==null&&delete r[i]},jo=ok;function ZT(e){return ek(e)}function ek(e,t){const n=Pu();n.__VUE__=!0;const{insert:o,remove:r,patchProp:a,createElement:s,createText:i,createComment:u,setText:h,setElementText:p,parentNode:g,nextSibling:w,setScopeId:A=za,insertStaticContent:M}=e,U=(R,j,W,ce=null,le=null,ne=null,Ce=void 0,be=null,de=!!j.dynamicChildren)=>{if(R===j)return;R&&!Ii(R,j)&&(ce=re(R),it(R,le,ne,!0),R=null),j.patchFlag===-2&&(de=!1,j.dynamicChildren=null);const{type:ie,ref:Ge,shapeFlag:Te}=j;switch(ie){case ju:Y(R,j,W,ce);break;case To:ue(R,j,W,ce);break;case nu:R==null&&F(j,W,ce,Ce);break;case qe:fe(R,j,W,ce,le,ne,Ce,be,de);break;default:Te&1?me(R,j,W,ce,le,ne,Ce,be,de):Te&6?Se(R,j,W,ce,le,ne,Ce,be,de):(Te&64||Te&128)&&ie.process(R,j,W,ce,le,ne,Ce,be,de,V)}Ge!=null&&le?ec(Ge,R&&R.ref,ne,j||R,!j):Ge==null&&R&&R.ref!=null&&ec(R.ref,null,ne,R,!0)},Y=(R,j,W,ce)=>{if(R==null)o(j.el=i(j.children),W,ce);else{const le=j.el=R.el;j.children!==R.children&&h(le,j.children)}},ue=(R,j,W,ce)=>{R==null?o(j.el=u(j.children||""),W,ce):j.el=R.el},F=(R,j,W,ce)=>{[R.el,R.anchor]=M(R.children,j,W,ce,R.el,R.anchor)},H=({el:R,anchor:j},W,ce)=>{let le;for(;R&&R!==j;)le=w(R),o(R,W,ce),R=le;o(j,W,ce)},q=({el:R,anchor:j})=>{let W;for(;R&&R!==j;)W=w(R),r(R),R=W;r(j)},me=(R,j,W,ce,le,ne,Ce,be,de)=>{if(j.type==="svg"?Ce="svg":j.type==="math"&&(Ce="mathml"),R==null)we(j,W,ce,le,ne,Ce,be,de);else{const ie=R.el&&R.el._isVueCE?R.el:null;try{ie&&ie._beginPatch(),ge(R,j,le,ne,Ce,be,de)}finally{ie&&ie._endPatch()}}},we=(R,j,W,ce,le,ne,Ce,be)=>{let de,ie;const{props:Ge,shapeFlag:Te,transition:Be,dirs:Fe}=R;if(de=R.el=s(R.type,ne,Ge&&Ge.is,Ge),Te&8?p(de,R.children):Te&16&&je(R.children,de,null,ce,le,wd(R,ne),Ce,be),Fe&&Ti(R,null,ce,"created"),ve(de,R,R.scopeId,Ce,ce),Ge){for(const bt in Ge)bt!=="value"&&!Ql(bt)&&a(de,bt,null,Ge[bt],ne,ce);"value"in Ge&&a(de,"value",null,Ge.value,ne),(ie=Ge.onVnodeBeforeMount)&&Fa(ie,ce,R)}Fe&&Ti(R,null,ce,"beforeMount");const ze=tk(le,Be);ze&&Be.beforeEnter(de),o(de,j,W),((ie=Ge&&Ge.onVnodeMounted)||ze||Fe)&&jo(()=>{try{ie&&Fa(ie,ce,R),ze&&Be.enter(de),Fe&&Ti(R,null,ce,"mounted")}finally{}},le)},ve=(R,j,W,ce,le)=>{if(W&&A(R,W),ce)for(let ne=0;ne<ce.length;ne++)A(R,ce[ne]);if(le){let ne=le.subTree;if(j===ne||_g(ne.type)&&(ne.ssContent===j||ne.ssFallback===j)){const Ce=le.vnode;ve(R,Ce,Ce.scopeId,Ce.slotScopeIds,le.parent)}}},je=(R,j,W,ce,le,ne,Ce,be,de=0)=>{for(let ie=de;ie<R.length;ie++){const Ge=R[ie]=be?fs(R[ie]):qa(R[ie]);U(null,Ge,j,W,ce,le,ne,Ce,be)}},ge=(R,j,W,ce,le,ne,Ce)=>{const be=j.el=R.el;let{patchFlag:de,dynamicChildren:ie,dirs:Ge}=j;de|=R.patchFlag&16;const Te=R.props||Zt,Be=j.props||Zt;let Fe;if(W&&ki(W,!1),(Fe=Be.onVnodeBeforeUpdate)&&Fa(Fe,W,j,R),Ge&&Ti(j,R,W,"beforeUpdate"),W&&ki(W,!0),ie&&(!R.dynamicChildren||R.dynamicChildren.length!==ie.length)&&(de=0,Ce=!1,ie=null),(Te.innerHTML&&Be.innerHTML==null||Te.textContent&&Be.textContent==null)&&p(be,""),ie?Ie(R.dynamicChildren,ie,be,W,ce,wd(j,le),ne):Ce||Le(R,j,be,null,W,ce,wd(j,le),ne,!1),de>0){if(de&16)De(be,Te,Be,W,le);else if(de&2&&Te.class!==Be.class&&a(be,"class",null,Be.class,le),de&4&&a(be,"style",Te.style,Be.style,le),de&8){const ze=j.dynamicProps;for(let bt=0;bt<ze.length;bt++){const dt=ze[bt],pt=Te[dt],Yt=Be[dt];(Yt!==pt||dt==="value")&&a(be,dt,pt,Yt,le,W)}}de&1&&R.children!==j.children&&p(be,j.children)}else!Ce&&ie==null&&De(be,Te,Be,W,le);((Fe=Be.onVnodeUpdated)||Ge)&&jo(()=>{Fe&&Fa(Fe,W,j,R),Ge&&Ti(j,R,W,"updated")},ce)},Ie=(R,j,W,ce,le,ne,Ce)=>{for(let be=0;be<j.length;be++){const de=R[be],ie=j[be],Ge=de.el&&(de.type===qe||!Ii(de,ie)||de.shapeFlag&198)?g(de.el):W;U(de,ie,Ge,null,ce,le,ne,Ce,!0)}},De=(R,j,W,ce,le)=>{if(j!==W){if(j!==Zt)for(const ne in j)!Ql(ne)&&!(ne in W)&&a(R,ne,j[ne],null,le,ce);for(const ne in W){if(Ql(ne))continue;const Ce=W[ne],be=j[ne];Ce!==be&&ne!=="value"&&a(R,ne,be,Ce,le,ce)}"value"in W&&a(R,"value",j.value,W.value,le)}},fe=(R,j,W,ce,le,ne,Ce,be,de)=>{const ie=j.el=R?R.el:i(""),Ge=j.anchor=R?R.anchor:i("");let{patchFlag:Te,dynamicChildren:Be,slotScopeIds:Fe}=j;Fe&&(be=be?be.concat(Fe):Fe),R==null?(o(ie,W,ce),o(Ge,W,ce),je(j.children||[],W,Ge,le,ne,Ce,be,de)):Te>0&&Te&64&&Be&&R.dynamicChildren&&R.dynamicChildren.length===Be.length?(Ie(R.dynamicChildren,Be,W,le,ne,Ce,be),(j.key!=null||le&&j===le.subTree)&&Ff(R,j,!0)):Le(R,j,W,Ge,le,ne,Ce,be,de)},Se=(R,j,W,ce,le,ne,Ce,be,de)=>{j.slotScopeIds=be,R==null?j.shapeFlag&512?le.ctx.activate(j,W,ce,Ce,de):_e(j,W,ce,le,ne,Ce,de):Pe(R,j,de)},_e=(R,j,W,ce,le,ne,Ce)=>{const be=R.component=lk(R,ce,le);if(gc(R)&&(be.ctx.renderer=V),ck(be,!1,Ce),be.asyncDep){if(le&&le.registerDep(be,Re,Ce),!R.el){const de=be.subTree=Me(To);ue(null,de,j,W),R.placeholder=de.el}}else Re(be,R,j,W,le,ne,Ce)},Pe=(R,j,W)=>{const ce=j.component=R.component;if(WT(R,j,W))if(ce.asyncDep&&!ce.asyncResolved){Ue(ce,j,W);return}else ce.next=j,ce.update();else j.el=R.el,ce.vnode=j},Re=(R,j,W,ce,le,ne,Ce)=>{const be=()=>{if(R.isMounted){let{next:Te,bu:Be,u:Fe,parent:ze,vnode:bt}=R;{const z=Cg(R);if(z){Te&&(Te.el=bt.el,Ue(R,Te,Ce)),z.asyncDep.then(()=>{jo(()=>{R.isUnmounted||ie()},le)});return}}let dt=Te,pt;ki(R,!1),Te?(Te.el=bt.el,Ue(R,Te,Ce)):Te=bt,Be&&eu(Be),(pt=Te.props&&Te.props.onVnodeBeforeUpdate)&&Fa(pt,ze,Te,bt),ki(R,!0);const Yt=ih(R),In=R.subTree;R.subTree=Yt,U(In,Yt,g(In.el),re(In),R,le,ne),Te.el=Yt.el,dt===null&&VT(R,Yt.el),Fe&&jo(Fe,le),(pt=Te.props&&Te.props.onVnodeUpdated)&&jo(()=>Fa(pt,ze,Te,bt),le)}else{let Te;const{el:Be,props:Fe}=j,{bm:ze,m:bt,parent:dt,root:pt,type:Yt}=R,In=al(j);ki(R,!1),ze&&eu(ze),!In&&(Te=Fe&&Fe.onVnodeBeforeMount)&&Fa(Te,dt,j),ki(R,!0);{pt.ce&&pt.ce._hasShadowRoot()&&pt.ce._injectChildStyle(Yt,R.parent?R.parent.type:void 0);const z=R.subTree=ih(R);U(null,z,W,ce,R,le,ne),j.el=z.el}if(bt&&jo(bt,le),!In&&(Te=Fe&&Fe.onVnodeMounted)){const z=j;jo(()=>Fa(Te,dt,z),le)}(j.shapeFlag&256||dt&&al(dt.vnode)&&dt.vnode.shapeFlag&256)&&R.a&&jo(R.a,le),R.isMounted=!0,j=W=ce=null}};R.scope.on();const de=R.effect=new Rv(be);R.scope.off();const ie=R.update=de.run.bind(de),Ge=R.job=de.runIfDirty.bind(de);Ge.i=R,Ge.id=R.uid,de.scheduler=()=>jf(Ge),ki(R,!0),ie()},Ue=(R,j,W)=>{j.component=R;const ce=R.vnode.props;R.vnode=j,R.next=null,KT(R,j.props,ce,W),XT(R,j.children,W),ys(),Yp(R),ws()},Le=(R,j,W,ce,le,ne,Ce,be,de=!1)=>{const ie=R&&R.children,Ge=R?R.shapeFlag:0,Te=j.children,{patchFlag:Be,shapeFlag:Fe}=j;if(Be>0){if(Be&128){ft(ie,Te,W,ce,le,ne,Ce,be,de);return}else if(Be&256){gt(ie,Te,W,ce,le,ne,Ce,be,de);return}}Fe&8?(Ge&16&&et(ie,le,ne),Te!==ie&&p(W,Te)):Ge&16?Fe&16?ft(ie,Te,W,ce,le,ne,Ce,be,de):et(ie,le,ne,!0):(Ge&8&&p(W,""),Fe&16&&je(Te,W,ce,le,ne,Ce,be,de))},gt=(R,j,W,ce,le,ne,Ce,be,de)=>{R=R||nl,j=j||nl;const ie=R.length,Ge=j.length,Te=Math.min(ie,Ge);let Be;for(Be=0;Be<Te;Be++){const Fe=j[Be]=de?fs(j[Be]):qa(j[Be]);U(R[Be],Fe,W,null,le,ne,Ce,be,de)}ie>Ge?et(R,le,ne,!0,!1,Te):je(j,W,ce,le,ne,Ce,be,de,Te)},ft=(R,j,W,ce,le,ne,Ce,be,de)=>{let ie=0;const Ge=j.length;let Te=R.length-1,Be=Ge-1;for(;ie<=Te&&ie<=Be;){const Fe=R[ie],ze=j[ie]=de?fs(j[ie]):qa(j[ie]);if(Ii(Fe,ze))U(Fe,ze,W,null,le,ne,Ce,be,de);else break;ie++}for(;ie<=Te&&ie<=Be;){const Fe=R[Te],ze=j[Be]=de?fs(j[Be]):qa(j[Be]);if(Ii(Fe,ze))U(Fe,ze,W,null,le,ne,Ce,be,de);else break;Te--,Be--}if(ie>Te){if(ie<=Be){const Fe=Be+1,ze=Fe<Ge?j[Fe].el:ce;for(;ie<=Be;)U(null,j[ie]=de?fs(j[ie]):qa(j[ie]),W,ze,le,ne,Ce,be,de),ie++}}else if(ie>Be)for(;ie<=Te;)it(R[ie],le,ne,!0),ie++;else{const Fe=ie,ze=ie,bt=new Map;for(ie=ze;ie<=Be;ie++){const pe=j[ie]=de?fs(j[ie]):qa(j[ie]);pe.key!=null&&bt.set(pe.key,ie)}let dt,pt=0;const Yt=Be-ze+1;let In=!1,z=0;const G=new Array(Yt);for(ie=0;ie<Yt;ie++)G[ie]=0;for(ie=Fe;ie<=Te;ie++){const pe=R[ie];if(pt>=Yt){it(pe,le,ne,!0);continue}let Ne;if(pe.key!=null)Ne=bt.get(pe.key);else for(dt=ze;dt<=Be;dt++)if(G[dt-ze]===0&&Ii(pe,j[dt])){Ne=dt;break}Ne===void 0?it(pe,le,ne,!0):(G[Ne-ze]=ie+1,Ne>=z?z=Ne:In=!0,U(pe,j[Ne],W,null,le,ne,Ce,be,de),pt++)}const K=In?nk(G):nl;for(dt=K.length-1,ie=Yt-1;ie>=0;ie--){const pe=ze+ie,Ne=j[pe],We=j[pe+1],Xe=pe+1<Ge?We.el||Sg(We):ce;G[ie]===0?U(null,Ne,W,Xe,le,ne,Ce,be,de):In&&(dt<0||ie!==K[dt]?at(Ne,W,Xe,2):dt--)}}},at=(R,j,W,ce,le=null)=>{const{el:ne,type:Ce,transition:be,children:de,shapeFlag:ie}=R;if(ie&6){at(R.component.subTree,j,W,ce);return}if(ie&128){R.suspense.move(j,W,ce);return}if(ie&64){Ce.move(R,j,W,V);return}if(Ce===qe){o(ne,j,W);for(let Te=0;Te<de.length;Te++)at(de[Te],j,W,ce);o(R.anchor,j,W);return}if(Ce===nu){H(R,j,W);return}if(ce!==2&&ie&1&&be)if(ce===0)be.persisted&&!ne[zr]?o(ne,j,W):(be.beforeEnter(ne),o(ne,j,W),jo(()=>be.enter(ne),le));else{const{leave:Te,delayLeave:Be,afterLeave:Fe}=be,ze=()=>{R.ctx.isUnmounted?r(ne):o(ne,j,W)},bt=()=>{const dt=ne._isLeaving||!!ne[zr];ne._isLeaving&&ne[zr](!0),be.persisted&&!dt?ze():Te(ne,()=>{ze(),Fe&&Fe()})};Be?Be(ne,ze,bt):bt()}else o(ne,j,W)},it=(R,j,W,ce=!1,le=!1)=>{const{type:ne,props:Ce,ref:be,children:de,dynamicChildren:ie,shapeFlag:Ge,patchFlag:Te,dirs:Be,cacheIndex:Fe,memo:ze}=R;if(Te===-2&&(le=!1),be!=null&&(ys(),ec(be,null,W,R,!0),ws()),Fe!=null&&(j.renderCache[Fe]=void 0),Ge&256){j.ctx.deactivate(R);return}const bt=Ge&1&&Be,dt=!al(R);let pt;if(dt&&(pt=Ce&&Ce.onVnodeBeforeUnmount)&&Fa(pt,j,R),Ge&6)Qe(R.component,W,ce);else{if(Ge&128){R.suspense.unmount(W,ce);return}bt&&Ti(R,null,j,"beforeUnmount"),Ge&64?R.type.remove(R,j,W,V,ce):ie&&!ie.hasOnce&&(ne!==qe||Te>0&&Te&64)?et(ie,j,W,!1,!0):(ne===qe&&Te&384||!le&&Ge&16)&&et(de,j,W),ce&&wt(R)}const Yt=ze!=null&&Fe==null;(dt&&(pt=Ce&&Ce.onVnodeUnmounted)||bt||Yt)&&jo(()=>{pt&&Fa(pt,j,R),bt&&Ti(R,null,j,"unmounted"),Yt&&(R.el=null)},W)},wt=R=>{const{type:j,el:W,anchor:ce,transition:le}=R;if(j===qe){St(W,ce);return}if(j===nu){q(R);return}const ne=()=>{r(W),le&&!le.persisted&&le.afterLeave&&le.afterLeave()};if(R.shapeFlag&1&&le&&!le.persisted){const{leave:Ce,delayLeave:be}=le,de=()=>Ce(W,ne);be?be(R.el,ne,de):de()}else ne()},St=(R,j)=>{let W;for(;R!==j;)W=w(R),r(R),R=W;r(j)},Qe=(R,j,W)=>{const{bum:ce,scope:le,job:ne,subTree:Ce,um:be,m:de,a:ie}=R;uh(de),uh(ie),ce&&eu(ce),le.stop(),ne&&(ne.flags|=8,it(Ce,R,j,W)),be&&jo(be,j),jo(()=>{R.isUnmounted=!0},j)},et=(R,j,W,ce=!1,le=!1,ne=0)=>{for(let Ce=ne;Ce<R.length;Ce++)it(R[Ce],j,W,ce,le)},re=R=>{if(R.shapeFlag&6)return re(R.component.subTree);if(R.shapeFlag&128)return R.suspense.next();const j=w(R.anchor||R.el),W=j&&j[eg];return W?w(W):j};let ee=!1;const te=(R,j,W)=>{let ce;R==null?j._vnode&&(it(j._vnode,null,null,!0),ce=j._vnode.component):U(j._vnode||null,R,j,null,null,null,W),j._vnode=R,ee||(ee=!0,Yp(ce),Yv(),ee=!1)},V={p:U,um:it,m:at,r:wt,mt:_e,mc:je,pc:Le,pbc:Ie,n:re,o:e};return{render:te,hydrate:void 0,createApp:FT(te)}}function wd({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 ki({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function tk(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ff(e,t,n=!1){const o=e.children,r=t.children;if(lt(o)&&lt(r))for(let a=0;a<o.length;a++){const s=o[a];let i=r[a];i.shapeFlag&1&&!i.dynamicChildren&&((i.patchFlag<=0||i.patchFlag===32)&&(i=r[a]=fs(r[a]),i.el=s.el),!n&&i.patchFlag!==-2&&Ff(s,i)),i.type===ju&&(i.patchFlag===-1&&(i=r[a]=fs(i)),i.el=s.el),i.type===To&&!i.el&&(i.el=s.el)}}function nk(e){const t=e.slice(),n=[0];let o,r,a,s,i;const u=e.length;for(o=0;o<u;o++){const h=e[o];if(h!==0){if(r=n[n.length-1],e[r]<h){t[o]=r,n.push(o);continue}for(a=0,s=n.length-1;a<s;)i=a+s>>1,e[n[i]]<h?a=i+1:s=i;h<e[n[a]]&&(a>0&&(t[o]=n[a-1]),n[a]=o)}}for(a=n.length,s=n[a-1];a-- >0;)n[a]=s,s=t[s];return n}function Cg(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Cg(t)}function uh(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Sg(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Sg(t.subTree):null}const _g=e=>e.__isSuspense;function ok(e,t){t&&t.pendingBranch?lt(e)?t.effects.push(...e):t.effects.push(e):iT(e)}const qe=Symbol.for("v-fgt"),ju=Symbol.for("v-txt"),To=Symbol.for("v-cmt"),nu=Symbol.for("v-stc"),gs=[];let Oo=null;function C(e=!1){gs.push(Oo=e?null:[])}function Bf(){gs.pop(),Oo=gs[gs.length-1]||null}let fl=1;function pu(e,t=!1){fl+=e,e<0&&Oo&&t&&(Oo.hasOnce=!0)}function xg(e){return e.dynamicChildren=fl>0?Oo||nl:null,Bf(),fl>0&&Oo&&Oo.push(e),e}function I(e,t,n,o,r,a){return xg(f(e,t,n,o,r,a,!0))}function Ze(e,t,n,o,r){return xg(Me(e,t,n,o,r,!0))}function cc(e){return e?e.__v_isVNode===!0:!1}function Ii(e,t){return e.type===t.type&&e.key===t.key}const Ag=({key:e})=>e??null,ou=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?cn(e)||ko(e)||vt(e)?{i:so,r:e,k:t,f:!!n}:e:null);function f(e,t=null,n=null,o=0,r=null,a=e===qe?0:1,s=!1,i=!1){const u={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ag(t),ref:t&&ou(t),scopeId:Qv,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:o,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:so};return i?(hu(u,n),a&128&&e.normalize(u)):n&&(u.shapeFlag|=cn(n)?8:16),fl>0&&!s&&Oo&&(u.patchFlag>0||a&6)&&u.patchFlag!==32&&Oo.push(u),u}const Me=rk;function rk(e,t=null,n=null,o=0,r=null,a=!1){if((!e||e===lg)&&(e=To),cc(e)){const i=ei(e,t,!0);return n&&hu(i,n),fl>0&&!a&&Oo&&(i.shapeFlag&6?Oo[Oo.indexOf(e)]=i:Oo.push(i)),i.patchFlag=-2,i}if(pk(e)&&(e=e.__vccOpts),t){t=ak(t);let{class:i,style:u}=t;i&&!cn(i)&&(t.class=Ye(i)),Kt(u)&&($f(u)&&!lt(u)&&(u=zn({},u)),t.style=kr(u))}const s=cn(e)?1:_g(e)?128:tg(e)?64:Kt(e)?4:vt(e)?2:0;return f(e,t,n,o,r,s,a,!0)}function ak(e){return e?$f(e)||gg(e)?zn({},e):e:null}function ei(e,t,n=!1,o=!1){const{props:r,ref:a,patchFlag:s,children:i,transition:u}=e,h=t?Ig(r||{},t):r,p={__v_isVNode:!0,__v_skip:!0,type:e.type,props:h,key:h&&Ag(h),ref:t&&t.ref?n&&a?lt(a)?a.concat(ou(t)):[a,ou(t)]:ou(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!==qe?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:u,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ei(e.ssContent),ssFallback:e.ssFallback&&ei(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return u&&o&&lc(p,u.clone(p)),p}function vs(e=" ",t=0){return Me(ju,null,e,t)}function E4(e,t){const n=Me(nu,null,e);return n.staticCount=t,n}function Z(e="",t=!1){return t?(C(),Ze(To,null,e)):Me(To,null,e)}function qa(e){return e==null||typeof e=="boolean"?Me(To):lt(e)?Me(qe,null,e.slice()):cc(e)?fs(e):Me(ju,null,String(e))}function fs(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ei(e)}function hu(e,t){let n=0;const{shapeFlag:o}=e;if(t==null)t=null;else if(lt(t))n=16;else if(typeof t=="object")if(o&65){const r=t.default;r&&(r._c&&(r._d=!1),hu(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!gg(t)?t._ctx=so:r===3&&so&&(so.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(vt(t)){if(o&65){hu(e,{default:t});return}t={default:t,_ctx:so},n=32}else t=String(t),o&64?(n=16,t=[vs(t)]):n=8;e.children=t,e.shapeFlag|=n}function Ig(...e){const t={};for(let n=0;n<e.length;n++){const o=e[n];for(const r in o)if(r==="class")t.class!==o.class&&(t.class=Ye([t.class,o.class]));else if(r==="style")t.style=kr([t.style,o.style]);else if(Su(r)){const a=t[r],s=o[r];s&&a!==s&&!(lt(a)&&a.includes(s))?t[r]=a?[].concat(a,s):s:s==null&&a==null&&!_u(r)&&(t[r]=s)}else r!==""&&(t[r]=o[r])}return t}function Fa(e,t,n,o=null){Vr(e,t,7,[n,o])}const sk=fg();let ik=0;function lk(e,t,n){const o=e.type,r=(t?t.appContext:e.appContext)||sk,a={uid:ik++,vnode:e,type:o,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new M0(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(r.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:wg(o,r),emitsOptions:pg(o,r),emit:null,emitted:null,propsDefaults:Zt,inheritAttrs:o.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=UT.bind(null,a),e.ce&&e.ce(a),a}let ao=null;const Uf=()=>ao||so;let mu,of;{const e=Pu(),t=(n,o)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(o),a=>{r.length>1?r.forEach(s=>s(a)):r[0](a)}};mu=t("__VUE_INSTANCE_SETTERS__",n=>ao=n),of=t("__VUE_SSR_SETTERS__",n=>pl=n)}const wc=e=>{const t=ao;return mu(e),e.scope.on(),()=>{e.scope.off(),mu(t)}},dh=()=>{ao&&ao.scope.off(),mu(null)};function Pg(e){return e.vnode.shapeFlag&4}let pl=!1;function ck(e,t=!1,n=!1){t&&of(t);const{props:o,children:r}=e.vnode,a=Pg(e);GT(e,o,a,t),QT(e,r,n||t);const s=a?uk(e,t):void 0;return t&&of(!1),s}function uk(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,RT);const{setup:o}=n;if(o){ys();const r=e.setupContext=o.length>1?Eg(e):null,a=wc(e),s=mc(o,e,0,[e.props,r]),i=kv(s);if(ws(),a(),(i||e.sp)&&!al(e)&&Lf(e),i){if(s.then(dh,dh),t)return s.then(u=>{fh(e,u)}).catch(u=>{vc(u,e,0)});e.asyncDep=s}else fh(e,s)}else Rg(e)}function fh(e,t,n){vt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Kt(t)&&(e.setupState=Vv(t)),Rg(e)}function Rg(e,t,n){const o=e.type;e.render||(e.render=o.render||za);{const r=wc(e);ys();try{$T(e)}finally{ws(),r()}}}const dk={get(e,t){return bo(e,"get",""),e[t]}};function Eg(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,dk),slots:e.slots,emit:e.emit,expose:t}}function Lu(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Vv(Q0(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in tc)return tc[n](e)},has(t,n){return n in t||n in tc}})):e.proxy}function fk(e,t=!0){return vt(e)?e.displayName||e.name:e.name||t&&e.__name}function pk(e){return vt(e)&&"__vccOpts"in e}const X=(e,t)=>nT(e,t,pl);function qf(e,t,n){try{pu(-1);const o=arguments.length;return o===2?Kt(t)&&!lt(t)?cc(t)?Me(e,null,[t]):Me(e,t):Me(e,null,t):(o>3?n=Array.prototype.slice.call(arguments,2):o===3&&cc(n)&&(n=[n]),Me(e,t,n))}finally{pu(1)}}function M4(e,t,n,o){const r=n[o];if(r&&hk(r,e))return r;const a=t();return a.memo=e.slice(),a.cacheIndex=o,n[o]=a}function hk(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let o=0;o<n.length;o++)if(ia(n[o],t[o]))return!1;return fl>0&&Oo&&Oo.push(e),!0}const mk="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 rf;const ph=typeof window<"u"&&window.trustedTypes;if(ph)try{rf=ph.createPolicy("vue",{createHTML:e=>e})}catch{}const Mg=rf?e=>rf.createHTML(e):e=>e,vk="http://www.w3.org/2000/svg",gk="http://www.w3.org/1998/Math/MathML",ds=typeof document<"u"?document:null,hh=ds&&ds.createElement("template"),yk={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,o)=>{const r=t==="svg"?ds.createElementNS(vk,e):t==="mathml"?ds.createElementNS(gk,e):n?ds.createElement(e,{is:n}):ds.createElement(e);return e==="select"&&o&&o.multiple!=null&&r.setAttribute("multiple",o.multiple),r},createText:e=>ds.createTextNode(e),createComment:e=>ds.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>ds.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,o,r,a){const s=n?n.previousSibling:t.lastChild;if(r&&(r===a||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===a||!(r=r.nextSibling)););else{hh.innerHTML=Mg(o==="svg"?`<svg>${e}</svg>`:o==="mathml"?`<math>${e}</math>`:e);const i=hh.content;if(o==="svg"||o==="mathml"){const u=i.firstChild;for(;u.firstChild;)i.appendChild(u.firstChild);i.removeChild(u)}t.insertBefore(i,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Fs="transition",ql="animation",uc=Symbol("_vtc"),$g={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},wk=zn({},ng,$g),bk=e=>(e.displayName="Transition",e.props=wk,e),bc=bk((e,{slots:t})=>qf(vT,Tk(e),t)),Ci=(e,t=[])=>{lt(e)?e.forEach(n=>n(...t)):e&&e(...t)},mh=e=>e?lt(e)?e.some(t=>t.length>1):e.length>1:!1;function Tk(e){const t={};for(const fe in e)fe in $g||(t[fe]=e[fe]);if(e.css===!1)return t;const{name:n="v",type:o,duration:r,enterFromClass:a=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:i=`${n}-enter-to`,appearFromClass:u=a,appearActiveClass:h=s,appearToClass:p=i,leaveFromClass:g=`${n}-leave-from`,leaveActiveClass:w=`${n}-leave-active`,leaveToClass:A=`${n}-leave-to`}=e,M=kk(r),U=M&&M[0],Y=M&&M[1],{onBeforeEnter:ue,onEnter:F,onEnterCancelled:H,onLeave:q,onLeaveCancelled:me,onBeforeAppear:we=ue,onAppear:ve=F,onAppearCancelled:je=H}=t,ge=(fe,Se,_e,Pe)=>{fe._enterCancelled=Pe,Si(fe,Se?p:i),Si(fe,Se?h:s),_e&&_e()},Ie=(fe,Se)=>{fe._isLeaving=!1,Si(fe,g),Si(fe,A),Si(fe,w),Se&&Se()},De=fe=>(Se,_e)=>{const Pe=fe?ve:F,Re=()=>ge(Se,fe,_e);Ci(Pe,[Se,Re]),vh(()=>{Si(Se,fe?u:a),ls(Se,fe?p:i),mh(Pe)||gh(Se,o,U,Re)})};return zn(t,{onBeforeEnter(fe){Ci(ue,[fe]),ls(fe,a),ls(fe,s)},onBeforeAppear(fe){Ci(we,[fe]),ls(fe,u),ls(fe,h)},onEnter:De(!1),onAppear:De(!0),onLeave(fe,Se){fe._isLeaving=!0;const _e=()=>Ie(fe,Se);ls(fe,g),fe._enterCancelled?(ls(fe,w),bh(fe)):(bh(fe),ls(fe,w)),vh(()=>{fe._isLeaving&&(Si(fe,g),ls(fe,A),mh(q)||gh(fe,o,Y,_e))}),Ci(q,[fe,_e])},onEnterCancelled(fe){ge(fe,!1,void 0,!0),Ci(H,[fe])},onAppearCancelled(fe){ge(fe,!0,void 0,!0),Ci(je,[fe])},onLeaveCancelled(fe){Ie(fe),Ci(me,[fe])}})}function kk(e){if(e==null)return null;if(Kt(e))return[bd(e.enter),bd(e.leave)];{const t=bd(e);return[t,t]}}function bd(e){return S0(e)}function ls(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[uc]||(e[uc]=new Set)).add(t)}function Si(e,t){t.split(/\s+/).forEach(o=>o&&e.classList.remove(o));const n=e[uc];n&&(n.delete(t),n.size||(e[uc]=void 0))}function vh(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Ck=0;function gh(e,t,n,o){const r=e._endId=++Ck,a=()=>{r===e._endId&&o()};if(n!=null)return setTimeout(a,n);const{type:s,timeout:i,propCount:u}=Sk(e,t);if(!s)return o();const h=s+"end";let p=0;const g=()=>{e.removeEventListener(h,w),a()},w=A=>{A.target===e&&++p>=u&&g()};setTimeout(()=>{p<u&&g()},i+1),e.addEventListener(h,w)}function Sk(e,t){const n=window.getComputedStyle(e),o=M=>(n[M]||"").split(", "),r=o(`${Fs}Delay`),a=o(`${Fs}Duration`),s=yh(r,a),i=o(`${ql}Delay`),u=o(`${ql}Duration`),h=yh(i,u);let p=null,g=0,w=0;t===Fs?s>0&&(p=Fs,g=s,w=a.length):t===ql?h>0&&(p=ql,g=h,w=u.length):(g=Math.max(s,h),p=g>0?s>h?Fs:ql:null,w=p?p===Fs?a.length:u.length:0);const A=p===Fs&&/\b(?:transform|all)(?:,|$)/.test(o(`${Fs}Property`).toString());return{type:p,timeout:g,propCount:w,hasTransform:A}}function yh(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,o)=>wh(n)+wh(e[o])))}function wh(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function bh(e){return(e?e.ownerDocument:document).body.offsetHeight}function _k(e,t,n){const o=e[uc];o&&(t=(t?[t,...o]:[...o]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const vu=Symbol("_vod"),jg=Symbol("_vsh"),Fc={name:"show",beforeMount(e,{value:t},{transition:n}){e[vu]=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:o}){!t!=!n&&(o?t?(o.beforeEnter(e),zl(e,!0),o.enter(e)):o.leave(e,()=>{zl(e,!1)}):zl(e,t))},beforeUnmount(e,{value:t}){zl(e,t)}};function zl(e,t){e.style.display=t?e[vu]:"none",e[jg]=!t}const xk=Symbol(""),Ak=/(?:^|;)\s*display\s*:/;function Ik(e,t,n){const o=e.style,r=cn(n);let a=!1;if(n&&!r){if(t)if(cn(t))for(const s of t.split(";")){const i=s.slice(0,s.indexOf(":")).trim();n[i]==null&&Yl(o,i,"")}else for(const s in t)n[s]==null&&Yl(o,s,"");for(const s in n){s==="display"&&(a=!0);const i=n[s];i!=null?Rk(e,s,!cn(t)&&t?t[s]:void 0,i)||Yl(o,s,i):Yl(o,s,"")}}else if(r){if(t!==n){const s=o[xk];s&&(n+=";"+s),o.cssText=n,a=Ak.test(n)}}else t&&e.removeAttribute("style");vu in e&&(e[vu]=a?o.display:"",e[jg]&&(o.display="none"))}const Th=/\s*!important$/;function Yl(e,t,n){if(lt(n))n.forEach(o=>Yl(e,t,o));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const o=Pk(e,t);Th.test(n)?e.setProperty(ti(o),n.replace(Th,""),"important"):e[o]=n}}const kh=["Webkit","Moz","ms"],Td={};function Pk(e,t){const n=Td[t];if(n)return n;let o=Do(t);if(o!=="filter"&&o in e)return Td[t]=o;o=Iu(o);for(let r=0;r<kh.length;r++){const a=kh[r]+o;if(a in e)return Td[t]=a}return t}function Rk(e,t,n,o){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&cn(o)&&n===o}const Ch="http://www.w3.org/1999/xlink";function Sh(e,t,n,o,r,a=R0(t)){o&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Ch,t.slice(6,t.length)):e.setAttributeNS(Ch,t,n):n==null||a&&!xv(n)?e.removeAttribute(t):e.setAttribute(t,a?"":pa(n)?String(n):n)}function _h(e,t,n,o,r){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Mg(n):n);return}const a=e.tagName;if(t==="value"&&a!=="PROGRESS"&&!a.includes("-")){const i=a==="OPTION"?e.getAttribute("value")||"":e.value,u=n==null?e.type==="checkbox"?"on":"":String(n);(i!==u||!("_value"in e))&&(e.value=u),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const i=typeof e[t];i==="boolean"?n=xv(n):n==null&&i==="string"?(n="",s=!0):i==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(r||t)}function Pi(e,t,n,o){e.addEventListener(t,n,o)}function Ek(e,t,n,o){e.removeEventListener(t,n,o)}const xh=Symbol("_vei");function Mk(e,t,n,o,r=null){const a=e[xh]||(e[xh]={}),s=a[t];if(o&&s)s.value=o;else{const[i,u]=Lk(t);if(o){const h=a[t]=Dk(o,r);Pi(e,i,h,u)}else s&&(Ek(e,i,s,u),a[t]=void 0)}}const $k=/(Once|Passive|Capture)$/,jk=/^on:?(?:Once|Passive|Capture)$/;function Lk(e){let t,n;for(;(n=e.match($k))&&!jk.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):ti(e.slice(2)),t]}let kd=0;const Nk=Promise.resolve(),Ok=()=>kd||(Nk.then(()=>kd=0),kd=Date.now());function Dk(e,t){const n=o=>{if(!o._vts)o._vts=Date.now();else if(o._vts<=n.attached)return;const r=n.value;if(lt(r)){const a=o.stopImmediatePropagation;o.stopImmediatePropagation=()=>{a.call(o),o._stopped=!0};const s=r.slice(),i=[o];for(let u=0;u<s.length&&!o._stopped;u++){const h=s[u];h&&Vr(h,t,5,i)}}else Vr(r,t,5,[o])};return n.value=e,n.attached=Ok(),n}const Ah=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Fk=(e,t,n,o,r,a)=>{const s=r==="svg";t==="class"?_k(e,o,s):t==="style"?Ik(e,n,o):Su(t)?_u(t)||Mk(e,t,n,o,a):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Bk(e,t,o,s))?(_h(e,t,o),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Sh(e,t,o,s,a,t!=="value")):e._isVueCE&&(Uk(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!cn(o)))?_h(e,Do(t),o,a,t):(t==="true-value"?e._trueValue=o:t==="false-value"&&(e._falseValue=o),Sh(e,t,o,s))};function Bk(e,t,n,o){if(o)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ah(t)&&vt(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 r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return Ah(t)&&cn(n)?!1:t in e}function Uk(e,t){const n=e._def.props;if(!n)return!1;const o=Do(t);return Array.isArray(n)?n.some(r=>Do(r)===o):Object.keys(n).some(r=>Do(r)===o)}const gu=e=>{const t=e.props["onUpdate:modelValue"]||!1;return lt(t)?n=>eu(t,n):t};function qk(e){e.target.composing=!0}function Ih(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const il=Symbol("_assign");function Ph(e,t,n){return t&&(e=e.trim()),n&&(e=xf(e)),e}const sn={created(e,{modifiers:{lazy:t,trim:n,number:o}},r){e[il]=gu(r);const a=o||r.props&&r.props.type==="number";Pi(e,t?"change":"input",s=>{s.target.composing||e[il](Ph(e.value,n,a))}),(n||a)&&Pi(e,"change",()=>{e.value=Ph(e.value,n,a)}),t||(Pi(e,"compositionstart",qk),Pi(e,"compositionend",Ih),Pi(e,"change",Ih))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:o,trim:r,number:a}},s){if(e[il]=gu(s),e.composing)return;const i=(a||e.type==="number")&&!/^0\d/.test(e.value)?xf(e.value):e.value,u=t??"";if(i===u)return;const h=e.getRootNode();(h instanceof Document||h instanceof ShadowRoot)&&h.activeElement===e&&e.type!=="range"&&(o&&t===n||r&&e.value.trim()===u)||(e.value=u)}},Lg={deep:!0,created(e,t,n){e[il]=gu(n),Pi(e,"change",()=>{const o=e._modelValue,r=zk(e),a=e.checked,s=e[il];if(lt(o)){const i=Av(o,r),u=i!==-1;if(a&&!u)s(o.concat(r));else if(!a&&u){const h=[...o];h.splice(i,1),s(h)}}else if(xu(o)){const i=new Set(o);a?i.add(r):i.delete(r),s(i)}else s(Ng(e,a))})},mounted:Rh,beforeUpdate(e,t,n){e[il]=gu(n),Rh(e,t,n)}};function Rh(e,{value:t,oldValue:n},o){e._modelValue=t;let r;if(lt(t))r=Av(t,o.props.value)>-1;else if(xu(t))r=t.has(o.props.value);else{if(t===n)return;r=hc(t,Ng(e,!0))}e.checked!==r&&(e.checked=r)}function zk(e){return"_value"in e?e._value:e.value}function Ng(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const Hk=["ctrl","shift","alt","meta"],Wk={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)=>Hk.some(n=>e[`${n}Key`]&&!t.includes(n))},st=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),o=t.join(".");return n[o]||(n[o]=(r,...a)=>{for(let s=0;s<t.length;s++){const i=Wk[t[s]];if(i&&i(r,t))return}return e(r,...a)})},Vk={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},xn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),o=t.join(".");return n[o]||(n[o]=r=>{if(!("key"in r))return;const a=ti(r.key);if(t.some(s=>s===a||Vk[s]===a))return e(r)})},Gk=zn({patchProp:Fk},yk);let Eh;function Kk(){return Eh||(Eh=ZT(Gk))}const Yk=(...e)=>{const t=Kk().createApp(...e),{mount:n}=t;return t.mount=o=>{const r=Qk(o);if(!r)return;const a=t._component;!vt(a)&&!a.render&&!a.template&&(a.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const s=n(r,!1,Jk(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),s},t};function Jk(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Qk(e){return cn(e)?document.querySelector(e):e}const Xk="modulepreload",Zk=function(e){return"/"+e},Mh={},Hl=function(t,n,o){let r=Promise.resolve();if(n&&n.length>0){let s=function(h){return Promise.all(h.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),u=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));r=s(n.map(h=>{if(h=Zk(h),h in Mh)return;Mh[h]=!0;const p=h.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const w=document.createElement("link");if(w.rel=p?"stylesheet":Xk,p||(w.as="script"),w.crossOrigin="",w.href=h,u&&w.setAttribute("nonce",u),document.head.appendChild(w),p)return new Promise((A,M)=>{w.addEventListener("load",A),w.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${h}`)))})}))}function a(s){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=s,window.dispatchEvent(i),!i.defaultPrevented)throw s}return r.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 Zi=typeof document<"u";function Og(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function eC(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Og(e.default)}const Wt=Object.assign;function Cd(e,t){const n={};for(const o in t){const r=t[o];n[o]=ma(r)?r.map(e):e(r)}return n}const nc=()=>{},ma=Array.isArray;function $h(e,t){const n={};for(const o in e)n[o]=o in t?t[o]:e[o];return n}const Dg=/#/g,tC=/&/g,nC=/\//g,oC=/=/g,rC=/\?/g,Fg=/\+/g,aC=/%5B/g,sC=/%5D/g,Bg=/%5E/g,iC=/%60/g,Ug=/%7B/g,lC=/%7C/g,qg=/%7D/g,cC=/%20/g;function zf(e){return e==null?"":encodeURI(""+e).replace(lC,"|").replace(aC,"[").replace(sC,"]")}function uC(e){return zf(e).replace(Ug,"{").replace(qg,"}").replace(Bg,"^")}function af(e){return zf(e).replace(Fg,"%2B").replace(cC,"+").replace(Dg,"%23").replace(tC,"%26").replace(iC,"`").replace(Ug,"{").replace(qg,"}").replace(Bg,"^")}function dC(e){return af(e).replace(oC,"%3D")}function fC(e){return zf(e).replace(Dg,"%23").replace(rC,"%3F")}function pC(e){return fC(e).replace(nC,"%2F")}function dc(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const hC=/\/$/,mC=e=>e.replace(hC,"");function Sd(e,t,n="/"){let o,r={},a="",s="";const i=t.indexOf("#");let u=t.indexOf("?");return u=i>=0&&u>i?-1:u,u>=0&&(o=t.slice(0,u),a=t.slice(u,i>0?i:t.length),r=e(a.slice(1))),i>=0&&(o=o||t.slice(0,i),s=t.slice(i,t.length)),o=wC(o??t,n),{fullPath:o+a+s,path:o,query:r,hash:dc(s)}}function vC(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function jh(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function gC(e,t,n){const o=t.matched.length-1,r=n.matched.length-1;return o>-1&&o===r&&hl(t.matched[o],n.matched[r])&&zg(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function hl(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function zg(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!yC(e[n],t[n]))return!1;return!0}function yC(e,t){return ma(e)?Lh(e,t):ma(t)?Lh(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Lh(e,t){return ma(t)?e.length===t.length&&e.every((n,o)=>n===t[o]):e.length===1&&e[0]===t}function wC(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),o=e.split("/"),r=o[o.length-1];(r===".."||r===".")&&o.push("");let a=n.length-1,s,i;for(s=0;s<o.length;s++)if(i=o[s],i!==".")if(i==="..")a>1&&a--;else break;return n.slice(0,a).join("/")+"/"+o.slice(s).join("/")}const Bs={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let sf=function(e){return e.pop="pop",e.push="push",e}({}),_d=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function bC(e){if(!e)if(Zi){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),mC(e)}const TC=/^[^#]+#/;function kC(e,t){return e.replace(TC,"#")+t}function CC(e,t){const n=document.documentElement.getBoundingClientRect(),o=e.getBoundingClientRect();return{behavior:t.behavior,left:o.left-n.left-(t.left||0),top:o.top-n.top-(t.top||0)}}const Nu=()=>({left:window.scrollX,top:window.scrollY});function SC(e){let t;if("el"in e){const n=e.el,o=typeof n=="string"&&n.startsWith("#"),r=typeof n=="string"?o?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!r)return;t=CC(r,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 Nh(e,t){return(history.state?history.state.position-t:-1)+e}const lf=new Map;function _C(e,t){lf.set(e,t)}function xC(e){const t=lf.get(e);return lf.delete(e),t}function AC(e){return typeof e=="string"||e&&typeof e=="object"}function Hg(e){return typeof e=="string"||typeof e=="symbol"}let An=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 Wg=Symbol("");An.MATCHER_NOT_FOUND+"",An.NAVIGATION_GUARD_REDIRECT+"",An.NAVIGATION_ABORTED+"",An.NAVIGATION_CANCELLED+"",An.NAVIGATION_DUPLICATED+"";function ml(e,t){return Wt(new Error,{type:e,[Wg]:!0},t)}function cs(e,t){return e instanceof Error&&Wg in e&&(t==null||!!(e.type&t))}const IC=["params","query","hash"];function PC(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of IC)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function RC(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let o=0;o<n.length;++o){const r=n[o].replace(Fg," "),a=r.indexOf("="),s=dc(a<0?r:r.slice(0,a)),i=a<0?null:dc(r.slice(a+1));if(s in t){let u=t[s];ma(u)||(u=t[s]=[u]),u.push(i)}else t[s]=i}return t}function Oh(e){let t="";for(let n in e){const o=e[n];if(n=dC(n),o==null){o!==void 0&&(t+=(t.length?"&":"")+n);continue}(ma(o)?o.map(r=>r&&af(r)):[o&&af(o)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+n,r!=null&&(t+="="+r))})}return t}function EC(e){const t={};for(const n in e){const o=e[n];o!==void 0&&(t[n]=ma(o)?o.map(r=>r==null?null:""+r):o==null?o:""+o)}return t}const MC=Symbol(""),Dh=Symbol(""),Ou=Symbol(""),Hf=Symbol(""),cf=Symbol("");function Wl(){let e=[];function t(o){return e.push(o),()=>{const r=e.indexOf(o);r>-1&&e.splice(r,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Vs(e,t,n,o,r,a=s=>s()){const s=o&&(o.enterCallbacks[r]=o.enterCallbacks[r]||[]);return()=>new Promise((i,u)=>{const h=w=>{w===!1?u(ml(An.NAVIGATION_ABORTED,{from:n,to:t})):w instanceof Error?u(w):AC(w)?u(ml(An.NAVIGATION_GUARD_REDIRECT,{from:t,to:w})):(s&&o.enterCallbacks[r]===s&&typeof w=="function"&&s.push(w),i())},p=a(()=>e.call(o&&o.instances[r],t,n,h));let g=Promise.resolve(p);e.length<3&&(g=g.then(h)),g.catch(w=>u(w))})}function xd(e,t,n,o,r=a=>a()){const a=[];for(const s of e)for(const i in s.components){let u=s.components[i];if(!(t!=="beforeRouteEnter"&&!s.instances[i]))if(Og(u)){const h=(u.__vccOpts||u)[t];h&&a.push(Vs(h,n,o,s,i,r))}else{let h=u();a.push(()=>h.then(p=>{if(!p)throw new Error(`Couldn't resolve component "${i}" at "${s.path}"`);const g=eC(p)?p.default:p;s.mods[i]=p,s.components[i]=g;const w=(g.__vccOpts||g)[t];return w&&Vs(w,n,o,s,i,r)()}))}}return a}function $C(e,t){const n=[],o=[],r=[],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(h=>hl(h,i))?o.push(i):n.push(i));const u=e.matched[s];u&&(t.matched.find(h=>hl(h,u))||r.push(u))}return[n,o,r]}/*!
23
+ * vue-router v4.6.4
24
+ * (c) 2025 Eduardo San Martin Morote
25
+ * @license MIT
26
+ */let jC=()=>location.protocol+"//"+location.host;function Vg(e,t){const{pathname:n,search:o,hash:r}=t,a=e.indexOf("#");if(a>-1){let s=r.includes(e.slice(a))?e.slice(a).length:1,i=r.slice(s);return i[0]!=="/"&&(i="/"+i),jh(i,"")}return jh(n,e)+o+r}function LC(e,t,n,o){let r=[],a=[],s=null;const i=({state:w})=>{const A=Vg(e,location),M=n.value,U=t.value;let Y=0;if(w){if(n.value=A,t.value=w,s&&s===M){s=null;return}Y=U?w.position-U.position:0}else o(A);r.forEach(ue=>{ue(n.value,M,{delta:Y,type:sf.pop,direction:Y?Y>0?_d.forward:_d.back:_d.unknown})})};function u(){s=n.value}function h(w){r.push(w);const A=()=>{const M=r.indexOf(w);M>-1&&r.splice(M,1)};return a.push(A),A}function p(){if(document.visibilityState==="hidden"){const{history:w}=window;if(!w.state)return;w.replaceState(Wt({},w.state,{scroll:Nu()}),"")}}function g(){for(const w of a)w();a=[],window.removeEventListener("popstate",i),window.removeEventListener("pagehide",p),document.removeEventListener("visibilitychange",p)}return window.addEventListener("popstate",i),window.addEventListener("pagehide",p),document.addEventListener("visibilitychange",p),{pauseListeners:u,listen:h,destroy:g}}function Fh(e,t,n,o=!1,r=!1){return{back:e,current:t,forward:n,replaced:o,position:window.history.length,scroll:r?Nu():null}}function NC(e){const{history:t,location:n}=window,o={value:Vg(e,n)},r={value:t.state};r.value||a(o.value,{back:null,current:o.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(u,h,p){const g=e.indexOf("#"),w=g>-1?(n.host&&document.querySelector("base")?e:e.slice(g))+u:jC()+e+u;try{t[p?"replaceState":"pushState"](h,"",w),r.value=h}catch(A){console.error(A),n[p?"replace":"assign"](w)}}function s(u,h){a(u,Wt({},t.state,Fh(r.value.back,u,r.value.forward,!0),h,{position:r.value.position}),!0),o.value=u}function i(u,h){const p=Wt({},r.value,t.state,{forward:u,scroll:Nu()});a(p.current,p,!0),a(u,Wt({},Fh(o.value,u,null),{position:p.position+1},h),!1),o.value=u}return{location:o,state:r,push:i,replace:s}}function OC(e){e=bC(e);const t=NC(e),n=LC(e,t.state,t.location,t.replace);function o(a,s=!0){s||n.pauseListeners(),history.go(a)}const r=Wt({location:"",base:e,go:o,createHref:kC.bind(null,e)},t,n);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>t.state.value}),r}function DC(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),OC(e)}let Ri=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var Yn=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}(Yn||{});const FC={type:Ri.Static,value:""},BC=/[a-zA-Z0-9_]/;function UC(e){if(!e)return[[]];if(e==="/")return[[FC]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(A){throw new Error(`ERR (${n})/"${h}": ${A}`)}let n=Yn.Static,o=n;const r=[];let a;function s(){a&&r.push(a),a=[]}let i=0,u,h="",p="";function g(){h&&(n===Yn.Static?a.push({type:Ri.Static,value:h}):n===Yn.Param||n===Yn.ParamRegExp||n===Yn.ParamRegExpEnd?(a.length>1&&(u==="*"||u==="+")&&t(`A repeatable param (${h}) must be alone in its segment. eg: '/:ids+.`),a.push({type:Ri.Param,value:h,regexp:p,repeatable:u==="*"||u==="+",optional:u==="*"||u==="?"})):t("Invalid state to consume buffer"),h="")}function w(){h+=u}for(;i<e.length;){if(u=e[i++],u==="\\"&&n!==Yn.ParamRegExp){o=n,n=Yn.EscapeNext;continue}switch(n){case Yn.Static:u==="/"?(h&&g(),s()):u===":"?(g(),n=Yn.Param):w();break;case Yn.EscapeNext:w(),n=o;break;case Yn.Param:u==="("?n=Yn.ParamRegExp:BC.test(u)?w():(g(),n=Yn.Static,u!=="*"&&u!=="?"&&u!=="+"&&i--);break;case Yn.ParamRegExp:u===")"?p[p.length-1]=="\\"?p=p.slice(0,-1)+u:n=Yn.ParamRegExpEnd:p+=u;break;case Yn.ParamRegExpEnd:g(),n=Yn.Static,u!=="*"&&u!=="?"&&u!=="+"&&i--,p="";break;default:t("Unknown state");break}}return n===Yn.ParamRegExp&&t(`Unfinished custom RegExp for param "${h}"`),g(),s(),r}const Bh="[^/]+?",qC={sensitive:!1,strict:!1,start:!0,end:!0};var Lo=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}(Lo||{});const zC=/[.+*?^${}()[\]/\\]/g;function HC(e,t){const n=Wt({},qC,t),o=[];let r=n.start?"^":"";const a=[];for(const h of e){const p=h.length?[]:[Lo.Root];n.strict&&!h.length&&(r+="/");for(let g=0;g<h.length;g++){const w=h[g];let A=Lo.Segment+(n.sensitive?Lo.BonusCaseSensitive:0);if(w.type===Ri.Static)g||(r+="/"),r+=w.value.replace(zC,"\\$&"),A+=Lo.Static;else if(w.type===Ri.Param){const{value:M,repeatable:U,optional:Y,regexp:ue}=w;a.push({name:M,repeatable:U,optional:Y});const F=ue||Bh;if(F!==Bh){A+=Lo.BonusCustomRegExp;try{`${F}`}catch(q){throw new Error(`Invalid custom RegExp for param "${M}" (${F}): `+q.message)}}let H=U?`((?:${F})(?:/(?:${F}))*)`:`(${F})`;g||(H=Y&&h.length<2?`(?:/${H})`:"/"+H),Y&&(H+="?"),r+=H,A+=Lo.Dynamic,Y&&(A+=Lo.BonusOptional),U&&(A+=Lo.BonusRepeatable),F===".*"&&(A+=Lo.BonusWildcard)}p.push(A)}o.push(p)}if(n.strict&&n.end){const h=o.length-1;o[h][o[h].length-1]+=Lo.BonusStrict}n.strict||(r+="/?"),n.end?r+="$":n.strict&&!r.endsWith("/")&&(r+="(?:/|$)");const s=new RegExp(r,n.sensitive?"":"i");function i(h){const p=h.match(s),g={};if(!p)return null;for(let w=1;w<p.length;w++){const A=p[w]||"",M=a[w-1];g[M.name]=A&&M.repeatable?A.split("/"):A}return g}function u(h){let p="",g=!1;for(const w of e){(!g||!p.endsWith("/"))&&(p+="/"),g=!1;for(const A of w)if(A.type===Ri.Static)p+=A.value;else if(A.type===Ri.Param){const{value:M,repeatable:U,optional:Y}=A,ue=M in h?h[M]:"";if(ma(ue)&&!U)throw new Error(`Provided param "${M}" is an array but it is not repeatable (* or + modifiers)`);const F=ma(ue)?ue.join("/"):ue;if(!F)if(Y)w.length<2&&(p.endsWith("/")?p=p.slice(0,-1):g=!0);else throw new Error(`Missing required param "${M}"`);p+=F}}return p||"/"}return{re:s,score:o,keys:a,parse:i,stringify:u}}function WC(e,t){let n=0;for(;n<e.length&&n<t.length;){const o=t[n]-e[n];if(o)return o;n++}return e.length<t.length?e.length===1&&e[0]===Lo.Static+Lo.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===Lo.Static+Lo.Segment?1:-1:0}function Gg(e,t){let n=0;const o=e.score,r=t.score;for(;n<o.length&&n<r.length;){const a=WC(o[n],r[n]);if(a)return a;n++}if(Math.abs(r.length-o.length)===1){if(Uh(o))return 1;if(Uh(r))return-1}return r.length-o.length}function Uh(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const VC={strict:!1,end:!0,sensitive:!1};function GC(e,t,n){const o=HC(UC(e.path),n),r=Wt(o,{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function KC(e,t){const n=[],o=new Map;t=$h(VC,t);function r(g){return o.get(g)}function a(g,w,A){const M=!A,U=zh(g);U.aliasOf=A&&A.record;const Y=$h(t,g),ue=[U];if("alias"in g){const q=typeof g.alias=="string"?[g.alias]:g.alias;for(const me of q)ue.push(zh(Wt({},U,{components:A?A.record.components:U.components,path:me,aliasOf:A?A.record:U})))}let F,H;for(const q of ue){const{path:me}=q;if(w&&me[0]!=="/"){const we=w.record.path,ve=we[we.length-1]==="/"?"":"/";q.path=w.record.path+(me&&ve+me)}if(F=GC(q,w,Y),A?A.alias.push(F):(H=H||F,H!==F&&H.alias.push(F),M&&g.name&&!Hh(F)&&s(g.name)),Kg(F)&&u(F),U.children){const we=U.children;for(let ve=0;ve<we.length;ve++)a(we[ve],F,A&&A.children[ve])}A=A||F}return H?()=>{s(H)}:nc}function s(g){if(Hg(g)){const w=o.get(g);w&&(o.delete(g),n.splice(n.indexOf(w),1),w.children.forEach(s),w.alias.forEach(s))}else{const w=n.indexOf(g);w>-1&&(n.splice(w,1),g.record.name&&o.delete(g.record.name),g.children.forEach(s),g.alias.forEach(s))}}function i(){return n}function u(g){const w=QC(g,n);n.splice(w,0,g),g.record.name&&!Hh(g)&&o.set(g.record.name,g)}function h(g,w){let A,M={},U,Y;if("name"in g&&g.name){if(A=o.get(g.name),!A)throw ml(An.MATCHER_NOT_FOUND,{location:g});Y=A.record.name,M=Wt(qh(w.params,A.keys.filter(H=>!H.optional).concat(A.parent?A.parent.keys.filter(H=>H.optional):[]).map(H=>H.name)),g.params&&qh(g.params,A.keys.map(H=>H.name))),U=A.stringify(M)}else if(g.path!=null)U=g.path,A=n.find(H=>H.re.test(U)),A&&(M=A.parse(U),Y=A.record.name);else{if(A=w.name?o.get(w.name):n.find(H=>H.re.test(w.path)),!A)throw ml(An.MATCHER_NOT_FOUND,{location:g,currentLocation:w});Y=A.record.name,M=Wt({},w.params,g.params),U=A.stringify(M)}const ue=[];let F=A;for(;F;)ue.unshift(F.record),F=F.parent;return{name:Y,path:U,params:M,matched:ue,meta:JC(ue)}}e.forEach(g=>a(g));function p(){n.length=0,o.clear()}return{addRoute:a,resolve:h,removeRoute:s,clearRoutes:p,getRoutes:i,getRecordMatcher:r}}function qh(e,t){const n={};for(const o of t)o in e&&(n[o]=e[o]);return n}function zh(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:YC(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 YC(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const o in e.components)t[o]=typeof n=="object"?n[o]:n;return t}function Hh(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function JC(e){return e.reduce((t,n)=>Wt(t,n.meta),{})}function QC(e,t){let n=0,o=t.length;for(;n!==o;){const a=n+o>>1;Gg(e,t[a])<0?o=a:n=a+1}const r=XC(e);return r&&(o=t.lastIndexOf(r,o-1)),o}function XC(e){let t=e;for(;t=t.parent;)if(Kg(t)&&Gg(e,t)===0)return t}function Kg({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Wh(e){const t=da(Ou),n=da(Hf),o=X(()=>{const u=v(e.to);return t.resolve(u)}),r=X(()=>{const{matched:u}=o.value,{length:h}=u,p=u[h-1],g=n.matched;if(!p||!g.length)return-1;const w=g.findIndex(hl.bind(null,p));if(w>-1)return w;const A=Vh(u[h-2]);return h>1&&Vh(p)===A&&g[g.length-1].path!==A?g.findIndex(hl.bind(null,u[h-2])):w}),a=X(()=>r.value>-1&&oS(n.params,o.value.params)),s=X(()=>r.value>-1&&r.value===n.matched.length-1&&zg(n.params,o.value.params));function i(u={}){if(nS(u)){const h=t[v(e.replace)?"replace":"push"](v(e.to)).catch(nc);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>h),h}return Promise.resolve()}return{route:o,href:X(()=>o.value.href),isActive:a,isExactActive:s,navigate:i}}function ZC(e){return e.length===1?e[0]:e}const eS=en({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:Wh,setup(e,{slots:t}){const n=Eu(Wh(e)),{options:o}=da(Ou),r=X(()=>({[Gh(e.activeClass,o.linkActiveClass,"router-link-active")]:n.isActive,[Gh(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&ZC(t.default(n));return e.custom?a:qf("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:r.value},a)}}}),tS=eS;function nS(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 oS(e,t){for(const n in t){const o=t[n],r=e[n];if(typeof o=="string"){if(o!==r)return!1}else if(!ma(r)||r.length!==o.length||o.some((a,s)=>a.valueOf()!==r[s].valueOf()))return!1}return!0}function Vh(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Gh=(e,t,n)=>e??t??n,rS=en({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const o=da(cf),r=X(()=>e.route||o.value),a=da(Dh,0),s=X(()=>{let h=v(a);const{matched:p}=r.value;let g;for(;(g=p[h])&&!g.components;)h++;return h}),i=X(()=>r.value.matched[s.value]);tu(Dh,X(()=>s.value+1)),tu(MC,i),tu(cf,r);const u=x();return tt(()=>[u.value,i.value,e.name],([h,p,g],[w,A,M])=>{p&&(p.instances[g]=h,A&&A!==p&&h&&h===w&&(p.leaveGuards.size||(p.leaveGuards=A.leaveGuards),p.updateGuards.size||(p.updateGuards=A.updateGuards))),h&&p&&(!A||!hl(p,A)||!w)&&(p.enterCallbacks[g]||[]).forEach(U=>U(h))},{flush:"post"}),()=>{const h=r.value,p=e.name,g=i.value,w=g&&g.components[p];if(!w)return Kh(n.default,{Component:w,route:h});const A=g.props[p],M=A?A===!0?h.params:typeof A=="function"?A(h):A:null,Y=qf(w,Wt({},M,t,{onVnodeUnmounted:ue=>{ue.component.isUnmounted&&(g.instances[p]=null)},ref:u}));return Kh(n.default,{Component:Y,route:h})||Y}}});function Kh(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const aS=rS;function sS(e){const t=KC(e.routes,e),n=e.parseQuery||RC,o=e.stringifyQuery||Oh,r=e.history,a=Wl(),s=Wl(),i=Wl(),u=X0(Bs);let h=Bs;Zi&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const p=Cd.bind(null,re=>""+re),g=Cd.bind(null,pC),w=Cd.bind(null,dc);function A(re,ee){let te,V;return Hg(re)?(te=t.getRecordMatcher(re),V=ee):V=re,t.addRoute(V,te)}function M(re){const ee=t.getRecordMatcher(re);ee&&t.removeRoute(ee)}function U(){return t.getRoutes().map(re=>re.record)}function Y(re){return!!t.getRecordMatcher(re)}function ue(re,ee){if(ee=Wt({},ee||u.value),typeof re=="string"){const W=Sd(n,re,ee.path),ce=t.resolve({path:W.path},ee),le=r.createHref(W.fullPath);return Wt(W,ce,{params:w(ce.params),hash:dc(W.hash),redirectedFrom:void 0,href:le})}let te;if(re.path!=null)te=Wt({},re,{path:Sd(n,re.path,ee.path).path});else{const W=Wt({},re.params);for(const ce in W)W[ce]==null&&delete W[ce];te=Wt({},re,{params:g(W)}),ee.params=g(ee.params)}const V=t.resolve(te,ee),$e=re.hash||"";V.params=p(w(V.params));const R=vC(o,Wt({},re,{hash:uC($e),path:V.path})),j=r.createHref(R);return Wt({fullPath:R,hash:$e,query:o===Oh?EC(re.query):re.query||{}},V,{redirectedFrom:void 0,href:j})}function F(re){return typeof re=="string"?Sd(n,re,u.value.path):Wt({},re)}function H(re,ee){if(h!==re)return ml(An.NAVIGATION_CANCELLED,{from:ee,to:re})}function q(re){return ve(re)}function me(re){return q(Wt(F(re),{replace:!0}))}function we(re,ee){const te=re.matched[re.matched.length-1];if(te&&te.redirect){const{redirect:V}=te;let $e=typeof V=="function"?V(re,ee):V;return typeof $e=="string"&&($e=$e.includes("?")||$e.includes("#")?$e=F($e):{path:$e},$e.params={}),Wt({query:re.query,hash:re.hash,params:$e.path!=null?{}:re.params},$e)}}function ve(re,ee){const te=h=ue(re),V=u.value,$e=re.state,R=re.force,j=re.replace===!0,W=we(te,V);if(W)return ve(Wt(F(W),{state:typeof W=="object"?Wt({},$e,W.state):$e,force:R,replace:j}),ee||te);const ce=te;ce.redirectedFrom=ee;let le;return!R&&gC(o,V,te)&&(le=ml(An.NAVIGATION_DUPLICATED,{to:ce,from:V}),at(V,V,!0,!1)),(le?Promise.resolve(le):Ie(ce,V)).catch(ne=>cs(ne)?cs(ne,An.NAVIGATION_GUARD_REDIRECT)?ne:ft(ne):Le(ne,ce,V)).then(ne=>{if(ne){if(cs(ne,An.NAVIGATION_GUARD_REDIRECT))return ve(Wt({replace:j},F(ne.to),{state:typeof ne.to=="object"?Wt({},$e,ne.to.state):$e,force:R}),ee||ce)}else ne=fe(ce,V,!0,j,$e);return De(ce,V,ne),ne})}function je(re,ee){const te=H(re,ee);return te?Promise.reject(te):Promise.resolve()}function ge(re){const ee=St.values().next().value;return ee&&typeof ee.runWithContext=="function"?ee.runWithContext(re):re()}function Ie(re,ee){let te;const[V,$e,R]=$C(re,ee);te=xd(V.reverse(),"beforeRouteLeave",re,ee);for(const W of V)W.leaveGuards.forEach(ce=>{te.push(Vs(ce,re,ee))});const j=je.bind(null,re,ee);return te.push(j),et(te).then(()=>{te=[];for(const W of a.list())te.push(Vs(W,re,ee));return te.push(j),et(te)}).then(()=>{te=xd($e,"beforeRouteUpdate",re,ee);for(const W of $e)W.updateGuards.forEach(ce=>{te.push(Vs(ce,re,ee))});return te.push(j),et(te)}).then(()=>{te=[];for(const W of R)if(W.beforeEnter)if(ma(W.beforeEnter))for(const ce of W.beforeEnter)te.push(Vs(ce,re,ee));else te.push(Vs(W.beforeEnter,re,ee));return te.push(j),et(te)}).then(()=>(re.matched.forEach(W=>W.enterCallbacks={}),te=xd(R,"beforeRouteEnter",re,ee,ge),te.push(j),et(te))).then(()=>{te=[];for(const W of s.list())te.push(Vs(W,re,ee));return te.push(j),et(te)}).catch(W=>cs(W,An.NAVIGATION_CANCELLED)?W:Promise.reject(W))}function De(re,ee,te){i.list().forEach(V=>ge(()=>V(re,ee,te)))}function fe(re,ee,te,V,$e){const R=H(re,ee);if(R)return R;const j=ee===Bs,W=Zi?history.state:{};te&&(V||j?r.replace(re.fullPath,Wt({scroll:j&&W&&W.scroll},$e)):r.push(re.fullPath,$e)),u.value=re,at(re,ee,te,j),ft()}let Se;function _e(){Se||(Se=r.listen((re,ee,te)=>{if(!Qe.listening)return;const V=ue(re),$e=we(V,Qe.currentRoute.value);if($e){ve(Wt($e,{replace:!0,force:!0}),V).catch(nc);return}h=V;const R=u.value;Zi&&_C(Nh(R.fullPath,te.delta),Nu()),Ie(V,R).catch(j=>cs(j,An.NAVIGATION_ABORTED|An.NAVIGATION_CANCELLED)?j:cs(j,An.NAVIGATION_GUARD_REDIRECT)?(ve(Wt(F(j.to),{force:!0}),V).then(W=>{cs(W,An.NAVIGATION_ABORTED|An.NAVIGATION_DUPLICATED)&&!te.delta&&te.type===sf.pop&&r.go(-1,!1)}).catch(nc),Promise.reject()):(te.delta&&r.go(-te.delta,!1),Le(j,V,R))).then(j=>{j=j||fe(V,R,!1),j&&(te.delta&&!cs(j,An.NAVIGATION_CANCELLED)?r.go(-te.delta,!1):te.type===sf.pop&&cs(j,An.NAVIGATION_ABORTED|An.NAVIGATION_DUPLICATED)&&r.go(-1,!1)),De(V,R,j)}).catch(nc)}))}let Pe=Wl(),Re=Wl(),Ue;function Le(re,ee,te){ft(re);const V=Re.list();return V.length?V.forEach($e=>$e(re,ee,te)):console.error(re),Promise.reject(re)}function gt(){return Ue&&u.value!==Bs?Promise.resolve():new Promise((re,ee)=>{Pe.add([re,ee])})}function ft(re){return Ue||(Ue=!re,_e(),Pe.list().forEach(([ee,te])=>re?te(re):ee()),Pe.reset()),re}function at(re,ee,te,V){const{scrollBehavior:$e}=e;if(!Zi||!$e)return Promise.resolve();const R=!te&&xC(Nh(re.fullPath,0))||(V||!te)&&history.state&&history.state.scroll||null;return Gt().then(()=>$e(re,ee,R)).then(j=>j&&SC(j)).catch(j=>Le(j,re,ee))}const it=re=>r.go(re);let wt;const St=new Set,Qe={currentRoute:u,listening:!0,addRoute:A,removeRoute:M,clearRoutes:t.clearRoutes,hasRoute:Y,getRoutes:U,resolve:ue,options:e,push:q,replace:me,go:it,back:()=>it(-1),forward:()=>it(1),beforeEach:a.add,beforeResolve:s.add,afterEach:i.add,onError:Re.add,isReady:gt,install(re){re.component("RouterLink",tS),re.component("RouterView",aS),re.config.globalProperties.$router=Qe,Object.defineProperty(re.config.globalProperties,"$route",{enumerable:!0,get:()=>v(u)}),Zi&&!wt&&u.value===Bs&&(wt=!0,q(r.location).catch(V=>{}));const ee={};for(const V in Bs)Object.defineProperty(ee,V,{get:()=>u.value[V],enumerable:!0});re.provide(Ou,Qe),re.provide(Hf,Hv(ee)),re.provide(cf,u);const te=re.unmount;St.add(re),re.unmount=function(){St.delete(re),St.size<1&&(h=Bs,Se&&Se(),Se=null,u.value=Bs,wt=!1,Ue=!1),te()}}};function et(re){return re.reduce((ee,te)=>ee.then(()=>ge(te)),Promise.resolve())}return Qe}function iS(){return da(Ou)}function lS(e){return da(Hf)}const Yh=768;function Wf(){const e=x(typeof window<"u"?window.innerWidth<Yh:!1);let t=null;function n(o){e.value=o.matches}return Cs(()=>{t=window.matchMedia(`(max-width: ${Yh-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),yc(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const cS={key:0,class:"desktop-sidebar"},uS={class:"desktop-main"},Jh="codex-web-local.sidebar-width.v1",dS=260,fS=620,Qh=320,pS=en({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Wf();function o(h){return Math.min(fS,Math.max(dS,h))}function r(){if(typeof window>"u")return Qh;const h=window.localStorage.getItem(Jh),p=Number(h);return Number.isFinite(p)?o(p):Qh}const a=x(r()),s=X(()=>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(h){typeof window>"u"||window.localStorage.setItem(Jh,String(h))}function u(h){h.preventDefault();const p=h.clientX,g=a.value,w=M=>{const U=M.clientX-p;a.value=o(g+U)},A=()=>{i(a.value),window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",A)};window.addEventListener("mousemove",w),window.addEventListener("mouseup",A)}return(h,p)=>(C(),I("div",{class:Ye(["desktop-layout",{"is-mobile":v(n)}]),style:kr(s.value)},[v(n)?(C(),Ze(Qs,{key:0,to:"body"},[Me(bc,{name:"drawer"},{default:mt(()=>[e.isSidebarCollapsed?Z("",!0):(C(),I("div",{key:0,class:"mobile-drawer-backdrop",onClick:p[1]||(p[1]=g=>h.$emit("close-sidebar"))},[f("aside",{class:"mobile-drawer",onClick:p[0]||(p[0]=st(()=>{},["stop"]))},[er(h.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):Z("",!0),v(n)?Z("",!0):(C(),I(qe,{key:1},[e.isSidebarCollapsed?Z("",!0):(C(),I("aside",cS,[er(h.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?Z("",!0):(C(),I("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:u},null,32))],64)),f("section",uS,[er(h.$slots,"content",{},void 0)])],6))}}),yt=(e,t)=>{const n=e.__vccOpts||e;for(const[o,r]of t)n[o]=r;return n},hS=yt(pS,[["__scopeId","data-v-782e512b"]]);function Xh(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class fa extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function Gr(e,t){if(typeof e=="string"&&e.length>0)return e;const n=Xh(e);if(!n)return t;const o=n.error;if(typeof o=="string"&&o.length>0)return o;const r=Xh(o);return r&&typeof r.message=="string"&&r.message.length>0?r.message:typeof n.message=="string"&&n.message.length>0?n.message:typeof n.detail=="string"&&n.detail.length>0?n.detail:t}function va(e,t,n){return e instanceof fa?e:e instanceof Error?new fa(e.message||t,{code:"unknown_error",method:n}):new fa(t,{code:"unknown_error",method:n})}function Yg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function mS(e,t){const n={method:e,params:t??null};let o;try{o=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(i){throw new fa(i instanceof Error?i.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let r=null,a=null;try{a=await o.text(),r=JSON.parse(a)}catch{r=null}if(!o.ok){const i=Gr(r,"")||(a==null?void 0:a.slice(0,500))||"",u=`RPC ${e} failed with HTTP ${o.status}`;throw new fa(i?`${u}: ${i}`:u,{code:"http_error",method:e,status:o.status})}const s=r;if(!s||typeof s!="object"||!("result"in s))throw new fa(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:o.status});return s.result}async function vS(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new fa(Gr(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 gS(e){const t=Yg(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 Zh(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function yS(e){if(typeof window>"u")return()=>{};let t=null,n=!1,o=null;const r=()=>{o!==null&&(window.clearTimeout(o),o=null)},a=(h,p)=>{if(n||o!==null)return;const g=Math.min(1e3*2**p,1e4);o=window.setTimeout(()=>{o=null,!n&&h()},g)},s=h=>{const p=gS(h);p&&e(p)},i=(h=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const p=new EventSource("/codex-api/events");let g=!1;p.onmessage=w=>{try{s(JSON.parse(w.data))}catch{}},p.addEventListener("ready",w=>{try{const A=w.data?JSON.parse(w.data):{ok:!0};Zh(e,A)}catch{Zh(e)}}),p.onerror=()=>{n||g||p.readyState===EventSource.CLOSED&&(g=!0,p.close(),a(()=>i(h+1),h))},t=()=>{g=!0,p.close()}},u=(h=0)=>{if(typeof WebSocket>"u"||n){i();return}t==null||t();const p=window.location.protocol==="https:"?"wss:":"ws:",g=new WebSocket(`${p}//${window.location.host}/codex-api/ws`);let w=!1,A=!1,M=window.setTimeout(()=>{w||n||A||(A=!0,g.close(),i())},2500);g.onopen=()=>{w=!0,r(),M!==null&&(window.clearTimeout(M),M=null)},g.onmessage=U=>{try{s(JSON.parse(String(U.data)))}catch{}},g.onerror=()=>{},g.onclose=()=>{if(M!==null&&(window.clearTimeout(M),M=null),!(n||A)){if(!w){i();return}a(()=>u(h+1),h)}},t=()=>{A=!0,M!==null&&(window.clearTimeout(M),M=null),g.close()}};return typeof WebSocket<"u"?u():i(),()=>{n=!0,r(),t==null||t()}}async function wS(e){let t;try{t=await fetch("/codex-api/server-requests/respond",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(o){throw new fa(o instanceof Error?o.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 fa(Gr(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function bS(){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 fa(Gr(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Yg(t),o=n==null?void 0:n.data;return Array.isArray(o)?o:[]}async function ut(e,t){try{return await mS(e,t)}catch(n){throw va(n,`RPC ${e} failed`,e)}}function pn(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},o=n.message;if(typeof o=="string"&&o.trim().length>0)return o;const r=n.error;return typeof r=="string"&&r.trim().length>0?r:t}function Je(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function ae(e){return typeof e=="string"&&e.length>0?e:null}function ln(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Co(e){return typeof e=="boolean"?e:null}function la(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}async function Oi(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 yu(e){const t=Je(e);if(!t)return null;const n=ae(t.id),o=ae(t.kind),r=ae(t.name),a=ae(t.prompt),s=ae(t.rrule),i=ae(t.status);return!n||!r||!a||!s||o!=="heartbeat"&&o!=="cron"||i!=="ACTIVE"&&i!=="PAUSED"?null:{id:n,kind:o,name:r,prompt:a,rrule:s,status:i,targetThreadId:ae(t.targetThreadId),cwds:Array.isArray(t.cwds)?t.cwds.filter(u=>typeof u=="string"&&u.trim().length>0):[],createdAtMs:ln(t.createdAtMs),updatedAtMs:ln(t.updatedAtMs),nextRunAtMs:ln(t.nextRunAtMs)}}function Jg(e){if(Array.isArray(e))return e.flatMap(n=>{const o=yu(n);return o?[o]:[]});const t=yu(e);return t?[t]:[]}async function TS(){var r;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(Gr(t,"Failed to load thread automations"));const n=Je((r=Je(t))==null?void 0:r.data),o={};if(!n)return o;for(const[a,s]of Object.entries(n)){const i=Jg(s);i.length>0&&(o[a]=i)}return o}async function kS(){var r;const e=await fetch("/codex-api/project-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(Gr(t,"Failed to load project automations"));const n=Je((r=Je(t))==null?void 0:r.data),o={};if(!n)return o;for(const[a,s]of Object.entries(n)){const i=Jg(s);i.length>0&&(o[a]=i)}return o}async function CS(e){var r;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(Gr(n,"Failed to save thread automation"));const o=yu((r=Je(n))==null?void 0:r.data);if(!o)throw new Error("Thread automation response was malformed");return o}async function SS(e){var r;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(Gr(n,"Failed to save project automation"));const o=yu((r=Je(n))==null?void 0:r.data);if(!o)throw new Error("Project automation response was malformed");return o}async function em(e,t){const n=new URLSearchParams({threadId:e});t&&n.set("automationId",t);const o=await fetch(`/codex-api/thread-automation?${n.toString()}`,{method:"DELETE"}),r=await o.json().catch(()=>null);if(!o.ok)throw new Error(Gr(r,"Failed to delete thread automation"))}async function tm(e,t){const n=new URLSearchParams({projectName:e});t&&n.set("automationId",t);const o=await fetch(`/codex-api/project-automation?${n.toString()}`,{method:"DELETE"}),r=await o.json().catch(()=>null);if(!o.ok)throw new Error(Gr(r,"Failed to delete project automation"))}async function _S(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})}),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(Gr(o,"Failed to run thread automation"))}const xS=new Set(["node_modules","dist","build","out",".next",".nuxt","coverage","__pycache__",".cache",".turbo","target",".venv","venv",".idea",".vscode","output"]);function Qg(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>n.startsWith(".")||xS.has(n))}function AS(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=Array.isArray(t.files)?t.files:[],o=[];for(const r of n){if(!r||typeof r!="object"||Array.isArray(r))continue;const s=r.path,i=typeof s=="string"?s.trim():"";!i||Qg(i)||o.push({path:i})}return o}async function IS(e,t){await ut("fuzzyFileSearch/sessionStart",{sessionId:t,roots:e})}async function PS(e,t){await ut("fuzzyFileSearch/sessionUpdate",{sessionId:e,query:t})}async function RS(e){await ut("fuzzyFileSearch/sessionStop",{sessionId:e}).catch(()=>{})}async function nm(e,t,n=20){const o=e.trim();if(!o)return[];const r=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:o,query:t.trim(),limit:n})}),a=await r.json();if(!r.ok){const h=pn(a,"Failed to search files");throw new Error(h)}const s=a&&typeof a=="object"&&!Array.isArray(a)?a:{},i=Array.isArray(s.data)?s.data:[],u=[];for(const h of i){if(!h||typeof h!="object"||Array.isArray(h))continue;const g=h.path,w=typeof g=="string"?g.trim():"";!w||Qg(w)||u.push({path:w})}return u}async function ES(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})}),o=await n.json();if(!n.ok)throw new Error(o.error||"Failed to search threads");return o.data??{threadIds:[],indexedThreadCount:0}}function MS(e){const t=Je(e);if(!t)return null;const n=ae(t.id),o=ae(t.threadId),r=ae(t.cwd),a=ae(t.shell);return!n||!o||!r||!a?null:{id:n,threadId:o,cwd:r,shell:a,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:Co(t.truncated)??!1}}async function wl(e,t){const n=await fetch(e,t),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(Gr(o,`Terminal request failed with HTTP ${n.status}`));return o}async function $4(e){var o;const t=await wl("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=MS((o=Je(t))==null?void 0:o.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function $S(){const e=await wl("/codex-api/thread-terminal/status"),t=Je(e);return{available:Co(t==null?void 0:t.available)??!1,reason:ae(t==null?void 0:t.reason)||null}}async function j4(e){const t=await wl(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=Je(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(r=>{const a=Je(r),s=ae(a==null?void 0:a.label),i=ae(a==null?void 0:a.value),u=ae(a==null?void 0:a.source);return!s||!i||u!=="package"&&u!=="script"&&u!=="make"?[]:[{label:s,value:i,source:u}]})}async function L4(e,t){await wl("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function N4(e,t,n){await wl("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function O4(e){await wl("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}const Xg=["none","minimal","low","medium","high","xhigh","max","ultra"];function vl(e){return typeof e=="string"&&Xg.some(t=>t===e)}function jS(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function nt(e){return jS(e)}function Zg(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function LS(e){const t=nt(e);return t.startsWith("/")||Zg(t)}function NS(e){const t=nt(e).replace(/[\\/]+/gu,"/");return Zg(t)?t.toLowerCase():t}function Tr(e){const t=nt(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function ll(e){const t=nt(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function Wr(e){return Tr(e)||nt(e)||"Projectless"}function wu(e){const t=nt(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function om(e){return new Date(e*1e3).toISOString()}function OS(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function DS(e){const t=e.error;return typeof(t==null?void 0:t.message)=="string"?t.message.trim():""}const FS=/^##\s+(.+?):\s+(.+?)\s*$/,BS=/^#\s*files mentioned by the user\s*:?\s*$/i;function US(e){var r,a;const t=e.split(`
27
+ `).findIndex(s=>BS.test(s.trim()));if(t<0)return[];const n=e.split(`
28
+ `).slice(t+1),o=[];for(const s of n){const i=s.trim();if(!i)continue;const u=i.match(FS);if(!u)break;const h=(r=u[1])==null?void 0:r.trim(),p=(a=u[2])==null?void 0:a.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");h&&p&&o.push({label:h,path:p})}return o}function qS(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 o=n.at(-1);if(!o||typeof o.index!="number")return e.trim();const r=o.index+o[0].length;return e.slice(r).trim()}function ey(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function zS(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 HS(e){return e.replace(/&lt;/giu,"<").replace(/&gt;/giu,">").replace(/&amp;/giu,"&")}function Ad(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?HS(n[1].trim()):""}function WS(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=Ad(t,"current_time_iso"),o=Ad(t,"instructions");return!n||!o?null:{automationId:Ad(t,"automation_id"),currentTimeIso:n,instructions:o}}function VS(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],o=[],r=[],a=[];for(const[h,p]of t.entries()){if(p.type==="text"&&typeof p.text=="string"&&p.text.length>0&&n.push(p.text),p.type==="image"&&typeof p.url=="string"&&p.url.trim().length>0&&o.push(p.url.trim()),p.type==="localImage"&&typeof p.path=="string"&&p.path.trim().length>0&&o.push(ey(p.path.trim())),p.type==="skill"){const g=typeof p.name=="string"?p.name.trim():"",w=typeof p.path=="string"?p.path.trim():"";g&&w&&r.push({name:g,path:w})}p.type!=="text"&&p.type!=="image"&&p.type!=="localImage"&&p.type!=="skill"&&a.push({id:`${e}:user-content:${h}`,role:"user",text:"",messageType:`userContent.${p.type}`,rawPayload:OS(p),isUnhandled:!0})}const s=n.join(`
29
+ `),i=US(s),u=WS(s);return{text:(u==null?void 0:u.instructions)??qS(s),images:o,skills:r,fileAttachments:i,rawBlocks:a,isAutomationRun:u!==null,automationDisplayName:(u==null?void 0:u.automationId)||null}}function GS(e){var a;const t=e.replace(/\r\n/g,`
30
+ `).trim();if(!t)return null;const n=t.split(`
31
+ `),o=[],r=[];for(const s of n){const i=s.trim();if(!i){o.length===0&&r.push("");continue}const u=i.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(u){const h=(u[1]??" ").toLowerCase(),p=(a=u[2])==null?void 0:a.trim();if(!p)continue;let g="pending";h==="x"&&(g="completed"),(h==="~"||h===">"||h==="-")&&(g="inProgress"),o.push({step:p,status:g});continue}r.push(i)}return o.length===0?null:{explanation:r.join(`
32
+ `).trim()||void 0,steps:o}}function rm(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 KS(e){let t=0,n=0;for(const o of e.replace(/\r\n/g,`
36
+ `).split(`
37
+ `))if(o&&!(o.startsWith("+++")||o.startsWith("---")||o.startsWith("@@"))){if(o.startsWith("+")){t+=1;continue}o.startsWith("-")&&(n+=1)}return{addedLineCount:t,removedLineCount:n}}function ty(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function uf(e){const t=Array.isArray(e)?e:[],n=[];for(const o of t){const r=o,a=typeof r.path=="string"?r.path:"",s=typeof r.diff=="string"?r.diff:"",i=r.kind,u=i==null?void 0:i.type;if(!a||u!=="add"&&u!=="delete"&&u!=="update")continue;const h=u==="update"&&typeof(i==null?void 0:i.move_path)=="string"?i.move_path:null,p=u==="update"?KS(s):u==="add"?{addedLineCount:rm(s),removedLineCount:0}:{addedLineCount:0,removedLineCount:rm(s)};n.push({path:a,operation:u,movedToPath:h,diff:s,...p})}return n}function YS(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=VS(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0||t.skills.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,messageType:e.type,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:[ey(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?zS(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"):[],o=Array.isArray(t.content)?t.content.filter(i=>typeof i=="string"):[],r=n.join(`
38
+ `).trim(),s=o.join(`
39
+ `).trim()||r;return s?[{id:e.id,role:"assistant",text:s,messageType:"reasoning",reasoning:{summary:n,content:o}}]:[]}if(e.type==="mcpToolCall"){const t=e,n=typeof t.server=="string"?t.server:"",o=typeof t.tool=="string"?t.tool:"";if(!n&&!o)return[];const r=t.status;let a="completed";const s=typeof r=="string"?r:r==null?void 0:r.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??""):"",u=typeof t.durationMs=="number"?t.durationMs:null;return[{id:e.id,role:"system",text:o,messageType:"toolCall",toolCall:{server:n,tool:o,status:a,error:i,durationMs:u}}]}if(e.type==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:GS(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=JS(t.status),o=typeof t.command=="string"?t.command:"",r=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:o,messageType:"commandExecution",commandExecution:{command:o,cwd:r,status:n,aggregatedOutput:a,exitCode:s}}]}if(e.type==="fileChange"){const t=uf(e.changes),n=ty(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 JS(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function QS(e){const t=e,n=[t.name,t.title,e.preview];for(const o of n)if(typeof o=="string"&&o.trim().length>0)return o.trim();return""}function XS(e){const t=QS(e);return t.length>0?t:"Untitled thread"}function Vf(e){return(e==null?void 0:e.status)==="inProgress"}function Gf(e){const n=e.externalSession;if(!n||typeof n!="object"||Array.isArray(n))return null;const o=n,r=typeof o.origin=="string"&&o.origin.trim().length>0?o.origin.trim():"";return r?{origin:r,active:o.active===!0,lastWriteAt:typeof o.lastWriteAt=="string"?o.lastWriteAt:null}:null}function ZS(e){var t;return((t=Gf(e))==null?void 0:t.active)===!0}function ny(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 r=(Array.isArray(e.turns)?e.turns:[]).at(-1);return Vf(r)||ZS(e)}function oy(e){const t=e,n=nt(typeof t.cwd=="string"?t.cwd:e.cwd),o=NS(n),r=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||o.includes("/.codex/worktrees/")||o.includes("/.git/worktrees/");return{id:e.id,title:XS(e),projectName:Wr(n),cwd:n,hasWorktree:r,createdAtIso:om(e.createdAt),updatedAtIso:om(e.updatedAt),preview:e.preview,unread:!1,inProgress:ny(e),externalSession:Gf(e)}}function e_(e){return oy(e.thread)}function t_(e){const t=new Map;for(const n of e){const o=t.get(n.projectName);o?o.push(n):t.set(n.projectName,[n])}return Array.from(t.entries()).map(([n,o])=>({projectName:n,threads:o.sort((r,a)=>new Date(a.updatedAtIso).getTime()-new Date(r.updatedAtIso).getTime())})).sort((n,o)=>{var s,i;const r=new Date(((s=n.threads[0])==null?void 0:s.updatedAtIso)??0).getTime();return new Date(((i=o.threads[0])==null?void 0:i.updatedAtIso)??0).getTime()-r})}function n_(e){const t=e.data.map(oy);return t_(t)}function Tc(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],o=[];for(let r=0;r<n.length;r++){const a=t+r,s=n[r],i=typeof(s==null?void 0:s.id)=="string"?s.id.trim():"",u=i.length>0?i:void 0,h=Array.isArray(s.items)?s.items:[],p=[];for(const w of h)for(const A of YS(w))p.push({...A,turnId:u,turnIndex:a});const g=DS(s);if(s.status==="failed"&&g){const w=u??`turn-${a}`;p.push({id:`${w}-error`,role:"system",text:g,messageType:"turnError",turnId:u,turnIndex:a})}o.push(...p)}return r_(o_(o))}function o_(e){var n;let t=-1;for(let o=e.length-1;o>=0;o-=1)if(((n=e[o])==null?void 0:n.messageType)==="compaction.done"){t=o;break}return t<0?e:e.filter((o,r)=>o.messageType!=="compaction.done"||r===t)}function r_(e){var s,i,u;let t=-1;for(let h=0;h<e.length;h+=1)if(((s=e[h])==null?void 0:s.messageType)==="compaction.done"){t=h;break}if(t<0)return e;const n=e[t],o=n.turnIndex;let r=-1;for(let h=0;h<e.length;h+=1)if(((i=e[h])==null?void 0:i.turnIndex)===o&&((u=e[h])==null?void 0:u.role)==="user"){r=h;break}if(r<0||t<=r)return e;const a=e.filter((h,p)=>p!==t);return a.splice(r+1,0,n),a}function Kf(e){if(ny(e.thread))return!0;const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Vf(t.at(-1))}function ry(e){return Gf(e.thread)}function Yf(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];for(let n=t.length-1;n>=0;n-=1){const o=t[n];if(Vf(o)&&typeof o.id=="string"&&o.id.trim().length>0)return o.id.trim()}return""}const a_=50,s_=3e4,Yi=new Map,i_=5e3;function Id(e){return e&&e.length>0?e:null}function Pd(e){return e&&e.length>0?e:null}function l_(e){return vl(e)?e:""}function c_(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}function Jf(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],o={};for(let r=0;r<n.length;r+=1){const a=t+r,s=n[r];typeof(s==null?void 0:s.id)!="string"||s.id.length===0||(o[s.id]=a)}return o}function Du(e){const t=Je(e),n=t==null?void 0:t.threadTurnStartIndex;return Math.max(0,Math.floor(typeof n=="number"?n:0))}function df(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const o=n.id;if(typeof o=="string"&&o.length>0)return o}return""}function u_(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const o=n.cwd;if(typeof o=="string"&&o.length>0)return o}return""}function fc(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}function Fu(e){var r,a;const t=Je(e);if(!t)return"";const n=((r=ae(t.modelProvider))==null?void 0:r.trim())??"";if(n)return n;const o=Je(t.thread);return((a=ae(o==null?void 0:o.modelProvider))==null?void 0:a.trim())??""}function am(e){var t;if(!e)return null;try{const n=new URL(e,"http://localhost");if(n.pathname!=="/codex-local-image")return null;const o=((t=n.searchParams.get("path"))==null?void 0:t.trim())??"";return o.length>0?o:null}catch{return null}}function d_(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
40
+ `;for(const o of t)n+=`
41
+ ## ${o.label}: ${o.path}
42
+ `;return`${n}
43
+ ## My request for Codex:
44
+
45
+ ${e}
46
+ `}function f_(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function p_(e){try{const t=(e==null?void 0:e.trim())??"",n=t?`/codex-api/provider-models?provider=${encodeURIComponent(t)}`:"/codex-api/provider-models",o=await fetch(n,{signal:AbortSignal.timeout(i_)});let r=null;try{r=await o.json()}catch{r=null}if(o.ok&&Array.isArray(r==null?void 0:r.data))return{ids:r.data.map(a=>typeof a=="string"?a.trim():"").filter((a,s,i)=>a.length>0&&i.indexOf(a)===s),exclusive:r.exclusive===!0}}catch{}return null}function h_(e){var s;const t=Je(e);if(!t)return null;const n=((s=ae(t.id??t.model))==null?void 0:s.trim())??"";if(!n)return null;const o=t.supportedReasoningEfforts??t.supported_reasoning_efforts,r=Array.isArray(o)?o.flatMap(i=>{const u=Je(i),h=u?u.reasoningEffort??u.reasoning_effort??u.effort:i;return vl(h)?[h]:[]}).filter((i,u,h)=>h.indexOf(i)===u):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:r,defaultReasoningEffort:vl(a)?a:null}}function sm(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function m_(e={}){const t=e.includeProviderModels!==!1,n=t?await p_(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(sm);const o=await ut("model/list",{}),r=[];for(const a of o.data){const s=h_(a);!s||r.some(i=>i.id===s.id)||r.push(s)}if(!t||!n)return r;for(const a of n.ids)r.some(s=>s.id===a)||r.push(sm(a));return r}async function v_(e={}){return(await m_(e)).map(t=>t.id)}async function g_(){const e=await ut("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",o=l_(e.config.model_reasoning_effort),r=c_(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:o,speedMode:r}}async function y_(e,t,n){var u;const o=(t==null?void 0:t.trim())??"";if(o)return{model:o,reasoningEffort:e==="plan"?Id(n):Pd(n)};let r=null;try{r=await g_()}catch{r=null}const a=(r==null?void 0:r.model.trim())??"";if(a)return{model:a,reasoningEffort:e==="plan"?Id(n??(r==null?void 0:r.reasoningEffort)):Pd(n??(r==null?void 0:r.reasoningEffort))};let s=[];try{s=await v_()}catch{s=[]}const i=((u=s.find(h=>h.trim().length>0))==null?void 0:u.trim())??"";if(i)return{model:i,reasoningEffort:e==="plan"?Id(n??(r==null?void 0:r.reasoningEffort)):Pd(n??(r==null?void 0:r.reasoningEffort))};throw new Error(`${e==="plan"?"Plan":"Default"} mode requires an available model. Wait for models to load and try again.`)}async function w_(e,t){const n=await ut("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:n_(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function b_(e){const t=await ut("thread/read",{threadId:e,includeTurns:!1});return e_(t)}async function T_(e){const t=await ut("thread/read",{threadId:e,includeTurns:!0}),n=Du(t),o=Tc(t,n);return{model:fc(t),modelProvider:Fu(t),messages:o,inProgress:Kf(t),activeTurnId:Yf(t),hasMoreOlder:n>0,turnIndexByTurnId:Jf(t,n),externalSession:ry(t)}}async function k_(e,t,n=10){const o=new URLSearchParams({threadId:e,beforeTurnId:t,limit:String(n)}),r=await fetch(`/codex-api/thread-turn-page?${o.toString()}`);if(!r.ok)throw new Error(`Older thread page request failed with ${r.status}`);const a=await r.json();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:Tc(a.result,s),inProgress:Kf(a.result),activeTurnId:Yf(a.result),hasMoreOlder:a.hasMoreOlder===!0,startTurnIndex:s,turnIndexByTurnId:Jf(a.result,s)}}async function im(e=null,t=a_){try{return await w_(e,t)}catch(n){throw va(n,"Failed to load thread groups","thread/list")}}async function C_(e){try{return await b_(e)}catch(t){throw va(t,`Failed to load thread ${e}`,"thread/read")}}async function Rd(e){try{return await T_(e)}catch(t){throw va(t,`Failed to load thread ${e}`,"thread/read")}}async function S_(e,t,n){try{return await k_(e,t,n)}catch(o){throw va(o,`Failed to load earlier messages for thread ${e}`,"thread/read")}}async function Ed(e){const t=Yi.get(e);if(t)return t;const n=(async()=>{const r=await ut("thread/resume",{threadId:e}),a=Du(r),s=Tc(r,a);return{model:fc(r),modelProvider:Fu(r),messages:s,inProgress:Kf(r),activeTurnId:Yf(r),hasMoreOlder:a>0,turnIndexByTurnId:Jf(r,a),externalSession:ry(r)}})();Yi.set(e,n);const o=globalThis.setTimeout(()=>{Yi.get(e)===n&&Yi.delete(e)},s_);return n.finally(()=>{globalThis.clearTimeout(o),globalThis.setTimeout(()=>{Yi.get(e)===n&&Yi.delete(e)},2e3)}).catch(()=>{}),n}async function __(e){await ut("thread/archive",{threadId:e})}async function x_(e){await ut("thread/unarchive",{threadId:e})}async function A_(e){await ut("thread/compact/start",{threadId:e})}async function I_(e,t){await ut("thread/name/set",{threadId:e,name:t})}async function Md(e,t){const n=await ut("thread/rollback",{threadId:e,numTurns:t});return Tc(n,Du(n))}async function lm(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 o=await ut("thread/start",n),r=df(o);if(!r)throw new Error("thread/start did not return a thread id");return{threadId:r,model:fc(o),modelProvider:Fu(o)}}catch(n){throw va(n,"Failed to start a new thread","thread/start")}}async function cm(e,t,n){if(arguments.length<=1)try{const o=await ut("thread/fork",{threadId:e,persistExtendedHistory:!0}),r=df(o);if(!r)throw new Error("thread/fork did not return a thread id");return{threadId:r,cwd:u_(o),model:fc(o),messages:Tc(o,Du(o))}}catch(o){throw va(o,`Failed to fork thread ${e}`,"thread/fork")}try{const o=e.trim();if(!o)throw new Error("thread/fork requires threadId");const r={threadId:o};typeof t=="string"&&t.trim().length>0&&(r.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(r.model=n.trim());const a=await ut("thread/fork",r),s=df(a);if(!s)throw new Error("thread/fork did not return a thread id");return{threadId:s,model:fc(a),modelProvider:Fu(a)}}catch(o){throw va(o,`Failed to fork thread ${e}`,"thread/fork")}}async function $d(e,t,n=[],o,r,a,s=[],i){var u;try{const h=(o==null?void 0:o.trim())??"",p=[];for(const F of n){const H=am(F.trim());H&&p.push({label:f_(H),path:H,fsPath:H})}const g=[...s,...p],w=g.filter((F,H)=>g.findIndex(q=>q.fsPath===F.fsPath)===H),M=[{type:"text",text:d_(t,w)}];for(const F of n){const H=F.trim();if(!H)continue;const q=am(H);if(q){M.push({type:"localImage",path:q});continue}M.push({type:"image",url:H,image_url:H})}if(a)for(const F of a)M.push({type:"skill",name:F.name,path:F.path});const U=w.map(F=>({label:F.label,path:F.path,fsPath:F.fsPath})),Y={threadId:e,input:M};if(U.length>0&&(Y.attachments=U),h&&(Y.model=h),typeof r=="string"&&r.length>0&&(Y.effort=r),i){const F=await y_(i,h,r);Y.collaborationMode={mode:i,settings:{model:F.model,reasoning_effort:F.reasoningEffort,developer_instructions:null}}}const ue=await ut("turn/start",Y);return typeof((u=ue==null?void 0:ue.turn)==null?void 0:u.id)=="string"?ue.turn.id.trim():""}catch(h){throw va(h,`Failed to start turn for thread ${e}`,"turn/start")}}async function P_(e,t){const n=e.trim(),o=(t==null?void 0:t.trim())||"";if(n)try{if(!o)throw new Error("turn/interrupt requires turnId");await ut("turn/interrupt",{threadId:n,turnId:o})}catch(r){throw va(r,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}const R_=5e3,um=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function E_(e){return vl(e)?e:""}function M_(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}async function $_(e){const t=e==="fast"?"fast":"standard";await ut("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 dm(){return await(await fetch("/codex-api/free-mode/status")).json()}async function fm(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function pm(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 Ji(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 j_(e){try{const t=(e==null?void 0:e.trim())??"",n=t?`/codex-api/provider-models?provider=${encodeURIComponent(t)}`:"/codex-api/provider-models",o=await fetch(n,{signal:AbortSignal.timeout(R_)});let r=null;try{r=await o.json()}catch{r=null}if(o.ok&&Array.isArray(r==null?void 0:r.data))return{ids:r.data.map(a=>typeof a=="string"?a.trim():"").filter((a,s,i)=>a.length>0&&i.indexOf(a)===s),exclusive:r.exclusive===!0}}catch{}return null}function L_(e){var s;const t=Je(e);if(!t)return null;const n=((s=ae(t.id??t.model))==null?void 0:s.trim())??"";if(!n)return null;const o=t.supportedReasoningEfforts??t.supported_reasoning_efforts,r=Array.isArray(o)?o.flatMap(i=>{const u=Je(i),h=u?u.reasoningEffort??u.reasoning_effort??u.effort:i;return vl(h)?[h]:[]}).filter((i,u,h)=>h.indexOf(i)===u):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:r,defaultReasoningEffort:vl(a)?a:null}}function hm(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function N_(e={}){const t=e.includeProviderModels!==!1,n=t?await j_(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(hm);const o=await ut("model/list",{}),r=[];for(const a of o.data){const s=L_(a);!s||r.some(i=>i.id===s.id)||r.push(s)}if(!t||!n)return r;for(const a of n.ids)r.some(s=>s.id===a)||r.push(hm(a));return r}async function O_(){const e=await ut("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",o=E_(e.config.model_reasoning_effort),r=M_(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:o,speedMode:r}}function D_(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function F_(){try{const e=await ut("collaborationMode/list",{}),t=new Set,n=[];for(const o of e.data){const r=o.mode;r!=="default"&&r!=="plan"&&r!=="execplans"||t.has(r)||(t.add(r),n.push({value:r,label:D_(o.name||r)||(r==="plan"?"Plan":"Default")}))}if(n.length>0){for(const o of um)t.has(o.value)||n.push(o);return n.sort((o,r)=>o.value===r.value?0:o.value==="default"?-1:1)}}catch{}return um}async function B_(){return vS()}function U_(e){const t=Je(e);if(!t)return null;const n=ae(t.event??t.name??t.hookName),o=ae(t.command??t.cmd);return!n||!o?null:{event:n,command:o,timeout:ln(t.timeout??t.timeout_ms),enabled:Co(t.enabled??t.active)}}async function q_(){const e=await ut("hooks/list",{}),t=[];for(const n of e.data??[]){const o=Je(n);o&&t.push({cwd:ae(o.cwd)??"",hooks:Array.isArray(o.hooks)?o.hooks.map(U_).filter(r=>r!==null):[],warnings:la(o.warnings),errors:la(o.errors)})}return t}async function D4(e){await ut("marketplace/add",{source:e})}async function F4(e){await ut("marketplace/remove",{marketplaceName:e})}async function B4(){const e=await ut("marketplace/upgrade",{});return{selectedMarketplaces:la(e.selectedMarketplaces??e.selected_marketplaces),upgradedRoots:la(e.upgradedRoots??e.upgraded_roots),errors:la(e.errors)}}function z_(e){const t=Je(e);if(!t)return null;const n=ae(t.remotePluginId??t.remote_plugin_id??t.id);return n?{remotePluginId:n,pluginName:ae(t.pluginName??t.plugin_name??t.name)??n,shareUrl:ae(t.shareUrl??t.share_url??t.url)??"",createdAt:ae(t.createdAt??t.created_at)??""}:null}async function U4(e){const t=await ut("plugin/share/save",{pluginPath:e});return{remotePluginId:ae(t.remotePluginId??t.remote_plugin_id)??"",shareUrl:ae(t.shareUrl??t.share_url??t.url)??""}}async function q4(){const e=await ut("plugin/share/list",{});return(e.data??e.shares??[]).map(z_).filter(n=>n!==null)}async function z4(e){await ut("plugin/share/delete",{remotePluginId:e})}async function H4(e){await ut("plugin/share/checkout",{remotePluginId:e})}function ay(e){const t=Je(e);if(!t)return null;const n=ae(t.id),o=ae(t.name);return!n||!o?null:{id:n,name:o,description:ae(t.description)??"",installUrl:ae(t.installUrl??t.install_url)??"",needsAuth:Co(t.needsAuth??t.needs_auth)??!1}}function H_(e){const t=Je(e);if(!t)return null;const n=ae(t.name),o=ae(t.path);if(!n||!o)return null;const r=Je(t.interface);return{name:n,path:o,description:ae(t.description)??"",enabled:Co(t.enabled)??!0,displayName:ae((r==null?void 0:r.displayName)??(r==null?void 0:r.display_name))??n,shortDescription:ae(t.shortDescription??t.short_description)??""}}function sy(e,t={}){const n=Je(e);if(!n)return null;const o=ae(n.id),r=ae(n.name);if(!o||!r)return null;const a=Je(n.interface),s=Je(n.source),i=ae(s==null?void 0:s.type)??"",u=ae(s==null?void 0:s.path),h=ae(s==null?void 0:s.url)??"",p=i==="remote"?t.name??null:null,g=t.path??(i==="local"?u:null),w=ae((a==null?void 0:a.displayName)??(a==null?void 0:a.display_name))??r,A=ae((a==null?void 0:a.shortDescription)??(a==null?void 0:a.short_description)),M=ae((a==null?void 0:a.longDescription)??(a==null?void 0:a.long_description))??"";return{id:o,name:r,displayName:w,description:A??M,longDescription:M,developerName:ae((a==null?void 0:a.developerName)??(a==null?void 0:a.developer_name))??"",category:ae(a==null?void 0:a.category)??"",marketplaceName:t.name??"",marketplaceDisplayName:t.displayName??t.name??"",marketplacePath:g,remoteMarketplaceName:p,sourceType:i,sourceUrl:h,installed:Co(n.installed)??!1,enabled:Co(n.enabled)??!0,installPolicy:ae(n.installPolicy??n.install_policy)??"",authPolicy:ae(n.authPolicy??n.auth_policy)??"",logoUrl:ae((a==null?void 0:a.logoUrl)??(a==null?void 0:a.logo_url))??"",logoPath:ae(a==null?void 0:a.logo)??"",composerIconUrl:ae((a==null?void 0:a.composerIconUrl)??(a==null?void 0:a.composer_icon_url))??"",composerIconPath:ae((a==null?void 0:a.composerIcon)??(a==null?void 0:a.composer_icon))??"",brandColor:ae((a==null?void 0:a.brandColor)??(a==null?void 0:a.brand_color))??"",capabilities:la(a==null?void 0:a.capabilities),defaultPrompt:la((a==null?void 0:a.defaultPrompt)??(a==null?void 0:a.default_prompt)),screenshotUrls:la((a==null?void 0:a.screenshotUrls)??(a==null?void 0:a.screenshot_urls)),screenshots:la(a==null?void 0:a.screenshots),websiteUrl:ae((a==null?void 0:a.websiteUrl)??(a==null?void 0:a.website_url))??"",privacyPolicyUrl:ae((a==null?void 0:a.privacyPolicyUrl)??(a==null?void 0:a.privacy_policy_url))??"",termsOfServiceUrl:ae((a==null?void 0:a.termsOfServiceUrl)??(a==null?void 0:a.terms_of_service_url))??""}}function W_(e,t=0){const n=Je(e);if(!n)return null;const o=ae(n.id),r=ae(n.name);if(!o||!r)return null;const a=Je(n.branding),s=Je(n.appMetadata??n.app_metadata);return{id:o,name:r,description:ae(n.description)??ae((s==null?void 0:s.seoDescription)??(s==null?void 0:s.seo_description))??"",logoUrl:ae(n.logoUrl??n.logo_url)??"",logoUrlDark:ae(n.logoUrlDark??n.logo_url_dark)??"",distributionChannel:ae(n.distributionChannel??n.distribution_channel)??"",installUrl:ae(n.installUrl??n.install_url)??"",isAccessible:Co(n.isAccessible??n.is_accessible)??!1,isEnabled:Co(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:la(n.pluginDisplayNames??n.plugin_display_names),category:ae(a==null?void 0:a.category)??"",developer:ae(a==null?void 0:a.developer)??ae(s==null?void 0:s.developer)??"",website:ae(a==null?void 0:a.website)??"",privacyPolicy:ae((a==null?void 0:a.privacyPolicy)??(a==null?void 0:a.privacy_policy))??"",termsOfService:ae((a==null?void 0:a.termsOfService)??(a==null?void 0:a.terms_of_service))??"",catalogRank:t}}function V_(e){const t=Je(e);if(!t)return null;const n=ae(t.name);if(!n)return null;const o=Je(t.tools)??{},r=Object.entries(o).map(([u,h])=>{const p=Je(h);return{name:ae(p==null?void 0:p.name)??u,title:ae(p==null?void 0:p.title)??"",description:ae(p==null?void 0:p.description)??""}}),a=Array.isArray(t.resources)?t.resources.map(u=>{const h=Je(u);return{name:ae(h==null?void 0:h.name)??"",title:ae(h==null?void 0:h.title)??"",uri:ae(h==null?void 0:h.uri)??"",description:ae(h==null?void 0:h.description)??""}}).filter(u=>u.name||u.uri):[],s=t.resourceTemplates??t.resource_templates,i=Array.isArray(s)?s.map(u=>{const h=Je(u);return{name:ae(h==null?void 0:h.name)??"",title:ae(h==null?void 0:h.title)??"",uriTemplate:ae((h==null?void 0:h.uriTemplate)??(h==null?void 0:h.uri_template))??"",description:ae(h==null?void 0:h.description)??""}}).filter(u=>u.name||u.uriTemplate):[];return{name:n,authStatus:ae(t.authStatus??t.auth_status)??"unsupported",tools:r,resources:a,resourceTemplates:i}}async function W4(e){const t={};e&&e.length>0&&(t.cwds=e);const n=await ut("plugin/list",t),o=[];for(const r of n.marketplaces??[]){const a=Je(r);if(!a)continue;const s=Je(a.interface),i={name:ae(a.name)??"",displayName:ae((s==null?void 0:s.displayName)??(s==null?void 0:s.display_name))??"",path:ae(a.path)},u=Array.isArray(a.plugins)?a.plugins:[];for(const h of u){const p=sy(h,i);p&&o.push(p)}}return o}async function V4(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await ut("plugin/read",t),o=Je(n.plugin);if(!o)throw new Error("Plugin detail response is empty");const r=sy(o.summary,{name:ae(o.marketplaceName)??e.marketplaceName,displayName:e.marketplaceDisplayName,path:ae(o.marketplacePath)??e.marketplacePath})??e;return{summary:r,description:ae(o.description)??r.longDescription,apps:Array.isArray(o.apps)?o.apps.map(ay).filter(a=>a!==null):[],skills:Array.isArray(o.skills)?o.skills.map(H_).filter(a=>a!==null):[],mcpServers:la(o.mcpServers??o.mcp_servers)}}async function G4(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await ut("plugin/install",t),o=n.appsNeedingAuth??n.apps_needing_auth??[];return{authPolicy:ae(n.authPolicy??n.auth_policy)??"",appsNeedingAuth:o.map(ay).filter(r=>r!==null)}}async function K4(e){await ut("plugin/uninstall",{pluginId:e})}async function Y4(e,t){await ut("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function J4(e){const t=[];let n=null,o=0;do{const r={limit:100};n&&(r.cursor=n),e&&(r.threadId=e);const a=await ut("app/list",r);for(const s of a.data??[]){const i=W_(s,o);i&&t.push(i),o+=1}n=ae(a.nextCursor??a.next_cursor)}while(n);return t}async function Q4(e,t){await ut("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function X4(){const e=[];let t=null;do{const n={};t&&(n.cursor=t);const o=await ut("mcpServerStatus/list",n);for(const r of o.data??[]){const a=V_(r);a&&e.push(a)}t=ae(o.nextCursor??o.next_cursor)}while(t);return e}async function Z4(){await ut("config/mcpServer/reload",{})}async function e3(e){const t=await ut("mcpServer/oauth/login",{name:e});return{authorizationUrl:ae(t.authorizationUrl??t.authorization_url)??""}}async function t3(){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 n3(e="",t=null,n=50){const o=new URLSearchParams;e.trim()&&o.set("query",e.trim()),t&&o.set("cursor",t),n&&Number.isFinite(n)&&o.set("limit",String(Math.max(1,Math.floor(n))));const r=o.toString(),a=await fetch(`/codex-api/composio/connectors${r?`?${r}`:""}`);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 o3(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 r3(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 a3(){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 s3(){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 mm(e){const t=Je(e);if(!t)return null;const n=ln(t.usedPercent??t.used_percent);if(n===null)return null;const o=ln(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:o,windowMinutes:o,resetsAt:ln(t.resetsAt??t.resets_at)}}function G_(e){const t=Je(e);if(!t)return null;const n=Co(t.hasCredits??t.has_credits),o=Co(t.unlimited);return n===null||o===null?null:{hasCredits:n,unlimited:o,balance:ae(t.balance)}}function vm(e){const t=Je(e);if(!t)return null;const n=mm(t.primary),o=mm(t.secondary),r=G_(t.credits);return!n&&!o&&!r?null:{limitId:ae(t.limitId??t.limit_id),limitName:ae(t.limitName??t.limit_name),primary:n,secondary:o,credits:r,planType:ae(t.planType??t.plan_type)}}function iy(e){const t=Je(e);if(!t)return null;const n=Je(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),o=vm(n==null?void 0:n.codex);return o||vm(t.rateLimits??t.rate_limits)}const K_=100;function Y_(){return K_}function J_(e){return yS(e)}async function Q_(e,t){await wS({id:e,...t})}async function gm(){return bS()}function X_(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 o=Array.isArray(t.imageUrls)?t.imageUrls.filter(s=>typeof s=="string"&&s.trim().length>0):[],r=Array.isArray(t.skills)?t.skills.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const i=s,u=typeof i.name=="string"?i.name.trim():"",h=typeof i.path=="string"?i.path.trim():"";return u&&h?[{name:u,path:h}]:[]}):[],a=Array.isArray(t.fileAttachments)?t.fileAttachments.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const i=s,u=typeof i.label=="string"?i.label.trim():"",h=typeof i.path=="string"?i.path.trim():"",p=typeof i.fsPath=="string"?i.fsPath.trim():"";return u&&h&&p?[{label:u,path:h,fsPath:p}]:[]}):[];return{id:n,text:typeof t.text=="string"?t.text:"",imageUrls:o,skills:r,fileAttachments:a,collaborationMode:t.collaborationMode==="plan"?"plan":"default"}}function ly(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,o]of Object.entries(e)){const r=n.trim();if(!r||!Array.isArray(o))continue;const a=o.flatMap(s=>{const i=X_(s);return i?[i]:[]});a.length>0&&(t[r]=a)}return t}async function ym(){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 ly(n.data)}async function Z_(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(ly(e))})).ok)throw new Error("Failed to save thread queue state")}async function ex(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})}),o=await n.json();if(!n.ok){const r=pn(o,"Failed to connect Telegram bot");throw new Error(r)}}async function tx(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const s=pn(t,"Failed to load Telegram configuration");throw new Error(s)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},o=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{},r=Array.isArray(o.allowedUserIds)?o.allowedUserIds:[],a=[];for(const s of r){if(s==="*"){a.push("*");continue}typeof s=="number"&&Number.isFinite(s)&&a.push(Math.trunc(s))}return{botToken:typeof o.botToken=="string"?o.botToken:"",allowedUserIds:a}}async function nx(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const r=pn(t,"Failed to load Telegram status");throw new Error(r)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},o=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return{configured:o.configured===!0,active:o.active===!0,mappedChats:typeof o.mappedChats=="number"?o.mappedChats:0,mappedThreads:typeof o.mappedThreads=="number"?o.mappedThreads:0,allowedUsers:typeof o.allowedUsers=="number"?o.allowedUsers:0,allowAllUsers:o.allowAllUsers===!0,lastError:typeof o.lastError=="string"?o.lastError:""}}async function ox(){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 Bc(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 rx(){try{const e=await fetch("/codex-api/thread-reasoning");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function ax(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 sx(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function ix(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function lx(){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 cx(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 ux(e,t){var n;try{return((n=(await ut("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}function ff(e){return e?e.endsWith("/SKILL.md")?e:`${e}/SKILL.md`:""}function dx(e,t){const n=ff(e),o=n.split("/").filter(Boolean);if(o.length<2)return null;const r=o.lastIndexOf("skills");if(r>=2){const u=o[r-2]??"";if(u){const h=`/${[...o.slice(0,r+1),u,"SKILL.md"].join("/")}`;if(t.has(h))return{rootPath:h,rootName:u,isNested:h!==n}}}const a=o.indexOf("skills");if(a<0||a+1>=o.length-1)return null;const s=o[a+1]??"";if(!s)return null;const i=`/${[...o.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 fx(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await ut("skills/list",t),o=n.data.flatMap(s=>s.skills),r=new Set(o.map(s=>ff(s.path)).filter(Boolean)),a=new Map;for(const s of n.data)for(const i of s.skills){if(!i.name)continue;const u=dx(i.path,r),h=ff(i.path),g=!!(u!=null&&u.isNested&&r.has(u.rootPath))?u.rootPath:h,w=h===g,A=a.get(g),M={name:i.name,displayName:u&&g===u.rootPath?u.rootName:void 0,description:i.shortDescription||i.description||"",path:g,scope:i.scope,enabled:i.enabled,__hasRoot:w};if(!A){a.set(g,M);continue}if(A.enabled=A.enabled||i.enabled,!A.__hasRoot&&w){a.set(g,M);continue}!A.displayName&&M.displayName&&(A.displayName=M.displayName),!A.description&&M.description&&(A.description=M.description)}return Array.from(a.values()).map(({__hasRoot:s,...i})=>i)}catch{return[]}}const px=6e4;async function Uc(e){const t=new AbortController,n=setTimeout(()=>t.abort(),px);try{const o=new FormData;o.append("file",e);const r=await fetch("/codex-api/upload-file",{method:"POST",body:o,signal:t.signal});return r.ok?(await r.json()).path??null:null}catch{return null}finally{clearTimeout(n)}}function hx(e){return e==="payment_required"?e:null}function mx(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function wm(e){const t=Je(e);if(!t)return null;const n=ln(t.usedPercent??t.used_percent);if(n===null)return null;const o=ln(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:o,windowMinutes:o,resetsAt:ln(t.resetsAt??t.resets_at)}}function vx(e){const t=Je(e);if(!t)return null;const n=Co(t.hasCredits??t.has_credits),o=Co(t.unlimited);return n===null||o===null?null:{hasCredits:n,unlimited:o,balance:ae(t.balance)}}function gx(e){const t=Je(e);if(!t)return null;const n=wm(t.primary),o=wm(t.secondary),r=vx(t.credits);return!n&&!o&&!r?null:{limitId:ae(t.limitId??t.limit_id),limitName:ae(t.limitName??t.limit_name),primary:n,secondary:o,credits:r,planType:ae(t.planType??t.plan_type)}}function cy(e,t=null,n=null){const o=Je(e);if(!o)return null;const r=ae(o.accountId),a=ae(o.storageId)??r,s=ae(o.quotaStatus),i=s==="loading"||s==="ready"||s==="error"?s:"idle";return r?{accountId:r,storageId:a??r,userId:ae(o.userId),authMode:ae(o.authMode),email:ae(o.email),planType:ae(o.planType),lastRefreshedAtIso:ae(o.lastRefreshedAtIso)??"",lastActivatedAtIso:ae(o.lastActivatedAtIso),quotaSnapshot:gx(o.quotaSnapshot),quotaUpdatedAtIso:ae(o.quotaUpdatedAtIso),quotaStatus:i,quotaError:ae(o.quotaError),unavailableReason:hx(o.unavailableReason)??(mx(ae(o.quotaError))?"payment_required":null),isActive:Co(o.isActive)??(a===n||r===t)}:null}function uy(e){const t=Je(e);if(!t)return null;const n=ae(t.clientId??t.client_id??t.id);return n?{clientId:n,deviceName:ae(t.deviceName??t.device_name??t.name)??"",lastSeenAt:ae(t.lastSeenAt??t.last_seen_at??t.lastSeen)}:null}async function yx(){const e=await ut("remoteControl/status/read",{}),t=Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[];return{enabled:Co(e.enabled)??!1,clients:t.map(uy).filter(n=>n!==null)}}async function wx(){var o;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=ae((o=t.data)==null?void 0:o.policy)??"";return n==="untrusted"||n==="on-failure"||n==="on-request"||n==="never"?n:"never"}async function bx(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 Tx(e){await ut(e?"remoteControl/enable":"remoteControl/disable",{})}async function kx(){const e=await ut("remoteControl/pairing/start",{});return{pairingCode:ae(e.pairingCode??e.pairing_code??e.code)??"",expiresAt:ae(e.expiresAt??e.expires_at)}}async function Cx(){const e=await ut("remoteControl/client/list",{});return(Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[]).map(uy).filter(n=>n!==null)}async function Sx(e){await ut("remoteControl/client/revoke",{clientId:e})}async function _x(){try{const e=await ut("account/rateLimits/read");return iy(e)}catch(e){throw va(e,"Failed to load account rate limits","account/rateLimits/read")}}function Bu(e){const t=Je(e),n=ae(t==null?void 0:t.activeAccountId),o=ae(t==null?void 0:t.activeStorageId),r=Array.isArray(t==null?void 0:t.accounts)?t==null?void 0:t.accounts:[];return{activeAccountId:n,activeStorageId:o,importedAccountId:ae(t==null?void 0:t.importedAccountId)??void 0,importedStorageId:ae(t==null?void 0:t.importedStorageId)??void 0,accounts:r.map(a=>cy(a,n,o)).filter(a=>a!==null)}}async function xx(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(pn(t,"Failed to load accounts"));const n=Je(t);return Bu(n==null?void 0:n.data)}async function bm(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(pn(t,"Failed to refresh accounts"));const n=Je(t);return Bu(n==null?void 0:n.data)}async function Ax(){const e=await fetch("/codex-api/accounts/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(pn(t,"Failed to start Codex login"));const n=Je(t),o=Je(n==null?void 0:n.data),r=ae(o==null?void 0:o.loginUrl);if(!r)throw new Error("Failed to start Codex login");return r}async function Ix(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(pn(n,"Failed to complete Codex login"));const o=Je(n);return Bu(o==null?void 0:o.data)}async function Px(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(pn(n,"Failed to switch account"));const o=Je(n),r=Je(o==null?void 0:o.data),a=cy(r==null?void 0:r.account,ae(r==null?void 0:r.activeAccountId),ae(r==null?void 0:r.activeStorageId));if(!a)throw new Error("Failed to switch account");return a}async function Rx(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(pn(n,"Failed to remove account"));const o=Je(n);return Bu(o==null?void 0:o.data)}let qc=null,oc=null;function Ex(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},o=t.labels,r={};if(o&&typeof o=="object"&&!Array.isArray(o))for(const[a,s]of Object.entries(o)){const i=typeof a=="string"?nt(a):"";i.length>0&&typeof s=="string"&&(r[i]=s)}return{order:n(t.order).map(a=>nt(a)),labels:r,active:n(t.active).map(a=>nt(a)),projectOrder:n(t.projectOrder).map(a=>nt(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"?nt(s.remotePath):"",label:typeof s.label=="string"?s.label.trim():""}]:[]}):[]}}async function el(){return oc?pf(oc):(qc||(qc=Mx().then(e=>(oc=e,e)).finally(()=>{qc=null})),pf(await qc))}async function Mx(){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 Ex(n.data)}function pf(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 Qf(){oc=null}async function $x(e,t){const n=(t??"").trim(),o=await fetch("/codex-api/worktree/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,baseBranch:n||void 0})}),r=await o.json();if(!o.ok||!r.data)throw new Error(r.error||"Failed to create worktree");return{...r.data,cwd:nt(r.data.cwd),gitRoot:nt(r.data.gitRoot)}}async function jx(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})}),o=await n.json();if(!n.ok||!o.data)throw new Error(o.error||"Failed to create worktree");return{...o.data,cwd:nt(o.data.cwd),gitRoot:nt(o.data.gitRoot)}}async function Lx(e){const t=e.trim();if(!t)return[];const n=new URLSearchParams({sourceCwd:t}),o=await fetch(`/codex-api/worktree/branches?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to load branches");const a=Array.isArray(r.data)?r.data:[],s=[],i=new Set;for(const u of a){if(!u||typeof u!="object"||Array.isArray(u))continue;const h=u,p=typeof h.value=="string"?h.value.trim():"",g=typeof h.label=="string"?h.label.trim():"";!p||i.has(p)||(i.add(p),s.push({value:p,label:g||p}))}return s}async function Nx(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}),o=await fetch(`/codex-api/git/branches?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to load Git branch state");const a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},s=a.currentBranch,i=typeof s=="string"&&s.trim()?s.trim():null,u=Array.isArray(a.options)?a.options:[],h=[],p=new Set;for(const Y of u){if(!Y||typeof Y!="object"||Array.isArray(Y))continue;const ue=Y,F=typeof ue.value=="string"?ue.value.trim():"",H=typeof ue.label=="string"?ue.label.trim():"";!F||p.has(F)||(p.add(F),h.push({value:F,label:H||F,isCurrent:ue.isCurrent===!0,isRemote:ue.isRemote===!0}))}i&&!p.has(i)&&h.unshift({value:i,label:i,isCurrent:!0});const g=a.headSha,w=a.headSubject,A=a.headDate,M=a.gitRoot,U=dy(a.changedFiles);return{currentBranch:i,headSha:typeof g=="string"&&g.trim()?g.trim():null,headSubject:typeof w=="string"&&w.trim()?w.trim():null,headDate:typeof A=="string"&&A.trim()?A.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof M=="string"?nt(M):"",options:h,changedFiles:U}}function dy(e){const t=Array.isArray(e)?e:[],n=[];for(const o of t){if(!o||typeof o!="object"||Array.isArray(o))continue;const r=o,a=r.path,s=typeof a=="string"?nt(a.trim()):"";if(!s)continue;const i=r.status,u=typeof i=="string"?i.trim():"",h=r.label,p=typeof h=="string"&&h.trim()?h.trim():u;n.push({path:s,previousPath:typeof r.previousPath=="string"&&r.previousPath.trim()?nt(r.previousPath.trim()):null,status:u,label:p,addedLineCount:typeof r.addedLineCount=="number"?r.addedLineCount:null,removedLineCount:typeof r.removedLineCount=="number"?r.removedLineCount:null})}return n}async function Ox(e){const t=e.trim();if(!t)return{isGitRepo:!1,gitRoot:""};const n=new URLSearchParams({cwd:t}),o=await fetch(`/codex-api/git/repository-status?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to read Git repository status");const a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{isGitRepo:a.isGitRepo===!0,gitRoot:typeof a.gitRoot=="string"?nt(a.gitRoot):""}}async function Dx(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()})}),o=await n.json();if(!n.ok)throw new Error(o.error||"Failed to switch branch");const r=(a=o.data)==null?void 0:a.currentBranch;return typeof r=="string"&&r.trim()?r.trim():null}async function Fx(e,t,n={}){const o=e.trim(),r=t.trim();if(!o||!r)return[];const a=new URLSearchParams({cwd:o,branch:r,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(h=>{if(!h||typeof h!="object"||Array.isArray(h))return[];const p=h,g=typeof p.sha=="string"?p.sha.trim():"",w=typeof p.shortSha=="string"?p.shortSha.trim():"",A=typeof p.subject=="string"?p.subject.trim():"",M=typeof p.date=="string"?p.date.trim():"";return!g||!w?[]:[{sha:g,shortSha:w,subject:A||w,date:M}]})}async function Bx(e,t){const n=e.trim(),o=t.trim();if(!n||!o)return[];const r=new URLSearchParams({cwd:n,sha:o}),a=await fetch(`/codex-api/git/commit-files?${r.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(u=>{if(!u||typeof u!="object"||Array.isArray(u))return[];const h=u,p=typeof h.path=="string"?h.path:"",g=typeof h.previousPath=="string"&&h.previousPath.length>0?h.previousPath:null,w=typeof h.status=="string"?h.status.trim():"",A=typeof h.label=="string"?h.label.trim():"",M=typeof h.addedLineCount=="number"&&Number.isFinite(h.addedLineCount)?h.addedLineCount:null,U=typeof h.removedLineCount=="number"&&Number.isFinite(h.removedLineCount)?h.removedLineCount:null;return!p||!w?[]:[{path:p,previousPath:g,status:w,label:A||w,addedLineCount:M,removedLineCount:U}]})}async function Ux(e,t,n){const o=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()})}),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to reset branch to commit");const a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.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"?nt(a.gitRoot):"",options:[],changedFiles:dy(a.changedFiles)}}async function jd(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");oc=pf(e)}async function zc(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)??""})}),o=await n.json();if(!n.ok){const i=pn(o,"Failed to open project root");throw new Error(i)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},s=typeof a.path=="string"?nt(a.path):"";return Qf(),s}function qx(e){return`/codex-api/project-zip?${new URLSearchParams({cwd:e}).toString()}`}function zx(e,t){var a;const n=e.headers.get("content-disposition")??"",o=n.match(/filename\*=UTF-8''([^;]+)/iu);if(o!=null&&o[1])try{return decodeURIComponent(o[1])}catch{return o[1]}const r=n.match(/filename="?([^";]+)"?/iu);return((a=r==null?void 0:r[1])==null?void 0:a.trim())||t}async function Hx(e,t){var p;const n=await fetch(qx(e));if(!n.ok){const g=await n.json().catch(()=>null),w="Failed to export project",A=pn(g,w),M=[n.status?String(n.status):"",n.statusText].filter(Boolean).join(" "),U=A!==w?A:M?`Failed to export project: ${M}`:w;throw new Error(U)}const o=Number(n.headers.get("content-length")??""),r=Number.isFinite(o)&&o>0?o:null,a=zx(n,"project.zip"),s=(p=n.body)==null?void 0:p.getReader();if(!s){const g=await n.blob();return t==null||t({loaded:g.size,total:g.size||r}),{blob:g,fileName:a}}const i=[];let u=0;for(t==null||t({loaded:u,total:r});;){const{done:g,value:w}=await s.read();if(g)break;w&&(i.push(new Uint8Array(w)),u+=w.byteLength,t==null||t({loaded:u,total:r}))}const h=i.map(g=>{const w=new Uint8Array(g.byteLength);return w.set(g),w.buffer});return{blob:new Blob(h,{type:n.headers.get("content-type")??"application/zip"}),fileName:a}}async function Wx(e,t){const n=new URLSearchParams({parent:t}),o=await fetch(`/codex-api/project-import?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e}),r=await Oi(o);if(!o.ok){const u=pn(r,"Failed to import project");throw new Error(u)}const a=r&&typeof r=="object"&&!Array.isArray(r)?r:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=typeof s.path=="string"?nt(s.path):"";return i&&Qf(),{path:i,importedSessions:typeof s.importedSessions=="number"?s.importedSessions:0}}async function Tm(){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:{},o=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return typeof o.path=="string"?o.path.trim():""}async function Vx(e,t){const n=new URLSearchParams({path:e});(t==null?void 0:t.showHidden)===!0&&n.set("showHidden","1");const o=await fetch(`/codex-local-directories?${n.toString()}`),r=await Oi(o);if(!o.ok){const u=pn(r,"Failed to load local directories");throw new Error(u)}const a=r&&typeof r=="object"&&!Array.isArray(r)?r:{},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"?nt(s.path):"",parentPath:typeof s.parentPath=="string"?nt(s.parentPath):"",entries:i.flatMap(u=>{if(!u||typeof u!="object"||Array.isArray(u))return[];const h=u,p=typeof h.name=="string"?h.name.trim():"",g=typeof h.path=="string"?nt(h.path):"";return p&&g?[{name:p,path:g}]:[]})}}async function Gx(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-files?${t.toString()}`),o=await Oi(n);if(!n.ok){const i=pn(o,"Failed to load workspace files");throw new Error(i)}const a=(o&&typeof o=="object"&&!Array.isArray(o)?o:{}).data;return(Array.isArray(a)?a:[]).flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const u=i,h=typeof u.path=="string"?nt(u.path):"",p=typeof u.relativePath=="string"?u.relativePath.trim():"";return!h||!p?[]:[{path:h,relativePath:p,isDirectory:u.isDirectory===!0}]})}async function Kx(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-preview?${t.toString()}`),o=await Oi(n);if(!n.ok){const i=pn(o,"Failed to preview file");throw new Error(i)}const a=(o&&typeof o=="object"&&!Array.isArray(o)?o:{}).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 Yx(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await Oi(t);if(!t.ok){const s=pn(n,"Failed to create local directory");throw new Error(s)}const o=n&&typeof n=="object"&&!Array.isArray(n)?n:{},r=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},a=typeof r.path=="string"?nt(r.path):"";return a&&Qf(),a}async function Jx(e,t){const n=await fetch("/codex-api/github-clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e,basePath:t})}),o=await Oi(n);if(!n.ok){const s=pn(o,"Failed to clone GitHub repository");throw new Error(s)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return typeof a.path=="string"?nt(a.path):""}async function Qx(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 Oi(t);if(!t.ok){const s=pn(n,"Failed to create new chat folder");throw new Error(s)}const o=n&&typeof n=="object"&&!Array.isArray(n)?n:{},r=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},a=typeof r.cwd=="string"?nt(r.cwd):"";if(!a)throw new Error("Failed to create new chat folder");return{cwd:a,outputDirectory:typeof r.outputDirectory=="string"?nt(r.outputDirectory):a,workspaceRoot:typeof r.workspaceRoot=="string"?nt(r.workspaceRoot):""}}async function Xx(e){const t=new URLSearchParams({basePath:e}),n=await fetch(`/codex-api/project-root-suggestion?${t.toString()}`),o=await n.json();if(!n.ok){const s=pn(o,"Failed to suggest project name");throw new Error(s)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{name:typeof a.name=="string"?a.name.trim():"",path:typeof a.path=="string"?nt(a.path):""}}function Zx(e){const t=Je(e);if(!t)return null;const n=ae(t.key),o=typeof t.text=="string"?t.text:"",r=ae(t.kind);return!n||!r||r!=="meta"&&r!=="hunk"&&r!=="add"&&r!=="remove"&&r!=="context"?null:{key:n,kind:r,text:o,oldLine:ln(t.oldLine),newLine:ln(t.newLine)}}function e1(e){const t=Je(e);if(!t)return null;const n=ae(t.id),o=typeof t.header=="string"?t.header:"",r=typeof t.patch=="string"?t.patch:"";return n?{id:n,header:o,patch:r,addedLineCount:ln(t.addedLineCount)??0,removedLineCount:ln(t.removedLineCount)??0,oldStart:ln(t.oldStart),oldLineCount:ln(t.oldLineCount)??0,newStart:ln(t.newStart),newLineCount:ln(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(a=>Zx(a)).filter(a=>a!==null):[]}:null}function t1(e){const t=Je(e);if(!t)return null;const n=ae(t.id),o=ae(t.path),r=ae(t.absolutePath),a=ae(t.operation);return!n||!o||!r||!a||a!=="add"&&a!=="delete"&&a!=="update"&&a!=="rename"?null:{id:n,path:o,absolutePath:r,previousPath:ae(t.previousPath),previousAbsolutePath:ae(t.previousAbsolutePath),operation:a,addedLineCount:ln(t.addedLineCount)??0,removedLineCount:ln(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(s=>e1(s)).filter(s=>s!==null):[]}}function fy(e){const t=Je(e),n=Je(t==null?void 0:t.data),o=Je(n==null?void 0:n.summary),r=ae(n==null?void 0:n.scope),a=r==="baseBranch"||r==="commit"?r:"workspace",s=ae(n==null?void 0:n.workspaceView)==="staged"?"staged":"unstaged";return{cwd:ae(n==null?void 0:n.cwd)??"",gitRoot:ae(n==null?void 0:n.gitRoot),isGitRepo:Co(n==null?void 0:n.isGitRepo)??!1,scope:a,workspaceView:s,baseBranch:ae(n==null?void 0:n.baseBranch),baseBranchOptions:Array.isArray(n==null?void 0:n.baseBranchOptions)?n.baseBranchOptions.map(i=>ae(i)).filter(i=>typeof i=="string"&&i.length>0):[],commitSha:ae(n==null?void 0:n.commitSha),headBranch:ae(n==null?void 0:n.headBranch),mergeBaseSha:ae(n==null?void 0:n.mergeBaseSha),generatedAtIso:ae(n==null?void 0:n.generatedAtIso)??"",summary:{fileCount:ln(o==null?void 0:o.fileCount)??0,addedLineCount:ln(o==null?void 0:o.addedLineCount)??0,removedLineCount:ln(o==null?void 0:o.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(i=>t1(i)).filter(i=>i!==null):[]}}function n1(e){const t=Je(e),n=Je(t==null?void 0:t.data);return{fileCount:ln(n==null?void 0:n.fileCount)??0,addedLineCount:ln(n==null?void 0:n.addedLineCount)??0,removedLineCount:ln(n==null?void 0:n.removedLineCount)??0}}async function i3(e,t,n,o,r){const a=new URLSearchParams({cwd:e,scope:t,workspaceView:n});o&&o.trim()&&a.set("baseBranch",o.trim()),r&&r.trim()&&a.set("commitSha",r.trim());const s=await fetch(`/codex-api/review/snapshot?${a.toString()}`),i=await s.json();if(!s.ok)throw new Error(pn(i,"Failed to load review snapshot"));return fy(i)}async function o1(e,t){const n=new URLSearchParams({cwd:e,workspaceView:t}),o=await fetch(`/codex-api/review/summary?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(pn(r,"Failed to load review summary"));return n1(r)}async function l3(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(pn(n,"Failed to apply review action"));return fy(n)}async function c3(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(pn(n,"Failed to initialize Git"))}async function r1(e,t,n,o,r,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:o,patchIds:r,scope:a,filePaths:s})}),u=await i.json().catch(()=>({}));if(!i.ok){const h=typeof u.message=="string"&&u.message.trim()?u.message.trim():typeof u.error=="string"&&u.error.trim()?u.error.trim():"Server error";return{changed:0,errors:Array.isArray(u.errors)&&u.errors.length>0?u.errors:[h],message:u.message}}return{changed:u.changed??u.reverted??u.applied??0,errors:Array.isArray(u.errors)?u.errors:[],message:u.message,revertedPatchIds:Array.isArray(u.revertedPatchIds)?u.revertedPatchIds:[],appliedPatchIds:Array.isArray(u.appliedPatchIds)?u.appliedPatchIds:[]}}catch(i){return{changed:0,errors:[i instanceof Error?i.message:"Network error"]}}}async function a1(e,t,n){const o=await r1(e,t,n,"undo");return{reverted:o.changed,errors:o.errors}}const s1={},i1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function l1(e,t){return C(),I("svg",i1,[...t[0]||(t[0]=[f("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const Js=yt(s1,[["render",l1]]),c1={},u1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function d1(e,t){return C(),I("svg",u1,[...t[0]||(t[0]=[f("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const Hc=yt(c1,[["render",d1]]),f1={},p1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function h1(e,t){return C(),I("svg",p1,[...t[0]||(t[0]=[f("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 hf=yt(f1,[["render",h1]]),m1={},v1={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function g1(e,t){return C(),I("svg",v1,[...t[0]||(t[0]=[f("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 Li=yt(m1,[["render",g1]]),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 C(),I("svg",w1,[...t[0]||(t[0]=[f("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 Xf=yt(y1,[["render",b1]]),T1={},k1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function C1(e,t){return C(),I("svg",k1,[...t[0]||(t[0]=[f("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 S1=yt(T1,[["render",C1]]),_1={},x1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function A1(e,t){return C(),I("svg",x1,[...t[0]||(t[0]=[f("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 Gs=yt(_1,[["render",A1]]),py="codex-web-local.ui-language.v1",I1={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...":"加载消息中...",Plan:"计划",Updating:"更新中",Step:"步骤","Edit this message":"编辑此消息","Edit message":"编辑消息","Rollback this message":"回退此消息",Rollback:"回退","Fork thread from this response":"从此回复分叉线程",Fork:"分叉","Response copied":"回复已复制","Copy response":"复制回复","Jump to latest":"跳转到最新","Jump to latest output":"跳转到最新输出","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":"没有匹配的线程","Loading threads...":"加载线程中...","Edit name":"编辑名称",Remove:"移除","Project name":"项目名称","No threads":"没有线程","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 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":"上下文已压缩","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":"已复制提交引用",Copy:"复制","Copy chat":"复制聊天","Create a new automation":"创建新自动化","Create chat fork":"创建聊天分叉",current:"当前",Declined:"已拒绝",Done:"完成","Rollback this turn?":"回退到该轮?",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.":"此线程还没有消息。",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.":"命令因权限或沙箱限制被拦截,未弹出审批提示。如预期应出现审批,请检查审批策略或受信任目录。",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.":"这会在所选项目文件夹上创建项目自动化。","This rolls the thread back to this turn so you can edit the message. Later replies will be removed.":"将线程回退到本轮,以便你编辑消息。之后的回复将被移除。","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.":"请通过线程或项目菜单添加自动化。"},km={en:"English","zh-CN":"简体中文"};function P1(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(py))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const Uu=x(P1());function hy(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}hy(Uu.value);function R1(e,t){return t?e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??"")):e}function E1(e){Uu.value=e,hy(e),typeof window<"u"&&window.localStorage.setItem(py,e)}function my(e,t){const n=Uu.value==="zh-CN"?I1[e]??e:e;return R1(n,t)}function io(){return{uiLanguage:Uu,uiLanguageOptions:[{value:"en",label:km.en},{value:"zh-CN",label:km["zh-CN"]}],t:my,setUiLanguage:E1}}const vy="brutalstrikedevs@gmail.com",M1=20,$1=6500,Cm=1800,Ld=12,Sm=240,_m=/token|secret|password|passwd|credential|authorization|auth|bearer|cookie|session|key/i,cl=x([]);let xm=!1,Nd=!1,Od=null;function Jl(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 j1(e){return typeof e=="string"?e:e instanceof URL?e.toString():e.url}function L1(e,t){var o;const n=(o=t==null?void 0:t.method)==null?void 0:o.trim();return n?n.toUpperCase():typeof e=="object"&&"method"in e&&typeof e.method=="string"&&e.method.trim()?e.method.trim().toUpperCase():"GET"}function gy(e){return((e||"").split(/\r?\n/,1)[0]??"").replace(/\s+/g," ").trim().slice(0,80)||"issue report"}function Am(e){return encodeURIComponent(e)}function N1(){return`mailto:${vy}`}function O1(){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>Cm?`${e.slice(0,Cm)}
50
+ ...[truncated]`:e:"No visible page text captured."}function D1(e,t){const n=t.replace(/\r\n/g,`
51
+ `).replace(/[ \t]+/g," ").trim();return n?_m.test(e)||_m.test(n)?`[omitted sensitive value, ${n.length} chars]`:n.length>Sm?`${n.slice(0,Sm)}...[truncated, ${n.length} chars total]`:n:""}function Im(e,t){if(!e)return`${t}: unavailable`;try{const n=[],o=Math.min(e.length,Ld);for(let a=0;a<o;a+=1){const s=e.key(a);s&&n.push(`${s}=${D1(s,e.getItem(s)??"")}`)}const r=e.length>Ld?`
52
+ ...${e.length-Ld} more item(s)`:"";return`${t}:
53
+ ${n.join(`
54
+ `)||"empty"}${r}`}catch(n){return`${t}: unavailable (${gy(Jl(n))})`}}function F1(){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}`,Im(window.localStorage,"localStorage"),Im(window.sessionStorage,"sessionStorage")].join(`
55
+ `)}function xi(e){const t=e.message.trim();if(!t)return;const n=cl.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 o={...e,message:t,atIso:e.atIso??new Date().toISOString()};cl.value=[o,...cl.value].slice(0,M1)}function yy(e=cl.value){var h;const t=typeof window>"u"?"unknown":`${window.innerWidth}x${window.innerHeight} @${window.devicePixelRatio||1}x`,n=typeof window>"u"?"unknown":window.location.href,o=typeof navigator>"u"?"unknown":navigator.userAgent,r="0.1.104",a="codex-mobile",s=e.slice(0,12).map((p,g)=>[`${g+1}. [${p.atIso}] ${p.kind}`,p.method?`${p.method}`:"",p.url??"",typeof p.status=="number"?`${p.status} ${p.statusText??""}`.trim():"",p.message].filter(Boolean).join(" | ")).join(`
56
+ `),i=["What happened?","","","Context",`URL: ${n}`,`User agent: ${o}`,`Viewport: ${t}`,`App version: ${r}`,`Worktree: ${a}`,"","Browser/app state",F1(),"","Recent diagnostics",s||"No diagnostics captured.","","Visible page text",O1()].join(`
57
+ `).slice(0,$1),u=`Codex Web feedback: ${gy((h=e[0])==null?void 0:h.message)}`;return`mailto:${vy}?subject=${Am(u)}&body=${Am(i)}`}function B1(){typeof window>"u"||(window.location.href=yy())}function U1(){if(!(typeof window>"u")&&(xm||(xm=!0,window.addEventListener("error",e=>{xi({kind:"window-error",message:e.error?Jl(e.error):e.message,url:e.filename||window.location.href})}),window.addEventListener("unhandledrejection",e=>{xi({kind:"unhandled-rejection",message:Jl(e.reason),url:window.location.href})})),!Nd)){if(typeof window.fetch!="function"){xi({kind:"fetch-error",message:"Feedback diagnostics could not monitor fetch: window.fetch is unavailable",url:window.location.href});return}try{Od=window.fetch.bind(window),window.fetch=async(e,t)=>{const n=j1(e),o=L1(e,t);try{const r=await Od(e,t);return r.ok||xi({kind:n.includes("/codex-api/")?"api-response":"fetch-error",message:`Request failed with HTTP ${r.status}`,url:n,method:o,status:r.status,statusText:r.statusText}),r}catch(r){throw xi({kind:"fetch-error",message:Jl(r),url:n,method:o}),r}},Nd=!0}catch(e){Od=null,Nd=!1;try{xi({kind:"fetch-error",message:`Feedback diagnostics could not monitor fetch: ${Jl(e)}`,url:window.location.href})}catch{}}}}function Zf(){const e=X(()=>cl.value.length>0);function t(n,o){xi({kind:"visible-error",message:n,url:o||(typeof window>"u"?void 0:window.location.href)})}return{diagnostics:cl,hasFeedbackDiagnostics:e,recordVisibleFailure:t,openFeedbackMail:B1,buildFeedbackMailto:yy,feedbackMailtoBase:N1}}const wy="codex-web-local.recycle-bin.v1";function by(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(wy);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 Pm(e){if(!(typeof window>"u"))try{window.localStorage.setItem(wy,JSON.stringify(e))}catch{}}const us=x(by());function q1(){function e(){us.value=by()}function t(r){us.value=[{...r,archivedAtIso:new Date().toISOString()},...us.value.filter(a=>a.id!==r.id)],Pm(us.value)}function n(r){us.value=us.value.filter(a=>a.id!==r),Pm(us.value)}async function o(r){if(!us.value.some(a=>a.id===r))return{ok:!1,error:"Thread is not in the recycle bin"};try{return await x_(r),n(r),{ok:!0}}catch(a){return{ok:!1,error:a instanceof Error?a.message:"Failed to restore thread"}}}return{records:us,loadRecords:e,recordArchivedThread:t,removeArchivedRecord:n,restoreArchivedThread:o}}const z1=["title","aria-label","disabled"],H1={key:1,class:"composer-dropdown-value"},W1={key:0,class:"composer-dropdown-search-wrap"},V1=["placeholder","onKeydown"],G1={class:"composer-dropdown-options",role:"listbox"},K1=["onClick"],Y1={key:0,class:"composer-dropdown-empty"},J1=en({__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,o=t,r=x(null),a=x(null),s=x(null),i=x(null),u=x(!1),h=x(""),p=x({});let g=!1;const w=X(()=>{var Pe;const _e=n.options.find(Re=>Re.value===n.modelValue);return _e?_e.label:((Pe=n.placeholder)==null?void 0:Pe.trim())||""}),A=X(()=>n.openDirection??"down"),M=X(()=>n.menuAlign??"start"),U=X(()=>n.iconOnly===!0),Y=X(()=>n.enableSearch===!0),ue=X(()=>n.variant==="pill"?"composer-dropdown-trigger--pill":""),F=X(()=>{var _e;return((_e=n.searchPlaceholder)==null?void 0:_e.trim())||"Quick search projects"}),H=X(()=>{var _e;return((_e=n.emptyLabel)==null?void 0:_e.trim())||"No results"}),q=X(()=>{var _e;return w.value||((_e=n.placeholder)==null?void 0:_e.trim())||"Select option"}),me=X(()=>{const _e=h.value.trim().toLowerCase();return _e?n.options.filter(Pe=>Pe.label.toLowerCase().includes(_e)||Pe.value.toLowerCase().includes(_e)):n.options});function we(){n.disabled||(u.value=!u.value)}function ve(_e,Pe,Re){return Math.min(Re,Math.max(Pe,_e))}function je(){var ee,te,V,$e;if(!u.value)return;const _e=r.value;if(!_e||typeof window>"u")return;const Pe=_e.getBoundingClientRect(),Re=window.innerWidth,Ue=window.innerHeight,Le=8,gt=8,ft=Math.max(0,Re-Le*2),at=((ee=s.value)==null?void 0:ee.offsetWidth)??((te=a.value)==null?void 0:te.offsetWidth)??224,it=((V=s.value)==null?void 0:V.offsetHeight)??(($e=a.value)==null?void 0:$e.offsetHeight)??0,wt=Math.min(at,ft),St=Math.max(Le,Re-wt-Le),Qe=M.value==="end"?Pe.right-wt:Pe.left,et=ve(Qe,Le,St);let re=A.value==="up"?Pe.top-it-gt:Pe.bottom+gt;it>0&&re+it>Ue-Le&&(re=Ue-it-Le),re=Math.max(Le,re),p.value={position:"fixed",left:`${et}px`,right:"auto",top:`${re}px`,bottom:"auto",width:`${wt}px`}}function ge(){g||typeof window>"u"||(window.addEventListener("resize",je),window.addEventListener("scroll",je,!0),g=!0)}function Ie(){!g||typeof window>"u"||(window.removeEventListener("resize",je),window.removeEventListener("scroll",je,!0),g=!1)}function De(_e){o("update:modelValue",_e),u.value=!1,h.value=""}function fe(){if(h.value.length>0){h.value="";return}u.value=!1}function Se(_e){if(!u.value)return;const Pe=r.value;if(!Pe)return;const Re=_e.target;Re instanceof Node&&(Pe.contains(Re)||(u.value=!1,h.value=""))}return tt(u,_e=>{if(!_e){Ie(),p.value={};return}ge(),Gt(()=>{var Pe;je(),window.requestAnimationFrame(je),Y.value&&((Pe=i.value)==null||Pe.focus())})}),Cs(()=>{window.addEventListener("pointerdown",Se)}),Ni(()=>{window.removeEventListener("pointerdown",Se),Ie()}),(_e,Pe)=>(C(),I("div",{ref_key:"rootRef",ref:r,class:"composer-dropdown"},[f("button",{class:Ye(["composer-dropdown-trigger",ue.value]),type:"button",title:q.value,"aria-label":q.value,disabled:e.disabled,onClick:we},[e.selectedPrefixIcon?(C(),Ze(Nf(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):Z("",!0),U.value?Z("",!0):(C(),I("span",H1,k(w.value),1)),Me(Js,{class:"composer-dropdown-chevron"})],10,z1),u.value?(C(),I("div",{key:0,ref_key:"menuWrapRef",ref:a,class:Ye(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":A.value==="up","composer-dropdown-menu-wrap-down":A.value==="down"}]),style:kr(p.value)},[f("div",{ref_key:"menuRef",ref:s,class:"composer-dropdown-menu"},[Y.value?(C(),I("div",W1,[Nt(f("input",{ref_key:"searchInputRef",ref:i,"onUpdate:modelValue":Pe[0]||(Pe[0]=Re=>h.value=Re),class:"composer-dropdown-search-input",type:"text",placeholder:F.value,onKeydown:xn(st(fe,["prevent"]),["esc"])},null,40,V1),[[sn,h.value]])])):Z("",!0),f("ul",G1,[(C(!0),I(qe,null,At(me.value,Re=>(C(),I("li",{key:Re.value},[f("button",{class:Ye(["composer-dropdown-option",{"is-selected":Re.value===e.modelValue}]),type:"button",onClick:Ue=>De(Re.value)},k(Re.label),11,K1)]))),128)),me.value.length===0?(C(),I("li",Y1,k(H.value),1)):Z("",!0)])],512)],6)):Z("",!0)],512))}}),Zo=yt(J1,[["__scopeId","data-v-48e2516e"]]),Q1={},X1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Z1(e,t){return C(),I("svg",X1,[...t[0]||(t[0]=[f("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const ru=yt(Q1,[["render",Z1]]),eA=["aria-label","onKeydown"],tA={class:"app-dialog-header"},nA={class:"app-dialog-title-wrap"},oA={class:"app-dialog-title"},rA={key:0,class:"app-dialog-subtitle"},aA=["aria-label","title"],sA={class:"app-dialog-body"},iA={key:0,class:"app-dialog-footer"},lA=en({__name:"AppDialog",props:{open:{type:Boolean},title:{},subtitle:{default:""},ariaLabel:{default:""},size:{default:"sm"}},emits:["close"],setup(e,{emit:t}){const n=e,o=t,{t:r}=io();function a(){o("close")}function s(i){n.open&&i.key==="Escape"&&(i.preventDefault(),a())}return tt(()=>n.open,i=>{typeof window>"u"||(i?window.addEventListener("keydown",s):window.removeEventListener("keydown",s))},{immediate:!0}),Ni(()=>{typeof window>"u"||window.removeEventListener("keydown",s)}),(i,u)=>(C(),Ze(Qs,{to:"body"},[e.open?(C(),I("div",{key:0,class:"app-dialog-overlay",onClick:st(a,["self"])},[f("div",{class:Ye(["app-dialog-panel",`app-dialog-panel--${e.size}`]),role:"dialog","aria-modal":"true","aria-label":e.ariaLabel||e.title,onKeydown:xn(st(a,["prevent"]),["esc"])},[f("div",tA,[f("div",nA,[f("h3",oA,k(e.title),1),e.subtitle?(C(),I("p",rA,k(e.subtitle),1)):Z("",!0)]),f("button",{class:"app-dialog-close",type:"button","aria-label":v(r)("Close"),title:v(r)("Close"),onClick:a},[Me(ru,{class:"app-dialog-close-icon"})],8,aA)]),f("div",sA,[er(i.$slots,"default",{},void 0)]),i.$slots.footer?(C(),I("div",iA,[er(i.$slots,"footer",{},void 0)])):Z("",!0)],42,eA)])):Z("",!0)]))}}),Dd=yt(lA,[["__scopeId","data-v-0c988f32"]]),cA={key:0,class:"sidebar-menu-row-left"},uA={class:"sidebar-menu-row-main"},dA={key:1,class:"sidebar-menu-row-right"},fA={key:0,class:"sidebar-menu-row-right-default"},pA={key:1,class:"sidebar-menu-row-right-hover"},hA=en({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=ET(),o=X(()=>!!n.left),r=X(()=>!!n.right),a=X(()=>!!n["right-hover"]),s=X(()=>r.value||a.value);return(i,u)=>(C(),Ze(Nf(t.as),Ig({class:"sidebar-menu-row","data-has-left":o.value,"data-has-right":s.value,"data-has-right-hover":a.value,"data-force-right-hover":t.forceRightHover},i.$attrs),{default:mt(()=>[o.value?(C(),I("span",cA,[er(i.$slots,"left",{},void 0,!0)])):Z("",!0),f("span",uA,[er(i.$slots,"default",{},void 0,!0)]),s.value?(C(),I("span",dA,[r.value?(C(),I("span",fA,[er(i.$slots,"right",{},void 0,!0)])):Z("",!0),a.value?(C(),I("span",pA,[er(i.$slots,"right-hover",{},void 0,!0)])):Z("",!0)])):Z("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),zs=yt(hA,[["__scopeId","data-v-5fc666fb"]]),mA={},vA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function gA(e,t){return C(),I("svg",vA,[...t[0]||(t[0]=[f("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 bu=yt(mA,[["render",gA]]),yA={},wA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function bA(e,t){return C(),I("svg",wA,[...t[0]||(t[0]=[f("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 Ty=yt(yA,[["render",bA]]),TA=["data-menu-open"],kA={class:"thread-left-stack"},CA=["data-state"],SA=["data-confirming","title"],_A={key:0,class:"thread-delete-confirm-label"},xA={class:"thread-row-title-wrap"},AA={class:"thread-row-title-line"},IA={class:"thread-row-title"},PA=["title"],RA={key:0,class:"thread-row-automation-count"},EA=["data-state"],MA={class:"thread-row-time"},$A=en({__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,o=t;function r(a){n.setMenuWrapRef(a instanceof HTMLDivElement?a:null)}return(a,s)=>(C(),I("li",{class:"thread-row-item","data-menu-open":n.menuOpen?"true":"false"},[Me(zs,{class:"thread-row","data-active":n.selected,"data-pinned":n.pinned,"data-menu-open":n.menuOpen?"true":"false","force-right-hover":n.menuOpen,onClick:s[3]||(s[3]=i=>o("select")),onMouseleave:s[4]||(s[4]=i=>o("row-leave",i)),onContextmenu:s[5]||(s[5]=i=>o("row-contextmenu",i))},{left:mt(()=>[f("span",kA,[n.showStatusIndicator?(C(),I("span",{key:0,class:"thread-status-indicator","data-state":n.threadState},null,8,CA)):Z("",!0),f("button",{class:"thread-delete-button",type:"button","data-confirming":n.inlineDeleteConfirming,title:n.inlineDeleteConfirming?n.confirmDeleteLabel:n.deleteLabel,onClick:s[0]||(s[0]=st(i=>o("inline-delete"),["stop"]))},[n.inlineDeleteConfirming?(C(),I("span",_A,k(n.confirmLabel),1)):(C(),Ze(Ty,{key:1,class:"thread-icon"}))],8,SA)])]),right:mt(()=>[f("span",MA,k(n.relativeTime),1)]),"right-hover":mt(()=>[f("div",{ref:r,class:"thread-menu-wrap"},[f("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:s[2]||(s[2]=st(i=>o("menu-toggle"),["stop"]))},[Me(hf,{class:"thread-icon"})])])]),default:mt(()=>[f("button",{class:"thread-main-button",type:"button",onClick:s[1]||(s[1]=st(i=>o("select"),["stop"]))},[f("span",xA,[f("span",AA,[f("span",IA,k(n.thread.title),1),n.thread.hasWorktree?(C(),Ze(bu,{key:0,class:"thread-row-worktree-icon",title:n.worktreeLabel},null,8,["title"])):Z("",!0),n.automationCount>0?(C(),I("span",{key:1,class:"thread-row-automation-chip",title:n.automationTooltip},[Me(Gs,{class:"thread-row-automation-icon"}),n.automationCount>1?(C(),I("span",RA,k(n.automationCount),1)):Z("",!0)],8,PA)):Z("",!0),n.thread.pendingRequestState?(C(),I("span",{key:2,class:"thread-row-request-chip","data-state":n.thread.pendingRequestState},k(n.requestLabel),9,EA)):Z("",!0)])])])]),_:1},8,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,TA))}}),Wc=yt($A,[["__scopeId","data-v-fac0242e"]]);function jA(e,t,n){return n.canPruneMissing?e.filter(o=>t.has(o)):e}const LA={key:0,class:"pinned-section"},NA={class:"thread-tree-header"},OA={key:0,class:"thread-list"},DA={class:"projects-section"},FA={class:"thread-tree-header"},BA=["aria-expanded","aria-label","title"],UA={class:"organize-menu-title"},qA=["data-active"],zA={key:0},HA=["data-active"],WA={key:0},VA=["data-active"],GA={key:0},KA={class:"organize-menu-title"},YA=["data-active"],JA={key:0},QA=["data-active"],XA={key:0},ZA={key:0,class:"thread-tree-action-error"},eI={key:1,class:"thread-tree-no-results"},tI={key:2,class:"thread-tree-loading"},nI={key:3,class:"thread-list thread-list-global"},oI=["data-project-name","data-expanded","data-dragging"],rI={class:"project-icon-stack"},aI={class:"project-icon-folder"},sI={class:"project-icon-chevron"},iI=["data-dragging-handle","onMousedown"],lI=["title"],cI=["title"],uI={key:0,class:"thread-row-automation-count"},dI={class:"project-hover-controls"},fI=["onClick"],pI=["data-open-direction"],hI=["onClick"],mI=["onClick"],vI=["onClick"],gI=["onClick"],yI=["onClick"],wI=["onClick"],bI={class:"project-menu-label"},TI=["onInput"],kI=["aria-label","title","onClick"],CI={key:0,class:"thread-list"},SI={class:"project-empty"},_I=["onClick"],xI={class:"chats-section"},AI={class:"thread-tree-header"},II={class:"chats-section-actions"},PI=["aria-label","title"],RI={key:0,class:"thread-tree-no-results"},EI={key:1,class:"thread-list thread-list-global"},MI=["data-open-direction"],$I=["disabled","title"],jI=["placeholder","onKeydown"],LI={key:0,class:"recycle-bin-empty"},NI={key:1,class:"recycle-bin-list"},OI={class:"recycle-bin-item-copy"},DI={class:"recycle-bin-item-title"},FI={key:0,class:"recycle-bin-item-meta"},BI={class:"recycle-bin-item-time"},UI={class:"recycle-bin-item-actions"},qI=["disabled","onClick"],zI=["onClick"],HI={key:2,class:"recycle-bin-error",role:"alert"},WI=["aria-label"],VI={class:"rename-thread-title"},GI={class:"rename-thread-subtitle"},KI={key:0,class:"automation-target-picker"},YI={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},JI={class:"automation-target-dropdown"},QI=["aria-label"],XI=["onClick"],ZI={class:"automation-thread-field"},eP={class:"automation-thread-label"},tP=["placeholder"],nP={class:"automation-thread-field"},oP={class:"automation-thread-label"},rP=["placeholder"],aP={class:"automation-thread-field"},sP={class:"automation-thread-label"},iP={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},lP={key:0,class:"automation-schedule-row"},cP={class:"automation-schedule-copy"},uP={key:1,class:"automation-schedule-row"},dP={class:"automation-schedule-copy"},fP={class:"automation-schedule-preview"},pP={class:"automation-thread-field"},hP={class:"automation-thread-label"},mP={key:2,class:"rename-thread-subtitle automation-thread-error"},vP={key:3,class:"rename-thread-subtitle automation-thread-notice"},gP={class:"rename-thread-actions"},yP=["disabled"],wP=["disabled"],bP=["disabled"],TP=["disabled"],kP=4,Rm=6,Em="codex-web-local.sidebar-section-expansion.v1",Mm="codex-web-local.sidebar-chats-first.v1",$m="codex-web-local.sidebar-chat-sort-mode.v1",jm="codex-web-local.thread-view-mode.v1",Lm="codex-web-local.collapsed-projects.v1",CP=en({__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 o=e,{t:r}=io(),{recordVisibleFailure:a}=Zf(),s=n,{records:i,loadRecords:u,recordArchivedThread:h,removeArchivedRecord:p,restoreArchivedThread:g}=q1(),w=x(!1),A=x(""),M=x("");function U(){un.value=!1,A.value="",u(),w.value=!0}async function Y(y){if(!M.value){M.value=y,A.value="";try{const b=await g(y);b.ok?s("restore-thread",y):A.value=b.error??"Failed to restore thread"}finally{M.value=""}}}const ue=x({}),F=x({}),H=x(!0),q=x(!0),me=x(!0),we=x(!1),ve=x(or(Mm,!1)),je=x(Tt());let ge=!1;const Ie=x([]),De=x({}),fe=x(""),Se=x([]),_e=x(""),Pe=x(""),Re=x("hover"),Ue=x({}),Le=x({}),gt=x({}),ft=x("actions"),at=x(""),it=x(!1),wt=x(""),St=x(""),Qe=x(null),et=x(!1),re=x(""),ee=x(""),te=x({}),V=x({}),$e=x(!1),R=x("thread"),j=x(""),W=x(""),ce=x(""),le=x("create"),ne=x(!1),Ce=x("thread"),be=x(""),de=x(""),ie=x(""),Ge=x(""),Te=x(!1),Be=x(!1),Fe=x({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),ze=x({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),bt=X(()=>{if(R.value==="project"){const b=W.value;return b?V.value[b]??[]:[]}const y=j.value;return y?te.value[y]??[]:[]}),dt=X(()=>Mn(Fe.value.rrule)),pt=X(()=>ne.value&&le.value==="create"?Ce.value==="thread"?r("This creates a heartbeat automation attached to the selected chat."):r("This creates a project automation attached to the selected project folder."):R.value==="project"?r("This creates project automations attached to the selected project folder."):r("This creates heartbeat automations attached to the selected thread.")),Yt=X(()=>{var b;const y=[];for(const T of o.groups)for(const N of T.threads){const ke=((b=N.title)==null?void 0:b.trim())||N.id,ot=Vn(T.projectName);y.push({value:N.id,label:`${ke} · ${ot}`,searchText:`${ke} ${ot} ${N.id}`.toLowerCase()})}return y}),In=X(()=>{const y=[];for(const b of o.groups){const T=Vo(b.projectName);if(!T)continue;const N=Vn(b.projectName);y.push({value:T,label:N,searchText:`${N} ${T}`.toLowerCase()})}return y}),z=X(()=>(Ce.value==="project"?In.value:Yt.value).map(b=>({value:b.value,label:b.label}))),G=[{value:"minutes",label:r("minutes")},{value:"hours",label:r("hours")},{value:"days",label:r("days")}],K=X(()=>[{value:"ACTIVE",label:r("Active")},{value:"PAUSED",label:r("Paused")}]);tt(z,y=>{var b;ne.value&&(y.some(T=>T.value===be.value)||(be.value=((b=y[0])==null?void 0:b.value)??""))});const pe=x(null),Ne=x(null),We=x(null);let Xe=null,$t=null;const Lt=x(""),kn=x({}),Fo=new Map,tr=new Map,lo=new Map,It=new WeakMap,Kr=x(null),nr=x(null),un=x(!1),jn=x(Cn()),Pn=typeof window<"u"?new ResizeObserver(y=>{for(const b of y){const T=b.target,N=It.get(T);N&&wn(N,T)}}):null;function So(){if(typeof window>"u")return{};try{const y=window.localStorage.getItem(Lm);if(!y)return{};const b=JSON.parse(y);return!b||typeof b!="object"||Array.isArray(b)?{}:b}catch{return{}}}function Cn(){return typeof window>"u"?"project":window.localStorage.getItem(jm)==="chronological"?"chronological":"project"}function or(y,b){if(typeof window>"u")return b;const T=window.localStorage.getItem(y);return T==="true"?!0:T==="false"?!1:b}function Tt(){return typeof window>"u"?"updated":window.localStorage.getItem($m)==="created"?"created":"updated"}F.value=So();function zt(){if(!(typeof window>"u"))try{const y=JSON.parse(window.localStorage.getItem(Em)||"{}");typeof y.pinned=="boolean"&&(H.value=y.pinned),typeof y.projects=="boolean"&&(q.value=y.projects),typeof y.chats=="boolean"&&(me.value=y.chats)}catch{}}function Et(){typeof window>"u"||window.localStorage.setItem(Em,JSON.stringify({pinned:H.value,projects:q.value,chats:me.value}))}zt(),tt(F,y=>{typeof window>"u"||window.localStorage.setItem(Lm,JSON.stringify(y))},{deep:!0}),tt(jn,y=>{typeof window>"u"||window.localStorage.setItem(jm,y)}),tt(ve,y=>{typeof window>"u"||window.localStorage.setItem(Mm,String(y))}),tt(je,y=>{typeof window>"u"||window.localStorage.setItem($m,y)}),tt([H,q,me],Et);const Cr=X(()=>o.searchQuery.trim().toLowerCase()),hn=X(()=>Cr.value.length>0),ga=X(()=>o.searchMatchedThreadIds?new Set(o.searchMatchedThreadIds):null),Sr=X(()=>new Set(Ie.value)),Bo=X(()=>new Set(Se.value));function ya(y){if(Bo.value.has(y.id))return!1;if(!hn.value)return!0;if(ga.value)return ga.value.has(y.id);const b=Cr.value;return y.title.toLowerCase().includes(b)||y.preview.toLowerCase().includes(b)}const wa=X(()=>o.groups.flatMap(y=>{const b=y.threads.filter(T=>!wu(T.cwd)&&ya(T));return b.length>0?[{...y,threads:b}]:!hn.value&&y.threads.length===0?[{...y,threads:b}]:[]})),_r=X(()=>jn.value==="chronological"),tn=X(()=>{const y=[];for(const b of o.groups)for(const T of b.threads)Sr.value.has(T.id)||ya(T)&&y.push(T);return y.sort((b,T)=>{const N=new Date(b.updatedAtIso||b.createdAtIso).getTime();return new Date(T.updatedAtIso||T.createdAtIso).getTime()-N})}),Sn=X(()=>{const y=tn.value.filter(T=>wu(T.cwd)),b=je.value==="created"?"createdAtIso":"updatedAtIso";return y.sort((T,N)=>{const ke=new Date(T[b]||T.updatedAtIso||T.createdAtIso).getTime();return new Date(N[b]||N.updatedAtIso||N.createdAtIso).getTime()-ke})}),mn=X(()=>hn.value||we.value?Sn.value:Sn.value.slice(0,10)),xr=X(()=>hn.value?!1:Sn.value.length>10),Ln=X(()=>{const y=new Map;for(const b of o.groups)for(const T of b.threads)Bo.value.has(T.id)||y.set(T.id,T);return y});tt(Ie,y=>{ge&&ix(y)}),tt([Ln,()=>o.isThreadListFullyLoaded],([y])=>{const b=jA(Ie.value,new Set(y.keys()),{canPruneMissing:o.isThreadListFullyLoaded});if(b.length===Ie.value.length)return;const T=new Set(b),N=Object.fromEntries(Object.entries(De.value).filter(([ke])=>T.has(ke)));De.value=N,Ie.value=b});let co=0;async function Rn(){if(o.isLoading)return;const y=Ie.value.filter(ke=>!Ln.value.has(ke)&&!De.value[ke]);if(y.length===0)return;const b=co+=1,T=await Promise.all(y.map(async ke=>{try{return await C_(ke)}catch{return null}}));if(b!==co)return;const N={...De.value};for(const ke of T)ke&&(N[ke.id]=ke);De.value=N}tt([Ie,Ln,()=>o.isLoading],()=>{ge&&Rn()}),Cs(async()=>{const{threadIds:y}=await sx(),b=Array.isArray(y)?y.filter(T=>typeof T=="string").map(T=>T.trim()).filter((T,N,ke)=>T.length>0&&ke.indexOf(T)===N):[];b.length>0&&(Ie.value=b);try{te.value=await TS()}catch{te.value={}}try{await dr()}catch{V.value={}}ge=!0,Rn()});const rr=X(()=>Jr(re.value)),Ar=X(()=>{const y=ee.value;return rr.value?r('This will archive the thread "{title}" and remove the attached heartbeat automations.',{title:y}):r('This will archive the thread "{title}". You can find it later in archived threads.',{title:y})}),uo=X(()=>{const y=new Map;for(const b of o.groups)for(const T of b.threads)y.set(T.id,b.projectName);return y}),Uo=X(()=>{const y=new Map;for(const b of o.groups){const T=b.threads.filter(N=>!Sr.value.has(N.id)&&!Bo.value.has(N.id));y.set(b.projectName,T)}return y}),ar=X(()=>{const y=new Map;for(const b of o.groups)for(const T of b.threads){const N=new Date(T.updatedAtIso||T.createdAtIso).getTime();y.set(T.id,N)}return y}),kt=X(()=>{const y=Pe.value;return y?Ln.value.get(y)??null:null}),Ot=X(()=>Ie.value.map(y=>Ln.value.get(y)??De.value[y]??null).filter(y=>y!==null).filter(ya));function Zn(){H.value=!H.value}function _o(){q.value=!q.value}function Ir(){me.value=!me.value}const xo=X(()=>{const y=We.value;if(!y||y.dropTargetIndexFull===null||o.groups.length===0)return null;const b=Math.max(0,Math.min(y.dropTargetIndexFull,o.groups.length)),T=b>y.fromIndex?b-1:b,N=Math.max(0,Math.min(T,o.groups.length-1));return N===y.fromIndex?null:N}),Jn=X(()=>{const b=(hn.value?wa.value:o.groups).map(Pt=>Pt.projectName),T=We.value,N=xo.value;if(!T||N===null)return b;const ke=[...b],[ot]=ke.splice(T.fromIndex,1);return ot?(ke.splice(N,0,ot),ke):b}),Ao=X(()=>{const y={};let b=0;for(const T of Jn.value)y[T]=b,b+=vr(T);return y}),qo=X(()=>{let y=0;for(const b of Jn.value)y+=vr(b);return{height:`${Math.max(0,y)}px`}});function Yr(y){if(Number.isNaN(y))return"n/a";const b=Math.abs(Date.now()-y);if(b<6e4)return r("now");const T=Math.floor(b/6e4);if(T<60)return`${T}m`;const N=Math.floor(T/60);return N<24?`${N}h`:`${Math.floor(N/24)}d`}function Pr(y){const b=ar.value.get(y.id);return Yr(typeof b=="number"?b:new Date(y.updatedAtIso||y.createdAtIso).getTime())}function ni(y){const b=new Date(y).getTime();return Number.isNaN(b)?"":new Date(b).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Io(y){return Sr.value.has(y)}function Ha(y){if(Io(y)){Ie.value=Ie.value.filter(b=>b!==y);return}Ie.value=[y,...Ie.value]}function ba(y){Ha(y),Ve()}function sr(y){fe.value="",s("select",y)}function Jr(y){return nn(y)>0}function nn(y){var b;return((b=te.value[y])==null?void 0:b.length)??0}function Ct(y){return Nn(y)>0}function Nn(y){var T;const b=Vo(y);return b?((T=V.value[b])==null?void 0:T.length)??0:0}function vn(y){if(y.length===0)return"";if(y.length>1){const N=y.filter(ke=>ke.status==="ACTIVE").length;return`${y.length} ${r("automations")} • ${N} ${r("active")}`}const[b]=y,T=b.status==="PAUSED"?"-":b.nextRunAtMs?new Date(b.nextRunAtMs).toLocaleString():r("Not scheduled");return`${b.name} • ${r("Next run")}: ${T}`}function zo(y){return vn(te.value[y]??[])}function fo(y){const b=Vo(y);return vn(b?V.value[b]??[]:[])}function po(y){return String(Math.max(0,y)).padStart(2,"0")}function En(y,b){const T=typeof y=="number"?y:Number(y);return Number.isFinite(T)?Math.max(1,Math.floor(T)):b}function gn(y){const[b,T]=y.split(":"),N=Math.min(23,Math.max(0,Number(b)||0)),ke=Math.min(59,Math.max(0,Number(T)||0));return`FREQ=DAILY;BYHOUR=${N};BYMINUTE=${ke}`}function _t(y,b){const T=En(y,1);return b==="minutes"?`FREQ=MINUTELY;INTERVAL=${T}`:b==="hours"?`FREQ=HOURLY;INTERVAL=${T}`:`FREQ=DAILY;INTERVAL=${T}`}function Jt(y){return Object.fromEntries(y.split(";").map(b=>b.trim()).filter(Boolean).map(b=>{const[T,...N]=b.split("=");return[T.toUpperCase(),N.join("=").trim()]}).filter(([b,T])=>b&&T))}function Mt(y){var ke;const b=Jt(y),T=(ke=b.FREQ)==null?void 0:ke.toUpperCase(),N=En(b.INTERVAL,1);if(T==="DAILY"&&b.BYHOUR!==void 0&&b.BYMINUTE!==void 0&&N===1){const ot=Math.min(23,Math.max(0,Number(b.BYHOUR)||0)),Pt=Math.min(59,Math.max(0,Number(b.BYMINUTE)||0));return{mode:"daily",dailyTime:`${po(ot)}:${po(Pt)}`,interval:1,intervalUnit:"hours"}}return T==="MINUTELY"||T==="HOURLY"||T==="DAILY"&&b.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:N,intervalUnit:T==="MINUTELY"?"minutes":T==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function Mn(y){var ke;const b=Jt(y),T=(ke=b.FREQ)==null?void 0:ke.toUpperCase(),N=En(b.INTERVAL,1);if(T==="DAILY"&&b.BYHOUR!==void 0&&b.BYMINUTE!==void 0&&N===1){const ot=Math.min(23,Math.max(0,Number(b.BYHOUR)||0)),Pt=Math.min(59,Math.max(0,Number(b.BYMINUTE)||0));return`${r("RRULE")}: ${y} · ${r("runs daily at")} ${po(ot)}:${po(Pt)}`}return T==="MINUTELY"?`${r("RRULE")}: ${y} · ${r("runs every")} ${N} ${r("minute(s)")}`:T==="HOURLY"?`${r("RRULE")}: ${y} · ${r("runs every")} ${N} ${r("hour(s)")}`:T==="DAILY"&&b.INTERVAL!==void 0?`${r("RRULE")}: ${y} · ${r("runs every")} ${N} ${r("day(s)")}`:y?`${r("RRULE")}: ${y}`:r("RRULE is required.")}function Hn(){const y=ze.value;y.mode==="daily"?Fe.value.rrule=gn(y.dailyTime):y.mode==="interval"&&(Fe.value.rrule=_t(y.interval,y.intervalUnit))}function Wa(y){y!=="minutes"&&y!=="hours"&&y!=="days"||(ze.value={...ze.value,intervalUnit:y},Hn())}function Rr(y){y!=="ACTIVE"&&y!=="PAUSED"||(Fe.value={...Fe.value,status:y})}function Va(){ze.value=Mt(Fe.value.rrule)}function ir(y){ze.value={...ze.value,mode:y},Hn()}function Ho(y){y===o.selectedThreadId&&(s("copy-thread-chat",y),Ve())}function lr(y){s("fork-thread",y),Ve()}function ho(y){return`${r("start new thread")} ${Vn(y)}`}function Er(y){s("start-new-thread",y)}function cr(y){s("browse-thread-files",y),Ve()}function E(y){s("save-thread-project",y),Ve()}async function O(y){var T,N;const b=((N=(T=Ln.value.get(y))==null?void 0:T.cwd)==null?void 0:N.trim())??"";if(Ve(),!(!b||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(b)}catch{}}function oe(y,b){if(Pe.value===y&&Re.value==="hover"){if(b){const T=b.relatedTarget,N=nr.value;if(T instanceof Node&&N&&N.contains(T))return}Ve()}}function Ee(y){return Pe.value===y}function Ve(){Pe.value="",Re.value="hover",gt.value={}}function Dt(y){if(fe.value="",Pe.value===y){Ve();return}Re.value="hover",Fn(),un.value=!1,Pe.value=y,Gt(()=>{Go(y)})}function yn(y,b){y.preventDefault(),fe.value="",Re.value="contextmenu",Pe.value=b}function on(y,b){wt.value=y,St.value=b,it.value=!0,Ve(),Gt(()=>{var T,N;(T=Qe.value)==null||T.focus(),(N=Qe.value)==null||N.select()})}function Ht(){it.value=!1,wt.value="",St.value=""}function Qr(){const y=wt.value,b=St.value.trim();!y||!b||(s("rename-thread",{threadId:y,title:b}),Ht())}function Po(y,b){fe.value="",re.value=y,ee.value=b,et.value=!0,Ve()}function dn(){et.value=!1,re.value="",ee.value=""}async function oi(){const y=re.value;y&&(Wo(y),dn())}function Mr(y){return fe.value===y}function Wn(y){if(fe.value!==y){fe.value=y,Ve();return}Wo(y),fe.value=""}function Wo(y){var T,N;const b=Ln.value.get(y)??null;Bo.value.has(y)||(Se.value=[y,...Se.value]),fe.value="",Ve(),h({id:y,title:((T=b==null?void 0:b.title)==null?void 0:T.trim())||"(untitled)",cwd:((N=b==null?void 0:b.cwd)==null?void 0:N.trim())??"",projectName:uo.value.get(y)??""}),Ie.value=Ie.value.filter(ke=>ke!==y),s("archive",y),Jr(y)&&(em(y).catch(()=>{}),te.value=jt(te.value,y))}function On(y){var T;R.value="thread",j.value=y,W.value="",ne.value=!1,de.value="",ie.value="";const b=(T=te.value[y])==null?void 0:T[0];b?ur(b.id):Xr(),$e.value=!0,Ve()}function ri(y){var N;const b=Vo(y);if(!b){R.value="project",j.value="",W.value="",ne.value=!1,de.value=r("Project automation requires a resolved absolute project path."),ie.value="",$e.value=!0,Fn();return}R.value="project",j.value="",W.value=b,ne.value=!1,de.value="",ie.value="";const T=(N=V.value[b])==null?void 0:N[0];T?ur(T.id):Xr(),$e.value=!0,Fn()}function bl(y){R.value=y.scope,j.value=y.scope==="thread"?y.target:"",W.value=y.scope==="project"?y.target:"",ne.value=!1,de.value="",ie.value="",y.scope==="project"?V.value=si(V.value,y.target,y.automation):te.value=Ft(te.value,y.target,y.automation),ur(y.automation.id),$e.value=!0,Fn(),Ve()}function ai(){var y;ne.value=!0,Ce.value="thread",be.value=((y=Yt.value[0])==null?void 0:y.value)??"",R.value="thread",j.value="",W.value="",de.value="",ie.value="",Xr(),$e.value=!0,Fn(),Ve()}function Dn(y){var b;Ce.value=y,be.value="",R.value=y==="project"?"project":"thread",be.value=((b=z.value[0])==null?void 0:b.value)??""}function Xr(){ce.value="",le.value="create",de.value="",ie.value="",Fe.value={name:R.value==="project"?"Project automation":"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},ze.value=Mt(Fe.value.rrule)}function ur(y){const b=bt.value.find(T=>T.id===y);b&&(ce.value=b.id,le.value="edit",de.value="",ie.value="",Fe.value={name:b.name,prompt:b.prompt,rrule:b.rrule,status:b.status},ze.value=Mt(b.rrule))}function Qn(){$e.value=!1,R.value="thread",j.value="",W.value="",ce.value="",de.value="",ie.value="",Te.value=!1,Be.value=!1}function jt(y,b){return Object.fromEntries(Object.entries(y).filter(([T])=>T!==b))}function Ft(y,b,T){const N=y[b]??[],ke=N.findIndex(Pt=>Pt.id===T.id),ot=[...N];return ke>=0?ot.splice(ke,1,T):ot.push(T),{...y,[b]:ot}}function Ga(y,b,T){const N=(y[b]??[]).filter(ke=>ke.id!==T);return N.length>0?{...y,[b]:N}:jt(y,b)}function Ta(y,b){return Object.fromEntries(Object.entries(y).filter(([T])=>T!==b))}function si(y,b,T){const N=y[b]??[],ke=N.findIndex(Pt=>Pt.id===T.id),ot=[...N];return ke>=0?ot.splice(ke,1,T):ot.push(T),{...y,[b]:ot}}async function dr(){V.value=await kS()}async function Ka(){let y=j.value,b=W.value;Te.value=!0,de.value="",ie.value="";try{if(Hn(),ne.value&&le.value==="create"&&(Ce.value==="thread"?(y=be.value,b="",R.value="thread",j.value=y,W.value=""):(b=be.value,y="",R.value="project",j.value="",W.value=b)),R.value==="thread"&&!y)throw new Error(r("Select a chat target for this automation"));if(R.value==="project"&&!b)throw new Error(r("Select a project target for this automation"));const T={id:ce.value||void 0,name:Fe.value.name,prompt:Fe.value.prompt,rrule:Fe.value.rrule,status:Fe.value.status},N=R.value==="project"?await SS({...T,projectName:b}):await CS({...T,threadId:y});R.value==="project"?await dr():te.value=Ft(te.value,y,N),s("automations-changed"),ur(N.id),ie.value=r("Automation saved."),Te.value=!1}catch(T){de.value=T instanceof Error?T.message:r("Failed to save automation"),Te.value=!1}}async function fr(){const y=j.value,b=W.value,T=ce.value;if(T&&!(R.value==="thread"&&!y)&&!(R.value==="project"&&!b)){Te.value=!0,de.value="",ie.value="";try{R.value==="project"?(await tm(b,T),await dr()):(await em(y,T),te.value=Ga(te.value,y,T));const N=bt.value[0];N?ur(N.id):Xr(),s("automations-changed"),Te.value=!1}catch(N){de.value=N instanceof Error?N.message:r("Failed to remove automation"),Te.value=!1}}}async function Ss(){const y=j.value,b=ce.value;if(!(!y||!b)){Be.value=!0,de.value="",ie.value="";try{await _S(y,b),ie.value=r("Automation run queued.")}catch(T){de.value=T instanceof Error?T.message:r("Failed to run automation")}finally{Be.value=!1}}}function Vn(y){return o.projectDisplayNameById[y]??y}t({openAutomationEditorFromPanel:bl,openAutomationCreatorFromPanel:ai,openRenameThreadDialog:on,openRecycleBin:U});function $r(y){return y.includes("/")||y.includes("\\")}function _s(y){return $r(y)?y:Vn(y)}function xs(y){const b=Tr(y);if(!b)return!1;let T=0;for(const N of o.groups)if($r(N.projectName)&&Tr(N.projectName)===b&&(T+=1,T>1))return!0;return!1}function ii(y){const b=o.projectDisplayNameById[y.projectName],T=Vn(y.projectName),N=y.projectName;if(b&&!$r(N)&&N!==T)return T.includes(N)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(N)?T:`${T} ${N}`;if(b&&$r(N)){const Pt=Tr(N),Mo=Tr(ll(N)),Qt=xs(N)?Mo:Pt;return Qt&&Qt!==T?`${T} ${Qt}`:T}if(!T.includes("/")&&!T.includes("\\"))return T;const ke=Tr(T)||T,ot=Tr(ll(T));return ot.startsWith(".")&&ot!==ke?`${ke} ${ot}`:y.threads.length>0||!xs(N)?ke:ot?`${ke} ${ot}`:ke}function Di(y){return _e.value===y}function Fn(){_e.value="",ft.value="actions",at.value=""}function li(){const y=!un.value;y&&(Fn(),Ve()),un.value=y}function As(y){jn.value=y,un.value=!1}function ka(){ve.value=!ve.value}function Ya(y){je.value=y}function Fi(y){s("request-project-git-status",y),Gt(()=>{xa(y)})}function Bi(y){if(_e.value===y){Fn();return}Ve(),un.value=!1,_e.value=y,ft.value="actions",at.value=Vn(y),Fi(y)}function Ui(y){Ve(),un.value=!1,_e.value=y,ft.value="actions",at.value=Vn(y),Fi(y)}function Ca(y){return o.projectDisplayNameById[y.projectName]??ii(y)}function pr(y){Ve();const b=y.projectName;_e.value=b,ft.value="rename",at.value=Ca(y),Gt(()=>{xa(b)})}function eo(y){s("browse-project-files",y),Fn()}function Ro(y){s("save-project",y),Fn()}function Sa(y){s("create-project-worktree",y),Fn()}function jr(y){s("rename-project",{projectName:y,displayName:at.value})}function _a(y){const b=Vo(y);if(s("remove-project",y),b&&Ct(y)){Ge.value="";const T=V.value;V.value=Ta(V.value,b),tm(b).then(dr).catch(async N=>{V.value=T;const ke=N instanceof Error?N.message:r("Failed to delete project automation");Ge.value=ke,a(ke);try{await dr()}catch{V.value=T}}).finally(()=>{s("automations-changed")})}Fn()}function Vo(y){var T;const b=((T=o.projectCwdByName[y])==null?void 0:T.trim())??"";return LS(b)?b:""}function Ja(y,b){if(!y.altKey||y.key!=="ArrowUp"&&y.key!=="ArrowDown")return;const T=o.groups.findIndex(ot=>ot.projectName===b);if(T<0)return;const N=y.key==="ArrowUp"?-1:1,ke=Math.max(0,Math.min(T+N,o.groups.length-1));ke!==T&&(y.preventDefault(),s("reorder-project",{projectName:b,toIndex:ke}))}function hr(y){return ue.value[y]===!0}function mo(y){return F.value[y]===!0}function Lr(y){ue.value={...ue.value,[y]:!hr(y)}}function Zr(){we.value=!we.value}function mr(y){if(Lt.value===y){Lt.value="";return}F.value={...F.value,[y]:!mo(y)}}function vr(y){const b=kn.value[y]??0,T=We.value,ke=((T==null?void 0:T.projectName)===y?T.groupHeight:null)??b,ot=mo(y)?0:Rm;return Math.max(0,ke+ot)}function Qa(y,b){const T=b instanceof HTMLElement?b:b&&"$el"in b&&b.$el instanceof HTMLElement?b.$el:null;if(T){tr.set(y,T);return}tr.delete(y)}function gr(y,b){const T=b instanceof HTMLElement?b:b&&"$el"in b&&b.$el instanceof HTMLElement?b.$el:null;if(T){lo.set(y,T);return}lo.delete(y)}function Is(y){let b=y.parentElement;for(;b;){const T=window.getComputedStyle(b),N=T.overflowY||T.overflow;if(N==="auto"||N==="scroll"||N==="hidden"||N==="clip")return b.getBoundingClientRect();b=b.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function Xa(y,b){const T=y.getBoundingClientRect(),N=Is(y),ke=6,ot=N.bottom-T.bottom,Pt=T.top-N.top;return ot>=b+ke?"down":Pt>ot?"up":"down"}function ea(y,b){const T=lo.get(y);if(!T)return"down";const N=Xa(T,b);return Le.value={...Le.value,[y]:N},N}function Tl(y){return Le.value[y]??"down"}function xa(y){const b=tr.get(y);if(!b)return;const T=b.querySelector(".project-menu-panel"),N=(T==null?void 0:T.getBoundingClientRect().height)??0;Ue.value={...Ue.value,[y]:Xa(b,N)}}function Bn(y,b,T){return Math.min(Math.max(y,b),T)}function Go(y){const b=lo.get(y);if(!b)return;const T=nr.value,N=T==null?void 0:T.getBoundingClientRect(),ke=(N==null?void 0:N.height)||(T==null?void 0:T.offsetHeight)||112,ot=(N==null?void 0:N.width)||(T==null?void 0:T.offsetWidth)||160,Pt=ea(y,ke),Mo=b.getBoundingClientRect(),Qt=8,qn=4,Xt=Math.max(Qt,window.innerWidth-ot-Qt),to=Bn(Mo.right-ot,Qt,Xt),ja=Bn(Pt==="up"?Mo.top-ke-qn:Mo.bottom+qn,Qt,Math.max(Qt,window.innerHeight-ke-Qt));gt.value={left:`${Math.round(to)}px`,top:`${Math.round(ja)}px`}}function vo(){const y=Pe.value;y&&Go(y)}function Ko(){window.addEventListener("resize",vo),document.addEventListener("scroll",vo,!0)}function Un(){window.removeEventListener("resize",vo),document.removeEventListener("scroll",vo,!0)}function Za(y){const b=_e.value;if(!b)return!1;const T=tr.get(b);if(!T)return!1;if((typeof y.composedPath=="function"?y.composedPath():[]).includes(T))return!0;const ke=y.target;return ke instanceof Node?T.contains(ke):!1}function Aa(y){const b=Pe.value;if(!b)return!1;const T=lo.get(b);if(!T)return!1;const N=typeof y.composedPath=="function"?y.composedPath():[];if(N.includes(T))return!0;const ke=nr.value;if(ke&&N.includes(ke))return!0;const ot=y.target;return ot instanceof Node?!!(T.contains(ot)||ke&&ke.contains(ot)):!1}function Nr(y){if(un.value){const b=Kr.value,T=typeof y.composedPath=="function"?y.composedPath():[];!!b&&(T.includes(b)||y.target instanceof Node&&b.contains(y.target))||(un.value=!1)}_e.value&&(Za(y)||Fn(),Pe.value&&(Aa(y)||Ve()))}function ci(y){_e.value&&!Za(y)&&Fn(),Pe.value&&!Aa(y)&&Ve()}function Or(){un.value&&(un.value=!1),_e.value&&Fn(),Pe.value&&Ve()}function Yo(){window.addEventListener("pointerdown",Nr,{capture:!0}),window.addEventListener("focusin",ci,{capture:!0}),window.addEventListener("blur",Or)}function yr(){window.removeEventListener("pointerdown",Nr,{capture:!0}),window.removeEventListener("focusin",ci,{capture:!0}),window.removeEventListener("blur",Or)}function wn(y,b){const T=b.getBoundingClientRect().height;if(!Number.isFinite(T)||T<=0)return;const N=kn.value[y];N!==void 0&&Math.abs(N-T)<.5||(kn.value={...kn.value,[y]:T})}function Ia(y,b){const T=Fo.get(y);T&&T!==b&&Pn&&Pn.unobserve(T);const N=b instanceof HTMLElement?b:b&&"$el"in b&&b.$el instanceof HTMLElement?b.$el:null;if(N){Fo.set(y,N),It.set(N,y),wn(y,N),Pn==null||Pn.observe(N);return}T&&(Pn==null||Pn.unobserve(T)),Fo.delete(y)}function Pa(y,b){if(y.button!==0||hn.value||Ne.value||We.value)return;const T=o.groups.findIndex(Pt=>Pt.projectName===b),N=Fo.get(b);if(T<0||!N)return;const ke=N.getBoundingClientRect(),ot=mo(b)?0:Rm;Ne.value={projectName:b,fromIndex:T,startClientX:y.clientX,startClientY:y.clientY,pointerOffsetY:y.clientY-ke.top,groupLeft:ke.left,groupWidth:ke.width,groupHeight:ke.height,groupOuterHeight:ke.height+ot},y.preventDefault(),ta()}function ta(){window.addEventListener("mousemove",na),window.addEventListener("mouseup",Eo),window.addEventListener("keydown",Ea)}function Ra(){window.removeEventListener("mousemove",na),window.removeEventListener("mouseup",Eo),window.removeEventListener("keydown",Ea)}function na(y){Xe={clientX:y.clientX,clientY:y.clientY},kl()}function Eo(y){Ma({clientX:y.clientX,clientY:y.clientY});const b=We.value;if(b&&xo.value!==null){const T=o.groups.findIndex(N=>N.projectName===b.projectName);if(T>=0){const N=xo.value;N!==T&&s("reorder-project",{projectName:b.projectName,toIndex:N})}}Ps({preserveToggleSuppression:!!b})}function Ea(y){y.key==="Escape"&&(!Ne.value&&!We.value||(y.preventDefault(),Ps()))}function Ps(y={}){$t!==null&&(window.cancelAnimationFrame($t),$t=null),Xe=null,Ne.value=null,We.value=null,y.preserveToggleSuppression||(Lt.value=""),Ra()}function kl(){$t===null&&($t=window.requestAnimationFrame(()=>{if($t=null,!Xe)return;const y=Xe;Xe=null,Ma(y)}))}function Ma(y){const b=Ne.value;if(!We.value&&b){const T=y.clientX-b.startClientX,N=y.clientY-b.startClientY;if(Math.hypot(T,N)<kP)return;Fn(),Lt.value=b.projectName,We.value={projectName:b.projectName,fromIndex:b.fromIndex,pointerOffsetY:b.pointerOffsetY,groupLeft:b.groupLeft,groupWidth:b.groupWidth,groupHeight:b.groupHeight,groupOuterHeight:b.groupOuterHeight,ghostTop:y.clientY-b.pointerOffsetY,dropTargetIndexFull:null}}We.value&&$a(y)}function $a(y){const b=We.value;if(!b)return;if(b.ghostTop=y.clientY-b.pointerOffsetY,!wr(y)){b.dropTargetIndexFull=null;return}const T=y.clientY,N=pe.value;if(!N){b.dropTargetIndexFull=null;return}const ke=N.getBoundingClientRect(),ot=new Map(o.groups.map((qn,Xt)=>[qn.projectName,Xt])),Pt=o.groups.map(qn=>qn.projectName).filter(qn=>qn!==b.projectName);let Mo=0,Qt=o.groups.length;for(const qn of Pt){const Xt=ot.get(qn);if(Xt===void 0)continue;const to=vr(qn),ja=ke.top+Mo+to/2;if(T<ja){Qt=Xt;break}Mo+=to}b.dropTargetIndexFull=Qt}function wr(y){const b=pe.value;if(!b)return!1;const T=b.getBoundingClientRect(),N=y.clientX>=T.left&&y.clientX<=T.right,ke=y.clientY>=T.top-32&&y.clientY<=T.bottom+32;return N&&ke}function go(y){var b;return((b=We.value)==null?void 0:b.projectName)===y}function Gn(y){const b=We.value,T=Ao.value[y]??0,N=Pe.value?uo.value.get(Pe.value)??"":"",ke=_e.value===y||N===y;return!b||b.projectName!==y?{position:"absolute",top:"0",left:"0",right:"0",zIndex:ke?"40":"1",transform:`translate3d(0, ${T}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${b.groupLeft}px`,width:`${b.groupWidth}px`,height:`${b.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${b.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function es(y){return Uo.value.get(y.projectName)??[]}function ui(y){if(hn.value)return es(y);if(mo(y.projectName))return[];const b=es(y);return hr(y.projectName)?b:b.slice(0,10)}function Bt(y){return hn.value?!1:!mo(y.projectName)&&es(y).length>10}function Xn(y){return es(y).length>0}function bn(y){var b;return!!y.pendingRequestState||y.inProgress||y.unread||((b=y.externalSession)==null?void 0:b.active)===!0}function Rs(y){return y.pendingRequestState==="approval"?r("Awaiting approval"):r("Awaiting response")}function Jo(y){var b;return((b=y.externalSession)==null?void 0:b.active)===!0?"external":y.pendingRequestState==="approval"?"awaiting-approval":y.pendingRequestState==="response"?"awaiting-response":y.inProgress?"working":y.unread?"unread":"idle"}tt(()=>o.groups.map(y=>y.projectName),y=>{var ke,ot;const b=((ke=We.value)==null?void 0:ke.projectName)??((ot=Ne.value)==null?void 0:ot.projectName)??"";b&&!o.groups.some(Pt=>Pt.projectName===b)&&Ps();const T=new Set(y),N=Object.fromEntries(Object.entries(kn.value).filter(([Pt])=>T.has(Pt)));Object.keys(N).length!==Object.keys(kn.value).length&&(kn.value=N)}),tt(()=>{const y=_e.value;return y?o.projectGitRepoByName[y]:void 0},()=>{const y=_e.value;y&&Gt(()=>{_e.value===y&&xa(y)})});const ts=X(()=>un.value||_e.value!==""||Pe.value!=="");return tt(ts,y=>{if(y){Yo();return}yr()}),tt(Pe,y=>{if(!y){Un();return}Ko(),Gt(()=>{Go(y)})}),Ni(()=>{for(const y of Fo.values())Pn==null||Pn.unobserve(y);Fo.clear(),tr.clear(),Un(),yr(),Ps()}),(y,b)=>(C(),I("section",{class:Ye(["thread-tree-root",{"chats-first":ve.value}])},[Ot.value.length>0?(C(),I("section",LA,[Me(zs,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":H.value,onClick:Zn},{left:mt(()=>[H.value?(C(),Ze(Js,{key:1,class:"thread-icon"})):(C(),Ze(Hc,{key:0,class:"thread-icon"}))]),default:mt(()=>[f("span",NA,k(v(r)("Pinned")),1)]),_:1},8,["aria-expanded"]),H.value?(C(),I("ul",OA,[(C(!0),I(qe,null,At(Ot.value,T=>(C(),Ze(Wc,{key:T.id,thread:T,selected:T.id===e.selectedThreadId,pinned:Io(T.id),"menu-open":Ee(T.id),"show-status-indicator":bn(T),"thread-state":Jo(T),"inline-delete-confirming":Mr(T.id),"automation-count":nn(T.id),"automation-tooltip":zo(T.id),"request-label":Rs(T),"relative-time":Pr(T),"delete-label":v(r)("Delete thread"),"confirm-delete-label":v(r)("Confirm delete"),"confirm-label":v(r)("Confirm"),"worktree-label":v(r)("Worktree thread"),"set-menu-wrap-ref":N=>gr(T.id,N),onSelect:N=>sr(T.id),onInlineDelete:N=>Wn(T.id),onMenuToggle:N=>Dt(T.id),onRowLeave:N=>oe(T.id,N),onRowContextmenu:N=>yn(N,T.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))])):Z("",!0)])):Z("",!0),f("section",DA,[Me(zs,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":q.value,onClick:_o},{left:mt(()=>[q.value?(C(),Ze(Js,{key:1,class:"thread-icon"})):(C(),Ze(Hc,{key:0,class:"thread-icon"}))]),right:mt(()=>[f("div",{ref_key:"organizeMenuWrapRef",ref:Kr,class:"organize-menu-wrap"},[f("button",{class:"organize-menu-trigger",type:"button","aria-expanded":un.value,"aria-label":v(r)("Organize threads"),title:v(r)("Organize threads"),onClick:st(li,["stop"])},[Me(hf,{class:"thread-icon"})],8,BA),un.value?(C(),I("div",{key:0,class:"organize-menu-panel",onClick:b[4]||(b[4]=st(()=>{},["stop"]))},[f("p",UA,k(v(r)("Organize")),1),f("button",{class:"organize-menu-item","data-active":jn.value==="project",type:"button",onClick:b[0]||(b[0]=T=>As("project"))},[f("span",null,k(v(r)("By project")),1),jn.value==="project"?(C(),I("span",zA,"✓")):Z("",!0)],8,qA),f("button",{class:"organize-menu-item","data-active":jn.value==="chronological",type:"button",onClick:b[1]||(b[1]=T=>As("chronological"))},[f("span",null,k(v(r)("Chronological list")),1),jn.value==="chronological"?(C(),I("span",WA,"✓")):Z("",!0)],8,HA),f("button",{class:"organize-menu-item","data-active":ve.value,type:"button",onClick:ka},[f("span",null,k(v(r)("Chats first")),1),ve.value?(C(),I("span",GA,"✓")):Z("",!0)],8,VA),b[31]||(b[31]=f("div",{class:"organize-menu-separator"},null,-1)),f("p",KA,k(v(r)("Sort by")),1),f("button",{class:"organize-menu-item","data-active":je.value==="created",type:"button",onClick:b[2]||(b[2]=T=>Ya("created"))},[f("span",null,k(v(r)("Created")),1),je.value==="created"?(C(),I("span",JA,"✓")):Z("",!0)],8,YA),f("button",{class:"organize-menu-item","data-active":je.value==="updated",type:"button",onClick:b[3]||(b[3]=T=>Ya("updated"))},[f("span",null,k(v(r)("Updated")),1),je.value==="updated"?(C(),I("span",XA,"✓")):Z("",!0)],8,QA),b[32]||(b[32]=f("div",{class:"organize-menu-separator"},null,-1)),f("button",{class:"organize-menu-item",type:"button",onClick:U},[f("span",null,k(v(r)("Recycle bin")),1)])])):Z("",!0)],512)]),default:mt(()=>[f("span",FA,k(v(r)("Projects")),1)]),_:1},8,["aria-expanded"]),q.value?(C(),I(qe,{key:0},[Ge.value?(C(),I("p",ZA,k(Ge.value),1)):Z("",!0),hn.value&&wa.value.length===0?(C(),I("p",eI,k(v(r)("No matching threads")),1)):e.isLoading&&e.groups.length===0?(C(),I("p",tI,k(v(r)("Loading threads...")),1)):_r.value?(C(),I("ul",nI,[(C(!0),I(qe,null,At(tn.value,T=>(C(),Ze(Wc,{key:T.id,thread:T,selected:T.id===e.selectedThreadId,pinned:Io(T.id),"menu-open":Ee(T.id),"show-status-indicator":bn(T),"thread-state":Jo(T),"inline-delete-confirming":Mr(T.id),"automation-count":nn(T.id),"automation-tooltip":zo(T.id),"request-label":Rs(T),"relative-time":Pr(T),"delete-label":v(r)("Delete thread"),"confirm-delete-label":v(r)("Confirm delete"),"confirm-label":v(r)("Confirm"),"worktree-label":v(r)("Worktree thread"),"set-menu-wrap-ref":N=>gr(T.id,N),onSelect:N=>sr(T.id),onInlineDelete:N=>Wn(T.id),onMenuToggle:N=>Dt(T.id),onRowLeave:N=>oe(T.id,N),onRowContextmenu:N=>yn(N,T.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))])):(C(),I("div",{key:4,ref_key:"groupsContainerRef",ref:pe,class:"thread-tree-groups",style:kr(qo.value)},[(C(!0),I(qe,null,At(wa.value,T=>(C(),I("article",{key:T.projectName,ref_for:!0,ref:N=>Ia(T.projectName,N),class:"project-group","data-project-name":T.projectName,"data-expanded":!mo(T.projectName),"data-dragging":go(T.projectName),style:kr(Gn(T.projectName))},[Me(zs,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:N=>mr(T.projectName),onContextmenu:st(N=>Ui(T.projectName),["prevent"]),onKeydown:[N=>Ja(N,T.projectName),xn(st(N=>mr(T.projectName),["prevent"]),["enter"]),xn(st(N=>mr(T.projectName),["prevent"]),["space"])]},{left:mt(()=>[f("span",rI,[f("span",aI,[mo(T.projectName)?(C(),Ze(Xf,{key:0,class:"thread-icon"})):(C(),Ze(S1,{key:1,class:"thread-icon"}))]),f("span",sI,[mo(T.projectName)?(C(),Ze(Hc,{key:0,class:"thread-icon"})):(C(),Ze(Js,{key:1,class:"thread-icon"}))])])]),right:mt(()=>[f("div",dI,[f("div",{ref_for:!0,ref:N=>Qa(T.projectName,N),class:"project-menu-wrap"},[f("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:st(N=>Bi(T.projectName),["stop"])},[Me(hf,{class:"thread-icon"})],8,fI),Di(T.projectName)?(C(),I("div",{key:0,class:"project-menu-panel","data-open-direction":Ue.value[T.projectName]??"down",onClick:b[6]||(b[6]=st(()=>{},["stop"]))},[ft.value==="actions"?(C(),I(qe,{key:0},[f("button",{class:"project-menu-item",type:"button",onClick:N=>eo(T.projectName)},k(v(r)("Browse files")),9,hI),f("button",{class:"project-menu-item",type:"button",onClick:N=>Ro(T.projectName)},k(v(r)("Export Project")),9,mI),f("button",{class:"project-menu-item",type:"button",onClick:N=>ri(T.projectName)},k(Ct(T.projectName)?v(r)("Manage automations…"):v(r)("Add automation…")),9,vI),e.projectGitRepoByName[T.projectName]?(C(),I("button",{key:0,class:"project-menu-item",type:"button",onClick:N=>Sa(T.projectName)},k(v(r)("New worktree")),9,gI)):Z("",!0),f("button",{class:"project-menu-item",type:"button",onClick:N=>pr(T)},k(v(r)("Rename project")),9,yI),f("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:N=>_a(T.projectName)},k(v(r)("Remove")),9,wI)],64)):(C(),I(qe,{key:1},[f("label",bI,k(v(r)("Project name")),1),Nt(f("input",{"onUpdate:modelValue":b[5]||(b[5]=N=>at.value=N),class:"project-menu-input",type:"text",onInput:N=>jr(T.projectName)},null,40,TI),[[sn,at.value]])],64))],8,pI)):Z("",!0)],512),f("button",{class:"thread-start-button",type:"button","aria-label":ho(T.projectName),title:ho(T.projectName),onClick:st(N=>Er(T.projectName),["stop"])},[Me(Li,{class:"thread-icon"})],8,kI)])]),default:mt(()=>[f("span",{class:"project-main-button","data-dragging-handle":go(T.projectName),onMousedown:st(N=>Pa(N,T.projectName),["left"])},[f("span",{class:"project-title",title:_s(T.projectName)},k(ii(T)),9,lI),Ct(T.projectName)?(C(),I("span",{key:0,class:"thread-row-automation-chip",title:fo(T.projectName)},[Me(Gs,{class:"thread-row-automation-icon"}),Nn(T.projectName)>1?(C(),I("span",uI,k(Nn(T.projectName)),1)):Z("",!0)],8,cI)):Z("",!0)],40,iI)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),Xn(T)?(C(),I("ul",CI,[(C(!0),I(qe,null,At(ui(T),N=>(C(),Ze(Wc,{key:N.id,thread:N,selected:N.id===e.selectedThreadId,pinned:Io(N.id),"menu-open":Ee(N.id),"show-status-indicator":bn(N),"thread-state":Jo(N),"inline-delete-confirming":Mr(N.id),"automation-count":nn(N.id),"automation-tooltip":zo(N.id),"request-label":Rs(N),"relative-time":Pr(N),"delete-label":v(r)("Delete thread"),"confirm-delete-label":v(r)("Confirm delete"),"confirm-label":v(r)("Confirm"),"worktree-label":v(r)("Worktree thread"),"set-menu-wrap-ref":ke=>gr(N.id,ke),onSelect:ke=>sr(N.id),onInlineDelete:ke=>Wn(N.id),onMenuToggle:ke=>Dt(N.id),onRowLeave:ke=>oe(N.id,ke),onRowContextmenu:ke=>yn(ke,N.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))])):(C(),Ze(zs,{key:1,as:"p",class:"project-empty-row"},{left:mt(()=>[...b[33]||(b[33]=[f("span",{class:"project-empty-spacer"},null,-1)])]),default:mt(()=>[f("span",SI,k(v(r)("No threads")),1)]),_:1})),Bt(T)?(C(),Ze(zs,{key:2,class:"thread-show-more-row"},{left:mt(()=>[...b[34]||(b[34]=[f("span",{class:"thread-show-more-spacer"},null,-1)])]),default:mt(()=>[f("button",{class:"thread-show-more-button",type:"button",onClick:N=>Lr(T.projectName)},k(hr(T.projectName)?"Show less":"Show more"),9,_I)]),_:2},1024)):Z("",!0)],12,oI))),128))],4))],64)):Z("",!0)]),f("section",xI,[Me(zs,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":me.value,onClick:Ir},{left:mt(()=>[me.value?(C(),Ze(Js,{key:1,class:"thread-icon"})):(C(),Ze(Hc,{key:0,class:"thread-icon"}))]),right:mt(()=>[f("div",II,[f("button",{class:"chats-section-action",type:"button","aria-label":v(r)("New chat"),title:v(r)("New chat"),onClick:b[7]||(b[7]=st(T=>y.$emit("start-new-chat"),["stop"]))},[Me(Li,{class:"thread-icon"})],8,PI)])]),default:mt(()=>[f("span",AI,k(v(r)("Chats")),1)]),_:1},8,["aria-expanded"]),me.value&&Sn.value.length===0?(C(),I("p",RI,k(v(r)("No chats")),1)):me.value?(C(),I("ul",EI,[(C(!0),I(qe,null,At(mn.value,T=>(C(),Ze(Wc,{key:T.id,thread:T,selected:T.id===e.selectedThreadId,pinned:Io(T.id),"menu-open":Ee(T.id),"show-status-indicator":bn(T),"thread-state":Jo(T),"inline-delete-confirming":Mr(T.id),"automation-count":nn(T.id),"automation-tooltip":zo(T.id),"request-label":Rs(T),"relative-time":Pr(T),"delete-label":v(r)("Delete thread"),"confirm-delete-label":v(r)("Confirm delete"),"confirm-label":v(r)("Confirm"),"worktree-label":v(r)("Worktree thread"),"set-menu-wrap-ref":N=>gr(T.id,N),onSelect:N=>sr(T.id),onInlineDelete:N=>Wn(T.id),onMenuToggle:N=>Dt(T.id),onRowLeave:N=>oe(T.id,N),onRowContextmenu:N=>yn(N,T.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))])):Z("",!0),me.value&&xr.value?(C(),Ze(zs,{key:2,class:"thread-show-more-row"},{left:mt(()=>[...b[35]||(b[35]=[f("span",{class:"thread-show-more-spacer"},null,-1)])]),default:mt(()=>[f("button",{class:"thread-show-more-button",type:"button",onClick:Zr},k(we.value?"Show less":"Show more"),1)]),_:1})):Z("",!0)]),(C(),Ze(Qs,{to:"body"},[kt.value?(C(),I("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:nr,class:"thread-menu-panel thread-menu-panel-fixed",style:kr(gt.value),"data-open-direction":Tl(kt.value.id),onClick:b[17]||(b[17]=st(()=>{},["stop"]))},[f("button",{class:"thread-menu-item",type:"button",onClick:b[8]||(b[8]=T=>On(kt.value.id))},k(Jr(kt.value.id)?v(r)("Manage automations…"):v(r)("Add automation…")),1),f("button",{class:"thread-menu-item",type:"button",onClick:b[9]||(b[9]=T=>cr(kt.value.id))},k(v(r)("Browse files")),1),f("button",{class:"thread-menu-item",type:"button",onClick:b[10]||(b[10]=T=>E(kt.value.id))},k(v(r)("Export Project")),1),f("button",{class:"thread-menu-item",type:"button",onClick:b[11]||(b[11]=T=>O(kt.value.id))},k(v(r)("Copy path")),1),f("button",{class:"thread-menu-item",type:"button",disabled:kt.value.id!==e.selectedThreadId,title:kt.value.id===e.selectedThreadId?v(r)("Copy chat"):v(r)("Open this chat before copying"),onClick:b[12]||(b[12]=T=>Ho(kt.value.id))},k(v(r)("Copy chat")),9,$I),f("button",{class:"thread-menu-item",type:"button",onClick:b[13]||(b[13]=T=>lr(kt.value.id))},k(v(r)("Create chat fork")),1),f("button",{class:"thread-menu-item",type:"button",onClick:b[14]||(b[14]=T=>ba(kt.value.id))},k(Io(kt.value.id)?v(r)("Unpin thread"):v(r)("Pin thread")),1),f("button",{class:"thread-menu-item",type:"button",onClick:b[15]||(b[15]=T=>on(kt.value.id,kt.value.title))},k(v(r)("Rename thread")),1),f("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:b[16]||(b[16]=T=>Po(kt.value.id,kt.value.title))},k(v(r)("Delete thread")),1)],12,MI)):Z("",!0)])),Me(Dd,{open:it.value,title:v(r)("Rename thread"),subtitle:v(r)("Make it short and recognizable."),onClose:Ht},{footer:mt(()=>[f("button",{class:"rename-thread-button",type:"button",onClick:Ht},k(v(r)("Cancel")),1),f("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Qr},k(v(r)("Save")),1)]),default:mt(()=>[Nt(f("input",{ref_key:"renameThreadInputRef",ref:Qe,"onUpdate:modelValue":b[18]||(b[18]=T=>St.value=T),class:"rename-thread-input",type:"text",placeholder:v(r)("Add title..."),onKeydown:xn(st(Qr,["prevent"]),["enter"])},null,40,jI),[[sn,St.value]])]),_:1},8,["open","title","subtitle"]),Me(Dd,{open:et.value,title:rr.value?v(r)("Archive chat and remove automations?"):v(r)("Delete thread?"),subtitle:Ar.value,onClose:dn},{footer:mt(()=>[f("button",{class:"rename-thread-button",type:"button",onClick:dn},k(v(r)("Cancel")),1),f("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:oi},k(rr.value?v(r)("Archive and remove"):v(r)("Delete")),1)]),_:1},8,["open","title","subtitle"]),Me(Dd,{open:w.value,title:v(r)("Recycle bin"),subtitle:v(r)("Threads you removed are kept here so you can restore them."),size:"md",onClose:b[19]||(b[19]=T=>w.value=!1)},{default:mt(()=>[v(i).length===0?(C(),I("div",LI,k(v(r)("Recycle bin is empty.")),1)):(C(),I("ul",NI,[(C(!0),I(qe,null,At(v(i),T=>(C(),I("li",{key:T.id,class:"recycle-bin-item"},[f("div",OI,[f("span",DI,k(T.title),1),T.projectName?(C(),I("span",FI,k(T.projectName),1)):Z("",!0),f("span",BI,k(ni(T.archivedAtIso)),1)]),f("div",UI,[f("button",{class:"recycle-bin-button recycle-bin-button-primary",type:"button",disabled:M.value===T.id,onClick:N=>Y(T.id)},k(M.value===T.id?v(r)("Restoring…"):v(r)("Restore")),9,qI),f("button",{class:"recycle-bin-button recycle-bin-button-danger",type:"button",onClick:N=>v(p)(T.id)},k(v(r)("Delete permanently")),9,zI)])]))),128))])),A.value?(C(),I("p",HI,k(A.value),1)):Z("",!0)]),_:1},8,["open","title","subtitle"]),(C(),Ze(Qs,{to:"body"},[$e.value?(C(),I("div",{key:0,class:"rename-thread-overlay",onClick:st(Qn,["self"])},[f("div",{class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":R.value==="project"?v(r)("Project automation"):v(r)("Thread automation")},[f("h3",VI,k(le.value==="edit"?v(r)("Edit automation"):v(r)("Add automation")),1),f("p",GI,k(pt.value),1),ne.value&&le.value==="create"?(C(),I("div",KI,[b[36]||(b[36]=f("span",{class:"automation-thread-label"},"Target",-1)),f("div",YI,[f("button",{class:Ye(["automation-target-mode",{"is-active":Ce.value==="thread"}]),type:"button",onClick:b[20]||(b[20]=T=>Dn("thread"))}," Existing chat ",2),f("button",{class:Ye(["automation-target-mode",{"is-active":Ce.value==="project"}]),type:"button",onClick:b[21]||(b[21]=T=>Dn("project"))}," Project ",2)]),f("div",JI,[Me(Zo,{modelValue:be.value,"onUpdate:modelValue":b[22]||(b[22]=T=>be.value=T),class:"automation-thread-dropdown",options:z.value,placeholder:Ce.value==="project"?"Select project":"Select chat","enable-search":"","search-placeholder":Ce.value==="project"?"Search projects":"Search chats"},null,8,["modelValue","options","placeholder","search-placeholder"])])])):Z("",!0),bt.value.length>0?(C(),I("div",{key:1,class:"automation-thread-list","aria-label":R.value==="project"?"Project automations":"Thread automations"},[(C(!0),I(qe,null,At(bt.value,T=>(C(),I("button",{key:T.id,class:Ye(["automation-thread-list-item",{"is-active":T.id===ce.value}]),type:"button",onClick:N=>ur(T.id)},[f("span",null,k(T.name),1),f("small",null,k(T.status==="PAUSED"?"Paused":"Active"),1)],10,XI))),128)),f("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:Xr},k(v(r)("Add another automation")),1)],8,QI)):Z("",!0),f("label",ZI,[f("span",eP,k(v(r)("Name")),1),Nt(f("input",{"onUpdate:modelValue":b[23]||(b[23]=T=>Fe.value.name=T),class:"rename-thread-input",type:"text",placeholder:v(r)("Automation name")},null,8,tP),[[sn,Fe.value.name]])]),f("label",nP,[f("span",oP,k(v(r)("Prompt")),1),Nt(f("textarea",{"onUpdate:modelValue":b[24]||(b[24]=T=>Fe.value.prompt=T),class:"automation-thread-textarea",rows:"6",placeholder:v(r)("Describe what the automation should do")},null,8,rP),[[sn,Fe.value.prompt]])]),f("div",aP,[f("span",sP,k(v(r)("Schedule")),1),f("div",iP,[f("button",{class:Ye(["automation-schedule-mode",{"is-active":ze.value.mode==="daily"}]),type:"button",onClick:b[25]||(b[25]=T=>ir("daily"))},k(v(r)("Daily")),3),f("button",{class:Ye(["automation-schedule-mode",{"is-active":ze.value.mode==="interval"}]),type:"button",onClick:b[26]||(b[26]=T=>ir("interval"))},k(v(r)("Interval")),3),f("button",{class:Ye(["automation-schedule-mode",{"is-active":ze.value.mode==="advanced"}]),type:"button",onClick:b[27]||(b[27]=T=>ir("advanced"))}," RRULE ",2)]),ze.value.mode==="daily"?(C(),I("div",lP,[f("span",cP,k(v(r)("Run every day at")),1),Nt(f("input",{"onUpdate:modelValue":b[28]||(b[28]=T=>ze.value.dailyTime=T),class:"automation-schedule-time",type:"time",onInput:Hn},null,544),[[sn,ze.value.dailyTime]])])):ze.value.mode==="interval"?(C(),I("div",uP,[f("span",dP,k(v(r)("Run every")),1),Nt(f("input",{"onUpdate:modelValue":b[29]||(b[29]=T=>ze.value.interval=T),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:Hn},null,544),[[sn,ze.value.interval,void 0,{number:!0}]]),Me(Zo,{class:"automation-schedule-unit-dropdown","model-value":ze.value.intervalUnit,options:G,placeholder:v(r)("Unit"),"onUpdate:modelValue":Wa},null,8,["model-value","placeholder"])])):Z("",!0),ze.value.mode==="advanced"?Nt((C(),I("input",{key:2,"onUpdate:modelValue":b[30]||(b[30]=T=>Fe.value.rrule=T),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:Va},null,544)),[[sn,Fe.value.rrule]]):Z("",!0),f("p",fP,k(dt.value),1)]),f("div",pP,[f("span",hP,k(v(r)("Status")),1),Me(Zo,{class:"automation-thread-dropdown","model-value":Fe.value.status,options:K.value,placeholder:v(r)("Status"),"onUpdate:modelValue":Rr},null,8,["model-value","options","placeholder"])]),de.value?(C(),I("p",mP,k(de.value),1)):ie.value?(C(),I("p",vP,k(ie.value),1)):Z("",!0),f("div",gP,[le.value==="edit"&&R.value==="thread"?(C(),I("button",{key:0,class:"rename-thread-button",type:"button",disabled:Te.value||Be.value,onClick:Ss},k(Be.value?v(r)("Running…"):v(r)("Run now")),9,yP)):Z("",!0),le.value==="edit"?(C(),I("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:Te.value||Be.value,onClick:fr},k(v(r)("Remove")),9,wP)):Z("",!0),f("button",{class:"rename-thread-button",type:"button",disabled:Te.value||Be.value,onClick:Qn},k(v(r)("Cancel")),9,bP),f("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:Te.value||Be.value,onClick:Ka},k(Te.value?v(r)("Saving…"):v(r)("Save")),9,TP)])],8,WI)])):Z("",!0)]))],2))}}),SP=yt(CP,[["__scopeId","data-v-58c24410"]]),_P={class:"content-header"},xP=["title"],AP={class:"content-actions"},IP=en({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(C(),I("header",_P,[f("div",{class:Ye(["content-leading",{"is-accent":e.accent}])},[er(t.$slots,"leading",{},void 0)],2),f("h1",{class:Ye(["content-title",{"is-accent":e.accent}]),title:e.title},k(e.title),11,xP),f("div",AP,[er(t.$slots,"actions",{},void 0)])]))}}),PP=yt(IP,[["__scopeId","data-v-61739409"]]),Nm=.0025,Fd=3,Om=2,RP=256;function EP(e){var De;const t=x("idle"),n=x(typeof navigator<"u"&&!!((De=navigator.mediaDevices)!=null&&De.getUserMedia)),o=x(0),r=x(null);let a=null,s=null,i=[],u=null,h=null,p=null,g=null,w=[],A=!1,M=!1,U=null;function Y(){U&&(U.abort(),U=null),t.value==="transcribing"&&(t.value="idle")}function ue(){const fe=r.value;if(!fe||typeof window>"u")return;const Se=fe.getContext("2d");if(!Se)return;const _e=Math.max(1,Math.floor(fe.clientWidth)),Pe=Math.max(1,Math.floor(fe.clientHeight||36)),Re=window.devicePixelRatio||1,Ue=Math.max(1,Math.floor(_e*Re)),Le=Math.max(1,Math.floor(Pe*Re));(fe.width!==Ue||fe.height!==Le)&&(fe.width=Ue,fe.height=Le),Se.setTransform(Re,0,0,Re,0,0),Se.clearRect(0,0,_e,Pe);const gt=Math.max(12,Math.floor(_e/(Fd+Om))),ft=w.slice(-gt),at=Math.max(0,gt-ft.length),it=Pe/2,wt=getComputedStyle(fe).color||"#000000";for(let St=0;St<gt;St+=1){const Qe=ft[St-at]??0,re=Math.max(.08,Math.min(1,Qe*18))*it,ee=St*(Fd+Om);Se.globalAlpha=Qe<=Nm?.35:1,Se.fillStyle=wt,Se.fillRect(ee,it-re,Fd,re*2)}Se.globalAlpha=1}function F(){w=[],o.value=0,ue()}function H(){p&&(p.disconnect(),p.onaudioprocess=null,p=null),h&&(h.disconnect(),h=null),u&&(u.close(),u=null),g=null}function q(fe){if(typeof window>"u")return;const Se=window.webkitAudioContext,_e=window.AudioContext??Se;_e&&(H(),F(),u=new _e,h=u.createMediaStreamSource(fe),p=u.createScriptProcessor(2048,1,1),g=performance.now(),p.onaudioprocess=Pe=>{const Re=Pe.inputBuffer.getChannelData(0);let Ue=0;for(let Le=0;Le<Re.length;Le+=1){const gt=Math.abs(Re[Le]??0);Ue+=gt<Nm?0:gt}w.push(Ue/Re.length),w.length>RP&&w.shift(),g!==null&&(o.value=Math.max(0,performance.now()-g)),ue()},h.connect(p),p.connect(u.destination),ue())}async function me(){var fe;if(t.value==="transcribing"&&Y(),!(t.value!=="idle"||!n.value||A)){A=!0,M=!1;try{s=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),i=[],a=new MediaRecorder(s),a.ondataavailable=Se=>{Se.data.size>0&&i.push(Se.data)},a.onstop=()=>{var Pe;const Se=i,_e=(a==null?void 0:a.mimeType)||((Pe=Se[0])==null?void 0:Pe.type)||"audio/webm";ge(),je(Se,_e)},q(s),a.start(250),t.value="recording",M&&we()}catch(Se){ge(),t.value="idle",(fe=e.onError)==null||fe.call(e,Se)}finally{A=!1}}}function we(){if(A&&t.value==="idle"){M=!0;return}if(!(t.value!=="recording"||!a)&&a.state!=="inactive"){t.value="transcribing";try{a.requestData()}catch{}a.stop()}}function ve(){M=!1,Y(),ge(),t.value="idle"}async function je(fe,Se){var Re,Ue,Le,gt,ft;if(fe.length===0){(Re=e.onEmpty)==null||Re.call(e),t.value="idle";return}const _e=new Blob(fe,{type:Se});t.value="transcribing";let Pe=null;try{const at=Se.split(/[/;]/)[1]??"webm",it=new FormData;it.append("file",_e,`codex.${at}`);const wt=((Ue=e.getLanguage)==null?void 0:Ue.call(e).trim())??"";wt&&wt.toLowerCase()!=="auto"&&it.append("language",wt),Pe=new AbortController,U=Pe;const St=await fetch("/codex-api/transcribe",{method:"POST",body:it,signal:Pe.signal}),Qe=await St.text();let et=null;try{et=Qe.trim()?JSON.parse(Qe):null}catch{et=null}if(!St.ok){const ee=(Le=et==null?void 0:et.error)==null?void 0:Le.trim(),te=Qe.trim();throw new Error(ee||te||`Transcription failed: ${St.status}`)}const re=((et==null?void 0:et.text)??"").trim();re.length>0?e.onTranscript(re):(gt=e.onEmpty)==null||gt.call(e)}catch(at){if(at instanceof DOMException&&at.name==="AbortError")return;(ft=e.onError)==null||ft.call(e,at)}finally{Pe&&U===Pe&&(U=null),t.value==="transcribing"&&(t.value="idle")}}function ge(){H(),F(),a&&(a.ondataavailable=null,a.onstop=null,a=null),s&&(s.getTracks().forEach(fe=>fe.stop()),s=null),i=[]}Ni(()=>{ve()});function Ie(){if(t.value==="recording"){we();return}(t.value==="idle"||t.value==="transcribing")&&me()}return{state:t,isSupported:n,recordingDurationMs:o,waveformCanvasRef:r,startRecording:me,stopRecording:we,toggleRecording:Ie,cancel:ve}}const MP={},$P={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function jP(e,t){return C(),I("svg",$P,[...t[0]||(t[0]=[f("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 LP=yt(MP,[["render",jP]]),NP={},OP={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function DP(e,t){return C(),I("svg",OP,[...t[0]||(t[0]=[f("path",{d:"M4 8V4h4"},null,-1),f("path",{d:"M20 8V4h-4"},null,-1),f("path",{d:"M4 16v4h4"},null,-1),f("path",{d:"M20 16v4h-4"},null,-1)])])}const FP=yt(NP,[["render",DP]]),BP={},UP={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function qP(e,t){return C(),I("svg",UP,[...t[0]||(t[0]=[f("path",{d:"M8 4v4H4"},null,-1),f("path",{d:"M16 4v4h4"},null,-1),f("path",{d:"M8 20v-4H4"},null,-1),f("path",{d:"M16 20v-4h4"},null,-1)])])}const zP=yt(BP,[["render",qP]]),HP={},WP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function VP(e,t){return C(),I("svg",WP,[...t[0]||(t[0]=[f("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),f("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 GP=yt(HP,[["render",VP]]),KP=["aria-label"],YP=en({__name:"ComposerPopover",props:{open:{type:Boolean},align:{},width:{},panelClass:{},ariaLabel:{}},emits:["update:open"],setup(e,{expose:t,emit:n}){const o=e,r=n,a=x(null),s=x(null),i=X(()=>o.open),u=X(()=>o.width==="lg"?"composer-popover-panel--lg":"composer-popover-panel--md");tt(i,async g=>{var w;g&&(await Gt(),(w=s.value)==null||w.focus())});function h(){r("update:open",!o.open)}function p(g){var ue,F,H;if(g.key==="Escape"){r("update:open",!1);return}const w=s.value;if(!w)return;const A=Array.from(w.querySelectorAll("button")).filter(q=>!q.disabled&&q.offsetParent!==null);if(A.length===0)return;if(g.key==="Home"){g.preventDefault(),(ue=A[0])==null||ue.focus();return}if(g.key==="End"){g.preventDefault(),(F=A[A.length-1])==null||F.focus();return}if(g.key!=="ArrowDown"&&g.key!=="ArrowUp")return;g.preventDefault();let M=A.findIndex(q=>q===document.activeElement);M<0&&(M=g.key==="ArrowDown"?-1:0);const U=g.key==="ArrowDown"?1:-1,Y=(M+U+A.length)%A.length;(H=A[Y])==null||H.focus()}return t({root:a}),(g,w)=>(C(),I("div",{ref_key:"rootRef",ref:a,class:Ye(["composer-popover-anchor",{"is-align-end":e.align==="end","is-align-center":e.align==="center"}])},[er(g.$slots,"trigger",{toggle:h,isOpen:i.value},void 0),Me(bc,{name:"composer-popover"},{default:mt(()=>[i.value?(C(),I("div",{key:0,ref_key:"panelRef",ref:s,class:Ye(["composer-popover-panel",[u.value,e.panelClass]]),role:"menu",tabindex:"-1","aria-label":e.ariaLabel,onKeydown:p},[er(g.$slots,"default",{},void 0,!0)],42,KP)):Z("",!0)]),_:3})],2))}}),Tu=yt(YP,[["__scopeId","data-v-bdd45c16"]]),JP=["aria-label"],QP={class:"composer-popover-group-label"},XP=["aria-selected","onMousedown"],ZP={class:"thread-composer-slash-body"},eR={class:"thread-composer-slash-name"},tR={class:"thread-composer-slash-desc"},nR={class:"thread-composer-slash-kind"},oR={class:"composer-popover-group-label composer-popover-group-label--skills"},rR=["aria-selected","onMousedown"],aR=["aria-label","title"],sR={class:"thread-composer-slash-body thread-composer-slash-body--skill"},iR={class:"thread-composer-slash-skill-name"},lR={class:"thread-composer-slash-desc thread-composer-slash-desc--skill"},cR=en({__name:"ComposerSlashMenu",props:{commands:{},highlightedIndex:{}},emits:["select"],setup(e,{emit:t}){const n=e,o=t,{t:r}=io(),a=x(null),s=X(()=>n.commands.filter(g=>g.group!=="skill")),i=X(()=>n.commands.filter(g=>g.group==="skill"));tt(()=>n.highlightedIndex,async()=>{var g,w;await Gt(),(w=(g=a.value)==null?void 0:g.querySelector(".is-active"))==null||w.scrollIntoView({block:"nearest"})});function u(g){return r(g==="rpc"?"Action":g==="text"?"Prompt":g==="skill"?"Skill":"Local")}function h(g){return g==="system"?"S":g==="repo"?"R":g==="plugin"?"P":"U"}function p(g){return r(g==="system"?"System":g==="repo"?"Repo":g==="plugin"?"Plugin":"User")}return(g,w)=>(C(),I("div",{ref_key:"rootRef",ref:a,class:"composer-popover",role:"listbox","aria-label":v(r)("Commands")},[s.value.length>0?(C(),I(qe,{key:0},[f("div",QP,k(v(r)("Commands")),1),(C(!0),I(qe,null,At(s.value,(A,M)=>(C(),I("button",{key:A.id,class:Ye(["thread-composer-slash-row",{"is-active":M===e.highlightedIndex}]),type:"button",role:"option","aria-selected":M===e.highlightedIndex,onMousedown:st(U=>o("select",A),["prevent"])},[w[0]||(w[0]=f("span",{class:"thread-composer-slash-prefix","aria-hidden":"true"},"/",-1)),f("span",ZP,[f("span",eR,k(A.id),1),f("span",tR,k(v(r)(A.description)),1)]),f("span",nR,k(u(A.kind)),1)],42,XP))),128))],64)):Z("",!0),i.value.length>0?(C(),I(qe,{key:1},[f("div",oR,k(v(r)("Skills")),1),(C(!0),I(qe,null,At(i.value,(A,M)=>(C(),I("button",{key:A.skillPath||A.id,class:Ye(["thread-composer-slash-row thread-composer-slash-row--skill",{"is-active":s.value.length+M===e.highlightedIndex}]),type:"button",role:"option","aria-selected":s.value.length+M===e.highlightedIndex,onMousedown:st(U=>o("select",A),["prevent"])},[f("span",{class:Ye(["thread-composer-slash-skill-icon",`is-${A.scope||"user"}`]),"aria-label":p(A.scope),title:p(A.scope)},k(h(A.scope)),11,aR),f("span",sR,[f("span",iR,k(A.displayName||A.id),1),f("span",lR,k(A.description),1)])],42,rR))),128))],64)):Z("",!0)],8,JP))}}),uR=yt(cR,[["__scopeId","data-v-ca16aa11"]]),dR=["data-streaming"],fR=["aria-expanded"],pR={class:"thread-composer-plan-panel-title"},hR={key:0,class:"thread-composer-plan-panel-badge"},mR={class:"thread-composer-plan-panel-progress"},vR=["title"],gR=["data-status"],yR={class:"thread-composer-plan-panel-latest-text"},wR={class:"thread-composer-plan-panel-popover-content"},bR={class:"thread-composer-plan-panel-popover-scroll"},TR={class:"thread-composer-plan-panel-popover-head"},kR={class:"thread-composer-plan-panel-title"},CR={class:"thread-composer-plan-panel-progress"},SR={key:0,class:"thread-composer-plan-panel-popover-section"},_R={class:"thread-composer-plan-panel-section-label"},xR=["title"],AR={class:"thread-composer-plan-panel-popover-section"},IR={class:"thread-composer-plan-panel-section-label"},PR={class:"thread-composer-plan-panel-steps"},RR=["data-status"],ER=["data-status"],MR=["title"],$R={class:"thread-composer-plan-panel-popover-footer"},jR=["disabled","data-state"],LR=en({__name:"ThreadComposerPlanPanel",props:{planPanel:{}},emits:["implement-plan"],setup(e,{emit:t}){const n=e,o=t,{t:r}=io(),a=x(!1),s=X(()=>{var w;return(((w=n.planPanel)==null?void 0:w.steps)??[]).filter(A=>A.status==="completed").length}),i=X(()=>{var w;const g=((w=n.planPanel)==null?void 0:w.steps)??[];if(g.length===0)return null;for(let A=g.length-1;A>=0;A-=1){const M=g[A];if(M.status==="inProgress")return M}return g[g.length-1]}),u=X(()=>{var M,U,Y;const g=((U=(M=n.planPanel)==null?void 0:M.explanation)==null?void 0:U.trim())??"";if(!g)return"";const w=((Y=g.split(/[。!?!?\n]/u)[0])==null?void 0:Y.trim())??"";if(!w)return g;const A=80;return w.length>A?`${w.slice(0,A)}…`:w});function h(g){switch(g){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function p(){a.value=!1,o("implement-plan")}return(g,w)=>(C(),I("div",{class:"thread-composer-plan-panel","data-streaming":e.planPanel.streaming},[Me(Tu,{open:a.value,align:"center",width:"lg","panel-class":"thread-composer-plan-panel-popover","aria-label":v(r)("Plan"),"onUpdate:open":w[1]||(w[1]=A=>a.value=A)},{trigger:mt(()=>{var A,M;return[f("button",{type:"button",class:"thread-composer-plan-panel-header","aria-expanded":a.value,onClick:w[0]||(w[0]=U=>a.value=!a.value)},[w[2]||(w[2]=f("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),f("span",pR,k(v(r)("Plan")),1),e.planPanel.streaming?(C(),I("span",hR,k(v(r)("Updating")),1)):Z("",!0),f("span",mR,k(s.value)+"/"+k(e.planPanel.steps.length),1),f("span",{class:"thread-composer-plan-panel-latest",title:((A=i.value)==null?void 0:A.step)??""},[i.value?(C(),I("span",{key:0,class:"thread-composer-plan-panel-latest-status","data-status":i.value.status},k(h(i.value.status)),9,gR)):Z("",!0),f("span",yR,k(((M=i.value)==null?void 0:M.step)??""),1)],8,vR),Me(Js,{class:"thread-composer-plan-panel-chevron"})],8,fR)]}),default:mt(()=>[f("div",wR,[f("div",bR,[f("header",TR,[w[3]||(w[3]=f("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),f("span",kR,k(v(r)("Plan")),1),f("span",CR,k(s.value)+"/"+k(e.planPanel.steps.length),1)]),e.planPanel.explanation?(C(),I("section",SR,[f("p",_R,k(v(r)("Summary")),1),f("p",{class:"thread-composer-plan-panel-explanation",title:e.planPanel.explanation},k(u.value),9,xR)])):Z("",!0),f("section",AR,[f("p",IR,k(v(r)("Steps"))+" ("+k(e.planPanel.steps.length)+")",1),f("ol",PR,[(C(!0),I(qe,null,At(e.planPanel.steps,(A,M)=>(C(),I("li",{key:`composer-plan-${e.planPanel.id}-${M}`,class:"thread-composer-plan-panel-step","data-status":A.status},[f("span",{class:"thread-composer-plan-panel-step-status","data-status":A.status},k(h(A.status)),9,ER),f("span",{class:"thread-composer-plan-panel-step-text",title:A.step},k(A.step),9,MR)],8,RR))),128))])])]),f("footer",$R,[f("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:p},k(e.planPanel.implemented?v(r)("Plan executed"):e.planPanel.streaming?v(r)("Implementing…"):v(r)("Implement plan")),9,jR)])])]),_:1},8,["open","aria-label"])],8,dR))}}),NR=yt(LR,[["__scopeId","data-v-856e4361"]]),OR={key:0,class:"thread-composer-attachments"},DR=["src"],FR=["src","alt"],BR=["aria-label","disabled","onClick"],UR={key:1,class:"thread-composer-folder-chips"},qR=["title"],zR={class:"thread-composer-folder-chip-meta"},HR=["aria-label","disabled","onClick"],WR={key:2,class:"thread-composer-file-chips"},VR=["title"],GR=["aria-label","disabled","onClick"],KR={key:3,class:"thread-composer-skill-chips"},YR=["title","aria-label","onClick"],JR=["aria-label","onClick"],QR=en({__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,o=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function r(u){const h=u.trim();return h?!!(/^video\/|^data:video\//i.test(h)||o.test(h)):!1}function a(u){return u.total<=0?0:Math.round(u.processed/u.total*100)}function s(u){const h=u.trim();return h?h.endsWith("/SKILL.md")?h:`${h.replace(/\/+$/,"")}/SKILL.md`:""}function i(u){const h=s(u.path);!h||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(h)}`,"_blank","noopener,noreferrer")}return(u,h)=>(C(),I(qe,null,[e.selectedImages.length>0?(C(),I("div",OR,[(C(!0),I(qe,null,At(e.selectedImages,p=>(C(),I("div",{key:p.id,class:"thread-composer-attachment"},[r(p.url)?(C(),I("video",{key:0,class:"thread-composer-attachment-image",src:p.url,controls:"",preload:"metadata"},null,8,DR)):(C(),I("img",{key:1,class:"thread-composer-attachment-image",src:p.url,alt:p.name||"Selected image"},null,8,FR)),f("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${p.name||"image"}`,disabled:e.isInteractionDisabled,onClick:g=>n("remove-image",p.id)}," x ",8,BR)]))),128))])):Z("",!0),e.folderUploadGroups.length>0?(C(),I("div",UR,[(C(!0),I(qe,null,At(e.folderUploadGroups,p=>(C(),I("span",{key:p.id,class:"thread-composer-folder-chip"},[Me(Xf,{class:"thread-composer-folder-chip-icon"}),f("span",{class:"thread-composer-folder-chip-name",title:p.name},k(p.name),9,qR),f("span",zR,[p.isUploading?(C(),I(qe,{key:0},[vs(k(a(p))+"% uploading ("+k(p.processed)+"/"+k(p.total)+") ",1)],64)):(C(),I(qe,{key:1},[vs(k(p.filePaths.length)+" file"+k(p.filePaths.length===1?"":"s"),1)],64))]),f("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${p.name}`,disabled:e.isInteractionDisabled,onClick:g=>n("remove-folder",p.id)},"×",8,HR)]))),128))])):Z("",!0),e.standaloneFileAttachments.length>0?(C(),I("div",WR,[(C(!0),I(qe,null,At(e.standaloneFileAttachments,p=>(C(),I("span",{key:p.fsPath,class:"thread-composer-file-chip"},[Me(Li,{class:"thread-composer-file-chip-icon"}),f("span",{class:"thread-composer-file-chip-name",title:p.fsPath},k(p.label),9,VR),f("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${p.label}`,disabled:e.isInteractionDisabled,onClick:g=>n("remove-file",p.fsPath)},"×",8,GR)]))),128))])):Z("",!0),e.selectedSkills.length>0?(C(),I("div",KR,[(C(!0),I(qe,null,At(e.selectedSkills,p=>(C(),I("span",{key:p.path,class:"thread-composer-skill-chip"},[f("button",{class:"thread-composer-skill-chip-name",type:"button",title:s(p.path),"aria-label":`Open ${p.displayName||p.name} SKILL.md`,onClick:g=>i(p)},k(p.displayName||p.name),9,YR),f("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${p.displayName||p.name}`,onClick:g=>n("remove-skill",p.path)},"×",8,JR)]))),128))])):Z("",!0)],64))}}),XR=yt(QR,[["__scopeId","data-v-67fd7144"]]),ZR=en({__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,o=t,{t:r}=io(),a=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],s=X(()=>{var Y;const M=(Y=n.modelReasoningEfforts)==null?void 0:Y[n.selectedModel];if(M===void 0)return a;const U=new Set(M);return a.filter(ue=>U.has(ue.value))});function i(M){return M.trim().replace(/^gpt/i,"GPT")}const u=X(()=>n.models.map(M=>({value:M,label:i(M)}))),h=X(()=>n.disabled||!n.activeThreadId),p=X(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(n.selectedModel.trim())),g=X(()=>n.selectedSpeedMode==="fast"&&p.value);function w(M){o("update:selected-model",M)}function A(M){o("update:selected-reasoning-effort",M)}return(M,U)=>(C(),I(qe,null,[Me(Zo,{class:"thread-composer-control thread-composer-model-control","model-value":e.selectedModel,options:u.value,"selected-prefix-icon":g.value?Gs:null,placeholder:v(r)("Model"),"open-direction":"up",variant:"pill",disabled:h.value||e.models.length===0,"enable-search":"","search-placeholder":v(r)("Search models..."),"onUpdate:modelValue":w},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Me(Zo,{class:"thread-composer-control thread-composer-thinking-control","model-value":e.selectedReasoningEffort,options:s.value,placeholder:v(r)("Thinking"),"open-direction":"up",variant:"pill",disabled:h.value||s.value.length===0,"onUpdate:modelValue":A},null,8,["model-value","options","placeholder","disabled"])],64))}}),eE=yt(ZR,[["__scopeId","data-v-ad846e52"]]),tE=["aria-label","disabled"],nE=["disabled"],oE=["disabled"],rE=["disabled"],aE={class:"thread-composer-attach-mode"},sE={class:"thread-composer-attach-mode-label"},iE={class:"thread-composer-attach-mode-buttons"},lE=["disabled"],cE=["disabled"],uE={class:"thread-composer-attach-mode"},dE={class:"thread-composer-attach-mode-label"},fE={class:"thread-composer-attach-mode-buttons"},pE=["disabled","onClick"],hE={class:"thread-composer-attach-mode"},mE={class:"thread-composer-attach-mode-label"},vE={class:"thread-composer-attach-mode-buttons"},gE=["disabled","onClick"],yE={key:0,class:"thread-composer-menu-error",role:"alert"},wE={key:0,class:"thread-composer-approval-tip",role:"status"},bE=en({__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:o}=io();function r(){n("toggle")}function a(g){n("set-active-mode",g)}function s(){n("select-photo")}function i(){n("select-folder")}function u(){n("capture-camera")}function h(g){n("select-collaboration-mode",g)}function p(g){n("select-approval-policy",g)}return(g,w)=>(C(),Ze(Tu,{open:e.open,align:"start",width:"lg","aria-label":v(o)("Add photos & files"),"onUpdate:open":w[2]||(w[2]=A=>n("update:open",A))},{trigger:mt(()=>[f("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":v(o)("Add photos & files"),disabled:e.isInteractionDisabled,onClick:r}," + ",8,tE)]),default:mt(()=>[f("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:s},k(v(o)("Add photos & files")),9,nE),f("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:i},k(v(o)("Add folder")),9,oE),f("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:u},k(v(o)("Take photo")),9,rE),w[5]||(w[5]=f("div",{class:"thread-composer-attach-separator"},null,-1)),f("div",aE,[f("span",sE,k(v(o)("In-progress send")),1),f("div",iE,[f("button",{class:Ye(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="steer"}]),type:"button",disabled:e.isInteractionDisabled,onClick:w[0]||(w[0]=A=>a("steer"))},k(v(o)("Steer")),11,lE),f("button",{class:Ye(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="queue"}]),type:"button",disabled:e.isInteractionDisabled,onClick:w[1]||(w[1]=A=>a("queue"))},k(v(o)("Queue")),11,cE)])]),e.isMobile?(C(),I(qe,{key:0},[w[3]||(w[3]=f("div",{class:"thread-composer-attach-separator"},null,-1)),f("div",uE,[f("span",dE,k(v(o)("Plan mode")),1),f("div",fE,[(C(!0),I(qe,null,At(e.collaborationModeChoices,A=>(C(),I("button",{key:`mobile-plan-${A.value}`,class:Ye(["thread-composer-attach-mode-button",{"is-active":e.selectedCollaborationMode===A.value}]),type:"button",disabled:A.disabled||e.isComposerConfigDisabled,onClick:M=>h(A.value)},k(v(o)(A.labelKey)),11,pE))),128))])]),w[4]||(w[4]=f("div",{class:"thread-composer-attach-separator"},null,-1)),f("div",hE,[f("span",mE,k(v(o)("Approval policy")),1),f("div",vE,[(C(!0),I(qe,null,At(e.approvalPolicyChoices,A=>(C(),I("button",{key:`mobile-approval-${A.value}`,class:Ye(["thread-composer-attach-mode-button",{"is-active":e.approvalPolicy===A.value}]),type:"button",disabled:e.isApprovalPolicySaving,onClick:M=>p(A.value)},k(v(o)(A.label)),11,gE))),128))])]),e.approvalPolicyError?(C(),I("p",yE,k(e.approvalPolicyError),1)):Z("",!0),Me(bc,{name:"approval-tip"},{default:mt(()=>[e.approvalPolicyNotice?(C(),I("span",wE,k(e.approvalPolicyNotice),1)):Z("",!0)]),_:1})],64)):Z("",!0)]),_:1},8,["open","aria-label"]))}}),TE=yt(bE,[["__scopeId","data-v-93f4c279"]]),kE=/(^|\s)(\/[a-zA-Z]*)$/,Dm=[{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 CE(e){var o,r,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 u=s.path.trim()||i;n.has(u)||(n.add(u),t.push({id:i,description:((o=s.description)==null?void 0:o.trim())||"Run this skill",kind:"skill",group:"skill",skillPath:s.path,displayName:((r=s.displayName)==null?void 0:r.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 SE(e){const t=e.match(kE);if(!t)return null;const n=t[2]??"";return{query:n.slice(1).toLowerCase(),token:n,startIndex:e.length-n.length}}function _E(e,t){const n=t.trim().toLowerCase();if(!n)return e;const o=e.filter(r=>r.id===n);return o.length>0?o:e.filter(r=>r.id.startsWith(n))}const xE={class:"thread-composer-main"},AE={class:"thread-composer-input-row"},IE={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},PE={class:"thread-composer-drop-overlay-copy"},RE={key:1,class:"composer-popover"},EE=["onMousedown"],ME={key:1,class:"thread-composer-file-mention-icon-markdown"},$E={class:"thread-composer-file-mention-text"},jE={class:"thread-composer-file-mention-name"},LE={key:0,class:"thread-composer-file-mention-dir"},NE={key:1,class:"thread-composer-file-mention-empty"},OE={key:2,class:"thread-composer-file-mention-empty"},DE=["placeholder","disabled"],FE=["aria-label","title","disabled"],BE={class:"thread-composer-actions"},UE=["aria-label","title","disabled"],qE={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},zE=["aria-label","title","disabled"],HE=["aria-label","disabled"],WE={class:"thread-composer-plan-trigger-label"},VE=["aria-checked","disabled","onClick"],GE={class:"thread-composer-menu-item-copy"},KE={class:"thread-composer-menu-item-title"},YE={key:0,class:"thread-composer-menu-item-sub"},JE={key:1,class:"thread-composer-menu-item-hint"},QE={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},XE=["aria-label","disabled"],ZE={class:"thread-composer-approval-trigger-label"},eM=["aria-checked","disabled","onClick"],tM={class:"thread-composer-menu-item-copy"},nM={class:"thread-composer-menu-item-title"},oM={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},rM={key:0,class:"thread-composer-menu-error",role:"alert"},aM={key:0,class:"thread-composer-approval-tip",role:"status"},sM=["title","aria-label"],iM={class:"thread-composer-context-usage-value"},lM={key:0,class:"thread-composer-context-usage-compact"},cM=["disabled"],uM=["disabled"],dM=["disabled"],Bd=12e3,fM=2e3,pM="codex-web-local.thread-draft.v1.",hM=en({__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 o=e,r=n,{t:a}=io(),s=x(""),i=x([]),u=x([]),h=x([]),p=x([]),g=x(""),w=x(0),A=x(null),M=x(!1),{state:U,cancel:Y}=EP({getLanguage:()=>o.dictationLanguage??"auto",onTranscript:E=>{if(s.value=s.value?`${s.value}
58
+ ${E}`:E,g.value="",o.dictationAutoSend!==!1){const O=o.isTurnInProgress?Te.value:"steer";Xe(O);return}Gt(()=>{var O;return(O=q.value)==null?void 0:O.focus()})},onEmpty:()=>{g.value=o.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:E=>{if(E instanceof DOMException&&E.name==="NotAllowedError"){g.value="Microphone access was denied.";return}g.value=E instanceof Error?E.message:"Dictation failed."}}),ue=x(null),F=x(null),H=x(null),q=x(null),{isMobile:me}=Wf(),we=x(!1),ve=x(!1),je=x(!1),ge=x(null),Ie=x(""),De=x([]),fe=x(!1),Se=x(0),_e=x(!1),Pe=x(null),Re=x(""),Ue=x(0),Le=x(Dm),gt=X(()=>[...Dm,...CE(o.skills??[])]),ft=x(!1),at=x(!1);let it=!1;const wt=x(0);let St=0,Qe=null,et="",re=!1,ee=0,te=0;const V=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let $e="";const R=X(()=>{const E=new Set((o.collaborationModes??[]).map(O=>O.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:!E.has("execplans")}]}),j=[{value:"on-request",label:"When Codex requests it"},{value:"untrusted",label:"Unless trusted"},{value:"never",label:"Never"}],W=X(()=>{const E=R.value.find(O=>O.value===o.selectedCollaborationMode);return a(E?E.labelKey:"Plan mode")}),ce=X(()=>{const E=j.find(O=>O.value===o.approvalPolicy);return a(E?E.label:"Approval policy")}),le=X(()=>o.selectedCollaborationMode==="plan"&&o.selectedModel.trim().length===0),ne=X(()=>o.disabled||o.isUpdatingSpeedMode||!o.activeThreadId||le.value||w.value>0?!1:s.value.trim().length>0||i.value.length>0||h.value.length>0),Ce=X(()=>s.value.trim().length>0||i.value.length>0||u.value.length>0||h.value.length>0||p.value.length>0),be=X(()=>{const E=new Set;for(const O of p.value)for(const oe of O.filePaths)E.add(oe);return h.value.filter(O=>!E.has(O.fsPath))}),de=X(()=>o.disabled||!o.activeThreadId||o.externalSessionActive===!0),ie=X(()=>o.disabled||!o.activeThreadId),Ge=X(()=>o.inProgressSubmitMode==="steer"?"steer":"queue"),Te=x(Ge.value),Be=X(()=>U.value==="recording"),Fe=X(()=>o.activeThreadId?le.value?a("Loading models for plan mode..."):a("Ask Codex anything, @ to add files, / for commands"):a("Select a thread to send a message")),ze=X(()=>s.value.trim().length>0||i.value.length>0||h.value.length>0),bt=X(()=>s.value.split(`
59
+ `).length),dt=X(()=>ft.value||bt.value>=6||at.value),pt=X(()=>We(o.threadTokenUsage??null)),Yt=X(()=>{var E;return((E=pt.value)==null?void 0:E.summaryText)??""}),In=X(()=>{var E;return((E=pt.value)==null?void 0:E.tooltipText)??""}),z=X(()=>{var E;return((E=pt.value)==null?void 0:E.tone)??"healthy"});function G(){z.value!=="healthy"&&r("compact-context")}function K(E){if(!Number.isFinite(E))return"0";const O=Math.abs(E);return O>=1e6?`${(O>=1e7?(E/1e6).toFixed(0):(E/1e6).toFixed(1)).replace(/\.0$/,"")}M`:O>=1e3?`${(O>=1e5?(E/1e3).toFixed(0):(E/1e3).toFixed(1)).replace(/\.0$/,"")}k`:String(Math.round(E))}function pe(E){const O=Math.max(0,E.inputTokens-E.cachedInputTokens),oe=[`${K(E.totalTokens)} ${a("total")}`,`${K(O)} ${a("input")}`];return E.cachedInputTokens>0&&oe.push(`${K(E.cachedInputTokens)} ${a("cached")}`),E.outputTokens>0&&oe.push(`${K(E.outputTokens)} ${a("output")}`),E.reasoningOutputTokens>0&&oe.push(`${K(E.reasoningOutputTokens)} ${a("reasoning")}`),oe.join(" · ")}function Ne(E,O){if(!Number.isFinite(E)||!Number.isFinite(O)||O<=0)return 0;if(O<=Bd){const Dt=Math.max(0,O-Math.max(0,E));return Math.max(0,Math.min(100,Math.round(Dt/O*100)))}const oe=O-Bd,Ee=Math.max(0,E-Bd),Ve=Math.max(0,oe-Ee);return Math.max(0,Math.min(100,Math.round(Ve/oe*100)))}function We(E){if(!E)return null;const O=E.modelContextWindow??null;if(typeof O!="number"||!Number.isFinite(O)||O<=0)return null;const oe=Math.max(0,E.last.totalTokens),Ee=Ne(oe,O),Ve=Math.max(0,Math.min(100,100-Ee)),Dt=Ee<=15?"danger":Ee<=35?"warning":"healthy";return{summaryText:`${Ee}% · ${K(oe)} / ${K(O)}`,tooltipText:[`${a("Context window")}: ${Ee}% ${a("left")} (${Ve}% ${a("used")})`,`${a("In context")}: ${oe.toLocaleString()} / ${O.toLocaleString()} tokens`,`${a("Last turn")}: ${pe(E.last)}`,`${a("Session total")}: ${pe(E.total)}`].join(`
60
+ `),percentRemaining:Ee,tone:Dt}}function Xe(E="steer"){var oe;const O=s.value.trim();if(ne.value){if(r("submit",{text:O,imageUrls:i.value.map(Ee=>Ee.url),fileAttachments:[...h.value],skills:u.value.map(Ee=>({name:Ee.name,path:Ee.path})),mode:E}),It(o.activeThreadId),kn(),ft.value=!1,p.value=[],we.value=!1,En(),V||me.value){(oe=q.value)==null||oe.blur();return}Gt(()=>{var Ee;return(Ee=q.value)==null?void 0:Ee.focus()})}}function $t(E){Te.value=E}function Lt(E){wt.value+=1,s.value=E.text,i.value=E.imageUrls.map((O,oe)=>({id:`queued-${Date.now()}-${oe}-${Math.random().toString(36).slice(2,8)}`,name:`${a("Image")} ${oe+1}`,url:O})),u.value=E.skills.map(O=>(o.skills??[]).find(oe=>oe.path===O.path)??{name:O.name,displayName:void 0,description:"",path:O.path}),h.value=E.fileAttachments.map(O=>({...O})),p.value=[],g.value="",A.value=null,w.value=0,we.value=!1,En(),_t(),te+=1}function kn(){Lt({text:"",imageUrls:[],fileAttachments:[],skills:[]}),ft.value=!1}function Fo(E){return`${pM}${E}`}function tr(E){if(typeof window>"u")return null;const O=E.trim();if(!O)return null;try{const oe=window.localStorage.getItem(Fo(O));if(!oe)return null;const Ee=JSON.parse(oe);return typeof Ee=="string"?{text:Ee,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof Ee.text=="string"?Ee.text:"",imageUrls:Array.isArray(Ee.imageUrls)?Ee.imageUrls.filter(Ve=>typeof Ve=="string"):[],fileAttachments:Array.isArray(Ee.fileAttachments)?Ee.fileAttachments.filter(Ve=>!!Ve&&typeof Ve.label=="string"&&typeof Ve.path=="string"&&typeof Ve.fsPath=="string"):[],skills:Array.isArray(Ee.skills)?Ee.skills.filter(Ve=>!!Ve&&typeof Ve.name=="string"&&typeof Ve.path=="string"):[]}}catch{return null}}function lo(E,O){if(typeof window>"u")return;const oe=E.trim();if(oe)try{if(O.text.trim().length>0||O.imageUrls.length>0||O.fileAttachments.length>0||O.skills.length>0){window.localStorage.setItem(Fo(oe),JSON.stringify(O));return}window.localStorage.removeItem(Fo(oe))}catch{}}function It(E){lo(E,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Kr(){return{text:s.value,imageUrls:i.value.map(E=>E.url),fileAttachments:h.value.map(E=>({...E})),skills:u.value.map(E=>({name:E.name,path:E.path}))}}function nr(){r("interrupt")}function un(){const E=q.value;if(!E){at.value=!1;return}at.value=E.scrollHeight>E.clientHeight+2}function jn(){it||(it=!0,Gt(()=>{it=!1,un()}))}function Pn(){de.value||(ft.value=!ft.value,jn(),Gt(()=>{var E;return(E=q.value)==null?void 0:E.focus()}))}function So(E){r("update:selected-model",E)}function Cn(E){if(E===o.selectedCollaborationMode){ve.value=!1;return}r("update:selected-collaboration-mode",E),ve.value=!1}function or(E){if(E===o.selectedCollaborationMode){we.value=!1;return}r("update:selected-collaboration-mode",E),we.value=!1}function Tt(E){r("update:selected-reasoning-effort",E)}function zt(E){o.approvalPolicy===E||o.isApprovalPolicySaving===!0||(r("update:approval-policy",E),r("save-approval-policy"))}function Et(){o.dictationClickToToggle}function Cr(){de.value||(we.value=!we.value,ve.value=!1,je.value=!1)}function hn(){ie.value||(ve.value=!ve.value,we.value=!1,je.value=!1)}function ga(){ie.value||(je.value=!je.value,we.value=!1,ve.value=!1)}function Sr(){var E;(E=ue.value)==null||E.click()}function Bo(){var E;(E=F.value)==null||E.click()}function ya(){var E;(E=H.value)==null||E.click()}function wa(E){const O=i.value.find(oe=>oe.id===E);if(O&&Rn(O.url)){const oe=rr(O.url);oe&&tn(oe)}i.value=i.value.filter(oe=>oe.id!==E)}function _r(E){u.value=u.value.filter(O=>O.path!==E)}function tn(E){h.value=h.value.filter(O=>O.fsPath!==E)}function Sn(E){const O=p.value.find(Ee=>Ee.id===E);if(!O)return;const oe=new Set(O.filePaths);h.value=h.value.filter(Ee=>!oe.has(Ee.fsPath)),p.value=p.value.filter(Ee=>Ee.id!==E)}function mn(E,O){const oe=E.replace(/\\/g,"/");if(h.value.some(Dt=>Dt.fsPath===oe))return;const Ee=oe.split("/").filter(Boolean),Ve=(O==null?void 0:O.trim())||Ee[Ee.length-1]||oe;h.value=[...h.value,{label:Ve,path:oe,fsPath:oe}]}function xr(E){return E.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(E.name)}const Ln=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function co(E){return E.type.startsWith("video/")?!0:Ln.test(E.name)}function Rn(E){const O=E.trim();if(!O)return!1;if(O.startsWith("data:video/"))return!0;try{const oe=new URL(O,window.location.href);return Ln.test(oe.pathname)?!0:oe.pathname==="/codex-local-image"?Ln.test(oe.searchParams.get("path")??""):!1}catch{return Ln.test(O)}}function rr(E){try{const O=new URL(E,window.location.href);return O.pathname!=="/codex-local-image"?"":decodeURIComponent(O.searchParams.get("path")??"").replace(/\\/g,"/")}catch{return""}}function Ar(E){return E?Array.from(E):[]}function uo(E){return E!==te?!1:(w.value+=1,!0)}function Uo(E){E===te&&(w.value=Math.max(0,w.value-1))}function ar(E){if(E<=0)return;const O=A.value,oe=O?O.succeeded+O.failed:0;if(!O||oe>=O.total){A.value={total:E,succeeded:0,failed:0};return}A.value={...O,total:O.total+E}}function kt(E){const O=A.value;O&&(A.value={...O,succeeded:O.succeeded+(E==="success"?1:0),failed:O.failed+(E==="failure"?1:0)})}function Ot(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function Zn(E){const O=new Date,oe=[O.getFullYear(),String(O.getMonth()+1).padStart(2,"0"),String(O.getDate()).padStart(2,"0"),String(O.getHours()).padStart(2,"0"),String(O.getMinutes()).padStart(2,"0"),String(O.getSeconds()).padStart(2,"0")].join("-"),Ee=E.type.startsWith("image/")&&E.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${oe}.${Ee}`}function _o(){const E=new Date;return`pasted-text-${[E.getFullYear(),String(E.getMonth()+1).padStart(2,"0"),String(E.getDate()).padStart(2,"0"),String(E.getHours()).padStart(2,"0"),String(E.getMinutes()).padStart(2,"0"),String(E.getSeconds()).padStart(2,"0")].join("-")}.txt`}function Ir(E){return E.name.trim()?E:new File([E],Zn(E),{type:E.type||"image/png",lastModified:Date.now()})}async function xo(E,O){if(uo(O))try{const oe=Ir(E),Ee=await Uc(oe);if(O!==te)return;if(!Ee){kt("failure");return}i.value=[...i.value,{id:Ot(),name:oe.name,url:`/codex-local-image?path=${encodeURIComponent(Ee)}`}],kt("success")}catch{O===te&&kt("failure")}finally{Uo(O)}}async function Jn(E,O){if(uo(O))try{const oe=await Uc(E);if(O!==te)return;if(!oe){kt("failure");return}mn(oe),kt("success")}catch{O===te&&kt("failure")}finally{Uo(O)}}async function Ao(E,O){if(uo(O))try{const oe=Ir(E),Ee=await Uc(oe);if(O!==te)return;if(!Ee){kt("failure");return}const Ve=Ee.replace(/\\/g,"/");i.value=[...i.value,{id:Ot(),name:oe.name,url:`/codex-local-image?path=${encodeURIComponent(Ve)}`}],mn(Ve),kt("success")}catch{O===te&&kt("failure")}finally{Uo(O)}}function qo(E){const O=Ar(E);if(O.length===0)return;ar(O.length),we.value=!1,En();const oe=te;for(const Ee of O)xr(Ee)?xo(Ee,oe):co(Ee)?Ao(Ee,oe):Jn(Ee,oe)}function Yr(){ee=0,M.value=!1}function Pr(E){return E?Array.from(E.types??[]).includes("Files"):!1}async function ni(E){if(!E||E.length===0)return;const O=wt.value,oe=Array.from(E),Ve=(oe[0].webkitRelativePath||oe[0].name).split("/").filter(Boolean)[0]||"Folder",Dt=`${Date.now()}-${Math.random().toString(36).slice(2)}`;p.value=[...p.value,{id:Dt,name:Ve,total:oe.length,processed:0,filePaths:[],isUploading:!0}];const yn=on=>{O===wt.value&&(p.value=p.value.map(Ht=>Ht.id===Dt?on(Ht):Ht))};for(const on of oe)try{const Ht=await Uc(on);if(O!==wt.value)return;if(Ht){const Qr=on.webkitRelativePath||on.name;mn(Ht,Qr),yn(Po=>({...Po,processed:Po.processed+1,filePaths:[...Po.filePaths,Ht]}));continue}yn(Qr=>({...Qr,processed:Qr.processed+1}))}catch{yn(Ht=>({...Ht,processed:Ht.processed+1}))}yn(on=>({...on,isUploading:!1}))}function Io(E){E&&(E.value="")}function Ha(E){const O=E.target;qo((O==null?void 0:O.files)??null),Io(O),we.value=!1}function ba(E){const O=E.target;qo((O==null?void 0:O.files)??null),Io(O),we.value=!1}function sr(E){const O=E.target;ni((O==null?void 0:O.files)??null),Io(O),we.value=!1}function Jr(E){de.value||!Pr(E.dataTransfer)||(E.preventDefault(),ee+=1,M.value=!0)}function nn(E){de.value||!Pr(E.dataTransfer)||(E.preventDefault(),E.dataTransfer&&(E.dataTransfer.dropEffect="copy"),M.value=!0)}function Ct(E){M.value&&(E.preventDefault(),ee=Math.max(0,ee-1),ee===0&&Yr())}function Nn(E){var O;de.value||!Pr(E.dataTransfer)||(E.preventDefault(),Yr(),qo(((O=E.dataTransfer)==null?void 0:O.files)??null))}function vn(){!M.value&&ee===0||Yr()}function zo(E){var Dt,yn;if(de.value)return;const O=((Dt=E.clipboardData)==null?void 0:Dt.getData("text/plain"))??"";if(O.length>=fM){E.preventDefault();const on=new File([O],_o(),{type:"text/plain",lastModified:Date.now()});qo([on]);return}const oe=Array.from(((yn=E.clipboardData)==null?void 0:yn.items)??[]);if(oe.length===0)return;const Ee=O.length>0,Ve=oe.filter(on=>on.kind==="file"&&on.type.startsWith("image/")).map(on=>on.getAsFile()).filter(on=>on instanceof File);Ve.length!==0&&(Ee||E.preventDefault(),qo(Ve))}function fo(){g.value&&(g.value=""),jn(),gn(),Jt()}function po(E){if(E.isComposing||E.keyCode===229)return;if(fe.value){if(E.key==="Escape"){E.preventDefault(),En();return}if(E.key==="ArrowDown"){E.preventDefault(),De.value.length>0&&(Se.value=(Se.value+1)%De.value.length);return}if(E.key==="ArrowUp"){if(E.preventDefault(),De.value.length>0){const oe=De.value.length;Se.value=(Se.value+oe-1)%oe}return}if(E.key==="Enter"||E.key==="Tab"){E.preventDefault();const oe=De.value[Se.value];oe?Hn(oe):En();return}}if(_e.value){if(E.key==="Escape"){E.preventDefault(),_t();return}if(E.key==="ArrowDown"){E.preventDefault(),Le.value.length>0&&(Ue.value=(Ue.value+1)%Le.value.length);return}if(E.key==="ArrowUp"){if(E.preventDefault(),Le.value.length>0){const oe=Le.value.length;Ue.value=(Ue.value+oe-1)%oe}return}if(E.key==="Enter"||E.key==="Tab"){E.preventDefault();const oe=Le.value[Ue.value];oe?Mt(oe):_t();return}}if(o.sendWithEnter!==!1?E.key==="Enter"&&!E.shiftKey:E.key==="Enter"&&(E.metaKey||E.ctrlKey)){E.preventDefault(),Xe(o.isTurnInProgress?Te.value:"steer");return}}function En(){if(fe.value=!1,ge.value=null,Ie.value="",De.value=[],Se.value=0,re=!1,et){const E=et;et="",RS(E)}}function gn(){const E=q.value;if(!E){En();return}const O=E.selectionStart??s.value.length,Ee=s.value.slice(0,O).match(/(^|\s)(@[^\s@]*)$/);if(!Ee){En();return}const Ve=Ee[2]??"",Dt=Ve.length,yn=O-Dt;_e.value&&_t(),ge.value=yn,Ie.value=Ve.slice(1),fe.value=!0,Mn()}function _t(){_e.value=!1,Pe.value=null,Re.value="",Ue.value=0,Le.value=gt.value}function Jt(){const E=q.value;if(!E){_t();return}const O=E.selectionStart??s.value.length,oe=s.value.slice(0,O),Ee=SE(oe);if(!Ee){_t();return}fe.value&&En(),Pe.value=Ee.startIndex,Re.value=Ee.query,Le.value=_E(gt.value,Ee.query),Ue.value=0,_e.value=!0}function Mt(E){const O=q.value,oe=Pe.value;if(oe!==null&&O){const Ee=O.selectionStart??s.value.length;s.value=`${s.value.slice(0,oe)}${s.value.slice(Ee)}`}if(_t(),E.kind==="skill"){const Ee=(o.skills??[]).find(Dt=>Dt.path===E.skillPath||Dt.name===E.id);Ee&&!u.value.some(Dt=>Dt.path===Ee.path)&&(u.value=[...u.value,{...Ee}]);const Ve=s.value.trim();s.value=Ve.length>0?`${Ve} (Use the ${E.id} skill.)`:`Use the ${E.id} skill.`,Gt(()=>{O==null||O.focus(),un()});return}if(E.kind==="rpc"){r("slash-command",E.id);return}E.kind==="text"&&E.insertText&&(s.value=s.value.trimEnd(),s.value=s.value.length>0?`${s.value} ${E.insertText}`:E.insertText),E.kind==="local"&&E.id==="clear"&&(s.value=""),Gt(()=>{O==null||O.focus(),un()})}async function Mn(){if(!fe.value)return;const E=(o.cwd??"").trim();if(!E){De.value=[],re=!0;return}re=!1,Qe&&clearTimeout(Qe);const O=++St;Qe=setTimeout(async()=>{const oe=`composer-${O}`,Ee=Ie.value;try{if(et||(await IS([E],oe),et=oe,r("register-fuzzy-session",oe)),await PS(et,Ee),!fe.value||O!==St)return;if(De.value=(o.fuzzyFileSearchResults??[]).map(Ve=>({path:Ve.path})),Se.value=0,De.value.length===0)try{const Ve=await nm(E,Ee,20);if(!fe.value||O!==St)return;De.value=Ve,Se.value=0}catch{if(!fe.value||O!==St)return;De.value=[]}}catch{if(!fe.value||O!==St)return;et="";try{const Ve=await nm(E,Ee,20);if(!fe.value||O!==St)return;De.value=Ve,Se.value=0}catch{if(!fe.value||O!==St)return;De.value=[]}}},120)}function Hn(E){const O=q.value,oe=ge.value;if(oe!==null&&O){const Ee=O.selectionStart??s.value.length;s.value=`${s.value.slice(0,oe)}${s.value.slice(Ee)}`.trimEnd()}mn(E.path),En(),Gt(()=>O==null?void 0:O.focus())}function Wa(E){Y(),Lt(E),Gt(()=>{var O;(O=q.value)==null||O.focus(),un()})}function Rr(E){const O=E.trim();O&&(s.value=s.value.trim()?`${s.value.trim()}
61
+ ${O}`:O,Gt(()=>{var oe;(oe=q.value)==null||oe.focus(),un()}))}function Va(E){const O=E.lastIndexOf("/");return O<0?E:E.slice(O+1)}function ir(E){const O=E.lastIndexOf("/");return O<=0?"":E.slice(0,O)}function Ho(E){const O=Va(E),oe=O.lastIndexOf(".");return oe<=0?"":O.slice(oe+1).toLowerCase()}function lr(E){const O=Ho(E);return O==="ts"?"TS":O==="tsx"?"TSX":O==="js"?"JS":O==="jsx"?"JSX":O==="json"?"{}":""}function ho(E){const O=Ho(E);return O.startsWith("ts")?"ts":O.startsWith("js")?"js":O==="json"?"json":"default"}function Er(E){const O=Ho(E);return O==="md"||O==="mdx"}function cr(E){if(!we.value&&!ve.value&&!je.value)return;const O=E.target;O&&(typeof O.closest=="function"&&O.closest(".composer-popover-anchor")||(we.value=!1,ve.value=!1,je.value=!1))}return Cs(()=>{document.addEventListener("click",cr),window.addEventListener("drop",vn),window.addEventListener("dragend",vn),window.addEventListener("blur",vn),jn()}),t({hydrateDraft:Wa,appendTextToDraft:Rr,hasUnsavedDraft:()=>Ce.value}),Ni(()=>{document.removeEventListener("click",cr),window.removeEventListener("drop",vn),window.removeEventListener("dragend",vn),window.removeEventListener("blur",vn),window.removeEventListener("pointerup",Et),window.removeEventListener("pointercancel",Et),window.removeEventListener("blur",Et),Qe&&clearTimeout(Qe)}),tt(()=>o.activeThreadId,E=>{Y(),$e&&lo($e,Kr()),kn();const O=tr(E);O&&(Lt(O),fo()),$e=E.trim()},{immediate:!0}),tt([s,i,h,u],()=>{$e&&lo($e,Kr())},{deep:!0}),tt(s,()=>{jn()}),tt(()=>o.cwd,()=>{fe.value&&Mn()}),tt(()=>o.fuzzyFileSearchResults,E=>{!fe.value||!et||(De.value=(E??[]).map(O=>({path:O.path})),Se.value=0)}),tt(Ge,E=>{Te.value=E}),(E,O)=>(C(),I("form",{class:"thread-composer",onSubmit:O[6]||(O[6]=st(oe=>Xe(e.isTurnInProgress?Te.value:"steer"),["prevent"]))},[f("div",{class:Ye(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":M.value}])},[e.planPanel?(C(),Ze(NR,{key:0,"plan-panel":e.planPanel,onImplementPlan:O[0]||(O[0]=oe=>E.$emit("implement-plan"))},null,8,["plan-panel"])):Z("",!0),Me(XR,{"selected-images":i.value,"folder-upload-groups":p.value,"standalone-file-attachments":be.value,"selected-skills":u.value,"is-interaction-disabled":de.value,onRemoveImage:wa,onRemoveFolder:Sn,onRemoveFile:tn,onRemoveSkill:_r},null,8,["selected-images","folder-upload-groups","standalone-file-attachments","selected-skills","is-interaction-disabled"]),f("div",xE,[f("div",AE,[f("div",{class:Ye(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":M.value,"thread-composer-input-wrap--expanded":ft.value}]),onDragenter:Jr,onDragover:nn,onDragleave:Ct,onDrop:Nn},[M.value?(C(),I("div",IE,[f("span",PE,k(v(a)("Drop images or files")),1)])):Z("",!0),fe.value?(C(),I("div",RE,[De.value.length>0?(C(!0),I(qe,{key:0},At(De.value,(oe,Ee)=>(C(),I("button",{key:oe.path,class:Ye(["thread-composer-file-mention-row",{"is-active":Ee===Se.value}]),type:"button",onMousedown:st(Ve=>Hn(oe),["prevent"])},[lr(oe.path)?(C(),I("span",{key:0,class:Ye(["thread-composer-file-mention-icon-badge",`is-${ho(oe.path)}`])},k(lr(oe.path)),3)):Er(oe.path)?(C(),I("span",ME,"↓")):(C(),Ze(Li,{key:2,class:"thread-composer-file-mention-icon-file"})),f("span",$E,[f("span",jE,k(Va(oe.path)),1),ir(oe.path)?(C(),I("span",LE,k(ir(oe.path)),1)):Z("",!0)])],42,EE))),128)):v(re)?(C(),I("div",NE,k(v(a)("No searchable directory for this thread")),1)):(C(),I("div",OE,k(v(a)("No matching files")),1))])):Z("",!0),_e.value?(C(),Ze(uR,{key:2,commands:Le.value,"highlighted-index":Ue.value,onSelect:Mt},null,8,["commands","highlighted-index"])):Z("",!0),Nt(f("textarea",{ref_key:"inputRef",ref:q,"onUpdate:modelValue":O[1]||(O[1]=oe=>s.value=oe),class:"thread-composer-input",placeholder:Fe.value,disabled:de.value,onInput:fo,onKeydown:po,onPaste:zo},null,40,DE),[[sn,s.value]]),dt.value?(C(),I("button",{key:3,class:"thread-composer-expand",type:"button","aria-label":ft.value?v(a)("Exit full screen composer"):v(a)("Expand composer"),title:ft.value?v(a)("Exit full screen composer"):v(a)("Expand composer"),disabled:de.value,onClick:Pn},[ft.value?(C(),Ze(zP,{key:0,class:"thread-composer-expand-icon"})):(C(),Ze(FP,{key:1,class:"thread-composer-expand-icon"}))],8,FE)):Z("",!0)],34),f("div",BE,[e.isTurnInProgress&&!ze.value?(C(),I("button",{key:0,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?v(a)("Saving thread before stop is available"):v(a)("Stop"),title:e.isStopPending?v(a)("Saving thread before stop is available"):v(a)("Stop"),disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending||e.externalSessionActive===!0,onClick:nr},[e.isStopPending?(C(),I("span",qE)):(C(),Ze(GP,{key:1,class:"thread-composer-stop-icon"}))],8,UE)):(C(),I("button",{key:1,class:Ye(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&Te.value==="queue"}]),type:"button","aria-label":e.isCompacting?v(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress&&Te.value==="queue"?v(a)("Queue message"):v(a)("Send message"),title:e.isCompacting?v(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress?`${v(a)("Send")} ${Te.value==="queue"?v(a)("Queue"):v(a)("Steer")}`:v(a)("Send"),disabled:!ne.value,onClick:O[2]||(O[2]=oe=>Xe(e.isTurnInProgress?Te.value:"steer"))},[Me(LP,{class:"thread-composer-submit-icon"})],10,zE))])]),f("div",{class:Ye(["thread-composer-controls",{"thread-composer-controls--recording":Be.value}])},[Me(TE,{open:we.value,"is-mobile":v(me),"is-interaction-disabled":de.value,"is-composer-config-disabled":ie.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":R.value,"approval-policy-choices":j,"active-in-progress-mode":Te.value,"onUpdate:open":O[3]||(O[3]=oe=>we.value=oe),onToggle:Cr,onSetActiveMode:$t,onSelectPhoto:Sr,onSelectFolder:ya,onCaptureCamera:Bo,onSelectCollaborationMode:or,onSelectApprovalPolicy:zt},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"]),v(me)?Z("",!0):(C(),Ze(Tu,{key:0,open:ve.value,align:"start",width:"md","aria-label":v(a)("Plan mode"),"onUpdate:open":O[4]||(O[4]=oe=>ve.value=oe)},{trigger:mt(()=>[f("button",{class:Ye(["thread-composer-plan-trigger",{"is-active":ve.value}]),type:"button","aria-label":v(a)("Plan mode"),disabled:ie.value,onClick:hn},[f("span",WE,k(W.value),1),Me(Js,{class:"thread-composer-plan-trigger-chevron"})],10,HE)]),default:mt(()=>[(C(!0),I(qe,null,At(R.value,oe=>(C(),I("button",{key:oe.value,class:Ye(["thread-composer-menu-item",{"is-active":e.selectedCollaborationMode===oe.value}]),type:"button",role:"menuitemradio","aria-checked":e.selectedCollaborationMode===oe.value,disabled:oe.disabled||ie.value,onClick:Ee=>Cn(oe.value)},[f("span",GE,[f("span",KE,k(v(a)(oe.labelKey)),1),oe.subLabel?(C(),I("span",YE,k(oe.subLabel),1)):Z("",!0),oe.disabled?(C(),I("span",JE,k(v(a)("Not supported by this Codex version")),1)):Z("",!0)]),e.selectedCollaborationMode===oe.value?(C(),I("span",QE,"✓")):Z("",!0)],10,VE))),128))]),_:1},8,["open","aria-label"])),v(me)?Z("",!0):(C(),Ze(Tu,{key:1,open:je.value,align:"center",width:"md","aria-label":v(a)("Approval policy"),"onUpdate:open":O[5]||(O[5]=oe=>je.value=oe)},{trigger:mt(()=>[f("button",{class:Ye(["thread-composer-approval-trigger",{"is-active":je.value}]),type:"button","aria-label":v(a)("Approval policy"),disabled:ie.value,onClick:ga},[f("span",ZE,k(ce.value),1),Me(Js,{class:"thread-composer-approval-trigger-chevron"})],10,XE)]),default:mt(()=>[(C(),I(qe,null,At(j,oe=>f("button",{key:oe.value,class:Ye(["thread-composer-menu-item",{"is-active":e.approvalPolicy===oe.value}]),type:"button",role:"menuitemradio","aria-checked":e.approvalPolicy===oe.value,disabled:e.isApprovalPolicySaving,onClick:Ee=>zt(oe.value)},[f("span",tM,[f("span",nM,k(v(a)(oe.label)),1)]),e.approvalPolicy===oe.value?(C(),I("span",oM,"✓")):Z("",!0)],10,eM)),64)),e.approvalPolicyError?(C(),I("p",rM,k(e.approvalPolicyError),1)):Z("",!0),Me(bc,{name:"approval-tip"},{default:mt(()=>[e.approvalPolicyNotice?(C(),I("span",aM,k(e.approvalPolicyNotice),1)):Z("",!0)]),_:1})]),_:1},8,["open","aria-label"])),Me(eE,{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":So,"onUpdate:selectedReasoningEffort":Tt},null,8,["models","selected-model","model-reasoning-efforts","selected-reasoning-effort","selected-speed-mode","disabled","active-thread-id"]),pt.value?(C(),I("button",{key:2,type:"button",class:Ye(["thread-composer-context-usage-inline",{"is-warning":z.value==="warning","is-danger":z.value==="danger"}]),title:In.value,"aria-label":v(a)("Context"),onClick:G},[f("span",iM,k(Yt.value),1),z.value!=="healthy"?(C(),I("span",lM,k(v(a)("Compact")),1)):Z("",!0)],10,sM)):Z("",!0)],2)])],2),f("input",{ref_key:"photoLibraryInputRef",ref:ue,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:de.value,onChange:Ha},null,40,cM),f("input",{ref_key:"cameraCaptureInputRef",ref:F,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:de.value,onChange:ba},null,40,uM),f("input",{ref_key:"folderPickerInputRef",ref:H,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:de.value,onChange:sr},null,40,dM)],32))}}),Fm=yt(hM,[["__scopeId","data-v-b91883d7"]]),mM={class:"thread-pending-request-title"},vM=["title"],gM={class:"thread-pending-request-approval"},yM=["aria-label"],wM=["aria-pressed","onClick"],bM={class:"thread-pending-request-option-index"},TM={class:"thread-pending-request-option-label"},kM={class:"thread-pending-request-footer thread-pending-request-footer--approval"},CM=["value","placeholder"],SM={key:0,class:"thread-pending-request-validation-error",role:"alert"},_M={class:"thread-pending-request-header"},xM={class:"thread-pending-request-heading"},AM={class:"thread-pending-request-eyebrow"},IM={class:"thread-pending-request-title"},PM={key:0,class:"thread-pending-request-counter"},RM={key:0,class:"thread-pending-request-preview"},EM={class:"thread-pending-request-preview-code"},MM={key:1,class:"thread-pending-request-validation-error",role:"alert"},$M={key:2,class:"thread-pending-request-user-input"},jM={key:0,class:"thread-pending-request-question-description"},LM=["href"],NM={class:"thread-pending-request-question-title"},OM={key:0},DM={key:0,class:"thread-pending-request-question-text"},FM={key:1,class:"thread-pending-request-input-wrap"},BM={class:"thread-pending-request-select-label"},UM=["type","value","onInput"],qM={key:2,class:"thread-pending-request-select-wrap"},zM={class:"thread-pending-request-select-label"},HM={key:3,class:"thread-pending-request-select-wrap"},WM={class:"thread-pending-request-select-label"},VM={key:4,class:"thread-pending-request-question-options"},GM=["checked","onChange"],KM={class:"thread-pending-request-checkbox-label"},YM={key:2,class:"thread-pending-request-validation-error"},JM={class:"thread-pending-request-footer"},QM={key:3,class:"thread-pending-request-user-input"},XM={class:"thread-pending-request-question-title"},ZM={key:0,class:"thread-pending-request-question-text"},e$={key:1,class:"thread-pending-request-question-options"},t$={class:"thread-pending-request-select-wrap"},n$={class:"thread-pending-request-select-label"},o$={key:0,class:"thread-pending-request-question-description"},r$={key:2,class:"thread-pending-request-input-wrap"},a$={class:"thread-pending-request-select-label"},s$=["value","placeholder","onInput"],i$={class:"thread-pending-request-footer"},l$={key:4,class:"thread-pending-request-actions"},c$={key:5,class:"thread-pending-request-actions"},u$=en({__name:"ThreadPendingRequestPanel",props:{request:{},requestCount:{},hasQueueAbove:{type:Boolean},panelWidth:{},visualViewportHeight:{},panelError:{}},emits:["respondServerRequest"],setup(e,{emit:t}){const n=e,o=t,r=X(()=>{const z=typeof n.panelWidth=="number"&&n.panelWidth>0?n.panelWidth:0,G=typeof n.visualViewportHeight=="number"&&n.visualViewportHeight>0?`${n.visualViewportHeight}px`:"100dvh";return{...z>0?{width:`${z}px`}:{},"--visual-viewport-height":G}}),a=x("accept"),s=x(""),i=x({}),u=x({}),h=x({}),p=x(""),{t:g}=io();function w(z){return z!==null&&typeof z=="object"&&!Array.isArray(z)?z:null}function A(z){return typeof z=="string"?z.trim():""}function M(z){return typeof z=="string"?z:null}function U(z){return/^[A-Za-z0-9_./:@%+=,-]+$/.test(z)?z:JSON.stringify(z)}function Y(z){const K=(Array.isArray(z.commandActions)?z.commandActions:[]).map(pe=>w(pe)).map(pe=>A(pe==null?void 0:pe.command)).find(pe=>pe.length>0);if(K)return K.replace(/\s+/g," ").trim();if(Array.isArray(z.command)){const pe=z.command.filter(Ne=>typeof Ne=="string").map(Ne=>Ne.trim()).filter(Ne=>Ne.length>0);if(pe.length>0)return pe.map(Ne=>U(Ne)).join(" ")}return ge(A(z.command))}function ue(z){return z.method==="item/commandExecution/requestApproval"||z.method==="execCommandApproval"}function F(z){return z.method==="item/fileChange/requestApproval"||z.method==="applyPatchApproval"}function H(z){return z.method==="item/permissions/requestApproval"}function q(z){return ue(z)||F(z)||H(z)}function me(z){return z.method==="mcpServer/elicitation/request"}function we(z){const G=w(z.params);return A(G==null?void 0:G.reason)||A(G==null?void 0:G.prompt)||A(G==null?void 0:G.message)}function ve(z){return q(z)?g("Awaiting approval"):me(z)?g("MCP server input required"):z.method==="item/tool/requestUserInput"?g("Awaiting response"):z.method==="item/tool/call"?g("Tool call waiting for response"):z.method}function je(z){const G=we(z);return G||(ue(z)?g("Do you want to run this command?"):F(z)?g("Do you want to make these changes?"):H(z)?g("Do you want to grant these permissions?"):me(z)?g("An MCP server needs your input before Codex can continue."):z.method==="item/tool/requestUserInput"?g("Codex needs your answer before it can continue."):g("Codex is waiting for a response before it can continue."))}function ge(z){var We;const G=z.trim();if(!G)return"";const K=G.match(/-Command\s+(.+)$/i),pe=((We=K==null?void 0:K[1])==null?void 0:We.trim())??G;return(pe.startsWith('"')&&pe.endsWith('"')?pe.slice(1,-1):pe).replace(/\\"/g,'"').replace(/`"/g,'"').replace(/""/g,'"').replace(/\s+/g," ").trim()}function Ie(z){const G=w(z.params);if(!G)return"";if(ue(z))return Y(G);if(F(z)){const K=A(G.grantRoot)||A(G.grant_root);if(K)return K.replace(/\s+/g," ").trim();const pe=w(G.fileChanges)??w(G.changes);if(!pe)return"";const Ne=Object.keys(pe).map(We=>We.trim()).filter(We=>We.length>0);return Ne.length===0?"":Ne.slice(0,3).join(", ")}return H(z)?De(G.permissions):me(z)?A(G.serverName)||A(G.url):""}function De(z){const G=w(z);if(!G)return"";const K=[],pe=w(G.fileSystem),Ne=w(G.network),We=Array.isArray(pe==null?void 0:pe.read)?pe.read.filter($t=>typeof $t=="string"):[],Xe=Array.isArray(pe==null?void 0:pe.write)?pe.write.filter($t=>typeof $t=="string"):[];return We.length>0&&K.push(`${g("Read")}: ${We.join(", ")}`),Xe.length>0&&K.push(`${g("Write")}: ${Xe.join(", ")}`),(Ne==null?void 0:Ne.enabled)===!0&&K.push(g("Network access")),K.join(" • ")}function fe(z){return!z||!q(z)?[]:[{id:"accept",label:g("Yes")},{id:"acceptForSession",label:g("Yes for Session")}]}const Se=X(()=>fe(n.request));tt(()=>{var z;return((z=n.request)==null?void 0:z.id)??0},()=>{var z;s.value="",i.value={},u.value={},h.value={},p.value="",a.value=((z=Se.value[0])==null?void 0:z.id)??"accept"},{immediate:!0}),tt(Se,z=>{var G;a.value!=="decline"&&(z.some(K=>K.id===a.value)||(a.value=((G=z[0])==null?void 0:G.id)??"accept"))},{immediate:!0});function _e(z,G){return`${String(z)}:${G}`}function Pe(z){const G=w(z.params),K=Array.isArray(G==null?void 0:G.questions)?G.questions:[],pe=[];for(const Ne of K){const We=w(Ne);if(!We)continue;const Xe=A(We.id);if(!Xe)continue;const $t=Array.isArray(We.options)?We.options.map(Lt=>w(Lt)).map(Lt=>({label:A(Lt==null?void 0:Lt.label),description:A(Lt==null?void 0:Lt.description)})).filter(Lt=>Lt.label.length>0):[];pe.push({id:Xe,header:A(We.header),question:A(We.question),isOther:We.isOther===!0,options:$t})}return pe}function Re(z,G,K){const pe=_e(z,G),Ne=i.value[pe];return typeof Ne=="string"&&Ne.length>0?Ne:K}function Ue(z,G){return u.value[_e(z,G)]??""}function Le(z,G,K){const pe=_e(z,G);i.value={...i.value,[pe]:K}}function gt(z){return z.options.map(G=>({value:G.label,label:G.label}))}function ft(z,G,K){const pe=K.target;if(!(pe instanceof HTMLInputElement))return;const Ne=_e(z,G);u.value={...u.value,[Ne]:pe.value}}function at(z,G,K){var Ne,We;const pe=Re(z,G,((Ne=K[0])==null?void 0:Ne.label)||"");return((We=K.find(Xe=>Xe.label===pe))==null?void 0:We.description)??""}function it(z,G){return`${String(z)}:${G}`}function wt(z){var G;return A((G=w(z.params))==null?void 0:G.serverName)}function St(z){var K;const G=A((K=w(z.params))==null?void 0:K.url);if(!G)return"";try{const pe=new URL(G),Ne=pe.protocol.toLowerCase();return Ne==="https:"||Ne==="http:"?pe.toString():""}catch{return""}}function Qe(z){const G=w(z.params),K=w(G==null?void 0:G.requestedSchema),pe=w(K==null?void 0:K.properties);if(!pe)return[];const Ne=new Set(Array.isArray(K==null?void 0:K.required)?K.required.filter(We=>typeof We=="string"):[]);return Object.entries(pe).map(([We,Xe])=>et(We,w(Xe),Ne.has(We))).filter(We=>We!==null)}function et(z,G,K){if(!G)return null;const pe=A(G.title)||z,Ne=A(G.description),We=A(G.type);if(We==="boolean")return{key:z,label:pe,description:Ne,required:K,kind:"boolean",inputType:"checkbox",options:[],defaultValue:typeof G.default=="boolean"?G.default:null,hasExplicitDefault:typeof G.default=="boolean"};if(We==="number"||We==="integer")return{key:z,label:pe,description:Ne,required:K,kind:"number",inputType:"number",options:[],defaultValue:typeof G.default=="number"?G.default:null,hasExplicitDefault:typeof G.default=="number"};const Xe=re(G);if(We==="array")return{key:z,label:pe,description:Ne,required:K,kind:"multiEnum",inputType:"checkbox",options:Xe,defaultValue:Array.isArray(G.default)?G.default.filter(Lt=>typeof Lt=="string"):[],hasExplicitDefault:Array.isArray(G.default)};const $t=M(G.default);return Xe.length>0?{key:z,label:pe,description:Ne,required:K,kind:"singleEnum",inputType:"select",options:Xe,defaultValue:$t,hasExplicitDefault:$t!==null}:{key:z,label:pe,description:Ne,required:K,kind:"string",inputType:ee(G),options:[],defaultValue:$t,hasExplicitDefault:$t!==null}}function re(z){const K=(Array.isArray(z.oneOf)?z.oneOf:Array.isArray(z.anyOf)?z.anyOf:[]).map(Xe=>w(Xe)).map(Xe=>({value:A(Xe==null?void 0:Xe.const),label:A(Xe==null?void 0:Xe.title)||A(Xe==null?void 0:Xe.const)})).filter(Xe=>Xe.value.length>0);if(K.length>0)return K;const pe=w(z.items);if(pe){const Xe=re(pe);if(Xe.length>0)return Xe}const Ne=Array.isArray(z.enum)?z.enum.filter(Xe=>typeof Xe=="string"):[],We=Array.isArray(z.enumNames)?z.enumNames.filter(Xe=>typeof Xe=="string"):[];return Ne.map((Xe,$t)=>({value:Xe,label:We[$t]||Xe}))}function ee(z){const G=A(z.format);return G==="email"?"email":G==="uri"?"url":G==="date"?"date":G==="date-time"?"datetime-local":"text"}function te(z,G){const K=h.value[it(z,G.key)];return K!==void 0?K:G.defaultValue}function V(z,G){const K=te(z,G);return Array.isArray(K)?K.filter(pe=>typeof pe=="string"):[]}function $e(z,G,K){const pe=K.target;pe instanceof HTMLInputElement&&R(z,G,pe.value)}function R(z,G,K){const pe=(G.kind==="number",K);h.value={...h.value,[it(z,G.key)]:K.length>0?pe:null},p.value=""}function j(z,G,K){let pe=null;K==="true"?pe=!0:K==="false"&&(pe=!1),h.value={...h.value,[it(z,G.key)]:pe},p.value=""}function W(z,G,K,pe){const Ne=pe.target;if(!(Ne instanceof HTMLInputElement))return;const We=new Set(V(z,G));Ne.checked?We.add(K):We.delete(K),h.value={...h.value,[it(z,G.key)]:Array.from(We)},p.value=""}function ce(z){return z===!0?"true":z===!1?"false":""}function le(z){const G=[{value:"true",label:g("True")},{value:"false",label:g("False")}];return z.hasExplicitDefault||G.unshift({value:"",label:g("Select true or false")}),G}function ne(z){const G=z.options.map(K=>({value:K.value,label:K.label}));return z.hasExplicitDefault||G.unshift({value:"",label:g("Select an option")}),G}function Ce(z,G){const K=te(z,G);return G.kind==="multiEnum"?Array.isArray(K)&&K.length>0:G.kind==="boolean"?typeof K=="boolean":G.kind==="number"&&typeof K=="number"?!0:typeof K=="string"&&K.trim().length>0}function be(z){const G=Qe(z).filter(K=>K.required&&!Ce(z.id,K)).map(K=>K.label);return G.length===0?"":G.length===1?`${g("Answer the required field")}: ${G[0]}.`:`${g("Answer the required field")}: ${G.join(", ")}.`}function de(z){const G={};for(const K of Qe(z)){const pe=te(z.id,K);if(K.kind==="multiEnum"){const We=Array.isArray(pe)?pe:[];(We.length>0||K.required)&&(G[K.key]=We);continue}if(K.kind==="boolean"){typeof pe=="boolean"&&(G[K.key]=pe);continue}if(K.kind==="number"){const We=typeof pe=="number"?pe:Number(String(pe).trim());Number.isNaN(We)||(G[K.key]=We);continue}const Ne=String(pe??"").trim();(Ne.length>0||K.required)&&(G[K.key]=Ne)}return G}function ie(z){a.value=z}function Ge(){a.value="decline"}function Te(z){const G=z.target;G instanceof HTMLInputElement&&(s.value=G.value,a.value="decline")}function Be(z,G){var K;if(H(z)){if(G==="decline"||G==="cancel"){o("respondServerRequest",{id:z.id,error:{code:-32e3,message:G==="cancel"?"Cancelled from CodexUI.":"Declined from CodexUI."}});return}const pe=w((K=w(z.params))==null?void 0:K.permissions)??{};o("respondServerRequest",{id:z.id,result:{permissions:pe,scope:G==="acceptForSession"?"session":"turn"}});return}o("respondServerRequest",{id:z.id,result:{decision:G}})}function Fe(z){const G=s.value.trim(),K=G.length>0?"decline":a.value;if(H(z)){Be(z,K);return}o("respondServerRequest",{id:z.id,result:{decision:K},followUpMessageText:G||void 0})}function ze(z,G){const K=w(z.params),pe={action:G};if(G==="accept"&&A(K==null?void 0:K.mode)==="form"){const Ne=be(z);if(Ne){p.value=Ne;return}pe.content=de(z)}o("respondServerRequest",{id:z.id,result:pe})}function bt(z){var pe;const G=Pe(z),K={};for(const Ne of G){const We=Re(z.id,Ne.id,((pe=Ne.options[0])==null?void 0:pe.label)||""),Xe=Ue(z.id,Ne.id).trim(),$t=[We,Xe].map(Lt=>Lt.trim()).filter(Lt=>Lt.length>0);K[Ne.id]={answers:$t}}o("respondServerRequest",{id:z.id,result:{answers:K}})}function dt(z){o("respondServerRequest",{id:z.id,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from CodexUI."}]}})}function pt(z){o("respondServerRequest",{id:z.id,result:{success:!0,contentItems:[]}})}function Yt(z){o("respondServerRequest",{id:z.id,result:{}})}function In(z){o("respondServerRequest",{id:z.id,error:{code:-32e3,message:"Rejected from CodexUI."}})}return(z,G)=>(C(),Ze(Qs,{to:"body"},[e.request?(C(),I("section",{key:0,class:"thread-pending-request",style:kr(r.value)},[f("article",{class:Ye(["thread-pending-request-shell",{"thread-pending-request-shell--no-top-radius":e.hasQueueAbove}])},[q(e.request)?(C(),I(qe,{key:0},[f("p",mM,k(je(e.request)),1),Ie(e.request)?(C(),I("p",{key:0,class:"thread-pending-request-command-line",title:Ie(e.request)},k(Ie(e.request)),9,vM)):Z("",!0),f("section",gM,[f("div",{class:"thread-pending-request-options",role:"radiogroup","aria-label":v(g)("Approval choices")},[(C(!0),I(qe,null,At(Se.value,(K,pe)=>(C(),I("button",{key:K.id,type:"button",class:Ye(["thread-pending-request-option",{"is-selected":a.value===K.id}]),"aria-pressed":a.value===K.id,onClick:Ne=>ie(K.id)},[f("span",bM,k(pe+1)+".",1),f("span",TM,k(K.label),1)],10,wM))),128))],8,yM),f("footer",kM,[f("label",{class:Ye(["thread-pending-request-inline-input",{"is-active":a.value==="decline"||s.value.length>0}])},[G[11]||(G[11]=f("span",{class:"thread-pending-request-option-index"},"3.",-1)),f("input",{class:"thread-pending-request-inline-control",type:"text",value:s.value,placeholder:v(g)("No, and tell Codex what to do differently"),onFocus:Ge,onInput:Te,onKeydown:G[0]||(G[0]=xn(st(K=>Fe(e.request),["prevent"]),["enter"]))},null,40,CM)],2),f("button",{type:"button",class:"thread-pending-request-secondary",onClick:G[1]||(G[1]=K=>Be(e.request,"cancel"))},k(v(g)("Skip")),1),f("button",{type:"button",class:"thread-pending-request-primary",onClick:G[2]||(G[2]=K=>Fe(e.request))},k(v(g)("Send")),1)]),e.panelError?(C(),I("p",SM,k(e.panelError),1)):Z("",!0)])],64)):(C(),I(qe,{key:1},[f("header",_M,[f("div",xM,[f("p",AM,k(ve(e.request)),1),f("p",IM,k(je(e.request)),1)]),(e.requestCount??0)>1?(C(),I("span",PM,k(e.requestCount??0)+" "+k(v(g)("pending")),1)):Z("",!0)]),Ie(e.request)?(C(),I("div",RM,[f("code",EM,k(Ie(e.request)),1)])):Z("",!0),e.panelError?(C(),I("p",MM,k(e.panelError),1)):Z("",!0),e.request.method==="mcpServer/elicitation/request"?(C(),I("section",$M,[wt(e.request)?(C(),I("p",jM,k(v(g)("Server"))+": "+k(wt(e.request)),1)):Z("",!0),St(e.request)?(C(),I("a",{key:1,class:"thread-pending-request-link",href:St(e.request),target:"_blank",rel:"noopener noreferrer"},k(v(g)("Open authorization link")),9,LM)):Z("",!0),(C(!0),I(qe,null,At(Qe(e.request),K=>(C(),I("div",{key:`${e.request.id}:${K.key}`,class:"thread-pending-request-question"},[f("p",NM,[vs(k(K.label),1),K.required?(C(),I("span",OM," *")):Z("",!0)]),K.description?(C(),I("p",DM,k(K.description),1)):Z("",!0),K.kind==="string"||K.kind==="number"?(C(),I("label",FM,[f("span",BM,k(v(g)("Value")),1),f("input",{class:"thread-pending-request-input",type:K.inputType,value:String(te(e.request.id,K)??""),onInput:pe=>$e(e.request.id,K,pe)},null,40,UM)])):K.kind==="boolean"?(C(),I("div",qM,[f("span",zM,k(v(g)("Choice")),1),Me(Zo,{class:"thread-pending-request-dropdown","model-value":ce(te(e.request.id,K)),options:le(K),placeholder:v(g)("Select true or false"),"onUpdate:modelValue":pe=>j(e.request.id,K,pe)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):K.kind==="singleEnum"?(C(),I("div",HM,[f("span",WM,k(v(g)("Choice")),1),Me(Zo,{class:"thread-pending-request-dropdown","model-value":String(te(e.request.id,K)??""),options:ne(K),placeholder:v(g)("Select an option"),"enable-search":"","search-placeholder":v(g)("Search options..."),"onUpdate:modelValue":pe=>R(e.request.id,K,pe)},null,8,["model-value","options","placeholder","search-placeholder","onUpdate:modelValue"])])):(C(),I("div",VM,[(C(!0),I(qe,null,At(K.options,pe=>(C(),I("label",{key:`${e.request.id}:${K.key}:${pe.value}`,class:"thread-pending-request-checkbox-row"},[f("input",{class:"thread-pending-request-checkbox",type:"checkbox",checked:V(e.request.id,K).includes(pe.value),onChange:Ne=>W(e.request.id,K,pe.value,Ne)},null,40,GM),f("span",KM,k(pe.label),1)]))),128))]))]))),128)),p.value?(C(),I("p",YM,k(p.value),1)):Z("",!0),f("footer",JM,[f("button",{type:"button",class:"thread-pending-request-secondary",onClick:G[3]||(G[3]=K=>ze(e.request,"cancel"))},k(v(g)("Cancel")),1),f("button",{type:"button",class:"thread-pending-request-secondary",onClick:G[4]||(G[4]=K=>ze(e.request,"decline"))},k(v(g)("Decline")),1),f("button",{type:"button",class:"thread-pending-request-primary",onClick:G[5]||(G[5]=K=>ze(e.request,"accept"))},k(v(g)("Continue")),1)])])):e.request.method==="item/tool/requestUserInput"?(C(),I("section",QM,[(C(!0),I(qe,null,At(Pe(e.request),K=>{var pe;return C(),I("div",{key:`${e.request.id}:${K.id}`,class:"thread-pending-request-question"},[f("p",XM,k(K.header||K.question),1),K.question?(C(),I("p",ZM,k(K.question),1)):Z("",!0),K.options.length>0?(C(),I("div",e$,[f("div",t$,[f("span",n$,k(v(g)("Choice")),1),Me(Zo,{class:"thread-pending-request-dropdown","model-value":Re(e.request.id,K.id,((pe=K.options[0])==null?void 0:pe.label)||""),options:gt(K),placeholder:v(g)("Choice"),"onUpdate:modelValue":Ne=>Le(e.request.id,K.id,Ne)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),at(e.request.id,K.id,K.options)?(C(),I("p",o$,k(at(e.request.id,K.id,K.options)),1)):Z("",!0)])):Z("",!0),K.isOther?(C(),I("label",r$,[f("span",a$,k(v(g)("Other answer")),1),f("input",{class:"thread-pending-request-input",type:"text",value:Ue(e.request.id,K.id),placeholder:v(g)("Other answer"),onInput:Ne=>ft(e.request.id,K.id,Ne)},null,40,s$)])):Z("",!0)])}),128)),f("footer",i$,[f("button",{type:"button",class:"thread-pending-request-primary",onClick:G[6]||(G[6]=K=>bt(e.request))},k(v(g)("Send")),1)])])):e.request.method==="item/tool/call"?(C(),I("section",l$,[f("button",{type:"button",class:"thread-pending-request-primary",onClick:G[7]||(G[7]=K=>dt(e.request))},k(v(g)("Fail Tool Call")),1),f("button",{type:"button",class:"thread-pending-request-secondary",onClick:G[8]||(G[8]=K=>pt(e.request))},k(v(g)("Success (Empty)")),1)])):(C(),I("section",c$,[f("button",{type:"button",class:"thread-pending-request-primary",onClick:G[9]||(G[9]=K=>Yt(e.request))},k(v(g)("Return Empty Result")),1),f("button",{type:"button",class:"thread-pending-request-secondary",onClick:G[10]||(G[10]=K=>In(e.request))},k(v(g)("Reject Request")),1)]))],64))],2)],4)):Z("",!0)]))}}),d$=yt(u$,[["__scopeId","data-v-1f49cff5"]]),f$={key:0,class:"queued-messages"},p$={class:"queued-messages-inner"},h$=["onDragstart","onDragover","onDragleave","onDrop"],m$=["aria-label","title"],v$={class:"queued-row-text"},g$={key:0,class:"queued-row-badge"},y$={class:"queued-row-actions"},w$=["title","onClick"],b$=["title","onClick"],T$=["aria-label","title","onClick"],k$=en({__name:"QueuedMessages",props:{messages:{}},emits:["edit","steer","delete","reorder"],setup(e,{emit:t}){const n=t,{t:o}=io(),r=x(""),a=x("");function s(w,A){var M;r.value=A,a.value="",(M=w.dataTransfer)==null||M.setData("text/plain",A),w.dataTransfer&&(w.dataTransfer.effectAllowed="move")}function i(w){!r.value||r.value===w||(a.value=w)}function u(w){a.value===w&&(a.value="")}function h(w){const A=r.value;p(),!(!A||A===w)&&n("reorder",{draggedId:A,targetId:w})}function p(){r.value="",a.value=""}function g(w){var F,H,q;const A=w.text.trim();if(A)return A;const M=[],U=((F=w.imageUrls)==null?void 0:F.length)??0,Y=((H=w.fileAttachments)==null?void 0:H.length)??0,ue=((q=w.skills)==null?void 0:q.length)??0;return U>0&&M.push(`${U} ${o(U===1?"image":"images")}`),Y>0&&M.push(`${Y} ${o(Y===1?"file":"files")}`),ue>0&&M.push(`${ue} ${o(ue===1?"skill":"skills")}`),M.join(", ")||o("(empty queued message)")}return(w,A)=>e.messages.length>0?(C(),I("div",f$,[f("div",p$,[(C(!0),I(qe,null,At(e.messages,M=>(C(),I("div",{key:M.id,class:Ye(["queued-row",{"is-dragging":r.value===M.id,"is-drop-target":a.value===M.id&&r.value!==M.id}]),draggable:"true",onDragstart:U=>s(U,M.id),onDragover:st(U=>i(M.id),["prevent"]),onDragleave:U=>u(M.id),onDrop:st(U=>h(M.id),["prevent"]),onDragend:p},[f("button",{class:"queued-row-drag",type:"button","aria-label":v(o)("Drag to reorder queued message"),title:v(o)("Drag to reorder queued message")},[...A[0]||(A[0]=[f("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[f("path",{fill:"currentColor",d:"M9 5.5A1.5 1.5 0 1 1 6 5.5a1.5 1.5 0 0 1 3 0m0 6.5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0m-1.5 8A1.5 1.5 0 1 0 7.5 17a1.5 1.5 0 0 0 0 3m10-13A1.5 1.5 0 1 0 17.5 4a1.5 1.5 0 0 0 0 3m1.5 5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0m-1.5 8a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3"})],-1)])],8,m$),A[2]||(A[2]=f("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[f("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})],-1)),f("span",v$,k(g(M)),1),M.awaitingCompaction?(C(),I("span",g$,k(v(o)("Compacts context before send")),1)):Z("",!0),f("div",y$,[f("button",{class:"queued-row-edit",type:"button",title:v(o)("Edit queued message"),onClick:U=>w.$emit("edit",M.id)},k(v(o)("Edit")),9,w$),f("button",{class:"queued-row-steer",type:"button",title:v(o)("Send now without interrupting work"),onClick:U=>w.$emit("steer",M.id)},k(v(o)("Steer")),9,b$),f("button",{class:"queued-row-delete",type:"button","aria-label":v(o)("Delete queued message"),title:v(o)("Delete queued message"),onClick:U=>w.$emit("delete",M.id)},[...A[1]||(A[1]=[f("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[f("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"})],-1)])],8,T$)])],42,h$))),128))])])):Z("",!0)}}),C$=yt(k$,[["__scopeId","data-v-631d6962"]]),S$={key:0,class:"rate-limit-status","aria-live":"polite"},_$=["title"],x$={class:"rate-limit-card-header"},A$={class:"rate-limit-card-title"},I$={key:0,class:"rate-limit-card-plan"},P$={class:"rate-limit-card-metrics"},R$={key:0,class:"rate-limit-card-footer"},E$=en({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){const{t}=io();function n(F){var H,q;return((H=F.limitId)==null?void 0:H.trim())||((q=F.limitName)==null?void 0:q.trim())||"__default__"}function o(F){var H,q;return((H=F.limitName)==null?void 0:H.trim())||((q=F.limitId)==null?void 0:q.trim())||t("Rate limits")}function r(F){const H=F.trim();return H?H.replace(/[_-]+/g," ").replace(/\b\w/g,q=>q.toUpperCase()):""}function a(F){return!F||F<=0?t("Window"):F%1440===0?`${F/1440}d`:F%60===0?`${F/60}h`:F<60?`${F}m`:`${Math.round(F/60*10)/10}h`}function s(F){const H=Math.max(0,Math.min(100,100-F));return`${Math.round(H)}% ${t("left")}`}function i(F){return`${Math.round(F)}%`}function u(F,H){return{key:H,label:`${a(F.windowDurationMins)} ${s(F.usedPercent)}`}}function h(F){const H=[];return F.primary&&H.push(u(F.primary,"primary")),F.secondary&&H.push(u(F.secondary,"secondary")),H}function p(F){if(!F)return"";const H=new Date(F*1e3),q=H.getMonth()+1,me=String(H.getDate()).padStart(2,"0"),we=String(H.getHours()).padStart(2,"0"),ve=String(H.getMinutes()).padStart(2,"0");return`${q}.${me} ${we}:${ve}`}function g(F){if(!(F!=null&&F.resetsAt))return"";const H=F.resetsAt*1e3-Date.now();if(H<=0)return t("Resetting now");const q=Math.round(H/6e4);if(q<60)return`${t("Resets in")} ${q}m`;const me=Math.round(q/60);if(me<24)return`${t("Resets in")} ${me}h`;const we=Math.round(me/24);return`${t("Resets in")} ${we}d`}function w(F){return[F.primary,F.secondary].filter(H=>H!==null)}function A(F){const H=w(F);return H.length===0?null:[...H].sort((q,me)=>{const we=q.windowDurationMins??Number.MAX_SAFE_INTEGER,ve=me.windowDurationMins??Number.MAX_SAFE_INTEGER;return we!==ve?we-ve:(q.resetsAt??Number.MAX_SAFE_INTEGER)-(me.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function M(F){const H=w(F);if(H.length===0)return"";const q=[...H].sort((we,ve)=>{const je=we.windowDurationMins??-1,ge=ve.windowDurationMins??-1;return je!==ge?ge-je:(ve.resetsAt??-1)-(we.resetsAt??-1)})[0],me=p(q.resetsAt);return me||""}function U(F){const H=F.credits;return H?H.unlimited?t("Unlimited credits"):H.balance?`${t("Credits")} ${H.balance}`:H.hasCredits?t("Credits available"):"":""}function Y(F){return[g(A(F)),M(F),U(F)].filter(H=>H.length>0)}function ue(F){const H=[o(F)];for(const q of h(F))H.push(q.label);for(const q of w(F))H.push(`${a(q.windowDurationMins)} used ${i(q.usedPercent)}`);for(const q of Y(F))H.push(q);return H.join(`
62
+ `)}return(F,H)=>e.snapshots.length>0?(C(),I("aside",S$,[(C(!0),I(qe,null,At(e.snapshots,q=>(C(),I("div",{key:n(q),class:"rate-limit-card",title:ue(q)},[f("div",x$,[f("span",A$,k(o(q)),1),q.planType?(C(),I("span",I$,k(r(q.planType)),1)):Z("",!0)]),f("div",P$,[(C(!0),I(qe,null,At(h(q),me=>(C(),I("span",{key:me.key,class:"rate-limit-card-metric"},k(me.label),1))),128))]),Y(q).length>0?(C(),I("div",R$,k(Y(q).join(" | ")),1)):Z("",!0)],8,_$))),128))])):Z("",!0)}}),M$=yt(E$,[["__scopeId","data-v-1fd5e1ec"]]),$$=["aria-label"],j$=["aria-checked","onClick"],L$={class:"runtime-toggle-option-label"},N$=en({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:o}=io(),r=[{value:"local",label:o("Local project"),icon:Xf},{value:"worktree",label:o("New worktree"),icon:bu}];function a(s){n("update:modelValue",s)}return(s,i)=>(C(),I("div",{class:"runtime-toggle",role:"radiogroup","aria-label":v(o)("Continue in")},[(C(),I(qe,null,At(r,u=>f("button",{key:u.value,class:Ye(["runtime-toggle-option",{"is-selected":e.modelValue===u.value}]),type:"button",role:"radio","aria-checked":e.modelValue===u.value,onClick:h=>a(u.value)},[(C(),Ze(Nf(u.icon),{class:"runtime-toggle-option-icon"})),f("span",L$,k(u.label),1)],10,j$)),64))],8,$$))}}),O$=yt(N$,[["__scopeId","data-v-4d282f1a"]]),D$={},F$={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 B$(e,t){return C(),I("svg",F$,[...t[0]||(t[0]=[f("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),f("path",{d:"M9 4l0 16"},null,-1)])])}const ky=yt(D$,[["render",B$]]),U$={},q$={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function z$(e,t){return C(),I("svg",q$,[...t[0]||(t[0]=[f("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 H$=yt(U$,[["render",z$]]),W$={class:"sidebar-thread-controls"},V$=["aria-label","title"],G$=["aria-label","title"],K$=en({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=io();return(n,o)=>(C(),I("div",W$,[f("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?v(t)("Expand sidebar"):v(t)("Collapse sidebar"),title:e.isSidebarCollapsed?v(t)("Expand sidebar"):v(t)("Collapse sidebar"),onClick:o[0]||(o[0]=r=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(C(),Ze(H$,{key:0,class:"sidebar-thread-controls-icon"})):(C(),Ze(ky,{key:1,class:"sidebar-thread-controls-icon"}))],8,V$),er(n.$slots,"default",{},void 0),e.showNewThreadButton?(C(),I("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":v(t)("Start new thread"),title:v(t)("Start new thread"),onClick:o[1]||(o[1]=r=>n.$emit("start-new-thread"))},[Me(Li,{class:"sidebar-thread-controls-icon"})],8,G$)):Z("",!0)]))}}),Bm=yt(K$,[["__scopeId","data-v-39c4ec05"]]),Y$={class:"sidebar-settings-account-section"},J$={class:"sidebar-settings-account-header"},Q$={class:"sidebar-settings-account-header-main"},X$=["aria-expanded","title"],Z$={class:"sidebar-settings-account-collapse-icon"},ej={class:"sidebar-settings-account-title"},tj={class:"sidebar-settings-account-count"},nj=["disabled"],oj={key:0,class:"sidebar-settings-account-error visible-error-with-feedback"},rj=["href"],aj={class:"sidebar-settings-account-login"},sj=["disabled"],ij=["href"],lj={key:1,class:"sidebar-settings-account-empty"},cj={key:2,class:"sidebar-settings-account-list"},uj=["title","onMouseenter","onMouseleave"],dj={class:"sidebar-settings-account-main"},fj={class:"sidebar-settings-account-email"},pj={class:"sidebar-settings-account-meta"},hj={class:"sidebar-settings-account-quota"},mj={class:"sidebar-settings-account-id"},vj={class:"sidebar-settings-account-actions"},gj=["disabled","onClick"],yj=["disabled","onClick"],wj=en({__name:"SettingsAccountsPanel",props:{accounts:{},isAccountsSectionCollapsed:{type:Boolean},isRefreshingAccounts:{type:Boolean},isSwitchingAccounts:{type:Boolean},isStartingCodexLogin:{type:Boolean},isCompletingCodexLogin:{type:Boolean},accountActionError:{},codexLoginUrl:{},feedbackMailto:{},isAccountUnavailable:{type:Function},isRemoveConfirmationActive:{type:Function},isRemoveVisible:{type:Function},buildAccountTitle:{type:Function},formatAccountMeta:{type:Function},formatAccountQuota:{type:Function},shortAccountId:{type:Function},isAccountActionDisabled:{type:Function},getAccountSwitchLabel:{type:Function},getAccountRemoveLabel:{type:Function},onRefreshAccounts:{type:Function},onStartCodexLogin:{type:Function},onSwitchAccount:{type:Function},onRemoveAccount:{type:Function},onAccountCardPointerEnter:{type:Function},onAccountCardPointerLeave:{type:Function},toggleAccountsSectionCollapsed:{type:Function},prepareFeedbackLink:{type:Function}},setup(e){const{t}=io();return(n,o)=>(C(),I("div",Y$,[f("div",J$,[f("div",Q$,[f("button",{class:"sidebar-settings-account-collapse",type:"button","aria-expanded":!e.isAccountsSectionCollapsed,title:e.isAccountsSectionCollapsed?v(t)("Expand accounts"):v(t)("Collapse accounts"),onClick:o[0]||(o[0]=(...r)=>e.toggleAccountsSectionCollapsed&&e.toggleAccountsSectionCollapsed(...r))},[f("span",Z$,k(e.isAccountsSectionCollapsed?"▸":"▾"),1)],8,X$),f("span",ej,k(v(t)("Accounts")),1),f("span",tj,k(e.accounts.length),1)]),f("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:e.isRefreshingAccounts||e.isSwitchingAccounts||e.isStartingCodexLogin||e.isCompletingCodexLogin,onClick:o[1]||(o[1]=(...r)=>e.onRefreshAccounts&&e.onRefreshAccounts(...r))},k(e.isRefreshingAccounts?v(t)("Reloading…"):v(t)("Reload")),9,nj)]),e.isAccountsSectionCollapsed?Z("",!0):(C(),I(qe,{key:0},[e.accountActionError?(C(),I("div",oj,[f("span",null,k(e.accountActionError),1),f("a",{class:"visible-error-feedback",href:e.feedbackMailto,onClick:o[2]||(o[2]=r=>e.prepareFeedbackLink(r,e.accountActionError))},k(v(t)("Send feedback")),9,rj)])):Z("",!0),f("div",aj,[f("button",{class:"sidebar-settings-account-login-button",type:"button",disabled:e.isRefreshingAccounts||e.isSwitchingAccounts||e.isStartingCodexLogin||e.isCompletingCodexLogin,onClick:o[3]||(o[3]=(...r)=>e.onStartCodexLogin&&e.onStartCodexLogin(...r))},k(e.isStartingCodexLogin?v(t)("Starting login…"):v(t)("Login")),9,sj),e.codexLoginUrl?(C(),I("a",{key:0,class:"sidebar-settings-account-login-link",href:e.codexLoginUrl,target:"_blank",rel:"noreferrer"},k(v(t)("Open login URL")),9,ij)):Z("",!0)]),e.accounts.length===0?(C(),I("p",lj,k(v(t)("Click Login, or run `codex login`, then click reload.")),1)):(C(),I("div",cj,[(C(!0),I(qe,null,At(e.accounts,r=>(C(),I("article",{key:r.storageId,class:Ye(["sidebar-settings-account-item",{"is-active":r.isActive,"is-unavailable":e.isAccountUnavailable(r),"is-confirming-remove":e.isRemoveConfirmationActive(r),"is-remove-visible":e.isRemoveVisible(r)}]),title:e.buildAccountTitle(r),onMouseenter:a=>e.onAccountCardPointerEnter(r.storageId),onMouseleave:a=>e.onAccountCardPointerLeave(r.storageId)},[f("div",dj,[f("p",fj,k(r.email||v(t)("Account")),1),f("p",pj,k(e.formatAccountMeta(r)),1),f("p",hj,k(e.formatAccountQuota(r)),1),f("p",mj," Workspace "+k(e.shortAccountId(r.accountId)),1)]),f("div",vj,[f("button",{class:"sidebar-settings-account-switch",type:"button",disabled:e.isAccountActionDisabled(r)||r.isActive||e.isAccountUnavailable(r),onClick:a=>e.onSwitchAccount(r.storageId)},k(e.getAccountSwitchLabel(r)),9,gj),f("button",{class:Ye(["sidebar-settings-account-remove",{"is-visible":e.isRemoveVisible(r),"is-confirming":e.isRemoveConfirmationActive(r)}]),type:"button",disabled:e.isAccountActionDisabled(r),onClick:a=>e.onRemoveAccount(r.storageId)},k(e.getAccountRemoveLabel(r)),11,yj)])],42,uj))),128))]))],64))]))}}),bj=yt(wj,[["__scopeId","data-v-828a7adf"]]);function Tj(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 Cy(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!Tj(e))throw new Error("Copy failed")}const kj={class:"right-git-panel"},Cj={class:"rgp-review-label"},Sj={class:"rgp-review-delta"},_j={class:"rgp-added"},xj={class:"rgp-removed"},Aj={class:"rgp-state"},Ij={class:"rgp-state-label"},Pj={class:"rgp-state-value"},Rj={key:0,class:"rgp-state-meta"},Ej=["href"],Mj={key:2,class:"rgp-section"},$j={class:"rgp-section-title"},jj={class:"rgp-file-list"},Lj=["title","onClick"],Nj={class:"rgp-file-status"},Oj={class:"rgp-file-path"},Dj={key:0,class:"rgp-file-previous-path"},Fj={class:"rgp-section"},Bj={class:"rgp-section-title"},Uj={class:"rgp-search-wrap"},qj=["placeholder"],zj={class:"rgp-branches",role:"listbox"},Hj={class:"rgp-branch-row"},Wj=["disabled","onClick"],Vj={class:"rgp-branch-name"},Gj={key:0,class:"rgp-branch-meta"},Kj={key:1,class:"rgp-branch-meta"},Yj=["disabled","onClick"],Jj={key:0,class:"rgp-empty"},Qj={class:"rgp-section"},Xj={class:"rgp-section-title"},Zj={class:"rgp-search-wrap"},eL=["placeholder"],tL={class:"rgp-toggle-row"},nL={class:"rgp-commit-list"},oL={key:0,class:"rgp-empty"},rL={key:1,class:"rgp-empty"},aL={key:2,class:"rgp-empty is-error"},sL=["disabled","title","onClick"],iL={class:"rgp-commit-top"},lL=["title","onClick","onKeydown"],cL={class:"rgp-commit-meta"},uL={key:0,class:"rgp-branch-meta"},dL={class:"rgp-commit-subject"},fL={key:0,class:"rgp-empty"},pL={key:3,class:"rgp-section"},hL={class:"rgp-section-title"},mL=["title"],vL=["disabled"],gL={class:"rgp-commit-detail-subject"},yL={class:"rgp-file-list"},wL={key:0,class:"rgp-empty"},bL={key:1,class:"rgp-empty is-error"},TL=["title","onClick"],kL={class:"rgp-file-meta-row"},CL={class:"rgp-file-status"},SL={class:"rgp-file-delta"},_L={class:"rgp-added"},xL={class:"rgp-removed"},AL={class:"rgp-file-path"},IL={key:0,class:"rgp-file-previous-path"},PL={key:0,class:"rgp-empty"},RL=en({__name:"RightGitPanel",props:{currentBranch:{},headSha:{},headSubject:{},headDate:{},detached:{type:Boolean},dirty:{type:Boolean},worktreeChangeSummary:{},worktreeChanges:{},branches:{},commitsByBranch:{},commitsLoadingFor:{},commitsError:{},commitFilesBySha:{},commitFilesLoadingFor:{},commitFilesError:{},loading:{type:Boolean},busy:{type:Boolean},error:{},reviewOpen:{type:Boolean},showReview:{type:Boolean}},emits:["toggleReview","checkoutBranch","resetBranchToCommit","loadCommits","loadCommitFiles","openCommitFile"],setup(e,{emit:t}){const n=e,o=t,r=x(null),a=x(""),s=x(""),i=x(""),u=x(""),h=x(""),p=x(""),g=x(!0),w=X(()=>n.showReview!==!1),{buildFeedbackMailto:A,feedbackMailtoBase:M,recordVisibleFailure:U}=Zf(),{t:Y}=io(),ue=M();function F(ee,te){U(te);const V=ee.currentTarget;V instanceof HTMLAnchorElement&&(V.href=A())}const H=X(()=>n.currentBranch?n.currentBranch:n.headSubject?n.headSubject:n.headSha?`${Y("Detached")} ${n.headSha}`:n.loading?Y("Loading branch..."):Y("Detached HEAD")),q=X(()=>{var V;const ee=[n.headSha,n.headDate].filter(Boolean).join(" · "),te=((V=n.headSubject)==null?void 0:V.trim())??"";return te&&ee?`${te} (${ee})`:te||ee}),me=X(()=>n.busy||n.loading),we=X(()=>n.error||(n.dirty?Y("Tracked changes must be committed, stashed, or discarded before switching or resetting. Untracked files are allowed unless Git would overwrite them."):"")),ve=X(()=>n.error?"error":"info"),je=X(()=>{const ee=a.value.trim().toLowerCase(),te=[...n.branches].sort((V,$e)=>V.isRemote===!0&&$e.isRemote!==!0?1:V.isRemote!==!0&&$e.isRemote===!0?-1:0);return ee?te.filter(V=>V.label.toLowerCase().includes(ee)||V.value.toLowerCase().includes(ee)):te}),ge=X(()=>n.branches.find(ee=>ee.value===i.value)??null),Ie=X(()=>{var ee;return((ee=ge.value)==null?void 0:ee.isRemote)===!0}),De=X(()=>i.value?`${i.value}\0${g.value?"with-reset-history":"without-reset-history"}`:""),fe=X(()=>De.value?n.commitsByBranch[De.value]||[]:[]),Se=X(()=>fe.value.find(ee=>ee.sha===u.value)??null),_e=X(()=>Se.value?n.commitFilesBySha[Se.value.sha]||[]:[]),Pe=X(()=>{const ee=s.value.trim().toLowerCase(),te=fe.value;return ee?te.filter(V=>V.sha.toLowerCase().includes(ee)||V.shortSha.toLowerCase().includes(ee)||V.subject.toLowerCase().includes(ee)||V.date.toLowerCase().includes(ee)):te});function Re(ee){i.value=ee,u.value="",o("loadCommits",{branch:ee,includeResetHistory:g.value})}function Ue(){i.value&&o("loadCommits",{branch:i.value,includeResetHistory:g.value})}function Le(ee){var V;const te=((V=n.headSha)==null?void 0:V.trim())??"";return te?ee.sha===te||ee.shortSha===te||ee.sha.startsWith(te):!1}function gt(ee){return`${Y("Show")} ${ee.shortSha} ${Y("files")}`}function ft(ee){u.value=ee.sha,o("loadCommitFiles",ee.sha)}function at(ee){const te=ee.sha.trim()||ee.shortSha.trim();te&&(h.value=ee.sha,Cy(te).catch(()=>{h.value=""}))}function it(){!i.value||!Se.value||Ie.value||o("resetBranchToCommit",{branch:i.value,sha:Se.value.sha})}function wt(ee){return typeof ee=="number"&&Number.isFinite(ee)?String(ee):"-"}function St(ee){Se.value&&o("openCommitFile",{sha:Se.value.sha,path:ee})}function Qe(ee){n.headSha&&o("openCommitFile",{sha:n.headSha,path:ee})}function et(){var te,V;const ee=(te=n.currentBranch)==null?void 0:te.trim();return ee||(((V=n.branches[0])==null?void 0:V.value)??"")}function re(){const ee=i.value||et();ee&&(i.value=ee,o("loadCommits",{branch:ee,includeResetHistory:g.value}))}return Cs(()=>{re(),Gt(()=>{var ee;return(ee=r.value)==null?void 0:ee.focus()})}),tt(()=>[n.currentBranch,n.branches.map(ee=>ee.value).join(`
63
+ `)],()=>{var $e;const ee=et();if(!ee){i.value="",p.value="";return}const te=(($e=n.currentBranch)==null?void 0:$e.trim())??"",V=te!==p.value;p.value=te,(V||!i.value||!n.branches.some(R=>R.value===i.value))&&(i.value=ee),i.value&&o("loadCommits",{branch:i.value,includeResetHistory:g.value})},{immediate:!0}),tt(fe,ee=>{u.value&&(ee.some(te=>te.sha===u.value)||(u.value=""))}),(ee,te)=>(C(),I("div",kj,[w.value?(C(),I("button",{key:0,class:"rgp-review",type:"button",onClick:te[0]||(te[0]=V=>o("toggleReview"))},[Me(Li,{class:"rgp-review-icon"}),f("span",Cj,k(e.reviewOpen?v(Y)("Review Worktree Changes (Open)"):v(Y)("Review Worktree Changes")),1),f("span",Sj,[f("span",_j,"+"+k(e.worktreeChangeSummary.addedLineCount),1),f("span",xj,"-"+k(e.worktreeChangeSummary.removedLineCount),1)])])):Z("",!0),f("div",Aj,[f("span",Ij,k(e.detached?v(Y)("Detached HEAD"):v(Y)("Current branch")),1),f("span",Pj,k(H.value),1),q.value?(C(),I("span",Rj,k(q.value),1)):Z("",!0)]),we.value?(C(),I("div",{key:1,class:Ye(["rgp-status",{"is-error":ve.value==="error"}])},[f("span",null,k(we.value),1),ve.value==="error"?(C(),I("a",{key:0,class:"rgp-feedback",href:v(ue),onClick:te[1]||(te[1]=V=>F(V,we.value))},k(v(Y)("Send feedback")),9,Ej)):Z("",!0)],2)):Z("",!0),n.worktreeChanges.length>0?(C(),I("div",Mj,[f("div",$j,k(n.worktreeChanges.length)+" "+k(n.worktreeChanges.length===1?v(Y)("file changed"):v(Y)("files changed")),1),f("div",jj,[(C(!0),I(qe,null,At(n.worktreeChanges,V=>(C(),I("button",{key:`${V.status}:${V.previousPath??""}:${V.path}`,class:"rgp-file",type:"button",title:V.previousPath?`${V.previousPath} → ${V.path}`:V.path,onClick:$e=>Qe(V.path)},[f("span",Nj,k(V.label),1),f("span",Oj,k(V.path),1),V.previousPath?(C(),I("span",Dj,"← "+k(V.previousPath),1)):Z("",!0)],8,Lj))),128))])])):Z("",!0),f("div",Fj,[f("div",Bj,k(v(Y)("Branches")),1),f("div",Uj,[Nt(f("input",{ref_key:"searchInputRef",ref:r,"onUpdate:modelValue":te[2]||(te[2]=V=>a.value=V),class:"rgp-search",type:"text",placeholder:v(Y)("Search branches...")},null,8,qj),[[sn,a.value]])]),f("ul",zj,[(C(!0),I(qe,null,At(je.value,V=>(C(),I("li",{key:V.value,class:"rgp-branch-item"},[f("div",Hj,[f("button",{class:Ye(["rgp-branch-button",{"is-current":V.value===e.currentBranch,"is-selected":V.value===i.value}]),type:"button",disabled:me.value,onClick:$e=>Re(V.value)},[f("span",Vj,k(V.label),1),V.value===e.currentBranch?(C(),I("span",Gj,k(v(Y)("current")),1)):V.isRemote?(C(),I("span",Kj,k(v(Y)("remote")),1)):Z("",!0)],10,Wj),V.value===i.value&&V.value!==e.currentBranch&&!V.isRemote?(C(),I("button",{key:0,class:"rgp-branch-checkout",type:"button",disabled:me.value,onClick:$e=>o("checkoutBranch",V.value)},k(v(Y)("Checkout")),9,Yj)):Z("",!0)])]))),128)),je.value.length===0?(C(),I("li",Jj,k(v(Y)("No branches found.")),1)):Z("",!0)])]),f("div",Qj,[f("div",Xj,k(v(Y)("Commits")),1),f("div",Zj,[Nt(f("input",{"onUpdate:modelValue":te[3]||(te[3]=V=>s.value=V),class:"rgp-search",type:"text",placeholder:v(Y)("Search commits...")},null,8,eL),[[sn,s.value]])]),f("label",tL,[Nt(f("input",{"onUpdate:modelValue":te[4]||(te[4]=V=>g.value=V),type:"checkbox",onChange:Ue},null,544),[[Lg,g.value]]),f("span",null,k(v(Y)("Reset-history refs")),1)]),f("div",nL,[i.value?e.commitsLoadingFor===De.value?(C(),I("div",rL,k(v(Y)("Loading commits...")),1)):e.commitsError?(C(),I("div",aL,k(e.commitsError),1)):(C(),I(qe,{key:3},[(C(!0),I(qe,null,At(Pe.value,V=>(C(),I("button",{key:V.sha,class:Ye(["rgp-commit",{"is-current":Le(V),"is-selected":V.sha===u.value}]),type:"button",disabled:me.value,title:gt(V),onClick:$e=>ft(V)},[f("span",iL,[f("span",{class:"rgp-ref",role:"button",tabindex:"0",title:h.value===V.sha?v(Y)("Copied commit ref"):`${v(Y)("Copy")} ${V.sha}`,onClick:st($e=>at(V),["stop"]),onKeydown:[xn(st($e=>at(V),["prevent","stop"]),["enter"]),xn(st($e=>at(V),["prevent","stop"]),["space"])]},k(V.shortSha),41,lL),f("span",cL,[Le(V)?(C(),I("span",uL,k(v(Y)("current")),1)):Z("",!0),f("span",null,k(V.date),1)])]),f("span",dL,k(V.subject),1)],10,sL))),128)),Pe.value.length===0?(C(),I("div",fL,k(v(Y)("No commits found.")),1)):Z("",!0)],64)):(C(),I("div",oL,k(v(Y)("Select a branch.")),1))])]),Se.value?(C(),I("div",pL,[f("div",hL,[f("span",{class:"rgp-ref",role:"button",tabindex:"0",title:h.value===Se.value.sha?v(Y)("Copied commit ref"):`${v(Y)("Copy")} ${Se.value.sha}`,onClick:te[5]||(te[5]=st(V=>at(Se.value),["stop"])),onKeydown:te[6]||(te[6]=xn(st(V=>at(Se.value),["prevent","stop"]),["enter"]))},k(Se.value.shortSha),41,mL),f("button",{class:"rgp-reset-commit",type:"button",disabled:me.value||Ie.value||!i.value,onClick:it},k(v(Y)("Reset")),9,vL)]),f("p",gL,k(Se.value.subject),1),f("div",yL,[e.commitFilesLoadingFor===Se.value.sha?(C(),I("div",wL,k(v(Y)("Loading files...")),1)):e.commitFilesError?(C(),I("div",bL,k(e.commitFilesError),1)):(C(),I(qe,{key:2},[(C(!0),I(qe,null,At(_e.value,V=>(C(),I("button",{key:`${V.status}:${V.previousPath??""}:${V.path}`,class:"rgp-file",type:"button",title:V.previousPath?`${V.previousPath} → ${V.path}`:V.path,onClick:$e=>St(V.path)},[f("span",kL,[f("span",CL,k(V.label),1),f("span",SL,[f("span",_L,"+"+k(wt(V.addedLineCount)),1),f("span",xL,"-"+k(wt(V.removedLineCount)),1)])]),f("span",AL,k(V.path),1),V.previousPath?(C(),I("span",IL,"← "+k(V.previousPath),1)):Z("",!0)],8,TL))),128)),_e.value.length===0?(C(),I("div",PL,k(v(Y)("No file changes.")),1)):Z("",!0)],64))])])):Z("",!0)]))}}),EL=yt(RL,[["__scopeId","data-v-76cdff49"]]),ML={class:"right-files-panel"},$L={class:"rfp-toolbar"},jL=["placeholder"],LL={key:0,class:"rfp-empty"},NL={key:1,class:"rfp-empty is-error"},OL={key:2,class:"rfp-empty"},DL={key:3,class:"rfp-groups"},FL=["aria-expanded","onClick"],BL={class:"rfp-dir-chevron","aria-hidden":"true"},UL={class:"rfp-dir-icon","aria-hidden":"true"},qL={class:"rfp-dir-name"},zL=["title","onClick"],HL={class:"rfp-file-label"},WL=en({__name:"RightFilesPanel",props:{cwd:{}},emits:["open-preview"],setup(e,{emit:t}){const n=e,o=t,{t:r}=io(),a=x([]),s=x(!1),i=x(""),u=x(""),h=x(new Set);function p(F){return F.sort((H,q)=>H.kind!==q.kind?H.kind==="dir"?-1:1:H.name.localeCompare(q.name,void 0,{numeric:!0,sensitivity:"base"}))}function g(F){const H=[],q=new Map;function me(we){let ve="",je=H;for(const ge of we){ve=ve?`${ve}/${ge}`:ge;let Ie=q.get(ve);Ie||(Ie={name:ge,path:"",relativePath:ve,kind:"dir",children:[]},q.set(ve,Ie),je.push(Ie)),je=Ie.children}return q.get(ve)}for(const we of F){const ve=we.relativePath.split("/").filter(Boolean);if(ve.length===0)continue;if(we.isDirectory){const De=me(ve);De.path=we.path;continue}const je=ve[ve.length-1],ge=ve.slice(0,-1);(ge.length>0?me(ge).children:H).push({name:je,path:we.path,relativePath:we.relativePath,kind:"file",children:[]})}p(H);for(const we of q.values())p(we.children);return H}const w=X(()=>g(a.value)),A=X(()=>{const F=u.value.trim().toLowerCase(),H=[];function q(we){return!F||we.relativePath.toLowerCase().includes(F)?!0:we.children.some(q)}function me(we,ve){for(const je of we){if(F&&!q(je)||(H.push({node:je,depth:ve}),je.kind==="file"))continue;(F?!0:!h.value.has(je.relativePath))&&me(je.children,ve+1)}}return me(w.value,0),H});function M(F){return u.value.trim()?!0:!h.value.has(F)}function U(F){const H=new Set(h.value);H.has(F)?H.delete(F):H.add(F),h.value=H}function Y(F){o("open-preview",{path:F.path,label:F.name})}async function ue(){const F=n.cwd.trim();if(!F){a.value=[],i.value="";return}s.value=!0,i.value="";try{a.value=await Gx(F)}catch(H){a.value=[],i.value=H instanceof Error?H.message:"Failed to load workspace files"}finally{s.value=!1}}return Cs(()=>{ue()}),tt(()=>n.cwd,()=>{h.value=new Set,u.value="",ue()}),(F,H)=>(C(),I("div",ML,[f("div",$L,[Nt(f("input",{"onUpdate:modelValue":H[0]||(H[0]=q=>u.value=q),class:"rfp-search",type:"text",placeholder:v(r)("Filter files...")},null,8,jL),[[sn,u.value]])]),s.value?(C(),I("div",LL,k(v(r)("Loading files...")),1)):i.value?(C(),I("div",NL,k(i.value),1)):A.value.length===0?(C(),I("div",OL,k(v(r)("No files in workspace.")),1)):(C(),I("div",DL,[(C(!0),I(qe,null,At(A.value,q=>(C(),I("div",{key:q.node.relativePath,class:"rfp-row",style:kr({paddingLeft:`${q.depth*12+6}px`})},[q.node.kind==="dir"?(C(),I("button",{key:0,class:"rfp-dir",type:"button","aria-expanded":M(q.node.relativePath),onClick:me=>U(q.node.relativePath)},[f("span",BL,k(M(q.node.relativePath)?"▾":"▸"),1),f("span",UL,k(M(q.node.relativePath)?"📂":"📁"),1),f("span",qL,k(q.node.name),1)],8,FL)):(C(),I("button",{key:1,class:"rfp-file",type:"button",title:q.node.relativePath,onClick:me=>Y(q.node)},[H[1]||(H[1]=f("span",{class:"rfp-file-icon","aria-hidden":"true"},"📄",-1)),f("span",HL,k(q.node.name),1)],8,zL))],4))),128))]))]))}}),VL=yt(WL,[["__scopeId","data-v-686d6084"]]),GL={class:"right-file-preview"},KL={class:"right-file-preview-header"},YL={class:"right-file-preview-title-wrap"},JL={class:"right-file-preview-title"},QL={class:"right-file-preview-path"},XL=["href"],ZL={class:"right-file-preview-body"},eN={key:0,class:"right-file-preview-empty"},tN={key:1,class:"right-file-preview-empty is-error"},nN=["src","alt"],oN={key:3,class:"right-file-preview-code"},rN={key:4,class:"right-file-preview-empty"},aN=["href"],sN={key:0,class:"right-file-preview-footer"},iN=en({__name:"RightFilePreview",props:{filePath:{},name:{}},setup(e){const t=e,{t:n}=io(),o=x(null),r=x(!1),a=x(""),s=X(()=>{const i=t.filePath.replace(/\\/g,"/"),u=i.startsWith("/")?i:`/${i}`;return`/codex-local-browse${encodeURI(u)}`});return tt(()=>t.filePath,async i=>{if(o.value=null,a.value="",!!i){r.value=!0;try{o.value=await Kx(i)}catch(u){a.value=u instanceof Error?u.message:"Failed to preview file"}finally{r.value=!1}}},{immediate:!0}),(i,u)=>(C(),I("div",GL,[f("div",KL,[f("div",YL,[f("span",JL,k(e.name),1),f("span",QL,k(e.filePath),1)]),f("a",{class:"right-file-preview-open",href:s.value,target:"_blank",rel:"noopener noreferrer"},k(v(n)("Open in browser")),9,XL)]),f("div",ZL,[r.value?(C(),I("div",eN,k(v(n)("Loading file…")),1)):a.value?(C(),I("div",tN,k(a.value),1)):o.value&&o.value.isImage?(C(),I("img",{key:2,class:"right-file-preview-image",src:s.value,alt:e.name},null,8,nN)):o.value&&o.value.isText&&o.value.content!==void 0?(C(),I("pre",oN,k(o.value.content),1)):(C(),I("div",rN,[f("p",null,k(v(n)("This file type cannot be previewed.")),1),f("a",{class:"right-file-preview-open",href:s.value,target:"_blank",rel:"noopener noreferrer"},k(v(n)("Open in browser")),9,aN)]))]),o.value&&o.value.truncated?(C(),I("div",sN,k(v(n)("File is large; showing the first part.")),1)):Z("",!0)]))}}),lN=yt(iN,[["__scopeId","data-v-11e988a2"]]),cN={},uN={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function dN(e,t){return C(),I("svg",uN,[...t[0]||(t[0]=[f("circle",{cx:"11",cy:"11",r:"8"},null,-1),f("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const Um=yt(cN,[["render",dN]]),fN={},pN={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function hN(e,t){return C(),I("svg",pN,[...t[0]||(t[0]=[f("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[f("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"}),f("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const mN=yt(fN,[["render",hN]]),vN={},gN={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function yN(e,t){return C(),I("svg",gN,[...t[0]||(t[0]=[f("path",{d:"M5 7l5 5-5 5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),f("path",{d:"M12 17h7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])])}const wN=yt(vN,[["render",yN]]),bN={},TN={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function kN(e,t){return C(),I("svg",TN,[...t[0]||(t[0]=[f("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 qm=yt(bN,[["render",kN]]);function Sy(e){var r;const t=e.replace(/\r\n/g,`
64
+ `).trim();if(!t)return null;const n=[],o=[];for(const a of t.split(`
65
+ `)){const s=a.trim();if(!s){n.length===0&&o.push("");continue}const i=s.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(i){const u=(i[1]??" ").toLowerCase();let h="pending";u==="x"&&(h="completed"),(u==="~"||u===">"||u==="-")&&(h="inProgress"),n.push({step:((r=i[2])==null?void 0:r.trim())??"",status:h});continue}o.push(s)}if(n.length===0){const a=CN(t);return a||null}return{explanation:o.join(`
66
+ `).trim(),steps:n.filter(a=>a.step.length>0)}}function CN(e){var a,s;const t=[],n=[],o=[];for(const i of e.split(`
67
+ `)){const u=i.trim();if(!u){t.length===0&&n.length===0&&o.push("");continue}const h=u.match(/^\d+[.)]\s+(.+)$/);if(h){t.push({step:((a=h[1])==null?void 0:a.trim())??"",status:"pending"});continue}const p=u.match(/^[-*]\s+(.+)$/);if(p){n.push({step:((s=p[1])==null?void 0:s.trim())??"",status:"pending"});continue}o.push(u)}const r=t.length>0?t:n;return r.length===0?null:{explanation:SN(o.join(`
68
+ `)),steps:r.filter(i=>i.step.length>0)}}function SN(e){return e.split(`
69
+ `).map(t=>t.replace(/^\s*#{1,6}\s*/,"")).join(`
70
+ `).trim()}function zm(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}:Sy(e.text)}function _N(e){return new Promise(t=>{typeof window<"u"?window.setTimeout(t,e):globalThis.setTimeout(t,e)})}function wo(e){return e.flatMap(t=>t.threads)}function xN(e,t){var o,r;const n=e.findIndex(a=>a.id===t);return n<0?"":((o=e[n+1])==null?void 0:o.id)??((r=e[n-1])==null?void 0:r.id)??""}function Hm(e){return(e instanceof Error?e.message:String(e??"")).includes("Codex CLI is not available")}function AN(e){if(e instanceof fa&&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 IN(e,t){if(!e||!t)return!1;const n=new Date(e).getTime(),o=new Date(t).getTime();return!Number.isFinite(n)||!Number.isFinite(o)?!1:n>o}function PN(e,t,n){return IN(e,t??n)}function _y(e){return e==="plan"?"plan":"default"}function gl(e){return typeof e=="string"?e.trim():""}function ca(){return Object.create(null)}function au(e){const t=ca();for(const[n,o]of Object.entries(e))t[n]=o;return t}function rc(e,t){if(!(t in e))return e;const n=ca();for(const[o,r]of Object.entries(e))o!==t&&(n[o]=r);return n}const Xs="__new-thread__",xy="__new-thread-provider__::";function Wm(e,t){let n=!1;const o=ca();for(const[r,a]of Object.entries(e)){if(r===Xs||r.startsWith(xy)||t.has(r)){o[r]=a;continue}n=!0}return n?o:e}function Hs(e){const t=e.trim().toLowerCase().replace(/_/g,"-");return!t||t==="openai"?"codex":t}function RN(e){return e===Xs}function Vc(e){const t=Hs(e);return t?`${xy}${t}`:""}function Ei(e){return e.trim()||Xs}function Vm(e,t){const n=Ei(t),o=gl(e[n]);return o||gl(e[Xs])}function Gc(e,t){const n=Ei(t);return _y(e[n])}function Gm(e,t,n){const o=Ei(t);if(RN(o))return rc(e,o);if(n==="plan"){const r=au(e);return r[o]="plan",r}return rc(e,o)}function Ay(e,t,n){return Math.min(Math.max(e,t),n)}function tl(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 Km(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:tl(t.totalTokens)??0,inputTokens:tl(t.inputTokens)??0,cachedInputTokens:tl(t.cachedInputTokens)??0,outputTokens:tl(t.outputTokens)??0,reasoningOutputTokens:tl(t.reasoningOutputTokens)??0}}function EN(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=Km(t.total),o=Km(t.last);if(!n||!o)return null;const r=tl(t.modelContextWindow),a=o.totalTokens,s=typeof r=="number"?Math.max(r-a,0):null,i=typeof r=="number"&&r>0?Ay(Math.round((s??0)/r*100),0,100):null;return{total:n,last:o,modelContextWindow:r,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function Qi(e,t){const n=[];for(const o of e)n.includes(o)||n.push(o);for(const o of t)n.includes(o.projectName)||n.push(o.projectName);return ps(e,n)?e:n}function Ud(e,t){const n=new Map(e.map(r=>[r.projectName,r])),o=t.map(r=>n.get(r)??null).filter(r=>r!==null);for(const r of e)t.includes(r.projectName)||o.push(r);return o}function ps(e,t){const n=Array.isArray(e)?e:[],o=Array.isArray(t)?t:[];if(n.length!==o.length)return!1;for(let r=0;r<n.length;r+=1)if(n[r]!==o[r])return!1;return!0}function MN(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const o=[...e],[r]=o.splice(t,1);return o.splice(n,0,r),o}function $N(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function jN(e=[],t=[]){var n,o,r,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)!==((o=t[s])==null?void 0:o.step)||((r=e[s])==null?void 0:r.status)!==((a=t[s])==null?void 0:a.status))return!1;return!0}function LN(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&jN(e.steps,t.steps)}function Kc(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 mf(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&ps(e.images,t.images)&&NN(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&$N(e.commandExecution,t.commandExecution)&&LN(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function yl(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 Ym(e,t,n={}){const o=new Map(e.map(p=>[p.id,p])),r=new Map(t.map(p=>[p.id,p])),a=t.map(p=>{const g=o.get(p.id);return g&&mf(g,p)?g:p});if(n.preserveMissing!==!0)return yl(e,a)?e:a;const s=e.map(p=>{const g=r.get(p.id);return!g||mf(p,g)?p:g}).filter(p=>!ep(p)||!DN(p,t)),i=new Set(e.map(p=>p.id)),u=a.filter(p=>!i.has(p.id)),h=[...s,...u];return yl(e,h)?e:h}function NN(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 o=e[n],r=t[n];if(o.path!==r.path||o.operation!==r.operation||o.movedToPath!==r.movedToPath||o.diff!==r.diff||o.addedLineCount!==r.addedLineCount||o.removedLineCount!==r.removedLineCount)return!1}return!0}function Ts(e){return e.replace(/\s+/gu," ").trim()}function ep(e){return e.messageType==="userMessage.optimistic"}function ON(e){return e.some(ep)}function DN(e,t){if(e.role!=="user")return!1;const n=Ts(e.text),o=Array.isArray(e.images)?e.images:[],r=Array.isArray(e.fileAttachments)?e.fileAttachments.length:0,a=Array.isArray(e.skills)?e.skills.length:0;return t.some(s=>{if(s===e||s.role!=="user"||ep(s))return!1;const i=Ts(s.text),u=Array.isArray(s.images)?s.images:[],h=Array.isArray(s.fileAttachments)?s.fileAttachments.length:0,p=Array.isArray(s.skills)?s.skills.length:0;return i===n&&ps(u,o)&&h===r&&p===a})}function FN(e){const t=[];let n=new Map;for(const o of e){if(!(o.role==="assistant"&&typeof o.messageType=="string"&&(o.messageType==="agentMessage"||o.messageType==="agentMessage.live"))){o.role==="user"&&(n=new Map),t.push(o);continue}const a=Ts(o.text);if(a.length===0){t.push(o);continue}const s=n.get(a);if(typeof s=="number"){t.splice(s,1);for(const[i,u]of n)u>s&&n.set(i,u-1);n.set(a,t.length),t.push(o)}else n.set(a,t.length),t.push(o)}return t}function BN(e,t){const n=new Set(t.map(a=>a.id)),o=new Set(t.filter(a=>a.role==="assistant").map(a=>Ts(a.text)).filter(a=>a.length>0));if(o.size===0)return e;const r=e.filter(a=>{if(a.messageType!=="agentMessage.live")return!0;if(n.has(a.id))return!1;const s=Ts(a.text);return s.length===0?!1:!o.has(s)});return r.length===e.length?e:r}function qu(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const o=e[n];if(mf(o,t))return e;const r=[...e];return r.splice(n,1,t),r}const Iy="worked";function Ks(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function UN(e){if(!Number.isFinite(e)||e<=0)return"<1s";const t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60,a=[];n>0&&a.push(`${n}h`),(o>0||n>0)&&a.push(`${o}m`);const s=r>0||a.length===0?r:0;return a.push(`${s}s`),a.join(" ")}function qN(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function zN(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 HN(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${UN(e.durationMs)}`,messageType:Iy,turnId:e.turnId,durationMs:e.durationMs}}function WN(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function VN(e,t){const n=HN(t),o=e.filter(s=>s.messageType!==Iy),r=WN(o);if(r<0)return[...o,n];const a=[...o];return a.splice(r,0,n),a}function xt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function GN(e,t){if(t.size===0)return e;let n=!1;const o={};for(const[r,a]of Object.entries(e)){if(t.has(r)){n=!0;continue}o[r]=a}return n?o:e}function KN(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 YN(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 JN(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 Tn(e,t){const n=Object.entries(e).filter(([o])=>t.has(o));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function Jm(e,t){const n=t.trim();if(!n)return e;let o=!1;const r=[];for(const a of e){const s=a.threads.filter(u=>u.id!==n),i=s.length!==a.threads.length;i&&(o=!0),s.length>0?r.push(i?{...a,threads:s}:a):a.threads.length===0&&r.push(a)}return o?r:e}function Yc(e,t){const n=new Map(e.map(r=>[r.projectName,r])),o=t.map(r=>{const a=n.get(r.projectName),s=new Map((a==null?void 0:a.threads.map(u=>[u.id,u]))??[]),i=r.threads.map(u=>{const h=s.get(u.id);return h&&KN(h,u)?h:u});return a&&a.projectName===r.projectName&&YN(a.threads,i)?a:{projectName:r.projectName,threads:i}});return JN(e,o)?e:o}function QN(e,t,n){const o=new Set(wo(t).map(i=>i.id)),r=wo(e).filter(i=>n[i.id]===!0&&!o.has(i.id));if(r.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 r){if(a.get(i.projectName)){const h=s.findIndex(p=>p.projectName===i.projectName);h>=0&&(s[h]={projectName:s[h].projectName,threads:[i,...s[h].threads]});continue}s.push({projectName:i.projectName,threads:[i]})}return s}function ji(e){return Wr(e)}function XN(e){const t=e.trim();if(!t)return"";const n=t.lastIndexOf(":");return n>=0?t.slice(n+1):t}function ZN(e){const t=e.label||Wr(e.remotePath),n=XN(e.hostId);return n?`${t} ${n}`:t}function Py(e){const t=(e==null?void 0:e.remoteProjects)??[];return new Map(t.map(n=>[n.id,n]))}function zu(e){if(!e)return[];const t=new Set(e.order),n=new Set((e.remoteProjects??[]).map(r=>r.id)),o=e.projectOrder.filter(r=>t.has(r)||n.has(r));for(const r of e.order)o.includes(r)||o.push(r);for(const r of n)o.includes(r)||o.push(r);return o}function vf(e,t){const n=Py(e);return zu(e).map(o=>{if(n.has(o))return o;const r=nt(o).trim(),a=ji(r);return t.has(a)?r:a})}function su(e,t){return nt(e).trim()===t||ji(e)===t}function eO(e,t){const n=new Set;for(const o of e.order)su(o,t)&&n.add(o);for(const o of e.active)su(o,t)&&n.add(o);for(const o of Object.keys(e.labels))su(o,t)&&n.add(o);return n}function tO(e,t,n){var h,p;const o=new Set((e.remoteProjects??[]).map(g=>g.id)),r=new Map;for(const g of e.order){const w=ji(g);r.has(w)||r.set(w,g)}for(const g of n){const w=((p=(h=g.threads[0])==null?void 0:h.cwd)==null?void 0:p.trim())??"";w&&r.set(g.projectName,w)}const a=[],s=g=>{g&&!a.includes(g)&&a.push(g)};for(const g of t){if(o.has(g)){s(g);continue}const w=r.get(g);w&&s(w)}for(const g of zu(e))s(g);const i=a.filter(g=>e.order.includes(g));for(const g of e.order)i.includes(g)||i.push(g);const u=e.active.filter(g=>i.includes(g));return u.length===0&&i.length>0&&u.push(i[0]),{order:i,active:u,projectOrder:a}}function nO(e,t,n){const o=vf(t,n);if(o.length===0)return e;const r=new Map(o.map((a,s)=>[a,s]));return[...e].sort((a,s)=>{if(wf(a)||wf(s))return 0;const i=r.get(a.projectName)??Number.POSITIVE_INFINITY,u=r.get(s.projectName)??Number.POSITIVE_INFINITY;return i===u?0:i-u})}function gf(e,t){const n=new Map,o=new Map,r=s=>{const i=nt(s).trim();if(!i)return;const u=Wr(i),h=n.get(u)??new Set;h.add(i),n.set(u,h)};for(const s of(t==null?void 0:t.order)??[]){const i=nt(s).trim();if(!i)continue;const u=Wr(i);ku(i)||o.set(u,(o.get(u)??0)+1),r(s)}for(const s of e)for(const i of s.threads){const u=nt(i.cwd).trim(),h=Wr(u),p=(t==null?void 0:t.order.some(g=>nt(g).trim()===u))===!0;ku(u)&&!p&&o.get(h)===1||r(i.cwd)}const a=new Set;for(const[s,i]of n.entries())i.size>1&&a.add(s);return a}function ku(e){return e.includes("/.codex/worktrees/")}function oO(e,t){const n=gf(e,t);if(n.size===0)return e;const o=new Set,r=new Set,a=new Map,s=new Set;for(const h of(t==null?void 0:t.order)??[]){const p=nt(h).trim();if(!p||(s.add(p),ku(p)))continue;const g=Wr(p);o.has(g)?(o.delete(g),r.add(g),a.delete(g)):r.has(g)||(o.add(g),a.set(g,p))}const i=[],u=new Map;for(const h of e)for(const p of h.threads){const g=nt(p.cwd).trim(),w=Wr(g),A=s.has(g),M=ku(g)&&!A&&o.has(w);let U=h.projectName;M&&n.has(w)?U=a.get(w)??h.projectName:g&&n.has(w)&&(U=g);const Y=p.projectName===U?p:{...p,projectName:U},ue=u.get(U);if(ue)ue.threads.push(Y);else{const F={projectName:U,threads:[Y]};u.set(U,F),i.push(F)}}return i}function rO(e,t,n){if(!t||t.order.length===0&&(t.remoteProjects??[]).length===0)return e;const o=new Set(e.map(s=>s.projectName)),r=[...e],a=Py(t);for(const s of zu(t)){if(a.has(s)){if(o.has(s))continue;r.push({projectName:s,threads:[]}),o.add(s);continue}const i=nt(s).trim();if(!i)continue;const u=ji(i),h=n.has(u)?i:u;o.has(h)||(r.push({projectName:h,threads:[]}),o.add(h))}return r}const yf=20;function Us(e){const t=e.split(`
71
+ `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,yf):"Untitled thread"}function aO(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||wu(t.cwd))}const Zs=new Map;let iu=0;function qd(e,t){const n=`${e}:${t.id}`,o=Zs.get(n);return o!==void 0?o:(iu+=1,Zs.set(n,iu),iu)}function sO(e){const t=`${e}:`;for(const n of[...Zs.keys()])n.startsWith(t)&&Zs.delete(n)}function iO(){Zs.clear(),iu=0}function lO(e){if(Zs.size!==0)for(const t of[...Zs.keys()]){const n=t.indexOf(":"),o=n>0?t.slice(0,n):"";e.has(o)||Zs.delete(t)}}function Qm(e,t){const n=t.trim();if(!n)return-1;const o=e.findIndex(i=>i.id===n);if(o>=0)return o;const r=`session-cmd-${n}`,a=e.findIndex(i=>i.id===r);if(a>=0)return a;const s="session-cmd-";if(n.startsWith(s)){const i=e.findIndex(u=>u.id===n.slice(s.length));if(i>=0)return i}return-1}function cO(e,t){var a,s;if(t.length===0)return e;const n=[...e],o=[],r=new Map;for(const i of t){const u=((a=i.reasoningAnchorMessageId)==null?void 0:a.trim())??"";if(u&&Qm(n,u)>=0)continue;const h=i.turnIndex;if(typeof h!="number"||!Number.isFinite(h))continue;const p=r.get(h)??[];p.push(i),r.set(h,p)}for(const i of[...t].reverse()){const u=((s=i.reasoningAnchorMessageId)==null?void 0:s.trim())??"";if(u){const M=Qm(n,u);if(M>=0){n.splice(M+1,0,i);continue}}const h=i.turnIndex;if(typeof h!="number"||!Number.isFinite(h)){o.push(i);continue}let p=-1,g=-1;const w=[];for(let M=0;M<n.length;M+=1)n[M].turnIndex===h&&(g=M,n[M].role==="user"?p=M:n[M].messageType!=="reasoning"&&w.push(M));if(w.some(M=>{const U=n[M].messageType;return U==="commandExecution"||U==="toolCall"||U==="fileChange"||U==="worked"})){const U=(r.get(h)??[]).indexOf(i),Y=U>=0?U:0;n.splice(w[Math.min(Y,w.length-1)]+1,0,i)}else if(p>=0)n.splice(p+1,0,i);else if(g>=0)n.splice(g+1,0,i);else continue}return o.length>0?[...n,...o.reverse()]:n}function uO(e,t,n){const o=new Set(n.map(s=>s.id)),r=new Map;for(const s of t)for(const i of s)o.has(i.id)||r.has(i.id)||r.set(i.id,i);const a=Array.from(r.values());for(const s of a)qd(e,s);return a.sort((s,i)=>qd(e,s)-qd(e,i))}function dO(e,t,n,o,r){const a=uO(e,o,t),s=new Map;let i;for(let w=0;w<t.length;w+=1){const A=t[w];A.role!=="user"||!Number.isInteger(A.turnIndex)||A.turnIndex<0||(i!==void 0&&s.set(i,w),i=A.turnIndex)}i!==void 0&&s.set(i,t.length);const u=new Map,h=[];for(const w of a){const A=w.turnIndex,M=Number.isInteger(A)&&A>=0?s.get(A):void 0;if(M===void 0){h.push(w);continue}const U=u.get(M);U?U.push(w):u.set(M,[w])}const p=[];for(let w=0;w<=t.length;w+=1)p.push(...u.get(w)??[]),w<t.length&&p.push(t[w]);p.push(...h);const g=FN(p);return[...cO(g,n),...r]}const Ry="codex-web-local.thread-read-state.v1",Xm="codex-web-local.thread-unread-cutoff.v1",Ey="codex-web-local.thread-token-usage.v1",My="codex-web-local.thread-reasoning.v1",$y="codex-web-local.thread-last-plan.v1",jy="codex-web-local.live-reasoning-snapshot.v1",Ly="codex-web-local.thread-terminal-open.v1",bf="codex-web-local.selected-thread-id.v1",Tf="codex-web-local.selected-model-by-context.v1",Ny="codex-web-local.selected-model-id.v1",Oy="codex-web-local.project-order.v1",Dy="codex-web-local.project-display-name.v1",kf="codex-web-local.collaboration-mode-by-context.v1",fO="codex-web-local.collaboration-mode.v1";function pO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ry);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Zm(e){typeof window>"u"||window.localStorage.setItem(Ry,JSON.stringify(e))}function hO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(My);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function zd(e){if(!(typeof window>"u")){try{window.localStorage.setItem(My,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e))t&&n.length>0&&ax(t,n)}}function mO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem($y);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Fy(e){if(!(typeof window>"u"))try{window.localStorage.setItem($y,JSON.stringify(e))}catch{}}function vO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(jy);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){const a=r;typeof(a==null?void 0:a.text)=="string"&&a.text.trim()&&typeof a.ts=="number"&&(n[o]={text:a.text,ts:a.ts})}return n}catch{return{}}}function gO(){if(typeof window>"u")return"";const e=window.localStorage.getItem(Xm);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(Xm,t),t}function yO(){if(typeof window>"u")return ca();try{const n=window.localStorage.getItem(Tf);if(n){const o=JSON.parse(n);if(!o||typeof o!="object"||Array.isArray(o))return ca();const r=ca();for(const[a,s]of Object.entries(o)){if(typeof a!="string"||a.length===0)continue;const i=gl(s);i&&(r[a]=i)}return r}}catch{}const e=gl(window.localStorage.getItem(Ny)),t=ca();return e&&(t[Xs]=e),t}function Jc(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Tf):window.localStorage.setItem(Tf,JSON.stringify(e)),window.localStorage.removeItem(Ny)}catch{}}function wO(){if(typeof window>"u")return ca();try{const e=window.localStorage.getItem(kf);if(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return ca();const n=ca();for(const[o,r]of Object.entries(t)){if(typeof o!="string"||o.length===0)continue;const a=_y(r);a==="plan"&&(n[o]=a)}return n}}catch{}return ca()}function Hd(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(fO)}catch{}}function bO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ey);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){if(!o)continue;const a=EN(r);a&&(n[o]=a)}return n}catch{return{}}}function ev(e){typeof window>"u"||window.localStorage.setItem(Ey,JSON.stringify(e))}function TO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ly);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t))o&&typeof r=="boolean"&&(n[o]=r);return n}catch{return{}}}function kO(e){typeof window>"u"||window.localStorage.setItem(Ly,JSON.stringify(e))}function CO(){return typeof window>"u"?"":window.localStorage.getItem(bf)??""}function SO(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(bf);return}window.localStorage.setItem(bf,e)}}function _O(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Oy);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const o of t){if(typeof o!="string"||o.length===0)continue;const r=Wr(o);r.length>0&&!n.includes(r)&&n.push(r)}return n}catch{return[]}}function Vl(e){typeof window>"u"||window.localStorage.setItem(Oy,JSON.stringify(e))}function xO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Dy);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){const a=typeof o=="string"?Wr(o):"";a.length>0&&typeof r=="string"&&(n[a]=r)}return n}catch{return{}}}function tv(e){typeof window>"u"||window.localStorage.setItem(Dy,JSON.stringify(e))}function AO(e){return e==="completed"?"completed":e==="inProgress"||e==="in_progress"?"inProgress":"pending"}function IO(e){var n;const t=[];(n=e.explanation)!=null&&n.trim()&&t.push(e.explanation.trim());for(const o of e.steps){const r=o.status==="completed"?"x":o.status==="inProgress"?"~":" ";t.push(`- [${r}] ${o.step}`)}return t.join(`
72
+ `).trim()}function Ke(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function Ae(e){return typeof e=="string"?e:""}function Ys(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function nv(e){const t=Ke(e);if(!t)return null;const n=Ys(t.totalTokens??t.total_tokens),o=Ys(t.inputTokens??t.input_tokens),r=Ys(t.cachedInputTokens??t.cached_input_tokens),a=Ys(t.outputTokens??t.output_tokens),s=Ys(t.reasoningOutputTokens??t.reasoning_output_tokens);return n===null||o===null||r===null||a===null||s===null?null:{totalTokens:n,inputTokens:o,cachedInputTokens:r,outputTokens:a,reasoningOutputTokens:s}}function PO(e){const t=Ke(e);if(!t)return null;const n=nv(t.total),o=nv(t.last);if(!n||!o)return null;const r=Ys(t.modelContextWindow??t.model_context_window),a=o.totalTokens,s=typeof r=="number"?Math.max(r-a,0):null,i=typeof r=="number"&&r>0?Ay(Math.round((s??0)/r*100),0,100):null;return{total:n,last:o,modelContextWindow:r,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function RO(e){if(e.method!=="thread/tokenUsage/updated")return null;const t=Ke(e.params),n=ro(e),o=PO((t==null?void 0:t.tokenUsage)??(t==null?void 0:t.token_usage));return!n||!o?null:{threadId:n,usage:o}}function ro(e){const t=Ke(e.params);if(!t)return"";const n=Ae(t.threadId);if(n)return n;const o=Ae(t.thread_id);if(o)return o;const r=Ae(t.conversationId);if(r)return r;const a=Ae(t.conversation_id);if(a)return a;const s=Ke(t.thread),i=Ae(s==null?void 0:s.id);if(i)return i;const u=Ke(t.turn),h=Ae(u==null?void 0:u.threadId);if(h)return h;const p=Ae(u==null?void 0:u.thread_id);return p||""}function EO(e){if(e.method!=="turn/completed")return"";const t=Ke(e.params),n=Ke(t==null?void 0:t.turn);if(!n||n.status!=="failed")return"";const o=Ke(n.error);return Ae(o==null?void 0:o.message)}function MO(e){var o;if(e.method!=="error")return null;const t=Ke(e.params),n=Ae(t==null?void 0:t.message)||Ae((o=Ke(t==null?void 0:t.error))==null?void 0:o.message);return n?{message:n,transient:(t==null?void 0:t.willRetry)===!0}:null}function $O(e){const t=ro(e);if(!t)return null;if(e.method==="turn/started")return{threadId:t,activity:{label:"Thinking",details:[]}};if(e.method==="item/started"){const n=Ke(e.params),o=Ke(n==null?void 0:n.item),r=Ae(o==null?void 0:o.type).toLowerCase();if(r==="reasoning")return{threadId:t,activity:{label:"Thinking",details:[]}};if(r==="agentmessage")return{threadId:t,activity:{label:"Writing response",details:[]}};if(r==="commandexecution"){const a=Ae(o==null?void 0:o.command);return{threadId:t,activity:{label:"Running command",details:a?[a]:[]}}}if(r==="filechange"){const s=(Array.isArray(o==null?void 0:o.changes)?o.changes:[])[0],i=Ae(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 jO(e){if(e.method!=="turn/started")return null;const t=Ke(e.params);if(!t)return null;const n=ro(e);if(!n)return null;const o=Ke(t.turn),r=Ae(o==null?void 0:o.id)||Ae(t.turnId)||`${n}:unknown`;if(!r)return null;const a=Ks(Ae(o==null?void 0:o.startedAt))??Ks(Ae(t.startedAt))??Ks(e.atIso)??Date.now();return{threadId:n,turnId:r,startedAtMs:a}}function LO(e){if(e.method!=="turn/completed")return null;const t=Ke(e.params);if(!t)return null;const n=ro(e);if(!n)return null;const o=Ke(t.turn),r=Ae(o==null?void 0:o.id)||Ae(t.turnId)||`${n}:unknown`;if(!r)return null;const a=Ks(Ae(o==null?void 0:o.completedAt))??Ks(Ae(t.completedAt))??Ks(e.atIso)??Date.now(),s=Ks(Ae(o==null?void 0:o.startedAt))??Ks(Ae(t.startedAt))??void 0;return{threadId:n,turnId:r,completedAtMs:a,startedAtMs:s}}function Cu(e){return`${e}:live-reasoning`}function NO(e){const t=Ke(e.params);if(!t)return"";if(e.method==="item/started"){const n=Ke(t.item);return!n||n.type!=="reasoning"?"":Ae(n.id)}return""}function OO(e){const t=Ke(e.params);if(!t)return null;if(e.method==="item/reasoning/summaryTextDelta"){const n=Ae(t.itemId),o=Ae(t.delta);return!n||!o?null:{messageId:Cu(n),itemId:n,delta:o}}if(e.method==="item/reasoning/textDelta"){const n=Ae(t.itemId),o=Ae(t.delta);return!n||!o?null:{messageId:Cu(n),itemId:n,delta:o}}return null}function DO(e){const t=Ke(e.params);if(!t)return"";if(e.method==="item/reasoning/summaryPartAdded"){const n=Ae(t.itemId);return n?Cu(n):""}return""}function FO(e){const t=Ke(e.params);if(!t)return"";if(e.method==="item/completed"){const n=Ke(t.item);return!n||n.type!=="reasoning"?"":Cu(Ae(n.id))}return""}function BO(e){var n;const t=[];for(const o of["content","summary"]){const r=Array.isArray(e[o])?e[o]:[];for(const a of r){const s=typeof a=="string"?a:(n=Ke(a))==null?void 0:n.text;typeof s=="string"&&s.trim()&&t.push(s)}}return t.join(`
73
+ `).trim()}function UO(e){if(e.method!=="item/started"&&e.method!=="item/completed")return null;const t=Ke(e.params),n=Ke(t==null?void 0:t.item);if(!n||Ae(n.type).toLowerCase()!=="reasoning")return null;const o=Ae(n.id);return o?{itemId:o,text:BO(n)}:null}function qO(e){const t=Ke(e.params);if(!t)return"";if(e.method==="item/started"){const n=Ke(t.item);return!n||n.type!=="agentMessage"?"":Ae(n.id)}return""}function zO(e){const t=Ke(e.params);if(!t)return null;if(e.method==="item/agentMessage/delta"){const n=Ae(t.itemId),o=Ae(t.delta);if(!n||!o)return null;const r=Ae(t.turnId)||Ae(t.turn_id);return{messageId:n,delta:o,turnId:r||void 0}}return null}function HO(e){const t=Ke(e.params);if(!t)return null;if(e.method==="item/completed"){const n=Ke(t.item);if(!n||n.type!=="agentMessage")return null;const o=Ae(n.id),r=Ae(n.text);if(!o||!r)return null;const a=Ae(t.turnId)||Ae(t.turn_id);return{id:o,role:"assistant",text:r,messageType:"agentMessage",turnId:a||void 0}}return null}function WO(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function VO(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 GO(e){if(e.method!=="item/completed")return null;const t=Ke(e.params),n=Ke(t==null?void 0:t.item);if(!n)return null;const o=Ae(n.id);if(!o)return null;if(n.type==="imageView"){const s=Ae(n.path);return s?{id:o,role:"assistant",text:"",images:[WO(s)],messageType:"imageView"}:null}if(n.type!=="imageGeneration"&&n.type!=="image_generation")return null;const r=Ae(n.result),a=r?VO(r):"";return a?{id:o,role:"assistant",text:"",images:[a],messageType:"imageView"}:null}function KO(e){if(e.method!=="item/commandExecution/outputDelta")return null;const t=Ke(e.params);if(!t)return null;const n=Ae(t.itemId),o=Ae(t.delta);return!n||!o?null:{itemId:n,delta:o}}const ul="__global__";function YO(e){return e==="item/commandExecution/requestApproval"||e==="item/fileChange/requestApproval"||e==="item/permissions/requestApproval"||e==="execCommandApproval"||e==="applyPatchApproval"}function ov(e){const t=Ke(e);if(!t)return null;const n=t.id,o=Ae(t.method),r=t.params;if(typeof n!="number"||!Number.isInteger(n)||!o)return null;const a=Ke(r),s=JO(o,a),i=Ae(a==null?void 0:a.threadId)||Ae(a==null?void 0:a.thread_id)||Ae(a==null?void 0:a.conversationId)||Ae(a==null?void 0:a.conversation_id)||ul,u=Ae(a==null?void 0:a.turnId)||Ae(a==null?void 0:a.turn_id),h=Ae(a==null?void 0:a.itemId)||Ae(a==null?void 0:a.item_id)||Ae(a==null?void 0:a.callId)||Ae(a==null?void 0:a.call_id),p=Ae(t.receivedAtIso)||new Date().toISOString();return{id:n,method:s,threadId:i,turnId:u,itemId:h,receivedAtIso:p,params:r??null}}function JO(e,t){const n=e.trim();return n&&(n==="item/commandExecution/requestApproval"||n==="execCommandApproval"||n==="exec_approval_request"||QO(t)?"item/commandExecution/requestApproval":n==="item/fileChange/requestApproval"||n==="applyPatchApproval"||n==="apply_patch_approval_request"||XO(t)?"item/fileChange/requestApproval":n==="item/tool/requestUserInput"||n==="request_user_input"||ZO(t)?"item/tool/requestUserInput":n==="mcpServer/elicitation/request"||n==="elicitation_request"||t2(t)?"mcpServer/elicitation/request":n==="item/permissions/requestApproval"||n2(t)?"item/permissions/requestApproval":n==="item/tool/call"||n==="dynamic_tool_call_request"||e2(t)?"item/tool/call":n)}function QO(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 XO(e){return e?typeof e.grantRoot=="string"&&e.grantRoot.trim().length>0||typeof e.grant_root=="string"&&e.grant_root.trim().length>0||Ke(e.fileChanges)?!0:Ke(e.changes)!==null:!1}function ZO(e){return!!(e&&Array.isArray(e.questions))}function e2(e){return e?typeof e.toolName=="string"||typeof e.tool_name=="string"||typeof e.name=="string"||Array.isArray(e.arguments):!1}function t2(e){if(!e)return!1;const t=Ae(e.mode);return typeof e.serverName=="string"&&typeof e.threadId=="string"&&typeof e.message=="string"&&(t==="form"||t==="url")}function n2(e){return e?typeof e.threadId=="string"&&typeof e.turnId=="string"&&typeof e.itemId=="string"&&Ke(e.permissions)!==null:!1}function o2(e){if(e.method!=="item/tool/requestUserInput")return[];const t=Ke(e.params),n=Array.isArray(t==null?void 0:t.questions)?t.questions:[],o=[];for(const r of n){const a=Ke(r),s=Ae(a==null?void 0:a.id).trim();s&&o.push(s)}return o}function r2(e,t){const n=t.threadId||ul,o=e.pendingServerRequestsByThreadId.value[n]??[],r=o.findIndex(s=>s.id===t.id),a=[...o];r>=0?a.splice(r,1,t):a.push(t),e.pendingServerRequestsByThreadId.value={...e.pendingServerRequestsByThreadId.value,[n]:a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso))},e.applyThreadFlags()}function a2(e,t){const n={};for(const[o,r]of Object.entries(e.pendingServerRequestsByThreadId.value)){const a=r.filter(s=>s.id!==t);a.length>0&&(n[o]=a)}e.pendingServerRequestsByThreadId.value=n,e.pendingReplyErrorByRequestId.value[String(t)]&&(e.pendingReplyErrorByRequestId.value=xt(e.pendingReplyErrorByRequestId.value,String(t))),e.applyThreadFlags()}function s2(e,t){return e.pendingReplyErrorByRequestId.value[String(t)]??""}function i2(e,t){const n={},o=new Set;for(const a of t){const s=a.threadId||ul,i=n[s]??[];i.push(a),n[s]=i,o.add(a.id)}for(const a of Object.values(n))a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso));e.pendingServerRequestsByThreadId.value=n;const r={};for(const[a,s]of Object.entries(e.pendingReplyErrorByRequestId.value))o.has(Number(a))&&(r[a]=s);e.pendingReplyErrorByRequestId.value=r}function By(e,t,n){const o=e.liveAgentMessagesByThreadId.value[t]??[];yl(o,n)||(e.liveAgentMessagesByThreadId.value={...e.liveAgentMessagesByThreadId.value,[t]:n})}function l2(e,t){t&&t in e.liveAgentMessagesByThreadId.value&&(e.liveAgentMessagesByThreadId.value=xt(e.liveAgentMessagesByThreadId.value,t))}function c2(e,t,n){const o=e.livePlanMessagesByThreadId.value[t]??[];yl(o,n)||(e.livePlanMessagesByThreadId.value={...e.livePlanMessagesByThreadId.value,[t]:n})}function u2(e,t,n){!t||!n||(e.lastPlanByThreadId.value={...e.lastPlanByThreadId.value,[t]:n},Fy(e.lastPlanByThreadId.value))}function d2(e,t,n){const o=e.livePlanMessagesByThreadId.value[t]??[],r=qu(o,n);c2(e,t,r),u2(e,t,n)}function f2(e,t,n){const o=e.liveFileChangeMessagesByThreadId.value[t]??[],r=qu(o,n);tp(e,t,r)}function p2(e,t,n){const o=e.liveAgentMessagesByThreadId.value[t]??[];let r=qu(o,n);const a=Ts(n.text);if(n.role==="assistant"&&a.length>0){const s=r.filter(i=>i.id===n.id||Ts(i.text)!==a);s.length!==r.length&&(r=s)}By(e,t,r)}function tp(e,t,n){const o=e.liveFileChangeMessagesByThreadId.value[t]??[];yl(o,n)||(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:n})}function h2(e,t,n){const o=e.liveCommandsByThreadId.value[t]??[],r=qu(o,n);r!==o&&(e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:r})}function m2(e,t,n){const o=e.liveCommandsByThreadId.value[t];if(!o||o.length===0)return;const r=new Set(n.map(s=>s.id)),a=o.filter(s=>!r.has(s.id));a.length!==o.length&&(a.length===0?e.liveCommandsByThreadId.value=xt(e.liveCommandsByThreadId.value,t):e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:a})}function v2(e,t,n){const o=e.liveFileChangeMessagesByThreadId.value[t];if(!o||o.length===0)return;const r=new Set(n.map(u=>u.id)),a=new Set(n.filter(u=>u.messageType==="fileChange"&&typeof u.turnId=="string"&&u.turnId.length>0).map(u=>u.turnId)),s=new Set(n.filter(u=>u.messageType==="fileChange"&&typeof u.turnIndex=="number").map(u=>u.turnIndex)),i=o.filter(u=>!r.has(u.id)&&!(u.turnId&&a.has(u.turnId))&&!(typeof u.turnIndex=="number"&&s.has(u.turnIndex)));i.length!==o.length&&(i.length===0?e.liveFileChangeMessagesByThreadId.value=xt(e.liveFileChangeMessagesByThreadId.value,t):e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:i})}function g2(e,t,n,o){if(!t||!n)return;const r=e.liveFileChangeMessagesByThreadId.value[t];if(!r)return;const a=r.findIndex(i=>i.id===n||i.turnId===n);if(a<0)return;const s=[...r];s[a]={...s[a],fileChanges:o},tp(e,t,s)}function y2(e,t,n,o){if(!t||!n)return;const r=e.liveFileChangeMessagesByThreadId.value[t];if(!r)return;const a=r.findIndex(u=>u.turnId===n);if(a<0)return;const s=[...r],i=s[a];s[a]={...i,fileChanges:(i.fileChanges??[]).map(u=>({...u,diff:o}))},tp(e,t,s)}function w2(e,t){const n=e.persistedMessagesByThreadId.value[t]??[];let o=-1;for(const r of n)typeof r.turnIndex=="number"&&Number.isFinite(r.turnIndex)&&(o=Math.max(o,r.turnIndex));return o+1}function b2(e,t,n,o){if(!t||!n||!Number.isInteger(o)||o<0)return;const r=e.turnIndexByTurnIdByThreadId.value[t]??{};r[n]!==o&&(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...r,[n]:o}})}function T2(e,t,n){const o=e.turnIndexByTurnIdByThreadId.value[t]??{},r=Object.entries(o),a=Object.entries(n);r.length===a.length&&r.every(([s,i])=>n[s]===i)||(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...n}})}function k2(e,t,n){var r;if(!t||!n)return;const o=(r=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:r[n];return typeof o=="number"?o:void 0}function C2(e,t){const n=e.liveFileChangeMessagesByThreadId.value[t];if(!n||n.length===0)return;const o=e.turnIndexByTurnIdByThreadId.value[t]??{};let r=!1;const a=n.map(s=>{if(typeof s.turnIndex=="number"||!s.turnId)return s;const i=o[s.turnId];return typeof i!="number"?s:(r=!0,{...s,turnIndex:i})});r&&(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:a})}const rv=8e3,S2=1500,_2=15*60*1e3;function x2(e){let t=vO(),n=!1,o=null;function r(){o===null&&(o=setTimeout(()=>{if(o=null,n&&(n=!1,typeof window<"u"))try{window.localStorage.setItem(jy,JSON.stringify(t))}catch{}n&&r()},S2))}function a(p,g){if(!p||e.inProgressById.value[p]!==!0)return;const w=g.length>rv?g.slice(-rv):g;t[p]={text:w,ts:Date.now()},n=!0,r()}function s(p,g){if(!p)return;const w=g.trim(),A=e.liveReasoningTextByThreadId.value[p]??"";if(w.length===0){if(!A)return;e.liveReasoningTextByThreadId.value=xt(e.liveReasoningTextByThreadId.value,p);return}A!==w&&(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[p]:w},a(p,w))}function i(p,g){if(!p)return;const w=e.liveReasoningTextByThreadId.value[p]??"";s(p,`${w}${g}`)}function u(p){var A;if(!p||((A=e.liveReasoningTextByThreadId.value[p])==null?void 0:A.trim()))return;const w=t[p];w!=null&&w.text&&(Date.now()-w.ts>_2||(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[p]:w.text}))}function h(p){p&&p in t&&(delete t[p],n=!0,r())}return{setLiveReasoningText:s,appendLiveReasoningText:i,restoreLiveReasoningSnapshot:u,clearLiveReasoningSnapshot:h}}function A2(e,t){if(!t)return;const n=e.activeTurnIdByThreadId.value[t]??"";n&&e.activeReasoningTurnIdByThreadId.set(t,n)}function I2(e,t,n=!1){var u;if(!t)return;const o=e.liveReasoningTextByThreadId.value[t];if(o===void 0){n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear());return}const r=e.activeReasoningTurnIdByThreadId.get(t)??e.activeTurnIdByThreadId.value[t]??"";e.activeReasoningTurnIdByThreadId.delete(t);const a=r?(u=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:u[r]:void 0,s=$2(e,t),i=r||void 0;s.length>0?R2(e,t,s,i,a):n||P2(e,t,o,i,a),e.liveReasoningTextByThreadId.value=xt(e.liveReasoningTextByThreadId.value,t),n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear(),e.clearLiveReasoningSnapshot(t))}function P2(e,t,n,o,r){if(!t)return;const a=n.trim();if(!a)return;const s=e.persistedReasoningByThreadId.value[t]??[];if(s.some(h=>h.text===a))return;const i={id:`reasoning:local:${t}:${Date.now()}`,role:"system",text:a,messageType:"reasoning",reasoning:{summary:[],content:[a]},turnId:o||void 0,turnIndex:typeof r=="number"?r:void 0},u=[...s,i].slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:u},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function R2(e,t,n,o,r){if(!t||n.length===0)return;const s=[...e.persistedReasoningByThreadId.value[t]??[]];for(const u of n){const h=u.text.trim();if(!h)continue;const p=`reasoning:item:${t}:${u.itemId}`,g=s.findIndex(w=>w.id===p);if(g>=0){const w=s[g],A=u.anchorMessageId||w.reasoningAnchorMessageId,M=typeof r=="number"?r:w.turnIndex;if(w.text===h&&w.turnIndex===M&&w.reasoningAnchorMessageId===A)continue;s[g]={...w,text:h,reasoning:{summary:[],content:[h]},turnId:o||w.turnId,turnIndex:M,reasoningAnchorMessageId:A};continue}s.some(w=>w.text===h)||s.push({id:p,role:"system",text:h,messageType:"reasoning",reasoning:{summary:[],content:[h]},turnId:o||void 0,turnIndex:typeof r=="number"?r:void 0,reasoningAnchorMessageId:u.anchorMessageId||void 0})}const i=s.slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:i},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function E2(e,t,n,o){if(!t||!o)return;o.trim()&&e.reasoningItemTextByItemId.set(n,o.trim());const r=e.liveReasoningTextByThreadId.value[t]??"",a=e.reasoningAppendedTextByItemId.get(n)??"";if(r.endsWith(o)||a&&o===a){e.reasoningAppendedTextByItemId.set(n,o);return}if(a&&o.startsWith(a)){const i=o.slice(a.length);i&&e.appendLiveReasoningText(t,i),e.reasoningAppendedTextByItemId.set(n,o);return}const s=r.length>0&&!r.endsWith(`
74
+ `)?`
75
+
76
+ `:"";e.appendLiveReasoningText(t,`${s}${o}`),e.reasoningAppendedTextByItemId.set(n,o)}function M2(e,t){const n=Ke(t.params);if(!n)return;const o=t.method==="item/started"||t.method==="item/completed",r=t.method==="item/reasoning/textDelta"||t.method==="item/reasoning/summaryTextDelta";if(!o&&!r)return;const a=Ke(n.item),s=Ae(r?n.itemId:a==null?void 0:a.id);if(!s)return;const i=ro(t);if(!i)return;const u=r||Ae(a==null?void 0:a.type).toLowerCase()==="reasoning"?"reasoning":"other",h=e.turnItemSequenceByThreadId.get(i)??[];h.some(p=>p.itemId===s)||e.turnItemSequenceByThreadId.set(i,[...h,{itemId:s,kind:u}])}function $2(e,t){var a;const n=e.turnItemSequenceByThreadId.get(t)??[],o=[];let r="";for(const s of n)if(s.kind==="reasoning"){const i=((a=e.reasoningItemTextByItemId.get(s.itemId))==null?void 0:a.trim())??"";i&&o.push({text:i,anchorMessageId:r,itemId:s.itemId})}else r=s.itemId;return o}function j2(e,t,n){if(!t||!n)return;const o=e.reasoningItemTextByItemId.get(t)??"";o.endsWith(n)||e.reasoningItemTextByItemId.set(t,`${o}${n}`)}function av(e){e.reasoningItemTextByItemId.clear()}const sv="codex-web-local.stashed-messages.v1",iv="codex-web-local.auto-compact-threshold.v1",Qc=10,L2=Xg,sa="gpt-5.4-mini",N2="big-pickle",lv="Codex CLI not found. Install @openai/codex or set CODEXUI_CODEX_COMMAND.",Xc=220,O2=1e4,D2=500,F2=3e3,cv=2e3,B2=2e3,U2=2e3,q2=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 z2(){const e=x([]),t=x([]),n=x(CO()),o=x({}),r=x({}),a=x(mO()),s=x({}),i=x({}),u=x(hO()),h=x({}),p=new Map,g=new Map,w=new Map,A=new Map,M=x({}),U=x({}),Y=x({}),F=x2({liveReasoningTextByThreadId:h,inProgressById:Y}),H=x({}),q=x({}),me=x({}),we=x(ot()),ve=x(Mo());let je=!1,ge=!1;const Ie=x({}),De=x([]),fe=x({}),Se=x({}),_e=x([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),Pe=x(wO()),Re=x(yO()),Ue=x(Gc(Pe.value,n.value)),Le=x(Vm(Re.value,n.value)),gt=x("medium"),ft=x("standard"),at=x(""),it=x(""),wt=x(pO()),St=x(gO()),Qe=x(_O()),et=x(xO()),re=x({}),ee=x({}),te=x({}),V=x({}),$e=x({}),R=x({}),j=x({}),W=x({}),ce=x({}),le=x({}),ne=x({}),Ce={liveReasoningTextByThreadId:h,persistedReasoningByThreadId:u,turnIndexByTurnIdByThreadId:R,activeTurnIdByThreadId:ne,activeReasoningTurnIdByThreadId:A,reasoningItemTextByItemId:g,reasoningAppendedTextByItemId:p,turnItemSequenceByThreadId:w,appendLiveReasoningText:(c,m)=>F.appendLiveReasoningText(c,m),clearLiveReasoningSnapshot:c=>F.clearLiveReasoningSnapshot(c),savePersistedReasoningMap:zd},be=x({}),de=x({}),ie=x({}),Ge=x({}),Te=x({}),Be=x({}),Fe=x(null),ze=x(bO()),bt=x(TO()),dt=x({}),pt=x({}),Yt=x([]),In=x([]),z=x([]),G=x(!1),K=x(!1),pe=x(!1),Ne=x(!1),We=x(!1),Xe=x(!1),$t=x(!1),Lt=x(!1),kn=x(new Set),Fo=6e4,tr=x([]);let lo="";const It=x(""),Kr=x(!1),nr=x(!1);function un(c){var m;try{const S=new URL(c,"http://localhost");return S.pathname!=="/codex-local-image"?"":((m=S.searchParams.get("path"))==null?void 0:m.trim())??""}catch{return""}}function jn(c){const m=c.trim().toLowerCase();return m?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(m):!1}function Pn(c){var S;const m=o.value[c]??[];for(let P=m.length-1;P>=0;P-=1){const L=m[P];if(!(L.role!=="user"||!Array.isArray(L.images)||L.images.length===0))for(let D=L.images.length-1;D>=0;D-=1){const B=((S=L.images[D])==null?void 0:S.trim())??"";if(B&&un(B))return B}}return""}let So=null,Cn=null,or=null;const Tt=new Map;let zt=null;const Et=new Map;let Cr=null,hn=null,ga=0,Sr=!1,Bo=!1,ya=0,wa="",_r=null,tn=!1,Sn=!1;const mn=new Set,xr=new Map,Ln=new Map;let co=null,Rn=null,rr=!1,Ar=!1,uo=[],Uo=null,ar=!1,kt=!1;const Ot=new Map,Zn=new Set,_o=X(()=>wo(e.value)),Ir=X(()=>_o.value.find(c=>c.id===n.value)??null),xo=X(()=>{const c=n.value;return!!(c&&bt.value[c]===!0)}),Jn=X(()=>{const c=n.value;return c?be.value[c]===!0:!1}),Ao=X(()=>{const c=[],m=n.value;return m&&Array.isArray(Te.value[m])&&c.push(...Te.value[m]),Array.isArray(Te.value[ul])&&c.push(...Te.value[ul]),c.sort((S,P)=>S.receivedAtIso.localeCompare(P.receivedAtIso))}),qo=X(()=>{const c=n.value;return c?ne.value[c]??"":""}),Yr=X(()=>{var J;const c=n.value;if(!c)return null;const m=Y.value[c]===!0,S=m?W.value[c]:void 0,P=m?(h.value[c]??"").trim():"",L=(((J=le.value[c])==null?void 0:J.message)??"").trim();let D="";if(!m&&L){const se=o.value[c]??[];for(let ye=se.length-1;ye>=0;ye-=1){const He=se[ye];if(He.messageType==="turnError"){D=Ts(He.text);break}}}const B=!m&&L&&D===L?"":L;return!m&&!S&&!P&&!B?null:{activityLabel:(S==null?void 0:S.label)||"Thinking",activityDetails:(S==null?void 0:S.details)??[],reasoningText:P,errorText:B}}),Pr=X(()=>Fe.value),ni=X(()=>{const c=n.value;return c?ze.value[c]??null:null}),Io=X(()=>{const c=n.value;if(!c)return[];const m=o.value[c]??[],S=r.value[c]??[],P=s.value[c]??[],L=M.value[c]??[],D=U.value[c]??[],B=i.value[c]??[],J=u.value[c]??[],se=m.some(ht=>ht.messageType==="compaction.done"),ye=kn.value.has(c),He=se&&!ye?B.filter(ht=>ht.messageType!=="compaction.pending"&&ht.messageType!=="compaction.done"):B,rt=dO(c,m,J,[S,L,D,P],He),ct=j.value[c];return ct?VN(rt,ct):rt}),Ha=X(()=>{const c=n.value;return c?Ge.value[c]??null:null}),ba=X(()=>{const c=n.value;return c?te.value[c]===!0:!1}),sr=X(()=>{const c=n.value;return c?V.value[c]===!0:!1});function Jr(c){var S;const m=o.value[c]??[];for(const P of m){const L=((S=P.turnId)==null?void 0:S.trim())??"";if(L)return L}return""}function nn(c){if(Ei(c)===Xs){const S=Hs(at.value),P=Vc(S),L=P?gl(Re.value[P]):"";if(L)return L}return Vm(Re.value,c).trim()}function Ct(c){const m=c.trim();return Hs(m?dt.value[m]??at.value:at.value)}function Nn(c){return fe.value[c.trim()]??L2}function vn(c,m=gt.value){const S=c.trim(),P=Nn(S);if(m&&P.includes(m))return m;if(P.includes("medium"))return"medium";const L=Se.value[S];return L&&P.includes(L)?L:P[0]??""}function zo(c){gt.value=vn(c)}function fo(c){const m={},S={};for(const P of c)P.supportedReasoningEfforts!==null&&(m[P.id]=[...P.supportedReasoningEfforts]),P.defaultReasoningEffort&&(S[P.id]=P.defaultReasoningEffort);fe.value=m,Se.value=S}function po(...c){const m=[...De.value];for(const S of c){const P=S.trim();P&&!m.includes(P)&&m.push(P)}ps(De.value,m)||(De.value=m)}function En(c){const m=c.trim();return De.value.length===0||m&&De.value.includes(m)?m:De.value[0]??""}function gn(c,m={}){n.value!==c&&(n.value=c,m.persist!==!1&&SO(c),Le.value=En(nn(c)),zo(Le.value),Ue.value=Gc(Pe.value,c),kt=!1)}function _t(c,m){const S=m.trim(),P=Ei(c),L=Hs(at.value),D=P===Xs?Vc(L):"",B=D||P;if(S){const J=au(Re.value);J[B]=S,D&&delete J[P],Re.value=J}else{let J=rc(Re.value,B);D&&(J=rc(J,P)),Re.value=J}P===Ei(n.value)?(Le.value=nn(n.value),po(Le.value),zo(Le.value)):po(S),Jc(Re.value)}function Jt(c){_t(n.value,c)}function Mt(c,m){const S=c.trim();if(!S)return;const P=m.trim();if(P){const L=au(Re.value);L[S]=P,Re.value=L}else Re.value=rc(Re.value,S);po(P),n.value===S&&(Le.value=nn(n.value),zo(Le.value)),Jc(Re.value)}function Mn(c,m){const S=c.trim();if(!S)return;const P=Hs(m);P?dt.value={...dt.value,[S]:P}:dt.value[S]&&(dt.value=xt(dt.value,S))}function Hn(c,m,S){const P=m.trim();if(Hs(S)!=="opencode-zen")return P;const D=nn(c).trim();return D&&!/^gpt-/i.test(D)?D:P&&!/^gpt-/i.test(P)?P:N2}function Wa(c,m){const S=c.trim();if(!S)return;if(!m){if(!(S in ze.value))return;ze.value=xt(ze.value,S),ev(ze.value);return}const P=ze.value[S];if(P&&JSON.stringify(P)===JSON.stringify(m))return;ze.value={...ze.value,[S]:m},ev(ze.value);const L=we.value[S];L&&L.length>0&&ve.value>0&&(m.remainingContextPercent!==null&&m.remainingContextPercent<=ve.value?kn.value.has(S)||Dr(S):Xt(S))}function Rr(c){const m=c==="plan"?"plan":"default",S=Ei(n.value);Gc(Pe.value,n.value)===m&&Ue.value===m||(Ue.value=m,Pe.value=Gm(Pe.value,S,m),Hd(Pe.value))}function Va(c,m){const S=m==="plan"?"plan":"default";Pe.value=Gm(Pe.value,c,S),c.trim()===n.value&&(Ue.value=S),Hd(Pe.value)}function ir(c){Fe.value=c}async function Ho(c=n.value){c.trim()?Mt(c,sa):Jt(sa),po(sa)}function lr(c,m){Be.value={...Be.value,[c]:m}}function ho(c){Be.value[c]&&(Be.value=xt(Be.value,c))}async function Er(c){if(Zn.has(c))return;const m=Be.value[c];if(!(!m||m.fallbackRetried)){Zn.add(c),lr(c,{...m,fallbackRetried:!0});try{await Ho(c);try{const S=await Md(c,1);fr(c,S),Ya(c),Vn(c,[]),ka(c),M.value[c]&&(M.value=xt(M.value,c))}catch{}if(Ft(c,null),It.value="",Wo(c,null),jt(c,{label:"Thinking",details:oe(sa,m.effort,m.collaborationMode)}),On(c,!0),$e.value[c]!==!0){const S=await Ed(c);S.model&&Mt(c,Hn(c,S.model,S.modelProvider)),S.modelProvider&&Mn(c,S.modelProvider),$e.value={...$e.value,[c]:!0}}await $d(c,m.text,m.imageUrls,sa,m.effort||void 0,m.skills.length>0?m.skills:void 0,m.fileAttachments,m.collaborationMode),Dt(),mn.add(c),await fn()}catch(S){const P=S instanceof Error?S.message:"Unknown application error";Ft(c,P),It.value=P,On(c,!1),jt(c,null)}finally{Zn.delete(c)}}}function cr(c){c&&!Nn(Le.value).includes(c)||(gt.value=c)}async function E(c){const m=c==="fast"?"fast":"standard";if($t.value||ft.value===m)return;const S=ft.value;ft.value=m,$t.value=!0,It.value="";try{await $_(m)}catch(P){ft.value=S,It.value=P instanceof Error?P.message:"Failed to update Fast mode"}finally{$t.value=!1}}async function O(){try{const c=await F_();_e.value=c,c.some(m=>m.value===Ue.value)||Rr("default")}catch{}}function oe(c,m,S=Ue.value){const P=c.trim()||"default",L=m||"default",D=S==="plan"?"Plan":"Default",B=ft.value==="fast"?"Fast":"Standard";return[`Mode: ${D}`,`Model: ${P}`,`Thinking: ${L}`,`Speed: ${B}`]}async function Ee(c){it.value="";try{const m=await O_(),S=m.model.trim(),P=Hs(m.providerId);at.value=P;const L=Ct(n.value),D=L!=="codex"&&L!=="custom",B=nn(n.value),J=await N_({includeProviderModels:D||(c==null?void 0:c.includeProviderModels)!==!1,requireProviderModels:D,providerId:D?L:void 0}),se=J.map(ht=>ht.id);fo(J);const ye=Vc(L),He=ye?gl(Re.value[ye]):"",rt=[...se];!(c!=null&&c.providerChanged)&&D&&L===P&&S&&!rt.includes(S)&&rt.push(S),De.value=rt;const ct=B&&se.includes(B);if(!B||!ct||c!=null&&c.providerChanged?c!=null&&c.providerChanged&&rt.length>0?He&&se.includes(He)?Jt(He):L===P&&S&&rt.includes(S)?Jt(S):Jt(rt[0]):L===P&&S&&rt.includes(S)?Jt(m.model):rt.length>0?Jt(rt[0]):Jt(""):Le.value.trim()!==B&&Jt(B),ye&&Le.value.trim().length>0){const ht=au(Re.value);ht[ye]=Le.value.trim();const Rt=Vc(P);Rt&&Rt!==ye&&S&&(ht[Rt]=S),Re.value=ht,Jc(Re.value)}gt.value=vn(Le.value,m.reasoningEffort),ft.value=m.speedMode}catch(m){Hm(m)?it.value=lv:it.value=""}}async function Ve(){if(_r){await _r;return}_r=(async()=>{try{const c=await _x();ir(c),In.value=c?[c]:[]}catch{}finally{_r=null}})(),await _r}function Dt(){if(typeof window>"u"){Ve();return}or!==null&&window.clearTimeout(or),or=window.setTimeout(()=>{or=null,Ve()},D2)}function yn(c){if(!c||typeof window>"u")return;const m=Tt.get(c);m!==void 0&&(window.clearTimeout(m),Tt.delete(c))}function on(c){if(!c||typeof window>"u")return;yn(c);const m=window.setTimeout(()=>{Tt.delete(c),mn.add(c),fn()},F2);Tt.set(c,m)}function Ht(c){const m=pt.value;return Object.keys(m).length===0?c.map(S=>({projectName:S.projectName,threads:S.threads.map(P=>({...P,title:Us(P.title)}))})):c.map(S=>({projectName:S.projectName,threads:S.threads.map(P=>{const L=m[P.id];return{...P,title:Us(L??P.title)}})}))}function Qr(c){return c?Array.isArray(Te.value[c])?Te.value[c]:[]:[]}function Po(c){return c.some(m=>YO(m.method))?"approval":c.length>0?"response":null}function dn(){const m=Ht(t.value).map(S=>({projectName:S.projectName,threads:S.threads.map(P=>{const L=H.value[P.id]??P.externalSession??null,D=Y.value[P.id]===!0||(L==null?void 0:L.active)===!0,B=Po(Qr(P.id)),J=n.value===P.id,se=Ie.value[P.id]===!0,ye=PN(P.updatedAtIso,wt.value[P.id],St.value);return{...P,inProgress:D,unread:!J&&!D&&(se||ye),pendingRequestState:B,...L?{externalSession:L}:{}}})}));e.value=Yc(e.value,m)}function oi(c,m,S){const P=new Date().toISOString(),L=nt(m),D=Wr(L),B={id:c,title:Us(S),projectName:D,cwd:L,hasWorktree:L.includes("/.codex/worktrees/")||L.includes("/.git/worktrees/"),createdAtIso:P,updatedAtIso:P,preview:S,unread:!1,inProgress:!1},J=t.value.findIndex(ye=>ye.projectName===D);if(J>=0){const He=t.value[J].threads.filter(ht=>ht.id!==c),rt={projectName:D,threads:[B,...He]},ct=[...t.value];ct.splice(J,1,rt),t.value=ct}else t.value=[{projectName:D,threads:[B]},...t.value];const se=Qi(Qe.value,t.value);ps(Qe.value,se)||(Qe.value=se,Vl(Qe.value)),dn()}function Mr(c){const m=new Set(c.map(se=>se.id)),S=n.value.trim();S&&m.add(S);const P=Wm(Re.value,m);P!==Re.value&&(Re.value=P,Le.value=En(nn(n.value)),Jc(P));const L=Wm(Pe.value,m);L!==Pe.value&&(Pe.value=L,Ue.value=Gc(L,n.value),Hd(L));const D=Tn(wt.value,m);if(D!==wt.value&&(wt.value=D,Zm(D)),ee.value=Tn(ee.value,m),re.value=Tn(re.value,m),$e.value=Tn($e.value,m),R.value=Tn(R.value,m),o.value=Tn(o.value,m),s.value=Tn(s.value,m),h.value=Tn(h.value,m),M.value=Tn(M.value,m),U.value=Tn(U.value,m),j.value=Tn(j.value,m),W.value=Tn(W.value,m),le.value=Tn(le.value,m),ne.value=Tn(ne.value,m),A.size>0)for(const se of[...A.keys()])m.has(se)||A.delete(se);lO(m),be.value=Tn(be.value,m),de.value=Tn(de.value,m),ie.value=Tn(ie.value,m),dt.value=Tn(dt.value,m);const B=Tn(q.value,m);B!==q.value&&(q.value=B,Eo()),ze.value=Tn(ze.value,m),Ie.value=Tn(Ie.value,m),Y.value=Tn(Y.value,m);const J={};for(const[se,ye]of Object.entries(Te.value))(se===ul||m.has(se))&&(J[se]=ye);Te.value=J}function Wn(c){const m=wo(t.value).find(S=>S.id===c);m&&(wt.value={...wt.value,[c]:m.updatedAtIso},Zm(wt.value),Ie.value[c]&&(Ie.value=xt(Ie.value,c)),dn())}function Wo(c,m){if(!c)return;const S=j.value[c];if(m){if(qN(S,m))return;j.value={...j.value,[c]:m}}else S&&(j.value=xt(j.value,c))}function On(c,m){!c||Y.value[c]===!0===m||(m?(Y.value={...Y.value,[c]:!0},li(c)):(Y.value=xt(Y.value,c),Bi(c),ri(c),Xt(c)),dn(),!m&&!Ma()&&co&&$a())}function ri(c){c&&(be.value[c]&&(be.value=xt(be.value,c)),de.value[c]&&(de.value=xt(de.value,c)),ie.value[c]&&(ie.value=xt(ie.value,c)))}function bl(c){c&&(be.value={...be.value,[c]:!0},de.value[c]&&(de.value=xt(de.value,c)),ie.value[c]&&(ie.value=xt(ie.value,c)))}function ai(c){c&&be.value[c]===!0&&de.value[c]===!0&&ie.value[c]===!0&&ri(c)}function Dn(c,m){!c||!m||be.value[c]===!0&&ri(c)}function Xr(c){const m=Object.keys(be.value);if(m.length===0)return;let S=de.value,P=!1;for(const L of m)!c.has(L)||S[L]===!0||(S={...S,[L]:!0},P=!0);if(P){de.value=S;for(const L of m)ai(L)}}function ur(c,m){c&&be.value[c]===!0&&m.some(S=>S.role==="user")&&(ie.value[c]!==!0&&(ie.value={...ie.value,[c]:!0}),ai(c))}function Qn(c){c&&c!==n.value&&Ie.value[c]!==!0&&(Ie.value={...Ie.value,[c]:!0},dn())}function jt(c,m){if(!c)return;const S=W.value[c];if(!m){S&&(W.value=xt(W.value,c));return}const P=hr(m.label)||"Thinking",L=m.details.map(J=>hr(J)).filter(J=>J.length>0&&J!==P),D=Array.from(new Set([...(S==null?void 0:S.details)??[],...L])).slice(-3),B={label:P,details:D};zN(S,B)||(W.value={...W.value,[c]:B})}function Ft(c,m,S={}){if(!c)return;const P=le.value[c],L=m?Ts(m):"";if(!L){P&&(le.value=xt(le.value,c));return}const D=S.transient===!0;(P==null?void 0:P.message)===L&&P.transient===D||(le.value={...le.value,[c]:{message:L,transient:D}})}function Ga(c){var m;c&&(m=le.value[c])!=null&&m.transient&&Ft(c,null)}function Ta(){const c=Object.entries(le.value).filter(([,S])=>S==null?void 0:S.transient).map(([S])=>S);if(c.length===0)return;let m=le.value;for(const S of c)m=xt(m,S);le.value=m}function si(c){const m=wo(t.value).find(S=>S.id===c);return(m==null?void 0:m.updatedAtIso)??""}function dr(c,m){if(!c)return;const S={...bt.value};m?S[c]=!0:delete S[c],bt.value=S,kO(S)}function Ka(){const c=n.value;c&&dr(c,!xo.value)}function fr(c,m){const S=o.value[c]??[];yl(S,m)||(o.value={...o.value,[c]:m})}function Ss(c,m,S=[],P=[],L=[]){const D=o.value[c]??[],B={id:`optimistic-user:${c}:${Date.now()}`,role:"user",text:m,images:S.length>0?[...S]:void 0,skills:P.length>0?P.map(J=>({name:J.name,path:J.path})):void 0,fileAttachments:L.length>0?L.map(J=>({...J})):void 0,messageType:"userMessage.optimistic"};fr(c,[...D,B])}function Vn(c,m){By(eo,c,m)}function $r(c){l2(eo,c)}function _s(c,m){d2(eo,c,m)}function xs(c,m){p2(eo,c,m)}function ii(c,m){f2(eo,c,m)}function Di(c,m){F.setLiveReasoningText(c,m)}function Fn(c,m){F.appendLiveReasoningText(c,m)}function li(c){F.restoreLiveReasoningSnapshot(c)}function As(c){A2(Ce,c)}function ka(c,m=!1){I2(Ce,c,m)}function Ya(c){c&&c in r.value&&(r.value=xt(r.value,c))}function Fi(c){c&&c in U.value&&(U.value=xt(U.value,c))}function Bi(c){if(!c)return;Ya(c);const m=a.value[c];if(m&&m.messageType==="plan.live"){const S={...m,messageType:"plan",plan:m.plan?{...m.plan,isStreaming:!1}:m.plan};a.value={...a.value,[c]:S},Fy(a.value)}ka(c),sO(c),jt(c,null),n.value,M.value[c]&&(M.value=xt(M.value,c)),ne.value[c]&&(ne.value=xt(ne.value,c)),ho(c)}function Ui(c){var ye;if(c.method!=="turn/plan/updated")return null;const m=Ke(c.params),S=ro(c),P=Ae(m==null?void 0:m.turnId)||Ae(m==null?void 0:m.turn_id),D=(Array.isArray(m==null?void 0:m.plan)?m==null?void 0:m.plan:[]).map(He=>Ke(He)).map(He=>({step:Ae(He==null?void 0:He.step),status:AO(He==null?void 0:He.status)})).filter(He=>He.step.length>0);if(!S||!P)return null;const J={explanation:Ae(m==null?void 0:m.explanation).trim()||void 0,steps:D,isStreaming:!0},se=(ye=R.value[S])==null?void 0:ye[P];return{threadId:S,message:{id:`${P}:plan`,role:"assistant",text:IO(J),messageType:"plan.live",plan:J,turnId:P||void 0,turnIndex:typeof se=="number"?se:void 0}}}function Ca(c){var He;if(c.method!=="item/plan/delta")return null;const m=Ke(c.params),S=ro(c),P=Ae(m==null?void 0:m.turnId)||Ae(m==null?void 0:m.turn_id),L=Ae(m==null?void 0:m.delta);if(!S||!P||!L)return null;const D=`${P}:plan`,B=(r.value[S]??[]).find(rt=>rt.id===D),J=`${(B==null?void 0:B.text)??""}${L}`,se=B!=null&&B.plan?{...B.plan,isStreaming:!0}:void 0,ye=(He=R.value[S])==null?void 0:He[P];return{threadId:S,message:{id:D,role:"assistant",text:J,messageType:"plan.live",plan:se,turnId:P||void 0,turnIndex:typeof ye=="number"?ye:void 0}}}const pr={pendingServerRequestsByThreadId:Te,pendingReplyErrorByRequestId:ce,applyThreadFlags:dn},eo={liveCommandsByThreadId:M,liveFileChangeMessagesByThreadId:U,liveAgentMessagesByThreadId:s,livePlanMessagesByThreadId:r,lastPlanByThreadId:a},Ro={turnIndexByTurnIdByThreadId:R,persistedMessagesByThreadId:o,liveFileChangeMessagesByThreadId:U};function Sa(c){r2(pr,c)}function jr(c){a2(pr,c)}function _a(c){return s2(pr,c)}function Vo(c){i2(pr,c)}function Ja(c){if(c.method==="server/request"){const m=ov(c.params);return m&&Sa(m),!0}if(c.method==="server/request/resolved"){const m=Ke(c.params),S=m==null?void 0:m.id;return typeof S=="number"&&Number.isInteger(S)&&jr(S),!0}return!1}function hr(c){return c.replace(/\s+/gu," ").trim()}function mo(c){return w2(Ro,c)}function Lr(c,m,S){b2(Ro,c,m,S)}function Zr(c,m){T2(Ro,c,m)}function mr(c,m){return k2(Ro,c,m)}function vr(c){C2(Ro,c)}function Qa(c,m,S){E2(Ce,c,m,S)}function gr(c){M2(Ce,c)}function Is(c){var se;if(c.method!=="item/started"&&c.method!=="item/completed")return null;const m=Ke(c.params),S=Ke(m==null?void 0:m.item);if(!S||Ae(S.type).toLowerCase()!=="plan")return null;const P=ro(c),L=Ae(m==null?void 0:m.turnId)||Ae(m==null?void 0:m.turn_id),D=Ae(S.id),B=Ae(S.text);if(!P||!D||!B)return null;const J=P&&L?(se=R.value[P])==null?void 0:se[L]:void 0;return{threadId:P,message:{id:D,role:"assistant",text:B,messageType:c.method==="item/completed"?"plan":"plan.live",plan:Sy(B)??void 0,turnId:L||void 0,turnIndex:typeof J=="number"?J:void 0}}}function Xa(c){var ye;if(c.method!=="item/started")return null;const m=Ke(c.params),S=Ke(m==null?void 0:m.item);if(!S||S.type!=="commandExecution")return null;const P=Ae(S.id),L=Ae(S.command);if(!P)return null;const D=typeof S.cwd=="string"?S.cwd:null,B=ro(c),J=Ae(m==null?void 0:m.turnId)||Ae(m==null?void 0:m.turn_id),se=B&&J?(ye=R.value[B])==null?void 0:ye[J]:void 0;return{id:P,role:"system",text:L,messageType:"commandExecution",commandExecution:{command:L,cwd:D,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:J||void 0,turnIndex:typeof se=="number"?se:void 0}}function ea(c){var ht;if(c.method!=="item/completed")return null;const m=Ke(c.params),S=Ke(m==null?void 0:m.item);if(!S||S.type!=="commandExecution")return null;const P=Ae(S.id),L=Ae(S.command);if(!P)return null;const D=typeof S.cwd=="string"?S.cwd:null,B=Ae(S.status),J=B==="failed"?"failed":B==="declined"?"declined":B==="interrupted"?"interrupted":"completed",se=typeof S.aggregatedOutput=="string"?S.aggregatedOutput:"",ye=typeof S.exitCode=="number"?S.exitCode:null,He=ro(c),rt=Ae(m==null?void 0:m.turnId)||Ae(m==null?void 0:m.turn_id),ct=He&&rt?(ht=R.value[He])==null?void 0:ht[rt]:void 0;return{id:P,role:"system",text:L,messageType:"commandExecution",commandExecution:{command:L,cwd:D,status:J,aggregatedOutput:se,exitCode:ye},turnId:rt||void 0,turnIndex:typeof ct=="number"?ct:void 0}}function Tl(c){var ye;if(c.method!=="item/completed")return null;const m=Ke(c.params),S=Ke(m==null?void 0:m.item);if(!S||S.type!=="fileChange")return null;const P=Ae(S.id);if(!P)return null;const L=Ae(m==null?void 0:m.threadId),D=Ae(m==null?void 0:m.turnId),B=L&&D?(ye=R.value[L])==null?void 0:ye[D]:void 0,J=uf(S.changes),se=ty(S.status);return J.length===0||se!=="completed"?null:{id:P,role:"system",text:"",messageType:"fileChange",fileChangeStatus:se,fileChanges:J,turnId:D||void 0,turnIndex:typeof B=="number"?B:void 0}}function xa(c,m){h2(eo,c,m)}function Bn(c,m){m2(eo,c,m)}function Go(c,m){v2(eo,c,m)}function vo(c){if(c.method==="item/agentMessage/delta")return!0;const m=Ke(c.params);if(!m)return!1;if(c.method==="item/completed"){const S=Ke(m.item);return(S==null?void 0:S.type)==="agentMessage"}return!1}const Ko=new Set;function Un(c){for(const m of Ko)try{m(c)}catch{}}function Za(c){return Ko.add(c),()=>{Ko.delete(c)}}function Aa(c,m,S){g2(eo,c,m,S)}function Nr(c,m,S){y2(eo,c,m,S)}function ci(c){var Cc,Ls,Sc,Rl,zi,_c,El,Hi;if(Ja(c))return;if(gr(c),c.method==="turn/started"){const xe=ro(c);xe&&w.delete(xe)}if(q2.has(c.method))return;if(c.method==="app/list/updated"||c.method==="mcpServer/startupStatus/updated"||c.method==="mcpServer/oauthLogin/completed"||c.method==="remoteControl/status/changed"){Un(c.method);return}if(c.method==="skills/changed"){Bt({force:!0});return}if(c.method==="hook/started"||c.method==="hook/completed"){Xn({force:!0});return}if(c.method==="thread/status/changed"){const xe=ro(c);xe&&xe===n.value&&mn.add(xe);return}if(c.method==="thread/archived"||c.method==="thread/unarchived"||c.method==="thread/deleted"||c.method==="thread/closed")return;if(c.method==="item/fileChange/patchUpdated"||c.method==="turn/diff/updated"){const xe=Ke(c.params),Ut=Ae(xe==null?void 0:xe.threadId);Ut&&(c.method==="item/fileChange/patchUpdated"?Aa(Ut,Ae(xe==null?void 0:xe.itemId),uf(xe==null?void 0:xe.changes)):Nr(Ut,Ae(xe==null?void 0:xe.turnId),Ae(xe==null?void 0:xe.diff)??""),Ut===n.value&&mn.add(Ut));return}if(c.method==="account/rateLimits/updated"&&Dt(),c.method==="thread/name/updated"){const xe=Ke(c.params),Ut=Ae(xe==null?void 0:xe.threadId),Da=Ae(xe==null?void 0:xe.threadName);if(Ut&&Da){const ss=Us(Da);pt.value={...pt.value,[Ut]:ss},dn(),Bc(Ut,ss)}}if(c.method==="thread/compacted"){const xe=Ke(c.params),Ut=Ae(xe==null?void 0:xe.threadId);Ut&&(rs(Ut,!1),Kn(Ut,"done"),mn.add(Ut));return}if(c.method==="fuzzyFileSearch/sessionUpdated"){const xe=Ke(c.params),Ut=Ae(xe==null?void 0:xe.sessionId);Ut&&Ut===lo&&(tr.value=AS(xe));return}if(c.method==="fuzzyFileSearch/sessionCompleted"){const xe=Ke(c.params),Ut=Ae(xe==null?void 0:xe.sessionId);Ut&&Ut===lo&&(lo="");return}if(c.method==="account/rateLimits/updated"){ir(iy(c.params));return}const m=RO(c);if(m){Wa(m.threadId,m.usage);return}const S=$O(c);S&&jt(S.threadId,S.activity);const P=ro(c),L=MO(c);!L&&P&&Ga(P);const D=jO(c);D&&(Ot.set(D.turnId,D),Lr(D.threadId,D.turnId,mo(D.threadId)),ne.value={...ne.value,[D.threadId]:D.turnId},Dn(D.threadId,D.turnId),Ya(D.threadId),Fi(D.threadId),Wo(D.threadId,null),Ft(D.threadId,null),On(D.threadId,!0),os(D.threadId),Ie.value[D.threadId]&&(Ie.value=xt(Ie.value,D.threadId)));const B=LO(c),J=EO(c),se=(B==null?void 0:B.threadId)??ro(c),ye=se?nn(se):"",He=!!se&&!!J&&ye!==sa&&Kc(new Error(J));if(B){Be.value[B.threadId];const xe=Ot.get(B.turnId);xe&&Ot.delete(B.turnId);const Ut=Ys((Cc=Ke(c.params))==null?void 0:Cc.durationMs)??Ys((Sc=Ke((Ls=Ke(c.params))==null?void 0:Ls.turn))==null?void 0:Sc.durationMs)??(typeof B.startedAtMs=="number"?B.completedAtMs-B.startedAtMs:null)??(xe?B.completedAtMs-xe.startedAtMs:null),Da=typeof Ut=="number"?Math.max(0,Ut):0;Wo(B.threadId,{turnId:B.turnId,durationMs:Da}),ne.value[B.threadId]&&(ne.value=xt(ne.value,B.threadId)),On(B.threadId,!1),jt(B.threadId,null),Qn(B.threadId),He||(ho(B.threadId),os(B.threadId))}if(J){const xe=(B==null?void 0:B.threadId)||ro(c);xe&&Ft(xe,J),It.value=J,xe&&He&&Er(xe)}else B&&Ft(B.threadId,null);if(L){const xe=P,Ut=xe?nn(xe):Le.value.trim();xe&&Ft(xe,L.message,{transient:L.transient}),It.value=L.message,Ut!==sa&&Kc(new Error(L.message))&&(xe?Er(xe):Ho())}const rt=Ui(c);rt&&(_s(rt.threadId,rt.message),jt(rt.threadId,{label:"Planning",details:((Rl=rt.message.plan)==null?void 0:Rl.steps.map(xe=>xe.step).slice(0,2))??[]}));const ct=Ca(c);ct&&(_s(ct.threadId,ct.message),jt(ct.threadId,{label:"Planning",details:[]}));const ht=Is(c);if(ht&&(_s(ht.threadId,ht.message),jt(ht.threadId,{label:"Planning",details:((zi=ht.message.plan)==null?void 0:zi.steps.map(xe=>xe.step).slice(0,2))??[]})),!P||P!==n.value)return;qO(c);const Rt=zO(c);if(Rt){const xe=(s.value[P]??[]).find(Ml=>Ml.id===Rt.messageId),Ut=`${(xe==null?void 0:xe.text)??""}${Rt.delta}`,Da=Rt.turnId??(xe==null?void 0:xe.turnId),ss=Da?(_c=R.value[P])==null?void 0:_c[Da]:xe==null?void 0:xe.turnIndex;xs(P,{id:Rt.messageId,role:"assistant",text:Ut,messageType:"agentMessage.live",turnId:Da,turnIndex:typeof ss=="number"?ss:void 0})}const Ur=HO(c);if(Ur){const xe=Ur.turnId?(El=R.value[P])==null?void 0:El[Ur.turnId]:void 0;xs(P,{...Ur,turnIndex:typeof xe=="number"?xe:void 0})}const $s=GO(c);$s&&xs(P,$s),NO(c)&&As(P);const js=OO(c);js&&(Fn(P,js.delta),j2(Ce,js.itemId,js.delta));const Qo=UO(c);if(Qo&&(Qa(P,Qo.itemId,Qo.text),As(P)),DO(c)){const xe=h.value[P]??"";xe.trim().length>0&&!xe.endsWith(`
77
+
78
+ `)&&Di(P,`${xe}
79
+
80
+ `)}FO(c);const Oa=Xa(c);Oa&&(xa(P,Oa),jt(P,{label:"Running command",details:[((Hi=Oa.commandExecution)==null?void 0:Hi.command)??""]}));const mi=KO(c);if(mi){const xe=(M.value[P]??[]).find(Ut=>Ut.id===mi.itemId);xe!=null&&xe.commandExecution&&xa(P,{...xe,commandExecution:{...xe.commandExecution,aggregatedOutput:`${xe.commandExecution.aggregatedOutput}${mi.delta}`}})}const _n=ea(c);_n&&xa(P,_n);const vi=Tl(c);if(vi&&ii(P,vi),vo(c)&&ka(P,!0),c.method==="turn/completed"){kt=!1,ka(P),av(Ce),M.value[P]&&(M.value=xt(M.value,P));const xe=ro(c);xe&&(yn(xe),On(xe,!1),jt(xe,null),Qn(xe),He||(ho(xe),os(xe)))}}function Or(c){if(c.method==="thread/tokenUsage/updated"||c.method.startsWith("thread/realtime/"))return;const m=c.method,S=m==="turn/started"||m==="turn/completed"||m==="error",P=m.startsWith("thread/")||m==="turn/completed";if(!S&&!P)return;const L=ro(c);L&&S&&mn.add(L),P&&(tn=!0,Sn=!0),!(Cn!==null||typeof window>"u")&&(Cn=window.setTimeout(()=>{Cn=null,fn()},Xc))}async function Yo(c,m){if(!ar){ar=!0;try{if(!m)return;const S=[];for(const P of zu(m)){const L=ji(P);S.includes(L)||S.push(L)}if(S.length>0){const P=m.projectOrder.length>0?Qi(S,c):Qi(Qe.value,c);ps(Qe.value,P)||(Qe.value=P)}if(Object.keys(m.labels).length>0||(m.remoteProjects??[]).length>0){const P={...et.value};let L=!1;for(const[D,B]of Object.entries(m.labels)){const J=nt(D).trim(),se=[ji(D)];J&&se.push(J);for(const ye of se)P[ye]!==B&&(P[ye]=B,L=!0)}for(const D of m.order){const B=ji(D),J=Wr(ll(D));if(!J.startsWith(".")||J===B)continue;const se=`${B} ${J}`;P[B]!==void 0||P[B]===se||(P[B]=se,L=!0)}for(const D of m.remoteProjects??[]){const B=ZN(D);P[D.id]!==B&&(P[D.id]=B,L=!0)}L&&(et.value=P)}}catch{}}}async function yr(c={}){if(!(c.force!==!0&&Object.keys(pt.value).length>0))try{const m=await ox();if(Object.keys(m.titles).length>0){const S={};for(const[P,L]of Object.entries(m.titles))S[P]=Us(L);pt.value=S}}catch{}}async function wn(){try{return await el()}catch{return null}}function Ia(c,m,S){const P=c.trim();if(P)return Us(P);const L=S.map(D=>D.label.trim()).find(D=>D.length>0);return L?Us(L):m.length>0?Us("[Image]"):"Untitled thread"}async function Pa(c,m,S,P=[],L=[]){if(pt.value[c])return;const D=m.trim();if(!D){const J=Ia(m,P,L);pt.value={...pt.value,[c]:J},dn(),Bc(c,J);return}const B=D.length>300?D.slice(0,300):D;try{const J=await ux(B,S);if(!J||pt.value[c])return;const se=J.length>yf?J.slice(0,yf):J;pt.value={...pt.value,[c]:se},dn(),Bc(c,se)}catch{}}function ta(c,m){const S=gf(c,m),P=oO(c,m),L=rO(P,m,S);if(!m||m.order.length===0&&(m.remoteProjects??[]).length===0)return L;const D=new Set;for(const J of vf(m,S))D.add(J);const B=L.filter(J=>D.has(J.projectName)?!0:wf(J));return nO(B,m,S)}function Ra(c,m){const S=ta(c,m),P=!!(m&&(m.order.length>0||m.projectOrder.length>0||(m.remoteProjects??[]).length>0)),L=m!=null&&m.projectOrder.length?Qi(vf(m,gf(c,m)),S):Qi(Qe.value,S);ps(Qe.value,L)||(Qe.value=L,P||Vl(Qe.value));const D=Ud(S,Qe.value);Xr(new Set(wo(D).map(se=>se.id)));const B=QN(t.value,D,Y.value);t.value=Yc(t.value,B),Y.value=Tn(Y.value,new Set(wo(t.value).map(se=>se.id))),new Set(wo(t.value).map(se=>se.id));const J={};for(const se of wo(t.value))J[se.id]=se.externalSession??H.value[se.id]??null;H.value=J,dn()}function na(c){const m={};for(const[S,P]of Object.entries(c)){const L=S.trim();!L||P.length===0||(m[L]=P.map(D=>({id:D.id,text:D.text,imageUrls:[...D.imageUrls],skills:D.skills.map(B=>({name:B.name,path:B.path})),fileAttachments:D.fileAttachments.map(B=>({label:B.label,path:B.path,fsPath:B.fsPath})),collaborationMode:D.collaborationMode})))}return m}function Eo(){Z_(na(q.value)).catch(()=>{})}async function Ea(){if(!ge){ge=!0;try{q.value=await ym()}catch{}}}function Ps(c){uo=Jm(uo,c),t.value=Jm(t.value,c),Y.value=xt(Y.value,c),dn()}function kl(c,m){if(c.length===0)return m;if(m.length===0)return c;const S=new Map;for(const L of wo(c))S.set(L.id,L);for(const L of wo(m))S.set(L.id,L);const P=new Map;for(const L of S.values()){const D=P.get(L.projectName);D?D.push(L):P.set(L.projectName,[L])}return Array.from(P.entries()).map(([L,D])=>({projectName:L,threads:D.sort((B,J)=>new Date(J.updatedAtIso).getTime()-new Date(B.updatedAtIso).getTime())})).sort((L,D)=>{var se,ye;const B=new Date(((se=L.threads[0])==null?void 0:se.updatedAtIso)??0).getTime();return new Date(((ye=D.threads[0])==null?void 0:ye.updatedAtIso)??0).getTime()-B})}function Ma(){return Object.values(Y.value).some(c=>c===!0)}function $a(c=Uo){if(!(!co||rr||Ma())){if(Uo=c,typeof window>"u"){wr(c);return}Rn!==null&&window.clearTimeout(Rn),Rn=window.setTimeout(()=>{Rn=null,!(!co||Ma())&&wr(Uo)},O2)}}async function wr(c){if(!(rr||!co||Ma())){rr=!0;try{const m=await im(co,Y_());co=m.nextCursor,Ar=m.nextCursor===null,Ne.value=Ar,uo=kl(uo,m.groups),Ra(uo,c)}catch{}finally{rr=!1,co&&!Ma()&&$a(c)}}}async function go(c={}){if(zt){await zt;return}c.force!==!0&&nr.value&&Date.now()-ga<B2||(zt=(async()=>{var m;nr.value||(K.value=!0);try{const[S,P]=await Promise.all([im(),wn(),yr({force:c.force===!0})]);Uo=P;const L=S.groups;uo=L,co=S.nextCursor,Ar=S.nextCursor===null,Ne.value=Ar,await Yo(L,P),Ra(uo,P),nr.value=!0,ga=Date.now(),Ar||$a(P);const D=wo(e.value);Mr(D),!D.some(J=>J.id===n.value)&&!n.value&&gn(((m=D[0])==null?void 0:m.id)??"")}finally{K.value=!1}})().finally(()=>{zt=null}),await zt)}async function Gn(c,m={}){var J;if(!c)return;const S=Date.now()-(Ln.get(c)??0)<cv;if((J=le.value[c])!=null&&J.transient&&(m.silent===!0||S))return;const P=Et.get(c);if(P&&m.force!==!0){await P;return}const L=ee.value[c]===!0,D=m.silent!==!0&&!L;D&&(pe.value=!0);const B=(async()=>{try{const se=si(c),ye=re.value[c]??"",He=Date.now()-(xr.get(c)??0)<cv;if(m.force===!0?!1:L&&(He||(se.length===0||ye===se)&&Y.value[c]!==!0)){Wn(c);return}const ht=$e.value[c]!==!0?await Ed(c):null,Rt=ht??await Rd(c);Rt.modelProvider&&Mn(c,Rt.modelProvider),Rt.model&&Mt(c,Hn(c,Rt.model,Rt.modelProvider)),ht&&($e.value={...$e.value,[c]:!0});const{messages:Ur,inProgress:$s,activeTurnId:hi,turnIndexByTurnId:js}=Rt;te.value={...te.value,[c]:Rt.hasMoreOlder===!0},ur(c,Ur),Zr(c,js),vr(c);const Qo=o.value[c]??[],Pl=Ym(Qo,Ur,{preserveMissing:m.silent===!0||ON(Qo)});fr(c,Pl);const Oa=s.value[c]??[];if($s){const mi=BN(Oa,Ur);Vn(c,mi)}else $r(c);Bn(c,Ur),Go(c,Ur),ee.value={...ee.value,[c]:!0},xr.set(c,Date.now()),Ln.delete(c),se&&(re.value={...re.value,[c]:se}),On(c,$s),Rt.externalSession&&(H.value={...H.value,[c]:Rt.externalSession}),Ga(c),hi?ne.value={...ne.value,[c]:hi}:ne.value[c]&&(ne.value=xt(ne.value,c)),$s||Bi(c),Wn(c)}catch(se){const ye=se instanceof Error?se.message:"Unknown application error";throw n.value===c&&Ft(c,ye,{transient:!0}),Ln.set(c,Date.now()),se}finally{D&&(pe.value=!1)}})().finally(()=>{Et.delete(c)});Et.set(c,B),await B}async function es(c=n.value){if(!c||V.value[c]===!0||te.value[c]!==!0)return;const m=Jr(c);if(!m){te.value={...te.value,[c]:!1};return}V.value={...V.value,[c]:!0};try{const S=await S_(c,m),P=o.value[c]??[],L=Ym(S.messages,P,{preserveMissing:!0});fr(c,L),Zr(c,{...R.value[c]??{},...S.turnIndexByTurnId}),vr(c),te.value={...te.value,[c]:S.hasMoreOlder}}catch(S){throw It.value=S instanceof Error?S.message:"Failed to load earlier messages",S}finally{V.value={...V.value,[c]:!1}}}async function ui(c,m={}){var S;c&&ee.value[c]!==!0&&(m.silent===!0&&((S=le.value[c])!=null&&S.transient)||await Gn(c,m))}async function Bt(c={}){var P,L;const m=((L=(P=Ir.value)==null?void 0:P.cwd)==null?void 0:L.trim())??"",S=m||"__global__";if(Cr){await Cr;return}c.force!==!0&&Sr&&wa===S&&Date.now()-ya<U2||(Cr=(async()=>{try{Yt.value=await fx(m?[m]:void 0),Sr=!0,ya=Date.now(),wa=S}catch{}finally{Cr=null}})(),await Cr)}async function Xn(c={}){if(hn){await hn;return}c.force!==!0&&Bo||(G.value=!0,hn=(async()=>{try{z.value=await q_(),Bo=!0}catch{}finally{G.value=!1,hn=null}})(),await hn)}async function bn(c={}){await Promise.allSettled([Ee({providerChanged:c.providerChanged,includeProviderModels:c.includeProviderModels}),Ve(),O(),Bt()])}function Rs(c={}){const m=()=>{bn(c)};if(typeof window>"u"){m();return}window.setTimeout(m,0)}async function Jo(c={}){It.value="",it.value="";const m=c.includeSelectedThreadMessages!==!1,S=c.awaitAncillaryRefreshes===!0;try{if(await Ea(),await go({force:c.forceThreadRefresh===!0}),m)try{await Gn(n.value)}catch(P){It.value=P instanceof Error?P.message:"Unknown application error"}S?await bn({providerChanged:c.providerChanged,includeProviderModels:c.providerChanged===!0||S}):Rs({providerChanged:c.providerChanged,includeProviderModels:!1})}catch(P){It.value=P instanceof Error?P.message:"Unknown application error",Hm(P)?it.value=lv:it.value=""}}async function ts(c){gn(c);try{return await Gn(c),await Ee({includeProviderModels:!0}),Bt(),"ok"}catch(m){const S=m instanceof Error?m.message:"Unknown application error";It.value=S;const P=AN(m)?"not-found":"error";return c.trim()&&Ft(c,S,{transient:!0}),P}}async function y(c){const m=n.value===c,S=m?xN(wo(e.value),c):"";m&&(gn(S),S&&Gn(S,{silent:!0}));try{await __(c),Ps(c),await go(),m&&S&&n.value===S&&await ui(S,{silent:!0})}catch(P){It.value=P instanceof Error?P.message:"Unknown application error"}}async function b(c,m){const S=m.trim();if(!(!c||!S))try{await I_(c,S),pt.value={...pt.value,[c]:S},dn(),Bc(c,S)}catch(P){It.value=P instanceof Error?P.message:"Unknown application error"}}async function T(c){var B,J;const m=c.trim();if(!m)return"";const S=wo(t.value).find(se=>se.id===m),P=((B=S==null?void 0:S.cwd)==null?void 0:B.trim())??"",L=((J=S==null?void 0:S.title)==null?void 0:J.trim())??"Forked chat",D=nn(m);It.value="";try{const se=await cm(m,P||void 0,D||void 0),ye=se.threadId.trim();return ye?(oi(ye,P,L),Mt(ye,se.model),$e.value={...$e.value,[ye]:!0},gn(ye),await go(),await Gn(ye),ye):""}catch(se){return It.value=se instanceof Error?se.message:"Unknown application error",""}}async function N(c,m){var B;const S=c.trim();if(!S||!Number.isInteger(m)||m<0)return"";if(Y.value[S]===!0)return It.value="Finish the current turn before forking from a response.","";if(ee.value[S]!==!0)try{await Gn(S)}catch(J){return It.value=J instanceof Error?J.message:"Unknown application error",""}const P=o.value[S]??[];let L=-1;for(const J of P)typeof J.turnIndex=="number"&&Number.isFinite(J.turnIndex)&&(L=Math.max(L,J.turnIndex));if(L>=0&&m>L)return"";const D=wo(t.value).find(J=>J.id===S)??null;try{It.value="";const J=await cm(S),se=J.threadId.trim();if(!se)return"";const ye=J.cwd.trim()||((B=D==null?void 0:D.cwd)==null?void 0:B.trim())||"",He=aO((D==null?void 0:D.title)||(D==null?void 0:D.preview)||"Untitled thread");oi(se,ye,He),Mt(se,J.model),fr(se,J.messages),ee.value={...ee.value,[se]:!0},$e.value={...$e.value,[se]:!0},Ya(se),Vn(se,[]),ka(se),M.value[se]&&(M.value=xt(M.value,se)),Wo(se,null),jt(se,null),Ft(se,null),On(se,!1);const rt=L-m;if(rt>0){const ct=await Md(se,rt);fr(se,ct)}return await b(se,He),gn(se),go().catch(()=>{}),se}catch(J){return It.value=J instanceof Error?J.message:"Unknown application error",""}}async function ke(c,m,S=[],P=[],L=[]){if(!c||!m.trim()||S.length>0||P.length>0||L.length>0)return!1;const B=(Te.value[c]??[]).filter(ye=>ye.method==="item/tool/requestUserInput");if(B.length!==1)return!1;const[J]=B,se=o2(J);return se.length!==1?!1:br({id:J.id,result:{answers:{[se[0]]:{answers:[m.trim()]}}}})}function ot(){if(typeof window>"u")return{};try{const c=window.localStorage.getItem(sv);if(!c)return{};const m=JSON.parse(c);if(!m||typeof m!="object"||Array.isArray(m))return{};const S={};for(const[P,L]of Object.entries(m)){if(!P||!Array.isArray(L))continue;const D=L.filter(B=>!!B&&typeof B=="object"&&typeof B.id=="string"&&typeof B.text=="string");D.length>0&&(S[P]=D)}return S}catch{return{}}}function Pt(){typeof window>"u"||window.localStorage.setItem(sv,JSON.stringify(we.value))}function Mo(){if(typeof window>"u")return Qc;try{const c=window.localStorage.getItem(iv);if(c===null)return Qc;const m=Number(c);return Number.isFinite(m)&&m>=0?Math.round(m):Qc}catch{return Qc}}function Qt(c){const m=Number.isFinite(c)&&c>0?Math.round(c):0;m!==ve.value&&(ve.value=m,!(typeof window>"u")&&window.localStorage.setItem(iv,String(m)))}async function qn(c,m,S,P,L,D){if(je||ve.value<=0||Y.value[c]===!0)return!1;const B=ze.value[c];if(!B||B.remainingContextPercent===null||B.remainingContextPercent>ve.value)return!1;const J=we.value[c]??[],se=`stash-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,ye=D==="plan"?"plan":D==="default"?"default":Ue.value;return we.value={...we.value,[c]:[...J,{id:se,text:m,imageUrls:S,skills:P,fileAttachments:L,collaborationMode:ye}]},Pt(),kn.value.has(c)||Dr(c),!0}async function Xt(c){const m=we.value[c];if(!m||m.length===0||Y.value[c]===!0)return;const S=[...m];we.value=xt(we.value,c),Pt(),je=!0;try{for(const P of S)try{await to(P.text,P.imageUrls,P.skills,"steer",P.fileAttachments,void 0,P.collaborationMode)}catch{}}finally{je=!1}}async function to(c,m=[],S=[],P="steer",L=[],D,B){if($t.value)return;const J=n.value,se=c.trim();if(!J||!se&&m.length===0&&L.length===0||await ke(J,se,m,S,L)||await qn(J,se,m,S,L,B))return;const ye=Y.value[J]===!0;if(ye&&P==="queue"){const He=q.value[J]??[],rt=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,ct=[...He],ht=typeof D=="number"?Math.max(0,Math.min(D,ct.length)):ct.length;ct.splice(ht,0,{id:rt,text:se,imageUrls:m,skills:S,fileAttachments:L,collaborationMode:B==="plan"?"plan":B==="default"?"default":Ue.value}),q.value={...q.value,[J]:ct},Eo();return}if(ye){kt=!0,no(J,se,m,S,L,B).catch(He=>{const rt=He instanceof Error?He.message:"Unknown application error";Ft(J,rt),It.value=rt});return}It.value="",kt=!0,Wo(J,null),jt(J,{label:"Thinking",details:oe(nn(J),gt.value,B==="plan"?"plan":B==="default"?"default":Ue.value)}),Ft(J,null),On(J,!0);try{await no(J,se,m,S,L,B)}catch(He){kt=!1,On(J,!1),jt(J,null);const rt=He instanceof Error?He.message:"Unknown application error";throw Ft(J,rt),It.value=rt,He}}async function ja(c,m,S=[],P=[],L=[]){if($t.value)return"";const D=c.trim(),B=m.trim(),J=nn(Xs).trim(),se=Ue.value;if(!D&&S.length===0&&L.length===0)return"";We.value=!0,It.value="";let ye="";try{try{const ht=await lm(B||void 0,J||void 0);ye=ht.threadId,Mt(ye,ht.model),Mn(ye,ht.modelProvider||at.value),Va(ye,se)}catch(ht){if(J&&J!==sa&&Kc(ht)){await Ho();const Rt=await lm(B||void 0,sa);ye=Rt.threadId,Mt(ye,Rt.model),Mn(ye,Rt.modelProvider||at.value),Va(ye,se)}else throw ht}if(!ye)return"";oi(ye,B,D||"[Image]"),Ss(ye,D,S,P,L),bl(ye),$e.value={...$e.value,[ye]:!0},gn(ye),kt=!0,Wo(ye,null),jt(ye,{label:"Thinking",details:oe(nn(ye),gt.value,se)}),Ft(ye,null),On(ye,!0);const He=ye,rt=B||null,ct=D;return no(ye,D,S,P,L,se).catch(ht=>{kt=!1,On(ye,!1),jt(ye,null);const Rt=ht instanceof Error?ht.message:"Unknown application error";Ft(ye,Rt),It.value=Rt}).finally(()=>{We.value=!1}),Pa(He,ct,rt,S,L),ye}catch(He){kt=!1,ye&&(On(ye,!1),jt(ye,null));const rt=He instanceof Error?He.message:"Unknown application error";throw ye&&Ft(ye,rt),It.value=rt,We.value=!1,He}}async function no(c,m,S=[],P=[],L=[],D){const B=gt.value,J=D==="plan"?"plan":D==="default"?"default":Ue.value,se=m.trim(),ye=[...S];if(ye.length===0&&jn(se)){const ct=Pn(c);ct&&ye.push(ct)}const He=P.map(ct=>({name:ct.name,path:ct.path})),rt=L.map(ct=>({...ct}));lr(c,{text:se,imageUrls:[...ye],skills:He,fileAttachments:rt,effort:B,collaborationMode:J,fallbackRetried:!1});try{if($e.value[c]!==!0){const Rt=await Ed(c);Rt.model&&Mt(c,Hn(c,Rt.model,Rt.modelProvider)),Rt.modelProvider&&Mn(c,Rt.modelProvider),$e.value={...$e.value,[c]:!0}}const ct=nn(c);let ht="";try{ht=await $d(c,m,ye,ct||void 0,B||void 0,P.length>0?P:void 0,L,J)}catch(Rt){if(ct&&ct!==sa&&Kc(Rt))await Ho(c),lr(c,{text:se,imageUrls:[...ye],skills:He,fileAttachments:rt,effort:B,collaborationMode:J,fallbackRetried:!0}),ht=await $d(c,m,ye,sa,B||void 0,P.length>0?P:void 0,L,J);else throw Rt}ht&&(ne.value={...ne.value,[c]:ht},Dn(c,ht)),mn.add(c),await fn(),on(c)}catch(ct){throw ct}}async function ns(c){if(me.value[c]!==!0){me.value={...me.value,[c]:!0};try{q.value=await ym()}catch{}finally{me.value=xt(me.value,c)}}}function os(c){ns(c),!(typeof window>"u")&&window.setTimeout(()=>{ns(c)},650)}async function Es(){const c=n.value;if(!c||Y.value[c]!==!0||be.value[c]===!0)return;let m=ne.value[c];if(!m){const{activeTurnId:D}=await Rd(c);m=D,m&&(ne.value={...ne.value,[c]:m})}if(!m)throw new Error("Could not determine active turn id for interrupt");const S=Io.value.filter(D=>D.turnId===m),P=S.find(D=>D.role==="user"),L=S.some(D=>{if(D.role==="assistant")return!0;const B=D.messageType??"";return B==="commandExecution"||B==="toolCall"||B==="worked"||B==="fileChange"||B==="plan"||B==="plan.live"||B==="compaction.done"||B==="turnError"});Xe.value=!0,It.value="";try{if(await P_(c,m),On(c,!1),jt(c,null),Ft(c,null),ne.value[c]&&(ne.value=xt(ne.value,c)),mn.add(c),tn=!0,await fn(),P&&!L){const D=(o.value[c]??[]).filter(J=>J.turnId!==m);fr(c,D);const B=u.value[c];if(B){const J=B.filter(se=>se.turnId!==m);J.length!==B.length&&(u.value={...u.value,[c]:J},zd(u.value))}Ge.value={...Ge.value,[c]:{text:P.text??"",imageUrls:P.images??[],fileAttachments:(P.fileAttachments??[]).map(J=>({label:J.label,path:J.path,fsPath:J.fsPath??J.path})),skills:P.skills??[]}}}}catch(D){const B=D instanceof Error?D.message:"Failed to interrupt active turn";Ft(c,B),It.value=B}finally{Xe.value=!1}}function Ms(c){c&&Ge.value[c]&&(Ge.value=xt(Ge.value,c))}async function La(c){var S,P;const m=n.value;if(m&&!Lt.value&&c.trim()){Lt.value=!0,It.value="";try{Y.value[m]===!0&&await Es();const L=o.value[m]??[],D=L.find(rt=>rt.turnId===c),B=typeof(D==null?void 0:D.turnIndex)=="number"?D.turnIndex:-1;if(B<0)return;const J=L.reduce((rt,ct)=>typeof ct.turnIndex=="number"&&ct.turnIndex>rt?ct.turnIndex:rt,-1);if(J<0||B>J)return;const se=J-B+1;if(se<1)return;const ye=((P=(S=Ir.value)==null?void 0:S.cwd)==null?void 0:P.trim())??"";ye&&await a1(m,c,ye);const He=await Md(m,se);fr(m,He),Vn(m,[]),ka(m),M.value[m]&&(M.value=xt(M.value,m)),Wo(m,null),jt(m,null),Ft(m,null),tn=!0,await fn()}catch(L){It.value=L instanceof Error?L.message:"Failed to rollback thread"}finally{Lt.value=!1}}}function Kn(c,m){const P=(i.value[c]??[]).filter(L=>L.messageType!=="compaction.pending"&&L.messageType!=="compaction.done");P.push({id:`compaction:${m}:${c}:${Date.now()}`,role:"system",text:"",messageType:m==="pending"?"compaction.pending":"compaction.done"}),i.value={...i.value,[c]:P}}function rs(c,m){const S=new Set(kn.value);m?S.add(c):S.delete(c),kn.value=S}function kc(c){lo=c.trim(),tr.value=[]}async function Dr(c){const m=c.trim();if(!(!m||kn.value.has(m))){rs(m,!0),Kn(m,"pending");try{await A_(m);const S=2e3,P=14,L=Date.now()+Fo;let D=0;for(;Date.now()<L&&D<P&&kn.value.has(m);){if((await Rd(m)).messages.some(se=>se.messageType==="compaction.done")){rs(m,!1),n.value===m&&await Gn(m,{silent:!0,force:!0}),Kn(m,"done"),Xt(m);break}D+=1,await _N(S)}kn.value.has(m)&&(rs(m,!1),Kn(m,"done"),Xt(m))}catch(S){It.value=S instanceof Error?S.message:"Failed to compact thread",rs(m,!1),Kn(m,"done"),Xt(m)}}}let di=null;async function Hu(c,m){try{const S=await el(),P={...S.labels};let L=!1;for(const D of S.order){if(!su(D,c))continue;const B=m.trim();B.length===0?P[D]!==void 0&&(delete P[D],L=!0):P[D]!==B&&(P[D]=B,L=!0)}L&&await jd({order:S.order,labels:P,active:S.active,projectOrder:S.projectOrder})}catch{}}function as(c,m){c.length===0||(et.value[c]??"")===m||(et.value={...et.value,[c]:m},tv(et.value),di!==null&&clearTimeout(di),di=setTimeout(()=>{di=null,Hu(c,m)},500))}async function Fr(c){var D;if(c.length===0)return;const m=Qe.value.filter(B=>B!==c);if(ps(Qe.value,m)||(Qe.value=m,Vl(Qe.value)),t.value=t.value.filter(B=>B.projectName!==c),et.value[c]!==void 0){const B={...et.value};delete B[c],et.value=B,tv(B)}dn();const S=wo(e.value);Mr(S),S.some(B=>B.id===n.value)||gn(((D=S[0])==null?void 0:D.id)??"");const L=new Set;try{const B=await el();eO(B,c).forEach(J=>{L.add(J)})}catch{}if(L.size>0)try{const B=await el(),J=B.order.filter(He=>!L.has(He)),se=B.active.filter(He=>!L.has(He)),ye=se.length===0&&J.length>0?[J[0]]:se;await jd({order:J,labels:GN(B.labels,L),active:ye,projectOrder:B.projectOrder.filter(He=>He!==c&&!L.has(He))});return}catch{}await $n()}function fi(c,m){if(c.length===0||t.value.length===0)return;const S=t.value.map(se=>se.projectName),P=S.indexOf(c);if(P===-1)return;const L=Math.max(0,Math.min(m,S.length-1)),D=MN(S,P,L);if(D===S)return;const B=Qi(D,t.value);Qe.value=B,Vl(Qe.value);const J=Ud(t.value,Qe.value);t.value=Yc(t.value,J),dn(),$n()}function Cl(c){const m=c.trim();if(!m)return;const S=[m,...Qe.value.filter(L=>L!==m)];if(ps(Qe.value,S))return;Qe.value=S,Vl(Qe.value);const P=Ud(t.value,Qe.value);t.value=Yc(t.value,P),dn(),$n()}async function $n(){try{const c=await el(),m=tO(c,Qe.value,t.value);await jd({order:m.order,labels:c.labels,active:m.active,projectOrder:m.projectOrder})}catch{}}async function fn(){if(Kr.value){typeof window<"u"&&Cn===null&&(Cn=window.setTimeout(()=>{Cn=null,fn()},Xc));return}Kr.value=!0;const c=tn,m=Sn,S=new Set(mn);tn=!1,Sn=!1,mn.clear();try{c&&await go({force:m});const P=n.value;if(!P)return;const L=S.has(P),D=Y.value[P]===!0,B=si(P),J=re.value[P]??"";(B.length>0&&B!==J||L||D&&ee.value[P]!==!0||c&&ee.value[P]!==!0)&&await Gn(P,{silent:!0,force:L})}catch{}finally{Kr.value=!1,(tn||mn.size>0)&&typeof window<"u"&&Cn===null&&(Cn=window.setTimeout(()=>{Cn=null,fn()},Xc))}}async function Br(){await _l(),tn=!nr.value,n.value&&ee.value[n.value]!==!0&&mn.add(n.value),await fn()}function Sl(c){const m=Ke(c.params),S=typeof(m==null?void 0:m.threadId)=="string"?m.threadId.trim():"";if(!S)return;const P=Ke(m==null?void 0:m.externalSession),L=P&&typeof P.origin=="string"&&P.origin.trim().length>0?{origin:P.origin.trim(),active:P.active===!0,lastWriteAt:typeof P.lastWriteAt=="string"?P.lastWriteAt:null}:null;H.value={...H.value,[S]:L},On(S,(L==null?void 0:L.active)===!0),dn(),tn=!0,n.value===S&&mn.add(S),Cn===null&&typeof window<"u"&&(Cn=window.setTimeout(()=>{Cn=null,fn()},Xc))}function oa(){typeof window>"u"||So||(_l(),Wu(),So=J_(c=>{if(c.method==="ready"){Ta(),Br();return}if(c.method==="externalSessionChanged"){Sl(c);return}ci(c),Or(c)}))}async function _l(){try{const m=(await gm()).map(S=>ov(S)).filter(S=>S!==null);Vo(m)}catch{}}async function Wu(){try{const c=await rx(),m=Object.entries(c);if(m.length===0)return;const S={...u.value};let P=!1;for(const[L,D]of m){const B=D.filter(He=>!!He&&typeof He.id=="string");if(B.length===0)continue;const J=S[L]??[],se=new Set(J.map(He=>He.text)),ye=[...J];for(const He of B)se.has(He.text)||(ye.push(He),se.add(He.text));S[L]=ye.slice(-20),P=!0}P&&(u.value=S,zd(S))}catch{}}async function br(c){try{return await Q_(c.id,{result:c.result,error:c.error}),jr(c.id),ce.value=xt(ce.value,String(c.id)),!0}catch(m){const S=m instanceof Error?m.message:"Failed to reply to server request";return await qi(c.id)?(It.value=S,ce.value={...ce.value,[String(c.id)]:S},!1):(jr(c.id),ce.value=xt(ce.value,String(c.id)),!0)}}async function qi(c){try{const m=await gm();for(const S of m){const P=Ke(S);if((P==null?void 0:P.id)===c)return!0}return!1}catch{return!0}}function xl(){if(So&&(So(),So=null),tn=!1,mn.clear(),Ot.clear(),Cn!==null&&typeof window<"u"&&(window.clearTimeout(Cn),Cn=null),or!==null&&typeof window<"u"&&(window.clearTimeout(or),or=null),Rn!==null&&typeof window<"u"&&(window.clearTimeout(Rn),Rn=null),typeof window<"u")for(const c of Tt.values())window.clearTimeout(c);Tt.clear(),kt=!1,o.value={},r.value={},s.value={},h.value={},u.value={},M.value={},U.value={},R.value={},W.value={},j.value={},le.value={},ne.value={},A.clear(),av(Ce),w.clear(),iO(),be.value={},de.value={},ie.value={},q.value={},me.value={},we.value={},Pt(),Eo(),Fe.value=null,ze.value={}}const Al=X(()=>{const c=n.value;if(!c)return[];const m=q.value[c]??[];return[...(we.value[c]??[]).map(L=>({...L,awaitingCompaction:!0})),...m]});function ra(c){const m=n.value;if(!m)return;const S=we.value[m];if(S!=null&&S.some(D=>D.id===c)){const D=S.filter(B=>B.id!==c);we.value=D.length>0?{...we.value,[m]:D}:xt(we.value,m),Pt();return}const P=q.value[m];if(!P)return;const L=P.filter(D=>D.id!==c);q.value=L.length>0?{...q.value,[m]:L}:xt(q.value,m),Eo()}function Il(c,m){const S=n.value;if(!S)return;const P=q.value[S];if(!P)return;const L=we.value[S];if(L!=null&&L.some(ye=>ye.id===c||ye.id===m))return;const D=P.findIndex(ye=>ye.id===c),B=P.findIndex(ye=>ye.id===m);if(D<0||B<0||D===B)return;const J=[...P],[se]=J.splice(D,1);J.splice(B,0,se),q.value={...q.value,[S]:J},Eo()}function pi(c){const m=n.value;if(!m)return;const S=we.value[m],P=S==null?void 0:S.find(B=>B.id===c);if(P){ra(c),Rr(P.collaborationMode),je=!0,to(P.text,P.imageUrls,P.skills,"steer",P.fileAttachments).finally(()=>{je=!1});return}const L=q.value[m];if(!L)return;const D=L.find(B=>B.id===c);D&&(ra(c),Rr(D.collaborationMode),to(D.text,D.imageUrls,D.skills,"steer",D.fileAttachments))}function Na(c,m={}){gn(c,m)}return{projectGroups:e,projectDisplayNameById:et,selectedThread:Ir,selectedThreadTokenUsage:ni,selectedThreadTerminalOpen:xo,isSelectedThreadInterruptPending:Jn,selectedThreadServerRequests:Ao,selectedLiveOverlay:Yr,selectedActiveTurnId:qo,lastPlanByThreadId:a,resolveThreadTurnIndex:mr,codexQuota:Pr,selectedThreadId:n,availableCollaborationModes:_e,availableModelIds:De,availableModelReasoningEfforts:fe,selectedCollaborationMode:Ue,selectedModelId:Le,selectedReasoningEffort:gt,selectedSpeedMode:ft,codexCliMissingError:it,installedSkills:Yt,accountRateLimitSnapshots:In,messages:Io,hasMoreOlderMessages:ba,isLoadingThreads:K,isThreadListFullyLoaded:Ne,isLoadingMessages:pe,isLoadingOlderMessages:sr,isSendingMessage:We,isInterruptingTurn:Xe,isUpdatingSpeedMode:$t,isRollingBack:Lt,compactingThreadIds:kn,fuzzyFileSearchResults:tr,registerFuzzyFileSearchSession:kc,error:It,refreshAll:Jo,refreshSkills:Bt,refreshHooks:Xn,hooksList:z,isHooksLoading:G,onRealtimeEvent:Za,selectThread:ts,loadMessages:Gn,loadOlderMessages:es,ensureThreadMessagesLoaded:ui,setThreadTerminalOpen:dr,toggleSelectedThreadTerminal:Ka,archiveThreadById:y,compactThreadById:Dr,renameThreadById:b,forkThreadById:T,forkThreadFromTurn:N,rollbackSelectedThread:La,sendMessageToSelectedThread:to,sendMessageToNewThread:ja,interruptSelectedThreadTurn:Es,interruptedUnsubmittedMessage:Ha,clearInterruptedUnsubmittedMessage:Ms,selectedThreadQueuedMessages:Al,removeQueuedMessage:ra,reorderQueuedMessage:Il,steerQueuedMessage:pi,autoCompactThreshold:ve,setAutoCompactThreshold:Qt,setSelectedCollaborationMode:Rr,readModelIdForThread:nn,setSelectedModelIdForThread:_t,setSelectedModelId:Jt,setSelectedReasoningEffort:cr,updateSelectedSpeedMode:E,respondToPendingServerRequest:br,pendingReplyErrorForRequest:_a,renameProject:as,removeProject:Fr,reorderProject:fi,pinProjectToTop:Cl,startPolling:oa,stopPolling:xl,primeSelectedThread:Na}}const H2={class:"sidebar-root"},W2=["aria-pressed","aria-label","title"],V2={key:1,class:"sidebar-search-bar"},G2=["placeholder"],K2=["aria-label"],Y2={class:"sidebar-skills-link-icon","aria-hidden":"true"},J2={class:"sidebar-skills-link-copy"},Q2={class:"sidebar-skills-link-title"},X2={class:"sidebar-skills-link-subtitle"},Z2={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},eD={class:"sidebar-skills-link-copy"},tD={class:"sidebar-skills-link-title"},nD={class:"sidebar-skills-link-subtitle"},oD=["aria-label"],rD={class:"settings-dialog-header"},aD={class:"settings-dialog-title"},sD=["aria-label","title"],iD={class:"settings-dialog-body"},lD=["aria-label"],cD=["aria-current","onClick"],uD={class:"settings-group-content"},dD=["title"],fD={class:"sidebar-settings-label"},pD=["title"],hD={class:"sidebar-settings-label"},mD={class:"sidebar-settings-value"},vD=["title"],gD={class:"sidebar-settings-label"},yD={class:"sidebar-settings-value"},wD=["title"],bD={class:"sidebar-settings-label"},TD=["title"],kD={class:"sidebar-settings-label"},CD={class:"sidebar-settings-value"},SD=["title"],_D={class:"sidebar-settings-label"},xD=["title"],AD={class:"sidebar-settings-label"},ID=["title"],PD={class:"sidebar-settings-label"},RD=["title"],ED={class:"sidebar-settings-label"},MD=["href"],$D={class:"sidebar-settings-label"},jD={class:"sidebar-settings-value"},LD=["title"],ND={class:"sidebar-settings-label"},OD={key:0,class:"sidebar-settings-row sidebar-settings-error"},DD=["href"],FD={key:1,class:"sidebar-settings-row sidebar-settings-row--input"},BD={class:"sidebar-settings-provider-info"},UD={class:"sidebar-settings-label"},qD={class:"sidebar-settings-provider-link",href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer"},zD={class:"sidebar-settings-key-group"},HD={class:"sidebar-settings-key-masked"},WD=["disabled","title"],VD=["placeholder"],GD=["disabled"],KD={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},YD={class:"sidebar-settings-label"},JD=["aria-label"],QD=["disabled"],XD=["disabled"],ZD={key:2,class:"sidebar-settings-row sidebar-settings-row--input"},eF={class:"sidebar-settings-provider-info"},tF={class:"sidebar-settings-label"},nF={class:"sidebar-settings-provider-link",href:"https://opencode.ai/auth",target:"_blank",rel:"noopener noreferrer"},oF={class:"sidebar-settings-key-group"},rF=["placeholder"],aF=["disabled"],sF={key:3,class:"sidebar-settings-row sidebar-settings-row--input"},iF={class:"sidebar-settings-label"},lF={class:"sidebar-settings-key-group"},cF=["placeholder"],uF={class:"sidebar-settings-label",style:{"margin-top":"4px"}},dF={class:"sidebar-settings-key-group"},fF=["placeholder"],pF=["disabled"],hF={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},mF={class:"sidebar-settings-label"},vF=["aria-label"],gF={class:"sidebar-settings-label"},yF={class:"sidebar-settings-value"},wF={key:0,class:"sidebar-settings-telegram-panel"},bF={class:"sidebar-settings-field"},TF={class:"sidebar-settings-field-label"},kF={class:"sidebar-settings-field"},CF={class:"sidebar-settings-field-label"},SF={class:"sidebar-settings-field-help"},_F={key:0,class:"sidebar-settings-telegram-error"},xF=["href"],AF={class:"sidebar-settings-telegram-actions"},IF=["disabled"],PF={class:"sidebar-settings-hooks-section"},RF={class:"sidebar-settings-hooks-header"},EF={class:"sidebar-settings-hooks-title"},MF=["disabled","title"],$F={key:0,class:"sidebar-settings-hooks-empty"},jF={key:0,class:"sidebar-settings-hooks-empty"},LF={key:1,class:"sidebar-settings-hooks-empty"},NF={key:2,class:"sidebar-settings-hooks-list"},OF={class:"sidebar-settings-hooks-cwd"},DF={class:"sidebar-settings-hooks-event"},FF={class:"sidebar-settings-hooks-command"},BF={class:"sidebar-settings-remote-section"},UF={class:"sidebar-settings-remote-header"},qF={class:"sidebar-settings-remote-title"},zF=["disabled","title"],HF={class:"sidebar-settings-remote-toggle-label"},WF={key:0,class:"sidebar-settings-remote-empty"},VF={key:0,class:"sidebar-settings-remote-error"},GF={key:1,class:"sidebar-settings-remote-notice"},KF={key:2,class:"sidebar-settings-remote-empty"},YF=["disabled"],JF={class:"sidebar-settings-remote-label"},QF={class:"sidebar-settings-remote-value"},XF={class:"sidebar-settings-remote-clients"},ZF={class:"sidebar-settings-remote-clients-header"},eB={class:"sidebar-settings-remote-label"},tB=["disabled"],nB={key:0,class:"sidebar-settings-remote-empty"},oB={class:"sidebar-settings-remote-client-name"},rB=["disabled","onClick"],aB={class:"sidebar-settings-rate-limits"},sB=["aria-label"],iB={class:"sidebar-settings-actions"},lB=["title","aria-label"],cB=["title","aria-label"],uB={class:"content-root-wrap"},dB={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},fB={key:1,class:"skills-route-header-icon","aria-hidden":"true"},pB={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},hB=["aria-label","title"],mB={class:"content-body"},vB={key:2,class:"content-grid content-grid-home"},gB={class:"new-thread-empty"},yB={class:"new-thread-hero"},wB=["title"],bB={class:"new-thread-folder-actions"},TB=["disabled"],kB={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},CB={class:"new-thread-launch-card-copy"},SB={class:"new-thread-launch-card-topline"},_B={class:"new-thread-launch-card-badge","aria-hidden":"true"},xB={class:"new-thread-launch-card-eyebrow"},AB={class:"new-thread-launch-card-title"},IB={class:"new-thread-launch-card-text"},PB={class:"new-thread-launch-card-actions"},RB=["aria-label","onKeydown"],EB={class:"new-thread-open-folder-header"},MB={class:"new-thread-open-folder-title"},$B={class:"new-thread-open-folder-label"},jB={class:"new-thread-open-folder-current"},LB=["placeholder","title","disabled","onKeydown"],NB=["disabled"],OB={class:"new-thread-open-folder-actions"},DB={class:"new-thread-open-folder-toggle"},FB=["aria-pressed","disabled"],BB={key:0,class:"new-thread-open-folder-create"},UB={class:"new-thread-open-folder-create-composer"},qB=["placeholder","onKeydown"],zB=["disabled"],HB={key:0,class:"new-thread-open-folder-error visible-error-with-feedback"},WB=["href"],VB=["placeholder","onKeydown"],GB={key:1,class:"new-thread-open-folder-error-actions"},KB={class:"new-thread-open-folder-error visible-error-with-feedback"},YB=["href"],JB=["disabled"],QB={key:2,class:"new-thread-open-folder-status"},XB={key:3,class:"new-thread-open-folder-status"},ZB={key:4,class:"new-thread-open-folder-list"},eU=["title","disabled","onClick"],tU={class:"new-thread-open-folder-item-name"},nU=["disabled","onClick"],oU=["aria-label","onKeydown"],rU={class:"new-thread-open-folder-header"},aU={class:"new-thread-open-folder-title"},sU=["disabled"],iU=["aria-label"],lU=["aria-selected","disabled"],cU=["aria-selected","disabled"],uU={class:"new-thread-project-field"},dU={class:"new-thread-open-folder-label"},fU=["disabled","placeholder"],pU={key:0,class:"new-thread-project-field"},hU={class:"new-thread-open-folder-label"},mU=["disabled","placeholder","onKeydown"],vU={key:1,class:"new-thread-project-field"},gU={class:"new-thread-open-folder-label"},yU=["disabled","onKeydown"],wU={key:2,class:"new-thread-open-folder-error visible-error-with-feedback"},bU=["href"],TU={class:"new-thread-project-modal-actions"},kU=["disabled"],CU=["disabled"],SU={key:3,class:"new-thread-branch-select"},_U={class:"new-thread-branch-select-label"},xU={class:"new-thread-branch-select-help"},AU={key:4,class:"new-thread-runtime-help"},IU={class:"worktree-init-status-title"},PU={class:"worktree-init-status-message"},RU={class:"composer-with-queue"},EU={key:0,class:"composer-runtime-error",role:"alert"},MU=["href"],$U={key:3,class:"content-grid"},jU={class:"content-thread"},LU={key:0,class:"external-session-banner",role:"alert"},NU={key:1,class:"composer-runtime-error",role:"alert"},OU=["href"],DU={key:2,class:"interrupt-recovered-banner",role:"status"},FU=["aria-label"],BU={class:"content-right-panel-header"},UU={class:"content-right-panel-tabs",role:"tablist"},qU=["aria-selected"],zU=["aria-selected"],HU=["aria-selected","title","onClick"],WU={class:"content-right-panel-tab-label"},VU=["aria-label","title","onClick"],GU={class:"content-right-panel-actions"},KU={class:"content-right-panel-add-wrap"},YU=["aria-label","title"],JU={key:0,class:"content-right-panel-menu"},QU=["aria-label","title"],XU={class:"content-right-panel-body"},ZU={key:0,class:"project-zip-modal-backdrop",role:"presentation"},e4=["aria-label"],t4={class:"project-zip-modal-header"},n4={class:"project-zip-modal-title"},o4=["aria-label","disabled"],r4={class:"project-zip-modal-copy"},a4={class:"project-zip-progress-label",role:"status","aria-live":"polite"},s4={class:"project-zip-progress-track"},i4={key:0,class:"project-zip-modal-error",role:"alert"},l4={class:"project-zip-modal-actions"},c4=["disabled"],u4=["disabled"],d4=["disabled"],f4=["aria-label"],p4={class:"codex-login-modal-header"},h4={class:"codex-login-modal-title"},m4=["aria-label","disabled"],v4={class:"codex-login-modal-copy"},g4=["href"],y4=["placeholder","disabled"],w4={key:1,class:"codex-login-modal-error visible-error-with-feedback"},b4=["href"],T4={class:"codex-login-modal-actions"},k4=["disabled"],C4=["disabled"],uv="codex-web-local.sidebar-collapsed.v1",dv="codex-web-local.accounts-section-collapsed.v1",fv="codex-web-local.right-panel-width.v1",S4=260,_4=640,pv=320,x4=400,hv="codex-web-local.send-with-enter.v1",mv="codex-web-local.in-progress-send-mode.v1",vv="codex-web-local.dark-mode.v1",gv="codex-web-local.dictation-click-to-toggle.v1",yv="codex-web-local.dictation-auto-send.v1",wv="codex-web-local.dictation-language.v1",bv="codex-web-local.chat-width.v1",A4=400,I4=en({__name:"App",setup(e){var zp,Hp;const t=Ul(()=>Hl(()=>import("./ThreadConversation-Cq7_5T10.js"),__vite__mapDeps([0,1,2]))),n=Ul(()=>Hl(()=>import("./ThreadTerminalPanel-BGadHi4n.js"),__vite__mapDeps([3,4]))),o=Ul(()=>Hl(()=>import("./ReviewPane-mi7B5jTv.js"),__vite__mapDeps([5,6]))),r=Ul(()=>Hl(()=>import("./DirectoryHub-DOxPtme6.js"),__vite__mapDeps([7,1,8]))),a=Ul(()=>Hl(()=>import("./AutomationsPanel-B_WavWrg.js"),__vite__mapDeps([9,10]))),{t:s,uiLanguage:i,uiLanguageOptions:u,setUiLanguage:h}=io(),p="codex-mobile",g="0.1.104",w={sendWithEnter:s("When enabled, press Enter to send. When disabled, use Command+Enter to send."),inProgressSendMode:s("If a turn is still running, choose whether a new prompt should steer the current turn or be queued."),appearance:s("Switch between system theme, light mode, and dark mode."),chatWidth:s("Choose how wide the conversation column and composer can grow on desktop screens."),dictationClickToToggle:s("Use click-to-start and click-to-stop dictation instead of hold-to-talk."),dictationAutoSend:s("Automatically send transcribed dictation when recording stops."),dictationLanguage:s("Choose transcription language or keep auto-detect.")},A={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},M={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:U,projectDisplayNameById:Y,selectedThread:ue,selectedThreadTokenUsage:F,selectedThreadServerRequests:H,selectedLiveOverlay:q,lastPlanByThreadId:me,resolveThreadTurnIndex:we,selectedActiveTurnId:ve,codexQuota:je,selectedThreadId:ge,availableCollaborationModes:Ie,availableModelIds:De,availableModelReasoningEfforts:fe,selectedCollaborationMode:Se,selectedReasoningEffort:_e,selectedSpeedMode:Pe,codexCliMissingError:Re,installedSkills:Ue,accountRateLimitSnapshots:Le,messages:gt,hasMoreOlderMessages:ft,isLoadingThreads:at,isThreadListFullyLoaded:it,isLoadingMessages:wt,isLoadingOlderMessages:St,isSendingMessage:Qe,isInterruptingTurn:et,isSelectedThreadInterruptPending:re,isUpdatingSpeedMode:ee,error:te,refreshAll:V,refreshSkills:$e,refreshHooks:R,hooksList:j,isHooksLoading:W,onRealtimeEvent:ce,selectThread:le,ensureThreadMessagesLoaded:ne,loadMessages:Ce,loadOlderMessages:be,archiveThreadById:de,compactThreadById:ie,compactingThreadIds:Ge,fuzzyFileSearchResults:Te,registerFuzzyFileSearchSession:Be,forkThreadById:Fe,renameThreadById:ze,forkThreadFromTurn:bt,sendMessageToSelectedThread:dt,sendMessageToNewThread:pt,interruptSelectedThreadTurn:Yt,interruptedUnsubmittedMessage:In,clearInterruptedUnsubmittedMessage:z,selectedThreadQueuedMessages:G,removeQueuedMessage:K,reorderQueuedMessage:pe,steerQueuedMessage:Ne,autoCompactThreshold:We,setAutoCompactThreshold:Xe,setSelectedCollaborationMode:$t,readModelIdForThread:Lt,setSelectedModelIdForThread:kn,setSelectedReasoningEffort:Fo,updateSelectedSpeedMode:tr,respondToPendingServerRequest:lo,pendingReplyErrorForRequest:It,renameProject:Kr,removeProject:nr,reorderProject:un,pinProjectToTop:jn,startPolling:Pn,stopPolling:So,primeSelectedThread:Cn,rollbackSelectedThread:or}=z2(),Tt=lS(),zt=iS(),{isMobile:Et}=Wf();function Cr(){return typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}const hn=x(null),ga=x(null),Sr=x(null);let Bo=null;const{buildFeedbackMailto:ya,feedbackMailtoBase:wa,recordVisibleFailure:_r}=Zf(),tn=wa();function Sn(l,d){d&&_r(d);const _=l.currentTarget;_ instanceof HTMLAnchorElement&&(_.href=ya())}const mn=x(null),xr=x(null),Ln=x(null),co=x(0);let Rn=null;function rr(){const l=Ln.value;if(!l)return;const d=window.getComputedStyle(l),_=Number.parseFloat(d.paddingLeft)+Number.parseFloat(d.paddingRight),$=Math.max(0,l.clientWidth-(Number.isFinite(_)?_:0)),Q=window.getComputedStyle(l).getPropertyValue("--chat-column-max").trim(),he=Number.parseFloat(Q)*(Q.endsWith("rem")?16:1),Oe=Number.isFinite(he)&&he>0?Math.min($,he):$;co.value=Oe}const Ar=x(null),uo=x(null),Uo=x(!1),ar=x(!1),kt=x(!0),Ot=x("git"),Zn=x([]),_o=x(""),Ir=X(()=>Zn.value.find(l=>l.key===_o.value)??null),xo=x(!1),Jn=x(!1),Ao=x(!1),qo=x(Pr());function Yr(l){return Math.min(_4,Math.max(S4,l))}function Pr(){if(typeof window>"u")return pv;const l=window.localStorage.getItem(fv),d=Number(l);return Number.isFinite(d)?Yr(d):pv}function ni(l){typeof window>"u"||window.localStorage.setItem(fv,String(l))}function Io(l){l.preventDefault();const d=l.clientX,_=qo.value,$=he=>{const Oe=d-he.clientX;qo.value=Yr(_+Oe)},Q=()=>{ni(qo.value),window.removeEventListener("mousemove",$),window.removeEventListener("mouseup",Q)};window.addEventListener("mousemove",$),window.addEventListener("mouseup",Q)}const Ha=x(null),ba=x(!1),sr=x("");let Jr=!1;const nn=x(!1),Ct=x(""),Nn=x("local"),vn=x({}),zo=new Map,fo=x(""),po=x([]),En=x(!1),gn=x({order:[],labels:{},projectOrder:[]}),_t=x({phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""}),Jt=x({phase:"idle",title:"",message:""}),Mt=x(c0()),Mn=x(""),Hn=x(!1),Wa=x(null),Rr=x(null),Va=x(null),ir=x(null),Ho=x(null),lr=x(null);let ho=null,Er=null,cr=0,E=0,O=!1,oe=0,Ee=0,Ve=0,Dt=0;const yn=x("New Project (1)"),on=x(""),Ht=x(!1),Qr=[{id:"general",label:"General settings"},{id:"models",label:"Models & providers"},{id:"integrations",label:"Integrations"},{id:"usage",label:"Usage & about"}],Po=x("general");let dn=0;function oi(){if(Ht.value){dn=Date.now(),Ht.value=!1;return}Date.now()-dn<x4||(Ht.value=!0)}const Mr=x(d0()),Wn=x(!1),Wo=x(!1),On=x(new Set);async function ri(){try{On.value=new Set(await B_())}catch{}finally{Wo.value=!0}}const bl=X(()=>!Wo.value||On.value.has("hooks/list")),ai=X(()=>!Wo.value||["remoteControl/status/read","remoteControl/enable","remoteControl/pairing/start","remoteControl/client/list"].every(l=>On.value.has(l)));tt(Ht,l=>{l&&(R(),ii(),ai.value&&As())});const Dn=x({enabled:!1,clients:[]}),Xr=x(null),ur=x(!1),Qn=x(!1),jt=x(""),Ft=x(""),Ga=x("");let Ta=null,si=!1,dr=null;const Ka=x("never"),fr=x(!1),Ss=x(!1),Vn=x(""),$r=x("");let _s=!1;const xs=x(!1);async function ii(l={}){if(!(l.force!==!0&&_s)){fr.value=!0,Vn.value="";try{Ka.value=await wx(),_s=!0}catch(d){Vn.value=d instanceof Error?d.message:"Failed to load approval policy"}finally{fr.value=!1}}}function Di(l){Ka.value=l}async function Fn(){Ss.value=!0,Vn.value="",$r.value="";try{await bx(Ka.value),xs.value=!0,$r.value=s("Approval policy saved"),li&&clearTimeout(li),li=setTimeout(()=>{$r.value=""},2200)}catch(l){Vn.value=l instanceof Error?l.message:"Failed to save approval policy"}finally{Ss.value=!1}}let li=null;async function As(l={}){if(!(l.force!==!0&&si)){ur.value=!0,Ft.value="";try{const d=await yx();Dn.value=d,si=!0}catch(d){Ft.value=d instanceof Error?d.message:"Failed to load remote control status"}finally{ur.value=!1}}}async function ka(){const l=!Dn.value.enabled;Qn.value=!0,jt.value=l?"enable":"disable";try{await Tx(l),Dn.value={...Dn.value,enabled:l},Ui(l?"Remote control enabled":"Remote control disabled")}catch(d){Ft.value=d instanceof Error?d.message:"Failed to update remote control"}finally{Qn.value=!1,jt.value=""}}async function Ya(){Qn.value=!0,jt.value="pairing";try{Xr.value=await kx()}catch(l){Ft.value=l instanceof Error?l.message:"Failed to start pairing"}finally{Qn.value=!1,jt.value=""}}async function Fi(){Qn.value=!0,jt.value="clients";try{Dn.value={...Dn.value,clients:await Cx()}}catch(l){Ft.value=l instanceof Error?l.message:"Failed to load remote clients"}finally{Qn.value=!1,jt.value=""}}async function Bi(l){Qn.value=!0,jt.value=`revoke:${l}`;try{await Sx(l),Dn.value={...Dn.value,clients:Dn.value.clients.filter(d=>d.clientId!==l)},Ui("Remote client removed")}catch(d){Ft.value=d instanceof Error?d.message:"Failed to remove remote client"}finally{Qn.value=!1,jt.value=""}}function Ui(l){Ga.value=l,Ta&&clearTimeout(Ta),Ta=setTimeout(()=>{Ga.value=""},3e3)}const Ca=x(""),pr=x(""),eo=x([]),Ro=x(null),Sa=x(null),jr=x(null),_a=x(null),Vo=x(!1),Ja=x(!1),hr=x({addedLineCount:0,removedLineCount:0}),mo=x([]),Lr=x(""),Zr=x({}),mr=x(""),vr=x(""),Qa=x({}),gr=x(""),Is=x(""),Xa=x(!1),ea=x(!1);function Tl(l,d){return`${l}\0${d?"with-reset-history":"without-reset-history"}`}const xa=x(null),Bn=x([]),Go=x(!1),vo=x(!1),Ko=x(!1),Un=x(!1),Za=x(!1),Aa=x(""),Nr=x(""),ci=x(null),Or=x(""),Yo=x(""),yr=x(""),wn=x(""),Ia=x(id(hv,!0)),Pa=x(Kb()),ta=x(Gb()),Ra=x(Yb()),na=x(id(gv,!1)),Eo=x(id(yv,!0)),Ea=x(i0()),Ps=X(()=>l0()),kl=X(()=>{const{loaded:l,total:d}=_t.value,_=mp(l);return d&&d>0?`${_} / ${mp(d)}`:l>0?_:s("Preparing...")}),Ma=X(()=>{const{loaded:l,total:d,phase:_}=_t.value;return _==="ready"?"100%":!d||d<=0?l>0?"55%":"20%":`${Math.min(100,Math.max(5,Math.round(l/d*100)))}%`}),$a=x(!1),wr=x(!1),go=x(!1),Gn=x(""),es=x(!1),ui=x(null),Bt=x(!1),Xn=x(""),bn=x("codex"),Rs=X(()=>[{value:"codex",label:s("Codex")},{value:"openrouter",label:s("OpenRouter")},{value:"opencode-zen",label:s("OpenCode Zen")},{value:"custom",label:s("Custom endpoint")}]),Jo=x(""),ts=x(""),y=x("responses"),b=x("responses"),T=x(""),N=x(!1),ke=x(""),ot=x(""),Pt=x(""),Mo=x(!1),Qt=x(!1),qn=x(""),Xt=x(""),to=x(!1),ja=x(!1),no=x("create"),ns=x(""),os=x(""),Es=x(""),Ms=x(!1),La=x(""),Kn=x(!1),rs=x(null),kc=x(null),Dr=x(!1),di=x(null),Hu=x(null),as=x(""),Fr=x(""),fi=x(""),Cl=x([]),$n=x(""),fn=x(!1),Br=x(!1),Sl=x(!1),oa=x(""),_l=[te,Re,Lr,vr,wn,Xn,Pt,Xt,La,$n],Wu=X(()=>_l.some(l=>l.value.trim().length>0)),br=x({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),qi=x(null),xl=x(!1),Al=x(!1),ra=x(typeof window<"u"?((zp=window.visualViewport)==null?void 0:zp.height)??window.innerHeight:0),Il=x(typeof window<"u"?((Hp=window.visualViewport)==null?void 0:Hp.offsetTop)??0:0),pi=x(typeof window<"u"?window.innerHeight:0);let Na=null,c=!1,m=!1,S=!1,P=0;const L=X(()=>{const l=Tt.params.threadId;return typeof l=="string"?l:""}),D=X(()=>Tt.name==="home"),B=X(()=>Tt.name==="skills"),J=X(()=>Tt.name==="automations"),se=X(()=>{const l=Tt.query.automationId;return typeof l=="string"?l:""}),ye=X(()=>{var l;return J.value?s("Automations"):B.value?s("Skills"):D.value?s("Start new thread"):((l=ue.value)==null?void 0:l.title)??s("Choose a thread")}),He=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",rt=X(()=>{var d,_;return(((_=(d=ue.value)==null?void 0:d.title)==null?void 0:_.trim())??"")||He}),ct=X(()=>gt.value.filter(l=>{const d=p0(l.messageType,l.role);return d==="worked"?!0:!(d==="turnActivity.live"||d==="turnError.live"||d==="agentReasoning.live")})),ht=new Set(["commandExecution","worked","toolCall","fileChange","agentMessage","agentMessage.live","plan"]),Rt=x(null);function Ur(l,d,_){const $=typeof d.turnIndex=="number"?d.turnIndex:-1;return $<0?!1:l.some((Q,he)=>he>_&&typeof Q.turnIndex=="number"&&Q.turnIndex>=$&&ht.has(Q.messageType??""))}function $s(l,d){return l.some(_=>typeof _.turnIndex=="number"&&_.turnIndex>=d&&ht.has(_.messageType??""))}const hi=X(()=>{const l=ct.value,d=wt.value;for(let he=l.length-1;he>=0;he-=1){const Oe=l[he];if(Oe.messageType!=="plan"&&Oe.messageType!=="plan.live")continue;const rn=zm(Oe);if(!rn||Rt.value!==null&&Oe.id===Rt.value)return null;const w0=d?!0:Ur(l,Oe,he);return{id:Oe.id,streaming:Oe.messageType==="plan.live",explanation:rn.explanation,steps:rn.steps,implemented:w0}}const _=ge.value?me.value[ge.value]??null:null;if(!_)return null;const $=zm(_);if(!$)return null;const Q=typeof _.turnIndex=="number"?_.turnIndex:_.turnId?we(ge.value,_.turnId)??-1:-1;return{id:_.id,streaming:_.messageType==="plan.live",explanation:$.explanation,steps:$.steps,implemented:d?!0:Q>=0?$s(l,Q):!1}}),js=X(()=>q.value),Qo=X(()=>D.value?"__new-thread__":ge.value),Pl=X(()=>Lt(Qo.value)),Oa=X(()=>{const l=H.value;return l.length>0?l[l.length-1]:null}),mi=X(()=>Oa.value?It(Oa.value.id):""),_n=X(()=>{var l,d;return D.value?Ct.value.trim():((d=(l=ue.value)==null?void 0:l.cwd)==null?void 0:d.trim())??""}),vi=X(()=>kt.value&&(D.value&&_n.value.length>0||Tt.name==="thread"&&ge.value.length>0)),Cc=X(()=>vi.value&&Ot.value==="terminal"),Ls=X(()=>!Et.value||ra.value<=0||pi.value<=0?!1:pi.value-ra.value>120),Sc=X(()=>Ls.value||Cc.value&&ar.value),Rl=X(()=>{var l,d;return((d=(l=ue.value)==null?void 0:l.cwd)==null?void 0:d.trim())??Ct.value.trim()}),zi=X(()=>{var l;return!D.value&&((l=ue.value)==null?void 0:l.inProgress)===!0}),_c=X(()=>{const l=ge.value;return!!l&&Ge.value.has(l)}),El=X(()=>{var l,d;return!D.value&&((d=(l=ue.value)==null?void 0:l.externalSession)==null?void 0:d.active)===!0}),Hi=X(()=>Qe.value||et.value||zi.value||H.value.length>0);function xe(){$a.value&&($a.value=!1,cx(!0))}function Ut(){xe(),zt.push({name:"skills",query:{tab:"plugins"}})}function Da(){const l=ge.value;l&&ie(l)}function ss(l,d){const _=nt(l).trim(),$=Tr(_);return!_||!$?!1:d.some(Q=>{const he=nt(Q).trim();return he!==_&&Tr(he)===$})}function Ml(l,d=""){const _=nt(l).trim(),$=d.trim();if($)return $;const Q=Tr(_),he=[...gn.value.order,...U.value.map(Oe=>{var rn,Xo;return((Xo=(rn=Oe.threads[0])==null?void 0:rn.cwd)==null?void 0:Xo.trim())??""}).filter(Boolean)];return ss(_,he)?_:Q}function Uy(){const l=new Set(gn.value.order),d=gn.value.projectOrder.filter(_=>l.has(_));for(const _ of gn.value.order)d.includes(_)||d.push(_);return d}function $l(l){const d=nt(l).trim(),_=[...gn.value.order,...U.value.map($=>{var Q,he;return((he=(Q=$.threads[0])==null?void 0:Q.cwd)==null?void 0:he.trim())??""}).filter(Boolean)];return ss(d,_)?d:Tr(d)}function np(l){const d=nt(l).trim();if(!d)return"";const _=[...gn.value.order,...U.value.map($=>{var Q,he;return((he=(Q=$.threads[0])==null?void 0:Q.cwd)==null?void 0:he.trim())??""}).filter(Boolean)];for(const $ of gn.value.order){const Q=nt($).trim();if(!Q)continue;const he=Tr(Q),Oe=ss(Q,_)?Q:he;if(Q===d||Oe===d||he===d)return Q}return""}const Vu=X(()=>{var $,Q;const l=[],d=new Set;for(const he of Uy()){const Oe=he.trim();!Oe||d.has(Oe)||(d.add(Oe),l.push({value:Oe,label:Ml(Oe,gn.value.labels[Oe])}))}for(const he of U.value){const Oe=((Q=($=he.threads[0])==null?void 0:$.cwd)==null?void 0:Q.trim())??"";!Oe||d.has(Oe)||wu(Oe)||(d.add(Oe),l.push({value:Oe,label:Ml(Oe,Y.value[he.projectName])}))}const _=Ct.value.trim();return _&&!d.has(_)&&l.unshift({value:_,label:Ml(_)}),l}),gi=X(()=>{const l=Ct.value.trim();return l?vn.value[l]===!0:!1}),qy=X(()=>{var d,_;const l={};for(const $ of U.value){const Q=Vi($.projectName,((_=(d=$.threads[0])==null?void 0:d.cwd)==null?void 0:_.trim())??"");l[$.projectName]=Q?vn.value[Q]===!0:!1}return l}),Gu=X(()=>{const l=fo.value.trim(),d=[...po.value];return l&&!d.some(_=>_.value===l)&&d.unshift({value:l,label:l}),d}),op=X(()=>{const l=fo.value.trim();if(!l)return"";const d=Gu.value.find(_=>_.value===l);return(d==null?void 0:d.label)??l}),rp=X(()=>Fr.value.trim()),ap=X(()=>{const l=qn.value.trim();return!l||l==="."||l===".."?!1:!/[\\/]/u.test(l)}),zy=X(()=>ap.value&&rp.value.trim().length>0&&!$n.value),sp=X(()=>{const l=os.value.trim();return!l||l==="."||l===".."?!1:!/[\\/]/u.test(l)}),ip=X(()=>ns.value.trim()?no.value==="create"?sp.value:Es.value.trim().length>0:!1),jl=X(()=>{const l=nt(as.value).trim();return l||Fr.value.trim()}),Hy=X(()=>to.value?"Creating…":"Create"),Wy=X(()=>Kn.value?no.value==="clone"?s("Cloning…"):s("Creating…"):no.value==="clone"?s("Clone repository"):s("Create project")),Vy=X(()=>{const l=Fr.value.trim(),d=fi.value.trim();return!!(l&&d&&l!==d)}),lp=X(()=>{const l=[];Vy.value&&l.push({key:`parent:${fi.value}`,name:"..",path:fi.value,kind:"parent"});for(const d of Cl.value)l.push({key:`directory:${d.path}`,name:d.name,path:d.path,kind:"directory"});return l}),Ku=X(()=>{const l=oa.value.trim().toLowerCase();return l?lp.value.filter(d=>d.kind==="parent"||d.name.toLowerCase().includes(l)):lp.value}),Wi=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,Gy=X(()=>s(A[Ra.value].label)),Ky=X(()=>{const l=A[Ra.value],d=Math.max(0,pi.value-ra.value-Il.value);return{"--chat-column-max":l.columnMax,"--chat-card-max":l.cardMax,"--visual-viewport-height":ra.value>0?`${ra.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,Il.value)}px`,"--virtual-keyboard-inset":`${d}px`}}),Yy=X(()=>{if(!br.value.configured)return s("Not configured");const l=br.value.active?s("Online"):s("Configured (offline)"),d=br.value.allowAllUsers?s("allow all users"):`${br.value.allowedUsers} ${s("allowed user(s)")}`,_=`${br.value.mappedChats} ${s("chat(s)")}, ${br.value.mappedThreads} ${s("thread(s)")}, ${d}`,$=br.value.lastError?`, ${s("error")}: ${br.value.lastError}`:"";return`${l}, ${_}${$}`});Cs(()=>{var l,d;document.addEventListener("pointerdown",kp),window.addEventListener("keydown",wp),document.addEventListener("visibilitychange",Cp),window.addEventListener("pageshow",Sp),window.addEventListener("focus",_p),window.addEventListener("resize",yi),(l=window.visualViewport)==null||l.addEventListener("resize",yi),(d=window.visualViewport)==null||d.addEventListener("scroll",yi),yi(),$c(),Wi==null||Wi.addEventListener("change",$c),Bo=ce(_=>{Sr.value&&Sr.value.refreshFromNotification(_)}),dr=ce(_=>{_==="remoteControl/status/changed"&&As({force:!0})}),h0(),Fb(),ri(),Xy(),Os(),aa(),up(),Yu(),cd(),sb(),ii()}),tt(_l,(l,d)=>{l.forEach((_,$)=>{if(_===d[$])return;const Q=_.trim();Q&&_r(Q)})}),tt(Ln,l=>{Rn&&(Rn.disconnect(),Rn=null),typeof ResizeObserver<"u"&&(Rn=new ResizeObserver(rr),l&&Rn.observe(l)),rr()},{immediate:!0}),yc(()=>{var l,d;document.removeEventListener("pointerdown",kp),window.removeEventListener("keydown",wp),document.removeEventListener("visibilitychange",Cp),window.removeEventListener("pageshow",Sp),window.removeEventListener("focus",_p),window.removeEventListener("resize",yi),(l=window.visualViewport)==null||l.removeEventListener("resize",yi),(d=window.visualViewport)==null||d.removeEventListener("scroll",yi),Wi==null||Wi.removeEventListener("change",$c),Rn&&(Rn.disconnect(),Rn=null),Na!==null&&(window.clearInterval(Na),Na=null),ho&&(clearTimeout(ho),ho=null),Pc(),So(),Bo&&(Bo(),Bo=null),dr&&(dr(),dr=null),Ta&&(clearTimeout(Ta),Ta=null)});function yi(){var l,d;typeof window>"u"||(pi.value=Math.max(pi.value,window.innerHeight),ra.value=((l=window.visualViewport)==null?void 0:l.height)??window.innerHeight,Il.value=((d=window.visualViewport)==null?void 0:d.offsetTop)??0)}tt(Mn,l=>{const d=l.trim();if(ho&&(clearTimeout(ho),ho=null),!d){lr.value=null;return}ho=setTimeout(()=>{ES(d,1e3).then(_=>{Mn.value.trim()===d&&(lr.value=_.threadIds)}).catch(()=>{Mn.value.trim()===d&&(lr.value=null)})},220)}),tt(Ls,l=>{l||(ar.value=!1)}),tt(Bn,()=>{if(typeof window>"u")return;if(!Bn.value.some(d=>d.quotaStatus==="loading")){Na!==null&&(window.clearInterval(Na),Na=null);return}Na===null&&(Na=window.setInterval(()=>{c||(c=!0,Ll({silent:!0}).finally(()=>{c=!1}))},1500))},{deep:!0}),tt(Le,()=>{cp().then(l=>{l&&V({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})})},{deep:!0});async function cp(){if(!m||S||bn.value!=="codex"||Bn.value.length>0||Le.value.length===0)return!1;S=!0;const l=JSON.stringify(Bn.value.map(_=>_.accountId).sort());try{const _=await bm();Bn.value=_.accounts}catch{await Ll({silent:!0})}const d=JSON.stringify(Bn.value.map(_=>_.accountId).sort());return l!==d}function Jy(){$e({force:!0})}function Qy(l){l&&Ce(l,{silent:!0,force:!0})}async function Yu(){try{br.value=await nx()}catch(l){const d=l instanceof Error?l.message:"Failed to load Telegram status";br.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:d}}}async function up(){try{const l=await tx();ke.value=l.botToken,ot.value=l.allowedUserIds.map(d=>String(d)).join(`
81
+ `),Pt.value=""}catch(l){Pt.value=l instanceof Error?l.message:"Failed to load Telegram configuration"}}async function Xy(){const l=await lx();$a.value=l.dismissed!==!0}function Zy(l){const d=l.split(/[\n,]/).map(Q=>Q.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),_=d.includes("*"),$=Array.from(new Set(d.filter(Q=>/^-?\d+$/.test(Q)).map(Q=>Number.parseInt(Q,10))));return _?["*",...$]:$}async function ew(){const l=ke.value.trim(),d=Zy(ot.value);if(!l){Pt.value=s("Telegram bot token is required.");return}if(d.length===0){Pt.value=s("At least one allowed Telegram user ID or * is required.");return}Mo.value=!0,Pt.value="";try{await ex(l,d),ot.value=d.map(_=>String(_)).join(`
82
+ `),await Promise.all([up(),Yu()]),window.alert(s("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(_){Pt.value=_ instanceof Error?_.message:s("Failed to connect Telegram bot"),Yu()}finally{Mo.value=!1}}function tw(){Hn.value=!Hn.value,Hn.value?Gt(()=>{var l;return(l=Rr.value)==null?void 0:l.focus()}):Mn.value=""}function nw(){var l;Mn.value="",(l=Rr.value)==null||l.focus()}function Ju(){return Wa.value?Wa.value:typeof document>"u"?null:document.querySelector(".mobile-drawer .sidebar-scrollable, .sidebar-scrollable")}function ow(l){if(Mt.value||O)return;const d=l==null?void 0:l.currentTarget,_=d instanceof HTMLElement?d:Ju();cr=(_==null?void 0:_.scrollTop)??cr}function rw(){const l=++E,d=cr,_=90;O=!0;const $=()=>{l===E&&(cr=d,O=!1)},Q=he=>{if(l!==E)return;if(Mt.value){$();return}const Oe=Ju();if(Oe&&(Oe.scrollTop=d,Math.abs(Oe.scrollTop-d)<=1||he>=_)){$();return}if(he>=_||typeof window>"u"){$();return}window.requestAnimationFrame(()=>Q(he+1))};Gt(()=>Q(0))}function aw(l){l.key==="Escape"&&(Hn.value=!1,Mn.value="")}function sw(l){l&&(Tt.name==="thread"&&L.value===l||(zt.push({name:"thread",params:{threadId:l}}),Et.value&&yo(!0)))}function iw(l){Tt.name==="automations"&&se.value!==l&&zt.replace({name:"automations",query:l?{automationId:l}:{}})}async function lw(l){var d;Mt.value&&(yo(!1),await Gt()),(d=hn.value)==null||d.openAutomationEditorFromPanel(l)}async function cw(){var l;Mt.value&&(yo(!1),await Gt()),(l=hn.value)==null||l.openAutomationCreatorFromPanel()}function uw(){var l;Tt.name==="automations"&&((l=ga.value)==null||l.loadAutomations())}async function dw(l){l&&ge.value===l&&await Hb()}function fw(l){return l.length>8?l.slice(-8):l}function dp(l){const d=[l.planType||s("unknown")];return l.authMode&&d.unshift(l.authMode),d.join(" · ")}function pw(l){if(!l)return!1;const d=l.toLowerCase();return d.includes("payment required")||/\b402\b/.test(d)}function xc(l){return l.unavailableReason==="payment_required"||pw(l.quotaError)}function hw(l){return Go.value||vo.value||Ko.value||Un.value||Or.value.length>0||l.isActive&&Or.value!==l.storageId&&Hi.value}function Qu(l){return Yo.value===l.storageId}function mw(l){return yr.value===l.storageId||Qu(l)}function vw(l){return xc(l)?s("Unavailable"):l.isActive?s("Active"):vo.value?s("Switching…"):s("Switch")}function gw(l){return Or.value===l.storageId?s("Removing…"):Qu(l)?s("Click again to remove"):s("Remove")}function yw(l){yr.value=l}function ww(l){yr.value===l&&(yr.value=""),Or.value!==l&&Yo.value===l&&(Yo.value="")}function bw(l){const d=l.quotaSnapshot;if(!d)return null;const _=[d==null?void 0:d.primary,d==null?void 0:d.secondary].filter(he=>he!==null),$=_.find(he=>he.windowMinutes===7*24*60);if($)return $;const Q=_.filter(he=>typeof he.windowMinutes=="number"&&he.windowMinutes>=7*24*60).sort((he,Oe)=>(he.windowMinutes??0)-(Oe.windowMinutes??0))[0]??null;return Q||(d.secondary??null)}function Tw(l){if(typeof l!="number"||!Number.isFinite(l))return"";const d=new Date(l*1e3);return`${d.getMonth()+1}月${d.getDate()}日`}function fp(l){var he,Oe;if(xc(l))return l.quotaError||s("402 Payment Required");const d=l.quotaSnapshot,_=bw(l),$=(d==null?void 0:d.primary)??(d==null?void 0:d.secondary)??null,Q=_??$;if(Q){const rn=Math.max(0,Math.min(100,100-Math.round(Q.usedPercent))),Xo=Tw(Q.resetsAt);return Xo?`${rn}% ${s("weekly remaining")} · ${Xo}`:`${rn}% ${s("weekly remaining")}`}return(he=d==null?void 0:d.credits)!=null&&he.unlimited?s("Unlimited credits"):(Oe=d==null?void 0:d.credits)!=null&&Oe.hasCredits&&d.credits.balance?`${d.credits.balance} ${s("credits")}`:l.quotaStatus==="loading"?s("Loading quota…"):l.quotaStatus==="error"?l.quotaError||s("Quota unavailable"):l.quotaStatus==="ready"||l.quotaStatus==="idle"?s("Quota unavailable"):s("Fetching account details…")}function kw(l){return[l.email||s("Account"),dp(l),xc(l)?s("Unavailable account"):null,fp(l),`${s("Workspace")} ${l.accountId}`].filter(Boolean).join(`
83
+ `)}async function Ll(l={}){try{const d=await xx();Bn.value=d.accounts,d.accounts.some(_=>_.storageId===yr.value)||(yr.value=""),d.accounts.some(_=>_.storageId===Yo.value)||(Yo.value="")}catch(d){if(l.silent===!0)return;wn.value=d instanceof Error?d.message:s("Failed to load accounts")}}async function Cw(){if(!(Go.value||vo.value||Ko.value||Un.value)){wn.value="",yr.value="",Yo.value="",Go.value=!0;try{const l=await bm();Bn.value=l.accounts,So(),Pn(),V({includeSelectedThreadMessages:!0})}catch(l){wn.value=l instanceof Error?l.message:s("Failed to refresh accounts")}finally{Go.value=!1}}}async function Sw(l){if(!(vo.value||Go.value||Ko.value||Un.value)){if(Hi.value){wn.value=s("Finish the current turn and pending requests before switching accounts.");return}wn.value="",yr.value="",Yo.value="",vo.value=!0;try{const d=await Px(l);Bn.value=Bn.value.map(_=>_.storageId===l?d:{..._,isActive:!1}),So(),Pn(),V({includeSelectedThreadMessages:!0}),Ll({silent:!0})}catch(d){wn.value=d instanceof Error?d.message:s("Failed to switch account")}finally{vo.value=!1}}}async function _w(){var l;if(!(Go.value||vo.value||Ko.value||Un.value)){wn.value="",Nr.value="",Ko.value=!0;try{const d=await Ax();Aa.value=d,Za.value=!0,window.open(d,"_blank","noopener,noreferrer"),await Gt(),(l=ci.value)==null||l.focus()}catch(d){wn.value=d instanceof Error?d.message:s("Failed to start Codex login")}finally{Ko.value=!1}}}function Xu(){Un.value||(Za.value=!1,Nr.value="")}async function xw(){const l=Nr.value.trim();l&&await Aw(l)}async function Aw(l){if(!(Un.value||l.length===0)){wn.value="",Un.value=!0;try{const d=await Ix(l);Bn.value=d.accounts,Aa.value="",Nr.value="",Za.value=!1,So(),Pn(),V({includeSelectedThreadMessages:!0})}catch(d){wn.value=d instanceof Error?d.message:s("Failed to complete Codex login")}finally{Un.value=!1}}}async function Iw(l){if(Go.value||vo.value||Ko.value||Un.value||Or.value.length>0)return;const d=Bn.value.find($=>$.storageId===l)??null;if(!d)return;if(Yo.value!==l){Yo.value=l;return}if(d.isActive&&Hi.value){wn.value=s("Finish the current turn and pending requests before removing the active account.");return}const _=d.isActive;wn.value="",Yo.value="",Or.value=l;try{const $=await Rx(l);Bn.value=$.accounts,So(),Pn(),_&&V({includeSelectedThreadMessages:!0}),Ll({silent:!0})}catch($){wn.value=$ instanceof Error?$.message:s("Failed to remove account")}finally{Or.value=""}}function Pw(l){de(l)}function Rw(l){V({includeSelectedThreadMessages:!1,forceThreadRefresh:!0})}async function Ew(l){const d=await Fe(l);d&&(D.value?await zt.replace({name:"thread",params:{threadId:d}}):await zt.push({name:"thread",params:{threadId:d}}),Et.value&&yo(!0))}function pp(l){const d=l.trim().replace(/\\/gu,"/");return d?d.includes("/.codex/worktrees/")||d.includes("/.git/worktrees/"):!1}function Vi(l,d=""){var he,Oe,rn;const _=U.value.find(Xo=>Xo.projectName===l);if(!_)return np(l)||d.trim();const $=_.threads.find(Xo=>!pp(Xo.cwd));return(((he=$==null?void 0:$.cwd)==null?void 0:he.trim())??((rn=(Oe=_.threads[0])==null?void 0:Oe.cwd)==null?void 0:rn.trim())??"")||np(l)||d.trim()}function Mw(l){var $,Q;const d=U.value.find(he=>he.projectName===l),_=Vi(l,((Q=($=d==null?void 0:d.threads[0])==null?void 0:$.cwd)==null?void 0:Q.trim())??"");_&&(Ct.value=_),Et.value&&yo(!0),!D.value&&zt.push({name:"home"})}function $w(l){var _;let d="";for(const $ of U.value){const Q=$.threads.find(he=>he.id===l);if((_=Q==null?void 0:Q.cwd)!=null&&_.trim()){d=Q.cwd.trim();break}}!d||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(d)}`,"_blank","noopener,noreferrer")}function Ac(l){var _,$;const d=U.value.find(Q=>Q.projectName===l);return Vi(l,(($=(_=d==null?void 0:d.threads[0])==null?void 0:_.cwd)==null?void 0:$.trim())??"")}const hp=X(()=>Object.fromEntries(U.value.map(l=>[l.projectName,Ac(l.projectName).trim()]).filter(([,l])=>l.length>0)));function jw(l){return(Y.value[l]??l).trim()||l}function Lw(l){return jw(l).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function Nw(l){const d=Ac(l);!d||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(d)}`,"_blank","noopener,noreferrer")}async function Ow(l){const d=Ac(l);await gp(d)}async function Dw(l){const d=Fw(l);await gp(d)}function Fw(l){var d;for(const _ of U.value){const $=_.threads.find(Q=>Q.id===l);if((d=$==null?void 0:$.cwd)!=null&&d.trim())return $.cwd.trim()}return""}function mp(l){if(!Number.isFinite(l)||l<=0)return"0 B";const d=["B","KB","MB","GB"];let _=l,$=0;for(;_>=1024&&$<d.length-1;)_/=1024,$+=1;return`${_>=10||$===0?_.toFixed(0):_.toFixed(1)} ${d[$]}`}function Bw(l,d){const _=URL.createObjectURL(l),$=document.createElement("a");$.href=_,$.download=d,document.body.appendChild($),$.click(),document.body.removeChild($),window.setTimeout(()=>URL.revokeObjectURL(_),3e4)}async function Uw(l,d){const $={files:[new File([l],d,{type:l.type||"application/zip"})],title:d};if(!(typeof navigator<"u"&&typeof navigator.share=="function"&&(typeof navigator.canShare!="function"||navigator.canShare($))))throw new Error("File sharing is not supported in this browser.");await navigator.share($)}function vp(){_t.value.phase!=="exporting"&&(_t.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""})}function qw(){const{blob:l,fileName:d}=_t.value;!l||!d||(_t.value={..._t.value,error:""},Bw(l,d))}async function zw(){const{blob:l,fileName:d}=_t.value;if(!(!l||!d))try{_t.value={..._t.value,error:""},await Uw(l,d)}catch(_){if(_ instanceof DOMException&&_.name==="AbortError")return;const $=_ instanceof Error?_.message:"",Q=_ instanceof DOMException&&_.name==="NotAllowedError"||/permission denied|notallowed|not allowed|gesture/iu.test($);_t.value={..._t.value,error:Q?s("This browser blocked sharing the ZIP. Use Download instead."):$||s("Failed to share project. Use Download instead.")}}}async function gp(l){if(!(!l||typeof document>"u")){_t.value={phase:"exporting",loaded:0,total:null,blob:null,fileName:"",error:""};try{const{blob:d,fileName:_}=await Hx(l,({loaded:$,total:Q})=>{_t.value={..._t.value,phase:"exporting",loaded:$,total:Q}});_t.value={phase:"ready",loaded:d.size,total:d.size,blob:d,fileName:_,error:""}}catch(d){if(_t.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""},d instanceof DOMException&&d.name==="AbortError")return;const _=d instanceof Error?d.message:"Failed to export project.";window.alert(_)}}}async function Hw(l){const d=Ac(l);if(!d||typeof window>"u"||(await Ic(d),vn.value[d]!==!0))return;const _=`${Lw(l)}-`,$=window.prompt("New worktree folder name",_);if($===null)return;const Q=$.trim();if(Q){if(Q.includes("/")||Q.includes("\\")||Q==="."||Q===".."){window.alert("Worktree name must be a single folder name.");return}try{const he=await jx(d,Q),Oe=await zc(he.cwd,{createIfMissing:!1,label:""});if(!Oe)return;Ct.value=Oe,Nn.value="local",jn($l(Oe)),await Os(),await aa(),Et.value&&yo(!0),D.value||await zt.push({name:"home"})}catch(he){const Oe=he instanceof Error?he.message:"Failed to create worktree.";window.alert(Oe)}}}function Ww(){var _,$,Q;const l=ue.value;if(!l)return"";const d=((_=l.projectName)==null?void 0:_.trim())??"";return d?Vi(d,((Q=l.cwd)==null?void 0:Q.trim())??""):(($=l.cwd)==null?void 0:$.trim())??""}function Zu(){const l=Ww();l&&(Ct.value=l),Nn.value="local",Et.value&&yo(!0),!D.value&&zt.push({name:"home"})}function Vw(){Ct.value="",Nn.value="local",Et.value&&yo(!0),!D.value&&zt.push({name:"home"})}async function Ic(l){const d=l.trim();if(!d||Object.prototype.hasOwnProperty.call(vn.value,d))return;const _=zo.get(d);if(_){const he=await _;Object.prototype.hasOwnProperty.call(vn.value,d)||(vn.value={...vn.value,[d]:he});return}const $=Ox(d).then(he=>he.isGitRepo).catch(()=>!1).finally(()=>{zo.delete(d)});zo.set(d,$);const Q=await $;Object.prototype.hasOwnProperty.call(vn.value,d)||(vn.value={...vn.value,[d]:Q})}function Gw(l){Kr(l.projectName,l.displayName)}function Kw(l){ze(l.threadId,l.title)}async function Yw(l){await nr(l),await Os(),aa()}function Jw(l){un(l.projectName,l.toIndex)}function Qw(l){var $,Q;const d=U.value.find(he=>he.projectName===l),_=Vi(l,((Q=($=d==null?void 0:d.threads[0])==null?void 0:$.cwd)==null?void 0:Q.trim())??"");Ic(_)}function yp(l){Xw(l)}async function Xw(l){var $;const d=await lo(l),_=(($=l.followUpMessageText)==null?void 0:$.trim())??"";if(!(!d||!_||D.value))try{await dt(_,[],[],"steer",[])}catch{}}async function Zw(l){const d=await bt(l.threadId,l.turnIndex);d&&(await zt.push({name:"thread",params:{threadId:d}}),ge.value!==d&&await le(d),Et.value&&yo(!0))}function yo(l){var d;if(Mt.value!==l){if(l){const _=(d=Ju())==null?void 0:d.scrollTop;typeof _=="number"&&(_>0||cr===0)&&(cr=_)}Mt.value=l,u0(l),l||rw()}}function wp(l){if(l.defaultPrevented)return;if(l.key==="Escape"&&Ht.value){Ht.value=!1;return}if(!l.ctrlKey&&!l.metaKey||l.shiftKey||l.altKey)return;const d=l.key.toLowerCase();if(d==="b"){if(!(Cr()?l.metaKey&&!l.ctrlKey:l.ctrlKey&&!l.metaKey))return;l.preventDefault(),yo(!Mt.value);return}if(d==="j"&&Tt.name==="thread"&&ge.value){l.preventDefault(),bp();return}d==="j"&&D.value&&_n.value&&(l.preventDefault(),bp())}function bp(){vi.value&&(Et.value&&!Jn.value&&(Jn.value=!0),Et.value||(Ao.value=!1),Ot.value=Ot.value==="terminal"?"git":"terminal",Ot.value!=="terminal"&&bi())}function wi(l){Ot.value=l,xo.value=!1,Et.value||(Ao.value=!1),Et.value&&(Jn.value=!0),l!=="terminal"&&bi()}function eb(l){const d=Zn.value.find(_=>_.path===l.path);if(d)_o.value=d.key;else{const _={key:`preview-${Date.now()}`,path:l.path,label:l.label};Zn.value=[...Zn.value,_],_o.value=_.key}wi("preview")}function tb(l){Zn.value.some(d=>d.key===l)&&(_o.value=l,wi("preview"))}function nb(l){const d=Zn.value.findIndex(Q=>Q.key===l);if(d<0)return;const _=Zn.value.filter(Q=>Q.key!==l);if(Zn.value=_,_o.value!==l)return;if(_.length===0){_o.value="",Ot.value="files";return}const $=_[Math.min(d,_.length-1)];_o.value=$.key}function Tp(){if(Et.value){Jn.value=!1;return}Ao.value=!0,xo.value=!1,bi()}function ob(){if(Et.value){Jn.value=!Jn.value;return}Ao.value=!Ao.value,Ao.value&&(xo.value=!1,bi())}function rb(){Ot.value="git",Et.value&&(Jn.value=!1),bi()}function ab(l){if(Uo.value=l,!l){ar.value=!1,Pc();return}ar.value=!0,Pc(),Er=setTimeout(()=>{Er=null,Ls.value||(ar.value=!1)},1500)}function bi(){Uo.value=!1,ar.value=!1,Pc()}function Pc(){Er&&(clearTimeout(Er),Er=null)}async function sb(){try{const l=await $S();kt.value=l.available,!l.available&&Ot.value==="terminal"&&(Ot.value="git",bi())}catch{kt.value=!1,Ot.value==="terminal"&&(Ot.value="git")}}function kp(l){var _,$;const d=l.target;if(d instanceof Node){if(Uo.value){const Q=d instanceof Element?d:d.parentElement;Q!=null&&Q.closest(".thread-terminal-panel")||bi()}Ht.value&&((_=ir.value)!=null&&_.contains(d)||($=Ho.value)!=null&&$.contains(d)||(dn=Date.now(),Ht.value=!1))}}function ib(l){var _,$;if(!Ht.value)return;const d=l.target;d instanceof Node&&((_=ir.value)!=null&&_.contains(d)||($=Ho.value)!=null&&$.contains(d)||(dn=Date.now(),Ht.value=!1))}function lb(){var l;(l=hn.value)==null||l.openRecycleBin()}function Cp(){if(!(typeof document>"u")&&Et.value){if(document.visibilityState==="hidden"){qi.value=Date.now(),xl.value=!1;return}ed()}}function Sp(l){l.persisted&&ed()}function _p(){Tt.name==="home"&&(Os(),aa()),ed()}function ed(){typeof window>"u"||typeof document>"u"||!Et.value||document.visibilityState!=="visible"||xl.value||qi.value===null||Date.now()-qi.value<A4||(xl.value=!0,qi.value=null,cb())}async function cb(){if(!Al.value){Al.value=!0;try{await V({includeSelectedThreadMessages:!0}),await dd()}finally{Al.value=!1}}}function xp(l){const d=l.text;Rc();const _=Ha.value,$=l.mode==="queue"&&_&&_.threadId===ge.value?_.queueIndex:void 0;if(Ha.value=null,D.value){m0(d,l.imageUrls,l.skills,l.fileAttachments);return}dt(d,l.imageUrls,l.skills,l.mode,l.fileAttachments,$)}function ub(l){const d=G.value.findIndex(he=>he.id===l),_=d>=0?G.value[d]:void 0,$=xr.value;if(!_||!$||$.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Ha.value=ge.value?{threadId:ge.value,queueIndex:d}:null;const Q={text:_.text,imageUrls:[..._.imageUrls],fileAttachments:_.fileAttachments.map(he=>({...he})),skills:_.skills.map(he=>({...he}))};$.hydrateDraft(Q),K(l)}function Rc(){if(!Et.value||D.value)return;const l=()=>{var d;(d=Ar.value)==null||d.jumpToLatest()};l(),Gt(()=>{l(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{l(),window.requestAnimationFrame(l)})})}function db(l){Ct.value=l.trim(),Xt.value=""}function fb(l){fo.value=l.trim()}function Ns(l){const d=_n.value.trim();return!l||d!==l?!1:Tt.name==="thread"||Tt.name==="home"&&gi.value}function Ap(){oe+=1,Ee+=1,Ve+=1,Dt+=1,eo.value=[],Ro.value=null,Sa.value=null,jr.value=null,_a.value=null,Vo.value=!1,Ja.value=!1,hr.value={addedLineCount:0,removedLineCount:0},mo.value=[],Zr.value={},mr.value="",vr.value="",Qa.value={},gr.value="",Is.value="",Lr.value="",Xa.value=!1}function Ip(l){const d=l.trim();if(!d){hr.value={addedLineCount:0,removedLineCount:0};return}const _=++Dt;o1(d,"unstaged").then($=>{_!==Dt||!Ns(d)||(hr.value={addedLineCount:$.addedLineCount,removedLineCount:$.removedLineCount})}).catch(()=>{_!==Dt||!Ns(d)||(hr.value={addedLineCount:0,removedLineCount:0})})}async function Nl(l){var $,Q,he;const d=l.trim();if(!d){Ap();return}const _=++oe;Xa.value=!0,Lr.value="";try{const Oe=await Nx(d);if(_!==oe||!Ns(d))return;eo.value=Oe.options,Ro.value=Oe.currentBranch,Sa.value=Oe.headSha,jr.value=Oe.headSubject,_a.value=Oe.headDate,Vo.value=Oe.detached,Ja.value=Oe.dirty,mo.value=Oe.changedFiles,Ip(d);const rn=(($=Oe.currentBranch)==null?void 0:$.trim())||((he=(Q=Oe.options[0])==null?void 0:Q.value)==null?void 0:he.trim())||"";rn&&Pp({branch:rn,includeResetHistory:!0})}catch{if(_!==oe||!Ns(d))return;eo.value=[],Ro.value=null,Sa.value=null,jr.value=null,_a.value=null,Vo.value=!1,Ja.value=!1,hr.value={addedLineCount:0,removedLineCount:0},mo.value=[]}finally{_===oe&&(Xa.value=!1)}}function pb(l){Ro.value=l.currentBranch,Sa.value=l.headSha,jr.value=l.headSubject,_a.value=l.headDate,Vo.value=l.detached,Ja.value=l.dirty,mo.value=l.changedFiles,Ip(_n.value)}function hb(l){if(ea.value)return;const d=l.trim();if(!d||d===(Ro.value??""))return;const _=_n.value.trim();_&&(ea.value=!0,Lr.value="",Dx(_,d).then($=>(Ro.value=$||d,Sa.value=null,jr.value=null,_a.value=null,Vo.value=!1,Wn.value=!1,Nl(_))).catch($=>{const Q=$ instanceof Error?$.message:"Failed to switch branch";Nl(_).finally(()=>{Lr.value=Q})}).finally(()=>{ea.value=!1}))}function mb(l){if(ea.value)return;const d=l.branch.trim(),_=l.sha.trim(),$=_n.value.trim();!d||!_||!$||(ea.value=!0,Lr.value="",Ux($,d,_).then(Q=>(pb(Q),Wn.value=!1,Nl($))).catch(Q=>{const he=Q instanceof Error?Q.message:"Failed to reset branch to commit";Nl($).finally(()=>{Lr.value=he})}).finally(()=>{ea.value=!1}))}function Pp(l){const d=(typeof l=="string"?l:l.branch).trim(),_=typeof l=="string"?!0:l.includeResetHistory!==!1,$=_n.value.trim(),Q=Tl(d,_);if(!d||!$||mr.value===Q||(vr.value="",Zr.value[Q]))return;const he=++Ee;mr.value=Q,Fx($,d,{includeResetHistory:_}).then(Oe=>{he!==Ee||!Ns($)||(Zr.value={...Zr.value,[Q]:Oe})}).catch(Oe=>{he!==Ee||!Ns($)||(vr.value=Oe instanceof Error?Oe.message:"Failed to load branch commits")}).finally(()=>{he===Ee&&mr.value===Q&&(mr.value="")})}function vb(l){const d=l.trim(),_=_n.value.trim();if(!d||!_||gr.value===d||(Is.value="",Qa.value[d]))return;const $=++Ve;gr.value=d,Bx(_,d).then(Q=>{$!==Ve||!Ns(_)||(Qa.value={...Qa.value,[d]:Q})}).catch(Q=>{$!==Ve||!Ns(_)||(Is.value=Q instanceof Error?Q.message:"Failed to load commit files")}).finally(()=>{$===Ve&&gr.value===d&&(gr.value="")})}function gb(l){const d=l.path.trim(),_=l.sha.trim();!d||!_||(Ca.value=d,pr.value=_,Wn.value=!0)}function yb(){Ca.value="",pr.value="",Wn.value=!Wn.value}function wb(){!Ca.value&&!pr.value||(Ca.value="",pr.value="",Wn.value=!1)}async function bb(){const l=await Mc();l&&(await aa(),ns.value=l,os.value=yn.value.trim()||"New Project (1)",Es.value="",La.value="",no.value="create",ja.value=!0,Gt(()=>{var d;return(d=rs.value)==null?void 0:d.focus()}))}function Ec(){Kn.value||(ja.value=!1,La.value="")}let td=!1,nd=!1;function Tb(){td=!0}function kb(){td&&(td=!1,Gi())}function Cb(){nd=!0}function Sb(){nd&&(nd=!1,Ec())}async function _b(){const l=ns.value.trim(),d=os.value.trim();if(!sp.value)throw new Error("Enter a single project folder name.");const _=$p(Mp(l,d));return _?zc(_,{createIfMissing:!0,label:""}):""}async function xb(){const l=ns.value.trim(),d=Es.value.trim();return d?Jx(d,l):""}async function od(){if(!(!ip.value||Kn.value)){La.value="",Kn.value=!0;try{const l=no.value==="clone"?await xb():await _b();if(!l)return;Ct.value=l,jn($l(l)),await Os(),await aa(),ja.value=!1}catch(l){La.value=l instanceof Error?l.message:"Failed to create or clone project."}finally{Kn.value=!1}}}function Ab(){Ib(kc.value)}function Ib(l){Ms.value||!l||(l.value="",l.click())}async function Pb(l,d,_){Ms.value=!0;try{const $=await Mc();if(!$)return;const Q=await d($);if(!Q.path)return;Ct.value=Q.path,jn($l(Q.path)),await Os(),await V({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await aa()}catch($){const Q=$ instanceof Error?$.message:_;window.alert(Q)}finally{Ms.value=!1,l&&(l.value="")}}async function Rb(l){var $;const d=l.target instanceof HTMLInputElement?l.target:null,_=(($=d==null?void 0:d.files)==null?void 0:$[0])??null;!_||Ms.value||await Pb(d,Q=>Wx(_,Q),"Failed to import project.")}async function Eb(){const l=Ct.value.trim()||await Mc();l&&(Qt.value=!1,Dr.value=!0,oa.value="",await Ds(l),$n.value||Gt(()=>{var d;return(d=di.value)==null?void 0:d.focus()}))}function Gi(){P+=1,Dr.value=!1,fn.value=!1,$n.value="",oa.value="",as.value="",Ol()}async function Mb(l){!l||fn.value||(oa.value="",await Ds(l))}function $b(){const l=Fr.value.trim();!Dr.value||!l||Ds(l)}function jb(){const l=jl.value;!Dr.value||!l||fn.value||Ds(l)}function Lb(){if(!Dr.value||fn.value||Br.value)return;const l=jl.value,d=Fr.value.trim();!l||l===d||Ds(l)}function Nb(){const l=jl.value,d=Fr.value.trim();if(l){if(l!==d){Ds(l);return}rd(l)}}async function rd(l=jl.value){const d=nt(l).trim();if(d){$n.value="",Br.value=!0;try{const _=await zc(d,{createIfMissing:!1,label:""});if(!_){$n.value="Failed to open the selected folder.";return}Ct.value=_,jn($l(_)),await Os(),await V({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await aa(),Gi()}catch(_){$n.value=_ instanceof Error?_.message:"Failed to open the selected folder."}finally{Br.value=!1}}}async function Ob(){if(Xt.value="",Qt.value){Ol();return}if(!Dr.value){const l=Ct.value.trim()||await Mc();if(!l||(Dr.value=!0,oa.value="",await Ds(l),$n.value))return}$n.value||(qn.value=yn.value,Qt.value=!0,Gt(()=>{var l;return(l=xa.value)==null?void 0:l.focus()}))}function Ol(){Xt.value="",qn.value="",Qt.value=!1}async function Rp(){const l=qn.value.trim();if(!l)return;if(Xt.value="",$n.value){Xt.value="Reload the current folder before creating a new one.";return}to.value=!0;const d=rp.value.trim(),_=$p(Mp(d,l));if(!_){Xt.value="Unable to determine where the new folder should be created.",to.value=!1;return}if(!ap.value){Xt.value="Enter a single folder name.",to.value=!1;return}try{const $=await Yx(_);if(!$){Xt.value="Failed to create the folder.";return}Xt.value="",oa.value="",await Ds($),Ol()}catch($){Xt.value=$ instanceof Error?$.message:"Failed to create folder."}finally{to.value=!1}}async function Db(){var d;if(typeof window>"u")return!1;const l=((d=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:d.trim())??"";if(!l)return!1;try{const _=await zc(l,{createIfMissing:!1,label:""});if(!_)return!1;Ct.value=_,jn($l(_)),await zt.replace({name:"home"}),await Os();const $=new URL(window.location.href);return $.searchParams.delete("openProjectPath"),window.history.replaceState({},"",$.toString()),!0}catch{return!1}}async function Mc(){const l=Ep();if(l)return l;try{const d=await Tm();if(d)return on.value=d,d}catch{}return""}async function aa(){const l=Ep();if(!l){yn.value="New Project (1)";return}try{const d=await Xx(l);yn.value=d.name||"New Project (1)"}catch{yn.value="New Project (1)"}}function Ep(){var _,$;const l=Ct.value.trim();if(l)return ll(l);const d=(($=(_=Vu.value[0])==null?void 0:_.value)==null?void 0:$.trim())??"";return d?ll(d):on.value.trim()}async function Fb(){try{on.value=await Tm()}catch{on.value=""}}async function Os(){try{const l=await el();gn.value={order:[...l.order],labels:{...l.labels},projectOrder:[...l.projectOrder]}}catch{gn.value={order:[],labels:{},projectOrder:[]}}}async function Ds(l){const d=++P,_=nt(l).trim();as.value=_,Fr.value=_,$n.value="",fn.value=!0;try{const $=await Vx(l,{showHidden:Sl.value});if(d!==P)return;as.value=$.path,Fr.value=$.path,fi.value=$.parentPath,Cl.value=$.entries}catch($){if(d!==P)return;$n.value=$ instanceof Error?$.message:"Failed to load local folders.",fi.value=ll(Fr.value),Cl.value=[],Ol()}finally{d===P&&(fn.value=!1)}}function Mp(l,d){const _=nt(l).trim(),$=nt(d).trim().replace(/^[\\/]+/u,"");if(!_||!$)return"";const Q=_.includes("\\")&&!_.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(_))return`${_.slice(0,2)}${Q}${$}`;if(/^\/+$/u.test(_))return`/${$}`;const he=_.replace(/[\\/]+$/u,"");return he?`${he}${Q}${$}`:""}function $p(l){const d=nt(l).trim();if(!d)return"";const _=d.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(_){const[,Q,he,Oe=""]=_,rn=ad(Oe.split(/[\\/]+/u));return rn.length>0?`\\\\${Q}\\${he}\\${rn.join("\\")}`:`\\\\${Q}\\${he}`}const $=d.match(/^([a-zA-Z]:)([\\/].*)?$/u);if($){const[,Q,he=""]=$,Oe=d.includes("\\")&&!d.includes("/")?"\\":"/",rn=ad(he.split(/[\\/]+/u));return rn.length>0?`${Q}${Oe}${rn.join(Oe)}`:`${Q}${Oe}`}if(d.startsWith("/")){const Q=ad(d.split("/"));return Q.length>0?`/${Q.join("/")}`:"/"}return d}function ad(l){const d=[];for(const _ of l){const $=_.trim();if(!(!$||$===".")){if($===".."){d.length>0&&d.pop();continue}d.push($)}}return d}function Bb(l){pe(l.draggedId,l.targetId)}function jp(l){kn(Qo.value,l)}function Lp(l){Fo(l)}function Np(l){tr(l)}function Ub(){Yt()}const Dl=x("");let sd=null;tt(In,l=>{var d;l&&(l.text&&((d=xr.value)==null||d.hydrateDraft({text:l.text,imageUrls:l.imageUrls,fileAttachments:l.fileAttachments,skills:l.skills})),Dl.value=l.text?s("Stopped: message not submitted, restored to input."):s("Stopped: message not submitted."),sd&&clearTimeout(sd),sd=setTimeout(()=>{Dl.value=""},6e3),z(Qo.value))});function Op(l){var _,$;const d=ge.value.trim();switch(l){case"compact":d&&ie(d);break;case"review":if(!d)return;Ca.value="",pr.value="",Wn.value=!0;break;case"rename":d&&(($=hn.value)==null||$.openRenameThreadDialog(d,((_=ue.value)==null?void 0:_.title)??""));break;case"archive":d&&de(d);break;case"fork":d&&Fe(d);break;case"new":Zu();break;case"skills":B.value||zt.push({name:"skills"});break}}function qb(l){const d=l.turnId.trim();if(d.length>0){const _=[...ct.value].reverse().find($=>{var Q;return $.role==="user"&&(((Q=$.turnId)==null?void 0:Q.trim())??"")===d&&$.text.trim().length>0});_!=null&&_.text&&xr.value&&xr.value.appendTextToDraft(_.text)}or(l.turnId)}function zb(){D.value||!ge.value||(hi.value&&(Rt.value=hi.value.id),$t("default"),Rc(),dt("Implement",[],[],"steer",[],void 0,"default"))}async function Hb(){if(D.value||B.value||J.value||!ue.value||ct.value.length===0)return;const l=Wb();try{await Cy(l)}catch{}}function Wb(){var _,$,Q;const l=[],d=(($=(_=ue.value)==null?void 0:_.title)==null?void 0:$.trim())||"Untitled thread";l.push(`# ${Vb(d)}`),l.push(""),l.push(`- Exported: ${new Date().toISOString()}`),l.push(`- Thread ID: ${((Q=ue.value)==null?void 0:Q.id)??""}`),l.push(""),l.push("---"),l.push("");for(const he of ct.value){const Oe=he.role?he.role.toUpperCase():"MESSAGE";l.push(`## ${Oe}`),l.push("");const rn=he.text.trim();if(rn&&(l.push(rn),l.push("")),he.commandExecution&&(l.push("```text"),l.push(`command: ${he.commandExecution.command}`),l.push(`status: ${he.commandExecution.status}`),he.commandExecution.cwd&&l.push(`cwd: ${he.commandExecution.cwd}`),he.commandExecution.exitCode!==null&&l.push(`exitCode: ${he.commandExecution.exitCode}`),l.push(he.commandExecution.aggregatedOutput||"(no output)"),l.push("```"),l.push("")),he.fileAttachments&&he.fileAttachments.length>0){l.push("Attachments:");for(const Xo of he.fileAttachments)l.push(`- ${Xo.path}`);l.push("")}if(he.images&&he.images.length>0){l.push("Images:");for(const Xo of he.images)l.push(`- ${Xo}`);l.push("")}}return`${l.join(`
84
+ `).trimEnd()}
85
+ `}function Vb(l){return l.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function id(l,d){if(typeof window>"u")return d;const _=window.localStorage.getItem(l);return _===null?d:_==="1"}function Gb(){if(typeof window>"u")return"system";const l=window.localStorage.getItem(vv);return l==="light"||l==="dark"?l:"system"}function Kb(){if(typeof window>"u")return"steer";const l=window.localStorage.getItem(mv);return l==="steer"||l==="queue"?l:"queue"}function Yb(){if(typeof window>"u")return"standard";const l=window.localStorage.getItem(bv);return l==="standard"||l==="wide"||l==="extra-wide"?l:"standard"}function Jb(){Ia.value=!Ia.value,window.localStorage.setItem(hv,Ia.value?"1":"0")}function Qb(){Pa.value=Pa.value==="steer"?"queue":"steer",window.localStorage.setItem(mv,Pa.value)}function Xb(){const l=["system","light","dark"],d=l.indexOf(ta.value);ta.value=l[(d+1)%l.length],window.localStorage.setItem(vv,ta.value),$c()}function Zb(){const l=["standard","wide","extra-wide"],d=l.indexOf(Ra.value);Ra.value=l[(d+1)%l.length],window.localStorage.setItem(bv,Ra.value)}function e0(){na.value=!na.value,window.localStorage.setItem(gv,na.value?"1":"0")}function t0(){Eo.value=!Eo.value,window.localStorage.setItem(yv,Eo.value?"1":"0")}async function n0(l){if(!go.value){go.value=!0;try{if(l==="codex"){bn.value="codex";const d=await fm(!1);wr.value=d.enabled}else if(l==="openrouter"){bn.value="openrouter";const d=await fm(!0);wr.value=d.enabled,await Ji("","",{wireApi:b.value,provider:"openrouter"})}else l==="opencode-zen"?(bn.value="opencode-zen",await Ji("",T.value.trim(),{wireApi:"responses",provider:"opencode-zen"}),wr.value=!0):l==="custom"&&(bn.value="custom",Jo.value.trim()&&ts.value.trim()&&(await Ji(Jo.value.trim(),ts.value.trim(),{wireApi:y.value}),wr.value=!0));Xn.value="",await V({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(d){Xn.value=d instanceof Error?d.message:"Failed to switch provider"}finally{go.value=!1}}}async function ld(){if(Bt.value)return;const l=Jo.value.trim();if(l){Bt.value=!0;try{Xn.value="",await Ji(l,ts.value.trim(),{wireApi:y.value}),wr.value=!0;const d=await dm();d.provider==="custom"&&!d.currentModel&&(Xn.value=s("Failed to resolve model from custom endpoint; check the URL and try again")),await V({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(d){Xn.value=d instanceof Error?d.message:"Failed to save custom endpoint"}finally{Bt.value=!1}}}async function Dp(l){if(Bt.value||go.value||b.value===l)return;const d=b.value;b.value=l,Bt.value=!0;try{Xn.value="",await Ji("","",{wireApi:l,provider:"openrouter"}),wr.value=!0,await V({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(_){b.value=d,Xn.value=_ instanceof Error?_.message:"Failed to save OpenRouter API format"}finally{Bt.value=!1}}async function Fp(){if(Bt.value)return;const l=T.value.trim();if(l){Bt.value=!0;try{Xn.value="",await Ji("",l,{wireApi:"responses",provider:"opencode-zen"}),wr.value=!0,await V({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(d){Xn.value=d instanceof Error?d.message:"Failed to save OpenCode Zen config"}finally{Bt.value=!1}}}async function Bp(){if(!Bt.value){Bt.value=!0;try{const l=Gn.value.trim();await pm(l),Gn.value="",await cd(),await V({includeSelectedThreadMessages:!1})}catch{}finally{Bt.value=!1}}}async function o0(){if(!Bt.value){Bt.value=!0;try{await pm(""),Gn.value="",await cd(),await V({includeSelectedThreadMessages:!1})}catch{}finally{Bt.value=!1}}}async function cd(){try{const l=bn.value,d=await dm();wr.value=d.enabled,es.value=d.customKey??!1,ui.value=d.maskedKey??null,d.enabled?d.provider==="opencode-zen"?bn.value="opencode-zen":d.provider==="custom"?(bn.value="custom",Jo.value=d.customBaseUrl??"",y.value=d.wireApi==="chat"?"chat":"responses"):(bn.value="openrouter",b.value=d.wireApi==="chat"?"chat":"responses"):bn.value="codex",m=d.hasCodexAuth===!0,m||(S=!1);const _=bn.value!==l;_&&await V({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0});const $=await cp();$&&await V({includeSelectedThreadMessages:!1,providerChanged:_||$,awaitAncillaryRefreshes:!0})}catch{}}function r0(l){const _=ud(l.trim())||"auto";Ea.value=_,window.localStorage.setItem(wv,_)}function a0(l){Xe(Number(l))}const s0=[{value:"0",label:s("Off")},{value:"5",label:"5%"},{value:"10",label:"10%"},{value:"15",label:"15%"},{value:"20",label:"20%"},{value:"25",label:"25%"}];function i0(){var _;if(typeof window>"u")return"auto";const l=((_=window.localStorage.getItem(wv))==null?void 0:_.trim())||"auto";return ud(l)||"auto"}function l0(){const l=[{value:"auto",label:s("Auto-detect")}],d=new Set(["auto"]);function _(Q){const he=M[Q]||Q;return`${he.charAt(0).toUpperCase()+he.slice(1)} (${Q})`}for(const Q of typeof navigator<"u"?navigator.languages??[]:[]){const he=ud(Q);!he||d.has(he)||(d.add(he),l.push({value:he,label:`${s("Preferred")}: ${_(he)}`}))}for(const Q of Object.keys(M))d.has(Q)||(d.add(Q),l.push({value:Q,label:_(Q)}));const $=Ea.value.trim();return $&&!d.has($)&&l.push({value:$,label:_($)}),l}function ud(l){const d=l.trim().toLowerCase();if(!d||d==="auto")return"";if(d in M)return d;const _=d.split("-")[0]??d;return _ in M?_:""}function $c(){const l=document.documentElement;if(ta.value==="dark")l.classList.add("dark");else if(ta.value==="light")l.classList.remove("dark");else{const d=window.matchMedia("(prefers-color-scheme: dark)").matches;l.classList.toggle("dark",d)}}function c0(){return typeof window>"u"?!1:window.localStorage.getItem(uv)==="1"}function u0(l){typeof window>"u"||window.localStorage.setItem(uv,l?"1":"0")}function d0(){if(typeof window>"u")return!0;const l=window.localStorage.getItem(dv);return l===null?!0:l==="1"}function f0(){Mr.value=!Mr.value,!(typeof window>"u")&&window.localStorage.setItem(dv,Mr.value?"1":"0")}function p0(l,d){const _=(l??"").trim();return _.length>0?_:d.trim()||"message"}function Up(l){$t(l)}async function h0(){await zt.isReady(),Tt.name==="thread"&&L.value?Cn(L.value):(Tt.name==="home"||Tt.name==="skills"||Tt.name==="automations")&&Cn("",{persist:!1}),await V({includeSelectedThreadMessages:Tt.name==="thread"}),Ll({silent:!0}),await Db(),nn.value=!0,await dd(),Pn()}async function dd(){if(ba.value){Jr=!0;return}ba.value=!0;try{do{if(Jr=!1,Tt.name==="home"||Tt.name==="skills"||Tt.name==="automations"){ge.value!==""&&await le("");continue}if(Tt.name==="thread"){const l=L.value;if(!l)continue;if(ge.value!==l){if(await le(l)==="not-found")continue}else ne(l,{silent:!0}).catch(()=>{})}}while(Jr)}finally{ba.value=!1}}tt(()=>[Tt.name,L.value,at.value,ge.value],async()=>{nn.value&&await dd()}),tt(()=>[ge.value,_n.value],()=>{wb()}),tt(()=>[Tt.name,_n.value],([l,d])=>{l==="thread"&&Ic(d)},{immediate:!0}),tt(()=>ge.value,async l=>{if(nn.value&&!ba.value&&!(D.value||B.value||J.value)){if(!l){Tt.name!=="home"&&await zt.replace({name:"home"});return}Tt.name==="thread"&&L.value===l||await zt.replace({name:"thread",params:{threadId:l}})}}),tt(()=>Vu.value,l=>{if(l.length===0){Ct.value="",aa();return}const d=Ct.value.trim();d&&(l.some($=>$.value===d)||(Ct.value="")),aa()},{immediate:!0}),tt(()=>Ct.value,()=>{Jt.value={phase:"idle",title:"",message:""},aa()}),tt(()=>[Tt.name,Ct.value],([l,d])=>{l==="home"&&Ic(d)},{immediate:!0}),tt(gi,l=>{!l&&Nn.value==="worktree"&&(Nn.value="local")},{immediate:!0}),tt(()=>[Nn.value,Ct.value],([l,d])=>{l!=="worktree"||!gi.value||qp(d)},{immediate:!0}),tt(()=>Nn.value,l=>{var d;if(l==="local"){Jt.value={phase:"idle",title:"",message:""};const _=Ct.value.trim();if(_&&pp(_)){const $=((d=ue.value)==null?void 0:d.projectName)??Tr(_),Q=Vi($,"");Q&&(Ct.value=Q)}return}gi.value&&qp(Ct.value)}),tt(()=>Tt.name,l=>{l!=="home"&&(Jt.value={phase:"idle",title:"",message:""}),l!=="thread"&&(Wn.value=!1)}),tt(()=>ge.value,()=>{Jt.value={phase:"idle",title:"",message:""}}),tt(()=>[Tt.name,_n.value,gi.value],([l,d,_])=>{if(!(l==="thread"||l==="home"&&_)){Ap();return}Ee+=1,Zr.value={},mr.value="",vr.value="",Nl(d)},{immediate:!0}),tt(rt,l=>{typeof document>"u"||(document.title=l)},{immediate:!0}),tt(Et,l=>{l&&!Mt.value&&yo(!0)},{immediate:!0});async function m0(l,d=[],_=[],$=[]){try{Jt.value={phase:"idle",title:"",message:""};let Q=Ct.value;if(Nn.value==="worktree"){Jt.value={phase:"running",title:s("Creating worktree"),message:s("Creating a worktree and running setup.")};try{const Oe=await $x(Ct.value,fo.value);Q=Oe.cwd,Ct.value=Oe.cwd,Jt.value={phase:"idle",title:"",message:""}}catch{Jt.value={phase:"error",title:s("Worktree setup failed"),message:s("Unable to create worktree. Try again or switch to Local project.")};return}}else if(!Q.trim()){const Oe=await Qx(l);Q=Oe.cwd,Ct.value=Oe.cwd}const he=await pt(l,Q,d,_,$);if(!he)return;await zt.replace({name:"thread",params:{threadId:he}}),Rc()}catch{}}function v0(l){var $;if(($=l.prompt)!=null&&$.trim())return l.prompt.trim();const d=l.displayName.trim()||l.name.trim(),_=l.kind==="skill"?"skill":l.kind==="plugin"?"plugin":l.kind==="composio"?"Composio connector":"app";return`Test ${d} ${_}. Give me a list of what it can do and one useful example.`}function g0(l){return`${l.kind}:${l.name}:${l.skillPath??""}`}async function y0(l){var $;if(sr.value)return;sr.value=g0(l);const d=v0(l),_=($=l.attachedSkills)!=null&&$.length?l.attachedSkills:l.kind==="skill"&&l.skillPath?[{name:l.name,path:l.skillPath}]:[];try{const Q=Rl.value.trim()||_n.value.trim(),he=await pt(d,Q,[],_,[]);if(!he)return;await zt.replace({name:"thread",params:{threadId:he}}),Rc()}catch{}finally{sr.value=""}}async function qp(l){var _;const d=l.trim();if(!d){po.value=[],fo.value="";return}En.value=!0;try{const $=await Lx(d);po.value=$;const Q=fo.value.trim();if(!(Q.length>0&&$.some(Oe=>Oe.value===Q))){const Oe=$.find(rn=>rn.value.trim()==="main");fo.value=(Oe==null?void 0:Oe.value)??((_=$[0])==null?void 0:_.value)??""}}catch{po.value=[],fo.value=""}finally{En.value=!1}}return(l,d)=>(C(),I(qe,null,[Me(hS,{"is-sidebar-collapsed":Mt.value,onCloseSidebar:d[47]||(d[47]=_=>yo(!0))},{sidebar:mt(()=>{var _;return[f("section",H2,[f("div",{ref_key:"sidebarScrollableRef",ref:Wa,class:"sidebar-scrollable",onScroll:ow},[Mt.value?Z("",!0):(C(),Ze(Bm,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":Mt.value,"show-new-thread-button":!0,onToggleSidebar:d[0]||(d[0]=$=>yo(!Mt.value)),onStartNewThread:Zu},{default:mt(()=>[f("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":Hn.value,"aria-label":v(s)("Search threads"),title:v(s)("Search threads"),onClick:tw},[Me(Um,{class:"sidebar-search-toggle-icon"})],8,W2)]),_:1},8,["is-sidebar-collapsed"])),!Mt.value&&Hn.value?(C(),I("div",V2,[Me(Um,{class:"sidebar-search-bar-icon"}),Nt(f("input",{ref_key:"sidebarSearchInputRef",ref:Rr,"onUpdate:modelValue":d[1]||(d[1]=$=>Mn.value=$),class:"sidebar-search-input",type:"text",placeholder:v(s)("Filter threads..."),onKeydown:aw},null,40,G2),[[sn,Mn.value]]),Mn.value.length>0?(C(),I("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":v(s)("Clear search"),onClick:nw},[Me(ru,{class:"sidebar-search-clear-icon"})],8,K2)):Z("",!0)])):Z("",!0),Mt.value?Z("",!0):(C(),I("button",{key:2,class:Ye(["sidebar-skills-link",{"is-active":B.value}]),type:"button",onClick:d[2]||(d[2]=$=>{v(zt).push({name:"skills"}),v(Et)&&yo(!0)})},[f("span",Y2,[Me(Gs)]),f("span",J2,[f("span",Q2,k(v(s)("Skills")),1),f("span",X2,k(v(s)("Plugins, apps, MCPs")),1)])],2)),Mt.value?Z("",!0):(C(),I("button",{key:3,class:Ye(["sidebar-skills-link",{"is-active":J.value}]),type:"button",onClick:d[3]||(d[3]=$=>{v(zt).push({name:"automations"}),v(Et)&&yo(!0)})},[f("span",Z2,[Me(Gs)]),f("span",eD,[f("span",tD,k(v(s)("Automations")),1),f("span",nD,k(v(s)("Scheduled work")),1)])],2)),Mt.value?Z("",!0):(C(),Ze(SP,{key:4,ref_key:"sidebarThreadTreeRef",ref:hn,groups:v(U),"project-display-name-by-id":v(Y),"project-git-repo-by-name":qy.value,"project-cwd-by-name":hp.value,"selected-thread-id":v(ge),"is-loading":v(at),"is-thread-list-fully-loaded":v(it),"search-query":Mn.value,"search-matched-thread-ids":lr.value,onSelect:sw,onArchive:Pw,onStartNewThread:Mw,onRenameProject:Gw,onBrowseThreadFiles:$w,onSaveThreadProject:Dw,onBrowseProjectFiles:Nw,onSaveProject:Ow,onRequestProjectGitStatus:Qw,onCreateProjectWorktree:Hw,onRenameThread:Kw,onForkThread:Ew,onRemoveProject:Yw,onReorderProject:Jw,onCopyThreadChat:dw,onAutomationsChanged:uw,onRestoreThread:Rw,onStartNewChat:Vw},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),Mt.value?Z("",!0):(C(),I("div",{key:0,ref_key:"settingsAreaRef",ref:Va,class:"sidebar-settings-area",onClick:ib},[(C(),Ze(Qs,{to:"body"},[Ht.value?(C(),I("div",{key:0,class:"settings-dialog-backdrop",role:"presentation",onClick:d[21]||(d[21]=st($=>Ht.value=!1,["self"]))},[f("div",{ref_key:"settingsPanelRef",ref:ir,class:"sidebar-settings-panel",role:"dialog","aria-modal":"true","aria-label":v(s)("Settings"),onClick:d[20]||(d[20]=st(()=>{},["stop"]))},[f("div",rD,[f("h2",aD,k(v(s)("Settings")),1),f("button",{class:"settings-dialog-close",type:"button","aria-label":v(s)("Close"),title:v(s)("Close"),onClick:d[4]||(d[4]=$=>Ht.value=!1)},[Me(ru,{class:"settings-dialog-close-icon"})],8,sD)]),f("div",iD,[f("nav",{class:"settings-group-nav","aria-label":v(s)("Settings groups")},[(C(),I(qe,null,At(Qr,$=>f("button",{key:$.id,type:"button",class:Ye(["settings-group-nav-item",{"is-active":Po.value===$.id}]),"aria-current":Po.value===$.id?"true":void 0,onClick:Q=>Po.value=$.id},k(v(s)($.label)),11,cD)),64))],8,lD),f("div",uD,[Nt(f("div",null,[Me(bj,{accounts:Bn.value,"is-accounts-section-collapsed":Mr.value,"is-refreshing-accounts":Go.value,"is-switching-accounts":vo.value,"is-starting-codex-login":Ko.value,"is-completing-codex-login":Un.value,"account-action-error":wn.value,"codex-login-url":Aa.value,"feedback-mailto":v(tn),"is-account-unavailable":xc,"is-remove-confirmation-active":Qu,"is-remove-visible":mw,"build-account-title":kw,"format-account-meta":dp,"format-account-quota":fp,"short-account-id":fw,"is-account-action-disabled":hw,"get-account-switch-label":vw,"get-account-remove-label":gw,"on-refresh-accounts":Cw,"on-start-codex-login":_w,"on-switch-account":Sw,"on-remove-account":Iw,"on-account-card-pointer-enter":yw,"on-account-card-pointer-leave":ww,"toggle-accounts-section-collapsed":f0,"prepare-feedback-link":Sn},null,8,["accounts","is-accounts-section-collapsed","is-refreshing-accounts","is-switching-accounts","is-starting-codex-login","is-completing-codex-login","account-action-error","codex-login-url","feedback-mailto"]),f("button",{class:"sidebar-settings-row",type:"button",title:w.sendWithEnter,onClick:Jb},[f("span",fD,k(v(s)("Require ⌘ + enter to send")),1),f("span",{class:Ye(["sidebar-settings-toggle",{"is-on":!Ia.value}])},null,2)],8,dD),f("button",{class:"sidebar-settings-row",type:"button",title:w.inProgressSendMode,onClick:Qb},[f("span",hD,k(v(s)("When busy, send as")),1),f("span",mD,k(Pa.value==="steer"?v(s)("Steer"):v(s)("Queue")),1)],8,pD),f("button",{class:"sidebar-settings-row",type:"button",title:w.appearance,onClick:Xb},[f("span",gD,k(v(s)("Appearance")),1),f("span",yD,k(ta.value==="system"?v(s)("System"):ta.value==="dark"?v(s)("Dark"):v(s)("Light")),1)],8,vD),f("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:v(s)("Choose the interface language for the app.")},[f("span",bD,k(v(s)("UI language")),1),Me(Zo,{class:"sidebar-settings-provider-dropdown","model-value":v(i),options:v(u),placeholder:v(s)("UI language"),"menu-align":"end","onUpdate:modelValue":d[5]||(d[5]=$=>v(h)($))},null,8,["model-value","options","placeholder"])],8,wD),f("button",{class:"sidebar-settings-row",type:"button",title:w.chatWidth,onClick:Zb},[f("span",kD,k(v(s)("Chat width")),1),f("span",CD,k(Gy.value),1)],8,TD),f("button",{class:"sidebar-settings-row",type:"button",title:w.dictationClickToToggle,onClick:e0},[f("span",_D,k(v(s)("Click to toggle dictation")),1),f("span",{class:Ye(["sidebar-settings-toggle",{"is-on":na.value}])},null,2)],8,SD),f("button",{class:"sidebar-settings-row",type:"button",title:w.dictationAutoSend,onClick:t0},[f("span",AD,k(v(s)("Auto send dictation")),1),f("span",{class:Ye(["sidebar-settings-toggle",{"is-on":Eo.value}])},null,2)],8,xD),f("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:w.dictationLanguage},[f("span",PD,k(v(s)("Dictation language")),1),Me(Zo,{class:"sidebar-settings-language-dropdown","model-value":Ea.value,options:Ps.value,placeholder:v(s)("Auto-detect"),"open-direction":"up","enable-search":!0,"search-placeholder":v(s)("Search language..."),"onUpdate:modelValue":r0},null,8,["model-value","options","placeholder","search-placeholder"])],8,ID),f("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:v(s)("Auto-compact at or below remaining context percentage. 0 disables auto-compaction and falls back to server-side compaction.")},[f("span",ED,k(v(s)("Auto-compact before send")),1),Me(Zo,{class:"sidebar-settings-auto-compact-dropdown","model-value":String(v(We)),options:s0,placeholder:v(s)("Off"),"menu-align":"end","onUpdate:modelValue":a0},null,8,["model-value","placeholder"])],8,RD),Wu.value?(C(),I("a",{key:0,class:"sidebar-settings-row sidebar-settings-feedback-row",href:v(tn),onClick:Sn},[f("span",$D,k(v(s)("Send feedback")),1),f("span",jD,k(v(s)("Issue detected")),1)],8,MD)):Z("",!0)],512),[[Fc,Po.value==="general"]]),Nt(f("div",null,[f("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:v(s)("Choose the API provider for the Codex backend")},[f("span",ND,k(v(s)("Provider")),1),Me(Zo,{class:"sidebar-settings-provider-dropdown","model-value":bn.value,options:Rs.value,placeholder:v(s)("Provider"),disabled:go.value,"menu-align":"end","onUpdate:modelValue":n0},null,8,["model-value","options","placeholder","disabled"])],8,LD),Xn.value?(C(),I("div",OD,[f("span",null,k(Xn.value),1),f("a",{class:"visible-error-feedback",href:v(tn),onClick:d[6]||(d[6]=$=>Sn($,Xn.value))},k(v(s)("Send feedback")),9,DD)])):Z("",!0),bn.value==="openrouter"?(C(),I("div",FD,[f("div",BD,[f("span",UD,k(v(s)("OpenRouter API key")),1),f("a",qD,k(v(s)("Get API key")),1)]),f("div",zD,[es.value&&!Gn.value?(C(),I(qe,{key:0},[f("span",HD,k(ui.value),1),f("button",{class:"sidebar-settings-key-clear",type:"button",disabled:Bt.value,title:v(s)("Remove custom key, use community keys"),onClick:o0},"✕",8,WD)],64)):(C(),I(qe,{key:1},[Nt(f("input",{"onUpdate:modelValue":d[7]||(d[7]=$=>Gn.value=$),class:"sidebar-settings-key-input",type:"password",placeholder:v(s)("sk-or-v1-... (optional, uses free keys if empty)"),onKeydown:xn(Bp,["enter"])},null,40,VD),[[sn,Gn.value]]),f("button",{class:"sidebar-settings-key-save",type:"button",disabled:Bt.value||!Gn.value.trim(),onClick:Bp},k(Bt.value?"...":v(s)("Set")),9,GD)],64))]),f("div",KD,[f("span",YD,k(v(s)("API format")),1),f("div",{class:"sidebar-settings-segmented",role:"group","aria-label":v(s)("OpenRouter API format")},[f("button",{type:"button",class:Ye(["sidebar-settings-segmented-option",{"is-active":b.value==="responses"}]),disabled:Bt.value||go.value,onClick:d[8]||(d[8]=$=>Dp("responses"))},k(v(s)("Responses")),11,QD),f("button",{type:"button",class:Ye(["sidebar-settings-segmented-option",{"is-active":b.value==="chat"}]),disabled:Bt.value||go.value,onClick:d[9]||(d[9]=$=>Dp("chat"))},k(v(s)("Completions")),11,XD)],8,JD)])])):Z("",!0),bn.value==="opencode-zen"?(C(),I("div",ZD,[f("div",eF,[f("span",tF,k(v(s)("OpenCode Zen API key")),1),f("a",nF,k(v(s)("Get API key")),1)]),f("div",oF,[Nt(f("input",{"onUpdate:modelValue":d[10]||(d[10]=$=>T.value=$),class:"sidebar-settings-key-input",type:"password",placeholder:v(s)("sk-..."),onKeydown:xn(Fp,["enter"])},null,40,rF),[[sn,T.value]]),f("button",{class:"sidebar-settings-key-save",type:"button",disabled:Bt.value||!T.value.trim(),onClick:Fp},k(Bt.value?"...":v(s)("Save")),9,aF)])])):Z("",!0),bn.value==="custom"?(C(),I("div",sF,[f("span",iF,k(v(s)("Custom endpoint URL")),1),f("div",lF,[Nt(f("input",{"onUpdate:modelValue":d[11]||(d[11]=$=>Jo.value=$),class:"sidebar-settings-key-input",type:"url",placeholder:v(s)("https://api.example.com/v1"),onKeydown:xn(ld,["enter"])},null,40,cF),[[sn,Jo.value]])]),f("span",uF,k(v(s)("API key")),1),f("div",dF,[Nt(f("input",{"onUpdate:modelValue":d[12]||(d[12]=$=>ts.value=$),class:"sidebar-settings-key-input",type:"password",placeholder:v(s)("Bearer token (optional)"),onKeydown:xn(ld,["enter"])},null,40,fF),[[sn,ts.value]]),f("button",{class:"sidebar-settings-key-save",type:"button",disabled:Bt.value||!Jo.value.trim(),onClick:ld},k(Bt.value?"...":v(s)("Save")),9,pF)]),f("div",hF,[f("span",mF,k(v(s)("API format")),1),f("div",{class:"sidebar-settings-segmented",role:"group","aria-label":v(s)("Custom endpoint API format")},[f("button",{type:"button",class:Ye(["sidebar-settings-segmented-option",{"is-active":y.value==="responses"}]),onClick:d[13]||(d[13]=$=>y.value="responses")},k(v(s)("Responses")),3),f("button",{type:"button",class:Ye(["sidebar-settings-segmented-option",{"is-active":y.value==="chat"}]),onClick:d[14]||(d[14]=$=>y.value="chat")},k(v(s)("Completions")),3)],8,vF)])])):Z("",!0)],512),[[Fc,Po.value==="models"]]),Nt(f("div",null,[f("button",{class:"sidebar-settings-row",type:"button","aria-live":"polite",onClick:d[15]||(d[15]=$=>N.value=!N.value)},[f("span",gF,k(v(s)("Telegram")),1),f("span",yF,k(Yy.value),1)]),N.value?(C(),I("div",wF,[f("label",bF,[f("span",TF,k(v(s)("Bot token")),1),Nt(f("input",{"onUpdate:modelValue":d[16]||(d[16]=$=>ke.value=$),class:"sidebar-settings-input",type:"password",placeholder:"123456:ABCDEF",autocomplete:"off",spellcheck:"false"},null,512),[[sn,ke.value]])]),f("label",kF,[f("span",CF,k(v(s)("Allowed Telegram user IDs")),1),Nt(f("textarea",{"onUpdate:modelValue":d[17]||(d[17]=$=>ot.value=$),class:"sidebar-settings-textarea",rows:"3",placeholder:`123456789
86
+ 987654321`,spellcheck:"false"},null,512),[[sn,ot.value]])]),f("div",SF,k(v(s)("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.")),1),Pt.value?(C(),I("div",_F,[f("span",null,k(Pt.value),1),f("a",{class:"visible-error-feedback",href:v(tn),onClick:d[18]||(d[18]=$=>Sn($,Pt.value))},k(v(s)("Send feedback")),9,xF)])):Z("",!0),f("div",AF,[f("button",{class:"sidebar-settings-telegram-save",type:"button",disabled:Mo.value,onClick:ew},k(Mo.value?v(s)("Saving…"):v(s)("Save Telegram config")),9,IF)])])):Z("",!0),f("div",PF,[f("div",RF,[f("span",EF,k(v(s)("Hooks")),1),f("button",{class:"sidebar-settings-hooks-reload",type:"button",disabled:v(W),title:v(s)("Reload lifecycle hooks"),onClick:d[19]||(d[19]=$=>v(R)({force:!0}))},k(v(W)?v(s)("Reloading…"):v(s)("Reload")),9,MF)]),bl.value?(C(),I(qe,{key:1},[v(W)?(C(),I("p",jF,k(v(s)("Loading hooks…")),1)):v(j).length===0?(C(),I("p",LF,k(v(s)("No hooks registered.")),1)):(C(),I("div",NF,[(C(!0),I(qe,null,At(v(j),$=>(C(),I("div",{key:$.cwd||"__global__",class:"sidebar-settings-hooks-entry"},[f("p",OF,k($.cwd||v(s)("Global")),1),(C(!0),I(qe,null,At($.hooks,(Q,he)=>(C(),I("div",{key:`${$.cwd}:${Q.event}:${he}`,class:"sidebar-settings-hooks-item"},[f("span",{class:Ye(["sidebar-settings-hooks-state",{"is-on":Q.enabled!==!1}])},k(Q.enabled===!1?v(s)("Disabled"):v(s)("Enabled")),3),f("span",DF,k(Q.event),1),f("code",FF,k(Q.command),1)]))),128))]))),128))]))],64)):(C(),I("p",$F,k(v(s)("Hooks are not supported by this Codex version.")),1))]),f("div",BF,[f("div",UF,[f("span",qF,k(v(s)("Remote control")),1),f("button",{class:"sidebar-settings-remote-toggle",type:"button",disabled:Qn.value||ur.value,title:v(s)("Enable or disable remote control"),onClick:ka},[f("span",{class:Ye(["sidebar-settings-remote-toggle-track",{"is-on":Dn.value.enabled}])},[...d[52]||(d[52]=[f("span",{class:"sidebar-settings-remote-toggle-thumb"},null,-1)])],2),f("span",HF,k(Dn.value.enabled?v(s)("Enabled"):v(s)("Disabled")),1)],8,zF)]),ai.value?(C(),I(qe,{key:1},[Ft.value?(C(),I("p",VF,k(Ft.value),1)):Z("",!0),Ga.value?(C(),I("p",GF,k(Ga.value),1)):Z("",!0),ur.value?(C(),I("p",KF,k(v(s)("Loading…")),1)):(C(),I(qe,{key:3},[f("button",{class:"sidebar-settings-remote-row",type:"button",disabled:!Dn.value.enabled||Qn.value,onClick:Ya},[f("span",JF,k(v(s)("Pair a new device")),1),f("span",QF,k(jt.value==="pairing"?v(s)("Starting…"):(_=Xr.value)!=null&&_.pairingCode?Xr.value.pairingCode:v(s)("Generate code")),1)],8,YF),f("div",XF,[f("div",ZF,[f("span",eB,k(v(s)("Paired devices")),1),f("button",{class:"sidebar-settings-remote-reload",type:"button",disabled:Qn.value,onClick:Fi},k(jt.value==="clients"?v(s)("Reloading…"):v(s)("Reload")),9,tB)]),Dn.value.clients.length===0?(C(),I("p",nB,k(v(s)("No paired devices.")),1)):Z("",!0),(C(!0),I(qe,null,At(Dn.value.clients,$=>(C(),I("div",{key:$.clientId,class:"sidebar-settings-remote-client"},[f("span",oB,k($.deviceName||$.clientId),1),f("button",{class:"sidebar-settings-remote-client-revoke",type:"button",disabled:Qn.value,onClick:Q=>Bi($.clientId)},k(jt.value===`revoke:${$.clientId}`?v(s)("Removing…"):v(s)("Revoke")),9,rB)]))),128))])],64))],64)):(C(),I("p",WF,k(v(s)("Remote control is not supported by this Codex version.")),1))])],512),[[Fc,Po.value==="integrations"]]),Nt(f("div",null,[f("div",aB,[Me(M$,{snapshots:v(Le)},null,8,["snapshots"])]),f("div",{class:"sidebar-settings-build-label","aria-label":v(s)("Worktree name and version")}," WT "+k(v(p))+" · v"+k(v(g)),9,sB)],512),[[Fc,Po.value==="usage"]])])])],8,oD)])):Z("",!0)])),f("div",iB,[f("button",{ref_key:"settingsButtonRef",ref:Ho,class:"sidebar-settings-icon-button",type:"button",title:v(s)("Settings"),"aria-label":v(s)("Settings"),onClick:st(oi,["stop"])},[Me(mN,{class:"sidebar-settings-icon"})],8,lB),f("button",{ref:"recycleBinButtonRef",class:"sidebar-settings-icon-button",type:"button",title:v(s)("Recycle bin"),"aria-label":v(s)("Recycle bin"),onClick:st(lb,["stop"])},[Me(Ty,{class:"sidebar-settings-icon"})],8,cB)])],512))])]}),content:mt(()=>[f("div",uB,[f("section",{class:Ye(["content-root",{"is-virtual-keyboard-open":Sc.value}]),style:kr(Ky.value)},[Ls.value?(C(),I("span",dB)):Z("",!0),Me(PP,{title:ye.value,accent:B.value||J.value},{leading:mt(()=>[Mt.value||v(Et)?(C(),Ze(Bm,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":Mt.value,"show-new-thread-button":!0,onToggleSidebar:d[22]||(d[22]=_=>yo(!Mt.value)),onStartNewThread:Zu},null,8,["is-sidebar-collapsed"])):Z("",!0),B.value?(C(),I("span",fB,[Me(Gs)])):J.value?(C(),I("span",pB,[Me(Gs)])):Z("",!0)]),actions:mt(()=>[vi.value?(C(),I("button",{key:0,class:"content-header-right-panel-toggle",type:"button","aria-label":v(Et)?Jn.value?v(s)("Close side panel"):v(s)("Open side panel"):Ao.value?v(s)("Open side panel"):v(s)("Close side panel"),title:v(Et)?Jn.value?v(s)("Close side panel"):v(s)("Open side panel"):Ao.value?v(s)("Open side panel"):v(s)("Close side panel"),onClick:ob},[Me(ky,{class:"content-header-right-panel-toggle-icon"})],8,hB)):Z("",!0)]),_:1},8,["title","accent"]),f("section",mB,[B.value?(C(),Ze(v(r),{key:0,ref_key:"directoryHubRef",ref:Sr,cwd:Rl.value,"thread-id":L.value,"try-in-flight-key":sr.value,onSkillsChanged:Jy,onTryItem:y0},null,8,["cwd","thread-id","try-in-flight-key"])):J.value?(C(),Ze(v(a),{key:1,ref_key:"automationsPanelRef",ref:ga,groups:v(U),"project-cwd-by-name":hp.value,"project-display-name-by-id":v(Y),"selected-automation-id":se.value,onSelectAutomation:iw,onEditAutomation:lw,onCreateAutomation:cw},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):D.value?(C(),I("div",vB,[f("div",gB,[f("p",yB,k(v(s)("Let's build")),1),Me(Zo,{class:"new-thread-folder-dropdown","model-value":Ct.value,options:Vu.value,placeholder:v(s)("Choose folder"),"enable-search":!0,"search-placeholder":v(s)("Quick search project"),disabled:!1,"onUpdate:modelValue":db},null,8,["model-value","options","placeholder","search-placeholder"]),Ct.value?(C(),I("p",{key:0,class:"new-thread-folder-selected",title:Ct.value},k(v(s)("Selected folder"))+": "+k(Ct.value),9,wB)):Z("",!0),f("div",bB,[f("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:Eb},k(v(s)("Select folder")),1),f("button",{class:"new-thread-folder-action",type:"button",onClick:bb},k(v(s)("Create Project")),1),f("button",{class:"new-thread-folder-action",type:"button",disabled:Ms.value,onClick:Ab},k(Ms.value?v(s)("Importing…"):v(s)("Import Project")),9,TB),f("input",{ref_key:"projectImportInputRef",ref:kc,class:"new-thread-project-import-input",type:"file",accept:".zip,application/zip",tabindex:"-1","aria-hidden":"true",onChange:Rb},null,544)]),$a.value?(C(),I("section",kB,[f("div",CB,[f("div",SB,[f("span",_B,[Me(Gs)]),f("p",xB,k(v(s)("New in Codex")),1)]),f("h2",AB,k(v(s)("Plugins are here")),1),f("p",IB,k(v(s)("Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.")),1),d[53]||(d[53]=f("div",{class:"new-thread-launch-card-pills","aria-label":"Example integrations"},[f("span",{class:"new-thread-launch-card-pill"},"Gmail"),f("span",{class:"new-thread-launch-card-pill"},"Calendar"),f("span",{class:"new-thread-launch-card-pill"},"GitHub"),f("span",{class:"new-thread-launch-card-pill"},"Slack"),f("span",{class:"new-thread-launch-card-pill"},"Browser Use")],-1))]),f("div",PB,[f("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:Ut},k(v(s)("Explore Plugins & Apps")),1),f("button",{class:"new-thread-launch-card-button",type:"button",onClick:xe},k(v(s)("Dismiss")),1)])])):Z("",!0),(C(),Ze(Qs,{to:"body"},[Dr.value?(C(),I("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:st(Tb,["self"]),onMouseup:kb},[f("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":v(s)("Select folder"),onKeydown:xn(st(Gi,["prevent"]),["esc"])},[f("div",EB,[f("p",MB,k(v(s)("Select folder")),1),f("button",{class:"new-thread-open-folder-close",type:"button",onClick:Gi},k(v(s)("Cancel")),1)]),f("p",$B,k(v(s)("Current folder")),1),f("div",jB,[Nt(f("input",{ref_key:"existingFolderPathInputRef",ref:di,"onUpdate:modelValue":d[23]||(d[23]=_=>as.value=_),class:"new-thread-open-folder-path",type:"text",placeholder:v(s)("Current folder"),title:as.value||v(s)("Unavailable"),disabled:fn.value||Br.value,onBlur:Lb,onKeydown:[xn(st(Nb,["prevent"]),["enter"]),xn(st(Gi,["prevent"]),["esc"])]},null,40,LB),[[sn,as.value]]),f("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!jl.value||fn.value||Br.value,onClick:d[24]||(d[24]=_=>rd())},k(Br.value?v(s)("Opening…"):v(s)("Open")),9,NB)]),f("div",OB,[f("label",DB,[Nt(f("input",{"onUpdate:modelValue":d[25]||(d[25]=_=>Sl.value=_),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:$b},null,544),[[Lg,Sl.value]]),f("span",null,k(v(s)("Show hidden folders")),1)]),f("button",{class:Ye(["new-thread-folder-action",{"new-thread-folder-action-primary":Qt.value}]),type:"button","aria-pressed":Qt.value,disabled:!Fr.value||fn.value||Br.value||to.value||!!$n.value&&!Qt.value,onClick:Ob},k(v(s)("New folder")),11,FB)]),Qt.value?(C(),I("div",BB,[f("div",UB,[Nt(f("input",{ref_key:"createFolderInputRef",ref:xa,"onUpdate:modelValue":d[26]||(d[26]=_=>qn.value=_),class:"new-thread-open-folder-create-input",type:"text",placeholder:v(s)("Folder name"),onKeydown:[xn(st(Rp,["prevent"]),["enter"]),xn(st(Ol,["prevent"]),["esc"])]},null,40,qB),[[sn,qn.value]]),f("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!zy.value||to.value,onClick:Rp},k(Hy.value),9,zB)]),Xt.value?(C(),I("div",HB,[f("span",null,k(Xt.value),1),f("a",{class:"visible-error-feedback",href:v(tn),onClick:d[27]||(d[27]=_=>Sn(_,Xt.value))},k(v(s)("Send feedback")),9,WB)])):Z("",!0)])):Z("",!0),Nt(f("input",{ref_key:"existingFolderFilterInputRef",ref:Hu,"onUpdate:modelValue":d[28]||(d[28]=_=>oa.value=_),class:"new-thread-open-folder-filter",type:"text",placeholder:v(s)("Filter folders..."),onKeydown:xn(st(Gi,["prevent"]),["esc"])},null,40,VB),[[sn,oa.value]]),$n.value?(C(),I("div",GB,[f("div",KB,[f("span",null,k($n.value),1),f("a",{class:"visible-error-feedback",href:v(tn),onClick:d[29]||(d[29]=_=>Sn(_,$n.value))},k(v(s)("Send feedback")),9,YB)]),f("button",{class:"new-thread-folder-action",type:"button",disabled:fn.value||Br.value,onClick:jb},k(v(s)("Retry")),9,JB)])):Z("",!0),fn.value?(C(),I("p",QB,k(v(s)("Loading folders…")),1)):!$n.value&&Ku.value.length===0?(C(),I("p",XB,k(oa.value.trim()?v(s)("No folders match this filter."):v(s)("No subfolders found here.")),1)):Ku.value.length>0?(C(),I("ul",ZB,[(C(!0),I(qe,null,At(Ku.value,_=>(C(),I("li",{key:_.key,class:"new-thread-open-folder-item"},[f("button",{class:"new-thread-open-folder-item-main",type:"button",title:_.path,disabled:fn.value||Br.value,onClick:$=>Mb(_.path)},[f("span",tU,k(_.name),1)],8,eU),_.kind==="directory"?(C(),I("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:fn.value||Br.value,onClick:$=>rd(_.path)},k(v(s)("Open")),9,nU)):Z("",!0)]))),128))])):Z("",!0)],40,RB)],32)):Z("",!0)])),(C(),Ze(Qs,{to:"body"},[ja.value?(C(),I("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:st(Cb,["self"]),onMouseup:Sb},[f("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":v(s)("Create or clone project"),onKeydown:xn(st(Ec,["prevent"]),["esc"])},[f("div",rU,[f("p",aU,k(v(s)("Create or clone project")),1),f("button",{class:"new-thread-open-folder-close",type:"button",disabled:Kn.value,onClick:Ec},k(v(s)("Cancel")),9,sU)]),f("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":v(s)("Project source")},[f("button",{class:Ye(["new-thread-project-mode-tab",{"is-active":no.value==="create"}]),type:"button",role:"tab","aria-selected":no.value==="create",disabled:Kn.value,onClick:d[30]||(d[30]=_=>no.value="create")},k(v(s)("New project")),11,lU),f("button",{class:Ye(["new-thread-project-mode-tab",{"is-active":no.value==="clone"}]),type:"button",role:"tab","aria-selected":no.value==="clone",disabled:Kn.value,onClick:d[31]||(d[31]=_=>no.value="clone")},k(v(s)("Clone from GitHub")),11,cU)],8,iU),f("label",uU,[f("span",dU,k(v(s)("Destination folder")),1),Nt(f("input",{"onUpdate:modelValue":d[32]||(d[32]=_=>ns.value=_),class:"new-thread-open-folder-path",type:"text",disabled:Kn.value,placeholder:v(s)("Destination folder")},null,8,fU),[[sn,ns.value]])]),no.value==="create"?(C(),I("label",pU,[f("span",hU,k(v(s)("Project name")),1),Nt(f("input",{ref_key:"projectSetupPrimaryInputRef",ref:rs,"onUpdate:modelValue":d[33]||(d[33]=_=>os.value=_),class:"new-thread-open-folder-create-input",type:"text",disabled:Kn.value,placeholder:v(s)("Project name"),onKeydown:xn(st(od,["prevent"]),["enter"])},null,40,mU),[[sn,os.value]])])):no.value==="clone"?(C(),I("label",vU,[f("span",gU,k(v(s)("GitHub repository URL")),1),Nt(f("input",{ref_key:"projectSetupPrimaryInputRef",ref:rs,"onUpdate:modelValue":d[34]||(d[34]=_=>Es.value=_),class:"new-thread-open-folder-create-input",type:"url",disabled:Kn.value,placeholder:"https://github.com/owner/repo",onKeydown:xn(st(od,["prevent"]),["enter"])},null,40,yU),[[sn,Es.value]])])):Z("",!0),La.value?(C(),I("div",wU,[f("span",null,k(La.value),1),f("a",{class:"visible-error-feedback",href:v(tn),onClick:d[35]||(d[35]=_=>Sn(_,La.value))},k(v(s)("Send feedback")),9,bU)])):Z("",!0),f("div",TU,[f("button",{class:"new-thread-folder-action",type:"button",disabled:Kn.value,onClick:Ec},k(v(s)("Cancel")),9,kU),f("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!ip.value||Kn.value,onClick:od},k(Wy.value),9,CU)])],40,oU)],32)):Z("",!0)])),gi.value?(C(),Ze(O$,{key:2,class:"new-thread-runtime-dropdown",modelValue:Nn.value,"onUpdate:modelValue":d[36]||(d[36]=_=>Nn.value=_)},null,8,["modelValue"])):Z("",!0),Nn.value==="worktree"?(C(),I("div",SU,[f("p",_U,k(v(s)("Base branch")),1),Me(Zo,{class:"new-thread-branch-dropdown","model-value":fo.value,options:Gu.value,placeholder:v(s)("Select branch"),"enable-search":!0,"search-placeholder":v(s)("Search branches..."),disabled:En.value||Gu.value.length===0,"onUpdate:modelValue":fb},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),f("p",xU,k(En.value?v(s)("Loading branches…"):op.value?v(s)("New worktree branch will start from {branch}.",{branch:op.value}):v(s)("No Git branches found for this folder.")),1)])):Z("",!0),gi.value?(C(),I("p",AU,k(v(s)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):Z("",!0),Jt.value.phase!=="idle"?(C(),I("div",{key:5,class:Ye(["worktree-init-status",{"is-running":Jt.value.phase==="running","is-error":Jt.value.phase==="error"}])},[f("strong",IU,k(Jt.value.title),1),f("span",PU,k(Jt.value.message),1)],2)):Z("",!0)]),f("div",RU,[v(Re)?(C(),I("div",EU,[f("span",null,k(v(s)(v(Re))),1),f("a",{class:"visible-error-feedback",href:v(tn),onClick:d[37]||(d[37]=_=>Sn(_,v(Re)))},k(v(s)("Send feedback")),9,MU)])):Z("",!0),Me(Fm,{ref_key:"homeThreadComposerRef",ref:mn,"active-thread-id":Qo.value,cwd:_n.value,"fuzzy-file-search-results":v(Te),onRegisterFuzzySession:v(Be),"collaboration-modes":v(Ie),"selected-collaboration-mode":v(Se),models:v(De),"model-reasoning-efforts":v(fe),"selected-model":Pl.value,"selected-reasoning-effort":v(_e),"selected-speed-mode":v(Pe),"is-updating-speed-mode":v(ee),skills:v(Ue),"thread-token-usage":v(F),"codex-quota":v(je),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":Ia.value,"in-progress-submit-mode":Pa.value,"dictation-click-to-toggle":na.value,"dictation-auto-send":Eo.value,"dictation-language":Ea.value,onSubmit:xp,"onUpdate:selectedCollaborationMode":Up,"onUpdate:selectedModel":jp,"onUpdate:selectedReasoningEffort":Lp,"onUpdate:selectedSpeedMode":Np,"approval-policy":Ka.value,"is-approval-policy-saving":Ss.value,"approval-policy-error":Vn.value,"approval-policy-notice":$r.value,"onUpdate:approvalPolicy":Di,onSaveApprovalPolicy:Fn,onSlashCommand:Op},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"])])])):(C(),I("div",$U,[Wn.value&&v(ge)&&_n.value?(C(),Ze(v(o),{key:0,"thread-id":v(ge),cwd:_n.value,"is-thread-in-progress":zi.value,"initial-file-path":Ca.value,"commit-sha":pr.value,onClose:d[38]||(d[38]=_=>Wn.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress","initial-file-path","commit-sha"])):(C(),I(qe,{key:1},[f("div",jU,[Me(v(t),{ref_key:"threadConversationRef",ref:Ar,messages:ct.value,"is-loading":v(wt),"active-thread-id":Qo.value,cwd:_n.value,"live-overlay":js.value,"live-turn-id":v(ve),"pending-requests":v(H),"has-more-persisted-above":v(ft),"is-loading-persisted-above":v(St),"load-earlier-messages":v(be),onForkThread:Zw,onRollback:qb,onFileChangesChanged:Qy,onRespondServerRequest:yp},null,8,["messages","is-loading","active-thread-id","cwd","live-overlay","live-turn-id","pending-requests","has-more-persisted-above","is-loading-persisted-above","load-earlier-messages"])]),f("div",{class:"composer-with-queue",ref_key:"composerQueueRef",ref:Ln},[El.value?(C(),I("div",LU,k(v(s)("This thread is running in the Codex TUI")),1)):Z("",!0),v(Re)?(C(),I("div",NU,[f("span",null,k(v(s)(v(Re))),1),f("a",{class:"visible-error-feedback",href:v(tn),onClick:d[39]||(d[39]=_=>Sn(_,v(Re)))},k(v(s)("Send feedback")),9,OU)])):Z("",!0),Me(C$,{messages:v(G),onEdit:ub,onSteer:v(Ne),onDelete:v(K),onReorder:Bb},null,8,["messages","onSteer","onDelete"]),Dl.value?(C(),I("div",DU,[f("span",null,k(Dl.value),1),f("button",{type:"button",class:"interrupt-recovered-dismiss","aria-label":v(s)("Dismiss"),onClick:d[40]||(d[40]=_=>Dl.value="")}," × ",8,FU)])):Z("",!0),Oa.value?(C(),Ze(d$,{key:3,request:Oa.value,"request-count":v(H).length,"has-queue-above":v(G).length>0,"panel-width":co.value,"visual-viewport-height":Ls.value?ra.value:0,"panel-error":mi.value,onRespondServerRequest:yp},null,8,["request","request-count","has-queue-above","panel-width","visual-viewport-height","panel-error"])):(C(),Ze(Fm,{key:4,ref_key:"threadComposerRef",ref:xr,"active-thread-id":Qo.value,cwd:_n.value,"fuzzy-file-search-results":v(Te),onRegisterFuzzySession:v(Be),"collaboration-modes":v(Ie),"selected-collaboration-mode":v(Se),models:v(De),"model-reasoning-efforts":v(fe),"selected-model":Pl.value,"selected-reasoning-effort":v(_e),"selected-speed-mode":v(Pe),"is-updating-speed-mode":v(ee),skills:v(Ue),"thread-token-usage":v(F),"codex-quota":v(je),"is-turn-in-progress":zi.value,"is-stop-pending":v(re),"is-interrupting-turn":v(et),"is-compacting":_c.value,"external-session-active":El.value,"has-queue-above":v(G).length>0,"send-with-enter":Ia.value,"in-progress-submit-mode":Pa.value,"dictation-click-to-toggle":na.value,"dictation-auto-send":Eo.value,"dictation-language":Ea.value,"onUpdate:selectedCollaborationMode":Up,onSubmit:xp,"onUpdate:selectedModel":jp,"onUpdate:selectedReasoningEffort":Lp,"onUpdate:selectedSpeedMode":Np,"approval-policy":Ka.value,"is-approval-policy-saving":Ss.value,"approval-policy-error":Vn.value,"approval-policy-notice":$r.value,"onUpdate:approvalPolicy":Di,onSaveApprovalPolicy:Fn,"plan-panel":hi.value,onInterrupt:Ub,onSlashCommand:Op,onImplementPlan:zb,onCompactContext:Da},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)],64))]))])],6),v(Et)&&Jn.value?(C(),I("div",{key:0,class:"content-right-panel-backdrop",role:"presentation",onClick:Tp})):Z("",!0),vi.value&&(v(Et)||!Ao.value)?(C(),I("aside",{key:1,class:Ye(["content-right-panel",{"is-mobile-open":Jn.value}]),style:kr({"--right-panel-width":`${qo.value}px`})},[v(Et)?Z("",!0):(C(),I("div",{key:0,class:"content-right-panel-resize-handle","aria-hidden":"true",onMousedown:Io},null,32)),f("div",BU,[f("div",UU,[f("button",{class:Ye(["content-right-panel-tab",{"is-active":Ot.value==="git"}]),type:"button",role:"tab","aria-selected":Ot.value==="git",onClick:d[41]||(d[41]=_=>wi("git"))},[Me(bu,{class:"content-right-panel-tab-icon"}),vs(" "+k(v(s)("Git")),1)],10,qU),f("button",{class:Ye(["content-right-panel-tab",{"is-active":Ot.value==="files"}]),type:"button",role:"tab","aria-selected":Ot.value==="files",onClick:d[42]||(d[42]=_=>wi("files"))},[Me(qm,{class:"content-right-panel-tab-icon"}),vs(" "+k(v(s)("Files")),1)],10,zU),(C(!0),I(qe,null,At(Zn.value,_=>(C(),I("button",{key:_.key,class:Ye(["content-right-panel-tab content-right-panel-tab--preview",{"is-active":Ot.value==="preview"&&_o.value===_.key}]),type:"button",role:"tab","aria-selected":Ot.value==="preview"&&_o.value===_.key,title:_.path,onClick:$=>tb(_.key)},[Me(Li,{class:"content-right-panel-tab-icon"}),f("span",WU,k(_.label),1),f("span",{class:"content-right-panel-tab-close",role:"button","aria-label":v(s)("Close"),title:v(s)("Close"),onClick:st($=>nb(_.key),["stop"])},"×",8,VU)],10,HU))),128))]),f("div",GU,[f("div",KU,[f("button",{ref:"rightPanelAddButtonRef",class:"content-right-panel-add",type:"button","aria-label":v(s)("Add panel"),title:v(s)("Add panel"),onClick:d[43]||(d[43]=st(_=>xo.value=!xo.value,["stop"]))},"+",8,YU),Me(bc,{name:"right-panel-menu"},{default:mt(()=>[xo.value?(C(),I("div",JU,[f("button",{type:"button",onClick:d[44]||(d[44]=_=>wi("terminal"))},[Me(wN,{class:"content-right-panel-menu-icon"}),vs(" "+k(v(s)("Terminal panel")),1)]),f("button",{type:"button",onClick:d[45]||(d[45]=_=>wi("git"))},[Me(bu,{class:"content-right-panel-menu-icon"}),vs(" "+k(v(s)("Git panel")),1)]),f("button",{type:"button",onClick:d[46]||(d[46]=_=>wi("files"))},[Me(qm,{class:"content-right-panel-menu-icon"}),vs(" "+k(v(s)("Files panel")),1)])])):Z("",!0)]),_:1})]),f("button",{class:"content-right-panel-close",type:"button","aria-label":v(s)("Close panel"),title:v(s)("Close panel"),onClick:Tp},[Me(ru,{class:"content-right-panel-close-icon"})],8,QU)])]),f("div",XU,[Ot.value==="git"?(C(),Ze(EL,{key:0,"current-branch":Ro.value,"head-sha":Sa.value,"head-subject":jr.value,"head-date":_a.value,detached:Vo.value,dirty:Ja.value,"worktree-change-summary":hr.value,"worktree-changes":mo.value,branches:eo.value,"commits-by-branch":Zr.value,"commits-loading-for":mr.value,"commits-error":vr.value,"commit-files-by-sha":Qa.value,"commit-files-loading-for":gr.value,"commit-files-error":Is.value,loading:Xa.value,busy:ea.value,error:Lr.value,"review-open":Wn.value,"show-review":v(Tt).name==="thread"&&v(ge).length>0,onToggleReview:yb,onCheckoutBranch:hb,onResetBranchToCommit:mb,onLoadCommits:Pp,onLoadCommitFiles:vb,onOpenCommitFile:gb},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"])):Ot.value==="files"?(C(),Ze(VL,{key:1,cwd:_n.value,onOpenPreview:eb},null,8,["cwd"])):Ot.value==="preview"&&Ir.value?(C(),Ze(lN,{key:2,"file-path":Ir.value.path,name:Ir.value.label},null,8,["file-path","name"])):(C(),Ze(v(n),{key:3,ref_key:"threadTerminalPanelRef",ref:uo,"thread-id":Qo.value,cwd:_n.value,onHide:rb,onTerminalFocusChange:ab},null,8,["thread-id","cwd"]))])],6)):Z("",!0)])]),_:1},8,["is-sidebar-collapsed"]),_t.value.phase!=="idle"?(C(),I("div",ZU,[f("div",{class:"project-zip-modal",role:"dialog","aria-modal":"true","aria-label":v(s)("Export Project"),onClick:d[48]||(d[48]=st(()=>{},["stop"]))},[f("div",t4,[f("h2",n4,k(v(s)("Export Project")),1),f("button",{class:"project-zip-modal-close",type:"button","aria-label":v(s)("Close"),disabled:_t.value.phase==="exporting",onClick:vp}," × ",8,o4)]),f("p",r4,k(_t.value.phase==="exporting"?v(s)("Preparing project ZIP..."):_t.value.fileName),1),f("div",a4,[f("span",null,k(_t.value.phase==="exporting"?v(s)("Exporting"):v(s)("Ready")),1),f("span",null,k(kl.value),1)]),f("div",s4,[f("div",{class:"project-zip-progress-fill",style:kr({width:Ma.value})},null,4)]),_t.value.error?(C(),I("p",i4,k(_t.value.error),1)):Z("",!0),f("div",l4,[f("button",{class:"project-zip-modal-cancel",type:"button",disabled:_t.value.phase==="exporting",onClick:vp},k(v(s)("Close")),9,c4),f("button",{class:"project-zip-modal-action",type:"button",disabled:!_t.value.blob,onClick:qw},k(v(s)("Download")),9,u4),f("button",{class:"project-zip-modal-action project-zip-modal-action-primary",type:"button",disabled:!_t.value.blob,onClick:zw},k(v(s)("Share")),9,d4)])],8,e4)])):Z("",!0),Za.value?(C(),I("div",{key:1,class:"codex-login-modal-backdrop",role:"presentation",onClick:Xu},[f("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":v(s)("Complete Codex login"),onSubmit:st(xw,["prevent"]),onClick:d[51]||(d[51]=st(()=>{},["stop"]))},[f("div",p4,[f("h2",h4,k(v(s)("Complete Codex login")),1),f("button",{class:"codex-login-modal-close",type:"button","aria-label":v(s)("Close"),disabled:Un.value,onClick:Xu}," × ",8,m4)]),f("p",v4,k(v(s)("Finish login in the browser, then paste the localhost callback URL here.")),1),Aa.value?(C(),I("a",{key:0,class:"codex-login-modal-link",href:Aa.value,target:"_blank",rel:"noreferrer"},k(v(s)("Open login URL")),9,g4)):Z("",!0),Nt(f("input",{ref_key:"codexLoginCallbackInputRef",ref:ci,"onUpdate:modelValue":d[49]||(d[49]=_=>Nr.value=_),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:v(s)("Paste localhost callback URL"),disabled:Un.value},null,8,y4),[[sn,Nr.value]]),wn.value?(C(),I("div",w4,[f("span",null,k(wn.value),1),f("a",{class:"visible-error-feedback",href:v(tn),onClick:d[50]||(d[50]=_=>Sn(_,wn.value))},k(v(s)("Send feedback")),9,b4)])):Z("",!0),f("div",T4,[f("button",{class:"codex-login-modal-cancel",type:"button",disabled:Un.value,onClick:Xu},k(v(s)("Cancel")),9,k4),f("button",{class:"codex-login-modal-submit",type:"submit",disabled:Un.value||Nr.value.trim().length===0},k(Un.value?v(s)("Completing…"):v(s)("Complete")),9,C4)])],40,f4)])):Z("",!0)],64))}}),P4=yt(I4,[["__scopeId","data-v-6551a133"]]),Zc={render:()=>null},R4=sS({history:DC(),routes:[{path:"/",name:"home",component:Zc},{path:"/thread/:threadId",name:"thread",component:Zc},{path:"/skills",name:"skills",component:Zc},{path:"/automations",name:"automations",component:Zc},{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");U1();Yk(P4).use(R4).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(my("Service worker registration failed."),e)})});export{xn as $,Hc as A,Wf as B,Gt as C,zm as D,M4 as E,qe as F,Nf as G,LP as H,ru as I,Hl as J,Tj as K,r1 as L,UN as M,Cs as N,J_ as O,L4 as P,$4 as Q,N4 as R,j4 as S,Qs as T,O4 as U,Zo as V,i3 as W,c3 as X,l3 as Y,E4 as Z,yt as _,I as a,Xf as a0,Nt as a1,sn as a2,lS as a3,iS as a4,B_ as a5,W4 as a6,D4 as a7,F4 as a8,B4 as a9,J4 as aa,t3 as ab,n3 as ac,V4 as ad,e3 as ae,q4 as af,U4 as ag,z4 as ah,H4 as ai,o3 as aj,a3 as ak,s3 as al,G4 as am,K4 as an,Y4 as ao,Q4 as ap,Z4 as aq,X4 as ar,r3 as as,TS as at,kS as au,Gs as av,GP as aw,f as b,Ze as c,en as d,Z as e,vs as f,Me as g,bc as h,mt as i,io as j,X as k,tt as l,Ni as m,Ye as n,C as o,kr as p,x as q,At as r,Cy as s,k as t,v as u,Zf as v,st as w,bu as x,er as y,Js as z};