codex-mobile-re 0.1.88

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.
Files changed (35) hide show
  1. package/LICENSE +11 -0
  2. package/README.md +278 -0
  3. package/dist/assets/AutomationsPanel-Dp8RsslP.js +1 -0
  4. package/dist/assets/AutomationsPanel-VRBbmMYW.css +1 -0
  5. package/dist/assets/DirectoryHub-BOxKTf5g.js +2 -0
  6. package/dist/assets/DirectoryHub-CIkiWzxh.css +1 -0
  7. package/dist/assets/ReviewPane-BI8SWSDv.js +1 -0
  8. package/dist/assets/ReviewPane-Q55bhcnB.css +1 -0
  9. package/dist/assets/ThreadConversation-DYiDMOhU.js +39 -0
  10. package/dist/assets/ThreadConversation-DoR0Kazk.css +1 -0
  11. package/dist/assets/ThreadTerminalPanel-CgxRx_qQ.js +38 -0
  12. package/dist/assets/ThreadTerminalPanel-O7IxAyfy.css +32 -0
  13. package/dist/assets/common-BeuopZEI.js +5 -0
  14. package/dist/assets/index-8nj0j9KO.css +1 -0
  15. package/dist/assets/index-BrpaGwQT.js +86 -0
  16. package/dist/assets/index.esm-Bx2Y2PLG.js +376 -0
  17. package/dist/assets/index.esm-Cxn_LBGD.js +16 -0
  18. package/dist/assets/index.esm-DYMAm9mq.js +1666 -0
  19. package/dist/assets/sanitizeHtml-LuNwludj.js +1 -0
  20. package/dist/icons/apple-touch-icon.png +0 -0
  21. package/dist/icons/codexui-icon.svg +52 -0
  22. package/dist/icons/maskable-512x512.png +0 -0
  23. package/dist/icons/pwa-192x192.png +0 -0
  24. package/dist/icons/pwa-512x512.png +0 -0
  25. package/dist/icons/pwa-icon.svg +38 -0
  26. package/dist/icons/pwa-maskable.svg +36 -0
  27. package/dist/index.html +21 -0
  28. package/dist/manifest.webmanifest +36 -0
  29. package/dist/sw.js +92 -0
  30. package/dist-cli/index.js +16110 -0
  31. package/dist-cli/index.js.map +1 -0
  32. package/package.json +84 -0
  33. package/scripts/dev-random-home.cjs +21 -0
  34. package/scripts/dev.cjs +69 -0
  35. package/scripts/fix-pty-native-build.cjs +70 -0
@@ -0,0 +1,86 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-DYiDMOhU.js","assets/sanitizeHtml-LuNwludj.js","assets/ThreadConversation-DoR0Kazk.css","assets/ThreadTerminalPanel-CgxRx_qQ.js","assets/ThreadTerminalPanel-O7IxAyfy.css","assets/ReviewPane-BI8SWSDv.js","assets/ReviewPane-Q55bhcnB.css","assets/DirectoryHub-BOxKTf5g.js","assets/DirectoryHub-CIkiWzxh.css","assets/AutomationsPanel-Dp8RsslP.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 s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();/**
3
+ * @vue/shared v3.5.40
4
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
5
+ * @license MIT
6
+ **/function Jf(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const tn={},yl=[],Ya=()=>{},jv=()=>!1,Qc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Xc=e=>e.startsWith("onUpdate:"),Un=Object.assign,Qf=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},u_=Object.prototype.hasOwnProperty,qt=(e,t)=>u_.call(e,t),ft=Array.isArray,wl=e=>Iu(e)==="[object Map]",Zc=e=>Iu(e)==="[object Set]",ch=e=>Iu(e)==="[object Date]",bt=e=>typeof e=="function",dn=e=>typeof e=="string",Ca=e=>typeof e=="symbol",Ht=e=>e!==null&&typeof e=="object",Nv=e=>(Ht(e)||bt(e))&&bt(e.then)&&bt(e.catch),Lv=Object.prototype.toString,Iu=e=>Lv.call(e),c_=e=>Iu(e).slice(8,-1),Ov=e=>Iu(e)==="[object Object]",Xf=e=>dn(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,pu=Jf(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ed=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},d_=/-\w/g,Yo=ed(e=>e.replace(d_,t=>t.slice(1).toUpperCase())),f_=/\B([A-Z])/g,si=ed(e=>e.replace(f_,"-$1").toLowerCase()),td=ed(e=>e.charAt(0).toUpperCase()+e.slice(1)),Dd=ed(e=>e?`on${td(e)}`:""),va=(e,t)=>!Object.is(e,t),Ic=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Dv=(e,t,n,o=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:o,value:n})},Zf=e=>{const t=parseFloat(e);return isNaN(t)?e:t},p_=e=>{const t=dn(e)?Number(e):NaN;return isNaN(t)?e:t};let dh;const nd=()=>dh||(dh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Vr(e){if(ft(e)){const t={};for(let n=0;n<e.length;n++){const o=e[n],r=dn(o)?g_(o):Vr(o);if(r)for(const s in r)t[s]=r[s]}return t}else if(dn(e)||Ht(e))return e}const h_=/;(?![^(]*\))/g,m_=/:([^]+)/,v_=/\/\*[^]*?\*\//g;function g_(e){const t={};return e.replace(v_,"").split(h_).forEach(n=>{if(n){const o=n.split(m_);o.length>1&&(t[o[0].trim()]=o[1].trim())}}),t}function Ke(e){let t="";if(dn(e))t=e;else if(ft(e))for(let n=0;n<e.length;n++){const o=Ke(e[n]);o&&(t+=o+" ")}else if(Ht(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const y_="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",w_=Jf(y_);function Fv(e){return!!e||e===""}function b_(e,t){if(e.length!==t.length)return!1;let n=!0;for(let o=0;n&&o<e.length;o++)n=Ru(e[o],t[o]);return n}function Ru(e,t){if(e===t)return!0;let n=ch(e),o=ch(t);if(n||o)return n&&o?e.getTime()===t.getTime():!1;if(n=Ca(e),o=Ca(t),n||o)return e===t;if(n=ft(e),o=ft(t),n||o)return n&&o?b_(e,t):!1;if(n=Ht(e),o=Ht(t),n||o){if(!n||!o)return!1;const r=Object.keys(e).length,s=Object.keys(t).length;if(r!==s)return!1;for(const a in e){const l=e.hasOwnProperty(a),f=t.hasOwnProperty(a);if(l&&!f||!l&&f||!Ru(e[a],t[a]))return!1}}return String(e)===String(t)}function Uv(e,t){return e.findIndex(n=>Ru(n,t))}const Bv=e=>!!(e&&e.__v_isRef===!0),k=e=>dn(e)?e:e==null?"":ft(e)||Ht(e)&&(e.toString===Lv||!bt(e.toString))?Bv(e)?k(e.value):JSON.stringify(e,qv,2):String(e),qv=(e,t)=>Bv(t)?qv(e,t.value):wl(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[o,r],s)=>(n[Fd(o,s)+" =>"]=r,n),{})}:Zc(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Fd(n))}:Ca(t)?Fd(t):Ht(t)&&!ft(t)&&!Ov(t)?String(t):t,Fd=(e,t="")=>{var n;return Ca(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 po;class __{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&&po&&(po.active?(this.parent=po,this.index=(po.scopes||(po.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=po;try{return po=this,t()}finally{po=n}}}on(){++this._on===1&&(this.prevScope=po,po=this)}off(){if(this._on>0&&--this._on===0){if(po===this)po=this.prevScope;else{let t=po;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 k_(){return po}let rn;const Ud=new WeakSet;class zv{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,po&&(po.active?po.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Ud.has(this)&&(Ud.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Wv(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,fh(this),Vv(this);const t=rn,n=ba;rn=this,ba=!0;try{return this.fn()}finally{Gv(this),rn=t,ba=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)np(t);this.deps=this.depsTail=void 0,fh(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Ud.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){yf(this)&&this.run()}get dirty(){return yf(this)}}let Hv=0,hu,mu;function Wv(e,t=!1){if(e.flags|=8,t){e.next=mu,mu=e;return}e.next=hu,hu=e}function ep(){Hv++}function tp(){if(--Hv>0)return;if(mu){let t=mu;for(mu=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;hu;){let t=hu;for(hu=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 Vv(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Gv(e){let t,n=e.depsTail,o=n;for(;o;){const r=o.prevDep;o.version===-1?(o===n&&(n=r),np(o),C_(o)):t=o,o.dep.activeLink=o.prevActiveLink,o.prevActiveLink=void 0,o=r}e.deps=t,e.depsTail=n}function yf(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Kv(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Kv(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===_u)||(e.globalVersion=_u,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!yf(e))))return;e.flags|=2;const t=e.dep,n=rn,o=ba;rn=e,ba=!0;try{Vv(e);const r=e.fn(e._value);(t.version===0||va(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{rn=n,ba=o,Gv(e),e.flags&=-3}}function np(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 s=n.computed.deps;s;s=s.nextDep)np(s,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function C_(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let ba=!0;const Yv=[];function Ts(){Yv.push(ba),ba=!1}function Ss(){const e=Yv.pop();ba=e===void 0?!0:e}function fh(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=rn;rn=void 0;try{t()}finally{rn=n}}}let _u=0;class T_{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 op{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(!rn||!ba||rn===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==rn)n=this.activeLink=new T_(rn,this),rn.deps?(n.prevDep=rn.depsTail,rn.depsTail.nextDep=n,rn.depsTail=n):rn.deps=rn.depsTail=n,Jv(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=rn.depsTail,n.nextDep=void 0,rn.depsTail.nextDep=n,rn.depsTail=n,rn.deps===n&&(rn.deps=o)}return n}trigger(t){this.version++,_u++,this.notify(t)}notify(t){ep();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{tp()}}}function Jv(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)Jv(o)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const wf=new WeakMap,Fi=Symbol(""),bf=Symbol(""),ku=Symbol("");function Io(e,t,n){if(ba&&rn){let o=wf.get(e);o||wf.set(e,o=new Map);let r=o.get(n);r||(o.set(n,r=new op),r.map=o,r.key=n),r.track()}}function bs(e,t,n,o,r,s){const a=wf.get(e);if(!a){_u++;return}const l=f=>{f&&f.trigger()};if(ep(),t==="clear")a.forEach(l);else{const f=ft(e),m=f&&Xf(n);if(f&&n==="length"){const g=Number(o);a.forEach((w,x)=>{(x==="length"||x===ku||!Ca(x)&&x>=g)&&l(w)})}else switch((n!==void 0||a.has(void 0))&&l(a.get(n)),m&&l(a.get(ku)),t){case"add":f?m&&l(a.get("length")):(l(a.get(Fi)),wl(e)&&l(a.get(bf)));break;case"delete":f||(l(a.get(Fi)),wl(e)&&l(a.get(bf)));break;case"set":wl(e)&&l(a.get(Fi));break}}tp()}function il(e){const t=Dt(e);return t===e?t:(Io(t,"iterate",ku),Gr(e)?t:t.map(Ta))}function od(e){return Io(e=Dt(e),"iterate",ku),e}function Ga(e,t){return xs(e)?xl(Ui(e)?Ta(t):t):Ta(t)}const S_={__proto__:null,[Symbol.iterator](){return Bd(this,Symbol.iterator,e=>Ga(this,e))},concat(...e){return il(this).concat(...e.map(t=>ft(t)?il(t):t))},entries(){return Bd(this,"entries",e=>(e[1]=Ga(this,e[1]),e))},every(e,t){return ps(this,"every",e,t,void 0,arguments)},filter(e,t){return ps(this,"filter",e,t,n=>n.map(o=>Ga(this,o)),arguments)},find(e,t){return ps(this,"find",e,t,n=>Ga(this,n),arguments)},findIndex(e,t){return ps(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return ps(this,"findLast",e,t,n=>Ga(this,n),arguments)},findLastIndex(e,t){return ps(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return ps(this,"forEach",e,t,void 0,arguments)},includes(...e){return qd(this,"includes",e)},indexOf(...e){return qd(this,"indexOf",e)},join(e){return il(this).join(e)},lastIndexOf(...e){return qd(this,"lastIndexOf",e)},map(e,t){return ps(this,"map",e,t,void 0,arguments)},pop(){return eu(this,"pop")},push(...e){return eu(this,"push",e)},reduce(e,...t){return ph(this,"reduce",e,t)},reduceRight(e,...t){return ph(this,"reduceRight",e,t)},shift(){return eu(this,"shift")},some(e,t){return ps(this,"some",e,t,void 0,arguments)},splice(...e){return eu(this,"splice",e)},toReversed(){return il(this).toReversed()},toSorted(e){return il(this).toSorted(e)},toSpliced(...e){return il(this).toSpliced(...e)},unshift(...e){return eu(this,"unshift",e)},values(){return Bd(this,"values",e=>Ga(this,e))}};function Bd(e,t,n){const o=od(e),r=o[t]();return o!==e&&!Gr(e)&&(r._next=r.next,r.next=()=>{const s=r._next();return s.done||(s.value=n(s.value)),s}),r}const x_=Array.prototype;function ps(e,t,n,o,r,s){const a=od(e),l=a!==e&&!Gr(e),f=a[t];if(f!==x_[t]){const w=f.apply(e,s);return l?Ta(w):w}let m=n;a!==e&&(l?m=function(w,x){return n.call(this,Ga(e,w),x,e)}:n.length>2&&(m=function(w,x){return n.call(this,w,x,e)}));const g=f.call(a,m,o);return l&&r?r(g):g}function ph(e,t,n,o){const r=od(e),s=r!==e&&!Gr(e);let a=n,l=!1;r!==e&&(s?(l=o.length===0,a=function(m,g,w){return l&&(l=!1,m=Ga(e,m)),n.call(this,m,Ga(e,g),w,e)}):n.length>3&&(a=function(m,g,w){return n.call(this,m,g,w,e)}));const f=r[t](a,...o);return l?Ga(e,f):f}function qd(e,t,n){const o=Dt(e);Io(o,"iterate",ku);const r=o[t](...n);return(r===-1||r===!1)&&sp(n[0])?(n[0]=Dt(n[0]),o[t](...n)):r}function eu(e,t,n=[]){Ts(),ep();const o=Dt(e)[t].apply(e,n);return tp(),Ss(),o}const A_=Jf("__proto__,__v_isRef,__isVue"),Qv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Ca));function P_(e){Ca(e)||(e=String(e));const t=Dt(this);return Io(t,"has",e),t.hasOwnProperty(e)}class Xv{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,s=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return s;if(n==="__v_raw")return o===(r?s?D_:ng:s?tg:eg).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(o)?t:void 0;const a=ft(t);if(!r){let f;if(a&&(f=S_[n]))return f;if(n==="hasOwnProperty")return P_}const l=Reflect.get(t,n,Mo(t)?t:o);if((Ca(n)?Qv.has(n):A_(n))||(r||Io(t,"get",n),s))return l;if(Mo(l)){const f=a&&Xf(n)?l:l.value;return r&&Ht(f)?kf(f):f}return Ht(l)?r?kf(l):rd(l):l}}class Zv extends Xv{constructor(t=!1){super(!1,t)}set(t,n,o,r){let s=t[n];const a=ft(t)&&Xf(n);if(!this._isShallow){const m=xs(s);if(!Gr(o)&&!xs(o)&&(s=Dt(s),o=Dt(o)),!a&&Mo(s)&&!Mo(o))return m||(s.value=o),!0}const l=a?Number(n)<t.length:qt(t,n),f=Reflect.set(t,n,o,Mo(t)?t:r);return t===Dt(r)&&f&&(l?va(o,s)&&bs(t,"set",n,o):bs(t,"add",n,o)),f}deleteProperty(t,n){const o=qt(t,n);t[n];const r=Reflect.deleteProperty(t,n);return r&&o&&bs(t,"delete",n,void 0),r}has(t,n){const o=Reflect.has(t,n);return(!Ca(n)||!Qv.has(n))&&Io(t,"has",n),o}ownKeys(t){return Io(t,"iterate",ft(t)?"length":Fi),Reflect.ownKeys(t)}}class E_ extends Xv{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const I_=new Zv,R_=new E_,M_=new Zv(!0);const _f=e=>e,uc=e=>Reflect.getPrototypeOf(e);function $_(e,t,n){return function(...o){const r=this.__v_raw,s=Dt(r),a=wl(s),l=e==="entries"||e===Symbol.iterator&&a,f=e==="keys"&&a,m=r[e](...o),g=n?_f:t?xl:Ta;return!t&&Io(s,"iterate",f?bf:Fi),Un(Object.create(m),{next(){const{value:w,done:x}=m.next();return x?{value:w,done:x}:{value:l?[g(w[0]),g(w[1])]:g(w),done:x}}})}}function cc(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function j_(e,t){const n={get(r){const s=this.__v_raw,a=Dt(s),l=Dt(r);e||(va(r,l)&&Io(a,"get",r),Io(a,"get",l));const{has:f}=uc(a),m=t?_f:e?xl:Ta;if(f.call(a,r))return m(s.get(r));if(f.call(a,l))return m(s.get(l));s!==a&&s.get(r)},get size(){const r=this.__v_raw;return!e&&Io(Dt(r),"iterate",Fi),r.size},has(r){const s=this.__v_raw,a=Dt(s),l=Dt(r);return e||(va(r,l)&&Io(a,"has",r),Io(a,"has",l)),r===l?s.has(r):s.has(r)||s.has(l)},forEach(r,s){const a=this,l=a.__v_raw,f=Dt(l),m=t?_f:e?xl:Ta;return!e&&Io(f,"iterate",Fi),l.forEach((g,w)=>r.call(s,m(g),m(w),a))}};return Un(n,e?{add:cc("add"),set:cc("set"),delete:cc("delete"),clear:cc("clear")}:{add(r){const s=Dt(this),a=uc(s),l=Dt(r),f=!t&&!Gr(r)&&!xs(r)?l:r;return a.has.call(s,f)||va(r,f)&&a.has.call(s,r)||va(l,f)&&a.has.call(s,l)||(s.add(f),bs(s,"add",f,f)),this},set(r,s){!t&&!Gr(s)&&!xs(s)&&(s=Dt(s));const a=Dt(this),{has:l,get:f}=uc(a);let m=l.call(a,r);m||(r=Dt(r),m=l.call(a,r));const g=f.call(a,r);return a.set(r,s),m?va(s,g)&&bs(a,"set",r,s):bs(a,"add",r,s),this},delete(r){const s=Dt(this),{has:a,get:l}=uc(s);let f=a.call(s,r);f||(r=Dt(r),f=a.call(s,r)),l&&l.call(s,r);const m=s.delete(r);return f&&bs(s,"delete",r,void 0),m},clear(){const r=Dt(this),s=r.size!==0,a=r.clear();return s&&bs(r,"clear",void 0,void 0),a}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=$_(r,e,t)}),n}function rp(e,t){const n=j_(e,t);return(o,r,s)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?o:Reflect.get(qt(n,r)&&r in o?n:o,r,s)}const N_={get:rp(!1,!1)},L_={get:rp(!1,!0)},O_={get:rp(!0,!1)};const eg=new WeakMap,tg=new WeakMap,ng=new WeakMap,D_=new WeakMap;function F_(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function rd(e){return xs(e)?e:ap(e,!1,I_,N_,eg)}function og(e){return ap(e,!1,M_,L_,tg)}function kf(e){return ap(e,!0,R_,O_,ng)}function ap(e,t,n,o,r){if(!Ht(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const s=r.get(e);if(s)return s;const a=F_(c_(e));if(a===0)return e;const l=new Proxy(e,a===2?o:n);return r.set(e,l),l}function Ui(e){return xs(e)?Ui(e.__v_raw):!!(e&&e.__v_isReactive)}function xs(e){return!!(e&&e.__v_isReadonly)}function Gr(e){return!!(e&&e.__v_isShallow)}function sp(e){return e?!!e.__v_raw:!1}function Dt(e){const t=e&&e.__v_raw;return t?Dt(t):e}function U_(e){return!qt(e,"__v_skip")&&Object.isExtensible(e)&&Dv(e,"__v_skip",!0),e}const Ta=e=>Ht(e)?rd(e):e,xl=e=>Ht(e)?kf(e):e;function Mo(e){return e?e.__v_isRef===!0:!1}function S(e){return rg(e,!1)}function B_(e){return rg(e,!0)}function rg(e,t){return Mo(e)?e:new q_(e,t)}class q_{constructor(t,n){this.dep=new op,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Dt(t),this._value=n?t:Ta(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,o=this.__v_isShallow||Gr(t)||xs(t);t=o?t:Dt(t),va(t,n)&&(this._rawValue=t,this._value=o?t:Ta(t),this.dep.trigger())}}function v(e){return Mo(e)?e.value:e}const z_={get:(e,t,n)=>t==="__v_raw"?e:v(Reflect.get(e,t,n)),set:(e,t,n,o)=>{const r=e[t];return Mo(r)&&!Mo(n)?(r.value=n,!0):Reflect.set(e,t,n,o)}};function ag(e){return Ui(e)?e:new Proxy(e,z_)}class H_{constructor(t,n,o){this.fn=t,this.setter=n,this._value=void 0,this.dep=new op(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=_u-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=o}notify(){if(this.flags|=16,!(this.flags&8)&&rn!==this)return Wv(this,!0),!0}get value(){const t=this.dep.track();return Kv(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function W_(e,t,n=!1){let o,r;return bt(e)?o=e:(o=e.get,r=e.set),new H_(o,r,n)}const dc={},Dc=new WeakMap;let Ri;function V_(e,t=!1,n=Ri){if(n){let o=Dc.get(n);o||Dc.set(n,o=[]),o.push(e)}}function G_(e,t,n=tn){const{immediate:o,deep:r,once:s,scheduler:a,augmentJob:l,call:f}=n,m=X=>r?X:Gr(X)||r===!1||r===0?_s(X,1):_s(X);let g,w,x,R,L=!1,B=!1;if(Mo(e)?(w=()=>e.value,L=Gr(e)):Ui(e)?(w=()=>m(e),L=!0):ft(e)?(B=!0,L=e.some(X=>Ui(X)||Gr(X)),w=()=>e.map(X=>{if(Mo(X))return X.value;if(Ui(X))return m(X);if(bt(X))return f?f(X,2):X()})):bt(e)?t?w=f?()=>f(e,2):e:w=()=>{if(x){Ts();try{x()}finally{Ss()}}const X=Ri;Ri=g;try{return f?f(e,3,[R]):e(R)}finally{Ri=X}}:w=Ya,t&&r){const X=w,ye=r===!0?1/0:r;w=()=>_s(X(),ye)}const Y=k_(),ae=()=>{g.stop(),Y&&Y.active&&Qf(Y.effects,g)};if(s&&t){const X=t;t=(...ye)=>{const Me=X(...ye);return ae(),Me}}let z=B?new Array(e.length).fill(dc):dc;const Z=X=>{if(!(!(g.flags&1)||!g.dirty&&!X))if(t){const ye=g.run();if(X||r||L||(B?ye.some((Me,Se)=>va(Me,z[Se])):va(ye,z))){x&&x();const Me=Ri;Ri=g;try{const Se=[ye,z===dc?void 0:B&&z[0]===dc?[]:z,R];z=ye,f?f(t,3,Se):t(...Se)}finally{Ri=Me}}}else g.run()};return l&&l(Z),g=new zv(w),g.scheduler=a?()=>a(Z,!1):Z,R=X=>V_(X,!1,g),x=g.onStop=()=>{const X=Dc.get(g);if(X){if(f)f(X,4);else for(const ye of X)ye();Dc.delete(g)}},t?o?Z(!0):z=g.run():a?a(Z.bind(null,!0),!0):g.run(),ae.pause=g.pause.bind(g),ae.resume=g.resume.bind(g),ae.stop=ae,ae}function _s(e,t=1/0,n){if(t<=0||!Ht(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Mo(e))_s(e.value,t,n);else if(ft(e))for(let o=0;o<e.length;o++)_s(e[o],t,n);else if(Zc(e)||wl(e))e.forEach(o=>{_s(o,t,n)});else if(Ov(e)){for(const o in e)_s(e[o],t,n);for(const o of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,o)&&_s(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 Mu(e,t,n,o){try{return o?e(...o):e()}catch(r){$u(r,t,n)}}function Yr(e,t,n,o){if(bt(e)){const r=Mu(e,t,n,o);return r&&Nv(r)&&r.catch(s=>{$u(s,t,n)}),r}if(ft(e)){const r=[];for(let s=0;s<e.length;s++)r.push(Yr(e[s],t,n,o));return r}}function $u(e,t,n,o=!0){const r=t?t.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:a}=t&&t.appContext.config||tn;if(t){let l=t.parent;const f=t.proxy,m=`https://vuejs.org/error-reference/#runtime-${n}`;for(;l;){const g=l.ec;if(g){for(let w=0;w<g.length;w++)if(g[w](e,f,m)===!1)return}l=l.parent}if(s){Ts(),Mu(s,null,10,[e,f,m]),Ss();return}}K_(e,n,r,o,a)}function K_(e,t,n,o=!0,r=!1){if(r)throw e;console.error(e)}const Go=[];let Va=-1;const bl=[];let ei=null,pl=0;const sg=Promise.resolve();let Fc=null;function zt(e){const t=Fc||sg;return e?t.then(this?e.bind(this):e):t}function Y_(e){let t=Va+1,n=Go.length;for(;t<n;){const o=t+n>>>1,r=Go[o],s=Cu(r);s<e||s===e&&r.flags&2?t=o+1:n=o}return t}function ip(e){if(!(e.flags&1)){const t=Cu(e),n=Go[Go.length-1];!n||!(e.flags&2)&&t>=Cu(n)?Go.push(e):Go.splice(Y_(t),0,e),e.flags|=1,ig()}}function ig(){Fc||(Fc=sg.then(ug))}function J_(e){ft(e)?bl.push(...e):ei&&e.id===-1?ei.splice(pl+1,0,e):e.flags&1||(bl.push(e),e.flags|=1),ig()}function hh(e,t,n=Va+1){for(;n<Go.length;n++){const o=Go[n];if(o&&o.flags&2){if(e&&o.id!==e.uid)continue;Go.splice(n,1),n--,o.flags&4&&(o.flags&=-2),o(),o.flags&4||(o.flags&=-2)}}}function lg(e){if(bl.length){const t=[...new Set(bl)].sort((n,o)=>Cu(n)-Cu(o));if(bl.length=0,ei){ei.push(...t);return}for(ei=t,pl=0;pl<ei.length;pl++){const n=ei[pl];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}ei=null,pl=0}}const Cu=e=>e.id==null?e.flags&2?-1:1/0:e.id;function ug(e){try{for(Va=0;Va<Go.length;Va++){const t=Go[Va];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Mu(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Va<Go.length;Va++){const t=Go[Va];t&&(t.flags&=-2)}Va=-1,Go.length=0,lg(),Fc=null,(Go.length||bl.length)&&ug()}}let mo=null,cg=null;function Uc(e){const t=mo;return mo=e,cg=e&&e.type.__scopeId||null,t}function tt(e,t=mo,n){if(!t||e._n)return e;const o=(...r)=>{o._d&&zc(-1);const s=Uc(t),a=Cs.length;let l;try{l=e(...r)}finally{for(let f=Cs.length;f>a;f--)pp();Uc(s),o._d&&zc(1)}return l};return o._n=!0,o._c=!0,o._d=!0,o}function Nt(e,t){if(mo===null)return e;const n=ld(mo),o=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[s,a,l,f=tn]=t[r];s&&(bt(s)&&(s={mounted:s,updated:s}),s.deep&&_s(a),o.push({dir:s,instance:n,value:a,oldValue:void 0,arg:l,modifiers:f}))}return e}function Ai(e,t,n,o){const r=e.dirs,s=t&&t.dirs;for(let a=0;a<r.length;a++){const l=r[a];s&&(l.oldValue=s[a].value);let f=l.dir[o];f&&(Ts(),Yr(f,n,8,[e.el,l,e,t]),Ss())}}function Rc(e,t){if(ho){let n=ho.provides;const o=ho.parent&&ho.parent.provides;o===n&&(n=ho.provides=Object.create(o)),n[e]=t}}function _a(e,t,n=!1){const o=hp();if(o||kl){let r=kl?kl._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&&bt(t)?t.call(o&&o.proxy):t}}const Q_=Symbol.for("v-scx"),X_=()=>_a(Q_);function rt(e,t,n){return dg(e,t,n)}function dg(e,t,n=tn){const{immediate:o,deep:r,flush:s,once:a}=n,l=Un({},n),f=t&&o||!t&&s!=="post";let m;if(Pl){if(s==="sync"){const R=X_();m=R.__watcherHandles||(R.__watcherHandles=[])}else if(!f){const R=()=>{};return R.stop=Ya,R.resume=Ya,R.pause=Ya,R}}const g=ho;l.call=(R,L,B)=>Yr(R,g,L,B);let w=!1;s==="post"?l.scheduler=R=>{Wo(R,g&&g.suspense)}:s!=="sync"&&(w=!0,l.scheduler=(R,L)=>{L?R():ip(R)}),l.augmentJob=R=>{t&&(R.flags|=4),w&&(R.flags|=2,g&&(R.id=g.uid,R.i=g))};const x=G_(e,t,l);return Pl&&(m?m.push(x):f&&x()),x}function Z_(e,t,n){const o=this.proxy,r=dn(e)?e.includes(".")?fg(o,e):()=>o[e]:e.bind(o,o);let s;bt(t)?s=t:(s=t.handler,n=t);const a=Lu(this),l=dg(r,s.bind(o),n);return a(),l}function fg(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 Xs=new WeakMap,pg=Symbol("_vte"),hg=e=>e.__isTeleport,$i=e=>e&&(e.disabled||e.disabled===""),e0=e=>e&&(e.defer||e.defer===""),mh=e=>typeof SVGElement<"u"&&e instanceof SVGElement,vh=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Cf=(e,t)=>{const n=e&&e.to;return dn(n)?t?t(n):null:n},t0={name:"Teleport",__isTeleport:!0,process(e,t,n,o,r,s,a,l,f,m){const{mc:g,pc:w,pbc:x,o:{insert:R,querySelector:L,createText:B,createComment:Y,parentNode:ae}}=m,z=$i(t.props);let{dynamicChildren:Z}=t;const X=(Se,Fe,pe)=>{Se.shapeFlag&16&&g(Se.children,Fe,pe,r,s,a,l,f)},ye=(Se=t)=>{const Fe=$i(Se.props),pe=Se.target=Cf(Se.props,L),Ue=Tf(pe,Se,B,R);pe&&(a!=="svg"&&mh(pe)?a="svg":a!=="mathml"&&vh(pe)&&(a="mathml"),r&&r.isCE&&(r.ce._teleportTargets||(r.ce._teleportTargets=new Set)).add(pe),Fe||(X(Se,pe,Ue),lu(Se,!1)))},Me=Se=>{const Fe=()=>{if(Xs.get(Se)===Fe){if(Xs.delete(Se),$i(Se.props)){const pe=ae(Se.el)||n;X(Se,pe,Se.anchor),lu(Se,!0)}ye(Se)}};Xs.set(Se,Fe),Wo(Fe,s)};if(e==null){const Se=t.el=B(""),Fe=t.anchor=B("");if(R(Se,n,o),R(Fe,n,o),e0(t.props)||s&&s.pendingBranch){Me(t);return}z&&(X(t,n,Fe),lu(t,!0)),ye()}else{t.el=e.el;const Se=t.anchor=e.anchor,Fe=Xs.get(e);if(Fe){Fe.flags|=8,Xs.delete(e),Me(t);return}t.targetStart=e.targetStart;const pe=t.target=e.target,Ue=t.targetAnchor=e.targetAnchor,$e=$i(e.props),he=$e?n:pe,Te=$e?Se:Ue;if(a==="svg"||mh(pe)?a="svg":(a==="mathml"||vh(pe))&&(a="mathml"),Z?(x(e.dynamicChildren,Z,he,r,s,a,l),fp(e,t,!0)):f||w(e,t,he,Te,r,s,a,l,!1),z)$e?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):fc(t,n,Se,m,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const Ae=Cf(t.props,L);Ae&&(t.target=Ae,fc(t,Ae,null,m,0))}else $e&&fc(t,pe,Ue,m,1);lu(t,z)}},remove(e,t,n,{um:o,o:{remove:r}},s){const{shapeFlag:a,children:l,anchor:f,targetStart:m,targetAnchor:g,target:w,props:x}=e,R=$i(x),L=s||!R,B=Xs.get(e);if(B&&(B.flags|=8,Xs.delete(e)),w&&(r(m),r(g)),s&&r(f),!B&&(R||w)&&a&16)for(let Y=0;Y<l.length;Y++){const ae=l[Y];o(ae,t,n,L,!!ae.dynamicChildren)}},move:fc,hydrate:n0};function fc(e,t,n,{o:{insert:o},m:r},s=2){s===0&&o(e.targetAnchor,t,n);const{el:a,anchor:l,shapeFlag:f,children:m,props:g}=e,w=s===2;if(w&&o(a,t,n),!Xs.has(e)&&(!w||$i(g))&&f&16)for(let x=0;x<m.length;x++)r(m[x],t,n,2);w&&o(l,t,n)}function n0(e,t,n,o,r,s,{o:{nextSibling:a,parentNode:l,querySelector:f,insert:m,createText:g}},w){function x(Y,ae){let z=ae;for(;z;){if(z&&z.nodeType===8){if(z.data==="teleport start anchor")t.targetStart=z;else if(z.data==="teleport anchor"){t.targetAnchor=z,Y._lpa=t.targetAnchor&&a(t.targetAnchor);break}}z=a(z)}}function R(Y,ae){ae.anchor=w(a(Y),ae,l(Y),n,o,r,s)}const L=t.target=Cf(t.props,f),B=$i(t.props);if(L){const Y=L._lpa||L.firstChild;t.shapeFlag&16&&(B?(R(e,t),x(L,Y),t.targetAnchor||Tf(L,t,g,m,l(e)===L?e:null)):(t.anchor=a(e),x(L,Y),t.targetAnchor||Tf(L,t,g,m),w(Y&&a(Y),t,L,n,o,r,s))),lu(t,B)}else B&&t.shapeFlag&16&&(R(e,t),t.targetStart=e,t.targetAnchor=a(e));return t.anchor&&a(t.anchor)}const Bi=t0;function lu(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 Tf(e,t,n,o,r=null){const s=t.targetStart=n(""),a=t.targetAnchor=n("");return s[pg]=a,e&&(o(s,e,r),o(a,e,r)),a}const Wr=Symbol("_leaveCb"),tu=Symbol("_enterCb");function o0(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Ps(()=>{e.isMounted=!0}),zi(()=>{e.isUnmounting=!0}),e}const Hr=[Function,Array],mg={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Hr,onEnter:Hr,onAfterEnter:Hr,onEnterCancelled:Hr,onBeforeLeave:Hr,onLeave:Hr,onAfterLeave:Hr,onLeaveCancelled:Hr,onBeforeAppear:Hr,onAppear:Hr,onAfterAppear:Hr,onAppearCancelled:Hr},vg=e=>{const t=e.subTree;return t.component?vg(t.component):t},r0={name:"BaseTransition",props:mg,setup(e,{slots:t}){const n=hp(),o=o0();return()=>{const r=t.default&&wg(t.default(),!0),s=r&&r.length?gg(r):n.subTree?J():void 0;if(!s)return;const a=Dt(e),{mode:l}=a;if(o.isLeaving)return zd(s);const f=gh(s);if(!f)return zd(s);let m=Sf(f,a,o,n,w=>m=w);f.type!==Ro&&Tu(f,m);let g=n.subTree&&gh(n.subTree);if(g&&g.type!==Ro&&!ji(g,f)&&vg(n).type!==Ro){let w=Sf(g,a,o,n);if(Tu(g,w),l==="out-in"&&f.type!==Ro)return o.isLeaving=!0,w.afterLeave=()=>{o.isLeaving=!1,n.job.flags&8||n.update(),delete w.afterLeave,g=void 0},zd(s);l==="in-out"&&f.type!==Ro?w.delayLeave=(x,R,L)=>{const B=yg(o,g);B[String(g.key)]=g,x[Wr]=()=>{R(),x[Wr]=void 0,delete m.delayedLeave,g=void 0},m.delayedLeave=()=>{L(),delete m.delayedLeave,g=void 0}}:g=void 0}else g&&(g=void 0);return s}}};function gg(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Ro){t=n;break}}return t}const a0=r0;function yg(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 Sf(e,t,n,o,r){const{appear:s,mode:a,persisted:l=!1,onBeforeEnter:f,onEnter:m,onAfterEnter:g,onEnterCancelled:w,onBeforeLeave:x,onLeave:R,onAfterLeave:L,onLeaveCancelled:B,onBeforeAppear:Y,onAppear:ae,onAfterAppear:z,onAppearCancelled:Z}=t,X=String(e.key),ye=yg(n,e),Me=(pe,Ue)=>{pe&&Yr(pe,o,9,Ue)},Se=(pe,Ue)=>{const $e=Ue[1];Me(pe,Ue),ft(pe)?pe.every(he=>he.length<=1)&&$e():pe.length<=1&&$e()},Fe={mode:a,persisted:l,beforeEnter(pe){let Ue=f;if(!n.isMounted)if(s)Ue=Y||f;else return;pe[Wr]&&pe[Wr](!0);const $e=ye[X];$e&&ji(e,$e)&&$e.el[Wr]&&$e.el[Wr](),Me(Ue,[pe])},enter(pe){if(ye[X]===e)return;let Ue=m,$e=g,he=w;if(!n.isMounted)if(s)Ue=ae||m,$e=z||g,he=Z||w;else return;let Te=!1;pe[tu]=Pe=>{Te||(Te=!0,Pe?Me(he,[pe]):Me($e,[pe]),Fe.delayedLeave&&Fe.delayedLeave(),pe[tu]=void 0)};const Ae=pe[tu].bind(null,!1);Ue?Se(Ue,[pe,Ae]):Ae()},leave(pe,Ue){const $e=String(e.key);if(pe[tu]&&pe[tu](!0),n.isUnmounting)return Ue();Me(x,[pe]);let he=!1;pe[Wr]=Ae=>{he||(he=!0,Ue(),Ae?Me(B,[pe]):Me(L,[pe]),pe[Wr]=void 0,ye[$e]===e&&delete ye[$e])};const Te=pe[Wr].bind(null,!1);ye[$e]=e,R?Se(R,[pe,Te]):Te()},clone(pe){const Ue=Sf(pe,t,n,o,r);return r&&r(Ue),Ue}};return Fe}function zd(e){if(ju(e))return e=ai(e),e.children=null,e}function gh(e){if(!ju(e))return hg(e.type)&&e.children?gg(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&&bt(n.default))return n.default()}}function Tu(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Tu(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 wg(e,t=!1,n){let o=[],r=0;for(let s=0;s<e.length;s++){let a=e[s];const l=n==null?a.key:String(n)+String(a.key!=null?a.key:s);a.type===ze?(a.patchFlag&128&&r++,o=o.concat(wg(a.children,t,l))):(t||a.type!==Ro)&&o.push(l!=null?ai(a,{key:l}):a)}if(r>1)for(let s=0;s<o.length;s++)o[s].patchFlag=-2;return o}function Nn(e,t){return bt(e)?Un({name:e.name},t,{setup:e}):e}function lp(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function yh(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Bc=new WeakMap;function vu(e,t,n,o,r=!1){if(ft(e)){e.forEach((B,Y)=>vu(B,t&&(ft(t)?t[Y]:t),n,o,r));return}if(_l(o)&&!r){o.shapeFlag&512&&o.type.__asyncResolved&&o.component.subTree.component&&vu(e,t,n,o.component.subTree);return}const s=o.shapeFlag&4?ld(o.component):o.el,a=r?null:s,{i:l,r:f}=e,m=t&&t.r,g=l.refs===tn?l.refs={}:l.refs,w=l.setupState,x=Dt(w),R=w===tn?jv:B=>yh(g,B)?!1:qt(x,B),L=(B,Y)=>!(Y&&yh(g,Y));if(m!=null&&m!==f){if(wh(t),dn(m))g[m]=null,R(m)&&(w[m]=null);else if(Mo(m)){const B=t;L(m,B.k)&&(m.value=null),B.k&&(g[B.k]=null)}}if(bt(f))Mu(f,l,12,[a,g]);else{const B=dn(f),Y=Mo(f);if(B||Y){const ae=()=>{if(e.f){const z=B?R(f)?w[f]:g[f]:L()||!e.k?f.value:g[e.k];if(r)ft(z)&&Qf(z,s);else if(ft(z))z.includes(s)||z.push(s);else if(B)g[f]=[s],R(f)&&(w[f]=g[f]);else{const Z=[s];L(f,e.k)&&(f.value=Z),e.k&&(g[e.k]=Z)}}else B?(g[f]=a,R(f)&&(w[f]=a)):Y&&(L(f,e.k)&&(f.value=a),e.k&&(g[e.k]=a))};if(a){const z=()=>{ae(),Bc.delete(e)};z.id=-1,Bc.set(e,z),Wo(z,n)}else wh(e),ae()}}}function wh(e){const t=Bc.get(e);t&&(t.flags|=8,Bc.delete(e))}const bh=e=>e.nodeType===8;nd().requestIdleCallback;nd().cancelIdleCallback;function s0(e,t){if(bh(e)&&e.data==="["){let n=1,o=e.nextSibling;for(;o;){if(o.nodeType===1){if(t(o)===!1)break}else if(bh(o))if(o.data==="]"){if(--n===0)break}else o.data==="["&&n++;o=o.nextSibling}}else t(e)}const _l=e=>!!e.type.__asyncLoader;function nu(e){bt(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:o,delay:r=200,hydrate:s,timeout:a,suspensible:l=!0,onError:f}=e;let m=null,g,w=0;const x=()=>(w++,m=null,R()),R=()=>{let L;return m||(L=m=t().catch(B=>{if(B=B instanceof Error?B:new Error(String(B)),f)return new Promise((Y,ae)=>{f(B,()=>Y(x()),()=>ae(B),w+1)});throw B}).then(B=>L!==m&&m?m:(B&&(B.__esModule||B[Symbol.toStringTag]==="Module")&&(B=B.default),g=B,B)))};return Nn({name:"AsyncComponentWrapper",__asyncLoader:R,__asyncHydrate(L,B,Y){const ae=L.isConnected;let z=!1;(B.bu||(B.bu=[])).push(()=>z=!0);const Z=()=>{z||!L.parentNode||ae&&!L.isConnected||Y()},X=s?()=>{const ye=s(Z,Me=>s0(L,Me));ye&&(B.bum||(B.bum=[])).push(ye)}:Z;g?X():R().then(()=>!B.isUnmounted&&X())},get __asyncResolved(){return g},setup(){const L=ho;if(lp(L),g)return()=>pc(g,L);const B=ye=>{m=null,$u(ye,L,13,!o)};if(l&&L.suspense||Pl)return R().then(ye=>()=>pc(ye,L)).catch(ye=>(B(ye),()=>o?xe(o,{error:ye}):null));const Y=S(!1),ae=S(),z=S(!!r);let Z,X;return Nu(()=>{Z!=null&&clearTimeout(Z),X!=null&&clearTimeout(X)}),r&&(X=setTimeout(()=>{L.isUnmounted||(z.value=!1)},r)),a!=null&&(Z=setTimeout(()=>{if(!L.isUnmounted&&!Y.value&&!ae.value){const ye=new Error(`Async component timed out after ${a}ms.`);B(ye),ae.value=ye}},a)),R().then(()=>{L.isUnmounted||(Y.value=!0,L.parent&&ju(L.parent.vnode)&&L.parent.update())}).catch(ye=>{if(L.isUnmounted){m=null;return}B(ye),ae.value=ye}),()=>{if(Y.value&&g)return pc(g,L);if(ae.value&&o)return xe(o,{error:ae.value});if(n&&!z.value)return pc(n,L)}}})}function pc(e,t){const{ref:n,props:o,children:r,ce:s}=t.vnode,a=xe(e,o,r);return a.ref=n,a.ce=s,delete t.vnode.ce,a}const ju=e=>e.type.__isKeepAlive;function i0(e,t){bg(e,"a",t)}function l0(e,t){bg(e,"da",t)}function bg(e,t,n=ho){const o=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(ad(t,o,n),n){let r=n.parent;for(;r&&r.parent;)ju(r.parent.vnode)&&u0(o,t,n,r),r=r.parent}}function u0(e,t,n,o){const r=ad(t,e,o,!0);Nu(()=>{Qf(o[t],r)},n)}function ad(e,t,n=ho,o=!1){if(n){const r=n[e]||(n[e]=[]),s=t.__weh||(t.__weh=(...a)=>{Ts();const l=Lu(n),f=Yr(t,n,e,a);return l(),Ss(),f});return o?r.unshift(s):r.push(s),s}}const As=e=>(t,n=ho)=>{(!Pl||e==="sp")&&ad(e,(...o)=>t(...o),n)},c0=As("bm"),Ps=As("m"),d0=As("bu"),f0=As("u"),zi=As("bum"),Nu=As("um"),p0=As("sp"),h0=As("rtg"),m0=As("rtc");function v0(e,t=ho){ad("ec",e,t)}const _g="components";function g0(e,t){return Cg(_g,e,!0,t)||e}const kg=Symbol.for("v-ndc");function up(e){return dn(e)?Cg(_g,e,!1)||e:e||kg}function Cg(e,t,n=!0,o=!1){const r=mo||ho;if(r){const s=r.type;{const l=ek(s,!1);if(l&&(l===t||l===Yo(t)||l===td(Yo(t))))return s}const a=_h(r[e]||s[e],t)||_h(r.appContext[e],t);return!a&&o?s:a}}function _h(e,t){return e&&(e[t]||e[Yo(t)]||e[td(Yo(t))])}function kt(e,t,n,o){let r;const s=n,a=ft(e);if(a||dn(e)){const l=a&&Ui(e);let f=!1,m=!1;l&&(f=!Gr(e),m=xs(e),e=od(e)),r=new Array(e.length);for(let g=0,w=e.length;g<w;g++)r[g]=t(f?m?xl(Ta(e[g])):Ta(e[g]):e[g],g,void 0,s)}else if(typeof e=="number"){r=new Array(e);for(let l=0;l<e;l++)r[l]=t(l+1,l,void 0,s)}else if(Ht(e))if(e[Symbol.iterator])r=Array.from(e,(l,f)=>t(l,f,void 0,s));else{const l=Object.keys(e);r=new Array(l.length);for(let f=0,m=l.length;f<m;f++){const g=l[f];r[f]=t(e[g],g,f,s)}}else r=[];return r}function ur(e,t,n={},o,r,s){if(mo.ce||mo.parent&&_l(mo.parent)&&mo.parent.ce){const m=s!=null&&n.key==null?Un({},n,{key:s}):n,g=Object.keys(m).length>0;return t!=="default"&&(m.name=t),T(),at(ze,null,[xe("slot",m,o)],g?-2:64)}let a=e[t];a&&a._c&&(a._d=!1);const l=Cs.length;T();let f;try{const m=a&&Tg(a(n)),g=n.key||s||m&&m.key;f=at(ze,{key:(g&&!Ca(g)?g:`_${t}`)+(!m&&o?"_fb":"")},m||(o?o():[]),m&&e._===1?64:-2)}catch(m){for(let g=Cs.length;g>l;g--)pp();throw m}finally{a&&a._c&&(a._d=!0)}return f}function Tg(e){return e.some(t=>Su(t)?!(t.type===Ro||t.type===ze&&!Tg(t.children)):!0)?e:null}const xf=e=>e?Hg(e)?ld(e):xf(e.parent):null,gu=Un(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=>xf(e.parent),$root:e=>xf(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>xg(e),$forceUpdate:e=>e.f||(e.f=()=>{ip(e.update)}),$nextTick:e=>e.n||(e.n=zt.bind(e.proxy)),$watch:e=>Z_.bind(e)}),Hd=(e,t)=>e!==tn&&!e.__isScriptSetup&&qt(e,t),y0={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:o,data:r,props:s,accessCache:a,type:l,appContext:f}=e;if(t[0]!=="$"){const x=a[t];if(x!==void 0)switch(x){case 1:return o[t];case 2:return r[t];case 4:return n[t];case 3:return s[t]}else{if(Hd(o,t))return a[t]=1,o[t];if(r!==tn&&qt(r,t))return a[t]=2,r[t];if(qt(s,t))return a[t]=3,s[t];if(n!==tn&&qt(n,t))return a[t]=4,n[t];Af&&(a[t]=0)}}const m=gu[t];let g,w;if(m)return t==="$attrs"&&Io(e.attrs,"get",""),m(e);if((g=l.__cssModules)&&(g=g[t]))return g;if(n!==tn&&qt(n,t))return a[t]=4,n[t];if(w=f.config.globalProperties,qt(w,t))return w[t]},set({_:e},t,n){const{data:o,setupState:r,ctx:s}=e;return Hd(r,t)?(r[t]=n,!0):o!==tn&&qt(o,t)?(o[t]=n,!0):qt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(s[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:o,appContext:r,props:s,type:a}},l){let f;return!!(n[l]||e!==tn&&l[0]!=="$"&&qt(e,l)||Hd(t,l)||qt(s,l)||qt(o,l)||qt(gu,l)||qt(r.config.globalProperties,l)||(f=a.__cssModules)&&f[l])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:qt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function w0(){return b0().slots}function b0(e){const t=hp();return t.setupContext||(t.setupContext=Vg(t))}function kh(e){return ft(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Af=!0;function _0(e){const t=xg(e),n=e.proxy,o=e.ctx;Af=!1,t.beforeCreate&&Ch(t.beforeCreate,e,"bc");const{data:r,computed:s,methods:a,watch:l,provide:f,inject:m,created:g,beforeMount:w,mounted:x,beforeUpdate:R,updated:L,activated:B,deactivated:Y,beforeDestroy:ae,beforeUnmount:z,destroyed:Z,unmounted:X,render:ye,renderTracked:Me,renderTriggered:Se,errorCaptured:Fe,serverPrefetch:pe,expose:Ue,inheritAttrs:$e,components:he,directives:Te,filters:Ae}=t;if(m&&k0(m,o,null),a)for(const Ye in a){const He=a[Ye];bt(He)&&(o[Ye]=He.bind(n))}if(r){const Ye=r.call(n,n);Ht(Ye)&&(e.data=rd(Ye))}if(Af=!0,s)for(const Ye in s){const He=s[Ye],St=bt(He)?He.bind(n,n):bt(He.get)?He.get.bind(n,n):Ya,ct=!bt(He)&&bt(He.set)?He.set.bind(n):Ya,Ge=ee({get:St,set:ct});Object.defineProperty(o,Ye,{enumerable:!0,configurable:!0,get:()=>Ge.value,set:nt=>Ge.value=nt})}if(l)for(const Ye in l)Sg(l[Ye],o,n,Ye);if(f){const Ye=bt(f)?f.call(n):f;Reflect.ownKeys(Ye).forEach(He=>{Rc(He,Ye[He])})}g&&Ch(g,e,"c");function De(Ye,He){ft(He)?He.forEach(St=>Ye(St.bind(n))):He&&Ye(He.bind(n))}if(De(c0,w),De(Ps,x),De(d0,R),De(f0,L),De(i0,B),De(l0,Y),De(v0,Fe),De(m0,Me),De(h0,Se),De(zi,z),De(Nu,X),De(p0,pe),ft(Ue))if(Ue.length){const Ye=e.exposed||(e.exposed={});Ue.forEach(He=>{Object.defineProperty(Ye,He,{get:()=>n[He],set:St=>n[He]=St,enumerable:!0})})}else e.exposed||(e.exposed={});ye&&e.render===Ya&&(e.render=ye),$e!=null&&(e.inheritAttrs=$e),he&&(e.components=he),Te&&(e.directives=Te),pe&&lp(e)}function k0(e,t,n=Ya){ft(e)&&(e=Pf(e));for(const o in e){const r=e[o];let s;Ht(r)?"default"in r?s=_a(r.from||o,r.default,!0):s=_a(r.from||o):s=_a(r),Mo(s)?Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get:()=>s.value,set:a=>s.value=a}):t[o]=s}}function Ch(e,t,n){Yr(ft(e)?e.map(o=>o.bind(t.proxy)):e.bind(t.proxy),t,n)}function Sg(e,t,n,o){let r=o.includes(".")?fg(n,o):()=>n[o];if(dn(e)){const s=t[e];bt(s)&&rt(r,s)}else if(bt(e))rt(r,e.bind(n));else if(Ht(e))if(ft(e))e.forEach(s=>Sg(s,t,n,o));else{const s=bt(e.handler)?e.handler.bind(n):t[e.handler];bt(s)&&rt(r,s,e)}}function xg(e){const t=e.type,{mixins:n,extends:o}=t,{mixins:r,optionsCache:s,config:{optionMergeStrategies:a}}=e.appContext,l=s.get(t);let f;return l?f=l:!r.length&&!n&&!o?f=t:(f={},r.length&&r.forEach(m=>qc(f,m,a,!0)),qc(f,t,a)),Ht(t)&&s.set(t,f),f}function qc(e,t,n,o=!1){const{mixins:r,extends:s}=t;s&&qc(e,s,n,!0),r&&r.forEach(a=>qc(e,a,n,!0));for(const a in t)if(!(o&&a==="expose")){const l=C0[a]||n&&n[a];e[a]=l?l(e[a],t[a]):t[a]}return e}const C0={data:Th,props:Sh,emits:Sh,methods:uu,computed:uu,beforeCreate:Ho,created:Ho,beforeMount:Ho,mounted:Ho,beforeUpdate:Ho,updated:Ho,beforeDestroy:Ho,beforeUnmount:Ho,destroyed:Ho,unmounted:Ho,activated:Ho,deactivated:Ho,errorCaptured:Ho,serverPrefetch:Ho,components:uu,directives:uu,watch:S0,provide:Th,inject:T0};function Th(e,t){return t?e?function(){return Un(bt(e)?e.call(this,this):e,bt(t)?t.call(this,this):t)}:t:e}function T0(e,t){return uu(Pf(e),Pf(t))}function Pf(e){if(ft(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Ho(e,t){return e?[...new Set([].concat(e,t))]:t}function uu(e,t){return e?Un(Object.create(null),e,t):t}function Sh(e,t){return e?ft(e)&&ft(t)?[...new Set([...e,...t])]:Un(Object.create(null),kh(e),kh(t??{})):t}function S0(e,t){if(!e)return t;if(!t)return e;const n=Un(Object.create(null),e);for(const o in t)n[o]=Ho(e[o],t[o]);return n}function Ag(){return{app:null,config:{isNativeTag:jv,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 x0=0;function A0(e,t){return function(o,r=null){bt(o)||(o=Un({},o)),r!=null&&!Ht(r)&&(r=null);const s=Ag(),a=new WeakSet,l=[];let f=!1;const m=s.app={_uid:x0++,_component:o,_props:r,_container:null,_context:s,_instance:null,version:ok,get config(){return s.config},set config(g){},use(g,...w){return a.has(g)||(g&&bt(g.install)?(a.add(g),g.install(m,...w)):bt(g)&&(a.add(g),g(m,...w))),m},mixin(g){return s.mixins.includes(g)||s.mixins.push(g),m},component(g,w){return w?(s.components[g]=w,m):s.components[g]},directive(g,w){return w?(s.directives[g]=w,m):s.directives[g]},mount(g,w,x){if(!f){const R=m._ceVNode||xe(o,r);return R.appContext=s,x===!0?x="svg":x===!1&&(x=void 0),e(R,g,x),f=!0,m._container=g,g.__vue_app__=m,ld(R.component)}},onUnmount(g){l.push(g)},unmount(){f&&(Yr(l,m._instance,16),e(null,m._container),delete m._container.__vue_app__)},provide(g,w){return s.provides[g]=w,m},runWithContext(g){const w=kl;kl=m;try{return g()}finally{kl=w}}};return m}}let kl=null;const P0=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Yo(t)}Modifiers`]||e[`${si(t)}Modifiers`];function E0(e,t,...n){if(e.isUnmounted)return;const o=e.vnode.props||tn;let r=n;const s=t.startsWith("update:"),a=s&&P0(o,t.slice(7));a&&(a.trim&&(r=n.map(g=>dn(g)?g.trim():g)),a.number&&(r=n.map(Zf)));let l,f=o[l=Dd(t)]||o[l=Dd(Yo(t))];!f&&s&&(f=o[l=Dd(si(t))]),f&&Yr(f,e,6,r);const m=o[l+"Once"];if(m){if(!e.emitted)e.emitted={};else if(e.emitted[l])return;e.emitted[l]=!0,Yr(m,e,6,r)}}const I0=new WeakMap;function Pg(e,t,n=!1){const o=n?I0:t.emitsCache,r=o.get(e);if(r!==void 0)return r;const s=e.emits;let a={},l=!1;if(!bt(e)){const f=m=>{const g=Pg(m,t,!0);g&&(l=!0,Un(a,g))};!n&&t.mixins.length&&t.mixins.forEach(f),e.extends&&f(e.extends),e.mixins&&e.mixins.forEach(f)}return!s&&!l?(Ht(e)&&o.set(e,null),null):(ft(s)?s.forEach(f=>a[f]=null):Un(a,s),Ht(e)&&o.set(e,a),a)}function sd(e,t){return!e||!Qc(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),qt(e,t[0].toLowerCase()+t.slice(1))||qt(e,si(t))||qt(e,t))}function xh(e){const{type:t,vnode:n,proxy:o,withProxy:r,propsOptions:[s],slots:a,attrs:l,emit:f,render:m,renderCache:g,props:w,data:x,setupState:R,ctx:L,inheritAttrs:B}=e,Y=Uc(e);let ae,z;try{if(n.shapeFlag&4){const X=r||o,ye=X;ae=Ka(m.call(ye,X,g,w,R,x,L)),z=l}else{const X=t;ae=Ka(X.length>1?X(w,{attrs:l,slots:a,emit:f}):X(w,null)),z=t.props?l:R0(l)}}catch(X){Cs.length=0,$u(X,e,1),ae=xe(Ro)}let Z=ae;if(z&&B!==!1){const X=Object.keys(z),{shapeFlag:ye}=Z;X.length&&ye&7&&(s&&X.some(Xc)&&(z=M0(z,s)),Z=ai(Z,z,!1,!0))}return n.dirs&&(Z=ai(Z,null,!1,!0),Z.dirs=Z.dirs?Z.dirs.concat(n.dirs):n.dirs),n.transition&&Tu(Z,n.transition),ae=Z,Uc(Y),ae}const R0=e=>{let t;for(const n in e)(n==="class"||n==="style"||Qc(n))&&((t||(t={}))[n]=e[n]);return t},M0=(e,t)=>{const n={};for(const o in e)(!Xc(o)||!(o.slice(9)in t))&&(n[o]=e[o]);return n};function $0(e,t,n){const{props:o,children:r,component:s}=e,{props:a,children:l,patchFlag:f}=t,m=s.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&f>=0){if(f&1024)return!0;if(f&16)return o?Ah(o,a,m):!!a;if(f&8){const g=t.dynamicProps;for(let w=0;w<g.length;w++){const x=g[w];if(Eg(a,o,x)&&!sd(m,x))return!0}}}else return(r||l)&&(!l||!l.$stable)?!0:o===a?!1:o?a?Ah(o,a,m):!0:!!a;return!1}function Ah(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 s=o[r];if(Eg(t,e,s)&&!sd(n,s))return!0}return!1}function Eg(e,t,n){const o=e[n],r=t[n];return n==="style"&&Ht(o)&&Ht(r)?!Ru(o,r):o!==r}function j0({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 Ig={},Rg=()=>Object.create(Ig),Mg=e=>Object.getPrototypeOf(e)===Ig;function N0(e,t,n,o=!1){const r={},s=Rg();e.propsDefaults=Object.create(null),$g(e,t,r,s);for(const a in e.propsOptions[0])a in r||(r[a]=void 0);n?e.props=o?r:og(r):e.type.props?e.props=r:e.props=s,e.attrs=s}function L0(e,t,n,o){const{props:r,attrs:s,vnode:{patchFlag:a}}=e,l=Dt(r),[f]=e.propsOptions;let m=!1;if((o||a>0)&&!(a&16)){if(a&8){const g=e.vnode.dynamicProps;for(let w=0;w<g.length;w++){let x=g[w];if(sd(e.emitsOptions,x))continue;const R=t[x];if(f)if(qt(s,x))R!==s[x]&&(s[x]=R,m=!0);else{const L=Yo(x);r[L]=Ef(f,l,L,R,e,!1)}else R!==s[x]&&(s[x]=R,m=!0)}}}else{$g(e,t,r,s)&&(m=!0);let g;for(const w in l)(!t||!qt(t,w)&&((g=si(w))===w||!qt(t,g)))&&(f?n&&(n[w]!==void 0||n[g]!==void 0)&&(r[w]=Ef(f,l,w,void 0,e,!0)):delete r[w]);if(s!==l)for(const w in s)(!t||!qt(t,w))&&(delete s[w],m=!0)}m&&bs(e.attrs,"set","")}function $g(e,t,n,o){const[r,s]=e.propsOptions;let a=!1,l;if(t)for(let f in t){if(pu(f))continue;const m=t[f];let g;r&&qt(r,g=Yo(f))?!s||!s.includes(g)?n[g]=m:(l||(l={}))[g]=m:sd(e.emitsOptions,f)||(!(f in o)||m!==o[f])&&(o[f]=m,a=!0)}if(s){const f=Dt(n),m=l||tn;for(let g=0;g<s.length;g++){const w=s[g];n[w]=Ef(r,f,w,m[w],e,!qt(m,w))}}return a}function Ef(e,t,n,o,r,s){const a=e[n];if(a!=null){const l=qt(a,"default");if(l&&o===void 0){const f=a.default;if(a.type!==Function&&!a.skipFactory&&bt(f)){const{propsDefaults:m}=r;if(n in m)o=m[n];else{const g=Lu(r);o=m[n]=f.call(null,t),g()}}else o=f;r.ce&&r.ce._setProp(n,o)}a[0]&&(s&&!l?o=!1:a[1]&&(o===""||o===si(n))&&(o=!0))}return o}const O0=new WeakMap;function jg(e,t,n=!1){const o=n?O0:t.propsCache,r=o.get(e);if(r)return r;const s=e.props,a={},l=[];let f=!1;if(!bt(e)){const g=w=>{f=!0;const[x,R]=jg(w,t,!0);Un(a,x),R&&l.push(...R)};!n&&t.mixins.length&&t.mixins.forEach(g),e.extends&&g(e.extends),e.mixins&&e.mixins.forEach(g)}if(!s&&!f)return Ht(e)&&o.set(e,yl),yl;if(ft(s))for(let g=0;g<s.length;g++){const w=Yo(s[g]);Ph(w)&&(a[w]=tn)}else if(s)for(const g in s){const w=Yo(g);if(Ph(w)){const x=s[g],R=a[w]=ft(x)||bt(x)?{type:x}:Un({},x),L=R.type;let B=!1,Y=!0;if(ft(L))for(let ae=0;ae<L.length;++ae){const z=L[ae],Z=bt(z)&&z.name;if(Z==="Boolean"){B=!0;break}else Z==="String"&&(Y=!1)}else B=bt(L)&&L.name==="Boolean";R[0]=B,R[1]=Y,(B||qt(R,"default"))&&l.push(w)}}const m=[a,l];return Ht(e)&&o.set(e,m),m}function Ph(e){return e[0]!=="$"&&!pu(e)}const cp=e=>e==="_"||e==="_ctx"||e==="$stable",dp=e=>ft(e)?e.map(Ka):[Ka(e)],D0=(e,t,n)=>{if(t._n)return t;const o=tt((...r)=>dp(t(...r)),n);return o._c=!1,o},Ng=(e,t,n)=>{const o=e._ctx;for(const r in e){if(cp(r))continue;const s=e[r];if(bt(s))t[r]=D0(r,s,o);else if(s!=null){const a=dp(s);t[r]=()=>a}}},Lg=(e,t)=>{const n=dp(t);e.slots.default=()=>n},Og=(e,t,n)=>{for(const o in t)(n||!cp(o))&&(e[o]=t[o])},F0=(e,t,n)=>{const o=e.slots=Rg();if(e.vnode.shapeFlag&32){const r=t._;r?(Og(o,t,n),n&&Dv(o,"_",r,!0)):Ng(t,o)}else t&&Lg(e,t)},U0=(e,t,n)=>{const{vnode:o,slots:r}=e;let s=!0,a=tn;if(o.shapeFlag&32){const l=t._;l?n&&l===1?s=!1:Og(r,t,n):(s=!t.$stable,Ng(t,r)),a=t}else t&&(Lg(e,t),a={default:1});if(s)for(const l in r)!cp(l)&&a[l]==null&&delete r[l]},Wo=W0;function B0(e){return q0(e)}function q0(e,t){const n=nd();n.__VUE__=!0;const{insert:o,remove:r,patchProp:s,createElement:a,createText:l,createComment:f,setText:m,setElementText:g,parentNode:w,nextSibling:x,setScopeId:R=Ya,insertStaticContent:L}=e,B=($,D,G,ie=null,le=null,oe=null,Ce=void 0,we=null,ve=!!D.dynamicChildren)=>{if($===D)return;$&&!ji($,D)&&(ie=se($),nt($,le,oe,!0),$=null),D.patchFlag===-2&&(ve=!1,D.dynamicChildren=null);const{type:ce,ref:Ee,shapeFlag:be}=D;switch(ce){case id:Y($,D,G,ie);break;case Ro:ae($,D,G,ie);break;case Mc:$==null&&z(D,G,ie,Ce);break;case ze:he($,D,G,ie,le,oe,Ce,we,ve);break;default:be&1?ye($,D,G,ie,le,oe,Ce,we,ve):be&6?Te($,D,G,ie,le,oe,Ce,we,ve):(be&64||be&128)&&ce.process($,D,G,ie,le,oe,Ce,we,ve,H)}Ee!=null&&le?vu(Ee,$&&$.ref,oe,D||$,!D):Ee==null&&$&&$.ref!=null&&vu($.ref,null,oe,$,!0)},Y=($,D,G,ie)=>{if($==null)o(D.el=l(D.children),G,ie);else{const le=D.el=$.el;D.children!==$.children&&m(le,D.children)}},ae=($,D,G,ie)=>{$==null?o(D.el=f(D.children||""),G,ie):D.el=$.el},z=($,D,G,ie)=>{[$.el,$.anchor]=L($.children,D,G,ie,$.el,$.anchor)},Z=({el:$,anchor:D},G,ie)=>{let le;for(;$&&$!==D;)le=x($),o($,G,ie),$=le;o(D,G,ie)},X=({el:$,anchor:D})=>{let G;for(;$&&$!==D;)G=x($),r($),$=G;r(D)},ye=($,D,G,ie,le,oe,Ce,we,ve)=>{if(D.type==="svg"?Ce="svg":D.type==="math"&&(Ce="mathml"),$==null)Me(D,G,ie,le,oe,Ce,we,ve);else{const ce=$.el&&$.el._isVueCE?$.el:null;try{ce&&ce._beginPatch(),pe($,D,le,oe,Ce,we,ve)}finally{ce&&ce._endPatch()}}},Me=($,D,G,ie,le,oe,Ce,we)=>{let ve,ce;const{props:Ee,shapeFlag:be,transition:Oe,dirs:Re}=$;if(ve=$.el=a($.type,oe,Ee&&Ee.is,Ee),be&8?g(ve,$.children):be&16&&Fe($.children,ve,null,ie,le,Wd($,oe),Ce,we),Re&&Ai($,null,ie,"created"),Se(ve,$,$.scopeId,Ce,ie),Ee){for(const it in Ee)it!=="value"&&!pu(it)&&s(ve,it,null,Ee[it],oe,ie);"value"in Ee&&s(ve,"value",null,Ee.value,oe),(ce=Ee.onVnodeBeforeMount)&&Wa(ce,ie,$)}Re&&Ai($,null,ie,"beforeMount");const Ve=z0(le,Oe);Ve&&Oe.beforeEnter(ve),o(ve,D,G),((ce=Ee&&Ee.onVnodeMounted)||Ve||Re)&&Wo(()=>{try{ce&&Wa(ce,ie,$),Ve&&Oe.enter(ve),Re&&Ai($,null,ie,"mounted")}finally{}},le)},Se=($,D,G,ie,le)=>{if(G&&R($,G),ie)for(let oe=0;oe<ie.length;oe++)R($,ie[oe]);if(le){let oe=le.subTree;if(D===oe||Ug(oe.type)&&(oe.ssContent===D||oe.ssFallback===D)){const Ce=le.vnode;Se($,Ce,Ce.scopeId,Ce.slotScopeIds,le.parent)}}},Fe=($,D,G,ie,le,oe,Ce,we,ve=0)=>{for(let ce=ve;ce<$.length;ce++){const Ee=$[ce]=we?ys($[ce]):Ka($[ce]);B(null,Ee,D,G,ie,le,oe,Ce,we)}},pe=($,D,G,ie,le,oe,Ce)=>{const we=D.el=$.el;let{patchFlag:ve,dynamicChildren:ce,dirs:Ee}=D;ve|=$.patchFlag&16;const be=$.props||tn,Oe=D.props||tn;let Re;if(G&&Pi(G,!1),(Re=Oe.onVnodeBeforeUpdate)&&Wa(Re,G,D,$),Ee&&Ai(D,$,G,"beforeUpdate"),G&&Pi(G,!0),ce&&(!$.dynamicChildren||$.dynamicChildren.length!==ce.length)&&(ve=0,Ce=!1,ce=null),(be.innerHTML&&Oe.innerHTML==null||be.textContent&&Oe.textContent==null)&&g(we,""),ce?Ue($.dynamicChildren,ce,we,G,ie,Wd(D,le),oe):Ce||He($,D,we,null,G,ie,Wd(D,le),oe,!1),ve>0){if(ve&16)$e(we,be,Oe,G,le);else if(ve&2&&be.class!==Oe.class&&s(we,"class",null,Oe.class,le),ve&4&&s(we,"style",be.style,Oe.style,le),ve&8){const Ve=D.dynamicProps;for(let it=0;it<Ve.length;it++){const yt=Ve[it],It=be[yt],Ze=Oe[yt];(Ze!==It||yt==="value")&&s(we,yt,It,Ze,le,G)}}ve&1&&$.children!==D.children&&g(we,D.children)}else!Ce&&ce==null&&$e(we,be,Oe,G,le);((Re=Oe.onVnodeUpdated)||Ee)&&Wo(()=>{Re&&Wa(Re,G,D,$),Ee&&Ai(D,$,G,"updated")},ie)},Ue=($,D,G,ie,le,oe,Ce)=>{for(let we=0;we<D.length;we++){const ve=$[we],ce=D[we],Ee=ve.el&&(ve.type===ze||!ji(ve,ce)||ve.shapeFlag&198)?w(ve.el):G;B(ve,ce,Ee,null,ie,le,oe,Ce,!0)}},$e=($,D,G,ie,le)=>{if(D!==G){if(D!==tn)for(const oe in D)!pu(oe)&&!(oe in G)&&s($,oe,D[oe],null,le,ie);for(const oe in G){if(pu(oe))continue;const Ce=G[oe],we=D[oe];Ce!==we&&oe!=="value"&&s($,oe,we,Ce,le,ie)}"value"in G&&s($,"value",D.value,G.value,le)}},he=($,D,G,ie,le,oe,Ce,we,ve)=>{const ce=D.el=$?$.el:l(""),Ee=D.anchor=$?$.anchor:l("");let{patchFlag:be,dynamicChildren:Oe,slotScopeIds:Re}=D;Re&&(we=we?we.concat(Re):Re),$==null?(o(ce,G,ie),o(Ee,G,ie),Fe(D.children||[],G,Ee,le,oe,Ce,we,ve)):be>0&&be&64&&Oe&&$.dynamicChildren&&$.dynamicChildren.length===Oe.length?(Ue($.dynamicChildren,Oe,G,le,oe,Ce,we),(D.key!=null||le&&D===le.subTree)&&fp($,D,!0)):He($,D,G,Ee,le,oe,Ce,we,ve)},Te=($,D,G,ie,le,oe,Ce,we,ve)=>{D.slotScopeIds=we,$==null?D.shapeFlag&512?le.ctx.activate(D,G,ie,Ce,ve):Ae(D,G,ie,le,oe,Ce,ve):Pe($,D,ve)},Ae=($,D,G,ie,le,oe,Ce)=>{const we=$.component=J0($,ie,le);if(ju($)&&(we.ctx.renderer=H),Q0(we,!1,Ce),we.asyncDep){if(le&&le.registerDep(we,De,Ce),!$.el){const ve=we.subTree=xe(Ro);ae(null,ve,D,G),$.placeholder=ve.el}}else De(we,$,D,G,le,oe,Ce)},Pe=($,D,G)=>{const ie=D.component=$.component;if($0($,D,G))if(ie.asyncDep&&!ie.asyncResolved){Ye(ie,D,G);return}else ie.next=D,ie.update();else D.el=$.el,ie.vnode=D},De=($,D,G,ie,le,oe,Ce)=>{const we=()=>{if($.isMounted){let{next:be,bu:Oe,u:Re,parent:Ve,vnode:it}=$;{const W=Dg($);if(W){be&&(be.el=it.el,Ye($,be,Ce)),W.asyncDep.then(()=>{Wo(()=>{$.isUnmounted||ce()},le)});return}}let yt=be,It;Pi($,!1),be?(be.el=it.el,Ye($,be,Ce)):be=it,Oe&&Ic(Oe),(It=be.props&&be.props.onVnodeBeforeUpdate)&&Wa(It,Ve,be,it),Pi($,!0);const Ze=xh($),Wt=$.subTree;$.subTree=Ze,B(Wt,Ze,w(Wt.el),se(Wt),$,le,oe),be.el=Ze.el,yt===null&&j0($,Ze.el),Re&&Wo(Re,le),(It=be.props&&be.props.onVnodeUpdated)&&Wo(()=>Wa(It,Ve,be,it),le)}else{let be;const{el:Oe,props:Re}=D,{bm:Ve,m:it,parent:yt,root:It,type:Ze}=$,Wt=_l(D);Pi($,!1),Ve&&Ic(Ve),!Wt&&(be=Re&&Re.onVnodeBeforeMount)&&Wa(be,yt,D),Pi($,!0);{It.ce&&It.ce._hasShadowRoot()&&It.ce._injectChildStyle(Ze,$.parent?$.parent.type:void 0);const W=$.subTree=xh($);B(null,W,G,ie,$,le,oe),D.el=W.el}if(it&&Wo(it,le),!Wt&&(be=Re&&Re.onVnodeMounted)){const W=D;Wo(()=>Wa(be,yt,W),le)}(D.shapeFlag&256||yt&&_l(yt.vnode)&&yt.vnode.shapeFlag&256)&&$.a&&Wo($.a,le),$.isMounted=!0,D=G=ie=null}};$.scope.on();const ve=$.effect=new zv(we);$.scope.off();const ce=$.update=ve.run.bind(ve),Ee=$.job=ve.runIfDirty.bind(ve);Ee.i=$,Ee.id=$.uid,ve.scheduler=()=>ip(Ee),Pi($,!0),ce()},Ye=($,D,G)=>{D.component=$;const ie=$.vnode.props;$.vnode=D,$.next=null,L0($,D.props,ie,G),U0($,D.children,G),Ts(),hh($),Ss()},He=($,D,G,ie,le,oe,Ce,we,ve=!1)=>{const ce=$&&$.children,Ee=$?$.shapeFlag:0,be=D.children,{patchFlag:Oe,shapeFlag:Re}=D;if(Oe>0){if(Oe&128){ct(ce,be,G,ie,le,oe,Ce,we,ve);return}else if(Oe&256){St(ce,be,G,ie,le,oe,Ce,we,ve);return}}Re&8?(Ee&16&&gt(ce,le,oe),be!==ce&&g(G,be)):Ee&16?Re&16?ct(ce,be,G,ie,le,oe,Ce,we,ve):gt(ce,le,oe,!0):(Ee&8&&g(G,""),Re&16&&Fe(be,G,ie,le,oe,Ce,we,ve))},St=($,D,G,ie,le,oe,Ce,we,ve)=>{$=$||yl,D=D||yl;const ce=$.length,Ee=D.length,be=Math.min(ce,Ee);let Oe;for(Oe=0;Oe<be;Oe++){const Re=D[Oe]=ve?ys(D[Oe]):Ka(D[Oe]);B($[Oe],Re,G,null,le,oe,Ce,we,ve)}ce>Ee?gt($,le,oe,!0,!1,be):Fe(D,G,ie,le,oe,Ce,we,ve,be)},ct=($,D,G,ie,le,oe,Ce,we,ve)=>{let ce=0;const Ee=D.length;let be=$.length-1,Oe=Ee-1;for(;ce<=be&&ce<=Oe;){const Re=$[ce],Ve=D[ce]=ve?ys(D[ce]):Ka(D[ce]);if(ji(Re,Ve))B(Re,Ve,G,null,le,oe,Ce,we,ve);else break;ce++}for(;ce<=be&&ce<=Oe;){const Re=$[be],Ve=D[Oe]=ve?ys(D[Oe]):Ka(D[Oe]);if(ji(Re,Ve))B(Re,Ve,G,null,le,oe,Ce,we,ve);else break;be--,Oe--}if(ce>be){if(ce<=Oe){const Re=Oe+1,Ve=Re<Ee?D[Re].el:ie;for(;ce<=Oe;)B(null,D[ce]=ve?ys(D[ce]):Ka(D[ce]),G,Ve,le,oe,Ce,we,ve),ce++}}else if(ce>Oe)for(;ce<=be;)nt($[ce],le,oe,!0),ce++;else{const Re=ce,Ve=ce,it=new Map;for(ce=Ve;ce<=Oe;ce++){const de=D[ce]=ve?ys(D[ce]):Ka(D[ce]);de.key!=null&&it.set(de.key,ce)}let yt,It=0;const Ze=Oe-Ve+1;let Wt=!1,W=0;const K=new Array(Ze);for(ce=0;ce<Ze;ce++)K[ce]=0;for(ce=Re;ce<=be;ce++){const de=$[ce];if(It>=Ze){nt(de,le,oe,!0);continue}let Le;if(de.key!=null)Le=it.get(de.key);else for(yt=Ve;yt<=Oe;yt++)if(K[yt-Ve]===0&&ji(de,D[yt])){Le=yt;break}Le===void 0?nt(de,le,oe,!0):(K[Le-Ve]=ce+1,Le>=W?W=Le:Wt=!0,B(de,D[Le],G,null,le,oe,Ce,we,ve),It++)}const Q=Wt?H0(K):yl;for(yt=Q.length-1,ce=Ze-1;ce>=0;ce--){const de=Ve+ce,Le=D[de],We=D[de+1],ot=de+1<Ee?We.el||Fg(We):ie;K[ce]===0?B(null,Le,G,ot,le,oe,Ce,we,ve):Wt&&(yt<0||ce!==Q[yt]?Ge(Le,G,ot,2):yt--)}}},Ge=($,D,G,ie,le=null)=>{const{el:oe,type:Ce,transition:we,children:ve,shapeFlag:ce}=$;if(ce&6){Ge($.component.subTree,D,G,ie);return}if(ce&128){$.suspense.move(D,G,ie);return}if(ce&64){Ce.move($,D,G,H);return}if(Ce===ze){o(oe,D,G);for(let be=0;be<ve.length;be++)Ge(ve[be],D,G,ie);o($.anchor,D,G);return}if(Ce===Mc){Z($,D,G);return}if(ie!==2&&ce&1&&we)if(ie===0)we.persisted&&!oe[Wr]?o(oe,D,G):(we.beforeEnter(oe),o(oe,D,G),Wo(()=>we.enter(oe),le));else{const{leave:be,delayLeave:Oe,afterLeave:Re}=we,Ve=()=>{$.ctx.isUnmounted?r(oe):o(oe,D,G)},it=()=>{const yt=oe._isLeaving||!!oe[Wr];oe._isLeaving&&oe[Wr](!0),we.persisted&&!yt?Ve():be(oe,()=>{Ve(),Re&&Re()})};Oe?Oe(oe,Ve,it):it()}else o(oe,D,G)},nt=($,D,G,ie=!1,le=!1)=>{const{type:oe,props:Ce,ref:we,children:ve,dynamicChildren:ce,shapeFlag:Ee,patchFlag:be,dirs:Oe,cacheIndex:Re,memo:Ve}=$;if(be===-2&&(le=!1),we!=null&&(Ts(),vu(we,null,G,$,!0),Ss()),Re!=null&&(D.renderCache[Re]=void 0),Ee&256){D.ctx.deactivate($);return}const it=Ee&1&&Oe,yt=!_l($);let It;if(yt&&(It=Ce&&Ce.onVnodeBeforeUnmount)&&Wa(It,D,$),Ee&6)Tt($.component,G,ie);else{if(Ee&128){$.suspense.unmount(G,ie);return}it&&Ai($,null,D,"beforeUnmount"),Ee&64?$.type.remove($,D,G,H,ie):ce&&!ce.hasOnce&&(oe!==ze||be>0&&be&64)?gt(ce,D,G,!1,!0):(oe===ze&&be&384||!le&&Ee&16)&&gt(ve,D,G),ie&&dt($)}const Ze=Ve!=null&&Re==null;(yt&&(It=Ce&&Ce.onVnodeUnmounted)||it||Ze)&&Wo(()=>{It&&Wa(It,D,$),it&&Ai($,null,D,"unmounted"),Ze&&($.el=null)},G)},dt=$=>{const{type:D,el:G,anchor:ie,transition:le}=$;if(D===ze){_t(G,ie);return}if(D===Mc){X($);return}const oe=()=>{r(G),le&&!le.persisted&&le.afterLeave&&le.afterLeave()};if($.shapeFlag&1&&le&&!le.persisted){const{leave:Ce,delayLeave:we}=le,ve=()=>Ce(G,oe);we?we($.el,oe,ve):ve()}else oe()},_t=($,D)=>{let G;for(;$!==D;)G=x($),r($),$=G;r(D)},Tt=($,D,G)=>{const{bum:ie,scope:le,job:oe,subTree:Ce,um:we,m:ve,a:ce}=$;Eh(ve),Eh(ce),ie&&Ic(ie),le.stop(),oe&&(oe.flags|=8,nt(Ce,$,D,G)),we&&Wo(we,D),Wo(()=>{$.isUnmounted=!0},D)},gt=($,D,G,ie=!1,le=!1,oe=0)=>{for(let Ce=oe;Ce<$.length;Ce++)nt($[Ce],D,G,ie,le)},se=$=>{if($.shapeFlag&6)return se($.component.subTree);if($.shapeFlag&128)return $.suspense.next();const D=x($.anchor||$.el),G=D&&D[pg];return G?x(G):D};let ne=!1;const re=($,D,G)=>{let ie;$==null?D._vnode&&(nt(D._vnode,null,null,!0),ie=D._vnode.component):B(D._vnode||null,$,D,null,null,null,G),D._vnode=$,ne||(ne=!0,hh(ie),lg(),ne=!1)},H={p:B,um:nt,m:Ge,r:dt,mt:Ae,mc:Fe,pc:He,pbc:Ue,n:se,o:e};return{render:re,hydrate:void 0,createApp:A0(re)}}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 Pi({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function z0(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function fp(e,t,n=!1){const o=e.children,r=t.children;if(ft(o)&&ft(r))for(let s=0;s<o.length;s++){const a=o[s];let l=r[s];l.shapeFlag&1&&!l.dynamicChildren&&((l.patchFlag<=0||l.patchFlag===32)&&(l=r[s]=ys(r[s]),l.el=a.el),!n&&l.patchFlag!==-2&&fp(a,l)),l.type===id&&(l.patchFlag===-1&&(l=r[s]=ys(l)),l.el=a.el),l.type===Ro&&!l.el&&(l.el=a.el)}}function H0(e){const t=e.slice(),n=[0];let o,r,s,a,l;const f=e.length;for(o=0;o<f;o++){const m=e[o];if(m!==0){if(r=n[n.length-1],e[r]<m){t[o]=r,n.push(o);continue}for(s=0,a=n.length-1;s<a;)l=s+a>>1,e[n[l]]<m?s=l+1:a=l;m<e[n[s]]&&(s>0&&(t[o]=n[s-1]),n[s]=o)}}for(s=n.length,a=n[s-1];s-- >0;)n[s]=a,a=t[a];return n}function Dg(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Dg(t)}function Eh(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Fg(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Fg(t.subTree):null}const Ug=e=>e.__isSuspense;function W0(e,t){t&&t.pendingBranch?ft(e)?t.effects.push(...e):t.effects.push(e):J_(e)}const ze=Symbol.for("v-fgt"),id=Symbol.for("v-txt"),Ro=Symbol.for("v-cmt"),Mc=Symbol.for("v-stc"),Cs=[];let Ko=null;function T(e=!1){Cs.push(Ko=e?null:[])}function pp(){Cs.pop(),Ko=Cs[Cs.length-1]||null}let Al=1;function zc(e,t=!1){Al+=e,e<0&&Ko&&t&&(Ko.hasOnce=!0)}function Bg(e){return e.dynamicChildren=Al>0?Ko||yl:null,pp(),Al>0&&Ko&&Ko.push(e),e}function A(e,t,n,o,r,s){return Bg(d(e,t,n,o,r,s,!0))}function at(e,t,n,o,r){return Bg(xe(e,t,n,o,r,!0))}function Su(e){return e?e.__v_isVNode===!0:!1}function ji(e,t){return e.type===t.type&&e.key===t.key}const qg=({key:e})=>e??null,$c=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?dn(e)||Mo(e)||bt(e)?{i:mo,r:e,k:t,f:!!n}:e:null);function d(e,t=null,n=null,o=0,r=null,s=e===ze?0:1,a=!1,l=!1){const f={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&qg(t),ref:t&&$c(t),scopeId:cg,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:s,patchFlag:o,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:mo};return l?(Hc(f,n),s&128&&e.normalize(f)):n&&(f.shapeFlag|=dn(n)?8:16),Al>0&&!a&&Ko&&(f.patchFlag>0||s&6)&&f.patchFlag!==32&&Ko.push(f),f}const xe=V0;function V0(e,t=null,n=null,o=0,r=null,s=!1){if((!e||e===kg)&&(e=Ro),Su(e)){const l=ai(e,t,!0);return n&&Hc(l,n),Al>0&&!s&&Ko&&(l.shapeFlag&6?Ko[Ko.indexOf(e)]=l:Ko.push(l)),l.patchFlag=-2,l}if(tk(e)&&(e=e.__vccOpts),t){t=G0(t);let{class:l,style:f}=t;l&&!dn(l)&&(t.class=Ke(l)),Ht(f)&&(sp(f)&&!ft(f)&&(f=Un({},f)),t.style=Vr(f))}const a=dn(e)?1:Ug(e)?128:hg(e)?64:Ht(e)?4:bt(e)?2:0;return d(e,t,n,o,r,a,s,!0)}function G0(e){return e?sp(e)||Mg(e)?Un({},e):e:null}function ai(e,t,n=!1,o=!1){const{props:r,ref:s,patchFlag:a,children:l,transition:f}=e,m=t?zg(r||{},t):r,g={__v_isVNode:!0,__v_skip:!0,type:e.type,props:m,key:m&&qg(m),ref:t&&t.ref?n&&s?ft(s)?s.concat($c(t)):[s,$c(t)]:$c(t):s,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:l,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==ze?a===-1?16:a|16:a,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:f,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ai(e.ssContent),ssFallback:e.ssFallback&&ai(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return f&&o&&Tu(g,f.clone(g)),g}function ks(e=" ",t=0){return xe(id,null,e,t)}function $4(e,t){const n=xe(Mc,null,e);return n.staticCount=t,n}function J(e="",t=!1){return t?(T(),at(Ro,null,e)):xe(Ro,null,e)}function Ka(e){return e==null||typeof e=="boolean"?xe(Ro):ft(e)?xe(ze,null,e.slice()):Su(e)?ys(e):xe(id,null,String(e))}function ys(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ai(e)}function Hc(e,t){let n=0;const{shapeFlag:o}=e;if(t==null)t=null;else if(ft(t))n=16;else if(typeof t=="object")if(o&65){const r=t.default;r&&(r._c&&(r._d=!1),Hc(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!Mg(t)?t._ctx=mo:r===3&&mo&&(mo.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(bt(t)){if(o&65){Hc(e,{default:t});return}t={default:t,_ctx:mo},n=32}else t=String(t),o&64?(n=16,t=[ks(t)]):n=8;e.children=t,e.shapeFlag|=n}function zg(...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=Ke([t.class,o.class]));else if(r==="style")t.style=Vr([t.style,o.style]);else if(Qc(r)){const s=t[r],a=o[r];a&&s!==a&&!(ft(s)&&s.includes(a))?t[r]=s?[].concat(s,a):a:a==null&&s==null&&!Xc(r)&&(t[r]=a)}else r!==""&&(t[r]=o[r])}return t}function Wa(e,t,n,o=null){Yr(e,t,7,[n,o])}const K0=Ag();let Y0=0;function J0(e,t,n){const o=e.type,r=(t?t.appContext:e.appContext)||K0,s={uid:Y0++,vnode:e,type:o,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new __(!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:jg(o,r),emitsOptions:Pg(o,r),emit:null,emitted:null,propsDefaults:tn,inheritAttrs:o.inheritAttrs,ctx:tn,data:tn,props:tn,attrs:tn,slots:tn,refs:tn,setupState:tn,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 s.ctx={_:s},s.root=t?t.root:s,s.emit=E0.bind(null,s),e.ce&&e.ce(s),s}let ho=null;const hp=()=>ho||mo;let Wc,If;{const e=nd(),t=(n,o)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(o),s=>{r.length>1?r.forEach(a=>a(s)):r[0](s)}};Wc=t("__VUE_INSTANCE_SETTERS__",n=>ho=n),If=t("__VUE_SSR_SETTERS__",n=>Pl=n)}const Lu=e=>{const t=ho;return Wc(e),e.scope.on(),()=>{e.scope.off(),Wc(t)}},Ih=()=>{ho&&ho.scope.off(),Wc(null)};function Hg(e){return e.vnode.shapeFlag&4}let Pl=!1;function Q0(e,t=!1,n=!1){t&&If(t);const{props:o,children:r}=e.vnode,s=Hg(e);N0(e,o,s,t),F0(e,r,n||t);const a=s?X0(e,t):void 0;return t&&If(!1),a}function X0(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,y0);const{setup:o}=n;if(o){Ts();const r=e.setupContext=o.length>1?Vg(e):null,s=Lu(e),a=Mu(o,e,0,[e.props,r]),l=Nv(a);if(Ss(),s(),(l||e.sp)&&!_l(e)&&lp(e),l){if(a.then(Ih,Ih),t)return a.then(f=>{Rh(e,f)}).catch(f=>{$u(f,e,0)});e.asyncDep=a}else Rh(e,a)}else Wg(e)}function Rh(e,t,n){bt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Ht(t)&&(e.setupState=ag(t)),Wg(e)}function Wg(e,t,n){const o=e.type;e.render||(e.render=o.render||Ya);{const r=Lu(e);Ts();try{_0(e)}finally{Ss(),r()}}}const Z0={get(e,t){return Io(e,"get",""),e[t]}};function Vg(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Z0),slots:e.slots,emit:e.emit,expose:t}}function ld(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(ag(U_(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in gu)return gu[n](e)},has(t,n){return n in t||n in gu}})):e.proxy}function ek(e,t=!0){return bt(e)?e.displayName||e.name:e.name||t&&e.__name}function tk(e){return bt(e)&&"__vccOpts"in e}const ee=(e,t)=>W_(e,t,Pl);function mp(e,t,n){try{zc(-1);const o=arguments.length;return o===2?Ht(t)&&!ft(t)?Su(t)?xe(e,null,[t]):xe(e,t):xe(e,null,t):(o>3?n=Array.prototype.slice.call(arguments,2):o===3&&Su(n)&&(n=[n]),xe(e,t,n))}finally{zc(1)}}function j4(e,t,n,o){const r=n[o];if(r&&nk(r,e))return r;const s=t();return s.memo=e.slice(),s.cacheIndex=o,n[o]=s}function nk(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let o=0;o<n.length;o++)if(va(n[o],t[o]))return!1;return Al>0&&Ko&&Ko.push(e),!0}const ok="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 Mh=typeof window<"u"&&window.trustedTypes;if(Mh)try{Rf=Mh.createPolicy("vue",{createHTML:e=>e})}catch{}const Gg=Rf?e=>Rf.createHTML(e):e=>e,rk="http://www.w3.org/2000/svg",ak="http://www.w3.org/1998/Math/MathML",gs=typeof document<"u"?document:null,$h=gs&&gs.createElement("template"),sk={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"?gs.createElementNS(rk,e):t==="mathml"?gs.createElementNS(ak,e):n?gs.createElement(e,{is:n}):gs.createElement(e);return e==="select"&&o&&o.multiple!=null&&r.setAttribute("multiple",o.multiple),r},createText:e=>gs.createTextNode(e),createComment:e=>gs.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>gs.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,o,r,s){const a=n?n.previousSibling:t.lastChild;if(r&&(r===s||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===s||!(r=r.nextSibling)););else{$h.innerHTML=Gg(o==="svg"?`<svg>${e}</svg>`:o==="mathml"?`<math>${e}</math>`:e);const l=$h.content;if(o==="svg"||o==="mathml"){const f=l.firstChild;for(;f.firstChild;)l.appendChild(f.firstChild);l.removeChild(f)}t.insertBefore(l,n)}return[a?a.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Ks="transition",ou="animation",xu=Symbol("_vtc"),Kg={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},ik=Un({},mg,Kg),lk=e=>(e.displayName="Transition",e.props=ik,e),Au=lk((e,{slots:t})=>mp(a0,uk(e),t)),Ei=(e,t=[])=>{ft(e)?e.forEach(n=>n(...t)):e&&e(...t)},jh=e=>e?ft(e)?e.some(t=>t.length>1):e.length>1:!1;function uk(e){const t={};for(const he in e)he in Kg||(t[he]=e[he]);if(e.css===!1)return t;const{name:n="v",type:o,duration:r,enterFromClass:s=`${n}-enter-from`,enterActiveClass:a=`${n}-enter-active`,enterToClass:l=`${n}-enter-to`,appearFromClass:f=s,appearActiveClass:m=a,appearToClass:g=l,leaveFromClass:w=`${n}-leave-from`,leaveActiveClass:x=`${n}-leave-active`,leaveToClass:R=`${n}-leave-to`}=e,L=ck(r),B=L&&L[0],Y=L&&L[1],{onBeforeEnter:ae,onEnter:z,onEnterCancelled:Z,onLeave:X,onLeaveCancelled:ye,onBeforeAppear:Me=ae,onAppear:Se=z,onAppearCancelled:Fe=Z}=t,pe=(he,Te,Ae,Pe)=>{he._enterCancelled=Pe,Ii(he,Te?g:l),Ii(he,Te?m:a),Ae&&Ae()},Ue=(he,Te)=>{he._isLeaving=!1,Ii(he,w),Ii(he,R),Ii(he,x),Te&&Te()},$e=he=>(Te,Ae)=>{const Pe=he?Se:z,De=()=>pe(Te,he,Ae);Ei(Pe,[Te,De]),Nh(()=>{Ii(Te,he?f:s),hs(Te,he?g:l),jh(Pe)||Lh(Te,o,B,De)})};return Un(t,{onBeforeEnter(he){Ei(ae,[he]),hs(he,s),hs(he,a)},onBeforeAppear(he){Ei(Me,[he]),hs(he,f),hs(he,m)},onEnter:$e(!1),onAppear:$e(!0),onLeave(he,Te){he._isLeaving=!0;const Ae=()=>Ue(he,Te);hs(he,w),he._enterCancelled?(hs(he,x),Fh(he)):(Fh(he),hs(he,x)),Nh(()=>{he._isLeaving&&(Ii(he,w),hs(he,R),jh(X)||Lh(he,o,Y,Ae))}),Ei(X,[he,Ae])},onEnterCancelled(he){pe(he,!1,void 0,!0),Ei(Z,[he])},onAppearCancelled(he){pe(he,!0,void 0,!0),Ei(Fe,[he])},onLeaveCancelled(he){Ue(he),Ei(ye,[he])}})}function ck(e){if(e==null)return null;if(Ht(e))return[Vd(e.enter),Vd(e.leave)];{const t=Vd(e);return[t,t]}}function Vd(e){return p_(e)}function hs(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[xu]||(e[xu]=new Set)).add(t)}function Ii(e,t){t.split(/\s+/).forEach(o=>o&&e.classList.remove(o));const n=e[xu];n&&(n.delete(t),n.size||(e[xu]=void 0))}function Nh(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let dk=0;function Lh(e,t,n,o){const r=e._endId=++dk,s=()=>{r===e._endId&&o()};if(n!=null)return setTimeout(s,n);const{type:a,timeout:l,propCount:f}=fk(e,t);if(!a)return o();const m=a+"end";let g=0;const w=()=>{e.removeEventListener(m,x),s()},x=R=>{R.target===e&&++g>=f&&w()};setTimeout(()=>{g<f&&w()},l+1),e.addEventListener(m,x)}function fk(e,t){const n=window.getComputedStyle(e),o=L=>(n[L]||"").split(", "),r=o(`${Ks}Delay`),s=o(`${Ks}Duration`),a=Oh(r,s),l=o(`${ou}Delay`),f=o(`${ou}Duration`),m=Oh(l,f);let g=null,w=0,x=0;t===Ks?a>0&&(g=Ks,w=a,x=s.length):t===ou?m>0&&(g=ou,w=m,x=f.length):(w=Math.max(a,m),g=w>0?a>m?Ks:ou:null,x=g?g===Ks?s.length:f.length:0);const R=g===Ks&&/\b(?:transform|all)(?:,|$)/.test(o(`${Ks}Property`).toString());return{type:g,timeout:w,propCount:x,hasTransform:R}}function Oh(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,o)=>Dh(n)+Dh(e[o])))}function Dh(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Fh(e){return(e?e.ownerDocument:document).body.offsetHeight}function pk(e,t,n){const o=e[xu];o&&(t=(t?[t,...o]:[...o]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Vc=Symbol("_vod"),Yg=Symbol("_vsh"),hc={name:"show",beforeMount(e,{value:t},{transition:n}){e[Vc]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):ru(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),ru(e,!0),o.enter(e)):o.leave(e,()=>{ru(e,!1)}):ru(e,t))},beforeUnmount(e,{value:t}){ru(e,t)}};function ru(e,t){e.style.display=t?e[Vc]:"none",e[Yg]=!t}const hk=Symbol(""),mk=/(?:^|;)\s*display\s*:/;function vk(e,t,n){const o=e.style,r=dn(n);let s=!1;if(n&&!r){if(t)if(dn(t))for(const a of t.split(";")){const l=a.slice(0,a.indexOf(":")).trim();n[l]==null&&cu(o,l,"")}else for(const a in t)n[a]==null&&cu(o,a,"");for(const a in n){a==="display"&&(s=!0);const l=n[a];l!=null?yk(e,a,!dn(t)&&t?t[a]:void 0,l)||cu(o,a,l):cu(o,a,"")}}else if(r){if(t!==n){const a=o[hk];a&&(n+=";"+a),o.cssText=n,s=mk.test(n)}}else t&&e.removeAttribute("style");Vc in e&&(e[Vc]=s?o.display:"",e[Yg]&&(o.display="none"))}const Uh=/\s*!important$/;function cu(e,t,n){if(ft(n))n.forEach(o=>cu(e,t,o));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const o=gk(e,t);Uh.test(n)?e.setProperty(si(o),n.replace(Uh,""),"important"):e[o]=n}}const Bh=["Webkit","Moz","ms"],Gd={};function gk(e,t){const n=Gd[t];if(n)return n;let o=Yo(t);if(o!=="filter"&&o in e)return Gd[t]=o;o=td(o);for(let r=0;r<Bh.length;r++){const s=Bh[r]+o;if(s in e)return Gd[t]=s}return t}function yk(e,t,n,o){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&dn(o)&&n===o}const qh="http://www.w3.org/1999/xlink";function zh(e,t,n,o,r,s=w_(t)){o&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(qh,t.slice(6,t.length)):e.setAttributeNS(qh,t,n):n==null||s&&!Fv(n)?e.removeAttribute(t):e.setAttribute(t,s?"":Ca(n)?String(n):n)}function Hh(e,t,n,o,r){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Gg(n):n);return}const s=e.tagName;if(t==="value"&&s!=="PROGRESS"&&!s.includes("-")){const l=s==="OPTION"?e.getAttribute("value")||"":e.value,f=n==null?e.type==="checkbox"?"on":"":String(n);(l!==f||!("_value"in e))&&(e.value=f),n==null&&e.removeAttribute(t),e._value=n;return}let a=!1;if(n===""||n==null){const l=typeof e[t];l==="boolean"?n=Fv(n):n==null&&l==="string"?(n="",a=!0):l==="number"&&(n=0,a=!0)}try{e[t]=n}catch{}a&&e.removeAttribute(r||t)}function Ni(e,t,n,o){e.addEventListener(t,n,o)}function wk(e,t,n,o){e.removeEventListener(t,n,o)}const Wh=Symbol("_vei");function bk(e,t,n,o,r=null){const s=e[Wh]||(e[Wh]={}),a=s[t];if(o&&a)a.value=o;else{const[l,f]=Ck(t);if(o){const m=s[t]=xk(o,r);Ni(e,l,m,f)}else a&&(wk(e,l,a,f),s[t]=void 0)}}const _k=/(Once|Passive|Capture)$/,kk=/^on:?(?:Once|Passive|Capture)$/;function Ck(e){let t,n;for(;(n=e.match(_k))&&!kk.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):si(e.slice(2)),t]}let Kd=0;const Tk=Promise.resolve(),Sk=()=>Kd||(Tk.then(()=>Kd=0),Kd=Date.now());function xk(e,t){const n=o=>{if(!o._vts)o._vts=Date.now();else if(o._vts<=n.attached)return;const r=n.value;if(ft(r)){const s=o.stopImmediatePropagation;o.stopImmediatePropagation=()=>{s.call(o),o._stopped=!0};const a=r.slice(),l=[o];for(let f=0;f<a.length&&!o._stopped;f++){const m=a[f];m&&Yr(m,t,5,l)}}else Yr(r,t,5,[o])};return n.value=e,n.attached=Sk(),n}const Vh=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Ak=(e,t,n,o,r,s)=>{const a=r==="svg";t==="class"?pk(e,o,a):t==="style"?vk(e,n,o):Qc(t)?Xc(t)||bk(e,t,n,o,s):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Pk(e,t,o,a))?(Hh(e,t,o),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&zh(e,t,o,a,s,t!=="value")):e._isVueCE&&(Ek(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!dn(o)))?Hh(e,Yo(t),o,s,t):(t==="true-value"?e._trueValue=o:t==="false-value"&&(e._falseValue=o),zh(e,t,o,a))};function Pk(e,t,n,o){if(o)return!!(t==="innerHTML"||t==="textContent"||t in e&&Vh(t)&&bt(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 Vh(t)&&dn(n)?!1:t in e}function Ek(e,t){const n=e._def.props;if(!n)return!1;const o=Yo(t);return Array.isArray(n)?n.some(r=>Yo(r)===o):Object.keys(n).some(r=>Yo(r)===o)}const Gc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return ft(t)?n=>Ic(t,n):t};function Ik(e){e.target.composing=!0}function Gh(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Cl=Symbol("_assign");function Kh(e,t,n){return t&&(e=e.trim()),n&&(e=Zf(e)),e}const an={created(e,{modifiers:{lazy:t,trim:n,number:o}},r){e[Cl]=Gc(r);const s=o||r.props&&r.props.type==="number";Ni(e,t?"change":"input",a=>{a.target.composing||e[Cl](Kh(e.value,n,s))}),(n||s)&&Ni(e,"change",()=>{e.value=Kh(e.value,n,s)}),t||(Ni(e,"compositionstart",Ik),Ni(e,"compositionend",Gh),Ni(e,"change",Gh))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:o,trim:r,number:s}},a){if(e[Cl]=Gc(a),e.composing)return;const l=(s||e.type==="number")&&!/^0\d/.test(e.value)?Zf(e.value):e.value,f=t??"";if(l===f)return;const m=e.getRootNode();(m instanceof Document||m instanceof ShadowRoot)&&m.activeElement===e&&e.type!=="range"&&(o&&t===n||r&&e.value.trim()===f)||(e.value=f)}},Jg={deep:!0,created(e,t,n){e[Cl]=Gc(n),Ni(e,"change",()=>{const o=e._modelValue,r=Rk(e),s=e.checked,a=e[Cl];if(ft(o)){const l=Uv(o,r),f=l!==-1;if(s&&!f)a(o.concat(r));else if(!s&&f){const m=[...o];m.splice(l,1),a(m)}}else if(Zc(o)){const l=new Set(o);s?l.add(r):l.delete(r),a(l)}else a(Qg(e,s))})},mounted:Yh,beforeUpdate(e,t,n){e[Cl]=Gc(n),Yh(e,t,n)}};function Yh(e,{value:t,oldValue:n},o){e._modelValue=t;let r;if(ft(t))r=Uv(t,o.props.value)>-1;else if(Zc(t))r=t.has(o.props.value);else{if(t===n)return;r=Ru(t,Qg(e,!0))}e.checked!==r&&(e.checked=r)}function Rk(e){return"_value"in e?e._value:e.value}function Qg(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const Mk=["ctrl","shift","alt","meta"],$k={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)=>Mk.some(n=>e[`${n}Key`]&&!t.includes(n))},Qe=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),o=t.join(".");return n[o]||(n[o]=(r,...s)=>{for(let a=0;a<t.length;a++){const l=$k[t[a]];if(l&&l(r,t))return}return e(r,...s)})},jk={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Pn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),o=t.join(".");return n[o]||(n[o]=r=>{if(!("key"in r))return;const s=si(r.key);if(t.some(a=>a===s||jk[a]===s))return e(r)})},Nk=Un({patchProp:Ak},sk);let Jh;function Lk(){return Jh||(Jh=B0(Nk))}const Ok=(...e)=>{const t=Lk().createApp(...e),{mount:n}=t;return t.mount=o=>{const r=Fk(o);if(!r)return;const s=t._component;!bt(s)&&!s.render&&!s.template&&(s.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const a=n(r,!1,Dk(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),a},t};function Dk(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Fk(e){return dn(e)?document.querySelector(e):e}const Uk="modulepreload",Bk=function(e){return"/"+e},Qh={},au=function(t,n,o){let r=Promise.resolve();if(n&&n.length>0){let a=function(m){return Promise.all(m.map(g=>Promise.resolve(g).then(w=>({status:"fulfilled",value:w}),w=>({status:"rejected",reason:w}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),f=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));r=a(n.map(m=>{if(m=Bk(m),m in Qh)return;Qh[m]=!0;const g=m.endsWith(".css"),w=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${w}`))return;const x=document.createElement("link");if(x.rel=g?"stylesheet":Uk,g||(x.as="script"),x.crossOrigin="",x.href=m,f&&x.setAttribute("nonce",f),document.head.appendChild(x),g)return new Promise((R,L)=>{x.addEventListener("load",R),x.addEventListener("error",()=>L(new Error(`Unable to preload CSS for ${m}`)))})}))}function s(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return r.then(a=>{for(const l of a||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})};/*!
19
+ * vue-router v4.6.4
20
+ * (c) 2025 Eduardo San Martin Morote
21
+ * @license MIT
22
+ */const hl=typeof document<"u";function Xg(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function qk(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Xg(e.default)}const Bt=Object.assign;function Yd(e,t){const n={};for(const o in t){const r=t[o];n[o]=Sa(r)?r.map(e):e(r)}return n}const yu=()=>{},Sa=Array.isArray;function Xh(e,t){const n={};for(const o in e)n[o]=o in t?t[o]:e[o];return n}const Zg=/#/g,zk=/&/g,Hk=/\//g,Wk=/=/g,Vk=/\?/g,ey=/\+/g,Gk=/%5B/g,Kk=/%5D/g,ty=/%5E/g,Yk=/%60/g,ny=/%7B/g,Jk=/%7C/g,oy=/%7D/g,Qk=/%20/g;function vp(e){return e==null?"":encodeURI(""+e).replace(Jk,"|").replace(Gk,"[").replace(Kk,"]")}function Xk(e){return vp(e).replace(ny,"{").replace(oy,"}").replace(ty,"^")}function Mf(e){return vp(e).replace(ey,"%2B").replace(Qk,"+").replace(Zg,"%23").replace(zk,"%26").replace(Yk,"`").replace(ny,"{").replace(oy,"}").replace(ty,"^")}function Zk(e){return Mf(e).replace(Wk,"%3D")}function eC(e){return vp(e).replace(Zg,"%23").replace(Vk,"%3F")}function tC(e){return eC(e).replace(Hk,"%2F")}function Pu(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const nC=/\/$/,oC=e=>e.replace(nC,"");function Jd(e,t,n="/"){let o,r={},s="",a="";const l=t.indexOf("#");let f=t.indexOf("?");return f=l>=0&&f>l?-1:f,f>=0&&(o=t.slice(0,f),s=t.slice(f,l>0?l:t.length),r=e(s.slice(1))),l>=0&&(o=o||t.slice(0,l),a=t.slice(l,t.length)),o=iC(o??t,n),{fullPath:o+s+a,path:o,query:r,hash:Pu(a)}}function rC(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Zh(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function aC(e,t,n){const o=t.matched.length-1,r=n.matched.length-1;return o>-1&&o===r&&El(t.matched[o],n.matched[r])&&ry(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function El(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function ry(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!sC(e[n],t[n]))return!1;return!0}function sC(e,t){return Sa(e)?em(e,t):Sa(t)?em(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function em(e,t){return Sa(t)?e.length===t.length&&e.every((n,o)=>n===t[o]):e.length===1&&e[0]===t}function iC(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 s=n.length-1,a,l;for(a=0;a<o.length;a++)if(l=o[a],l!==".")if(l==="..")s>1&&s--;else break;return n.slice(0,s).join("/")+"/"+o.slice(a).join("/")}const Ys={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let $f=function(e){return e.pop="pop",e.push="push",e}({}),Qd=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function lC(e){if(!e)if(hl){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),oC(e)}const uC=/^[^#]+#/;function cC(e,t){return e.replace(uC,"#")+t}function dC(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 ud=()=>({left:window.scrollX,top:window.scrollY});function fC(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=dC(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 tm(e,t){return(history.state?history.state.position-t:-1)+e}const jf=new Map;function pC(e,t){jf.set(e,t)}function hC(e){const t=jf.get(e);return jf.delete(e),t}function mC(e){return typeof e=="string"||e&&typeof e=="object"}function ay(e){return typeof e=="string"||typeof e=="symbol"}let En=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 sy=Symbol("");En.MATCHER_NOT_FOUND+"",En.NAVIGATION_GUARD_REDIRECT+"",En.NAVIGATION_ABORTED+"",En.NAVIGATION_CANCELLED+"",En.NAVIGATION_DUPLICATED+"";function Il(e,t){return Bt(new Error,{type:e,[sy]:!0},t)}function ms(e,t){return e instanceof Error&&sy in e&&(t==null||!!(e.type&t))}const vC=["params","query","hash"];function gC(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of vC)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function yC(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(ey," "),s=r.indexOf("="),a=Pu(s<0?r:r.slice(0,s)),l=s<0?null:Pu(r.slice(s+1));if(a in t){let f=t[a];Sa(f)||(f=t[a]=[f]),f.push(l)}else t[a]=l}return t}function nm(e){let t="";for(let n in e){const o=e[n];if(n=Zk(n),o==null){o!==void 0&&(t+=(t.length?"&":"")+n);continue}(Sa(o)?o.map(r=>r&&Mf(r)):[o&&Mf(o)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+n,r!=null&&(t+="="+r))})}return t}function wC(e){const t={};for(const n in e){const o=e[n];o!==void 0&&(t[n]=Sa(o)?o.map(r=>r==null?null:""+r):o==null?o:""+o)}return t}const bC=Symbol(""),om=Symbol(""),cd=Symbol(""),gp=Symbol(""),Nf=Symbol("");function su(){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 ti(e,t,n,o,r,s=a=>a()){const a=o&&(o.enterCallbacks[r]=o.enterCallbacks[r]||[]);return()=>new Promise((l,f)=>{const m=x=>{x===!1?f(Il(En.NAVIGATION_ABORTED,{from:n,to:t})):x instanceof Error?f(x):mC(x)?f(Il(En.NAVIGATION_GUARD_REDIRECT,{from:t,to:x})):(a&&o.enterCallbacks[r]===a&&typeof x=="function"&&a.push(x),l())},g=s(()=>e.call(o&&o.instances[r],t,n,m));let w=Promise.resolve(g);e.length<3&&(w=w.then(m)),w.catch(x=>f(x))})}function Xd(e,t,n,o,r=s=>s()){const s=[];for(const a of e)for(const l in a.components){let f=a.components[l];if(!(t!=="beforeRouteEnter"&&!a.instances[l]))if(Xg(f)){const m=(f.__vccOpts||f)[t];m&&s.push(ti(m,n,o,a,l,r))}else{let m=f();s.push(()=>m.then(g=>{if(!g)throw new Error(`Couldn't resolve component "${l}" at "${a.path}"`);const w=qk(g)?g.default:g;a.mods[l]=g,a.components[l]=w;const x=(w.__vccOpts||w)[t];return x&&ti(x,n,o,a,l,r)()}))}}return s}function _C(e,t){const n=[],o=[],r=[],s=Math.max(t.matched.length,e.matched.length);for(let a=0;a<s;a++){const l=t.matched[a];l&&(e.matched.find(m=>El(m,l))?o.push(l):n.push(l));const f=e.matched[a];f&&(t.matched.find(m=>El(m,f))||r.push(f))}return[n,o,r]}/*!
23
+ * vue-router v4.6.4
24
+ * (c) 2025 Eduardo San Martin Morote
25
+ * @license MIT
26
+ */let kC=()=>location.protocol+"//"+location.host;function iy(e,t){const{pathname:n,search:o,hash:r}=t,s=e.indexOf("#");if(s>-1){let a=r.includes(e.slice(s))?e.slice(s).length:1,l=r.slice(a);return l[0]!=="/"&&(l="/"+l),Zh(l,"")}return Zh(n,e)+o+r}function CC(e,t,n,o){let r=[],s=[],a=null;const l=({state:x})=>{const R=iy(e,location),L=n.value,B=t.value;let Y=0;if(x){if(n.value=R,t.value=x,a&&a===L){a=null;return}Y=B?x.position-B.position:0}else o(R);r.forEach(ae=>{ae(n.value,L,{delta:Y,type:$f.pop,direction:Y?Y>0?Qd.forward:Qd.back:Qd.unknown})})};function f(){a=n.value}function m(x){r.push(x);const R=()=>{const L=r.indexOf(x);L>-1&&r.splice(L,1)};return s.push(R),R}function g(){if(document.visibilityState==="hidden"){const{history:x}=window;if(!x.state)return;x.replaceState(Bt({},x.state,{scroll:ud()}),"")}}function w(){for(const x of s)x();s=[],window.removeEventListener("popstate",l),window.removeEventListener("pagehide",g),document.removeEventListener("visibilitychange",g)}return window.addEventListener("popstate",l),window.addEventListener("pagehide",g),document.addEventListener("visibilitychange",g),{pauseListeners:f,listen:m,destroy:w}}function rm(e,t,n,o=!1,r=!1){return{back:e,current:t,forward:n,replaced:o,position:window.history.length,scroll:r?ud():null}}function TC(e){const{history:t,location:n}=window,o={value:iy(e,n)},r={value:t.state};r.value||s(o.value,{back:null,current:o.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function s(f,m,g){const w=e.indexOf("#"),x=w>-1?(n.host&&document.querySelector("base")?e:e.slice(w))+f:kC()+e+f;try{t[g?"replaceState":"pushState"](m,"",x),r.value=m}catch(R){console.error(R),n[g?"replace":"assign"](x)}}function a(f,m){s(f,Bt({},t.state,rm(r.value.back,f,r.value.forward,!0),m,{position:r.value.position}),!0),o.value=f}function l(f,m){const g=Bt({},r.value,t.state,{forward:f,scroll:ud()});s(g.current,g,!0),s(f,Bt({},rm(o.value,f,null),{position:g.position+1},m),!1),o.value=f}return{location:o,state:r,push:l,replace:a}}function SC(e){e=lC(e);const t=TC(e),n=CC(e,t.state,t.location,t.replace);function o(s,a=!0){a||n.pauseListeners(),history.go(s)}const r=Bt({location:"",base:e,go:o,createHref:cC.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 xC(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),SC(e)}let Li=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var Gn=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}(Gn||{});const AC={type:Li.Static,value:""},PC=/[a-zA-Z0-9_]/;function EC(e){if(!e)return[[]];if(e==="/")return[[AC]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(R){throw new Error(`ERR (${n})/"${m}": ${R}`)}let n=Gn.Static,o=n;const r=[];let s;function a(){s&&r.push(s),s=[]}let l=0,f,m="",g="";function w(){m&&(n===Gn.Static?s.push({type:Li.Static,value:m}):n===Gn.Param||n===Gn.ParamRegExp||n===Gn.ParamRegExpEnd?(s.length>1&&(f==="*"||f==="+")&&t(`A repeatable param (${m}) must be alone in its segment. eg: '/:ids+.`),s.push({type:Li.Param,value:m,regexp:g,repeatable:f==="*"||f==="+",optional:f==="*"||f==="?"})):t("Invalid state to consume buffer"),m="")}function x(){m+=f}for(;l<e.length;){if(f=e[l++],f==="\\"&&n!==Gn.ParamRegExp){o=n,n=Gn.EscapeNext;continue}switch(n){case Gn.Static:f==="/"?(m&&w(),a()):f===":"?(w(),n=Gn.Param):x();break;case Gn.EscapeNext:x(),n=o;break;case Gn.Param:f==="("?n=Gn.ParamRegExp:PC.test(f)?x():(w(),n=Gn.Static,f!=="*"&&f!=="?"&&f!=="+"&&l--);break;case Gn.ParamRegExp:f===")"?g[g.length-1]=="\\"?g=g.slice(0,-1)+f:n=Gn.ParamRegExpEnd:g+=f;break;case Gn.ParamRegExpEnd:w(),n=Gn.Static,f!=="*"&&f!=="?"&&f!=="+"&&l--,g="";break;default:t("Unknown state");break}}return n===Gn.ParamRegExp&&t(`Unfinished custom RegExp for param "${m}"`),w(),a(),r}const am="[^/]+?",IC={sensitive:!1,strict:!1,start:!0,end:!0};var Vo=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}(Vo||{});const RC=/[.+*?^${}()[\]/\\]/g;function MC(e,t){const n=Bt({},IC,t),o=[];let r=n.start?"^":"";const s=[];for(const m of e){const g=m.length?[]:[Vo.Root];n.strict&&!m.length&&(r+="/");for(let w=0;w<m.length;w++){const x=m[w];let R=Vo.Segment+(n.sensitive?Vo.BonusCaseSensitive:0);if(x.type===Li.Static)w||(r+="/"),r+=x.value.replace(RC,"\\$&"),R+=Vo.Static;else if(x.type===Li.Param){const{value:L,repeatable:B,optional:Y,regexp:ae}=x;s.push({name:L,repeatable:B,optional:Y});const z=ae||am;if(z!==am){R+=Vo.BonusCustomRegExp;try{`${z}`}catch(X){throw new Error(`Invalid custom RegExp for param "${L}" (${z}): `+X.message)}}let Z=B?`((?:${z})(?:/(?:${z}))*)`:`(${z})`;w||(Z=Y&&m.length<2?`(?:/${Z})`:"/"+Z),Y&&(Z+="?"),r+=Z,R+=Vo.Dynamic,Y&&(R+=Vo.BonusOptional),B&&(R+=Vo.BonusRepeatable),z===".*"&&(R+=Vo.BonusWildcard)}g.push(R)}o.push(g)}if(n.strict&&n.end){const m=o.length-1;o[m][o[m].length-1]+=Vo.BonusStrict}n.strict||(r+="/?"),n.end?r+="$":n.strict&&!r.endsWith("/")&&(r+="(?:/|$)");const a=new RegExp(r,n.sensitive?"":"i");function l(m){const g=m.match(a),w={};if(!g)return null;for(let x=1;x<g.length;x++){const R=g[x]||"",L=s[x-1];w[L.name]=R&&L.repeatable?R.split("/"):R}return w}function f(m){let g="",w=!1;for(const x of e){(!w||!g.endsWith("/"))&&(g+="/"),w=!1;for(const R of x)if(R.type===Li.Static)g+=R.value;else if(R.type===Li.Param){const{value:L,repeatable:B,optional:Y}=R,ae=L in m?m[L]:"";if(Sa(ae)&&!B)throw new Error(`Provided param "${L}" is an array but it is not repeatable (* or + modifiers)`);const z=Sa(ae)?ae.join("/"):ae;if(!z)if(Y)x.length<2&&(g.endsWith("/")?g=g.slice(0,-1):w=!0);else throw new Error(`Missing required param "${L}"`);g+=z}}return g||"/"}return{re:a,score:o,keys:s,parse:l,stringify:f}}function $C(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]===Vo.Static+Vo.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===Vo.Static+Vo.Segment?1:-1:0}function ly(e,t){let n=0;const o=e.score,r=t.score;for(;n<o.length&&n<r.length;){const s=$C(o[n],r[n]);if(s)return s;n++}if(Math.abs(r.length-o.length)===1){if(sm(o))return 1;if(sm(r))return-1}return r.length-o.length}function sm(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const jC={strict:!1,end:!0,sensitive:!1};function NC(e,t,n){const o=MC(EC(e.path),n),r=Bt(o,{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function LC(e,t){const n=[],o=new Map;t=Xh(jC,t);function r(w){return o.get(w)}function s(w,x,R){const L=!R,B=lm(w);B.aliasOf=R&&R.record;const Y=Xh(t,w),ae=[B];if("alias"in w){const X=typeof w.alias=="string"?[w.alias]:w.alias;for(const ye of X)ae.push(lm(Bt({},B,{components:R?R.record.components:B.components,path:ye,aliasOf:R?R.record:B})))}let z,Z;for(const X of ae){const{path:ye}=X;if(x&&ye[0]!=="/"){const Me=x.record.path,Se=Me[Me.length-1]==="/"?"":"/";X.path=x.record.path+(ye&&Se+ye)}if(z=NC(X,x,Y),R?R.alias.push(z):(Z=Z||z,Z!==z&&Z.alias.push(z),L&&w.name&&!um(z)&&a(w.name)),uy(z)&&f(z),B.children){const Me=B.children;for(let Se=0;Se<Me.length;Se++)s(Me[Se],z,R&&R.children[Se])}R=R||z}return Z?()=>{a(Z)}:yu}function a(w){if(ay(w)){const x=o.get(w);x&&(o.delete(w),n.splice(n.indexOf(x),1),x.children.forEach(a),x.alias.forEach(a))}else{const x=n.indexOf(w);x>-1&&(n.splice(x,1),w.record.name&&o.delete(w.record.name),w.children.forEach(a),w.alias.forEach(a))}}function l(){return n}function f(w){const x=FC(w,n);n.splice(x,0,w),w.record.name&&!um(w)&&o.set(w.record.name,w)}function m(w,x){let R,L={},B,Y;if("name"in w&&w.name){if(R=o.get(w.name),!R)throw Il(En.MATCHER_NOT_FOUND,{location:w});Y=R.record.name,L=Bt(im(x.params,R.keys.filter(Z=>!Z.optional).concat(R.parent?R.parent.keys.filter(Z=>Z.optional):[]).map(Z=>Z.name)),w.params&&im(w.params,R.keys.map(Z=>Z.name))),B=R.stringify(L)}else if(w.path!=null)B=w.path,R=n.find(Z=>Z.re.test(B)),R&&(L=R.parse(B),Y=R.record.name);else{if(R=x.name?o.get(x.name):n.find(Z=>Z.re.test(x.path)),!R)throw Il(En.MATCHER_NOT_FOUND,{location:w,currentLocation:x});Y=R.record.name,L=Bt({},x.params,w.params),B=R.stringify(L)}const ae=[];let z=R;for(;z;)ae.unshift(z.record),z=z.parent;return{name:Y,path:B,params:L,matched:ae,meta:DC(ae)}}e.forEach(w=>s(w));function g(){n.length=0,o.clear()}return{addRoute:s,resolve:m,removeRoute:a,clearRoutes:g,getRoutes:l,getRecordMatcher:r}}function im(e,t){const n={};for(const o of t)o in e&&(n[o]=e[o]);return n}function lm(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:OC(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 OC(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 um(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function DC(e){return e.reduce((t,n)=>Bt(t,n.meta),{})}function FC(e,t){let n=0,o=t.length;for(;n!==o;){const s=n+o>>1;ly(e,t[s])<0?o=s:n=s+1}const r=UC(e);return r&&(o=t.lastIndexOf(r,o-1)),o}function UC(e){let t=e;for(;t=t.parent;)if(uy(t)&&ly(e,t)===0)return t}function uy({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function cm(e){const t=_a(cd),n=_a(gp),o=ee(()=>{const f=v(e.to);return t.resolve(f)}),r=ee(()=>{const{matched:f}=o.value,{length:m}=f,g=f[m-1],w=n.matched;if(!g||!w.length)return-1;const x=w.findIndex(El.bind(null,g));if(x>-1)return x;const R=dm(f[m-2]);return m>1&&dm(g)===R&&w[w.length-1].path!==R?w.findIndex(El.bind(null,f[m-2])):x}),s=ee(()=>r.value>-1&&WC(n.params,o.value.params)),a=ee(()=>r.value>-1&&r.value===n.matched.length-1&&ry(n.params,o.value.params));function l(f={}){if(HC(f)){const m=t[v(e.replace)?"replace":"push"](v(e.to)).catch(yu);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>m),m}return Promise.resolve()}return{route:o,href:ee(()=>o.value.href),isActive:s,isExactActive:a,navigate:l}}function BC(e){return e.length===1?e[0]:e}const qC=Nn({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:cm,setup(e,{slots:t}){const n=rd(cm(e)),{options:o}=_a(cd),r=ee(()=>({[fm(e.activeClass,o.linkActiveClass,"router-link-active")]:n.isActive,[fm(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const s=t.default&&BC(t.default(n));return e.custom?s:mp("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:r.value},s)}}}),zC=qC;function HC(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 WC(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(!Sa(r)||r.length!==o.length||o.some((s,a)=>s.valueOf()!==r[a].valueOf()))return!1}return!0}function dm(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const fm=(e,t,n)=>e??t??n,VC=Nn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const o=_a(Nf),r=ee(()=>e.route||o.value),s=_a(om,0),a=ee(()=>{let m=v(s);const{matched:g}=r.value;let w;for(;(w=g[m])&&!w.components;)m++;return m}),l=ee(()=>r.value.matched[a.value]);Rc(om,ee(()=>a.value+1)),Rc(bC,l),Rc(Nf,r);const f=S();return rt(()=>[f.value,l.value,e.name],([m,g,w],[x,R,L])=>{g&&(g.instances[w]=m,R&&R!==g&&m&&m===x&&(g.leaveGuards.size||(g.leaveGuards=R.leaveGuards),g.updateGuards.size||(g.updateGuards=R.updateGuards))),m&&g&&(!R||!El(g,R)||!x)&&(g.enterCallbacks[w]||[]).forEach(B=>B(m))},{flush:"post"}),()=>{const m=r.value,g=e.name,w=l.value,x=w&&w.components[g];if(!x)return pm(n.default,{Component:x,route:m});const R=w.props[g],L=R?R===!0?m.params:typeof R=="function"?R(m):R:null,Y=mp(x,Bt({},L,t,{onVnodeUnmounted:ae=>{ae.component.isUnmounted&&(w.instances[g]=null)},ref:f}));return pm(n.default,{Component:Y,route:m})||Y}}});function pm(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const GC=VC;function KC(e){const t=LC(e.routes,e),n=e.parseQuery||yC,o=e.stringifyQuery||nm,r=e.history,s=su(),a=su(),l=su(),f=B_(Ys);let m=Ys;hl&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const g=Yd.bind(null,se=>""+se),w=Yd.bind(null,tC),x=Yd.bind(null,Pu);function R(se,ne){let re,H;return ay(se)?(re=t.getRecordMatcher(se),H=ne):H=se,t.addRoute(H,re)}function L(se){const ne=t.getRecordMatcher(se);ne&&t.removeRoute(ne)}function B(){return t.getRoutes().map(se=>se.record)}function Y(se){return!!t.getRecordMatcher(se)}function ae(se,ne){if(ne=Bt({},ne||f.value),typeof se=="string"){const G=Jd(n,se,ne.path),ie=t.resolve({path:G.path},ne),le=r.createHref(G.fullPath);return Bt(G,ie,{params:x(ie.params),hash:Pu(G.hash),redirectedFrom:void 0,href:le})}let re;if(se.path!=null)re=Bt({},se,{path:Jd(n,se.path,ne.path).path});else{const G=Bt({},se.params);for(const ie in G)G[ie]==null&&delete G[ie];re=Bt({},se,{params:w(G)}),ne.params=w(ne.params)}const H=t.resolve(re,ne),Be=se.hash||"";H.params=g(x(H.params));const $=rC(o,Bt({},se,{hash:Xk(Be),path:H.path})),D=r.createHref($);return Bt({fullPath:$,hash:Be,query:o===nm?wC(se.query):se.query||{}},H,{redirectedFrom:void 0,href:D})}function z(se){return typeof se=="string"?Jd(n,se,f.value.path):Bt({},se)}function Z(se,ne){if(m!==se)return Il(En.NAVIGATION_CANCELLED,{from:ne,to:se})}function X(se){return Se(se)}function ye(se){return X(Bt(z(se),{replace:!0}))}function Me(se,ne){const re=se.matched[se.matched.length-1];if(re&&re.redirect){const{redirect:H}=re;let Be=typeof H=="function"?H(se,ne):H;return typeof Be=="string"&&(Be=Be.includes("?")||Be.includes("#")?Be=z(Be):{path:Be},Be.params={}),Bt({query:se.query,hash:se.hash,params:Be.path!=null?{}:se.params},Be)}}function Se(se,ne){const re=m=ae(se),H=f.value,Be=se.state,$=se.force,D=se.replace===!0,G=Me(re,H);if(G)return Se(Bt(z(G),{state:typeof G=="object"?Bt({},Be,G.state):Be,force:$,replace:D}),ne||re);const ie=re;ie.redirectedFrom=ne;let le;return!$&&aC(o,H,re)&&(le=Il(En.NAVIGATION_DUPLICATED,{to:ie,from:H}),Ge(H,H,!0,!1)),(le?Promise.resolve(le):Ue(ie,H)).catch(oe=>ms(oe)?ms(oe,En.NAVIGATION_GUARD_REDIRECT)?oe:ct(oe):He(oe,ie,H)).then(oe=>{if(oe){if(ms(oe,En.NAVIGATION_GUARD_REDIRECT))return Se(Bt({replace:D},z(oe.to),{state:typeof oe.to=="object"?Bt({},Be,oe.to.state):Be,force:$}),ne||ie)}else oe=he(ie,H,!0,D,Be);return $e(ie,H,oe),oe})}function Fe(se,ne){const re=Z(se,ne);return re?Promise.reject(re):Promise.resolve()}function pe(se){const ne=_t.values().next().value;return ne&&typeof ne.runWithContext=="function"?ne.runWithContext(se):se()}function Ue(se,ne){let re;const[H,Be,$]=_C(se,ne);re=Xd(H.reverse(),"beforeRouteLeave",se,ne);for(const G of H)G.leaveGuards.forEach(ie=>{re.push(ti(ie,se,ne))});const D=Fe.bind(null,se,ne);return re.push(D),gt(re).then(()=>{re=[];for(const G of s.list())re.push(ti(G,se,ne));return re.push(D),gt(re)}).then(()=>{re=Xd(Be,"beforeRouteUpdate",se,ne);for(const G of Be)G.updateGuards.forEach(ie=>{re.push(ti(ie,se,ne))});return re.push(D),gt(re)}).then(()=>{re=[];for(const G of $)if(G.beforeEnter)if(Sa(G.beforeEnter))for(const ie of G.beforeEnter)re.push(ti(ie,se,ne));else re.push(ti(G.beforeEnter,se,ne));return re.push(D),gt(re)}).then(()=>(se.matched.forEach(G=>G.enterCallbacks={}),re=Xd($,"beforeRouteEnter",se,ne,pe),re.push(D),gt(re))).then(()=>{re=[];for(const G of a.list())re.push(ti(G,se,ne));return re.push(D),gt(re)}).catch(G=>ms(G,En.NAVIGATION_CANCELLED)?G:Promise.reject(G))}function $e(se,ne,re){l.list().forEach(H=>pe(()=>H(se,ne,re)))}function he(se,ne,re,H,Be){const $=Z(se,ne);if($)return $;const D=ne===Ys,G=hl?history.state:{};re&&(H||D?r.replace(se.fullPath,Bt({scroll:D&&G&&G.scroll},Be)):r.push(se.fullPath,Be)),f.value=se,Ge(se,ne,re,D),ct()}let Te;function Ae(){Te||(Te=r.listen((se,ne,re)=>{if(!Tt.listening)return;const H=ae(se),Be=Me(H,Tt.currentRoute.value);if(Be){Se(Bt(Be,{replace:!0,force:!0}),H).catch(yu);return}m=H;const $=f.value;hl&&pC(tm($.fullPath,re.delta),ud()),Ue(H,$).catch(D=>ms(D,En.NAVIGATION_ABORTED|En.NAVIGATION_CANCELLED)?D:ms(D,En.NAVIGATION_GUARD_REDIRECT)?(Se(Bt(z(D.to),{force:!0}),H).then(G=>{ms(G,En.NAVIGATION_ABORTED|En.NAVIGATION_DUPLICATED)&&!re.delta&&re.type===$f.pop&&r.go(-1,!1)}).catch(yu),Promise.reject()):(re.delta&&r.go(-re.delta,!1),He(D,H,$))).then(D=>{D=D||he(H,$,!1),D&&(re.delta&&!ms(D,En.NAVIGATION_CANCELLED)?r.go(-re.delta,!1):re.type===$f.pop&&ms(D,En.NAVIGATION_ABORTED|En.NAVIGATION_DUPLICATED)&&r.go(-1,!1)),$e(H,$,D)}).catch(yu)}))}let Pe=su(),De=su(),Ye;function He(se,ne,re){ct(se);const H=De.list();return H.length?H.forEach(Be=>Be(se,ne,re)):console.error(se),Promise.reject(se)}function St(){return Ye&&f.value!==Ys?Promise.resolve():new Promise((se,ne)=>{Pe.add([se,ne])})}function ct(se){return Ye||(Ye=!se,Ae(),Pe.list().forEach(([ne,re])=>se?re(se):ne()),Pe.reset()),se}function Ge(se,ne,re,H){const{scrollBehavior:Be}=e;if(!hl||!Be)return Promise.resolve();const $=!re&&hC(tm(se.fullPath,0))||(H||!re)&&history.state&&history.state.scroll||null;return zt().then(()=>Be(se,ne,$)).then(D=>D&&fC(D)).catch(D=>He(D,se,ne))}const nt=se=>r.go(se);let dt;const _t=new Set,Tt={currentRoute:f,listening:!0,addRoute:R,removeRoute:L,clearRoutes:t.clearRoutes,hasRoute:Y,getRoutes:B,resolve:ae,options:e,push:X,replace:ye,go:nt,back:()=>nt(-1),forward:()=>nt(1),beforeEach:s.add,beforeResolve:a.add,afterEach:l.add,onError:De.add,isReady:St,install(se){se.component("RouterLink",zC),se.component("RouterView",GC),se.config.globalProperties.$router=Tt,Object.defineProperty(se.config.globalProperties,"$route",{enumerable:!0,get:()=>v(f)}),hl&&!dt&&f.value===Ys&&(dt=!0,X(r.location).catch(H=>{}));const ne={};for(const H in Ys)Object.defineProperty(ne,H,{get:()=>f.value[H],enumerable:!0});se.provide(cd,Tt),se.provide(gp,og(ne)),se.provide(Nf,f);const re=se.unmount;_t.add(se),se.unmount=function(){_t.delete(se),_t.size<1&&(m=Ys,Te&&Te(),Te=null,f.value=Ys,dt=!1,Ye=!1),re()}}};function gt(se){return se.reduce((ne,re)=>ne.then(()=>pe(re)),Promise.resolve())}return Tt}function YC(){return _a(cd)}function JC(e){return _a(gp)}const hm=768;function yp(){const e=S(typeof window<"u"?window.innerWidth<hm:!1);let t=null;function n(o){e.value=o.matches}return Ps(()=>{t=window.matchMedia(`(max-width: ${hm-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Nu(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const QC={key:0,class:"desktop-sidebar"},XC={class:"desktop-main"},mm="codex-web-local.sidebar-width.v1",ZC=260,eT=620,vm=320,tT=Nn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=yp();function o(m){return Math.min(eT,Math.max(ZC,m))}function r(){if(typeof window>"u")return vm;const m=window.localStorage.getItem(mm),g=Number(m);return Number.isFinite(g)?o(g):vm}const s=S(r()),a=ee(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${s.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function l(m){typeof window>"u"||window.localStorage.setItem(mm,String(m))}function f(m){m.preventDefault();const g=m.clientX,w=s.value,x=L=>{const B=L.clientX-g;s.value=o(w+B)},R=()=>{l(s.value),window.removeEventListener("mousemove",x),window.removeEventListener("mouseup",R)};window.addEventListener("mousemove",x),window.addEventListener("mouseup",R)}return(m,g)=>(T(),A("div",{class:Ke(["desktop-layout",{"is-mobile":v(n)}]),style:Vr(a.value)},[v(n)?(T(),at(Bi,{key:0,to:"body"},[xe(Au,{name:"drawer"},{default:tt(()=>[e.isSidebarCollapsed?J("",!0):(T(),A("div",{key:0,class:"mobile-drawer-backdrop",onClick:g[1]||(g[1]=w=>m.$emit("close-sidebar"))},[d("aside",{class:"mobile-drawer",onClick:g[0]||(g[0]=Qe(()=>{},["stop"]))},[ur(m.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):J("",!0),v(n)?J("",!0):(T(),A(ze,{key:1},[e.isSidebarCollapsed?J("",!0):(T(),A("aside",QC,[ur(m.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?J("",!0):(T(),A("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:f},null,32))],64)),d("section",XC,[ur(m.$slots,"content",{},void 0)])],6))}}),At=(e,t)=>{const n=e.__vccOpts||e;for(const[o,r]of t)n[o]=r;return n},nT=At(tT,[["__scopeId","data-v-782e512b"]]);function gm(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class ka extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function Jr(e,t){if(typeof e=="string"&&e.length>0)return e;const n=gm(e);if(!n)return t;const o=n.error;if(typeof o=="string"&&o.length>0)return o;const r=gm(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 xa(e,t,n){return e instanceof ka?e:e instanceof Error?new ka(e.message||t,{code:"unknown_error",method:n}):new ka(t,{code:"unknown_error",method:n})}function cy(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function oT(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(l){throw new ka(l instanceof Error?l.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let r=null,s=null;try{s=await o.text(),r=JSON.parse(s)}catch{r=null}if(!o.ok){const l=Jr(r,"")||(s==null?void 0:s.slice(0,500))||"",f=`RPC ${e} failed with HTTP ${o.status}`;throw new ka(l?`${f}: ${l}`:f,{code:"http_error",method:e,status:o.status})}const a=r;if(!a||typeof a!="object"||!("result"in a))throw new ka(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:o.status});return a.result}async function rT(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new ka(Jr(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 aT(e){const t=cy(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 ym(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function sT(e){if(typeof window>"u")return()=>{};let t=null,n=!1,o=null;const r=()=>{o!==null&&(window.clearTimeout(o),o=null)},s=(m,g)=>{if(n||o!==null)return;const w=Math.min(1e3*2**g,1e4);o=window.setTimeout(()=>{o=null,!n&&m()},w)},a=m=>{const g=aT(m);g&&e(g)},l=(m=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const g=new EventSource("/codex-api/events");let w=!1;g.onmessage=x=>{try{a(JSON.parse(x.data))}catch{}},g.addEventListener("ready",x=>{try{const R=x.data?JSON.parse(x.data):{ok:!0};ym(e,R)}catch{ym(e)}}),g.onerror=()=>{n||w||g.readyState===EventSource.CLOSED&&(w=!0,g.close(),s(()=>l(m+1),m))},t=()=>{w=!0,g.close()}},f=(m=0)=>{if(typeof WebSocket>"u"||n){l();return}t==null||t();const g=window.location.protocol==="https:"?"wss:":"ws:",w=new WebSocket(`${g}//${window.location.host}/codex-api/ws`);let x=!1,R=!1,L=window.setTimeout(()=>{x||n||R||(R=!0,w.close(),l())},2500);w.onopen=()=>{x=!0,r(),L!==null&&(window.clearTimeout(L),L=null)},w.onmessage=B=>{try{a(JSON.parse(String(B.data)))}catch{}},w.onerror=()=>{},w.onclose=()=>{if(L!==null&&(window.clearTimeout(L),L=null),!(n||R)){if(!x){l();return}s(()=>f(m+1),m)}},t=()=>{R=!0,L!==null&&(window.clearTimeout(L),L=null),w.close()}};return typeof WebSocket<"u"?f():l(),()=>{n=!0,r(),t==null||t()}}async function iT(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 ka(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 ka(Jr(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function lT(){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 ka(Jr(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=cy(t),o=n==null?void 0:n.data;return Array.isArray(o)?o:[]}const dy=["none","minimal","low","medium","high","xhigh","max","ultra"];function Lf(e){return typeof e=="string"&&dy.some(t=>t===e)}function uT(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function st(e){return uT(e)}function fy(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function cT(e){const t=st(e);return t.startsWith("/")||fy(t)}function dT(e){const t=st(e).replace(/[\\/]+/gu,"/");return fy(t)?t.toLowerCase():t}function xr(e){const t=st(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function Tl(e){const t=st(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function Kr(e){return xr(e)||st(e)||"Projectless"}function Kc(e){const t=st(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function wm(e){return new Date(e*1e3).toISOString()}function fT(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function pT(e){const t=e.error;return typeof(t==null?void 0:t.message)=="string"?t.message.trim():""}const hT=/^##\s+(.+?):\s+(.+?)\s*$/,mT=/^#\s*files mentioned by the user\s*:?\s*$/i;function vT(e){var r,s;const t=e.split(`
27
+ `).findIndex(a=>mT.test(a.trim()));if(t<0)return[];const n=e.split(`
28
+ `).slice(t+1),o=[];for(const a of n){const l=a.trim();if(!l)continue;const f=l.match(hT);if(!f)break;const m=(r=f[1])==null?void 0:r.trim(),g=(s=f[2])==null?void 0:s.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");m&&g&&o.push({label:m,path:g})}return o}function gT(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 py(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function yT(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 wT(e){return e.replace(/&lt;/giu,"<").replace(/&gt;/giu,">").replace(/&amp;/giu,"&")}function Zd(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?wT(n[1].trim()):""}function bT(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=Zd(t,"current_time_iso"),o=Zd(t,"instructions");return!n||!o?null:{automationId:Zd(t,"automation_id"),currentTimeIso:n,instructions:o}}function _T(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],o=[],r=[],s=[];for(const[m,g]of t.entries()){if(g.type==="text"&&typeof g.text=="string"&&g.text.length>0&&n.push(g.text),g.type==="image"&&typeof g.url=="string"&&g.url.trim().length>0&&o.push(g.url.trim()),g.type==="localImage"&&typeof g.path=="string"&&g.path.trim().length>0&&o.push(py(g.path.trim())),g.type==="skill"){const w=typeof g.name=="string"?g.name.trim():"",x=typeof g.path=="string"?g.path.trim():"";w&&x&&r.push({name:w,path:x})}g.type!=="text"&&g.type!=="image"&&g.type!=="localImage"&&g.type!=="skill"&&s.push({id:`${e}:user-content:${m}`,role:"user",text:"",messageType:`userContent.${g.type}`,rawPayload:fT(g),isUnhandled:!0})}const a=n.join(`
29
+ `),l=vT(a),f=bT(a);return{text:(f==null?void 0:f.instructions)??gT(a),images:o,skills:r,fileAttachments:l,rawBlocks:s,isAutomationRun:f!==null,automationDisplayName:(f==null?void 0:f.automationId)||null}}function kT(e){var s;const t=e.replace(/\r\n/g,`
30
+ `).trim();if(!t)return null;const n=t.split(`
31
+ `),o=[],r=[];for(const a of n){const l=a.trim();if(!l){o.length===0&&r.push("");continue}const f=l.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(f){const m=(f[1]??" ").toLowerCase(),g=(s=f[2])==null?void 0:s.trim();if(!g)continue;let w="pending";m==="x"&&(w="completed"),(m==="~"||m===">"||m==="-")&&(w="inProgress"),o.push({step:g,status:w});continue}r.push(l)}return o.length===0?null:{explanation:r.join(`
32
+ `).trim()||void 0,steps:o}}function bm(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 CT(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 hy(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function Of(e){const t=Array.isArray(e)?e:[],n=[];for(const o of t){const r=o,s=typeof r.path=="string"?r.path:"",a=typeof r.diff=="string"?r.diff:"",l=r.kind,f=l==null?void 0:l.type;if(!s||f!=="add"&&f!=="delete"&&f!=="update")continue;const m=f==="update"&&typeof(l==null?void 0:l.move_path)=="string"?l.move_path:null,g=f==="update"?CT(a):f==="add"?{addedLineCount:bm(a),removedLineCount:0}:{addedLineCount:0,removedLineCount:bm(a)};n.push({path:s,operation:f,movedToPath:m,diff:a,...g})}return n}function TT(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=_T(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:[py(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?yT(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(l=>typeof l=="string"):[],o=Array.isArray(t.content)?t.content.filter(l=>typeof l=="string"):[],r=n.join(`
38
+ `).trim(),a=o.join(`
39
+ `).trim()||r;return a?[{id:e.id,role:"assistant",text:a,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 s="completed";const a=typeof r=="string"?r:r==null?void 0:r.type;(a==="inProgress"||a==="in_progress")&&(s="inProgress"),(a==="failed"||a==="error")&&(s="failed");const l=typeof t.error=="object"&&t.error!==null?String(t.error.message??""):"",f=typeof t.durationMs=="number"?t.durationMs:null;return[{id:e.id,role:"system",text:o,messageType:"toolCall",toolCall:{server:n,tool:o,status:s,error:l,durationMs:f}}]}if(e.type==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:kT(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=ST(t.status),o=typeof t.command=="string"?t.command:"",r=typeof t.cwd=="string"?t.cwd:null,s=typeof t.aggregatedOutput=="string"?t.aggregatedOutput:"",a=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:s,exitCode:a}}]}if(e.type==="fileChange"){const t=Of(e.changes),n=hy(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 ST(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function xT(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 AT(e){const t=xT(e);return t.length>0?t:"Untitled thread"}function wp(e){return(e==null?void 0:e.status)==="inProgress"}function bp(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 PT(e){var t;return((t=bp(e))==null?void 0:t.active)===!0}function my(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 s=n.type;if(s==="active"||s==="inProgress")return!0}const r=(Array.isArray(e.turns)?e.turns:[]).at(-1);return wp(r)||PT(e)}function vy(e){const t=e,n=st(typeof t.cwd=="string"?t.cwd:e.cwd),o=dT(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:AT(e),projectName:Kr(n),cwd:n,hasWorktree:r,createdAtIso:wm(e.createdAt),updatedAtIso:wm(e.updatedAt),preview:e.preview,unread:!1,inProgress:my(e),externalSession:bp(e)}}function ET(e){return vy(e.thread)}function IT(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,s)=>new Date(s.updatedAtIso).getTime()-new Date(r.updatedAtIso).getTime())})).sort((n,o)=>{var a,l;const r=new Date(((a=n.threads[0])==null?void 0:a.updatedAtIso)??0).getTime();return new Date(((l=o.threads[0])==null?void 0:l.updatedAtIso)??0).getTime()-r})}function RT(e){const t=e.data.map(vy);return IT(t)}function Ou(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],o=[];for(let r=0;r<n.length;r++){const s=t+r,a=n[r],l=typeof(a==null?void 0:a.id)=="string"?a.id.trim():"",f=l.length>0?l:void 0,m=Array.isArray(a.items)?a.items:[],g=[];for(const x of m)for(const R of TT(x))g.push({...R,turnId:f,turnIndex:s});const w=pT(a);if(a.status==="failed"&&w){const x=f??`turn-${s}`;g.push({id:`${x}-error`,role:"system",text:w,messageType:"turnError",turnId:f,turnIndex:s})}o.push(...g)}return $T(MT(o))}function MT(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 $T(e){var a,l,f;let t=-1;for(let m=0;m<e.length;m+=1)if(((a=e[m])==null?void 0:a.messageType)==="compaction.done"){t=m;break}if(t<0)return e;const n=e[t],o=n.turnIndex;let r=-1;for(let m=0;m<e.length;m+=1)if(((l=e[m])==null?void 0:l.turnIndex)===o&&((f=e[m])==null?void 0:f.role)==="user"){r=m;break}if(r<0||t<=r)return e;const s=e.filter((m,g)=>g!==t);return s.splice(r+1,0,n),s}function _p(e){if(my(e.thread))return!0;const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return wp(t.at(-1))}function gy(e){return bp(e.thread)}function kp(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(wp(o)&&typeof o.id=="string"&&o.id.trim().length>0)return o.id.trim()}return""}const jT=5e3;function ef(e){return e&&e.length>0?e:null}function tf(e){return e&&e.length>0?e:null}let mc=null,wu=null;async function NT(e,t){await vt("fuzzyFileSearch/sessionStart",{sessionId:t,roots:e})}async function LT(e,t){await vt("fuzzyFileSearch/sessionUpdate",{sessionId:e,query:t})}async function OT(e){await vt("fuzzyFileSearch/sessionStop",{sessionId:e}).catch(()=>{})}function DT(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 a=r.path,l=typeof a=="string"?a.trim():"";l&&o.push({path:l})}return o}const _m=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function Xe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function ue(e){return typeof e=="string"&&e.length>0?e:null}function Tn(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function cr(e){return typeof e=="boolean"?e:null}function ya(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function FT(e){return e==="payment_required"?e:null}function UT(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function km(e){const t=Xe(e);if(!t)return null;const n=Tn(t.usedPercent??t.used_percent);if(n===null)return null;const o=Tn(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:o,windowMinutes:o,resetsAt:Tn(t.resetsAt??t.resets_at)}}function BT(e){const t=Xe(e);if(!t)return null;const n=cr(t.hasCredits??t.has_credits),o=cr(t.unlimited);return n===null||o===null?null:{hasCredits:n,unlimited:o,balance:ue(t.balance)}}function Df(e){const t=Xe(e);if(!t)return null;const n=km(t.primary),o=km(t.secondary),r=BT(t.credits);return!n&&!o&&!r?null:{limitId:ue(t.limitId??t.limit_id),limitName:ue(t.limitName??t.limit_name),primary:n,secondary:o,credits:r,planType:ue(t.planType??t.plan_type)}}function yy(e,t=null,n=null){const o=Xe(e);if(!o)return null;const r=ue(o.accountId),s=ue(o.storageId)??r,a=ue(o.quotaStatus),l=a==="loading"||a==="ready"||a==="error"?a:"idle";return r?{accountId:r,storageId:s??r,userId:ue(o.userId),authMode:ue(o.authMode),email:ue(o.email),planType:ue(o.planType),lastRefreshedAtIso:ue(o.lastRefreshedAtIso)??"",lastActivatedAtIso:ue(o.lastActivatedAtIso),quotaSnapshot:Df(o.quotaSnapshot),quotaUpdatedAtIso:ue(o.quotaUpdatedAtIso),quotaStatus:l,quotaError:ue(o.quotaError),unavailableReason:FT(o.unavailableReason)??(UT(ue(o.quotaError))?"payment_required":null),isActive:cr(o.isActive)??(s===n||r===t)}:null}function wy(e){const t=Xe(e);if(!t)return null;const n=Xe(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),o=Df(n==null?void 0:n.codex);return o||Df(t.rateLimits??t.rate_limits)}async function vt(e,t){try{return await oT(e,t)}catch(n){throw xa(n,`RPC ${e} failed`,e)}}function Cp(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],o={};for(let r=0;r<n.length;r+=1){const s=t+r,a=n[r];typeof(a==null?void 0:a.id)!="string"||a.id.length===0||(o[a.id]=s)}return o}function dd(e){const t=Xe(e),n=t==null?void 0:t.threadTurnStartIndex;return Math.max(0,Math.floor(typeof n=="number"?n:0))}function qT(e){return Lf(e)?e:""}function zT(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}const HT=50,WT=100;async function VT(e,t){const n=await vt("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:RT(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function GT(e){const t=await vt("thread/read",{threadId:e,includeTurns:!1});return ET(t)}async function KT(e){const t=await vt("thread/read",{threadId:e,includeTurns:!0}),n=dd(t),o=Ou(t,n);return{model:Eu(t),modelProvider:pd(t),messages:o,inProgress:_p(t),activeTurnId:kp(t),hasMoreOlder:n>0,turnIndexByTurnId:Cp(t,n),externalSession:gy(t)}}async function YT(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 s=await r.json();if(!s.result)throw new Error("Older thread page response did not include a thread result");const a=Math.max(0,Math.floor(typeof s.startTurnIndex=="number"?s.startTurnIndex:0));return{messages:Ou(s.result,a),inProgress:_p(s.result),activeTurnId:kp(s.result),hasMoreOlder:s.hasMoreOlder===!0,startTurnIndex:a,turnIndexByTurnId:Cp(s.result,a)}}async function Cm(e=null,t=HT){try{return await VT(e,t)}catch(n){throw xa(n,"Failed to load thread groups","thread/list")}}function JT(){return WT}async function QT(e){try{return await GT(e)}catch(t){throw xa(t,`Failed to load thread ${e}`,"thread/read")}}async function nf(e){try{return await KT(e)}catch(t){throw xa(t,`Failed to load thread ${e}`,"thread/read")}}async function XT(e,t,n){try{return await YT(e,t,n)}catch(o){throw xa(o,`Failed to load earlier messages for thread ${e}`,"thread/read")}}function ZT(e){const t=Xe(e);if(!t)return null;const n=ue(t.key),o=typeof t.text=="string"?t.text:"",r=ue(t.kind);return!n||!r||r!=="meta"&&r!=="hunk"&&r!=="add"&&r!=="remove"&&r!=="context"?null:{key:n,kind:r,text:o,oldLine:Tn(t.oldLine),newLine:Tn(t.newLine)}}function e1(e){const t=Xe(e);if(!t)return null;const n=ue(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:Tn(t.addedLineCount)??0,removedLineCount:Tn(t.removedLineCount)??0,oldStart:Tn(t.oldStart),oldLineCount:Tn(t.oldLineCount)??0,newStart:Tn(t.newStart),newLineCount:Tn(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(s=>ZT(s)).filter(s=>s!==null):[]}:null}function t1(e){const t=Xe(e);if(!t)return null;const n=ue(t.id),o=ue(t.path),r=ue(t.absolutePath),s=ue(t.operation);return!n||!o||!r||!s||s!=="add"&&s!=="delete"&&s!=="update"&&s!=="rename"?null:{id:n,path:o,absolutePath:r,previousPath:ue(t.previousPath),previousAbsolutePath:ue(t.previousAbsolutePath),operation:s,addedLineCount:Tn(t.addedLineCount)??0,removedLineCount:Tn(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(a=>e1(a)).filter(a=>a!==null):[]}}function by(e){const t=Xe(e),n=Xe(t==null?void 0:t.data),o=Xe(n==null?void 0:n.summary),r=ue(n==null?void 0:n.scope),s=r==="baseBranch"||r==="commit"?r:"workspace",a=ue(n==null?void 0:n.workspaceView)==="staged"?"staged":"unstaged";return{cwd:ue(n==null?void 0:n.cwd)??"",gitRoot:ue(n==null?void 0:n.gitRoot),isGitRepo:cr(n==null?void 0:n.isGitRepo)??!1,scope:s,workspaceView:a,baseBranch:ue(n==null?void 0:n.baseBranch),baseBranchOptions:Array.isArray(n==null?void 0:n.baseBranchOptions)?n.baseBranchOptions.map(l=>ue(l)).filter(l=>typeof l=="string"&&l.length>0):[],commitSha:ue(n==null?void 0:n.commitSha),headBranch:ue(n==null?void 0:n.headBranch),mergeBaseSha:ue(n==null?void 0:n.mergeBaseSha),generatedAtIso:ue(n==null?void 0:n.generatedAtIso)??"",summary:{fileCount:Tn(o==null?void 0:o.fileCount)??0,addedLineCount:Tn(o==null?void 0:o.addedLineCount)??0,removedLineCount:Tn(o==null?void 0:o.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(l=>t1(l)).filter(l=>l!==null):[]}}function n1(e){const t=Xe(e),n=Xe(t==null?void 0:t.data);return{fileCount:Tn(n==null?void 0:n.fileCount)??0,addedLineCount:Tn(n==null?void 0:n.addedLineCount)??0,removedLineCount:Tn(n==null?void 0:n.removedLineCount)??0}}async function o1(){return rT()}function r1(e){const t=Xe(e);if(!t)return null;const n=ue(t.event??t.name??t.hookName),o=ue(t.command??t.cmd);return!n||!o?null:{event:n,command:o,timeout:Tn(t.timeout??t.timeout_ms),enabled:cr(t.enabled??t.active)}}async function a1(){const e=await vt("hooks/list",{}),t=[];for(const n of e.data??[]){const o=Xe(n);o&&t.push({cwd:ue(o.cwd)??"",hooks:Array.isArray(o.hooks)?o.hooks.map(r1).filter(r=>r!==null):[],warnings:ya(o.warnings),errors:ya(o.errors)})}return t}async function N4(e){await vt("marketplace/add",{source:e})}async function L4(e){await vt("marketplace/remove",{marketplaceName:e})}async function O4(){const e=await vt("marketplace/upgrade",{});return{selectedMarketplaces:ya(e.selectedMarketplaces??e.selected_marketplaces),upgradedRoots:ya(e.upgradedRoots??e.upgraded_roots),errors:ya(e.errors)}}function s1(e){const t=Xe(e);if(!t)return null;const n=ue(t.remotePluginId??t.remote_plugin_id??t.id);return n?{remotePluginId:n,pluginName:ue(t.pluginName??t.plugin_name??t.name)??n,shareUrl:ue(t.shareUrl??t.share_url??t.url)??"",createdAt:ue(t.createdAt??t.created_at)??""}:null}async function D4(e){const t=await vt("plugin/share/save",{pluginPath:e});return{remotePluginId:ue(t.remotePluginId??t.remote_plugin_id)??"",shareUrl:ue(t.shareUrl??t.share_url??t.url)??""}}async function F4(){const e=await vt("plugin/share/list",{});return(e.data??e.shares??[]).map(s1).filter(n=>n!==null)}async function U4(e){await vt("plugin/share/delete",{remotePluginId:e})}async function B4(e){await vt("plugin/share/checkout",{remotePluginId:e})}function _y(e){const t=Xe(e);if(!t)return null;const n=ue(t.clientId??t.client_id??t.id);return n?{clientId:n,deviceName:ue(t.deviceName??t.device_name??t.name)??"",lastSeenAt:ue(t.lastSeenAt??t.last_seen_at??t.lastSeen)}:null}async function i1(){const e=await vt("remoteControl/status/read",{}),t=Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[];return{enabled:cr(e.enabled)??!1,clients:t.map(_y).filter(n=>n!==null)}}async function l1(){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=ue((o=t.data)==null?void 0:o.policy)??"";return n==="untrusted"||n==="on-failure"||n==="on-request"||n==="never"?n:"never"}async function u1(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 c1(e){await vt(e?"remoteControl/enable":"remoteControl/disable",{})}async function d1(){const e=await vt("remoteControl/pairing/start",{});return{pairingCode:ue(e.pairingCode??e.pairing_code??e.code)??"",expiresAt:ue(e.expiresAt??e.expires_at)}}async function f1(){const e=await vt("remoteControl/client/list",{});return(Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[]).map(_y).filter(n=>n!==null)}async function p1(e){await vt("remoteControl/client/revoke",{clientId:e})}function Yc(e){const t=Xe(e);if(!t)return null;const n=ue(t.id),o=ue(t.kind),r=ue(t.name),s=ue(t.prompt),a=ue(t.rrule),l=ue(t.status);return!n||!r||!s||!a||o!=="heartbeat"&&o!=="cron"||l!=="ACTIVE"&&l!=="PAUSED"?null:{id:n,kind:o,name:r,prompt:s,rrule:a,status:l,targetThreadId:ue(t.targetThreadId),cwds:Array.isArray(t.cwds)?t.cwds.filter(f=>typeof f=="string"&&f.trim().length>0):[],createdAtMs:Tn(t.createdAtMs),updatedAtMs:Tn(t.updatedAtMs),nextRunAtMs:Tn(t.nextRunAtMs)}}function ky(e){if(Array.isArray(e))return e.flatMap(n=>{const o=Yc(n);return o?[o]:[]});const t=Yc(e);return t?[t]:[]}async function h1(){var r;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(Jr(t,"Failed to load thread automations"));const n=Xe((r=Xe(t))==null?void 0:r.data),o={};if(!n)return o;for(const[s,a]of Object.entries(n)){const l=ky(a);l.length>0&&(o[s]=l)}return o}async function m1(){var r;const e=await fetch("/codex-api/project-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(Jr(t,"Failed to load project automations"));const n=Xe((r=Xe(t))==null?void 0:r.data),o={};if(!n)return o;for(const[s,a]of Object.entries(n)){const l=ky(a);l.length>0&&(o[s]=l)}return o}async function v1(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(Jr(n,"Failed to save thread automation"));const o=Yc((r=Xe(n))==null?void 0:r.data);if(!o)throw new Error("Thread automation response was malformed");return o}async function g1(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(Jr(n,"Failed to save project automation"));const o=Yc((r=Xe(n))==null?void 0:r.data);if(!o)throw new Error("Project automation response was malformed");return o}async function Tm(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(Jr(r,"Failed to delete thread automation"))}async function Sm(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(Jr(r,"Failed to delete project automation"))}async function y1(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(Jr(o,"Failed to run thread automation"))}function w1(e){return sT(e)}function b1(e){const t=Xe(e);if(!t)return null;const n=ue(t.id),o=ue(t.threadId),r=ue(t.cwd),s=ue(t.shell);return!n||!o||!r||!s?null:{id:n,threadId:o,cwd:r,shell:s,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:cr(t.truncated)??!1}}async function jl(e,t){const n=await fetch(e,t),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(Jr(o,`Terminal request failed with HTTP ${n.status}`));return o}async function q4(e){var o;const t=await jl("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=b1((o=Xe(t))==null?void 0:o.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function _1(){const e=await jl("/codex-api/thread-terminal/status"),t=Xe(e);return{available:cr(t==null?void 0:t.available)??!1,reason:ue(t==null?void 0:t.reason)||null}}async function z4(e){const t=await jl(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=Xe(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(r=>{const s=Xe(r),a=ue(s==null?void 0:s.label),l=ue(s==null?void 0:s.value),f=ue(s==null?void 0:s.source);return!a||!l||f!=="package"&&f!=="script"&&f!=="make"?[]:[{label:a,value:l,source:f}]})}async function H4(e,t){await jl("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function W4(e,t,n){await jl("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function V4(e){await jl("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}async function k1(e,t){await iT({id:e,...t})}async function xm(){return lT()}async function C1(){try{const e=await vt("account/rateLimits/read");return wy(e)}catch(e){throw xa(e,"Failed to load account rate limits","account/rateLimits/read")}}function fd(e){const t=Xe(e),n=ue(t==null?void 0:t.activeAccountId),o=ue(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:ue(t==null?void 0:t.importedAccountId)??void 0,importedStorageId:ue(t==null?void 0:t.importedStorageId)??void 0,accounts:r.map(s=>yy(s,n,o)).filter(s=>s!==null)}}async function T1(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(vn(t,"Failed to load accounts"));const n=Xe(t);return fd(n==null?void 0:n.data)}async function Am(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(vn(t,"Failed to refresh accounts"));const n=Xe(t);return fd(n==null?void 0:n.data)}async function S1(){const e=await fetch("/codex-api/accounts/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(vn(t,"Failed to start Codex login"));const n=Xe(t),o=Xe(n==null?void 0:n.data),r=ue(o==null?void 0:o.loginUrl);if(!r)throw new Error("Failed to start Codex login");return r}async function x1(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(vn(n,"Failed to complete Codex login"));const o=Xe(n);return fd(o==null?void 0:o.data)}async function A1(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(vn(n,"Failed to switch account"));const o=Xe(n),r=Xe(o==null?void 0:o.data),s=yy(r==null?void 0:r.account,ue(r==null?void 0:r.activeAccountId),ue(r==null?void 0:r.activeStorageId));if(!s)throw new Error("Failed to switch account");return s}async function P1(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(vn(n,"Failed to remove account"));const o=Xe(n);return fd(o==null?void 0:o.data)}const E1=3e4,ll=new Map;async function of(e){const t=ll.get(e);if(t)return t;const n=(async()=>{const r=await vt("thread/resume",{threadId:e}),s=dd(r),a=Ou(r,s);return{model:Eu(r),modelProvider:pd(r),messages:a,inProgress:_p(r),activeTurnId:kp(r),hasMoreOlder:s>0,turnIndexByTurnId:Cp(r,s),externalSession:gy(r)}})();ll.set(e,n);const o=globalThis.setTimeout(()=>{ll.get(e)===n&&ll.delete(e)},E1);return n.finally(()=>{globalThis.clearTimeout(o),globalThis.setTimeout(()=>{ll.get(e)===n&&ll.delete(e)},2e3)}).catch(()=>{}),n}async function I1(e){await vt("thread/archive",{threadId:e})}async function R1(e){await vt("thread/unarchive",{threadId:e})}async function M1(e){await vt("thread/compact/start",{threadId:e})}async function $1(e,t){await vt("thread/name/set",{threadId:e,name:t})}async function rf(e,t){const n=await vt("thread/rollback",{threadId:e,numTurns:t});return Ou(n,dd(n))}async function j1(e,t,n,o,r,s){try{const a=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:s})}),l=await a.json().catch(()=>({}));if(!a.ok){const f=typeof l.message=="string"&&l.message.trim()?l.message.trim():typeof l.error=="string"&&l.error.trim()?l.error.trim():"Server error";return{changed:0,errors:Array.isArray(l.errors)&&l.errors.length>0?l.errors:[f],message:l.message}}return{changed:l.changed??l.reverted??l.applied??0,errors:Array.isArray(l.errors)?l.errors:[],message:l.message,revertedPatchIds:Array.isArray(l.revertedPatchIds)?l.revertedPatchIds:[],appliedPatchIds:Array.isArray(l.appliedPatchIds)?l.appliedPatchIds:[]}}catch(a){return{changed:0,errors:[a instanceof Error?a.message:"Network error"]}}}async function N1(e,t,n){const o=await j1(e,t,n,"undo");return{reverted:o.changed,errors:o.errors}}function Ff(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 L1(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 Eu(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}function pd(e){var r,s;const t=Xe(e);if(!t)return"";const n=((r=ue(t.modelProvider))==null?void 0:r.trim())??"";if(n)return n;const o=Xe(t.thread);return((s=ue(o==null?void 0:o.modelProvider))==null?void 0:s.trim())??""}async function Pm(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 vt("thread/start",n),r=Ff(o);if(!r)throw new Error("thread/start did not return a thread id");return{threadId:r,model:Eu(o),modelProvider:pd(o)}}catch(n){throw xa(n,"Failed to start a new thread","thread/start")}}async function Em(e,t,n){if(arguments.length<=1)try{const o=await vt("thread/fork",{threadId:e,persistExtendedHistory:!0}),r=Ff(o);if(!r)throw new Error("thread/fork did not return a thread id");return{threadId:r,cwd:L1(o),model:Eu(o),messages:Ou(o,dd(o))}}catch(o){throw xa(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 s=await vt("thread/fork",r),a=Ff(s);if(!a)throw new Error("thread/fork did not return a thread id");return{threadId:a,model:Eu(s),modelProvider:pd(s)}}catch(o){throw xa(o,`Failed to fork thread ${e}`,"thread/fork")}}function Im(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 O1(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 D1(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function F1(e,t,n){var f;const o=(t==null?void 0:t.trim())??"";if(o)return{model:o,reasoningEffort:e==="plan"?ef(n):tf(n)};let r=null;try{r=await Ty()}catch{r=null}const s=(r==null?void 0:r.model.trim())??"";if(s)return{model:s,reasoningEffort:e==="plan"?ef(n??(r==null?void 0:r.reasoningEffort)):tf(n??(r==null?void 0:r.reasoningEffort))};let a=[];try{a=await W1()}catch{a=[]}const l=((f=a.find(m=>m.trim().length>0))==null?void 0:f.trim())??"";if(l)return{model:l,reasoningEffort:e==="plan"?ef(n??(r==null?void 0:r.reasoningEffort)):tf(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 af(e,t,n=[],o,r,s,a=[],l){var f;try{const m=(o==null?void 0:o.trim())??"",g=[];for(const z of n){const Z=Im(z.trim());Z&&g.push({label:D1(Z),path:Z,fsPath:Z})}const w=[...a,...g],x=w.filter((z,Z)=>w.findIndex(X=>X.fsPath===z.fsPath)===Z),L=[{type:"text",text:O1(t,x)}];for(const z of n){const Z=z.trim();if(!Z)continue;const X=Im(Z);if(X){L.push({type:"localImage",path:X});continue}L.push({type:"image",url:Z,image_url:Z})}if(s)for(const z of s)L.push({type:"skill",name:z.name,path:z.path});const B=x.map(z=>({label:z.label,path:z.path,fsPath:z.fsPath})),Y={threadId:e,input:L};if(B.length>0&&(Y.attachments=B),m&&(Y.model=m),typeof r=="string"&&r.length>0&&(Y.effort=r),l){const z=await F1(l,m,r);Y.collaborationMode={mode:l,settings:{model:z.model,reasoning_effort:z.reasoningEffort,developer_instructions:null}}}const ae=await vt("turn/start",Y);return typeof((f=ae==null?void 0:ae.turn)==null?void 0:f.id)=="string"?ae.turn.id.trim():""}catch(m){throw xa(m,`Failed to start turn for thread ${e}`,"turn/start")}}async function U1(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 vt("turn/interrupt",{threadId:n,turnId:o})}catch(r){throw xa(r,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function B1(e){const t=e==="fast"?"fast":"standard";await vt("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 q1(){return await(await fetch("/codex-api/free-mode/status")).json()}async function Rm(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function Mm(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 ul(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 z1(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(jT)});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(s=>typeof s=="string"?s.trim():"").filter((s,a,l)=>s.length>0&&l.indexOf(s)===a),exclusive:r.exclusive===!0}}catch{}return null}function H1(e){var a;const t=Xe(e);if(!t)return null;const n=((a=ue(t.id??t.model))==null?void 0:a.trim())??"";if(!n)return null;const o=t.supportedReasoningEfforts??t.supported_reasoning_efforts,r=Array.isArray(o)?o.flatMap(l=>{const f=Xe(l),m=f?f.reasoningEffort??f.reasoning_effort??f.effort:l;return Lf(m)?[m]:[]}).filter((l,f,m)=>m.indexOf(l)===f):null,s=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:r,defaultReasoningEffort:Lf(s)?s:null}}function $m(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function Cy(e={}){const t=e.includeProviderModels!==!1,n=t?await z1(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map($m);const o=await vt("model/list",{}),r=[];for(const s of o.data){const a=H1(s);!a||r.some(l=>l.id===a.id)||r.push(a)}if(!t||!n)return r;for(const s of n.ids)r.some(a=>a.id===s)||r.push($m(s));return r}async function W1(e={}){return(await Cy(e)).map(t=>t.id)}async function Ty(){const e=await vt("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",o=qT(e.config.model_reasoning_effort),r=zT(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:o,speedMode:r}}function Sy(e){const t=Xe(e);if(!t)return null;const n=ue(t.id),o=ue(t.name);return!n||!o?null:{id:n,name:o,description:ue(t.description)??"",installUrl:ue(t.installUrl??t.install_url)??"",needsAuth:cr(t.needsAuth??t.needs_auth)??!1}}function V1(e){const t=Xe(e);if(!t)return null;const n=ue(t.name),o=ue(t.path);if(!n||!o)return null;const r=Xe(t.interface);return{name:n,path:o,description:ue(t.description)??"",enabled:cr(t.enabled)??!0,displayName:ue((r==null?void 0:r.displayName)??(r==null?void 0:r.display_name))??n,shortDescription:ue(t.shortDescription??t.short_description)??""}}function xy(e,t={}){const n=Xe(e);if(!n)return null;const o=ue(n.id),r=ue(n.name);if(!o||!r)return null;const s=Xe(n.interface),a=Xe(n.source),l=ue(a==null?void 0:a.type)??"",f=ue(a==null?void 0:a.path),m=ue(a==null?void 0:a.url)??"",g=l==="remote"?t.name??null:null,w=t.path??(l==="local"?f:null),x=ue((s==null?void 0:s.displayName)??(s==null?void 0:s.display_name))??r,R=ue((s==null?void 0:s.shortDescription)??(s==null?void 0:s.short_description)),L=ue((s==null?void 0:s.longDescription)??(s==null?void 0:s.long_description))??"";return{id:o,name:r,displayName:x,description:R??L,longDescription:L,developerName:ue((s==null?void 0:s.developerName)??(s==null?void 0:s.developer_name))??"",category:ue(s==null?void 0:s.category)??"",marketplaceName:t.name??"",marketplaceDisplayName:t.displayName??t.name??"",marketplacePath:w,remoteMarketplaceName:g,sourceType:l,sourceUrl:m,installed:cr(n.installed)??!1,enabled:cr(n.enabled)??!0,installPolicy:ue(n.installPolicy??n.install_policy)??"",authPolicy:ue(n.authPolicy??n.auth_policy)??"",logoUrl:ue((s==null?void 0:s.logoUrl)??(s==null?void 0:s.logo_url))??"",logoPath:ue(s==null?void 0:s.logo)??"",composerIconUrl:ue((s==null?void 0:s.composerIconUrl)??(s==null?void 0:s.composer_icon_url))??"",composerIconPath:ue((s==null?void 0:s.composerIcon)??(s==null?void 0:s.composer_icon))??"",brandColor:ue((s==null?void 0:s.brandColor)??(s==null?void 0:s.brand_color))??"",capabilities:ya(s==null?void 0:s.capabilities),defaultPrompt:ya((s==null?void 0:s.defaultPrompt)??(s==null?void 0:s.default_prompt)),screenshotUrls:ya((s==null?void 0:s.screenshotUrls)??(s==null?void 0:s.screenshot_urls)),screenshots:ya(s==null?void 0:s.screenshots),websiteUrl:ue((s==null?void 0:s.websiteUrl)??(s==null?void 0:s.website_url))??"",privacyPolicyUrl:ue((s==null?void 0:s.privacyPolicyUrl)??(s==null?void 0:s.privacy_policy_url))??"",termsOfServiceUrl:ue((s==null?void 0:s.termsOfServiceUrl)??(s==null?void 0:s.terms_of_service_url))??""}}function G1(e,t=0){const n=Xe(e);if(!n)return null;const o=ue(n.id),r=ue(n.name);if(!o||!r)return null;const s=Xe(n.branding),a=Xe(n.appMetadata??n.app_metadata);return{id:o,name:r,description:ue(n.description)??ue((a==null?void 0:a.seoDescription)??(a==null?void 0:a.seo_description))??"",logoUrl:ue(n.logoUrl??n.logo_url)??"",logoUrlDark:ue(n.logoUrlDark??n.logo_url_dark)??"",distributionChannel:ue(n.distributionChannel??n.distribution_channel)??"",installUrl:ue(n.installUrl??n.install_url)??"",isAccessible:cr(n.isAccessible??n.is_accessible)??!1,isEnabled:cr(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:ya(n.pluginDisplayNames??n.plugin_display_names),category:ue(s==null?void 0:s.category)??"",developer:ue(s==null?void 0:s.developer)??ue(a==null?void 0:a.developer)??"",website:ue(s==null?void 0:s.website)??"",privacyPolicy:ue((s==null?void 0:s.privacyPolicy)??(s==null?void 0:s.privacy_policy))??"",termsOfService:ue((s==null?void 0:s.termsOfService)??(s==null?void 0:s.terms_of_service))??"",catalogRank:t}}function K1(e){const t=Xe(e);if(!t)return null;const n=ue(t.name);if(!n)return null;const o=Xe(t.tools)??{},r=Object.entries(o).map(([f,m])=>{const g=Xe(m);return{name:ue(g==null?void 0:g.name)??f,title:ue(g==null?void 0:g.title)??"",description:ue(g==null?void 0:g.description)??""}}),s=Array.isArray(t.resources)?t.resources.map(f=>{const m=Xe(f);return{name:ue(m==null?void 0:m.name)??"",title:ue(m==null?void 0:m.title)??"",uri:ue(m==null?void 0:m.uri)??"",description:ue(m==null?void 0:m.description)??""}}).filter(f=>f.name||f.uri):[],a=t.resourceTemplates??t.resource_templates,l=Array.isArray(a)?a.map(f=>{const m=Xe(f);return{name:ue(m==null?void 0:m.name)??"",title:ue(m==null?void 0:m.title)??"",uriTemplate:ue((m==null?void 0:m.uriTemplate)??(m==null?void 0:m.uri_template))??"",description:ue(m==null?void 0:m.description)??""}}).filter(f=>f.name||f.uriTemplate):[];return{name:n,authStatus:ue(t.authStatus??t.auth_status)??"unsupported",tools:r,resources:s,resourceTemplates:l}}async function G4(e){const t={};e&&e.length>0&&(t.cwds=e);const n=await vt("plugin/list",t),o=[];for(const r of n.marketplaces??[]){const s=Xe(r);if(!s)continue;const a=Xe(s.interface),l={name:ue(s.name)??"",displayName:ue((a==null?void 0:a.displayName)??(a==null?void 0:a.display_name))??"",path:ue(s.path)},f=Array.isArray(s.plugins)?s.plugins:[];for(const m of f){const g=xy(m,l);g&&o.push(g)}}return o}async function K4(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await vt("plugin/read",t),o=Xe(n.plugin);if(!o)throw new Error("Plugin detail response is empty");const r=xy(o.summary,{name:ue(o.marketplaceName)??e.marketplaceName,displayName:e.marketplaceDisplayName,path:ue(o.marketplacePath)??e.marketplacePath})??e;return{summary:r,description:ue(o.description)??r.longDescription,apps:Array.isArray(o.apps)?o.apps.map(Sy).filter(s=>s!==null):[],skills:Array.isArray(o.skills)?o.skills.map(V1).filter(s=>s!==null):[],mcpServers:ya(o.mcpServers??o.mcp_servers)}}async function Y4(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await vt("plugin/install",t),o=n.appsNeedingAuth??n.apps_needing_auth??[];return{authPolicy:ue(n.authPolicy??n.auth_policy)??"",appsNeedingAuth:o.map(Sy).filter(r=>r!==null)}}async function J4(e){await vt("plugin/uninstall",{pluginId:e})}async function Q4(e,t){await vt("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function X4(e){const t=[];let n=null,o=0;do{const r={limit:100};n&&(r.cursor=n),e&&(r.threadId=e);const s=await vt("app/list",r);for(const a of s.data??[]){const l=G1(a,o);l&&t.push(l),o+=1}n=ue(s.nextCursor??s.next_cursor)}while(n);return t}async function Z4(e,t){await vt("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function eB(){const e=[];let t=null;do{const n={};t&&(n.cursor=t);const o=await vt("mcpServerStatus/list",n);for(const r of o.data??[]){const s=K1(r);s&&e.push(s)}t=ue(o.nextCursor??o.next_cursor)}while(t);return e}async function tB(){await vt("config/mcpServer/reload",{})}async function nB(e){const t=await vt("mcpServer/oauth/login",{name:e});return{authorizationUrl:ue(t.authorizationUrl??t.authorization_url)??""}}async function oB(){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 rB(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(),s=await fetch(`/codex-api/composio/connectors${r?`?${r}`:""}`);if(!s.ok)throw new Error(`Failed to list Composio connectors (${s.status})`);const a=await s.json();return{data:Array.isArray(a.data)?a.data:[],nextCursor:typeof a.nextCursor=="string"&&a.nextCursor.length>0?a.nextCursor:null,total:typeof a.total=="number"&&Number.isFinite(a.total)?Math.max(0,Math.floor(a.total)):0}}async function aB(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 sB(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 iB(){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 lB(){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 Y1(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function J1(){try{const e=await vt("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:Y1(o.name||r)||(r==="plan"?"Plan":"Default")}))}if(n.length>0){for(const o of _m)t.has(o.value)||n.push(o);return n.sort((o,r)=>o.value===r.value?0:o.value==="default"?-1:1)}}catch{}return _m}function Q1(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=s=>{if(!Array.isArray(s))return[];const a=[];for(const l of s)typeof l=="string"&&l.length>0&&!a.includes(l)&&a.push(l);return a},o=t.labels,r={};if(o&&typeof o=="object"&&!Array.isArray(o))for(const[s,a]of Object.entries(o)){const l=typeof s=="string"?st(s):"";l.length>0&&typeof a=="string"&&(r[l]=a)}return{order:n(t.order).map(s=>st(s)),labels:r,active:n(t.active).map(s=>st(s)),projectOrder:n(t.projectOrder).map(s=>st(s)),remoteProjects:Array.isArray(t.remoteProjects)?t.remoteProjects.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const a=s,l=typeof a.id=="string"?a.id.trim():"";return l?[{id:l,hostId:typeof a.hostId=="string"?a.hostId.trim():"",remotePath:typeof a.remotePath=="string"?st(a.remotePath):"",label:typeof a.label=="string"?a.label.trim():""}]:[]}):[]}}function X1(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(a=>typeof a=="string"&&a.trim().length>0):[],r=Array.isArray(t.skills)?t.skills.flatMap(a=>{if(!a||typeof a!="object"||Array.isArray(a))return[];const l=a,f=typeof l.name=="string"?l.name.trim():"",m=typeof l.path=="string"?l.path.trim():"";return f&&m?[{name:f,path:m}]:[]}):[],s=Array.isArray(t.fileAttachments)?t.fileAttachments.flatMap(a=>{if(!a||typeof a!="object"||Array.isArray(a))return[];const l=a,f=typeof l.label=="string"?l.label.trim():"",m=typeof l.path=="string"?l.path.trim():"",g=typeof l.fsPath=="string"?l.fsPath.trim():"";return f&&m&&g?[{label:f,path:m,fsPath:g}]:[]}):[];return{id:n,text:typeof t.text=="string"?t.text:"",imageUrls:o,skills:r,fileAttachments:s,collaborationMode:t.collaborationMode==="plan"?"plan":"default"}}function Ay(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 s=o.flatMap(a=>{const l=X1(a);return l?[l]:[]});s.length>0&&(t[r]=s)}return t}async function ml(){return wu?Uf(wu):(mc||(mc=Z1().then(e=>(wu=e,e)).finally(()=>{mc=null})),Uf(await mc))}async function Z1(){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 Q1(n.data)}function Uf(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 Tp(){wu=null}async function jm(){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 Ay(n.data)}async function eS(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ay(e))})).ok)throw new Error("Failed to save thread queue state")}async function tS(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:st(r.data.cwd),gitRoot:st(r.data.gitRoot)}}async function nS(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:st(o.data.cwd),gitRoot:st(o.data.gitRoot)}}async function oS(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 s=Array.isArray(r.data)?r.data:[],a=[],l=new Set;for(const f of s){if(!f||typeof f!="object"||Array.isArray(f))continue;const m=f,g=typeof m.value=="string"?m.value.trim():"",w=typeof m.label=="string"?m.label.trim():"";!g||l.has(g)||(l.add(g),a.push({value:g,label:w||g}))}return a}async function rS(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 s=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=s.currentBranch,l=typeof a=="string"&&a.trim()?a.trim():null,f=Array.isArray(s.options)?s.options:[],m=[],g=new Set;for(const Y of f){if(!Y||typeof Y!="object"||Array.isArray(Y))continue;const ae=Y,z=typeof ae.value=="string"?ae.value.trim():"",Z=typeof ae.label=="string"?ae.label.trim():"";!z||g.has(z)||(g.add(z),m.push({value:z,label:Z||z,isCurrent:ae.isCurrent===!0,isRemote:ae.isRemote===!0}))}l&&!g.has(l)&&m.unshift({value:l,label:l,isCurrent:!0});const w=s.headSha,x=s.headSubject,R=s.headDate,L=s.gitRoot,B=Py(s.changedFiles);return{currentBranch:l,headSha:typeof w=="string"&&w.trim()?w.trim():null,headSubject:typeof x=="string"&&x.trim()?x.trim():null,headDate:typeof R=="string"&&R.trim()?R.trim():null,detached:s.detached===!0,dirty:s.dirty===!0,gitRoot:typeof L=="string"?st(L):"",options:m,changedFiles:B}}function Py(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,s=r.path,a=typeof s=="string"?st(s.trim()):"";if(!a)continue;const l=r.status,f=typeof l=="string"?l.trim():"",m=r.label,g=typeof m=="string"&&m.trim()?m.trim():f;n.push({path:a,previousPath:typeof r.previousPath=="string"&&r.previousPath.trim()?st(r.previousPath.trim()):null,status:f,label:g,addedLineCount:typeof r.addedLineCount=="number"?r.addedLineCount:null,removedLineCount:typeof r.removedLineCount=="number"?r.removedLineCount:null})}return n}async function aS(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 s=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{isGitRepo:s.isGitRepo===!0,gitRoot:typeof s.gitRoot=="string"?st(s.gitRoot):""}}async function sS(e,t){var s;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=(s=o.data)==null?void 0:s.currentBranch;return typeof r=="string"&&r.trim()?r.trim():null}async function iS(e,t,n={}){const o=e.trim(),r=t.trim();if(!o||!r)return[];const s=new URLSearchParams({cwd:o,branch:r,includeResetHistory:n.includeResetHistory===!1?"false":"true"}),a=await fetch(`/codex-api/git/branch-commits?${s.toString()}`),l=await a.json();if(!a.ok)throw new Error(l.error||"Failed to load branch commits");return(Array.isArray(l.data)?l.data:[]).flatMap(m=>{if(!m||typeof m!="object"||Array.isArray(m))return[];const g=m,w=typeof g.sha=="string"?g.sha.trim():"",x=typeof g.shortSha=="string"?g.shortSha.trim():"",R=typeof g.subject=="string"?g.subject.trim():"",L=typeof g.date=="string"?g.date.trim():"";return!w||!x?[]:[{sha:w,shortSha:x,subject:R||x,date:L}]})}async function lS(e,t){const n=e.trim(),o=t.trim();if(!n||!o)return[];const r=new URLSearchParams({cwd:n,sha:o}),s=await fetch(`/codex-api/git/commit-files?${r.toString()}`),a=await s.json();if(!s.ok)throw new Error(a.error||"Failed to load commit files");return(Array.isArray(a.data)?a.data:[]).flatMap(f=>{if(!f||typeof f!="object"||Array.isArray(f))return[];const m=f,g=typeof m.path=="string"?m.path:"",w=typeof m.previousPath=="string"&&m.previousPath.length>0?m.previousPath:null,x=typeof m.status=="string"?m.status.trim():"",R=typeof m.label=="string"?m.label.trim():"",L=typeof m.addedLineCount=="number"&&Number.isFinite(m.addedLineCount)?m.addedLineCount:null,B=typeof m.removedLineCount=="number"&&Number.isFinite(m.removedLineCount)?m.removedLineCount:null;return!g||!x?[]:[{path:g,previousPath:w,status:x,label:R||x,addedLineCount:L,removedLineCount:B}]})}async function uS(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 s=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{currentBranch:typeof s.currentBranch=="string"&&s.currentBranch.trim()?s.currentBranch.trim():null,headSha:typeof s.headSha=="string"&&s.headSha.trim()?s.headSha.trim():null,headSubject:typeof s.headSubject=="string"&&s.headSubject.trim()?s.headSubject.trim():null,headDate:typeof s.headDate=="string"&&s.headDate.trim()?s.headDate.trim():null,detached:s.detached===!0,dirty:s.dirty===!0,gitRoot:typeof s.gitRoot=="string"?st(s.gitRoot):"",options:[],changedFiles:Py(s.changedFiles)}}async function uB(e,t,n,o,r){const s=new URLSearchParams({cwd:e,scope:t,workspaceView:n});o&&o.trim()&&s.set("baseBranch",o.trim()),r&&r.trim()&&s.set("commitSha",r.trim());const a=await fetch(`/codex-api/review/snapshot?${s.toString()}`),l=await a.json();if(!a.ok)throw new Error(vn(l,"Failed to load review snapshot"));return by(l)}async function cS(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(vn(r,"Failed to load review summary"));return n1(r)}async function cB(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(vn(n,"Failed to apply review action"));return by(n)}async function dB(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(vn(n,"Failed to initialize Git"))}async function Nm(){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 dS(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 Hi(o);if(!o.ok){const f=vn(r,"Failed to load local directories");throw new Error(f)}const s=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{},l=Array.isArray(a.entries)?a.entries:[];return{path:typeof a.path=="string"?st(a.path):"",parentPath:typeof a.parentPath=="string"?st(a.parentPath):"",entries:l.flatMap(f=>{if(!f||typeof f!="object"||Array.isArray(f))return[];const m=f,g=typeof m.name=="string"?m.name.trim():"",w=typeof m.path=="string"?st(m.path):"";return g&&w?[{name:g,path:w}]:[]})}}async function fS(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-files?${t.toString()}`),o=await Hi(n);if(!n.ok){const l=vn(o,"Failed to load workspace files");throw new Error(l)}const s=(o&&typeof o=="object"&&!Array.isArray(o)?o:{}).data;return(Array.isArray(s)?s:[]).flatMap(l=>{if(!l||typeof l!="object"||Array.isArray(l))return[];const f=l,m=typeof f.path=="string"?st(f.path):"",g=typeof f.relativePath=="string"?f.relativePath.trim():"";return!m||!g?[]:[{path:m,relativePath:g,isDirectory:f.isDirectory===!0}]})}async function pS(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-preview?${t.toString()}`),o=await Hi(n);if(!n.ok){const l=vn(o,"Failed to preview file");throw new Error(l)}const s=(o&&typeof o=="object"&&!Array.isArray(o)?o:{}).data,a=s&&typeof s=="object"&&!Array.isArray(s)?s:{};return{path:typeof a.path=="string"?a.path:e,name:typeof a.name=="string"?a.name:"",size:typeof a.size=="number"?a.size:0,isText:a.isText===!0,isImage:a.isImage===!0,content:typeof a.content=="string"?a.content:void 0,truncated:a.truncated===!0}}async function Hi(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"}`)}}async function sf(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");wu=Uf(e)}async function vc(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 l=vn(o,"Failed to open project root");throw new Error(l)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=typeof s.path=="string"?st(s.path):"";return Tp(),a}function hS(e){return`/codex-api/project-zip?${new URLSearchParams({cwd:e}).toString()}`}function mS(e,t){var s;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((s=r==null?void 0:r[1])==null?void 0:s.trim())||t}async function vS(e,t){var g;const n=await fetch(hS(e));if(!n.ok){const w=await n.json().catch(()=>null),x="Failed to export project",R=vn(w,x),L=[n.status?String(n.status):"",n.statusText].filter(Boolean).join(" "),B=R!==x?R:L?`Failed to export project: ${L}`:x;throw new Error(B)}const o=Number(n.headers.get("content-length")??""),r=Number.isFinite(o)&&o>0?o:null,s=mS(n,"project.zip"),a=(g=n.body)==null?void 0:g.getReader();if(!a){const w=await n.blob();return t==null||t({loaded:w.size,total:w.size||r}),{blob:w,fileName:s}}const l=[];let f=0;for(t==null||t({loaded:f,total:r});;){const{done:w,value:x}=await a.read();if(w)break;x&&(l.push(new Uint8Array(x)),f+=x.byteLength,t==null||t({loaded:f,total:r}))}const m=l.map(w=>{const x=new Uint8Array(w.byteLength);return x.set(w),x.buffer});return{blob:new Blob(m,{type:n.headers.get("content-type")??"application/zip"}),fileName:s}}async function gS(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 Hi(o);if(!o.ok){const f=vn(r,"Failed to import project");throw new Error(f)}const s=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{},l=typeof a.path=="string"?st(a.path):"";return l&&Tp(),{path:l,importedSessions:typeof a.importedSessions=="number"?a.importedSessions:0}}async function yS(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await Hi(t);if(!t.ok){const a=vn(n,"Failed to create local directory");throw new Error(a)}const o=n&&typeof n=="object"&&!Array.isArray(n)?n:{},r=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=typeof r.path=="string"?st(r.path):"";return s&&Tp(),s}async function wS(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 Hi(n);if(!n.ok){const a=vn(o,"Failed to clone GitHub repository");throw new Error(a)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return typeof s.path=="string"?st(s.path):""}async function bS(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 Hi(t);if(!t.ok){const a=vn(n,"Failed to create new chat folder");throw new Error(a)}const o=n&&typeof n=="object"&&!Array.isArray(n)?n:{},r=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=typeof r.cwd=="string"?st(r.cwd):"";if(!s)throw new Error("Failed to create new chat folder");return{cwd:s,outputDirectory:typeof r.outputDirectory=="string"?st(r.outputDirectory):s,workspaceRoot:typeof r.workspaceRoot=="string"?st(r.workspaceRoot):""}}async function _S(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 a=vn(o,"Failed to suggest project name");throw new Error(a)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{name:typeof s.name=="string"?s.name.trim():"",path:typeof s.path=="string"?st(s.path):""}}async function Lm(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})}),s=await r.json();if(!r.ok){const m=vn(s,"Failed to search files");throw new Error(m)}const a=s&&typeof s=="object"&&!Array.isArray(s)?s:{},l=Array.isArray(a.data)?a.data:[],f=[];for(const m of l){if(!m||typeof m!="object"||Array.isArray(m))continue;const w=m.path,x=typeof w=="string"?w.trim():"";x&&f.push({path:x})}return f}async function kS(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}}async function CS(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=vn(o,"Failed to connect Telegram bot");throw new Error(r)}}async function TS(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const a=vn(t,"Failed to load Telegram configuration");throw new Error(a)}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:[],s=[];for(const a of r){if(a==="*"){s.push("*");continue}typeof a=="number"&&Number.isFinite(a)&&s.push(Math.trunc(a))}return{botToken:typeof o.botToken=="string"?o.botToken:"",allowedUserIds:s}}async function SS(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const r=vn(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:""}}function vn(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}async function xS(){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 gc(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 AS(){try{const e=await fetch("/codex-api/thread-reasoning");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function PS(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 ES(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function IS(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function RS(){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 MS(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 $S(e,t){var n;try{return((n=(await vt("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}function Bf(e){return e?e.endsWith("/SKILL.md")?e:`${e}/SKILL.md`:""}function jS(e,t){const n=Bf(e),o=n.split("/").filter(Boolean);if(o.length<2)return null;const r=o.lastIndexOf("skills");if(r>=2){const f=o[r-2]??"";if(f){const m=`/${[...o.slice(0,r+1),f,"SKILL.md"].join("/")}`;if(t.has(m))return{rootPath:m,rootName:f,isNested:m!==n}}}const s=o.indexOf("skills");if(s<0||s+1>=o.length-1)return null;const a=o[s+1]??"";if(!a)return null;const l=`/${[...o.slice(0,s+2),"SKILL.md"].join("/")}`;return t.has(l)?{rootPath:l,rootName:a,isNested:l!==n}:{rootPath:l,rootName:a,isNested:l!==n}}async function NS(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await vt("skills/list",t),o=n.data.flatMap(a=>a.skills),r=new Set(o.map(a=>Bf(a.path)).filter(Boolean)),s=new Map;for(const a of n.data)for(const l of a.skills){if(!l.name)continue;const f=jS(l.path,r),m=Bf(l.path),w=!!(f!=null&&f.isNested&&r.has(f.rootPath))?f.rootPath:m,x=m===w,R=s.get(w),L={name:l.name,displayName:f&&w===f.rootPath?f.rootName:void 0,description:l.shortDescription||l.description||"",path:w,scope:l.scope,enabled:l.enabled,__hasRoot:x};if(!R){s.set(w,L);continue}if(R.enabled=R.enabled||l.enabled,!R.__hasRoot&&x){s.set(w,L);continue}!R.displayName&&L.displayName&&(R.displayName=L.displayName),!R.description&&L.description&&(R.description=L.description)}return Array.from(s.values()).map(({__hasRoot:a,...l})=>l)}catch{return[]}}const LS=6e4;async function lf(e){const t=new AbortController,n=setTimeout(()=>t.abort(),LS);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)}}const OS={},DS={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function FS(e,t){return T(),A("svg",DS,[...t[0]||(t[0]=[d("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const ni=At(OS,[["render",FS]]),US={},BS={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function qS(e,t){return T(),A("svg",BS,[...t[0]||(t[0]=[d("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const yc=At(US,[["render",qS]]),zS={},HS={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function WS(e,t){return T(),A("svg",HS,[...t[0]||(t[0]=[d("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 cl=At(zS,[["render",WS]]),VS={},GS={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function KS(e,t){return T(),A("svg",GS,[...t[0]||(t[0]=[d("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 Rl=At(VS,[["render",KS]]),YS={},JS={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function QS(e,t){return T(),A("svg",JS,[...t[0]||(t[0]=[d("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 Sp=At(YS,[["render",QS]]),XS={},ZS={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ex(e,t){return T(),A("svg",ZS,[...t[0]||(t[0]=[d("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 tx=At(XS,[["render",ex]]),nx={},ox={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function rx(e,t){return T(),A("svg",ox,[...t[0]||(t[0]=[d("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 Oi=At(nx,[["render",rx]]),ax={},sx={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ix(e,t){return T(),A("svg",sx,[...t[0]||(t[0]=[d("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 ga=At(ax,[["render",ix]]),lx={},ux={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function cx(e,t){return T(),A("svg",ux,[...t[0]||(t[0]=[d("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 du=At(lx,[["render",cx]]),Ey="codex-web-local.ui-language.v1",dx={English:"English","Simplified Chinese":"简体中文",Commands:"命令",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":"思考过程","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":"自定义端点",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 无法自动还原。",Undoing:"正在撤销","Uninstall failed":"卸载失败","Use a thread or project menu to add an automation.":"请通过线程或项目菜单添加自动化。"},Om={en:"English","zh-CN":"简体中文"};function fx(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(Ey))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const hd=S(fx());function Iy(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}Iy(hd.value);function px(e,t){return t?e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??"")):e}function hx(e){hd.value=e,Iy(e),typeof window<"u"&&window.localStorage.setItem(Ey,e)}function Ry(e,t){const n=hd.value==="zh-CN"?dx[e]??e:e;return px(n,t)}function Ar(){return{uiLanguage:hd,uiLanguageOptions:[{value:"en",label:Om.en},{value:"zh-CN",label:Om["zh-CN"]}],t:Ry,setUiLanguage:hx}}const My="brutalstrikedevs@gmail.com",mx=20,vx=6500,Dm=1800,uf=12,Fm=240,Um=/token|secret|password|passwd|credential|authorization|auth|bearer|cookie|session|key/i,Sl=S([]);let Bm=!1,cf=!1,df=null;function fu(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 gx(e){return typeof e=="string"?e:e instanceof URL?e.toString():e.url}function yx(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 $y(e){return((e||"").split(/\r?\n/,1)[0]??"").replace(/\s+/g," ").trim().slice(0,80)||"issue report"}function qm(e){return encodeURIComponent(e)}function wx(){return`mailto:${My}`}function bx(){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>Dm?`${e.slice(0,Dm)}
50
+ ...[truncated]`:e:"No visible page text captured."}function _x(e,t){const n=t.replace(/\r\n/g,`
51
+ `).replace(/[ \t]+/g," ").trim();return n?Um.test(e)||Um.test(n)?`[omitted sensitive value, ${n.length} chars]`:n.length>Fm?`${n.slice(0,Fm)}...[truncated, ${n.length} chars total]`:n:""}function zm(e,t){if(!e)return`${t}: unavailable`;try{const n=[],o=Math.min(e.length,uf);for(let s=0;s<o;s+=1){const a=e.key(s);a&&n.push(`${a}=${_x(a,e.getItem(a)??"")}`)}const r=e.length>uf?`
52
+ ...${e.length-uf} more item(s)`:"";return`${t}:
53
+ ${n.join(`
54
+ `)||"empty"}${r}`}catch(n){return`${t}: unavailable (${$y(fu(n))})`}}function kx(){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}`,zm(window.localStorage,"localStorage"),zm(window.sessionStorage,"sessionStorage")].join(`
55
+ `)}function Mi(e){const t=e.message.trim();if(!t)return;const n=Sl.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()};Sl.value=[o,...Sl.value].slice(0,mx)}function jy(e=Sl.value){var m;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.88",s="codex-mobile",a=e.slice(0,12).map((g,w)=>[`${w+1}. [${g.atIso}] ${g.kind}`,g.method?`${g.method}`:"",g.url??"",typeof g.status=="number"?`${g.status} ${g.statusText??""}`.trim():"",g.message].filter(Boolean).join(" | ")).join(`
56
+ `),l=["What happened?","","","Context",`URL: ${n}`,`User agent: ${o}`,`Viewport: ${t}`,`App version: ${r}`,`Worktree: ${s}`,"","Browser/app state",kx(),"","Recent diagnostics",a||"No diagnostics captured.","","Visible page text",bx()].join(`
57
+ `).slice(0,vx),f=`Codex Web feedback: ${$y((m=e[0])==null?void 0:m.message)}`;return`mailto:${My}?subject=${qm(f)}&body=${qm(l)}`}function Cx(){typeof window>"u"||(window.location.href=jy())}function Tx(){if(!(typeof window>"u")&&(Bm||(Bm=!0,window.addEventListener("error",e=>{Mi({kind:"window-error",message:e.error?fu(e.error):e.message,url:e.filename||window.location.href})}),window.addEventListener("unhandledrejection",e=>{Mi({kind:"unhandled-rejection",message:fu(e.reason),url:window.location.href})})),!cf)){if(typeof window.fetch!="function"){Mi({kind:"fetch-error",message:"Feedback diagnostics could not monitor fetch: window.fetch is unavailable",url:window.location.href});return}try{df=window.fetch.bind(window),window.fetch=async(e,t)=>{const n=gx(e),o=yx(e,t);try{const r=await df(e,t);return r.ok||Mi({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 Mi({kind:"fetch-error",message:fu(r),url:n,method:o}),r}},cf=!0}catch(e){df=null,cf=!1;try{Mi({kind:"fetch-error",message:`Feedback diagnostics could not monitor fetch: ${fu(e)}`,url:window.location.href})}catch{}}}}function xp(){const e=ee(()=>Sl.value.length>0);function t(n,o){Mi({kind:"visible-error",message:n,url:o||(typeof window>"u"?void 0:window.location.href)})}return{diagnostics:Sl,hasFeedbackDiagnostics:e,recordVisibleFailure:t,openFeedbackMail:Cx,buildFeedbackMailto:jy,feedbackMailtoBase:wx}}const Ny="codex-web-local.recycle-bin.v1";function Ly(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Ny);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 Hm(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Ny,JSON.stringify(e))}catch{}}const vs=S(Ly());function Sx(){function e(){vs.value=Ly()}function t(r){vs.value=[{...r,archivedAtIso:new Date().toISOString()},...vs.value.filter(s=>s.id!==r.id)],Hm(vs.value)}function n(r){vs.value=vs.value.filter(s=>s.id!==r),Hm(vs.value)}async function o(r){if(!vs.value.some(s=>s.id===r))return{ok:!1,error:"Thread is not in the recycle bin"};try{return await R1(r),n(r),{ok:!0}}catch(s){return{ok:!1,error:s instanceof Error?s.message:"Failed to restore thread"}}}return{records:vs,loadRecords:e,recordArchivedThread:t,removeArchivedRecord:n,restoreArchivedThread:o}}const xx=["title","aria-label","disabled"],Ax={key:1,class:"composer-dropdown-value"},Px={key:0,class:"composer-dropdown-search-wrap"},Ex=["placeholder","onKeydown"],Ix={class:"composer-dropdown-options",role:"listbox"},Rx=["onClick"],Mx={key:0,class:"composer-dropdown-empty"},$x=Nn({__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=S(null),s=S(null),a=S(null),l=S(null),f=S(!1),m=S(""),g=S({});let w=!1;const x=ee(()=>{var Pe;const Ae=n.options.find(De=>De.value===n.modelValue);return Ae?Ae.label:((Pe=n.placeholder)==null?void 0:Pe.trim())||""}),R=ee(()=>n.openDirection??"down"),L=ee(()=>n.menuAlign??"start"),B=ee(()=>n.iconOnly===!0),Y=ee(()=>n.enableSearch===!0),ae=ee(()=>n.variant==="pill"?"composer-dropdown-trigger--pill":""),z=ee(()=>{var Ae;return((Ae=n.searchPlaceholder)==null?void 0:Ae.trim())||"Quick search projects"}),Z=ee(()=>{var Ae;return((Ae=n.emptyLabel)==null?void 0:Ae.trim())||"No results"}),X=ee(()=>{var Ae;return x.value||((Ae=n.placeholder)==null?void 0:Ae.trim())||"Select option"}),ye=ee(()=>{const Ae=m.value.trim().toLowerCase();return Ae?n.options.filter(Pe=>Pe.label.toLowerCase().includes(Ae)||Pe.value.toLowerCase().includes(Ae)):n.options});function Me(){n.disabled||(f.value=!f.value)}function Se(Ae,Pe,De){return Math.min(De,Math.max(Pe,Ae))}function Fe(){var ne,re,H,Be;if(!f.value)return;const Ae=r.value;if(!Ae||typeof window>"u")return;const Pe=Ae.getBoundingClientRect(),De=window.innerWidth,Ye=window.innerHeight,He=8,St=8,ct=Math.max(0,De-He*2),Ge=((ne=a.value)==null?void 0:ne.offsetWidth)??((re=s.value)==null?void 0:re.offsetWidth)??224,nt=((H=a.value)==null?void 0:H.offsetHeight)??((Be=s.value)==null?void 0:Be.offsetHeight)??0,dt=Math.min(Ge,ct),_t=Math.max(He,De-dt-He),Tt=L.value==="end"?Pe.right-dt:Pe.left,gt=Se(Tt,He,_t);let se=R.value==="up"?Pe.top-nt-St:Pe.bottom+St;nt>0&&se+nt>Ye-He&&(se=Ye-nt-He),se=Math.max(He,se),g.value={position:"fixed",left:`${gt}px`,right:"auto",top:`${se}px`,bottom:"auto",width:`${dt}px`}}function pe(){w||typeof window>"u"||(window.addEventListener("resize",Fe),window.addEventListener("scroll",Fe,!0),w=!0)}function Ue(){!w||typeof window>"u"||(window.removeEventListener("resize",Fe),window.removeEventListener("scroll",Fe,!0),w=!1)}function $e(Ae){o("update:modelValue",Ae),f.value=!1,m.value=""}function he(){if(m.value.length>0){m.value="";return}f.value=!1}function Te(Ae){if(!f.value)return;const Pe=r.value;if(!Pe)return;const De=Ae.target;De instanceof Node&&(Pe.contains(De)||(f.value=!1,m.value=""))}return rt(f,Ae=>{if(!Ae){Ue(),g.value={};return}pe(),zt(()=>{var Pe;Fe(),window.requestAnimationFrame(Fe),Y.value&&((Pe=l.value)==null||Pe.focus())})}),Ps(()=>{window.addEventListener("pointerdown",Te)}),zi(()=>{window.removeEventListener("pointerdown",Te),Ue()}),(Ae,Pe)=>(T(),A("div",{ref_key:"rootRef",ref:r,class:"composer-dropdown"},[d("button",{class:Ke(["composer-dropdown-trigger",ae.value]),type:"button",title:X.value,"aria-label":X.value,disabled:e.disabled,onClick:Me},[e.selectedPrefixIcon?(T(),at(up(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):J("",!0),B.value?J("",!0):(T(),A("span",Ax,k(x.value),1)),xe(ni,{class:"composer-dropdown-chevron"})],10,xx),f.value?(T(),A("div",{key:0,ref_key:"menuWrapRef",ref:s,class:Ke(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":R.value==="up","composer-dropdown-menu-wrap-down":R.value==="down"}]),style:Vr(g.value)},[d("div",{ref_key:"menuRef",ref:a,class:"composer-dropdown-menu"},[Y.value?(T(),A("div",Px,[Nt(d("input",{ref_key:"searchInputRef",ref:l,"onUpdate:modelValue":Pe[0]||(Pe[0]=De=>m.value=De),class:"composer-dropdown-search-input",type:"text",placeholder:z.value,onKeydown:Pn(Qe(he,["prevent"]),["esc"])},null,40,Ex),[[an,m.value]])])):J("",!0),d("ul",Ix,[(T(!0),A(ze,null,kt(ye.value,De=>(T(),A("li",{key:De.value},[d("button",{class:Ke(["composer-dropdown-option",{"is-selected":De.value===e.modelValue}]),type:"button",onClick:Ye=>$e(De.value)},k(De.label),11,Rx)]))),128)),ye.value.length===0?(T(),A("li",Mx,k(Z.value),1)):J("",!0)])],512)],6)):J("",!0)],512))}}),lr=At($x,[["__scopeId","data-v-48e2516e"]]),jx={},Nx={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Lx(e,t){return T(),A("svg",Nx,[...t[0]||(t[0]=[d("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const jc=At(jx,[["render",Lx]]),Ox=["aria-label","onKeydown"],Dx={class:"app-dialog-header"},Fx={class:"app-dialog-title-wrap"},Ux={class:"app-dialog-title"},Bx={key:0,class:"app-dialog-subtitle"},qx=["aria-label","title"],zx={class:"app-dialog-body"},Hx={key:0,class:"app-dialog-footer"},Wx=Nn({__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}=Ar();function s(){o("close")}function a(l){n.open&&l.key==="Escape"&&(l.preventDefault(),s())}return rt(()=>n.open,l=>{typeof window>"u"||(l?window.addEventListener("keydown",a):window.removeEventListener("keydown",a))},{immediate:!0}),zi(()=>{typeof window>"u"||window.removeEventListener("keydown",a)}),(l,f)=>(T(),at(Bi,{to:"body"},[e.open?(T(),A("div",{key:0,class:"app-dialog-overlay",onClick:Qe(s,["self"])},[d("div",{class:Ke(["app-dialog-panel",`app-dialog-panel--${e.size}`]),role:"dialog","aria-modal":"true","aria-label":e.ariaLabel||e.title,onKeydown:Pn(Qe(s,["prevent"]),["esc"])},[d("div",Dx,[d("div",Fx,[d("h3",Ux,k(e.title),1),e.subtitle?(T(),A("p",Bx,k(e.subtitle),1)):J("",!0)]),d("button",{class:"app-dialog-close",type:"button","aria-label":v(r)("Close"),title:v(r)("Close"),onClick:s},[xe(jc,{class:"app-dialog-close-icon"})],8,qx)]),d("div",zx,[ur(l.$slots,"default",{},void 0)]),l.$slots.footer?(T(),A("div",Hx,[ur(l.$slots,"footer",{},void 0)])):J("",!0)],42,Ox)])):J("",!0)]))}}),ff=At(Wx,[["__scopeId","data-v-3d93f67e"]]),Vx={key:0,class:"sidebar-menu-row-left"},Gx={class:"sidebar-menu-row-main"},Kx={key:1,class:"sidebar-menu-row-right"},Yx={key:0,class:"sidebar-menu-row-right-default"},Jx={key:1,class:"sidebar-menu-row-right-hover"},Qx=Nn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=w0(),o=ee(()=>!!n.left),r=ee(()=>!!n.right),s=ee(()=>!!n["right-hover"]),a=ee(()=>r.value||s.value);return(l,f)=>(T(),at(up(t.as),zg({class:"sidebar-menu-row","data-has-left":o.value,"data-has-right":a.value,"data-has-right-hover":s.value,"data-force-right-hover":t.forceRightHover},l.$attrs),{default:tt(()=>[o.value?(T(),A("span",Vx,[ur(l.$slots,"left",{},void 0,!0)])):J("",!0),d("span",Gx,[ur(l.$slots,"default",{},void 0,!0)]),a.value?(T(),A("span",Kx,[r.value?(T(),A("span",Yx,[ur(l.$slots,"right",{},void 0,!0)])):J("",!0),s.value?(T(),A("span",Jx,[ur(l.$slots,"right-hover",{},void 0,!0)])):J("",!0)])):J("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),ha=At(Qx,[["__scopeId","data-v-5fc666fb"]]);function Xx(e,t,n){return n.canPruneMissing?e.filter(o=>t.has(o)):e}const Zx={key:0,class:"pinned-section"},eA={class:"thread-tree-header"},tA={key:0,class:"thread-list"},nA=["data-menu-open"],oA={class:"thread-left-stack"},rA=["data-state"],aA=["data-confirming","title","onClick"],sA={key:0,class:"thread-delete-confirm-label"},iA=["onClick"],lA={class:"thread-row-title-wrap"},uA={class:"thread-row-title-line"},cA={class:"thread-row-title"},dA=["title"],fA={key:0,class:"thread-row-automation-count"},pA=["data-state"],hA={class:"thread-row-time"},mA=["onClick"],vA={class:"projects-section"},gA={class:"thread-tree-header"},yA=["aria-expanded","aria-label","title"],wA={class:"organize-menu-title"},bA=["data-active"],_A={key:0},kA=["data-active"],CA={key:0},TA=["data-active"],SA={key:0},xA={class:"organize-menu-title"},AA=["data-active"],PA={key:0},EA=["data-active"],IA={key:0},RA={key:0,class:"thread-tree-action-error"},MA={key:1,class:"thread-tree-no-results"},$A={key:2,class:"thread-tree-loading"},jA={key:3,class:"thread-list thread-list-global"},NA=["data-menu-open"],LA={class:"thread-left-stack"},OA=["data-state"],DA=["data-confirming","title","onClick"],FA={key:0,class:"thread-delete-confirm-label"},UA=["onClick"],BA={class:"thread-row-title-wrap"},qA={class:"thread-row-title-line"},zA={class:"thread-row-title"},HA=["title"],WA={key:0,class:"thread-row-automation-count"},VA=["data-state"],GA={class:"thread-row-time"},KA=["onClick"],YA=["data-project-name","data-expanded","data-dragging"],JA={class:"project-icon-stack"},QA={class:"project-icon-folder"},XA={class:"project-icon-chevron"},ZA=["data-dragging-handle","onMousedown"],eP=["title"],tP=["title"],nP={key:0,class:"thread-row-automation-count"},oP={class:"project-hover-controls"},rP=["onClick"],aP=["data-open-direction"],sP=["onClick"],iP=["onClick"],lP=["onClick"],uP=["onClick"],cP=["onClick"],dP=["onClick"],fP={class:"project-menu-label"},pP=["onInput"],hP=["aria-label","title","onClick"],mP={key:0,class:"thread-list"},vP=["data-menu-open"],gP={class:"thread-left-stack"},yP=["data-state"],wP=["data-confirming","title","onClick"],bP={key:0,class:"thread-delete-confirm-label"},_P=["onClick"],kP={class:"thread-row-title-wrap"},CP={class:"thread-row-title-line"},TP={class:"thread-row-title"},SP=["title"],xP={key:0,class:"thread-row-automation-count"},AP=["data-state"],PP={class:"thread-row-time"},EP=["onClick"],IP={class:"project-empty"},RP=["onClick"],MP={class:"chats-section"},$P={class:"thread-tree-header"},jP={class:"chats-section-actions"},NP=["aria-label","title"],LP={key:0,class:"thread-tree-no-results"},OP={key:1,class:"thread-list thread-list-global"},DP=["data-menu-open"],FP={class:"thread-left-stack"},UP=["data-state"],BP=["data-confirming","title","onClick"],qP={key:0,class:"thread-delete-confirm-label"},zP=["onClick"],HP={class:"thread-row-title-wrap"},WP={class:"thread-row-title-line"},VP={class:"thread-row-title"},GP=["title"],KP={key:0,class:"thread-row-automation-count"},YP=["data-state"],JP={class:"thread-row-time"},QP=["onClick"],XP=["data-open-direction"],ZP=["disabled","title"],eE=["placeholder","onKeydown"],tE={key:0,class:"recycle-bin-empty"},nE={key:1,class:"recycle-bin-list"},oE={class:"recycle-bin-item-copy"},rE={class:"recycle-bin-item-title"},aE={key:0,class:"recycle-bin-item-meta"},sE={class:"recycle-bin-item-time"},iE={class:"recycle-bin-item-actions"},lE=["disabled","onClick"],uE=["onClick"],cE={key:2,class:"recycle-bin-error",role:"alert"},dE=["aria-label"],fE={class:"rename-thread-title"},pE={class:"rename-thread-subtitle"},hE={key:0,class:"automation-target-picker"},mE={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},vE={class:"automation-target-dropdown"},gE=["aria-label"],yE=["onClick"],wE={class:"automation-thread-field"},bE={class:"automation-thread-label"},_E=["placeholder"],kE={class:"automation-thread-field"},CE={class:"automation-thread-label"},TE=["placeholder"],SE={class:"automation-thread-field"},xE={class:"automation-thread-label"},AE={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},PE={key:0,class:"automation-schedule-row"},EE={class:"automation-schedule-copy"},IE={key:1,class:"automation-schedule-row"},RE={class:"automation-schedule-copy"},ME={class:"automation-schedule-preview"},$E={class:"automation-thread-field"},jE={class:"automation-thread-label"},NE={key:2,class:"rename-thread-subtitle automation-thread-error"},LE={key:3,class:"rename-thread-subtitle automation-thread-notice"},OE={class:"rename-thread-actions"},DE=["disabled"],FE=["disabled"],UE=["disabled"],BE=["disabled"],qE=4,Wm=6,Vm="codex-web-local.sidebar-section-expansion.v1",Gm="codex-web-local.sidebar-chats-first.v1",Km="codex-web-local.sidebar-chat-sort-mode.v1",Ym="codex-web-local.thread-view-mode.v1",Jm="codex-web-local.collapsed-projects.v1",zE=Nn({__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}=Ar(),{recordVisibleFailure:s}=xp(),a=n,{records:l,loadRecords:f,recordArchivedThread:m,removeArchivedRecord:g,restoreArchivedThread:w}=Sx(),x=S(!1),R=S(""),L=S("");function B(){gn.value=!1,R.value="",f(),x.value=!0}async function Y(y){if(!L.value){L.value=y,R.value="";try{const C=await w(y);C.ok?a("restore-thread",y):R.value=C.error??"Failed to restore thread"}finally{L.value=""}}}const ae=S({}),z=S({}),Z=S(!0),X=S(!0),ye=S(!0),Me=S(!1),Se=S(Es(Gm,!1)),Fe=S(xt());let pe=!1;const Ue=S([]),$e=S({}),he=S(""),Te=S([]),Ae=S(""),Pe=S(""),De=S("hover"),Ye=S({}),He=S({}),St=S({}),ct=S("actions"),Ge=S(""),nt=S(!1),dt=S(""),_t=S(""),Tt=S(null),gt=S(!1),se=S(""),ne=S(""),re=S({}),H=S({}),Be=S(!1),$=S("thread"),D=S(""),G=S(""),ie=S(""),le=S("create"),oe=S(!1),Ce=S("thread"),we=S(""),ve=S(""),ce=S(""),Ee=S(""),be=S(!1),Oe=S(!1),Re=S({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),Ve=S({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),it=ee(()=>{if($.value==="project"){const C=G.value;return C?H.value[C]??[]:[]}const y=D.value;return y?re.value[y]??[]:[]}),yt=ee(()=>bn(Re.value.rrule)),It=ee(()=>oe.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."):$.value==="project"?r("This creates project automations attached to the selected project folder."):r("This creates heartbeat automations attached to the selected thread.")),Ze=ee(()=>{var C;const y=[];for(const _ of o.groups)for(const F of _.threads){const _e=((C=F.title)==null?void 0:C.trim())||F.id,lt=co(_.projectName);y.push({value:F.id,label:`${_e} · ${lt}`,searchText:`${_e} ${lt} ${F.id}`.toLowerCase()})}return y}),Wt=ee(()=>{const y=[];for(const C of o.groups){const _=Uo(C.projectName);if(!_)continue;const F=co(C.projectName);y.push({value:_,label:F,searchText:`${F} ${_}`.toLowerCase()})}return y}),W=ee(()=>(Ce.value==="project"?Wt.value:Ze.value).map(C=>({value:C.value,label:C.label}))),K=[{value:"minutes",label:r("minutes")},{value:"hours",label:r("hours")},{value:"days",label:r("days")}],Q=ee(()=>[{value:"ACTIVE",label:r("Active")},{value:"PAUSED",label:r("Paused")}]);rt(W,y=>{var C;oe.value&&(y.some(_=>_.value===we.value)||(we.value=((C=y[0])==null?void 0:C.value)??""))});const de=S(null),Le=S(null),We=S(null);let ot=null,Ft=null;const Vt=S(""),Bn=S({}),Jo=new Map,vo=new Map,Qn=new Map,go=new WeakMap,Qo=S(null),dr=S(null),gn=S(!1),mt=S(Aa()),nn=typeof window<"u"?new ResizeObserver(y=>{for(const C of y){const _=C.target,F=go.get(_);F&&cn(F,_)}}):null;function Xn(){if(typeof window>"u")return{};try{const y=window.localStorage.getItem(Jm);if(!y)return{};const C=JSON.parse(y);return!C||typeof C!="object"||Array.isArray(C)?{}:C}catch{return{}}}function Aa(){return typeof window>"u"?"project":window.localStorage.getItem(Ym)==="chronological"?"chronological":"project"}function Es(y,C){if(typeof window>"u")return C;const _=window.localStorage.getItem(y);return _==="true"?!0:_==="false"?!1:C}function xt(){return typeof window>"u"?"updated":window.localStorage.getItem(Km)==="created"?"created":"updated"}z.value=Xn();function Gt(){if(!(typeof window>"u"))try{const y=JSON.parse(window.localStorage.getItem(Vm)||"{}");typeof y.pinned=="boolean"&&(Z.value=y.pinned),typeof y.projects=="boolean"&&(X.value=y.projects),typeof y.chats=="boolean"&&(ye.value=y.chats)}catch{}}function ht(){typeof window>"u"||window.localStorage.setItem(Vm,JSON.stringify({pinned:Z.value,projects:X.value,chats:ye.value}))}Gt(),rt(z,y=>{typeof window>"u"||window.localStorage.setItem(Jm,JSON.stringify(y))},{deep:!0}),rt(mt,y=>{typeof window>"u"||window.localStorage.setItem(Ym,y)}),rt(Se,y=>{typeof window>"u"||window.localStorage.setItem(Gm,String(y))}),rt(Fe,y=>{typeof window>"u"||window.localStorage.setItem(Km,y)}),rt([Z,X,ye],ht);const Xo=ee(()=>o.searchQuery.trim().toLowerCase()),sn=ee(()=>Xo.value.length>0),fr=ee(()=>o.searchMatchedThreadIds?new Set(o.searchMatchedThreadIds):null),yo=ee(()=>new Set(Ue.value)),Ln=ee(()=>new Set(Te.value));function pr(y){if(Ln.value.has(y.id))return!1;if(!sn.value)return!0;if(fr.value)return fr.value.has(y.id);const C=Xo.value;return y.title.toLowerCase().includes(C)||y.preview.toLowerCase().includes(C)}const Pa=ee(()=>o.groups.flatMap(y=>{const C=y.threads.filter(_=>!Kc(_.cwd)&&pr(_));return C.length>0?[{...y,threads:C}]:!sn.value&&y.threads.length===0?[{...y,threads:C}]:[]})),Ja=ee(()=>mt.value==="chronological"),Kn=ee(()=>{const y=[];for(const C of o.groups)for(const _ of C.threads)yo.value.has(_.id)||pr(_)&&y.push(_);return y.sort((C,_)=>{const F=new Date(C.updatedAtIso||C.createdAtIso).getTime();return new Date(_.updatedAtIso||_.createdAtIso).getTime()-F})}),In=ee(()=>{const y=Kn.value.filter(_=>Kc(_.cwd)),C=Fe.value==="created"?"createdAtIso":"updatedAtIso";return y.sort((_,F)=>{const _e=new Date(_[C]||_.updatedAtIso||_.createdAtIso).getTime();return new Date(F[C]||F.updatedAtIso||F.createdAtIso).getTime()-_e})}),Qa=ee(()=>sn.value||Me.value?In.value:In.value.slice(0,10)),Zn=ee(()=>sn.value?!1:In.value.length>10),yn=ee(()=>{const y=new Map;for(const C of o.groups)for(const _ of C.threads)Ln.value.has(_.id)||y.set(_.id,_);return y});rt(Ue,y=>{pe&&IS(y)}),rt([yn,()=>o.isThreadListFullyLoaded],([y])=>{const C=Xx(Ue.value,new Set(y.keys()),{canPruneMissing:o.isThreadListFullyLoaded});if(C.length===Ue.value.length)return;const _=new Set(C),F=Object.fromEntries(Object.entries($e.value).filter(([_e])=>_.has(_e)));$e.value=F,Ue.value=C});let Qr=0;async function Xt(){if(o.isLoading)return;const y=Ue.value.filter(_e=>!yn.value.has(_e)&&!$e.value[_e]);if(y.length===0)return;const C=Qr+=1,_=await Promise.all(y.map(async _e=>{try{return await QT(_e)}catch{return null}}));if(C!==Qr)return;const F={...$e.value};for(const _e of _)_e&&(F[_e.id]=_e);$e.value=F}rt([Ue,yn,()=>o.isLoading],()=>{pe&&Xt()}),Ps(async()=>{const{threadIds:y}=await ES(),C=Array.isArray(y)?y.filter(_=>typeof _=="string").map(_=>_.trim()).filter((_,F,_e)=>_.length>0&&_e.indexOf(_)===F):[];C.length>0&&(Ue.value=C);try{re.value=await h1()}catch{re.value={}}try{await Jt()}catch{H.value={}}pe=!0,Xt()});const Xr=ee(()=>_o(se.value)),Ea=ee(()=>{const y=ne.value;return Xr.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})}),wo=ee(()=>{const y=new Map;for(const C of o.groups)for(const _ of C.threads)y.set(_.id,C.projectName);return y}),$o=ee(()=>{const y=new Map;for(const C of o.groups){const _=C.threads.filter(F=>!yo.value.has(F.id)&&!Ln.value.has(F.id));y.set(C.projectName,_)}return y}),jo=ee(()=>{const y=new Map;for(const C of o.groups)for(const _ of C.threads){const F=new Date(_.updatedAtIso||_.createdAtIso).getTime();y.set(_.id,F)}return y}),Lt=ee(()=>{const y=Pe.value;return y?yn.value.get(y)??null:null}),Rt=ee(()=>Ue.value.map(y=>yn.value.get(y)??$e.value[y]??null).filter(y=>y!==null).filter(pr));function Yn(){Z.value=!Z.value}function bo(){X.value=!X.value}function eo(){ye.value=!ye.value}const qn=ee(()=>{const y=We.value;if(!y||y.dropTargetIndexFull===null||o.groups.length===0)return null;const C=Math.max(0,Math.min(y.dropTargetIndexFull,o.groups.length)),_=C>y.fromIndex?C-1:C,F=Math.max(0,Math.min(_,o.groups.length-1));return F===y.fromIndex?null:F}),On=ee(()=>{const C=(sn.value?Pa.value:o.groups).map(Pt=>Pt.projectName),_=We.value,F=qn.value;if(!_||F===null)return C;const _e=[...C],[lt]=_e.splice(_.fromIndex,1);return lt?(_e.splice(F,0,lt),_e):C}),No=ee(()=>{const y={};let C=0;for(const _ of On.value)y[_]=C,C+=Wn(_);return y}),hr=ee(()=>{let y=0;for(const C of On.value)y+=Wn(C);return{height:`${Math.max(0,y)}px`}});function Zr(y){if(Number.isNaN(y))return"n/a";const C=Math.abs(Date.now()-y);if(C<6e4)return r("now");const _=Math.floor(C/6e4);if(_<60)return`${_}m`;const F=Math.floor(_/60);return F<24?`${F}h`:`${Math.floor(F/24)}d`}function Ia(y){const C=jo.value.get(y.id);return Zr(typeof C=="number"?C:new Date(y.updatedAtIso||y.createdAtIso).getTime())}function Pr(y){const C=new Date(y).getTime();return Number.isNaN(C)?"":new Date(C).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Er(y){return yo.value.has(y)}function Xa(y){if(Er(y)){Ue.value=Ue.value.filter(C=>C!==y);return}Ue.value=[y,...Ue.value]}function Ra(y){Xa(y),$t()}function to(y){he.value="",a("select",y)}function _o(y){return no(y)>0}function no(y){var C;return((C=re.value[y])==null?void 0:C.length)??0}function wt(y){return Rn(y)>0}function Rn(y){var _;const C=Uo(y);return C?((_=H.value[C])==null?void 0:_.length)??0:0}function zn(y){if(y.length===0)return"";if(y.length>1){const F=y.filter(_e=>_e.status==="ACTIVE").length;return`${y.length} ${r("automations")} • ${F} ${r("active")}`}const[C]=y,_=C.status==="PAUSED"?"-":C.nextRunAtMs?new Date(C.nextRunAtMs).toLocaleString():r("Not scheduled");return`${C.name} • ${r("Next run")}: ${_}`}function ln(y){return zn(re.value[y]??[])}function oo(y){const C=Uo(y);return zn(C?H.value[C]??[]:[])}function Zo(y){return String(Math.max(0,y)).padStart(2,"0")}function mr(y,C){const _=typeof y=="number"?y:Number(y);return Number.isFinite(_)?Math.max(1,Math.floor(_)):C}function Jn(y){const[C,_]=y.split(":"),F=Math.min(23,Math.max(0,Number(C)||0)),_e=Math.min(59,Math.max(0,Number(_)||0));return`FREQ=DAILY;BYHOUR=${F};BYMINUTE=${_e}`}function Mt(y,C){const _=mr(y,1);return C==="minutes"?`FREQ=MINUTELY;INTERVAL=${_}`:C==="hours"?`FREQ=HOURLY;INTERVAL=${_}`:`FREQ=DAILY;INTERVAL=${_}`}function wn(y){return Object.fromEntries(y.split(";").map(C=>C.trim()).filter(Boolean).map(C=>{const[_,...F]=C.split("=");return[_.toUpperCase(),F.join("=").trim()]}).filter(([C,_])=>C&&_))}function Kt(y){var _e;const C=wn(y),_=(_e=C.FREQ)==null?void 0:_e.toUpperCase(),F=mr(C.INTERVAL,1);if(_==="DAILY"&&C.BYHOUR!==void 0&&C.BYMINUTE!==void 0&&F===1){const lt=Math.min(23,Math.max(0,Number(C.BYHOUR)||0)),Pt=Math.min(59,Math.max(0,Number(C.BYMINUTE)||0));return{mode:"daily",dailyTime:`${Zo(lt)}:${Zo(Pt)}`,interval:1,intervalUnit:"hours"}}return _==="MINUTELY"||_==="HOURLY"||_==="DAILY"&&C.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:F,intervalUnit:_==="MINUTELY"?"minutes":_==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function bn(y){var _e;const C=wn(y),_=(_e=C.FREQ)==null?void 0:_e.toUpperCase(),F=mr(C.INTERVAL,1);if(_==="DAILY"&&C.BYHOUR!==void 0&&C.BYMINUTE!==void 0&&F===1){const lt=Math.min(23,Math.max(0,Number(C.BYHOUR)||0)),Pt=Math.min(59,Math.max(0,Number(C.BYMINUTE)||0));return`${r("RRULE")}: ${y} · ${r("runs daily at")} ${Zo(lt)}:${Zo(Pt)}`}return _==="MINUTELY"?`${r("RRULE")}: ${y} · ${r("runs every")} ${F} ${r("minute(s)")}`:_==="HOURLY"?`${r("RRULE")}: ${y} · ${r("runs every")} ${F} ${r("hour(s)")}`:_==="DAILY"&&C.INTERVAL!==void 0?`${r("RRULE")}: ${y} · ${r("runs every")} ${F} ${r("day(s)")}`:y?`${r("RRULE")}: ${y}`:r("RRULE is required.")}function Sn(){const y=Ve.value;y.mode==="daily"?Re.value.rrule=Jn(y.dailyTime):y.mode==="interval"&&(Re.value.rrule=Mt(y.interval,y.intervalUnit))}function ro(y){y!=="minutes"&&y!=="hours"&&y!=="days"||(Ve.value={...Ve.value,intervalUnit:y},Sn())}function ao(y){y!=="ACTIVE"&&y!=="PAUSED"||(Re.value={...Re.value,status:y})}function ea(){Ve.value=Kt(Re.value.rrule)}function Mn(y){Ve.value={...Ve.value,mode:y},Sn()}function Za(y){y===o.selectedThreadId&&(a("copy-thread-chat",y),$t())}function Hn(y){a("fork-thread",y),$t()}function Lo(y){return`${r("start new thread")} ${co(y)}`}function vr(y){a("start-new-thread",y)}function ko(y){a("browse-thread-files",y),$t()}function Ir(y){a("save-thread-project",y),$t()}async function ta(y){var _,F;const C=((F=(_=yn.value.get(y))==null?void 0:_.cwd)==null?void 0:F.trim())??"";if($t(),!(!C||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(C)}catch{}}function Oo(y,C){if(Pe.value===y&&De.value==="hover"){if(C){const _=C.relatedTarget,F=dr.value;if(_ instanceof Node&&F&&F.contains(_))return}$t()}}function fn(y){return Pe.value===y}function $t(){Pe.value="",De.value="hover",St.value={}}function Do(y){if(he.value="",Pe.value===y){$t();return}De.value="hover",Dn(),gn.value=!1,Pe.value=y,zt(()=>{To(y)})}function so(y,C){y.preventDefault(),he.value="",De.value="contextmenu",Pe.value=C}function Rr(y,C){dt.value=y,_t.value=C,nt.value=!0,$t(),zt(()=>{var _,F;(_=Tt.value)==null||_.focus(),(F=Tt.value)==null||F.select()})}function _n(){nt.value=!1,dt.value="",_t.value=""}function Ma(){const y=dt.value,C=_t.value.trim();!y||!C||(a("rename-thread",{threadId:y,title:C}),_n())}function I(y,C){he.value="",se.value=y,ne.value=C,gt.value=!0,$t()}function O(){gt.value=!1,se.value="",ne.value=""}async function V(){const y=se.value;y&&(Ut(y),O())}function ge(y){return he.value===y}function et(y){if(he.value!==y){he.value=y,$t();return}Ut(y),he.value=""}function Ut(y){var _,F;Ln.value.has(y)||(Te.value=[y,...Te.value]),he.value="",$t();const C=yn.value.get(y)??null;m({id:y,title:((_=C==null?void 0:C.title)==null?void 0:_.trim())||"(untitled)",cwd:((F=C==null?void 0:C.cwd)==null?void 0:F.trim())??"",projectName:wo.value.get(y)??""}),Ue.value=Ue.value.filter(_e=>_e!==y),a("archive",y),_o(y)&&(Tm(y).catch(()=>{}),re.value=uo(re.value,y))}function jt(y){var _;$.value="thread",D.value=y,G.value="",oe.value=!1,ve.value="",ce.value="";const C=(_=re.value[y])==null?void 0:_[0];C?Fo(C.id):hn(),Be.value=!0,$t()}function pn(y){var F;const C=Uo(y);if(!C){$.value="project",D.value="",G.value="",oe.value=!1,ve.value=r("Project automation requires a resolved absolute project path."),ce.value="",Be.value=!0,Dn();return}$.value="project",D.value="",G.value=C,oe.value=!1,ve.value="",ce.value="";const _=(F=H.value[C])==null?void 0:F[0];_?Fo(_.id):hn(),Be.value=!0,Dn()}function io(y){$.value=y.scope,D.value=y.scope==="thread"?y.target:"",G.value=y.scope==="project"?y.target:"",oe.value=!1,ve.value="",ce.value="",y.scope==="project"?H.value=ii(H.value,y.target,y.automation):re.value=er(re.value,y.target,y.automation),Fo(y.automation.id),Be.value=!0,Dn(),$t()}function Mr(){var y;oe.value=!0,Ce.value="thread",we.value=((y=Ze.value[0])==null?void 0:y.value)??"",$.value="thread",D.value="",G.value="",ve.value="",ce.value="",hn(),Be.value=!0,Dn(),$t()}function Yt(y){var C;Ce.value=y,we.value="",$.value=y==="project"?"project":"thread",we.value=((C=W.value[0])==null?void 0:C.value)??""}function hn(){ie.value="",le.value="create",ve.value="",ce.value="",Re.value={name:$.value==="project"?"Project automation":"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},Ve.value=Kt(Re.value.rrule)}function Fo(y){const C=it.value.find(_=>_.id===y);C&&(ie.value=C.id,le.value="edit",ve.value="",ce.value="",Re.value={name:C.name,prompt:C.prompt,rrule:C.rrule,status:C.status},Ve.value=Kt(C.rrule))}function lo(){Be.value=!1,$.value="thread",D.value="",G.value="",ie.value="",ve.value="",ce.value="",be.value=!1,Oe.value=!1}function uo(y,C){return Object.fromEntries(Object.entries(y).filter(([_])=>_!==C))}function er(y,C,_){const F=y[C]??[],_e=F.findIndex(Pt=>Pt.id===_.id),lt=[...F];return _e>=0?lt.splice(_e,1,_):lt.push(_),{...y,[C]:lt}}function Is(y,C,_){const F=(y[C]??[]).filter(_e=>_e.id!==_);return F.length>0?{...y,[C]:F}:uo(y,C)}function $a(y,C){return Object.fromEntries(Object.entries(y).filter(([_])=>_!==C))}function ii(y,C,_){const F=y[C]??[],_e=F.findIndex(Pt=>Pt.id===_.id),lt=[...F];return _e>=0?lt.splice(_e,1,_):lt.push(_),{...y,[C]:lt}}async function Jt(){H.value=await m1()}async function en(){let y=D.value,C=G.value;be.value=!0,ve.value="",ce.value="";try{if(Sn(),oe.value&&le.value==="create"&&(Ce.value==="thread"?(y=we.value,C="",$.value="thread",D.value=y,G.value=""):(C=we.value,y="",$.value="project",D.value="",G.value=C)),$.value==="thread"&&!y)throw new Error(r("Select a chat target for this automation"));if($.value==="project"&&!C)throw new Error(r("Select a project target for this automation"));const _={id:ie.value||void 0,name:Re.value.name,prompt:Re.value.prompt,rrule:Re.value.rrule,status:Re.value.status},F=$.value==="project"?await g1({..._,projectName:C}):await v1({..._,threadId:y});$.value==="project"?await Jt():re.value=er(re.value,y,F),a("automations-changed"),Fo(F.id),ce.value=r("Automation saved."),be.value=!1}catch(_){ve.value=_ instanceof Error?_.message:r("Failed to save automation"),be.value=!1}}async function li(){const y=D.value,C=G.value,_=ie.value;if(_&&!($.value==="thread"&&!y)&&!($.value==="project"&&!C)){be.value=!0,ve.value="",ce.value="";try{$.value==="project"?(await Sm(C,_),await Jt()):(await Tm(y,_),re.value=Is(re.value,y,_));const F=it.value[0];F?Fo(F.id):hn(),a("automations-changed"),be.value=!1}catch(F){ve.value=F instanceof Error?F.message:r("Failed to remove automation"),be.value=!1}}}async function Rs(){const y=D.value,C=ie.value;if(!(!y||!C)){Oe.value=!0,ve.value="",ce.value="";try{await y1(y,C),ce.value=r("Automation run queued.")}catch(_){ve.value=_ instanceof Error?_.message:r("Failed to run automation")}finally{Oe.value=!1}}}function co(y){return o.projectDisplayNameById[y]??y}t({openAutomationEditorFromPanel:io,openAutomationCreatorFromPanel:Mr,openRenameThreadDialog:Rr,openRecycleBin:B});function gr(y){return y.includes("/")||y.includes("\\")}function Wi(y){return gr(y)?y:co(y)}function yr(y){const C=xr(y);if(!C)return!1;let _=0;for(const F of o.groups)if(gr(F.projectName)&&xr(F.projectName)===C&&(_+=1,_>1))return!0;return!1}function ui(y){const C=o.projectDisplayNameById[y.projectName],_=co(y.projectName),F=y.projectName;if(C&&!gr(F)&&F!==_)return _.includes(F)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(F)?_:`${_} ${F}`;if(C&&gr(F)){const Pt=xr(F),Bo=xr(Tl(F)),Qt=yr(F)?Bo:Pt;return Qt&&Qt!==_?`${_} ${Qt}`:_}if(!_.includes("/")&&!_.includes("\\"))return _;const _e=xr(_)||_,lt=xr(Tl(_));return lt.startsWith(".")&&lt!==_e?`${_e} ${lt}`:y.threads.length>0||!yr(F)?_e:lt?`${_e} ${lt}`:_e}function ja(y){return Ae.value===y}function Dn(){Ae.value="",ct.value="actions",Ge.value=""}function es(){const y=!gn.value;y&&(Dn(),$t()),gn.value=y}function ci(y){mt.value=y,gn.value=!1}function di(){Se.value=!Se.value}function Vi(y){Fe.value=y}function Ms(y){a("request-project-git-status",y),zt(()=>{ns(y)})}function Nl(y){if(Ae.value===y){Dn();return}$t(),gn.value=!1,Ae.value=y,ct.value="actions",Ge.value=co(y),Ms(y)}function fi(y){$t(),gn.value=!1,Ae.value=y,ct.value="actions",Ge.value=co(y),Ms(y)}function $r(y){return o.projectDisplayNameById[y.projectName]??ui(y)}function na(y){$t();const C=y.projectName;Ae.value=C,ct.value="rename",Ge.value=$r(y),zt(()=>{ns(C)})}function wr(y){a("browse-project-files",y),Dn()}function oa(y){a("save-project",y),Dn()}function Na(y){a("create-project-worktree",y),Dn()}function br(y){a("rename-project",{projectName:y,displayName:Ge.value})}function La(y){const C=Uo(y);if(a("remove-project",y),C&&wt(y)){Ee.value="";const _=H.value;H.value=$a(H.value,C),Sm(C).then(Jt).catch(async F=>{H.value=_;const _e=F instanceof Error?F.message:r("Failed to delete project automation");Ee.value=_e,s(_e);try{await Jt()}catch{H.value=_}}).finally(()=>{a("automations-changed")})}Dn()}function Uo(y){var _;const C=((_=o.projectCwdByName[y])==null?void 0:_.trim())??"";return cT(C)?C:""}function ts(y,C){if(!y.altKey||y.key!=="ArrowUp"&&y.key!=="ArrowDown")return;const _=o.groups.findIndex(lt=>lt.projectName===C);if(_<0)return;const F=y.key==="ArrowUp"?-1:1,_e=Math.max(0,Math.min(_+F,o.groups.length-1));_e!==_&&(y.preventDefault(),a("reorder-project",{projectName:C,toIndex:_e}))}function jr(y){return ae.value[y]===!0}function Co(y){return z.value[y]===!0}function Nr(y){ae.value={...ae.value,[y]:!jr(y)}}function qe(){Me.value=!Me.value}function ke(y){if(Vt.value===y){Vt.value="";return}z.value={...z.value,[y]:!Co(y)}}function Wn(y){const C=Bn.value[y]??0,_=We.value,_e=((_==null?void 0:_.projectName)===y?_.groupHeight:null)??C,lt=Co(y)?0:Wm;return Math.max(0,_e+lt)}function Oa(y,C){const _=C instanceof HTMLElement?C:C&&"$el"in C&&C.$el instanceof HTMLElement?C.$el:null;if(_){vo.set(y,_);return}vo.delete(y)}function _r(y,C){const _=C instanceof HTMLElement?C:C&&"$el"in C&&C.$el instanceof HTMLElement?C.$el:null;if(_){Qn.set(y,_);return}Qn.delete(y)}function $s(y){let C=y.parentElement;for(;C;){const _=window.getComputedStyle(C),F=_.overflowY||_.overflow;if(F==="auto"||F==="scroll"||F==="hidden"||F==="clip")return C.getBoundingClientRect();C=C.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function un(y,C){const _=y.getBoundingClientRect(),F=$s(y),_e=6,lt=F.bottom-_.bottom,Pt=_.top-F.top;return lt>=C+_e?"down":Pt>lt?"up":"down"}function ra(y,C){const _=Qn.get(y);if(!_)return"down";const F=un(_,C);return He.value={...He.value,[y]:F},F}function Ll(y){return He.value[y]??"down"}function ns(y){const C=vo.get(y);if(!C)return;const _=C.querySelector(".project-menu-panel"),F=(_==null?void 0:_.getBoundingClientRect().height)??0;Ye.value={...Ye.value,[y]:un(C,F)}}function xn(y,C,_){return Math.min(Math.max(y,C),_)}function To(y){const C=Qn.get(y);if(!C)return;const _=dr.value,F=_==null?void 0:_.getBoundingClientRect(),_e=(F==null?void 0:F.height)||(_==null?void 0:_.offsetHeight)||112,lt=(F==null?void 0:F.width)||(_==null?void 0:_.offsetWidth)||160,Pt=ra(y,_e),Bo=C.getBoundingClientRect(),Qt=8,Fn=4,kn=Math.max(Qt,window.innerWidth-lt-Qt),sr=xn(Bo.right-lt,Qt,kn),Fr=xn(Pt==="up"?Bo.top-_e-Fn:Bo.bottom+Fn,Qt,Math.max(Qt,window.innerHeight-_e-Qt));St.value={left:`${Math.round(sr)}px`,top:`${Math.round(Fr)}px`}}function fo(){const y=Pe.value;y&&To(y)}function tr(){window.addEventListener("resize",fo),document.addEventListener("scroll",fo,!0)}function $n(){window.removeEventListener("resize",fo),document.removeEventListener("scroll",fo,!0)}function os(y){const C=Ae.value;if(!C)return!1;const _=vo.get(C);if(!_)return!1;if((typeof y.composedPath=="function"?y.composedPath():[]).includes(_))return!0;const _e=y.target;return _e instanceof Node?_.contains(_e):!1}function aa(y){const C=Pe.value;if(!C)return!1;const _=Qn.get(C);if(!_)return!1;const F=typeof y.composedPath=="function"?y.composedPath():[];if(F.includes(_))return!0;const _e=dr.value;if(_e&&F.includes(_e))return!0;const lt=y.target;return lt instanceof Node?!!(_.contains(lt)||_e&&_e.contains(lt)):!1}function Lr(y){if(gn.value){const C=Qo.value,_=typeof y.composedPath=="function"?y.composedPath():[];!!C&&(_.includes(C)||y.target instanceof Node&&C.contains(y.target))||(gn.value=!1)}Ae.value&&(os(y)||Dn(),Pe.value&&(aa(y)||$t()))}function pi(y){Ae.value&&!os(y)&&Dn(),Pe.value&&!aa(y)&&$t()}function nr(){gn.value&&(gn.value=!1),Ae.value&&Dn(),Pe.value&&$t()}function or(){window.addEventListener("pointerdown",Lr,{capture:!0}),window.addEventListener("focusin",pi,{capture:!0}),window.addEventListener("blur",nr)}function kr(){window.removeEventListener("pointerdown",Lr,{capture:!0}),window.removeEventListener("focusin",pi,{capture:!0}),window.removeEventListener("blur",nr)}function cn(y,C){const _=C.getBoundingClientRect().height;if(!Number.isFinite(_)||_<=0)return;const F=Bn.value[y];F!==void 0&&Math.abs(F-_)<.5||(Bn.value={...Bn.value,[y]:_})}function sa(y,C){const _=Jo.get(y);_&&_!==C&&nn&&nn.unobserve(_);const F=C instanceof HTMLElement?C:C&&"$el"in C&&C.$el instanceof HTMLElement?C.$el:null;if(F){Jo.set(y,F),go.set(F,y),cn(y,F),nn==null||nn.observe(F);return}_&&(nn==null||nn.unobserve(_)),Jo.delete(y)}function Da(y,C){if(y.button!==0||sn.value||Le.value||We.value)return;const _=o.groups.findIndex(Pt=>Pt.projectName===C),F=Jo.get(C);if(_<0||!F)return;const _e=F.getBoundingClientRect(),lt=Co(C)?0:Wm;Le.value={projectName:C,fromIndex:_,startClientX:y.clientX,startClientY:y.clientY,pointerOffsetY:y.clientY-_e.top,groupLeft:_e.left,groupWidth:_e.width,groupHeight:_e.height,groupOuterHeight:_e.height+lt},y.preventDefault(),ia()}function ia(){window.addEventListener("mousemove",rr),window.addEventListener("mouseup",la),window.addEventListener("keydown",Fa)}function rs(){window.removeEventListener("mousemove",rr),window.removeEventListener("mouseup",la),window.removeEventListener("keydown",Fa)}function rr(y){ot={clientX:y.clientX,clientY:y.clientY},Ol()}function la(y){hi({clientX:y.clientX,clientY:y.clientY});const C=We.value;if(C&&qn.value!==null){const _=o.groups.findIndex(F=>F.projectName===C.projectName);if(_>=0){const F=qn.value;F!==_&&a("reorder-project",{projectName:C.projectName,toIndex:F})}}as({preserveToggleSuppression:!!C})}function Fa(y){y.key==="Escape"&&(!Le.value&&!We.value||(y.preventDefault(),as()))}function as(y={}){Ft!==null&&(window.cancelAnimationFrame(Ft),Ft=null),ot=null,Le.value=null,We.value=null,y.preserveToggleSuppression||(Vt.value=""),rs()}function Ol(){Ft===null&&(Ft=window.requestAnimationFrame(()=>{if(Ft=null,!ot)return;const y=ot;ot=null,hi(y)}))}function hi(y){const C=Le.value;if(!We.value&&C){const _=y.clientX-C.startClientX,F=y.clientY-C.startClientY;if(Math.hypot(_,F)<qE)return;Dn(),Vt.value=C.projectName,We.value={projectName:C.projectName,fromIndex:C.fromIndex,pointerOffsetY:C.pointerOffsetY,groupLeft:C.groupLeft,groupWidth:C.groupWidth,groupHeight:C.groupHeight,groupOuterHeight:C.groupOuterHeight,ghostTop:y.clientY-C.pointerOffsetY,dropTargetIndexFull:null}}We.value&&js(y)}function js(y){const C=We.value;if(!C)return;if(C.ghostTop=y.clientY-C.pointerOffsetY,!Or(y)){C.dropTargetIndexFull=null;return}const _=y.clientY,F=de.value;if(!F){C.dropTargetIndexFull=null;return}const _e=F.getBoundingClientRect(),lt=new Map(o.groups.map((Fn,kn)=>[Fn.projectName,kn])),Pt=o.groups.map(Fn=>Fn.projectName).filter(Fn=>Fn!==C.projectName);let Bo=0,Qt=o.groups.length;for(const Fn of Pt){const kn=lt.get(Fn);if(kn===void 0)continue;const sr=Wn(Fn),Fr=_e.top+Bo+sr/2;if(_<Fr){Qt=kn;break}Bo+=sr}C.dropTargetIndexFull=Qt}function Or(y){const C=de.value;if(!C)return!1;const _=C.getBoundingClientRect(),F=y.clientX>=_.left&&y.clientX<=_.right,_e=y.clientY>=_.top-32&&y.clientY<=_.bottom+32;return F&&_e}function Dr(y){var C;return((C=We.value)==null?void 0:C.projectName)===y}function ua(y){const C=We.value,_=No.value[y]??0,F=Pe.value?wo.value.get(Pe.value)??"":"",_e=Ae.value===y||F===y;return!C||C.projectName!==y?{position:"absolute",top:"0",left:"0",right:"0",zIndex:_e?"40":"1",transform:`translate3d(0, ${_}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${C.groupLeft}px`,width:`${C.groupWidth}px`,height:`${C.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${C.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function ss(y){return $o.value.get(y.projectName)??[]}function Gi(y){if(sn.value)return ss(y);if(Co(y.projectName))return[];const C=ss(y);return jr(y.projectName)?C:C.slice(0,10)}function Zt(y){return sn.value?!1:!Co(y.projectName)&&ss(y).length>10}function So(y){return ss(y).length>0}function An(y){var C;return!!y.pendingRequestState||y.inProgress||y.unread||((C=y.externalSession)==null?void 0:C.active)===!0}function Ns(y){return y.pendingRequestState==="approval"?r("Awaiting approval"):r("Awaiting response")}function ar(y){var C;return((C=y.externalSession)==null?void 0:C.active)===!0?"external":y.pendingRequestState==="approval"?"awaiting-approval":y.pendingRequestState==="response"?"awaiting-response":y.inProgress?"working":y.unread?"unread":"idle"}rt(()=>o.groups.map(y=>y.projectName),y=>{var _e,lt;const C=((_e=We.value)==null?void 0:_e.projectName)??((lt=Le.value)==null?void 0:lt.projectName)??"";C&&!o.groups.some(Pt=>Pt.projectName===C)&&as();const _=new Set(y),F=Object.fromEntries(Object.entries(Bn.value).filter(([Pt])=>_.has(Pt)));Object.keys(F).length!==Object.keys(Bn.value).length&&(Bn.value=F)}),rt(()=>{const y=Ae.value;return y?o.projectGitRepoByName[y]:void 0},()=>{const y=Ae.value;y&&zt(()=>{Ae.value===y&&ns(y)})});const is=ee(()=>gn.value||Ae.value!==""||Pe.value!=="");return rt(is,y=>{if(y){or();return}kr()}),rt(Pe,y=>{if(!y){$n();return}tr(),zt(()=>{To(y)})}),zi(()=>{for(const y of Jo.values())nn==null||nn.unobserve(y);Jo.clear(),vo.clear(),$n(),kr(),as()}),(y,C)=>(T(),A("section",{class:Ke(["thread-tree-root",{"chats-first":Se.value}])},[Rt.value.length>0?(T(),A("section",Zx,[xe(ha,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":Z.value,onClick:Yn},{left:tt(()=>[Z.value?(T(),at(ni,{key:1,class:"thread-icon"})):(T(),at(yc,{key:0,class:"thread-icon"}))]),default:tt(()=>[d("span",eA,k(v(r)("Pinned")),1)]),_:1},8,["aria-expanded"]),Z.value?(T(),A("ul",tA,[(T(!0),A(ze,null,kt(Rt.value,_=>(T(),A("li",{key:_.id,class:"thread-row-item","data-menu-open":fn(_.id)?"true":"false"},[xe(ha,{class:"thread-row","data-active":_.id===e.selectedThreadId,"data-pinned":Er(_.id),"data-menu-open":fn(_.id)?"true":"false","force-right-hover":fn(_.id),onClick:F=>to(_.id),onMouseleave:F=>Oo(_.id,F),onContextmenu:F=>so(F,_.id)},{left:tt(()=>[d("span",oA,[An(_)?(T(),A("span",{key:0,class:"thread-status-indicator","data-state":ar(_)},null,8,rA)):J("",!0),d("button",{class:"thread-delete-button",type:"button","data-confirming":ge(_.id),title:ge(_.id)?v(r)("Confirm delete"):v(r)("Delete thread"),onClick:Qe(F=>et(_.id),["stop"])},[ge(_.id)?(T(),A("span",sA,k(v(r)("Confirm")),1)):(T(),at(du,{key:1,class:"thread-icon"}))],8,aA)])]),right:tt(()=>[d("span",hA,k(Ia(_)),1)]),"right-hover":tt(()=>[d("div",{ref_for:!0,ref:F=>_r(_.id,F),class:"thread-menu-wrap"},[d("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Qe(F=>Do(_.id),["stop"])},[xe(cl,{class:"thread-icon"})],8,mA)],512)]),default:tt(()=>[d("button",{class:"thread-main-button",type:"button",onClick:Qe(F=>to(_.id),["stop"])},[d("span",lA,[d("span",uA,[d("span",cA,k(_.title),1),_.hasWorktree?(T(),at(Oi,{key:0,class:"thread-row-worktree-icon",title:v(r)("Worktree thread")},null,8,["title"])):J("",!0),_o(_.id)?(T(),A("span",{key:1,class:"thread-row-automation-chip",title:ln(_.id)},[xe(ga,{class:"thread-row-automation-icon"}),no(_.id)>1?(T(),A("span",fA,k(no(_.id)),1)):J("",!0)],8,dA)):J("",!0),_.pendingRequestState?(T(),A("span",{key:2,class:"thread-row-request-chip","data-state":_.pendingRequestState},k(Ns(_)),9,pA)):J("",!0)])])],8,iA)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,nA))),128))])):J("",!0)])):J("",!0),d("section",vA,[xe(ha,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":X.value,onClick:bo},{left:tt(()=>[X.value?(T(),at(ni,{key:1,class:"thread-icon"})):(T(),at(yc,{key:0,class:"thread-icon"}))]),right:tt(()=>[d("div",{ref_key:"organizeMenuWrapRef",ref:Qo,class:"organize-menu-wrap"},[d("button",{class:"organize-menu-trigger",type:"button","aria-expanded":gn.value,"aria-label":v(r)("Organize threads"),title:v(r)("Organize threads"),onClick:Qe(es,["stop"])},[xe(cl,{class:"thread-icon"})],8,yA),gn.value?(T(),A("div",{key:0,class:"organize-menu-panel",onClick:C[4]||(C[4]=Qe(()=>{},["stop"]))},[d("p",wA,k(v(r)("Organize")),1),d("button",{class:"organize-menu-item","data-active":mt.value==="project",type:"button",onClick:C[0]||(C[0]=_=>ci("project"))},[d("span",null,k(v(r)("By project")),1),mt.value==="project"?(T(),A("span",_A,"✓")):J("",!0)],8,bA),d("button",{class:"organize-menu-item","data-active":mt.value==="chronological",type:"button",onClick:C[1]||(C[1]=_=>ci("chronological"))},[d("span",null,k(v(r)("Chronological list")),1),mt.value==="chronological"?(T(),A("span",CA,"✓")):J("",!0)],8,kA),d("button",{class:"organize-menu-item","data-active":Se.value,type:"button",onClick:di},[d("span",null,k(v(r)("Chats first")),1),Se.value?(T(),A("span",SA,"✓")):J("",!0)],8,TA),C[31]||(C[31]=d("div",{class:"organize-menu-separator"},null,-1)),d("p",xA,k(v(r)("Sort by")),1),d("button",{class:"organize-menu-item","data-active":Fe.value==="created",type:"button",onClick:C[2]||(C[2]=_=>Vi("created"))},[d("span",null,k(v(r)("Created")),1),Fe.value==="created"?(T(),A("span",PA,"✓")):J("",!0)],8,AA),d("button",{class:"organize-menu-item","data-active":Fe.value==="updated",type:"button",onClick:C[3]||(C[3]=_=>Vi("updated"))},[d("span",null,k(v(r)("Updated")),1),Fe.value==="updated"?(T(),A("span",IA,"✓")):J("",!0)],8,EA),C[32]||(C[32]=d("div",{class:"organize-menu-separator"},null,-1)),d("button",{class:"organize-menu-item",type:"button",onClick:B},[d("span",null,k(v(r)("Recycle bin")),1)])])):J("",!0)],512)]),default:tt(()=>[d("span",gA,k(v(r)("Projects")),1)]),_:1},8,["aria-expanded"]),X.value?(T(),A(ze,{key:0},[Ee.value?(T(),A("p",RA,k(Ee.value),1)):J("",!0),sn.value&&Pa.value.length===0?(T(),A("p",MA,k(v(r)("No matching threads")),1)):e.isLoading&&e.groups.length===0?(T(),A("p",$A,k(v(r)("Loading threads...")),1)):Ja.value?(T(),A("ul",jA,[(T(!0),A(ze,null,kt(Kn.value,_=>(T(),A("li",{key:_.id,class:"thread-row-item","data-menu-open":fn(_.id)?"true":"false"},[xe(ha,{class:"thread-row","data-active":_.id===e.selectedThreadId,"data-pinned":Er(_.id),"data-menu-open":fn(_.id)?"true":"false","force-right-hover":fn(_.id),onClick:F=>to(_.id),onMouseleave:F=>Oo(_.id,F),onContextmenu:F=>so(F,_.id)},{left:tt(()=>[d("span",LA,[An(_)?(T(),A("span",{key:0,class:"thread-status-indicator","data-state":ar(_)},null,8,OA)):J("",!0),d("button",{class:"thread-delete-button",type:"button","data-confirming":ge(_.id),title:ge(_.id)?v(r)("Confirm delete"):v(r)("Delete thread"),onClick:Qe(F=>et(_.id),["stop"])},[ge(_.id)?(T(),A("span",FA,k(v(r)("Confirm")),1)):(T(),at(du,{key:1,class:"thread-icon"}))],8,DA)])]),right:tt(()=>[d("span",GA,k(Ia(_)),1)]),"right-hover":tt(()=>[d("div",{ref_for:!0,ref:F=>_r(_.id,F),class:"thread-menu-wrap"},[d("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Qe(F=>Do(_.id),["stop"])},[xe(cl,{class:"thread-icon"})],8,KA)],512)]),default:tt(()=>[d("button",{class:"thread-main-button",type:"button",onClick:Qe(F=>to(_.id),["stop"])},[d("span",BA,[d("span",qA,[d("span",zA,k(_.title),1),_.hasWorktree?(T(),at(Oi,{key:0,class:"thread-row-worktree-icon",title:v(r)("Worktree thread")},null,8,["title"])):J("",!0),_o(_.id)?(T(),A("span",{key:1,class:"thread-row-automation-chip",title:ln(_.id)},[xe(ga,{class:"thread-row-automation-icon"}),no(_.id)>1?(T(),A("span",WA,k(no(_.id)),1)):J("",!0)],8,HA)):J("",!0),_.pendingRequestState?(T(),A("span",{key:2,class:"thread-row-request-chip","data-state":_.pendingRequestState},k(Ns(_)),9,VA)):J("",!0)])])],8,UA)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,NA))),128))])):(T(),A("div",{key:4,ref_key:"groupsContainerRef",ref:de,class:"thread-tree-groups",style:Vr(hr.value)},[(T(!0),A(ze,null,kt(Pa.value,_=>(T(),A("article",{key:_.projectName,ref_for:!0,ref:F=>sa(_.projectName,F),class:"project-group","data-project-name":_.projectName,"data-expanded":!Co(_.projectName),"data-dragging":Dr(_.projectName),style:Vr(ua(_.projectName))},[xe(ha,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:F=>ke(_.projectName),onContextmenu:Qe(F=>fi(_.projectName),["prevent"]),onKeydown:[F=>ts(F,_.projectName),Pn(Qe(F=>ke(_.projectName),["prevent"]),["enter"]),Pn(Qe(F=>ke(_.projectName),["prevent"]),["space"])]},{left:tt(()=>[d("span",JA,[d("span",QA,[Co(_.projectName)?(T(),at(Sp,{key:0,class:"thread-icon"})):(T(),at(tx,{key:1,class:"thread-icon"}))]),d("span",XA,[Co(_.projectName)?(T(),at(yc,{key:0,class:"thread-icon"})):(T(),at(ni,{key:1,class:"thread-icon"}))])])]),right:tt(()=>[d("div",oP,[d("div",{ref_for:!0,ref:F=>Oa(_.projectName,F),class:"project-menu-wrap"},[d("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:Qe(F=>Nl(_.projectName),["stop"])},[xe(cl,{class:"thread-icon"})],8,rP),ja(_.projectName)?(T(),A("div",{key:0,class:"project-menu-panel","data-open-direction":Ye.value[_.projectName]??"down",onClick:C[6]||(C[6]=Qe(()=>{},["stop"]))},[ct.value==="actions"?(T(),A(ze,{key:0},[d("button",{class:"project-menu-item",type:"button",onClick:F=>wr(_.projectName)},k(v(r)("Browse files")),9,sP),d("button",{class:"project-menu-item",type:"button",onClick:F=>oa(_.projectName)},k(v(r)("Export Project")),9,iP),d("button",{class:"project-menu-item",type:"button",onClick:F=>pn(_.projectName)},k(wt(_.projectName)?v(r)("Manage automations…"):v(r)("Add automation…")),9,lP),e.projectGitRepoByName[_.projectName]?(T(),A("button",{key:0,class:"project-menu-item",type:"button",onClick:F=>Na(_.projectName)},k(v(r)("New worktree")),9,uP)):J("",!0),d("button",{class:"project-menu-item",type:"button",onClick:F=>na(_)},k(v(r)("Rename project")),9,cP),d("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:F=>La(_.projectName)},k(v(r)("Remove")),9,dP)],64)):(T(),A(ze,{key:1},[d("label",fP,k(v(r)("Project name")),1),Nt(d("input",{"onUpdate:modelValue":C[5]||(C[5]=F=>Ge.value=F),class:"project-menu-input",type:"text",onInput:F=>br(_.projectName)},null,40,pP),[[an,Ge.value]])],64))],8,aP)):J("",!0)],512),d("button",{class:"thread-start-button",type:"button","aria-label":Lo(_.projectName),title:Lo(_.projectName),onClick:Qe(F=>vr(_.projectName),["stop"])},[xe(Rl,{class:"thread-icon"})],8,hP)])]),default:tt(()=>[d("span",{class:"project-main-button","data-dragging-handle":Dr(_.projectName),onMousedown:Qe(F=>Da(F,_.projectName),["left"])},[d("span",{class:"project-title",title:Wi(_.projectName)},k(ui(_)),9,eP),wt(_.projectName)?(T(),A("span",{key:0,class:"thread-row-automation-chip",title:oo(_.projectName)},[xe(ga,{class:"thread-row-automation-icon"}),Rn(_.projectName)>1?(T(),A("span",nP,k(Rn(_.projectName)),1)):J("",!0)],8,tP)):J("",!0)],40,ZA)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),So(_)?(T(),A("ul",mP,[(T(!0),A(ze,null,kt(Gi(_),F=>(T(),A("li",{key:F.id,class:"thread-row-item","data-menu-open":fn(F.id)?"true":"false"},[xe(ha,{class:"thread-row","data-active":F.id===e.selectedThreadId,"data-pinned":Er(F.id),"data-menu-open":fn(F.id)?"true":"false","force-right-hover":fn(F.id),onClick:_e=>to(F.id),onMouseleave:_e=>Oo(F.id,_e),onContextmenu:_e=>so(_e,F.id)},{left:tt(()=>[d("span",gP,[An(F)?(T(),A("span",{key:0,class:"thread-status-indicator","data-state":ar(F)},null,8,yP)):J("",!0),d("button",{class:"thread-delete-button",type:"button","data-confirming":ge(F.id),title:ge(F.id)?v(r)("Confirm delete"):v(r)("Delete thread"),onClick:Qe(_e=>et(F.id),["stop"])},[ge(F.id)?(T(),A("span",bP,k(v(r)("Confirm")),1)):(T(),at(du,{key:1,class:"thread-icon"}))],8,wP)])]),right:tt(()=>[d("span",PP,k(Ia(F)),1)]),"right-hover":tt(()=>[d("div",{ref_for:!0,ref:_e=>_r(F.id,_e),class:"thread-menu-wrap"},[d("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Qe(_e=>Do(F.id),["stop"])},[xe(cl,{class:"thread-icon"})],8,EP)],512)]),default:tt(()=>[d("button",{class:"thread-main-button",type:"button",onClick:Qe(_e=>to(F.id),["stop"])},[d("span",kP,[d("span",CP,[d("span",TP,k(F.title),1),F.hasWorktree?(T(),at(Oi,{key:0,class:"thread-row-worktree-icon",title:v(r)("Worktree thread")},null,8,["title"])):J("",!0),_o(F.id)?(T(),A("span",{key:1,class:"thread-row-automation-chip",title:ln(F.id)},[xe(ga,{class:"thread-row-automation-icon"}),no(F.id)>1?(T(),A("span",xP,k(no(F.id)),1)):J("",!0)],8,SP)):J("",!0),F.pendingRequestState?(T(),A("span",{key:2,class:"thread-row-request-chip","data-state":F.pendingRequestState},k(Ns(F)),9,AP)):J("",!0)])])],8,_P)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,vP))),128))])):(T(),at(ha,{key:1,as:"p",class:"project-empty-row"},{left:tt(()=>[...C[33]||(C[33]=[d("span",{class:"project-empty-spacer"},null,-1)])]),default:tt(()=>[d("span",IP,k(v(r)("No threads")),1)]),_:1})),Zt(_)?(T(),at(ha,{key:2,class:"thread-show-more-row"},{left:tt(()=>[...C[34]||(C[34]=[d("span",{class:"thread-show-more-spacer"},null,-1)])]),default:tt(()=>[d("button",{class:"thread-show-more-button",type:"button",onClick:F=>Nr(_.projectName)},k(jr(_.projectName)?"Show less":"Show more"),9,RP)]),_:2},1024)):J("",!0)],12,YA))),128))],4))],64)):J("",!0)]),d("section",MP,[xe(ha,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":ye.value,onClick:eo},{left:tt(()=>[ye.value?(T(),at(ni,{key:1,class:"thread-icon"})):(T(),at(yc,{key:0,class:"thread-icon"}))]),right:tt(()=>[d("div",jP,[d("button",{class:"chats-section-action",type:"button","aria-label":v(r)("New chat"),title:v(r)("New chat"),onClick:C[7]||(C[7]=Qe(_=>y.$emit("start-new-chat"),["stop"]))},[xe(Rl,{class:"thread-icon"})],8,NP)])]),default:tt(()=>[d("span",$P,k(v(r)("Chats")),1)]),_:1},8,["aria-expanded"]),ye.value&&In.value.length===0?(T(),A("p",LP,k(v(r)("No chats")),1)):ye.value?(T(),A("ul",OP,[(T(!0),A(ze,null,kt(Qa.value,_=>(T(),A("li",{key:_.id,class:"thread-row-item","data-menu-open":fn(_.id)?"true":"false"},[xe(ha,{class:"thread-row","data-active":_.id===e.selectedThreadId,"data-pinned":Er(_.id),"data-menu-open":fn(_.id)?"true":"false","force-right-hover":fn(_.id),onClick:F=>to(_.id),onMouseleave:F=>Oo(_.id,F),onContextmenu:F=>so(F,_.id)},{left:tt(()=>[d("span",FP,[An(_)?(T(),A("span",{key:0,class:"thread-status-indicator","data-state":ar(_)},null,8,UP)):J("",!0),d("button",{class:"thread-delete-button",type:"button","data-confirming":ge(_.id),title:ge(_.id)?v(r)("Confirm delete"):v(r)("Delete thread"),onClick:Qe(F=>et(_.id),["stop"])},[ge(_.id)?(T(),A("span",qP,k(v(r)("Confirm")),1)):(T(),at(du,{key:1,class:"thread-icon"}))],8,BP)])]),right:tt(()=>[d("span",JP,k(Ia(_)),1)]),"right-hover":tt(()=>[d("div",{ref_for:!0,ref:F=>_r(_.id,F),class:"thread-menu-wrap"},[d("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Qe(F=>Do(_.id),["stop"])},[xe(cl,{class:"thread-icon"})],8,QP)],512)]),default:tt(()=>[d("button",{class:"thread-main-button",type:"button",onClick:Qe(F=>to(_.id),["stop"])},[d("span",HP,[d("span",WP,[d("span",VP,k(_.title),1),_.hasWorktree?(T(),at(Oi,{key:0,class:"thread-row-worktree-icon",title:v(r)("Worktree thread")},null,8,["title"])):J("",!0),_o(_.id)?(T(),A("span",{key:1,class:"thread-row-automation-chip",title:ln(_.id)},[xe(ga,{class:"thread-row-automation-icon"}),no(_.id)>1?(T(),A("span",KP,k(no(_.id)),1)):J("",!0)],8,GP)):J("",!0),_.pendingRequestState?(T(),A("span",{key:2,class:"thread-row-request-chip","data-state":_.pendingRequestState},k(Ns(_)),9,YP)):J("",!0)])])],8,zP)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,DP))),128))])):J("",!0),ye.value&&Zn.value?(T(),at(ha,{key:2,class:"thread-show-more-row"},{left:tt(()=>[...C[35]||(C[35]=[d("span",{class:"thread-show-more-spacer"},null,-1)])]),default:tt(()=>[d("button",{class:"thread-show-more-button",type:"button",onClick:qe},k(Me.value?"Show less":"Show more"),1)]),_:1})):J("",!0)]),(T(),at(Bi,{to:"body"},[Lt.value?(T(),A("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:dr,class:"thread-menu-panel thread-menu-panel-fixed",style:Vr(St.value),"data-open-direction":Ll(Lt.value.id),onClick:C[17]||(C[17]=Qe(()=>{},["stop"]))},[d("button",{class:"thread-menu-item",type:"button",onClick:C[8]||(C[8]=_=>jt(Lt.value.id))},k(_o(Lt.value.id)?v(r)("Manage automations…"):v(r)("Add automation…")),1),d("button",{class:"thread-menu-item",type:"button",onClick:C[9]||(C[9]=_=>ko(Lt.value.id))},k(v(r)("Browse files")),1),d("button",{class:"thread-menu-item",type:"button",onClick:C[10]||(C[10]=_=>Ir(Lt.value.id))},k(v(r)("Export Project")),1),d("button",{class:"thread-menu-item",type:"button",onClick:C[11]||(C[11]=_=>ta(Lt.value.id))},k(v(r)("Copy path")),1),d("button",{class:"thread-menu-item",type:"button",disabled:Lt.value.id!==e.selectedThreadId,title:Lt.value.id===e.selectedThreadId?v(r)("Copy chat"):v(r)("Open this chat before copying"),onClick:C[12]||(C[12]=_=>Za(Lt.value.id))},k(v(r)("Copy chat")),9,ZP),d("button",{class:"thread-menu-item",type:"button",onClick:C[13]||(C[13]=_=>Hn(Lt.value.id))},k(v(r)("Create chat fork")),1),d("button",{class:"thread-menu-item",type:"button",onClick:C[14]||(C[14]=_=>Ra(Lt.value.id))},k(Er(Lt.value.id)?v(r)("Unpin thread"):v(r)("Pin thread")),1),d("button",{class:"thread-menu-item",type:"button",onClick:C[15]||(C[15]=_=>Rr(Lt.value.id,Lt.value.title))},k(v(r)("Rename thread")),1),d("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:C[16]||(C[16]=_=>I(Lt.value.id,Lt.value.title))},k(v(r)("Delete thread")),1)],12,XP)):J("",!0)])),xe(ff,{open:nt.value,title:v(r)("Rename thread"),subtitle:v(r)("Make it short and recognizable."),onClose:_n},{footer:tt(()=>[d("button",{class:"rename-thread-button",type:"button",onClick:_n},k(v(r)("Cancel")),1),d("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Ma},k(v(r)("Save")),1)]),default:tt(()=>[Nt(d("input",{ref_key:"renameThreadInputRef",ref:Tt,"onUpdate:modelValue":C[18]||(C[18]=_=>_t.value=_),class:"rename-thread-input",type:"text",placeholder:v(r)("Add title..."),onKeydown:Pn(Qe(Ma,["prevent"]),["enter"])},null,40,eE),[[an,_t.value]])]),_:1},8,["open","title","subtitle"]),xe(ff,{open:gt.value,title:Xr.value?v(r)("Archive chat and remove automations?"):v(r)("Delete thread?"),subtitle:Ea.value,onClose:O},{footer:tt(()=>[d("button",{class:"rename-thread-button",type:"button",onClick:O},k(v(r)("Cancel")),1),d("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:V},k(Xr.value?v(r)("Archive and remove"):v(r)("Delete")),1)]),_:1},8,["open","title","subtitle"]),xe(ff,{open:x.value,title:v(r)("Recycle bin"),subtitle:v(r)("Threads you removed are kept here so you can restore them."),size:"md",onClose:C[19]||(C[19]=_=>x.value=!1)},{default:tt(()=>[v(l).length===0?(T(),A("div",tE,k(v(r)("Recycle bin is empty.")),1)):(T(),A("ul",nE,[(T(!0),A(ze,null,kt(v(l),_=>(T(),A("li",{key:_.id,class:"recycle-bin-item"},[d("div",oE,[d("span",rE,k(_.title),1),_.projectName?(T(),A("span",aE,k(_.projectName),1)):J("",!0),d("span",sE,k(Pr(_.archivedAtIso)),1)]),d("div",iE,[d("button",{class:"recycle-bin-button recycle-bin-button-primary",type:"button",disabled:L.value===_.id,onClick:F=>Y(_.id)},k(L.value===_.id?v(r)("Restoring…"):v(r)("Restore")),9,lE),d("button",{class:"recycle-bin-button recycle-bin-button-danger",type:"button",onClick:F=>v(g)(_.id)},k(v(r)("Delete permanently")),9,uE)])]))),128))])),R.value?(T(),A("p",cE,k(R.value),1)):J("",!0)]),_:1},8,["open","title","subtitle"]),(T(),at(Bi,{to:"body"},[Be.value?(T(),A("div",{key:0,class:"rename-thread-overlay",onClick:Qe(lo,["self"])},[d("div",{class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":$.value==="project"?v(r)("Project automation"):v(r)("Thread automation")},[d("h3",fE,k(le.value==="edit"?v(r)("Edit automation"):v(r)("Add automation")),1),d("p",pE,k(It.value),1),oe.value&&le.value==="create"?(T(),A("div",hE,[C[36]||(C[36]=d("span",{class:"automation-thread-label"},"Target",-1)),d("div",mE,[d("button",{class:Ke(["automation-target-mode",{"is-active":Ce.value==="thread"}]),type:"button",onClick:C[20]||(C[20]=_=>Yt("thread"))}," Existing chat ",2),d("button",{class:Ke(["automation-target-mode",{"is-active":Ce.value==="project"}]),type:"button",onClick:C[21]||(C[21]=_=>Yt("project"))}," Project ",2)]),d("div",vE,[xe(lr,{modelValue:we.value,"onUpdate:modelValue":C[22]||(C[22]=_=>we.value=_),class:"automation-thread-dropdown",options:W.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"])])])):J("",!0),it.value.length>0?(T(),A("div",{key:1,class:"automation-thread-list","aria-label":$.value==="project"?"Project automations":"Thread automations"},[(T(!0),A(ze,null,kt(it.value,_=>(T(),A("button",{key:_.id,class:Ke(["automation-thread-list-item",{"is-active":_.id===ie.value}]),type:"button",onClick:F=>Fo(_.id)},[d("span",null,k(_.name),1),d("small",null,k(_.status==="PAUSED"?"Paused":"Active"),1)],10,yE))),128)),d("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:hn},k(v(r)("Add another automation")),1)],8,gE)):J("",!0),d("label",wE,[d("span",bE,k(v(r)("Name")),1),Nt(d("input",{"onUpdate:modelValue":C[23]||(C[23]=_=>Re.value.name=_),class:"rename-thread-input",type:"text",placeholder:v(r)("Automation name")},null,8,_E),[[an,Re.value.name]])]),d("label",kE,[d("span",CE,k(v(r)("Prompt")),1),Nt(d("textarea",{"onUpdate:modelValue":C[24]||(C[24]=_=>Re.value.prompt=_),class:"automation-thread-textarea",rows:"6",placeholder:v(r)("Describe what the automation should do")},null,8,TE),[[an,Re.value.prompt]])]),d("div",SE,[d("span",xE,k(v(r)("Schedule")),1),d("div",AE,[d("button",{class:Ke(["automation-schedule-mode",{"is-active":Ve.value.mode==="daily"}]),type:"button",onClick:C[25]||(C[25]=_=>Mn("daily"))},k(v(r)("Daily")),3),d("button",{class:Ke(["automation-schedule-mode",{"is-active":Ve.value.mode==="interval"}]),type:"button",onClick:C[26]||(C[26]=_=>Mn("interval"))},k(v(r)("Interval")),3),d("button",{class:Ke(["automation-schedule-mode",{"is-active":Ve.value.mode==="advanced"}]),type:"button",onClick:C[27]||(C[27]=_=>Mn("advanced"))}," RRULE ",2)]),Ve.value.mode==="daily"?(T(),A("div",PE,[d("span",EE,k(v(r)("Run every day at")),1),Nt(d("input",{"onUpdate:modelValue":C[28]||(C[28]=_=>Ve.value.dailyTime=_),class:"automation-schedule-time",type:"time",onInput:Sn},null,544),[[an,Ve.value.dailyTime]])])):Ve.value.mode==="interval"?(T(),A("div",IE,[d("span",RE,k(v(r)("Run every")),1),Nt(d("input",{"onUpdate:modelValue":C[29]||(C[29]=_=>Ve.value.interval=_),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:Sn},null,544),[[an,Ve.value.interval,void 0,{number:!0}]]),xe(lr,{class:"automation-schedule-unit-dropdown","model-value":Ve.value.intervalUnit,options:K,placeholder:v(r)("Unit"),"onUpdate:modelValue":ro},null,8,["model-value","placeholder"])])):J("",!0),Ve.value.mode==="advanced"?Nt((T(),A("input",{key:2,"onUpdate:modelValue":C[30]||(C[30]=_=>Re.value.rrule=_),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:ea},null,544)),[[an,Re.value.rrule]]):J("",!0),d("p",ME,k(yt.value),1)]),d("div",$E,[d("span",jE,k(v(r)("Status")),1),xe(lr,{class:"automation-thread-dropdown","model-value":Re.value.status,options:Q.value,placeholder:v(r)("Status"),"onUpdate:modelValue":ao},null,8,["model-value","options","placeholder"])]),ve.value?(T(),A("p",NE,k(ve.value),1)):ce.value?(T(),A("p",LE,k(ce.value),1)):J("",!0),d("div",OE,[le.value==="edit"&&$.value==="thread"?(T(),A("button",{key:0,class:"rename-thread-button",type:"button",disabled:be.value||Oe.value,onClick:Rs},k(Oe.value?v(r)("Running…"):v(r)("Run now")),9,DE)):J("",!0),le.value==="edit"?(T(),A("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:be.value||Oe.value,onClick:li},k(v(r)("Remove")),9,FE)):J("",!0),d("button",{class:"rename-thread-button",type:"button",disabled:be.value||Oe.value,onClick:lo},k(v(r)("Cancel")),9,UE),d("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:be.value||Oe.value,onClick:en},k(be.value?v(r)("Saving…"):v(r)("Save")),9,BE)])],8,dE)])):J("",!0)]))],2))}}),HE=At(zE,[["__scopeId","data-v-b0e1b136"]]),WE={class:"content-header"},VE=["title"],GE={class:"content-actions"},KE=Nn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(T(),A("header",WE,[d("div",{class:Ke(["content-leading",{"is-accent":e.accent}])},[ur(t.$slots,"leading",{},void 0)],2),d("h1",{class:Ke(["content-title",{"is-accent":e.accent}]),title:e.title},k(e.title),11,VE),d("div",GE,[ur(t.$slots,"actions",{},void 0)])]))}}),YE=At(KE,[["__scopeId","data-v-61739409"]]),Qm=.0025,pf=3,Xm=2,JE=256;function QE(e){var $e;const t=S("idle"),n=S(typeof navigator<"u"&&!!(($e=navigator.mediaDevices)!=null&&$e.getUserMedia)),o=S(0),r=S(null);let s=null,a=null,l=[],f=null,m=null,g=null,w=null,x=[],R=!1,L=!1,B=null;function Y(){B&&(B.abort(),B=null),t.value==="transcribing"&&(t.value="idle")}function ae(){const he=r.value;if(!he||typeof window>"u")return;const Te=he.getContext("2d");if(!Te)return;const Ae=Math.max(1,Math.floor(he.clientWidth)),Pe=Math.max(1,Math.floor(he.clientHeight||36)),De=window.devicePixelRatio||1,Ye=Math.max(1,Math.floor(Ae*De)),He=Math.max(1,Math.floor(Pe*De));(he.width!==Ye||he.height!==He)&&(he.width=Ye,he.height=He),Te.setTransform(De,0,0,De,0,0),Te.clearRect(0,0,Ae,Pe);const St=Math.max(12,Math.floor(Ae/(pf+Xm))),ct=x.slice(-St),Ge=Math.max(0,St-ct.length),nt=Pe/2,dt=getComputedStyle(he).color||"#000000";for(let _t=0;_t<St;_t+=1){const Tt=ct[_t-Ge]??0,se=Math.max(.08,Math.min(1,Tt*18))*nt,ne=_t*(pf+Xm);Te.globalAlpha=Tt<=Qm?.35:1,Te.fillStyle=dt,Te.fillRect(ne,nt-se,pf,se*2)}Te.globalAlpha=1}function z(){x=[],o.value=0,ae()}function Z(){g&&(g.disconnect(),g.onaudioprocess=null,g=null),m&&(m.disconnect(),m=null),f&&(f.close(),f=null),w=null}function X(he){if(typeof window>"u")return;const Te=window.webkitAudioContext,Ae=window.AudioContext??Te;Ae&&(Z(),z(),f=new Ae,m=f.createMediaStreamSource(he),g=f.createScriptProcessor(2048,1,1),w=performance.now(),g.onaudioprocess=Pe=>{const De=Pe.inputBuffer.getChannelData(0);let Ye=0;for(let He=0;He<De.length;He+=1){const St=Math.abs(De[He]??0);Ye+=St<Qm?0:St}x.push(Ye/De.length),x.length>JE&&x.shift(),w!==null&&(o.value=Math.max(0,performance.now()-w)),ae()},m.connect(g),g.connect(f.destination),ae())}async function ye(){var he;if(t.value==="transcribing"&&Y(),!(t.value!=="idle"||!n.value||R)){R=!0,L=!1;try{a=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),l=[],s=new MediaRecorder(a),s.ondataavailable=Te=>{Te.data.size>0&&l.push(Te.data)},s.onstop=()=>{var Pe;const Te=l,Ae=(s==null?void 0:s.mimeType)||((Pe=Te[0])==null?void 0:Pe.type)||"audio/webm";pe(),Fe(Te,Ae)},X(a),s.start(250),t.value="recording",L&&Me()}catch(Te){pe(),t.value="idle",(he=e.onError)==null||he.call(e,Te)}finally{R=!1}}}function Me(){if(R&&t.value==="idle"){L=!0;return}if(!(t.value!=="recording"||!s)&&s.state!=="inactive"){t.value="transcribing";try{s.requestData()}catch{}s.stop()}}function Se(){L=!1,Y(),pe(),t.value="idle"}async function Fe(he,Te){var De,Ye,He,St,ct;if(he.length===0){(De=e.onEmpty)==null||De.call(e),t.value="idle";return}const Ae=new Blob(he,{type:Te});t.value="transcribing";let Pe=null;try{const Ge=Te.split(/[/;]/)[1]??"webm",nt=new FormData;nt.append("file",Ae,`codex.${Ge}`);const dt=((Ye=e.getLanguage)==null?void 0:Ye.call(e).trim())??"";dt&&dt.toLowerCase()!=="auto"&&nt.append("language",dt),Pe=new AbortController,B=Pe;const _t=await fetch("/codex-api/transcribe",{method:"POST",body:nt,signal:Pe.signal}),Tt=await _t.text();let gt=null;try{gt=Tt.trim()?JSON.parse(Tt):null}catch{gt=null}if(!_t.ok){const ne=(He=gt==null?void 0:gt.error)==null?void 0:He.trim(),re=Tt.trim();throw new Error(ne||re||`Transcription failed: ${_t.status}`)}const se=((gt==null?void 0:gt.text)??"").trim();se.length>0?e.onTranscript(se):(St=e.onEmpty)==null||St.call(e)}catch(Ge){if(Ge instanceof DOMException&&Ge.name==="AbortError")return;(ct=e.onError)==null||ct.call(e,Ge)}finally{Pe&&B===Pe&&(B=null),t.value==="transcribing"&&(t.value="idle")}}function pe(){Z(),z(),s&&(s.ondataavailable=null,s.onstop=null,s=null),a&&(a.getTracks().forEach(he=>he.stop()),a=null),l=[]}zi(()=>{Se()});function Ue(){if(t.value==="recording"){Me();return}(t.value==="idle"||t.value==="transcribing")&&ye()}return{state:t,isSupported:n,recordingDurationMs:o,waveformCanvasRef:r,startRecording:ye,stopRecording:Me,toggleRecording:Ue,cancel:Se}}const XE={},ZE={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function eI(e,t){return T(),A("svg",ZE,[...t[0]||(t[0]=[d("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 tI=At(XE,[["render",eI]]),nI={},oI={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function rI(e,t){return T(),A("svg",oI,[...t[0]||(t[0]=[d("path",{d:"M4 8V4h4"},null,-1),d("path",{d:"M20 8V4h-4"},null,-1),d("path",{d:"M4 16v4h4"},null,-1),d("path",{d:"M20 16v4h-4"},null,-1)])])}const aI=At(nI,[["render",rI]]),sI={},iI={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function lI(e,t){return T(),A("svg",iI,[...t[0]||(t[0]=[d("path",{d:"M8 4v4H4"},null,-1),d("path",{d:"M16 4v4h4"},null,-1),d("path",{d:"M8 20v-4H4"},null,-1),d("path",{d:"M16 20v-4h4"},null,-1)])])}const uI=At(sI,[["render",lI]]),cI={},dI={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function fI(e,t){return T(),A("svg",dI,[...t[0]||(t[0]=[d("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),d("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 pI=At(cI,[["render",fI]]),hI=["aria-label"],mI=Nn({__name:"ComposerPopover",props:{open:{type:Boolean},align:{},width:{},panelClass:{},ariaLabel:{}},emits:["update:open"],setup(e,{expose:t,emit:n}){const o=e,r=n,s=S(null),a=S(null),l=ee(()=>o.open),f=ee(()=>o.width==="lg"?"composer-popover-panel--lg":"composer-popover-panel--md");rt(l,async w=>{var x;w&&(await zt(),(x=a.value)==null||x.focus())});function m(){r("update:open",!o.open)}function g(w){var ae,z,Z;if(w.key==="Escape"){r("update:open",!1);return}const x=a.value;if(!x)return;const R=Array.from(x.querySelectorAll("button")).filter(X=>!X.disabled&&X.offsetParent!==null);if(R.length===0)return;if(w.key==="Home"){w.preventDefault(),(ae=R[0])==null||ae.focus();return}if(w.key==="End"){w.preventDefault(),(z=R[R.length-1])==null||z.focus();return}if(w.key!=="ArrowDown"&&w.key!=="ArrowUp")return;w.preventDefault();let L=R.findIndex(X=>X===document.activeElement);L<0&&(L=w.key==="ArrowDown"?-1:0);const B=w.key==="ArrowDown"?1:-1,Y=(L+B+R.length)%R.length;(Z=R[Y])==null||Z.focus()}return t({root:s}),(w,x)=>(T(),A("div",{ref_key:"rootRef",ref:s,class:Ke(["composer-popover-anchor",{"is-align-end":e.align==="end","is-align-center":e.align==="center"}])},[ur(w.$slots,"trigger",{toggle:m,isOpen:l.value},void 0),xe(Au,{name:"composer-popover"},{default:tt(()=>[l.value?(T(),A("div",{key:0,ref_key:"panelRef",ref:a,class:Ke(["composer-popover-panel",[f.value,e.panelClass]]),role:"menu",tabindex:"-1","aria-label":e.ariaLabel,onKeydown:g},[ur(w.$slots,"default",{},void 0,!0)],42,hI)):J("",!0)]),_:3})],2))}}),wc=At(mI,[["__scopeId","data-v-bdd45c16"]]),vI=["aria-label"],gI={class:"composer-popover-group-label"},yI=["aria-selected","onMousedown"],wI={class:"thread-composer-slash-body"},bI={class:"thread-composer-slash-name"},_I={class:"thread-composer-slash-desc"},kI={class:"thread-composer-slash-kind"},CI={class:"composer-popover-group-label composer-popover-group-label--skills"},TI=["aria-selected","onMousedown"],SI=["aria-label","title"],xI={class:"thread-composer-slash-body thread-composer-slash-body--skill"},AI={class:"thread-composer-slash-skill-name"},PI={class:"thread-composer-slash-desc thread-composer-slash-desc--skill"},EI=Nn({__name:"ComposerSlashMenu",props:{commands:{},highlightedIndex:{}},emits:["select"],setup(e,{emit:t}){const n=e,o=t,{t:r}=Ar(),s=S(null),a=ee(()=>n.commands.filter(w=>w.group!=="skill")),l=ee(()=>n.commands.filter(w=>w.group==="skill"));rt(()=>n.highlightedIndex,async()=>{var w,x;await zt(),(x=(w=s.value)==null?void 0:w.querySelector(".is-active"))==null||x.scrollIntoView({block:"nearest"})});function f(w){return r(w==="rpc"?"Action":w==="text"?"Prompt":w==="skill"?"Skill":"Local")}function m(w){return w==="system"?"S":w==="repo"?"R":w==="plugin"?"P":"U"}function g(w){return r(w==="system"?"System":w==="repo"?"Repo":w==="plugin"?"Plugin":"User")}return(w,x)=>(T(),A("div",{ref_key:"rootRef",ref:s,class:"composer-popover",role:"listbox","aria-label":v(r)("Commands")},[a.value.length>0?(T(),A(ze,{key:0},[d("div",gI,k(v(r)("Commands")),1),(T(!0),A(ze,null,kt(a.value,(R,L)=>(T(),A("button",{key:R.id,class:Ke(["thread-composer-slash-row",{"is-active":L===e.highlightedIndex}]),type:"button",role:"option","aria-selected":L===e.highlightedIndex,onMousedown:Qe(B=>o("select",R),["prevent"])},[x[0]||(x[0]=d("span",{class:"thread-composer-slash-prefix","aria-hidden":"true"},"/",-1)),d("span",wI,[d("span",bI,k(R.id),1),d("span",_I,k(v(r)(R.description)),1)]),d("span",kI,k(f(R.kind)),1)],42,yI))),128))],64)):J("",!0),l.value.length>0?(T(),A(ze,{key:1},[d("div",CI,k(v(r)("Skills")),1),(T(!0),A(ze,null,kt(l.value,(R,L)=>(T(),A("button",{key:R.skillPath||R.id,class:Ke(["thread-composer-slash-row thread-composer-slash-row--skill",{"is-active":a.value.length+L===e.highlightedIndex}]),type:"button",role:"option","aria-selected":a.value.length+L===e.highlightedIndex,onMousedown:Qe(B=>o("select",R),["prevent"])},[d("span",{class:Ke(["thread-composer-slash-skill-icon",`is-${R.scope||"user"}`]),"aria-label":g(R.scope),title:g(R.scope)},k(m(R.scope)),11,SI),d("span",xI,[d("span",AI,k(R.displayName||R.id),1),d("span",PI,k(R.description),1)])],42,TI))),128))],64)):J("",!0)],8,vI))}}),II=At(EI,[["__scopeId","data-v-ca16aa11"]]),RI=/(^|\s)(\/[a-zA-Z]*)$/,Zm=[{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 MI(e){var o,r,s;const t=[],n=new Set;for(const a of e){const l=a.name.trim().replace(/^\//u,"").toLowerCase().replace(/\s+/gu,"-");if(!l)continue;const f=a.path.trim()||l;n.has(f)||(n.add(f),t.push({id:l,description:((o=a.description)==null?void 0:o.trim())||"Run this skill",kind:"skill",group:"skill",skillPath:a.path,displayName:((r=a.displayName)==null?void 0:r.trim())||a.name.trim(),scope:((s=a.scope)==null?void 0:s.trim())||"user"}))}return t.sort((a,l)=>a.id.localeCompare(l.id))}function $I(e){const t=e.match(RI);if(!t)return null;const n=t[2]??"";return{query:n.slice(1).toLowerCase(),token:n,startIndex:e.length-n.length}}function jI(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 NI=["data-streaming"],LI=["aria-expanded"],OI={class:"thread-composer-plan-panel-title"},DI={key:0,class:"thread-composer-plan-panel-badge"},FI={class:"thread-composer-plan-panel-progress"},UI=["title"],BI=["data-status"],qI={class:"thread-composer-plan-panel-latest-text"},zI={class:"thread-composer-plan-panel-popover-content"},HI={class:"thread-composer-plan-panel-popover-scroll"},WI={class:"thread-composer-plan-panel-popover-head"},VI={class:"thread-composer-plan-panel-title"},GI={class:"thread-composer-plan-panel-progress"},KI={key:0,class:"thread-composer-plan-panel-popover-section"},YI={class:"thread-composer-plan-panel-section-label"},JI=["title"],QI={class:"thread-composer-plan-panel-popover-section"},XI={class:"thread-composer-plan-panel-section-label"},ZI={class:"thread-composer-plan-panel-steps"},eR=["data-status"],tR=["data-status"],nR=["title"],oR={class:"thread-composer-plan-panel-popover-footer"},rR=["disabled","data-state"],aR={key:1,class:"thread-composer-attachments"},sR=["src","alt"],iR=["aria-label","disabled","onClick"],lR={key:2,class:"thread-composer-folder-chips"},uR=["title"],cR={class:"thread-composer-folder-chip-meta"},dR=["aria-label","disabled","onClick"],fR={key:3,class:"thread-composer-file-chips"},pR=["title"],hR=["aria-label","disabled","onClick"],mR={key:4,class:"thread-composer-skill-chips"},vR=["title","aria-label","onClick"],gR=["aria-label","onClick"],yR={class:"thread-composer-main"},wR={class:"thread-composer-input-row"},bR={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},_R={class:"thread-composer-drop-overlay-copy"},kR={key:1,class:"composer-popover"},CR=["onMousedown"],TR={key:1,class:"thread-composer-file-mention-icon-markdown"},SR={class:"thread-composer-file-mention-text"},xR={class:"thread-composer-file-mention-name"},AR={key:0,class:"thread-composer-file-mention-dir"},PR={key:1,class:"thread-composer-file-mention-empty"},ER={key:2,class:"thread-composer-file-mention-empty"},IR=["placeholder","disabled"],RR=["aria-label","title","disabled"],MR={class:"thread-composer-actions"},$R=["aria-label","title","disabled"],jR={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},NR=["aria-label","title","disabled"],LR=["aria-label","disabled"],OR=["disabled"],DR=["disabled"],FR=["disabled"],UR={class:"thread-composer-attach-mode"},BR={class:"thread-composer-attach-mode-label"},qR={class:"thread-composer-attach-mode-buttons"},zR=["disabled"],HR=["disabled"],WR={class:"thread-composer-attach-mode"},VR={class:"thread-composer-attach-mode-label"},GR={class:"thread-composer-attach-mode-buttons"},KR=["disabled","onClick"],YR={class:"thread-composer-attach-mode"},JR={class:"thread-composer-attach-mode-label"},QR={class:"thread-composer-attach-mode-buttons"},XR=["disabled","onClick"],ZR={key:0,class:"thread-composer-menu-error",role:"alert"},eM={key:0,class:"thread-composer-approval-tip",role:"status"},tM=["aria-label","disabled"],nM={class:"thread-composer-plan-trigger-label"},oM=["aria-checked","disabled","onClick"],rM={class:"thread-composer-menu-item-copy"},aM={class:"thread-composer-menu-item-title"},sM={key:0,class:"thread-composer-menu-item-sub"},iM={key:1,class:"thread-composer-menu-item-hint"},lM={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},uM=["aria-label","disabled"],cM={class:"thread-composer-approval-trigger-label"},dM=["aria-checked","disabled","onClick"],fM={class:"thread-composer-menu-item-copy"},pM={class:"thread-composer-menu-item-title"},hM={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},mM={key:0,class:"thread-composer-menu-error",role:"alert"},vM={key:0,class:"thread-composer-approval-tip",role:"status"},gM=["title","aria-label"],yM={class:"thread-composer-context-usage-value"},wM={key:0,class:"thread-composer-context-usage-compact"},bM=["disabled"],_M=["disabled"],kM=["disabled"],hf=12e3,CM=2e3,TM="codex-web-local.thread-draft.v1.",SM=Nn({__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:s}=Ar(),a=S(""),l=S([]),f=S([]),m=S([]),g=S([]),w=S(""),x=S(0),R=S(null),L=S(!1),{state:B,cancel:Y}=QE({getLanguage:()=>o.dictationLanguage??"auto",onTranscript:I=>{if(a.value=a.value?`${a.value}
58
+ ${I}`:I,w.value="",o.dictationAutoSend!==!1){const O=o.isTurnInProgress?de.value:"steer";nn(O);return}zt(()=>{var O;return(O=X.value)==null?void 0:O.focus()})},onEmpty:()=>{w.value=o.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:I=>{if(I instanceof DOMException&&I.name==="NotAllowedError"){w.value="Microphone access was denied.";return}w.value=I instanceof Error?I.message:"Dictation failed."}}),ae=S(null),z=S(null),Z=S(null),X=S(null),{isMobile:ye}=yp(),Me=S(!1),Se=S(!1),Fe=S(!1),pe=S(null),Ue=S(""),$e=S([]),he=S(!1),Te=S(0),Ae=S(!1),Pe=S(null),De=S(""),Ye=S(0),He=S(Zm),St=ee(()=>[...Zm,...MI(o.skills??[])]),ct=S(!1),Ge=S(!1),nt=ee(()=>{var O;return(((O=o.planPanel)==null?void 0:O.steps)??[]).filter(V=>V.status==="completed").length}),dt=ee(()=>{var O;const I=((O=o.planPanel)==null?void 0:O.steps)??[];if(I.length===0)return null;for(let V=I.length-1;V>=0;V-=1){const ge=I[V];if(ge.status==="inProgress")return ge}return I[I.length-1]}),_t=ee(()=>{var ge,et,Ut;const I=((et=(ge=o.planPanel)==null?void 0:ge.explanation)==null?void 0:et.trim())??"";if(!I)return"";const O=((Ut=I.split(/[。!?!?\n]/u)[0])==null?void 0:Ut.trim())??"";if(!O)return I;const V=80;return O.length>V?`${O.slice(0,V)}…`:O});function Tt(I){switch(I){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function gt(){Ge.value=!1,r("implement-plan")}const se=S(!1);let ne=!1;const re=S(0);let H=0,Be=null,$="",D=!1,G=0,ie=0;const le=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let oe="";const Ce=[{value:"none",label:"None"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"Extra high"},{value:"max",label:"Max"},{value:"ultra",label:"Ultra"}],we=ee(()=>{var V;const I=(V=o.modelReasoningEfforts)==null?void 0:V[o.selectedModel];if(I===void 0)return Ce;const O=new Set(I);return Ce.filter(ge=>O.has(ge.value))});function ve(I){return I.trim().replace(/^gpt/i,"GPT")}const ce=ee(()=>o.models.map(I=>({value:I,label:ve(I)}))),Ee=ee(()=>{const I=new Set((o.collaborationModes??[]).map(O=>O.value));return[{value:"default",labelKey:"Default",subLabel:"",disabled:!1},{value:"plan",labelKey:"Plan mode",subLabel:s("Agent proposes a plan before acting"),disabled:!1},{value:"execplans",labelKey:"Execution plans",subLabel:"",disabled:!I.has("execplans")}]}),be=[{value:"on-request",label:"When Codex requests it"},{value:"untrusted",label:"Unless trusted"},{value:"never",label:"Never"}],Oe=ee(()=>{const I=Ee.value.find(O=>O.value===o.selectedCollaborationMode);return s(I?I.labelKey:"Plan mode")}),Re=ee(()=>{const I=be.find(O=>O.value===o.approvalPolicy);return s(I?I.label:"Approval policy")}),Ve=ee(()=>o.selectedCollaborationMode==="plan"&&o.selectedModel.trim().length===0),it=ee(()=>o.disabled||o.isUpdatingSpeedMode||!o.activeThreadId||Ve.value||x.value>0?!1:a.value.trim().length>0||l.value.length>0||m.value.length>0),yt=ee(()=>a.value.trim().length>0||l.value.length>0||f.value.length>0||m.value.length>0||g.value.length>0),It=ee(()=>{const I=new Set;for(const O of g.value)for(const V of O.filePaths)I.add(V);return m.value.filter(O=>!I.has(O.fsPath))}),Ze=ee(()=>o.disabled||!o.activeThreadId||o.externalSessionActive===!0),Wt=ee(()=>o.disabled||!o.activeThreadId),W=ee(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(o.selectedModel.trim())),K=ee(()=>o.selectedSpeedMode==="fast"&&W.value),Q=ee(()=>o.inProgressSubmitMode==="steer"?"steer":"queue"),de=S(Q.value),Le=ee(()=>B.value==="recording"),We=ee(()=>o.activeThreadId?Ve.value?s("Loading models for plan mode..."):s("Ask Codex anything, @ to add files, / for commands"):s("Select a thread to send a message")),ot=ee(()=>a.value.trim().length>0||l.value.length>0||m.value.length>0),Ft=ee(()=>a.value.split(`
59
+ `).length),Vt=ee(()=>ct.value||Ft.value>=6||se.value),Bn=ee(()=>mt(o.threadTokenUsage??null)),Jo=ee(()=>{var I;return((I=Bn.value)==null?void 0:I.summaryText)??""}),vo=ee(()=>{var I;return((I=Bn.value)==null?void 0:I.tooltipText)??""}),Qn=ee(()=>{var I;return((I=Bn.value)==null?void 0:I.tone)??"healthy"});function go(){Qn.value!=="healthy"&&r("compact-context")}function Qo(I){if(!Number.isFinite(I))return"0";const O=Math.abs(I);return O>=1e6?`${(O>=1e7?(I/1e6).toFixed(0):(I/1e6).toFixed(1)).replace(/\.0$/,"")}M`:O>=1e3?`${(O>=1e5?(I/1e3).toFixed(0):(I/1e3).toFixed(1)).replace(/\.0$/,"")}k`:String(Math.round(I))}function dr(I){const O=Math.max(0,I.inputTokens-I.cachedInputTokens),V=[`${Qo(I.totalTokens)} ${s("total")}`,`${Qo(O)} ${s("input")}`];return I.cachedInputTokens>0&&V.push(`${Qo(I.cachedInputTokens)} ${s("cached")}`),I.outputTokens>0&&V.push(`${Qo(I.outputTokens)} ${s("output")}`),I.reasoningOutputTokens>0&&V.push(`${Qo(I.reasoningOutputTokens)} ${s("reasoning")}`),V.join(" · ")}function gn(I,O){if(!Number.isFinite(I)||!Number.isFinite(O)||O<=0)return 0;if(O<=hf){const Ut=Math.max(0,O-Math.max(0,I));return Math.max(0,Math.min(100,Math.round(Ut/O*100)))}const V=O-hf,ge=Math.max(0,I-hf),et=Math.max(0,V-ge);return Math.max(0,Math.min(100,Math.round(et/V*100)))}function mt(I){if(!I)return null;const O=I.modelContextWindow??null;if(typeof O!="number"||!Number.isFinite(O)||O<=0)return null;const V=Math.max(0,I.last.totalTokens),ge=gn(V,O),et=Math.max(0,Math.min(100,100-ge)),Ut=ge<=15?"danger":ge<=35?"warning":"healthy";return{summaryText:`${ge}% · ${Qo(V)} / ${Qo(O)}`,tooltipText:[`${s("Context window")}: ${ge}% ${s("left")} (${et}% ${s("used")})`,`${s("In context")}: ${V.toLocaleString()} / ${O.toLocaleString()} tokens`,`${s("Last turn")}: ${dr(I.last)}`,`${s("Session total")}: ${dr(I.total)}`].join(`
60
+ `),percentRemaining:ge,tone:Ut}}function nn(I="steer"){var V;const O=a.value.trim();if(it.value){if(r("submit",{text:O,imageUrls:l.value.map(ge=>ge.url),fileAttachments:[...m.value],skills:f.value.map(ge=>({name:ge.name,path:ge.path})),mode:I}),Xo(o.activeThreadId),Es(),ct.value=!1,g.value=[],Me.value=!1,Mn(),le||ye.value){(V=X.value)==null||V.blur();return}zt(()=>{var ge;return(ge=X.value)==null?void 0:ge.focus()})}}function Xn(I){de.value=I}function Aa(I){re.value+=1,a.value=I.text,l.value=I.imageUrls.map((O,V)=>({id:`queued-${Date.now()}-${V}-${Math.random().toString(36).slice(2,8)}`,name:`${s("Image")} ${V+1}`,url:O})),f.value=I.skills.map(O=>(o.skills??[]).find(V=>V.path===O.path)??{name:O.name,displayName:void 0,description:"",path:O.path}),m.value=I.fileAttachments.map(O=>({...O})),g.value=[],w.value="",R.value=null,x.value=0,Me.value=!1,Mn(),Hn(),ie+=1}function Es(){Aa({text:"",imageUrls:[],fileAttachments:[],skills:[]}),ct.value=!1}function xt(I){return`${TM}${I}`}function Gt(I){if(typeof window>"u")return null;const O=I.trim();if(!O)return null;try{const V=window.localStorage.getItem(xt(O));if(!V)return null;const ge=JSON.parse(V);return typeof ge=="string"?{text:ge,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof ge.text=="string"?ge.text:"",imageUrls:Array.isArray(ge.imageUrls)?ge.imageUrls.filter(et=>typeof et=="string"):[],fileAttachments:Array.isArray(ge.fileAttachments)?ge.fileAttachments.filter(et=>!!et&&typeof et.label=="string"&&typeof et.path=="string"&&typeof et.fsPath=="string"):[],skills:Array.isArray(ge.skills)?ge.skills.filter(et=>!!et&&typeof et.name=="string"&&typeof et.path=="string"):[]}}catch{return null}}function ht(I,O){if(typeof window>"u")return;const V=I.trim();if(V)try{if(O.text.trim().length>0||O.imageUrls.length>0||O.fileAttachments.length>0||O.skills.length>0){window.localStorage.setItem(xt(V),JSON.stringify(O));return}window.localStorage.removeItem(xt(V))}catch{}}function Xo(I){ht(I,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function sn(){return{text:a.value,imageUrls:l.value.map(I=>I.url),fileAttachments:m.value.map(I=>({...I})),skills:f.value.map(I=>({name:I.name,path:I.path}))}}function fr(){r("interrupt")}function yo(){const I=X.value;if(!I){se.value=!1;return}se.value=I.scrollHeight>I.clientHeight+2}function Ln(){ne||(ne=!0,zt(()=>{ne=!1,yo()}))}function pr(){Ze.value||(ct.value=!ct.value,Ln(),zt(()=>{var I;return(I=X.value)==null?void 0:I.focus()}))}function Pa(I){r("update:selected-model",I)}function Ja(I){if(I===o.selectedCollaborationMode){Se.value=!1;return}r("update:selected-collaboration-mode",I),Se.value=!1}function Kn(I){if(I===o.selectedCollaborationMode){Me.value=!1;return}r("update:selected-collaboration-mode",I),Me.value=!1}function In(I){r("update:selected-reasoning-effort",I)}function Qa(I){o.approvalPolicy===I||o.isApprovalPolicySaving===!0||(r("update:approval-policy",I),r("save-approval-policy"))}function Zn(){o.dictationClickToToggle}function yn(){Ze.value||(Me.value=!Me.value,Se.value=!1,Fe.value=!1)}function Qr(){Wt.value||(Se.value=!Se.value,Me.value=!1,Fe.value=!1)}function Xt(){Wt.value||(Fe.value=!Fe.value,Me.value=!1,Se.value=!1)}function Xr(){var I;(I=ae.value)==null||I.click()}function Ea(){var I;(I=z.value)==null||I.click()}function wo(){var I;(I=Z.value)==null||I.click()}function $o(I){l.value=l.value.filter(O=>O.id!==I)}function jo(I){f.value=f.value.filter(O=>O.path!==I)}function Lt(I){const O=I.trim();return O?O.endsWith("/SKILL.md")?O:`${O.replace(/\/+$/,"")}/SKILL.md`:""}function Rt(I){const O=Lt(I.path);!O||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(O)}`,"_blank","noopener,noreferrer")}function Yn(I){m.value=m.value.filter(O=>O.fsPath!==I)}function bo(I){const O=g.value.find(ge=>ge.id===I);if(!O)return;const V=new Set(O.filePaths);m.value=m.value.filter(ge=>!V.has(ge.fsPath)),g.value=g.value.filter(ge=>ge.id!==I)}function eo(I){return I.total<=0?0:Math.round(I.processed/I.total*100)}function qn(I,O){const V=I.replace(/\\/g,"/");if(m.value.some(Ut=>Ut.fsPath===V))return;const ge=V.split("/").filter(Boolean),et=(O==null?void 0:O.trim())||ge[ge.length-1]||V;m.value=[...m.value,{label:et,path:V,fsPath:V}]}function On(I){return I.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(I.name)}function No(I){return I?Array.from(I):[]}function hr(I){return I!==ie?!1:(x.value+=1,!0)}function Zr(I){I===ie&&(x.value=Math.max(0,x.value-1))}function Ia(I){if(I<=0)return;const O=R.value,V=O?O.succeeded+O.failed:0;if(!O||V>=O.total){R.value={total:I,succeeded:0,failed:0};return}R.value={...O,total:O.total+I}}function Pr(I){const O=R.value;O&&(R.value={...O,succeeded:O.succeeded+(I==="success"?1:0),failed:O.failed+(I==="failure"?1:0)})}function Er(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function Xa(I){const O=new Date,V=[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("-"),ge=I.type.startsWith("image/")&&I.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${V}.${ge}`}function Ra(){const I=new Date;return`pasted-text-${[I.getFullYear(),String(I.getMonth()+1).padStart(2,"0"),String(I.getDate()).padStart(2,"0"),String(I.getHours()).padStart(2,"0"),String(I.getMinutes()).padStart(2,"0"),String(I.getSeconds()).padStart(2,"0")].join("-")}.txt`}function to(I){return I.name.trim()?I:new File([I],Xa(I),{type:I.type||"image/png",lastModified:Date.now()})}async function _o(I,O){if(hr(O))try{const V=to(I),ge=await lf(V);if(O!==ie)return;if(!ge){Pr("failure");return}l.value=[...l.value,{id:Er(),name:V.name,url:`/codex-local-image?path=${encodeURIComponent(ge)}`}],Pr("success")}catch{O===ie&&Pr("failure")}finally{Zr(O)}}async function no(I,O){if(hr(O))try{const V=await lf(I);if(O!==ie)return;if(!V){Pr("failure");return}qn(V),Pr("success")}catch{O===ie&&Pr("failure")}finally{Zr(O)}}function wt(I){const O=No(I);if(O.length===0)return;Ia(O.length),Me.value=!1,Mn();const V=ie;for(const ge of O)On(ge)?_o(ge,V):no(ge,V)}function Rn(){G=0,L.value=!1}function zn(I){return I?Array.from(I.types??[]).includes("Files"):!1}async function ln(I){if(!I||I.length===0)return;const O=re.value,V=Array.from(I),et=(V[0].webkitRelativePath||V[0].name).split("/").filter(Boolean)[0]||"Folder",Ut=`${Date.now()}-${Math.random().toString(36).slice(2)}`;g.value=[...g.value,{id:Ut,name:et,total:V.length,processed:0,filePaths:[],isUploading:!0}];const jt=pn=>{O===re.value&&(g.value=g.value.map(io=>io.id===Ut?pn(io):io))};for(const pn of V)try{const io=await lf(pn);if(O!==re.value)return;if(io){const Mr=pn.webkitRelativePath||pn.name;qn(io,Mr),jt(Yt=>({...Yt,processed:Yt.processed+1,filePaths:[...Yt.filePaths,io]}));continue}jt(Mr=>({...Mr,processed:Mr.processed+1}))}catch{jt(io=>({...io,processed:io.processed+1}))}jt(pn=>({...pn,isUploading:!1}))}function oo(I){I&&(I.value="")}function Zo(I){const O=I.target;wt((O==null?void 0:O.files)??null),oo(O),Me.value=!1}function mr(I){const O=I.target;wt((O==null?void 0:O.files)??null),oo(O),Me.value=!1}function Jn(I){const O=I.target;ln((O==null?void 0:O.files)??null),oo(O),Me.value=!1}function Mt(I){Ze.value||!zn(I.dataTransfer)||(I.preventDefault(),G+=1,L.value=!0)}function wn(I){Ze.value||!zn(I.dataTransfer)||(I.preventDefault(),I.dataTransfer&&(I.dataTransfer.dropEffect="copy"),L.value=!0)}function Kt(I){L.value&&(I.preventDefault(),G=Math.max(0,G-1),G===0&&Rn())}function bn(I){var O;Ze.value||!zn(I.dataTransfer)||(I.preventDefault(),Rn(),wt(((O=I.dataTransfer)==null?void 0:O.files)??null))}function Sn(){!L.value&&G===0||Rn()}function ro(I){var Ut,jt;if(Ze.value)return;const O=((Ut=I.clipboardData)==null?void 0:Ut.getData("text/plain"))??"";if(O.length>=CM){I.preventDefault();const pn=new File([O],Ra(),{type:"text/plain",lastModified:Date.now()});wt([pn]);return}const V=Array.from(((jt=I.clipboardData)==null?void 0:jt.items)??[]);if(V.length===0)return;const ge=O.length>0,et=V.filter(pn=>pn.kind==="file"&&pn.type.startsWith("image/")).map(pn=>pn.getAsFile()).filter(pn=>pn instanceof File);et.length!==0&&(ge||I.preventDefault(),wt(et))}function ao(){w.value&&(w.value=""),Ln(),Za(),Lo()}function ea(I){if(I.isComposing||I.keyCode===229)return;if(he.value){if(I.key==="Escape"){I.preventDefault(),Mn();return}if(I.key==="ArrowDown"){I.preventDefault(),$e.value.length>0&&(Te.value=(Te.value+1)%$e.value.length);return}if(I.key==="ArrowUp"){if(I.preventDefault(),$e.value.length>0){const V=$e.value.length;Te.value=(Te.value+V-1)%V}return}if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();const V=$e.value[Te.value];V?Ir(V):Mn();return}}if(Ae.value){if(I.key==="Escape"){I.preventDefault(),Hn();return}if(I.key==="ArrowDown"){I.preventDefault(),He.value.length>0&&(Ye.value=(Ye.value+1)%He.value.length);return}if(I.key==="ArrowUp"){if(I.preventDefault(),He.value.length>0){const V=He.value.length;Ye.value=(Ye.value+V-1)%V}return}if(I.key==="Enter"||I.key==="Tab"){I.preventDefault();const V=He.value[Ye.value];V?vr(V):Hn();return}}if(o.sendWithEnter!==!1?I.key==="Enter"&&!I.shiftKey:I.key==="Enter"&&(I.metaKey||I.ctrlKey)){I.preventDefault(),nn(o.isTurnInProgress?de.value:"steer");return}}function Mn(){if(he.value=!1,pe.value=null,Ue.value="",$e.value=[],Te.value=0,D=!1,$){const I=$;$="",OT(I)}}function Za(){const I=X.value;if(!I){Mn();return}const O=I.selectionStart??a.value.length,ge=a.value.slice(0,O).match(/(^|\s)(@[^\s@]*)$/);if(!ge){Mn();return}const et=ge[2]??"",Ut=et.length,jt=O-Ut;Ae.value&&Hn(),pe.value=jt,Ue.value=et.slice(1),he.value=!0,ko()}function Hn(){Ae.value=!1,Pe.value=null,De.value="",Ye.value=0,He.value=St.value}function Lo(){const I=X.value;if(!I){Hn();return}const O=I.selectionStart??a.value.length,V=a.value.slice(0,O),ge=$I(V);if(!ge){Hn();return}he.value&&Mn(),Pe.value=ge.startIndex,De.value=ge.query,He.value=jI(St.value,ge.query),Ye.value=0,Ae.value=!0}function vr(I){const O=X.value,V=Pe.value;if(V!==null&&O){const ge=O.selectionStart??a.value.length;a.value=`${a.value.slice(0,V)}${a.value.slice(ge)}`}if(Hn(),I.kind==="skill"){const ge=(o.skills??[]).find(Ut=>Ut.path===I.skillPath||Ut.name===I.id);ge&&!f.value.some(Ut=>Ut.path===ge.path)&&(f.value=[...f.value,{...ge}]);const et=a.value.trim();a.value=et.length>0?`${et} (Use the ${I.id} skill.)`:`Use the ${I.id} skill.`,zt(()=>{O==null||O.focus(),yo()});return}if(I.kind==="rpc"){r("slash-command",I.id);return}I.kind==="text"&&I.insertText&&(a.value=a.value.trimEnd(),a.value=a.value.length>0?`${a.value} ${I.insertText}`:I.insertText),I.kind==="local"&&I.id==="clear"&&(a.value=""),zt(()=>{O==null||O.focus(),yo()})}async function ko(){if(!he.value)return;const I=(o.cwd??"").trim();if(!I){$e.value=[],D=!0;return}D=!1,Be&&clearTimeout(Be);const O=++H;Be=setTimeout(async()=>{const V=`composer-${O}`,ge=Ue.value;try{if($||(await NT([I],V),$=V,r("register-fuzzy-session",V)),await LT($,ge),!he.value||O!==H)return;if($e.value=(o.fuzzyFileSearchResults??[]).map(et=>({path:et.path})),Te.value=0,$e.value.length===0)try{const et=await Lm(I,ge,20);if(!he.value||O!==H)return;$e.value=et,Te.value=0}catch{if(!he.value||O!==H)return;$e.value=[]}}catch{if(!he.value||O!==H)return;$="";try{const et=await Lm(I,ge,20);if(!he.value||O!==H)return;$e.value=et,Te.value=0}catch{if(!he.value||O!==H)return;$e.value=[]}}},120)}function Ir(I){const O=X.value,V=pe.value;if(V!==null&&O){const ge=O.selectionStart??a.value.length;a.value=`${a.value.slice(0,V)}${a.value.slice(ge)}`.trimEnd()}qn(I.path),Mn(),zt(()=>O==null?void 0:O.focus())}function ta(I){Y(),Aa(I),zt(()=>{var O;(O=X.value)==null||O.focus(),yo()})}function Oo(I){const O=I.trim();O&&(Y(),a.value.trim().length>0?a.value=`${a.value.trimEnd()}
61
+ ${O}`:a.value=O,zt(()=>{var V;return(V=X.value)==null?void 0:V.focus()}))}function fn(I){const O=I.lastIndexOf("/");return O<0?I:I.slice(O+1)}function $t(I){const O=I.lastIndexOf("/");return O<=0?"":I.slice(0,O)}function Do(I){const O=fn(I),V=O.lastIndexOf(".");return V<=0?"":O.slice(V+1).toLowerCase()}function so(I){const O=Do(I);return O==="ts"?"TS":O==="tsx"?"TSX":O==="js"?"JS":O==="jsx"?"JSX":O==="json"?"{}":""}function Rr(I){const O=Do(I);return O.startsWith("ts")?"ts":O.startsWith("js")?"js":O==="json"?"json":"default"}function _n(I){const O=Do(I);return O==="md"||O==="mdx"}function Ma(I){if(!Me.value&&!Se.value&&!Fe.value)return;const O=I.target;O&&(typeof O.closest=="function"&&O.closest(".composer-popover-anchor")||(Me.value=!1,Se.value=!1,Fe.value=!1))}return Ps(()=>{document.addEventListener("click",Ma),window.addEventListener("drop",Sn),window.addEventListener("dragend",Sn),window.addEventListener("blur",Sn),Ln()}),t({hydrateDraft:ta,appendTextToDraft:Oo,hasUnsavedDraft:()=>yt.value}),zi(()=>{document.removeEventListener("click",Ma),window.removeEventListener("drop",Sn),window.removeEventListener("dragend",Sn),window.removeEventListener("blur",Sn),window.removeEventListener("pointerup",Zn),window.removeEventListener("pointercancel",Zn),window.removeEventListener("blur",Zn),Be&&clearTimeout(Be)}),rt(()=>o.activeThreadId,I=>{Y(),oe&&ht(oe,sn()),Es();const O=Gt(I);O&&(Aa(O),ao()),oe=I.trim()},{immediate:!0}),rt([a,l,m,f],()=>{oe&&ht(oe,sn())},{deep:!0}),rt(a,()=>{Ln()}),rt(()=>o.cwd,()=>{he.value&&ko()}),rt(()=>o.fuzzyFileSearchResults,I=>{!he.value||!$||($e.value=(I??[]).map(O=>({path:O.path})),Te.value=0)}),rt(Q,I=>{de.value=I}),(I,O)=>(T(),A("form",{class:"thread-composer",onSubmit:O[9]||(O[9]=Qe(V=>nn(e.isTurnInProgress?de.value:"steer"),["prevent"]))},[d("div",{class:Ke(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":L.value}])},[e.planPanel?(T(),A("div",{key:0,class:"thread-composer-plan-panel","data-streaming":e.planPanel.streaming},[xe(wc,{open:Ge.value,align:"center",width:"lg","panel-class":"thread-composer-plan-panel-popover","aria-label":v(s)("Plan"),"onUpdate:open":O[1]||(O[1]=V=>Ge.value=V)},{trigger:tt(()=>{var V,ge;return[d("button",{type:"button",class:"thread-composer-plan-panel-header","aria-expanded":Ge.value,onClick:O[0]||(O[0]=et=>Ge.value=!Ge.value)},[O[10]||(O[10]=d("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),d("span",OI,k(v(s)("Plan")),1),e.planPanel.streaming?(T(),A("span",DI,k(v(s)("Updating")),1)):J("",!0),d("span",FI,k(nt.value)+"/"+k(e.planPanel.steps.length),1),d("span",{class:"thread-composer-plan-panel-latest",title:((V=dt.value)==null?void 0:V.step)??""},[dt.value?(T(),A("span",{key:0,class:"thread-composer-plan-panel-latest-status","data-status":dt.value.status},k(Tt(dt.value.status)),9,BI)):J("",!0),d("span",qI,k(((ge=dt.value)==null?void 0:ge.step)??""),1)],8,UI),xe(ni,{class:"thread-composer-plan-panel-chevron"})],8,LI)]}),default:tt(()=>[d("div",zI,[d("div",HI,[d("header",WI,[O[11]||(O[11]=d("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),d("span",VI,k(v(s)("Plan")),1),d("span",GI,k(nt.value)+"/"+k(e.planPanel.steps.length),1)]),e.planPanel.explanation?(T(),A("section",KI,[d("p",YI,k(v(s)("Summary")),1),d("p",{class:"thread-composer-plan-panel-explanation",title:e.planPanel.explanation},k(_t.value),9,JI)])):J("",!0),d("section",QI,[d("p",XI,k(v(s)("Steps"))+" ("+k(e.planPanel.steps.length)+")",1),d("ol",ZI,[(T(!0),A(ze,null,kt(e.planPanel.steps,(V,ge)=>(T(),A("li",{key:`composer-plan-${e.planPanel.id}-${ge}`,class:"thread-composer-plan-panel-step","data-status":V.status},[d("span",{class:"thread-composer-plan-panel-step-status","data-status":V.status},k(Tt(V.status)),9,tR),d("span",{class:"thread-composer-plan-panel-step-text",title:V.step},k(V.step),9,nR)],8,eR))),128))])])]),d("footer",oR,[d("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:gt},k(e.planPanel.implemented?v(s)("Plan executed"):e.planPanel.streaming?v(s)("Implementing…"):v(s)("Implement plan")),9,rR)])])]),_:1},8,["open","aria-label"])],8,NI)):J("",!0),l.value.length>0?(T(),A("div",aR,[(T(!0),A(ze,null,kt(l.value,V=>(T(),A("div",{key:V.id,class:"thread-composer-attachment"},[d("img",{class:"thread-composer-attachment-image",src:V.url,alt:V.name||"Selected image"},null,8,sR),d("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${V.name||"image"}`,disabled:Ze.value,onClick:ge=>$o(V.id)}," x ",8,iR)]))),128))])):J("",!0),g.value.length>0?(T(),A("div",lR,[(T(!0),A(ze,null,kt(g.value,V=>(T(),A("span",{key:V.id,class:"thread-composer-folder-chip"},[xe(Sp,{class:"thread-composer-folder-chip-icon"}),d("span",{class:"thread-composer-folder-chip-name",title:V.name},k(V.name),9,uR),d("span",cR,[V.isUploading?(T(),A(ze,{key:0},[ks(k(eo(V))+"% uploading ("+k(V.processed)+"/"+k(V.total)+") ",1)],64)):(T(),A(ze,{key:1},[ks(k(V.filePaths.length)+" file"+k(V.filePaths.length===1?"":"s"),1)],64))]),d("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${V.name}`,disabled:Ze.value,onClick:ge=>bo(V.id)},"×",8,dR)]))),128))])):J("",!0),It.value.length>0?(T(),A("div",fR,[(T(!0),A(ze,null,kt(It.value,V=>(T(),A("span",{key:V.fsPath,class:"thread-composer-file-chip"},[xe(Rl,{class:"thread-composer-file-chip-icon"}),d("span",{class:"thread-composer-file-chip-name",title:V.fsPath},k(V.label),9,pR),d("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${V.label}`,disabled:Ze.value,onClick:ge=>Yn(V.fsPath)},"×",8,hR)]))),128))])):J("",!0),f.value.length>0?(T(),A("div",mR,[(T(!0),A(ze,null,kt(f.value,V=>(T(),A("span",{key:V.path,class:"thread-composer-skill-chip"},[d("button",{class:"thread-composer-skill-chip-name",type:"button",title:Lt(V.path),"aria-label":`Open ${V.displayName||V.name} SKILL.md`,onClick:ge=>Rt(V)},k(V.displayName||V.name),9,vR),d("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${V.displayName||V.name}`,onClick:ge=>jo(V.path)},"×",8,gR)]))),128))])):J("",!0),d("div",yR,[d("div",wR,[d("div",{class:Ke(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":L.value,"thread-composer-input-wrap--expanded":ct.value}]),onDragenter:Mt,onDragover:wn,onDragleave:Kt,onDrop:bn},[L.value?(T(),A("div",bR,[d("span",_R,k(v(s)("Drop images or files")),1)])):J("",!0),he.value?(T(),A("div",kR,[$e.value.length>0?(T(!0),A(ze,{key:0},kt($e.value,(V,ge)=>(T(),A("button",{key:V.path,class:Ke(["thread-composer-file-mention-row",{"is-active":ge===Te.value}]),type:"button",onMousedown:Qe(et=>Ir(V),["prevent"])},[so(V.path)?(T(),A("span",{key:0,class:Ke(["thread-composer-file-mention-icon-badge",`is-${Rr(V.path)}`])},k(so(V.path)),3)):_n(V.path)?(T(),A("span",TR,"↓")):(T(),at(Rl,{key:2,class:"thread-composer-file-mention-icon-file"})),d("span",SR,[d("span",xR,k(fn(V.path)),1),$t(V.path)?(T(),A("span",AR,k($t(V.path)),1)):J("",!0)])],42,CR))),128)):v(D)?(T(),A("div",PR,k(v(s)("No searchable directory for this thread")),1)):(T(),A("div",ER,k(v(s)("No matching files")),1))])):J("",!0),Ae.value?(T(),at(II,{key:2,commands:He.value,"highlighted-index":Ye.value,onSelect:vr},null,8,["commands","highlighted-index"])):J("",!0),Nt(d("textarea",{ref_key:"inputRef",ref:X,"onUpdate:modelValue":O[2]||(O[2]=V=>a.value=V),class:"thread-composer-input",placeholder:We.value,disabled:Ze.value,onInput:ao,onKeydown:ea,onPaste:ro},null,40,IR),[[an,a.value]]),Vt.value?(T(),A("button",{key:3,class:"thread-composer-expand",type:"button","aria-label":ct.value?v(s)("Exit full screen composer"):v(s)("Expand composer"),title:ct.value?v(s)("Exit full screen composer"):v(s)("Expand composer"),disabled:Ze.value,onClick:pr},[ct.value?(T(),at(uI,{key:0,class:"thread-composer-expand-icon"})):(T(),at(aI,{key:1,class:"thread-composer-expand-icon"}))],8,RR)):J("",!0)],34),d("div",MR,[e.isTurnInProgress&&!ot.value?(T(),A("button",{key:0,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?v(s)("Saving thread before stop is available"):v(s)("Stop"),title:e.isStopPending?v(s)("Saving thread before stop is available"):v(s)("Stop"),disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending||e.externalSessionActive===!0,onClick:fr},[e.isStopPending?(T(),A("span",jR)):(T(),at(pI,{key:1,class:"thread-composer-stop-icon"}))],8,$R)):(T(),A("button",{key:1,class:Ke(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&de.value==="queue"}]),type:"button","aria-label":e.isCompacting?v(s)("Compacting context — the message will send after compaction"):e.isTurnInProgress&&de.value==="queue"?v(s)("Queue message"):v(s)("Send message"),title:e.isCompacting?v(s)("Compacting context — the message will send after compaction"):e.isTurnInProgress?`${v(s)("Send")} ${de.value==="queue"?v(s)("Queue"):v(s)("Steer")}`:v(s)("Send"),disabled:!it.value,onClick:O[3]||(O[3]=V=>nn(e.isTurnInProgress?de.value:"steer"))},[xe(tI,{class:"thread-composer-submit-icon"})],10,NR))])]),d("div",{class:Ke(["thread-composer-controls",{"thread-composer-controls--recording":Le.value}])},[xe(wc,{open:Me.value,align:"start",width:"lg","aria-label":v(s)("Add photos & files"),"onUpdate:open":O[6]||(O[6]=V=>Me.value=V)},{trigger:tt(()=>[d("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":v(s)("Add photos & files"),disabled:Ze.value,onClick:yn}," + ",8,LR)]),default:tt(()=>[d("button",{class:"thread-composer-attach-item",type:"button",disabled:Ze.value,onClick:Xr},k(v(s)("Add photos & files")),9,OR),d("button",{class:"thread-composer-attach-item",type:"button",disabled:Ze.value,onClick:wo},k(v(s)("Add folder")),9,DR),d("button",{class:"thread-composer-attach-item",type:"button",disabled:Ze.value,onClick:Ea},k(v(s)("Take photo")),9,FR),O[14]||(O[14]=d("div",{class:"thread-composer-attach-separator"},null,-1)),d("div",UR,[d("span",BR,k(v(s)("In-progress send")),1),d("div",qR,[d("button",{class:Ke(["thread-composer-attach-mode-button",{"is-active":de.value==="steer"}]),type:"button",disabled:Ze.value,onClick:O[4]||(O[4]=V=>Xn("steer"))},k(v(s)("Steer")),11,zR),d("button",{class:Ke(["thread-composer-attach-mode-button",{"is-active":de.value==="queue"}]),type:"button",disabled:Ze.value,onClick:O[5]||(O[5]=V=>Xn("queue"))},k(v(s)("Queue")),11,HR)])]),v(ye)?(T(),A(ze,{key:0},[O[12]||(O[12]=d("div",{class:"thread-composer-attach-separator"},null,-1)),d("div",WR,[d("span",VR,k(v(s)("Plan mode")),1),d("div",GR,[(T(!0),A(ze,null,kt(Ee.value,V=>(T(),A("button",{key:`mobile-plan-${V.value}`,class:Ke(["thread-composer-attach-mode-button",{"is-active":e.selectedCollaborationMode===V.value}]),type:"button",disabled:V.disabled||Wt.value,onClick:ge=>Kn(V.value)},k(v(s)(V.labelKey)),11,KR))),128))])]),O[13]||(O[13]=d("div",{class:"thread-composer-attach-separator"},null,-1)),d("div",YR,[d("span",JR,k(v(s)("Approval policy")),1),d("div",QR,[(T(),A(ze,null,kt(be,V=>d("button",{key:`mobile-approval-${V.value}`,class:Ke(["thread-composer-attach-mode-button",{"is-active":e.approvalPolicy===V.value}]),type:"button",disabled:e.isApprovalPolicySaving,onClick:ge=>Qa(V.value)},k(v(s)(V.label)),11,XR)),64))])]),e.approvalPolicyError?(T(),A("p",ZR,k(e.approvalPolicyError),1)):J("",!0),xe(Au,{name:"approval-tip"},{default:tt(()=>[e.approvalPolicyNotice?(T(),A("span",eM,k(e.approvalPolicyNotice),1)):J("",!0)]),_:1})],64)):J("",!0)]),_:1},8,["open","aria-label"]),v(ye)?J("",!0):(T(),at(wc,{key:0,open:Se.value,align:"start",width:"md","aria-label":v(s)("Plan mode"),"onUpdate:open":O[7]||(O[7]=V=>Se.value=V)},{trigger:tt(()=>[d("button",{class:Ke(["thread-composer-plan-trigger",{"is-active":Se.value}]),type:"button","aria-label":v(s)("Plan mode"),disabled:Wt.value,onClick:Qr},[d("span",nM,k(Oe.value),1),xe(ni,{class:"thread-composer-plan-trigger-chevron"})],10,tM)]),default:tt(()=>[(T(!0),A(ze,null,kt(Ee.value,V=>(T(),A("button",{key:V.value,class:Ke(["thread-composer-menu-item",{"is-active":e.selectedCollaborationMode===V.value}]),type:"button",role:"menuitemradio","aria-checked":e.selectedCollaborationMode===V.value,disabled:V.disabled||Wt.value,onClick:ge=>Ja(V.value)},[d("span",rM,[d("span",aM,k(v(s)(V.labelKey)),1),V.subLabel?(T(),A("span",sM,k(V.subLabel),1)):J("",!0),V.disabled?(T(),A("span",iM,k(v(s)("Not supported by this Codex version")),1)):J("",!0)]),e.selectedCollaborationMode===V.value?(T(),A("span",lM,"✓")):J("",!0)],10,oM))),128))]),_:1},8,["open","aria-label"])),v(ye)?J("",!0):(T(),at(wc,{key:1,open:Fe.value,align:"center",width:"md","aria-label":v(s)("Approval policy"),"onUpdate:open":O[8]||(O[8]=V=>Fe.value=V)},{trigger:tt(()=>[d("button",{class:Ke(["thread-composer-approval-trigger",{"is-active":Fe.value}]),type:"button","aria-label":v(s)("Approval policy"),disabled:Wt.value,onClick:Xt},[d("span",cM,k(Re.value),1),xe(ni,{class:"thread-composer-approval-trigger-chevron"})],10,uM)]),default:tt(()=>[(T(),A(ze,null,kt(be,V=>d("button",{key:V.value,class:Ke(["thread-composer-menu-item",{"is-active":e.approvalPolicy===V.value}]),type:"button",role:"menuitemradio","aria-checked":e.approvalPolicy===V.value,disabled:e.isApprovalPolicySaving,onClick:ge=>Qa(V.value)},[d("span",fM,[d("span",pM,k(v(s)(V.label)),1)]),e.approvalPolicy===V.value?(T(),A("span",hM,"✓")):J("",!0)],10,dM)),64)),e.approvalPolicyError?(T(),A("p",mM,k(e.approvalPolicyError),1)):J("",!0),xe(Au,{name:"approval-tip"},{default:tt(()=>[e.approvalPolicyNotice?(T(),A("span",vM,k(e.approvalPolicyNotice),1)):J("",!0)]),_:1})]),_:1},8,["open","aria-label"])),xe(lr,{class:"thread-composer-control thread-composer-model-control","model-value":e.selectedModel,options:ce.value,"selected-prefix-icon":K.value?ga:null,placeholder:v(s)("Model"),"open-direction":"up",variant:"pill",disabled:Wt.value||e.models.length===0,"enable-search":"","search-placeholder":v(s)("Search models..."),"onUpdate:modelValue":Pa},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),xe(lr,{class:"thread-composer-control thread-composer-thinking-control","model-value":e.selectedReasoningEffort,options:we.value,placeholder:v(s)("Thinking"),"open-direction":"up",variant:"pill",disabled:Wt.value||we.value.length===0,"onUpdate:modelValue":In},null,8,["model-value","options","placeholder","disabled"]),Bn.value?(T(),A("button",{key:2,type:"button",class:Ke(["thread-composer-context-usage-inline",{"is-warning":Qn.value==="warning","is-danger":Qn.value==="danger"}]),title:vo.value,"aria-label":v(s)("Context"),onClick:go},[d("span",yM,k(Jo.value),1),Qn.value!=="healthy"?(T(),A("span",wM,k(v(s)("Compact")),1)):J("",!0)],10,gM)):J("",!0)],2)])],2),d("input",{ref_key:"photoLibraryInputRef",ref:ae,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:Ze.value,onChange:Zo},null,40,bM),d("input",{ref_key:"cameraCaptureInputRef",ref:z,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:Ze.value,onChange:mr},null,40,_M),d("input",{ref_key:"folderPickerInputRef",ref:Z,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:Ze.value,onChange:Jn},null,40,kM)],32))}}),ev=At(SM,[["__scopeId","data-v-b0a07dd7"]]),xM={class:"thread-pending-request-title"},AM=["title"],PM={class:"thread-pending-request-approval"},EM=["aria-label"],IM=["aria-pressed","onClick"],RM={class:"thread-pending-request-option-index"},MM={class:"thread-pending-request-option-label"},$M={class:"thread-pending-request-footer thread-pending-request-footer--approval"},jM=["value","placeholder"],NM={key:0,class:"thread-pending-request-validation-error",role:"alert"},LM={class:"thread-pending-request-header"},OM={class:"thread-pending-request-heading"},DM={class:"thread-pending-request-eyebrow"},FM={class:"thread-pending-request-title"},UM={key:0,class:"thread-pending-request-counter"},BM={key:0,class:"thread-pending-request-preview"},qM={class:"thread-pending-request-preview-code"},zM={key:1,class:"thread-pending-request-validation-error",role:"alert"},HM={key:2,class:"thread-pending-request-user-input"},WM={key:0,class:"thread-pending-request-question-description"},VM=["href"],GM={class:"thread-pending-request-question-title"},KM={key:0},YM={key:0,class:"thread-pending-request-question-text"},JM={key:1,class:"thread-pending-request-input-wrap"},QM={class:"thread-pending-request-select-label"},XM=["type","value","onInput"],ZM={key:2,class:"thread-pending-request-select-wrap"},e$={class:"thread-pending-request-select-label"},t$={key:3,class:"thread-pending-request-select-wrap"},n$={class:"thread-pending-request-select-label"},o$={key:4,class:"thread-pending-request-question-options"},r$=["checked","onChange"],a$={class:"thread-pending-request-checkbox-label"},s$={key:2,class:"thread-pending-request-validation-error"},i$={class:"thread-pending-request-footer"},l$={key:3,class:"thread-pending-request-user-input"},u$={class:"thread-pending-request-question-title"},c$={key:0,class:"thread-pending-request-question-text"},d$={key:1,class:"thread-pending-request-question-options"},f$={class:"thread-pending-request-select-wrap"},p$={class:"thread-pending-request-select-label"},h$={key:0,class:"thread-pending-request-question-description"},m$={key:2,class:"thread-pending-request-input-wrap"},v$={class:"thread-pending-request-select-label"},g$=["value","placeholder","onInput"],y$={class:"thread-pending-request-footer"},w$={key:4,class:"thread-pending-request-actions"},b$={key:5,class:"thread-pending-request-actions"},_$=Nn({__name:"ThreadPendingRequestPanel",props:{request:{},requestCount:{},hasQueueAbove:{type:Boolean},panelWidth:{},panelError:{}},emits:["respondServerRequest"],setup(e,{emit:t}){const n=e,o=t,r=ee(()=>{const W=typeof n.panelWidth=="number"&&n.panelWidth>0?n.panelWidth:0;return W>0?{width:`${W}px`}:{}}),s=S("accept"),a=S(""),l=S({}),f=S({}),m=S({}),g=S(""),{t:w}=Ar();function x(W){return W!==null&&typeof W=="object"&&!Array.isArray(W)?W:null}function R(W){return typeof W=="string"?W.trim():""}function L(W){return typeof W=="string"?W:null}function B(W){return/^[A-Za-z0-9_./:@%+=,-]+$/.test(W)?W:JSON.stringify(W)}function Y(W){const Q=(Array.isArray(W.commandActions)?W.commandActions:[]).map(de=>x(de)).map(de=>R(de==null?void 0:de.command)).find(de=>de.length>0);if(Q)return Q.replace(/\s+/g," ").trim();if(Array.isArray(W.command)){const de=W.command.filter(Le=>typeof Le=="string").map(Le=>Le.trim()).filter(Le=>Le.length>0);if(de.length>0)return de.map(Le=>B(Le)).join(" ")}return pe(R(W.command))}function ae(W){return W.method==="item/commandExecution/requestApproval"||W.method==="execCommandApproval"}function z(W){return W.method==="item/fileChange/requestApproval"||W.method==="applyPatchApproval"}function Z(W){return W.method==="item/permissions/requestApproval"}function X(W){return ae(W)||z(W)||Z(W)}function ye(W){return W.method==="mcpServer/elicitation/request"}function Me(W){const K=x(W.params);return R(K==null?void 0:K.reason)||R(K==null?void 0:K.prompt)||R(K==null?void 0:K.message)}function Se(W){return X(W)?w("Awaiting approval"):ye(W)?w("MCP server input required"):W.method==="item/tool/requestUserInput"?w("Awaiting response"):W.method==="item/tool/call"?w("Tool call waiting for response"):W.method}function Fe(W){const K=Me(W);return K||(ae(W)?w("Do you want to run this command?"):z(W)?w("Do you want to make these changes?"):Z(W)?w("Do you want to grant these permissions?"):ye(W)?w("An MCP server needs your input before Codex can continue."):W.method==="item/tool/requestUserInput"?w("Codex needs your answer before it can continue."):w("Codex is waiting for a response before it can continue."))}function pe(W){var We;const K=W.trim();if(!K)return"";const Q=K.match(/-Command\s+(.+)$/i),de=((We=Q==null?void 0:Q[1])==null?void 0:We.trim())??K;return(de.startsWith('"')&&de.endsWith('"')?de.slice(1,-1):de).replace(/\\"/g,'"').replace(/`"/g,'"').replace(/""/g,'"').replace(/\s+/g," ").trim()}function Ue(W){const K=x(W.params);if(!K)return"";if(ae(W))return Y(K);if(z(W)){const Q=R(K.grantRoot)||R(K.grant_root);if(Q)return Q.replace(/\s+/g," ").trim();const de=x(K.fileChanges)??x(K.changes);if(!de)return"";const Le=Object.keys(de).map(We=>We.trim()).filter(We=>We.length>0);return Le.length===0?"":Le.slice(0,3).join(", ")}return Z(W)?$e(K.permissions):ye(W)?R(K.serverName)||R(K.url):""}function $e(W){const K=x(W);if(!K)return"";const Q=[],de=x(K.fileSystem),Le=x(K.network),We=Array.isArray(de==null?void 0:de.read)?de.read.filter(Ft=>typeof Ft=="string"):[],ot=Array.isArray(de==null?void 0:de.write)?de.write.filter(Ft=>typeof Ft=="string"):[];return We.length>0&&Q.push(`${w("Read")}: ${We.join(", ")}`),ot.length>0&&Q.push(`${w("Write")}: ${ot.join(", ")}`),(Le==null?void 0:Le.enabled)===!0&&Q.push(w("Network access")),Q.join(" • ")}function he(W){return!W||!X(W)?[]:[{id:"accept",label:w("Yes")},{id:"acceptForSession",label:w("Yes for Session")}]}const Te=ee(()=>he(n.request));rt(()=>{var W;return((W=n.request)==null?void 0:W.id)??0},()=>{var W;a.value="",l.value={},f.value={},m.value={},g.value="",s.value=((W=Te.value[0])==null?void 0:W.id)??"accept"},{immediate:!0}),rt(Te,W=>{var K;s.value!=="decline"&&(W.some(Q=>Q.id===s.value)||(s.value=((K=W[0])==null?void 0:K.id)??"accept"))},{immediate:!0});function Ae(W,K){return`${String(W)}:${K}`}function Pe(W){const K=x(W.params),Q=Array.isArray(K==null?void 0:K.questions)?K.questions:[],de=[];for(const Le of Q){const We=x(Le);if(!We)continue;const ot=R(We.id);if(!ot)continue;const Ft=Array.isArray(We.options)?We.options.map(Vt=>x(Vt)).map(Vt=>({label:R(Vt==null?void 0:Vt.label),description:R(Vt==null?void 0:Vt.description)})).filter(Vt=>Vt.label.length>0):[];de.push({id:ot,header:R(We.header),question:R(We.question),isOther:We.isOther===!0,options:Ft})}return de}function De(W,K,Q){const de=Ae(W,K),Le=l.value[de];return typeof Le=="string"&&Le.length>0?Le:Q}function Ye(W,K){return f.value[Ae(W,K)]??""}function He(W,K,Q){const de=Ae(W,K);l.value={...l.value,[de]:Q}}function St(W){return W.options.map(K=>({value:K.label,label:K.label}))}function ct(W,K,Q){const de=Q.target;if(!(de instanceof HTMLInputElement))return;const Le=Ae(W,K);f.value={...f.value,[Le]:de.value}}function Ge(W,K,Q){var Le,We;const de=De(W,K,((Le=Q[0])==null?void 0:Le.label)||"");return((We=Q.find(ot=>ot.label===de))==null?void 0:We.description)??""}function nt(W,K){return`${String(W)}:${K}`}function dt(W){var K;return R((K=x(W.params))==null?void 0:K.serverName)}function _t(W){var Q;const K=R((Q=x(W.params))==null?void 0:Q.url);if(!K)return"";try{const de=new URL(K),Le=de.protocol.toLowerCase();return Le==="https:"||Le==="http:"?de.toString():""}catch{return""}}function Tt(W){const K=x(W.params),Q=x(K==null?void 0:K.requestedSchema),de=x(Q==null?void 0:Q.properties);if(!de)return[];const Le=new Set(Array.isArray(Q==null?void 0:Q.required)?Q.required.filter(We=>typeof We=="string"):[]);return Object.entries(de).map(([We,ot])=>gt(We,x(ot),Le.has(We))).filter(We=>We!==null)}function gt(W,K,Q){if(!K)return null;const de=R(K.title)||W,Le=R(K.description),We=R(K.type);if(We==="boolean")return{key:W,label:de,description:Le,required:Q,kind:"boolean",inputType:"checkbox",options:[],defaultValue:typeof K.default=="boolean"?K.default:null,hasExplicitDefault:typeof K.default=="boolean"};if(We==="number"||We==="integer")return{key:W,label:de,description:Le,required:Q,kind:"number",inputType:"number",options:[],defaultValue:typeof K.default=="number"?K.default:null,hasExplicitDefault:typeof K.default=="number"};const ot=se(K);if(We==="array")return{key:W,label:de,description:Le,required:Q,kind:"multiEnum",inputType:"checkbox",options:ot,defaultValue:Array.isArray(K.default)?K.default.filter(Vt=>typeof Vt=="string"):[],hasExplicitDefault:Array.isArray(K.default)};const Ft=L(K.default);return ot.length>0?{key:W,label:de,description:Le,required:Q,kind:"singleEnum",inputType:"select",options:ot,defaultValue:Ft,hasExplicitDefault:Ft!==null}:{key:W,label:de,description:Le,required:Q,kind:"string",inputType:ne(K),options:[],defaultValue:Ft,hasExplicitDefault:Ft!==null}}function se(W){const Q=(Array.isArray(W.oneOf)?W.oneOf:Array.isArray(W.anyOf)?W.anyOf:[]).map(ot=>x(ot)).map(ot=>({value:R(ot==null?void 0:ot.const),label:R(ot==null?void 0:ot.title)||R(ot==null?void 0:ot.const)})).filter(ot=>ot.value.length>0);if(Q.length>0)return Q;const de=x(W.items);if(de){const ot=se(de);if(ot.length>0)return ot}const Le=Array.isArray(W.enum)?W.enum.filter(ot=>typeof ot=="string"):[],We=Array.isArray(W.enumNames)?W.enumNames.filter(ot=>typeof ot=="string"):[];return Le.map((ot,Ft)=>({value:ot,label:We[Ft]||ot}))}function ne(W){const K=R(W.format);return K==="email"?"email":K==="uri"?"url":K==="date"?"date":K==="date-time"?"datetime-local":"text"}function re(W,K){const Q=m.value[nt(W,K.key)];return Q!==void 0?Q:K.defaultValue}function H(W,K){const Q=re(W,K);return Array.isArray(Q)?Q.filter(de=>typeof de=="string"):[]}function Be(W,K,Q){const de=Q.target;de instanceof HTMLInputElement&&$(W,K,de.value)}function $(W,K,Q){const de=(K.kind==="number",Q);m.value={...m.value,[nt(W,K.key)]:Q.length>0?de:null},g.value=""}function D(W,K,Q){let de=null;Q==="true"?de=!0:Q==="false"&&(de=!1),m.value={...m.value,[nt(W,K.key)]:de},g.value=""}function G(W,K,Q,de){const Le=de.target;if(!(Le instanceof HTMLInputElement))return;const We=new Set(H(W,K));Le.checked?We.add(Q):We.delete(Q),m.value={...m.value,[nt(W,K.key)]:Array.from(We)},g.value=""}function ie(W){return W===!0?"true":W===!1?"false":""}function le(W){const K=[{value:"true",label:w("True")},{value:"false",label:w("False")}];return W.hasExplicitDefault||K.unshift({value:"",label:w("Select true or false")}),K}function oe(W){const K=W.options.map(Q=>({value:Q.value,label:Q.label}));return W.hasExplicitDefault||K.unshift({value:"",label:w("Select an option")}),K}function Ce(W,K){const Q=re(W,K);return K.kind==="multiEnum"?Array.isArray(Q)&&Q.length>0:K.kind==="boolean"?typeof Q=="boolean":K.kind==="number"&&typeof Q=="number"?!0:typeof Q=="string"&&Q.trim().length>0}function we(W){const K=Tt(W).filter(Q=>Q.required&&!Ce(W.id,Q)).map(Q=>Q.label);return K.length===0?"":K.length===1?`${w("Answer the required field")}: ${K[0]}.`:`${w("Answer the required field")}: ${K.join(", ")}.`}function ve(W){const K={};for(const Q of Tt(W)){const de=re(W.id,Q);if(Q.kind==="multiEnum"){const We=Array.isArray(de)?de:[];(We.length>0||Q.required)&&(K[Q.key]=We);continue}if(Q.kind==="boolean"){typeof de=="boolean"&&(K[Q.key]=de);continue}if(Q.kind==="number"){const We=typeof de=="number"?de:Number(String(de).trim());Number.isNaN(We)||(K[Q.key]=We);continue}const Le=String(de??"").trim();(Le.length>0||Q.required)&&(K[Q.key]=Le)}return K}function ce(W){s.value=W}function Ee(){s.value="decline"}function be(W){const K=W.target;K instanceof HTMLInputElement&&(a.value=K.value,s.value="decline")}function Oe(W,K){var Q;if(Z(W)){if(K==="decline"||K==="cancel"){o("respondServerRequest",{id:W.id,error:{code:-32e3,message:K==="cancel"?"Cancelled from CodexUI.":"Declined from CodexUI."}});return}const de=x((Q=x(W.params))==null?void 0:Q.permissions)??{};o("respondServerRequest",{id:W.id,result:{permissions:de,scope:K==="acceptForSession"?"session":"turn"}});return}o("respondServerRequest",{id:W.id,result:{decision:K}})}function Re(W){const K=a.value.trim(),Q=K.length>0?"decline":s.value;if(Z(W)){Oe(W,Q);return}o("respondServerRequest",{id:W.id,result:{decision:Q},followUpMessageText:K||void 0})}function Ve(W,K){const Q=x(W.params),de={action:K};if(K==="accept"&&R(Q==null?void 0:Q.mode)==="form"){const Le=we(W);if(Le){g.value=Le;return}de.content=ve(W)}o("respondServerRequest",{id:W.id,result:de})}function it(W){var de;const K=Pe(W),Q={};for(const Le of K){const We=De(W.id,Le.id,((de=Le.options[0])==null?void 0:de.label)||""),ot=Ye(W.id,Le.id).trim(),Ft=[We,ot].map(Vt=>Vt.trim()).filter(Vt=>Vt.length>0);Q[Le.id]={answers:Ft}}o("respondServerRequest",{id:W.id,result:{answers:Q}})}function yt(W){o("respondServerRequest",{id:W.id,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from CodexUI."}]}})}function It(W){o("respondServerRequest",{id:W.id,result:{success:!0,contentItems:[]}})}function Ze(W){o("respondServerRequest",{id:W.id,result:{}})}function Wt(W){o("respondServerRequest",{id:W.id,error:{code:-32e3,message:"Rejected from CodexUI."}})}return(W,K)=>e.request?(T(),A("section",{key:0,class:"thread-pending-request",style:Vr(r.value)},[d("article",{class:Ke(["thread-pending-request-shell",{"thread-pending-request-shell--no-top-radius":e.hasQueueAbove}])},[X(e.request)?(T(),A(ze,{key:0},[d("p",xM,k(Fe(e.request)),1),Ue(e.request)?(T(),A("p",{key:0,class:"thread-pending-request-command-line",title:Ue(e.request)},k(Ue(e.request)),9,AM)):J("",!0),d("section",PM,[d("div",{class:"thread-pending-request-options",role:"radiogroup","aria-label":v(w)("Approval choices")},[(T(!0),A(ze,null,kt(Te.value,(Q,de)=>(T(),A("button",{key:Q.id,type:"button",class:Ke(["thread-pending-request-option",{"is-selected":s.value===Q.id}]),"aria-pressed":s.value===Q.id,onClick:Le=>ce(Q.id)},[d("span",RM,k(de+1)+".",1),d("span",MM,k(Q.label),1)],10,IM))),128))],8,EM),d("footer",$M,[d("label",{class:Ke(["thread-pending-request-inline-input",{"is-active":s.value==="decline"||a.value.length>0}])},[K[11]||(K[11]=d("span",{class:"thread-pending-request-option-index"},"3.",-1)),d("input",{class:"thread-pending-request-inline-control",type:"text",value:a.value,placeholder:v(w)("No, and tell Codex what to do differently"),onFocus:Ee,onInput:be,onKeydown:K[0]||(K[0]=Pn(Qe(Q=>Re(e.request),["prevent"]),["enter"]))},null,40,jM)],2),d("button",{type:"button",class:"thread-pending-request-secondary",onClick:K[1]||(K[1]=Q=>Oe(e.request,"cancel"))},k(v(w)("Skip")),1),d("button",{type:"button",class:"thread-pending-request-primary",onClick:K[2]||(K[2]=Q=>Re(e.request))},k(v(w)("Send")),1)]),e.panelError?(T(),A("p",NM,k(e.panelError),1)):J("",!0)])],64)):(T(),A(ze,{key:1},[d("header",LM,[d("div",OM,[d("p",DM,k(Se(e.request)),1),d("p",FM,k(Fe(e.request)),1)]),(e.requestCount??0)>1?(T(),A("span",UM,k(e.requestCount??0)+" "+k(v(w)("pending")),1)):J("",!0)]),Ue(e.request)?(T(),A("div",BM,[d("code",qM,k(Ue(e.request)),1)])):J("",!0),e.panelError?(T(),A("p",zM,k(e.panelError),1)):J("",!0),e.request.method==="mcpServer/elicitation/request"?(T(),A("section",HM,[dt(e.request)?(T(),A("p",WM,k(v(w)("Server"))+": "+k(dt(e.request)),1)):J("",!0),_t(e.request)?(T(),A("a",{key:1,class:"thread-pending-request-link",href:_t(e.request),target:"_blank",rel:"noopener noreferrer"},k(v(w)("Open authorization link")),9,VM)):J("",!0),(T(!0),A(ze,null,kt(Tt(e.request),Q=>(T(),A("div",{key:`${e.request.id}:${Q.key}`,class:"thread-pending-request-question"},[d("p",GM,[ks(k(Q.label),1),Q.required?(T(),A("span",KM," *")):J("",!0)]),Q.description?(T(),A("p",YM,k(Q.description),1)):J("",!0),Q.kind==="string"||Q.kind==="number"?(T(),A("label",JM,[d("span",QM,k(v(w)("Value")),1),d("input",{class:"thread-pending-request-input",type:Q.inputType,value:String(re(e.request.id,Q)??""),onInput:de=>Be(e.request.id,Q,de)},null,40,XM)])):Q.kind==="boolean"?(T(),A("div",ZM,[d("span",e$,k(v(w)("Choice")),1),xe(lr,{class:"thread-pending-request-dropdown","model-value":ie(re(e.request.id,Q)),options:le(Q),placeholder:v(w)("Select true or false"),"onUpdate:modelValue":de=>D(e.request.id,Q,de)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):Q.kind==="singleEnum"?(T(),A("div",t$,[d("span",n$,k(v(w)("Choice")),1),xe(lr,{class:"thread-pending-request-dropdown","model-value":String(re(e.request.id,Q)??""),options:oe(Q),placeholder:v(w)("Select an option"),"enable-search":"","search-placeholder":v(w)("Search options..."),"onUpdate:modelValue":de=>$(e.request.id,Q,de)},null,8,["model-value","options","placeholder","search-placeholder","onUpdate:modelValue"])])):(T(),A("div",o$,[(T(!0),A(ze,null,kt(Q.options,de=>(T(),A("label",{key:`${e.request.id}:${Q.key}:${de.value}`,class:"thread-pending-request-checkbox-row"},[d("input",{class:"thread-pending-request-checkbox",type:"checkbox",checked:H(e.request.id,Q).includes(de.value),onChange:Le=>G(e.request.id,Q,de.value,Le)},null,40,r$),d("span",a$,k(de.label),1)]))),128))]))]))),128)),g.value?(T(),A("p",s$,k(g.value),1)):J("",!0),d("footer",i$,[d("button",{type:"button",class:"thread-pending-request-secondary",onClick:K[3]||(K[3]=Q=>Ve(e.request,"cancel"))},k(v(w)("Cancel")),1),d("button",{type:"button",class:"thread-pending-request-secondary",onClick:K[4]||(K[4]=Q=>Ve(e.request,"decline"))},k(v(w)("Decline")),1),d("button",{type:"button",class:"thread-pending-request-primary",onClick:K[5]||(K[5]=Q=>Ve(e.request,"accept"))},k(v(w)("Continue")),1)])])):e.request.method==="item/tool/requestUserInput"?(T(),A("section",l$,[(T(!0),A(ze,null,kt(Pe(e.request),Q=>{var de;return T(),A("div",{key:`${e.request.id}:${Q.id}`,class:"thread-pending-request-question"},[d("p",u$,k(Q.header||Q.question),1),Q.question?(T(),A("p",c$,k(Q.question),1)):J("",!0),Q.options.length>0?(T(),A("div",d$,[d("div",f$,[d("span",p$,k(v(w)("Choice")),1),xe(lr,{class:"thread-pending-request-dropdown","model-value":De(e.request.id,Q.id,((de=Q.options[0])==null?void 0:de.label)||""),options:St(Q),placeholder:v(w)("Choice"),"onUpdate:modelValue":Le=>He(e.request.id,Q.id,Le)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),Ge(e.request.id,Q.id,Q.options)?(T(),A("p",h$,k(Ge(e.request.id,Q.id,Q.options)),1)):J("",!0)])):J("",!0),Q.isOther?(T(),A("label",m$,[d("span",v$,k(v(w)("Other answer")),1),d("input",{class:"thread-pending-request-input",type:"text",value:Ye(e.request.id,Q.id),placeholder:v(w)("Other answer"),onInput:Le=>ct(e.request.id,Q.id,Le)},null,40,g$)])):J("",!0)])}),128)),d("footer",y$,[d("button",{type:"button",class:"thread-pending-request-primary",onClick:K[6]||(K[6]=Q=>it(e.request))},k(v(w)("Send")),1)])])):e.request.method==="item/tool/call"?(T(),A("section",w$,[d("button",{type:"button",class:"thread-pending-request-primary",onClick:K[7]||(K[7]=Q=>yt(e.request))},k(v(w)("Fail Tool Call")),1),d("button",{type:"button",class:"thread-pending-request-secondary",onClick:K[8]||(K[8]=Q=>It(e.request))},k(v(w)("Success (Empty)")),1)])):(T(),A("section",b$,[d("button",{type:"button",class:"thread-pending-request-primary",onClick:K[9]||(K[9]=Q=>Ze(e.request))},k(v(w)("Return Empty Result")),1),d("button",{type:"button",class:"thread-pending-request-secondary",onClick:K[10]||(K[10]=Q=>Wt(e.request))},k(v(w)("Reject Request")),1)]))],64))],2)],4)):J("",!0)}}),k$=At(_$,[["__scopeId","data-v-ffe669ea"]]),C$={key:0,class:"queued-messages"},T$={class:"queued-messages-inner"},S$=["onDragstart","onDragover","onDragleave","onDrop"],x$=["aria-label","title"],A$={class:"queued-row-text"},P$={key:0,class:"queued-row-badge"},E$={class:"queued-row-actions"},I$=["title","onClick"],R$=["title","onClick"],M$=["aria-label","title","onClick"],$$=Nn({__name:"QueuedMessages",props:{messages:{}},emits:["edit","steer","delete","reorder"],setup(e,{emit:t}){const n=t,{t:o}=Ar(),r=S(""),s=S("");function a(x,R){var L;r.value=R,s.value="",(L=x.dataTransfer)==null||L.setData("text/plain",R),x.dataTransfer&&(x.dataTransfer.effectAllowed="move")}function l(x){!r.value||r.value===x||(s.value=x)}function f(x){s.value===x&&(s.value="")}function m(x){const R=r.value;g(),!(!R||R===x)&&n("reorder",{draggedId:R,targetId:x})}function g(){r.value="",s.value=""}function w(x){var z,Z,X;const R=x.text.trim();if(R)return R;const L=[],B=((z=x.imageUrls)==null?void 0:z.length)??0,Y=((Z=x.fileAttachments)==null?void 0:Z.length)??0,ae=((X=x.skills)==null?void 0:X.length)??0;return B>0&&L.push(`${B} ${o(B===1?"image":"images")}`),Y>0&&L.push(`${Y} ${o(Y===1?"file":"files")}`),ae>0&&L.push(`${ae} ${o(ae===1?"skill":"skills")}`),L.join(", ")||o("(empty queued message)")}return(x,R)=>e.messages.length>0?(T(),A("div",C$,[d("div",T$,[(T(!0),A(ze,null,kt(e.messages,L=>(T(),A("div",{key:L.id,class:Ke(["queued-row",{"is-dragging":r.value===L.id,"is-drop-target":s.value===L.id&&r.value!==L.id}]),draggable:"true",onDragstart:B=>a(B,L.id),onDragover:Qe(B=>l(L.id),["prevent"]),onDragleave:B=>f(L.id),onDrop:Qe(B=>m(L.id),["prevent"]),onDragend:g},[d("button",{class:"queued-row-drag",type:"button","aria-label":v(o)("Drag to reorder queued message"),title:v(o)("Drag to reorder queued message")},[...R[0]||(R[0]=[d("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[d("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,x$),R[2]||(R[2]=d("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[d("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)),d("span",A$,k(w(L)),1),L.awaitingCompaction?(T(),A("span",P$,k(v(o)("Compacts context before send")),1)):J("",!0),d("div",E$,[d("button",{class:"queued-row-edit",type:"button",title:v(o)("Edit queued message"),onClick:B=>x.$emit("edit",L.id)},k(v(o)("Edit")),9,I$),d("button",{class:"queued-row-steer",type:"button",title:v(o)("Send now without interrupting work"),onClick:B=>x.$emit("steer",L.id)},k(v(o)("Steer")),9,R$),d("button",{class:"queued-row-delete",type:"button","aria-label":v(o)("Delete queued message"),title:v(o)("Delete queued message"),onClick:B=>x.$emit("delete",L.id)},[...R[1]||(R[1]=[d("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[d("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,M$)])],42,S$))),128))])])):J("",!0)}}),j$=At($$,[["__scopeId","data-v-631d6962"]]),N$={key:0,class:"rate-limit-status","aria-live":"polite"},L$=["title"],O$={class:"rate-limit-card-header"},D$={class:"rate-limit-card-title"},F$={key:0,class:"rate-limit-card-plan"},U$={class:"rate-limit-card-metrics"},B$={key:0,class:"rate-limit-card-footer"},q$=Nn({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){const{t}=Ar();function n(z){var Z,X;return((Z=z.limitId)==null?void 0:Z.trim())||((X=z.limitName)==null?void 0:X.trim())||"__default__"}function o(z){var Z,X;return((Z=z.limitName)==null?void 0:Z.trim())||((X=z.limitId)==null?void 0:X.trim())||t("Rate limits")}function r(z){const Z=z.trim();return Z?Z.replace(/[_-]+/g," ").replace(/\b\w/g,X=>X.toUpperCase()):""}function s(z){return!z||z<=0?t("Window"):z%1440===0?`${z/1440}d`:z%60===0?`${z/60}h`:z<60?`${z}m`:`${Math.round(z/60*10)/10}h`}function a(z){const Z=Math.max(0,Math.min(100,100-z));return`${Math.round(Z)}% ${t("left")}`}function l(z){return`${Math.round(z)}%`}function f(z,Z){return{key:Z,label:`${s(z.windowDurationMins)} ${a(z.usedPercent)}`}}function m(z){const Z=[];return z.primary&&Z.push(f(z.primary,"primary")),z.secondary&&Z.push(f(z.secondary,"secondary")),Z}function g(z){if(!z)return"";const Z=new Date(z*1e3),X=Z.getMonth()+1,ye=String(Z.getDate()).padStart(2,"0"),Me=String(Z.getHours()).padStart(2,"0"),Se=String(Z.getMinutes()).padStart(2,"0");return`${X}.${ye} ${Me}:${Se}`}function w(z){if(!(z!=null&&z.resetsAt))return"";const Z=z.resetsAt*1e3-Date.now();if(Z<=0)return t("Resetting now");const X=Math.round(Z/6e4);if(X<60)return`${t("Resets in")} ${X}m`;const ye=Math.round(X/60);if(ye<24)return`${t("Resets in")} ${ye}h`;const Me=Math.round(ye/24);return`${t("Resets in")} ${Me}d`}function x(z){return[z.primary,z.secondary].filter(Z=>Z!==null)}function R(z){const Z=x(z);return Z.length===0?null:[...Z].sort((X,ye)=>{const Me=X.windowDurationMins??Number.MAX_SAFE_INTEGER,Se=ye.windowDurationMins??Number.MAX_SAFE_INTEGER;return Me!==Se?Me-Se:(X.resetsAt??Number.MAX_SAFE_INTEGER)-(ye.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function L(z){const Z=x(z);if(Z.length===0)return"";const X=[...Z].sort((Me,Se)=>{const Fe=Me.windowDurationMins??-1,pe=Se.windowDurationMins??-1;return Fe!==pe?pe-Fe:(Se.resetsAt??-1)-(Me.resetsAt??-1)})[0],ye=g(X.resetsAt);return ye||""}function B(z){const Z=z.credits;return Z?Z.unlimited?t("Unlimited credits"):Z.balance?`${t("Credits")} ${Z.balance}`:Z.hasCredits?t("Credits available"):"":""}function Y(z){return[w(R(z)),L(z),B(z)].filter(Z=>Z.length>0)}function ae(z){const Z=[o(z)];for(const X of m(z))Z.push(X.label);for(const X of x(z))Z.push(`${s(X.windowDurationMins)} used ${l(X.usedPercent)}`);for(const X of Y(z))Z.push(X);return Z.join(`
62
+ `)}return(z,Z)=>e.snapshots.length>0?(T(),A("aside",N$,[(T(!0),A(ze,null,kt(e.snapshots,X=>(T(),A("div",{key:n(X),class:"rate-limit-card",title:ae(X)},[d("div",O$,[d("span",D$,k(o(X)),1),X.planType?(T(),A("span",F$,k(r(X.planType)),1)):J("",!0)]),d("div",U$,[(T(!0),A(ze,null,kt(m(X),ye=>(T(),A("span",{key:ye.key,class:"rate-limit-card-metric"},k(ye.label),1))),128))]),Y(X).length>0?(T(),A("div",B$,k(Y(X).join(" | ")),1)):J("",!0)],8,L$))),128))])):J("",!0)}}),z$=At(q$,[["__scopeId","data-v-1fd5e1ec"]]),H$=["aria-label"],W$=["aria-checked","onClick"],V$={class:"runtime-toggle-option-label"},G$=Nn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:o}=Ar(),r=[{value:"local",label:o("Local project"),icon:Sp},{value:"worktree",label:o("New worktree"),icon:Oi}];function s(a){n("update:modelValue",a)}return(a,l)=>(T(),A("div",{class:"runtime-toggle",role:"radiogroup","aria-label":v(o)("Continue in")},[(T(),A(ze,null,kt(r,f=>d("button",{key:f.value,class:Ke(["runtime-toggle-option",{"is-selected":e.modelValue===f.value}]),type:"button",role:"radio","aria-checked":e.modelValue===f.value,onClick:m=>s(f.value)},[(T(),at(up(f.icon),{class:"runtime-toggle-option-icon"})),d("span",V$,k(f.label),1)],10,W$)),64))],8,H$))}}),K$=At(G$,[["__scopeId","data-v-4d282f1a"]]),Y$={},J$={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 Q$(e,t){return T(),A("svg",J$,[...t[0]||(t[0]=[d("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),d("path",{d:"M9 4l0 16"},null,-1)])])}const Oy=At(Y$,[["render",Q$]]),X$={},Z$={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function ej(e,t){return T(),A("svg",Z$,[...t[0]||(t[0]=[d("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 tj=At(X$,[["render",ej]]),nj={class:"sidebar-thread-controls"},oj=["aria-label","title"],rj=["aria-label","title"],aj=Nn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=Ar();return(n,o)=>(T(),A("div",nj,[d("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?(T(),at(tj,{key:0,class:"sidebar-thread-controls-icon"})):(T(),at(Oy,{key:1,class:"sidebar-thread-controls-icon"}))],8,oj),ur(n.$slots,"default",{},void 0),e.showNewThreadButton?(T(),A("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"))},[xe(Rl,{class:"sidebar-thread-controls-icon"})],8,rj)):J("",!0)]))}}),tv=At(aj,[["__scopeId","data-v-39c4ec05"]]);function sj(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 Dy(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!sj(e))throw new Error("Copy failed")}const ij={class:"right-git-panel"},lj={class:"rgp-review-label"},uj={class:"rgp-review-delta"},cj={class:"rgp-added"},dj={class:"rgp-removed"},fj={class:"rgp-state"},pj={class:"rgp-state-label"},hj={class:"rgp-state-value"},mj={key:0,class:"rgp-state-meta"},vj=["href"],gj={key:2,class:"rgp-section"},yj={class:"rgp-section-title"},wj={class:"rgp-file-list"},bj=["title","onClick"],_j={class:"rgp-file-status"},kj={class:"rgp-file-path"},Cj={key:0,class:"rgp-file-previous-path"},Tj={class:"rgp-section"},Sj={class:"rgp-section-title"},xj={class:"rgp-search-wrap"},Aj=["placeholder"],Pj={class:"rgp-branches",role:"listbox"},Ej={class:"rgp-branch-row"},Ij=["disabled","onClick"],Rj={class:"rgp-branch-name"},Mj={key:0,class:"rgp-branch-meta"},$j={key:1,class:"rgp-branch-meta"},jj=["disabled","onClick"],Nj={key:0,class:"rgp-empty"},Lj={class:"rgp-section"},Oj={class:"rgp-section-title"},Dj={class:"rgp-search-wrap"},Fj=["placeholder"],Uj={class:"rgp-toggle-row"},Bj={class:"rgp-commit-list"},qj={key:0,class:"rgp-empty"},zj={key:1,class:"rgp-empty"},Hj={key:2,class:"rgp-empty is-error"},Wj=["disabled","title","onClick"],Vj={class:"rgp-commit-top"},Gj=["title","onClick","onKeydown"],Kj={class:"rgp-commit-meta"},Yj={key:0,class:"rgp-branch-meta"},Jj={class:"rgp-commit-subject"},Qj={key:0,class:"rgp-empty"},Xj={key:3,class:"rgp-section"},Zj={class:"rgp-section-title"},e2=["title"],t2=["disabled"],n2={class:"rgp-commit-detail-subject"},o2={class:"rgp-file-list"},r2={key:0,class:"rgp-empty"},a2={key:1,class:"rgp-empty is-error"},s2=["title","onClick"],i2={class:"rgp-file-meta-row"},l2={class:"rgp-file-status"},u2={class:"rgp-file-delta"},c2={class:"rgp-added"},d2={class:"rgp-removed"},f2={class:"rgp-file-path"},p2={key:0,class:"rgp-file-previous-path"},h2={key:0,class:"rgp-empty"},m2=Nn({__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=S(null),s=S(""),a=S(""),l=S(""),f=S(""),m=S(""),g=S(""),w=S(!0),x=ee(()=>n.showReview!==!1),{buildFeedbackMailto:R,feedbackMailtoBase:L,recordVisibleFailure:B}=xp(),{t:Y}=Ar(),ae=L();function z(ne,re){B(re);const H=ne.currentTarget;H instanceof HTMLAnchorElement&&(H.href=R())}const Z=ee(()=>n.currentBranch?n.currentBranch:n.headSubject?n.headSubject:n.headSha?`${Y("Detached")} ${n.headSha}`:n.loading?Y("Loading branch..."):Y("Detached HEAD")),X=ee(()=>{var H;const ne=[n.headSha,n.headDate].filter(Boolean).join(" · "),re=((H=n.headSubject)==null?void 0:H.trim())??"";return re&&ne?`${re} (${ne})`:re||ne}),ye=ee(()=>n.busy||n.loading),Me=ee(()=>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."):"")),Se=ee(()=>n.error?"error":"info"),Fe=ee(()=>{const ne=s.value.trim().toLowerCase(),re=[...n.branches].sort((H,Be)=>H.isRemote===!0&&Be.isRemote!==!0?1:H.isRemote!==!0&&Be.isRemote===!0?-1:0);return ne?re.filter(H=>H.label.toLowerCase().includes(ne)||H.value.toLowerCase().includes(ne)):re}),pe=ee(()=>n.branches.find(ne=>ne.value===l.value)??null),Ue=ee(()=>{var ne;return((ne=pe.value)==null?void 0:ne.isRemote)===!0}),$e=ee(()=>l.value?`${l.value}\0${w.value?"with-reset-history":"without-reset-history"}`:""),he=ee(()=>$e.value?n.commitsByBranch[$e.value]||[]:[]),Te=ee(()=>he.value.find(ne=>ne.sha===f.value)??null),Ae=ee(()=>Te.value?n.commitFilesBySha[Te.value.sha]||[]:[]),Pe=ee(()=>{const ne=a.value.trim().toLowerCase(),re=he.value;return ne?re.filter(H=>H.sha.toLowerCase().includes(ne)||H.shortSha.toLowerCase().includes(ne)||H.subject.toLowerCase().includes(ne)||H.date.toLowerCase().includes(ne)):re});function De(ne){l.value=ne,f.value="",o("loadCommits",{branch:ne,includeResetHistory:w.value})}function Ye(){l.value&&o("loadCommits",{branch:l.value,includeResetHistory:w.value})}function He(ne){var H;const re=((H=n.headSha)==null?void 0:H.trim())??"";return re?ne.sha===re||ne.shortSha===re||ne.sha.startsWith(re):!1}function St(ne){return`${Y("Show")} ${ne.shortSha} ${Y("files")}`}function ct(ne){f.value=ne.sha,o("loadCommitFiles",ne.sha)}function Ge(ne){const re=ne.sha.trim()||ne.shortSha.trim();re&&(m.value=ne.sha,Dy(re).catch(()=>{m.value=""}))}function nt(){!l.value||!Te.value||Ue.value||o("resetBranchToCommit",{branch:l.value,sha:Te.value.sha})}function dt(ne){return typeof ne=="number"&&Number.isFinite(ne)?String(ne):"-"}function _t(ne){Te.value&&o("openCommitFile",{sha:Te.value.sha,path:ne})}function Tt(ne){n.headSha&&o("openCommitFile",{sha:n.headSha,path:ne})}function gt(){var re,H;const ne=(re=n.currentBranch)==null?void 0:re.trim();return ne||(((H=n.branches[0])==null?void 0:H.value)??"")}function se(){const ne=l.value||gt();ne&&(l.value=ne,o("loadCommits",{branch:ne,includeResetHistory:w.value}))}return Ps(()=>{se(),zt(()=>{var ne;return(ne=r.value)==null?void 0:ne.focus()})}),rt(()=>[n.currentBranch,n.branches.map(ne=>ne.value).join(`
63
+ `)],()=>{var Be;const ne=gt();if(!ne){l.value="",g.value="";return}const re=((Be=n.currentBranch)==null?void 0:Be.trim())??"",H=re!==g.value;g.value=re,(H||!l.value||!n.branches.some($=>$.value===l.value))&&(l.value=ne),l.value&&o("loadCommits",{branch:l.value,includeResetHistory:w.value})},{immediate:!0}),rt(he,ne=>{f.value&&(ne.some(re=>re.sha===f.value)||(f.value=""))}),(ne,re)=>(T(),A("div",ij,[x.value?(T(),A("button",{key:0,class:"rgp-review",type:"button",onClick:re[0]||(re[0]=H=>o("toggleReview"))},[xe(Rl,{class:"rgp-review-icon"}),d("span",lj,k(e.reviewOpen?v(Y)("Review Worktree Changes (Open)"):v(Y)("Review Worktree Changes")),1),d("span",uj,[d("span",cj,"+"+k(e.worktreeChangeSummary.addedLineCount),1),d("span",dj,"-"+k(e.worktreeChangeSummary.removedLineCount),1)])])):J("",!0),d("div",fj,[d("span",pj,k(e.detached?v(Y)("Detached HEAD"):v(Y)("Current branch")),1),d("span",hj,k(Z.value),1),X.value?(T(),A("span",mj,k(X.value),1)):J("",!0)]),Me.value?(T(),A("div",{key:1,class:Ke(["rgp-status",{"is-error":Se.value==="error"}])},[d("span",null,k(Me.value),1),Se.value==="error"?(T(),A("a",{key:0,class:"rgp-feedback",href:v(ae),onClick:re[1]||(re[1]=H=>z(H,Me.value))},k(v(Y)("Send feedback")),9,vj)):J("",!0)],2)):J("",!0),n.worktreeChanges.length>0?(T(),A("div",gj,[d("div",yj,k(n.worktreeChanges.length)+" "+k(n.worktreeChanges.length===1?v(Y)("file changed"):v(Y)("files changed")),1),d("div",wj,[(T(!0),A(ze,null,kt(n.worktreeChanges,H=>(T(),A("button",{key:`${H.status}:${H.previousPath??""}:${H.path}`,class:"rgp-file",type:"button",title:H.previousPath?`${H.previousPath} → ${H.path}`:H.path,onClick:Be=>Tt(H.path)},[d("span",_j,k(H.label),1),d("span",kj,k(H.path),1),H.previousPath?(T(),A("span",Cj,"← "+k(H.previousPath),1)):J("",!0)],8,bj))),128))])])):J("",!0),d("div",Tj,[d("div",Sj,k(v(Y)("Branches")),1),d("div",xj,[Nt(d("input",{ref_key:"searchInputRef",ref:r,"onUpdate:modelValue":re[2]||(re[2]=H=>s.value=H),class:"rgp-search",type:"text",placeholder:v(Y)("Search branches...")},null,8,Aj),[[an,s.value]])]),d("ul",Pj,[(T(!0),A(ze,null,kt(Fe.value,H=>(T(),A("li",{key:H.value,class:"rgp-branch-item"},[d("div",Ej,[d("button",{class:Ke(["rgp-branch-button",{"is-current":H.value===e.currentBranch,"is-selected":H.value===l.value}]),type:"button",disabled:ye.value,onClick:Be=>De(H.value)},[d("span",Rj,k(H.label),1),H.value===e.currentBranch?(T(),A("span",Mj,k(v(Y)("current")),1)):H.isRemote?(T(),A("span",$j,k(v(Y)("remote")),1)):J("",!0)],10,Ij),H.value===l.value&&H.value!==e.currentBranch&&!H.isRemote?(T(),A("button",{key:0,class:"rgp-branch-checkout",type:"button",disabled:ye.value,onClick:Be=>o("checkoutBranch",H.value)},k(v(Y)("Checkout")),9,jj)):J("",!0)])]))),128)),Fe.value.length===0?(T(),A("li",Nj,k(v(Y)("No branches found.")),1)):J("",!0)])]),d("div",Lj,[d("div",Oj,k(v(Y)("Commits")),1),d("div",Dj,[Nt(d("input",{"onUpdate:modelValue":re[3]||(re[3]=H=>a.value=H),class:"rgp-search",type:"text",placeholder:v(Y)("Search commits...")},null,8,Fj),[[an,a.value]])]),d("label",Uj,[Nt(d("input",{"onUpdate:modelValue":re[4]||(re[4]=H=>w.value=H),type:"checkbox",onChange:Ye},null,544),[[Jg,w.value]]),d("span",null,k(v(Y)("Reset-history refs")),1)]),d("div",Bj,[l.value?e.commitsLoadingFor===$e.value?(T(),A("div",zj,k(v(Y)("Loading commits...")),1)):e.commitsError?(T(),A("div",Hj,k(e.commitsError),1)):(T(),A(ze,{key:3},[(T(!0),A(ze,null,kt(Pe.value,H=>(T(),A("button",{key:H.sha,class:Ke(["rgp-commit",{"is-current":He(H),"is-selected":H.sha===f.value}]),type:"button",disabled:ye.value,title:St(H),onClick:Be=>ct(H)},[d("span",Vj,[d("span",{class:"rgp-ref",role:"button",tabindex:"0",title:m.value===H.sha?v(Y)("Copied commit ref"):`${v(Y)("Copy")} ${H.sha}`,onClick:Qe(Be=>Ge(H),["stop"]),onKeydown:[Pn(Qe(Be=>Ge(H),["prevent","stop"]),["enter"]),Pn(Qe(Be=>Ge(H),["prevent","stop"]),["space"])]},k(H.shortSha),41,Gj),d("span",Kj,[He(H)?(T(),A("span",Yj,k(v(Y)("current")),1)):J("",!0),d("span",null,k(H.date),1)])]),d("span",Jj,k(H.subject),1)],10,Wj))),128)),Pe.value.length===0?(T(),A("div",Qj,k(v(Y)("No commits found.")),1)):J("",!0)],64)):(T(),A("div",qj,k(v(Y)("Select a branch.")),1))])]),Te.value?(T(),A("div",Xj,[d("div",Zj,[d("span",{class:"rgp-ref",role:"button",tabindex:"0",title:m.value===Te.value.sha?v(Y)("Copied commit ref"):`${v(Y)("Copy")} ${Te.value.sha}`,onClick:re[5]||(re[5]=Qe(H=>Ge(Te.value),["stop"])),onKeydown:re[6]||(re[6]=Pn(Qe(H=>Ge(Te.value),["prevent","stop"]),["enter"]))},k(Te.value.shortSha),41,e2),d("button",{class:"rgp-reset-commit",type:"button",disabled:ye.value||Ue.value||!l.value,onClick:nt},k(v(Y)("Reset")),9,t2)]),d("p",n2,k(Te.value.subject),1),d("div",o2,[e.commitFilesLoadingFor===Te.value.sha?(T(),A("div",r2,k(v(Y)("Loading files...")),1)):e.commitFilesError?(T(),A("div",a2,k(e.commitFilesError),1)):(T(),A(ze,{key:2},[(T(!0),A(ze,null,kt(Ae.value,H=>(T(),A("button",{key:`${H.status}:${H.previousPath??""}:${H.path}`,class:"rgp-file",type:"button",title:H.previousPath?`${H.previousPath} → ${H.path}`:H.path,onClick:Be=>_t(H.path)},[d("span",i2,[d("span",l2,k(H.label),1),d("span",u2,[d("span",c2,"+"+k(dt(H.addedLineCount)),1),d("span",d2,"-"+k(dt(H.removedLineCount)),1)])]),d("span",f2,k(H.path),1),H.previousPath?(T(),A("span",p2,"← "+k(H.previousPath),1)):J("",!0)],8,s2))),128)),Ae.value.length===0?(T(),A("div",h2,k(v(Y)("No file changes.")),1)):J("",!0)],64))])])):J("",!0)]))}}),v2=At(m2,[["__scopeId","data-v-76cdff49"]]),g2={class:"right-files-panel"},y2={class:"rfp-toolbar"},w2=["placeholder"],b2={key:0,class:"rfp-empty"},_2={key:1,class:"rfp-empty is-error"},k2={key:2,class:"rfp-empty"},C2={key:3,class:"rfp-groups"},T2=["aria-expanded","onClick"],S2={class:"rfp-group-chevron","aria-hidden":"true"},x2={class:"rfp-group-name"},A2={class:"rfp-group-count"},P2={key:0,class:"rfp-group-body"},E2=["title","onClick"],I2={class:"rfp-file-label"},R2={class:"rfp-file-sub"},M2=Nn({__name:"RightFilesPanel",props:{cwd:{}},emits:["open-preview"],setup(e,{emit:t}){const n=e,o=t,{t:r}=Ar(),s=S([]),a=S(!1),l=S(""),f=S(""),m=S(new Set),g=ee(()=>{const B=f.value.trim().toLowerCase(),Y=B?s.value.filter(X=>X.relativePath.toLowerCase().includes(B)):s.value,ae=new Map,z=[];for(const X of Y){if(X.isDirectory)continue;const ye=X.relativePath.indexOf("/"),Me=ye<0?"":X.relativePath.slice(0,ye),Se=ye<0?X.relativePath:X.relativePath.slice(ye+1),Fe={path:X.path,relativePath:X.relativePath,label:Se.slice(Se.lastIndexOf("/")+1),sub:Se};if(Me){let pe=ae.get(Me);pe||(pe={name:Me,files:[]},ae.set(Me,pe)),pe.files.push(Fe)}else z.push(Fe)}const Z=[...ae.values()].sort((X,ye)=>X.name.localeCompare(ye.name));return z.length>0&&Z.unshift({name:"(root)",files:z}),Z});function w(B){return!m.value.has(B)}function x(B){const Y=new Set(m.value);Y.has(B)?Y.delete(B):Y.add(B),m.value=Y}function R(B){o("open-preview",{path:B.path,label:B.label})}async function L(){const B=n.cwd.trim();if(!B){s.value=[],l.value="";return}a.value=!0,l.value="";try{s.value=await fS(B)}catch(Y){s.value=[],l.value=Y instanceof Error?Y.message:"Failed to load workspace files"}finally{a.value=!1}}return Ps(()=>{L()}),rt(()=>n.cwd,()=>{m.value=new Set,f.value="",L()}),(B,Y)=>(T(),A("div",g2,[d("div",y2,[Nt(d("input",{"onUpdate:modelValue":Y[0]||(Y[0]=ae=>f.value=ae),class:"rfp-search",type:"text",placeholder:v(r)("Filter files...")},null,8,w2),[[an,f.value]])]),a.value?(T(),A("div",b2,k(v(r)("Loading files...")),1)):l.value?(T(),A("div",_2,k(l.value),1)):g.value.length===0?(T(),A("div",k2,k(v(r)("No files in workspace.")),1)):(T(),A("div",C2,[(T(!0),A(ze,null,kt(g.value,ae=>(T(),A("div",{key:ae.name,class:"rfp-group"},[d("button",{class:"rfp-group-header",type:"button","aria-expanded":w(ae.name),onClick:z=>x(ae.name)},[d("span",S2,k(w(ae.name)?"▾":"▸"),1),d("span",x2,k(ae.name),1),d("span",A2,k(ae.files.length),1)],8,T2),w(ae.name)?(T(),A("div",P2,[(T(!0),A(ze,null,kt(ae.files,z=>(T(),A("button",{key:z.path,class:"rfp-file",type:"button",title:z.relativePath,onClick:Z=>R(z)},[d("span",I2,k(z.label),1),d("span",R2,k(z.sub),1)],8,E2))),128))])):J("",!0)]))),128))]))]))}}),$2=At(M2,[["__scopeId","data-v-502fad21"]]),j2={class:"right-file-preview"},N2={class:"right-file-preview-header"},L2={class:"right-file-preview-title-wrap"},O2={class:"right-file-preview-title"},D2={class:"right-file-preview-path"},F2=["href"],U2={class:"right-file-preview-body"},B2={key:0,class:"right-file-preview-empty"},q2={key:1,class:"right-file-preview-empty is-error"},z2=["src","alt"],H2={key:3,class:"right-file-preview-code"},W2={key:4,class:"right-file-preview-empty"},V2=["href"],G2={key:0,class:"right-file-preview-footer"},K2=Nn({__name:"RightFilePreview",props:{filePath:{},name:{}},setup(e){const t=e,{t:n}=Ar(),o=S(null),r=S(!1),s=S(""),a=ee(()=>{const l=t.filePath.replace(/\\/g,"/"),f=l.startsWith("/")?l:`/${l}`;return`/codex-local-browse${encodeURI(f)}`});return rt(()=>t.filePath,async l=>{if(o.value=null,s.value="",!!l){r.value=!0;try{o.value=await pS(l)}catch(f){s.value=f instanceof Error?f.message:"Failed to preview file"}finally{r.value=!1}}},{immediate:!0}),(l,f)=>(T(),A("div",j2,[d("div",N2,[d("div",L2,[d("span",O2,k(e.name),1),d("span",D2,k(e.filePath),1)]),d("a",{class:"right-file-preview-open",href:a.value,target:"_blank",rel:"noopener noreferrer"},k(v(n)("Open in browser")),9,F2)]),d("div",U2,[r.value?(T(),A("div",B2,k(v(n)("Loading file…")),1)):s.value?(T(),A("div",q2,k(s.value),1)):o.value&&o.value.isImage?(T(),A("img",{key:2,class:"right-file-preview-image",src:a.value,alt:e.name},null,8,z2)):o.value&&o.value.isText&&o.value.content!==void 0?(T(),A("pre",H2,k(o.value.content),1)):(T(),A("div",W2,[d("p",null,k(v(n)("This file type cannot be previewed.")),1),d("a",{class:"right-file-preview-open",href:a.value,target:"_blank",rel:"noopener noreferrer"},k(v(n)("Open in browser")),9,V2)]))]),o.value&&o.value.truncated?(T(),A("div",G2,k(v(n)("File is large; showing the first part.")),1)):J("",!0)]))}}),Y2=At(K2,[["__scopeId","data-v-11e988a2"]]),J2={},Q2={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function X2(e,t){return T(),A("svg",Q2,[...t[0]||(t[0]=[d("circle",{cx:"11",cy:"11",r:"8"},null,-1),d("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const nv=At(J2,[["render",X2]]),Z2={},eN={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function tN(e,t){return T(),A("svg",eN,[...t[0]||(t[0]=[d("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[d("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"}),d("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const nN=At(Z2,[["render",tN]]),oN={},rN={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function aN(e,t){return T(),A("svg",rN,[...t[0]||(t[0]=[d("path",{d:"M5 7l5 5-5 5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),d("path",{d:"M12 17h7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])])}const sN=At(oN,[["render",aN]]),iN={},lN={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function uN(e,t){return T(),A("svg",lN,[...t[0]||(t[0]=[d("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 ov=At(iN,[["render",uN]]);function Fy(e){var r;const t=e.replace(/\r\n/g,`
64
+ `).trim();if(!t)return null;const n=[],o=[];for(const s of t.split(`
65
+ `)){const a=s.trim();if(!a){n.length===0&&o.push("");continue}const l=a.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(l){const f=(l[1]??" ").toLowerCase();let m="pending";f==="x"&&(m="completed"),(f==="~"||f===">"||f==="-")&&(m="inProgress"),n.push({step:((r=l[2])==null?void 0:r.trim())??"",status:m});continue}o.push(a)}if(n.length===0){const s=cN(t);return s||null}return{explanation:o.join(`
66
+ `).trim(),steps:n.filter(s=>s.step.length>0)}}function cN(e){var s,a;const t=[],n=[],o=[];for(const l of e.split(`
67
+ `)){const f=l.trim();if(!f){t.length===0&&n.length===0&&o.push("");continue}const m=f.match(/^\d+[.)]\s+(.+)$/);if(m){t.push({step:((s=m[1])==null?void 0:s.trim())??"",status:"pending"});continue}const g=f.match(/^[-*]\s+(.+)$/);if(g){n.push({step:((a=g[1])==null?void 0:a.trim())??"",status:"pending"});continue}o.push(f)}const r=t.length>0?t:n;return r.length===0?null:{explanation:dN(o.join(`
68
+ `)),steps:r.filter(l=>l.step.length>0)}}function dN(e){return e.split(`
69
+ `).map(t=>t.replace(/^\s*#{1,6}\s*/,"")).join(`
70
+ `).trim()}function rv(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}:Fy(e.text)}function fN(e){return new Promise(t=>{typeof window<"u"?window.setTimeout(t,e):globalThis.setTimeout(t,e)})}function Eo(e){return e.flatMap(t=>t.threads)}function pN(e,t){var o,r;const n=e.findIndex(s=>s.id===t);return n<0?"":((o=e[n+1])==null?void 0:o.id)??((r=e[n-1])==null?void 0:r.id)??""}const Uy="codex-web-local.thread-read-state.v1",av="codex-web-local.thread-unread-cutoff.v1",By="codex-web-local.thread-token-usage.v1",qy="codex-web-local.thread-reasoning.v1",zy="codex-web-local.thread-last-plan.v1",Hy="codex-web-local.live-reasoning-snapshot.v1",sv=8e3,hN=15*60*1e3,mN=1500,iv="codex-web-local.stashed-messages.v1",lv="codex-web-local.auto-compact-threshold.v1",bc=10,Wy="codex-web-local.thread-terminal-open.v1",qf="codex-web-local.selected-thread-id.v1",zf="codex-web-local.selected-model-by-context.v1",Vy="codex-web-local.selected-model-id.v1",Gy="codex-web-local.project-order.v1",Ky="codex-web-local.project-display-name.v1",Hf="codex-web-local.collaboration-mode-by-context.v1",vN="codex-web-local.collaboration-mode.v1",ri="__new-thread__",Yy="__new-thread-provider__::",_c=220,gN=1e4,yN=500,wN=3e3,uv=2e3,bN=2e3,_N=2e3,kN=dy,dl="__global__",ma="gpt-5.4-mini",CN="big-pickle",cv="Codex CLI not found. Install @openai/codex or set CODEXUI_CODEX_COMMAND.",TN=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 dv(e){return(e instanceof Error?e.message:String(e??"")).includes("Codex CLI is not available")}function SN(e){if(e instanceof ka&&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 xN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Uy);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function fv(e){typeof window>"u"||window.localStorage.setItem(Uy,JSON.stringify(e))}function AN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(qy);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function kc(e){if(!(typeof window>"u")){try{window.localStorage.setItem(qy,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e))t&&n.length>0&&PS(t,n)}}function PN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(zy);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function pv(e){if(!(typeof window>"u"))try{window.localStorage.setItem(zy,JSON.stringify(e))}catch{}}function EN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Hy);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 s=r;typeof(s==null?void 0:s.text)=="string"&&s.text.trim()&&typeof s.ts=="number"&&(n[o]={text:s.text,ts:s.ts})}return n}catch{return{}}}function IN(){if(typeof window>"u")return"";const e=window.localStorage.getItem(av);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(av,t),t}function RN(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 MN(e,t,n){return RN(e,t??n)}function Jy(e){return e==="plan"?"plan":"default"}function Ml(e){return typeof e=="string"?e.trim():""}function wa(){return Object.create(null)}function Nc(e){const t=wa();for(const[n,o]of Object.entries(e))t[n]=o;return t}function bu(e,t){if(!(t in e))return e;const n=wa();for(const[o,r]of Object.entries(e))o!==t&&(n[o]=r);return n}function hv(e,t){let n=!1;const o=wa();for(const[r,s]of Object.entries(e)){if(r===ri||r.startsWith(Yy)||t.has(r)){o[r]=s;continue}n=!0}return n?o:e}function Zs(e){const t=e.trim().toLowerCase().replace(/_/g,"-");return!t||t==="openai"?"codex":t}function $N(e){return e===ri}function Cc(e){const t=Zs(e);return t?`${Yy}${t}`:""}function Di(e){return e.trim()||ri}function jN(){if(typeof window>"u")return wa();try{const n=window.localStorage.getItem(zf);if(n){const o=JSON.parse(n);if(!o||typeof o!="object"||Array.isArray(o))return wa();const r=wa();for(const[s,a]of Object.entries(o)){if(typeof s!="string"||s.length===0)continue;const l=Ml(a);l&&(r[s]=l)}return r}}catch{}const e=Ml(window.localStorage.getItem(Vy)),t=wa();return e&&(t[ri]=e),t}function mv(e,t){const n=Di(t),o=Ml(e[n]);return o||Ml(e[ri])}function Tc(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(zf):window.localStorage.setItem(zf,JSON.stringify(e)),window.localStorage.removeItem(Vy)}catch{}}function NN(){if(typeof window>"u")return wa();try{const e=window.localStorage.getItem(Hf);if(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return wa();const n=wa();for(const[o,r]of Object.entries(t)){if(typeof o!="string"||o.length===0)continue;const s=Jy(r);s==="plan"&&(n[o]=s)}return n}}catch{}return wa()}function Sc(e,t){const n=Di(t);return Jy(e[n])}function vv(e,t,n){const o=Di(t);if($N(o))return bu(e,o);if(n==="plan"){const r=Nc(e);return r[o]="plan",r}return bu(e,o)}function mf(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Hf):window.localStorage.setItem(Hf,JSON.stringify(e)),window.localStorage.removeItem(vN)}catch{}}function Qy(e,t,n){return Math.min(Math.max(e,t),n)}function vl(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 gv(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:vl(t.totalTokens)??0,inputTokens:vl(t.inputTokens)??0,cachedInputTokens:vl(t.cachedInputTokens)??0,outputTokens:vl(t.outputTokens)??0,reasoningOutputTokens:vl(t.reasoningOutputTokens)??0}}function LN(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=gv(t.total),o=gv(t.last);if(!n||!o)return null;const r=vl(t.modelContextWindow),s=o.totalTokens,a=typeof r=="number"?Math.max(r-s,0):null,l=typeof r=="number"&&r>0?Qy(Math.round((a??0)/r*100),0,100):null;return{total:n,last:o,modelContextWindow:r,currentContextTokens:s,remainingContextTokens:a,remainingContextPercent:l}}function ON(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(By);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 s=LN(r);s&&(n[o]=s)}return n}catch{return{}}}function yv(e){typeof window>"u"||window.localStorage.setItem(By,JSON.stringify(e))}function DN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Wy);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 FN(e){typeof window>"u"||window.localStorage.setItem(Wy,JSON.stringify(e))}function UN(){return typeof window>"u"?"":window.localStorage.getItem(qf)??""}function BN(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(qf);return}window.localStorage.setItem(qf,e)}}function qN(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Gy);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=Kr(o);r.length>0&&!n.includes(r)&&n.push(r)}return n}catch{return[]}}function iu(e){typeof window>"u"||window.localStorage.setItem(Gy,JSON.stringify(e))}function zN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ky);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 s=typeof o=="string"?Kr(o):"";s.length>0&&typeof r=="string"&&(n[s]=r)}return n}catch{return{}}}function wv(e){typeof window>"u"||window.localStorage.setItem(Ky,JSON.stringify(e))}function fl(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 ws(e,n)?e:n}function vf(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 ws(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 HN(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 WN(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function VN(e=[],t=[]){var n,o,r,s;if(e.length!==t.length)return!1;for(let a=0;a<e.length;a+=1)if(((n=e[a])==null?void 0:n.step)!==((o=t[a])==null?void 0:o.step)||((r=e[a])==null?void 0:r.status)!==((s=t[a])==null?void 0:s.status))return!1;return!0}function GN(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&VN(e.steps,t.steps)}function xc(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 Wf(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&ws(e.images,t.images)&&KN(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&WN(e.commandExecution,t.commandExecution)&&GN(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function gl(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 bv(e,t,n={}){const o=new Map(e.map(g=>[g.id,g])),r=new Map(t.map(g=>[g.id,g])),s=t.map(g=>{const w=o.get(g.id);return w&&Wf(w,g)?w:g});if(n.preserveMissing!==!0)return gl(e,s)?e:s;const a=e.map(g=>{const w=r.get(g.id);return!w||Wf(g,w)?g:w}).filter(g=>!Ap(g)||!JN(g,t)),l=new Set(e.map(g=>g.id)),f=s.filter(g=>!l.has(g.id)),m=[...a,...f];return gl(e,m)?e:m}function KN(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 $l(e){return e.replace(/\s+/gu," ").trim()}function Ap(e){return e.messageType==="userMessage.optimistic"}function YN(e){return e.some(Ap)}function JN(e,t){if(e.role!=="user")return!1;const n=$l(e.text),o=Array.isArray(e.images)?e.images:[],r=Array.isArray(e.fileAttachments)?e.fileAttachments.length:0,s=Array.isArray(e.skills)?e.skills.length:0;return t.some(a=>{if(a===e||a.role!=="user"||Ap(a))return!1;const l=$l(a.text),f=Array.isArray(a.images)?a.images:[],m=Array.isArray(a.fileAttachments)?a.fileAttachments.length:0,g=Array.isArray(a.skills)?a.skills.length:0;return l===n&&ws(f,o)&&m===r&&g===s})}function QN(e,t){const n=new Set(t.map(s=>s.id)),o=new Set(t.filter(s=>s.role==="assistant").map(s=>$l(s.text)).filter(s=>s.length>0));if(o.size===0)return e;const r=e.filter(s=>{if(s.messageType!=="agentMessage.live")return!0;if(n.has(s.id))return!1;const a=$l(s.text);return a.length===0?!1:!o.has(a)});return r.length===e.length?e:r}function Ac(e,t){const n=e.findIndex(s=>s.id===t.id);if(n<0)return[...e,t];const o=e[n];if(Wf(o,t))return e;const r=[...e];return r.splice(n,1,t),r}const Xy="worked";function Js(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function XN(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,s=[];n>0&&s.push(`${n}h`),(o>0||n>0)&&s.push(`${o}m`);const a=r>0||s.length===0?r:0;return s.push(`${a}s`),s.join(" ")}function ZN(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function eL(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 tL(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${XN(e.durationMs)}`,messageType:Xy,turnId:e.turnId,durationMs:e.durationMs}}function nL(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function oL(e,t){const n=tL(t),o=e.filter(a=>a.messageType!==Xy),r=nL(o);if(r<0)return[...o,n];const s=[...o];return s.splice(r,0,n),s}function Ct(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function rL(e,t){if(t.size===0)return e;let n=!1;const o={};for(const[r,s]of Object.entries(e)){if(t.has(r)){n=!0;continue}o[r]=s}return n?o:e}function aL(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 sL(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 iL(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 Cn(e,t){const n=Object.entries(e).filter(([o])=>t.has(o));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function _v(e,t){const n=t.trim();if(!n)return e;let o=!1;const r=[];for(const s of e){const a=s.threads.filter(f=>f.id!==n),l=a.length!==s.threads.length;l&&(o=!0),a.length>0?r.push(l?{...s,threads:a}:s):s.threads.length===0&&r.push(s)}return o?r:e}function Pc(e,t){const n=new Map(e.map(r=>[r.projectName,r])),o=t.map(r=>{const s=n.get(r.projectName),a=new Map((s==null?void 0:s.threads.map(f=>[f.id,f]))??[]),l=r.threads.map(f=>{const m=a.get(f.id);return m&&aL(m,f)?m:f});return s&&s.projectName===r.projectName&&sL(s.threads,l)?s:{projectName:r.projectName,threads:l}});return iL(e,o)?e:o}function lL(e,t,n){const o=new Set(Eo(t).map(l=>l.id)),r=Eo(e).filter(l=>n[l.id]===!0&&!o.has(l.id));if(r.length===0)return t;const s=new Map(t.map(l=>[l.projectName,l])),a=t.map(l=>({projectName:l.projectName,threads:[...l.threads]}));for(const l of r){if(s.get(l.projectName)){const m=a.findIndex(g=>g.projectName===l.projectName);m>=0&&(a[m]={projectName:a[m].projectName,threads:[l,...a[m].threads]});continue}a.push({projectName:l.projectName,threads:[l]})}return a}function qi(e){return Kr(e)}function uL(e){const t=e.trim();if(!t)return"";const n=t.lastIndexOf(":");return n>=0?t.slice(n+1):t}function cL(e){const t=e.label||Kr(e.remotePath),n=uL(e.hostId);return n?`${t} ${n}`:t}function Zy(e){const t=(e==null?void 0:e.remoteProjects)??[];return new Map(t.map(n=>[n.id,n]))}function md(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=Zy(e);return md(e).map(o=>{if(n.has(o))return o;const r=st(o).trim(),s=qi(r);return t.has(s)?r:s})}function Lc(e,t){return st(e).trim()===t||qi(e)===t}function dL(e,t){const n=new Set;for(const o of e.order)Lc(o,t)&&n.add(o);for(const o of e.active)Lc(o,t)&&n.add(o);for(const o of Object.keys(e.labels))Lc(o,t)&&n.add(o);return n}function fL(e,t,n){var m,g;const o=new Set((e.remoteProjects??[]).map(w=>w.id)),r=new Map;for(const w of e.order){const x=qi(w);r.has(x)||r.set(x,w)}for(const w of n){const x=((g=(m=w.threads[0])==null?void 0:m.cwd)==null?void 0:g.trim())??"";x&&r.set(w.projectName,x)}const s=[],a=w=>{w&&!s.includes(w)&&s.push(w)};for(const w of t){if(o.has(w)){a(w);continue}const x=r.get(w);x&&a(x)}for(const w of md(e))a(w);const l=s.filter(w=>e.order.includes(w));for(const w of e.order)l.includes(w)||l.push(w);const f=e.active.filter(w=>l.includes(w));return f.length===0&&l.length>0&&f.push(l[0]),{order:l,active:f,projectOrder:s}}function pL(e,t,n){const o=Vf(t,n);if(o.length===0)return e;const r=new Map(o.map((s,a)=>[s,a]));return[...e].sort((s,a)=>{if(Yf(s)||Yf(a))return 0;const l=r.get(s.projectName)??Number.POSITIVE_INFINITY,f=r.get(a.projectName)??Number.POSITIVE_INFINITY;return l===f?0:l-f})}function Gf(e,t){const n=new Map,o=new Map,r=a=>{const l=st(a).trim();if(!l)return;const f=Kr(l),m=n.get(f)??new Set;m.add(l),n.set(f,m)};for(const a of(t==null?void 0:t.order)??[]){const l=st(a).trim();if(!l)continue;const f=Kr(l);Jc(l)||o.set(f,(o.get(f)??0)+1),r(a)}for(const a of e)for(const l of a.threads){const f=st(l.cwd).trim(),m=Kr(f),g=(t==null?void 0:t.order.some(w=>st(w).trim()===f))===!0;Jc(f)&&!g&&o.get(m)===1||r(l.cwd)}const s=new Set;for(const[a,l]of n.entries())l.size>1&&s.add(a);return s}function Jc(e){return e.includes("/.codex/worktrees/")}function hL(e,t){const n=Gf(e,t);if(n.size===0)return e;const o=new Set,r=new Set,s=new Map,a=new Set;for(const m of(t==null?void 0:t.order)??[]){const g=st(m).trim();if(!g||(a.add(g),Jc(g)))continue;const w=Kr(g);o.has(w)?(o.delete(w),r.add(w),s.delete(w)):r.has(w)||(o.add(w),s.set(w,g))}const l=[],f=new Map;for(const m of e)for(const g of m.threads){const w=st(g.cwd).trim(),x=Kr(w),R=a.has(w),L=Jc(w)&&!R&&o.has(x);let B=m.projectName;L&&n.has(x)?B=s.get(x)??m.projectName:w&&n.has(x)&&(B=w);const Y=g.projectName===B?g:{...g,projectName:B},ae=f.get(B);if(ae)ae.threads.push(Y);else{const z={projectName:B,threads:[Y]};f.set(B,z),l.push(z)}}return l}function mL(e,t,n){if(!t||t.order.length===0&&(t.remoteProjects??[]).length===0)return e;const o=new Set(e.map(a=>a.projectName)),r=[...e],s=Zy(t);for(const a of md(t)){if(s.has(a)){if(o.has(a))continue;r.push({projectName:a,threads:[]}),o.add(a);continue}const l=st(a).trim();if(!l)continue;const f=qi(l),m=n.has(f)?l:f;o.has(m)||(r.push({projectName:m,threads:[]}),o.add(m))}return r}const Kf=20;function Qs(e){const t=e.split(`
71
+ `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,Kf):"Untitled thread"}function vL(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function Yf(e){return e.threads.some(t=>t.cwd.trim().length===0||Kc(t.cwd))}const oi=new Map;let Oc=0;function gf(e,t){const n=`${e}:${t.id}`,o=oi.get(n);return o!==void 0?o:(Oc+=1,oi.set(n,Oc),Oc)}function gL(e){const t=`${e}:`;for(const n of[...oi.keys()])n.startsWith(t)&&oi.delete(n)}function kv(e,t){const n=t.trim();if(!n)return-1;const o=e.findIndex(l=>l.id===n);if(o>=0)return o;const r=`session-cmd-${n}`,s=e.findIndex(l=>l.id===r);if(s>=0)return s;const a="session-cmd-";if(n.startsWith(a)){const l=e.findIndex(f=>f.id===n.slice(a.length));if(l>=0)return l}return-1}function yL(e,t){var s,a;if(t.length===0)return e;const n=[...e],o=[],r=new Map;for(const l of t){const f=((s=l.reasoningAnchorMessageId)==null?void 0:s.trim())??"";if(f&&kv(n,f)>=0)continue;const m=l.turnIndex;if(typeof m!="number"||!Number.isFinite(m))continue;const g=r.get(m)??[];g.push(l),r.set(m,g)}for(const l of[...t].reverse()){const f=((a=l.reasoningAnchorMessageId)==null?void 0:a.trim())??"";if(f){const L=kv(n,f);if(L>=0){n.splice(L+1,0,l);continue}}const m=l.turnIndex;if(typeof m!="number"||!Number.isFinite(m)){o.push(l);continue}let g=-1,w=-1;const x=[];for(let L=0;L<n.length;L+=1)n[L].turnIndex===m&&(w=L,n[L].role==="user"?g=L:n[L].messageType!=="reasoning"&&x.push(L));if(x.some(L=>{const B=n[L].messageType;return B==="commandExecution"||B==="toolCall"||B==="fileChange"||B==="worked"})){const B=(r.get(m)??[]).indexOf(l),Y=B>=0?B:0;n.splice(x[Math.min(Y,x.length-1)]+1,0,l)}else g>=0?n.splice(g+1,0,l):w>=0?n.splice(w+1,0,l):o.push(l)}return o.length>0?[...n,...o.reverse()]:n}function wL(e,t,n){const o=new Set(n.map(a=>a.id)),r=new Map;for(const a of t)for(const l of a)o.has(l.id)||r.has(l.id)||r.set(l.id,l);const s=Array.from(r.values());for(const a of s)gf(e,a);return s.sort((a,l)=>gf(e,a)-gf(e,l))}function bL(e,t,n,o,r){const s=wL(e,o,t),a=[...t,...s];return[...yL(a,n),...r]}function _L(){const e=S([]),t=S([]),n=S(UN()),o=S({}),r=S({}),s=S(PN()),a=S({}),l=S({}),f=S(AN()),m=S({}),g=new Map,w=new Map,x=new Map,R=new Map,L=S({}),B=S({}),Y=S({});let ae=EN(),z=!1,Z=null;function X(){Z===null&&(Z=setTimeout(()=>{if(Z=null,z&&(z=!1,typeof window<"u"))try{window.localStorage.setItem(Hy,JSON.stringify(ae))}catch{}z&&X()},mN))}function ye(i,c){if(!i||Y.value[i]!==!0)return;const h=c.length>sv?c.slice(-sv):c;ae[i]={text:h,ts:Date.now()},z=!0,X()}function Me(i){var b;if(!i||((b=m.value[i])==null?void 0:b.trim()))return;const h=ae[i];h!=null&&h.text&&(Date.now()-h.ts>hN||(m.value={...m.value,[i]:h.text}))}function Se(i){i&&i in ae&&(delete ae[i],z=!0,X())}const Fe=S({}),pe=S({}),Ue=S({}),$e=S(jn()),he=S(cs());let Te=!1,Ae=!1;const Pe=S({}),De=S([]),Ye=S({}),He=S({}),St=S([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),ct=S(NN()),Ge=S(jN()),nt=S(Sc(ct.value,n.value)),dt=S(mv(Ge.value,n.value)),_t=S("medium"),Tt=S("standard"),gt=S(""),se=S(""),ne=S(xN()),re=S(IN()),H=S(qN()),Be=S(zN()),$=S({}),D=S({}),G=S({}),ie=S({}),le=S({}),oe=S({}),Ce=S({}),we=S({}),ve=S({}),ce=S({}),Ee=S({}),be=S({}),Oe=S({}),Re=S({}),Ve=S({}),it=S({}),yt=S({}),It=S(null),Ze=S(ON()),Wt=S(DN()),W=S({}),K=S({}),Q=S([]),de=S([]),Le=S([]),We=S(!1),ot=S(!1),Ft=S(!1),Vt=S(!1),Bn=S(!1),Jo=S(!1),vo=S(!1),Qn=S(!1),go=S(new Set),Qo=6e4,dr=S([]);let gn="";const mt=S(""),nn=S(!1),Xn=S(!1);function Aa(i){var c;try{const h=new URL(i,"http://localhost");return h.pathname!=="/codex-local-image"?"":((c=h.searchParams.get("path"))==null?void 0:c.trim())??""}catch{return""}}function Es(i){const c=i.trim().toLowerCase();return c?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(c):!1}function xt(i){var h;const c=o.value[i]??[];for(let b=c.length-1;b>=0;b-=1){const E=c[b];if(!(E.role!=="user"||!Array.isArray(E.images)||E.images.length===0))for(let P=E.images.length-1;P>=0;P-=1){const N=((h=E.images[P])==null?void 0:h.trim())??"";if(N&&Aa(N))return N}}return""}let Gt=null,ht=null,Xo=null;const sn=new Map;let fr=null;const yo=new Map;let Ln=null,pr=null,Pa=0,Ja=!1,Kn=!1,In=0,Qa="",Zn=null,yn=!1,Qr=!1;const Xt=new Set,Xr=new Map,Ea=new Map;let wo=null,$o=null,jo=!1,Lt=!1,Rt=[],Yn=null,bo=!1,eo=!1;const qn=new Map,On=new Set,No=ee(()=>Eo(e.value)),hr=ee(()=>No.value.find(i=>i.id===n.value)??null),Zr=ee(()=>{const i=n.value;return!!(i&&Wt.value[i]===!0)}),Ia=ee(()=>{const i=n.value;return i?be.value[i]===!0:!1}),Pr=ee(()=>{const i=[],c=n.value;return c&&Array.isArray(it.value[c])&&i.push(...it.value[c]),Array.isArray(it.value[dl])&&i.push(...it.value[dl]),i.sort((h,b)=>h.receivedAtIso.localeCompare(b.receivedAtIso))}),Er=ee(()=>{const i=n.value;return i?Ee.value[i]??"":""}),Xa=ee(()=>{var q;const i=n.value;if(!i)return null;const c=Y.value[i]===!0,h=c?we.value[i]:void 0,b=c?(m.value[i]??"").trim():"",E=(((q=ce.value[i])==null?void 0:q.message)??"").trim();let P="";if(!c&&E){const te=o.value[i]??[];for(let me=te.length-1;me>=0;me-=1){const je=te[me];if(je.messageType==="turnError"){P=$l(je.text);break}}}const N=!c&&E&&P===E?"":E;return!c&&!h&&!b&&!N?null:{activityLabel:(h==null?void 0:h.label)||"Thinking",activityDetails:(h==null?void 0:h.details)??[],reasoningText:b,errorText:N}}),Ra=ee(()=>It.value),to=ee(()=>{const i=n.value;return i?Ze.value[i]??null:null}),_o=ee(()=>{const i=n.value;if(!i)return[];const c=o.value[i]??[],h=r.value[i]??[],b=a.value[i]??[],E=L.value[i]??[],P=B.value[i]??[],N=l.value[i]??[],q=f.value[i]??[],te=c.some(ut=>ut.messageType==="compaction.done"),me=go.value.has(i),je=te&&!me?N.filter(ut=>ut.messageType!=="compaction.pending"&&ut.messageType!=="compaction.done"):N,Je=bL(i,c,q,[h,E,P,b],je),pt=Ce.value[i];return pt?oL(Je,pt):Je}),no=ee(()=>{const i=n.value;return i?Ve.value[i]??null:null}),wt=ee(()=>{const i=n.value;return i?G.value[i]===!0:!1}),Rn=ee(()=>{const i=n.value;return i?ie.value[i]===!0:!1});function zn(i){var h;const c=o.value[i]??[];for(const b of c){const E=((h=b.turnId)==null?void 0:h.trim())??"";if(E)return E}return""}function ln(i){if(Di(i)===ri){const h=Zs(gt.value),b=Cc(h),E=b?Ml(Ge.value[b]):"";if(E)return E}return mv(Ge.value,i).trim()}function oo(i){const c=i.trim();return Zs(c?W.value[c]??gt.value:gt.value)}function Zo(i){return Ye.value[i.trim()]??kN}function mr(i,c=_t.value){const h=i.trim(),b=Zo(h);if(c&&b.includes(c))return c;if(b.includes("medium"))return"medium";const E=He.value[h];return E&&b.includes(E)?E:b[0]??""}function Jn(i){_t.value=mr(i)}function Mt(i){const c={},h={};for(const b of i)b.supportedReasoningEfforts!==null&&(c[b.id]=[...b.supportedReasoningEfforts]),b.defaultReasoningEffort&&(h[b.id]=b.defaultReasoningEffort);Ye.value=c,He.value=h}function wn(...i){const c=[...De.value];for(const h of i){const b=h.trim();b&&!c.includes(b)&&c.push(b)}ws(De.value,c)||(De.value=c)}function Kt(i){const c=i.trim();return De.value.length===0||c&&De.value.includes(c)?c:De.value[0]??""}function bn(i,c={}){n.value!==i&&(n.value=i,c.persist!==!1&&BN(i),dt.value=Kt(ln(i)),Jn(dt.value),nt.value=Sc(ct.value,i),eo=!1)}function Sn(i,c){const h=c.trim(),b=Di(i),E=Zs(gt.value),P=b===ri?Cc(E):"",N=P||b;if(h){const q=Nc(Ge.value);q[N]=h,P&&delete q[b],Ge.value=q}else{let q=bu(Ge.value,N);P&&(q=bu(q,b)),Ge.value=q}b===Di(n.value)?(dt.value=ln(n.value),wn(dt.value),Jn(dt.value)):wn(h),Tc(Ge.value)}function ro(i){Sn(n.value,i)}function ao(i,c){const h=i.trim();if(!h)return;const b=c.trim();if(b){const E=Nc(Ge.value);E[h]=b,Ge.value=E}else Ge.value=bu(Ge.value,h);wn(b),n.value===h&&(dt.value=ln(n.value),Jn(dt.value)),Tc(Ge.value)}function ea(i,c){const h=i.trim();if(!h)return;const b=Zs(c);b?W.value={...W.value,[h]:b}:W.value[h]&&(W.value=Ct(W.value,h))}function Mn(i,c,h){const b=c.trim();if(Zs(h)!=="opencode-zen")return b;const P=ln(i).trim();return P&&!/^gpt-/i.test(P)?P:b&&!/^gpt-/i.test(b)?b:CN}function Za(i,c){const h=i.trim();if(!h)return;if(!c){if(!(h in Ze.value))return;Ze.value=Ct(Ze.value,h),yv(Ze.value);return}const b=Ze.value[h];if(b&&JSON.stringify(b)===JSON.stringify(c))return;Ze.value={...Ze.value,[h]:c},yv(Ze.value);const E=$e.value[h];E&&E.length>0&&he.value>0&&(c.remainingContextPercent!==null&&c.remainingContextPercent<=he.value?go.value.has(h)||Wl(h):_i(h))}function Hn(i){const c=i==="plan"?"plan":"default",h=Di(n.value);Sc(ct.value,n.value)===c&&nt.value===c||(nt.value=c,ct.value=vv(ct.value,h,c),mf(ct.value))}function Lo(i,c){const h=c==="plan"?"plan":"default";ct.value=vv(ct.value,i,h),i.trim()===n.value&&(nt.value=h),mf(ct.value)}function vr(i){It.value=i}async function ko(i=n.value){i.trim()?ao(i,ma):ro(ma),wn(ma)}function Ir(i,c){yt.value={...yt.value,[i]:c}}function ta(i){yt.value[i]&&(yt.value=Ct(yt.value,i))}async function Oo(i){if(On.has(i))return;const c=yt.value[i];if(!(!c||c.fallbackRetried)){On.add(i),Ir(i,{...c,fallbackRetried:!0});try{await ko(i);try{const h=await rf(i,1);yr(i,h),br(i),ja(i,[]),wr(i),L.value[i]&&(L.value=Ct(L.value,i))}catch{}if(en(i,null),mt.value="",Yt(i,null),Jt(i,{label:"Thinking",details:so(ma,c.effort,c.collaborationMode)}),hn(i,!0),le.value[i]!==!0){const h=await of(i);h.model&&ao(i,Mn(i,h.model,h.modelProvider)),h.modelProvider&&ea(i,h.modelProvider),le.value={...le.value,[i]:!0}}await af(i,c.text,c.imageUrls,ma,c.effort||void 0,c.skills.length>0?c.skills:void 0,c.fileAttachments,c.collaborationMode),Ma(),Xt.add(i),await zr()}catch(h){const b=h instanceof Error?h.message:"Unknown application error";en(i,b),mt.value=b,hn(i,!1),Jt(i,null)}finally{On.delete(i)}}}function fn(i){i&&!Zo(dt.value).includes(i)||(_t.value=i)}async function $t(i){const c=i==="fast"?"fast":"standard";if(vo.value||Tt.value===c)return;const h=Tt.value;Tt.value=c,vo.value=!0,mt.value="";try{await B1(c)}catch(b){Tt.value=h,mt.value=b instanceof Error?b.message:"Failed to update Fast mode"}finally{vo.value=!1}}async function Do(){try{const i=await J1();St.value=i,i.some(c=>c.value===nt.value)||Hn("default")}catch{}}function so(i,c,h=nt.value){const b=i.trim()||"default",E=c||"default",P=h==="plan"?"Plan":"Default",N=Tt.value==="fast"?"Fast":"Standard";return[`Mode: ${P}`,`Model: ${b}`,`Thinking: ${E}`,`Speed: ${N}`]}async function Rr(i){se.value="";try{const c=await Ty(),h=c.model.trim(),b=Zs(c.providerId);gt.value=b;const E=oo(n.value),P=E!=="codex",N=ln(n.value),q=await Cy({includeProviderModels:P||(i==null?void 0:i.includeProviderModels)!==!1,requireProviderModels:P,providerId:P?E:void 0}),te=q.map(ut=>ut.id);Mt(q);const me=Cc(E),je=me?Ml(Ge.value[me]):"",Je=[...te];!(i!=null&&i.providerChanged)&&P&&E===b&&h&&!Je.includes(h)&&Je.push(h),De.value=Je;const pt=N&&te.includes(N);if(!N||!pt||i!=null&&i.providerChanged?i!=null&&i.providerChanged&&Je.length>0?je&&te.includes(je)?ro(je):E===b&&h&&Je.includes(h)?ro(h):ro(Je[0]):E===b&&h&&Je.includes(h)?ro(c.model):Je.length>0?ro(Je[0]):ro(""):dt.value.trim()!==N&&ro(N),me&&dt.value.trim().length>0){const ut=Nc(Ge.value);ut[me]=dt.value.trim();const Et=Cc(b);Et&&Et!==me&&h&&(ut[Et]=h),Ge.value=ut,Tc(Ge.value)}_t.value=mr(dt.value,c.reasoningEffort),Tt.value=c.speedMode}catch(c){dv(c)?se.value=cv:se.value=""}}async function _n(){if(Zn){await Zn;return}Zn=(async()=>{try{const i=await C1();vr(i),de.value=i?[i]:[]}catch{}finally{Zn=null}})(),await Zn}function Ma(){if(typeof window>"u"){_n();return}Xo!==null&&window.clearTimeout(Xo),Xo=window.setTimeout(()=>{Xo=null,_n()},yN)}function I(i){if(!i||typeof window>"u")return;const c=sn.get(i);c!==void 0&&(window.clearTimeout(c),sn.delete(i))}function O(i){if(!i||typeof window>"u")return;I(i);const c=window.setTimeout(()=>{sn.delete(i),Xt.add(i),zr()},wN);sn.set(i,c)}function V(i){const c=K.value;return Object.keys(c).length===0?i.map(h=>({projectName:h.projectName,threads:h.threads.map(b=>({...b,title:Qs(b.title)}))})):i.map(h=>({projectName:h.projectName,threads:h.threads.map(b=>{const E=c[b.id];return{...b,title:Qs(E??b.title)}})}))}function ge(i){return i?Array.isArray(it.value[i])?it.value[i]:[]:[]}function et(i){return i==="item/commandExecution/requestApproval"||i==="item/fileChange/requestApproval"||i==="item/permissions/requestApproval"||i==="execCommandApproval"||i==="applyPatchApproval"}function Ut(i){return i.some(c=>et(c.method))?"approval":i.length>0?"response":null}function jt(){const c=V(t.value).map(h=>({projectName:h.projectName,threads:h.threads.map(b=>{const E=Fe.value[b.id]??b.externalSession??null,P=Y.value[b.id]===!0||(E==null?void 0:E.active)===!0,N=Ut(ge(b.id)),q=n.value===b.id,te=Pe.value[b.id]===!0,me=MN(b.updatedAtIso,ne.value[b.id],re.value);return{...b,inProgress:P,unread:!q&&!P&&(te||me),pendingRequestState:N,...E?{externalSession:E}:{}}})}));e.value=Pc(e.value,c)}function pn(i,c,h){const b=new Date().toISOString(),E=st(c),P=Kr(E),N={id:i,title:Qs(h),projectName:P,cwd:E,hasWorktree:E.includes("/.codex/worktrees/")||E.includes("/.git/worktrees/"),createdAtIso:b,updatedAtIso:b,preview:h,unread:!1,inProgress:!1},q=t.value.findIndex(me=>me.projectName===P);if(q>=0){const je=t.value[q].threads.filter(ut=>ut.id!==i),Je={projectName:P,threads:[N,...je]},pt=[...t.value];pt.splice(q,1,Je),t.value=pt}else t.value=[{projectName:P,threads:[N]},...t.value];const te=fl(H.value,t.value);ws(H.value,te)||(H.value=te,iu(H.value)),jt()}function io(i){const c=new Set(i.map(te=>te.id)),h=n.value.trim();h&&c.add(h);const b=hv(Ge.value,c);b!==Ge.value&&(Ge.value=b,dt.value=Kt(ln(n.value)),Tc(b));const E=hv(ct.value,c);E!==ct.value&&(ct.value=E,nt.value=Sc(E,n.value),mf(E));const P=Cn(ne.value,c);if(P!==ne.value&&(ne.value=P,fv(P)),D.value=Cn(D.value,c),$.value=Cn($.value,c),le.value=Cn(le.value,c),oe.value=Cn(oe.value,c),o.value=Cn(o.value,c),a.value=Cn(a.value,c),m.value=Cn(m.value,c),L.value=Cn(L.value,c),B.value=Cn(B.value,c),Ce.value=Cn(Ce.value,c),we.value=Cn(we.value,c),ce.value=Cn(ce.value,c),Ee.value=Cn(Ee.value,c),R.size>0)for(const te of[...R.keys()])c.has(te)||R.delete(te);if(oi.size>0)for(const te of[...oi.keys()]){const me=te.indexOf(":"),je=me>0?te.slice(0,me):"";c.has(je)||oi.delete(te)}be.value=Cn(be.value,c),Oe.value=Cn(Oe.value,c),Re.value=Cn(Re.value,c),W.value=Cn(W.value,c);const N=Cn(pe.value,c);N!==pe.value&&(pe.value=N,ca()),Ze.value=Cn(Ze.value,c),Pe.value=Cn(Pe.value,c),Y.value=Cn(Y.value,c);const q={};for(const[te,me]of Object.entries(it.value))(te===dl||c.has(te))&&(q[te]=me);it.value=q}function Mr(i){const c=Eo(t.value).find(h=>h.id===i);c&&(ne.value={...ne.value,[i]:c.updatedAtIso},fv(ne.value),Pe.value[i]&&(Pe.value=Ct(Pe.value,i)),jt())}function Yt(i,c){if(!i)return;const h=Ce.value[i];if(c){if(ZN(h,c))return;Ce.value={...Ce.value,[i]:c}}else h&&(Ce.value=Ct(Ce.value,i))}function hn(i,c){!i||Y.value[i]===!0===c||(c?(Y.value={...Y.value,[i]:!0},Me(i)):(Y.value=Ct(Y.value,i),Uo(i),Fo(i),_i(i)),jt(),!c&&!Ao()&&wo&&gi())}function Fo(i){i&&(be.value[i]&&(be.value=Ct(be.value,i)),Oe.value[i]&&(Oe.value=Ct(Oe.value,i)),Re.value[i]&&(Re.value=Ct(Re.value,i)))}function lo(i){i&&(be.value={...be.value,[i]:!0},Oe.value[i]&&(Oe.value=Ct(Oe.value,i)),Re.value[i]&&(Re.value=Ct(Re.value,i)))}function uo(i){i&&be.value[i]===!0&&Oe.value[i]===!0&&Re.value[i]===!0&&Fo(i)}function er(i,c){!i||!c||be.value[i]===!0&&Fo(i)}function Is(i){const c=Object.keys(be.value);if(c.length===0)return;let h=Oe.value,b=!1;for(const E of c)!i.has(E)||h[E]===!0||(h={...h,[E]:!0},b=!0);if(b){Oe.value=h;for(const E of c)uo(E)}}function $a(i,c){i&&be.value[i]===!0&&c.some(h=>h.role==="user")&&(Re.value[i]!==!0&&(Re.value={...Re.value,[i]:!0}),uo(i))}function ii(i){i&&i!==n.value&&Pe.value[i]!==!0&&(Pe.value={...Pe.value,[i]:!0},jt())}function Jt(i,c){if(!i)return;const h=we.value[i];if(!c){h&&(we.value=Ct(we.value,i));return}const b=sa(c.label)||"Thinking",E=c.details.map(q=>sa(q)).filter(q=>q.length>0&&q!==b),P=Array.from(new Set([...(h==null?void 0:h.details)??[],...E])).slice(-3),N={label:b,details:P};eL(h,N)||(we.value={...we.value,[i]:N})}function en(i,c,h={}){if(!i)return;const b=ce.value[i],E=c?$l(c):"";if(!E){b&&(ce.value=Ct(ce.value,i));return}const P=h.transient===!0;(b==null?void 0:b.message)===E&&b.transient===P||(ce.value={...ce.value,[i]:{message:E,transient:P}})}function li(i){var c;i&&(c=ce.value[i])!=null&&c.transient&&en(i,null)}function Rs(){const i=Object.entries(ce.value).filter(([,h])=>h==null?void 0:h.transient).map(([h])=>h);if(i.length===0)return;let c=ce.value;for(const h of i)c=Ct(c,h);ce.value=c}function co(i){const c=Eo(t.value).find(h=>h.id===i);return(c==null?void 0:c.updatedAtIso)??""}function gr(i,c){if(!i)return;const h={...Wt.value};c?h[i]=!0:delete h[i],Wt.value=h,FN(h)}function Wi(){const i=n.value;i&&gr(i,!Zr.value)}function yr(i,c){const h=o.value[i]??[];gl(h,c)||(o.value={...o.value,[i]:c})}function ui(i,c,h=[],b=[],E=[]){const P=o.value[i]??[],N={id:`optimistic-user:${i}:${Date.now()}`,role:"user",text:c,images:h.length>0?[...h]:void 0,skills:b.length>0?b.map(q=>({name:q.name,path:q.path})):void 0,fileAttachments:E.length>0?E.map(q=>({...q})):void 0,messageType:"userMessage.optimistic"};yr(i,[...P,N])}function ja(i,c){const h=a.value[i]??[];gl(h,c)||(a.value={...a.value,[i]:c})}function Dn(i){i&&i in a.value&&(a.value=Ct(a.value,i))}function es(i,c){const h=B.value[i]??[];gl(h,c)||(B.value={...B.value,[i]:c})}function ci(i,c){const h=r.value[i]??[];gl(h,c)||(r.value={...r.value,[i]:c})}function di(i,c){const h=r.value[i]??[],b=Ac(h,c);ci(i,b),Vi(i,c)}function Vi(i,c){!i||!c||(s.value={...s.value,[i]:c},pv(s.value))}function Ms(i,c){const h=a.value[i]??[],b=Ac(h,c);ja(i,b)}function Nl(i,c){const h=B.value[i]??[],b=Ac(h,c);es(i,b)}function fi(i,c){if(!i)return;const h=c.trim(),b=m.value[i]??"";if(h.length===0){if(!b)return;m.value=Ct(m.value,i);return}b!==h&&(m.value={...m.value,[i]:h},ye(i,h))}function $r(i,c){if(!i)return;const h=m.value[i]??"";fi(i,`${h}${c}`)}function na(i){if(!i)return;const c=Ee.value[i]??"";c&&R.set(i,c)}function wr(i,c=!1){var N;if(!i)return;const h=m.value[i];if(h===void 0){c||(x.delete(i),g.clear());return}const b=R.get(i)??Ee.value[i]??"";R.delete(i);const E=b?(N=oe.value[i])==null?void 0:N[b]:void 0,P=An(i);P.length>0?Na(i,P,b||void 0,E):c||oa(i,h,b||void 0,E),m.value=Ct(m.value,i),c||(x.delete(i),g.clear(),Se(i))}function oa(i,c,h,b){if(!i)return;const E=c.trim();if(!E)return;const P=f.value[i]??[];if(P.some(te=>te.text===E))return;const N={id:`reasoning:local:${i}:${Date.now()}`,role:"system",text:E,messageType:"reasoning",reasoning:{summary:[],content:[E]},turnId:h||void 0,turnIndex:typeof b=="number"?b:void 0},q=[...P,N].slice(-20);f.value={...f.value,[i]:q},kc(f.value)}function Na(i,c,h,b){if(!i||c.length===0)return;const P=[...f.value[i]??[]];for(const q of c){const te=q.text.trim();if(!te)continue;const me=`reasoning:item:${i}:${q.itemId}`,je=P.findIndex(Je=>Je.id===me);if(je>=0){const Je=P[je],pt=q.anchorMessageId||Je.reasoningAnchorMessageId,ut=typeof b=="number"?b:Je.turnIndex;if(Je.text===te&&Je.turnIndex===ut&&Je.reasoningAnchorMessageId===pt)continue;P[je]={...Je,text:te,reasoning:{summary:[],content:[te]},turnId:h||Je.turnId,turnIndex:ut,reasoningAnchorMessageId:pt};continue}P.some(Je=>Je.text===te)||P.push({id:me,role:"system",text:te,messageType:"reasoning",reasoning:{summary:[],content:[te]},turnId:h||void 0,turnIndex:typeof b=="number"?b:void 0,reasoningAnchorMessageId:q.anchorMessageId||void 0})}const N=P.slice(-20);f.value={...f.value,[i]:N},kc(f.value)}function br(i){i&&i in r.value&&(r.value=Ct(r.value,i))}function La(i){i&&i in B.value&&(B.value=Ct(B.value,i))}function Uo(i){if(!i)return;br(i);const c=s.value[i];if(c&&c.messageType==="plan.live"){const h={...c,messageType:"plan",plan:c.plan?{...c.plan,isStreaming:!1}:c.plan};s.value={...s.value,[i]:h},pv(s.value)}wr(i),gL(i),Jt(i,null),n.value,L.value[i]&&(L.value=Ct(L.value,i)),Ee.value[i]&&(Ee.value=Ct(Ee.value,i)),ta(i)}function ts(i){return i==="completed"?"completed":i==="inProgress"||i==="in_progress"?"inProgress":"pending"}function jr(i){var h;const c=[];(h=i.explanation)!=null&&h.trim()&&c.push(i.explanation.trim());for(const b of i.steps){const E=b.status==="completed"?"x":b.status==="inProgress"?"~":" ";c.push(`- [${E}] ${b.step}`)}return c.join(`
72
+ `).trim()}function Co(i){var me;if(i.method!=="turn/plan/updated")return null;const c=qe(i.params),h=un(i),b=ke(c==null?void 0:c.turnId)||ke(c==null?void 0:c.turn_id),P=(Array.isArray(c==null?void 0:c.plan)?c==null?void 0:c.plan:[]).map(je=>qe(je)).map(je=>({step:ke(je==null?void 0:je.step),status:ts(je==null?void 0:je.status)})).filter(je=>je.step.length>0);if(!h||!b)return null;const q={explanation:ke(c==null?void 0:c.explanation).trim()||void 0,steps:P,isStreaming:!0},te=(me=oe.value[h])==null?void 0:me[b];return{threadId:h,message:{id:`${b}:plan`,role:"assistant",text:jr(q),messageType:"plan.live",plan:q,turnId:b||void 0,turnIndex:typeof te=="number"?te:void 0}}}function Nr(i){var je;if(i.method!=="item/plan/delta")return null;const c=qe(i.params),h=un(i),b=ke(c==null?void 0:c.turnId)||ke(c==null?void 0:c.turn_id),E=ke(c==null?void 0:c.delta);if(!h||!b||!E)return null;const P=`${b}:plan`,N=(r.value[h]??[]).find(Je=>Je.id===P),q=`${(N==null?void 0:N.text)??""}${E}`,te=N!=null&&N.plan?{...N.plan,isStreaming:!0}:void 0,me=(je=oe.value[h])==null?void 0:je[b];return{threadId:h,message:{id:P,role:"assistant",text:q,messageType:"plan.live",plan:te,turnId:b||void 0,turnIndex:typeof me=="number"?me:void 0}}}function qe(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)?i:null}function ke(i){return typeof i=="string"?i:""}function Wn(i){return typeof i=="number"&&Number.isFinite(i)?i:null}function Oa(i){const c=qe(i);if(!c)return null;const h=Wn(c.totalTokens??c.total_tokens),b=Wn(c.inputTokens??c.input_tokens),E=Wn(c.cachedInputTokens??c.cached_input_tokens),P=Wn(c.outputTokens??c.output_tokens),N=Wn(c.reasoningOutputTokens??c.reasoning_output_tokens);return h===null||b===null||E===null||P===null||N===null?null:{totalTokens:h,inputTokens:b,cachedInputTokens:E,outputTokens:P,reasoningOutputTokens:N}}function _r(i){const c=qe(i);if(!c)return null;const h=Oa(c.total),b=Oa(c.last);if(!h||!b)return null;const E=Wn(c.modelContextWindow??c.model_context_window),P=b.totalTokens,N=typeof E=="number"?Math.max(E-P,0):null,q=typeof E=="number"&&E>0?Qy(Math.round((N??0)/E*100),0,100):null;return{total:h,last:b,modelContextWindow:E,currentContextTokens:P,remainingContextTokens:N,remainingContextPercent:q}}function $s(i){if(i.method!=="thread/tokenUsage/updated")return null;const c=qe(i.params),h=un(i),b=_r((c==null?void 0:c.tokenUsage)??(c==null?void 0:c.token_usage));return!h||!b?null:{threadId:h,usage:b}}function un(i){const c=qe(i.params);if(!c)return"";const h=ke(c.threadId);if(h)return h;const b=ke(c.thread_id);if(b)return b;const E=ke(c.conversationId);if(E)return E;const P=ke(c.conversation_id);if(P)return P;const N=qe(c.thread),q=ke(N==null?void 0:N.id);if(q)return q;const te=qe(c.turn),me=ke(te==null?void 0:te.threadId);if(me)return me;const je=ke(te==null?void 0:te.thread_id);return je||""}function ra(i){if(i.method!=="turn/completed")return"";const c=qe(i.params),h=qe(c==null?void 0:c.turn);if(!h||h.status!=="failed")return"";const b=qe(h.error);return ke(b==null?void 0:b.message)}function Ll(i){var b;if(i.method!=="error")return null;const c=qe(i.params),h=ke(c==null?void 0:c.message)||ke((b=qe(c==null?void 0:c.error))==null?void 0:b.message);return h?{message:h,transient:(c==null?void 0:c.willRetry)===!0}:null}function ns(i){const c=qe(i);if(!c)return null;const h=c.id,b=ke(c.method),E=c.params;if(typeof h!="number"||!Number.isInteger(h)||!b)return null;const P=qe(E),N=xn(b,P),q=ke(P==null?void 0:P.threadId)||ke(P==null?void 0:P.thread_id)||ke(P==null?void 0:P.conversationId)||ke(P==null?void 0:P.conversation_id)||dl,te=ke(P==null?void 0:P.turnId)||ke(P==null?void 0:P.turn_id),me=ke(P==null?void 0:P.itemId)||ke(P==null?void 0:P.item_id)||ke(P==null?void 0:P.callId)||ke(P==null?void 0:P.call_id),je=ke(c.receivedAtIso)||new Date().toISOString();return{id:h,method:N,threadId:q,turnId:te,itemId:me,receivedAtIso:je,params:E??null}}function xn(i,c){const h=i.trim();return h&&(h==="item/commandExecution/requestApproval"||h==="execCommandApproval"||h==="exec_approval_request"||To(c)?"item/commandExecution/requestApproval":h==="item/fileChange/requestApproval"||h==="applyPatchApproval"||h==="apply_patch_approval_request"||fo(c)?"item/fileChange/requestApproval":h==="item/tool/requestUserInput"||h==="request_user_input"||tr(c)?"item/tool/requestUserInput":h==="mcpServer/elicitation/request"||h==="elicitation_request"||os(c)?"mcpServer/elicitation/request":h==="item/permissions/requestApproval"||aa(c)?"item/permissions/requestApproval":h==="item/tool/call"||h==="dynamic_tool_call_request"||$n(c)?"item/tool/call":h)}function To(i){if(!i)return!1;const c=i.command;return Array.isArray(c)&&c.some(h=>typeof h=="string"&&h.trim().length>0)||typeof c=="string"&&c.trim().length>0?!0:Array.isArray(i.commandActions)}function fo(i){return i?typeof i.grantRoot=="string"&&i.grantRoot.trim().length>0||typeof i.grant_root=="string"&&i.grant_root.trim().length>0||qe(i.fileChanges)?!0:qe(i.changes)!==null:!1}function tr(i){return!!(i&&Array.isArray(i.questions))}function $n(i){return i?typeof i.toolName=="string"||typeof i.tool_name=="string"||typeof i.name=="string"||Array.isArray(i.arguments):!1}function os(i){if(!i)return!1;const c=ke(i.mode);return typeof i.serverName=="string"&&typeof i.threadId=="string"&&typeof i.message=="string"&&(c==="form"||c==="url")}function aa(i){return i?typeof i.threadId=="string"&&typeof i.turnId=="string"&&typeof i.itemId=="string"&&qe(i.permissions)!==null:!1}function Lr(i){if(i.method!=="item/tool/requestUserInput")return[];const c=qe(i.params),h=Array.isArray(c==null?void 0:c.questions)?c.questions:[],b=[];for(const E of h){const P=qe(E),N=ke(P==null?void 0:P.id).trim();N&&b.push(N)}return b}function pi(i){const c=i.threadId||dl,h=it.value[c]??[],b=h.findIndex(P=>P.id===i.id),E=[...h];b>=0?E.splice(b,1,i):E.push(i),it.value={...it.value,[c]:E.sort((P,N)=>P.receivedAtIso.localeCompare(N.receivedAtIso))},jt()}function nr(i){const c={};for(const[h,b]of Object.entries(it.value)){const E=b.filter(P=>P.id!==i);E.length>0&&(c[h]=E)}it.value=c,ve.value[String(i)]&&(ve.value=Ct(ve.value,String(i))),jt()}function or(i){return ve.value[String(i)]??""}function kr(i){const c={},h=new Set;for(const E of i){const P=E.threadId||dl,N=c[P]??[];N.push(E),c[P]=N,h.add(E.id)}for(const E of Object.values(c))E.sort((P,N)=>P.receivedAtIso.localeCompare(N.receivedAtIso));it.value=c;const b={};for(const[E,P]of Object.entries(ve.value))h.has(Number(E))&&(b[E]=P);ve.value=b}function cn(i){if(i.method==="server/request"){const c=ns(i.params);return c&&pi(c),!0}if(i.method==="server/request/resolved"){const c=qe(i.params),h=c==null?void 0:c.id;return typeof h=="number"&&Number.isInteger(h)&&nr(h),!0}return!1}function sa(i){return i.replace(/\s+/gu," ").trim()}function Da(i){const c=un(i);if(!c)return null;if(i.method==="turn/started")return{threadId:c,activity:{label:"Thinking",details:[]}};if(i.method==="item/started"){const h=qe(i.params),b=qe(h==null?void 0:h.item),E=ke(b==null?void 0:b.type).toLowerCase();if(E==="reasoning")return{threadId:c,activity:{label:"Thinking",details:[]}};if(E==="agentmessage")return{threadId:c,activity:{label:"Writing response",details:[]}};if(E==="commandexecution"){const P=ke(b==null?void 0:b.command);return{threadId:c,activity:{label:"Running command",details:P?[P]:[]}}}if(E==="filechange"){const N=(Array.isArray(b==null?void 0:b.changes)?b.changes:[])[0],q=ke(N==null?void 0:N.path);return{threadId:c,activity:{label:"Applying changes",details:q?[q]:[]}}}}return i.method==="item/commandExecution/outputDelta"?{threadId:c,activity:{label:"Running command",details:[]}}:i.method==="item/fileChange/outputDelta"?{threadId:c,activity:{label:"Applying changes",details:[]}}:i.method==="item/reasoning/summaryTextDelta"||i.method==="item/reasoning/summaryPartAdded"||i.method==="item/reasoning/textDelta"?{threadId:c,activity:{label:"Thinking",details:[]}}:i.method==="item/agentMessage/delta"?{threadId:c,activity:{label:"Writing response",details:[]}}:null}function ia(i){if(i.method!=="turn/started")return null;const c=qe(i.params);if(!c)return null;const h=un(i);if(!h)return null;const b=qe(c.turn),E=ke(b==null?void 0:b.id)||ke(c.turnId)||`${h}:unknown`;if(!E)return null;const P=Js(ke(b==null?void 0:b.startedAt))??Js(ke(c.startedAt))??Js(i.atIso)??Date.now();return{threadId:h,turnId:E,startedAtMs:P}}function rs(i){if(i.method!=="turn/completed")return null;const c=qe(i.params);if(!c)return null;const h=un(i);if(!h)return null;const b=qe(c.turn),E=ke(b==null?void 0:b.id)||ke(c.turnId)||`${h}:unknown`;if(!E)return null;const P=Js(ke(b==null?void 0:b.completedAt))??Js(ke(c.completedAt))??Js(i.atIso)??Date.now(),N=Js(ke(b==null?void 0:b.startedAt))??Js(ke(c.startedAt))??void 0;return{threadId:h,turnId:E,completedAtMs:P,startedAtMs:N}}function rr(i){return`${i}:live-reasoning`}function la(i){const c=o.value[i]??[];let h=-1;for(const b of c)typeof b.turnIndex=="number"&&Number.isFinite(b.turnIndex)&&(h=Math.max(h,b.turnIndex));return h+1}function Fa(i,c,h){if(!i||!c||!Number.isInteger(h)||h<0)return;const b=oe.value[i]??{};b[c]!==h&&(oe.value={...oe.value,[i]:{...b,[c]:h}})}function as(i,c){const h=oe.value[i]??{},b=Object.entries(h),E=Object.entries(c);b.length===E.length&&b.every(([P,N])=>c[P]===N)||(oe.value={...oe.value,[i]:{...c}})}function Ol(i,c){var b;if(!i||!c)return;const h=(b=oe.value[i])==null?void 0:b[c];return typeof h=="number"?h:void 0}function hi(i){const c=B.value[i];if(!c||c.length===0)return;const h=oe.value[i]??{};let b=!1;const E=c.map(P=>{if(typeof P.turnIndex=="number"||!P.turnId)return P;const N=h[P.turnId];return typeof N!="number"?P:(b=!0,{...P,turnIndex:N})});b&&(B.value={...B.value,[i]:E})}function js(i){const c=qe(i.params);if(!c)return"";if(i.method==="item/started"){const h=qe(c.item);return!h||h.type!=="reasoning"?"":ke(h.id)}return""}function Or(i){const c=qe(i.params);if(!c)return null;if(i.method==="item/reasoning/summaryTextDelta"){const h=ke(c.itemId),b=ke(c.delta);return!h||!b?null:{messageId:rr(h),itemId:h,delta:b}}if(i.method==="item/reasoning/textDelta"){const h=ke(c.itemId),b=ke(c.delta);return!h||!b?null:{messageId:rr(h),itemId:h,delta:b}}return null}function Dr(i){const c=qe(i.params);if(!c)return"";if(i.method==="item/reasoning/summaryPartAdded"){const h=ke(c.itemId);return h?rr(h):""}return""}function ua(i){const c=qe(i.params);if(!c)return"";if(i.method==="item/completed"){const h=qe(c.item);return!h||h.type!=="reasoning"?"":rr(ke(h.id))}return""}function ss(i){var h;const c=[];for(const b of["content","summary"]){const E=Array.isArray(i[b])?i[b]:[];for(const P of E){const N=typeof P=="string"?P:(h=qe(P))==null?void 0:h.text;typeof N=="string"&&N.trim()&&c.push(N)}}return c.join(`
73
+ `).trim()}function Gi(i){if(i.method!=="item/started"&&i.method!=="item/completed")return null;const c=qe(i.params),h=qe(c==null?void 0:c.item);if(!h||ke(h.type).toLowerCase()!=="reasoning")return null;const b=ke(h.id);return b?{itemId:b,text:ss(h)}:null}function Zt(i,c,h){if(!i||!h)return;h.trim()&&w.set(c,h.trim());const b=m.value[i]??"",E=g.get(c)??"";if(b.endsWith(h)||E&&h===E){g.set(c,h);return}if(E&&h.startsWith(E)){const N=h.slice(E.length);N&&$r(i,N),g.set(c,h);return}const P=b.length>0&&!b.endsWith(`
74
+ `)?`
75
+
76
+ `:"";$r(i,`${P}${h}`),g.set(c,h)}function So(i){const c=qe(i.params);if(!c)return;const h=i.method==="item/started"||i.method==="item/completed",b=i.method==="item/reasoning/textDelta"||i.method==="item/reasoning/summaryTextDelta";if(!h&&!b)return;const E=qe(c.item),P=ke(b?c.itemId:E==null?void 0:E.id);if(!P)return;const N=un(i);if(!N)return;const q=b||ke(E==null?void 0:E.type).toLowerCase()==="reasoning"?"reasoning":"other",te=x.get(N)??[];te.some(me=>me.itemId===P)||x.set(N,[...te,{itemId:P,kind:q}])}function An(i){var E;const c=x.get(i)??[],h=[];let b="";for(const P of c)if(P.kind==="reasoning"){const N=((E=w.get(P.itemId))==null?void 0:E.trim())??"";N&&h.push({text:N,anchorMessageId:b,itemId:P.itemId})}else b=P.itemId;return h}function Ns(i){var te;if(i.method!=="item/started"&&i.method!=="item/completed")return null;const c=qe(i.params),h=qe(c==null?void 0:c.item);if(!h||ke(h.type).toLowerCase()!=="plan")return null;const b=un(i),E=ke(c==null?void 0:c.turnId)||ke(c==null?void 0:c.turn_id),P=ke(h.id),N=ke(h.text);if(!b||!P||!N)return null;const q=b&&E?(te=oe.value[b])==null?void 0:te[E]:void 0;return{threadId:b,message:{id:P,role:"assistant",text:N,messageType:i.method==="item/completed"?"plan":"plan.live",plan:Fy(N)??void 0,turnId:E||void 0,turnIndex:typeof q=="number"?q:void 0}}}function ar(i){const c=qe(i.params);if(!c)return"";if(i.method==="item/started"){const h=qe(c.item);return!h||h.type!=="agentMessage"?"":ke(h.id)}return""}function is(i){const c=qe(i.params);if(!c)return null;if(i.method==="item/agentMessage/delta"){const h=ke(c.itemId),b=ke(c.delta);return!h||!b?null:{messageId:h,delta:b}}return null}function y(i){const c=qe(i.params);if(!c)return null;if(i.method==="item/completed"){const h=qe(c.item);if(!h||h.type!=="agentMessage")return null;const b=ke(h.id),E=ke(h.text);return!b||!E?null:{id:b,role:"assistant",text:E,messageType:"agentMessage.live"}}return null}function C(i){return`/codex-local-image?path=${encodeURIComponent(i)}`}function _(i){const c=i.trim();if(!c)return"";if(c.startsWith("data:")||c.startsWith("http://")||c.startsWith("https://")||c.startsWith("/codex-local-image?"))return c;const h=c.replace(/\s+/gu,"");return/^[A-Za-z0-9+/]+={0,2}$/u.test(h)?`data:image/png;base64,${h}`:""}function F(i){if(i.method!=="item/completed")return null;const c=qe(i.params),h=qe(c==null?void 0:c.item);if(!h)return null;const b=ke(h.id);if(!b)return null;if(h.type==="imageView"){const N=ke(h.path);return N?{id:b,role:"assistant",text:"",images:[C(N)],messageType:"imageView"}:null}if(h.type!=="imageGeneration"&&h.type!=="image_generation")return null;const E=ke(h.result),P=E?_(E):"";return P?{id:b,role:"assistant",text:"",images:[P],messageType:"imageView"}:null}function _e(i){var me;if(i.method!=="item/started")return null;const c=qe(i.params),h=qe(c==null?void 0:c.item);if(!h||h.type!=="commandExecution")return null;const b=ke(h.id),E=ke(h.command);if(!b)return null;const P=typeof h.cwd=="string"?h.cwd:null,N=un(i),q=ke(c==null?void 0:c.turnId)||ke(c==null?void 0:c.turn_id),te=N&&q?(me=oe.value[N])==null?void 0:me[q]:void 0;return{id:b,role:"system",text:E,messageType:"commandExecution",commandExecution:{command:E,cwd:P,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:q||void 0,turnIndex:typeof te=="number"?te:void 0}}function lt(i){if(i.method!=="item/commandExecution/outputDelta")return null;const c=qe(i.params);if(!c)return null;const h=ke(c.itemId),b=ke(c.delta);return!h||!b?null:{itemId:h,delta:b}}function Pt(i){var ut;if(i.method!=="item/completed")return null;const c=qe(i.params),h=qe(c==null?void 0:c.item);if(!h||h.type!=="commandExecution")return null;const b=ke(h.id),E=ke(h.command);if(!b)return null;const P=typeof h.cwd=="string"?h.cwd:null,N=ke(h.status),q=N==="failed"?"failed":N==="declined"?"declined":N==="interrupted"?"interrupted":"completed",te=typeof h.aggregatedOutput=="string"?h.aggregatedOutput:"",me=typeof h.exitCode=="number"?h.exitCode:null,je=un(i),Je=ke(c==null?void 0:c.turnId)||ke(c==null?void 0:c.turn_id),pt=je&&Je?(ut=oe.value[je])==null?void 0:ut[Je]:void 0;return{id:b,role:"system",text:E,messageType:"commandExecution",commandExecution:{command:E,cwd:P,status:q,aggregatedOutput:te,exitCode:me},turnId:Je||void 0,turnIndex:typeof pt=="number"?pt:void 0}}function Bo(i){var me;if(i.method!=="item/completed")return null;const c=qe(i.params),h=qe(c==null?void 0:c.item);if(!h||h.type!=="fileChange")return null;const b=ke(h.id);if(!b)return null;const E=ke(c==null?void 0:c.threadId),P=ke(c==null?void 0:c.turnId),N=E&&P?(me=oe.value[E])==null?void 0:me[P]:void 0,q=Of(h.changes),te=hy(h.status);return q.length===0||te!=="completed"?null:{id:b,role:"system",text:"",messageType:"fileChange",fileChangeStatus:te,fileChanges:q,turnId:P||void 0,turnIndex:typeof N=="number"?N:void 0}}function Qt(i,c){const h=L.value[i]??[],b=Ac(h,c);b!==h&&(L.value={...L.value,[i]:b})}function Fn(i,c){const h=L.value[i];if(!h||h.length===0)return;const b=new Set(c.map(P=>P.id)),E=h.filter(P=>!b.has(P.id));E.length!==h.length&&(E.length===0?L.value=Ct(L.value,i):L.value={...L.value,[i]:E})}function kn(i,c){const h=B.value[i];if(!h||h.length===0)return;const b=new Set(c.map(q=>q.id)),E=new Set(c.filter(q=>q.messageType==="fileChange"&&typeof q.turnId=="string"&&q.turnId.length>0).map(q=>q.turnId)),P=new Set(c.filter(q=>q.messageType==="fileChange"&&typeof q.turnIndex=="number").map(q=>q.turnIndex)),N=h.filter(q=>!b.has(q.id)&&!(q.turnId&&E.has(q.turnId))&&!(typeof q.turnIndex=="number"&&P.has(q.turnIndex)));N.length!==h.length&&(N.length===0?B.value=Ct(B.value,i):B.value={...B.value,[i]:N})}function sr(i){if(i.method==="item/agentMessage/delta")return!0;const c=qe(i.params);if(!c)return!1;if(i.method==="item/completed"){const h=qe(c.item);return(h==null?void 0:h.type)==="agentMessage"}return!1}const Fr=new Set;function qo(i){for(const c of Fr)try{c(i)}catch{}}function Ls(i){return Fr.add(i),()=>{Fr.delete(i)}}function mi(i,c,h){if(!i||!c)return;const b=B.value[i];if(!b)return;const E=b.findIndex(N=>N.id===c||N.turnId===c);if(E<0)return;const P=[...b];P[E]={...P[E],fileChanges:h},es(i,P)}function vi(i,c,h){if(!i||!c)return;const b=B.value[i];if(!b)return;const E=b.findIndex(q=>q.turnId===c);if(E<0)return;const P=[...b],N=P[E];P[E]={...N,fileChanges:(N.fileChanges??[]).map(q=>({...q,diff:h}))},es(i,P)}function Os(i){var Yu,Ju,Qu,rl,Xu,Zu;if(cn(i))return;if(So(i),i.method==="turn/started"){const Ie=un(i);Ie&&x.delete(Ie)}if(TN.has(i.method))return;if(i.method==="app/list/updated"||i.method==="mcpServer/startupStatus/updated"||i.method==="mcpServer/oauthLogin/completed"||i.method==="remoteControl/status/changed"){qo(i.method);return}if(i.method==="skills/changed"){Fs({force:!0});return}if(i.method==="hook/started"||i.method==="hook/completed"){Ki({force:!0});return}if(i.method==="thread/status/changed"){const Ie=un(i);Ie&&Ie===n.value&&Xt.add(Ie);return}if(i.method==="thread/archived"||i.method==="thread/unarchived"||i.method==="thread/deleted"||i.method==="thread/closed")return;if(i.method==="item/fileChange/patchUpdated"||i.method==="turn/diff/updated"){const Ie=qe(i.params),Ot=ke(Ie==null?void 0:Ie.threadId);Ot&&(i.method==="item/fileChange/patchUpdated"?mi(Ot,ke(Ie==null?void 0:Ie.itemId),Of(Ie==null?void 0:Ie.changes)):vi(Ot,ke(Ie==null?void 0:Ie.turnId),ke(Ie==null?void 0:Ie.diff)??""),Ot===n.value&&Xt.add(Ot));return}if(i.method==="account/rateLimits/updated"&&Ma(),i.method==="thread/name/updated"){const Ie=qe(i.params),Ot=ke(Ie==null?void 0:Ie.threadId),Hs=ke(Ie==null?void 0:Ie.threadName);if(Ot&&Hs){const ec=Qs(Hs);K.value={...K.value,[Ot]:ec},jt(),gc(Ot,ec)}}if(i.method==="thread/compacted"){const Ie=qe(i.params),Ot=ke(Ie==null?void 0:Ie.threadId);Ot&&(Us(Ot,!1),Tr(Ot,"done"),Xt.add(Ot));return}if(i.method==="fuzzyFileSearch/sessionUpdated"){const Ie=qe(i.params),Ot=ke(Ie==null?void 0:Ie.sessionId);Ot&&Ot===gn&&(dr.value=DT(Ie));return}if(i.method==="fuzzyFileSearch/sessionCompleted"){const Ie=qe(i.params),Ot=ke(Ie==null?void 0:Ie.sessionId);Ot&&Ot===gn&&(gn="");return}if(i.method==="account/rateLimits/updated"){vr(wy(i.params));return}const c=$s(i);if(c){Za(c.threadId,c.usage);return}const h=Da(i);h&&Jt(h.threadId,h.activity);const b=un(i),E=Ll(i);!E&&b&&li(b);const P=ia(i);P&&(qn.set(P.turnId,P),Fa(P.threadId,P.turnId,la(P.threadId)),Ee.value={...Ee.value,[P.threadId]:P.turnId},er(P.threadId,P.turnId),br(P.threadId),La(P.threadId),Yt(P.threadId,null),en(P.threadId,null),hn(P.threadId,!0),zl(P.threadId),Pe.value[P.threadId]&&(Pe.value=Ct(Pe.value,P.threadId)));const N=rs(i),q=ra(i),te=(N==null?void 0:N.threadId)??un(i),me=te?ln(te):"",je=!!te&&!!q&&me!==ma&&xc(new Error(q));if(N){yt.value[N.threadId];const Ie=qn.get(N.turnId);Ie&&qn.delete(N.turnId);const Ot=Wn((Yu=qe(i.params))==null?void 0:Yu.durationMs)??Wn((Qu=qe((Ju=qe(i.params))==null?void 0:Ju.turn))==null?void 0:Qu.durationMs)??(typeof N.startedAtMs=="number"?N.completedAtMs-N.startedAtMs:null)??(Ie?N.completedAtMs-Ie.startedAtMs:null),Hs=typeof Ot=="number"?Math.max(0,Ot):0;Yt(N.threadId,{turnId:N.turnId,durationMs:Hs}),Ee.value[N.threadId]&&(Ee.value=Ct(Ee.value,N.threadId)),hn(N.threadId,!1),Jt(N.threadId,null),ii(N.threadId),je||(ta(N.threadId),zl(N.threadId))}if(q){const Ie=(N==null?void 0:N.threadId)||un(i);Ie&&en(Ie,q),mt.value=q,Ie&&je&&Oo(Ie)}else N&&en(N.threadId,null);if(E){const Ie=b,Ot=Ie?ln(Ie):dt.value.trim();Ie&&en(Ie,E.message,{transient:E.transient}),mt.value=E.message,Ot!==ma&&xc(new Error(E.message))&&(Ie?Oo(Ie):ko())}const Je=Co(i);Je&&(di(Je.threadId,Je.message),Jt(Je.threadId,{label:"Planning",details:((rl=Je.message.plan)==null?void 0:rl.steps.map(Ie=>Ie.step).slice(0,2))??[]}));const pt=Nr(i);pt&&(di(pt.threadId,pt.message),Jt(pt.threadId,{label:"Planning",details:[]}));const ut=Ns(i);if(ut&&(di(ut.threadId,ut.message),Jt(ut.threadId,{label:"Planning",details:((Xu=ut.message.plan)==null?void 0:Xu.steps.map(Ie=>Ie.step).slice(0,2))??[]})),!b||b!==n.value)return;ar(i);const Et=is(i);if(Et){const Ie=(a.value[b]??[]).find(Hs=>Hs.id===Et.messageId),Ot=`${(Ie==null?void 0:Ie.text)??""}${Et.delta}`;Ms(b,{id:Et.messageId,role:"assistant",text:Ot,messageType:"agentMessage.live"})}const Ha=y(i);Ha&&Ms(b,Ha);const Bs=F(i);Bs&&Ms(b,Bs),js(i)&&na(b);const Sr=Or(i);if(Sr&&($r(b,Sr.delta),Sr.itemId&&Sr.delta)){const Ie=w.get(Sr.itemId)??"";Ie.endsWith(Sr.delta)||w.set(Sr.itemId,`${Ie}${Sr.delta}`)}const qs=Gi(i);if(qs&&(Zt(b,qs.itemId,qs.text),na(b)),Dr(i)){const Ie=m.value[b]??"";Ie.trim().length>0&&!Ie.endsWith(`
77
+
78
+ `)&&fi(b,`${Ie}
79
+
80
+ `)}ua(i);const fs=_e(i);fs&&(Qt(b,fs),Jt(b,{label:"Running command",details:[((Zu=fs.commandExecution)==null?void 0:Zu.command)??""]}));const zs=lt(i);if(zs){const Ie=(L.value[b]??[]).find(Ot=>Ot.id===zs.itemId);Ie!=null&&Ie.commandExecution&&Qt(b,{...Ie,commandExecution:{...Ie.commandExecution,aggregatedOutput:`${Ie.commandExecution.aggregatedOutput}${zs.delta}`}})}const Gu=Pt(i);Gu&&Qt(b,Gu);const Ku=Bo(i);if(Ku&&Nl(b,Ku),sr(i)&&wr(b,!0),i.method==="turn/completed"){eo=!1,wr(b),w.clear(),L.value[b]&&(L.value=Ct(L.value,b));const Ie=un(i);Ie&&(I(Ie),hn(Ie,!1),Jt(Ie,null),ii(Ie),je||(ta(Ie),zl(Ie)))}}function Ua(i){if(i.method==="thread/tokenUsage/updated"||i.method.startsWith("thread/realtime/"))return;const c=i.method,h=c==="turn/started"||c==="turn/completed"||c==="error",b=c.startsWith("thread/")||c==="turn/completed";if(!h&&!b)return;const E=un(i);E&&h&&Xt.add(E),b&&(yn=!0,Qr=!0),!(ht!==null||typeof window>"u")&&(ht=window.setTimeout(()=>{ht=null,zr()},_c))}async function zo(i,c){if(!bo){bo=!0;try{if(!c)return;const h=[];for(const b of md(c)){const E=qi(b);h.includes(E)||h.push(E)}if(h.length>0){const b=c.projectOrder.length>0?fl(h,i):fl(H.value,i);ws(H.value,b)||(H.value=b)}if(Object.keys(c.labels).length>0||(c.remoteProjects??[]).length>0){const b={...Be.value};let E=!1;for(const[P,N]of Object.entries(c.labels)){const q=st(P).trim(),te=[qi(P)];q&&te.push(q);for(const me of te)b[me]!==N&&(b[me]=N,E=!0)}for(const P of c.order){const N=qi(P),q=Kr(Tl(P));if(!q.startsWith(".")||q===N)continue;const te=`${N} ${q}`;b[N]!==void 0||b[N]===te||(b[N]=te,E=!0)}for(const P of c.remoteProjects??[]){const N=cL(P);b[P.id]!==N&&(b[P.id]=N,E=!0)}E&&(Be.value=b)}}catch{}}}async function Dl(i={}){if(!(i.force!==!0&&Object.keys(K.value).length>0))try{const c=await xS();if(Object.keys(c.titles).length>0){const h={};for(const[b,E]of Object.entries(c.titles))h[b]=Qs(E);K.value=h}}catch{}}async function Du(){try{return await ml()}catch{return null}}function Ba(i,c,h){const b=i.trim();if(b)return Qs(b);const E=h.map(P=>P.label.trim()).find(P=>P.length>0);return E?Qs(E):c.length>0?Qs("[Image]"):"Untitled thread"}async function Fu(i,c,h,b=[],E=[]){if(K.value[i])return;const P=c.trim();if(!P){const q=Ba(c,b,E);K.value={...K.value,[i]:q},jt(),gc(i,q);return}const N=P.length>300?P.slice(0,300):P;try{const q=await $S(N,h);if(!q||K.value[i])return;const te=q.length>Kf?q.slice(0,Kf):q;K.value={...K.value,[i]:te},jt(),gc(i,te)}catch{}}function vd(i,c){const h=Gf(i,c),b=hL(i,c),E=mL(b,c,h);if(!c||c.order.length===0&&(c.remoteProjects??[]).length===0)return E;const P=new Set;for(const q of Vf(c,h))P.add(q);const N=E.filter(q=>P.has(q.projectName)?!0:Yf(q));return pL(N,c,h)}function qa(i,c){const h=vd(i,c),b=!!(c&&(c.order.length>0||c.projectOrder.length>0||(c.remoteProjects??[]).length>0)),E=c!=null&&c.projectOrder.length?fl(Vf(c,Gf(i,c)),h):fl(H.value,h);ws(H.value,E)||(H.value=E,b||iu(H.value));const P=vf(h,H.value);Is(new Set(Eo(P).map(te=>te.id)));const N=lL(t.value,P,Y.value);t.value=Pc(t.value,N),Y.value=Cn(Y.value,new Set(Eo(t.value).map(te=>te.id))),new Set(Eo(t.value).map(te=>te.id));const q={};for(const te of Eo(t.value))q[te.id]=te.externalSession??Fe.value[te.id]??null;Fe.value=q,jt()}function Ur(i){const c={};for(const[h,b]of Object.entries(i)){const E=h.trim();!E||b.length===0||(c[E]=b.map(P=>({id:P.id,text:P.text,imageUrls:[...P.imageUrls],skills:P.skills.map(N=>({name:N.name,path:N.path})),fileAttachments:P.fileAttachments.map(N=>({label:N.label,path:N.path,fsPath:N.fsPath})),collaborationMode:P.collaborationMode})))}return c}function ca(){eS(Ur(pe.value)).catch(()=>{})}async function Fl(){if(!Ae){Ae=!0;try{pe.value=await jm()}catch{}}}function Vn(i){Rt=_v(Rt,i),t.value=_v(t.value,i),Y.value=Ct(Y.value,i),jt()}function xo(i,c){if(i.length===0)return c;if(c.length===0)return i;const h=new Map;for(const E of Eo(i))h.set(E.id,E);for(const E of Eo(c))h.set(E.id,E);const b=new Map;for(const E of h.values()){const P=b.get(E.projectName);P?P.push(E):b.set(E.projectName,[E])}return Array.from(b.entries()).map(([E,P])=>({projectName:E,threads:P.sort((N,q)=>new Date(q.updatedAtIso).getTime()-new Date(N.updatedAtIso).getTime())})).sort((E,P)=>{var te,me;const N=new Date(((te=E.threads[0])==null?void 0:te.updatedAtIso)??0).getTime();return new Date(((me=P.threads[0])==null?void 0:me.updatedAtIso)??0).getTime()-N})}function Ao(){return Object.values(Y.value).some(i=>i===!0)}function gi(i=Yn){if(!(!wo||jo||Ao())){if(Yn=i,typeof window>"u"){Br(i);return}$o!==null&&window.clearTimeout($o),$o=window.setTimeout(()=>{$o=null,!(!wo||Ao())&&Br(Yn)},gN)}}async function Br(i){if(!(jo||!wo||Ao())){jo=!0;try{const c=await Cm(wo,JT());wo=c.nextCursor,Lt=c.nextCursor===null,Vt.value=Lt,Rt=xo(Rt,c.groups),qa(Rt,i)}catch{}finally{jo=!1,wo&&!Ao()&&gi(i)}}}async function Ds(i={}){if(fr){await fr;return}i.force!==!0&&Xn.value&&Date.now()-Pa<bN||(fr=(async()=>{var c;Xn.value||(ot.value=!0);try{const[h,b]=await Promise.all([Cm(),Du(),Dl({force:i.force===!0})]);Yn=b;const E=h.groups;Rt=Xn.value?xo(Rt,E):E,wo=Xn.value&&!Lt?wo:h.nextCursor,Lt=h.nextCursor===null,Vt.value=Lt,await zo(E,b),qa(Rt,b),Xn.value=!0,Pa=Date.now(),Lt||gi(b);const P=Eo(e.value);io(P),!P.some(q=>q.id===n.value)&&!n.value&&bn(((c=P[0])==null?void 0:c.id)??"")}finally{ot.value=!1}})().finally(()=>{fr=null}),await fr)}async function da(i,c={}){var q;if(!i)return;const h=Date.now()-(Ea.get(i)??0)<uv;if((q=ce.value[i])!=null&&q.transient&&(c.silent===!0||h))return;const b=yo.get(i);if(b&&c.force!==!0){await b;return}const E=D.value[i]===!0,P=c.silent!==!0&&!E;P&&(Ft.value=!0);const N=(async()=>{try{const te=co(i),me=$.value[i]??"",je=Date.now()-(Xr.get(i)??0)<uv;if(c.force===!0?!1:E&&(je||(te.length===0||me===te)&&Y.value[i]!==!0)){Mr(i);return}const ut=le.value[i]!==!0?await of(i):null,Et=ut??await nf(i);Et.modelProvider&&ea(i,Et.modelProvider),Et.model&&ao(i,Mn(i,Et.model,Et.modelProvider)),ut&&(le.value={...le.value,[i]:!0});const{messages:Ha,inProgress:Bs,activeTurnId:fa,turnIndexByTurnId:Sr}=Et;G.value={...G.value,[i]:Et.hasMoreOlder===!0},$a(i,Ha),as(i,Sr),hi(i);const qs=o.value[i]??[],Vu=bv(qs,Ha,{preserveMissing:c.silent===!0||YN(qs)});yr(i,Vu);const fs=a.value[i]??[];if(Bs){const zs=QN(fs,Ha);ja(i,zs)}else Dn(i);Fn(i,Ha),kn(i,Ha),D.value={...D.value,[i]:!0},Xr.set(i,Date.now()),Ea.delete(i),te&&($.value={...$.value,[i]:te}),hn(i,Bs),Et.externalSession&&(Fe.value={...Fe.value,[i]:Et.externalSession}),li(i),fa?Ee.value={...Ee.value,[i]:fa}:Ee.value[i]&&(Ee.value=Ct(Ee.value,i)),Bs||Uo(i),Mr(i)}catch(te){const me=te instanceof Error?te.message:"Unknown application error";throw n.value===i&&en(i,me,{transient:!0}),Ea.set(i,Date.now()),te}finally{P&&(Ft.value=!1)}})().finally(()=>{yo.delete(i)});yo.set(i,N),await N}async function qr(i=n.value){if(!i||ie.value[i]===!0||G.value[i]!==!0)return;const c=zn(i);if(!c){G.value={...G.value,[i]:!1};return}ie.value={...ie.value,[i]:!0};try{const h=await XT(i,c),b=o.value[i]??[],E=bv(h.messages,b,{preserveMissing:!0});yr(i,E),as(i,{...oe.value[i]??{},...h.turnIndexByTurnId}),hi(i),G.value={...G.value,[i]:h.hasMoreOlder}}catch(h){throw mt.value=h instanceof Error?h.message:"Failed to load earlier messages",h}finally{ie.value={...ie.value,[i]:!1}}}async function yi(i,c={}){var h;i&&D.value[i]!==!0&&(c.silent===!0&&((h=ce.value[i])!=null&&h.transient)||await da(i,c))}async function Fs(i={}){var b,E;const c=((E=(b=hr.value)==null?void 0:b.cwd)==null?void 0:E.trim())??"",h=c||"__global__";if(Ln){await Ln;return}i.force!==!0&&Ja&&Qa===h&&Date.now()-In<_N||(Ln=(async()=>{try{Q.value=await NS(c?[c]:void 0),Ja=!0,In=Date.now(),Qa=h}catch{}finally{Ln=null}})(),await Ln)}async function Ki(i={}){if(pr){await pr;return}i.force!==!0&&Kn||(We.value=!0,pr=(async()=>{try{Le.value=await a1(),Kn=!0}catch{}finally{We.value=!1,pr=null}})(),await pr)}async function ls(i={}){await Promise.allSettled([Rr({providerChanged:i.providerChanged,includeProviderModels:i.includeProviderModels}),_n(),Do(),Fs()])}function Ul(i={}){const c=()=>{ls(i)};if(typeof window>"u"){c();return}window.setTimeout(c,0)}async function wi(i={}){mt.value="",se.value="";const c=i.includeSelectedThreadMessages!==!1,h=i.awaitAncillaryRefreshes===!0;try{if(await Fl(),await Ds({force:i.forceThreadRefresh===!0}),c)try{await da(n.value)}catch(b){mt.value=b instanceof Error?b.message:"Unknown application error"}h?await ls({providerChanged:i.providerChanged,includeProviderModels:i.providerChanged===!0||h}):Ul({providerChanged:i.providerChanged,includeProviderModels:!1})}catch(b){mt.value=b instanceof Error?b.message:"Unknown application error",dv(b)?se.value=cv:se.value=""}}async function za(i){bn(i);try{return await da(i),await Rr({includeProviderModels:!0}),Fs(),"ok"}catch(c){const h=c instanceof Error?c.message:"Unknown application error";mt.value=h;const b=SN(c)?"not-found":"error";return i.trim()&&en(i,h,{transient:!0}),b}}async function Bl(i){const c=n.value===i,h=c?pN(Eo(e.value),i):"";c&&(bn(h),h&&da(h,{silent:!0}));try{await I1(i),Vn(i),await Ds(),c&&h&&n.value===h&&await yi(h,{silent:!0})}catch(b){mt.value=b instanceof Error?b.message:"Unknown application error"}}async function Yi(i,c){const h=c.trim();if(!(!i||!h))try{await $1(i,h),K.value={...K.value,[i]:h},jt(),gc(i,h)}catch(b){mt.value=b instanceof Error?b.message:"Unknown application error"}}async function ql(i){var N,q;const c=i.trim();if(!c)return"";const h=Eo(t.value).find(te=>te.id===c),b=((N=h==null?void 0:h.cwd)==null?void 0:N.trim())??"",E=((q=h==null?void 0:h.title)==null?void 0:q.trim())??"Forked chat",P=ln(c);mt.value="";try{const te=await Em(c,b||void 0,P||void 0),me=te.threadId.trim();return me?(pn(me,b,E),ao(me,te.model),le.value={...le.value,[me]:!0},bn(me),await Ds(),await da(me),me):""}catch(te){return mt.value=te instanceof Error?te.message:"Unknown application error",""}}async function bi(i,c){var N;const h=i.trim();if(!h||!Number.isInteger(c)||c<0)return"";if(Y.value[h]===!0)return mt.value="Finish the current turn before forking from a response.","";if(D.value[h]!==!0)try{await da(h)}catch(q){return mt.value=q instanceof Error?q.message:"Unknown application error",""}const b=o.value[h]??[];let E=-1;for(const q of b)typeof q.turnIndex=="number"&&Number.isFinite(q.turnIndex)&&(E=Math.max(E,q.turnIndex));if(E>=0&&c>E)return"";const P=Eo(t.value).find(q=>q.id===h)??null;try{mt.value="";const q=await Em(h),te=q.threadId.trim();if(!te)return"";const me=q.cwd.trim()||((N=P==null?void 0:P.cwd)==null?void 0:N.trim())||"",je=vL((P==null?void 0:P.title)||(P==null?void 0:P.preview)||"Untitled thread");pn(te,me,je),ao(te,q.model),yr(te,q.messages),D.value={...D.value,[te]:!0},le.value={...le.value,[te]:!0},br(te),ja(te,[]),wr(te),L.value[te]&&(L.value=Ct(L.value,te)),Yt(te,null),Jt(te,null),en(te,null),hn(te,!1);const Je=E-c;if(Je>0){const pt=await rf(te,Je);yr(te,pt)}return await Yi(te,je),bn(te),Ds().catch(()=>{}),te}catch(q){return mt.value=q instanceof Error?q.message:"Unknown application error",""}}async function us(i,c,h=[],b=[],E=[]){if(!i||!c.trim()||h.length>0||b.length>0||E.length>0)return!1;const N=(it.value[i]??[]).filter(me=>me.method==="item/tool/requestUserInput");if(N.length!==1)return!1;const[q]=N,te=Lr(q);return te.length!==1?!1:nl({id:q.id,result:{answers:{[te[0]]:{answers:[c.trim()]}}}})}function jn(){if(typeof window>"u")return{};try{const i=window.localStorage.getItem(iv);if(!i)return{};const c=JSON.parse(i);if(!c||typeof c!="object"||Array.isArray(c))return{};const h={};for(const[b,E]of Object.entries(c)){if(!b||!Array.isArray(E))continue;const P=E.filter(N=>!!N&&typeof N=="object"&&typeof N.id=="string"&&typeof N.text=="string");P.length>0&&(h[b]=P)}return h}catch{return{}}}function Cr(){typeof window>"u"||window.localStorage.setItem(iv,JSON.stringify($e.value))}function cs(){if(typeof window>"u")return bc;try{const i=window.localStorage.getItem(lv);if(i===null)return bc;const c=Number(i);return Number.isFinite(c)&&c>=0?Math.round(c):bc}catch{return bc}}function Uu(i){const c=Number.isFinite(i)&&i>0?Math.round(i):0;c!==he.value&&(he.value=c,!(typeof window>"u")&&window.localStorage.setItem(lv,String(c)))}async function gd(i,c,h,b,E,P){if(Te||he.value<=0||Y.value[i]===!0)return!1;const N=Ze.value[i];if(!N||N.remainingContextPercent===null||N.remainingContextPercent>he.value)return!1;const q=$e.value[i]??[],te=`stash-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,me=P==="plan"?"plan":P==="default"?"default":nt.value;return $e.value={...$e.value,[i]:[...q,{id:te,text:c,imageUrls:h,skills:b,fileAttachments:E,collaborationMode:me}]},Cr(),go.value.has(i)||Wl(i),!0}async function _i(i){const c=$e.value[i];if(!c||c.length===0||Y.value[i]===!0)return;const h=[...c];$e.value=Ct($e.value,i),Cr(),Te=!0;try{for(const b of h)try{await Ji(b.text,b.imageUrls,b.skills,"steer",b.fileAttachments,void 0,b.collaborationMode)}catch{}}finally{Te=!1}}async function Ji(i,c=[],h=[],b="steer",E=[],P,N){if(vo.value)return;const q=n.value,te=i.trim();if(!q||!te&&c.length===0&&E.length===0||await us(q,te,c,h,E)||await gd(q,te,c,h,E,N))return;const me=Y.value[q]===!0;if(me&&b==="queue"){const je=pe.value[q]??[],Je=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,pt=[...je],ut=typeof P=="number"?Math.max(0,Math.min(P,pt.length)):pt.length;pt.splice(ut,0,{id:Je,text:te,imageUrls:c,skills:h,fileAttachments:E,collaborationMode:N==="plan"?"plan":N==="default"?"default":nt.value}),pe.value={...pe.value,[q]:pt},ca();return}if(me){eo=!0,Qi(q,te,c,h,E,N).catch(je=>{const Je=je instanceof Error?je.message:"Unknown application error";en(q,Je),mt.value=Je});return}mt.value="",eo=!0,Yt(q,null),Jt(q,{label:"Thinking",details:so(ln(q),_t.value,N==="plan"?"plan":N==="default"?"default":nt.value)}),en(q,null),hn(q,!0);try{await Qi(q,te,c,h,E,N)}catch(je){eo=!1,hn(q,!1),Jt(q,null);const Je=je instanceof Error?je.message:"Unknown application error";throw en(q,Je),mt.value=Je,je}}async function ki(i,c,h=[],b=[],E=[]){if(vo.value)return"";const P=i.trim(),N=c.trim(),q=ln(ri).trim(),te=nt.value;if(!P&&h.length===0&&E.length===0)return"";Bn.value=!0,mt.value="";let me="";try{try{const ut=await Pm(N||void 0,q||void 0);me=ut.threadId,ao(me,ut.model),ea(me,ut.modelProvider||gt.value),Lo(me,te)}catch(ut){if(q&&q!==ma&&xc(ut)){await ko();const Et=await Pm(N||void 0,ma);me=Et.threadId,ao(me,Et.model),ea(me,Et.modelProvider||gt.value),Lo(me,te)}else throw ut}if(!me)return"";pn(me,N,P||"[Image]"),ui(me,P,h,b,E),lo(me),le.value={...le.value,[me]:!0},bn(me),eo=!0,Yt(me,null),Jt(me,{label:"Thinking",details:so(ln(me),_t.value,te)}),en(me,null),hn(me,!0);const je=me,Je=N||null,pt=P;return Qi(me,P,h,b,E,te).catch(ut=>{eo=!1,hn(me,!1),Jt(me,null);const Et=ut instanceof Error?ut.message:"Unknown application error";en(me,Et),mt.value=Et}).finally(()=>{Bn.value=!1}),Fu(je,pt,Je,h,E),me}catch(je){eo=!1,me&&(hn(me,!1),Jt(me,null));const Je=je instanceof Error?je.message:"Unknown application error";throw me&&en(me,Je),mt.value=Je,Bn.value=!1,je}}async function Qi(i,c,h=[],b=[],E=[],P){const N=_t.value,q=P==="plan"?"plan":P==="default"?"default":nt.value,te=c.trim(),me=[...h];if(me.length===0&&Es(te)){const pt=xt(i);pt&&me.push(pt)}const je=b.map(pt=>({name:pt.name,path:pt.path})),Je=E.map(pt=>({...pt}));Ir(i,{text:te,imageUrls:[...me],skills:je,fileAttachments:Je,effort:N,collaborationMode:q,fallbackRetried:!1});try{if(le.value[i]!==!0){const Et=await of(i);Et.model&&ao(i,Mn(i,Et.model,Et.modelProvider)),Et.modelProvider&&ea(i,Et.modelProvider),le.value={...le.value,[i]:!0}}const pt=ln(i);let ut="";try{ut=await af(i,c,me,pt||void 0,N||void 0,b.length>0?b:void 0,E,q)}catch(Et){if(pt&&pt!==ma&&xc(Et))await ko(i),Ir(i,{text:te,imageUrls:[...me],skills:je,fileAttachments:Je,effort:N,collaborationMode:q,fallbackRetried:!0}),ut=await af(i,c,me,ma,N||void 0,b.length>0?b:void 0,E,q);else throw Et}ut&&(Ee.value={...Ee.value,[i]:ut},er(i,ut)),Xt.add(i),await zr(),O(i)}catch(pt){throw pt}}async function Xi(i){if(Ue.value[i]!==!0){Ue.value={...Ue.value,[i]:!0};try{pe.value=await jm()}catch{}finally{Ue.value=Ct(Ue.value,i)}}}function zl(i){Xi(i),!(typeof window>"u")&&window.setTimeout(()=>{Xi(i)},650)}async function Bu(){const i=n.value;if(!i||Y.value[i]!==!0||be.value[i]===!0)return;let c=Ee.value[i];if(!c){const{activeTurnId:P}=await nf(i);c=P,c&&(Ee.value={...Ee.value,[i]:c})}if(!c)throw new Error("Could not determine active turn id for interrupt");const h=_o.value.filter(P=>P.turnId===c),b=h.find(P=>P.role==="user"),E=h.some(P=>{if(P.role==="assistant")return!0;const N=P.messageType??"";return N==="commandExecution"||N==="toolCall"||N==="worked"||N==="fileChange"||N==="plan"||N==="plan.live"||N==="compaction.done"||N==="turnError"});Jo.value=!0,mt.value="";try{if(await U1(i,c),hn(i,!1),Jt(i,null),en(i,null),Ee.value[i]&&(Ee.value=Ct(Ee.value,i)),Xt.add(i),yn=!0,await zr(),b&&!E){const P=(o.value[i]??[]).filter(q=>q.turnId!==c);yr(i,P);const N=f.value[i];if(N){const q=N.filter(te=>te.turnId!==c);q.length!==N.length&&(f.value={...f.value,[i]:q},kc(f.value))}Ve.value={...Ve.value,[i]:{text:b.text??"",imageUrls:b.images??[],fileAttachments:(b.fileAttachments??[]).map(q=>({label:q.label,path:q.path,fsPath:q.fsPath??q.path})),skills:b.skills??[]}}}}catch(P){const N=P instanceof Error?P.message:"Failed to interrupt active turn";en(i,N),mt.value=N}finally{Jo.value=!1}}function Hl(i){i&&Ve.value[i]&&(Ve.value=Ct(Ve.value,i))}async function yd(i){var h,b;const c=n.value;if(c&&!Qn.value&&i.trim()){Qn.value=!0,mt.value="";try{Y.value[c]===!0&&await Bu();const E=o.value[c]??[],P=E.find(Je=>Je.turnId===i),N=typeof(P==null?void 0:P.turnIndex)=="number"?P.turnIndex:-1;if(N<0)return;const q=E.reduce((Je,pt)=>typeof pt.turnIndex=="number"&&pt.turnIndex>Je?pt.turnIndex:Je,-1);if(q<0||N>q)return;const te=q-N+1;if(te<1)return;const me=((b=(h=hr.value)==null?void 0:h.cwd)==null?void 0:b.trim())??"";me&&await N1(c,i,me);const je=await rf(c,te);yr(c,je),ja(c,[]),wr(c),L.value[c]&&(L.value=Ct(L.value,c)),Yt(c,null),Jt(c,null),en(c,null),yn=!0,await zr()}catch(E){mt.value=E instanceof Error?E.message:"Failed to rollback thread"}finally{Qn.value=!1}}}function Tr(i,c){const b=(l.value[i]??[]).filter(E=>E.messageType!=="compaction.pending"&&E.messageType!=="compaction.done");b.push({id:`compaction:${c}:${i}:${Date.now()}`,role:"system",text:"",messageType:c==="pending"?"compaction.pending":"compaction.done"}),l.value={...l.value,[i]:b}}function Us(i,c){const h=new Set(go.value);c?h.add(i):h.delete(i),go.value=h}function Zi(i){gn=i.trim(),dr.value=[]}async function Wl(i){const c=i.trim();if(!(!c||go.value.has(c))){Us(c,!0),Tr(c,"pending");try{await M1(c);const h=2e3,b=14,E=Date.now()+Qo;let P=0;for(;Date.now()<E&&P<b&&go.value.has(c);){if((await nf(c)).messages.some(te=>te.messageType==="compaction.done")){Us(c,!1),n.value===c&&await da(c,{silent:!0,force:!0}),Tr(c,"done"),_i(c);break}P+=1,await fN(h)}go.value.has(c)&&(Us(c,!1),Tr(c,"done"),_i(c))}catch(h){mt.value=h instanceof Error?h.message:"Failed to compact thread",Us(c,!1),Tr(c,"done"),_i(c)}}}let mn=null;async function el(i,c){try{const h=await ml(),b={...h.labels};let E=!1;for(const P of h.order){if(!Lc(P,i))continue;const N=c.trim();N.length===0?b[P]!==void 0&&(delete b[P],E=!0):b[P]!==N&&(b[P]=N,E=!0)}E&&await sf({order:h.order,labels:b,active:h.active,projectOrder:h.projectOrder})}catch{}}function wd(i,c){i.length===0||(Be.value[i]??"")===c||(Be.value={...Be.value,[i]:c},wv(Be.value),mn!==null&&clearTimeout(mn),mn=setTimeout(()=>{mn=null,el(i,c)},500))}async function tl(i){var P;if(i.length===0)return;const c=H.value.filter(N=>N!==i);if(ws(H.value,c)||(H.value=c,iu(H.value)),t.value=t.value.filter(N=>N.projectName!==i),Be.value[i]!==void 0){const N={...Be.value};delete N[i],Be.value=N,wv(N)}jt();const h=Eo(e.value);io(h),h.some(N=>N.id===n.value)||bn(((P=h[0])==null?void 0:P.id)??"");const E=new Set;try{const N=await ml();dL(N,i).forEach(q=>{E.add(q)})}catch{}if(E.size>0)try{const N=await ml(),q=N.order.filter(je=>!E.has(je)),te=N.active.filter(je=>!E.has(je)),me=te.length===0&&q.length>0?[q[0]]:te;await sf({order:q,labels:rL(N.labels,E),active:me,projectOrder:N.projectOrder.filter(je=>je!==i&&!E.has(je))});return}catch{}await Ci()}function bd(i,c){if(i.length===0||t.value.length===0)return;const h=t.value.map(te=>te.projectName),b=h.indexOf(i);if(b===-1)return;const E=Math.max(0,Math.min(c,h.length-1)),P=HN(h,b,E);if(P===h)return;const N=fl(P,t.value);H.value=N,iu(H.value);const q=vf(t.value,H.value);t.value=Pc(t.value,q),jt(),Ci()}function qu(i){const c=i.trim();if(!c)return;const h=[c,...H.value.filter(E=>E!==c)];if(ws(H.value,h))return;H.value=h,iu(H.value);const b=vf(t.value,H.value);t.value=Pc(t.value,b),jt(),Ci()}async function Ci(){try{const i=await ml(),c=fL(i,H.value,t.value);await sf({order:c.order,labels:i.labels,active:c.active,projectOrder:c.projectOrder})}catch{}}async function zr(){if(nn.value){typeof window<"u"&&ht===null&&(ht=window.setTimeout(()=>{ht=null,zr()},_c));return}nn.value=!0;const i=yn,c=Qr,h=new Set(Xt);yn=!1,Qr=!1,Xt.clear();try{i&&await Ds({force:c});const b=n.value;if(!b)return;const E=h.has(b),P=Y.value[b]===!0,N=co(b),q=$.value[b]??"";(N.length>0&&N!==q||E||P&&D.value[b]!==!0||i&&D.value[b]!==!0)&&await da(b,{silent:!0,force:E})}catch{}finally{nn.value=!1,(yn||Xt.size>0)&&typeof window<"u"&&ht===null&&(ht=window.setTimeout(()=>{ht=null,zr()},_c))}}async function zu(){await Wu(),yn=!Xn.value,n.value&&D.value[n.value]!==!0&&Xt.add(n.value),await zr()}function Vl(i){const c=qe(i.params),h=typeof(c==null?void 0:c.threadId)=="string"?c.threadId.trim():"";if(!h)return;const b=qe(c==null?void 0:c.externalSession),E=b&&typeof b.origin=="string"&&b.origin.trim().length>0?{origin:b.origin.trim(),active:b.active===!0,lastWriteAt:typeof b.lastWriteAt=="string"?b.lastWriteAt:null}:null;Fe.value={...Fe.value,[h]:E},hn(h,(E==null?void 0:E.active)===!0),jt(),yn=!0,n.value===h&&Xt.add(h),ht===null&&typeof window<"u"&&(ht=window.setTimeout(()=>{ht=null,zr()},_c))}function Hu(){typeof window>"u"||Gt||(Wu(),_d(),Gt=w1(i=>{if(i.method==="ready"){Rs(),zu();return}if(i.method==="externalSessionChanged"){Vl(i);return}Os(i),Ua(i)}))}async function Wu(){try{const c=(await xm()).map(h=>ns(h)).filter(h=>h!==null);kr(c)}catch{}}async function _d(){try{const i=await AS(),c=Object.entries(i);if(c.length===0)return;const h={...f.value};let b=!1;for(const[E,P]of c){const N=P.filter(je=>!!je&&typeof je.id=="string");if(N.length===0)continue;const q=h[E]??[],te=new Set(q.map(je=>je.text)),me=[...q];for(const je of N)te.has(je.text)||(me.push(je),te.add(je.text));h[E]=me.slice(-20),b=!0}b&&(f.value=h,kc(h))}catch{}}async function nl(i){try{return await k1(i.id,{result:i.result,error:i.error}),nr(i.id),ve.value=Ct(ve.value,String(i.id)),!0}catch(c){const h=c instanceof Error?c.message:"Failed to reply to server request";return await Gl(i.id)?(mt.value=h,ve.value={...ve.value,[String(i.id)]:h},!1):(nr(i.id),ve.value=Ct(ve.value,String(i.id)),!0)}}async function Gl(i){try{const c=await xm();for(const h of c){const b=qe(h);if((b==null?void 0:b.id)===i)return!0}return!1}catch{return!0}}function kd(){if(Gt&&(Gt(),Gt=null),yn=!1,Xt.clear(),qn.clear(),ht!==null&&typeof window<"u"&&(window.clearTimeout(ht),ht=null),Xo!==null&&typeof window<"u"&&(window.clearTimeout(Xo),Xo=null),$o!==null&&typeof window<"u"&&(window.clearTimeout($o),$o=null),typeof window<"u")for(const i of sn.values())window.clearTimeout(i);sn.clear(),eo=!1,o.value={},r.value={},a.value={},m.value={},f.value={},L.value={},B.value={},oe.value={},we.value={},Ce.value={},ce.value={},Ee.value={},R.clear(),w.clear(),x.clear(),oi.clear(),Oc=0,be.value={},Oe.value={},Re.value={},pe.value={},Ue.value={},$e.value={},Cr(),ca(),It.value=null,Ze.value={}}const Ti=ee(()=>{const i=n.value;if(!i)return[];const c=pe.value[i]??[];return[...($e.value[i]??[]).map(E=>({...E,awaitingCompaction:!0})),...c]});function ol(i){const c=n.value;if(!c)return;const h=$e.value[c];if(h!=null&&h.some(P=>P.id===i)){const P=h.filter(N=>N.id!==i);$e.value=P.length>0?{...$e.value,[c]:P}:Ct($e.value,c),Cr();return}const b=pe.value[c];if(!b)return;const E=b.filter(P=>P.id!==i);pe.value=E.length>0?{...pe.value,[c]:E}:Ct(pe.value,c),ca()}function Kl(i,c){const h=n.value;if(!h)return;const b=pe.value[h];if(!b)return;const E=$e.value[h];if(E!=null&&E.some(me=>me.id===i||me.id===c))return;const P=b.findIndex(me=>me.id===i),N=b.findIndex(me=>me.id===c);if(P<0||N<0||P===N)return;const q=[...b],[te]=q.splice(P,1);q.splice(N,0,te),pe.value={...pe.value,[h]:q},ca()}function ds(i){const c=n.value;if(!c)return;const h=$e.value[c],b=h==null?void 0:h.find(N=>N.id===i);if(b){ol(i),Hn(b.collaborationMode),Te=!0,Ji(b.text,b.imageUrls,b.skills,"steer",b.fileAttachments).finally(()=>{Te=!1});return}const E=pe.value[c];if(!E)return;const P=E.find(N=>N.id===i);P&&(ol(i),Hn(P.collaborationMode),Ji(P.text,P.imageUrls,P.skills,"steer",P.fileAttachments))}function Cd(i,c={}){bn(i,c)}return{projectGroups:e,projectDisplayNameById:Be,selectedThread:hr,selectedThreadTokenUsage:to,selectedThreadTerminalOpen:Zr,isSelectedThreadInterruptPending:Ia,selectedThreadServerRequests:Pr,selectedLiveOverlay:Xa,selectedActiveTurnId:Er,lastPlanByThreadId:s,resolveThreadTurnIndex:Ol,codexQuota:Ra,selectedThreadId:n,availableCollaborationModes:St,availableModelIds:De,availableModelReasoningEfforts:Ye,selectedCollaborationMode:nt,selectedModelId:dt,selectedReasoningEffort:_t,selectedSpeedMode:Tt,codexCliMissingError:se,installedSkills:Q,accountRateLimitSnapshots:de,messages:_o,hasMoreOlderMessages:wt,isLoadingThreads:ot,isThreadListFullyLoaded:Vt,isLoadingMessages:Ft,isLoadingOlderMessages:Rn,isSendingMessage:Bn,isInterruptingTurn:Jo,isUpdatingSpeedMode:vo,isRollingBack:Qn,compactingThreadIds:go,fuzzyFileSearchResults:dr,registerFuzzyFileSearchSession:Zi,error:mt,refreshAll:wi,refreshSkills:Fs,refreshHooks:Ki,hooksList:Le,isHooksLoading:We,onRealtimeEvent:Ls,selectThread:za,loadMessages:da,loadOlderMessages:qr,ensureThreadMessagesLoaded:yi,setThreadTerminalOpen:gr,toggleSelectedThreadTerminal:Wi,archiveThreadById:Bl,compactThreadById:Wl,renameThreadById:Yi,forkThreadById:ql,forkThreadFromTurn:bi,rollbackSelectedThread:yd,sendMessageToSelectedThread:Ji,sendMessageToNewThread:ki,interruptSelectedThreadTurn:Bu,interruptedUnsubmittedMessage:no,clearInterruptedUnsubmittedMessage:Hl,selectedThreadQueuedMessages:Ti,removeQueuedMessage:ol,reorderQueuedMessage:Kl,steerQueuedMessage:ds,autoCompactThreshold:he,setAutoCompactThreshold:Uu,setSelectedCollaborationMode:Hn,readModelIdForThread:ln,setSelectedModelIdForThread:Sn,setSelectedModelId:ro,setSelectedReasoningEffort:fn,updateSelectedSpeedMode:$t,respondToPendingServerRequest:nl,pendingReplyErrorForRequest:or,renameProject:wd,removeProject:tl,reorderProject:bd,pinProjectToTop:qu,startPolling:Hu,stopPolling:kd,primeSelectedThread:Cd}}const kL={class:"sidebar-root"},CL=["aria-pressed","aria-label","title"],TL={key:1,class:"sidebar-search-bar"},SL=["placeholder"],xL=["aria-label"],AL={class:"sidebar-skills-link-icon","aria-hidden":"true"},PL={class:"sidebar-skills-link-copy"},EL={class:"sidebar-skills-link-title"},IL={class:"sidebar-skills-link-subtitle"},RL={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},ML={class:"sidebar-skills-link-copy"},$L={class:"sidebar-skills-link-title"},jL={class:"sidebar-skills-link-subtitle"},NL=["aria-label"],LL={class:"settings-dialog-header"},OL={class:"settings-dialog-title"},DL=["aria-label","title"],FL={class:"settings-dialog-body"},UL=["aria-label"],BL=["aria-current","onClick"],qL={class:"settings-group-content"},zL={class:"sidebar-settings-account-section"},HL={class:"sidebar-settings-account-header"},WL={class:"sidebar-settings-account-header-main"},VL=["aria-expanded","title"],GL={class:"sidebar-settings-account-collapse-icon"},KL={class:"sidebar-settings-account-title"},YL={class:"sidebar-settings-account-count"},JL=["disabled"],QL={key:0,class:"sidebar-settings-account-error visible-error-with-feedback"},XL=["href"],ZL={class:"sidebar-settings-account-login"},eO=["disabled"],tO=["href"],nO={key:1,class:"sidebar-settings-account-empty"},oO={key:2,class:"sidebar-settings-account-list"},rO=["title","onMouseenter","onMouseleave"],aO={class:"sidebar-settings-account-main"},sO={class:"sidebar-settings-account-email"},iO={class:"sidebar-settings-account-meta"},lO={class:"sidebar-settings-account-quota"},uO={class:"sidebar-settings-account-id"},cO={class:"sidebar-settings-account-actions"},dO=["disabled","onClick"],fO=["disabled","onClick"],pO=["title"],hO={class:"sidebar-settings-label"},mO=["title"],vO={class:"sidebar-settings-label"},gO={class:"sidebar-settings-value"},yO=["title"],wO={class:"sidebar-settings-label"},bO={class:"sidebar-settings-value"},_O=["title"],kO={class:"sidebar-settings-label"},CO=["title"],TO={class:"sidebar-settings-label"},SO={class:"sidebar-settings-value"},xO=["title"],AO={class:"sidebar-settings-label"},PO=["title"],EO={class:"sidebar-settings-label"},IO=["title"],RO={class:"sidebar-settings-label"},MO=["title"],$O={class:"sidebar-settings-label"},jO=["href"],NO={class:"sidebar-settings-label"},LO={class:"sidebar-settings-value"},OO=["title"],DO={class:"sidebar-settings-label"},FO={key:0,class:"sidebar-settings-row sidebar-settings-error"},UO=["href"],BO={key:1,class:"sidebar-settings-row sidebar-settings-row--input"},qO={class:"sidebar-settings-provider-info"},zO={class:"sidebar-settings-label"},HO={class:"sidebar-settings-provider-link",href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer"},WO={class:"sidebar-settings-key-group"},VO={class:"sidebar-settings-key-masked"},GO=["disabled","title"],KO=["placeholder"],YO=["disabled"],JO={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},QO={class:"sidebar-settings-label"},XO=["aria-label"],ZO=["disabled"],eD=["disabled"],tD={key:2,class:"sidebar-settings-row sidebar-settings-row--input"},nD={class:"sidebar-settings-provider-info"},oD={class:"sidebar-settings-label"},rD={class:"sidebar-settings-provider-link",href:"https://opencode.ai/auth",target:"_blank",rel:"noopener noreferrer"},aD={class:"sidebar-settings-key-group"},sD=["placeholder"],iD=["disabled"],lD={key:3,class:"sidebar-settings-row sidebar-settings-row--input"},uD={class:"sidebar-settings-label"},cD={class:"sidebar-settings-key-group"},dD=["placeholder"],fD={class:"sidebar-settings-label",style:{"margin-top":"4px"}},pD={class:"sidebar-settings-key-group"},hD=["placeholder"],mD=["disabled"],vD={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},gD={class:"sidebar-settings-label"},yD=["aria-label"],wD={class:"sidebar-settings-label"},bD={class:"sidebar-settings-value"},_D={key:0,class:"sidebar-settings-telegram-panel"},kD={class:"sidebar-settings-field"},CD={class:"sidebar-settings-field-label"},TD={class:"sidebar-settings-field"},SD={class:"sidebar-settings-field-label"},xD={class:"sidebar-settings-field-help"},AD={key:0,class:"sidebar-settings-telegram-error"},PD=["href"],ED={class:"sidebar-settings-telegram-actions"},ID=["disabled"],RD={class:"sidebar-settings-hooks-section"},MD={class:"sidebar-settings-hooks-header"},$D={class:"sidebar-settings-hooks-title"},jD=["disabled","title"],ND={key:0,class:"sidebar-settings-hooks-empty"},LD={key:0,class:"sidebar-settings-hooks-empty"},OD={key:1,class:"sidebar-settings-hooks-empty"},DD={key:2,class:"sidebar-settings-hooks-list"},FD={class:"sidebar-settings-hooks-cwd"},UD={class:"sidebar-settings-hooks-event"},BD={class:"sidebar-settings-hooks-command"},qD={class:"sidebar-settings-remote-section"},zD={class:"sidebar-settings-remote-header"},HD={class:"sidebar-settings-remote-title"},WD=["disabled","title"],VD={class:"sidebar-settings-remote-toggle-label"},GD={key:0,class:"sidebar-settings-remote-empty"},KD={key:0,class:"sidebar-settings-remote-error"},YD={key:1,class:"sidebar-settings-remote-notice"},JD={key:2,class:"sidebar-settings-remote-empty"},QD=["disabled"],XD={class:"sidebar-settings-remote-label"},ZD={class:"sidebar-settings-remote-value"},eF={class:"sidebar-settings-remote-clients"},tF={class:"sidebar-settings-remote-clients-header"},nF={class:"sidebar-settings-remote-label"},oF=["disabled"],rF={key:0,class:"sidebar-settings-remote-empty"},aF={class:"sidebar-settings-remote-client-name"},sF=["disabled","onClick"],iF={class:"sidebar-settings-rate-limits"},lF=["aria-label"],uF={class:"sidebar-settings-actions"},cF=["title","aria-label"],dF=["title","aria-label"],fF={class:"content-root-wrap"},pF={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},hF={key:1,class:"skills-route-header-icon","aria-hidden":"true"},mF={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},vF=["aria-label","title"],gF={class:"content-body"},yF={key:2,class:"content-grid content-grid-home"},wF={class:"new-thread-empty"},bF={class:"new-thread-hero"},_F=["title"],kF={class:"new-thread-folder-actions"},CF=["disabled"],TF={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},SF={class:"new-thread-launch-card-copy"},xF={class:"new-thread-launch-card-topline"},AF={class:"new-thread-launch-card-badge","aria-hidden":"true"},PF={class:"new-thread-launch-card-eyebrow"},EF={class:"new-thread-launch-card-title"},IF={class:"new-thread-launch-card-text"},RF={class:"new-thread-launch-card-actions"},MF=["aria-label","onKeydown"],$F={class:"new-thread-open-folder-header"},jF={class:"new-thread-open-folder-title"},NF={class:"new-thread-open-folder-label"},LF={class:"new-thread-open-folder-current"},OF=["placeholder","title","disabled","onKeydown"],DF=["disabled"],FF={class:"new-thread-open-folder-actions"},UF={class:"new-thread-open-folder-toggle"},BF=["aria-pressed","disabled"],qF={key:0,class:"new-thread-open-folder-create"},zF={class:"new-thread-open-folder-create-composer"},HF=["placeholder","onKeydown"],WF=["disabled"],VF={key:0,class:"new-thread-open-folder-error visible-error-with-feedback"},GF=["href"],KF=["placeholder","onKeydown"],YF={key:1,class:"new-thread-open-folder-error-actions"},JF={class:"new-thread-open-folder-error visible-error-with-feedback"},QF=["href"],XF=["disabled"],ZF={key:2,class:"new-thread-open-folder-status"},eU={key:3,class:"new-thread-open-folder-status"},tU={key:4,class:"new-thread-open-folder-list"},nU=["title","disabled","onClick"],oU={class:"new-thread-open-folder-item-name"},rU=["disabled","onClick"],aU=["aria-label","onKeydown"],sU={class:"new-thread-open-folder-header"},iU={class:"new-thread-open-folder-title"},lU=["disabled"],uU=["aria-label"],cU=["aria-selected","disabled"],dU=["aria-selected","disabled"],fU={class:"new-thread-project-field"},pU={class:"new-thread-open-folder-label"},hU=["disabled","placeholder"],mU={key:0,class:"new-thread-project-field"},vU={class:"new-thread-open-folder-label"},gU=["disabled","placeholder","onKeydown"],yU={key:1,class:"new-thread-project-field"},wU={class:"new-thread-open-folder-label"},bU=["disabled","onKeydown"],_U={key:2,class:"new-thread-open-folder-error visible-error-with-feedback"},kU=["href"],CU={class:"new-thread-project-modal-actions"},TU=["disabled"],SU=["disabled"],xU={key:3,class:"new-thread-branch-select"},AU={class:"new-thread-branch-select-label"},PU={class:"new-thread-branch-select-help"},EU={key:4,class:"new-thread-runtime-help"},IU={class:"worktree-init-status-title"},RU={class:"worktree-init-status-message"},MU={class:"composer-with-queue"},$U={key:0,class:"composer-runtime-error",role:"alert"},jU=["href"],NU={key:3,class:"content-grid"},LU={class:"content-thread"},OU={key:0,class:"external-session-banner",role:"alert"},DU={key:1,class:"composer-runtime-error",role:"alert"},FU=["href"],UU={key:2,class:"interrupt-recovered-banner",role:"status"},BU=["aria-label"],qU={class:"content-right-panel-header"},zU={class:"content-right-panel-tabs",role:"tablist"},HU=["aria-selected"],WU=["aria-selected"],VU=["aria-selected","title","onClick"],GU={class:"content-right-panel-tab-label"},KU=["aria-label","title","onClick"],YU={class:"content-right-panel-actions"},JU={class:"content-right-panel-add-wrap"},QU=["aria-label","title"],XU={key:0,class:"content-right-panel-menu"},ZU=["aria-label","title"],e4={class:"content-right-panel-body"},t4={key:0,class:"project-zip-modal-backdrop",role:"presentation"},n4=["aria-label"],o4={class:"project-zip-modal-header"},r4={class:"project-zip-modal-title"},a4=["aria-label","disabled"],s4={class:"project-zip-modal-copy"},i4={class:"project-zip-progress-label",role:"status","aria-live":"polite"},l4={class:"project-zip-progress-track"},u4={key:0,class:"project-zip-modal-error",role:"alert"},c4={class:"project-zip-modal-actions"},d4=["disabled"],f4=["disabled"],p4=["disabled"],h4=["aria-label"],m4={class:"codex-login-modal-header"},v4={class:"codex-login-modal-title"},g4=["aria-label","disabled"],y4={class:"codex-login-modal-copy"},w4=["href"],b4=["placeholder","disabled"],_4={key:1,class:"codex-login-modal-error visible-error-with-feedback"},k4=["href"],C4={class:"codex-login-modal-actions"},T4=["disabled"],S4=["disabled"],Cv="codex-web-local.sidebar-collapsed.v1",Tv="codex-web-local.accounts-section-collapsed.v1",Sv="codex-web-local.right-panel-width.v1",x4=260,A4=640,xv=320,P4=400,Av="codex-web-local.send-with-enter.v1",Pv="codex-web-local.in-progress-send-mode.v1",Ev="codex-web-local.dark-mode.v1",Iv="codex-web-local.dictation-click-to-toggle.v1",Rv="codex-web-local.dictation-auto-send.v1",Mv="codex-web-local.dictation-language.v1",$v="codex-web-local.chat-width.v1",E4=400,I4=Nn({__name:"App",setup(e){var lh,uh;const t=nu(()=>au(()=>import("./ThreadConversation-DYiDMOhU.js"),__vite__mapDeps([0,1,2]))),n=nu(()=>au(()=>import("./ThreadTerminalPanel-CgxRx_qQ.js"),__vite__mapDeps([3,4]))),o=nu(()=>au(()=>import("./ReviewPane-BI8SWSDv.js"),__vite__mapDeps([5,6]))),r=nu(()=>au(()=>import("./DirectoryHub-BOxKTf5g.js"),__vite__mapDeps([7,1,8]))),s=nu(()=>au(()=>import("./AutomationsPanel-Dp8RsslP.js"),__vite__mapDeps([9,10]))),{t:a,uiLanguage:l,uiLanguageOptions:f,setUiLanguage:m}=Ar(),g="codex-mobile",w="0.1.88",x={sendWithEnter:a("When enabled, press Enter to send. When disabled, use Command+Enter to send."),inProgressSendMode:a("If a turn is still running, choose whether a new prompt should steer the current turn or be queued."),appearance:a("Switch between system theme, light mode, and dark mode."),chatWidth:a("Choose how wide the conversation column and composer can grow on desktop screens."),dictationClickToToggle:a("Use click-to-start and click-to-stop dictation instead of hold-to-talk."),dictationAutoSend:a("Automatically send transcribed dictation when recording stops."),dictationLanguage:a("Choose transcription language or keep auto-detect.")},R={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},L={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:B,projectDisplayNameById:Y,selectedThread:ae,selectedThreadTokenUsage:z,selectedThreadServerRequests:Z,selectedLiveOverlay:X,lastPlanByThreadId:ye,resolveThreadTurnIndex:Me,selectedActiveTurnId:Se,codexQuota:Fe,selectedThreadId:pe,availableCollaborationModes:Ue,availableModelIds:$e,availableModelReasoningEfforts:he,selectedCollaborationMode:Te,selectedReasoningEffort:Ae,selectedSpeedMode:Pe,codexCliMissingError:De,installedSkills:Ye,accountRateLimitSnapshots:He,messages:St,hasMoreOlderMessages:ct,isLoadingThreads:Ge,isThreadListFullyLoaded:nt,isLoadingMessages:dt,isLoadingOlderMessages:_t,isSendingMessage:Tt,isInterruptingTurn:gt,isSelectedThreadInterruptPending:se,isUpdatingSpeedMode:ne,error:re,refreshAll:H,refreshSkills:Be,refreshHooks:$,hooksList:D,isHooksLoading:G,onRealtimeEvent:ie,selectThread:le,ensureThreadMessagesLoaded:oe,loadMessages:Ce,loadOlderMessages:we,archiveThreadById:ve,compactThreadById:ce,compactingThreadIds:Ee,fuzzyFileSearchResults:be,registerFuzzyFileSearchSession:Oe,forkThreadById:Re,renameThreadById:Ve,forkThreadFromTurn:it,sendMessageToSelectedThread:yt,sendMessageToNewThread:It,interruptSelectedThreadTurn:Ze,interruptedUnsubmittedMessage:Wt,clearInterruptedUnsubmittedMessage:W,selectedThreadQueuedMessages:K,removeQueuedMessage:Q,reorderQueuedMessage:de,steerQueuedMessage:Le,autoCompactThreshold:We,setAutoCompactThreshold:ot,setSelectedCollaborationMode:Ft,readModelIdForThread:Vt,setSelectedModelIdForThread:Bn,setSelectedReasoningEffort:Jo,updateSelectedSpeedMode:vo,respondToPendingServerRequest:Qn,pendingReplyErrorForRequest:go,renameProject:Qo,removeProject:dr,reorderProject:gn,pinProjectToTop:mt,startPolling:nn,stopPolling:Xn,primeSelectedThread:Aa,rollbackSelectedThread:Es}=_L(),xt=JC(),Gt=YC(),{isMobile:ht}=yp();function Xo(){return typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}const sn=S(null),fr=S(null),yo=S(null);let Ln=null;const{buildFeedbackMailto:pr,feedbackMailtoBase:Pa,recordVisibleFailure:Ja}=xp(),Kn=Pa();function In(u,p){p&&Ja(p);const M=u.currentTarget;M instanceof HTMLAnchorElement&&(M.href=pr())}const Qa=S(null),Zn=S(null),yn=S(null),Qr=S(0);let Xt=null;function Xr(){const u=yn.value;if(!u)return;const p=window.getComputedStyle(u),M=Number.parseFloat(p.paddingLeft)+Number.parseFloat(p.paddingRight),j=Math.max(0,u.clientWidth-(Number.isFinite(M)?M:0)),U=window.getComputedStyle(u).getPropertyValue("--chat-column-max").trim(),fe=Number.parseFloat(U)*(U.endsWith("rem")?16:1),Ne=Number.isFinite(fe)&&fe>0?Math.min(j,fe):j;Qr.value=Ne}const Ea=S(null),wo=S(null),$o=S(!1),jo=S(!1),Lt=S(!0),Rt=S("git"),Yn=S([]),bo=S(""),eo=ee(()=>Yn.value.find(u=>u.key===bo.value)??null),qn=S(!1),On=S(!1),No=S(!1),hr=S(Ia());function Zr(u){return Math.min(A4,Math.max(x4,u))}function Ia(){if(typeof window>"u")return xv;const u=window.localStorage.getItem(Sv),p=Number(u);return Number.isFinite(p)?Zr(p):xv}function Pr(u){typeof window>"u"||window.localStorage.setItem(Sv,String(u))}function Er(u){u.preventDefault();const p=u.clientX,M=hr.value,j=fe=>{const Ne=p-fe.clientX;hr.value=Zr(M+Ne)},U=()=>{Pr(hr.value),window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",U)};window.addEventListener("mousemove",j),window.addEventListener("mouseup",U)}const Xa=S(null),Ra=S(!1),to=S("");let _o=!1;const no=S(!1),wt=S(""),Rn=S("local"),zn=S({}),ln=new Map,oo=S(""),Zo=S([]),mr=S(!1),Jn=S({order:[],labels:{},projectOrder:[]}),Mt=S({phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""}),wn=S({phase:"idle",title:"",message:""}),Kt=S(Xb()),bn=S(""),Sn=S(!1),ro=S(null),ao=S(null),ea=S(null),Mn=S(null),Za=S(null),Hn=S(null);let Lo=null,vr=null,ko=0,Ir=0,ta=!1,Oo=0,fn=0,$t=0,Do=0;const so=S("New Project (1)"),Rr=S(""),_n=S(!1),Ma=[{id:"general",label:"General settings"},{id:"models",label:"Models & providers"},{id:"integrations",label:"Integrations"},{id:"usage",label:"Usage & about"}],I=S("general");let O=0;function V(){if(_n.value){O=Date.now(),_n.value=!1;return}Date.now()-O<P4||(_n.value=!0)}const ge=S(e_()),et=S(!1),Ut=S(!1),jt=S(new Set);async function pn(){try{jt.value=new Set(await o1())}catch{}finally{Ut.value=!0}}const io=ee(()=>!Ut.value||jt.value.has("hooks/list")),Mr=ee(()=>!Ut.value||["remoteControl/status/read","remoteControl/enable","remoteControl/pairing/start","remoteControl/client/list"].every(u=>jt.value.has(u)));rt(_n,u=>{u&&($(),ui(),Mr.value&&ci())});const Yt=S({enabled:!1,clients:[]}),hn=S(null),Fo=S(!1),lo=S(!1),uo=S(""),er=S(""),Is=S("");let $a=null,ii=!1,Jt=null;const en=S("never"),li=S(!1),Rs=S(!1),co=S(""),gr=S("");let Wi=!1;const yr=S(!1);async function ui(u={}){if(!(u.force!==!0&&Wi)){li.value=!0,co.value="";try{en.value=await l1(),Wi=!0}catch(p){co.value=p instanceof Error?p.message:"Failed to load approval policy"}finally{li.value=!1}}}function ja(u){en.value=u}async function Dn(){Rs.value=!0,co.value="",gr.value="";try{await u1(en.value),yr.value=!0,gr.value=a("Approval policy saved"),es&&clearTimeout(es),es=setTimeout(()=>{gr.value=""},2200)}catch(u){co.value=u instanceof Error?u.message:"Failed to save approval policy"}finally{Rs.value=!1}}let es=null;async function ci(u={}){if(!(u.force!==!0&&ii)){Fo.value=!0,er.value="";try{const p=await i1();Yt.value=p,ii=!0}catch(p){er.value=p instanceof Error?p.message:"Failed to load remote control status"}finally{Fo.value=!1}}}async function di(){const u=!Yt.value.enabled;lo.value=!0,uo.value=u?"enable":"disable";try{await c1(u),Yt.value={...Yt.value,enabled:u},fi(u?"Remote control enabled":"Remote control disabled")}catch(p){er.value=p instanceof Error?p.message:"Failed to update remote control"}finally{lo.value=!1,uo.value=""}}async function Vi(){lo.value=!0,uo.value="pairing";try{hn.value=await d1()}catch(u){er.value=u instanceof Error?u.message:"Failed to start pairing"}finally{lo.value=!1,uo.value=""}}async function Ms(){lo.value=!0,uo.value="clients";try{Yt.value={...Yt.value,clients:await f1()}}catch(u){er.value=u instanceof Error?u.message:"Failed to load remote clients"}finally{lo.value=!1,uo.value=""}}async function Nl(u){lo.value=!0,uo.value=`revoke:${u}`;try{await p1(u),Yt.value={...Yt.value,clients:Yt.value.clients.filter(p=>p.clientId!==u)},fi("Remote client removed")}catch(p){er.value=p instanceof Error?p.message:"Failed to remove remote client"}finally{lo.value=!1,uo.value=""}}function fi(u){Is.value=u,$a&&clearTimeout($a),$a=setTimeout(()=>{Is.value=""},3e3)}const $r=S(""),na=S(""),wr=S([]),oa=S(null),Na=S(null),br=S(null),La=S(null),Uo=S(!1),ts=S(!1),jr=S({addedLineCount:0,removedLineCount:0}),Co=S([]),Nr=S(""),qe=S({}),ke=S(""),Wn=S(""),Oa=S({}),_r=S(""),$s=S(""),un=S(!1),ra=S(!1);function Ll(u,p){return`${u}\0${p?"with-reset-history":"without-reset-history"}`}const ns=S(null),xn=S([]),To=S(!1),fo=S(!1),tr=S(!1),$n=S(!1),os=S(!1),aa=S(""),Lr=S(""),pi=S(null),nr=S(""),or=S(""),kr=S(""),cn=S(""),sa=S($d(Av,!0)),Da=S(Ob()),ia=S(Lb()),rs=S(Db()),rr=S($d(Iv,!1)),la=S($d(Rv,!0)),Fa=S(Jb()),as=ee(()=>Qb()),Ol=ee(()=>{const{loaded:u,total:p}=Mt.value,M=jp(u);return p&&p>0?`${M} / ${jp(p)}`:u>0?M:a("Preparing...")}),hi=ee(()=>{const{loaded:u,total:p,phase:M}=Mt.value;return M==="ready"?"100%":!p||p<=0?u>0?"55%":"20%":`${Math.min(100,Math.max(5,Math.round(u/p*100)))}%`}),js=S(!1),Or=S(!1),Dr=S(!1),ua=S(""),ss=S(!1),Gi=S(null),Zt=S(!1),So=S(""),An=S("codex"),Ns=ee(()=>[{value:"codex",label:a("Codex")},{value:"openrouter",label:a("OpenRouter")},{value:"opencode-zen",label:a("OpenCode Zen")},{value:"custom",label:a("Custom endpoint")}]),ar=S(""),is=S(""),y=S("responses"),C=S("responses"),_=S(""),F=S(!1),_e=S(""),lt=S(""),Pt=S(""),Bo=S(!1),Qt=S(!1),Fn=S(""),kn=S(""),sr=S(!1),Fr=S(!1),qo=S("create"),Ls=S(""),mi=S(""),vi=S(""),Os=S(!1),Ua=S(""),zo=S(!1),Dl=S(null),Du=S(null),Ba=S(!1),Fu=S(null),vd=S(null),qa=S(""),Ur=S(""),ca=S(""),Fl=S([]),Vn=S(""),xo=S(!1),Ao=S(!1),gi=S(!1),Br=S(""),Ds=[re,De,Nr,Wn,cn,So,Pt,kn,Ua,Vn],da=ee(()=>Ds.some(u=>u.value.trim().length>0)),qr=S({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),yi=S(null),Fs=S(!1),Ki=S(!1),ls=S(typeof window<"u"?((lh=window.visualViewport)==null?void 0:lh.height)??window.innerHeight:0),Ul=S(typeof window<"u"?((uh=window.visualViewport)==null?void 0:uh.offsetTop)??0:0),wi=S(typeof window<"u"?window.innerHeight:0);let za=null,Bl=!1,Yi=!1,ql=!1,bi=0;const us=ee(()=>{const u=xt.params.threadId;return typeof u=="string"?u:""}),jn=ee(()=>xt.name==="home"),Cr=ee(()=>xt.name==="skills"),cs=ee(()=>xt.name==="automations"),Uu=ee(()=>{const u=xt.query.automationId;return typeof u=="string"?u:""}),gd=ee(()=>{var u;return cs.value?a("Automations"):Cr.value?a("Skills"):jn.value?a("Start new thread"):((u=ae.value)==null?void 0:u.title)??a("Choose a thread")}),_i=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",Ji=ee(()=>{var p,M;return(((M=(p=ae.value)==null?void 0:p.title)==null?void 0:M.trim())??"")||_i}),ki=ee(()=>St.value.filter(u=>{const p=n_(u.messageType,u.role);return p==="worked"?!0:!(p==="turnActivity.live"||p==="turnError.live"||p==="agentReasoning.live")})),Qi=new Set(["commandExecution","worked","toolCall","fileChange","agentMessage","agentMessage.live","plan"]),Xi=S(null);function zl(u,p,M){const j=typeof p.turnIndex=="number"?p.turnIndex:-1;return j<0?!1:u.some((U,fe)=>fe>M&&typeof U.turnIndex=="number"&&U.turnIndex>=j&&Qi.has(U.messageType??""))}function Bu(u,p){return u.some(M=>typeof M.turnIndex=="number"&&M.turnIndex>=p&&Qi.has(M.messageType??""))}const Hl=ee(()=>{const u=ki.value,p=dt.value;for(let fe=u.length-1;fe>=0;fe-=1){const Ne=u[fe];if(Ne.messageType!=="plan"&&Ne.messageType!=="plan.live")continue;const on=rv(Ne);if(!on||Xi.value!==null&&Ne.id===Xi.value)return null;const l_=p?!0:zl(u,Ne,fe);return{id:Ne.id,streaming:Ne.messageType==="plan.live",explanation:on.explanation,steps:on.steps,implemented:l_}}const M=pe.value?ye.value[pe.value]??null:null;if(!M)return null;const j=rv(M);if(!j)return null;const U=typeof M.turnIndex=="number"?M.turnIndex:M.turnId?Me(pe.value,M.turnId)??-1:-1;return{id:M.id,streaming:M.messageType==="plan.live",explanation:j.explanation,steps:j.steps,implemented:p?!0:U>=0?Bu(u,U):!1}}),yd=ee(()=>X.value),Tr=ee(()=>jn.value?"__new-thread__":pe.value),Us=ee(()=>Vt(Tr.value)),Zi=ee(()=>{const u=Z.value;return u.length>0?u[u.length-1]:null}),Wl=ee(()=>Zi.value?go(Zi.value.id):""),mn=ee(()=>{var u,p;return jn.value?wt.value.trim():((p=(u=ae.value)==null?void 0:u.cwd)==null?void 0:p.trim())??""}),el=ee(()=>Lt.value&&(jn.value&&mn.value.length>0||xt.name==="thread"&&pe.value.length>0)),wd=ee(()=>el.value&&Rt.value==="terminal"),tl=ee(()=>!ht.value||ls.value<=0||wi.value<=0?!1:wi.value-ls.value>120),bd=ee(()=>tl.value||wd.value&&jo.value),qu=ee(()=>{var u,p;return((p=(u=ae.value)==null?void 0:u.cwd)==null?void 0:p.trim())??wt.value.trim()}),Ci=ee(()=>{var u;return!jn.value&&((u=ae.value)==null?void 0:u.inProgress)===!0}),zr=ee(()=>{const u=pe.value;return!!u&&Ee.value.has(u)}),zu=ee(()=>{var u,p;return!jn.value&&((p=(u=ae.value)==null?void 0:u.externalSession)==null?void 0:p.active)===!0}),Vl=ee(()=>Tt.value||gt.value||Ci.value||Z.value.length>0);function Hu(){js.value&&(js.value=!1,MS(!0))}function Wu(){Hu(),Gt.push({name:"skills",query:{tab:"plugins"}})}function _d(){const u=pe.value;u&&ce(u)}function nl(u,p){const M=st(u).trim(),j=xr(M);return!M||!j?!1:p.some(U=>{const fe=st(U).trim();return fe!==M&&xr(fe)===j})}function Gl(u,p=""){const M=st(u).trim(),j=p.trim();if(j)return j;const U=xr(M),fe=[...Jn.value.order,...B.value.map(Ne=>{var on,ir;return((ir=(on=Ne.threads[0])==null?void 0:on.cwd)==null?void 0:ir.trim())??""}).filter(Boolean)];return nl(M,fe)?M:U}function kd(){const u=new Set(Jn.value.order),p=Jn.value.projectOrder.filter(M=>u.has(M));for(const M of Jn.value.order)p.includes(M)||p.push(M);return p}function Ti(u){const p=st(u).trim(),M=[...Jn.value.order,...B.value.map(j=>{var U,fe;return((fe=(U=j.threads[0])==null?void 0:U.cwd)==null?void 0:fe.trim())??""}).filter(Boolean)];return nl(p,M)?p:xr(p)}function ol(u){const p=st(u).trim();if(!p)return"";const M=[...Jn.value.order,...B.value.map(j=>{var U,fe;return((fe=(U=j.threads[0])==null?void 0:U.cwd)==null?void 0:fe.trim())??""}).filter(Boolean)];for(const j of Jn.value.order){const U=st(j).trim();if(!U)continue;const fe=xr(U),Ne=nl(U,M)?U:fe;if(U===p||Ne===p||fe===p)return U}return""}const Kl=ee(()=>{var j,U;const u=[],p=new Set;for(const fe of kd()){const Ne=fe.trim();!Ne||p.has(Ne)||(p.add(Ne),u.push({value:Ne,label:Gl(Ne,Jn.value.labels[Ne])}))}for(const fe of B.value){const Ne=((U=(j=fe.threads[0])==null?void 0:j.cwd)==null?void 0:U.trim())??"";!Ne||p.has(Ne)||Kc(Ne)||(p.add(Ne),u.push({value:Ne,label:Gl(Ne,Y.value[fe.projectName])}))}const M=wt.value.trim();return M&&!p.has(M)&&u.unshift({value:M,label:Gl(M)}),u}),ds=ee(()=>{const u=wt.value.trim();return u?zn.value[u]===!0:!1}),Cd=ee(()=>{var p,M;const u={};for(const j of B.value){const U=al(j.projectName,((M=(p=j.threads[0])==null?void 0:p.cwd)==null?void 0:M.trim())??"");u[j.projectName]=U?zn.value[U]===!0:!1}return u}),i=ee(()=>{const u=oo.value.trim(),p=[...Zo.value];return u&&!p.some(M=>M.value===u)&&p.unshift({value:u,label:u}),p}),c=ee(()=>{const u=oo.value.trim();if(!u)return"";const p=i.value.find(M=>M.value===u);return(p==null?void 0:p.label)??u}),h=ee(()=>Ur.value.trim()),b=ee(()=>{const u=Fn.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),E=ee(()=>b.value&&h.value.trim().length>0&&!Vn.value),P=ee(()=>{const u=mi.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),N=ee(()=>Ls.value.trim()?qo.value==="create"?P.value:vi.value.trim().length>0:!1),q=ee(()=>{const u=st(qa.value).trim();return u||Ur.value.trim()}),te=ee(()=>sr.value?"Creating…":"Create"),me=ee(()=>zo.value?qo.value==="clone"?a("Cloning…"):a("Creating…"):qo.value==="clone"?a("Clone repository"):a("Create project")),je=ee(()=>{const u=Ur.value.trim(),p=ca.value.trim();return!!(u&&p&&u!==p)}),Je=ee(()=>{const u=[];je.value&&u.push({key:`parent:${ca.value}`,name:"..",path:ca.value,kind:"parent"});for(const p of Fl.value)u.push({key:`directory:${p.path}`,name:p.name,path:p.path,kind:"directory"});return u}),pt=ee(()=>{const u=Br.value.trim().toLowerCase();return u?Je.value.filter(p=>p.kind==="parent"||p.name.toLowerCase().includes(u)):Je.value}),ut=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,Et=ee(()=>a(R[rs.value].label)),Ha=ee(()=>{const u=R[rs.value],p=Math.max(0,wi.value-ls.value-Ul.value);return{"--chat-column-max":u.columnMax,"--chat-card-max":u.cardMax,"--visual-viewport-height":ls.value>0?`${ls.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,Ul.value)}px`,"--virtual-keyboard-inset":`${p}px`}}),Bs=ee(()=>{if(!qr.value.configured)return a("Not configured");const u=qr.value.active?a("Online"):a("Configured (offline)"),p=qr.value.allowAllUsers?a("allow all users"):`${qr.value.allowedUsers} ${a("allowed user(s)")}`,M=`${qr.value.mappedChats} ${a("chat(s)")}, ${qr.value.mappedThreads} ${a("thread(s)")}, ${p}`,j=qr.value.lastError?`, ${a("error")}: ${qr.value.lastError}`:"";return`${u}, ${M}${j}`});Ps(()=>{var u,p;document.addEventListener("pointerdown",Bp),window.addEventListener("keydown",Dp),document.addEventListener("visibilitychange",qp),window.addEventListener("pageshow",zp),window.addEventListener("focus",Hp),window.addEventListener("resize",fa),(u=window.visualViewport)==null||u.addEventListener("resize",fa),(p=window.visualViewport)==null||p.addEventListener("scroll",fa),fa(),lc(),ut==null||ut.addEventListener("change",lc),Ln=ie(M=>{yo.value&&yo.value.refreshFromNotification(M)}),Jt=ie(M=>{M==="remoteControl/status/changed"&&ci({force:!0})}),o_(),Pb(),pn(),Gu(),Vs(),pa(),zs(),fs(),Nd(),Yw(),ui()}),rt(Ds,(u,p)=>{u.forEach((M,j)=>{if(M===p[j])return;const U=M.trim();U&&Ja(U)})}),rt(yn,u=>{Xt&&(Xt.disconnect(),Xt=null),typeof ResizeObserver<"u"&&(Xt=new ResizeObserver(Xr),u&&Xt.observe(u)),Xr()},{immediate:!0}),Nu(()=>{var u,p;document.removeEventListener("pointerdown",Bp),window.removeEventListener("keydown",Dp),document.removeEventListener("visibilitychange",qp),window.removeEventListener("pageshow",zp),window.removeEventListener("focus",Hp),window.removeEventListener("resize",fa),(u=window.visualViewport)==null||u.removeEventListener("resize",fa),(p=window.visualViewport)==null||p.removeEventListener("scroll",fa),ut==null||ut.removeEventListener("change",lc),Xt&&(Xt.disconnect(),Xt=null),za!==null&&(window.clearInterval(za),za=null),Lo&&(clearTimeout(Lo),Lo=null),rc(),Xn(),Ln&&(Ln(),Ln=null),Jt&&(Jt(),Jt=null),$a&&(clearTimeout($a),$a=null)});function fa(){var u,p;typeof window>"u"||(wi.value=Math.max(wi.value,window.innerHeight),ls.value=((u=window.visualViewport)==null?void 0:u.height)??window.innerHeight,Ul.value=((p=window.visualViewport)==null?void 0:p.offsetTop)??0)}rt(bn,u=>{const p=u.trim();if(Lo&&(clearTimeout(Lo),Lo=null),!p){Hn.value=null;return}Lo=setTimeout(()=>{kS(p,1e3).then(M=>{bn.value.trim()===p&&(Hn.value=M.threadIds)}).catch(()=>{bn.value.trim()===p&&(Hn.value=null)})},220)}),rt(tl,u=>{u||(jo.value=!1)}),rt(xn,()=>{if(typeof window>"u")return;if(!xn.value.some(p=>p.quotaStatus==="loading")){za!==null&&(window.clearInterval(za),za=null);return}za===null&&(za=window.setInterval(()=>{Bl||(Bl=!0,Jl({silent:!0}).finally(()=>{Bl=!1}))},1500))},{deep:!0}),rt(He,()=>{Sr().then(u=>{u&&H({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})})},{deep:!0});async function Sr(){if(!Yi||ql||An.value!=="codex"||xn.value.length>0||He.value.length===0)return!1;ql=!0;const u=JSON.stringify(xn.value.map(M=>M.accountId).sort());try{const M=await Am();xn.value=M.accounts}catch{await Jl({silent:!0})}const p=JSON.stringify(xn.value.map(M=>M.accountId).sort());return u!==p}function qs(){Be({force:!0})}function Vu(u){u&&Ce(u,{silent:!0,force:!0})}async function fs(){try{qr.value=await SS()}catch(u){const p=u instanceof Error?u.message:"Failed to load Telegram status";qr.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:p}}}async function zs(){try{const u=await TS();_e.value=u.botToken,lt.value=u.allowedUserIds.map(p=>String(p)).join(`
81
+ `),Pt.value=""}catch(u){Pt.value=u instanceof Error?u.message:"Failed to load Telegram configuration"}}async function Gu(){const u=await RS();js.value=u.dismissed!==!0}function Ku(u){const p=u.split(/[\n,]/).map(U=>U.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),M=p.includes("*"),j=Array.from(new Set(p.filter(U=>/^-?\d+$/.test(U)).map(U=>Number.parseInt(U,10))));return M?["*",...j]:j}async function Yu(){const u=_e.value.trim(),p=Ku(lt.value);if(!u){Pt.value=a("Telegram bot token is required.");return}if(p.length===0){Pt.value=a("At least one allowed Telegram user ID or * is required.");return}Bo.value=!0,Pt.value="";try{await CS(u,p),lt.value=p.map(M=>String(M)).join(`
82
+ `),await Promise.all([zs(),fs()]),window.alert(a("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(M){Pt.value=M instanceof Error?M.message:a("Failed to connect Telegram bot"),fs()}finally{Bo.value=!1}}function Ju(){Sn.value=!Sn.value,Sn.value?zt(()=>{var u;return(u=ao.value)==null?void 0:u.focus()}):bn.value=""}function Qu(){var u;bn.value="",(u=ao.value)==null||u.focus()}function rl(){return ro.value?ro.value:typeof document>"u"?null:document.querySelector(".mobile-drawer .sidebar-scrollable, .sidebar-scrollable")}function Xu(u){if(Kt.value||ta)return;const p=u==null?void 0:u.currentTarget,M=p instanceof HTMLElement?p:rl();ko=(M==null?void 0:M.scrollTop)??ko}function Zu(){const u=++Ir,p=ko,M=90;ta=!0;const j=()=>{u===Ir&&(ko=p,ta=!1)},U=fe=>{if(u!==Ir)return;if(Kt.value){j();return}const Ne=rl();if(Ne&&(Ne.scrollTop=p,Math.abs(Ne.scrollTop-p)<=1||fe>=M)){j();return}if(fe>=M||typeof window>"u"){j();return}window.requestAnimationFrame(()=>U(fe+1))};zt(()=>U(0))}function Ie(u){u.key==="Escape"&&(Sn.value=!1,bn.value="")}function Ot(u){u&&(xt.name==="thread"&&us.value===u||(Gt.push({name:"thread",params:{threadId:u}}),ht.value&&Po(!0)))}function Hs(u){xt.name==="automations"&&Uu.value!==u&&Gt.replace({name:"automations",query:u?{automationId:u}:{}})}async function ec(u){var p;Kt.value&&(Po(!1),await zt()),(p=sn.value)==null||p.openAutomationEditorFromPanel(u)}async function ew(){var u;Kt.value&&(Po(!1),await zt()),(u=sn.value)==null||u.openAutomationCreatorFromPanel()}function tw(){var u;xt.name==="automations"&&((u=fr.value)==null||u.loadAutomations())}async function nw(u){u&&pe.value===u&&await $b()}function ow(u){return u.length>8?u.slice(-8):u}function Pp(u){const p=[u.planType||a("unknown")];return u.authMode&&p.unshift(u.authMode),p.join(" · ")}function rw(u){if(!u)return!1;const p=u.toLowerCase();return p.includes("payment required")||/\b402\b/.test(p)}function Yl(u){return u.unavailableReason==="payment_required"||rw(u.quotaError)}function Ep(u){return To.value||fo.value||tr.value||$n.value||nr.value.length>0||u.isActive&&nr.value!==u.storageId&&Vl.value}function tc(u){return or.value===u.storageId}function Ip(u){return kr.value===u.storageId||tc(u)}function aw(u){return Yl(u)?a("Unavailable"):u.isActive?a("Active"):fo.value?a("Switching…"):a("Switch")}function sw(u){return nr.value===u.storageId?a("Removing…"):tc(u)?a("Click again to remove"):a("Remove")}function iw(u){kr.value=u}function lw(u){kr.value===u&&(kr.value=""),nr.value!==u&&or.value===u&&(or.value="")}function uw(u){const p=u.quotaSnapshot;if(!p)return null;const M=[p==null?void 0:p.primary,p==null?void 0:p.secondary].filter(fe=>fe!==null),j=M.find(fe=>fe.windowMinutes===7*24*60);if(j)return j;const U=M.filter(fe=>typeof fe.windowMinutes=="number"&&fe.windowMinutes>=7*24*60).sort((fe,Ne)=>(fe.windowMinutes??0)-(Ne.windowMinutes??0))[0]??null;return U||(p.secondary??null)}function cw(u){if(typeof u!="number"||!Number.isFinite(u))return"";const p=new Date(u*1e3);return`${p.getMonth()+1}月${p.getDate()}日`}function Rp(u){var fe,Ne;if(Yl(u))return u.quotaError||a("402 Payment Required");const p=u.quotaSnapshot,M=uw(u),j=(p==null?void 0:p.primary)??(p==null?void 0:p.secondary)??null,U=M??j;if(U){const on=Math.max(0,Math.min(100,100-Math.round(U.usedPercent))),ir=cw(U.resetsAt);return ir?`${on}% ${a("weekly remaining")} · ${ir}`:`${on}% ${a("weekly remaining")}`}return(fe=p==null?void 0:p.credits)!=null&&fe.unlimited?a("Unlimited credits"):(Ne=p==null?void 0:p.credits)!=null&&Ne.hasCredits&&p.credits.balance?`${p.credits.balance} ${a("credits")}`:u.quotaStatus==="loading"?a("Loading quota…"):u.quotaStatus==="error"?u.quotaError||a("Quota unavailable"):u.quotaStatus==="ready"||u.quotaStatus==="idle"?a("Quota unavailable"):a("Fetching account details…")}function dw(u){return[u.email||a("Account"),Pp(u),Yl(u)?a("Unavailable account"):null,Rp(u),`${a("Workspace")} ${u.accountId}`].filter(Boolean).join(`
83
+ `)}async function Jl(u={}){try{const p=await T1();xn.value=p.accounts,p.accounts.some(M=>M.storageId===kr.value)||(kr.value=""),p.accounts.some(M=>M.storageId===or.value)||(or.value="")}catch(p){if(u.silent===!0)return;cn.value=p instanceof Error?p.message:a("Failed to load accounts")}}async function fw(){if(!(To.value||fo.value||tr.value||$n.value)){cn.value="",kr.value="",or.value="",To.value=!0;try{const u=await Am();xn.value=u.accounts,Xn(),nn(),H({includeSelectedThreadMessages:!0})}catch(u){cn.value=u instanceof Error?u.message:a("Failed to refresh accounts")}finally{To.value=!1}}}async function pw(u){if(!(fo.value||To.value||tr.value||$n.value)){if(Vl.value){cn.value=a("Finish the current turn and pending requests before switching accounts.");return}cn.value="",kr.value="",or.value="",fo.value=!0;try{const p=await A1(u);xn.value=xn.value.map(M=>M.storageId===u?p:{...M,isActive:!1}),Xn(),nn(),H({includeSelectedThreadMessages:!0}),Jl({silent:!0})}catch(p){cn.value=p instanceof Error?p.message:a("Failed to switch account")}finally{fo.value=!1}}}async function hw(){var u;if(!(To.value||fo.value||tr.value||$n.value)){cn.value="",Lr.value="",tr.value=!0;try{const p=await S1();aa.value=p,os.value=!0,window.open(p,"_blank","noopener,noreferrer"),await zt(),(u=pi.value)==null||u.focus()}catch(p){cn.value=p instanceof Error?p.message:a("Failed to start Codex login")}finally{tr.value=!1}}}function Td(){$n.value||(os.value=!1,Lr.value="")}async function mw(){const u=Lr.value.trim();u&&await vw(u)}async function vw(u){if(!($n.value||u.length===0)){cn.value="",$n.value=!0;try{const p=await x1(u);xn.value=p.accounts,aa.value="",Lr.value="",os.value=!1,Xn(),nn(),H({includeSelectedThreadMessages:!0})}catch(p){cn.value=p instanceof Error?p.message:a("Failed to complete Codex login")}finally{$n.value=!1}}}async function gw(u){if(To.value||fo.value||tr.value||$n.value||nr.value.length>0)return;const p=xn.value.find(j=>j.storageId===u)??null;if(!p)return;if(or.value!==u){or.value=u;return}if(p.isActive&&Vl.value){cn.value=a("Finish the current turn and pending requests before removing the active account.");return}const M=p.isActive;cn.value="",or.value="",nr.value=u;try{const j=await P1(u);xn.value=j.accounts,Xn(),nn(),M&&H({includeSelectedThreadMessages:!0}),Jl({silent:!0})}catch(j){cn.value=j instanceof Error?j.message:a("Failed to remove account")}finally{nr.value=""}}function yw(u){ve(u)}function ww(u){H({includeSelectedThreadMessages:!1,forceThreadRefresh:!0})}async function bw(u){const p=await Re(u);p&&(jn.value?await Gt.replace({name:"thread",params:{threadId:p}}):await Gt.push({name:"thread",params:{threadId:p}}),ht.value&&Po(!0))}function Mp(u){const p=u.trim().replace(/\\/gu,"/");return p?p.includes("/.codex/worktrees/")||p.includes("/.git/worktrees/"):!1}function al(u,p=""){var fe,Ne,on;const M=B.value.find(ir=>ir.projectName===u);if(!M)return ol(u)||p.trim();const j=M.threads.find(ir=>!Mp(ir.cwd));return(((fe=j==null?void 0:j.cwd)==null?void 0:fe.trim())??((on=(Ne=M.threads[0])==null?void 0:Ne.cwd)==null?void 0:on.trim())??"")||ol(u)||p.trim()}function _w(u){var j,U;const p=B.value.find(fe=>fe.projectName===u),M=al(u,((U=(j=p==null?void 0:p.threads[0])==null?void 0:j.cwd)==null?void 0:U.trim())??"");M&&(wt.value=M),ht.value&&Po(!0),!jn.value&&Gt.push({name:"home"})}function kw(u){var M;let p="";for(const j of B.value){const U=j.threads.find(fe=>fe.id===u);if((M=U==null?void 0:U.cwd)!=null&&M.trim()){p=U.cwd.trim();break}}!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}function nc(u){var M,j;const p=B.value.find(U=>U.projectName===u);return al(u,((j=(M=p==null?void 0:p.threads[0])==null?void 0:M.cwd)==null?void 0:j.trim())??"")}const $p=ee(()=>Object.fromEntries(B.value.map(u=>[u.projectName,nc(u.projectName).trim()]).filter(([,u])=>u.length>0)));function Cw(u){return(Y.value[u]??u).trim()||u}function Tw(u){return Cw(u).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function Sw(u){const p=nc(u);!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}async function xw(u){const p=nc(u);await Lp(p)}async function Aw(u){const p=Pw(u);await Lp(p)}function Pw(u){var p;for(const M of B.value){const j=M.threads.find(U=>U.id===u);if((p=j==null?void 0:j.cwd)!=null&&p.trim())return j.cwd.trim()}return""}function jp(u){if(!Number.isFinite(u)||u<=0)return"0 B";const p=["B","KB","MB","GB"];let M=u,j=0;for(;M>=1024&&j<p.length-1;)M/=1024,j+=1;return`${M>=10||j===0?M.toFixed(0):M.toFixed(1)} ${p[j]}`}function Ew(u,p){const M=URL.createObjectURL(u),j=document.createElement("a");j.href=M,j.download=p,document.body.appendChild(j),j.click(),document.body.removeChild(j),window.setTimeout(()=>URL.revokeObjectURL(M),3e4)}async function Iw(u,p){const j={files:[new File([u],p,{type:u.type||"application/zip"})],title:p};if(!(typeof navigator<"u"&&typeof navigator.share=="function"&&(typeof navigator.canShare!="function"||navigator.canShare(j))))throw new Error("File sharing is not supported in this browser.");await navigator.share(j)}function Np(){Mt.value.phase!=="exporting"&&(Mt.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""})}function Rw(){const{blob:u,fileName:p}=Mt.value;!u||!p||(Mt.value={...Mt.value,error:""},Ew(u,p))}async function Mw(){const{blob:u,fileName:p}=Mt.value;if(!(!u||!p))try{Mt.value={...Mt.value,error:""},await Iw(u,p)}catch(M){if(M instanceof DOMException&&M.name==="AbortError")return;const j=M instanceof Error?M.message:"",U=M instanceof DOMException&&M.name==="NotAllowedError"||/permission denied|notallowed|not allowed|gesture/iu.test(j);Mt.value={...Mt.value,error:U?a("This browser blocked sharing the ZIP. Use Download instead."):j||a("Failed to share project. Use Download instead.")}}}async function Lp(u){if(!(!u||typeof document>"u")){Mt.value={phase:"exporting",loaded:0,total:null,blob:null,fileName:"",error:""};try{const{blob:p,fileName:M}=await vS(u,({loaded:j,total:U})=>{Mt.value={...Mt.value,phase:"exporting",loaded:j,total:U}});Mt.value={phase:"ready",loaded:p.size,total:p.size,blob:p,fileName:M,error:""}}catch(p){if(Mt.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""},p instanceof DOMException&&p.name==="AbortError")return;const M=p instanceof Error?p.message:"Failed to export project.";window.alert(M)}}}async function $w(u){const p=nc(u);if(!p||typeof window>"u"||(await oc(p),zn.value[p]!==!0))return;const M=`${Tw(u)}-`,j=window.prompt("New worktree folder name",M);if(j===null)return;const U=j.trim();if(U){if(U.includes("/")||U.includes("\\")||U==="."||U===".."){window.alert("Worktree name must be a single folder name.");return}try{const fe=await nS(p,U),Ne=await vc(fe.cwd,{createIfMissing:!1,label:""});if(!Ne)return;wt.value=Ne,Rn.value="local",mt(Ti(Ne)),await Vs(),await pa(),ht.value&&Po(!0),jn.value||await Gt.push({name:"home"})}catch(fe){const Ne=fe instanceof Error?fe.message:"Failed to create worktree.";window.alert(Ne)}}}function jw(){var M,j,U;const u=ae.value;if(!u)return"";const p=((M=u.projectName)==null?void 0:M.trim())??"";return p?al(p,((U=u.cwd)==null?void 0:U.trim())??""):((j=u.cwd)==null?void 0:j.trim())??""}function Sd(){const u=jw();u&&(wt.value=u),Rn.value="local",ht.value&&Po(!0),!jn.value&&Gt.push({name:"home"})}function Nw(){wt.value="",Rn.value="local",ht.value&&Po(!0),!jn.value&&Gt.push({name:"home"})}async function oc(u){const p=u.trim();if(!p||Object.prototype.hasOwnProperty.call(zn.value,p))return;const M=ln.get(p);if(M){const fe=await M;Object.prototype.hasOwnProperty.call(zn.value,p)||(zn.value={...zn.value,[p]:fe});return}const j=aS(p).then(fe=>fe.isGitRepo).catch(()=>!1).finally(()=>{ln.delete(p)});ln.set(p,j);const U=await j;Object.prototype.hasOwnProperty.call(zn.value,p)||(zn.value={...zn.value,[p]:U})}function Lw(u){Qo(u.projectName,u.displayName)}function Ow(u){Ve(u.threadId,u.title)}async function Dw(u){await dr(u),await Vs(),pa()}function Fw(u){gn(u.projectName,u.toIndex)}function Uw(u){var j,U;const p=B.value.find(fe=>fe.projectName===u),M=al(u,((U=(j=p==null?void 0:p.threads[0])==null?void 0:j.cwd)==null?void 0:U.trim())??"");oc(M)}function Op(u){Bw(u)}async function Bw(u){var j;const p=await Qn(u),M=((j=u.followUpMessageText)==null?void 0:j.trim())??"";if(!(!p||!M||jn.value))try{await yt(M,[],[],"steer",[])}catch{}}async function qw(u){const p=await it(u.threadId,u.turnIndex);p&&(await Gt.push({name:"thread",params:{threadId:p}}),pe.value!==p&&await le(p),ht.value&&Po(!0))}function Po(u){var p;if(Kt.value!==u){if(u){const M=(p=rl())==null?void 0:p.scrollTop;typeof M=="number"&&(M>0||ko===0)&&(ko=M)}Kt.value=u,Zb(u),u||Zu()}}function Dp(u){if(u.defaultPrevented)return;if(u.key==="Escape"&&_n.value){_n.value=!1;return}if(!u.ctrlKey&&!u.metaKey||u.shiftKey||u.altKey)return;const p=u.key.toLowerCase();if(p==="b"){if(!(Xo()?u.metaKey&&!u.ctrlKey:u.ctrlKey&&!u.metaKey))return;u.preventDefault(),Po(!Kt.value);return}if(p==="j"&&xt.name==="thread"&&pe.value){u.preventDefault(),Fp();return}p==="j"&&jn.value&&mn.value&&(u.preventDefault(),Fp())}function Fp(){el.value&&(ht.value&&!On.value&&(On.value=!0),ht.value||(No.value=!1),Rt.value=Rt.value==="terminal"?"git":"terminal",Rt.value!=="terminal"&&xi())}function Si(u){Rt.value=u,qn.value=!1,ht.value||(No.value=!1),ht.value&&(On.value=!0),u!=="terminal"&&xi()}function zw(u){const p=Yn.value.find(M=>M.path===u.path);if(p)bo.value=p.key;else{const M={key:`preview-${Date.now()}`,path:u.path,label:u.label};Yn.value=[...Yn.value,M],bo.value=M.key}Si("preview")}function Hw(u){Yn.value.some(p=>p.key===u)&&(bo.value=u,Si("preview"))}function Ww(u){const p=Yn.value.findIndex(U=>U.key===u);if(p<0)return;const M=Yn.value.filter(U=>U.key!==u);if(Yn.value=M,bo.value!==u)return;if(M.length===0){bo.value="",Rt.value="files";return}const j=M[Math.min(p,M.length-1)];bo.value=j.key}function Up(){if(ht.value){On.value=!1;return}No.value=!0,qn.value=!1,xi()}function Vw(){if(ht.value){On.value=!On.value;return}No.value=!No.value,No.value&&(qn.value=!1,xi())}function Gw(){Rt.value="git",ht.value&&(On.value=!1),xi()}function Kw(u){if($o.value=u,!u){jo.value=!1,rc();return}jo.value=!0,rc(),vr=setTimeout(()=>{vr=null,tl.value||(jo.value=!1)},1500)}function xi(){$o.value=!1,jo.value=!1,rc()}function rc(){vr&&(clearTimeout(vr),vr=null)}async function Yw(){try{const u=await _1();Lt.value=u.available,!u.available&&Rt.value==="terminal"&&(Rt.value="git",xi())}catch{Lt.value=!1,Rt.value==="terminal"&&(Rt.value="git")}}function Bp(u){var M,j;const p=u.target;if(p instanceof Node){if($o.value){const U=p instanceof Element?p:p.parentElement;U!=null&&U.closest(".thread-terminal-panel")||xi()}_n.value&&((M=Mn.value)!=null&&M.contains(p)||(j=Za.value)!=null&&j.contains(p)||(O=Date.now(),_n.value=!1))}}function Jw(u){var M,j;if(!_n.value)return;const p=u.target;p instanceof Node&&((M=Mn.value)!=null&&M.contains(p)||(j=Za.value)!=null&&j.contains(p)||(O=Date.now(),_n.value=!1))}function Qw(){var u;(u=sn.value)==null||u.openRecycleBin()}function qp(){if(!(typeof document>"u")&&ht.value){if(document.visibilityState==="hidden"){yi.value=Date.now(),Fs.value=!1;return}xd()}}function zp(u){u.persisted&&xd()}function Hp(){xt.name==="home"&&(Vs(),pa()),xd()}function xd(){typeof window>"u"||typeof document>"u"||!ht.value||document.visibilityState!=="visible"||Fs.value||yi.value===null||Date.now()-yi.value<E4||(Fs.value=!0,yi.value=null,Xw())}async function Xw(){if(!Ki.value){Ki.value=!0;try{await H({includeSelectedThreadMessages:!0,awaitAncillaryRefreshes:!0}),await Od()}finally{Ki.value=!1}}}function Wp(u){const p=u.text;ac();const M=Xa.value,j=u.mode==="queue"&&M&&M.threadId===pe.value?M.queueIndex:void 0;if(Xa.value=null,jn.value){r_(p,u.imageUrls,u.skills,u.fileAttachments);return}yt(p,u.imageUrls,u.skills,u.mode,u.fileAttachments,j)}function Zw(u){const p=K.value.findIndex(fe=>fe.id===u),M=p>=0?K.value[p]:void 0,j=Zn.value;if(!M||!j||j.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Xa.value=pe.value?{threadId:pe.value,queueIndex:p}:null;const U={text:M.text,imageUrls:[...M.imageUrls],fileAttachments:M.fileAttachments.map(fe=>({...fe})),skills:M.skills.map(fe=>({...fe}))};j.hydrateDraft(U),Q(u)}function ac(){if(!ht.value||jn.value)return;const u=()=>{var p;(p=Ea.value)==null||p.jumpToLatest()};u(),zt(()=>{u(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{u(),window.requestAnimationFrame(u)})})}function eb(u){wt.value=u.trim(),kn.value=""}function tb(u){oo.value=u.trim()}function Ws(u){const p=mn.value.trim();return!u||p!==u?!1:xt.name==="thread"||xt.name==="home"&&ds.value}function Vp(){Oo+=1,fn+=1,$t+=1,Do+=1,wr.value=[],oa.value=null,Na.value=null,br.value=null,La.value=null,Uo.value=!1,ts.value=!1,jr.value={addedLineCount:0,removedLineCount:0},Co.value=[],qe.value={},ke.value="",Wn.value="",Oa.value={},_r.value="",$s.value="",Nr.value="",un.value=!1}function Gp(u){const p=u.trim();if(!p){jr.value={addedLineCount:0,removedLineCount:0};return}const M=++Do;cS(p,"unstaged").then(j=>{M!==Do||!Ws(p)||(jr.value={addedLineCount:j.addedLineCount,removedLineCount:j.removedLineCount})}).catch(()=>{M!==Do||!Ws(p)||(jr.value={addedLineCount:0,removedLineCount:0})})}async function Ql(u){var j,U,fe;const p=u.trim();if(!p){Vp();return}const M=++Oo;un.value=!0,Nr.value="";try{const Ne=await rS(p);if(M!==Oo||!Ws(p))return;wr.value=Ne.options,oa.value=Ne.currentBranch,Na.value=Ne.headSha,br.value=Ne.headSubject,La.value=Ne.headDate,Uo.value=Ne.detached,ts.value=Ne.dirty,Co.value=Ne.changedFiles,Gp(p);const on=((j=Ne.currentBranch)==null?void 0:j.trim())||((fe=(U=Ne.options[0])==null?void 0:U.value)==null?void 0:fe.trim())||"";on&&Kp({branch:on,includeResetHistory:!0})}catch{if(M!==Oo||!Ws(p))return;wr.value=[],oa.value=null,Na.value=null,br.value=null,La.value=null,Uo.value=!1,ts.value=!1,jr.value={addedLineCount:0,removedLineCount:0},Co.value=[]}finally{M===Oo&&(un.value=!1)}}function nb(u){oa.value=u.currentBranch,Na.value=u.headSha,br.value=u.headSubject,La.value=u.headDate,Uo.value=u.detached,ts.value=u.dirty,Co.value=u.changedFiles,Gp(mn.value)}function ob(u){if(ra.value)return;const p=u.trim();if(!p||p===(oa.value??""))return;const M=mn.value.trim();M&&(ra.value=!0,Nr.value="",sS(M,p).then(j=>(oa.value=j||p,Na.value=null,br.value=null,La.value=null,Uo.value=!1,et.value=!1,Ql(M))).catch(j=>{const U=j instanceof Error?j.message:"Failed to switch branch";Ql(M).finally(()=>{Nr.value=U})}).finally(()=>{ra.value=!1}))}function rb(u){if(ra.value)return;const p=u.branch.trim(),M=u.sha.trim(),j=mn.value.trim();!p||!M||!j||(ra.value=!0,Nr.value="",uS(j,p,M).then(U=>(nb(U),et.value=!1,Ql(j))).catch(U=>{const fe=U instanceof Error?U.message:"Failed to reset branch to commit";Ql(j).finally(()=>{Nr.value=fe})}).finally(()=>{ra.value=!1}))}function Kp(u){const p=(typeof u=="string"?u:u.branch).trim(),M=typeof u=="string"?!0:u.includeResetHistory!==!1,j=mn.value.trim(),U=Ll(p,M);if(!p||!j||ke.value===U||(Wn.value="",qe.value[U]))return;const fe=++fn;ke.value=U,iS(j,p,{includeResetHistory:M}).then(Ne=>{fe!==fn||!Ws(j)||(qe.value={...qe.value,[U]:Ne})}).catch(Ne=>{fe!==fn||!Ws(j)||(Wn.value=Ne instanceof Error?Ne.message:"Failed to load branch commits")}).finally(()=>{fe===fn&&ke.value===U&&(ke.value="")})}function ab(u){const p=u.trim(),M=mn.value.trim();if(!p||!M||_r.value===p||($s.value="",Oa.value[p]))return;const j=++$t;_r.value=p,lS(M,p).then(U=>{j!==$t||!Ws(M)||(Oa.value={...Oa.value,[p]:U})}).catch(U=>{j!==$t||!Ws(M)||($s.value=U instanceof Error?U.message:"Failed to load commit files")}).finally(()=>{j===$t&&_r.value===p&&(_r.value="")})}function sb(u){const p=u.path.trim(),M=u.sha.trim();!p||!M||($r.value=p,na.value=M,et.value=!0)}function ib(){$r.value="",na.value="",et.value=!et.value}function lb(){!$r.value&&!na.value||($r.value="",na.value="",et.value=!1)}async function ub(){const u=await ic();u&&(await pa(),Ls.value=u,mi.value=so.value.trim()||"New Project (1)",vi.value="",Ua.value="",qo.value="create",Fr.value=!0,zt(()=>{var p;return(p=Dl.value)==null?void 0:p.focus()}))}function sc(){zo.value||(Fr.value=!1,Ua.value="")}let Ad=!1,Pd=!1;function cb(){Ad=!0}function db(){Ad&&(Ad=!1,sl())}function fb(){Pd=!0}function pb(){Pd&&(Pd=!1,sc())}async function hb(){const u=Ls.value.trim(),p=mi.value.trim();if(!P.value)throw new Error("Enter a single project folder name.");const M=Xp(Qp(u,p));return M?vc(M,{createIfMissing:!0,label:""}):""}async function mb(){const u=Ls.value.trim(),p=vi.value.trim();return p?wS(p,u):""}async function Ed(){if(!(!N.value||zo.value)){Ua.value="",zo.value=!0;try{const u=qo.value==="clone"?await mb():await hb();if(!u)return;wt.value=u,mt(Ti(u)),await Vs(),await pa(),Fr.value=!1}catch(u){Ua.value=u instanceof Error?u.message:"Failed to create or clone project."}finally{zo.value=!1}}}function vb(){gb(Du.value)}function gb(u){Os.value||!u||(u.value="",u.click())}async function yb(u,p,M){Os.value=!0;try{const j=await ic();if(!j)return;const U=await p(j);if(!U.path)return;wt.value=U.path,mt(Ti(U.path)),await Vs(),await H({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await pa()}catch(j){const U=j instanceof Error?j.message:M;window.alert(U)}finally{Os.value=!1,u&&(u.value="")}}async function wb(u){var j;const p=u.target instanceof HTMLInputElement?u.target:null,M=((j=p==null?void 0:p.files)==null?void 0:j[0])??null;!M||Os.value||await yb(p,U=>gS(M,U),"Failed to import project.")}async function bb(){const u=wt.value.trim()||await ic();u&&(Qt.value=!1,Ba.value=!0,Br.value="",await Gs(u),Vn.value||zt(()=>{var p;return(p=Fu.value)==null?void 0:p.focus()}))}function sl(){bi+=1,Ba.value=!1,xo.value=!1,Vn.value="",Br.value="",qa.value="",Xl()}async function _b(u){!u||xo.value||(Br.value="",await Gs(u))}function kb(){const u=Ur.value.trim();!Ba.value||!u||Gs(u)}function Cb(){const u=q.value;!Ba.value||!u||xo.value||Gs(u)}function Tb(){if(!Ba.value||xo.value||Ao.value)return;const u=q.value,p=Ur.value.trim();!u||u===p||Gs(u)}function Sb(){const u=q.value,p=Ur.value.trim();if(u){if(u!==p){Gs(u);return}Id(u)}}async function Id(u=q.value){const p=st(u).trim();if(p){Vn.value="",Ao.value=!0;try{const M=await vc(p,{createIfMissing:!1,label:""});if(!M){Vn.value="Failed to open the selected folder.";return}wt.value=M,mt(Ti(M)),await Vs(),await H({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await pa(),sl()}catch(M){Vn.value=M instanceof Error?M.message:"Failed to open the selected folder."}finally{Ao.value=!1}}}async function xb(){if(kn.value="",Qt.value){Xl();return}if(!Ba.value){const u=wt.value.trim()||await ic();if(!u||(Ba.value=!0,Br.value="",await Gs(u),Vn.value))return}Vn.value||(Fn.value=so.value,Qt.value=!0,zt(()=>{var u;return(u=ns.value)==null?void 0:u.focus()}))}function Xl(){kn.value="",Fn.value="",Qt.value=!1}async function Yp(){const u=Fn.value.trim();if(!u)return;if(kn.value="",Vn.value){kn.value="Reload the current folder before creating a new one.";return}sr.value=!0;const p=h.value.trim(),M=Xp(Qp(p,u));if(!M){kn.value="Unable to determine where the new folder should be created.",sr.value=!1;return}if(!b.value){kn.value="Enter a single folder name.",sr.value=!1;return}try{const j=await yS(M);if(!j){kn.value="Failed to create the folder.";return}kn.value="",Br.value="",await Gs(j),Xl()}catch(j){kn.value=j instanceof Error?j.message:"Failed to create folder."}finally{sr.value=!1}}async function Ab(){var p;if(typeof window>"u")return!1;const u=((p=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:p.trim())??"";if(!u)return!1;try{const M=await vc(u,{createIfMissing:!1,label:""});if(!M)return!1;wt.value=M,mt(Ti(M)),await Gt.replace({name:"home"}),await Vs();const j=new URL(window.location.href);return j.searchParams.delete("openProjectPath"),window.history.replaceState({},"",j.toString()),!0}catch{return!1}}async function ic(){const u=Jp();if(u)return u;try{const p=await Nm();if(p)return Rr.value=p,p}catch{}return""}async function pa(){const u=Jp();if(!u){so.value="New Project (1)";return}try{const p=await _S(u);so.value=p.name||"New Project (1)"}catch{so.value="New Project (1)"}}function Jp(){var M,j;const u=wt.value.trim();if(u)return Tl(u);const p=((j=(M=Kl.value[0])==null?void 0:M.value)==null?void 0:j.trim())??"";return p?Tl(p):Rr.value.trim()}async function Pb(){try{Rr.value=await Nm()}catch{Rr.value=""}}async function Vs(){try{const u=await ml();Jn.value={order:[...u.order],labels:{...u.labels},projectOrder:[...u.projectOrder]}}catch{Jn.value={order:[],labels:{},projectOrder:[]}}}async function Gs(u){const p=++bi,M=st(u).trim();qa.value=M,Ur.value=M,Vn.value="",xo.value=!0;try{const j=await dS(u,{showHidden:gi.value});if(p!==bi)return;qa.value=j.path,Ur.value=j.path,ca.value=j.parentPath,Fl.value=j.entries}catch(j){if(p!==bi)return;Vn.value=j instanceof Error?j.message:"Failed to load local folders.",ca.value=Tl(Ur.value),Fl.value=[],Xl()}finally{p===bi&&(xo.value=!1)}}function Qp(u,p){const M=st(u).trim(),j=st(p).trim().replace(/^[\\/]+/u,"");if(!M||!j)return"";const U=M.includes("\\")&&!M.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(M))return`${M.slice(0,2)}${U}${j}`;if(/^\/+$/u.test(M))return`/${j}`;const fe=M.replace(/[\\/]+$/u,"");return fe?`${fe}${U}${j}`:""}function Xp(u){const p=st(u).trim();if(!p)return"";const M=p.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(M){const[,U,fe,Ne=""]=M,on=Rd(Ne.split(/[\\/]+/u));return on.length>0?`\\\\${U}\\${fe}\\${on.join("\\")}`:`\\\\${U}\\${fe}`}const j=p.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(j){const[,U,fe=""]=j,Ne=p.includes("\\")&&!p.includes("/")?"\\":"/",on=Rd(fe.split(/[\\/]+/u));return on.length>0?`${U}${Ne}${on.join(Ne)}`:`${U}${Ne}`}if(p.startsWith("/")){const U=Rd(p.split("/"));return U.length>0?`/${U.join("/")}`:"/"}return p}function Rd(u){const p=[];for(const M of u){const j=M.trim();if(!(!j||j===".")){if(j===".."){p.length>0&&p.pop();continue}p.push(j)}}return p}function Eb(u){de(u.draggedId,u.targetId)}function Zp(u){Bn(Tr.value,u)}function eh(u){Jo(u)}function th(u){vo(u)}function Ib(){Ze()}const Zl=S("");let Md=null;rt(Wt,u=>{var p;u&&(u.text&&((p=Zn.value)==null||p.hydrateDraft({text:u.text,imageUrls:u.imageUrls,fileAttachments:u.fileAttachments,skills:u.skills})),Zl.value=u.text?a("Stopped: message not submitted, restored to input."):a("Stopped: message not submitted."),Md&&clearTimeout(Md),Md=setTimeout(()=>{Zl.value=""},6e3),W(Tr.value))});function nh(u){var M,j;const p=pe.value.trim();switch(u){case"compact":p&&ce(p);break;case"review":if(!p)return;$r.value="",na.value="",et.value=!0;break;case"rename":p&&((j=sn.value)==null||j.openRenameThreadDialog(p,((M=ae.value)==null?void 0:M.title)??""));break;case"archive":p&&ve(p);break;case"fork":p&&Re(p);break;case"new":Sd();break;case"skills":Cr.value||Gt.push({name:"skills"});break}}function Rb(u){const p=u.turnId.trim();if(p.length>0){const M=[...ki.value].reverse().find(j=>{var U;return j.role==="user"&&(((U=j.turnId)==null?void 0:U.trim())??"")===p&&j.text.trim().length>0});M!=null&&M.text&&Zn.value&&Zn.value.appendTextToDraft(M.text)}Es(u.turnId)}function Mb(){jn.value||!pe.value||(Hl.value&&(Xi.value=Hl.value.id),Ft("default"),ac(),yt("Implement",[],[],"steer",[],void 0,"default"))}async function $b(){if(jn.value||Cr.value||cs.value||!ae.value||ki.value.length===0)return;const u=jb();try{await Dy(u)}catch{}}function jb(){var M,j,U;const u=[],p=((j=(M=ae.value)==null?void 0:M.title)==null?void 0:j.trim())||"Untitled thread";u.push(`# ${Nb(p)}`),u.push(""),u.push(`- Exported: ${new Date().toISOString()}`),u.push(`- Thread ID: ${((U=ae.value)==null?void 0:U.id)??""}`),u.push(""),u.push("---"),u.push("");for(const fe of ki.value){const Ne=fe.role?fe.role.toUpperCase():"MESSAGE";u.push(`## ${Ne}`),u.push("");const on=fe.text.trim();if(on&&(u.push(on),u.push("")),fe.commandExecution&&(u.push("```text"),u.push(`command: ${fe.commandExecution.command}`),u.push(`status: ${fe.commandExecution.status}`),fe.commandExecution.cwd&&u.push(`cwd: ${fe.commandExecution.cwd}`),fe.commandExecution.exitCode!==null&&u.push(`exitCode: ${fe.commandExecution.exitCode}`),u.push(fe.commandExecution.aggregatedOutput||"(no output)"),u.push("```"),u.push("")),fe.fileAttachments&&fe.fileAttachments.length>0){u.push("Attachments:");for(const ir of fe.fileAttachments)u.push(`- ${ir.path}`);u.push("")}if(fe.images&&fe.images.length>0){u.push("Images:");for(const ir of fe.images)u.push(`- ${ir}`);u.push("")}}return`${u.join(`
84
+ `).trimEnd()}
85
+ `}function Nb(u){return u.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function $d(u,p){if(typeof window>"u")return p;const M=window.localStorage.getItem(u);return M===null?p:M==="1"}function Lb(){if(typeof window>"u")return"system";const u=window.localStorage.getItem(Ev);return u==="light"||u==="dark"?u:"system"}function Ob(){if(typeof window>"u")return"steer";const u=window.localStorage.getItem(Pv);return u==="steer"||u==="queue"?u:"queue"}function Db(){if(typeof window>"u")return"standard";const u=window.localStorage.getItem($v);return u==="standard"||u==="wide"||u==="extra-wide"?u:"standard"}function Fb(){sa.value=!sa.value,window.localStorage.setItem(Av,sa.value?"1":"0")}function Ub(){Da.value=Da.value==="steer"?"queue":"steer",window.localStorage.setItem(Pv,Da.value)}function Bb(){const u=["system","light","dark"],p=u.indexOf(ia.value);ia.value=u[(p+1)%u.length],window.localStorage.setItem(Ev,ia.value),lc()}function qb(){const u=["standard","wide","extra-wide"],p=u.indexOf(rs.value);rs.value=u[(p+1)%u.length],window.localStorage.setItem($v,rs.value)}function zb(){rr.value=!rr.value,window.localStorage.setItem(Iv,rr.value?"1":"0")}function Hb(){la.value=!la.value,window.localStorage.setItem(Rv,la.value?"1":"0")}async function Wb(u){if(!Dr.value){Dr.value=!0;try{if(u==="codex"){An.value="codex";const p=await Rm(!1);Or.value=p.enabled}else if(u==="openrouter"){An.value="openrouter";const p=await Rm(!0);Or.value=p.enabled,await ul("","",{wireApi:C.value,provider:"openrouter"})}else u==="opencode-zen"?(An.value="opencode-zen",await ul("",_.value.trim(),{wireApi:"responses",provider:"opencode-zen"}),Or.value=!0):u==="custom"&&(An.value="custom",ar.value.trim()&&is.value.trim()&&(await ul(ar.value.trim(),is.value.trim(),{wireApi:y.value}),Or.value=!0));So.value="",await H({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){So.value=p instanceof Error?p.message:"Failed to switch provider"}finally{Dr.value=!1}}}async function jd(){if(Zt.value)return;const u=ar.value.trim();if(u){Zt.value=!0;try{So.value="",await ul(u,is.value.trim(),{wireApi:y.value}),Or.value=!0,await H({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){So.value=p instanceof Error?p.message:"Failed to save custom endpoint"}finally{Zt.value=!1}}}async function oh(u){if(Zt.value||Dr.value||C.value===u)return;const p=C.value;C.value=u,Zt.value=!0;try{So.value="",await ul("","",{wireApi:u,provider:"openrouter"}),Or.value=!0,await H({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(M){C.value=p,So.value=M instanceof Error?M.message:"Failed to save OpenRouter API format"}finally{Zt.value=!1}}async function rh(){if(Zt.value)return;const u=_.value.trim();if(u){Zt.value=!0;try{So.value="",await ul("",u,{wireApi:"responses",provider:"opencode-zen"}),Or.value=!0,await H({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){So.value=p instanceof Error?p.message:"Failed to save OpenCode Zen config"}finally{Zt.value=!1}}}async function ah(){if(!Zt.value){Zt.value=!0;try{const u=ua.value.trim();await Mm(u),ua.value="",await Nd(),await H({includeSelectedThreadMessages:!1})}catch{}finally{Zt.value=!1}}}async function Vb(){if(!Zt.value){Zt.value=!0;try{await Mm(""),ua.value="",await Nd(),await H({includeSelectedThreadMessages:!1})}catch{}finally{Zt.value=!1}}}async function Nd(){try{const u=An.value,p=await q1();Or.value=p.enabled,ss.value=p.customKey??!1,Gi.value=p.maskedKey??null,p.enabled?p.provider==="opencode-zen"?An.value="opencode-zen":p.provider==="custom"?(An.value="custom",ar.value=p.customBaseUrl??"",y.value=p.wireApi==="chat"?"chat":"responses"):(An.value="openrouter",C.value=p.wireApi==="chat"?"chat":"responses"):An.value="codex",Yi=p.hasCodexAuth===!0,Yi||(ql=!1);const M=An.value!==u;M&&await H({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0});const j=await Sr();j&&await H({includeSelectedThreadMessages:!1,providerChanged:M||j,awaitAncillaryRefreshes:!0})}catch{}}function Gb(u){const M=Ld(u.trim())||"auto";Fa.value=M,window.localStorage.setItem(Mv,M)}function Kb(u){ot(Number(u))}const Yb=[{value:"0",label:a("Off")},{value:"5",label:"5%"},{value:"10",label:"10%"},{value:"15",label:"15%"},{value:"20",label:"20%"},{value:"25",label:"25%"}];function Jb(){var M;if(typeof window>"u")return"auto";const u=((M=window.localStorage.getItem(Mv))==null?void 0:M.trim())||"auto";return Ld(u)||"auto"}function Qb(){const u=[{value:"auto",label:a("Auto-detect")}],p=new Set(["auto"]);function M(U){const fe=L[U]||U;return`${fe.charAt(0).toUpperCase()+fe.slice(1)} (${U})`}for(const U of typeof navigator<"u"?navigator.languages??[]:[]){const fe=Ld(U);!fe||p.has(fe)||(p.add(fe),u.push({value:fe,label:`${a("Preferred")}: ${M(fe)}`}))}for(const U of Object.keys(L))p.has(U)||(p.add(U),u.push({value:U,label:M(U)}));const j=Fa.value.trim();return j&&!p.has(j)&&u.push({value:j,label:M(j)}),u}function Ld(u){const p=u.trim().toLowerCase();if(!p||p==="auto")return"";if(p in L)return p;const M=p.split("-")[0]??p;return M in L?M:""}function lc(){const u=document.documentElement;if(ia.value==="dark")u.classList.add("dark");else if(ia.value==="light")u.classList.remove("dark");else{const p=window.matchMedia("(prefers-color-scheme: dark)").matches;u.classList.toggle("dark",p)}}function Xb(){return typeof window>"u"?!1:window.localStorage.getItem(Cv)==="1"}function Zb(u){typeof window>"u"||window.localStorage.setItem(Cv,u?"1":"0")}function e_(){if(typeof window>"u")return!0;const u=window.localStorage.getItem(Tv);return u===null?!0:u==="1"}function t_(){ge.value=!ge.value,!(typeof window>"u")&&window.localStorage.setItem(Tv,ge.value?"1":"0")}function n_(u,p){const M=(u??"").trim();return M.length>0?M:p.trim()||"message"}function sh(u){Ft(u)}async function o_(){await Gt.isReady(),xt.name==="thread"&&us.value?Aa(us.value):(xt.name==="home"||xt.name==="skills"||xt.name==="automations")&&Aa("",{persist:!1}),await H({includeSelectedThreadMessages:xt.name==="thread"}),Jl({silent:!0}),await Ab(),no.value=!0,await Od(),nn()}async function Od(){if(Ra.value){_o=!0;return}Ra.value=!0;try{do{if(_o=!1,xt.name==="home"||xt.name==="skills"||xt.name==="automations"){pe.value!==""&&await le("");continue}if(xt.name==="thread"){const u=us.value;if(!u)continue;if(pe.value!==u){if(await le(u)==="not-found")continue}else oe(u,{silent:!0}).catch(()=>{})}}while(_o)}finally{Ra.value=!1}}rt(()=>[xt.name,us.value,Ge.value,pe.value],async()=>{no.value&&await Od()}),rt(()=>[pe.value,mn.value],()=>{lb()}),rt(()=>[xt.name,mn.value],([u,p])=>{u==="thread"&&oc(p)},{immediate:!0}),rt(()=>pe.value,async u=>{if(no.value&&!Ra.value&&!(jn.value||Cr.value||cs.value)){if(!u){xt.name!=="home"&&await Gt.replace({name:"home"});return}xt.name==="thread"&&us.value===u||await Gt.replace({name:"thread",params:{threadId:u}})}}),rt(()=>Kl.value,u=>{if(u.length===0){wt.value="",pa();return}const p=wt.value.trim();p&&(u.some(j=>j.value===p)||(wt.value="")),pa()},{immediate:!0}),rt(()=>wt.value,()=>{wn.value={phase:"idle",title:"",message:""},pa()}),rt(()=>[xt.name,wt.value],([u,p])=>{u==="home"&&oc(p)},{immediate:!0}),rt(ds,u=>{!u&&Rn.value==="worktree"&&(Rn.value="local")},{immediate:!0}),rt(()=>[Rn.value,wt.value],([u,p])=>{u!=="worktree"||!ds.value||ih(p)},{immediate:!0}),rt(()=>Rn.value,u=>{var p;if(u==="local"){wn.value={phase:"idle",title:"",message:""};const M=wt.value.trim();if(M&&Mp(M)){const j=((p=ae.value)==null?void 0:p.projectName)??xr(M),U=al(j,"");U&&(wt.value=U)}return}ds.value&&ih(wt.value)}),rt(()=>xt.name,u=>{u!=="home"&&(wn.value={phase:"idle",title:"",message:""}),u!=="thread"&&(et.value=!1)}),rt(()=>pe.value,()=>{wn.value={phase:"idle",title:"",message:""}}),rt(()=>[xt.name,mn.value,ds.value],([u,p,M])=>{if(!(u==="thread"||u==="home"&&M)){Vp();return}fn+=1,qe.value={},ke.value="",Wn.value="",Ql(p)},{immediate:!0}),rt(Ji,u=>{typeof document>"u"||(document.title=u)},{immediate:!0}),rt(ht,u=>{u&&!Kt.value&&Po(!0)},{immediate:!0});async function r_(u,p=[],M=[],j=[]){try{wn.value={phase:"idle",title:"",message:""};let U=wt.value;if(Rn.value==="worktree"){wn.value={phase:"running",title:a("Creating worktree"),message:a("Creating a worktree and running setup.")};try{const Ne=await tS(wt.value,oo.value);U=Ne.cwd,wt.value=Ne.cwd,wn.value={phase:"idle",title:"",message:""}}catch{wn.value={phase:"error",title:a("Worktree setup failed"),message:a("Unable to create worktree. Try again or switch to Local project.")};return}}else if(!U.trim()){const Ne=await bS(u);U=Ne.cwd,wt.value=Ne.cwd}const fe=await It(u,U,p,M,j);if(!fe)return;await Gt.replace({name:"thread",params:{threadId:fe}}),ac()}catch{}}function a_(u){var j;if((j=u.prompt)!=null&&j.trim())return u.prompt.trim();const p=u.displayName.trim()||u.name.trim(),M=u.kind==="skill"?"skill":u.kind==="plugin"?"plugin":u.kind==="composio"?"Composio connector":"app";return`Test ${p} ${M}. Give me a list of what it can do and one useful example.`}function s_(u){return`${u.kind}:${u.name}:${u.skillPath??""}`}async function i_(u){var j;if(to.value)return;to.value=s_(u);const p=a_(u),M=(j=u.attachedSkills)!=null&&j.length?u.attachedSkills:u.kind==="skill"&&u.skillPath?[{name:u.name,path:u.skillPath}]:[];try{const U=qu.value.trim()||mn.value.trim(),fe=await It(p,U,[],M,[]);if(!fe)return;await Gt.replace({name:"thread",params:{threadId:fe}}),ac()}catch{}finally{to.value=""}}async function ih(u){var M;const p=u.trim();if(!p){Zo.value=[],oo.value="";return}mr.value=!0;try{const j=await oS(p);Zo.value=j;const U=oo.value.trim();if(!(U.length>0&&j.some(Ne=>Ne.value===U))){const Ne=j.find(on=>on.value.trim()==="main");oo.value=(Ne==null?void 0:Ne.value)??((M=j[0])==null?void 0:M.value)??""}}catch{Zo.value=[],oo.value=""}finally{mr.value=!1}}return(u,p)=>{const M=g0("IconTablerFilePencil");return T(),A(ze,null,[xe(nT,{"is-sidebar-collapsed":Kt.value,onCloseSidebar:p[48]||(p[48]=j=>Po(!0))},{sidebar:tt(()=>{var j;return[d("section",kL,[d("div",{ref_key:"sidebarScrollableRef",ref:ro,class:"sidebar-scrollable",onScroll:Xu},[Kt.value?J("",!0):(T(),at(tv,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":Kt.value,"show-new-thread-button":!0,onToggleSidebar:p[0]||(p[0]=U=>Po(!Kt.value)),onStartNewThread:Sd},{default:tt(()=>[d("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":Sn.value,"aria-label":v(a)("Search threads"),title:v(a)("Search threads"),onClick:Ju},[xe(nv,{class:"sidebar-search-toggle-icon"})],8,CL)]),_:1},8,["is-sidebar-collapsed"])),!Kt.value&&Sn.value?(T(),A("div",TL,[xe(nv,{class:"sidebar-search-bar-icon"}),Nt(d("input",{ref_key:"sidebarSearchInputRef",ref:ao,"onUpdate:modelValue":p[1]||(p[1]=U=>bn.value=U),class:"sidebar-search-input",type:"text",placeholder:v(a)("Filter threads..."),onKeydown:Ie},null,40,SL),[[an,bn.value]]),bn.value.length>0?(T(),A("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":v(a)("Clear search"),onClick:Qu},[xe(jc,{class:"sidebar-search-clear-icon"})],8,xL)):J("",!0)])):J("",!0),Kt.value?J("",!0):(T(),A("button",{key:2,class:Ke(["sidebar-skills-link",{"is-active":Cr.value}]),type:"button",onClick:p[2]||(p[2]=U=>{v(Gt).push({name:"skills"}),v(ht)&&Po(!0)})},[d("span",AL,[xe(ga)]),d("span",PL,[d("span",EL,k(v(a)("Skills")),1),d("span",IL,k(v(a)("Plugins, apps, MCPs")),1)])],2)),Kt.value?J("",!0):(T(),A("button",{key:3,class:Ke(["sidebar-skills-link",{"is-active":cs.value}]),type:"button",onClick:p[3]||(p[3]=U=>{v(Gt).push({name:"automations"}),v(ht)&&Po(!0)})},[d("span",RL,[xe(ga)]),d("span",ML,[d("span",$L,k(v(a)("Automations")),1),d("span",jL,k(v(a)("Scheduled work")),1)])],2)),Kt.value?J("",!0):(T(),at(HE,{key:4,ref_key:"sidebarThreadTreeRef",ref:sn,groups:v(B),"project-display-name-by-id":v(Y),"project-git-repo-by-name":Cd.value,"project-cwd-by-name":$p.value,"selected-thread-id":v(pe),"is-loading":v(Ge),"is-thread-list-fully-loaded":v(nt),"search-query":bn.value,"search-matched-thread-ids":Hn.value,onSelect:Ot,onArchive:yw,onStartNewThread:_w,onRenameProject:Lw,onBrowseThreadFiles:kw,onSaveThreadProject:Aw,onBrowseProjectFiles:Sw,onSaveProject:xw,onRequestProjectGitStatus:Uw,onCreateProjectWorktree:$w,onRenameThread:Ow,onForkThread:bw,onRemoveProject:Dw,onReorderProject:Fw,onCopyThreadChat:nw,onAutomationsChanged:tw,onRestoreThread:ww,onStartNewChat:Nw},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),Kt.value?J("",!0):(T(),A("div",{key:0,ref_key:"settingsAreaRef",ref:ea,class:"sidebar-settings-area",onClick:Jw},[(T(),at(Bi,{to:"body"},[_n.value?(T(),A("div",{key:0,class:"settings-dialog-backdrop",role:"presentation",onClick:p[22]||(p[22]=Qe(U=>_n.value=!1,["self"]))},[d("div",{ref_key:"settingsPanelRef",ref:Mn,class:"sidebar-settings-panel",role:"dialog","aria-modal":"true","aria-label":v(a)("Settings"),onClick:p[21]||(p[21]=Qe(()=>{},["stop"]))},[d("div",LL,[d("h2",OL,k(v(a)("Settings")),1),d("button",{class:"settings-dialog-close",type:"button","aria-label":v(a)("Close"),title:v(a)("Close"),onClick:p[4]||(p[4]=U=>_n.value=!1)},[xe(jc,{class:"settings-dialog-close-icon"})],8,DL)]),d("div",FL,[d("nav",{class:"settings-group-nav","aria-label":v(a)("Settings groups")},[(T(),A(ze,null,kt(Ma,U=>d("button",{key:U.id,type:"button",class:Ke(["settings-group-nav-item",{"is-active":I.value===U.id}]),"aria-current":I.value===U.id?"true":void 0,onClick:fe=>I.value=U.id},k(v(a)(U.label)),11,BL)),64))],8,UL),d("div",qL,[Nt(d("div",null,[d("div",zL,[d("div",HL,[d("div",WL,[d("button",{class:"sidebar-settings-account-collapse",type:"button","aria-expanded":!ge.value,title:ge.value?v(a)("Expand accounts"):v(a)("Collapse accounts"),onClick:t_},[d("span",GL,k(ge.value?"▸":"▾"),1)],8,VL),d("span",KL,k(v(a)("Accounts")),1),d("span",YL,k(xn.value.length),1)]),d("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:To.value||fo.value||tr.value||$n.value,onClick:fw},k(To.value?v(a)("Reloading…"):v(a)("Reload")),9,JL)]),ge.value?J("",!0):(T(),A(ze,{key:0},[cn.value?(T(),A("div",QL,[d("span",null,k(cn.value),1),d("a",{class:"visible-error-feedback",href:v(Kn),onClick:p[5]||(p[5]=U=>In(U,cn.value))},k(v(a)("Send feedback")),9,XL)])):J("",!0),d("div",ZL,[d("button",{class:"sidebar-settings-account-login-button",type:"button",disabled:To.value||fo.value||tr.value||$n.value,onClick:hw},k(tr.value?v(a)("Starting login…"):v(a)("Login")),9,eO),aa.value?(T(),A("a",{key:0,class:"sidebar-settings-account-login-link",href:aa.value,target:"_blank",rel:"noreferrer"},k(v(a)("Open login URL")),9,tO)):J("",!0)]),xn.value.length===0?(T(),A("p",nO,k(v(a)("Click Login, or run `codex login`, then click reload.")),1)):(T(),A("div",oO,[(T(!0),A(ze,null,kt(xn.value,U=>(T(),A("article",{key:U.storageId,class:Ke(["sidebar-settings-account-item",{"is-active":U.isActive,"is-unavailable":Yl(U),"is-confirming-remove":tc(U),"is-remove-visible":Ip(U)}]),title:dw(U),onMouseenter:fe=>iw(U.storageId),onMouseleave:fe=>lw(U.storageId)},[d("div",aO,[d("p",sO,k(U.email||v(a)("Account")),1),d("p",iO,k(Pp(U)),1),d("p",lO,k(Rp(U)),1),d("p",uO," Workspace "+k(ow(U.accountId)),1)]),d("div",cO,[d("button",{class:"sidebar-settings-account-switch",type:"button",disabled:Ep(U)||U.isActive||Yl(U),onClick:fe=>pw(U.storageId)},k(aw(U)),9,dO),d("button",{class:Ke(["sidebar-settings-account-remove",{"is-visible":Ip(U),"is-confirming":tc(U)}]),type:"button",disabled:Ep(U),onClick:fe=>gw(U.storageId)},k(sw(U)),11,fO)])],42,rO))),128))]))],64))]),d("button",{class:"sidebar-settings-row",type:"button",title:x.sendWithEnter,onClick:Fb},[d("span",hO,k(v(a)("Require ⌘ + enter to send")),1),d("span",{class:Ke(["sidebar-settings-toggle",{"is-on":!sa.value}])},null,2)],8,pO),d("button",{class:"sidebar-settings-row",type:"button",title:x.inProgressSendMode,onClick:Ub},[d("span",vO,k(v(a)("When busy, send as")),1),d("span",gO,k(Da.value==="steer"?v(a)("Steer"):v(a)("Queue")),1)],8,mO),d("button",{class:"sidebar-settings-row",type:"button",title:x.appearance,onClick:Bb},[d("span",wO,k(v(a)("Appearance")),1),d("span",bO,k(ia.value==="system"?v(a)("System"):ia.value==="dark"?v(a)("Dark"):v(a)("Light")),1)],8,yO),d("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:v(a)("Choose the interface language for the app.")},[d("span",kO,k(v(a)("UI language")),1),xe(lr,{class:"sidebar-settings-provider-dropdown","model-value":v(l),options:v(f),placeholder:v(a)("UI language"),"menu-align":"end","onUpdate:modelValue":p[6]||(p[6]=U=>v(m)(U))},null,8,["model-value","options","placeholder"])],8,_O),d("button",{class:"sidebar-settings-row",type:"button",title:x.chatWidth,onClick:qb},[d("span",TO,k(v(a)("Chat width")),1),d("span",SO,k(Et.value),1)],8,CO),d("button",{class:"sidebar-settings-row",type:"button",title:x.dictationClickToToggle,onClick:zb},[d("span",AO,k(v(a)("Click to toggle dictation")),1),d("span",{class:Ke(["sidebar-settings-toggle",{"is-on":rr.value}])},null,2)],8,xO),d("button",{class:"sidebar-settings-row",type:"button",title:x.dictationAutoSend,onClick:Hb},[d("span",EO,k(v(a)("Auto send dictation")),1),d("span",{class:Ke(["sidebar-settings-toggle",{"is-on":la.value}])},null,2)],8,PO),d("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:x.dictationLanguage},[d("span",RO,k(v(a)("Dictation language")),1),xe(lr,{class:"sidebar-settings-language-dropdown","model-value":Fa.value,options:as.value,placeholder:v(a)("Auto-detect"),"open-direction":"up","enable-search":!0,"search-placeholder":v(a)("Search language..."),"onUpdate:modelValue":Gb},null,8,["model-value","options","placeholder","search-placeholder"])],8,IO),d("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:v(a)("Auto-compact at or below remaining context percentage. 0 disables auto-compaction and falls back to server-side compaction.")},[d("span",$O,k(v(a)("Auto-compact before send")),1),xe(lr,{class:"sidebar-settings-auto-compact-dropdown","model-value":String(v(We)),options:Yb,placeholder:v(a)("Off"),"menu-align":"end","onUpdate:modelValue":Kb},null,8,["model-value","placeholder"])],8,MO),da.value?(T(),A("a",{key:0,class:"sidebar-settings-row sidebar-settings-feedback-row",href:v(Kn),onClick:In},[d("span",NO,k(v(a)("Send feedback")),1),d("span",LO,k(v(a)("Issue detected")),1)],8,jO)):J("",!0)],512),[[hc,I.value==="general"]]),Nt(d("div",null,[d("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:v(a)("Choose the API provider for the Codex backend")},[d("span",DO,k(v(a)("Provider")),1),xe(lr,{class:"sidebar-settings-provider-dropdown","model-value":An.value,options:Ns.value,placeholder:v(a)("Provider"),disabled:Dr.value,"menu-align":"end","onUpdate:modelValue":Wb},null,8,["model-value","options","placeholder","disabled"])],8,OO),So.value?(T(),A("div",FO,[d("span",null,k(So.value),1),d("a",{class:"visible-error-feedback",href:v(Kn),onClick:p[7]||(p[7]=U=>In(U,So.value))},k(v(a)("Send feedback")),9,UO)])):J("",!0),An.value==="openrouter"?(T(),A("div",BO,[d("div",qO,[d("span",zO,k(v(a)("OpenRouter API key")),1),d("a",HO,k(v(a)("Get API key")),1)]),d("div",WO,[ss.value&&!ua.value?(T(),A(ze,{key:0},[d("span",VO,k(Gi.value),1),d("button",{class:"sidebar-settings-key-clear",type:"button",disabled:Zt.value,title:v(a)("Remove custom key, use community keys"),onClick:Vb},"✕",8,GO)],64)):(T(),A(ze,{key:1},[Nt(d("input",{"onUpdate:modelValue":p[8]||(p[8]=U=>ua.value=U),class:"sidebar-settings-key-input",type:"password",placeholder:v(a)("sk-or-v1-... (optional, uses free keys if empty)"),onKeydown:Pn(ah,["enter"])},null,40,KO),[[an,ua.value]]),d("button",{class:"sidebar-settings-key-save",type:"button",disabled:Zt.value||!ua.value.trim(),onClick:ah},k(Zt.value?"...":v(a)("Set")),9,YO)],64))]),d("div",JO,[d("span",QO,k(v(a)("API format")),1),d("div",{class:"sidebar-settings-segmented",role:"group","aria-label":v(a)("OpenRouter API format")},[d("button",{type:"button",class:Ke(["sidebar-settings-segmented-option",{"is-active":C.value==="responses"}]),disabled:Zt.value||Dr.value,onClick:p[9]||(p[9]=U=>oh("responses"))},k(v(a)("Responses")),11,ZO),d("button",{type:"button",class:Ke(["sidebar-settings-segmented-option",{"is-active":C.value==="chat"}]),disabled:Zt.value||Dr.value,onClick:p[10]||(p[10]=U=>oh("chat"))},k(v(a)("Completions")),11,eD)],8,XO)])])):J("",!0),An.value==="opencode-zen"?(T(),A("div",tD,[d("div",nD,[d("span",oD,k(v(a)("OpenCode Zen API key")),1),d("a",rD,k(v(a)("Get API key")),1)]),d("div",aD,[Nt(d("input",{"onUpdate:modelValue":p[11]||(p[11]=U=>_.value=U),class:"sidebar-settings-key-input",type:"password",placeholder:v(a)("sk-..."),onKeydown:Pn(rh,["enter"])},null,40,sD),[[an,_.value]]),d("button",{class:"sidebar-settings-key-save",type:"button",disabled:Zt.value||!_.value.trim(),onClick:rh},k(Zt.value?"...":v(a)("Save")),9,iD)])])):J("",!0),An.value==="custom"?(T(),A("div",lD,[d("span",uD,k(v(a)("Custom endpoint URL")),1),d("div",cD,[Nt(d("input",{"onUpdate:modelValue":p[12]||(p[12]=U=>ar.value=U),class:"sidebar-settings-key-input",type:"url",placeholder:v(a)("https://api.example.com/v1"),onKeydown:Pn(jd,["enter"])},null,40,dD),[[an,ar.value]])]),d("span",fD,k(v(a)("API key")),1),d("div",pD,[Nt(d("input",{"onUpdate:modelValue":p[13]||(p[13]=U=>is.value=U),class:"sidebar-settings-key-input",type:"password",placeholder:v(a)("Bearer token (optional)"),onKeydown:Pn(jd,["enter"])},null,40,hD),[[an,is.value]]),d("button",{class:"sidebar-settings-key-save",type:"button",disabled:Zt.value||!ar.value.trim(),onClick:jd},k(Zt.value?"...":v(a)("Save")),9,mD)]),d("div",vD,[d("span",gD,k(v(a)("API format")),1),d("div",{class:"sidebar-settings-segmented",role:"group","aria-label":v(a)("Custom endpoint API format")},[d("button",{type:"button",class:Ke(["sidebar-settings-segmented-option",{"is-active":y.value==="responses"}]),onClick:p[14]||(p[14]=U=>y.value="responses")},k(v(a)("Responses")),3),d("button",{type:"button",class:Ke(["sidebar-settings-segmented-option",{"is-active":y.value==="chat"}]),onClick:p[15]||(p[15]=U=>y.value="chat")},k(v(a)("Completions")),3)],8,yD)])])):J("",!0)],512),[[hc,I.value==="models"]]),Nt(d("div",null,[d("button",{class:"sidebar-settings-row",type:"button","aria-live":"polite",onClick:p[16]||(p[16]=U=>F.value=!F.value)},[d("span",wD,k(v(a)("Telegram")),1),d("span",bD,k(Bs.value),1)]),F.value?(T(),A("div",_D,[d("label",kD,[d("span",CD,k(v(a)("Bot token")),1),Nt(d("input",{"onUpdate:modelValue":p[17]||(p[17]=U=>_e.value=U),class:"sidebar-settings-input",type:"password",placeholder:"123456:ABCDEF",autocomplete:"off",spellcheck:"false"},null,512),[[an,_e.value]])]),d("label",TD,[d("span",SD,k(v(a)("Allowed Telegram user IDs")),1),Nt(d("textarea",{"onUpdate:modelValue":p[18]||(p[18]=U=>lt.value=U),class:"sidebar-settings-textarea",rows:"3",placeholder:`123456789
86
+ 987654321`,spellcheck:"false"},null,512),[[an,lt.value]])]),d("div",xD,k(v(a)("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?(T(),A("div",AD,[d("span",null,k(Pt.value),1),d("a",{class:"visible-error-feedback",href:v(Kn),onClick:p[19]||(p[19]=U=>In(U,Pt.value))},k(v(a)("Send feedback")),9,PD)])):J("",!0),d("div",ED,[d("button",{class:"sidebar-settings-telegram-save",type:"button",disabled:Bo.value,onClick:Yu},k(Bo.value?v(a)("Saving…"):v(a)("Save Telegram config")),9,ID)])])):J("",!0),d("div",RD,[d("div",MD,[d("span",$D,k(v(a)("Hooks")),1),d("button",{class:"sidebar-settings-hooks-reload",type:"button",disabled:v(G),title:v(a)("Reload lifecycle hooks"),onClick:p[20]||(p[20]=U=>v($)({force:!0}))},k(v(G)?v(a)("Reloading…"):v(a)("Reload")),9,jD)]),io.value?(T(),A(ze,{key:1},[v(G)?(T(),A("p",LD,k(v(a)("Loading hooks…")),1)):v(D).length===0?(T(),A("p",OD,k(v(a)("No hooks registered.")),1)):(T(),A("div",DD,[(T(!0),A(ze,null,kt(v(D),U=>(T(),A("div",{key:U.cwd||"__global__",class:"sidebar-settings-hooks-entry"},[d("p",FD,k(U.cwd||v(a)("Global")),1),(T(!0),A(ze,null,kt(U.hooks,(fe,Ne)=>(T(),A("div",{key:`${U.cwd}:${fe.event}:${Ne}`,class:"sidebar-settings-hooks-item"},[d("span",{class:Ke(["sidebar-settings-hooks-state",{"is-on":fe.enabled!==!1}])},k(fe.enabled===!1?v(a)("Disabled"):v(a)("Enabled")),3),d("span",UD,k(fe.event),1),d("code",BD,k(fe.command),1)]))),128))]))),128))]))],64)):(T(),A("p",ND,k(v(a)("Hooks are not supported by this Codex version.")),1))]),d("div",qD,[d("div",zD,[d("span",HD,k(v(a)("Remote control")),1),d("button",{class:"sidebar-settings-remote-toggle",type:"button",disabled:lo.value||Fo.value,title:v(a)("Enable or disable remote control"),onClick:di},[d("span",{class:Ke(["sidebar-settings-remote-toggle-track",{"is-on":Yt.value.enabled}])},[...p[53]||(p[53]=[d("span",{class:"sidebar-settings-remote-toggle-thumb"},null,-1)])],2),d("span",VD,k(Yt.value.enabled?v(a)("Enabled"):v(a)("Disabled")),1)],8,WD)]),Mr.value?(T(),A(ze,{key:1},[er.value?(T(),A("p",KD,k(er.value),1)):J("",!0),Is.value?(T(),A("p",YD,k(Is.value),1)):J("",!0),Fo.value?(T(),A("p",JD,k(v(a)("Loading…")),1)):(T(),A(ze,{key:3},[d("button",{class:"sidebar-settings-remote-row",type:"button",disabled:!Yt.value.enabled||lo.value,onClick:Vi},[d("span",XD,k(v(a)("Pair a new device")),1),d("span",ZD,k(uo.value==="pairing"?v(a)("Starting…"):(j=hn.value)!=null&&j.pairingCode?hn.value.pairingCode:v(a)("Generate code")),1)],8,QD),d("div",eF,[d("div",tF,[d("span",nF,k(v(a)("Paired devices")),1),d("button",{class:"sidebar-settings-remote-reload",type:"button",disabled:lo.value,onClick:Ms},k(uo.value==="clients"?v(a)("Reloading…"):v(a)("Reload")),9,oF)]),Yt.value.clients.length===0?(T(),A("p",rF,k(v(a)("No paired devices.")),1)):J("",!0),(T(!0),A(ze,null,kt(Yt.value.clients,U=>(T(),A("div",{key:U.clientId,class:"sidebar-settings-remote-client"},[d("span",aF,k(U.deviceName||U.clientId),1),d("button",{class:"sidebar-settings-remote-client-revoke",type:"button",disabled:lo.value,onClick:fe=>Nl(U.clientId)},k(uo.value===`revoke:${U.clientId}`?v(a)("Removing…"):v(a)("Revoke")),9,sF)]))),128))])],64))],64)):(T(),A("p",GD,k(v(a)("Remote control is not supported by this Codex version.")),1))])],512),[[hc,I.value==="integrations"]]),Nt(d("div",null,[d("div",iF,[xe(z$,{snapshots:v(He)},null,8,["snapshots"])]),d("div",{class:"sidebar-settings-build-label","aria-label":v(a)("Worktree name and version")}," WT "+k(v(g))+" · v"+k(v(w)),9,lF)],512),[[hc,I.value==="usage"]])])])],8,NL)])):J("",!0)])),d("div",uF,[d("button",{ref_key:"settingsButtonRef",ref:Za,class:"sidebar-settings-icon-button",type:"button",title:v(a)("Settings"),"aria-label":v(a)("Settings"),onClick:Qe(V,["stop"])},[xe(nN,{class:"sidebar-settings-icon"})],8,cF),d("button",{ref:"recycleBinButtonRef",class:"sidebar-settings-icon-button",type:"button",title:v(a)("Recycle bin"),"aria-label":v(a)("Recycle bin"),onClick:Qe(Qw,["stop"])},[xe(du,{class:"sidebar-settings-icon"})],8,dF)])],512))])]}),content:tt(()=>[d("div",fF,[d("section",{class:Ke(["content-root",{"is-virtual-keyboard-open":bd.value}]),style:Vr(Ha.value)},[tl.value?(T(),A("span",pF)):J("",!0),xe(YE,{title:gd.value,accent:Cr.value||cs.value},{leading:tt(()=>[Kt.value||v(ht)?(T(),at(tv,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":Kt.value,"show-new-thread-button":!0,onToggleSidebar:p[23]||(p[23]=j=>Po(!Kt.value)),onStartNewThread:Sd},null,8,["is-sidebar-collapsed"])):J("",!0),Cr.value?(T(),A("span",hF,[xe(ga)])):cs.value?(T(),A("span",mF,[xe(ga)])):J("",!0)]),actions:tt(()=>[el.value?(T(),A("button",{key:0,class:"content-header-right-panel-toggle",type:"button","aria-label":v(ht)?On.value?v(a)("Close side panel"):v(a)("Open side panel"):No.value?v(a)("Open side panel"):v(a)("Close side panel"),title:v(ht)?On.value?v(a)("Close side panel"):v(a)("Open side panel"):No.value?v(a)("Open side panel"):v(a)("Close side panel"),onClick:Vw},[xe(Oy,{class:"content-header-right-panel-toggle-icon"})],8,vF)):J("",!0)]),_:1},8,["title","accent"]),d("section",gF,[Cr.value?(T(),at(v(r),{key:0,ref_key:"directoryHubRef",ref:yo,cwd:qu.value,"thread-id":us.value,"try-in-flight-key":to.value,onSkillsChanged:qs,onTryItem:i_},null,8,["cwd","thread-id","try-in-flight-key"])):cs.value?(T(),at(v(s),{key:1,ref_key:"automationsPanelRef",ref:fr,groups:v(B),"project-cwd-by-name":$p.value,"project-display-name-by-id":v(Y),"selected-automation-id":Uu.value,onSelectAutomation:Hs,onEditAutomation:ec,onCreateAutomation:ew},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):jn.value?(T(),A("div",yF,[d("div",wF,[d("p",bF,k(v(a)("Let's build")),1),xe(lr,{class:"new-thread-folder-dropdown","model-value":wt.value,options:Kl.value,placeholder:v(a)("Choose folder"),"enable-search":!0,"search-placeholder":v(a)("Quick search project"),disabled:!1,"onUpdate:modelValue":eb},null,8,["model-value","options","placeholder","search-placeholder"]),wt.value?(T(),A("p",{key:0,class:"new-thread-folder-selected",title:wt.value},k(v(a)("Selected folder"))+": "+k(wt.value),9,_F)):J("",!0),d("div",kF,[d("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:bb},k(v(a)("Select folder")),1),d("button",{class:"new-thread-folder-action",type:"button",onClick:ub},k(v(a)("Create Project")),1),d("button",{class:"new-thread-folder-action",type:"button",disabled:Os.value,onClick:vb},k(Os.value?v(a)("Importing…"):v(a)("Import Project")),9,CF),d("input",{ref_key:"projectImportInputRef",ref:Du,class:"new-thread-project-import-input",type:"file",accept:".zip,application/zip",tabindex:"-1","aria-hidden":"true",onChange:wb},null,544)]),js.value?(T(),A("section",TF,[d("div",SF,[d("div",xF,[d("span",AF,[xe(ga)]),d("p",PF,k(v(a)("New in Codex")),1)]),d("h2",EF,k(v(a)("Plugins are here")),1),d("p",IF,k(v(a)("Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.")),1),p[54]||(p[54]=d("div",{class:"new-thread-launch-card-pills","aria-label":"Example integrations"},[d("span",{class:"new-thread-launch-card-pill"},"Gmail"),d("span",{class:"new-thread-launch-card-pill"},"Calendar"),d("span",{class:"new-thread-launch-card-pill"},"GitHub"),d("span",{class:"new-thread-launch-card-pill"},"Slack"),d("span",{class:"new-thread-launch-card-pill"},"Browser Use")],-1))]),d("div",RF,[d("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:Wu},k(v(a)("Explore Plugins & Apps")),1),d("button",{class:"new-thread-launch-card-button",type:"button",onClick:Hu},k(v(a)("Dismiss")),1)])])):J("",!0),(T(),at(Bi,{to:"body"},[Ba.value?(T(),A("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:Qe(cb,["self"]),onMouseup:db},[d("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":v(a)("Select folder"),onKeydown:Pn(Qe(sl,["prevent"]),["esc"])},[d("div",$F,[d("p",jF,k(v(a)("Select folder")),1),d("button",{class:"new-thread-open-folder-close",type:"button",onClick:sl},k(v(a)("Cancel")),1)]),d("p",NF,k(v(a)("Current folder")),1),d("div",LF,[Nt(d("input",{ref_key:"existingFolderPathInputRef",ref:Fu,"onUpdate:modelValue":p[24]||(p[24]=j=>qa.value=j),class:"new-thread-open-folder-path",type:"text",placeholder:v(a)("Current folder"),title:qa.value||v(a)("Unavailable"),disabled:xo.value||Ao.value,onBlur:Tb,onKeydown:[Pn(Qe(Sb,["prevent"]),["enter"]),Pn(Qe(sl,["prevent"]),["esc"])]},null,40,OF),[[an,qa.value]]),d("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!q.value||xo.value||Ao.value,onClick:p[25]||(p[25]=j=>Id())},k(Ao.value?v(a)("Opening…"):v(a)("Open")),9,DF)]),d("div",FF,[d("label",UF,[Nt(d("input",{"onUpdate:modelValue":p[26]||(p[26]=j=>gi.value=j),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:kb},null,544),[[Jg,gi.value]]),d("span",null,k(v(a)("Show hidden folders")),1)]),d("button",{class:Ke(["new-thread-folder-action",{"new-thread-folder-action-primary":Qt.value}]),type:"button","aria-pressed":Qt.value,disabled:!Ur.value||xo.value||Ao.value||sr.value||!!Vn.value&&!Qt.value,onClick:xb},k(v(a)("New folder")),11,BF)]),Qt.value?(T(),A("div",qF,[d("div",zF,[Nt(d("input",{ref_key:"createFolderInputRef",ref:ns,"onUpdate:modelValue":p[27]||(p[27]=j=>Fn.value=j),class:"new-thread-open-folder-create-input",type:"text",placeholder:v(a)("Folder name"),onKeydown:[Pn(Qe(Yp,["prevent"]),["enter"]),Pn(Qe(Xl,["prevent"]),["esc"])]},null,40,HF),[[an,Fn.value]]),d("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!E.value||sr.value,onClick:Yp},k(te.value),9,WF)]),kn.value?(T(),A("div",VF,[d("span",null,k(kn.value),1),d("a",{class:"visible-error-feedback",href:v(Kn),onClick:p[28]||(p[28]=j=>In(j,kn.value))},k(v(a)("Send feedback")),9,GF)])):J("",!0)])):J("",!0),Nt(d("input",{ref_key:"existingFolderFilterInputRef",ref:vd,"onUpdate:modelValue":p[29]||(p[29]=j=>Br.value=j),class:"new-thread-open-folder-filter",type:"text",placeholder:v(a)("Filter folders..."),onKeydown:Pn(Qe(sl,["prevent"]),["esc"])},null,40,KF),[[an,Br.value]]),Vn.value?(T(),A("div",YF,[d("div",JF,[d("span",null,k(Vn.value),1),d("a",{class:"visible-error-feedback",href:v(Kn),onClick:p[30]||(p[30]=j=>In(j,Vn.value))},k(v(a)("Send feedback")),9,QF)]),d("button",{class:"new-thread-folder-action",type:"button",disabled:xo.value||Ao.value,onClick:Cb},k(v(a)("Retry")),9,XF)])):J("",!0),xo.value?(T(),A("p",ZF,k(v(a)("Loading folders…")),1)):!Vn.value&&pt.value.length===0?(T(),A("p",eU,k(Br.value.trim()?v(a)("No folders match this filter."):v(a)("No subfolders found here.")),1)):pt.value.length>0?(T(),A("ul",tU,[(T(!0),A(ze,null,kt(pt.value,j=>(T(),A("li",{key:j.key,class:"new-thread-open-folder-item"},[d("button",{class:"new-thread-open-folder-item-main",type:"button",title:j.path,disabled:xo.value||Ao.value,onClick:U=>_b(j.path)},[d("span",oU,k(j.name),1)],8,nU),j.kind==="directory"?(T(),A("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:xo.value||Ao.value,onClick:U=>Id(j.path)},k(v(a)("Open")),9,rU)):J("",!0)]))),128))])):J("",!0)],40,MF)],32)):J("",!0)])),(T(),at(Bi,{to:"body"},[Fr.value?(T(),A("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:Qe(fb,["self"]),onMouseup:pb},[d("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":v(a)("Create or clone project"),onKeydown:Pn(Qe(sc,["prevent"]),["esc"])},[d("div",sU,[d("p",iU,k(v(a)("Create or clone project")),1),d("button",{class:"new-thread-open-folder-close",type:"button",disabled:zo.value,onClick:sc},k(v(a)("Cancel")),9,lU)]),d("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":v(a)("Project source")},[d("button",{class:Ke(["new-thread-project-mode-tab",{"is-active":qo.value==="create"}]),type:"button",role:"tab","aria-selected":qo.value==="create",disabled:zo.value,onClick:p[31]||(p[31]=j=>qo.value="create")},k(v(a)("New project")),11,cU),d("button",{class:Ke(["new-thread-project-mode-tab",{"is-active":qo.value==="clone"}]),type:"button",role:"tab","aria-selected":qo.value==="clone",disabled:zo.value,onClick:p[32]||(p[32]=j=>qo.value="clone")},k(v(a)("Clone from GitHub")),11,dU)],8,uU),d("label",fU,[d("span",pU,k(v(a)("Destination folder")),1),Nt(d("input",{"onUpdate:modelValue":p[33]||(p[33]=j=>Ls.value=j),class:"new-thread-open-folder-path",type:"text",disabled:zo.value,placeholder:v(a)("Destination folder")},null,8,hU),[[an,Ls.value]])]),qo.value==="create"?(T(),A("label",mU,[d("span",vU,k(v(a)("Project name")),1),Nt(d("input",{ref_key:"projectSetupPrimaryInputRef",ref:Dl,"onUpdate:modelValue":p[34]||(p[34]=j=>mi.value=j),class:"new-thread-open-folder-create-input",type:"text",disabled:zo.value,placeholder:v(a)("Project name"),onKeydown:Pn(Qe(Ed,["prevent"]),["enter"])},null,40,gU),[[an,mi.value]])])):qo.value==="clone"?(T(),A("label",yU,[d("span",wU,k(v(a)("GitHub repository URL")),1),Nt(d("input",{ref_key:"projectSetupPrimaryInputRef",ref:Dl,"onUpdate:modelValue":p[35]||(p[35]=j=>vi.value=j),class:"new-thread-open-folder-create-input",type:"url",disabled:zo.value,placeholder:"https://github.com/owner/repo",onKeydown:Pn(Qe(Ed,["prevent"]),["enter"])},null,40,bU),[[an,vi.value]])])):J("",!0),Ua.value?(T(),A("div",_U,[d("span",null,k(Ua.value),1),d("a",{class:"visible-error-feedback",href:v(Kn),onClick:p[36]||(p[36]=j=>In(j,Ua.value))},k(v(a)("Send feedback")),9,kU)])):J("",!0),d("div",CU,[d("button",{class:"new-thread-folder-action",type:"button",disabled:zo.value,onClick:sc},k(v(a)("Cancel")),9,TU),d("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!N.value||zo.value,onClick:Ed},k(me.value),9,SU)])],40,aU)],32)):J("",!0)])),ds.value?(T(),at(K$,{key:2,class:"new-thread-runtime-dropdown",modelValue:Rn.value,"onUpdate:modelValue":p[37]||(p[37]=j=>Rn.value=j)},null,8,["modelValue"])):J("",!0),Rn.value==="worktree"?(T(),A("div",xU,[d("p",AU,k(v(a)("Base branch")),1),xe(lr,{class:"new-thread-branch-dropdown","model-value":oo.value,options:i.value,placeholder:v(a)("Select branch"),"enable-search":!0,"search-placeholder":v(a)("Search branches..."),disabled:mr.value||i.value.length===0,"onUpdate:modelValue":tb},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),d("p",PU,k(mr.value?v(a)("Loading branches…"):c.value?v(a)("New worktree branch will start from {branch}.",{branch:c.value}):v(a)("No Git branches found for this folder.")),1)])):J("",!0),ds.value?(T(),A("p",EU,k(v(a)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):J("",!0),wn.value.phase!=="idle"?(T(),A("div",{key:5,class:Ke(["worktree-init-status",{"is-running":wn.value.phase==="running","is-error":wn.value.phase==="error"}])},[d("strong",IU,k(wn.value.title),1),d("span",RU,k(wn.value.message),1)],2)):J("",!0)]),d("div",MU,[v(De)?(T(),A("div",$U,[d("span",null,k(v(a)(v(De))),1),d("a",{class:"visible-error-feedback",href:v(Kn),onClick:p[38]||(p[38]=j=>In(j,v(De)))},k(v(a)("Send feedback")),9,jU)])):J("",!0),xe(ev,{ref_key:"homeThreadComposerRef",ref:Qa,"active-thread-id":Tr.value,cwd:mn.value,"fuzzy-file-search-results":v(be),onRegisterFuzzySession:v(Oe),"collaboration-modes":v(Ue),"selected-collaboration-mode":v(Te),models:v($e),"model-reasoning-efforts":v(he),"selected-model":Us.value,"selected-reasoning-effort":v(Ae),"selected-speed-mode":v(Pe),"is-updating-speed-mode":v(ne),skills:v(Ye),"thread-token-usage":v(z),"codex-quota":v(Fe),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":sa.value,"in-progress-submit-mode":Da.value,"dictation-click-to-toggle":rr.value,"dictation-auto-send":la.value,"dictation-language":Fa.value,onSubmit:Wp,"onUpdate:selectedCollaborationMode":sh,"onUpdate:selectedModel":Zp,"onUpdate:selectedReasoningEffort":eh,"onUpdate:selectedSpeedMode":th,"approval-policy":en.value,"is-approval-policy-saving":Rs.value,"approval-policy-error":co.value,"approval-policy-notice":gr.value,"onUpdate:approvalPolicy":ja,onSaveApprovalPolicy:Dn,onSlashCommand:nh},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"])])])):(T(),A("div",NU,[et.value&&v(pe)&&mn.value?(T(),at(v(o),{key:0,"thread-id":v(pe),cwd:mn.value,"is-thread-in-progress":Ci.value,"initial-file-path":$r.value,"commit-sha":na.value,onClose:p[39]||(p[39]=j=>et.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress","initial-file-path","commit-sha"])):(T(),A(ze,{key:1},[d("div",LU,[xe(v(t),{ref_key:"threadConversationRef",ref:Ea,messages:ki.value,"is-loading":v(dt),"active-thread-id":Tr.value,cwd:mn.value,"live-overlay":yd.value,"live-turn-id":v(Se),"pending-requests":v(Z),"has-more-persisted-above":v(ct),"is-loading-persisted-above":v(_t),"load-earlier-messages":v(we),onForkThread:qw,onRollback:Rb,onFileChangesChanged:Vu,onRespondServerRequest:Op},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"])]),d("div",{class:"composer-with-queue",ref_key:"composerQueueRef",ref:yn},[zu.value?(T(),A("div",OU,k(v(a)("This thread is running in the Codex TUI")),1)):J("",!0),v(De)?(T(),A("div",DU,[d("span",null,k(v(a)(v(De))),1),d("a",{class:"visible-error-feedback",href:v(Kn),onClick:p[40]||(p[40]=j=>In(j,v(De)))},k(v(a)("Send feedback")),9,FU)])):J("",!0),xe(j$,{messages:v(K),onEdit:Zw,onSteer:v(Le),onDelete:v(Q),onReorder:Eb},null,8,["messages","onSteer","onDelete"]),Zl.value?(T(),A("div",UU,[d("span",null,k(Zl.value),1),d("button",{type:"button",class:"interrupt-recovered-dismiss","aria-label":v(a)("Dismiss"),onClick:p[41]||(p[41]=j=>Zl.value="")}," × ",8,BU)])):J("",!0),Zi.value?(T(),at(k$,{key:3,request:Zi.value,"request-count":v(Z).length,"has-queue-above":v(K).length>0,"panel-width":Qr.value,"panel-error":Wl.value,onRespondServerRequest:Op},null,8,["request","request-count","has-queue-above","panel-width","panel-error"])):(T(),at(ev,{key:4,ref_key:"threadComposerRef",ref:Zn,"active-thread-id":Tr.value,cwd:mn.value,"fuzzy-file-search-results":v(be),onRegisterFuzzySession:v(Oe),"collaboration-modes":v(Ue),"selected-collaboration-mode":v(Te),models:v($e),"model-reasoning-efforts":v(he),"selected-model":Us.value,"selected-reasoning-effort":v(Ae),"selected-speed-mode":v(Pe),"is-updating-speed-mode":v(ne),skills:v(Ye),"thread-token-usage":v(z),"codex-quota":v(Fe),"is-turn-in-progress":Ci.value,"is-stop-pending":v(se),"is-interrupting-turn":v(gt),"is-compacting":zr.value,"external-session-active":zu.value,"has-queue-above":v(K).length>0,"send-with-enter":sa.value,"in-progress-submit-mode":Da.value,"dictation-click-to-toggle":rr.value,"dictation-auto-send":la.value,"dictation-language":Fa.value,"onUpdate:selectedCollaborationMode":sh,onSubmit:Wp,"onUpdate:selectedModel":Zp,"onUpdate:selectedReasoningEffort":eh,"onUpdate:selectedSpeedMode":th,"approval-policy":en.value,"is-approval-policy-saving":Rs.value,"approval-policy-error":co.value,"approval-policy-notice":gr.value,"onUpdate:approvalPolicy":ja,onSaveApprovalPolicy:Dn,"plan-panel":Hl.value,onInterrupt:Ib,onSlashCommand:nh,onImplementPlan:Mb,onCompactContext:_d},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(ht)&&On.value?(T(),A("div",{key:0,class:"content-right-panel-backdrop",role:"presentation",onClick:Up})):J("",!0),el.value&&(v(ht)||!No.value)?(T(),A("aside",{key:1,class:Ke(["content-right-panel",{"is-mobile-open":On.value}]),style:Vr({"--right-panel-width":`${hr.value}px`})},[v(ht)?J("",!0):(T(),A("div",{key:0,class:"content-right-panel-resize-handle","aria-hidden":"true",onMousedown:Er},null,32)),d("div",qU,[d("div",zU,[d("button",{class:Ke(["content-right-panel-tab",{"is-active":Rt.value==="git"}]),type:"button",role:"tab","aria-selected":Rt.value==="git",onClick:p[42]||(p[42]=j=>Si("git"))},[xe(Oi,{class:"content-right-panel-tab-icon"}),ks(" "+k(v(a)("Git")),1)],10,HU),d("button",{class:Ke(["content-right-panel-tab",{"is-active":Rt.value==="files"}]),type:"button",role:"tab","aria-selected":Rt.value==="files",onClick:p[43]||(p[43]=j=>Si("files"))},[xe(ov,{class:"content-right-panel-tab-icon"}),ks(" "+k(v(a)("Files")),1)],10,WU),(T(!0),A(ze,null,kt(Yn.value,j=>(T(),A("button",{key:j.key,class:Ke(["content-right-panel-tab content-right-panel-tab--preview",{"is-active":Rt.value==="preview"&&bo.value===j.key}]),type:"button",role:"tab","aria-selected":Rt.value==="preview"&&bo.value===j.key,title:j.path,onClick:U=>Hw(j.key)},[xe(M,{class:"content-right-panel-tab-icon"}),d("span",GU,k(j.label),1),d("span",{class:"content-right-panel-tab-close",role:"button","aria-label":v(a)("Close"),title:v(a)("Close"),onClick:Qe(U=>Ww(j.key),["stop"])},"×",8,KU)],10,VU))),128))]),d("div",YU,[d("div",JU,[d("button",{ref:"rightPanelAddButtonRef",class:"content-right-panel-add",type:"button","aria-label":v(a)("Add panel"),title:v(a)("Add panel"),onClick:p[44]||(p[44]=Qe(j=>qn.value=!qn.value,["stop"]))},"+",8,QU),xe(Au,{name:"right-panel-menu"},{default:tt(()=>[qn.value?(T(),A("div",XU,[d("button",{type:"button",onClick:p[45]||(p[45]=j=>Si("terminal"))},[xe(sN,{class:"content-right-panel-menu-icon"}),ks(" "+k(v(a)("Terminal panel")),1)]),d("button",{type:"button",onClick:p[46]||(p[46]=j=>Si("git"))},[xe(Oi,{class:"content-right-panel-menu-icon"}),ks(" "+k(v(a)("Git panel")),1)]),d("button",{type:"button",onClick:p[47]||(p[47]=j=>Si("files"))},[xe(ov,{class:"content-right-panel-menu-icon"}),ks(" "+k(v(a)("Files panel")),1)])])):J("",!0)]),_:1})]),d("button",{class:"content-right-panel-close",type:"button","aria-label":v(a)("Close panel"),title:v(a)("Close panel"),onClick:Up},[xe(jc,{class:"content-right-panel-close-icon"})],8,ZU)])]),d("div",e4,[Rt.value==="git"?(T(),at(v2,{key:0,"current-branch":oa.value,"head-sha":Na.value,"head-subject":br.value,"head-date":La.value,detached:Uo.value,dirty:ts.value,"worktree-change-summary":jr.value,"worktree-changes":Co.value,branches:wr.value,"commits-by-branch":qe.value,"commits-loading-for":ke.value,"commits-error":Wn.value,"commit-files-by-sha":Oa.value,"commit-files-loading-for":_r.value,"commit-files-error":$s.value,loading:un.value,busy:ra.value,error:Nr.value,"review-open":et.value,"show-review":v(xt).name==="thread"&&v(pe).length>0,onToggleReview:ib,onCheckoutBranch:ob,onResetBranchToCommit:rb,onLoadCommits:Kp,onLoadCommitFiles:ab,onOpenCommitFile:sb},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"])):Rt.value==="files"?(T(),at($2,{key:1,cwd:mn.value,onOpenPreview:zw},null,8,["cwd"])):Rt.value==="preview"&&eo.value?(T(),at(Y2,{key:2,"file-path":eo.value.path,name:eo.value.label},null,8,["file-path","name"])):(T(),at(v(n),{key:3,ref_key:"threadTerminalPanelRef",ref:wo,"thread-id":Tr.value,cwd:mn.value,onHide:Gw,onTerminalFocusChange:Kw},null,8,["thread-id","cwd"]))])],6)):J("",!0)])]),_:1},8,["is-sidebar-collapsed"]),Mt.value.phase!=="idle"?(T(),A("div",t4,[d("div",{class:"project-zip-modal",role:"dialog","aria-modal":"true","aria-label":v(a)("Export Project"),onClick:p[49]||(p[49]=Qe(()=>{},["stop"]))},[d("div",o4,[d("h2",r4,k(v(a)("Export Project")),1),d("button",{class:"project-zip-modal-close",type:"button","aria-label":v(a)("Close"),disabled:Mt.value.phase==="exporting",onClick:Np}," × ",8,a4)]),d("p",s4,k(Mt.value.phase==="exporting"?v(a)("Preparing project ZIP..."):Mt.value.fileName),1),d("div",i4,[d("span",null,k(Mt.value.phase==="exporting"?v(a)("Exporting"):v(a)("Ready")),1),d("span",null,k(Ol.value),1)]),d("div",l4,[d("div",{class:"project-zip-progress-fill",style:Vr({width:hi.value})},null,4)]),Mt.value.error?(T(),A("p",u4,k(Mt.value.error),1)):J("",!0),d("div",c4,[d("button",{class:"project-zip-modal-cancel",type:"button",disabled:Mt.value.phase==="exporting",onClick:Np},k(v(a)("Close")),9,d4),d("button",{class:"project-zip-modal-action",type:"button",disabled:!Mt.value.blob,onClick:Rw},k(v(a)("Download")),9,f4),d("button",{class:"project-zip-modal-action project-zip-modal-action-primary",type:"button",disabled:!Mt.value.blob,onClick:Mw},k(v(a)("Share")),9,p4)])],8,n4)])):J("",!0),os.value?(T(),A("div",{key:1,class:"codex-login-modal-backdrop",role:"presentation",onClick:Td},[d("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":v(a)("Complete Codex login"),onSubmit:Qe(mw,["prevent"]),onClick:p[52]||(p[52]=Qe(()=>{},["stop"]))},[d("div",m4,[d("h2",v4,k(v(a)("Complete Codex login")),1),d("button",{class:"codex-login-modal-close",type:"button","aria-label":v(a)("Close"),disabled:$n.value,onClick:Td}," × ",8,g4)]),d("p",y4,k(v(a)("Finish login in the browser, then paste the localhost callback URL here.")),1),aa.value?(T(),A("a",{key:0,class:"codex-login-modal-link",href:aa.value,target:"_blank",rel:"noreferrer"},k(v(a)("Open login URL")),9,w4)):J("",!0),Nt(d("input",{ref_key:"codexLoginCallbackInputRef",ref:pi,"onUpdate:modelValue":p[50]||(p[50]=j=>Lr.value=j),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:v(a)("Paste localhost callback URL"),disabled:$n.value},null,8,b4),[[an,Lr.value]]),cn.value?(T(),A("div",_4,[d("span",null,k(cn.value),1),d("a",{class:"visible-error-feedback",href:v(Kn),onClick:p[51]||(p[51]=j=>In(j,cn.value))},k(v(a)("Send feedback")),9,k4)])):J("",!0),d("div",C4,[d("button",{class:"codex-login-modal-cancel",type:"button",disabled:$n.value,onClick:Td},k(v(a)("Cancel")),9,T4),d("button",{class:"codex-login-modal-submit",type:"submit",disabled:$n.value||Lr.value.trim().length===0},k($n.value?v(a)("Completing…"):v(a)("Complete")),9,S4)])],40,h4)])):J("",!0)],64)}}}),R4=At(I4,[["__scopeId","data-v-df7bde28"]]),Ec={render:()=>null},M4=KC({history:xC(),routes:[{path:"/",name:"home",component:Ec},{path:"/thread/:threadId",name:"thread",component:Ec},{path:"/skills",name:"skills",component:Ec},{path:"/automations",name:"automations",component:Ec},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codex-mobile-re. github: https://github.com/cattails-lgao/codex-mobile");Tx();Ok(R4).use(M4).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(Ry("Service worker registration failed."),e)})});export{an as $,yp as A,zt as B,j4 as C,tI as D,au as E,ze as F,sj as G,j1 as H,jc as I,rv as J,XN as K,up as L,Ps as M,w1 as N,H4 as O,q4 as P,W4 as Q,z4 as R,V4 as S,Bi as T,lr as U,uB as V,dB as W,cB as X,Sp as Y,Nt as Z,At as _,A as a,JC as a0,YC as a1,Pn as a2,$4 as a3,o1 as a4,G4 as a5,N4 as a6,L4 as a7,O4 as a8,X4 as a9,oB as aa,rB as ab,K4 as ac,nB as ad,F4 as ae,D4 as af,U4 as ag,B4 as ah,aB as ai,iB as aj,lB as ak,Y4 as al,J4 as am,Q4 as an,Z4 as ao,tB as ap,eB as aq,sB as ar,h1 as as,m1 as at,ga as au,pI as av,d as b,at as c,Nn as d,J as e,ks as f,xe as g,Au as h,tt as i,Ar as j,ee as k,rt as l,zi as m,Ke as n,T as o,Vr as p,S as q,kt as r,Dy as s,k as t,v as u,xp as v,Qe as w,Oi as x,ur as y,yc as z};