codex-mobile-re 0.1.113 → 0.1.115
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.
- package/dist/assets/{AutomationsPanel-DlBkLmKR.js → AutomationsPanel-BmeZ3J9i.js} +1 -1
- package/dist/assets/{DirectoryHub-sS2h3U_D.js → DirectoryHub-Ciz8rVK4.js} +1 -1
- package/dist/assets/{QueuedMessages-D_o6pC9F.js → QueuedMessages-p3CX5QzM.js} +1 -1
- package/dist/assets/{ReviewPane-qS7hOyaM.js → ReviewPane-DcvdhrcS.js} +1 -1
- package/dist/assets/{RightFilePreview-D1LmPrpY.js → RightFilePreview-BjmHDwE1.js} +1 -1
- package/dist/assets/{RightFilesPanel-B5AIrAU3.js → RightFilesPanel-CFsAu6As.js} +1 -1
- package/dist/assets/{RightGitPanel-K_jp1qHA.js → RightGitPanel-NcqihWb7.js} +1 -1
- package/dist/assets/{SettingsDialog-C4aE-PFC.js → SettingsDialog-C-PIbb7v.js} +1 -1
- package/dist/assets/{ThreadConversation-Ccm62p-Y.css → ThreadConversation-BOs1zeme.css} +1 -1
- package/dist/assets/ThreadConversation-CcsAV6iU.js +39 -0
- package/dist/assets/{ThreadPendingRequestPanel-DNTrk7uR.js → ThreadPendingRequestPanel-C7aX0YrN.js} +1 -1
- package/dist/assets/{ThreadTerminalPanel-BLHMQWJI.js → ThreadTerminalPanel-2PMt2IWn.js} +1 -1
- package/dist/assets/{index-Cu_hRJGY.js → index-BJ-YiA9y.js} +17 -17
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/ThreadConversation-B4NZvuHw.js +0 -39
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-CcsAV6iU.js","assets/sanitizeHtml-Bd3No2dT.js","assets/ThreadConversation-BOs1zeme.css","assets/ThreadTerminalPanel-2PMt2IWn.js","assets/ThreadTerminalPanel-O7IxAyfy.css","assets/ReviewPane-DcvdhrcS.js","assets/ReviewPane-ZrWfZEd_.css","assets/DirectoryHub-Ciz8rVK4.js","assets/DirectoryHub-DmZLEiwB.css","assets/AutomationsPanel-BmeZ3J9i.js","assets/AutomationsPanel-VRBbmMYW.css","assets/SettingsDialog-C-PIbb7v.js","assets/SettingsDialog-CfChVi0L.css","assets/RightGitPanel-NcqihWb7.js","assets/RightGitPanel-BTq9Wdmr.css","assets/RightFilesPanel-CFsAu6As.js","assets/RightFilesPanel-l-aqQaW6.css","assets/RightFilePreview-BjmHDwE1.js","assets/RightFilePreview-BythLbi1.css","assets/ThreadPendingRequestPanel-C7aX0YrN.js","assets/ThreadPendingRequestPanel-BptJdqbc.css","assets/QueuedMessages-p3CX5QzM.js","assets/QueuedMessages-BM1najM7.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&o(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?a.credentials="include":r.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function o(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();/**
|
|
3
3
|
* @vue/shared v3.5.40
|
|
4
4
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
@@ -7,15 +7,15 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversat
|
|
|
7
7
|
* @vue/reactivity v3.5.40
|
|
8
8
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
9
9
|
* @license MIT
|
|
10
|
-
**/let jn;class RT{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&&jn&&(jn.active?(this.parent=jn,this.index=(jn.scopes||(jn.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=jn;try{return jn=this,t()}finally{jn=n}}}on(){++this._on===1&&(this.prevScope=jn,jn=this)}off(){if(this._on>0&&--this._on===0){if(jn===this)jn=this.prevScope;else{let t=jn;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 ET(){return jn}let Bt;const od=new WeakSet;class hv{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,jn&&(jn.active?jn.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,od.has(this)&&(od.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||vv(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Up(this),gv(this);const t=Bt,n=jr;Bt=this,jr=!0;try{return this.fn()}finally{yv(this),Bt=t,jr=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Tf(t);this.deps=this.depsTail=void 0,Up(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?od.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Md(this)&&this.run()}get dirty(){return Md(this)}}let mv=0,Rl,El;function vv(e,t=!1){if(e.flags|=8,t){e.next=El,El=e;return}e.next=Rl,Rl=e}function wf(){mv++}function bf(){if(--mv>0)return;if(El){let t=El;for(El=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Rl;){let t=Rl;for(Rl=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 gv(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function yv(e){let t,n=e.depsTail,o=n;for(;o;){const r=o.prevDep;o.version===-1?(o===n&&(n=r),Tf(o),MT(o)):t=o,o.dep.activeLink=o.prevActiveLink,o.prevActiveLink=void 0,o=r}e.deps=t,e.depsTail=n}function Md(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(wv(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function wv(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Ol)||(e.globalVersion=Ol,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Md(e))))return;e.flags|=2;const t=e.dep,n=Bt,o=jr;Bt=e,jr=!0;try{gv(e);const r=e.fn(e._value);(t.version===0||Rr(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{Bt=n,jr=o,yv(e),e.flags&=-3}}function Tf(e,t=!1){const{dep:n,prevSub:o,nextSub:r}=e;if(o&&(o.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=o,e.nextSub=void 0),n.subs===e&&(n.subs=o,!o&&n.computed)){n.computed.flags&=-5;for(let a=n.computed.deps;a;a=a.nextDep)Tf(a,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function MT(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let jr=!0;const bv=[];function Da(){bv.push(jr),jr=!1}function Fa(){const e=bv.pop();jr=e===void 0?!0:e}function Up(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Bt;Bt=void 0;try{t()}finally{Bt=n}}}let Ol=0;class jT{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 Sf{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(!Bt||!jr||Bt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Bt)n=this.activeLink=new jT(Bt,this),Bt.deps?(n.prevDep=Bt.depsTail,Bt.depsTail.nextDep=n,Bt.depsTail=n):Bt.deps=Bt.depsTail=n,Tv(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=Bt.depsTail,n.nextDep=void 0,Bt.depsTail.nextDep=n,Bt.depsTail=n,Bt.deps===n&&(Bt.deps=o)}return n}trigger(t){this.version++,Ol++,this.notify(t)}notify(t){wf();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{bf()}}}function Tv(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)Tv(o)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const jd=new WeakMap,li=Symbol(""),Ld=Symbol(""),Dl=Symbol("");function Jn(e,t,n){if(jr&&Bt){let o=jd.get(e);o||jd.set(e,o=new Map);let r=o.get(n);r||(o.set(n,r=new Sf),r.map=o,r.key=n),r.track()}}function La(e,t,n,o,r,a){const s=jd.get(e);if(!s){Ol++;return}const i=l=>{l&&l.trigger()};if(wf(),t==="clear")s.forEach(i);else{const l=nt(e),d=l&&gf(n);if(l&&n==="length"){const c=Number(o);s.forEach((v,f)=>{(f==="length"||f===Dl||!$r(f)&&f>=c)&&i(v)})}else switch((n!==void 0||s.has(void 0))&&i(s.get(n)),d&&i(s.get(Dl)),t){case"add":l?d&&i(s.get("length")):(i(s.get(li)),Fi(e)&&i(s.get(Ld)));break;case"delete":l||(i(s.get(li)),Fi(e)&&i(s.get(Ld)));break;case"set":Fi(e)&&i(s.get(li));break}}bf()}function Ri(e){const t=Rt(e);return t===e?t:(Jn(t,"iterate",Dl),tr(e)?t:t.map(Or))}function ic(e){return Jn(e=Rt(e),"iterate",Dl),e}function la(e,t){return Ba(e)?Vi(ui(e)?Or(t):t):Or(t)}const LT={__proto__:null,[Symbol.iterator](){return rd(this,Symbol.iterator,e=>la(this,e))},concat(...e){return Ri(this).concat(...e.map(t=>nt(t)?Ri(t):t))},entries(){return rd(this,"entries",e=>(e[1]=la(this,e[1]),e))},every(e,t){return _a(this,"every",e,t,void 0,arguments)},filter(e,t){return _a(this,"filter",e,t,n=>n.map(o=>la(this,o)),arguments)},find(e,t){return _a(this,"find",e,t,n=>la(this,n),arguments)},findIndex(e,t){return _a(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return _a(this,"findLast",e,t,n=>la(this,n),arguments)},findLastIndex(e,t){return _a(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return _a(this,"forEach",e,t,void 0,arguments)},includes(...e){return ad(this,"includes",e)},indexOf(...e){return ad(this,"indexOf",e)},join(e){return Ri(this).join(e)},lastIndexOf(...e){return ad(this,"lastIndexOf",e)},map(e,t){return _a(this,"map",e,t,void 0,arguments)},pop(){return bl(this,"pop")},push(...e){return bl(this,"push",e)},reduce(e,...t){return zp(this,"reduce",e,t)},reduceRight(e,...t){return zp(this,"reduceRight",e,t)},shift(){return bl(this,"shift")},some(e,t){return _a(this,"some",e,t,void 0,arguments)},splice(...e){return bl(this,"splice",e)},toReversed(){return Ri(this).toReversed()},toSorted(e){return Ri(this).toSorted(e)},toSpliced(...e){return Ri(this).toSpliced(...e)},unshift(...e){return bl(this,"unshift",e)},values(){return rd(this,"values",e=>la(this,e))}};function rd(e,t,n){const o=ic(e),r=o[t]();return o!==e&&!tr(e)&&(r._next=r.next,r.next=()=>{const a=r._next();return a.done||(a.value=n(a.value)),a}),r}const NT=Array.prototype;function _a(e,t,n,o,r,a){const s=ic(e),i=s!==e&&!tr(e),l=s[t];if(l!==NT[t]){const v=l.apply(e,a);return i?Or(v):v}let d=n;s!==e&&(i?d=function(v,f){return n.call(this,la(e,v),f,e)}:n.length>2&&(d=function(v,f){return n.call(this,v,f,e)}));const c=l.call(s,d,o);return i&&r?r(c):c}function zp(e,t,n,o){const r=ic(e),a=r!==e&&!tr(e);let s=n,i=!1;r!==e&&(a?(i=o.length===0,s=function(d,c,v){return i&&(i=!1,d=la(e,d)),n.call(this,d,la(e,c),v,e)}):n.length>3&&(s=function(d,c,v){return n.call(this,d,c,v,e)}));const l=r[t](s,...o);return i?la(e,l):l}function ad(e,t,n){const o=Rt(e);Jn(o,"iterate",Dl);const r=o[t](...n);return(r===-1||r===!1)&&kf(n[0])?(n[0]=Rt(n[0]),o[t](...n)):r}function bl(e,t,n=[]){Da(),wf();const o=Rt(e)[t].apply(e,n);return bf(),Fa(),o}const $T=mf("__proto__,__v_isRef,__isVue"),Sv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter($r));function OT(e){$r(e)||(e=String(e));const t=Rt(this);return Jn(t,"has",e),t.hasOwnProperty(e)}class Cv{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,o){if(n==="__v_skip")return t.__v_skip;const r=this._isReadonly,a=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return a;if(n==="__v_raw")return o===(r?a?VT:Av:a?Iv:kv).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(o)?t:void 0;const s=nt(t);if(!r){let l;if(s&&(l=LT[n]))return l;if(n==="hasOwnProperty")return OT}const i=Reflect.get(t,n,kn(t)?t:o);if(($r(n)?Sv.has(n):$T(n))||(r||Jn(t,"get",n),a))return i;if(kn(i)){const l=s&&gf(n)?i:i.value;return r&&jt(l)?$d(l):l}return jt(i)?r?$d(i):lc(i):i}}class xv extends Cv{constructor(t=!1){super(!1,t)}set(t,n,o,r){let a=t[n];const s=nt(t)&&gf(n);if(!this._isShallow){const d=Ba(a);if(!tr(o)&&!Ba(o)&&(a=Rt(a),o=Rt(o)),!s&&kn(a)&&!kn(o))return d||(a.value=o),!0}const i=s?Number(n)<t.length:Mt(t,n),l=Reflect.set(t,n,o,kn(t)?t:r);return t===Rt(r)&&l&&(i?Rr(o,a)&&La(t,"set",n,o):La(t,"add",n,o)),l}deleteProperty(t,n){const o=Mt(t,n);t[n];const r=Reflect.deleteProperty(t,n);return r&&o&&La(t,"delete",n,void 0),r}has(t,n){const o=Reflect.has(t,n);return(!$r(n)||!Sv.has(n))&&Jn(t,"has",n),o}ownKeys(t){return Jn(t,"iterate",nt(t)?"length":li),Reflect.ownKeys(t)}}class DT extends Cv{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const FT=new xv,BT=new DT,UT=new xv(!0);const Nd=e=>e,hu=e=>Reflect.getPrototypeOf(e);function zT(e,t,n){return function(...o){const r=this.__v_raw,a=Rt(r),s=Fi(a),i=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,d=r[e](...o),c=n?Nd:t?Vi:Or;return!t&&Jn(a,"iterate",l?Ld:li),pn(Object.create(d),{next(){const{value:v,done:f}=d.next();return f?{value:v,done:f}:{value:i?[c(v[0]),c(v[1])]:c(v),done:f}}})}}function mu(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function HT(e,t){const n={get(r){const a=this.__v_raw,s=Rt(a),i=Rt(r);e||(Rr(r,i)&&Jn(s,"get",r),Jn(s,"get",i));const{has:l}=hu(s),d=t?Nd:e?Vi:Or;if(l.call(s,r))return d(a.get(r));if(l.call(s,i))return d(a.get(i));a!==s&&a.get(r)},get size(){const r=this.__v_raw;return!e&&Jn(Rt(r),"iterate",li),r.size},has(r){const a=this.__v_raw,s=Rt(a),i=Rt(r);return e||(Rr(r,i)&&Jn(s,"has",r),Jn(s,"has",i)),r===i?a.has(r):a.has(r)||a.has(i)},forEach(r,a){const s=this,i=s.__v_raw,l=Rt(i),d=t?Nd:e?Vi:Or;return!e&&Jn(l,"iterate",li),i.forEach((c,v)=>r.call(a,d(c),d(v),s))}};return pn(n,e?{add:mu("add"),set:mu("set"),delete:mu("delete"),clear:mu("clear")}:{add(r){const a=Rt(this),s=hu(a),i=Rt(r),l=!t&&!tr(r)&&!Ba(r)?i:r;return s.has.call(a,l)||Rr(r,l)&&s.has.call(a,r)||Rr(i,l)&&s.has.call(a,i)||(a.add(l),La(a,"add",l,l)),this},set(r,a){!t&&!tr(a)&&!Ba(a)&&(a=Rt(a));const s=Rt(this),{has:i,get:l}=hu(s);let d=i.call(s,r);d||(r=Rt(r),d=i.call(s,r));const c=l.call(s,r);return s.set(r,a),d?Rr(a,c)&&La(s,"set",r,a):La(s,"add",r,a),this},delete(r){const a=Rt(this),{has:s,get:i}=hu(a);let l=s.call(a,r);l||(r=Rt(r),l=s.call(a,r)),i&&i.call(a,r);const d=a.delete(r);return l&&La(a,"delete",r,void 0),d},clear(){const r=Rt(this),a=r.size!==0,s=r.clear();return a&&La(r,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=zT(r,e,t)}),n}function Cf(e,t){const n=HT(e,t);return(o,r,a)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?o:Reflect.get(Mt(n,r)&&r in o?n:o,r,a)}const qT={get:Cf(!1,!1)},WT={get:Cf(!1,!0)},GT={get:Cf(!0,!1)};const kv=new WeakMap,Iv=new WeakMap,Av=new WeakMap,VT=new WeakMap;function KT(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function lc(e){return Ba(e)?e:xf(e,!1,FT,qT,kv)}function _v(e){return xf(e,!1,UT,WT,Iv)}function $d(e){return xf(e,!0,BT,GT,Av)}function xf(e,t,n,o,r){if(!jt(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const a=r.get(e);if(a)return a;const s=KT(wT(e));if(s===0)return e;const i=new Proxy(e,s===2?o:n);return r.set(e,i),i}function ui(e){return Ba(e)?ui(e.__v_raw):!!(e&&e.__v_isReactive)}function Ba(e){return!!(e&&e.__v_isReadonly)}function tr(e){return!!(e&&e.__v_isShallow)}function kf(e){return e?!!e.__v_raw:!1}function Rt(e){const t=e&&e.__v_raw;return t?Rt(t):e}function YT(e){return!Mt(e,"__v_skip")&&Object.isExtensible(e)&&uv(e,"__v_skip",!0),e}const Or=e=>jt(e)?lc(e):e,Vi=e=>jt(e)?$d(e):e;function kn(e){return e?e.__v_isRef===!0:!1}function S(e){return Pv(e,!1)}function JT(e){return Pv(e,!0)}function Pv(e,t){return kn(e)?e:new QT(e,t)}class QT{constructor(t,n){this.dep=new Sf,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Rt(t),this._value=n?t:Or(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,o=this.__v_isShallow||tr(t)||Ba(t);t=o?t:Rt(t),Rr(t,n)&&(this._rawValue=t,this._value=o?t:Or(t),this.dep.trigger())}}function h(e){return kn(e)?e.value:e}const XT={get:(e,t,n)=>t==="__v_raw"?e:h(Reflect.get(e,t,n)),set:(e,t,n,o)=>{const r=e[t];return kn(r)&&!kn(n)?(r.value=n,!0):Reflect.set(e,t,n,o)}};function Rv(e){return ui(e)?e:new Proxy(e,XT)}class ZT{constructor(t,n,o){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Sf(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Ol-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=o}notify(){if(this.flags|=16,!(this.flags&8)&&Bt!==this)return vv(this,!0),!0}get value(){const t=this.dep.track();return wv(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function eS(e,t,n=!1){let o,r;return ft(e)?o=e:(o=e.get,r=e.set),new ZT(o,r,n)}const vu={},Ou=new WeakMap;let ni;function tS(e,t=!1,n=ni){if(n){let o=Ou.get(n);o||Ou.set(n,o=[]),o.push(e)}}function nS(e,t,n=Dt){const{immediate:o,deep:r,once:a,scheduler:s,augmentJob:i,call:l}=n,d=H=>r?H:tr(H)||r===!1||r===0?Na(H,1):Na(H);let c,v,f,b,y=!1,P=!1;if(kn(e)?(v=()=>e.value,y=tr(e)):ui(e)?(v=()=>d(e),y=!0):nt(e)?(P=!0,y=e.some(H=>ui(H)||tr(H)),v=()=>e.map(H=>{if(kn(H))return H.value;if(ui(H))return d(H);if(ft(H))return l?l(H,2):H()})):ft(e)?t?v=l?()=>l(e,2):e:v=()=>{if(f){Da();try{f()}finally{Fa()}}const H=ni;ni=c;try{return l?l(e,3,[b]):e(b)}finally{ni=H}}:v=ca,t&&r){const H=v,be=r===!0?1/0:r;v=()=>Na(H(),be)}const B=ET(),L=()=>{c.stop(),B&&B.active&&vf(B.effects,c)};if(a&&t){const H=t;t=(...be)=>{const le=H(...be);return L(),le}}let j=P?new Array(e.length).fill(vu):vu;const U=H=>{if(!(!(c.flags&1)||!c.dirty&&!H))if(t){const be=c.run();if(H||r||y||(P?be.some((le,W)=>Rr(le,j[W])):Rr(be,j))){f&&f();const le=ni;ni=c;try{const W=[be,j===vu?void 0:P&&j[0]===vu?[]:j,b];j=be,l?l(t,3,W):t(...W)}finally{ni=le}}}else c.run()};return i&&i(U),c=new hv(v),c.scheduler=s?()=>s(U,!1):U,b=H=>tS(H,!1,c),f=c.onStop=()=>{const H=Ou.get(c);if(H){if(l)l(H,4);else for(const be of H)be();Ou.delete(c)}},t?o?U(!0):j=c.run():s?s(U.bind(null,!0),!0):c.run(),L.pause=c.pause.bind(c),L.resume=c.resume.bind(c),L.stop=L,L}function Na(e,t=1/0,n){if(t<=0||!jt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,kn(e))Na(e.value,t,n);else if(nt(e))for(let o=0;o<e.length;o++)Na(e[o],t,n);else if(oc(e)||Fi(e))e.forEach(o=>{Na(o,t,n)});else if(lv(e)){for(const o in e)Na(e[o],t,n);for(const o of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,o)&&Na(e[o],t,n)}return e}/**
|
|
10
|
+
**/let jn;class RT{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&&jn&&(jn.active?(this.parent=jn,this.index=(jn.scopes||(jn.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=jn;try{return jn=this,t()}finally{jn=n}}}on(){++this._on===1&&(this.prevScope=jn,jn=this)}off(){if(this._on>0&&--this._on===0){if(jn===this)jn=this.prevScope;else{let t=jn;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 ET(){return jn}let Bt;const od=new WeakSet;class hv{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,jn&&(jn.active?jn.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,od.has(this)&&(od.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||vv(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Up(this),gv(this);const t=Bt,n=jr;Bt=this,jr=!0;try{return this.fn()}finally{yv(this),Bt=t,jr=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Tf(t);this.deps=this.depsTail=void 0,Up(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?od.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Md(this)&&this.run()}get dirty(){return Md(this)}}let mv=0,Rl,El;function vv(e,t=!1){if(e.flags|=8,t){e.next=El,El=e;return}e.next=Rl,Rl=e}function wf(){mv++}function bf(){if(--mv>0)return;if(El){let t=El;for(El=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Rl;){let t=Rl;for(Rl=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 gv(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function yv(e){let t,n=e.depsTail,o=n;for(;o;){const r=o.prevDep;o.version===-1?(o===n&&(n=r),Tf(o),MT(o)):t=o,o.dep.activeLink=o.prevActiveLink,o.prevActiveLink=void 0,o=r}e.deps=t,e.depsTail=n}function Md(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(wv(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function wv(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Ol)||(e.globalVersion=Ol,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Md(e))))return;e.flags|=2;const t=e.dep,n=Bt,o=jr;Bt=e,jr=!0;try{gv(e);const r=e.fn(e._value);(t.version===0||Rr(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{Bt=n,jr=o,yv(e),e.flags&=-3}}function Tf(e,t=!1){const{dep:n,prevSub:o,nextSub:r}=e;if(o&&(o.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=o,e.nextSub=void 0),n.subs===e&&(n.subs=o,!o&&n.computed)){n.computed.flags&=-5;for(let a=n.computed.deps;a;a=a.nextDep)Tf(a,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function MT(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let jr=!0;const bv=[];function Da(){bv.push(jr),jr=!1}function Fa(){const e=bv.pop();jr=e===void 0?!0:e}function Up(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Bt;Bt=void 0;try{t()}finally{Bt=n}}}let Ol=0;class jT{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 Sf{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(!Bt||!jr||Bt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Bt)n=this.activeLink=new jT(Bt,this),Bt.deps?(n.prevDep=Bt.depsTail,Bt.depsTail.nextDep=n,Bt.depsTail=n):Bt.deps=Bt.depsTail=n,Tv(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=Bt.depsTail,n.nextDep=void 0,Bt.depsTail.nextDep=n,Bt.depsTail=n,Bt.deps===n&&(Bt.deps=o)}return n}trigger(t){this.version++,Ol++,this.notify(t)}notify(t){wf();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{bf()}}}function Tv(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)Tv(o)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const jd=new WeakMap,li=Symbol(""),Ld=Symbol(""),Dl=Symbol("");function Jn(e,t,n){if(jr&&Bt){let o=jd.get(e);o||jd.set(e,o=new Map);let r=o.get(n);r||(o.set(n,r=new Sf),r.map=o,r.key=n),r.track()}}function La(e,t,n,o,r,a){const s=jd.get(e);if(!s){Ol++;return}const i=l=>{l&&l.trigger()};if(wf(),t==="clear")s.forEach(i);else{const l=nt(e),d=l&&gf(n);if(l&&n==="length"){const c=Number(o);s.forEach((v,f)=>{(f==="length"||f===Dl||!$r(f)&&f>=c)&&i(v)})}else switch((n!==void 0||s.has(void 0))&&i(s.get(n)),d&&i(s.get(Dl)),t){case"add":l?d&&i(s.get("length")):(i(s.get(li)),Fi(e)&&i(s.get(Ld)));break;case"delete":l||(i(s.get(li)),Fi(e)&&i(s.get(Ld)));break;case"set":Fi(e)&&i(s.get(li));break}}bf()}function Ri(e){const t=Rt(e);return t===e?t:(Jn(t,"iterate",Dl),tr(e)?t:t.map(Or))}function ic(e){return Jn(e=Rt(e),"iterate",Dl),e}function la(e,t){return Ba(e)?Vi(ui(e)?Or(t):t):Or(t)}const LT={__proto__:null,[Symbol.iterator](){return rd(this,Symbol.iterator,e=>la(this,e))},concat(...e){return Ri(this).concat(...e.map(t=>nt(t)?Ri(t):t))},entries(){return rd(this,"entries",e=>(e[1]=la(this,e[1]),e))},every(e,t){return _a(this,"every",e,t,void 0,arguments)},filter(e,t){return _a(this,"filter",e,t,n=>n.map(o=>la(this,o)),arguments)},find(e,t){return _a(this,"find",e,t,n=>la(this,n),arguments)},findIndex(e,t){return _a(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return _a(this,"findLast",e,t,n=>la(this,n),arguments)},findLastIndex(e,t){return _a(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return _a(this,"forEach",e,t,void 0,arguments)},includes(...e){return ad(this,"includes",e)},indexOf(...e){return ad(this,"indexOf",e)},join(e){return Ri(this).join(e)},lastIndexOf(...e){return ad(this,"lastIndexOf",e)},map(e,t){return _a(this,"map",e,t,void 0,arguments)},pop(){return bl(this,"pop")},push(...e){return bl(this,"push",e)},reduce(e,...t){return zp(this,"reduce",e,t)},reduceRight(e,...t){return zp(this,"reduceRight",e,t)},shift(){return bl(this,"shift")},some(e,t){return _a(this,"some",e,t,void 0,arguments)},splice(...e){return bl(this,"splice",e)},toReversed(){return Ri(this).toReversed()},toSorted(e){return Ri(this).toSorted(e)},toSpliced(...e){return Ri(this).toSpliced(...e)},unshift(...e){return bl(this,"unshift",e)},values(){return rd(this,"values",e=>la(this,e))}};function rd(e,t,n){const o=ic(e),r=o[t]();return o!==e&&!tr(e)&&(r._next=r.next,r.next=()=>{const a=r._next();return a.done||(a.value=n(a.value)),a}),r}const NT=Array.prototype;function _a(e,t,n,o,r,a){const s=ic(e),i=s!==e&&!tr(e),l=s[t];if(l!==NT[t]){const v=l.apply(e,a);return i?Or(v):v}let d=n;s!==e&&(i?d=function(v,f){return n.call(this,la(e,v),f,e)}:n.length>2&&(d=function(v,f){return n.call(this,v,f,e)}));const c=l.call(s,d,o);return i&&r?r(c):c}function zp(e,t,n,o){const r=ic(e),a=r!==e&&!tr(e);let s=n,i=!1;r!==e&&(a?(i=o.length===0,s=function(d,c,v){return i&&(i=!1,d=la(e,d)),n.call(this,d,la(e,c),v,e)}):n.length>3&&(s=function(d,c,v){return n.call(this,d,c,v,e)}));const l=r[t](s,...o);return i?la(e,l):l}function ad(e,t,n){const o=Rt(e);Jn(o,"iterate",Dl);const r=o[t](...n);return(r===-1||r===!1)&&kf(n[0])?(n[0]=Rt(n[0]),o[t](...n)):r}function bl(e,t,n=[]){Da(),wf();const o=Rt(e)[t].apply(e,n);return bf(),Fa(),o}const $T=mf("__proto__,__v_isRef,__isVue"),Sv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter($r));function OT(e){$r(e)||(e=String(e));const t=Rt(this);return Jn(t,"has",e),t.hasOwnProperty(e)}class Cv{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,o){if(n==="__v_skip")return t.__v_skip;const r=this._isReadonly,a=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return a;if(n==="__v_raw")return o===(r?a?VT:Av:a?Iv:kv).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(o)?t:void 0;const s=nt(t);if(!r){let l;if(s&&(l=LT[n]))return l;if(n==="hasOwnProperty")return OT}const i=Reflect.get(t,n,kn(t)?t:o);if(($r(n)?Sv.has(n):$T(n))||(r||Jn(t,"get",n),a))return i;if(kn(i)){const l=s&&gf(n)?i:i.value;return r&&jt(l)?$d(l):l}return jt(i)?r?$d(i):lc(i):i}}class xv extends Cv{constructor(t=!1){super(!1,t)}set(t,n,o,r){let a=t[n];const s=nt(t)&&gf(n);if(!this._isShallow){const d=Ba(a);if(!tr(o)&&!Ba(o)&&(a=Rt(a),o=Rt(o)),!s&&kn(a)&&!kn(o))return d||(a.value=o),!0}const i=s?Number(n)<t.length:Mt(t,n),l=Reflect.set(t,n,o,kn(t)?t:r);return t===Rt(r)&&l&&(i?Rr(o,a)&&La(t,"set",n,o):La(t,"add",n,o)),l}deleteProperty(t,n){const o=Mt(t,n);t[n];const r=Reflect.deleteProperty(t,n);return r&&o&&La(t,"delete",n,void 0),r}has(t,n){const o=Reflect.has(t,n);return(!$r(n)||!Sv.has(n))&&Jn(t,"has",n),o}ownKeys(t){return Jn(t,"iterate",nt(t)?"length":li),Reflect.ownKeys(t)}}class DT extends Cv{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const FT=new xv,BT=new DT,UT=new xv(!0);const Nd=e=>e,hu=e=>Reflect.getPrototypeOf(e);function zT(e,t,n){return function(...o){const r=this.__v_raw,a=Rt(r),s=Fi(a),i=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,d=r[e](...o),c=n?Nd:t?Vi:Or;return!t&&Jn(a,"iterate",l?Ld:li),pn(Object.create(d),{next(){const{value:v,done:f}=d.next();return f?{value:v,done:f}:{value:i?[c(v[0]),c(v[1])]:c(v),done:f}}})}}function mu(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function HT(e,t){const n={get(r){const a=this.__v_raw,s=Rt(a),i=Rt(r);e||(Rr(r,i)&&Jn(s,"get",r),Jn(s,"get",i));const{has:l}=hu(s),d=t?Nd:e?Vi:Or;if(l.call(s,r))return d(a.get(r));if(l.call(s,i))return d(a.get(i));a!==s&&a.get(r)},get size(){const r=this.__v_raw;return!e&&Jn(Rt(r),"iterate",li),r.size},has(r){const a=this.__v_raw,s=Rt(a),i=Rt(r);return e||(Rr(r,i)&&Jn(s,"has",r),Jn(s,"has",i)),r===i?a.has(r):a.has(r)||a.has(i)},forEach(r,a){const s=this,i=s.__v_raw,l=Rt(i),d=t?Nd:e?Vi:Or;return!e&&Jn(l,"iterate",li),i.forEach((c,v)=>r.call(a,d(c),d(v),s))}};return pn(n,e?{add:mu("add"),set:mu("set"),delete:mu("delete"),clear:mu("clear")}:{add(r){const a=Rt(this),s=hu(a),i=Rt(r),l=!t&&!tr(r)&&!Ba(r)?i:r;return s.has.call(a,l)||Rr(r,l)&&s.has.call(a,r)||Rr(i,l)&&s.has.call(a,i)||(a.add(l),La(a,"add",l,l)),this},set(r,a){!t&&!tr(a)&&!Ba(a)&&(a=Rt(a));const s=Rt(this),{has:i,get:l}=hu(s);let d=i.call(s,r);d||(r=Rt(r),d=i.call(s,r));const c=l.call(s,r);return s.set(r,a),d?Rr(a,c)&&La(s,"set",r,a):La(s,"add",r,a),this},delete(r){const a=Rt(this),{has:s,get:i}=hu(a);let l=s.call(a,r);l||(r=Rt(r),l=s.call(a,r)),i&&i.call(a,r);const d=a.delete(r);return l&&La(a,"delete",r,void 0),d},clear(){const r=Rt(this),a=r.size!==0,s=r.clear();return a&&La(r,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=zT(r,e,t)}),n}function Cf(e,t){const n=HT(e,t);return(o,r,a)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?o:Reflect.get(Mt(n,r)&&r in o?n:o,r,a)}const qT={get:Cf(!1,!1)},WT={get:Cf(!1,!0)},GT={get:Cf(!0,!1)};const kv=new WeakMap,Iv=new WeakMap,Av=new WeakMap,VT=new WeakMap;function KT(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function lc(e){return Ba(e)?e:xf(e,!1,FT,qT,kv)}function _v(e){return xf(e,!1,UT,WT,Iv)}function $d(e){return xf(e,!0,BT,GT,Av)}function xf(e,t,n,o,r){if(!jt(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const a=r.get(e);if(a)return a;const s=KT(wT(e));if(s===0)return e;const i=new Proxy(e,s===2?o:n);return r.set(e,i),i}function ui(e){return Ba(e)?ui(e.__v_raw):!!(e&&e.__v_isReactive)}function Ba(e){return!!(e&&e.__v_isReadonly)}function tr(e){return!!(e&&e.__v_isShallow)}function kf(e){return e?!!e.__v_raw:!1}function Rt(e){const t=e&&e.__v_raw;return t?Rt(t):e}function YT(e){return!Mt(e,"__v_skip")&&Object.isExtensible(e)&&uv(e,"__v_skip",!0),e}const Or=e=>jt(e)?lc(e):e,Vi=e=>jt(e)?$d(e):e;function kn(e){return e?e.__v_isRef===!0:!1}function S(e){return Pv(e,!1)}function JT(e){return Pv(e,!0)}function Pv(e,t){return kn(e)?e:new QT(e,t)}class QT{constructor(t,n){this.dep=new Sf,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Rt(t),this._value=n?t:Or(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,o=this.__v_isShallow||tr(t)||Ba(t);t=o?t:Rt(t),Rr(t,n)&&(this._rawValue=t,this._value=o?t:Or(t),this.dep.trigger())}}function m(e){return kn(e)?e.value:e}const XT={get:(e,t,n)=>t==="__v_raw"?e:m(Reflect.get(e,t,n)),set:(e,t,n,o)=>{const r=e[t];return kn(r)&&!kn(n)?(r.value=n,!0):Reflect.set(e,t,n,o)}};function Rv(e){return ui(e)?e:new Proxy(e,XT)}class ZT{constructor(t,n,o){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Sf(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Ol-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=o}notify(){if(this.flags|=16,!(this.flags&8)&&Bt!==this)return vv(this,!0),!0}get value(){const t=this.dep.track();return wv(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function eS(e,t,n=!1){let o,r;return ft(e)?o=e:(o=e.get,r=e.set),new ZT(o,r,n)}const vu={},Ou=new WeakMap;let ni;function tS(e,t=!1,n=ni){if(n){let o=Ou.get(n);o||Ou.set(n,o=[]),o.push(e)}}function nS(e,t,n=Dt){const{immediate:o,deep:r,once:a,scheduler:s,augmentJob:i,call:l}=n,d=H=>r?H:tr(H)||r===!1||r===0?Na(H,1):Na(H);let c,v,f,b,y=!1,P=!1;if(kn(e)?(v=()=>e.value,y=tr(e)):ui(e)?(v=()=>d(e),y=!0):nt(e)?(P=!0,y=e.some(H=>ui(H)||tr(H)),v=()=>e.map(H=>{if(kn(H))return H.value;if(ui(H))return d(H);if(ft(H))return l?l(H,2):H()})):ft(e)?t?v=l?()=>l(e,2):e:v=()=>{if(f){Da();try{f()}finally{Fa()}}const H=ni;ni=c;try{return l?l(e,3,[b]):e(b)}finally{ni=H}}:v=ca,t&&r){const H=v,be=r===!0?1/0:r;v=()=>Na(H(),be)}const B=ET(),L=()=>{c.stop(),B&&B.active&&vf(B.effects,c)};if(a&&t){const H=t;t=(...be)=>{const le=H(...be);return L(),le}}let j=P?new Array(e.length).fill(vu):vu;const U=H=>{if(!(!(c.flags&1)||!c.dirty&&!H))if(t){const be=c.run();if(H||r||y||(P?be.some((le,W)=>Rr(le,j[W])):Rr(be,j))){f&&f();const le=ni;ni=c;try{const W=[be,j===vu?void 0:P&&j[0]===vu?[]:j,b];j=be,l?l(t,3,W):t(...W)}finally{ni=le}}}else c.run()};return i&&i(U),c=new hv(v),c.scheduler=s?()=>s(U,!1):U,b=H=>tS(H,!1,c),f=c.onStop=()=>{const H=Ou.get(c);if(H){if(l)l(H,4);else for(const be of H)be();Ou.delete(c)}},t?o?U(!0):j=c.run():s?s(U.bind(null,!0),!0):c.run(),L.pause=c.pause.bind(c),L.resume=c.resume.bind(c),L.stop=L,L}function Na(e,t=1/0,n){if(t<=0||!jt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,kn(e))Na(e.value,t,n);else if(nt(e))for(let o=0;o<e.length;o++)Na(e[o],t,n);else if(oc(e)||Fi(e))e.forEach(o=>{Na(o,t,n)});else if(lv(e)){for(const o in e)Na(e[o],t,n);for(const o of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,o)&&Na(e[o],t,n)}return e}/**
|
|
11
11
|
* @vue/runtime-core v3.5.40
|
|
12
12
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
13
13
|
* @license MIT
|
|
14
|
-
**/function Vl(e,t,n,o){try{return o?e(...o):e()}catch(r){Kl(r,t,n)}}function or(e,t,n,o){if(ft(e)){const r=Vl(e,t,n,o);return r&&sv(r)&&r.catch(a=>{Kl(a,t,n)}),r}if(nt(e)){const r=[];for(let a=0;a<e.length;a++)r.push(or(e[a],t,n,o));return r}}function Kl(e,t,n,o=!0){const r=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Dt;if(t){let i=t.parent;const l=t.proxy,d=`https://vuejs.org/error-reference/#runtime-${n}`;for(;i;){const c=i.ec;if(c){for(let v=0;v<c.length;v++)if(c[v](e,l,d)===!1)return}i=i.parent}if(a){Da(),Vl(a,null,10,[e,l,d]),Fa();return}}oS(e,n,r,o,s)}function oS(e,t,n,o=!0,r=!1){if(r)throw e;console.error(e)}const co=[];let ia=-1;const Bi=[];let vs=null,ji=0;const Ev=Promise.resolve();let Du=null;function Nt(e){const t=Du||Ev;return e?t.then(this?e.bind(this):e):t}function rS(e){let t=ia+1,n=co.length;for(;t<n;){const o=t+n>>>1,r=co[o],a=Fl(r);a<e||a===e&&r.flags&2?t=o+1:n=o}return t}function If(e){if(!(e.flags&1)){const t=Fl(e),n=co[co.length-1];!n||!(e.flags&2)&&t>=Fl(n)?co.push(e):co.splice(rS(t),0,e),e.flags|=1,Mv()}}function Mv(){Du||(Du=Ev.then(Lv))}function aS(e){nt(e)?Bi.push(...e):vs&&e.id===-1?vs.splice(ji+1,0,e):e.flags&1||(Bi.push(e),e.flags|=1),Mv()}function Hp(e,t,n=ia+1){for(;n<co.length;n++){const o=co[n];if(o&&o.flags&2){if(e&&o.id!==e.uid)continue;co.splice(n,1),n--,o.flags&4&&(o.flags&=-2),o(),o.flags&4||(o.flags&=-2)}}}function jv(e){if(Bi.length){const t=[...new Set(Bi)].sort((n,o)=>Fl(n)-Fl(o));if(Bi.length=0,vs){vs.push(...t);return}for(vs=t,ji=0;ji<vs.length;ji++){const n=vs[ji];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}vs=null,ji=0}}const Fl=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Lv(e){try{for(ia=0;ia<co.length;ia++){const t=co[ia];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Vl(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;ia<co.length;ia++){const t=co[ia];t&&(t.flags&=-2)}ia=-1,co.length=0,jv(),Du=null,(co.length||Bi.length)&&Lv()}}let On=null,Nv=null;function Fu(e){const t=On;return On=e,Nv=e&&e.type.__scopeId||null,t}function dt(e,t=On,n){if(!t||e._n)return e;const o=(...r)=>{o._d&&zu(-1);const a=Fu(t),s=$a.length;let i;try{i=e(...r)}finally{for(let l=$a.length;l>s;l--)Mf();Fu(a),o._d&&zu(1)}return i};return o._n=!0,o._c=!0,o._d=!0,o}function xn(e,t){if(On===null)return e;const n=fc(On),o=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[a,s,i,l=Dt]=t[r];a&&(ft(a)&&(a={mounted:a,updated:a}),a.deep&&Na(s),o.push({dir:a,instance:n,value:s,oldValue:void 0,arg:i,modifiers:l}))}return e}function Qs(e,t,n,o){const r=e.dirs,a=t&&t.dirs;for(let s=0;s<r.length;s++){const i=r[s];a&&(i.oldValue=a[s].value);let l=i.dir[o];l&&(Da(),or(l,n,8,[e.el,i,e,t]),Fa())}}function Eu(e,t){if($n){let n=$n.provides;const o=$n.parent&&$n.parent.provides;o===n&&(n=$n.provides=Object.create(o)),n[e]=t}}function Lr(e,t,n=!1){const o=Lf();if(o||zi){let r=zi?zi._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&&ft(t)?t.call(o&&o.proxy):t}}const sS=Symbol.for("v-scx"),iS=()=>Lr(sS);function tt(e,t,n){return $v(e,t,n)}function $v(e,t,n=Dt){const{immediate:o,deep:r,flush:a,once:s}=n,i=pn({},n),l=t&&o||!t&&a!=="post";let d;if(Ji){if(a==="sync"){const b=iS();d=b.__watcherHandles||(b.__watcherHandles=[])}else if(!l){const b=()=>{};return b.stop=ca,b.resume=ca,b.pause=ca,b}}const c=$n;i.call=(b,y,P)=>or(b,c,y,P);let v=!1;a==="post"?i.scheduler=b=>{lo(b,c&&c.suspense)}:a!=="sync"&&(v=!0,i.scheduler=(b,y)=>{y?b():If(b)}),i.augmentJob=b=>{t&&(b.flags|=4),v&&(b.flags|=2,c&&(b.id=c.uid,b.i=c))};const f=nS(e,t,i);return Ji&&(d?d.push(f):l&&f()),f}function lS(e,t,n){const o=this.proxy,r=Vt(e)?e.includes(".")?Ov(o,e):()=>o[e]:e.bind(o,o);let a;ft(t)?a=t:(a=t.handler,n=t);const s=Ql(this),i=$v(r,a.bind(o),n);return s(),i}function Ov(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 ps=new WeakMap,Dv=Symbol("_vte"),Fv=e=>e.__isTeleport,ri=e=>e&&(e.disabled||e.disabled===""),uS=e=>e&&(e.defer||e.defer===""),qp=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Wp=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Od=(e,t)=>{const n=e&&e.to;return Vt(n)?t?t(n):null:n},cS={name:"Teleport",__isTeleport:!0,process(e,t,n,o,r,a,s,i,l,d){const{mc:c,pc:v,pbc:f,o:{insert:b,querySelector:y,createText:P,createComment:B,parentNode:L}}=d,j=ri(t.props);let{dynamicChildren:U}=t;const H=(W,he,Se)=>{W.shapeFlag&16&&c(W.children,he,Se,r,a,s,i,l)},be=(W=t)=>{const he=ri(W.props),Se=W.target=Od(W.props,y),Pe=Dd(Se,W,P,b);Se&&(s!=="svg"&&qp(Se)?s="svg":s!=="mathml"&&Wp(Se)&&(s="mathml"),r&&r.isCE&&(r.ce._teleportTargets||(r.ce._teleportTargets=new Set)).add(Se),he||(H(W,Se,Pe),kl(W,!1)))},le=W=>{const he=()=>{if(ps.get(W)===he){if(ps.delete(W),ri(W.props)){const Se=L(W.el)||n;H(W,Se,W.anchor),kl(W,!0)}be(W)}};ps.set(W,he),lo(he,a)};if(e==null){const W=t.el=P(""),he=t.anchor=P("");if(b(W,n,o),b(he,n,o),uS(t.props)||a&&a.pendingBranch){le(t);return}j&&(H(t,n,he),kl(t,!0)),be()}else{t.el=e.el;const W=t.anchor=e.anchor,he=ps.get(e);if(he){he.flags|=8,ps.delete(e),le(t);return}t.targetStart=e.targetStart;const Se=t.target=e.target,Pe=t.targetAnchor=e.targetAnchor,ge=ri(e.props),Y=ge?n:Se,pe=ge?W:Pe;if(s==="svg"||qp(Se)?s="svg":(s==="mathml"||Wp(Se))&&(s="mathml"),U?(f(e.dynamicChildren,U,Y,r,a,s,i),Ef(e,t,!0)):l||v(e,t,Y,pe,r,a,s,i,!1),j)ge?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):gu(t,n,W,d,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const ne=Od(t.props,y);ne&&(t.target=ne,gu(t,ne,null,d,0))}else ge&&gu(t,Se,Pe,d,1);kl(t,j)}},remove(e,t,n,{um:o,o:{remove:r}},a){const{shapeFlag:s,children:i,anchor:l,targetStart:d,targetAnchor:c,target:v,props:f}=e,b=ri(f),y=a||!b,P=ps.get(e);if(P&&(P.flags|=8,ps.delete(e)),v&&(r(d),r(c)),a&&r(l),!P&&(b||v)&&s&16)for(let B=0;B<i.length;B++){const L=i[B];o(L,t,n,y,!!L.dynamicChildren)}},move:gu,hydrate:dS};function gu(e,t,n,{o:{insert:o},m:r},a=2){a===0&&o(e.targetAnchor,t,n);const{el:s,anchor:i,shapeFlag:l,children:d,props:c}=e,v=a===2;if(v&&o(s,t,n),!ps.has(e)&&(!v||ri(c))&&l&16)for(let f=0;f<d.length;f++)r(d[f],t,n,2);v&&o(i,t,n)}function dS(e,t,n,o,r,a,{o:{nextSibling:s,parentNode:i,querySelector:l,insert:d,createText:c}},v){function f(B,L){let j=L;for(;j;){if(j&&j.nodeType===8){if(j.data==="teleport start anchor")t.targetStart=j;else if(j.data==="teleport anchor"){t.targetAnchor=j,B._lpa=t.targetAnchor&&s(t.targetAnchor);break}}j=s(j)}}function b(B,L){L.anchor=v(s(B),L,i(B),n,o,r,a)}const y=t.target=Od(t.props,l),P=ri(t.props);if(y){const B=y._lpa||y.firstChild;t.shapeFlag&16&&(P?(b(e,t),f(y,B),t.targetAnchor||Dd(y,t,c,d,i(e)===y?e:null)):(t.anchor=s(e),f(y,B),t.targetAnchor||Dd(y,t,c,d),v(B&&s(B),t,y,n,o,r,a))),kl(t,P)}else P&&t.shapeFlag&16&&(b(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}const Ki=cS;function kl(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 Dd(e,t,n,o,r=null){const a=t.targetStart=n(""),s=t.targetAnchor=n("");return a[Dv]=s,e&&(o(a,e,r),o(s,e,r)),s}const Zo=Symbol("_leaveCb"),Tl=Symbol("_enterCb");function fS(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return pi(()=>{e.isMounted=!0}),_s(()=>{e.isUnmounting=!0}),e}const Xo=[Function,Array],Bv={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Xo,onEnter:Xo,onAfterEnter:Xo,onEnterCancelled:Xo,onBeforeLeave:Xo,onLeave:Xo,onAfterLeave:Xo,onLeaveCancelled:Xo,onBeforeAppear:Xo,onAppear:Xo,onAfterAppear:Xo,onAppearCancelled:Xo},Uv=e=>{const t=e.subTree;return t.component?Uv(t.component):t},pS={name:"BaseTransition",props:Bv,setup(e,{slots:t}){const n=Lf(),o=fS();return()=>{const r=t.default&&qv(t.default(),!0),a=r&&r.length?zv(r):n.subTree?ve():void 0;if(!a)return;const s=Rt(e),{mode:i}=s;if(o.isLeaving)return sd(a);const l=Gp(a);if(!l)return sd(a);let d=Fd(l,s,o,n,v=>d=v);l.type!==Qn&&Bl(l,d);let c=n.subTree&&Gp(n.subTree);if(c&&c.type!==Qn&&!ai(c,l)&&Uv(n).type!==Qn){let v=Fd(c,s,o,n);if(Bl(c,v),i==="out-in"&&l.type!==Qn)return o.isLeaving=!0,v.afterLeave=()=>{o.isLeaving=!1,n.job.flags&8||n.update(),delete v.afterLeave,c=void 0},sd(a);i==="in-out"&&l.type!==Qn?v.delayLeave=(f,b,y)=>{const P=Hv(o,c);P[String(c.key)]=c,f[Zo]=()=>{b(),f[Zo]=void 0,delete d.delayedLeave,c=void 0},d.delayedLeave=()=>{y(),delete d.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return a}}};function zv(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Qn){t=n;break}}return t}const hS=pS;function Hv(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 Fd(e,t,n,o,r){const{appear:a,mode:s,persisted:i=!1,onBeforeEnter:l,onEnter:d,onAfterEnter:c,onEnterCancelled:v,onBeforeLeave:f,onLeave:b,onAfterLeave:y,onLeaveCancelled:P,onBeforeAppear:B,onAppear:L,onAfterAppear:j,onAppearCancelled:U}=t,H=String(e.key),be=Hv(n,e),le=(Se,Pe)=>{Se&&or(Se,o,9,Pe)},W=(Se,Pe)=>{const ge=Pe[1];le(Se,Pe),nt(Se)?Se.every(Y=>Y.length<=1)&&ge():Se.length<=1&&ge()},he={mode:s,persisted:i,beforeEnter(Se){let Pe=l;if(!n.isMounted)if(a)Pe=B||l;else return;Se[Zo]&&Se[Zo](!0);const ge=be[H];ge&&ai(e,ge)&&ge.el[Zo]&&ge.el[Zo](),le(Pe,[Se])},enter(Se){if(be[H]===e)return;let Pe=d,ge=c,Y=v;if(!n.isMounted)if(a)Pe=L||d,ge=j||c,Y=U||v;else return;let pe=!1;Se[Tl]=xe=>{pe||(pe=!0,xe?le(Y,[Se]):le(ge,[Se]),he.delayedLeave&&he.delayedLeave(),Se[Tl]=void 0)};const ne=Se[Tl].bind(null,!1);Pe?W(Pe,[Se,ne]):ne()},leave(Se,Pe){const ge=String(e.key);if(Se[Tl]&&Se[Tl](!0),n.isUnmounting)return Pe();le(f,[Se]);let Y=!1;Se[Zo]=ne=>{Y||(Y=!0,Pe(),ne?le(P,[Se]):le(y,[Se]),Se[Zo]=void 0,be[ge]===e&&delete be[ge])};const pe=Se[Zo].bind(null,!1);be[ge]=e,b?W(b,[Se,pe]):pe()},clone(Se){const Pe=Fd(Se,t,n,o,r);return r&&r(Pe),Pe}};return he}function sd(e){if(Yl(e))return e=ks(e),e.children=null,e}function Gp(e){if(!Yl(e))return Fv(e.type)&&e.children?zv(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&&ft(n.default))return n.default()}}function Bl(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Bl(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 qv(e,t=!1,n){let o=[],r=0;for(let a=0;a<e.length;a++){let s=e[a];const i=n==null?s.key:String(n)+String(s.key!=null?s.key:a);s.type===ot?(s.patchFlag&128&&r++,o=o.concat(qv(s.children,t,i))):(t||s.type!==Qn)&&o.push(i!=null?ks(s,{key:i}):s)}if(r>1)for(let a=0;a<o.length;a++)o[a].patchFlag=-2;return o}function hn(e,t){return ft(e)?pn({name:e.name},t,{setup:e}):e}function Af(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Vp(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Bu=new WeakMap;function Ml(e,t,n,o,r=!1){if(nt(e)){e.forEach((P,B)=>Ml(P,t&&(nt(t)?t[B]:t),n,o,r));return}if(Ui(o)&&!r){o.shapeFlag&512&&o.type.__asyncResolved&&o.component.subTree.component&&Ml(e,t,n,o.component.subTree);return}const a=o.shapeFlag&4?fc(o.component):o.el,s=r?null:a,{i,r:l}=e,d=t&&t.r,c=i.refs===Dt?i.refs={}:i.refs,v=i.setupState,f=Rt(v),b=v===Dt?av:P=>Vp(c,P)?!1:Mt(f,P),y=(P,B)=>!(B&&Vp(c,B));if(d!=null&&d!==l){if(Kp(t),Vt(d))c[d]=null,b(d)&&(v[d]=null);else if(kn(d)){const P=t;y(d,P.k)&&(d.value=null),P.k&&(c[P.k]=null)}}if(ft(l))Vl(l,i,12,[s,c]);else{const P=Vt(l),B=kn(l);if(P||B){const L=()=>{if(e.f){const j=P?b(l)?v[l]:c[l]:y()||!e.k?l.value:c[e.k];if(r)nt(j)&&vf(j,a);else if(nt(j))j.includes(a)||j.push(a);else if(P)c[l]=[a],b(l)&&(v[l]=c[l]);else{const U=[a];y(l,e.k)&&(l.value=U),e.k&&(c[e.k]=U)}}else P?(c[l]=s,b(l)&&(v[l]=s)):B&&(y(l,e.k)&&(l.value=s),e.k&&(c[e.k]=s))};if(s){const j=()=>{L(),Bu.delete(e)};j.id=-1,Bu.set(e,j),lo(j,n)}else Kp(e),L()}}}function Kp(e){const t=Bu.get(e);t&&(t.flags|=8,Bu.delete(e))}const Yp=e=>e.nodeType===8;sc().requestIdleCallback;sc().cancelIdleCallback;function mS(e,t){if(Yp(e)&&e.data==="["){let n=1,o=e.nextSibling;for(;o;){if(o.nodeType===1){if(t(o)===!1)break}else if(Yp(o))if(o.data==="]"){if(--n===0)break}else o.data==="["&&n++;o=o.nextSibling}}else t(e)}const Ui=e=>!!e.type.__asyncLoader;function Ar(e){ft(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:o,delay:r=200,hydrate:a,timeout:s,suspensible:i=!0,onError:l}=e;let d=null,c,v=0;const f=()=>(v++,d=null,b()),b=()=>{let y;return d||(y=d=t().catch(P=>{if(P=P instanceof Error?P:new Error(String(P)),l)return new Promise((B,L)=>{l(P,()=>B(f()),()=>L(P),v+1)});throw P}).then(P=>y!==d&&d?d:(P&&(P.__esModule||P[Symbol.toStringTag]==="Module")&&(P=P.default),c=P,P)))};return hn({name:"AsyncComponentWrapper",__asyncLoader:b,__asyncHydrate(y,P,B){const L=y.isConnected;let j=!1;(P.bu||(P.bu=[])).push(()=>j=!0);const U=()=>{j||!y.parentNode||L&&!y.isConnected||B()},H=a?()=>{const be=a(U,le=>mS(y,le));be&&(P.bum||(P.bum=[])).push(be)}:U;c?H():b().then(()=>!P.isUnmounted&&H())},get __asyncResolved(){return c},setup(){const y=$n;if(Af(y),c)return()=>yu(c,y);const P=be=>{d=null,Kl(be,y,13,!o)};if(i&&y.suspense||Ji)return b().then(be=>()=>yu(be,y)).catch(be=>(P(be),()=>o?Oe(o,{error:be}):null));const B=S(!1),L=S(),j=S(!!r);let U,H;return Jl(()=>{U!=null&&clearTimeout(U),H!=null&&clearTimeout(H)}),r&&(H=setTimeout(()=>{y.isUnmounted||(j.value=!1)},r)),s!=null&&(U=setTimeout(()=>{if(!y.isUnmounted&&!B.value&&!L.value){const be=new Error(`Async component timed out after ${s}ms.`);P(be),L.value=be}},s)),b().then(()=>{y.isUnmounted||(B.value=!0,y.parent&&Yl(y.parent.vnode)&&y.parent.update())}).catch(be=>{if(y.isUnmounted){d=null;return}P(be),L.value=be}),()=>{if(B.value&&c)return yu(c,y);if(L.value&&o)return Oe(o,{error:L.value});if(n&&!j.value)return yu(n,y)}}})}function yu(e,t){const{ref:n,props:o,children:r,ce:a}=t.vnode,s=Oe(e,o,r);return s.ref=n,s.ce=a,delete t.vnode.ce,s}const Yl=e=>e.type.__isKeepAlive;function vS(e,t){Wv(e,"a",t)}function gS(e,t){Wv(e,"da",t)}function Wv(e,t,n=$n){const o=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(uc(t,o,n),n){let r=n.parent;for(;r&&r.parent;)Yl(r.parent.vnode)&&yS(o,t,n,r),r=r.parent}}function yS(e,t,n,o){const r=uc(t,e,o,!0);Jl(()=>{vf(o[t],r)},n)}function uc(e,t,n=$n,o=!1){if(n){const r=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=(...s)=>{Da();const i=Ql(n),l=or(t,n,e,s);return i(),Fa(),l});return o?r.unshift(a):r.push(a),a}}const za=e=>(t,n=$n)=>{(!Ji||e==="sp")&&uc(e,(...o)=>t(...o),n)},wS=za("bm"),pi=za("m"),bS=za("bu"),TS=za("u"),_s=za("bum"),Jl=za("um"),SS=za("sp"),CS=za("rtg"),xS=za("rtc");function kS(e,t=$n){uc("ec",e,t)}const IS="components",Gv=Symbol.for("v-ndc");function _f(e){return Vt(e)?AS(IS,e,!1)||e:e||Gv}function AS(e,t,n=!0,o=!1){const r=On||$n;if(r){const a=r.type;{const i=cC(a,!1);if(i&&(i===t||i===po(t)||i===ac(po(t))))return a}const s=Jp(r[e]||a[e],t)||Jp(r.appContext[e],t);return!s&&o?a:s}}function Jp(e,t){return e&&(e[t]||e[po(t)]||e[ac(po(t))])}function Zt(e,t,n,o){let r;const a=n,s=nt(e);if(s||Vt(e)){const i=s&&ui(e);let l=!1,d=!1;i&&(l=!tr(e),d=Ba(e),e=ic(e)),r=new Array(e.length);for(let c=0,v=e.length;c<v;c++)r[c]=t(l?d?Vi(Or(e[c])):Or(e[c]):e[c],c,void 0,a)}else if(typeof e=="number"){r=new Array(e);for(let i=0;i<e;i++)r[i]=t(i+1,i,void 0,a)}else if(jt(e))if(e[Symbol.iterator])r=Array.from(e,(i,l)=>t(i,l,void 0,a));else{const i=Object.keys(e);r=new Array(i.length);for(let l=0,d=i.length;l<d;l++){const c=i[l];r[l]=t(e[c],c,l,a)}}else r=[];return r}function _o(e,t,n={},o,r,a){if(On.ce||On.parent&&Ui(On.parent)&&On.parent.ce){const d=a!=null&&n.key==null?pn({},n,{key:a}):n,c=Object.keys(d).length>0;return t!=="default"&&(d.name=t),_(),Qe(ot,null,[Oe("slot",d,o)],c?-2:64)}let s=e[t];s&&s._c&&(s._d=!1);const i=$a.length;_();let l;try{const d=s&&Vv(s(n)),c=n.key||a||d&&d.key;l=Qe(ot,{key:(c&&!$r(c)?c:`_${t}`)+(!d&&o?"_fb":"")},d||(o?o():[]),d&&e._===1?64:-2)}catch(d){for(let c=$a.length;c>i;c--)Mf();throw d}finally{s&&s._c&&(s._d=!0)}return l}function Vv(e){return e.some(t=>Ul(t)?!(t.type===Qn||t.type===ot&&!Vv(t.children)):!0)?e:null}const Bd=e=>e?fg(e)?fc(e):Bd(e.parent):null,jl=pn(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=>Bd(e.parent),$root:e=>Bd(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Yv(e),$forceUpdate:e=>e.f||(e.f=()=>{If(e.update)}),$nextTick:e=>e.n||(e.n=Nt.bind(e.proxy)),$watch:e=>lS.bind(e)}),id=(e,t)=>e!==Dt&&!e.__isScriptSetup&&Mt(e,t),_S={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:o,data:r,props:a,accessCache:s,type:i,appContext:l}=e;if(t[0]!=="$"){const f=s[t];if(f!==void 0)switch(f){case 1:return o[t];case 2:return r[t];case 4:return n[t];case 3:return a[t]}else{if(id(o,t))return s[t]=1,o[t];if(r!==Dt&&Mt(r,t))return s[t]=2,r[t];if(Mt(a,t))return s[t]=3,a[t];if(n!==Dt&&Mt(n,t))return s[t]=4,n[t];Ud&&(s[t]=0)}}const d=jl[t];let c,v;if(d)return t==="$attrs"&&Jn(e.attrs,"get",""),d(e);if((c=i.__cssModules)&&(c=c[t]))return c;if(n!==Dt&&Mt(n,t))return s[t]=4,n[t];if(v=l.config.globalProperties,Mt(v,t))return v[t]},set({_:e},t,n){const{data:o,setupState:r,ctx:a}=e;return id(r,t)?(r[t]=n,!0):o!==Dt&&Mt(o,t)?(o[t]=n,!0):Mt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:o,appContext:r,props:a,type:s}},i){let l;return!!(n[i]||e!==Dt&&i[0]!=="$"&&Mt(e,i)||id(t,i)||Mt(a,i)||Mt(o,i)||Mt(jl,i)||Mt(r.config.globalProperties,i)||(l=s.__cssModules)&&l[i])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Mt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function PS(){return RS().slots}function RS(e){const t=Lf();return t.setupContext||(t.setupContext=hg(t))}function Qp(e){return nt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Ud=!0;function ES(e){const t=Yv(e),n=e.proxy,o=e.ctx;Ud=!1,t.beforeCreate&&Xp(t.beforeCreate,e,"bc");const{data:r,computed:a,methods:s,watch:i,provide:l,inject:d,created:c,beforeMount:v,mounted:f,beforeUpdate:b,updated:y,activated:P,deactivated:B,beforeDestroy:L,beforeUnmount:j,destroyed:U,unmounted:H,render:be,renderTracked:le,renderTriggered:W,errorCaptured:he,serverPrefetch:Se,expose:Pe,inheritAttrs:ge,components:Y,directives:pe,filters:ne}=t;if(d&&MS(d,o,null),s)for(const te in s){const de=s[te];ft(de)&&(o[te]=de.bind(n))}if(r){const te=r.call(n,n);jt(te)&&(e.data=lc(te))}if(Ud=!0,a)for(const te in a){const de=a[te],Le=ft(de)?de.bind(n,n):ft(de.get)?de.get.bind(n,n):ca,Ae=!ft(de)&&ft(de.set)?de.set.bind(n):ca,Fe=K({get:Le,set:Ae});Object.defineProperty(o,te,{enumerable:!0,configurable:!0,get:()=>Fe.value,set:Ke=>Fe.value=Ke})}if(i)for(const te in i)Kv(i[te],o,n,te);if(l){const te=ft(l)?l.call(n):l;Reflect.ownKeys(te).forEach(de=>{Eu(de,te[de])})}c&&Xp(c,e,"c");function $e(te,de){nt(de)?de.forEach(Le=>te(Le.bind(n))):de&&te(de.bind(n))}if($e(wS,v),$e(pi,f),$e(bS,b),$e(TS,y),$e(vS,P),$e(gS,B),$e(kS,he),$e(xS,le),$e(CS,W),$e(_s,j),$e(Jl,H),$e(SS,Se),nt(Pe))if(Pe.length){const te=e.exposed||(e.exposed={});Pe.forEach(de=>{Object.defineProperty(te,de,{get:()=>n[de],set:Le=>n[de]=Le,enumerable:!0})})}else e.exposed||(e.exposed={});be&&e.render===ca&&(e.render=be),ge!=null&&(e.inheritAttrs=ge),Y&&(e.components=Y),pe&&(e.directives=pe),Se&&Af(e)}function MS(e,t,n=ca){nt(e)&&(e=zd(e));for(const o in e){const r=e[o];let a;jt(r)?"default"in r?a=Lr(r.from||o,r.default,!0):a=Lr(r.from||o):a=Lr(r),kn(a)?Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get:()=>a.value,set:s=>a.value=s}):t[o]=a}}function Xp(e,t,n){or(nt(e)?e.map(o=>o.bind(t.proxy)):e.bind(t.proxy),t,n)}function Kv(e,t,n,o){let r=o.includes(".")?Ov(n,o):()=>n[o];if(Vt(e)){const a=t[e];ft(a)&&tt(r,a)}else if(ft(e))tt(r,e.bind(n));else if(jt(e))if(nt(e))e.forEach(a=>Kv(a,t,n,o));else{const a=ft(e.handler)?e.handler.bind(n):t[e.handler];ft(a)&&tt(r,a,e)}}function Yv(e){const t=e.type,{mixins:n,extends:o}=t,{mixins:r,optionsCache:a,config:{optionMergeStrategies:s}}=e.appContext,i=a.get(t);let l;return i?l=i:!r.length&&!n&&!o?l=t:(l={},r.length&&r.forEach(d=>Uu(l,d,s,!0)),Uu(l,t,s)),jt(t)&&a.set(t,l),l}function Uu(e,t,n,o=!1){const{mixins:r,extends:a}=t;a&&Uu(e,a,n,!0),r&&r.forEach(s=>Uu(e,s,n,!0));for(const s in t)if(!(o&&s==="expose")){const i=jS[s]||n&&n[s];e[s]=i?i(e[s],t[s]):t[s]}return e}const jS={data:Zp,props:eh,emits:eh,methods:Il,computed:Il,beforeCreate:io,created:io,beforeMount:io,mounted:io,beforeUpdate:io,updated:io,beforeDestroy:io,beforeUnmount:io,destroyed:io,unmounted:io,activated:io,deactivated:io,errorCaptured:io,serverPrefetch:io,components:Il,directives:Il,watch:NS,provide:Zp,inject:LS};function Zp(e,t){return t?e?function(){return pn(ft(e)?e.call(this,this):e,ft(t)?t.call(this,this):t)}:t:e}function LS(e,t){return Il(zd(e),zd(t))}function zd(e){if(nt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function io(e,t){return e?[...new Set([].concat(e,t))]:t}function Il(e,t){return e?pn(Object.create(null),e,t):t}function eh(e,t){return e?nt(e)&&nt(t)?[...new Set([...e,...t])]:pn(Object.create(null),Qp(e),Qp(t??{})):t}function NS(e,t){if(!e)return t;if(!t)return e;const n=pn(Object.create(null),e);for(const o in t)n[o]=io(e[o],t[o]);return n}function Jv(){return{app:null,config:{isNativeTag:av,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 $S=0;function OS(e,t){return function(o,r=null){ft(o)||(o=pn({},o)),r!=null&&!jt(r)&&(r=null);const a=Jv(),s=new WeakSet,i=[];let l=!1;const d=a.app={_uid:$S++,_component:o,_props:r,_container:null,_context:a,_instance:null,version:pC,get config(){return a.config},set config(c){},use(c,...v){return s.has(c)||(c&&ft(c.install)?(s.add(c),c.install(d,...v)):ft(c)&&(s.add(c),c(d,...v))),d},mixin(c){return a.mixins.includes(c)||a.mixins.push(c),d},component(c,v){return v?(a.components[c]=v,d):a.components[c]},directive(c,v){return v?(a.directives[c]=v,d):a.directives[c]},mount(c,v,f){if(!l){const b=d._ceVNode||Oe(o,r);return b.appContext=a,f===!0?f="svg":f===!1&&(f=void 0),e(b,c,f),l=!0,d._container=c,c.__vue_app__=d,fc(b.component)}},onUnmount(c){i.push(c)},unmount(){l&&(or(i,d._instance,16),e(null,d._container),delete d._container.__vue_app__)},provide(c,v){return a.provides[c]=v,d},runWithContext(c){const v=zi;zi=d;try{return c()}finally{zi=v}}};return d}}let zi=null;const DS=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${po(t)}Modifiers`]||e[`${As(t)}Modifiers`];function FS(e,t,...n){if(e.isUnmounted)return;const o=e.vnode.props||Dt;let r=n;const a=t.startsWith("update:"),s=a&&DS(o,t.slice(7));s&&(s.trim&&(r=n.map(c=>Vt(c)?c.trim():c)),s.number&&(r=n.map(yf)));let i,l=o[i=td(t)]||o[i=td(po(t))];!l&&a&&(l=o[i=td(As(t))]),l&&or(l,e,6,r);const d=o[i+"Once"];if(d){if(!e.emitted)e.emitted={};else if(e.emitted[i])return;e.emitted[i]=!0,or(d,e,6,r)}}const BS=new WeakMap;function Qv(e,t,n=!1){const o=n?BS:t.emitsCache,r=o.get(e);if(r!==void 0)return r;const a=e.emits;let s={},i=!1;if(!ft(e)){const l=d=>{const c=Qv(d,t,!0);c&&(i=!0,pn(s,c))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!a&&!i?(jt(e)&&o.set(e,null),null):(nt(a)?a.forEach(l=>s[l]=null):pn(s,a),jt(e)&&o.set(e,s),s)}function cc(e,t){return!e||!tc(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),Mt(e,t[0].toLowerCase()+t.slice(1))||Mt(e,As(t))||Mt(e,t))}function th(e){const{type:t,vnode:n,proxy:o,withProxy:r,propsOptions:[a],slots:s,attrs:i,emit:l,render:d,renderCache:c,props:v,data:f,setupState:b,ctx:y,inheritAttrs:P}=e,B=Fu(e);let L,j;try{if(n.shapeFlag&4){const H=r||o,be=H;L=ua(d.call(be,H,c,v,b,f,y)),j=i}else{const H=t;L=ua(H.length>1?H(v,{attrs:i,slots:s,emit:l}):H(v,null)),j=t.props?i:US(i)}}catch(H){$a.length=0,Kl(H,e,1),L=Oe(Qn)}let U=L;if(j&&P!==!1){const H=Object.keys(j),{shapeFlag:be}=U;H.length&&be&7&&(a&&H.some(nc)&&(j=zS(j,a)),U=ks(U,j,!1,!0))}return n.dirs&&(U=ks(U,null,!1,!0),U.dirs=U.dirs?U.dirs.concat(n.dirs):n.dirs),n.transition&&Bl(U,n.transition),L=U,Fu(B),L}const US=e=>{let t;for(const n in e)(n==="class"||n==="style"||tc(n))&&((t||(t={}))[n]=e[n]);return t},zS=(e,t)=>{const n={};for(const o in e)(!nc(o)||!(o.slice(9)in t))&&(n[o]=e[o]);return n};function HS(e,t,n){const{props:o,children:r,component:a}=e,{props:s,children:i,patchFlag:l}=t,d=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return o?nh(o,s,d):!!s;if(l&8){const c=t.dynamicProps;for(let v=0;v<c.length;v++){const f=c[v];if(Xv(s,o,f)&&!cc(d,f))return!0}}}else return(r||i)&&(!i||!i.$stable)?!0:o===s?!1:o?s?nh(o,s,d):!0:!!s;return!1}function nh(e,t,n){const o=Object.keys(t);if(o.length!==Object.keys(e).length)return!0;for(let r=0;r<o.length;r++){const a=o[r];if(Xv(t,e,a)&&!cc(n,a))return!0}return!1}function Xv(e,t,n){const o=e[n],r=t[n];return n==="style"&&jt(o)&&jt(r)?!Gl(o,r):o!==r}function qS({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 Zv={},eg=()=>Object.create(Zv),tg=e=>Object.getPrototypeOf(e)===Zv;function WS(e,t,n,o=!1){const r={},a=eg();e.propsDefaults=Object.create(null),ng(e,t,r,a);for(const s in e.propsOptions[0])s in r||(r[s]=void 0);n?e.props=o?r:_v(r):e.type.props?e.props=r:e.props=a,e.attrs=a}function GS(e,t,n,o){const{props:r,attrs:a,vnode:{patchFlag:s}}=e,i=Rt(r),[l]=e.propsOptions;let d=!1;if((o||s>0)&&!(s&16)){if(s&8){const c=e.vnode.dynamicProps;for(let v=0;v<c.length;v++){let f=c[v];if(cc(e.emitsOptions,f))continue;const b=t[f];if(l)if(Mt(a,f))b!==a[f]&&(a[f]=b,d=!0);else{const y=po(f);r[y]=Hd(l,i,y,b,e,!1)}else b!==a[f]&&(a[f]=b,d=!0)}}}else{ng(e,t,r,a)&&(d=!0);let c;for(const v in i)(!t||!Mt(t,v)&&((c=As(v))===v||!Mt(t,c)))&&(l?n&&(n[v]!==void 0||n[c]!==void 0)&&(r[v]=Hd(l,i,v,void 0,e,!0)):delete r[v]);if(a!==i)for(const v in a)(!t||!Mt(t,v))&&(delete a[v],d=!0)}d&&La(e.attrs,"set","")}function ng(e,t,n,o){const[r,a]=e.propsOptions;let s=!1,i;if(t)for(let l in t){if(Pl(l))continue;const d=t[l];let c;r&&Mt(r,c=po(l))?!a||!a.includes(c)?n[c]=d:(i||(i={}))[c]=d:cc(e.emitsOptions,l)||(!(l in o)||d!==o[l])&&(o[l]=d,s=!0)}if(a){const l=Rt(n),d=i||Dt;for(let c=0;c<a.length;c++){const v=a[c];n[v]=Hd(r,l,v,d[v],e,!Mt(d,v))}}return s}function Hd(e,t,n,o,r,a){const s=e[n];if(s!=null){const i=Mt(s,"default");if(i&&o===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&ft(l)){const{propsDefaults:d}=r;if(n in d)o=d[n];else{const c=Ql(r);o=d[n]=l.call(null,t),c()}}else o=l;r.ce&&r.ce._setProp(n,o)}s[0]&&(a&&!i?o=!1:s[1]&&(o===""||o===As(n))&&(o=!0))}return o}const VS=new WeakMap;function og(e,t,n=!1){const o=n?VS:t.propsCache,r=o.get(e);if(r)return r;const a=e.props,s={},i=[];let l=!1;if(!ft(e)){const c=v=>{l=!0;const[f,b]=og(v,t,!0);pn(s,f),b&&i.push(...b)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!a&&!l)return jt(e)&&o.set(e,Di),Di;if(nt(a))for(let c=0;c<a.length;c++){const v=po(a[c]);oh(v)&&(s[v]=Dt)}else if(a)for(const c in a){const v=po(c);if(oh(v)){const f=a[c],b=s[v]=nt(f)||ft(f)?{type:f}:pn({},f),y=b.type;let P=!1,B=!0;if(nt(y))for(let L=0;L<y.length;++L){const j=y[L],U=ft(j)&&j.name;if(U==="Boolean"){P=!0;break}else U==="String"&&(B=!1)}else P=ft(y)&&y.name==="Boolean";b[0]=P,b[1]=B,(P||Mt(b,"default"))&&i.push(v)}}const d=[s,i];return jt(e)&&o.set(e,d),d}function oh(e){return e[0]!=="$"&&!Pl(e)}const Pf=e=>e==="_"||e==="_ctx"||e==="$stable",Rf=e=>nt(e)?e.map(ua):[ua(e)],KS=(e,t,n)=>{if(t._n)return t;const o=dt((...r)=>Rf(t(...r)),n);return o._c=!1,o},rg=(e,t,n)=>{const o=e._ctx;for(const r in e){if(Pf(r))continue;const a=e[r];if(ft(a))t[r]=KS(r,a,o);else if(a!=null){const s=Rf(a);t[r]=()=>s}}},ag=(e,t)=>{const n=Rf(t);e.slots.default=()=>n},sg=(e,t,n)=>{for(const o in t)(n||!Pf(o))&&(e[o]=t[o])},YS=(e,t,n)=>{const o=e.slots=eg();if(e.vnode.shapeFlag&32){const r=t._;r?(sg(o,t,n),n&&uv(o,"_",r,!0)):rg(t,o)}else t&&ag(e,t)},JS=(e,t,n)=>{const{vnode:o,slots:r}=e;let a=!0,s=Dt;if(o.shapeFlag&32){const i=t._;i?n&&i===1?a=!1:sg(r,t,n):(a=!t.$stable,rg(t,r)),s=t}else t&&(ag(e,t),s={default:1});if(a)for(const i in r)!Pf(i)&&s[i]==null&&delete r[i]},lo=tC;function QS(e){return XS(e)}function XS(e,t){const n=sc();n.__VUE__=!0;const{insert:o,remove:r,patchProp:a,createElement:s,createText:i,createComment:l,setText:d,setElementText:c,parentNode:v,nextSibling:f,setScopeId:b=ca,insertStaticContent:y}=e,P=(A,M,z,Z=null,ce=null,re=null,je=void 0,Re=null,ke=!!M.dynamicChildren)=>{if(A===M)return;A&&!ai(A,M)&&(Z=N(A),Ke(A,ce,re,!0),A=null),M.patchFlag===-2&&(ke=!1,M.dynamicChildren=null);const{type:me,ref:Ve,shapeFlag:Ne}=M;switch(me){case dc:B(A,M,z,Z);break;case Qn:L(A,M,z,Z);break;case Mu:A==null&&j(M,z,Z,je);break;case ot:Y(A,M,z,Z,ce,re,je,Re,ke);break;default:Ne&1?be(A,M,z,Z,ce,re,je,Re,ke):Ne&6?pe(A,M,z,Z,ce,re,je,Re,ke):(Ne&64||Ne&128)&&me.process(A,M,z,Z,ce,re,je,Re,ke,Ee)}Ve!=null&&ce?Ml(Ve,A&&A.ref,re,M||A,!M):Ve==null&&A&&A.ref!=null&&Ml(A.ref,null,re,A,!0)},B=(A,M,z,Z)=>{if(A==null)o(M.el=i(M.children),z,Z);else{const ce=M.el=A.el;M.children!==A.children&&d(ce,M.children)}},L=(A,M,z,Z)=>{A==null?o(M.el=l(M.children||""),z,Z):M.el=A.el},j=(A,M,z,Z)=>{[A.el,A.anchor]=y(A.children,M,z,Z,A.el,A.anchor)},U=({el:A,anchor:M},z,Z)=>{let ce;for(;A&&A!==M;)ce=f(A),o(A,z,Z),A=ce;o(M,z,Z)},H=({el:A,anchor:M})=>{let z;for(;A&&A!==M;)z=f(A),r(A),A=z;r(M)},be=(A,M,z,Z,ce,re,je,Re,ke)=>{if(M.type==="svg"?je="svg":M.type==="math"&&(je="mathml"),A==null)le(M,z,Z,ce,re,je,Re,ke);else{const me=A.el&&A.el._isVueCE?A.el:null;try{me&&me._beginPatch(),Se(A,M,ce,re,je,Re,ke)}finally{me&&me._endPatch()}}},le=(A,M,z,Z,ce,re,je,Re)=>{let ke,me;const{props:Ve,shapeFlag:Ne,transition:He,dirs:Ue}=A;if(ke=A.el=s(A.type,re,Ve&&Ve.is,Ve),Ne&8?c(ke,A.children):Ne&16&&he(A.children,ke,null,Z,ce,ld(A,re),je,Re),Ue&&Qs(A,null,Z,"created"),W(ke,A,A.scopeId,je,Z),Ve){for(const et in Ve)et!=="value"&&!Pl(et)&&a(ke,et,null,Ve[et],re,Z);"value"in Ve&&a(ke,"value",null,Ve.value,re),(me=Ve.onVnodeBeforeMount)&&sa(me,Z,A)}Ue&&Qs(A,null,Z,"beforeMount");const Je=ZS(ce,He);Je&&He.beforeEnter(ke),o(ke,M,z),((me=Ve&&Ve.onVnodeMounted)||Je||Ue)&&lo(()=>{try{me&&sa(me,Z,A),Je&&He.enter(ke),Ue&&Qs(A,null,Z,"mounted")}finally{}},ce)},W=(A,M,z,Z,ce)=>{if(z&&b(A,z),Z)for(let re=0;re<Z.length;re++)b(A,Z[re]);if(ce){let re=ce.subTree;if(M===re||ug(re.type)&&(re.ssContent===M||re.ssFallback===M)){const je=ce.vnode;W(A,je,je.scopeId,je.slotScopeIds,ce.parent)}}},he=(A,M,z,Z,ce,re,je,Re,ke=0)=>{for(let me=ke;me<A.length;me++){const Ve=A[me]=Re?ja(A[me]):ua(A[me]);P(null,Ve,M,z,Z,ce,re,je,Re)}},Se=(A,M,z,Z,ce,re,je)=>{const Re=M.el=A.el;let{patchFlag:ke,dynamicChildren:me,dirs:Ve}=M;ke|=A.patchFlag&16;const Ne=A.props||Dt,He=M.props||Dt;let Ue;if(z&&Xs(z,!1),(Ue=He.onVnodeBeforeUpdate)&&sa(Ue,z,M,A),Ve&&Qs(M,A,z,"beforeUpdate"),z&&Xs(z,!0),me&&(!A.dynamicChildren||A.dynamicChildren.length!==me.length)&&(ke=0,je=!1,me=null),(Ne.innerHTML&&He.innerHTML==null||Ne.textContent&&He.textContent==null)&&c(Re,""),me?Pe(A.dynamicChildren,me,Re,z,Z,ld(M,ce),re):je||de(A,M,Re,null,z,Z,ld(M,ce),re,!1),ke>0){if(ke&16)ge(Re,Ne,He,z,ce);else if(ke&2&&Ne.class!==He.class&&a(Re,"class",null,He.class,ce),ke&4&&a(Re,"style",Ne.style,He.style,ce),ke&8){const Je=M.dynamicProps;for(let et=0;et<Je.length;et++){const st=Je[et],mt=Ne[st],q=He[st];(q!==mt||st==="value")&&a(Re,st,mt,q,ce,z)}}ke&1&&A.children!==M.children&&c(Re,M.children)}else!je&&me==null&&ge(Re,Ne,He,z,ce);((Ue=He.onVnodeUpdated)||Ve)&&lo(()=>{Ue&&sa(Ue,z,M,A),Ve&&Qs(M,A,z,"updated")},Z)},Pe=(A,M,z,Z,ce,re,je)=>{for(let Re=0;Re<M.length;Re++){const ke=A[Re],me=M[Re],Ve=ke.el&&(ke.type===ot||!ai(ke,me)||ke.shapeFlag&198)?v(ke.el):z;P(ke,me,Ve,null,Z,ce,re,je,!0)}},ge=(A,M,z,Z,ce)=>{if(M!==z){if(M!==Dt)for(const re in M)!Pl(re)&&!(re in z)&&a(A,re,M[re],null,ce,Z);for(const re in z){if(Pl(re))continue;const je=z[re],Re=M[re];je!==Re&&re!=="value"&&a(A,re,Re,je,ce,Z)}"value"in z&&a(A,"value",M.value,z.value,ce)}},Y=(A,M,z,Z,ce,re,je,Re,ke)=>{const me=M.el=A?A.el:i(""),Ve=M.anchor=A?A.anchor:i("");let{patchFlag:Ne,dynamicChildren:He,slotScopeIds:Ue}=M;Ue&&(Re=Re?Re.concat(Ue):Ue),A==null?(o(me,z,Z),o(Ve,z,Z),he(M.children||[],z,Ve,ce,re,je,Re,ke)):Ne>0&&Ne&64&&He&&A.dynamicChildren&&A.dynamicChildren.length===He.length?(Pe(A.dynamicChildren,He,z,ce,re,je,Re),(M.key!=null||ce&&M===ce.subTree)&&Ef(A,M,!0)):de(A,M,z,Ve,ce,re,je,Re,ke)},pe=(A,M,z,Z,ce,re,je,Re,ke)=>{M.slotScopeIds=Re,A==null?M.shapeFlag&512?ce.ctx.activate(M,z,Z,je,ke):ne(M,z,Z,ce,re,je,ke):xe(A,M,ke)},ne=(A,M,z,Z,ce,re,je)=>{const Re=A.component=sC(A,Z,ce);if(Yl(A)&&(Re.ctx.renderer=Ee),iC(Re,!1,je),Re.asyncDep){if(ce&&ce.registerDep(Re,$e,je),!A.el){const ke=Re.subTree=Oe(Qn);L(null,ke,M,z),A.placeholder=ke.el}}else $e(Re,A,M,z,ce,re,je)},xe=(A,M,z)=>{const Z=M.component=A.component;if(HS(A,M,z))if(Z.asyncDep&&!Z.asyncResolved){te(Z,M,z);return}else Z.next=M,Z.update();else M.el=A.el,Z.vnode=M},$e=(A,M,z,Z,ce,re,je)=>{const Re=()=>{if(A.isMounted){let{next:Ne,bu:He,u:Ue,parent:Je,vnode:et}=A;{const _e=ig(A);if(_e){Ne&&(Ne.el=et.el,te(A,Ne,je)),_e.asyncDep.then(()=>{lo(()=>{A.isUnmounted||me()},ce)});return}}let st=Ne,mt;Xs(A,!1),Ne?(Ne.el=et.el,te(A,Ne,je)):Ne=et,He&&Ru(He),(mt=Ne.props&&Ne.props.onVnodeBeforeUpdate)&&sa(mt,Je,Ne,et),Xs(A,!0);const q=th(A),ae=A.subTree;A.subTree=q,P(ae,q,v(ae.el),N(ae),A,ce,re),Ne.el=q.el,st===null&&qS(A,q.el),Ue&&lo(Ue,ce),(mt=Ne.props&&Ne.props.onVnodeUpdated)&&lo(()=>sa(mt,Je,Ne,et),ce)}else{let Ne;const{el:He,props:Ue}=M,{bm:Je,m:et,parent:st,root:mt,type:q}=A,ae=Ui(M);Xs(A,!1),Je&&Ru(Je),!ae&&(Ne=Ue&&Ue.onVnodeBeforeMount)&&sa(Ne,st,M),Xs(A,!0);{mt.ce&&mt.ce._hasShadowRoot()&&mt.ce._injectChildStyle(q,A.parent?A.parent.type:void 0);const _e=A.subTree=th(A);P(null,_e,z,Z,A,ce,re),M.el=_e.el}if(et&&lo(et,ce),!ae&&(Ne=Ue&&Ue.onVnodeMounted)){const _e=M;lo(()=>sa(Ne,st,_e),ce)}(M.shapeFlag&256||st&&Ui(st.vnode)&&st.vnode.shapeFlag&256)&&A.a&&lo(A.a,ce),A.isMounted=!0,M=z=Z=null}};A.scope.on();const ke=A.effect=new hv(Re);A.scope.off();const me=A.update=ke.run.bind(ke),Ve=A.job=ke.runIfDirty.bind(ke);Ve.i=A,Ve.id=A.uid,ke.scheduler=()=>If(Ve),Xs(A,!0),me()},te=(A,M,z)=>{M.component=A;const Z=A.vnode.props;A.vnode=M,A.next=null,GS(A,M.props,Z,z),JS(A,M.children,z),Da(),Hp(A),Fa()},de=(A,M,z,Z,ce,re,je,Re,ke=!1)=>{const me=A&&A.children,Ve=A?A.shapeFlag:0,Ne=M.children,{patchFlag:He,shapeFlag:Ue}=M;if(He>0){if(He&128){Ae(me,Ne,z,Z,ce,re,je,Re,ke);return}else if(He&256){Le(me,Ne,z,Z,ce,re,je,Re,ke);return}}Ue&8?(Ve&16&&fe(me,ce,re),Ne!==me&&c(z,Ne)):Ve&16?Ue&16?Ae(me,Ne,z,Z,ce,re,je,Re,ke):fe(me,ce,re,!0):(Ve&8&&c(z,""),Ue&16&&he(Ne,z,Z,ce,re,je,Re,ke))},Le=(A,M,z,Z,ce,re,je,Re,ke)=>{A=A||Di,M=M||Di;const me=A.length,Ve=M.length,Ne=Math.min(me,Ve);let He;for(He=0;He<Ne;He++){const Ue=M[He]=ke?ja(M[He]):ua(M[He]);P(A[He],Ue,z,null,ce,re,je,Re,ke)}me>Ve?fe(A,ce,re,!0,!1,Ne):he(M,z,Z,ce,re,je,Re,ke,Ne)},Ae=(A,M,z,Z,ce,re,je,Re,ke)=>{let me=0;const Ve=M.length;let Ne=A.length-1,He=Ve-1;for(;me<=Ne&&me<=He;){const Ue=A[me],Je=M[me]=ke?ja(M[me]):ua(M[me]);if(ai(Ue,Je))P(Ue,Je,z,null,ce,re,je,Re,ke);else break;me++}for(;me<=Ne&&me<=He;){const Ue=A[Ne],Je=M[He]=ke?ja(M[He]):ua(M[He]);if(ai(Ue,Je))P(Ue,Je,z,null,ce,re,je,Re,ke);else break;Ne--,He--}if(me>Ne){if(me<=He){const Ue=He+1,Je=Ue<Ve?M[Ue].el:Z;for(;me<=He;)P(null,M[me]=ke?ja(M[me]):ua(M[me]),z,Je,ce,re,je,Re,ke),me++}}else if(me>He)for(;me<=Ne;)Ke(A[me],ce,re,!0),me++;else{const Ue=me,Je=me,et=new Map;for(me=Je;me<=He;me++){const Tt=M[me]=ke?ja(M[me]):ua(M[me]);Tt.key!=null&&et.set(Tt.key,me)}let st,mt=0;const q=He-Je+1;let ae=!1,_e=0;const Ye=new Array(q);for(me=0;me<q;me++)Ye[me]=0;for(me=Ue;me<=Ne;me++){const Tt=A[me];if(mt>=q){Ke(Tt,ce,re,!0);continue}let At;if(Tt.key!=null)At=et.get(Tt.key);else for(st=Je;st<=He;st++)if(Ye[st-Je]===0&&ai(Tt,M[st])){At=st;break}At===void 0?Ke(Tt,ce,re,!0):(Ye[At-Je]=me+1,At>=_e?_e=At:ae=!0,P(Tt,M[At],z,null,ce,re,je,Re,ke),mt++)}const bt=ae?eC(Ye):Di;for(st=bt.length-1,me=q-1;me>=0;me--){const Tt=Je+me,At=M[Tt],Br=M[Tt+1],zt=Tt+1<Ve?Br.el||lg(Br):Z;Ye[me]===0?P(null,At,z,zt,ce,re,je,Re,ke):ae&&(st<0||me!==bt[st]?Fe(At,z,zt,2):st--)}}},Fe=(A,M,z,Z,ce=null)=>{const{el:re,type:je,transition:Re,children:ke,shapeFlag:me}=A;if(me&6){Fe(A.component.subTree,M,z,Z);return}if(me&128){A.suspense.move(M,z,Z);return}if(me&64){je.move(A,M,z,Ee);return}if(je===ot){o(re,M,z);for(let Ne=0;Ne<ke.length;Ne++)Fe(ke[Ne],M,z,Z);o(A.anchor,M,z);return}if(je===Mu){U(A,M,z);return}if(Z!==2&&me&1&&Re)if(Z===0)Re.persisted&&!re[Zo]?o(re,M,z):(Re.beforeEnter(re),o(re,M,z),lo(()=>Re.enter(re),ce));else{const{leave:Ne,delayLeave:He,afterLeave:Ue}=Re,Je=()=>{A.ctx.isUnmounted?r(re):o(re,M,z)},et=()=>{const st=re._isLeaving||!!re[Zo];re._isLeaving&&re[Zo](!0),Re.persisted&&!st?Je():Ne(re,()=>{Je(),Ue&&Ue()})};He?He(re,Je,et):et()}else o(re,M,z)},Ke=(A,M,z,Z=!1,ce=!1)=>{const{type:re,props:je,ref:Re,children:ke,dynamicChildren:me,shapeFlag:Ve,patchFlag:Ne,dirs:He,cacheIndex:Ue,memo:Je}=A;if(Ne===-2&&(ce=!1),Re!=null&&(Da(),Ml(Re,null,z,A,!0),Fa()),Ue!=null&&(M.renderCache[Ue]=void 0),Ve&256){M.ctx.deactivate(A);return}const et=Ve&1&&He,st=!Ui(A);let mt;if(st&&(mt=je&&je.onVnodeBeforeUnmount)&&sa(mt,M,A),Ve&6)ut(A.component,z,Z);else{if(Ve&128){A.suspense.unmount(z,Z);return}et&&Qs(A,null,M,"beforeUnmount"),Ve&64?A.type.remove(A,M,z,Ee,Z):me&&!me.hasOnce&&(re!==ot||Ne>0&&Ne&64)?fe(me,M,z,!1,!0):(re===ot&&Ne&384||!ce&&Ve&16)&&fe(ke,M,z),Z&<(A)}const q=Je!=null&&Ue==null;(st&&(mt=je&&je.onVnodeUnmounted)||et||q)&&lo(()=>{mt&&sa(mt,M,A),et&&Qs(A,null,M,"unmounted"),q&&(A.el=null)},z)},lt=A=>{const{type:M,el:z,anchor:Z,transition:ce}=A;if(M===ot){Ze(z,Z);return}if(M===Mu){H(A);return}const re=()=>{r(z),ce&&!ce.persisted&&ce.afterLeave&&ce.afterLeave()};if(A.shapeFlag&1&&ce&&!ce.persisted){const{leave:je,delayLeave:Re}=ce,ke=()=>je(z,re);Re?Re(A.el,re,ke):ke()}else re()},Ze=(A,M)=>{let z;for(;A!==M;)z=f(A),r(A),A=z;r(M)},ut=(A,M,z)=>{const{bum:Z,scope:ce,job:re,subTree:je,um:Re,m:ke,a:me}=A;rh(ke),rh(me),Z&&Ru(Z),ce.stop(),re&&(re.flags|=8,Ke(je,A,M,z)),Re&&lo(Re,M),lo(()=>{A.isUnmounted=!0},M)},fe=(A,M,z,Z=!1,ce=!1,re=0)=>{for(let je=re;je<A.length;je++)Ke(A[je],M,z,Z,ce)},N=A=>{if(A.shapeFlag&6)return N(A.component.subTree);if(A.shapeFlag&128)return A.suspense.next();const M=f(A.anchor||A.el),z=M&&M[Dv];return z?f(z):M};let oe=!1;const ue=(A,M,z)=>{let Z;A==null?M._vnode&&(Ke(M._vnode,null,null,!0),Z=M._vnode.component):P(M._vnode||null,A,M,null,null,null,z),M._vnode=A,oe||(oe=!0,Hp(Z),jv(),oe=!1)},Ee={p:P,um:Ke,m:Fe,r:lt,mt:ne,mc:he,pc:de,pbc:Pe,n:N,o:e};return{render:ue,hydrate:void 0,createApp:OS(ue)}}function ld({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 Xs({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function ZS(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ef(e,t,n=!1){const o=e.children,r=t.children;if(nt(o)&&nt(r))for(let a=0;a<o.length;a++){const s=o[a];let i=r[a];i.shapeFlag&1&&!i.dynamicChildren&&((i.patchFlag<=0||i.patchFlag===32)&&(i=r[a]=ja(r[a]),i.el=s.el),!n&&i.patchFlag!==-2&&Ef(s,i)),i.type===dc&&(i.patchFlag===-1&&(i=r[a]=ja(i)),i.el=s.el),i.type===Qn&&!i.el&&(i.el=s.el)}}function eC(e){const t=e.slice(),n=[0];let o,r,a,s,i;const l=e.length;for(o=0;o<l;o++){const d=e[o];if(d!==0){if(r=n[n.length-1],e[r]<d){t[o]=r,n.push(o);continue}for(a=0,s=n.length-1;a<s;)i=a+s>>1,e[n[i]]<d?a=i+1:s=i;d<e[n[a]]&&(a>0&&(t[o]=n[a-1]),n[a]=o)}}for(a=n.length,s=n[a-1];a-- >0;)n[a]=s,s=t[s];return n}function ig(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:ig(t)}function rh(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function lg(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?lg(t.subTree):null}const ug=e=>e.__isSuspense;function tC(e,t){t&&t.pendingBranch?nt(e)?t.effects.push(...e):t.effects.push(e):aS(e)}const ot=Symbol.for("v-fgt"),dc=Symbol.for("v-txt"),Qn=Symbol.for("v-cmt"),Mu=Symbol.for("v-stc"),$a=[];let fo=null;function _(e=!1){$a.push(fo=e?null:[])}function Mf(){$a.pop(),fo=$a[$a.length-1]||null}let Yi=1;function zu(e,t=!1){Yi+=e,e<0&&fo&&t&&(fo.hasOnce=!0)}function cg(e){return e.dynamicChildren=Yi>0?fo||Di:null,Mf(),Yi>0&&fo&&fo.push(e),e}function F(e,t,n,o,r,a){return cg(w(e,t,n,o,r,a,!0))}function Qe(e,t,n,o,r){return cg(Oe(e,t,n,o,r,!0))}function Ul(e){return e?e.__v_isVNode===!0:!1}function ai(e,t){return e.type===t.type&&e.key===t.key}const dg=({key:e})=>e??null,ju=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Vt(e)||kn(e)||ft(e)?{i:On,r:e,k:t,f:!!n}:e:null);function w(e,t=null,n=null,o=0,r=null,a=e===ot?0:1,s=!1,i=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&dg(t),ref:t&&ju(t),scopeId:Nv,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:o,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:On};return i?(Hu(l,n),a&128&&e.normalize(l)):n&&(l.shapeFlag|=Vt(n)?8:16),Yi>0&&!s&&fo&&(l.patchFlag>0||a&6)&&l.patchFlag!==32&&fo.push(l),l}const Oe=nC;function nC(e,t=null,n=null,o=0,r=null,a=!1){if((!e||e===Gv)&&(e=Qn),Ul(e)){const i=ks(e,t,!0);return n&&Hu(i,n),Yi>0&&!a&&fo&&(i.shapeFlag&6?fo[fo.indexOf(e)]=i:fo.push(i)),i.patchFlag=-2,i}if(dC(e)&&(e=e.__vccOpts),t){t=oC(t);let{class:i,style:l}=t;i&&!Vt(i)&&(t.class=at(i)),jt(l)&&(kf(l)&&!nt(l)&&(l=pn({},l)),t.style=er(l))}const s=Vt(e)?1:ug(e)?128:Fv(e)?64:jt(e)?4:ft(e)?2:0;return w(e,t,n,o,r,s,a,!0)}function oC(e){return e?kf(e)||tg(e)?pn({},e):e:null}function ks(e,t,n=!1,o=!1){const{props:r,ref:a,patchFlag:s,children:i,transition:l}=e,d=t?jf(r||{},t):r,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:d,key:d&&dg(d),ref:t&&t.ref?n&&a?nt(a)?a.concat(ju(t)):[a,ju(t)]:ju(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:i,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==ot?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ks(e.ssContent),ssFallback:e.ssFallback&&ks(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&o&&Bl(c,l.clone(c)),c}function ws(e=" ",t=0){return Oe(dc,null,e,t)}function AD(e,t){const n=Oe(Mu,null,e);return n.staticCount=t,n}function ve(e="",t=!1){return t?(_(),Qe(Qn,null,e)):Oe(Qn,null,e)}function ua(e){return e==null||typeof e=="boolean"?Oe(Qn):nt(e)?Oe(ot,null,e.slice()):Ul(e)?ja(e):Oe(dc,null,String(e))}function ja(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ks(e)}function Hu(e,t){let n=0;const{shapeFlag:o}=e;if(t==null)t=null;else if(nt(t))n=16;else if(typeof t=="object")if(o&65){const r=t.default;r&&(r._c&&(r._d=!1),Hu(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!tg(t)?t._ctx=On:r===3&&On&&(On.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(ft(t)){if(o&65){Hu(e,{default:t});return}t={default:t,_ctx:On},n=32}else t=String(t),o&64?(n=16,t=[ws(t)]):n=8;e.children=t,e.shapeFlag|=n}function jf(...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=at([t.class,o.class]));else if(r==="style")t.style=er([t.style,o.style]);else if(tc(r)){const a=t[r],s=o[r];s&&a!==s&&!(nt(a)&&a.includes(s))?t[r]=a?[].concat(a,s):s:s==null&&a==null&&!nc(r)&&(t[r]=s)}else r!==""&&(t[r]=o[r])}return t}function sa(e,t,n,o=null){or(e,t,7,[n,o])}const rC=Jv();let aC=0;function sC(e,t,n){const o=e.type,r=(t?t.appContext:e.appContext)||rC,a={uid:aC++,vnode:e,type:o,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new RT(!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:og(o,r),emitsOptions:Qv(o,r),emit:null,emitted:null,propsDefaults:Dt,inheritAttrs:o.inheritAttrs,ctx:Dt,data:Dt,props:Dt,attrs:Dt,slots:Dt,refs:Dt,setupState:Dt,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=FS.bind(null,a),e.ce&&e.ce(a),a}let $n=null;const Lf=()=>$n||On;let qu,qd;{const e=sc(),t=(n,o)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(o),a=>{r.length>1?r.forEach(s=>s(a)):r[0](a)}};qu=t("__VUE_INSTANCE_SETTERS__",n=>$n=n),qd=t("__VUE_SSR_SETTERS__",n=>Ji=n)}const Ql=e=>{const t=$n;return qu(e),e.scope.on(),()=>{e.scope.off(),qu(t)}},ah=()=>{$n&&$n.scope.off(),qu(null)};function fg(e){return e.vnode.shapeFlag&4}let Ji=!1;function iC(e,t=!1,n=!1){t&&qd(t);const{props:o,children:r}=e.vnode,a=fg(e);WS(e,o,a,t),YS(e,r,n||t);const s=a?lC(e,t):void 0;return t&&qd(!1),s}function lC(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,_S);const{setup:o}=n;if(o){Da();const r=e.setupContext=o.length>1?hg(e):null,a=Ql(e),s=Vl(o,e,0,[e.props,r]),i=sv(s);if(Fa(),a(),(i||e.sp)&&!Ui(e)&&Af(e),i){if(s.then(ah,ah),t)return s.then(l=>{sh(e,l)}).catch(l=>{Kl(l,e,0)});e.asyncDep=s}else sh(e,s)}else pg(e)}function sh(e,t,n){ft(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:jt(t)&&(e.setupState=Rv(t)),pg(e)}function pg(e,t,n){const o=e.type;e.render||(e.render=o.render||ca);{const r=Ql(e);Da();try{ES(e)}finally{Fa(),r()}}}const uC={get(e,t){return Jn(e,"get",""),e[t]}};function hg(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,uC),slots:e.slots,emit:e.emit,expose:t}}function fc(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Rv(YT(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in jl)return jl[n](e)},has(t,n){return n in t||n in jl}})):e.proxy}function cC(e,t=!0){return ft(e)?e.displayName||e.name:e.name||t&&e.__name}function dC(e){return ft(e)&&"__vccOpts"in e}const K=(e,t)=>eS(e,t,Ji);function Nf(e,t,n){try{zu(-1);const o=arguments.length;return o===2?jt(t)&&!nt(t)?Ul(t)?Oe(e,null,[t]):Oe(e,t):Oe(e,null,t):(o>3?n=Array.prototype.slice.call(arguments,2):o===3&&Ul(n)&&(n=[n]),Oe(e,t,n))}finally{zu(1)}}function _D(e,t,n,o){const r=n[o];if(r&&fC(r,e))return r;const a=t();return a.memo=e.slice(),a.cacheIndex=o,n[o]=a}function fC(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let o=0;o<n.length;o++)if(Rr(n[o],t[o]))return!1;return Yi>0&&fo&&fo.push(e),!0}const pC="3.5.40";/**
|
|
14
|
+
**/function Vl(e,t,n,o){try{return o?e(...o):e()}catch(r){Kl(r,t,n)}}function or(e,t,n,o){if(ft(e)){const r=Vl(e,t,n,o);return r&&sv(r)&&r.catch(a=>{Kl(a,t,n)}),r}if(nt(e)){const r=[];for(let a=0;a<e.length;a++)r.push(or(e[a],t,n,o));return r}}function Kl(e,t,n,o=!0){const r=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Dt;if(t){let i=t.parent;const l=t.proxy,d=`https://vuejs.org/error-reference/#runtime-${n}`;for(;i;){const c=i.ec;if(c){for(let v=0;v<c.length;v++)if(c[v](e,l,d)===!1)return}i=i.parent}if(a){Da(),Vl(a,null,10,[e,l,d]),Fa();return}}oS(e,n,r,o,s)}function oS(e,t,n,o=!0,r=!1){if(r)throw e;console.error(e)}const co=[];let ia=-1;const Bi=[];let vs=null,ji=0;const Ev=Promise.resolve();let Du=null;function Nt(e){const t=Du||Ev;return e?t.then(this?e.bind(this):e):t}function rS(e){let t=ia+1,n=co.length;for(;t<n;){const o=t+n>>>1,r=co[o],a=Fl(r);a<e||a===e&&r.flags&2?t=o+1:n=o}return t}function If(e){if(!(e.flags&1)){const t=Fl(e),n=co[co.length-1];!n||!(e.flags&2)&&t>=Fl(n)?co.push(e):co.splice(rS(t),0,e),e.flags|=1,Mv()}}function Mv(){Du||(Du=Ev.then(Lv))}function aS(e){nt(e)?Bi.push(...e):vs&&e.id===-1?vs.splice(ji+1,0,e):e.flags&1||(Bi.push(e),e.flags|=1),Mv()}function Hp(e,t,n=ia+1){for(;n<co.length;n++){const o=co[n];if(o&&o.flags&2){if(e&&o.id!==e.uid)continue;co.splice(n,1),n--,o.flags&4&&(o.flags&=-2),o(),o.flags&4||(o.flags&=-2)}}}function jv(e){if(Bi.length){const t=[...new Set(Bi)].sort((n,o)=>Fl(n)-Fl(o));if(Bi.length=0,vs){vs.push(...t);return}for(vs=t,ji=0;ji<vs.length;ji++){const n=vs[ji];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}vs=null,ji=0}}const Fl=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Lv(e){try{for(ia=0;ia<co.length;ia++){const t=co[ia];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Vl(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;ia<co.length;ia++){const t=co[ia];t&&(t.flags&=-2)}ia=-1,co.length=0,jv(),Du=null,(co.length||Bi.length)&&Lv()}}let On=null,Nv=null;function Fu(e){const t=On;return On=e,Nv=e&&e.type.__scopeId||null,t}function dt(e,t=On,n){if(!t||e._n)return e;const o=(...r)=>{o._d&&zu(-1);const a=Fu(t),s=$a.length;let i;try{i=e(...r)}finally{for(let l=$a.length;l>s;l--)Mf();Fu(a),o._d&&zu(1)}return i};return o._n=!0,o._c=!0,o._d=!0,o}function xn(e,t){if(On===null)return e;const n=fc(On),o=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[a,s,i,l=Dt]=t[r];a&&(ft(a)&&(a={mounted:a,updated:a}),a.deep&&Na(s),o.push({dir:a,instance:n,value:s,oldValue:void 0,arg:i,modifiers:l}))}return e}function Qs(e,t,n,o){const r=e.dirs,a=t&&t.dirs;for(let s=0;s<r.length;s++){const i=r[s];a&&(i.oldValue=a[s].value);let l=i.dir[o];l&&(Da(),or(l,n,8,[e.el,i,e,t]),Fa())}}function Eu(e,t){if($n){let n=$n.provides;const o=$n.parent&&$n.parent.provides;o===n&&(n=$n.provides=Object.create(o)),n[e]=t}}function Lr(e,t,n=!1){const o=Lf();if(o||zi){let r=zi?zi._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&&ft(t)?t.call(o&&o.proxy):t}}const sS=Symbol.for("v-scx"),iS=()=>Lr(sS);function tt(e,t,n){return $v(e,t,n)}function $v(e,t,n=Dt){const{immediate:o,deep:r,flush:a,once:s}=n,i=pn({},n),l=t&&o||!t&&a!=="post";let d;if(Ji){if(a==="sync"){const b=iS();d=b.__watcherHandles||(b.__watcherHandles=[])}else if(!l){const b=()=>{};return b.stop=ca,b.resume=ca,b.pause=ca,b}}const c=$n;i.call=(b,y,P)=>or(b,c,y,P);let v=!1;a==="post"?i.scheduler=b=>{lo(b,c&&c.suspense)}:a!=="sync"&&(v=!0,i.scheduler=(b,y)=>{y?b():If(b)}),i.augmentJob=b=>{t&&(b.flags|=4),v&&(b.flags|=2,c&&(b.id=c.uid,b.i=c))};const f=nS(e,t,i);return Ji&&(d?d.push(f):l&&f()),f}function lS(e,t,n){const o=this.proxy,r=Vt(e)?e.includes(".")?Ov(o,e):()=>o[e]:e.bind(o,o);let a;ft(t)?a=t:(a=t.handler,n=t);const s=Ql(this),i=$v(r,a.bind(o),n);return s(),i}function Ov(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 ps=new WeakMap,Dv=Symbol("_vte"),Fv=e=>e.__isTeleport,ri=e=>e&&(e.disabled||e.disabled===""),uS=e=>e&&(e.defer||e.defer===""),qp=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Wp=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Od=(e,t)=>{const n=e&&e.to;return Vt(n)?t?t(n):null:n},cS={name:"Teleport",__isTeleport:!0,process(e,t,n,o,r,a,s,i,l,d){const{mc:c,pc:v,pbc:f,o:{insert:b,querySelector:y,createText:P,createComment:B,parentNode:L}}=d,j=ri(t.props);let{dynamicChildren:U}=t;const H=(W,he,Se)=>{W.shapeFlag&16&&c(W.children,he,Se,r,a,s,i,l)},be=(W=t)=>{const he=ri(W.props),Se=W.target=Od(W.props,y),Pe=Dd(Se,W,P,b);Se&&(s!=="svg"&&qp(Se)?s="svg":s!=="mathml"&&Wp(Se)&&(s="mathml"),r&&r.isCE&&(r.ce._teleportTargets||(r.ce._teleportTargets=new Set)).add(Se),he||(H(W,Se,Pe),kl(W,!1)))},le=W=>{const he=()=>{if(ps.get(W)===he){if(ps.delete(W),ri(W.props)){const Se=L(W.el)||n;H(W,Se,W.anchor),kl(W,!0)}be(W)}};ps.set(W,he),lo(he,a)};if(e==null){const W=t.el=P(""),he=t.anchor=P("");if(b(W,n,o),b(he,n,o),uS(t.props)||a&&a.pendingBranch){le(t);return}j&&(H(t,n,he),kl(t,!0)),be()}else{t.el=e.el;const W=t.anchor=e.anchor,he=ps.get(e);if(he){he.flags|=8,ps.delete(e),le(t);return}t.targetStart=e.targetStart;const Se=t.target=e.target,Pe=t.targetAnchor=e.targetAnchor,ye=ri(e.props),Y=ye?n:Se,pe=ye?W:Pe;if(s==="svg"||qp(Se)?s="svg":(s==="mathml"||Wp(Se))&&(s="mathml"),U?(f(e.dynamicChildren,U,Y,r,a,s,i),Ef(e,t,!0)):l||v(e,t,Y,pe,r,a,s,i,!1),j)ye?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):gu(t,n,W,d,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const ne=Od(t.props,y);ne&&(t.target=ne,gu(t,ne,null,d,0))}else ye&&gu(t,Se,Pe,d,1);kl(t,j)}},remove(e,t,n,{um:o,o:{remove:r}},a){const{shapeFlag:s,children:i,anchor:l,targetStart:d,targetAnchor:c,target:v,props:f}=e,b=ri(f),y=a||!b,P=ps.get(e);if(P&&(P.flags|=8,ps.delete(e)),v&&(r(d),r(c)),a&&r(l),!P&&(b||v)&&s&16)for(let B=0;B<i.length;B++){const L=i[B];o(L,t,n,y,!!L.dynamicChildren)}},move:gu,hydrate:dS};function gu(e,t,n,{o:{insert:o},m:r},a=2){a===0&&o(e.targetAnchor,t,n);const{el:s,anchor:i,shapeFlag:l,children:d,props:c}=e,v=a===2;if(v&&o(s,t,n),!ps.has(e)&&(!v||ri(c))&&l&16)for(let f=0;f<d.length;f++)r(d[f],t,n,2);v&&o(i,t,n)}function dS(e,t,n,o,r,a,{o:{nextSibling:s,parentNode:i,querySelector:l,insert:d,createText:c}},v){function f(B,L){let j=L;for(;j;){if(j&&j.nodeType===8){if(j.data==="teleport start anchor")t.targetStart=j;else if(j.data==="teleport anchor"){t.targetAnchor=j,B._lpa=t.targetAnchor&&s(t.targetAnchor);break}}j=s(j)}}function b(B,L){L.anchor=v(s(B),L,i(B),n,o,r,a)}const y=t.target=Od(t.props,l),P=ri(t.props);if(y){const B=y._lpa||y.firstChild;t.shapeFlag&16&&(P?(b(e,t),f(y,B),t.targetAnchor||Dd(y,t,c,d,i(e)===y?e:null)):(t.anchor=s(e),f(y,B),t.targetAnchor||Dd(y,t,c,d),v(B&&s(B),t,y,n,o,r,a))),kl(t,P)}else P&&t.shapeFlag&16&&(b(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}const Ki=cS;function kl(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 Dd(e,t,n,o,r=null){const a=t.targetStart=n(""),s=t.targetAnchor=n("");return a[Dv]=s,e&&(o(a,e,r),o(s,e,r)),s}const Zo=Symbol("_leaveCb"),Tl=Symbol("_enterCb");function fS(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return pi(()=>{e.isMounted=!0}),_s(()=>{e.isUnmounting=!0}),e}const Xo=[Function,Array],Bv={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Xo,onEnter:Xo,onAfterEnter:Xo,onEnterCancelled:Xo,onBeforeLeave:Xo,onLeave:Xo,onAfterLeave:Xo,onLeaveCancelled:Xo,onBeforeAppear:Xo,onAppear:Xo,onAfterAppear:Xo,onAppearCancelled:Xo},Uv=e=>{const t=e.subTree;return t.component?Uv(t.component):t},pS={name:"BaseTransition",props:Bv,setup(e,{slots:t}){const n=Lf(),o=fS();return()=>{const r=t.default&&qv(t.default(),!0),a=r&&r.length?zv(r):n.subTree?ve():void 0;if(!a)return;const s=Rt(e),{mode:i}=s;if(o.isLeaving)return sd(a);const l=Gp(a);if(!l)return sd(a);let d=Fd(l,s,o,n,v=>d=v);l.type!==Qn&&Bl(l,d);let c=n.subTree&&Gp(n.subTree);if(c&&c.type!==Qn&&!ai(c,l)&&Uv(n).type!==Qn){let v=Fd(c,s,o,n);if(Bl(c,v),i==="out-in"&&l.type!==Qn)return o.isLeaving=!0,v.afterLeave=()=>{o.isLeaving=!1,n.job.flags&8||n.update(),delete v.afterLeave,c=void 0},sd(a);i==="in-out"&&l.type!==Qn?v.delayLeave=(f,b,y)=>{const P=Hv(o,c);P[String(c.key)]=c,f[Zo]=()=>{b(),f[Zo]=void 0,delete d.delayedLeave,c=void 0},d.delayedLeave=()=>{y(),delete d.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return a}}};function zv(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Qn){t=n;break}}return t}const hS=pS;function Hv(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 Fd(e,t,n,o,r){const{appear:a,mode:s,persisted:i=!1,onBeforeEnter:l,onEnter:d,onAfterEnter:c,onEnterCancelled:v,onBeforeLeave:f,onLeave:b,onAfterLeave:y,onLeaveCancelled:P,onBeforeAppear:B,onAppear:L,onAfterAppear:j,onAppearCancelled:U}=t,H=String(e.key),be=Hv(n,e),le=(Se,Pe)=>{Se&&or(Se,o,9,Pe)},W=(Se,Pe)=>{const ye=Pe[1];le(Se,Pe),nt(Se)?Se.every(Y=>Y.length<=1)&&ye():Se.length<=1&&ye()},he={mode:s,persisted:i,beforeEnter(Se){let Pe=l;if(!n.isMounted)if(a)Pe=B||l;else return;Se[Zo]&&Se[Zo](!0);const ye=be[H];ye&&ai(e,ye)&&ye.el[Zo]&&ye.el[Zo](),le(Pe,[Se])},enter(Se){if(be[H]===e)return;let Pe=d,ye=c,Y=v;if(!n.isMounted)if(a)Pe=L||d,ye=j||c,Y=U||v;else return;let pe=!1;Se[Tl]=xe=>{pe||(pe=!0,xe?le(Y,[Se]):le(ye,[Se]),he.delayedLeave&&he.delayedLeave(),Se[Tl]=void 0)};const ne=Se[Tl].bind(null,!1);Pe?W(Pe,[Se,ne]):ne()},leave(Se,Pe){const ye=String(e.key);if(Se[Tl]&&Se[Tl](!0),n.isUnmounting)return Pe();le(f,[Se]);let Y=!1;Se[Zo]=ne=>{Y||(Y=!0,Pe(),ne?le(P,[Se]):le(y,[Se]),Se[Zo]=void 0,be[ye]===e&&delete be[ye])};const pe=Se[Zo].bind(null,!1);be[ye]=e,b?W(b,[Se,pe]):pe()},clone(Se){const Pe=Fd(Se,t,n,o,r);return r&&r(Pe),Pe}};return he}function sd(e){if(Yl(e))return e=ks(e),e.children=null,e}function Gp(e){if(!Yl(e))return Fv(e.type)&&e.children?zv(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&&ft(n.default))return n.default()}}function Bl(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Bl(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 qv(e,t=!1,n){let o=[],r=0;for(let a=0;a<e.length;a++){let s=e[a];const i=n==null?s.key:String(n)+String(s.key!=null?s.key:a);s.type===ot?(s.patchFlag&128&&r++,o=o.concat(qv(s.children,t,i))):(t||s.type!==Qn)&&o.push(i!=null?ks(s,{key:i}):s)}if(r>1)for(let a=0;a<o.length;a++)o[a].patchFlag=-2;return o}function hn(e,t){return ft(e)?pn({name:e.name},t,{setup:e}):e}function Af(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Vp(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Bu=new WeakMap;function Ml(e,t,n,o,r=!1){if(nt(e)){e.forEach((P,B)=>Ml(P,t&&(nt(t)?t[B]:t),n,o,r));return}if(Ui(o)&&!r){o.shapeFlag&512&&o.type.__asyncResolved&&o.component.subTree.component&&Ml(e,t,n,o.component.subTree);return}const a=o.shapeFlag&4?fc(o.component):o.el,s=r?null:a,{i,r:l}=e,d=t&&t.r,c=i.refs===Dt?i.refs={}:i.refs,v=i.setupState,f=Rt(v),b=v===Dt?av:P=>Vp(c,P)?!1:Mt(f,P),y=(P,B)=>!(B&&Vp(c,B));if(d!=null&&d!==l){if(Kp(t),Vt(d))c[d]=null,b(d)&&(v[d]=null);else if(kn(d)){const P=t;y(d,P.k)&&(d.value=null),P.k&&(c[P.k]=null)}}if(ft(l))Vl(l,i,12,[s,c]);else{const P=Vt(l),B=kn(l);if(P||B){const L=()=>{if(e.f){const j=P?b(l)?v[l]:c[l]:y()||!e.k?l.value:c[e.k];if(r)nt(j)&&vf(j,a);else if(nt(j))j.includes(a)||j.push(a);else if(P)c[l]=[a],b(l)&&(v[l]=c[l]);else{const U=[a];y(l,e.k)&&(l.value=U),e.k&&(c[e.k]=U)}}else P?(c[l]=s,b(l)&&(v[l]=s)):B&&(y(l,e.k)&&(l.value=s),e.k&&(c[e.k]=s))};if(s){const j=()=>{L(),Bu.delete(e)};j.id=-1,Bu.set(e,j),lo(j,n)}else Kp(e),L()}}}function Kp(e){const t=Bu.get(e);t&&(t.flags|=8,Bu.delete(e))}const Yp=e=>e.nodeType===8;sc().requestIdleCallback;sc().cancelIdleCallback;function mS(e,t){if(Yp(e)&&e.data==="["){let n=1,o=e.nextSibling;for(;o;){if(o.nodeType===1){if(t(o)===!1)break}else if(Yp(o))if(o.data==="]"){if(--n===0)break}else o.data==="["&&n++;o=o.nextSibling}}else t(e)}const Ui=e=>!!e.type.__asyncLoader;function Ar(e){ft(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:o,delay:r=200,hydrate:a,timeout:s,suspensible:i=!0,onError:l}=e;let d=null,c,v=0;const f=()=>(v++,d=null,b()),b=()=>{let y;return d||(y=d=t().catch(P=>{if(P=P instanceof Error?P:new Error(String(P)),l)return new Promise((B,L)=>{l(P,()=>B(f()),()=>L(P),v+1)});throw P}).then(P=>y!==d&&d?d:(P&&(P.__esModule||P[Symbol.toStringTag]==="Module")&&(P=P.default),c=P,P)))};return hn({name:"AsyncComponentWrapper",__asyncLoader:b,__asyncHydrate(y,P,B){const L=y.isConnected;let j=!1;(P.bu||(P.bu=[])).push(()=>j=!0);const U=()=>{j||!y.parentNode||L&&!y.isConnected||B()},H=a?()=>{const be=a(U,le=>mS(y,le));be&&(P.bum||(P.bum=[])).push(be)}:U;c?H():b().then(()=>!P.isUnmounted&&H())},get __asyncResolved(){return c},setup(){const y=$n;if(Af(y),c)return()=>yu(c,y);const P=be=>{d=null,Kl(be,y,13,!o)};if(i&&y.suspense||Ji)return b().then(be=>()=>yu(be,y)).catch(be=>(P(be),()=>o?Oe(o,{error:be}):null));const B=S(!1),L=S(),j=S(!!r);let U,H;return Jl(()=>{U!=null&&clearTimeout(U),H!=null&&clearTimeout(H)}),r&&(H=setTimeout(()=>{y.isUnmounted||(j.value=!1)},r)),s!=null&&(U=setTimeout(()=>{if(!y.isUnmounted&&!B.value&&!L.value){const be=new Error(`Async component timed out after ${s}ms.`);P(be),L.value=be}},s)),b().then(()=>{y.isUnmounted||(B.value=!0,y.parent&&Yl(y.parent.vnode)&&y.parent.update())}).catch(be=>{if(y.isUnmounted){d=null;return}P(be),L.value=be}),()=>{if(B.value&&c)return yu(c,y);if(L.value&&o)return Oe(o,{error:L.value});if(n&&!j.value)return yu(n,y)}}})}function yu(e,t){const{ref:n,props:o,children:r,ce:a}=t.vnode,s=Oe(e,o,r);return s.ref=n,s.ce=a,delete t.vnode.ce,s}const Yl=e=>e.type.__isKeepAlive;function vS(e,t){Wv(e,"a",t)}function gS(e,t){Wv(e,"da",t)}function Wv(e,t,n=$n){const o=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(uc(t,o,n),n){let r=n.parent;for(;r&&r.parent;)Yl(r.parent.vnode)&&yS(o,t,n,r),r=r.parent}}function yS(e,t,n,o){const r=uc(t,e,o,!0);Jl(()=>{vf(o[t],r)},n)}function uc(e,t,n=$n,o=!1){if(n){const r=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=(...s)=>{Da();const i=Ql(n),l=or(t,n,e,s);return i(),Fa(),l});return o?r.unshift(a):r.push(a),a}}const za=e=>(t,n=$n)=>{(!Ji||e==="sp")&&uc(e,(...o)=>t(...o),n)},wS=za("bm"),pi=za("m"),bS=za("bu"),TS=za("u"),_s=za("bum"),Jl=za("um"),SS=za("sp"),CS=za("rtg"),xS=za("rtc");function kS(e,t=$n){uc("ec",e,t)}const IS="components",Gv=Symbol.for("v-ndc");function _f(e){return Vt(e)?AS(IS,e,!1)||e:e||Gv}function AS(e,t,n=!0,o=!1){const r=On||$n;if(r){const a=r.type;{const i=cC(a,!1);if(i&&(i===t||i===po(t)||i===ac(po(t))))return a}const s=Jp(r[e]||a[e],t)||Jp(r.appContext[e],t);return!s&&o?a:s}}function Jp(e,t){return e&&(e[t]||e[po(t)]||e[ac(po(t))])}function Zt(e,t,n,o){let r;const a=n,s=nt(e);if(s||Vt(e)){const i=s&&ui(e);let l=!1,d=!1;i&&(l=!tr(e),d=Ba(e),e=ic(e)),r=new Array(e.length);for(let c=0,v=e.length;c<v;c++)r[c]=t(l?d?Vi(Or(e[c])):Or(e[c]):e[c],c,void 0,a)}else if(typeof e=="number"){r=new Array(e);for(let i=0;i<e;i++)r[i]=t(i+1,i,void 0,a)}else if(jt(e))if(e[Symbol.iterator])r=Array.from(e,(i,l)=>t(i,l,void 0,a));else{const i=Object.keys(e);r=new Array(i.length);for(let l=0,d=i.length;l<d;l++){const c=i[l];r[l]=t(e[c],c,l,a)}}else r=[];return r}function _o(e,t,n={},o,r,a){if(On.ce||On.parent&&Ui(On.parent)&&On.parent.ce){const d=a!=null&&n.key==null?pn({},n,{key:a}):n,c=Object.keys(d).length>0;return t!=="default"&&(d.name=t),_(),Qe(ot,null,[Oe("slot",d,o)],c?-2:64)}let s=e[t];s&&s._c&&(s._d=!1);const i=$a.length;_();let l;try{const d=s&&Vv(s(n)),c=n.key||a||d&&d.key;l=Qe(ot,{key:(c&&!$r(c)?c:`_${t}`)+(!d&&o?"_fb":"")},d||(o?o():[]),d&&e._===1?64:-2)}catch(d){for(let c=$a.length;c>i;c--)Mf();throw d}finally{s&&s._c&&(s._d=!0)}return l}function Vv(e){return e.some(t=>Ul(t)?!(t.type===Qn||t.type===ot&&!Vv(t.children)):!0)?e:null}const Bd=e=>e?fg(e)?fc(e):Bd(e.parent):null,jl=pn(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=>Bd(e.parent),$root:e=>Bd(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Yv(e),$forceUpdate:e=>e.f||(e.f=()=>{If(e.update)}),$nextTick:e=>e.n||(e.n=Nt.bind(e.proxy)),$watch:e=>lS.bind(e)}),id=(e,t)=>e!==Dt&&!e.__isScriptSetup&&Mt(e,t),_S={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:o,data:r,props:a,accessCache:s,type:i,appContext:l}=e;if(t[0]!=="$"){const f=s[t];if(f!==void 0)switch(f){case 1:return o[t];case 2:return r[t];case 4:return n[t];case 3:return a[t]}else{if(id(o,t))return s[t]=1,o[t];if(r!==Dt&&Mt(r,t))return s[t]=2,r[t];if(Mt(a,t))return s[t]=3,a[t];if(n!==Dt&&Mt(n,t))return s[t]=4,n[t];Ud&&(s[t]=0)}}const d=jl[t];let c,v;if(d)return t==="$attrs"&&Jn(e.attrs,"get",""),d(e);if((c=i.__cssModules)&&(c=c[t]))return c;if(n!==Dt&&Mt(n,t))return s[t]=4,n[t];if(v=l.config.globalProperties,Mt(v,t))return v[t]},set({_:e},t,n){const{data:o,setupState:r,ctx:a}=e;return id(r,t)?(r[t]=n,!0):o!==Dt&&Mt(o,t)?(o[t]=n,!0):Mt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:o,appContext:r,props:a,type:s}},i){let l;return!!(n[i]||e!==Dt&&i[0]!=="$"&&Mt(e,i)||id(t,i)||Mt(a,i)||Mt(o,i)||Mt(jl,i)||Mt(r.config.globalProperties,i)||(l=s.__cssModules)&&l[i])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Mt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function PS(){return RS().slots}function RS(e){const t=Lf();return t.setupContext||(t.setupContext=hg(t))}function Qp(e){return nt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Ud=!0;function ES(e){const t=Yv(e),n=e.proxy,o=e.ctx;Ud=!1,t.beforeCreate&&Xp(t.beforeCreate,e,"bc");const{data:r,computed:a,methods:s,watch:i,provide:l,inject:d,created:c,beforeMount:v,mounted:f,beforeUpdate:b,updated:y,activated:P,deactivated:B,beforeDestroy:L,beforeUnmount:j,destroyed:U,unmounted:H,render:be,renderTracked:le,renderTriggered:W,errorCaptured:he,serverPrefetch:Se,expose:Pe,inheritAttrs:ye,components:Y,directives:pe,filters:ne}=t;if(d&&MS(d,o,null),s)for(const te in s){const de=s[te];ft(de)&&(o[te]=de.bind(n))}if(r){const te=r.call(n,n);jt(te)&&(e.data=lc(te))}if(Ud=!0,a)for(const te in a){const de=a[te],Le=ft(de)?de.bind(n,n):ft(de.get)?de.get.bind(n,n):ca,Ae=!ft(de)&&ft(de.set)?de.set.bind(n):ca,Fe=K({get:Le,set:Ae});Object.defineProperty(o,te,{enumerable:!0,configurable:!0,get:()=>Fe.value,set:Ke=>Fe.value=Ke})}if(i)for(const te in i)Kv(i[te],o,n,te);if(l){const te=ft(l)?l.call(n):l;Reflect.ownKeys(te).forEach(de=>{Eu(de,te[de])})}c&&Xp(c,e,"c");function $e(te,de){nt(de)?de.forEach(Le=>te(Le.bind(n))):de&&te(de.bind(n))}if($e(wS,v),$e(pi,f),$e(bS,b),$e(TS,y),$e(vS,P),$e(gS,B),$e(kS,he),$e(xS,le),$e(CS,W),$e(_s,j),$e(Jl,H),$e(SS,Se),nt(Pe))if(Pe.length){const te=e.exposed||(e.exposed={});Pe.forEach(de=>{Object.defineProperty(te,de,{get:()=>n[de],set:Le=>n[de]=Le,enumerable:!0})})}else e.exposed||(e.exposed={});be&&e.render===ca&&(e.render=be),ye!=null&&(e.inheritAttrs=ye),Y&&(e.components=Y),pe&&(e.directives=pe),Se&&Af(e)}function MS(e,t,n=ca){nt(e)&&(e=zd(e));for(const o in e){const r=e[o];let a;jt(r)?"default"in r?a=Lr(r.from||o,r.default,!0):a=Lr(r.from||o):a=Lr(r),kn(a)?Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get:()=>a.value,set:s=>a.value=s}):t[o]=a}}function Xp(e,t,n){or(nt(e)?e.map(o=>o.bind(t.proxy)):e.bind(t.proxy),t,n)}function Kv(e,t,n,o){let r=o.includes(".")?Ov(n,o):()=>n[o];if(Vt(e)){const a=t[e];ft(a)&&tt(r,a)}else if(ft(e))tt(r,e.bind(n));else if(jt(e))if(nt(e))e.forEach(a=>Kv(a,t,n,o));else{const a=ft(e.handler)?e.handler.bind(n):t[e.handler];ft(a)&&tt(r,a,e)}}function Yv(e){const t=e.type,{mixins:n,extends:o}=t,{mixins:r,optionsCache:a,config:{optionMergeStrategies:s}}=e.appContext,i=a.get(t);let l;return i?l=i:!r.length&&!n&&!o?l=t:(l={},r.length&&r.forEach(d=>Uu(l,d,s,!0)),Uu(l,t,s)),jt(t)&&a.set(t,l),l}function Uu(e,t,n,o=!1){const{mixins:r,extends:a}=t;a&&Uu(e,a,n,!0),r&&r.forEach(s=>Uu(e,s,n,!0));for(const s in t)if(!(o&&s==="expose")){const i=jS[s]||n&&n[s];e[s]=i?i(e[s],t[s]):t[s]}return e}const jS={data:Zp,props:eh,emits:eh,methods:Il,computed:Il,beforeCreate:io,created:io,beforeMount:io,mounted:io,beforeUpdate:io,updated:io,beforeDestroy:io,beforeUnmount:io,destroyed:io,unmounted:io,activated:io,deactivated:io,errorCaptured:io,serverPrefetch:io,components:Il,directives:Il,watch:NS,provide:Zp,inject:LS};function Zp(e,t){return t?e?function(){return pn(ft(e)?e.call(this,this):e,ft(t)?t.call(this,this):t)}:t:e}function LS(e,t){return Il(zd(e),zd(t))}function zd(e){if(nt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function io(e,t){return e?[...new Set([].concat(e,t))]:t}function Il(e,t){return e?pn(Object.create(null),e,t):t}function eh(e,t){return e?nt(e)&&nt(t)?[...new Set([...e,...t])]:pn(Object.create(null),Qp(e),Qp(t??{})):t}function NS(e,t){if(!e)return t;if(!t)return e;const n=pn(Object.create(null),e);for(const o in t)n[o]=io(e[o],t[o]);return n}function Jv(){return{app:null,config:{isNativeTag:av,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 $S=0;function OS(e,t){return function(o,r=null){ft(o)||(o=pn({},o)),r!=null&&!jt(r)&&(r=null);const a=Jv(),s=new WeakSet,i=[];let l=!1;const d=a.app={_uid:$S++,_component:o,_props:r,_container:null,_context:a,_instance:null,version:pC,get config(){return a.config},set config(c){},use(c,...v){return s.has(c)||(c&&ft(c.install)?(s.add(c),c.install(d,...v)):ft(c)&&(s.add(c),c(d,...v))),d},mixin(c){return a.mixins.includes(c)||a.mixins.push(c),d},component(c,v){return v?(a.components[c]=v,d):a.components[c]},directive(c,v){return v?(a.directives[c]=v,d):a.directives[c]},mount(c,v,f){if(!l){const b=d._ceVNode||Oe(o,r);return b.appContext=a,f===!0?f="svg":f===!1&&(f=void 0),e(b,c,f),l=!0,d._container=c,c.__vue_app__=d,fc(b.component)}},onUnmount(c){i.push(c)},unmount(){l&&(or(i,d._instance,16),e(null,d._container),delete d._container.__vue_app__)},provide(c,v){return a.provides[c]=v,d},runWithContext(c){const v=zi;zi=d;try{return c()}finally{zi=v}}};return d}}let zi=null;const DS=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${po(t)}Modifiers`]||e[`${As(t)}Modifiers`];function FS(e,t,...n){if(e.isUnmounted)return;const o=e.vnode.props||Dt;let r=n;const a=t.startsWith("update:"),s=a&&DS(o,t.slice(7));s&&(s.trim&&(r=n.map(c=>Vt(c)?c.trim():c)),s.number&&(r=n.map(yf)));let i,l=o[i=td(t)]||o[i=td(po(t))];!l&&a&&(l=o[i=td(As(t))]),l&&or(l,e,6,r);const d=o[i+"Once"];if(d){if(!e.emitted)e.emitted={};else if(e.emitted[i])return;e.emitted[i]=!0,or(d,e,6,r)}}const BS=new WeakMap;function Qv(e,t,n=!1){const o=n?BS:t.emitsCache,r=o.get(e);if(r!==void 0)return r;const a=e.emits;let s={},i=!1;if(!ft(e)){const l=d=>{const c=Qv(d,t,!0);c&&(i=!0,pn(s,c))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!a&&!i?(jt(e)&&o.set(e,null),null):(nt(a)?a.forEach(l=>s[l]=null):pn(s,a),jt(e)&&o.set(e,s),s)}function cc(e,t){return!e||!tc(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),Mt(e,t[0].toLowerCase()+t.slice(1))||Mt(e,As(t))||Mt(e,t))}function th(e){const{type:t,vnode:n,proxy:o,withProxy:r,propsOptions:[a],slots:s,attrs:i,emit:l,render:d,renderCache:c,props:v,data:f,setupState:b,ctx:y,inheritAttrs:P}=e,B=Fu(e);let L,j;try{if(n.shapeFlag&4){const H=r||o,be=H;L=ua(d.call(be,H,c,v,b,f,y)),j=i}else{const H=t;L=ua(H.length>1?H(v,{attrs:i,slots:s,emit:l}):H(v,null)),j=t.props?i:US(i)}}catch(H){$a.length=0,Kl(H,e,1),L=Oe(Qn)}let U=L;if(j&&P!==!1){const H=Object.keys(j),{shapeFlag:be}=U;H.length&&be&7&&(a&&H.some(nc)&&(j=zS(j,a)),U=ks(U,j,!1,!0))}return n.dirs&&(U=ks(U,null,!1,!0),U.dirs=U.dirs?U.dirs.concat(n.dirs):n.dirs),n.transition&&Bl(U,n.transition),L=U,Fu(B),L}const US=e=>{let t;for(const n in e)(n==="class"||n==="style"||tc(n))&&((t||(t={}))[n]=e[n]);return t},zS=(e,t)=>{const n={};for(const o in e)(!nc(o)||!(o.slice(9)in t))&&(n[o]=e[o]);return n};function HS(e,t,n){const{props:o,children:r,component:a}=e,{props:s,children:i,patchFlag:l}=t,d=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return o?nh(o,s,d):!!s;if(l&8){const c=t.dynamicProps;for(let v=0;v<c.length;v++){const f=c[v];if(Xv(s,o,f)&&!cc(d,f))return!0}}}else return(r||i)&&(!i||!i.$stable)?!0:o===s?!1:o?s?nh(o,s,d):!0:!!s;return!1}function nh(e,t,n){const o=Object.keys(t);if(o.length!==Object.keys(e).length)return!0;for(let r=0;r<o.length;r++){const a=o[r];if(Xv(t,e,a)&&!cc(n,a))return!0}return!1}function Xv(e,t,n){const o=e[n],r=t[n];return n==="style"&&jt(o)&&jt(r)?!Gl(o,r):o!==r}function qS({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 Zv={},eg=()=>Object.create(Zv),tg=e=>Object.getPrototypeOf(e)===Zv;function WS(e,t,n,o=!1){const r={},a=eg();e.propsDefaults=Object.create(null),ng(e,t,r,a);for(const s in e.propsOptions[0])s in r||(r[s]=void 0);n?e.props=o?r:_v(r):e.type.props?e.props=r:e.props=a,e.attrs=a}function GS(e,t,n,o){const{props:r,attrs:a,vnode:{patchFlag:s}}=e,i=Rt(r),[l]=e.propsOptions;let d=!1;if((o||s>0)&&!(s&16)){if(s&8){const c=e.vnode.dynamicProps;for(let v=0;v<c.length;v++){let f=c[v];if(cc(e.emitsOptions,f))continue;const b=t[f];if(l)if(Mt(a,f))b!==a[f]&&(a[f]=b,d=!0);else{const y=po(f);r[y]=Hd(l,i,y,b,e,!1)}else b!==a[f]&&(a[f]=b,d=!0)}}}else{ng(e,t,r,a)&&(d=!0);let c;for(const v in i)(!t||!Mt(t,v)&&((c=As(v))===v||!Mt(t,c)))&&(l?n&&(n[v]!==void 0||n[c]!==void 0)&&(r[v]=Hd(l,i,v,void 0,e,!0)):delete r[v]);if(a!==i)for(const v in a)(!t||!Mt(t,v))&&(delete a[v],d=!0)}d&&La(e.attrs,"set","")}function ng(e,t,n,o){const[r,a]=e.propsOptions;let s=!1,i;if(t)for(let l in t){if(Pl(l))continue;const d=t[l];let c;r&&Mt(r,c=po(l))?!a||!a.includes(c)?n[c]=d:(i||(i={}))[c]=d:cc(e.emitsOptions,l)||(!(l in o)||d!==o[l])&&(o[l]=d,s=!0)}if(a){const l=Rt(n),d=i||Dt;for(let c=0;c<a.length;c++){const v=a[c];n[v]=Hd(r,l,v,d[v],e,!Mt(d,v))}}return s}function Hd(e,t,n,o,r,a){const s=e[n];if(s!=null){const i=Mt(s,"default");if(i&&o===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&ft(l)){const{propsDefaults:d}=r;if(n in d)o=d[n];else{const c=Ql(r);o=d[n]=l.call(null,t),c()}}else o=l;r.ce&&r.ce._setProp(n,o)}s[0]&&(a&&!i?o=!1:s[1]&&(o===""||o===As(n))&&(o=!0))}return o}const VS=new WeakMap;function og(e,t,n=!1){const o=n?VS:t.propsCache,r=o.get(e);if(r)return r;const a=e.props,s={},i=[];let l=!1;if(!ft(e)){const c=v=>{l=!0;const[f,b]=og(v,t,!0);pn(s,f),b&&i.push(...b)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!a&&!l)return jt(e)&&o.set(e,Di),Di;if(nt(a))for(let c=0;c<a.length;c++){const v=po(a[c]);oh(v)&&(s[v]=Dt)}else if(a)for(const c in a){const v=po(c);if(oh(v)){const f=a[c],b=s[v]=nt(f)||ft(f)?{type:f}:pn({},f),y=b.type;let P=!1,B=!0;if(nt(y))for(let L=0;L<y.length;++L){const j=y[L],U=ft(j)&&j.name;if(U==="Boolean"){P=!0;break}else U==="String"&&(B=!1)}else P=ft(y)&&y.name==="Boolean";b[0]=P,b[1]=B,(P||Mt(b,"default"))&&i.push(v)}}const d=[s,i];return jt(e)&&o.set(e,d),d}function oh(e){return e[0]!=="$"&&!Pl(e)}const Pf=e=>e==="_"||e==="_ctx"||e==="$stable",Rf=e=>nt(e)?e.map(ua):[ua(e)],KS=(e,t,n)=>{if(t._n)return t;const o=dt((...r)=>Rf(t(...r)),n);return o._c=!1,o},rg=(e,t,n)=>{const o=e._ctx;for(const r in e){if(Pf(r))continue;const a=e[r];if(ft(a))t[r]=KS(r,a,o);else if(a!=null){const s=Rf(a);t[r]=()=>s}}},ag=(e,t)=>{const n=Rf(t);e.slots.default=()=>n},sg=(e,t,n)=>{for(const o in t)(n||!Pf(o))&&(e[o]=t[o])},YS=(e,t,n)=>{const o=e.slots=eg();if(e.vnode.shapeFlag&32){const r=t._;r?(sg(o,t,n),n&&uv(o,"_",r,!0)):rg(t,o)}else t&&ag(e,t)},JS=(e,t,n)=>{const{vnode:o,slots:r}=e;let a=!0,s=Dt;if(o.shapeFlag&32){const i=t._;i?n&&i===1?a=!1:sg(r,t,n):(a=!t.$stable,rg(t,r)),s=t}else t&&(ag(e,t),s={default:1});if(a)for(const i in r)!Pf(i)&&s[i]==null&&delete r[i]},lo=tC;function QS(e){return XS(e)}function XS(e,t){const n=sc();n.__VUE__=!0;const{insert:o,remove:r,patchProp:a,createElement:s,createText:i,createComment:l,setText:d,setElementText:c,parentNode:v,nextSibling:f,setScopeId:b=ca,insertStaticContent:y}=e,P=(A,M,z,Z=null,ce=null,re=null,je=void 0,Re=null,ke=!!M.dynamicChildren)=>{if(A===M)return;A&&!ai(A,M)&&(Z=N(A),Ke(A,ce,re,!0),A=null),M.patchFlag===-2&&(ke=!1,M.dynamicChildren=null);const{type:me,ref:Ve,shapeFlag:Ne}=M;switch(me){case dc:B(A,M,z,Z);break;case Qn:L(A,M,z,Z);break;case Mu:A==null&&j(M,z,Z,je);break;case ot:Y(A,M,z,Z,ce,re,je,Re,ke);break;default:Ne&1?be(A,M,z,Z,ce,re,je,Re,ke):Ne&6?pe(A,M,z,Z,ce,re,je,Re,ke):(Ne&64||Ne&128)&&me.process(A,M,z,Z,ce,re,je,Re,ke,Ee)}Ve!=null&&ce?Ml(Ve,A&&A.ref,re,M||A,!M):Ve==null&&A&&A.ref!=null&&Ml(A.ref,null,re,A,!0)},B=(A,M,z,Z)=>{if(A==null)o(M.el=i(M.children),z,Z);else{const ce=M.el=A.el;M.children!==A.children&&d(ce,M.children)}},L=(A,M,z,Z)=>{A==null?o(M.el=l(M.children||""),z,Z):M.el=A.el},j=(A,M,z,Z)=>{[A.el,A.anchor]=y(A.children,M,z,Z,A.el,A.anchor)},U=({el:A,anchor:M},z,Z)=>{let ce;for(;A&&A!==M;)ce=f(A),o(A,z,Z),A=ce;o(M,z,Z)},H=({el:A,anchor:M})=>{let z;for(;A&&A!==M;)z=f(A),r(A),A=z;r(M)},be=(A,M,z,Z,ce,re,je,Re,ke)=>{if(M.type==="svg"?je="svg":M.type==="math"&&(je="mathml"),A==null)le(M,z,Z,ce,re,je,Re,ke);else{const me=A.el&&A.el._isVueCE?A.el:null;try{me&&me._beginPatch(),Se(A,M,ce,re,je,Re,ke)}finally{me&&me._endPatch()}}},le=(A,M,z,Z,ce,re,je,Re)=>{let ke,me;const{props:Ve,shapeFlag:Ne,transition:He,dirs:Ue}=A;if(ke=A.el=s(A.type,re,Ve&&Ve.is,Ve),Ne&8?c(ke,A.children):Ne&16&&he(A.children,ke,null,Z,ce,ld(A,re),je,Re),Ue&&Qs(A,null,Z,"created"),W(ke,A,A.scopeId,je,Z),Ve){for(const et in Ve)et!=="value"&&!Pl(et)&&a(ke,et,null,Ve[et],re,Z);"value"in Ve&&a(ke,"value",null,Ve.value,re),(me=Ve.onVnodeBeforeMount)&&sa(me,Z,A)}Ue&&Qs(A,null,Z,"beforeMount");const Je=ZS(ce,He);Je&&He.beforeEnter(ke),o(ke,M,z),((me=Ve&&Ve.onVnodeMounted)||Je||Ue)&&lo(()=>{try{me&&sa(me,Z,A),Je&&He.enter(ke),Ue&&Qs(A,null,Z,"mounted")}finally{}},ce)},W=(A,M,z,Z,ce)=>{if(z&&b(A,z),Z)for(let re=0;re<Z.length;re++)b(A,Z[re]);if(ce){let re=ce.subTree;if(M===re||ug(re.type)&&(re.ssContent===M||re.ssFallback===M)){const je=ce.vnode;W(A,je,je.scopeId,je.slotScopeIds,ce.parent)}}},he=(A,M,z,Z,ce,re,je,Re,ke=0)=>{for(let me=ke;me<A.length;me++){const Ve=A[me]=Re?ja(A[me]):ua(A[me]);P(null,Ve,M,z,Z,ce,re,je,Re)}},Se=(A,M,z,Z,ce,re,je)=>{const Re=M.el=A.el;let{patchFlag:ke,dynamicChildren:me,dirs:Ve}=M;ke|=A.patchFlag&16;const Ne=A.props||Dt,He=M.props||Dt;let Ue;if(z&&Xs(z,!1),(Ue=He.onVnodeBeforeUpdate)&&sa(Ue,z,M,A),Ve&&Qs(M,A,z,"beforeUpdate"),z&&Xs(z,!0),me&&(!A.dynamicChildren||A.dynamicChildren.length!==me.length)&&(ke=0,je=!1,me=null),(Ne.innerHTML&&He.innerHTML==null||Ne.textContent&&He.textContent==null)&&c(Re,""),me?Pe(A.dynamicChildren,me,Re,z,Z,ld(M,ce),re):je||de(A,M,Re,null,z,Z,ld(M,ce),re,!1),ke>0){if(ke&16)ye(Re,Ne,He,z,ce);else if(ke&2&&Ne.class!==He.class&&a(Re,"class",null,He.class,ce),ke&4&&a(Re,"style",Ne.style,He.style,ce),ke&8){const Je=M.dynamicProps;for(let et=0;et<Je.length;et++){const st=Je[et],mt=Ne[st],q=He[st];(q!==mt||st==="value")&&a(Re,st,mt,q,ce,z)}}ke&1&&A.children!==M.children&&c(Re,M.children)}else!je&&me==null&&ye(Re,Ne,He,z,ce);((Ue=He.onVnodeUpdated)||Ve)&&lo(()=>{Ue&&sa(Ue,z,M,A),Ve&&Qs(M,A,z,"updated")},Z)},Pe=(A,M,z,Z,ce,re,je)=>{for(let Re=0;Re<M.length;Re++){const ke=A[Re],me=M[Re],Ve=ke.el&&(ke.type===ot||!ai(ke,me)||ke.shapeFlag&198)?v(ke.el):z;P(ke,me,Ve,null,Z,ce,re,je,!0)}},ye=(A,M,z,Z,ce)=>{if(M!==z){if(M!==Dt)for(const re in M)!Pl(re)&&!(re in z)&&a(A,re,M[re],null,ce,Z);for(const re in z){if(Pl(re))continue;const je=z[re],Re=M[re];je!==Re&&re!=="value"&&a(A,re,Re,je,ce,Z)}"value"in z&&a(A,"value",M.value,z.value,ce)}},Y=(A,M,z,Z,ce,re,je,Re,ke)=>{const me=M.el=A?A.el:i(""),Ve=M.anchor=A?A.anchor:i("");let{patchFlag:Ne,dynamicChildren:He,slotScopeIds:Ue}=M;Ue&&(Re=Re?Re.concat(Ue):Ue),A==null?(o(me,z,Z),o(Ve,z,Z),he(M.children||[],z,Ve,ce,re,je,Re,ke)):Ne>0&&Ne&64&&He&&A.dynamicChildren&&A.dynamicChildren.length===He.length?(Pe(A.dynamicChildren,He,z,ce,re,je,Re),(M.key!=null||ce&&M===ce.subTree)&&Ef(A,M,!0)):de(A,M,z,Ve,ce,re,je,Re,ke)},pe=(A,M,z,Z,ce,re,je,Re,ke)=>{M.slotScopeIds=Re,A==null?M.shapeFlag&512?ce.ctx.activate(M,z,Z,je,ke):ne(M,z,Z,ce,re,je,ke):xe(A,M,ke)},ne=(A,M,z,Z,ce,re,je)=>{const Re=A.component=sC(A,Z,ce);if(Yl(A)&&(Re.ctx.renderer=Ee),iC(Re,!1,je),Re.asyncDep){if(ce&&ce.registerDep(Re,$e,je),!A.el){const ke=Re.subTree=Oe(Qn);L(null,ke,M,z),A.placeholder=ke.el}}else $e(Re,A,M,z,ce,re,je)},xe=(A,M,z)=>{const Z=M.component=A.component;if(HS(A,M,z))if(Z.asyncDep&&!Z.asyncResolved){te(Z,M,z);return}else Z.next=M,Z.update();else M.el=A.el,Z.vnode=M},$e=(A,M,z,Z,ce,re,je)=>{const Re=()=>{if(A.isMounted){let{next:Ne,bu:He,u:Ue,parent:Je,vnode:et}=A;{const _e=ig(A);if(_e){Ne&&(Ne.el=et.el,te(A,Ne,je)),_e.asyncDep.then(()=>{lo(()=>{A.isUnmounted||me()},ce)});return}}let st=Ne,mt;Xs(A,!1),Ne?(Ne.el=et.el,te(A,Ne,je)):Ne=et,He&&Ru(He),(mt=Ne.props&&Ne.props.onVnodeBeforeUpdate)&&sa(mt,Je,Ne,et),Xs(A,!0);const q=th(A),ae=A.subTree;A.subTree=q,P(ae,q,v(ae.el),N(ae),A,ce,re),Ne.el=q.el,st===null&&qS(A,q.el),Ue&&lo(Ue,ce),(mt=Ne.props&&Ne.props.onVnodeUpdated)&&lo(()=>sa(mt,Je,Ne,et),ce)}else{let Ne;const{el:He,props:Ue}=M,{bm:Je,m:et,parent:st,root:mt,type:q}=A,ae=Ui(M);Xs(A,!1),Je&&Ru(Je),!ae&&(Ne=Ue&&Ue.onVnodeBeforeMount)&&sa(Ne,st,M),Xs(A,!0);{mt.ce&&mt.ce._hasShadowRoot()&&mt.ce._injectChildStyle(q,A.parent?A.parent.type:void 0);const _e=A.subTree=th(A);P(null,_e,z,Z,A,ce,re),M.el=_e.el}if(et&&lo(et,ce),!ae&&(Ne=Ue&&Ue.onVnodeMounted)){const _e=M;lo(()=>sa(Ne,st,_e),ce)}(M.shapeFlag&256||st&&Ui(st.vnode)&&st.vnode.shapeFlag&256)&&A.a&&lo(A.a,ce),A.isMounted=!0,M=z=Z=null}};A.scope.on();const ke=A.effect=new hv(Re);A.scope.off();const me=A.update=ke.run.bind(ke),Ve=A.job=ke.runIfDirty.bind(ke);Ve.i=A,Ve.id=A.uid,ke.scheduler=()=>If(Ve),Xs(A,!0),me()},te=(A,M,z)=>{M.component=A;const Z=A.vnode.props;A.vnode=M,A.next=null,GS(A,M.props,Z,z),JS(A,M.children,z),Da(),Hp(A),Fa()},de=(A,M,z,Z,ce,re,je,Re,ke=!1)=>{const me=A&&A.children,Ve=A?A.shapeFlag:0,Ne=M.children,{patchFlag:He,shapeFlag:Ue}=M;if(He>0){if(He&128){Ae(me,Ne,z,Z,ce,re,je,Re,ke);return}else if(He&256){Le(me,Ne,z,Z,ce,re,je,Re,ke);return}}Ue&8?(Ve&16&&fe(me,ce,re),Ne!==me&&c(z,Ne)):Ve&16?Ue&16?Ae(me,Ne,z,Z,ce,re,je,Re,ke):fe(me,ce,re,!0):(Ve&8&&c(z,""),Ue&16&&he(Ne,z,Z,ce,re,je,Re,ke))},Le=(A,M,z,Z,ce,re,je,Re,ke)=>{A=A||Di,M=M||Di;const me=A.length,Ve=M.length,Ne=Math.min(me,Ve);let He;for(He=0;He<Ne;He++){const Ue=M[He]=ke?ja(M[He]):ua(M[He]);P(A[He],Ue,z,null,ce,re,je,Re,ke)}me>Ve?fe(A,ce,re,!0,!1,Ne):he(M,z,Z,ce,re,je,Re,ke,Ne)},Ae=(A,M,z,Z,ce,re,je,Re,ke)=>{let me=0;const Ve=M.length;let Ne=A.length-1,He=Ve-1;for(;me<=Ne&&me<=He;){const Ue=A[me],Je=M[me]=ke?ja(M[me]):ua(M[me]);if(ai(Ue,Je))P(Ue,Je,z,null,ce,re,je,Re,ke);else break;me++}for(;me<=Ne&&me<=He;){const Ue=A[Ne],Je=M[He]=ke?ja(M[He]):ua(M[He]);if(ai(Ue,Je))P(Ue,Je,z,null,ce,re,je,Re,ke);else break;Ne--,He--}if(me>Ne){if(me<=He){const Ue=He+1,Je=Ue<Ve?M[Ue].el:Z;for(;me<=He;)P(null,M[me]=ke?ja(M[me]):ua(M[me]),z,Je,ce,re,je,Re,ke),me++}}else if(me>He)for(;me<=Ne;)Ke(A[me],ce,re,!0),me++;else{const Ue=me,Je=me,et=new Map;for(me=Je;me<=He;me++){const Tt=M[me]=ke?ja(M[me]):ua(M[me]);Tt.key!=null&&et.set(Tt.key,me)}let st,mt=0;const q=He-Je+1;let ae=!1,_e=0;const Ye=new Array(q);for(me=0;me<q;me++)Ye[me]=0;for(me=Ue;me<=Ne;me++){const Tt=A[me];if(mt>=q){Ke(Tt,ce,re,!0);continue}let At;if(Tt.key!=null)At=et.get(Tt.key);else for(st=Je;st<=He;st++)if(Ye[st-Je]===0&&ai(Tt,M[st])){At=st;break}At===void 0?Ke(Tt,ce,re,!0):(Ye[At-Je]=me+1,At>=_e?_e=At:ae=!0,P(Tt,M[At],z,null,ce,re,je,Re,ke),mt++)}const bt=ae?eC(Ye):Di;for(st=bt.length-1,me=q-1;me>=0;me--){const Tt=Je+me,At=M[Tt],Br=M[Tt+1],zt=Tt+1<Ve?Br.el||lg(Br):Z;Ye[me]===0?P(null,At,z,zt,ce,re,je,Re,ke):ae&&(st<0||me!==bt[st]?Fe(At,z,zt,2):st--)}}},Fe=(A,M,z,Z,ce=null)=>{const{el:re,type:je,transition:Re,children:ke,shapeFlag:me}=A;if(me&6){Fe(A.component.subTree,M,z,Z);return}if(me&128){A.suspense.move(M,z,Z);return}if(me&64){je.move(A,M,z,Ee);return}if(je===ot){o(re,M,z);for(let Ne=0;Ne<ke.length;Ne++)Fe(ke[Ne],M,z,Z);o(A.anchor,M,z);return}if(je===Mu){U(A,M,z);return}if(Z!==2&&me&1&&Re)if(Z===0)Re.persisted&&!re[Zo]?o(re,M,z):(Re.beforeEnter(re),o(re,M,z),lo(()=>Re.enter(re),ce));else{const{leave:Ne,delayLeave:He,afterLeave:Ue}=Re,Je=()=>{A.ctx.isUnmounted?r(re):o(re,M,z)},et=()=>{const st=re._isLeaving||!!re[Zo];re._isLeaving&&re[Zo](!0),Re.persisted&&!st?Je():Ne(re,()=>{Je(),Ue&&Ue()})};He?He(re,Je,et):et()}else o(re,M,z)},Ke=(A,M,z,Z=!1,ce=!1)=>{const{type:re,props:je,ref:Re,children:ke,dynamicChildren:me,shapeFlag:Ve,patchFlag:Ne,dirs:He,cacheIndex:Ue,memo:Je}=A;if(Ne===-2&&(ce=!1),Re!=null&&(Da(),Ml(Re,null,z,A,!0),Fa()),Ue!=null&&(M.renderCache[Ue]=void 0),Ve&256){M.ctx.deactivate(A);return}const et=Ve&1&&He,st=!Ui(A);let mt;if(st&&(mt=je&&je.onVnodeBeforeUnmount)&&sa(mt,M,A),Ve&6)ut(A.component,z,Z);else{if(Ve&128){A.suspense.unmount(z,Z);return}et&&Qs(A,null,M,"beforeUnmount"),Ve&64?A.type.remove(A,M,z,Ee,Z):me&&!me.hasOnce&&(re!==ot||Ne>0&&Ne&64)?fe(me,M,z,!1,!0):(re===ot&&Ne&384||!ce&&Ve&16)&&fe(ke,M,z),Z&<(A)}const q=Je!=null&&Ue==null;(st&&(mt=je&&je.onVnodeUnmounted)||et||q)&&lo(()=>{mt&&sa(mt,M,A),et&&Qs(A,null,M,"unmounted"),q&&(A.el=null)},z)},lt=A=>{const{type:M,el:z,anchor:Z,transition:ce}=A;if(M===ot){Ze(z,Z);return}if(M===Mu){H(A);return}const re=()=>{r(z),ce&&!ce.persisted&&ce.afterLeave&&ce.afterLeave()};if(A.shapeFlag&1&&ce&&!ce.persisted){const{leave:je,delayLeave:Re}=ce,ke=()=>je(z,re);Re?Re(A.el,re,ke):ke()}else re()},Ze=(A,M)=>{let z;for(;A!==M;)z=f(A),r(A),A=z;r(M)},ut=(A,M,z)=>{const{bum:Z,scope:ce,job:re,subTree:je,um:Re,m:ke,a:me}=A;rh(ke),rh(me),Z&&Ru(Z),ce.stop(),re&&(re.flags|=8,Ke(je,A,M,z)),Re&&lo(Re,M),lo(()=>{A.isUnmounted=!0},M)},fe=(A,M,z,Z=!1,ce=!1,re=0)=>{for(let je=re;je<A.length;je++)Ke(A[je],M,z,Z,ce)},N=A=>{if(A.shapeFlag&6)return N(A.component.subTree);if(A.shapeFlag&128)return A.suspense.next();const M=f(A.anchor||A.el),z=M&&M[Dv];return z?f(z):M};let oe=!1;const ue=(A,M,z)=>{let Z;A==null?M._vnode&&(Ke(M._vnode,null,null,!0),Z=M._vnode.component):P(M._vnode||null,A,M,null,null,null,z),M._vnode=A,oe||(oe=!0,Hp(Z),jv(),oe=!1)},Ee={p:P,um:Ke,m:Fe,r:lt,mt:ne,mc:he,pc:de,pbc:Pe,n:N,o:e};return{render:ue,hydrate:void 0,createApp:OS(ue)}}function ld({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 Xs({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function ZS(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ef(e,t,n=!1){const o=e.children,r=t.children;if(nt(o)&&nt(r))for(let a=0;a<o.length;a++){const s=o[a];let i=r[a];i.shapeFlag&1&&!i.dynamicChildren&&((i.patchFlag<=0||i.patchFlag===32)&&(i=r[a]=ja(r[a]),i.el=s.el),!n&&i.patchFlag!==-2&&Ef(s,i)),i.type===dc&&(i.patchFlag===-1&&(i=r[a]=ja(i)),i.el=s.el),i.type===Qn&&!i.el&&(i.el=s.el)}}function eC(e){const t=e.slice(),n=[0];let o,r,a,s,i;const l=e.length;for(o=0;o<l;o++){const d=e[o];if(d!==0){if(r=n[n.length-1],e[r]<d){t[o]=r,n.push(o);continue}for(a=0,s=n.length-1;a<s;)i=a+s>>1,e[n[i]]<d?a=i+1:s=i;d<e[n[a]]&&(a>0&&(t[o]=n[a-1]),n[a]=o)}}for(a=n.length,s=n[a-1];a-- >0;)n[a]=s,s=t[s];return n}function ig(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:ig(t)}function rh(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function lg(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?lg(t.subTree):null}const ug=e=>e.__isSuspense;function tC(e,t){t&&t.pendingBranch?nt(e)?t.effects.push(...e):t.effects.push(e):aS(e)}const ot=Symbol.for("v-fgt"),dc=Symbol.for("v-txt"),Qn=Symbol.for("v-cmt"),Mu=Symbol.for("v-stc"),$a=[];let fo=null;function _(e=!1){$a.push(fo=e?null:[])}function Mf(){$a.pop(),fo=$a[$a.length-1]||null}let Yi=1;function zu(e,t=!1){Yi+=e,e<0&&fo&&t&&(fo.hasOnce=!0)}function cg(e){return e.dynamicChildren=Yi>0?fo||Di:null,Mf(),Yi>0&&fo&&fo.push(e),e}function F(e,t,n,o,r,a){return cg(w(e,t,n,o,r,a,!0))}function Qe(e,t,n,o,r){return cg(Oe(e,t,n,o,r,!0))}function Ul(e){return e?e.__v_isVNode===!0:!1}function ai(e,t){return e.type===t.type&&e.key===t.key}const dg=({key:e})=>e??null,ju=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Vt(e)||kn(e)||ft(e)?{i:On,r:e,k:t,f:!!n}:e:null);function w(e,t=null,n=null,o=0,r=null,a=e===ot?0:1,s=!1,i=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&dg(t),ref:t&&ju(t),scopeId:Nv,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:o,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:On};return i?(Hu(l,n),a&128&&e.normalize(l)):n&&(l.shapeFlag|=Vt(n)?8:16),Yi>0&&!s&&fo&&(l.patchFlag>0||a&6)&&l.patchFlag!==32&&fo.push(l),l}const Oe=nC;function nC(e,t=null,n=null,o=0,r=null,a=!1){if((!e||e===Gv)&&(e=Qn),Ul(e)){const i=ks(e,t,!0);return n&&Hu(i,n),Yi>0&&!a&&fo&&(i.shapeFlag&6?fo[fo.indexOf(e)]=i:fo.push(i)),i.patchFlag=-2,i}if(dC(e)&&(e=e.__vccOpts),t){t=oC(t);let{class:i,style:l}=t;i&&!Vt(i)&&(t.class=at(i)),jt(l)&&(kf(l)&&!nt(l)&&(l=pn({},l)),t.style=er(l))}const s=Vt(e)?1:ug(e)?128:Fv(e)?64:jt(e)?4:ft(e)?2:0;return w(e,t,n,o,r,s,a,!0)}function oC(e){return e?kf(e)||tg(e)?pn({},e):e:null}function ks(e,t,n=!1,o=!1){const{props:r,ref:a,patchFlag:s,children:i,transition:l}=e,d=t?jf(r||{},t):r,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:d,key:d&&dg(d),ref:t&&t.ref?n&&a?nt(a)?a.concat(ju(t)):[a,ju(t)]:ju(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:i,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==ot?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ks(e.ssContent),ssFallback:e.ssFallback&&ks(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&o&&Bl(c,l.clone(c)),c}function ws(e=" ",t=0){return Oe(dc,null,e,t)}function AD(e,t){const n=Oe(Mu,null,e);return n.staticCount=t,n}function ve(e="",t=!1){return t?(_(),Qe(Qn,null,e)):Oe(Qn,null,e)}function ua(e){return e==null||typeof e=="boolean"?Oe(Qn):nt(e)?Oe(ot,null,e.slice()):Ul(e)?ja(e):Oe(dc,null,String(e))}function ja(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ks(e)}function Hu(e,t){let n=0;const{shapeFlag:o}=e;if(t==null)t=null;else if(nt(t))n=16;else if(typeof t=="object")if(o&65){const r=t.default;r&&(r._c&&(r._d=!1),Hu(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!tg(t)?t._ctx=On:r===3&&On&&(On.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(ft(t)){if(o&65){Hu(e,{default:t});return}t={default:t,_ctx:On},n=32}else t=String(t),o&64?(n=16,t=[ws(t)]):n=8;e.children=t,e.shapeFlag|=n}function jf(...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=at([t.class,o.class]));else if(r==="style")t.style=er([t.style,o.style]);else if(tc(r)){const a=t[r],s=o[r];s&&a!==s&&!(nt(a)&&a.includes(s))?t[r]=a?[].concat(a,s):s:s==null&&a==null&&!nc(r)&&(t[r]=s)}else r!==""&&(t[r]=o[r])}return t}function sa(e,t,n,o=null){or(e,t,7,[n,o])}const rC=Jv();let aC=0;function sC(e,t,n){const o=e.type,r=(t?t.appContext:e.appContext)||rC,a={uid:aC++,vnode:e,type:o,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new RT(!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:og(o,r),emitsOptions:Qv(o,r),emit:null,emitted:null,propsDefaults:Dt,inheritAttrs:o.inheritAttrs,ctx:Dt,data:Dt,props:Dt,attrs:Dt,slots:Dt,refs:Dt,setupState:Dt,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=FS.bind(null,a),e.ce&&e.ce(a),a}let $n=null;const Lf=()=>$n||On;let qu,qd;{const e=sc(),t=(n,o)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(o),a=>{r.length>1?r.forEach(s=>s(a)):r[0](a)}};qu=t("__VUE_INSTANCE_SETTERS__",n=>$n=n),qd=t("__VUE_SSR_SETTERS__",n=>Ji=n)}const Ql=e=>{const t=$n;return qu(e),e.scope.on(),()=>{e.scope.off(),qu(t)}},ah=()=>{$n&&$n.scope.off(),qu(null)};function fg(e){return e.vnode.shapeFlag&4}let Ji=!1;function iC(e,t=!1,n=!1){t&&qd(t);const{props:o,children:r}=e.vnode,a=fg(e);WS(e,o,a,t),YS(e,r,n||t);const s=a?lC(e,t):void 0;return t&&qd(!1),s}function lC(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,_S);const{setup:o}=n;if(o){Da();const r=e.setupContext=o.length>1?hg(e):null,a=Ql(e),s=Vl(o,e,0,[e.props,r]),i=sv(s);if(Fa(),a(),(i||e.sp)&&!Ui(e)&&Af(e),i){if(s.then(ah,ah),t)return s.then(l=>{sh(e,l)}).catch(l=>{Kl(l,e,0)});e.asyncDep=s}else sh(e,s)}else pg(e)}function sh(e,t,n){ft(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:jt(t)&&(e.setupState=Rv(t)),pg(e)}function pg(e,t,n){const o=e.type;e.render||(e.render=o.render||ca);{const r=Ql(e);Da();try{ES(e)}finally{Fa(),r()}}}const uC={get(e,t){return Jn(e,"get",""),e[t]}};function hg(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,uC),slots:e.slots,emit:e.emit,expose:t}}function fc(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Rv(YT(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in jl)return jl[n](e)},has(t,n){return n in t||n in jl}})):e.proxy}function cC(e,t=!0){return ft(e)?e.displayName||e.name:e.name||t&&e.__name}function dC(e){return ft(e)&&"__vccOpts"in e}const K=(e,t)=>eS(e,t,Ji);function Nf(e,t,n){try{zu(-1);const o=arguments.length;return o===2?jt(t)&&!nt(t)?Ul(t)?Oe(e,null,[t]):Oe(e,t):Oe(e,null,t):(o>3?n=Array.prototype.slice.call(arguments,2):o===3&&Ul(n)&&(n=[n]),Oe(e,t,n))}finally{zu(1)}}function _D(e,t,n,o){const r=n[o];if(r&&fC(r,e))return r;const a=t();return a.memo=e.slice(),a.cacheIndex=o,n[o]=a}function fC(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let o=0;o<n.length;o++)if(Rr(n[o],t[o]))return!1;return Yi>0&&fo&&fo.push(e),!0}const pC="3.5.40";/**
|
|
15
15
|
* @vue/runtime-dom v3.5.40
|
|
16
16
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
17
17
|
* @license MIT
|
|
18
|
-
**/let Wd;const ih=typeof window<"u"&&window.trustedTypes;if(ih)try{Wd=ih.createPolicy("vue",{createHTML:e=>e})}catch{}const mg=Wd?e=>Wd.createHTML(e):e=>e,hC="http://www.w3.org/2000/svg",mC="http://www.w3.org/1998/Math/MathML",Ma=typeof document<"u"?document:null,lh=Ma&&Ma.createElement("template"),vC={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"?Ma.createElementNS(hC,e):t==="mathml"?Ma.createElementNS(mC,e):n?Ma.createElement(e,{is:n}):Ma.createElement(e);return e==="select"&&o&&o.multiple!=null&&r.setAttribute("multiple",o.multiple),r},createText:e=>Ma.createTextNode(e),createComment:e=>Ma.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ma.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,o,r,a){const s=n?n.previousSibling:t.lastChild;if(r&&(r===a||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===a||!(r=r.nextSibling)););else{lh.innerHTML=mg(o==="svg"?`<svg>${e}</svg>`:o==="mathml"?`<math>${e}</math>`:e);const i=lh.content;if(o==="svg"||o==="mathml"){const l=i.firstChild;for(;l.firstChild;)i.appendChild(l.firstChild);i.removeChild(l)}t.insertBefore(i,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},ds="transition",Sl="animation",zl=Symbol("_vtc"),vg={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},gC=pn({},Bv,vg),yC=e=>(e.displayName="Transition",e.props=gC,e),Xl=yC((e,{slots:t})=>Nf(hS,wC(e),t)),Zs=(e,t=[])=>{nt(e)?e.forEach(n=>n(...t)):e&&e(...t)},uh=e=>e?nt(e)?e.some(t=>t.length>1):e.length>1:!1;function wC(e){const t={};for(const Y in e)Y in vg||(t[Y]=e[Y]);if(e.css===!1)return t;const{name:n="v",type:o,duration:r,enterFromClass:a=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:i=`${n}-enter-to`,appearFromClass:l=a,appearActiveClass:d=s,appearToClass:c=i,leaveFromClass:v=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:b=`${n}-leave-to`}=e,y=bC(r),P=y&&y[0],B=y&&y[1],{onBeforeEnter:L,onEnter:j,onEnterCancelled:U,onLeave:H,onLeaveCancelled:be,onBeforeAppear:le=L,onAppear:W=j,onAppearCancelled:he=U}=t,Se=(Y,pe,ne,xe)=>{Y._enterCancelled=xe,ei(Y,pe?c:i),ei(Y,pe?d:s),ne&&ne()},Pe=(Y,pe)=>{Y._isLeaving=!1,ei(Y,v),ei(Y,b),ei(Y,f),pe&&pe()},ge=Y=>(pe,ne)=>{const xe=Y?W:j,$e=()=>Se(pe,Y,ne);Zs(xe,[pe,$e]),ch(()=>{ei(pe,Y?l:a),Pa(pe,Y?c:i),uh(xe)||dh(pe,o,P,$e)})};return pn(t,{onBeforeEnter(Y){Zs(L,[Y]),Pa(Y,a),Pa(Y,s)},onBeforeAppear(Y){Zs(le,[Y]),Pa(Y,l),Pa(Y,d)},onEnter:ge(!1),onAppear:ge(!0),onLeave(Y,pe){Y._isLeaving=!0;const ne=()=>Pe(Y,pe);Pa(Y,v),Y._enterCancelled?(Pa(Y,f),hh(Y)):(hh(Y),Pa(Y,f)),ch(()=>{Y._isLeaving&&(ei(Y,v),Pa(Y,b),uh(H)||dh(Y,o,B,ne))}),Zs(H,[Y,ne])},onEnterCancelled(Y){Se(Y,!1,void 0,!0),Zs(U,[Y])},onAppearCancelled(Y){Se(Y,!0,void 0,!0),Zs(he,[Y])},onLeaveCancelled(Y){Pe(Y),Zs(be,[Y])}})}function bC(e){if(e==null)return null;if(jt(e))return[ud(e.enter),ud(e.leave)];{const t=ud(e);return[t,t]}}function ud(e){return ST(e)}function Pa(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[zl]||(e[zl]=new Set)).add(t)}function ei(e,t){t.split(/\s+/).forEach(o=>o&&e.classList.remove(o));const n=e[zl];n&&(n.delete(t),n.size||(e[zl]=void 0))}function ch(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let TC=0;function dh(e,t,n,o){const r=e._endId=++TC,a=()=>{r===e._endId&&o()};if(n!=null)return setTimeout(a,n);const{type:s,timeout:i,propCount:l}=SC(e,t);if(!s)return o();const d=s+"end";let c=0;const v=()=>{e.removeEventListener(d,f),a()},f=b=>{b.target===e&&++c>=l&&v()};setTimeout(()=>{c<l&&v()},i+1),e.addEventListener(d,f)}function SC(e,t){const n=window.getComputedStyle(e),o=y=>(n[y]||"").split(", "),r=o(`${ds}Delay`),a=o(`${ds}Duration`),s=fh(r,a),i=o(`${Sl}Delay`),l=o(`${Sl}Duration`),d=fh(i,l);let c=null,v=0,f=0;t===ds?s>0&&(c=ds,v=s,f=a.length):t===Sl?d>0&&(c=Sl,v=d,f=l.length):(v=Math.max(s,d),c=v>0?s>d?ds:Sl:null,f=c?c===ds?a.length:l.length:0);const b=c===ds&&/\b(?:transform|all)(?:,|$)/.test(o(`${ds}Property`).toString());return{type:c,timeout:v,propCount:f,hasTransform:b}}function fh(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,o)=>ph(n)+ph(e[o])))}function ph(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function hh(e){return(e?e.ownerDocument:document).body.offsetHeight}function CC(e,t,n){const o=e[zl];o&&(t=(t?[t,...o]:[...o]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Wu=Symbol("_vod"),gg=Symbol("_vsh"),PD={name:"show",beforeMount(e,{value:t},{transition:n}){e[Wu]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Cl(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),Cl(e,!0),o.enter(e)):o.leave(e,()=>{Cl(e,!1)}):Cl(e,t))},beforeUnmount(e,{value:t}){Cl(e,t)}};function Cl(e,t){e.style.display=t?e[Wu]:"none",e[gg]=!t}const xC=Symbol(""),kC=/(?:^|;)\s*display\s*:/;function IC(e,t,n){const o=e.style,r=Vt(n);let a=!1;if(n&&!r){if(t)if(Vt(t))for(const s of t.split(";")){const i=s.slice(0,s.indexOf(":")).trim();n[i]==null&&Al(o,i,"")}else for(const s in t)n[s]==null&&Al(o,s,"");for(const s in n){s==="display"&&(a=!0);const i=n[s];i!=null?_C(e,s,!Vt(t)&&t?t[s]:void 0,i)||Al(o,s,i):Al(o,s,"")}}else if(r){if(t!==n){const s=o[xC];s&&(n+=";"+s),o.cssText=n,a=kC.test(n)}}else t&&e.removeAttribute("style");Wu in e&&(e[Wu]=a?o.display:"",e[gg]&&(o.display="none"))}const mh=/\s*!important$/;function Al(e,t,n){if(nt(n))n.forEach(o=>Al(e,t,o));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const o=AC(e,t);mh.test(n)?e.setProperty(As(o),n.replace(mh,""),"important"):e[o]=n}}const vh=["Webkit","Moz","ms"],cd={};function AC(e,t){const n=cd[t];if(n)return n;let o=po(t);if(o!=="filter"&&o in e)return cd[t]=o;o=ac(o);for(let r=0;r<vh.length;r++){const a=vh[r]+o;if(a in e)return cd[t]=a}return t}function _C(e,t,n,o){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Vt(o)&&n===o}const gh="http://www.w3.org/1999/xlink";function yh(e,t,n,o,r,a=_T(t)){o&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(gh,t.slice(6,t.length)):e.setAttributeNS(gh,t,n):n==null||a&&!cv(n)?e.removeAttribute(t):e.setAttribute(t,a?"":$r(n)?String(n):n)}function wh(e,t,n,o,r){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?mg(n):n);return}const a=e.tagName;if(t==="value"&&a!=="PROGRESS"&&!a.includes("-")){const i=a==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(i!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const i=typeof e[t];i==="boolean"?n=cv(n):n==null&&i==="string"?(n="",s=!0):i==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(r||t)}function si(e,t,n,o){e.addEventListener(t,n,o)}function PC(e,t,n,o){e.removeEventListener(t,n,o)}const bh=Symbol("_vei");function RC(e,t,n,o,r=null){const a=e[bh]||(e[bh]={}),s=a[t];if(o&&s)s.value=o;else{const[i,l]=jC(t);if(o){const d=a[t]=$C(o,r);si(e,i,d,l)}else s&&(PC(e,i,s,l),a[t]=void 0)}}const EC=/(Once|Passive|Capture)$/,MC=/^on:?(?:Once|Passive|Capture)$/;function jC(e){let t,n;for(;(n=e.match(EC))&&!MC.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):As(e.slice(2)),t]}let dd=0;const LC=Promise.resolve(),NC=()=>dd||(LC.then(()=>dd=0),dd=Date.now());function $C(e,t){const n=o=>{if(!o._vts)o._vts=Date.now();else if(o._vts<=n.attached)return;const r=n.value;if(nt(r)){const a=o.stopImmediatePropagation;o.stopImmediatePropagation=()=>{a.call(o),o._stopped=!0};const s=r.slice(),i=[o];for(let l=0;l<s.length&&!o._stopped;l++){const d=s[l];d&&or(d,t,5,i)}}else or(r,t,5,[o])};return n.value=e,n.attached=NC(),n}const Th=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,OC=(e,t,n,o,r,a)=>{const s=r==="svg";t==="class"?CC(e,o,s):t==="style"?IC(e,n,o):tc(t)?nc(t)||RC(e,t,n,o,a):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):DC(e,t,o,s))?(wh(e,t,o),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&yh(e,t,o,s,a,t!=="value")):e._isVueCE&&(FC(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Vt(o)))?wh(e,po(t),o,a,t):(t==="true-value"?e._trueValue=o:t==="false-value"&&(e._falseValue=o),yh(e,t,o,s))};function DC(e,t,n,o){if(o)return!!(t==="innerHTML"||t==="textContent"||t in e&&Th(t)&&ft(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 Th(t)&&Vt(n)?!1:t in e}function FC(e,t){const n=e._def.props;if(!n)return!1;const o=po(t);return Array.isArray(n)?n.some(r=>po(r)===o):Object.keys(n).some(r=>po(r)===o)}const Gu=e=>{const t=e.props["onUpdate:modelValue"]||!1;return nt(t)?n=>Ru(t,n):t};function BC(e){e.target.composing=!0}function Sh(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Hi=Symbol("_assign");function Ch(e,t,n){return t&&(e=e.trim()),n&&(e=yf(e)),e}const Nn={created(e,{modifiers:{lazy:t,trim:n,number:o}},r){e[Hi]=Gu(r);const a=o||r.props&&r.props.type==="number";si(e,t?"change":"input",s=>{s.target.composing||e[Hi](Ch(e.value,n,a))}),(n||a)&&si(e,"change",()=>{e.value=Ch(e.value,n,a)}),t||(si(e,"compositionstart",BC),si(e,"compositionend",Sh),si(e,"change",Sh))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:o,trim:r,number:a}},s){if(e[Hi]=Gu(s),e.composing)return;const i=(a||e.type==="number")&&!/^0\d/.test(e.value)?yf(e.value):e.value,l=t??"";if(i===l)return;const d=e.getRootNode();(d instanceof Document||d instanceof ShadowRoot)&&d.activeElement===e&&e.type!=="range"&&(o&&t===n||r&&e.value.trim()===l)||(e.value=l)}},UC={deep:!0,created(e,t,n){e[Hi]=Gu(n),si(e,"change",()=>{const o=e._modelValue,r=zC(e),a=e.checked,s=e[Hi];if(nt(o)){const i=dv(o,r),l=i!==-1;if(a&&!l)s(o.concat(r));else if(!a&&l){const d=[...o];d.splice(i,1),s(d)}}else if(oc(o)){const i=new Set(o);a?i.add(r):i.delete(r),s(i)}else s(yg(e,a))})},mounted:xh,beforeUpdate(e,t,n){e[Hi]=Gu(n),xh(e,t,n)}};function xh(e,{value:t,oldValue:n},o){e._modelValue=t;let r;if(nt(t))r=dv(t,o.props.value)>-1;else if(oc(t))r=t.has(o.props.value);else{if(t===n)return;r=Gl(t,yg(e,!0))}e.checked!==r&&(e.checked=r)}function zC(e){return"_value"in e?e._value:e.value}function yg(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const HC=["ctrl","shift","alt","meta"],qC={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)=>HC.some(n=>e[`${n}Key`]&&!t.includes(n))},gt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),o=t.join(".");return n[o]||(n[o]=(r,...a)=>{for(let s=0;s<t.length;s++){const i=qC[t[s]];if(i&&i(r,t))return}return e(r,...a)})},WC={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Ao=(e,t)=>{const n=e._withKeys||(e._withKeys={}),o=t.join(".");return n[o]||(n[o]=r=>{if(!("key"in r))return;const a=As(r.key);if(t.some(s=>s===a||WC[s]===a))return e(r)})},GC=pn({patchProp:OC},vC);let kh;function VC(){return kh||(kh=QS(GC))}const KC=(...e)=>{const t=VC().createApp(...e),{mount:n}=t;return t.mount=o=>{const r=JC(o);if(!r)return;const a=t._component;!ft(a)&&!a.render&&!a.template&&(a.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const s=n(r,!1,YC(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),s},t};function YC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function JC(e){return Vt(e)?document.querySelector(e):e}const QC="modulepreload",XC=function(e){return"/"+e},Ih={},_r=function(t,n,o){let r=Promise.resolve();if(n&&n.length>0){let s=function(d){return Promise.all(d.map(c=>Promise.resolve(c).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));r=s(n.map(d=>{if(d=XC(d),d in Ih)return;Ih[d]=!0;const c=d.endsWith(".css"),v=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${v}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":QC,c||(f.as="script"),f.crossOrigin="",f.href=d,l&&f.setAttribute("nonce",l),document.head.appendChild(f),c)return new Promise((b,y)=>{f.addEventListener("load",b),f.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${d}`)))})}))}function a(s){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=s,window.dispatchEvent(i),!i.defaultPrevented)throw s}return r.then(s=>{for(const i of s||[])i.status==="rejected"&&a(i.reason);return t().catch(a)})};/*!
|
|
18
|
+
**/let Wd;const ih=typeof window<"u"&&window.trustedTypes;if(ih)try{Wd=ih.createPolicy("vue",{createHTML:e=>e})}catch{}const mg=Wd?e=>Wd.createHTML(e):e=>e,hC="http://www.w3.org/2000/svg",mC="http://www.w3.org/1998/Math/MathML",Ma=typeof document<"u"?document:null,lh=Ma&&Ma.createElement("template"),vC={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"?Ma.createElementNS(hC,e):t==="mathml"?Ma.createElementNS(mC,e):n?Ma.createElement(e,{is:n}):Ma.createElement(e);return e==="select"&&o&&o.multiple!=null&&r.setAttribute("multiple",o.multiple),r},createText:e=>Ma.createTextNode(e),createComment:e=>Ma.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ma.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,o,r,a){const s=n?n.previousSibling:t.lastChild;if(r&&(r===a||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===a||!(r=r.nextSibling)););else{lh.innerHTML=mg(o==="svg"?`<svg>${e}</svg>`:o==="mathml"?`<math>${e}</math>`:e);const i=lh.content;if(o==="svg"||o==="mathml"){const l=i.firstChild;for(;l.firstChild;)i.appendChild(l.firstChild);i.removeChild(l)}t.insertBefore(i,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},ds="transition",Sl="animation",zl=Symbol("_vtc"),vg={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},gC=pn({},Bv,vg),yC=e=>(e.displayName="Transition",e.props=gC,e),Xl=yC((e,{slots:t})=>Nf(hS,wC(e),t)),Zs=(e,t=[])=>{nt(e)?e.forEach(n=>n(...t)):e&&e(...t)},uh=e=>e?nt(e)?e.some(t=>t.length>1):e.length>1:!1;function wC(e){const t={};for(const Y in e)Y in vg||(t[Y]=e[Y]);if(e.css===!1)return t;const{name:n="v",type:o,duration:r,enterFromClass:a=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:i=`${n}-enter-to`,appearFromClass:l=a,appearActiveClass:d=s,appearToClass:c=i,leaveFromClass:v=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:b=`${n}-leave-to`}=e,y=bC(r),P=y&&y[0],B=y&&y[1],{onBeforeEnter:L,onEnter:j,onEnterCancelled:U,onLeave:H,onLeaveCancelled:be,onBeforeAppear:le=L,onAppear:W=j,onAppearCancelled:he=U}=t,Se=(Y,pe,ne,xe)=>{Y._enterCancelled=xe,ei(Y,pe?c:i),ei(Y,pe?d:s),ne&&ne()},Pe=(Y,pe)=>{Y._isLeaving=!1,ei(Y,v),ei(Y,b),ei(Y,f),pe&&pe()},ye=Y=>(pe,ne)=>{const xe=Y?W:j,$e=()=>Se(pe,Y,ne);Zs(xe,[pe,$e]),ch(()=>{ei(pe,Y?l:a),Pa(pe,Y?c:i),uh(xe)||dh(pe,o,P,$e)})};return pn(t,{onBeforeEnter(Y){Zs(L,[Y]),Pa(Y,a),Pa(Y,s)},onBeforeAppear(Y){Zs(le,[Y]),Pa(Y,l),Pa(Y,d)},onEnter:ye(!1),onAppear:ye(!0),onLeave(Y,pe){Y._isLeaving=!0;const ne=()=>Pe(Y,pe);Pa(Y,v),Y._enterCancelled?(Pa(Y,f),hh(Y)):(hh(Y),Pa(Y,f)),ch(()=>{Y._isLeaving&&(ei(Y,v),Pa(Y,b),uh(H)||dh(Y,o,B,ne))}),Zs(H,[Y,ne])},onEnterCancelled(Y){Se(Y,!1,void 0,!0),Zs(U,[Y])},onAppearCancelled(Y){Se(Y,!0,void 0,!0),Zs(he,[Y])},onLeaveCancelled(Y){Pe(Y),Zs(be,[Y])}})}function bC(e){if(e==null)return null;if(jt(e))return[ud(e.enter),ud(e.leave)];{const t=ud(e);return[t,t]}}function ud(e){return ST(e)}function Pa(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[zl]||(e[zl]=new Set)).add(t)}function ei(e,t){t.split(/\s+/).forEach(o=>o&&e.classList.remove(o));const n=e[zl];n&&(n.delete(t),n.size||(e[zl]=void 0))}function ch(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let TC=0;function dh(e,t,n,o){const r=e._endId=++TC,a=()=>{r===e._endId&&o()};if(n!=null)return setTimeout(a,n);const{type:s,timeout:i,propCount:l}=SC(e,t);if(!s)return o();const d=s+"end";let c=0;const v=()=>{e.removeEventListener(d,f),a()},f=b=>{b.target===e&&++c>=l&&v()};setTimeout(()=>{c<l&&v()},i+1),e.addEventListener(d,f)}function SC(e,t){const n=window.getComputedStyle(e),o=y=>(n[y]||"").split(", "),r=o(`${ds}Delay`),a=o(`${ds}Duration`),s=fh(r,a),i=o(`${Sl}Delay`),l=o(`${Sl}Duration`),d=fh(i,l);let c=null,v=0,f=0;t===ds?s>0&&(c=ds,v=s,f=a.length):t===Sl?d>0&&(c=Sl,v=d,f=l.length):(v=Math.max(s,d),c=v>0?s>d?ds:Sl:null,f=c?c===ds?a.length:l.length:0);const b=c===ds&&/\b(?:transform|all)(?:,|$)/.test(o(`${ds}Property`).toString());return{type:c,timeout:v,propCount:f,hasTransform:b}}function fh(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,o)=>ph(n)+ph(e[o])))}function ph(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function hh(e){return(e?e.ownerDocument:document).body.offsetHeight}function CC(e,t,n){const o=e[zl];o&&(t=(t?[t,...o]:[...o]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Wu=Symbol("_vod"),gg=Symbol("_vsh"),PD={name:"show",beforeMount(e,{value:t},{transition:n}){e[Wu]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Cl(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),Cl(e,!0),o.enter(e)):o.leave(e,()=>{Cl(e,!1)}):Cl(e,t))},beforeUnmount(e,{value:t}){Cl(e,t)}};function Cl(e,t){e.style.display=t?e[Wu]:"none",e[gg]=!t}const xC=Symbol(""),kC=/(?:^|;)\s*display\s*:/;function IC(e,t,n){const o=e.style,r=Vt(n);let a=!1;if(n&&!r){if(t)if(Vt(t))for(const s of t.split(";")){const i=s.slice(0,s.indexOf(":")).trim();n[i]==null&&Al(o,i,"")}else for(const s in t)n[s]==null&&Al(o,s,"");for(const s in n){s==="display"&&(a=!0);const i=n[s];i!=null?_C(e,s,!Vt(t)&&t?t[s]:void 0,i)||Al(o,s,i):Al(o,s,"")}}else if(r){if(t!==n){const s=o[xC];s&&(n+=";"+s),o.cssText=n,a=kC.test(n)}}else t&&e.removeAttribute("style");Wu in e&&(e[Wu]=a?o.display:"",e[gg]&&(o.display="none"))}const mh=/\s*!important$/;function Al(e,t,n){if(nt(n))n.forEach(o=>Al(e,t,o));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const o=AC(e,t);mh.test(n)?e.setProperty(As(o),n.replace(mh,""),"important"):e[o]=n}}const vh=["Webkit","Moz","ms"],cd={};function AC(e,t){const n=cd[t];if(n)return n;let o=po(t);if(o!=="filter"&&o in e)return cd[t]=o;o=ac(o);for(let r=0;r<vh.length;r++){const a=vh[r]+o;if(a in e)return cd[t]=a}return t}function _C(e,t,n,o){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Vt(o)&&n===o}const gh="http://www.w3.org/1999/xlink";function yh(e,t,n,o,r,a=_T(t)){o&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(gh,t.slice(6,t.length)):e.setAttributeNS(gh,t,n):n==null||a&&!cv(n)?e.removeAttribute(t):e.setAttribute(t,a?"":$r(n)?String(n):n)}function wh(e,t,n,o,r){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?mg(n):n);return}const a=e.tagName;if(t==="value"&&a!=="PROGRESS"&&!a.includes("-")){const i=a==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(i!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const i=typeof e[t];i==="boolean"?n=cv(n):n==null&&i==="string"?(n="",s=!0):i==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(r||t)}function si(e,t,n,o){e.addEventListener(t,n,o)}function PC(e,t,n,o){e.removeEventListener(t,n,o)}const bh=Symbol("_vei");function RC(e,t,n,o,r=null){const a=e[bh]||(e[bh]={}),s=a[t];if(o&&s)s.value=o;else{const[i,l]=jC(t);if(o){const d=a[t]=$C(o,r);si(e,i,d,l)}else s&&(PC(e,i,s,l),a[t]=void 0)}}const EC=/(Once|Passive|Capture)$/,MC=/^on:?(?:Once|Passive|Capture)$/;function jC(e){let t,n;for(;(n=e.match(EC))&&!MC.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):As(e.slice(2)),t]}let dd=0;const LC=Promise.resolve(),NC=()=>dd||(LC.then(()=>dd=0),dd=Date.now());function $C(e,t){const n=o=>{if(!o._vts)o._vts=Date.now();else if(o._vts<=n.attached)return;const r=n.value;if(nt(r)){const a=o.stopImmediatePropagation;o.stopImmediatePropagation=()=>{a.call(o),o._stopped=!0};const s=r.slice(),i=[o];for(let l=0;l<s.length&&!o._stopped;l++){const d=s[l];d&&or(d,t,5,i)}}else or(r,t,5,[o])};return n.value=e,n.attached=NC(),n}const Th=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,OC=(e,t,n,o,r,a)=>{const s=r==="svg";t==="class"?CC(e,o,s):t==="style"?IC(e,n,o):tc(t)?nc(t)||RC(e,t,n,o,a):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):DC(e,t,o,s))?(wh(e,t,o),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&yh(e,t,o,s,a,t!=="value")):e._isVueCE&&(FC(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Vt(o)))?wh(e,po(t),o,a,t):(t==="true-value"?e._trueValue=o:t==="false-value"&&(e._falseValue=o),yh(e,t,o,s))};function DC(e,t,n,o){if(o)return!!(t==="innerHTML"||t==="textContent"||t in e&&Th(t)&&ft(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 Th(t)&&Vt(n)?!1:t in e}function FC(e,t){const n=e._def.props;if(!n)return!1;const o=po(t);return Array.isArray(n)?n.some(r=>po(r)===o):Object.keys(n).some(r=>po(r)===o)}const Gu=e=>{const t=e.props["onUpdate:modelValue"]||!1;return nt(t)?n=>Ru(t,n):t};function BC(e){e.target.composing=!0}function Sh(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Hi=Symbol("_assign");function Ch(e,t,n){return t&&(e=e.trim()),n&&(e=yf(e)),e}const Nn={created(e,{modifiers:{lazy:t,trim:n,number:o}},r){e[Hi]=Gu(r);const a=o||r.props&&r.props.type==="number";si(e,t?"change":"input",s=>{s.target.composing||e[Hi](Ch(e.value,n,a))}),(n||a)&&si(e,"change",()=>{e.value=Ch(e.value,n,a)}),t||(si(e,"compositionstart",BC),si(e,"compositionend",Sh),si(e,"change",Sh))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:o,trim:r,number:a}},s){if(e[Hi]=Gu(s),e.composing)return;const i=(a||e.type==="number")&&!/^0\d/.test(e.value)?yf(e.value):e.value,l=t??"";if(i===l)return;const d=e.getRootNode();(d instanceof Document||d instanceof ShadowRoot)&&d.activeElement===e&&e.type!=="range"&&(o&&t===n||r&&e.value.trim()===l)||(e.value=l)}},UC={deep:!0,created(e,t,n){e[Hi]=Gu(n),si(e,"change",()=>{const o=e._modelValue,r=zC(e),a=e.checked,s=e[Hi];if(nt(o)){const i=dv(o,r),l=i!==-1;if(a&&!l)s(o.concat(r));else if(!a&&l){const d=[...o];d.splice(i,1),s(d)}}else if(oc(o)){const i=new Set(o);a?i.add(r):i.delete(r),s(i)}else s(yg(e,a))})},mounted:xh,beforeUpdate(e,t,n){e[Hi]=Gu(n),xh(e,t,n)}};function xh(e,{value:t,oldValue:n},o){e._modelValue=t;let r;if(nt(t))r=dv(t,o.props.value)>-1;else if(oc(t))r=t.has(o.props.value);else{if(t===n)return;r=Gl(t,yg(e,!0))}e.checked!==r&&(e.checked=r)}function zC(e){return"_value"in e?e._value:e.value}function yg(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const HC=["ctrl","shift","alt","meta"],qC={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)=>HC.some(n=>e[`${n}Key`]&&!t.includes(n))},gt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),o=t.join(".");return n[o]||(n[o]=(r,...a)=>{for(let s=0;s<t.length;s++){const i=qC[t[s]];if(i&&i(r,t))return}return e(r,...a)})},WC={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Ao=(e,t)=>{const n=e._withKeys||(e._withKeys={}),o=t.join(".");return n[o]||(n[o]=r=>{if(!("key"in r))return;const a=As(r.key);if(t.some(s=>s===a||WC[s]===a))return e(r)})},GC=pn({patchProp:OC},vC);let kh;function VC(){return kh||(kh=QS(GC))}const KC=(...e)=>{const t=VC().createApp(...e),{mount:n}=t;return t.mount=o=>{const r=JC(o);if(!r)return;const a=t._component;!ft(a)&&!a.render&&!a.template&&(a.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const s=n(r,!1,YC(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),s},t};function YC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function JC(e){return Vt(e)?document.querySelector(e):e}const QC="modulepreload",XC=function(e){return"/"+e},Ih={},_r=function(t,n,o){let r=Promise.resolve();if(n&&n.length>0){let s=function(d){return Promise.all(d.map(c=>Promise.resolve(c).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));r=s(n.map(d=>{if(d=XC(d),d in Ih)return;Ih[d]=!0;const c=d.endsWith(".css"),v=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${v}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":QC,c||(f.as="script"),f.crossOrigin="",f.href=d,l&&f.setAttribute("nonce",l),document.head.appendChild(f),c)return new Promise((b,y)=>{f.addEventListener("load",b),f.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${d}`)))})}))}function a(s){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=s,window.dispatchEvent(i),!i.defaultPrevented)throw s}return r.then(s=>{for(const i of s||[])i.status==="rejected"&&a(i.reason);return t().catch(a)})};/*!
|
|
19
19
|
* vue-router v4.6.4
|
|
20
20
|
* (c) 2025 Eduardo San Martin Morote
|
|
21
21
|
* @license MIT
|
|
@@ -23,7 +23,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversat
|
|
|
23
23
|
* vue-router v4.6.4
|
|
24
24
|
* (c) 2025 Eduardo San Martin Morote
|
|
25
25
|
* @license MIT
|
|
26
|
-
*/let j0=()=>location.protocol+"//"+location.host;function _g(e,t){const{pathname:n,search:o,hash:r}=t,a=e.indexOf("#");if(a>-1){let s=r.includes(e.slice(a))?e.slice(a).length:1,i=r.slice(s);return i[0]!=="/"&&(i="/"+i),_h(i,"")}return _h(n,e)+o+r}function L0(e,t,n,o){let r=[],a=[],s=null;const i=({state:f})=>{const b=_g(e,location),y=n.value,P=t.value;let B=0;if(f){if(n.value=b,t.value=f,s&&s===y){s=null;return}B=P?f.position-P.position:0}else o(b);r.forEach(L=>{L(n.value,y,{delta:B,type:Vd.pop,direction:B?B>0?hd.forward:hd.back:hd.unknown})})};function l(){s=n.value}function d(f){r.push(f);const b=()=>{const y=r.indexOf(f);y>-1&&r.splice(y,1)};return a.push(b),b}function c(){if(document.visibilityState==="hidden"){const{history:f}=window;if(!f.state)return;f.replaceState(Et({},f.state,{scroll:pc()}),"")}}function v(){for(const f of a)f();a=[],window.removeEventListener("popstate",i),window.removeEventListener("pagehide",c),document.removeEventListener("visibilitychange",c)}return window.addEventListener("popstate",i),window.addEventListener("pagehide",c),document.addEventListener("visibilitychange",c),{pauseListeners:l,listen:d,destroy:v}}function jh(e,t,n,o=!1,r=!1){return{back:e,current:t,forward:n,replaced:o,position:window.history.length,scroll:r?pc():null}}function N0(e){const{history:t,location:n}=window,o={value:_g(e,n)},r={value:t.state};r.value||a(o.value,{back:null,current:o.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(l,d,c){const v=e.indexOf("#"),f=v>-1?(n.host&&document.querySelector("base")?e:e.slice(v))+l:j0()+e+l;try{t[c?"replaceState":"pushState"](d,"",f),r.value=d}catch(b){console.error(b),n[c?"replace":"assign"](f)}}function s(l,d){a(l,Et({},t.state,jh(r.value.back,l,r.value.forward,!0),d,{position:r.value.position}),!0),o.value=l}function i(l,d){const c=Et({},r.value,t.state,{forward:l,scroll:pc()});a(c.current,c,!0),a(l,Et({},jh(o.value,l,null),{position:c.position+1},d),!1),o.value=l}return{location:o,state:r,push:i,replace:s}}function $0(e){e=w0(e);const t=N0(e),n=L0(e,t.state,t.location,t.replace);function o(a,s=!0){s||n.pauseListeners(),history.go(a)}const r=Et({location:"",base:e,go:o,createHref:T0.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 O0(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),$0(e)}let ii=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var wn=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}(wn||{});const D0={type:ii.Static,value:""},F0=/[a-zA-Z0-9_]/;function B0(e){if(!e)return[[]];if(e==="/")return[[D0]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(b){throw new Error(`ERR (${n})/"${d}": ${b}`)}let n=wn.Static,o=n;const r=[];let a;function s(){a&&r.push(a),a=[]}let i=0,l,d="",c="";function v(){d&&(n===wn.Static?a.push({type:ii.Static,value:d}):n===wn.Param||n===wn.ParamRegExp||n===wn.ParamRegExpEnd?(a.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),a.push({type:ii.Param,value:d,regexp:c,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),d="")}function f(){d+=l}for(;i<e.length;){if(l=e[i++],l==="\\"&&n!==wn.ParamRegExp){o=n,n=wn.EscapeNext;continue}switch(n){case wn.Static:l==="/"?(d&&v(),s()):l===":"?(v(),n=wn.Param):f();break;case wn.EscapeNext:f(),n=o;break;case wn.Param:l==="("?n=wn.ParamRegExp:F0.test(l)?f():(v(),n=wn.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--);break;case wn.ParamRegExp:l===")"?c[c.length-1]=="\\"?c=c.slice(0,-1)+l:n=wn.ParamRegExpEnd:c+=l;break;case wn.ParamRegExpEnd:v(),n=wn.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--,c="";break;default:t("Unknown state");break}}return n===wn.ParamRegExp&&t(`Unfinished custom RegExp for param "${d}"`),v(),s(),r}const Lh="[^/]+?",U0={sensitive:!1,strict:!1,start:!0,end:!0};var uo=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}(uo||{});const z0=/[.+*?^${}()[\]/\\]/g;function H0(e,t){const n=Et({},U0,t),o=[];let r=n.start?"^":"";const a=[];for(const d of e){const c=d.length?[]:[uo.Root];n.strict&&!d.length&&(r+="/");for(let v=0;v<d.length;v++){const f=d[v];let b=uo.Segment+(n.sensitive?uo.BonusCaseSensitive:0);if(f.type===ii.Static)v||(r+="/"),r+=f.value.replace(z0,"\\$&"),b+=uo.Static;else if(f.type===ii.Param){const{value:y,repeatable:P,optional:B,regexp:L}=f;a.push({name:y,repeatable:P,optional:B});const j=L||Lh;if(j!==Lh){b+=uo.BonusCustomRegExp;try{`${j}`}catch(H){throw new Error(`Invalid custom RegExp for param "${y}" (${j}): `+H.message)}}let U=P?`((?:${j})(?:/(?:${j}))*)`:`(${j})`;v||(U=B&&d.length<2?`(?:/${U})`:"/"+U),B&&(U+="?"),r+=U,b+=uo.Dynamic,B&&(b+=uo.BonusOptional),P&&(b+=uo.BonusRepeatable),j===".*"&&(b+=uo.BonusWildcard)}c.push(b)}o.push(c)}if(n.strict&&n.end){const d=o.length-1;o[d][o[d].length-1]+=uo.BonusStrict}n.strict||(r+="/?"),n.end?r+="$":n.strict&&!r.endsWith("/")&&(r+="(?:/|$)");const s=new RegExp(r,n.sensitive?"":"i");function i(d){const c=d.match(s),v={};if(!c)return null;for(let f=1;f<c.length;f++){const b=c[f]||"",y=a[f-1];v[y.name]=b&&y.repeatable?b.split("/"):b}return v}function l(d){let c="",v=!1;for(const f of e){(!v||!c.endsWith("/"))&&(c+="/"),v=!1;for(const b of f)if(b.type===ii.Static)c+=b.value;else if(b.type===ii.Param){const{value:y,repeatable:P,optional:B}=b,L=y in d?d[y]:"";if(Dr(L)&&!P)throw new Error(`Provided param "${y}" is an array but it is not repeatable (* or + modifiers)`);const j=Dr(L)?L.join("/"):L;if(!j)if(B)f.length<2&&(c.endsWith("/")?c=c.slice(0,-1):v=!0);else throw new Error(`Missing required param "${y}"`);c+=j}}return c||"/"}return{re:s,score:o,keys:a,parse:i,stringify:l}}function q0(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]===uo.Static+uo.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===uo.Static+uo.Segment?1:-1:0}function Pg(e,t){let n=0;const o=e.score,r=t.score;for(;n<o.length&&n<r.length;){const a=q0(o[n],r[n]);if(a)return a;n++}if(Math.abs(r.length-o.length)===1){if(Nh(o))return 1;if(Nh(r))return-1}return r.length-o.length}function Nh(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const W0={strict:!1,end:!0,sensitive:!1};function G0(e,t,n){const o=H0(B0(e.path),n),r=Et(o,{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function V0(e,t){const n=[],o=new Map;t=Ah(W0,t);function r(v){return o.get(v)}function a(v,f,b){const y=!b,P=Oh(v);P.aliasOf=b&&b.record;const B=Ah(t,v),L=[P];if("alias"in v){const H=typeof v.alias=="string"?[v.alias]:v.alias;for(const be of H)L.push(Oh(Et({},P,{components:b?b.record.components:P.components,path:be,aliasOf:b?b.record:P})))}let j,U;for(const H of L){const{path:be}=H;if(f&&be[0]!=="/"){const le=f.record.path,W=le[le.length-1]==="/"?"":"/";H.path=f.record.path+(be&&W+be)}if(j=G0(H,f,B),b?b.alias.push(j):(U=U||j,U!==j&&U.alias.push(j),y&&v.name&&!Dh(j)&&s(v.name)),Rg(j)&&l(j),P.children){const le=P.children;for(let W=0;W<le.length;W++)a(le[W],j,b&&b.children[W])}b=b||j}return U?()=>{s(U)}:Ll}function s(v){if(Ig(v)){const f=o.get(v);f&&(o.delete(v),n.splice(n.indexOf(f),1),f.children.forEach(s),f.alias.forEach(s))}else{const f=n.indexOf(v);f>-1&&(n.splice(f,1),v.record.name&&o.delete(v.record.name),v.children.forEach(s),v.alias.forEach(s))}}function i(){return n}function l(v){const f=J0(v,n);n.splice(f,0,v),v.record.name&&!Dh(v)&&o.set(v.record.name,v)}function d(v,f){let b,y={},P,B;if("name"in v&&v.name){if(b=o.get(v.name),!b)throw Xi(an.MATCHER_NOT_FOUND,{location:v});B=b.record.name,y=Et($h(f.params,b.keys.filter(U=>!U.optional).concat(b.parent?b.parent.keys.filter(U=>U.optional):[]).map(U=>U.name)),v.params&&$h(v.params,b.keys.map(U=>U.name))),P=b.stringify(y)}else if(v.path!=null)P=v.path,b=n.find(U=>U.re.test(P)),b&&(y=b.parse(P),B=b.record.name);else{if(b=f.name?o.get(f.name):n.find(U=>U.re.test(f.path)),!b)throw Xi(an.MATCHER_NOT_FOUND,{location:v,currentLocation:f});B=b.record.name,y=Et({},f.params,v.params),P=b.stringify(y)}const L=[];let j=b;for(;j;)L.unshift(j.record),j=j.parent;return{name:B,path:P,params:y,matched:L,meta:Y0(L)}}e.forEach(v=>a(v));function c(){n.length=0,o.clear()}return{addRoute:a,resolve:d,removeRoute:s,clearRoutes:c,getRoutes:i,getRecordMatcher:r}}function $h(e,t){const n={};for(const o of t)o in e&&(n[o]=e[o]);return n}function Oh(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:K0(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 K0(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 Dh(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Y0(e){return e.reduce((t,n)=>Et(t,n.meta),{})}function J0(e,t){let n=0,o=t.length;for(;n!==o;){const a=n+o>>1;Pg(e,t[a])<0?o=a:n=a+1}const r=Q0(e);return r&&(o=t.lastIndexOf(r,o-1)),o}function Q0(e){let t=e;for(;t=t.parent;)if(Rg(t)&&Pg(e,t)===0)return t}function Rg({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Fh(e){const t=Lr(hc),n=Lr(Of),o=K(()=>{const l=h(e.to);return t.resolve(l)}),r=K(()=>{const{matched:l}=o.value,{length:d}=l,c=l[d-1],v=n.matched;if(!c||!v.length)return-1;const f=v.findIndex(Qi.bind(null,c));if(f>-1)return f;const b=Bh(l[d-2]);return d>1&&Bh(c)===b&&v[v.length-1].path!==b?v.findIndex(Qi.bind(null,l[d-2])):f}),a=K(()=>r.value>-1&&nx(n.params,o.value.params)),s=K(()=>r.value>-1&&r.value===n.matched.length-1&&kg(n.params,o.value.params));function i(l={}){if(tx(l)){const d=t[h(e.replace)?"replace":"push"](h(e.to)).catch(Ll);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>d),d}return Promise.resolve()}return{route:o,href:K(()=>o.value.href),isActive:a,isExactActive:s,navigate:i}}function X0(e){return e.length===1?e[0]:e}const Z0=hn({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:Fh,setup(e,{slots:t}){const n=lc(Fh(e)),{options:o}=Lr(hc),r=K(()=>({[Uh(e.activeClass,o.linkActiveClass,"router-link-active")]:n.isActive,[Uh(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&X0(t.default(n));return e.custom?a:Nf("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:r.value},a)}}}),ex=Z0;function tx(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 nx(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(!Dr(r)||r.length!==o.length||o.some((a,s)=>a.valueOf()!==r[s].valueOf()))return!1}return!0}function Bh(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Uh=(e,t,n)=>e??t??n,ox=hn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const o=Lr(Yd),r=K(()=>e.route||o.value),a=Lr(Mh,0),s=K(()=>{let d=h(a);const{matched:c}=r.value;let v;for(;(v=c[d])&&!v.components;)d++;return d}),i=K(()=>r.value.matched[s.value]);Eu(Mh,K(()=>s.value+1)),Eu(E0,i),Eu(Yd,r);const l=S();return tt(()=>[l.value,i.value,e.name],([d,c,v],[f,b,y])=>{c&&(c.instances[v]=d,b&&b!==c&&d&&d===f&&(c.leaveGuards.size||(c.leaveGuards=b.leaveGuards),c.updateGuards.size||(c.updateGuards=b.updateGuards))),d&&c&&(!b||!Qi(c,b)||!f)&&(c.enterCallbacks[v]||[]).forEach(P=>P(d))},{flush:"post"}),()=>{const d=r.value,c=e.name,v=i.value,f=v&&v.components[c];if(!f)return zh(n.default,{Component:f,route:d});const b=v.props[c],y=b?b===!0?d.params:typeof b=="function"?b(d):b:null,B=Nf(f,Et({},y,t,{onVnodeUnmounted:L=>{L.component.isUnmounted&&(v.instances[c]=null)},ref:l}));return zh(n.default,{Component:B,route:d})||B}}});function zh(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const rx=ox;function ax(e){const t=V0(e.routes,e),n=e.parseQuery||P0,o=e.stringifyQuery||Eh,r=e.history,a=xl(),s=xl(),i=xl(),l=JT(fs);let d=fs;Li&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=fd.bind(null,N=>""+N),v=fd.bind(null,f0),f=fd.bind(null,Hl);function b(N,oe){let ue,Ee;return Ig(N)?(ue=t.getRecordMatcher(N),Ee=oe):Ee=N,t.addRoute(Ee,ue)}function y(N){const oe=t.getRecordMatcher(N);oe&&t.removeRoute(oe)}function P(){return t.getRoutes().map(N=>N.record)}function B(N){return!!t.getRecordMatcher(N)}function L(N,oe){if(oe=Et({},oe||l.value),typeof N=="string"){const z=pd(n,N,oe.path),Z=t.resolve({path:z.path},oe),ce=r.createHref(z.fullPath);return Et(z,Z,{params:f(Z.params),hash:Hl(z.hash),redirectedFrom:void 0,href:ce})}let ue;if(N.path!=null)ue=Et({},N,{path:pd(n,N.path,oe.path).path});else{const z=Et({},N.params);for(const Z in z)z[Z]==null&&delete z[Z];ue=Et({},N,{params:v(z)}),oe.params=v(oe.params)}const Ee=t.resolve(ue,oe),Be=N.hash||"";Ee.params=c(f(Ee.params));const A=m0(o,Et({},N,{hash:u0(Be),path:Ee.path})),M=r.createHref(A);return Et({fullPath:A,hash:Be,query:o===Eh?R0(N.query):N.query||{}},Ee,{redirectedFrom:void 0,href:M})}function j(N){return typeof N=="string"?pd(n,N,l.value.path):Et({},N)}function U(N,oe){if(d!==N)return Xi(an.NAVIGATION_CANCELLED,{from:oe,to:N})}function H(N){return W(N)}function be(N){return H(Et(j(N),{replace:!0}))}function le(N,oe){const ue=N.matched[N.matched.length-1];if(ue&&ue.redirect){const{redirect:Ee}=ue;let Be=typeof Ee=="function"?Ee(N,oe):Ee;return typeof Be=="string"&&(Be=Be.includes("?")||Be.includes("#")?Be=j(Be):{path:Be},Be.params={}),Et({query:N.query,hash:N.hash,params:Be.path!=null?{}:N.params},Be)}}function W(N,oe){const ue=d=L(N),Ee=l.value,Be=N.state,A=N.force,M=N.replace===!0,z=le(ue,Ee);if(z)return W(Et(j(z),{state:typeof z=="object"?Et({},Be,z.state):Be,force:A,replace:M}),oe||ue);const Z=ue;Z.redirectedFrom=oe;let ce;return!A&&v0(o,Ee,ue)&&(ce=Xi(an.NAVIGATION_DUPLICATED,{to:Z,from:Ee}),Fe(Ee,Ee,!0,!1)),(ce?Promise.resolve(ce):Pe(Z,Ee)).catch(re=>Ra(re)?Ra(re,an.NAVIGATION_GUARD_REDIRECT)?re:Ae(re):de(re,Z,Ee)).then(re=>{if(re){if(Ra(re,an.NAVIGATION_GUARD_REDIRECT))return W(Et({replace:M},j(re.to),{state:typeof re.to=="object"?Et({},Be,re.to.state):Be,force:A}),oe||Z)}else re=Y(Z,Ee,!0,M,Be);return ge(Z,Ee,re),re})}function he(N,oe){const ue=U(N,oe);return ue?Promise.reject(ue):Promise.resolve()}function Se(N){const oe=Ze.values().next().value;return oe&&typeof oe.runWithContext=="function"?oe.runWithContext(N):N()}function Pe(N,oe){let ue;const[Ee,Be,A]=M0(N,oe);ue=md(Ee.reverse(),"beforeRouteLeave",N,oe);for(const z of Ee)z.leaveGuards.forEach(Z=>{ue.push(gs(Z,N,oe))});const M=he.bind(null,N,oe);return ue.push(M),fe(ue).then(()=>{ue=[];for(const z of a.list())ue.push(gs(z,N,oe));return ue.push(M),fe(ue)}).then(()=>{ue=md(Be,"beforeRouteUpdate",N,oe);for(const z of Be)z.updateGuards.forEach(Z=>{ue.push(gs(Z,N,oe))});return ue.push(M),fe(ue)}).then(()=>{ue=[];for(const z of A)if(z.beforeEnter)if(Dr(z.beforeEnter))for(const Z of z.beforeEnter)ue.push(gs(Z,N,oe));else ue.push(gs(z.beforeEnter,N,oe));return ue.push(M),fe(ue)}).then(()=>(N.matched.forEach(z=>z.enterCallbacks={}),ue=md(A,"beforeRouteEnter",N,oe,Se),ue.push(M),fe(ue))).then(()=>{ue=[];for(const z of s.list())ue.push(gs(z,N,oe));return ue.push(M),fe(ue)}).catch(z=>Ra(z,an.NAVIGATION_CANCELLED)?z:Promise.reject(z))}function ge(N,oe,ue){i.list().forEach(Ee=>Se(()=>Ee(N,oe,ue)))}function Y(N,oe,ue,Ee,Be){const A=U(N,oe);if(A)return A;const M=oe===fs,z=Li?history.state:{};ue&&(Ee||M?r.replace(N.fullPath,Et({scroll:M&&z&&z.scroll},Be)):r.push(N.fullPath,Be)),l.value=N,Fe(N,oe,ue,M),Ae()}let pe;function ne(){pe||(pe=r.listen((N,oe,ue)=>{if(!ut.listening)return;const Ee=L(N),Be=le(Ee,ut.currentRoute.value);if(Be){W(Et(Be,{replace:!0,force:!0}),Ee).catch(Ll);return}d=Ee;const A=l.value;Li&&x0(Rh(A.fullPath,ue.delta),pc()),Pe(Ee,A).catch(M=>Ra(M,an.NAVIGATION_ABORTED|an.NAVIGATION_CANCELLED)?M:Ra(M,an.NAVIGATION_GUARD_REDIRECT)?(W(Et(j(M.to),{force:!0}),Ee).then(z=>{Ra(z,an.NAVIGATION_ABORTED|an.NAVIGATION_DUPLICATED)&&!ue.delta&&ue.type===Vd.pop&&r.go(-1,!1)}).catch(Ll),Promise.reject()):(ue.delta&&r.go(-ue.delta,!1),de(M,Ee,A))).then(M=>{M=M||Y(Ee,A,!1),M&&(ue.delta&&!Ra(M,an.NAVIGATION_CANCELLED)?r.go(-ue.delta,!1):ue.type===Vd.pop&&Ra(M,an.NAVIGATION_ABORTED|an.NAVIGATION_DUPLICATED)&&r.go(-1,!1)),ge(Ee,A,M)}).catch(Ll)}))}let xe=xl(),$e=xl(),te;function de(N,oe,ue){Ae(N);const Ee=$e.list();return Ee.length?Ee.forEach(Be=>Be(N,oe,ue)):console.error(N),Promise.reject(N)}function Le(){return te&&l.value!==fs?Promise.resolve():new Promise((N,oe)=>{xe.add([N,oe])})}function Ae(N){return te||(te=!N,ne(),xe.list().forEach(([oe,ue])=>N?ue(N):oe()),xe.reset()),N}function Fe(N,oe,ue,Ee){const{scrollBehavior:Be}=e;if(!Li||!Be)return Promise.resolve();const A=!ue&&k0(Rh(N.fullPath,0))||(Ee||!ue)&&history.state&&history.state.scroll||null;return Nt().then(()=>Be(N,oe,A)).then(M=>M&&C0(M)).catch(M=>de(M,N,oe))}const Ke=N=>r.go(N);let lt;const Ze=new Set,ut={currentRoute:l,listening:!0,addRoute:b,removeRoute:y,clearRoutes:t.clearRoutes,hasRoute:B,getRoutes:P,resolve:L,options:e,push:H,replace:be,go:Ke,back:()=>Ke(-1),forward:()=>Ke(1),beforeEach:a.add,beforeResolve:s.add,afterEach:i.add,onError:$e.add,isReady:Le,install(N){N.component("RouterLink",ex),N.component("RouterView",rx),N.config.globalProperties.$router=ut,Object.defineProperty(N.config.globalProperties,"$route",{enumerable:!0,get:()=>h(l)}),Li&&!lt&&l.value===fs&&(lt=!0,H(r.location).catch(Ee=>{}));const oe={};for(const Ee in fs)Object.defineProperty(oe,Ee,{get:()=>l.value[Ee],enumerable:!0});N.provide(hc,ut),N.provide(Of,_v(oe)),N.provide(Yd,l);const ue=N.unmount;Ze.add(N),N.unmount=function(){Ze.delete(N),Ze.size<1&&(d=fs,pe&&pe(),pe=null,l.value=fs,lt=!1,te=!1),ue()}}};function fe(N){return N.reduce((oe,ue)=>oe.then(()=>Se(ue)),Promise.resolve())}return ut}function sx(){return Lr(hc)}function ix(e){return Lr(Of)}const Hh=768;function Df(){const e=S(typeof window<"u"?window.innerWidth<Hh:!1);let t=null;function n(o){e.value=o.matches}return pi(()=>{t=window.matchMedia(`(max-width: ${Hh-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Jl(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const lx={key:0,class:"desktop-sidebar"},ux={class:"desktop-main"},qh="codex-web-local.sidebar-width.v1",cx=260,dx=620,Wh=320,fx=hn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Df();function o(d){return Math.min(dx,Math.max(cx,d))}function r(){if(typeof window>"u")return Wh;const d=window.localStorage.getItem(qh),c=Number(d);return Number.isFinite(c)?o(c):Wh}const a=S(r()),s=K(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${a.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function i(d){typeof window>"u"||window.localStorage.setItem(qh,String(d))}function l(d){d.preventDefault();const c=d.clientX,v=a.value,f=y=>{const P=y.clientX-c;a.value=o(v+P)},b=()=>{i(a.value),window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",b)};window.addEventListener("mousemove",f),window.addEventListener("mouseup",b)}return(d,c)=>(_(),F("div",{class:at(["desktop-layout",{"is-mobile":h(n)}]),style:er(s.value)},[h(n)?(_(),Qe(Ki,{key:0,to:"body"},[Oe(Xl,{name:"drawer"},{default:dt(()=>[e.isSidebarCollapsed?ve("",!0):(_(),F("div",{key:0,class:"mobile-drawer-backdrop",onClick:c[1]||(c[1]=v=>d.$emit("close-sidebar"))},[w("aside",{class:"mobile-drawer",onClick:c[0]||(c[0]=gt(()=>{},["stop"]))},[_o(d.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):ve("",!0),h(n)?ve("",!0):(_(),F(ot,{key:1},[e.isSidebarCollapsed?ve("",!0):(_(),F("aside",lx,[_o(d.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?ve("",!0):(_(),F("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),w("section",ux,[_o(d.$slots,"content",{},void 0)])],6))}}),It=(e,t)=>{const n=e.__vccOpts||e;for(const[o,r]of t)n[o]=r;return n},px=It(fx,[["__scopeId","data-v-782e512b"]]);function Gh(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Nr extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function rr(e,t){if(typeof e=="string"&&e.length>0)return e;const n=Gh(e);if(!n)return t;const o=n.error;if(typeof o=="string"&&o.length>0)return o;const r=Gh(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 Fr(e,t,n){return e instanceof Nr?e:e instanceof Error?new Nr(e.message||t,{code:"unknown_error",method:n}):new Nr(t,{code:"unknown_error",method:n})}function Eg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function hx(e,t){const n={method:e,params:t??null};let o;try{o=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(i){throw new Nr(i instanceof Error?i.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let r=null,a=null;try{a=await o.text(),r=JSON.parse(a)}catch{r=null}if(!o.ok){const i=rr(r,"")||(a==null?void 0:a.slice(0,500))||"",l=`RPC ${e} failed with HTTP ${o.status}`;throw new Nr(i?`${l}: ${i}`:l,{code:"http_error",method:e,status:o.status})}const s=r;if(!s||typeof s!="object"||!("result"in s))throw new Nr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:o.status});return s.result}async function mx(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Nr(rr(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 vx(e){const t=Eg(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 Vh(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function gx(e){if(typeof window>"u")return()=>{};let t=null,n=!1,o=null;const r=()=>{o!==null&&(window.clearTimeout(o),o=null)},a=(d,c)=>{if(n||o!==null)return;const v=Math.min(1e3*2**c,1e4);o=window.setTimeout(()=>{o=null,!n&&d()},v)},s=d=>{const c=vx(d);c&&e(c)},i=(d=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const c=new EventSource("/codex-api/events");let v=!1;c.onmessage=f=>{try{s(JSON.parse(f.data))}catch{}},c.addEventListener("ready",f=>{try{const b=f.data?JSON.parse(f.data):{ok:!0};Vh(e,b)}catch{Vh(e)}}),c.onerror=()=>{n||v||c.readyState===EventSource.CLOSED&&(v=!0,c.close(),a(()=>i(d+1),d))},t=()=>{v=!0,c.close()}},l=(d=0)=>{if(typeof WebSocket>"u"||n){i();return}t==null||t();const c=window.location.protocol==="https:"?"wss:":"ws:",v=new WebSocket(`${c}//${window.location.host}/codex-api/ws`);let f=!1,b=!1,y=window.setTimeout(()=>{f||n||b||(b=!0,v.close(),i())},2500);v.onopen=()=>{f=!0,r(),y!==null&&(window.clearTimeout(y),y=null)},v.onmessage=P=>{try{s(JSON.parse(String(P.data)))}catch{}},v.onerror=()=>{},v.onclose=()=>{if(y!==null&&(window.clearTimeout(y),y=null),!(n||b)){if(!f){i();return}a(()=>l(d+1),d)}},t=()=>{b=!0,y!==null&&(window.clearTimeout(y),y=null),v.close()}};return typeof WebSocket<"u"?l():i(),()=>{n=!0,r(),t==null||t()}}async function yx(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 Nr(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 Nr(rr(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function wx(){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 Nr(rr(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Eg(t),o=n==null?void 0:n.data;return Array.isArray(o)?o:[]}async function rt(e,t){try{return await hx(e,t)}catch(n){throw Fr(n,`RPC ${e} failed`,e)}}function Jt(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},o=n.message;if(typeof o=="string"&&o.trim().length>0)return o;const r=n.error;return typeof r=="string"&&r.trim().length>0?r:t}function Ge(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function ee(e){return typeof e=="string"&&e.length>0?e:null}function Ut(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Xn(e){return typeof e=="boolean"?e:null}function Er(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>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"}`)}}function Vu(e){const t=Ge(e);if(!t)return null;const n=ee(t.id),o=ee(t.kind),r=ee(t.name),a=ee(t.prompt),s=ee(t.rrule),i=ee(t.status);return!n||!r||!a||!s||o!=="heartbeat"&&o!=="cron"||i!=="ACTIVE"&&i!=="PAUSED"?null:{id:n,kind:o,name:r,prompt:a,rrule:s,status:i,targetThreadId:ee(t.targetThreadId),cwds:Array.isArray(t.cwds)?t.cwds.filter(l=>typeof l=="string"&&l.trim().length>0):[],createdAtMs:Ut(t.createdAtMs),updatedAtMs:Ut(t.updatedAtMs),nextRunAtMs:Ut(t.nextRunAtMs)}}function Mg(e){if(Array.isArray(e))return e.flatMap(n=>{const o=Vu(n);return o?[o]:[]});const t=Vu(e);return t?[t]:[]}async function bx(){var r;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(rr(t,"Failed to load thread automations"));const n=Ge((r=Ge(t))==null?void 0:r.data),o={};if(!n)return o;for(const[a,s]of Object.entries(n)){const i=Mg(s);i.length>0&&(o[a]=i)}return o}async function Tx(){var r;const e=await fetch("/codex-api/project-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(rr(t,"Failed to load project automations"));const n=Ge((r=Ge(t))==null?void 0:r.data),o={};if(!n)return o;for(const[a,s]of Object.entries(n)){const i=Mg(s);i.length>0&&(o[a]=i)}return o}async function Sx(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(rr(n,"Failed to save thread automation"));const o=Vu((r=Ge(n))==null?void 0:r.data);if(!o)throw new Error("Thread automation response was malformed");return o}async function Cx(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(rr(n,"Failed to save project automation"));const o=Vu((r=Ge(n))==null?void 0:r.data);if(!o)throw new Error("Project automation response was malformed");return o}async function Kh(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(rr(r,"Failed to delete thread automation"))}async function jg(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(rr(r,"Failed to delete project automation"))}async function xx(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(rr(o,"Failed to run thread automation"))}const kx=new Set(["node_modules","dist","build","out",".next",".nuxt","coverage","__pycache__",".cache",".turbo","target",".venv","venv",".idea",".vscode","output"]);function Lg(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>n.startsWith(".")||kx.has(n))}function Ix(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=Array.isArray(t.files)?t.files:[],o=[];for(const r of n){if(!r||typeof r!="object"||Array.isArray(r))continue;const s=r.path,i=typeof s=="string"?s.trim():"";!i||Lg(i)||o.push({path:i})}return o}async function Ax(e,t){await rt("fuzzyFileSearch/sessionStart",{sessionId:t,roots:e})}async function _x(e,t){await rt("fuzzyFileSearch/sessionUpdate",{sessionId:e,query:t})}async function Px(e){await rt("fuzzyFileSearch/sessionStop",{sessionId:e}).catch(()=>{})}async function Yh(e,t,n=20){const o=e.trim();if(!o)return[];const r=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:o,query:t.trim(),limit:n})}),a=await r.json();if(!r.ok){const d=Jt(a,"Failed to search files");throw new Error(d)}const s=a&&typeof a=="object"&&!Array.isArray(a)?a:{},i=Array.isArray(s.data)?s.data:[],l=[];for(const d of i){if(!d||typeof d!="object"||Array.isArray(d))continue;const v=d.path,f=typeof v=="string"?v.trim():"";!f||Lg(f)||l.push({path:f})}return l}async function Rx(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),o=await n.json();if(!n.ok)throw new Error(o.error||"Failed to search threads");return o.data??{threadIds:[],indexedThreadCount:0}}function Ex(e){const t=Ge(e);if(!t)return null;const n=ee(t.id),o=ee(t.threadId),r=ee(t.cwd),a=ee(t.shell);return!n||!o||!r||!a?null:{id:n,threadId:o,cwd:r,shell:a,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:Xn(t.truncated)??!1}}async function ol(e,t){const n=await fetch(e,t),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(rr(o,`Terminal request failed with HTTP ${n.status}`));return o}async function RD(e){var o;const t=await ol("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=Ex((o=Ge(t))==null?void 0:o.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function Mx(){const e=await ol("/codex-api/thread-terminal/status"),t=Ge(e);return{available:Xn(t==null?void 0:t.available)??!1,reason:ee(t==null?void 0:t.reason)||null}}async function ED(e){const t=await ol(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=Ge(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(r=>{const a=Ge(r),s=ee(a==null?void 0:a.label),i=ee(a==null?void 0:a.value),l=ee(a==null?void 0:a.source);return!s||!i||l!=="package"&&l!=="script"&&l!=="make"?[]:[{label:s,value:i,source:l}]})}async function MD(e,t){await ol("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function jD(e,t,n){await ol("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function LD(e){await ol("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}const Ng=["none","minimal","low","medium","high","xhigh","max","ultra"];function Zi(e){return typeof e=="string"&&Ng.some(t=>t===e)}function jx(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function Xe(e){return jx(e)}function $g(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function Lx(e){const t=Xe(e);return t.startsWith("/")||$g(t)}function Nx(e){const t=Xe(e).replace(/[\\/]+/gu,"/");return $g(t)?t.toLowerCase():t}function Bo(e){const t=Xe(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function qi(e){const t=Xe(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function nr(e){return Bo(e)||Xe(e)||"Projectless"}function Ku(e){const t=Xe(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function Jh(e){return new Date(e*1e3).toISOString()}function $x(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Ox(e){const t=e.error;return typeof(t==null?void 0:t.message)=="string"?t.message.trim():""}const Dx=/^##\s+(.+?):\s+(.+?)\s*$/,Fx=/^#\s*files mentioned by the user\s*:?\s*$/i;function Bx(e){var r,a;const t=e.split(`
|
|
26
|
+
*/let j0=()=>location.protocol+"//"+location.host;function _g(e,t){const{pathname:n,search:o,hash:r}=t,a=e.indexOf("#");if(a>-1){let s=r.includes(e.slice(a))?e.slice(a).length:1,i=r.slice(s);return i[0]!=="/"&&(i="/"+i),_h(i,"")}return _h(n,e)+o+r}function L0(e,t,n,o){let r=[],a=[],s=null;const i=({state:f})=>{const b=_g(e,location),y=n.value,P=t.value;let B=0;if(f){if(n.value=b,t.value=f,s&&s===y){s=null;return}B=P?f.position-P.position:0}else o(b);r.forEach(L=>{L(n.value,y,{delta:B,type:Vd.pop,direction:B?B>0?hd.forward:hd.back:hd.unknown})})};function l(){s=n.value}function d(f){r.push(f);const b=()=>{const y=r.indexOf(f);y>-1&&r.splice(y,1)};return a.push(b),b}function c(){if(document.visibilityState==="hidden"){const{history:f}=window;if(!f.state)return;f.replaceState(Et({},f.state,{scroll:pc()}),"")}}function v(){for(const f of a)f();a=[],window.removeEventListener("popstate",i),window.removeEventListener("pagehide",c),document.removeEventListener("visibilitychange",c)}return window.addEventListener("popstate",i),window.addEventListener("pagehide",c),document.addEventListener("visibilitychange",c),{pauseListeners:l,listen:d,destroy:v}}function jh(e,t,n,o=!1,r=!1){return{back:e,current:t,forward:n,replaced:o,position:window.history.length,scroll:r?pc():null}}function N0(e){const{history:t,location:n}=window,o={value:_g(e,n)},r={value:t.state};r.value||a(o.value,{back:null,current:o.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(l,d,c){const v=e.indexOf("#"),f=v>-1?(n.host&&document.querySelector("base")?e:e.slice(v))+l:j0()+e+l;try{t[c?"replaceState":"pushState"](d,"",f),r.value=d}catch(b){console.error(b),n[c?"replace":"assign"](f)}}function s(l,d){a(l,Et({},t.state,jh(r.value.back,l,r.value.forward,!0),d,{position:r.value.position}),!0),o.value=l}function i(l,d){const c=Et({},r.value,t.state,{forward:l,scroll:pc()});a(c.current,c,!0),a(l,Et({},jh(o.value,l,null),{position:c.position+1},d),!1),o.value=l}return{location:o,state:r,push:i,replace:s}}function $0(e){e=w0(e);const t=N0(e),n=L0(e,t.state,t.location,t.replace);function o(a,s=!0){s||n.pauseListeners(),history.go(a)}const r=Et({location:"",base:e,go:o,createHref:T0.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 O0(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),$0(e)}let ii=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var wn=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}(wn||{});const D0={type:ii.Static,value:""},F0=/[a-zA-Z0-9_]/;function B0(e){if(!e)return[[]];if(e==="/")return[[D0]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(b){throw new Error(`ERR (${n})/"${d}": ${b}`)}let n=wn.Static,o=n;const r=[];let a;function s(){a&&r.push(a),a=[]}let i=0,l,d="",c="";function v(){d&&(n===wn.Static?a.push({type:ii.Static,value:d}):n===wn.Param||n===wn.ParamRegExp||n===wn.ParamRegExpEnd?(a.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),a.push({type:ii.Param,value:d,regexp:c,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),d="")}function f(){d+=l}for(;i<e.length;){if(l=e[i++],l==="\\"&&n!==wn.ParamRegExp){o=n,n=wn.EscapeNext;continue}switch(n){case wn.Static:l==="/"?(d&&v(),s()):l===":"?(v(),n=wn.Param):f();break;case wn.EscapeNext:f(),n=o;break;case wn.Param:l==="("?n=wn.ParamRegExp:F0.test(l)?f():(v(),n=wn.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--);break;case wn.ParamRegExp:l===")"?c[c.length-1]=="\\"?c=c.slice(0,-1)+l:n=wn.ParamRegExpEnd:c+=l;break;case wn.ParamRegExpEnd:v(),n=wn.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--,c="";break;default:t("Unknown state");break}}return n===wn.ParamRegExp&&t(`Unfinished custom RegExp for param "${d}"`),v(),s(),r}const Lh="[^/]+?",U0={sensitive:!1,strict:!1,start:!0,end:!0};var uo=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}(uo||{});const z0=/[.+*?^${}()[\]/\\]/g;function H0(e,t){const n=Et({},U0,t),o=[];let r=n.start?"^":"";const a=[];for(const d of e){const c=d.length?[]:[uo.Root];n.strict&&!d.length&&(r+="/");for(let v=0;v<d.length;v++){const f=d[v];let b=uo.Segment+(n.sensitive?uo.BonusCaseSensitive:0);if(f.type===ii.Static)v||(r+="/"),r+=f.value.replace(z0,"\\$&"),b+=uo.Static;else if(f.type===ii.Param){const{value:y,repeatable:P,optional:B,regexp:L}=f;a.push({name:y,repeatable:P,optional:B});const j=L||Lh;if(j!==Lh){b+=uo.BonusCustomRegExp;try{`${j}`}catch(H){throw new Error(`Invalid custom RegExp for param "${y}" (${j}): `+H.message)}}let U=P?`((?:${j})(?:/(?:${j}))*)`:`(${j})`;v||(U=B&&d.length<2?`(?:/${U})`:"/"+U),B&&(U+="?"),r+=U,b+=uo.Dynamic,B&&(b+=uo.BonusOptional),P&&(b+=uo.BonusRepeatable),j===".*"&&(b+=uo.BonusWildcard)}c.push(b)}o.push(c)}if(n.strict&&n.end){const d=o.length-1;o[d][o[d].length-1]+=uo.BonusStrict}n.strict||(r+="/?"),n.end?r+="$":n.strict&&!r.endsWith("/")&&(r+="(?:/|$)");const s=new RegExp(r,n.sensitive?"":"i");function i(d){const c=d.match(s),v={};if(!c)return null;for(let f=1;f<c.length;f++){const b=c[f]||"",y=a[f-1];v[y.name]=b&&y.repeatable?b.split("/"):b}return v}function l(d){let c="",v=!1;for(const f of e){(!v||!c.endsWith("/"))&&(c+="/"),v=!1;for(const b of f)if(b.type===ii.Static)c+=b.value;else if(b.type===ii.Param){const{value:y,repeatable:P,optional:B}=b,L=y in d?d[y]:"";if(Dr(L)&&!P)throw new Error(`Provided param "${y}" is an array but it is not repeatable (* or + modifiers)`);const j=Dr(L)?L.join("/"):L;if(!j)if(B)f.length<2&&(c.endsWith("/")?c=c.slice(0,-1):v=!0);else throw new Error(`Missing required param "${y}"`);c+=j}}return c||"/"}return{re:s,score:o,keys:a,parse:i,stringify:l}}function q0(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]===uo.Static+uo.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===uo.Static+uo.Segment?1:-1:0}function Pg(e,t){let n=0;const o=e.score,r=t.score;for(;n<o.length&&n<r.length;){const a=q0(o[n],r[n]);if(a)return a;n++}if(Math.abs(r.length-o.length)===1){if(Nh(o))return 1;if(Nh(r))return-1}return r.length-o.length}function Nh(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const W0={strict:!1,end:!0,sensitive:!1};function G0(e,t,n){const o=H0(B0(e.path),n),r=Et(o,{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function V0(e,t){const n=[],o=new Map;t=Ah(W0,t);function r(v){return o.get(v)}function a(v,f,b){const y=!b,P=Oh(v);P.aliasOf=b&&b.record;const B=Ah(t,v),L=[P];if("alias"in v){const H=typeof v.alias=="string"?[v.alias]:v.alias;for(const be of H)L.push(Oh(Et({},P,{components:b?b.record.components:P.components,path:be,aliasOf:b?b.record:P})))}let j,U;for(const H of L){const{path:be}=H;if(f&&be[0]!=="/"){const le=f.record.path,W=le[le.length-1]==="/"?"":"/";H.path=f.record.path+(be&&W+be)}if(j=G0(H,f,B),b?b.alias.push(j):(U=U||j,U!==j&&U.alias.push(j),y&&v.name&&!Dh(j)&&s(v.name)),Rg(j)&&l(j),P.children){const le=P.children;for(let W=0;W<le.length;W++)a(le[W],j,b&&b.children[W])}b=b||j}return U?()=>{s(U)}:Ll}function s(v){if(Ig(v)){const f=o.get(v);f&&(o.delete(v),n.splice(n.indexOf(f),1),f.children.forEach(s),f.alias.forEach(s))}else{const f=n.indexOf(v);f>-1&&(n.splice(f,1),v.record.name&&o.delete(v.record.name),v.children.forEach(s),v.alias.forEach(s))}}function i(){return n}function l(v){const f=J0(v,n);n.splice(f,0,v),v.record.name&&!Dh(v)&&o.set(v.record.name,v)}function d(v,f){let b,y={},P,B;if("name"in v&&v.name){if(b=o.get(v.name),!b)throw Xi(an.MATCHER_NOT_FOUND,{location:v});B=b.record.name,y=Et($h(f.params,b.keys.filter(U=>!U.optional).concat(b.parent?b.parent.keys.filter(U=>U.optional):[]).map(U=>U.name)),v.params&&$h(v.params,b.keys.map(U=>U.name))),P=b.stringify(y)}else if(v.path!=null)P=v.path,b=n.find(U=>U.re.test(P)),b&&(y=b.parse(P),B=b.record.name);else{if(b=f.name?o.get(f.name):n.find(U=>U.re.test(f.path)),!b)throw Xi(an.MATCHER_NOT_FOUND,{location:v,currentLocation:f});B=b.record.name,y=Et({},f.params,v.params),P=b.stringify(y)}const L=[];let j=b;for(;j;)L.unshift(j.record),j=j.parent;return{name:B,path:P,params:y,matched:L,meta:Y0(L)}}e.forEach(v=>a(v));function c(){n.length=0,o.clear()}return{addRoute:a,resolve:d,removeRoute:s,clearRoutes:c,getRoutes:i,getRecordMatcher:r}}function $h(e,t){const n={};for(const o of t)o in e&&(n[o]=e[o]);return n}function Oh(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:K0(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 K0(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 Dh(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Y0(e){return e.reduce((t,n)=>Et(t,n.meta),{})}function J0(e,t){let n=0,o=t.length;for(;n!==o;){const a=n+o>>1;Pg(e,t[a])<0?o=a:n=a+1}const r=Q0(e);return r&&(o=t.lastIndexOf(r,o-1)),o}function Q0(e){let t=e;for(;t=t.parent;)if(Rg(t)&&Pg(e,t)===0)return t}function Rg({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Fh(e){const t=Lr(hc),n=Lr(Of),o=K(()=>{const l=m(e.to);return t.resolve(l)}),r=K(()=>{const{matched:l}=o.value,{length:d}=l,c=l[d-1],v=n.matched;if(!c||!v.length)return-1;const f=v.findIndex(Qi.bind(null,c));if(f>-1)return f;const b=Bh(l[d-2]);return d>1&&Bh(c)===b&&v[v.length-1].path!==b?v.findIndex(Qi.bind(null,l[d-2])):f}),a=K(()=>r.value>-1&&nx(n.params,o.value.params)),s=K(()=>r.value>-1&&r.value===n.matched.length-1&&kg(n.params,o.value.params));function i(l={}){if(tx(l)){const d=t[m(e.replace)?"replace":"push"](m(e.to)).catch(Ll);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>d),d}return Promise.resolve()}return{route:o,href:K(()=>o.value.href),isActive:a,isExactActive:s,navigate:i}}function X0(e){return e.length===1?e[0]:e}const Z0=hn({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:Fh,setup(e,{slots:t}){const n=lc(Fh(e)),{options:o}=Lr(hc),r=K(()=>({[Uh(e.activeClass,o.linkActiveClass,"router-link-active")]:n.isActive,[Uh(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&X0(t.default(n));return e.custom?a:Nf("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:r.value},a)}}}),ex=Z0;function tx(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 nx(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(!Dr(r)||r.length!==o.length||o.some((a,s)=>a.valueOf()!==r[s].valueOf()))return!1}return!0}function Bh(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Uh=(e,t,n)=>e??t??n,ox=hn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const o=Lr(Yd),r=K(()=>e.route||o.value),a=Lr(Mh,0),s=K(()=>{let d=m(a);const{matched:c}=r.value;let v;for(;(v=c[d])&&!v.components;)d++;return d}),i=K(()=>r.value.matched[s.value]);Eu(Mh,K(()=>s.value+1)),Eu(E0,i),Eu(Yd,r);const l=S();return tt(()=>[l.value,i.value,e.name],([d,c,v],[f,b,y])=>{c&&(c.instances[v]=d,b&&b!==c&&d&&d===f&&(c.leaveGuards.size||(c.leaveGuards=b.leaveGuards),c.updateGuards.size||(c.updateGuards=b.updateGuards))),d&&c&&(!b||!Qi(c,b)||!f)&&(c.enterCallbacks[v]||[]).forEach(P=>P(d))},{flush:"post"}),()=>{const d=r.value,c=e.name,v=i.value,f=v&&v.components[c];if(!f)return zh(n.default,{Component:f,route:d});const b=v.props[c],y=b?b===!0?d.params:typeof b=="function"?b(d):b:null,B=Nf(f,Et({},y,t,{onVnodeUnmounted:L=>{L.component.isUnmounted&&(v.instances[c]=null)},ref:l}));return zh(n.default,{Component:B,route:d})||B}}});function zh(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const rx=ox;function ax(e){const t=V0(e.routes,e),n=e.parseQuery||P0,o=e.stringifyQuery||Eh,r=e.history,a=xl(),s=xl(),i=xl(),l=JT(fs);let d=fs;Li&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=fd.bind(null,N=>""+N),v=fd.bind(null,f0),f=fd.bind(null,Hl);function b(N,oe){let ue,Ee;return Ig(N)?(ue=t.getRecordMatcher(N),Ee=oe):Ee=N,t.addRoute(Ee,ue)}function y(N){const oe=t.getRecordMatcher(N);oe&&t.removeRoute(oe)}function P(){return t.getRoutes().map(N=>N.record)}function B(N){return!!t.getRecordMatcher(N)}function L(N,oe){if(oe=Et({},oe||l.value),typeof N=="string"){const z=pd(n,N,oe.path),Z=t.resolve({path:z.path},oe),ce=r.createHref(z.fullPath);return Et(z,Z,{params:f(Z.params),hash:Hl(z.hash),redirectedFrom:void 0,href:ce})}let ue;if(N.path!=null)ue=Et({},N,{path:pd(n,N.path,oe.path).path});else{const z=Et({},N.params);for(const Z in z)z[Z]==null&&delete z[Z];ue=Et({},N,{params:v(z)}),oe.params=v(oe.params)}const Ee=t.resolve(ue,oe),Be=N.hash||"";Ee.params=c(f(Ee.params));const A=m0(o,Et({},N,{hash:u0(Be),path:Ee.path})),M=r.createHref(A);return Et({fullPath:A,hash:Be,query:o===Eh?R0(N.query):N.query||{}},Ee,{redirectedFrom:void 0,href:M})}function j(N){return typeof N=="string"?pd(n,N,l.value.path):Et({},N)}function U(N,oe){if(d!==N)return Xi(an.NAVIGATION_CANCELLED,{from:oe,to:N})}function H(N){return W(N)}function be(N){return H(Et(j(N),{replace:!0}))}function le(N,oe){const ue=N.matched[N.matched.length-1];if(ue&&ue.redirect){const{redirect:Ee}=ue;let Be=typeof Ee=="function"?Ee(N,oe):Ee;return typeof Be=="string"&&(Be=Be.includes("?")||Be.includes("#")?Be=j(Be):{path:Be},Be.params={}),Et({query:N.query,hash:N.hash,params:Be.path!=null?{}:N.params},Be)}}function W(N,oe){const ue=d=L(N),Ee=l.value,Be=N.state,A=N.force,M=N.replace===!0,z=le(ue,Ee);if(z)return W(Et(j(z),{state:typeof z=="object"?Et({},Be,z.state):Be,force:A,replace:M}),oe||ue);const Z=ue;Z.redirectedFrom=oe;let ce;return!A&&v0(o,Ee,ue)&&(ce=Xi(an.NAVIGATION_DUPLICATED,{to:Z,from:Ee}),Fe(Ee,Ee,!0,!1)),(ce?Promise.resolve(ce):Pe(Z,Ee)).catch(re=>Ra(re)?Ra(re,an.NAVIGATION_GUARD_REDIRECT)?re:Ae(re):de(re,Z,Ee)).then(re=>{if(re){if(Ra(re,an.NAVIGATION_GUARD_REDIRECT))return W(Et({replace:M},j(re.to),{state:typeof re.to=="object"?Et({},Be,re.to.state):Be,force:A}),oe||Z)}else re=Y(Z,Ee,!0,M,Be);return ye(Z,Ee,re),re})}function he(N,oe){const ue=U(N,oe);return ue?Promise.reject(ue):Promise.resolve()}function Se(N){const oe=Ze.values().next().value;return oe&&typeof oe.runWithContext=="function"?oe.runWithContext(N):N()}function Pe(N,oe){let ue;const[Ee,Be,A]=M0(N,oe);ue=md(Ee.reverse(),"beforeRouteLeave",N,oe);for(const z of Ee)z.leaveGuards.forEach(Z=>{ue.push(gs(Z,N,oe))});const M=he.bind(null,N,oe);return ue.push(M),fe(ue).then(()=>{ue=[];for(const z of a.list())ue.push(gs(z,N,oe));return ue.push(M),fe(ue)}).then(()=>{ue=md(Be,"beforeRouteUpdate",N,oe);for(const z of Be)z.updateGuards.forEach(Z=>{ue.push(gs(Z,N,oe))});return ue.push(M),fe(ue)}).then(()=>{ue=[];for(const z of A)if(z.beforeEnter)if(Dr(z.beforeEnter))for(const Z of z.beforeEnter)ue.push(gs(Z,N,oe));else ue.push(gs(z.beforeEnter,N,oe));return ue.push(M),fe(ue)}).then(()=>(N.matched.forEach(z=>z.enterCallbacks={}),ue=md(A,"beforeRouteEnter",N,oe,Se),ue.push(M),fe(ue))).then(()=>{ue=[];for(const z of s.list())ue.push(gs(z,N,oe));return ue.push(M),fe(ue)}).catch(z=>Ra(z,an.NAVIGATION_CANCELLED)?z:Promise.reject(z))}function ye(N,oe,ue){i.list().forEach(Ee=>Se(()=>Ee(N,oe,ue)))}function Y(N,oe,ue,Ee,Be){const A=U(N,oe);if(A)return A;const M=oe===fs,z=Li?history.state:{};ue&&(Ee||M?r.replace(N.fullPath,Et({scroll:M&&z&&z.scroll},Be)):r.push(N.fullPath,Be)),l.value=N,Fe(N,oe,ue,M),Ae()}let pe;function ne(){pe||(pe=r.listen((N,oe,ue)=>{if(!ut.listening)return;const Ee=L(N),Be=le(Ee,ut.currentRoute.value);if(Be){W(Et(Be,{replace:!0,force:!0}),Ee).catch(Ll);return}d=Ee;const A=l.value;Li&&x0(Rh(A.fullPath,ue.delta),pc()),Pe(Ee,A).catch(M=>Ra(M,an.NAVIGATION_ABORTED|an.NAVIGATION_CANCELLED)?M:Ra(M,an.NAVIGATION_GUARD_REDIRECT)?(W(Et(j(M.to),{force:!0}),Ee).then(z=>{Ra(z,an.NAVIGATION_ABORTED|an.NAVIGATION_DUPLICATED)&&!ue.delta&&ue.type===Vd.pop&&r.go(-1,!1)}).catch(Ll),Promise.reject()):(ue.delta&&r.go(-ue.delta,!1),de(M,Ee,A))).then(M=>{M=M||Y(Ee,A,!1),M&&(ue.delta&&!Ra(M,an.NAVIGATION_CANCELLED)?r.go(-ue.delta,!1):ue.type===Vd.pop&&Ra(M,an.NAVIGATION_ABORTED|an.NAVIGATION_DUPLICATED)&&r.go(-1,!1)),ye(Ee,A,M)}).catch(Ll)}))}let xe=xl(),$e=xl(),te;function de(N,oe,ue){Ae(N);const Ee=$e.list();return Ee.length?Ee.forEach(Be=>Be(N,oe,ue)):console.error(N),Promise.reject(N)}function Le(){return te&&l.value!==fs?Promise.resolve():new Promise((N,oe)=>{xe.add([N,oe])})}function Ae(N){return te||(te=!N,ne(),xe.list().forEach(([oe,ue])=>N?ue(N):oe()),xe.reset()),N}function Fe(N,oe,ue,Ee){const{scrollBehavior:Be}=e;if(!Li||!Be)return Promise.resolve();const A=!ue&&k0(Rh(N.fullPath,0))||(Ee||!ue)&&history.state&&history.state.scroll||null;return Nt().then(()=>Be(N,oe,A)).then(M=>M&&C0(M)).catch(M=>de(M,N,oe))}const Ke=N=>r.go(N);let lt;const Ze=new Set,ut={currentRoute:l,listening:!0,addRoute:b,removeRoute:y,clearRoutes:t.clearRoutes,hasRoute:B,getRoutes:P,resolve:L,options:e,push:H,replace:be,go:Ke,back:()=>Ke(-1),forward:()=>Ke(1),beforeEach:a.add,beforeResolve:s.add,afterEach:i.add,onError:$e.add,isReady:Le,install(N){N.component("RouterLink",ex),N.component("RouterView",rx),N.config.globalProperties.$router=ut,Object.defineProperty(N.config.globalProperties,"$route",{enumerable:!0,get:()=>m(l)}),Li&&!lt&&l.value===fs&&(lt=!0,H(r.location).catch(Ee=>{}));const oe={};for(const Ee in fs)Object.defineProperty(oe,Ee,{get:()=>l.value[Ee],enumerable:!0});N.provide(hc,ut),N.provide(Of,_v(oe)),N.provide(Yd,l);const ue=N.unmount;Ze.add(N),N.unmount=function(){Ze.delete(N),Ze.size<1&&(d=fs,pe&&pe(),pe=null,l.value=fs,lt=!1,te=!1),ue()}}};function fe(N){return N.reduce((oe,ue)=>oe.then(()=>Se(ue)),Promise.resolve())}return ut}function sx(){return Lr(hc)}function ix(e){return Lr(Of)}const Hh=768;function Df(){const e=S(typeof window<"u"?window.innerWidth<Hh:!1);let t=null;function n(o){e.value=o.matches}return pi(()=>{t=window.matchMedia(`(max-width: ${Hh-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Jl(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const lx={key:0,class:"desktop-sidebar"},ux={class:"desktop-main"},qh="codex-web-local.sidebar-width.v1",cx=260,dx=620,Wh=320,fx=hn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Df();function o(d){return Math.min(dx,Math.max(cx,d))}function r(){if(typeof window>"u")return Wh;const d=window.localStorage.getItem(qh),c=Number(d);return Number.isFinite(c)?o(c):Wh}const a=S(r()),s=K(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${a.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function i(d){typeof window>"u"||window.localStorage.setItem(qh,String(d))}function l(d){d.preventDefault();const c=d.clientX,v=a.value,f=y=>{const P=y.clientX-c;a.value=o(v+P)},b=()=>{i(a.value),window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",b)};window.addEventListener("mousemove",f),window.addEventListener("mouseup",b)}return(d,c)=>(_(),F("div",{class:at(["desktop-layout",{"is-mobile":m(n)}]),style:er(s.value)},[m(n)?(_(),Qe(Ki,{key:0,to:"body"},[Oe(Xl,{name:"drawer"},{default:dt(()=>[e.isSidebarCollapsed?ve("",!0):(_(),F("div",{key:0,class:"mobile-drawer-backdrop",onClick:c[1]||(c[1]=v=>d.$emit("close-sidebar"))},[w("aside",{class:"mobile-drawer",onClick:c[0]||(c[0]=gt(()=>{},["stop"]))},[_o(d.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):ve("",!0),m(n)?ve("",!0):(_(),F(ot,{key:1},[e.isSidebarCollapsed?ve("",!0):(_(),F("aside",lx,[_o(d.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?ve("",!0):(_(),F("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),w("section",ux,[_o(d.$slots,"content",{},void 0)])],6))}}),It=(e,t)=>{const n=e.__vccOpts||e;for(const[o,r]of t)n[o]=r;return n},px=It(fx,[["__scopeId","data-v-782e512b"]]);function Gh(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Nr extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function rr(e,t){if(typeof e=="string"&&e.length>0)return e;const n=Gh(e);if(!n)return t;const o=n.error;if(typeof o=="string"&&o.length>0)return o;const r=Gh(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 Fr(e,t,n){return e instanceof Nr?e:e instanceof Error?new Nr(e.message||t,{code:"unknown_error",method:n}):new Nr(t,{code:"unknown_error",method:n})}function Eg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function hx(e,t){const n={method:e,params:t??null};let o;try{o=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(i){throw new Nr(i instanceof Error?i.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let r=null,a=null;try{a=await o.text(),r=JSON.parse(a)}catch{r=null}if(!o.ok){const i=rr(r,"")||(a==null?void 0:a.slice(0,500))||"",l=`RPC ${e} failed with HTTP ${o.status}`;throw new Nr(i?`${l}: ${i}`:l,{code:"http_error",method:e,status:o.status})}const s=r;if(!s||typeof s!="object"||!("result"in s))throw new Nr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:o.status});return s.result}async function mx(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Nr(rr(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 vx(e){const t=Eg(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 Vh(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function gx(e){if(typeof window>"u")return()=>{};let t=null,n=!1,o=null;const r=()=>{o!==null&&(window.clearTimeout(o),o=null)},a=(d,c)=>{if(n||o!==null)return;const v=Math.min(1e3*2**c,1e4);o=window.setTimeout(()=>{o=null,!n&&d()},v)},s=d=>{const c=vx(d);c&&e(c)},i=(d=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const c=new EventSource("/codex-api/events");let v=!1;c.onmessage=f=>{try{s(JSON.parse(f.data))}catch{}},c.addEventListener("ready",f=>{try{const b=f.data?JSON.parse(f.data):{ok:!0};Vh(e,b)}catch{Vh(e)}}),c.onerror=()=>{n||v||c.readyState===EventSource.CLOSED&&(v=!0,c.close(),a(()=>i(d+1),d))},t=()=>{v=!0,c.close()}},l=(d=0)=>{if(typeof WebSocket>"u"||n){i();return}t==null||t();const c=window.location.protocol==="https:"?"wss:":"ws:",v=new WebSocket(`${c}//${window.location.host}/codex-api/ws`);let f=!1,b=!1,y=window.setTimeout(()=>{f||n||b||(b=!0,v.close(),i())},2500);v.onopen=()=>{f=!0,r(),y!==null&&(window.clearTimeout(y),y=null)},v.onmessage=P=>{try{s(JSON.parse(String(P.data)))}catch{}},v.onerror=()=>{},v.onclose=()=>{if(y!==null&&(window.clearTimeout(y),y=null),!(n||b)){if(!f){i();return}a(()=>l(d+1),d)}},t=()=>{b=!0,y!==null&&(window.clearTimeout(y),y=null),v.close()}};return typeof WebSocket<"u"?l():i(),()=>{n=!0,r(),t==null||t()}}async function yx(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 Nr(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 Nr(rr(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function wx(){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 Nr(rr(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Eg(t),o=n==null?void 0:n.data;return Array.isArray(o)?o:[]}async function rt(e,t){try{return await hx(e,t)}catch(n){throw Fr(n,`RPC ${e} failed`,e)}}function Jt(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},o=n.message;if(typeof o=="string"&&o.trim().length>0)return o;const r=n.error;return typeof r=="string"&&r.trim().length>0?r:t}function Ge(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function ee(e){return typeof e=="string"&&e.length>0?e:null}function Ut(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Xn(e){return typeof e=="boolean"?e:null}function Er(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>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"}`)}}function Vu(e){const t=Ge(e);if(!t)return null;const n=ee(t.id),o=ee(t.kind),r=ee(t.name),a=ee(t.prompt),s=ee(t.rrule),i=ee(t.status);return!n||!r||!a||!s||o!=="heartbeat"&&o!=="cron"||i!=="ACTIVE"&&i!=="PAUSED"?null:{id:n,kind:o,name:r,prompt:a,rrule:s,status:i,targetThreadId:ee(t.targetThreadId),cwds:Array.isArray(t.cwds)?t.cwds.filter(l=>typeof l=="string"&&l.trim().length>0):[],createdAtMs:Ut(t.createdAtMs),updatedAtMs:Ut(t.updatedAtMs),nextRunAtMs:Ut(t.nextRunAtMs)}}function Mg(e){if(Array.isArray(e))return e.flatMap(n=>{const o=Vu(n);return o?[o]:[]});const t=Vu(e);return t?[t]:[]}async function bx(){var r;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(rr(t,"Failed to load thread automations"));const n=Ge((r=Ge(t))==null?void 0:r.data),o={};if(!n)return o;for(const[a,s]of Object.entries(n)){const i=Mg(s);i.length>0&&(o[a]=i)}return o}async function Tx(){var r;const e=await fetch("/codex-api/project-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(rr(t,"Failed to load project automations"));const n=Ge((r=Ge(t))==null?void 0:r.data),o={};if(!n)return o;for(const[a,s]of Object.entries(n)){const i=Mg(s);i.length>0&&(o[a]=i)}return o}async function Sx(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(rr(n,"Failed to save thread automation"));const o=Vu((r=Ge(n))==null?void 0:r.data);if(!o)throw new Error("Thread automation response was malformed");return o}async function Cx(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(rr(n,"Failed to save project automation"));const o=Vu((r=Ge(n))==null?void 0:r.data);if(!o)throw new Error("Project automation response was malformed");return o}async function Kh(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(rr(r,"Failed to delete thread automation"))}async function jg(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(rr(r,"Failed to delete project automation"))}async function xx(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(rr(o,"Failed to run thread automation"))}const kx=new Set(["node_modules","dist","build","out",".next",".nuxt","coverage","__pycache__",".cache",".turbo","target",".venv","venv",".idea",".vscode","output"]);function Lg(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>n.startsWith(".")||kx.has(n))}function Ix(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=Array.isArray(t.files)?t.files:[],o=[];for(const r of n){if(!r||typeof r!="object"||Array.isArray(r))continue;const s=r.path,i=typeof s=="string"?s.trim():"";!i||Lg(i)||o.push({path:i})}return o}async function Ax(e,t){await rt("fuzzyFileSearch/sessionStart",{sessionId:t,roots:e})}async function _x(e,t){await rt("fuzzyFileSearch/sessionUpdate",{sessionId:e,query:t})}async function Px(e){await rt("fuzzyFileSearch/sessionStop",{sessionId:e}).catch(()=>{})}async function Yh(e,t,n=20){const o=e.trim();if(!o)return[];const r=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:o,query:t.trim(),limit:n})}),a=await r.json();if(!r.ok){const d=Jt(a,"Failed to search files");throw new Error(d)}const s=a&&typeof a=="object"&&!Array.isArray(a)?a:{},i=Array.isArray(s.data)?s.data:[],l=[];for(const d of i){if(!d||typeof d!="object"||Array.isArray(d))continue;const v=d.path,f=typeof v=="string"?v.trim():"";!f||Lg(f)||l.push({path:f})}return l}async function Rx(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),o=await n.json();if(!n.ok)throw new Error(o.error||"Failed to search threads");return o.data??{threadIds:[],indexedThreadCount:0}}function Ex(e){const t=Ge(e);if(!t)return null;const n=ee(t.id),o=ee(t.threadId),r=ee(t.cwd),a=ee(t.shell);return!n||!o||!r||!a?null:{id:n,threadId:o,cwd:r,shell:a,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:Xn(t.truncated)??!1}}async function ol(e,t){const n=await fetch(e,t),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(rr(o,`Terminal request failed with HTTP ${n.status}`));return o}async function RD(e){var o;const t=await ol("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=Ex((o=Ge(t))==null?void 0:o.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function Mx(){const e=await ol("/codex-api/thread-terminal/status"),t=Ge(e);return{available:Xn(t==null?void 0:t.available)??!1,reason:ee(t==null?void 0:t.reason)||null}}async function ED(e){const t=await ol(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=Ge(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(r=>{const a=Ge(r),s=ee(a==null?void 0:a.label),i=ee(a==null?void 0:a.value),l=ee(a==null?void 0:a.source);return!s||!i||l!=="package"&&l!=="script"&&l!=="make"?[]:[{label:s,value:i,source:l}]})}async function MD(e,t){await ol("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function jD(e,t,n){await ol("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function LD(e){await ol("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}const Ng=["none","minimal","low","medium","high","xhigh","max","ultra"];function Zi(e){return typeof e=="string"&&Ng.some(t=>t===e)}function jx(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function Xe(e){return jx(e)}function $g(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function Lx(e){const t=Xe(e);return t.startsWith("/")||$g(t)}function Nx(e){const t=Xe(e).replace(/[\\/]+/gu,"/");return $g(t)?t.toLowerCase():t}function Bo(e){const t=Xe(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function qi(e){const t=Xe(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function nr(e){return Bo(e)||Xe(e)||"Projectless"}function Ku(e){const t=Xe(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function Jh(e){return new Date(e*1e3).toISOString()}function $x(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Ox(e){const t=e.error;return typeof(t==null?void 0:t.message)=="string"?t.message.trim():""}const Dx=/^##\s+(.+?):\s+(.+?)\s*$/,Fx=/^#\s*files mentioned by the user\s*:?\s*$/i;function Bx(e){var r,a;const t=e.split(`
|
|
27
27
|
`).findIndex(s=>Fx.test(s.trim()));if(t<0)return[];const n=e.split(`
|
|
28
28
|
`).slice(t+1),o=[];for(const s of n){const i=s.trim();if(!i)continue;const l=i.match(Dx);if(!l)break;const d=(r=l[1])==null?void 0:r.trim(),c=(a=l[2])==null?void 0:a.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");d&&c&&o.push({label:d,path:c})}return o}function Ux(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 Og(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function zx(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 Hx(e){return e.replace(/</giu,"<").replace(/>/giu,">").replace(/&/giu,"&")}function vd(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?Hx(n[1].trim()):""}function qx(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=vd(t,"current_time_iso"),o=vd(t,"instructions");return!n||!o?null:{automationId:vd(t,"automation_id"),currentTimeIso:n,instructions:o}}function Wx(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],o=[],r=[],a=[];for(const[d,c]of t.entries()){if(c.type==="text"&&typeof c.text=="string"&&c.text.length>0&&n.push(c.text),c.type==="image"&&typeof c.url=="string"&&c.url.trim().length>0&&o.push(c.url.trim()),c.type==="localImage"&&typeof c.path=="string"&&c.path.trim().length>0&&o.push(Og(c.path.trim())),c.type==="skill"){const v=typeof c.name=="string"?c.name.trim():"",f=typeof c.path=="string"?c.path.trim():"";v&&f&&r.push({name:v,path:f})}c.type!=="text"&&c.type!=="image"&&c.type!=="localImage"&&c.type!=="skill"&&a.push({id:`${e}:user-content:${d}`,role:"user",text:"",messageType:`userContent.${c.type}`,rawPayload:$x(c),isUnhandled:!0})}const s=n.join(`
|
|
29
29
|
`),i=Bx(s),l=qx(s);return{text:(l==null?void 0:l.instructions)??Ux(s),images:o,skills:r,fileAttachments:i,rawBlocks:a,isAutomationRun:l!==null,automationDisplayName:(l==null?void 0:l.automationId)||null}}function Gx(e){var a;const t=e.replace(/\r\n/g,`
|
|
@@ -52,13 +52,13 @@ ${e}
|
|
|
52
52
|
...${e.length-Sd} more item(s)`:"";return`${t}:
|
|
53
53
|
${n.join(`
|
|
54
54
|
`)||"empty"}${r}`}catch(n){return`${t}: unavailable (${ey(_l(n))})`}}function FA(){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}`,Sm(window.localStorage,"localStorage"),Sm(window.sessionStorage,"sessionStorage")].join(`
|
|
55
|
-
`)}function oi(e){const t=e.message.trim();if(!t)return;const n=Wi.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()};Wi.value=[o,...Wi.value].slice(0,MA)}function ty(e=Wi.value){var d;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.
|
|
55
|
+
`)}function oi(e){const t=e.message.trim();if(!t)return;const n=Wi.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()};Wi.value=[o,...Wi.value].slice(0,MA)}function ty(e=Wi.value){var d;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.115",a="codex-mobile",s=e.slice(0,12).map((c,v)=>[`${v+1}. [${c.atIso}] ${c.kind}`,c.method?`${c.method}`:"",c.url??"",typeof c.status=="number"?`${c.status} ${c.statusText??""}`.trim():"",c.message].filter(Boolean).join(" | ")).join(`
|
|
56
56
|
`),i=["What happened?","","","Context",`URL: ${n}`,`User agent: ${o}`,`Viewport: ${t}`,`App version: ${r}`,`Worktree: ${a}`,"","Browser/app state",FA(),"","Recent diagnostics",s||"No diagnostics captured.","","Visible page text",OA()].join(`
|
|
57
|
-
`).slice(0,jA),l=`Codex Web feedback: ${ey((d=e[0])==null?void 0:d.message)}`;return`mailto:${Zg}?subject=${Tm(l)}&body=${Tm(i)}`}function BA(){typeof window>"u"||(window.location.href=ty())}function UA(){if(!(typeof window>"u")&&(bm||(bm=!0,window.addEventListener("error",e=>{oi({kind:"window-error",message:e.error?_l(e.error):e.message,url:e.filename||window.location.href})}),window.addEventListener("unhandledrejection",e=>{oi({kind:"unhandled-rejection",message:_l(e.reason),url:window.location.href})})),!Cd)){if(typeof window.fetch!="function"){oi({kind:"fetch-error",message:"Feedback diagnostics could not monitor fetch: window.fetch is unavailable",url:window.location.href});return}try{xd=window.fetch.bind(window),window.fetch=async(e,t)=>{const n=LA(e),o=NA(e,t);try{const r=await xd(e,t);return r.ok||oi({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 oi({kind:"fetch-error",message:_l(r),url:n,method:o}),r}},Cd=!0}catch(e){xd=null,Cd=!1;try{oi({kind:"fetch-error",message:`Feedback diagnostics could not monitor fetch: ${_l(e)}`,url:window.location.href})}catch{}}}}function ny(){const e=K(()=>Wi.value.length>0);function t(n,o){oi({kind:"visible-error",message:n,url:o||(typeof window>"u"?void 0:window.location.href)})}return{diagnostics:Wi,hasFeedbackDiagnostics:e,recordVisibleFailure:t,openFeedbackMail:BA,buildFeedbackMailto:ty,feedbackMailtoBase:$A}}const oy="codex-web-local.recycle-bin.v1";function ry(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(oy);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 Cm(e){if(!(typeof window>"u"))try{window.localStorage.setItem(oy,JSON.stringify(e))}catch{}}const Ea=S(ry());function zA(){function e(){Ea.value=ry()}function t(r){Ea.value=[{...r,archivedAtIso:new Date().toISOString()},...Ea.value.filter(a=>a.id!==r.id)],Cm(Ea.value)}function n(r){Ea.value=Ea.value.filter(a=>a.id!==r),Cm(Ea.value)}async function o(r){if(!Ea.value.some(a=>a.id===r))return{ok:!1,error:"Thread is not in the recycle bin"};try{return await kk(r),n(r),{ok:!0}}catch(a){return{ok:!1,error:a instanceof Error?a.message:"Failed to restore thread"}}}return{records:Ea,loadRecords:e,recordArchivedThread:t,removeArchivedRecord:n,restoreArchivedThread:o}}const HA=["title","aria-label","disabled"],qA={key:1,class:"composer-dropdown-value"},WA={key:0,class:"composer-dropdown-search-wrap"},GA=["placeholder","onKeydown"],VA={class:"composer-dropdown-options",role:"listbox"},KA=["onClick"],YA={key:0,class:"composer-dropdown-empty"},JA=hn({__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),a=S(null),s=S(null),i=S(null),l=S(!1),d=S(""),c=S({});let v=!1;const f=K(()=>{var xe;const ne=n.options.find($e=>$e.value===n.modelValue);return ne?ne.label:((xe=n.placeholder)==null?void 0:xe.trim())||""}),b=K(()=>n.openDirection??"down"),y=K(()=>n.menuAlign??"start"),P=K(()=>n.iconOnly===!0),B=K(()=>n.enableSearch===!0),L=K(()=>n.variant==="pill"?"composer-dropdown-trigger--pill":""),j=K(()=>{var ne;return((ne=n.searchPlaceholder)==null?void 0:ne.trim())||"Quick search projects"}),U=K(()=>{var ne;return((ne=n.emptyLabel)==null?void 0:ne.trim())||"No results"}),H=K(()=>{var ne;return f.value||((ne=n.placeholder)==null?void 0:ne.trim())||"Select option"}),be=K(()=>{const ne=d.value.trim().toLowerCase();return ne?n.options.filter(xe=>xe.label.toLowerCase().includes(ne)||xe.value.toLowerCase().includes(ne)):n.options});function le(){n.disabled||(l.value=!l.value)}function W(ne,xe,$e){return Math.min($e,Math.max(xe,ne))}function he(){var oe,ue,Ee,Be;if(!l.value)return;const ne=r.value;if(!ne||typeof window>"u")return;const xe=ne.getBoundingClientRect(),$e=window.innerWidth,te=window.innerHeight,de=8,Le=8,Ae=Math.max(0,$e-de*2),Fe=((oe=s.value)==null?void 0:oe.offsetWidth)??((ue=a.value)==null?void 0:ue.offsetWidth)??224,Ke=((Ee=s.value)==null?void 0:Ee.offsetHeight)??((Be=a.value)==null?void 0:Be.offsetHeight)??0,lt=Math.min(Fe,Ae),Ze=Math.max(de,$e-lt-de),ut=y.value==="end"?xe.right-lt:xe.left,fe=W(ut,de,Ze);let N=b.value==="up"?xe.top-Ke-Le:xe.bottom+Le;Ke>0&&N+Ke>te-de&&(N=te-Ke-de),N=Math.max(de,N),c.value={position:"fixed",left:`${fe}px`,right:"auto",top:`${N}px`,bottom:"auto",width:`${lt}px`}}function Se(){v||typeof window>"u"||(window.addEventListener("resize",he),window.addEventListener("scroll",he,!0),v=!0)}function Pe(){!v||typeof window>"u"||(window.removeEventListener("resize",he),window.removeEventListener("scroll",he,!0),v=!1)}function ge(ne){o("update:modelValue",ne),l.value=!1,d.value=""}function Y(){if(d.value.length>0){d.value="";return}l.value=!1}function pe(ne){if(!l.value)return;const xe=r.value;if(!xe)return;const $e=ne.target;$e instanceof Node&&(xe.contains($e)||(l.value=!1,d.value=""))}return tt(l,ne=>{if(!ne){Pe(),c.value={};return}Se(),Nt(()=>{var xe;he(),window.requestAnimationFrame(he),B.value&&((xe=i.value)==null||xe.focus())})}),pi(()=>{window.addEventListener("pointerdown",pe)}),_s(()=>{window.removeEventListener("pointerdown",pe),Pe()}),(ne,xe)=>(_(),F("div",{ref_key:"rootRef",ref:r,class:"composer-dropdown"},[w("button",{class:at(["composer-dropdown-trigger",L.value]),type:"button",title:H.value,"aria-label":H.value,disabled:e.disabled,onClick:le},[e.selectedPrefixIcon?(_(),Qe(_f(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):ve("",!0),P.value?ve("",!0):(_(),F("span",qA,D(f.value),1)),Oe(Cs,{class:"composer-dropdown-chevron"})],10,HA),l.value?(_(),F("div",{key:0,ref_key:"menuWrapRef",ref:a,class:at(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":b.value==="up","composer-dropdown-menu-wrap-down":b.value==="down"}]),style:er(c.value)},[w("div",{ref_key:"menuRef",ref:s,class:"composer-dropdown-menu"},[B.value?(_(),F("div",WA,[xn(w("input",{ref_key:"searchInputRef",ref:i,"onUpdate:modelValue":xe[0]||(xe[0]=$e=>d.value=$e),class:"composer-dropdown-search-input",type:"text",placeholder:j.value,onKeydown:Ao(gt(Y,["prevent"]),["esc"])},null,40,GA),[[Nn,d.value]])])):ve("",!0),w("ul",VA,[(_(!0),F(ot,null,Zt(be.value,$e=>(_(),F("li",{key:$e.value},[w("button",{class:at(["composer-dropdown-option",{"is-selected":$e.value===e.modelValue}]),type:"button",onClick:te=>ge($e.value)},D($e.label),11,KA)]))),128)),be.value.length===0?(_(),F("li",YA,D(U.value),1)):ve("",!0)])],512)],6)):ve("",!0)],512))}}),ci=It(JA,[["__scopeId","data-v-48e2516e"]]),QA={},XA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ZA(e,t){return _(),F("svg",XA,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const of=It(QA,[["render",ZA]]),e_=["aria-label","onKeydown"],t_={class:"app-dialog-header"},n_={class:"app-dialog-title-wrap"},o_={class:"app-dialog-title"},r_={key:0,class:"app-dialog-subtitle"},a_=["aria-label","title"],s_={class:"app-dialog-body"},i_={key:0,class:"app-dialog-footer"},l_=hn({__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}=da();function a(){o("close")}function s(i){n.open&&i.key==="Escape"&&(i.preventDefault(),a())}return tt(()=>n.open,i=>{typeof window>"u"||(i?window.addEventListener("keydown",s):window.removeEventListener("keydown",s))},{immediate:!0}),_s(()=>{typeof window>"u"||window.removeEventListener("keydown",s)}),(i,l)=>(_(),Qe(Ki,{to:"body"},[e.open?(_(),F("div",{key:0,class:"app-dialog-overlay",onClick:gt(a,["self"])},[w("div",{class:at(["app-dialog-panel",`app-dialog-panel--${e.size}`]),role:"dialog","aria-modal":"true","aria-label":e.ariaLabel||e.title,onKeydown:Ao(gt(a,["prevent"]),["esc"])},[w("div",t_,[w("div",n_,[w("h3",o_,D(e.title),1),e.subtitle?(_(),F("p",r_,D(e.subtitle),1)):ve("",!0)]),w("button",{class:"app-dialog-close",type:"button","aria-label":h(r)("Close"),title:h(r)("Close"),onClick:a},[Oe(of,{class:"app-dialog-close-icon"})],8,a_)]),w("div",s_,[_o(i.$slots,"default",{},void 0)]),i.$slots.footer?(_(),F("div",i_,[_o(i.$slots,"footer",{},void 0)])):ve("",!0)],42,e_)])):ve("",!0)]))}}),kd=It(l_,[["__scopeId","data-v-0c988f32"]]),u_={key:0,class:"sidebar-menu-row-left"},c_={class:"sidebar-menu-row-main"},d_={key:1,class:"sidebar-menu-row-right"},f_={key:0,class:"sidebar-menu-row-right-default"},p_={key:1,class:"sidebar-menu-row-right-hover"},h_=hn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=PS(),o=K(()=>!!n.left),r=K(()=>!!n.right),a=K(()=>!!n["right-hover"]),s=K(()=>r.value||a.value);return(i,l)=>(_(),Qe(_f(t.as),jf({class:"sidebar-menu-row","data-has-left":o.value,"data-has-right":s.value,"data-has-right-hover":a.value,"data-force-right-hover":t.forceRightHover},i.$attrs),{default:dt(()=>[o.value?(_(),F("span",u_,[_o(i.$slots,"left",{},void 0,!0)])):ve("",!0),w("span",c_,[_o(i.$slots,"default",{},void 0,!0)]),s.value?(_(),F("span",d_,[r.value?(_(),F("span",f_,[_o(i.$slots,"right",{},void 0,!0)])):ve("",!0),a.value?(_(),F("span",p_,[_o(i.$slots,"right-hover",{},void 0,!0)])):ve("",!0)])):ve("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),hs=It(h_,[["__scopeId","data-v-5fc666fb"]]),m_={},v_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function g_(e,t){return _(),F("svg",v_,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 18v-6m0 0a4 4 0 0 1 4-4h2m-6 4a4 4 0 0 0-4-4H6m0-4a2 2 0 1 0 0 4a2 2 0 0 0 0-4m12 0a2 2 0 1 0 0 4a2 2 0 0 0 0-4m-6 14a2 2 0 1 0 0 4a2 2 0 0 0 0-4"},null,-1)])])}const Ju=It(m_,[["render",g_]]),y_={},w_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function b_(e,t){return _(),F("svg",w_,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"},null,-1)])])}const ay=It(y_,[["render",b_]]),T_=["data-menu-open"],S_={class:"thread-left-stack"},C_=["data-state"],x_=["data-confirming","title"],k_={key:0,class:"thread-delete-confirm-label"},I_={class:"thread-row-title-wrap"},A_={class:"thread-row-title-line"},__={class:"thread-row-title"},P_=["title"],R_={key:0,class:"thread-row-automation-count"},E_=["data-state"],M_={class:"thread-row-time"},j_=hn({__name:"SidebarThreadRow",props:{thread:{},selected:{type:Boolean},pinned:{type:Boolean},menuOpen:{type:Boolean},showStatusIndicator:{type:Boolean},threadState:{},inlineDeleteConfirming:{type:Boolean},automationCount:{},automationTooltip:{},requestLabel:{},relativeTime:{},deleteLabel:{},confirmDeleteLabel:{},confirmLabel:{},worktreeLabel:{},setMenuWrapRef:{type:Function}},emits:["select","inline-delete","menu-toggle","row-leave","row-contextmenu"],setup(e,{emit:t}){const n=e,o=t;function r(a){n.setMenuWrapRef(a instanceof HTMLDivElement?a:null)}return(a,s)=>(_(),F("li",{class:"thread-row-item","data-menu-open":n.menuOpen?"true":"false"},[Oe(hs,{class:"thread-row","data-active":n.selected,"data-pinned":n.pinned,"data-menu-open":n.menuOpen?"true":"false","force-right-hover":n.menuOpen,onClick:s[3]||(s[3]=i=>o("select")),onMouseleave:s[4]||(s[4]=i=>o("row-leave",i)),onContextmenu:s[5]||(s[5]=i=>o("row-contextmenu",i))},{left:dt(()=>[w("span",S_,[n.showStatusIndicator?(_(),F("span",{key:0,class:"thread-status-indicator","data-state":n.threadState},null,8,C_)):ve("",!0),w("button",{class:"thread-delete-button",type:"button","data-confirming":n.inlineDeleteConfirming,title:n.inlineDeleteConfirming?n.confirmDeleteLabel:n.deleteLabel,onClick:s[0]||(s[0]=gt(i=>o("inline-delete"),["stop"]))},[n.inlineDeleteConfirming?(_(),F("span",k_,D(n.confirmLabel),1)):(_(),Qe(ay,{key:1,class:"thread-icon"}))],8,x_)])]),right:dt(()=>[w("span",M_,D(n.relativeTime),1)]),"right-hover":dt(()=>[w("div",{ref:r,class:"thread-menu-wrap"},[w("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:s[2]||(s[2]=gt(i=>o("menu-toggle"),["stop"]))},[Oe(nf,{class:"thread-icon"})])])]),default:dt(()=>[w("button",{class:"thread-main-button",type:"button",onClick:s[1]||(s[1]=gt(i=>o("select"),["stop"]))},[w("span",I_,[w("span",A_,[w("span",__,D(n.thread.title),1),n.thread.hasWorktree?(_(),Qe(Ju,{key:0,class:"thread-row-worktree-icon",title:n.worktreeLabel},null,8,["title"])):ve("",!0),n.automationCount>0?(_(),F("span",{key:1,class:"thread-row-automation-chip",title:n.automationTooltip},[Oe(bs,{class:"thread-row-automation-icon"}),n.automationCount>1?(_(),F("span",R_,D(n.automationCount),1)):ve("",!0)],8,P_)):ve("",!0),n.thread.pendingRequestState?(_(),F("span",{key:2,class:"thread-row-request-chip","data-state":n.thread.pendingRequestState},D(n.requestLabel),9,E_)):ve("",!0)])])])]),_:1},8,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,T_))}}),Cu=It(j_,[["__scopeId","data-v-fac0242e"]]);function L_(e,t,n){return n.canPruneMissing?e.filter(o=>t.has(o)):e}function N_(e){const{getGroups:t,t:n}=e,o=S({}),r=S({}),a=S(!1),s=S("thread"),i=S(""),l=S(""),d=S(""),c=S("create"),v=S(!1),f=S("thread"),b=S(""),y=S(""),P=S(""),B=S(""),L=S(!1),j=S(!1),U=S({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),H=S({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),be=K(()=>{if(s.value==="project"){const ae=l.value;return ae?r.value[ae]??[]:[]}const q=i.value;return q?o.value[q]??[]:[]}),le=K(()=>fe(U.value.rrule)),W=K(()=>v.value&&c.value==="create"?f.value==="thread"?n("This creates a heartbeat automation attached to the selected chat."):n("This creates a project automation attached to the selected project folder."):s.value==="project"?n("This creates project automations attached to the selected project folder."):n("This creates heartbeat automations attached to the selected thread.")),he=K(()=>{var ae;const q=[];for(const _e of t())for(const Ye of _e.threads){const bt=((ae=Ye.title)==null?void 0:ae.trim())||Ye.id,Tt=e.getProjectDisplayName(_e.projectName);q.push({value:Ye.id,label:`${bt} · ${Tt}`,searchText:`${bt} ${Tt} ${Ye.id}`.toLowerCase()})}return q}),Se=K(()=>{const q=[];for(const ae of t()){const _e=e.getProjectAutomationKey(ae.projectName);if(!_e)continue;const Ye=e.getProjectDisplayName(ae.projectName);q.push({value:_e,label:Ye,searchText:`${Ye} ${_e}`.toLowerCase()})}return q}),Pe=K(()=>(f.value==="project"?Se.value:he.value).map(ae=>({value:ae.value,label:ae.label}))),ge=[{value:"minutes",label:n("minutes")},{value:"hours",label:n("hours")},{value:"days",label:n("days")}],Y=K(()=>[{value:"ACTIVE",label:n("Active")},{value:"PAUSED",label:n("Paused")}]);tt(Pe,q=>{var ae;v.value&&(q.some(_e=>_e.value===b.value)||(b.value=((ae=q[0])==null?void 0:ae.value)??""))});function pe(q){var ae;return((ae=o.value[q])==null?void 0:ae.length)??0}function ne(q){return pe(q)>0}function xe(q){var _e;const ae=e.getProjectAutomationKey(q);return ae?((_e=r.value[ae])==null?void 0:_e.length)??0:0}function $e(q){return xe(q)>0}function te(q){if(q.length===0)return"";if(q.length>1){const Ye=q.filter(bt=>bt.status==="ACTIVE").length;return`${q.length} ${n("automations")} • ${Ye} ${n("active")}`}const[ae]=q,_e=ae.status==="PAUSED"?"-":ae.nextRunAtMs?new Date(ae.nextRunAtMs).toLocaleString():n("Not scheduled");return`${ae.name} • ${n("Next run")}: ${_e}`}function de(q){return te(o.value[q]??[])}function Le(q){const ae=e.getProjectAutomationKey(q);return te(ae?r.value[ae]??[]:[])}function Ae(q){return String(Math.max(0,q)).padStart(2,"0")}function Fe(q,ae){const _e=typeof q=="number"?q:Number(q);return Number.isFinite(_e)?Math.max(1,Math.floor(_e)):ae}function Ke(q){const[ae,_e]=q.split(":"),Ye=Math.min(23,Math.max(0,Number(ae)||0)),bt=Math.min(59,Math.max(0,Number(_e)||0));return`FREQ=DAILY;BYHOUR=${Ye};BYMINUTE=${bt}`}function lt(q,ae){const _e=Fe(q,1);return ae==="minutes"?`FREQ=MINUTELY;INTERVAL=${_e}`:ae==="hours"?`FREQ=HOURLY;INTERVAL=${_e}`:`FREQ=DAILY;INTERVAL=${_e}`}function Ze(q){return Object.fromEntries(q.split(";").map(ae=>ae.trim()).filter(Boolean).map(ae=>{const[_e,...Ye]=ae.split("=");return[_e.toUpperCase(),Ye.join("=").trim()]}).filter(([ae,_e])=>ae&&_e))}function ut(q){var bt;const ae=Ze(q),_e=(bt=ae.FREQ)==null?void 0:bt.toUpperCase(),Ye=Fe(ae.INTERVAL,1);if(_e==="DAILY"&&ae.BYHOUR!==void 0&&ae.BYMINUTE!==void 0&&Ye===1){const Tt=Math.min(23,Math.max(0,Number(ae.BYHOUR)||0)),At=Math.min(59,Math.max(0,Number(ae.BYMINUTE)||0));return{mode:"daily",dailyTime:`${Ae(Tt)}:${Ae(At)}`,interval:1,intervalUnit:"hours"}}return _e==="MINUTELY"||_e==="HOURLY"||_e==="DAILY"&&ae.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:Ye,intervalUnit:_e==="MINUTELY"?"minutes":_e==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function fe(q){var bt;const ae=Ze(q),_e=(bt=ae.FREQ)==null?void 0:bt.toUpperCase(),Ye=Fe(ae.INTERVAL,1);if(_e==="DAILY"&&ae.BYHOUR!==void 0&&ae.BYMINUTE!==void 0&&Ye===1){const Tt=Math.min(23,Math.max(0,Number(ae.BYHOUR)||0)),At=Math.min(59,Math.max(0,Number(ae.BYMINUTE)||0));return`${n("RRULE")}: ${q} · ${n("runs daily at")} ${Ae(Tt)}:${Ae(At)}`}return _e==="MINUTELY"?`${n("RRULE")}: ${q} · ${n("runs every")} ${Ye} ${n("minute(s)")}`:_e==="HOURLY"?`${n("RRULE")}: ${q} · ${n("runs every")} ${Ye} ${n("hour(s)")}`:_e==="DAILY"&&ae.INTERVAL!==void 0?`${n("RRULE")}: ${q} · ${n("runs every")} ${Ye} ${n("day(s)")}`:q?`${n("RRULE")}: ${q}`:n("RRULE is required.")}function N(){const q=H.value;q.mode==="daily"?U.value.rrule=Ke(q.dailyTime):q.mode==="interval"&&(U.value.rrule=lt(q.interval,q.intervalUnit))}function oe(q){q!=="minutes"&&q!=="hours"&&q!=="days"||(H.value={...H.value,intervalUnit:q},N())}function ue(q){q!=="ACTIVE"&&q!=="PAUSED"||(U.value={...U.value,status:q})}function Ee(){H.value=ut(U.value.rrule)}function Be(q){H.value={...H.value,mode:q},N()}function A(q){var _e;s.value="thread",i.value=q,l.value="",v.value=!1,y.value="",P.value="";const ae=(_e=o.value[q])==null?void 0:_e[0];ae?je(ae.id):re(),a.value=!0,e.closeThreadMenu()}function M(q){var Ye;const ae=e.getProjectAutomationKey(q);if(!ae){s.value="project",i.value="",l.value="",v.value=!1,y.value=n("Project automation requires a resolved absolute project path."),P.value="",a.value=!0,e.closeProjectMenu();return}s.value="project",i.value="",l.value=ae,v.value=!1,y.value="",P.value="";const _e=(Ye=r.value[ae])==null?void 0:Ye[0];_e?je(_e.id):re(),a.value=!0,e.closeProjectMenu()}function z(q){s.value=q.scope,i.value=q.scope==="thread"?q.target:"",l.value=q.scope==="project"?q.target:"",v.value=!1,y.value="",P.value="",q.scope==="project"?r.value=He(r.value,q.target,q.automation):o.value=me(o.value,q.target,q.automation),je(q.automation.id),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function Z(){var q;v.value=!0,f.value="thread",b.value=((q=he.value[0])==null?void 0:q.value)??"",s.value="thread",i.value="",l.value="",y.value="",P.value="",re(),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function ce(q){var ae;f.value=q,b.value="",s.value=q==="project"?"project":"thread",b.value=((ae=Pe.value[0])==null?void 0:ae.value)??""}function re(){d.value="",c.value="create",y.value="",P.value="",U.value={name:s.value==="project"?"Project automation":"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},H.value=ut(U.value.rrule)}function je(q){const ae=be.value.find(_e=>_e.id===q);ae&&(d.value=ae.id,c.value="edit",y.value="",P.value="",U.value={name:ae.name,prompt:ae.prompt,rrule:ae.rrule,status:ae.status},H.value=ut(ae.rrule))}function Re(){a.value=!1,s.value="thread",i.value="",l.value="",d.value="",y.value="",P.value="",L.value=!1,j.value=!1}function ke(q,ae){return Object.fromEntries(Object.entries(q).filter(([_e])=>_e!==ae))}function me(q,ae,_e){const Ye=q[ae]??[],bt=Ye.findIndex(At=>At.id===_e.id),Tt=[...Ye];return bt>=0?Tt.splice(bt,1,_e):Tt.push(_e),{...q,[ae]:Tt}}function Ve(q,ae,_e){const Ye=(q[ae]??[]).filter(bt=>bt.id!==_e);return Ye.length>0?{...q,[ae]:Ye}:ke(q,ae)}function Ne(q,ae){return Object.fromEntries(Object.entries(q).filter(([_e])=>_e!==ae))}function He(q,ae,_e){const Ye=q[ae]??[],bt=Ye.findIndex(At=>At.id===_e.id),Tt=[...Ye];return bt>=0?Tt.splice(bt,1,_e):Tt.push(_e),{...q,[ae]:Tt}}async function Ue(){r.value=await Tx()}async function Je(q){await Kh(q).catch(()=>{}),o.value=ke(o.value,q)}async function et(){let q=i.value,ae=l.value;L.value=!0,y.value="",P.value="";try{if(N(),v.value&&c.value==="create"&&(f.value==="thread"?(q=b.value,ae="",s.value="thread",i.value=q,l.value=""):(ae=b.value,q="",s.value="project",i.value="",l.value=ae)),s.value==="thread"&&!q)throw new Error(n("Select a chat target for this automation"));if(s.value==="project"&&!ae)throw new Error(n("Select a project target for this automation"));const _e={id:d.value||void 0,name:U.value.name,prompt:U.value.prompt,rrule:U.value.rrule,status:U.value.status},Ye=s.value==="project"?await Cx({..._e,projectName:ae}):await Sx({..._e,threadId:q});s.value==="project"?await Ue():o.value=me(o.value,q,Ye),e.onAutomationsChanged(),je(Ye.id),P.value=n("Automation saved."),L.value=!1}catch(_e){y.value=_e instanceof Error?_e.message:n("Failed to save automation"),L.value=!1}}async function st(){const q=i.value,ae=l.value,_e=d.value;if(_e&&!(s.value==="thread"&&!q)&&!(s.value==="project"&&!ae)){L.value=!0,y.value="",P.value="";try{s.value==="project"?(await jg(ae,_e),await Ue()):(await Kh(q,_e),o.value=Ve(o.value,q,_e));const Ye=be.value[0];Ye?je(Ye.id):re(),e.onAutomationsChanged(),L.value=!1}catch(Ye){y.value=Ye instanceof Error?Ye.message:n("Failed to remove automation"),L.value=!1}}}async function mt(){const q=i.value,ae=d.value;if(!(!q||!ae)){j.value=!0,y.value="",P.value="";try{await xx(q,ae),P.value=n("Automation run queued.")}catch(_e){y.value=_e instanceof Error?_e.message:n("Failed to run automation")}finally{j.value=!1}}}return{automationByThreadId:o,automationByProjectName:r,automationDialogVisible:a,automationDialogScope:s,automationDialogThreadId:i,automationDialogProjectName:l,automationDialogAutomationId:d,automationDialogMode:c,automationTargetPickerVisible:v,automationTargetMode:f,automationTargetValue:b,automationDialogError:y,automationDialogNotice:P,projectAutomationActionError:B,isSavingAutomation:L,isRunningAutomation:j,automationDraft:U,automationScheduleDraft:H,automationDialogAutomations:be,automationSchedulePreview:le,automationDialogSubtitle:W,automationThreadTargetOptions:he,automationProjectTargetOptions:Se,automationTargetDropdownOptions:Pe,automationIntervalUnitOptions:ge,automationStatusOptions:Y,threadAutomationCount:pe,threadHasAutomation:ne,projectAutomationCount:xe,projectHasAutomation:$e,threadAutomationTooltip:de,projectAutomationTooltip:Le,syncAutomationRruleFromScheduleDraft:N,onAutomationIntervalUnitChange:oe,onAutomationStatusChange:ue,syncAutomationScheduleDraftFromRrule:Ee,setAutomationScheduleMode:Be,openAutomationDialog:A,openProjectAutomationDialog:M,openAutomationEditorFromPanel:z,openAutomationCreatorFromPanel:Z,setAutomationTargetMode:ce,startNewAutomationDraft:re,selectAutomationForEditing:je,closeAutomationDialog:Re,omitAutomationProject:Ne,reloadProjectAutomations:Ue,removeAutomationsForThread:Je,submitAutomationDialog:et,onDeleteAutomationFromDialog:st,onRunAutomationFromDialog:mt}}const $_=4,xm=6;function O_(e,t,n){if(e===null||n===0)return null;const o=Math.max(0,Math.min(e,n)),r=o>t?o-1:o,a=Math.max(0,Math.min(r,n-1));return a===t?null:a}function D_(e){const{getGroups:t,getFilteredGroups:n,isSearchActive:o,isCollapsed:r,getElevatedProjectName:a,onReorderProject:s,closeProjectMenu:i}=e,l=S(null),d=S(null),c=S(null);let v=null,f=null;const b=S(""),y=S({}),P=new Map,B=new WeakMap,L=typeof window<"u"?new ResizeObserver(fe=>{for(const N of fe){const oe=N.target,ue=B.get(oe);ue&&U(ue,oe)}}):null,j=()=>{var fe,N;return((fe=c.value)==null?void 0:fe.projectName)??((N=d.value)==null?void 0:N.projectName)??""};function U(fe,N){const oe=N.getBoundingClientRect().height;if(!Number.isFinite(oe)||oe<=0)return;const ue=y.value[fe];ue!==void 0&&Math.abs(ue-oe)<.5||(y.value={...y.value,[fe]:oe})}function H(fe,N){const oe=P.get(fe);oe&&oe!==N&&L&&L.unobserve(oe);const ue=N instanceof HTMLElement?N:N&&"$el"in N&&N.$el instanceof HTMLElement?N.$el:null;if(ue){P.set(fe,ue),B.set(ue,fe),U(fe,ue),L==null||L.observe(ue);return}oe&&(L==null||L.unobserve(oe)),P.delete(fe)}function be(fe){const N=y.value[fe]??0,oe=c.value,Ee=((oe==null?void 0:oe.projectName)===fe?oe.groupHeight:null)??N,Be=r(fe)?0:xm;return Math.max(0,Ee+Be)}const le=K(()=>{const fe=c.value;return fe?O_(fe.dropTargetIndexFull,fe.fromIndex,t().length):null}),W=K(()=>{const N=(o()?n():t()).map(A=>A.projectName),oe=c.value,ue=le.value;if(!oe||ue===null)return N;const Ee=[...N],[Be]=Ee.splice(oe.fromIndex,1);return Be?(Ee.splice(ue,0,Be),Ee):N}),he=K(()=>{const fe={};let N=0;for(const oe of W.value)fe[oe]=N,N+=be(oe);return fe}),Se=K(()=>{let fe=0;for(const N of W.value)fe+=be(N);return{height:`${Math.max(0,fe)}px`}});function Pe(fe,N){if(fe.button!==0||o()||d.value||c.value)return;const ue=t().findIndex(M=>M.projectName===N),Ee=P.get(N);if(ue<0||!Ee)return;const Be=Ee.getBoundingClientRect(),A=r(N)?0:xm;d.value={projectName:N,fromIndex:ue,startClientX:fe.clientX,startClientY:fe.clientY,pointerOffsetY:fe.clientY-Be.top,groupLeft:Be.left,groupWidth:Be.width,groupHeight:Be.height,groupOuterHeight:Be.height+A},fe.preventDefault(),ge()}function ge(){window.addEventListener("mousemove",pe),window.addEventListener("mouseup",ne),window.addEventListener("keydown",xe)}function Y(){window.removeEventListener("mousemove",pe),window.removeEventListener("mouseup",ne),window.removeEventListener("keydown",xe)}function pe(fe){v={clientX:fe.clientX,clientY:fe.clientY},te()}function ne(fe){de({clientX:fe.clientX,clientY:fe.clientY});const N=c.value;if(N&&le.value!==null){const oe=t().findIndex(ue=>ue.projectName===N.projectName);if(oe>=0){const ue=le.value;ue!==oe&&s(N.projectName,ue)}}$e({preserveToggleSuppression:!!N})}function xe(fe){fe.key==="Escape"&&(!d.value&&!c.value||(fe.preventDefault(),$e()))}function $e(fe={}){f!==null&&(window.cancelAnimationFrame(f),f=null),v=null,d.value=null,c.value=null,fe.preserveToggleSuppression||(b.value=""),Y()}function te(){f===null&&(f=window.requestAnimationFrame(()=>{if(f=null,!v)return;const fe=v;v=null,de(fe)}))}function de(fe){const N=d.value;if(!c.value&&N){const oe=fe.clientX-N.startClientX,ue=fe.clientY-N.startClientY;if(Math.hypot(oe,ue)<$_)return;i(),b.value=N.projectName,c.value={projectName:N.projectName,fromIndex:N.fromIndex,pointerOffsetY:N.pointerOffsetY,groupLeft:N.groupLeft,groupWidth:N.groupWidth,groupHeight:N.groupHeight,groupOuterHeight:N.groupOuterHeight,ghostTop:fe.clientY-N.pointerOffsetY,dropTargetIndexFull:null}}c.value&&Le(fe)}function Le(fe){const N=c.value;if(!N)return;if(N.ghostTop=fe.clientY-N.pointerOffsetY,!Ae(fe)){N.dropTargetIndexFull=null;return}const oe=fe.clientY,ue=l.value;if(!ue){N.dropTargetIndexFull=null;return}const Ee=t(),Be=ue.getBoundingClientRect(),A=new Map(Ee.map((ce,re)=>[ce.projectName,re])),M=Ee.map(ce=>ce.projectName).filter(ce=>ce!==N.projectName);let z=0,Z=Ee.length;for(const ce of M){const re=A.get(ce);if(re===void 0)continue;const je=be(ce),Re=Be.top+z+je/2;if(oe<Re){Z=re;break}z+=je}N.dropTargetIndexFull=Z}function Ae(fe){const N=l.value;if(!N)return!1;const oe=N.getBoundingClientRect(),ue=fe.clientX>=oe.left&&fe.clientX<=oe.right,Ee=fe.clientY>=oe.top-32&&fe.clientY<=oe.bottom+32;return ue&&Ee}function Fe(fe){var N;return((N=c.value)==null?void 0:N.projectName)===fe}function Ke(fe){const N=c.value,oe=he.value[fe]??0,ue=a()===fe;return!N||N.projectName!==fe?{position:"absolute",top:"0",left:"0",right:"0",zIndex:ue?"40":"1",transform:`translate3d(0, ${oe}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${N.groupLeft}px`,width:`${N.groupWidth}px`,height:`${N.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${N.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function lt(fe){return b.value===fe?(b.value="",!0):!1}function Ze(fe){const N=j();N&&!fe.includes(N)&&$e();const oe=new Set(fe),ue=Object.fromEntries(Object.entries(y.value).filter(([Ee])=>oe.has(Ee)));Object.keys(ue).length!==Object.keys(y.value).length&&(y.value=ue)}function ut(){for(const fe of P.values())L==null||L.unobserve(fe);P.clear(),$e()}return{groupsContainerRef:l,groupsContainerStyle:Se,setProjectGroupRef:H,isDraggingProject:Fe,projectGroupStyle:Ke,onProjectHandleMouseDown:Pe,takeToggleSuppression:lt,pruneProjectGroups:Ze,dispose:ut}}const F_={key:0,class:"pinned-section"},B_={class:"thread-tree-header"},U_={key:0,class:"thread-list"},z_={class:"projects-section"},H_={class:"thread-tree-header"},q_=["aria-expanded","aria-label","title"],W_={class:"organize-menu-title"},G_=["data-active"],V_={key:0},K_=["data-active"],Y_={key:0},J_=["data-active"],Q_={key:0},X_={class:"organize-menu-title"},Z_=["data-active"],eP={key:0},tP=["data-active"],nP={key:0},oP={key:0,class:"thread-tree-action-error"},rP={key:1,class:"thread-tree-no-results"},aP={key:2,class:"thread-tree-loading"},sP={key:3,class:"thread-list thread-list-global"},iP=["data-project-name","data-expanded","data-dragging"],lP={class:"project-icon-stack"},uP={class:"project-icon-folder"},cP={class:"project-icon-chevron"},dP=["data-dragging-handle","onMousedown"],fP=["title"],pP=["title"],hP={key:0,class:"thread-row-automation-count"},mP={class:"project-hover-controls"},vP=["onClick"],gP=["data-open-direction"],yP=["onClick"],wP=["onClick"],bP=["onClick"],TP=["onClick"],SP=["onClick"],CP=["onClick"],xP={class:"project-menu-label"},kP=["onInput"],IP=["aria-label","title","onClick"],AP={key:0,class:"thread-list"},_P={class:"project-empty"},PP=["onClick"],RP={class:"chats-section"},EP={class:"thread-tree-header"},MP={class:"chats-section-actions"},jP=["aria-label","title"],LP={key:0,class:"thread-tree-no-results"},NP={key:1,class:"thread-list thread-list-global"},$P=["data-open-direction"],OP=["disabled","title"],DP=["placeholder","onKeydown"],FP={class:"recycle-bin-content"},BP={key:0,class:"recycle-bin-empty"},UP={key:1,class:"recycle-bin-list"},zP={class:"recycle-bin-item-copy"},HP={class:"recycle-bin-item-title"},qP={key:0,class:"recycle-bin-item-meta"},WP={class:"recycle-bin-item-time"},GP={class:"recycle-bin-item-actions"},VP=["disabled","onClick"],KP=["onClick"],YP={key:2,class:"recycle-bin-error",role:"alert"},JP=["aria-label"],QP={class:"rename-thread-title"},XP={class:"rename-thread-subtitle"},ZP={key:0,class:"automation-target-picker"},eR={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},tR={class:"automation-target-dropdown"},nR=["aria-label"],oR=["onClick"],rR={class:"automation-thread-field"},aR={class:"automation-thread-label"},sR=["placeholder"],iR={class:"automation-thread-field"},lR={class:"automation-thread-label"},uR=["placeholder"],cR={class:"automation-thread-field"},dR={class:"automation-thread-label"},fR={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},pR={key:0,class:"automation-schedule-row"},hR={class:"automation-schedule-copy"},mR={key:1,class:"automation-schedule-row"},vR={class:"automation-schedule-copy"},gR={class:"automation-schedule-preview"},yR={class:"automation-thread-field"},wR={class:"automation-thread-label"},bR={key:2,class:"rename-thread-subtitle automation-thread-error"},TR={key:3,class:"rename-thread-subtitle automation-thread-notice"},SR={class:"rename-thread-actions"},CR=["disabled"],xR=["disabled"],kR=["disabled"],IR=["disabled"],km="codex-web-local.sidebar-section-expansion.v1",Im="codex-web-local.sidebar-chats-first.v1",Am="codex-web-local.sidebar-chat-sort-mode.v1",_m="codex-web-local.thread-view-mode.v1",Pm="codex-web-local.collapsed-projects.v1",AR=hn({__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}=da(),{recordVisibleFailure:a}=ny(),s=n,{records:i,loadRecords:l,recordArchivedThread:d,removeArchivedRecord:c,restoreArchivedThread:v}=zA(),f=S(!1),b=S(""),y=S("");function P(){xt.value=!1,b.value="",l(),f.value=!0}async function B(x){if(!y.value){y.value=x,b.value="";try{const R=await v(x);R.ok?s("restore-thread",x):b.value=R.error??"Failed to restore thread"}finally{y.value=""}}}const L=S({}),j=S({}),U=S(!0),H=S(!0),be=S(!0),le=S(!1),W=S(Mo(Im,!1)),he=S(en());let Se=!1;const Pe=S([]),ge=S({}),Y=S(""),pe=S([]),ne=S(""),xe=S(""),$e=S("hover"),te=S({}),de=S({}),Le=S({}),Ae=S("actions"),Fe=S(""),Ke=S(!1),lt=S(""),Ze=S(""),ut=S(null),fe=S(!1),N=S(""),oe=S(""),ue=N_({getGroups:()=>o.groups,t:r,getProjectDisplayName:mr,getProjectAutomationKey:qn,closeThreadMenu:ye,closeProjectMenu:$t,onAutomationsChanged:()=>s("automations-changed")}),{automationByThreadId:Ee,automationByProjectName:Be,automationDialogVisible:A,automationDialogScope:M,automationDialogAutomationId:z,automationDialogMode:Z,automationTargetPickerVisible:ce,automationTargetMode:re,automationTargetValue:je,automationDialogError:Re,automationDialogNotice:ke,projectAutomationActionError:me,isSavingAutomation:Ve,isRunningAutomation:Ne,automationDraft:He,automationScheduleDraft:Ue,automationDialogAutomations:Je,automationSchedulePreview:et,automationDialogSubtitle:st,automationTargetDropdownOptions:mt,automationIntervalUnitOptions:q,automationStatusOptions:ae,threadAutomationCount:_e,threadHasAutomation:Ye,projectAutomationCount:bt,projectHasAutomation:Tt,threadAutomationTooltip:At,projectAutomationTooltip:Br,syncAutomationRruleFromScheduleDraft:zt,onAutomationIntervalUnitChange:Ha,onAutomationStatusChange:fa,syncAutomationScheduleDraftFromRrule:pa,setAutomationScheduleMode:ar,openAutomationDialog:Ur,openProjectAutomationDialog:zr,openAutomationEditorFromPanel:Ps,openAutomationCreatorFromPanel:qa,setAutomationTargetMode:Wa,startNewAutomationDraft:Uo,selectAutomationForEditing:sr,closeAutomationDialog:Zn,omitAutomationProject:Rs,reloadProjectAutomations:ha,removeAutomationsForThread:Es,submitAutomationDialog:zo,onDeleteAutomationFromDialog:Po,onRunAutomationFromDialog:Dn}=ue,Ga=D_({getGroups:()=>o.groups,getFilteredGroups:()=>Lt.value,isSearchActive:()=>bn.value,isCollapsed:un,getElevatedProjectName:()=>ne.value?ne.value:xe.value?Gr.value.get(xe.value)??"":"",onReorderProject:(x,R)=>s("reorder-project",{projectName:x,toIndex:R}),closeProjectMenu:$t}),{groupsContainerRef:Ms,groupsContainerStyle:vt,setProjectGroupRef:Ct,isDraggingProject:kt,projectGroupStyle:mn,onProjectHandleMouseDown:Fn,takeToggleSuppression:ho,pruneProjectGroups:Hr,dispose:qr}=Ga,mo=new Map,Ho=new Map,Ro=S(null),Bn=S(null),xt=S(!1),eo=S(Eo());function vo(){if(typeof window>"u")return{};try{const x=window.localStorage.getItem(Pm);if(!x)return{};const R=JSON.parse(x);return!R||typeof R!="object"||Array.isArray(R)?{}:R}catch{return{}}}function Eo(){return typeof window>"u"?"project":window.localStorage.getItem(_m)==="chronological"?"chronological":"project"}function Mo(x,R){if(typeof window>"u")return R;const k=window.localStorage.getItem(x);return k==="true"?!0:k==="false"?!1:R}function en(){return typeof window>"u"?"updated":window.localStorage.getItem(Am)==="created"?"created":"updated"}j.value=vo();function Un(){if(!(typeof window>"u"))try{const x=JSON.parse(window.localStorage.getItem(km)||"{}");typeof x.pinned=="boolean"&&(U.value=x.pinned),typeof x.projects=="boolean"&&(H.value=x.projects),typeof x.chats=="boolean"&&(be.value=x.chats)}catch{}}function ir(){typeof window>"u"||window.localStorage.setItem(km,JSON.stringify({pinned:U.value,projects:H.value,chats:be.value}))}Un(),tt(j,x=>{typeof window>"u"||window.localStorage.setItem(Pm,JSON.stringify(x))},{deep:!0}),tt(eo,x=>{typeof window>"u"||window.localStorage.setItem(_m,x)}),tt(W,x=>{typeof window>"u"||window.localStorage.setItem(Im,String(x))}),tt(he,x=>{typeof window>"u"||window.localStorage.setItem(Am,x)}),tt([U,H,be],ir);const lr=K(()=>o.searchQuery.trim().toLowerCase()),bn=K(()=>lr.value.length>0),ma=K(()=>o.searchMatchedThreadIds?new Set(o.searchMatchedThreadIds):null),tn=K(()=>new Set(Pe.value)),Wr=K(()=>new Set(pe.value));function go(x){if(Wr.value.has(x.id))return!1;if(!bn.value)return!0;if(ma.value)return ma.value.has(x.id);const R=lr.value;return x.title.toLowerCase().includes(R)||x.preview.toLowerCase().includes(R)}const Lt=K(()=>o.groups.flatMap(x=>{const R=x.threads.filter(k=>!Ku(k.cwd)&&go(k));return R.length>0?[{...x,threads:R}]:!bn.value&&x.threads.length===0?[{...x,threads:R}]:[]})),zn=K(()=>eo.value==="chronological"),sn=K(()=>{const x=[];for(const R of o.groups)for(const k of R.threads)tn.value.has(k.id)||go(k)&&x.push(k);return x.sort((R,k)=>{const G=new Date(R.updatedAtIso||R.createdAtIso).getTime();return new Date(k.updatedAtIso||k.createdAtIso).getTime()-G})}),to=K(()=>{const x=sn.value.filter(k=>Ku(k.cwd)),R=he.value==="created"?"createdAtIso":"updatedAtIso";return x.sort((k,G)=>{const We=new Date(k[R]||k.updatedAtIso||k.createdAtIso).getTime();return new Date(G[R]||G.updatedAtIso||G.createdAtIso).getTime()-We})}),nn=K(()=>bn.value||le.value?to.value:to.value.slice(0,10)),Va=K(()=>bn.value?!1:to.value.length>10),on=K(()=>{const x=new Map;for(const R of o.groups)for(const k of R.threads)Wr.value.has(k.id)||x.set(k.id,k);return x});tt(Pe,x=>{Se&&uI(x)}),tt([on,()=>o.isThreadListFullyLoaded],([x])=>{const R=L_(Pe.value,new Set(x.keys()),{canPruneMissing:o.isThreadListFullyLoaded});if(R.length===Pe.value.length)return;const k=new Set(R),G=Object.fromEntries(Object.entries(ge.value).filter(([We])=>k.has(We)));ge.value=G,Pe.value=R});let qo=0;async function ur(){if(o.isLoading)return;const x=Pe.value.filter(We=>!on.value.has(We)&&!ge.value[We]);if(x.length===0)return;const R=qo+=1,k=await Promise.all(x.map(async We=>{try{return await Sk(We)}catch{return null}}));if(R!==qo)return;const G={...ge.value};for(const We of k)We&&(G[We.id]=We);ge.value=G}tt([Pe,on,()=>o.isLoading],()=>{Se&&ur()}),pi(async()=>{const{threadIds:x}=await lI(),R=Array.isArray(x)?x.filter(k=>typeof k=="string").map(k=>k.trim()).filter((k,G,We)=>k.length>0&&We.indexOf(k)===G):[];R.length>0&&(Pe.value=R);try{Ee.value=await bx()}catch{Ee.value={}}try{await ha()}catch{Be.value={}}Se=!0,ur()});const Ht=K(()=>Ye(N.value)),js=K(()=>{const x=oe.value;return Ht.value?r('This will archive the thread "{title}" and remove the attached heartbeat automations.',{title:x}):r('This will archive the thread "{title}". You can find it later in archived threads.',{title:x})}),Gr=K(()=>{const x=new Map;for(const R of o.groups)for(const k of R.threads)x.set(k.id,R.projectName);return x}),Wo=K(()=>{const x=new Map;for(const R of o.groups){const k=R.threads.filter(G=>!tn.value.has(G.id)&&!Wr.value.has(G.id));x.set(R.projectName,k)}return x}),yo=K(()=>{const x=new Map;for(const R of o.groups)for(const k of R.threads){const G=new Date(k.updatedAtIso||k.createdAtIso).getTime();x.set(k.id,G)}return x}),qt=K(()=>{const x=xe.value;return x?on.value.get(x)??null:null}),Ka=K(()=>Pe.value.map(x=>on.value.get(x)??ge.value[x]??null).filter(x=>x!==null).filter(go));function no(){U.value=!U.value}function Ya(){H.value=!H.value}function wo(){be.value=!be.value}function Vr(x){if(Number.isNaN(x))return"n/a";const R=Math.abs(Date.now()-x);if(R<6e4)return r("now");const k=Math.floor(R/6e4);if(k<60)return`${k}m`;const G=Math.floor(k/60);return G<24?`${G}h`:`${Math.floor(G/24)}d`}function bo(x){const R=yo.value.get(x.id);return Vr(typeof R=="number"?R:new Date(x.updatedAtIso||x.createdAtIso).getTime())}function jo(x){const R=new Date(x).getTime();return Number.isNaN(R)?"":new Date(R).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function oo(x){return tn.value.has(x)}function cr(x){if(oo(x)){Pe.value=Pe.value.filter(R=>R!==x);return}Pe.value=[x,...Pe.value]}function St(x){cr(x),ye()}function ln(x){Y.value="",s("select",x)}function In(x){x===o.selectedThreadId&&(s("copy-thread-chat",x),ye())}function dr(x){s("fork-thread",x),ye()}function An(x){return`${r("start new thread")} ${mr(x)}`}function Kr(x){s("start-new-thread",x)}function fr(x){s("browse-thread-files",x),ye()}function dn(x){s("save-thread-project",x),ye()}async function C(x){var k,G;const R=((G=(k=on.value.get(x))==null?void 0:k.cwd)==null?void 0:G.trim())??"";if(ye(),!(!R||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(R)}catch{}}function E(x,R){if(xe.value===x&&$e.value==="hover"){if(R){const k=R.relatedTarget,G=Bn.value;if(k instanceof Node&&G&&G.contains(k))return}ye()}}function Q(x){return xe.value===x}function ye(){xe.value="",$e.value="hover",Le.value={}}function ct(x){if(Y.value="",xe.value===x){ye();return}$e.value="hover",$t(),xt.value=!1,xe.value=x,Nt(()=>{Xa(x)})}function _t(x,R){x.preventDefault(),Y.value="",$e.value="contextmenu",xe.value=R}function _n(x,R){lt.value=x,Ze.value=R,Ke.value=!0,ye(),Nt(()=>{var k,G;(k=ut.value)==null||k.focus(),(G=ut.value)==null||G.select()})}function Kt(){Ke.value=!1,lt.value="",Ze.value=""}function Pn(){const x=lt.value,R=Ze.value.trim();!x||!R||(s("rename-thread",{threadId:x,title:R}),Kt())}function Wt(x,R){Y.value="",N.value=x,oe.value=R,fe.value=!0,ye()}function vn(){fe.value=!1,N.value="",oe.value=""}async function mi(){const x=N.value;x&&(Ls(x),vn())}function pr(x){return Y.value===x}function hr(x){if(Y.value!==x){Y.value=x,ye();return}Ls(x),Y.value=""}function Ls(x){var k,G;const R=on.value.get(x)??null;Wr.value.has(x)||(pe.value=[x,...pe.value]),Y.value="",ye(),d({id:x,title:((k=R==null?void 0:R.title)==null?void 0:k.trim())||"(untitled)",cwd:((G=R==null?void 0:R.cwd)==null?void 0:G.trim())??"",projectName:Gr.value.get(x)??""}),Pe.value=Pe.value.filter(We=>We!==x),s("archive",x),Ye(x)&&Es(x)}function mr(x){return o.projectDisplayNameById[x]??x}t({openAutomationEditorFromPanel:Ps,openAutomationCreatorFromPanel:qa,openRenameThreadDialog:_n,openRecycleBin:P});function Yr(x){return x.includes("/")||x.includes("\\")}function Tn(x){return Yr(x)?x:mr(x)}function vr(x){const R=Bo(x);if(!R)return!1;let k=0;for(const G of o.groups)if(Yr(G.projectName)&&Bo(G.projectName)===R&&(k+=1,k>1))return!0;return!1}function Lo(x){const R=o.projectDisplayNameById[x.projectName],k=mr(x.projectName),G=x.projectName;if(R&&!Yr(G)&&G!==k)return k.includes(G)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(G)?k:`${k} ${G}`;if(R&&Yr(G)){const ao=Bo(G),Co=Bo(qi(G)),cn=vr(G)?Co:ao;return cn&&cn!==k?`${k} ${cn}`:k}if(!k.includes("/")&&!k.includes("\\"))return k;const We=Bo(k)||k,Ot=Bo(qi(k));return Ot.startsWith(".")&&Ot!==We?`${We} ${Ot}`:x.threads.length>0||!vr(G)?We:Ot?`${We} ${Ot}`:We}function va(x){return ne.value===x}function $t(){ne.value="",Ae.value="actions",Fe.value=""}function ga(){const x=!xt.value;x&&($t(),ye()),xt.value=x}function rn(x){eo.value=x,xt.value=!1}function gr(){W.value=!W.value}function ya(x){he.value=x}function Sn(x){s("request-project-git-status",x),Nt(()=>{Rn(x)})}function Ns(x){if(ne.value===x){$t();return}ye(),xt.value=!1,ne.value=x,Ae.value="actions",Fe.value=mr(x),Sn(x)}function Ja(x){ye(),xt.value=!1,ne.value=x,Ae.value="actions",Fe.value=mr(x),Sn(x)}function rl(x){return o.projectDisplayNameById[x.projectName]??Lo(x)}function Hn(x){ye();const R=x.projectName;ne.value=R,Ae.value="rename",Fe.value=rl(x),Nt(()=>{Rn(R)})}function Yt(x){s("browse-project-files",x),$t()}function Gt(x){s("save-project",x),$t()}function vi(x){s("create-project-worktree",x),$t()}function al(x){s("rename-project",{projectName:x,displayName:Fe.value})}function $s(x){const R=qn(x);if(s("remove-project",x),R&&Tt(x)){me.value="";const k=Be.value;Be.value=Rs(Be.value,R),jg(R).then(ha).catch(async G=>{Be.value=k;const We=G instanceof Error?G.message:r("Failed to delete project automation");me.value=We,a(We);try{await ha()}catch{Be.value=k}}).finally(()=>{s("automations-changed")})}$t()}function qn(x){var k;const R=((k=o.projectCwdByName[x])==null?void 0:k.trim())??"";return Lx(R)?R:""}function gi(x,R){if(!x.altKey||x.key!=="ArrowUp"&&x.key!=="ArrowDown")return;const k=o.groups.findIndex(Ot=>Ot.projectName===R);if(k<0)return;const G=x.key==="ArrowUp"?-1:1,We=Math.max(0,Math.min(k+G,o.groups.length-1));We!==k&&(x.preventDefault(),s("reorder-project",{projectName:R,toIndex:We}))}function ro(x){return L.value[x]===!0}function un(x){return j.value[x]===!0}function Wn(x){L.value={...L.value,[x]:!ro(x)}}function yr(){le.value=!le.value}function wr(x){ho(x)||(j.value={...j.value,[x]:!un(x)})}function Go(x,R){const k=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(k){mo.set(x,k);return}mo.delete(x)}function wa(x,R){const k=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(k){Ho.set(x,k);return}Ho.delete(x)}function Qa(x){let R=x.parentElement;for(;R;){const k=window.getComputedStyle(R),G=k.overflowY||k.overflow;if(G==="auto"||G==="scroll"||G==="hidden"||G==="clip")return R.getBoundingClientRect();R=R.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function Jr(x,R){const k=x.getBoundingClientRect(),G=Qa(x),We=6,Ot=G.bottom-k.bottom,ao=k.top-G.top;return Ot>=R+We?"down":ao>Ot?"up":"down"}function yi(x,R){const k=Ho.get(x);if(!k)return"down";const G=Jr(k,R);return de.value={...de.value,[x]:G},G}function ba(x){return de.value[x]??"down"}function Rn(x){const R=mo.get(x);if(!R)return;const k=R.querySelector(".project-menu-panel"),G=(k==null?void 0:k.getBoundingClientRect().height)??0;te.value={...te.value,[x]:Jr(R,G)}}function To(x,R,k){return Math.min(Math.max(x,R),k)}function Xa(x){const R=Ho.get(x);if(!R)return;const k=Bn.value,G=k==null?void 0:k.getBoundingClientRect(),We=(G==null?void 0:G.height)||(k==null?void 0:k.offsetHeight)||112,Ot=(G==null?void 0:G.width)||(k==null?void 0:k.offsetWidth)||160,ao=yi(x,We),Co=R.getBoundingClientRect(),cn=8,br=4,es=Math.max(cn,window.innerWidth-Ot-cn),ts=To(Co.right-Ot,cn,es),Tr=To(ao==="up"?Co.top-We-br:Co.bottom+br,cn,Math.max(cn,window.innerHeight-We-cn));Le.value={left:`${Math.round(ts)}px`,top:`${Math.round(Tr)}px`}}function Ta(){const x=xe.value;x&&Xa(x)}function wi(){window.addEventListener("resize",Ta),document.addEventListener("scroll",Ta,!0)}function Os(){window.removeEventListener("resize",Ta),document.removeEventListener("scroll",Ta,!0)}function Gn(x){const R=ne.value;if(!R)return!1;const k=mo.get(R);if(!k)return!1;if((typeof x.composedPath=="function"?x.composedPath():[]).includes(k))return!0;const We=x.target;return We instanceof Node?k.contains(We):!1}function Vo(x){const R=xe.value;if(!R)return!1;const k=Ho.get(R);if(!k)return!1;const G=typeof x.composedPath=="function"?x.composedPath():[];if(G.includes(k))return!0;const We=Bn.value;if(We&&G.includes(We))return!0;const Ot=x.target;return Ot instanceof Node?!!(k.contains(Ot)||We&&We.contains(Ot)):!1}function Ds(x){if(xt.value){const R=Ro.value,k=typeof x.composedPath=="function"?x.composedPath():[];!!R&&(k.includes(R)||x.target instanceof Node&&R.contains(x.target))||(xt.value=!1)}ne.value&&(Gn(x)||$t(),xe.value&&(Vo(x)||ye()))}function Fs(x){ne.value&&!Gn(x)&&$t(),xe.value&&!Vo(x)&&ye()}function bi(){xt.value&&(xt.value=!1),ne.value&&$t(),xe.value&&ye()}function sl(){window.addEventListener("pointerdown",Ds,{capture:!0}),window.addEventListener("focusin",Fs,{capture:!0}),window.addEventListener("blur",bi)}function Ti(){window.removeEventListener("pointerdown",Ds,{capture:!0}),window.removeEventListener("focusin",Fs,{capture:!0}),window.removeEventListener("blur",bi)}function Sa(x){return Wo.value.get(x.projectName)??[]}function Qr(x){if(bn.value)return Sa(x);if(un(x.projectName))return[];const R=Sa(x);return ro(x.projectName)?R:R.slice(0,10)}function Xr(x){return bn.value?!1:!un(x.projectName)&&Sa(x).length>10}function Za(x){return Sa(x).length>0}function So(x){var R;return!!x.pendingRequestState||x.inProgress||x.unread||((R=x.externalSession)==null?void 0:R.active)===!0}function No(x){return x.pendingRequestState==="approval"?r("Awaiting approval"):r("Awaiting response")}function $o(x){var R;return((R=x.externalSession)==null?void 0:R.active)===!0?"external":x.pendingRequestState==="approval"?"awaiting-approval":x.pendingRequestState==="response"?"awaiting-response":x.inProgress?"working":x.unread?"unread":"idle"}tt(()=>o.groups.map(x=>x.projectName),x=>{Hr(x)}),tt(()=>{const x=ne.value;return x?o.projectGitRepoByName[x]:void 0},()=>{const x=ne.value;x&&Nt(()=>{ne.value===x&&Rn(x)})});const Zr=K(()=>xt.value||ne.value!==""||xe.value!=="");return tt(Zr,x=>{if(x){sl();return}Ti()}),tt(xe,x=>{if(!x){Os();return}wi(),Nt(()=>{Xa(x)})}),_s(()=>{mo.clear(),Os(),Ti(),qr()}),(x,R)=>(_(),F("section",{class:at(["thread-tree-root",{"chats-first":W.value}])},[Ka.value.length>0?(_(),F("section",F_,[Oe(hs,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":U.value,onClick:no},{left:dt(()=>[U.value?(_(),Qe(Cs,{key:1,class:"thread-icon"})):(_(),Qe(Su,{key:0,class:"thread-icon"}))]),default:dt(()=>[w("span",B_,D(h(r)("Pinned")),1)]),_:1},8,["aria-expanded"]),U.value?(_(),F("ul",U_,[(_(!0),F(ot,null,Zt(Ka.value,k=>(_(),Qe(Cu,{key:k.id,thread:k,selected:k.id===e.selectedThreadId,pinned:oo(k.id),"menu-open":Q(k.id),"show-status-indicator":So(k),"thread-state":$o(k),"inline-delete-confirming":pr(k.id),"automation-count":h(_e)(k.id),"automation-tooltip":h(At)(k.id),"request-label":No(k),"relative-time":bo(k),"delete-label":h(r)("Delete thread"),"confirm-delete-label":h(r)("Confirm delete"),"confirm-label":h(r)("Confirm"),"worktree-label":h(r)("Worktree thread"),"set-menu-wrap-ref":G=>wa(k.id,G),onSelect:G=>ln(k.id),onInlineDelete:G=>hr(k.id),onMenuToggle:G=>ct(k.id),onRowLeave:G=>E(k.id,G),onRowContextmenu:G=>_t(G,k.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):ve("",!0)])):ve("",!0),w("section",z_,[Oe(hs,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":H.value,onClick:Ya},{left:dt(()=>[H.value?(_(),Qe(Cs,{key:1,class:"thread-icon"})):(_(),Qe(Su,{key:0,class:"thread-icon"}))]),right:dt(()=>[w("div",{ref_key:"organizeMenuWrapRef",ref:Ro,class:"organize-menu-wrap"},[w("button",{class:"organize-menu-trigger",type:"button","aria-expanded":xt.value,"aria-label":h(r)("Organize threads"),title:h(r)("Organize threads"),onClick:gt(ga,["stop"])},[Oe(nf,{class:"thread-icon"})],8,q_),xt.value?(_(),F("div",{key:0,class:"organize-menu-panel",onClick:R[4]||(R[4]=gt(()=>{},["stop"]))},[w("p",W_,D(h(r)("Organize")),1),w("button",{class:"organize-menu-item","data-active":eo.value==="project",type:"button",onClick:R[0]||(R[0]=k=>rn("project"))},[w("span",null,D(h(r)("By project")),1),eo.value==="project"?(_(),F("span",V_,"✓")):ve("",!0)],8,G_),w("button",{class:"organize-menu-item","data-active":eo.value==="chronological",type:"button",onClick:R[1]||(R[1]=k=>rn("chronological"))},[w("span",null,D(h(r)("Chronological list")),1),eo.value==="chronological"?(_(),F("span",Y_,"✓")):ve("",!0)],8,K_),w("button",{class:"organize-menu-item","data-active":W.value,type:"button",onClick:gr},[w("span",null,D(h(r)("Chats first")),1),W.value?(_(),F("span",Q_,"✓")):ve("",!0)],8,J_),R[40]||(R[40]=w("div",{class:"organize-menu-separator"},null,-1)),w("p",X_,D(h(r)("Sort by")),1),w("button",{class:"organize-menu-item","data-active":he.value==="created",type:"button",onClick:R[2]||(R[2]=k=>ya("created"))},[w("span",null,D(h(r)("Created")),1),he.value==="created"?(_(),F("span",eP,"✓")):ve("",!0)],8,Z_),w("button",{class:"organize-menu-item","data-active":he.value==="updated",type:"button",onClick:R[3]||(R[3]=k=>ya("updated"))},[w("span",null,D(h(r)("Updated")),1),he.value==="updated"?(_(),F("span",nP,"✓")):ve("",!0)],8,tP),R[41]||(R[41]=w("div",{class:"organize-menu-separator"},null,-1)),w("button",{class:"organize-menu-item",type:"button",onClick:P},[w("span",null,D(h(r)("Recycle bin")),1)])])):ve("",!0)],512)]),default:dt(()=>[w("span",H_,D(h(r)("Projects")),1)]),_:1},8,["aria-expanded"]),H.value?(_(),F(ot,{key:0},[h(me)?(_(),F("p",oP,D(h(me)),1)):ve("",!0),bn.value&&Lt.value.length===0?(_(),F("p",rP,D(h(r)("No matching threads")),1)):e.isLoading&&e.groups.length===0?(_(),F("p",aP,D(h(r)("Loading threads...")),1)):zn.value?(_(),F("ul",sP,[(_(!0),F(ot,null,Zt(sn.value,k=>(_(),Qe(Cu,{key:k.id,thread:k,selected:k.id===e.selectedThreadId,pinned:oo(k.id),"menu-open":Q(k.id),"show-status-indicator":So(k),"thread-state":$o(k),"inline-delete-confirming":pr(k.id),"automation-count":h(_e)(k.id),"automation-tooltip":h(At)(k.id),"request-label":No(k),"relative-time":bo(k),"delete-label":h(r)("Delete thread"),"confirm-delete-label":h(r)("Confirm delete"),"confirm-label":h(r)("Confirm"),"worktree-label":h(r)("Worktree thread"),"set-menu-wrap-ref":G=>wa(k.id,G),onSelect:G=>ln(k.id),onInlineDelete:G=>hr(k.id),onMenuToggle:G=>ct(k.id),onRowLeave:G=>E(k.id,G),onRowContextmenu:G=>_t(G,k.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):(_(),F("div",{key:4,ref_key:"groupsContainerRef",ref:Ms,class:"thread-tree-groups",style:er(h(vt))},[(_(!0),F(ot,null,Zt(Lt.value,k=>(_(),F("article",{key:k.projectName,ref_for:!0,ref:G=>h(Ct)(k.projectName,G),class:"project-group","data-project-name":k.projectName,"data-expanded":!un(k.projectName),"data-dragging":h(kt)(k.projectName),style:er(h(mn)(k.projectName))},[Oe(hs,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:G=>wr(k.projectName),onContextmenu:gt(G=>Ja(k.projectName),["prevent"]),onKeydown:[G=>gi(G,k.projectName),Ao(gt(G=>wr(k.projectName),["prevent"]),["enter"]),Ao(gt(G=>wr(k.projectName),["prevent"]),["space"])]},{left:dt(()=>[w("span",lP,[w("span",uP,[un(k.projectName)?(_(),Qe(Wf,{key:0,class:"thread-icon"})):(_(),Qe(xA,{key:1,class:"thread-icon"}))]),w("span",cP,[un(k.projectName)?(_(),Qe(Su,{key:0,class:"thread-icon"})):(_(),Qe(Cs,{key:1,class:"thread-icon"}))])])]),right:dt(()=>[w("div",mP,[w("div",{ref_for:!0,ref:G=>Go(k.projectName,G),class:"project-menu-wrap"},[w("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:gt(G=>Ns(k.projectName),["stop"])},[Oe(nf,{class:"thread-icon"})],8,vP),va(k.projectName)?(_(),F("div",{key:0,class:"project-menu-panel","data-open-direction":te.value[k.projectName]??"down",onClick:R[6]||(R[6]=gt(()=>{},["stop"]))},[Ae.value==="actions"?(_(),F(ot,{key:0},[w("button",{class:"project-menu-item",type:"button",onClick:G=>Yt(k.projectName)},D(h(r)("Browse files")),9,yP),w("button",{class:"project-menu-item",type:"button",onClick:G=>Gt(k.projectName)},D(h(r)("Export Project")),9,wP),w("button",{class:"project-menu-item",type:"button",onClick:G=>h(zr)(k.projectName)},D(h(Tt)(k.projectName)?h(r)("Manage automations…"):h(r)("Add automation…")),9,bP),e.projectGitRepoByName[k.projectName]?(_(),F("button",{key:0,class:"project-menu-item",type:"button",onClick:G=>vi(k.projectName)},D(h(r)("New worktree")),9,TP)):ve("",!0),w("button",{class:"project-menu-item",type:"button",onClick:G=>Hn(k)},D(h(r)("Rename project")),9,SP),w("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:G=>$s(k.projectName)},D(h(r)("Remove")),9,CP)],64)):(_(),F(ot,{key:1},[w("label",xP,D(h(r)("Project name")),1),xn(w("input",{"onUpdate:modelValue":R[5]||(R[5]=G=>Fe.value=G),class:"project-menu-input",type:"text",onInput:G=>al(k.projectName)},null,40,kP),[[Nn,Fe.value]])],64))],8,gP)):ve("",!0)],512),w("button",{class:"thread-start-button",type:"button","aria-label":An(k.projectName),title:An(k.projectName),onClick:gt(G=>Kr(k.projectName),["stop"])},[Oe(el,{class:"thread-icon"})],8,IP)])]),default:dt(()=>[w("span",{class:"project-main-button","data-dragging-handle":h(kt)(k.projectName),onMousedown:gt(G=>h(Fn)(G,k.projectName),["left"])},[w("span",{class:"project-title",title:Tn(k.projectName)},D(Lo(k)),9,fP),h(Tt)(k.projectName)?(_(),F("span",{key:0,class:"thread-row-automation-chip",title:h(Br)(k.projectName)},[Oe(bs,{class:"thread-row-automation-icon"}),h(bt)(k.projectName)>1?(_(),F("span",hP,D(h(bt)(k.projectName)),1)):ve("",!0)],8,pP)):ve("",!0)],40,dP)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),Za(k)?(_(),F("ul",AP,[(_(!0),F(ot,null,Zt(Qr(k),G=>(_(),Qe(Cu,{key:G.id,thread:G,selected:G.id===e.selectedThreadId,pinned:oo(G.id),"menu-open":Q(G.id),"show-status-indicator":So(G),"thread-state":$o(G),"inline-delete-confirming":pr(G.id),"automation-count":h(_e)(G.id),"automation-tooltip":h(At)(G.id),"request-label":No(G),"relative-time":bo(G),"delete-label":h(r)("Delete thread"),"confirm-delete-label":h(r)("Confirm delete"),"confirm-label":h(r)("Confirm"),"worktree-label":h(r)("Worktree thread"),"set-menu-wrap-ref":We=>wa(G.id,We),onSelect:We=>ln(G.id),onInlineDelete:We=>hr(G.id),onMenuToggle:We=>ct(G.id),onRowLeave:We=>E(G.id,We),onRowContextmenu:We=>_t(We,G.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):(_(),Qe(hs,{key:1,as:"p",class:"project-empty-row"},{left:dt(()=>[...R[42]||(R[42]=[w("span",{class:"project-empty-spacer"},null,-1)])]),default:dt(()=>[w("span",_P,D(h(r)("No threads")),1)]),_:1})),Xr(k)?(_(),Qe(hs,{key:2,class:"thread-show-more-row"},{left:dt(()=>[...R[43]||(R[43]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:dt(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:G=>Wn(k.projectName)},D(ro(k.projectName)?"Show less":"Show more"),9,PP)]),_:2},1024)):ve("",!0)],12,iP))),128))],4))],64)):ve("",!0)]),w("section",RP,[Oe(hs,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":be.value,onClick:wo},{left:dt(()=>[be.value?(_(),Qe(Cs,{key:1,class:"thread-icon"})):(_(),Qe(Su,{key:0,class:"thread-icon"}))]),right:dt(()=>[w("div",MP,[w("button",{class:"chats-section-action",type:"button","aria-label":h(r)("New chat"),title:h(r)("New chat"),onClick:R[7]||(R[7]=gt(k=>x.$emit("start-new-chat"),["stop"]))},[Oe(el,{class:"thread-icon"})],8,jP)])]),default:dt(()=>[w("span",EP,D(h(r)("Chats")),1)]),_:1},8,["aria-expanded"]),be.value&&to.value.length===0?(_(),F("p",LP,D(h(r)("No chats")),1)):be.value?(_(),F("ul",NP,[(_(!0),F(ot,null,Zt(nn.value,k=>(_(),Qe(Cu,{key:k.id,thread:k,selected:k.id===e.selectedThreadId,pinned:oo(k.id),"menu-open":Q(k.id),"show-status-indicator":So(k),"thread-state":$o(k),"inline-delete-confirming":pr(k.id),"automation-count":h(_e)(k.id),"automation-tooltip":h(At)(k.id),"request-label":No(k),"relative-time":bo(k),"delete-label":h(r)("Delete thread"),"confirm-delete-label":h(r)("Confirm delete"),"confirm-label":h(r)("Confirm"),"worktree-label":h(r)("Worktree thread"),"set-menu-wrap-ref":G=>wa(k.id,G),onSelect:G=>ln(k.id),onInlineDelete:G=>hr(k.id),onMenuToggle:G=>ct(k.id),onRowLeave:G=>E(k.id,G),onRowContextmenu:G=>_t(G,k.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):ve("",!0),be.value&&Va.value?(_(),Qe(hs,{key:2,class:"thread-show-more-row"},{left:dt(()=>[...R[44]||(R[44]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:dt(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:yr},D(le.value?"Show less":"Show more"),1)]),_:1})):ve("",!0)]),(_(),Qe(Ki,{to:"body"},[qt.value?(_(),F("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:Bn,class:"thread-menu-panel thread-menu-panel-fixed",style:er(Le.value),"data-open-direction":ba(qt.value.id),onClick:R[17]||(R[17]=gt(()=>{},["stop"]))},[w("button",{class:"thread-menu-item",type:"button",onClick:R[8]||(R[8]=k=>h(Ur)(qt.value.id))},D(h(Ye)(qt.value.id)?h(r)("Manage automations…"):h(r)("Add automation…")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[9]||(R[9]=k=>fr(qt.value.id))},D(h(r)("Browse files")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[10]||(R[10]=k=>dn(qt.value.id))},D(h(r)("Export Project")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[11]||(R[11]=k=>C(qt.value.id))},D(h(r)("Copy path")),1),w("button",{class:"thread-menu-item",type:"button",disabled:qt.value.id!==e.selectedThreadId,title:qt.value.id===e.selectedThreadId?h(r)("Copy chat"):h(r)("Open this chat before copying"),onClick:R[12]||(R[12]=k=>In(qt.value.id))},D(h(r)("Copy chat")),9,OP),w("button",{class:"thread-menu-item",type:"button",onClick:R[13]||(R[13]=k=>dr(qt.value.id))},D(h(r)("Create chat fork")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[14]||(R[14]=k=>St(qt.value.id))},D(oo(qt.value.id)?h(r)("Unpin thread"):h(r)("Pin thread")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[15]||(R[15]=k=>_n(qt.value.id,qt.value.title))},D(h(r)("Rename thread")),1),w("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:R[16]||(R[16]=k=>Wt(qt.value.id,qt.value.title))},D(h(r)("Delete thread")),1)],12,$P)):ve("",!0)])),Oe(kd,{open:Ke.value,title:h(r)("Rename thread"),subtitle:h(r)("Make it short and recognizable."),onClose:Kt},{footer:dt(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:Kt},D(h(r)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Pn},D(h(r)("Save")),1)]),default:dt(()=>[xn(w("input",{ref_key:"renameThreadInputRef",ref:ut,"onUpdate:modelValue":R[18]||(R[18]=k=>Ze.value=k),class:"rename-thread-input",type:"text",placeholder:h(r)("Add title..."),onKeydown:Ao(gt(Pn,["prevent"]),["enter"])},null,40,DP),[[Nn,Ze.value]])]),_:1},8,["open","title","subtitle"]),Oe(kd,{open:fe.value,title:Ht.value?h(r)("Archive chat and remove automations?"):h(r)("Delete thread?"),subtitle:js.value,onClose:vn},{footer:dt(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:vn},D(h(r)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:mi},D(Ht.value?h(r)("Archive and remove"):h(r)("Delete")),1)]),_:1},8,["open","title","subtitle"]),Oe(kd,{open:f.value,title:h(r)("Recycle bin"),subtitle:h(r)("Threads you removed are kept here so you can restore them."),size:"md",onClose:R[19]||(R[19]=k=>f.value=!1)},{default:dt(()=>[w("div",FP,[h(i).length===0?(_(),F("div",BP,D(h(r)("Recycle bin is empty.")),1)):(_(),F("ul",UP,[(_(!0),F(ot,null,Zt(h(i),k=>(_(),F("li",{key:k.id,class:"recycle-bin-item"},[w("div",zP,[w("span",HP,D(k.title),1),k.projectName?(_(),F("span",qP,D(k.projectName),1)):ve("",!0),w("span",WP,D(jo(k.archivedAtIso)),1)]),w("div",GP,[w("button",{class:"recycle-bin-button recycle-bin-button-primary",type:"button",disabled:y.value===k.id,onClick:G=>B(k.id)},D(y.value===k.id?h(r)("Restoring…"):h(r)("Restore")),9,VP),w("button",{class:"recycle-bin-button recycle-bin-button-danger",type:"button",onClick:G=>h(c)(k.id)},D(h(r)("Delete permanently")),9,KP)])]))),128))])),b.value?(_(),F("p",YP,D(b.value),1)):ve("",!0)])]),_:1},8,["open","title","subtitle"]),(_(),Qe(Ki,{to:"body"},[h(A)?(_(),F("div",{key:0,class:"rename-thread-overlay",onClick:R[39]||(R[39]=gt((...k)=>h(Zn)&&h(Zn)(...k),["self"]))},[w("div",{class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":h(M)==="project"?h(r)("Project automation"):h(r)("Thread automation")},[w("h3",QP,D(h(Z)==="edit"?h(r)("Edit automation"):h(r)("Add automation")),1),w("p",XP,D(h(st)),1),h(ce)&&h(Z)==="create"?(_(),F("div",ZP,[R[45]||(R[45]=w("span",{class:"automation-thread-label"},"Target",-1)),w("div",eR,[w("button",{class:at(["automation-target-mode",{"is-active":h(re)==="thread"}]),type:"button",onClick:R[20]||(R[20]=k=>h(Wa)("thread"))}," Existing chat ",2),w("button",{class:at(["automation-target-mode",{"is-active":h(re)==="project"}]),type:"button",onClick:R[21]||(R[21]=k=>h(Wa)("project"))}," Project ",2)]),w("div",tR,[Oe(ci,{modelValue:h(je),"onUpdate:modelValue":R[22]||(R[22]=k=>kn(je)?je.value=k:null),class:"automation-thread-dropdown",options:h(mt),placeholder:h(re)==="project"?"Select project":"Select chat","enable-search":"","search-placeholder":h(re)==="project"?"Search projects":"Search chats"},null,8,["modelValue","options","placeholder","search-placeholder"])])])):ve("",!0),h(Je).length>0?(_(),F("div",{key:1,class:"automation-thread-list","aria-label":h(M)==="project"?"Project automations":"Thread automations"},[(_(!0),F(ot,null,Zt(h(Je),k=>(_(),F("button",{key:k.id,class:at(["automation-thread-list-item",{"is-active":k.id===h(z)}]),type:"button",onClick:G=>h(sr)(k.id)},[w("span",null,D(k.name),1),w("small",null,D(k.status==="PAUSED"?"Paused":"Active"),1)],10,oR))),128)),w("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:R[23]||(R[23]=(...k)=>h(Uo)&&h(Uo)(...k))},D(h(r)("Add another automation")),1)],8,nR)):ve("",!0),w("label",rR,[w("span",aR,D(h(r)("Name")),1),xn(w("input",{"onUpdate:modelValue":R[24]||(R[24]=k=>h(He).name=k),class:"rename-thread-input",type:"text",placeholder:h(r)("Automation name")},null,8,sR),[[Nn,h(He).name]])]),w("label",iR,[w("span",lR,D(h(r)("Prompt")),1),xn(w("textarea",{"onUpdate:modelValue":R[25]||(R[25]=k=>h(He).prompt=k),class:"automation-thread-textarea",rows:"6",placeholder:h(r)("Describe what the automation should do")},null,8,uR),[[Nn,h(He).prompt]])]),w("div",cR,[w("span",dR,D(h(r)("Schedule")),1),w("div",fR,[w("button",{class:at(["automation-schedule-mode",{"is-active":h(Ue).mode==="daily"}]),type:"button",onClick:R[26]||(R[26]=k=>h(ar)("daily"))},D(h(r)("Daily")),3),w("button",{class:at(["automation-schedule-mode",{"is-active":h(Ue).mode==="interval"}]),type:"button",onClick:R[27]||(R[27]=k=>h(ar)("interval"))},D(h(r)("Interval")),3),w("button",{class:at(["automation-schedule-mode",{"is-active":h(Ue).mode==="advanced"}]),type:"button",onClick:R[28]||(R[28]=k=>h(ar)("advanced"))}," RRULE ",2)]),h(Ue).mode==="daily"?(_(),F("div",pR,[w("span",hR,D(h(r)("Run every day at")),1),xn(w("input",{"onUpdate:modelValue":R[29]||(R[29]=k=>h(Ue).dailyTime=k),class:"automation-schedule-time",type:"time",onInput:R[30]||(R[30]=(...k)=>h(zt)&&h(zt)(...k))},null,544),[[Nn,h(Ue).dailyTime]])])):h(Ue).mode==="interval"?(_(),F("div",mR,[w("span",vR,D(h(r)("Run every")),1),xn(w("input",{"onUpdate:modelValue":R[31]||(R[31]=k=>h(Ue).interval=k),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:R[32]||(R[32]=(...k)=>h(zt)&&h(zt)(...k))},null,544),[[Nn,h(Ue).interval,void 0,{number:!0}]]),Oe(ci,{class:"automation-schedule-unit-dropdown","model-value":h(Ue).intervalUnit,options:h(q),placeholder:h(r)("Unit"),"onUpdate:modelValue":h(Ha)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):ve("",!0),h(Ue).mode==="advanced"?xn((_(),F("input",{key:2,"onUpdate:modelValue":R[33]||(R[33]=k=>h(He).rrule=k),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:R[34]||(R[34]=(...k)=>h(pa)&&h(pa)(...k))},null,544)),[[Nn,h(He).rrule]]):ve("",!0),w("p",gR,D(h(et)),1)]),w("div",yR,[w("span",wR,D(h(r)("Status")),1),Oe(ci,{class:"automation-thread-dropdown","model-value":h(He).status,options:h(ae),placeholder:h(r)("Status"),"onUpdate:modelValue":h(fa)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),h(Re)?(_(),F("p",bR,D(h(Re)),1)):h(ke)?(_(),F("p",TR,D(h(ke)),1)):ve("",!0),w("div",SR,[h(Z)==="edit"&&h(M)==="thread"?(_(),F("button",{key:0,class:"rename-thread-button",type:"button",disabled:h(Ve)||h(Ne),onClick:R[35]||(R[35]=(...k)=>h(Dn)&&h(Dn)(...k))},D(h(Ne)?h(r)("Running…"):h(r)("Run now")),9,CR)):ve("",!0),h(Z)==="edit"?(_(),F("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:h(Ve)||h(Ne),onClick:R[36]||(R[36]=(...k)=>h(Po)&&h(Po)(...k))},D(h(r)("Remove")),9,xR)):ve("",!0),w("button",{class:"rename-thread-button",type:"button",disabled:h(Ve)||h(Ne),onClick:R[37]||(R[37]=(...k)=>h(Zn)&&h(Zn)(...k))},D(h(r)("Cancel")),9,kR),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:h(Ve)||h(Ne),onClick:R[38]||(R[38]=(...k)=>h(zo)&&h(zo)(...k))},D(h(Ve)?h(r)("Saving…"):h(r)("Save")),9,IR)])],8,JP)])):ve("",!0)]))],2))}}),_R=It(AR,[["__scopeId","data-v-e9f9e36a"]]),PR={class:"content-header"},RR=["title"],ER={class:"content-actions"},MR=hn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(_(),F("header",PR,[w("div",{class:at(["content-leading",{"is-accent":e.accent}])},[_o(t.$slots,"leading",{},void 0)],2),w("h1",{class:at(["content-title",{"is-accent":e.accent}]),title:e.title},D(e.title),11,RR),w("div",ER,[_o(t.$slots,"actions",{},void 0)])]))}}),jR=It(MR,[["__scopeId","data-v-61739409"]]),Rm=.0025,Id=3,Em=2,LR=256;function NR(e){var ge;const t=S("idle"),n=S(typeof navigator<"u"&&!!((ge=navigator.mediaDevices)!=null&&ge.getUserMedia)),o=S(0),r=S(null);let a=null,s=null,i=[],l=null,d=null,c=null,v=null,f=[],b=!1,y=!1,P=null;function B(){P&&(P.abort(),P=null),t.value==="transcribing"&&(t.value="idle")}function L(){const Y=r.value;if(!Y||typeof window>"u")return;const pe=Y.getContext("2d");if(!pe)return;const ne=Math.max(1,Math.floor(Y.clientWidth)),xe=Math.max(1,Math.floor(Y.clientHeight||36)),$e=window.devicePixelRatio||1,te=Math.max(1,Math.floor(ne*$e)),de=Math.max(1,Math.floor(xe*$e));(Y.width!==te||Y.height!==de)&&(Y.width=te,Y.height=de),pe.setTransform($e,0,0,$e,0,0),pe.clearRect(0,0,ne,xe);const Le=Math.max(12,Math.floor(ne/(Id+Em))),Ae=f.slice(-Le),Fe=Math.max(0,Le-Ae.length),Ke=xe/2,lt=getComputedStyle(Y).color||"#000000";for(let Ze=0;Ze<Le;Ze+=1){const ut=Ae[Ze-Fe]??0,N=Math.max(.08,Math.min(1,ut*18))*Ke,oe=Ze*(Id+Em);pe.globalAlpha=ut<=Rm?.35:1,pe.fillStyle=lt,pe.fillRect(oe,Ke-N,Id,N*2)}pe.globalAlpha=1}function j(){f=[],o.value=0,L()}function U(){c&&(c.disconnect(),c.onaudioprocess=null,c=null),d&&(d.disconnect(),d=null),l&&(l.close(),l=null),v=null}function H(Y){if(typeof window>"u")return;const pe=window.webkitAudioContext,ne=window.AudioContext??pe;ne&&(U(),j(),l=new ne,d=l.createMediaStreamSource(Y),c=l.createScriptProcessor(2048,1,1),v=performance.now(),c.onaudioprocess=xe=>{const $e=xe.inputBuffer.getChannelData(0);let te=0;for(let de=0;de<$e.length;de+=1){const Le=Math.abs($e[de]??0);te+=Le<Rm?0:Le}f.push(te/$e.length),f.length>LR&&f.shift(),v!==null&&(o.value=Math.max(0,performance.now()-v)),L()},d.connect(c),c.connect(l.destination),L())}async function be(){var Y;if(t.value==="transcribing"&&B(),!(t.value!=="idle"||!n.value||b)){b=!0,y=!1;try{s=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),i=[],a=new MediaRecorder(s),a.ondataavailable=pe=>{pe.data.size>0&&i.push(pe.data)},a.onstop=()=>{var xe;const pe=i,ne=(a==null?void 0:a.mimeType)||((xe=pe[0])==null?void 0:xe.type)||"audio/webm";Se(),he(pe,ne)},H(s),a.start(250),t.value="recording",y&&le()}catch(pe){Se(),t.value="idle",(Y=e.onError)==null||Y.call(e,pe)}finally{b=!1}}}function le(){if(b&&t.value==="idle"){y=!0;return}if(!(t.value!=="recording"||!a)&&a.state!=="inactive"){t.value="transcribing";try{a.requestData()}catch{}a.stop()}}function W(){y=!1,B(),Se(),t.value="idle"}async function he(Y,pe){var $e,te,de,Le,Ae;if(Y.length===0){($e=e.onEmpty)==null||$e.call(e),t.value="idle";return}const ne=new Blob(Y,{type:pe});t.value="transcribing";let xe=null;try{const Fe=pe.split(/[/;]/)[1]??"webm",Ke=new FormData;Ke.append("file",ne,`codex.${Fe}`);const lt=((te=e.getLanguage)==null?void 0:te.call(e).trim())??"";lt&<.toLowerCase()!=="auto"&&Ke.append("language",lt),xe=new AbortController,P=xe;const Ze=await fetch("/codex-api/transcribe",{method:"POST",body:Ke,signal:xe.signal}),ut=await Ze.text();let fe=null;try{fe=ut.trim()?JSON.parse(ut):null}catch{fe=null}if(!Ze.ok){const oe=(de=fe==null?void 0:fe.error)==null?void 0:de.trim(),ue=ut.trim();throw new Error(oe||ue||`Transcription failed: ${Ze.status}`)}const N=((fe==null?void 0:fe.text)??"").trim();N.length>0?e.onTranscript(N):(Le=e.onEmpty)==null||Le.call(e)}catch(Fe){if(Fe instanceof DOMException&&Fe.name==="AbortError")return;(Ae=e.onError)==null||Ae.call(e,Fe)}finally{xe&&P===xe&&(P=null),t.value==="transcribing"&&(t.value="idle")}}function Se(){U(),j(),a&&(a.ondataavailable=null,a.onstop=null,a=null),s&&(s.getTracks().forEach(Y=>Y.stop()),s=null),i=[]}_s(()=>{W()});function Pe(){if(t.value==="recording"){le();return}(t.value==="idle"||t.value==="transcribing")&&be()}return{state:t,isSupported:n,recordingDurationMs:o,waveformCanvasRef:r,startRecording:be,stopRecording:le,toggleRecording:Pe,cancel:W}}const $R={},OR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function DR(e,t){return _(),F("svg",OR,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m12 5l0 14m-6-8l6-6l6 6"},null,-1)])])}const FR=It($R,[["render",DR]]),BR={},UR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function zR(e,t){return _(),F("svg",UR,[...t[0]||(t[0]=[w("path",{d:"M4 8V4h4"},null,-1),w("path",{d:"M20 8V4h-4"},null,-1),w("path",{d:"M4 16v4h4"},null,-1),w("path",{d:"M20 16v4h-4"},null,-1)])])}const HR=It(BR,[["render",zR]]),qR={},WR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function GR(e,t){return _(),F("svg",WR,[...t[0]||(t[0]=[w("path",{d:"M8 4v4H4"},null,-1),w("path",{d:"M16 4v4h4"},null,-1),w("path",{d:"M8 20v-4H4"},null,-1),w("path",{d:"M16 20v-4h4"},null,-1)])])}const VR=It(qR,[["render",GR]]),KR={},YR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function JR(e,t){return _(),F("svg",YR,[...t[0]||(t[0]=[w("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),w("path",{fill:"currentColor",d:"M8 5a3 3 0 0 0 -3 3v8a3 3 0 0 0 3 3h8a3 3 0 0 0 3 -3v-8a3 3 0 0 0 -3 -3h-8z"},null,-1)])])}const QR=It(KR,[["render",JR]]),XR=["aria-label"],ZR=8,ti=8,eE=hn({__name:"ComposerPopover",props:{open:{type:Boolean},align:{},width:{},panelClass:{},ariaLabel:{}},emits:["update:open"],setup(e,{expose:t,emit:n}){const o=e,r=n,a=S(null),s=S(null),i=S({});let l=!1;const d=K(()=>o.open),c=K(()=>o.width==="lg"?"composer-popover-panel--lg":"composer-popover-panel--md");function v(L,j,U){return Math.min(Math.max(j,L),U)}function f(){var Pe,ge;if(!d.value)return;const L=a.value;if(!L||typeof window>"u")return;const j=L.getBoundingClientRect(),U=window.innerWidth,H=window.innerHeight,be=Math.max(0,U-ti*2),le=Math.min(((Pe=s.value)==null?void 0:Pe.offsetWidth)??288,be),W=((ge=s.value)==null?void 0:ge.offsetHeight)??0;let he;o.align==="end"?he=j.right-le:o.align==="center"?he=j.left+(j.width-le)/2:he=j.left,he=v(he,ti,Math.max(ti,U-le-ti));let Se=j.top-W-ZR;Se=v(Se,ti,Math.max(ti,H-W-ti)),i.value={position:"fixed",left:`${he}px`,right:"auto",top:`${Se}px`,bottom:"auto",width:`${le}px`}}function b(){l||typeof window>"u"||(window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),window.addEventListener("orientationchange",f),l=!0)}function y(){!l||typeof window>"u"||(window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0),window.removeEventListener("orientationchange",f),l=!1)}tt(d,L=>{if(!L){y(),i.value={};return}b(),Nt(()=>{var j;(j=s.value)==null||j.focus(),f(),window.requestAnimationFrame(f)})}),_s(()=>{y()});function P(){r("update:open",!o.open)}function B(L){var W,he,Se;if(L.key==="Escape"){r("update:open",!1);return}const j=s.value;if(!j)return;const U=Array.from(j.querySelectorAll("button")).filter(Pe=>!Pe.disabled&&Pe.offsetParent!==null);if(U.length===0)return;if(L.key==="Home"){L.preventDefault(),(W=U[0])==null||W.focus();return}if(L.key==="End"){L.preventDefault(),(he=U[U.length-1])==null||he.focus();return}if(L.key!=="ArrowDown"&&L.key!=="ArrowUp")return;L.preventDefault();let H=U.findIndex(Pe=>Pe===document.activeElement);H<0&&(H=L.key==="ArrowDown"?-1:0);const be=L.key==="ArrowDown"?1:-1,le=(H+be+U.length)%U.length;(Se=U[le])==null||Se.focus()}return t({root:a}),(L,j)=>(_(),F("div",{ref_key:"rootRef",ref:a,class:"composer-popover-anchor"},[_o(L.$slots,"trigger",{toggle:P,isOpen:d.value},void 0),Oe(Xl,{name:"composer-popover"},{default:dt(()=>[d.value?(_(),F("div",{key:0,ref_key:"panelRef",ref:s,class:at(["composer-popover-panel",[c.value,e.panelClass]]),style:er(i.value),role:"menu",tabindex:"-1","aria-label":e.ariaLabel,onKeydown:B},[_o(L.$slots,"default",{},void 0,!0)],46,XR)):ve("",!0)]),_:3})],512))}}),Qu=It(eE,[["__scopeId","data-v-f7444b02"]]),tE=["aria-label"],nE={class:"composer-popover-group-label"},oE=["aria-selected","onMousedown"],rE={class:"thread-composer-slash-body"},aE={class:"thread-composer-slash-name"},sE={class:"thread-composer-slash-desc"},iE={class:"thread-composer-slash-kind"},lE={class:"composer-popover-group-label composer-popover-group-label--skills"},uE=["aria-selected","onMousedown"],cE=["aria-label","title"],dE={class:"thread-composer-slash-body thread-composer-slash-body--skill"},fE={class:"thread-composer-slash-skill-name"},pE={class:"thread-composer-slash-desc thread-composer-slash-desc--skill"},hE=hn({__name:"ComposerSlashMenu",props:{commands:{},highlightedIndex:{}},emits:["select"],setup(e,{emit:t}){const n=e,o=t,{t:r}=da(),a=S(null),s=K(()=>n.commands.filter(v=>v.group!=="skill")),i=K(()=>n.commands.filter(v=>v.group==="skill"));tt(()=>n.highlightedIndex,async()=>{var v,f;await Nt(),(f=(v=a.value)==null?void 0:v.querySelector(".is-active"))==null||f.scrollIntoView({block:"nearest"})});function l(v){return r(v==="rpc"?"Action":v==="text"?"Prompt":v==="skill"?"Skill":"Local")}function d(v){return v==="system"?"S":v==="repo"?"R":v==="plugin"?"P":"U"}function c(v){return r(v==="system"?"System":v==="repo"?"Repo":v==="plugin"?"Plugin":"User")}return(v,f)=>(_(),F("div",{ref_key:"rootRef",ref:a,class:"composer-popover",role:"listbox","aria-label":h(r)("Commands")},[s.value.length>0?(_(),F(ot,{key:0},[w("div",nE,D(h(r)("Commands")),1),(_(!0),F(ot,null,Zt(s.value,(b,y)=>(_(),F("button",{key:b.id,class:at(["thread-composer-slash-row",{"is-active":y===e.highlightedIndex}]),type:"button",role:"option","aria-selected":y===e.highlightedIndex,onMousedown:gt(P=>o("select",b),["prevent"])},[f[0]||(f[0]=w("span",{class:"thread-composer-slash-prefix","aria-hidden":"true"},"/",-1)),w("span",rE,[w("span",aE,D(b.id),1),w("span",sE,D(h(r)(b.description)),1)]),w("span",iE,D(l(b.kind)),1)],42,oE))),128))],64)):ve("",!0),i.value.length>0?(_(),F(ot,{key:1},[w("div",lE,D(h(r)("Skills")),1),(_(!0),F(ot,null,Zt(i.value,(b,y)=>(_(),F("button",{key:b.skillPath||b.id,class:at(["thread-composer-slash-row thread-composer-slash-row--skill",{"is-active":s.value.length+y===e.highlightedIndex}]),type:"button",role:"option","aria-selected":s.value.length+y===e.highlightedIndex,onMousedown:gt(P=>o("select",b),["prevent"])},[w("span",{class:at(["thread-composer-slash-skill-icon",`is-${b.scope||"user"}`]),"aria-label":c(b.scope),title:c(b.scope)},D(d(b.scope)),11,cE),w("span",dE,[w("span",fE,D(b.displayName||b.id),1),w("span",pE,D(b.description),1)])],42,uE))),128))],64)):ve("",!0)],8,tE))}}),mE=It(hE,[["__scopeId","data-v-ca16aa11"]]),vE=["data-streaming"],gE=["aria-expanded"],yE={class:"thread-composer-plan-panel-title"},wE={key:0,class:"thread-composer-plan-panel-badge"},bE={class:"thread-composer-plan-panel-progress"},TE=["title"],SE=["data-status"],CE={class:"thread-composer-plan-panel-latest-text"},xE={class:"thread-composer-plan-panel-popover-content"},kE={class:"thread-composer-plan-panel-popover-scroll"},IE={class:"thread-composer-plan-panel-popover-head"},AE={class:"thread-composer-plan-panel-title"},_E={class:"thread-composer-plan-panel-progress"},PE={key:0,class:"thread-composer-plan-panel-popover-section"},RE={class:"thread-composer-plan-panel-section-label"},EE=["title"],ME={class:"thread-composer-plan-panel-popover-section"},jE={class:"thread-composer-plan-panel-section-label"},LE={class:"thread-composer-plan-panel-steps"},NE=["data-status"],$E=["data-status"],OE=["title"],DE={class:"thread-composer-plan-panel-popover-footer"},FE=["disabled","data-state"],BE=hn({__name:"ThreadComposerPlanPanel",props:{planPanel:{}},emits:["implement-plan"],setup(e,{emit:t}){const n=e,o=t,{t:r}=da(),a=S(!1),s=K(()=>{var f;return(((f=n.planPanel)==null?void 0:f.steps)??[]).filter(b=>b.status==="completed").length}),i=K(()=>{var f;const v=((f=n.planPanel)==null?void 0:f.steps)??[];if(v.length===0)return null;for(let b=v.length-1;b>=0;b-=1){const y=v[b];if(y.status==="inProgress")return y}return v[v.length-1]}),l=K(()=>{var y,P,B;const v=((P=(y=n.planPanel)==null?void 0:y.explanation)==null?void 0:P.trim())??"";if(!v)return"";const f=((B=v.split(/[。!?!?\n]/u)[0])==null?void 0:B.trim())??"";if(!f)return v;const b=80;return f.length>b?`${f.slice(0,b)}…`:f});function d(v){switch(v){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function c(){a.value=!1,o("implement-plan")}return(v,f)=>(_(),F("div",{class:"thread-composer-plan-panel","data-streaming":e.planPanel.streaming},[Oe(Qu,{open:a.value,align:"center",width:"lg","panel-class":"thread-composer-plan-panel-popover","aria-label":h(r)("Plan"),"onUpdate:open":f[1]||(f[1]=b=>a.value=b)},{trigger:dt(()=>{var b,y;return[w("button",{type:"button",class:"thread-composer-plan-panel-header","aria-expanded":a.value,onClick:f[0]||(f[0]=P=>a.value=!a.value)},[f[2]||(f[2]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",yE,D(h(r)("Plan")),1),e.planPanel.streaming?(_(),F("span",wE,D(h(r)("Updating")),1)):ve("",!0),w("span",bE,D(s.value)+"/"+D(e.planPanel.steps.length),1),w("span",{class:"thread-composer-plan-panel-latest",title:((b=i.value)==null?void 0:b.step)??""},[i.value?(_(),F("span",{key:0,class:"thread-composer-plan-panel-latest-status","data-status":i.value.status},D(d(i.value.status)),9,SE)):ve("",!0),w("span",CE,D(((y=i.value)==null?void 0:y.step)??""),1)],8,TE),Oe(Cs,{class:"thread-composer-plan-panel-chevron"})],8,gE)]}),default:dt(()=>[w("div",xE,[w("div",kE,[w("header",IE,[f[3]||(f[3]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",AE,D(h(r)("Plan")),1),w("span",_E,D(s.value)+"/"+D(e.planPanel.steps.length),1)]),e.planPanel.explanation?(_(),F("section",PE,[w("p",RE,D(h(r)("Summary")),1),w("p",{class:"thread-composer-plan-panel-explanation",title:e.planPanel.explanation},D(l.value),9,EE)])):ve("",!0),w("section",ME,[w("p",jE,D(h(r)("Steps"))+" ("+D(e.planPanel.steps.length)+")",1),w("ol",LE,[(_(!0),F(ot,null,Zt(e.planPanel.steps,(b,y)=>(_(),F("li",{key:`composer-plan-${e.planPanel.id}-${y}`,class:"thread-composer-plan-panel-step","data-status":b.status},[w("span",{class:"thread-composer-plan-panel-step-status","data-status":b.status},D(d(b.status)),9,$E),w("span",{class:"thread-composer-plan-panel-step-text",title:b.step},D(b.step),9,OE)],8,NE))),128))])])]),w("footer",DE,[w("button",{type:"button",class:"thread-composer-plan-panel-implement",disabled:e.planPanel.streaming||e.planPanel.implemented,"data-state":e.planPanel.implemented?"done":e.planPanel.streaming?"running":"idle",onClick:c},D(e.planPanel.implemented?h(r)("Plan executed"):e.planPanel.streaming?h(r)("Implementing…"):h(r)("Implement plan")),9,FE)])])]),_:1},8,["open","aria-label"])],8,vE))}}),UE=It(BE,[["__scopeId","data-v-856e4361"]]),zE={key:0,class:"thread-composer-attachments"},HE=["src"],qE=["src","alt"],WE=["aria-label","disabled","onClick"],GE={key:1,class:"thread-composer-folder-chips"},VE=["title"],KE={class:"thread-composer-folder-chip-meta"},YE=["aria-label","disabled","onClick"],JE={key:2,class:"thread-composer-file-chips"},QE=["title"],XE=["aria-label","disabled","onClick"],ZE={key:3,class:"thread-composer-skill-chips"},eM=["title","aria-label","onClick"],tM=["aria-label","onClick"],nM=hn({__name:"ThreadComposerAttachments",props:{selectedImages:{},folderUploadGroups:{},standaloneFileAttachments:{},selectedSkills:{},isInteractionDisabled:{type:Boolean}},emits:["remove-image","remove-folder","remove-file","remove-skill"],setup(e,{emit:t}){const n=t,o=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function r(l){const d=l.trim();return d?!!(/^video\/|^data:video\//i.test(d)||o.test(d)):!1}function a(l){return l.total<=0?0:Math.round(l.processed/l.total*100)}function s(l){const d=l.trim();return d?d.endsWith("/SKILL.md")?d:`${d.replace(/\/+$/,"")}/SKILL.md`:""}function i(l){const d=s(l.path);!d||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(d)}`,"_blank","noopener,noreferrer")}return(l,d)=>(_(),F(ot,null,[e.selectedImages.length>0?(_(),F("div",zE,[(_(!0),F(ot,null,Zt(e.selectedImages,c=>(_(),F("div",{key:c.id,class:"thread-composer-attachment"},[r(c.url)?(_(),F("video",{key:0,class:"thread-composer-attachment-image",src:c.url,controls:"",preload:"metadata"},null,8,HE)):(_(),F("img",{key:1,class:"thread-composer-attachment-image",src:c.url,alt:c.name||"Selected image"},null,8,qE)),w("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${c.name||"image"}`,disabled:e.isInteractionDisabled,onClick:v=>n("remove-image",c.id)}," x ",8,WE)]))),128))])):ve("",!0),e.folderUploadGroups.length>0?(_(),F("div",GE,[(_(!0),F(ot,null,Zt(e.folderUploadGroups,c=>(_(),F("span",{key:c.id,class:"thread-composer-folder-chip"},[Oe(Wf,{class:"thread-composer-folder-chip-icon"}),w("span",{class:"thread-composer-folder-chip-name",title:c.name},D(c.name),9,VE),w("span",KE,[c.isUploading?(_(),F(ot,{key:0},[ws(D(a(c))+"% uploading ("+D(c.processed)+"/"+D(c.total)+") ",1)],64)):(_(),F(ot,{key:1},[ws(D(c.filePaths.length)+" file"+D(c.filePaths.length===1?"":"s"),1)],64))]),w("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${c.name}`,disabled:e.isInteractionDisabled,onClick:v=>n("remove-folder",c.id)},"×",8,YE)]))),128))])):ve("",!0),e.standaloneFileAttachments.length>0?(_(),F("div",JE,[(_(!0),F(ot,null,Zt(e.standaloneFileAttachments,c=>(_(),F("span",{key:c.fsPath,class:"thread-composer-file-chip"},[Oe(el,{class:"thread-composer-file-chip-icon"}),w("span",{class:"thread-composer-file-chip-name",title:c.fsPath},D(c.label),9,QE),w("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${c.label}`,disabled:e.isInteractionDisabled,onClick:v=>n("remove-file",c.fsPath)},"×",8,XE)]))),128))])):ve("",!0),e.selectedSkills.length>0?(_(),F("div",ZE,[(_(!0),F(ot,null,Zt(e.selectedSkills,c=>(_(),F("span",{key:c.path,class:"thread-composer-skill-chip"},[w("button",{class:"thread-composer-skill-chip-name",type:"button",title:s(c.path),"aria-label":`Open ${c.displayName||c.name} SKILL.md`,onClick:v=>i(c)},D(c.displayName||c.name),9,eM),w("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${c.displayName||c.name}`,onClick:v=>n("remove-skill",c.path)},"×",8,tM)]))),128))])):ve("",!0)],64))}}),oM=It(nM,[["__scopeId","data-v-67fd7144"]]),rM=hn({__name:"ThreadComposerModelControls",props:{models:{},selectedModel:{},modelReasoningEfforts:{},selectedReasoningEffort:{},selectedSpeedMode:{},disabled:{type:Boolean},activeThreadId:{}},emits:["update:selected-model","update:selected-reasoning-effort"],setup(e,{emit:t}){const n=e,o=t,{t:r}=da(),a=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],s=K(()=>{var B;const y=(B=n.modelReasoningEfforts)==null?void 0:B[n.selectedModel];if(y===void 0)return a;const P=new Set(y);return a.filter(L=>P.has(L.value))});function i(y){return y.trim().replace(/^gpt/i,"GPT")}const l=K(()=>n.models.map(y=>({value:y,label:i(y)}))),d=K(()=>n.disabled||!n.activeThreadId),c=K(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(n.selectedModel.trim())),v=K(()=>n.selectedSpeedMode==="fast"&&c.value);function f(y){o("update:selected-model",y)}function b(y){o("update:selected-reasoning-effort",y)}return(y,P)=>(_(),F(ot,null,[Oe(ci,{class:"thread-composer-control thread-composer-model-control","model-value":e.selectedModel,options:l.value,"selected-prefix-icon":v.value?bs:null,placeholder:h(r)("Model"),"open-direction":"up",variant:"pill",disabled:d.value||e.models.length===0,"enable-search":"","search-placeholder":h(r)("Search models..."),"onUpdate:modelValue":f},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Oe(ci,{class:"thread-composer-control thread-composer-thinking-control","model-value":e.selectedReasoningEffort,options:s.value,placeholder:h(r)("Thinking"),"open-direction":"up",variant:"pill",disabled:d.value||s.value.length===0,"onUpdate:modelValue":b},null,8,["model-value","options","placeholder","disabled"])],64))}}),aM=It(rM,[["__scopeId","data-v-ad846e52"]]),sM=["aria-label","disabled"],iM=["disabled"],lM=["disabled"],uM=["disabled"],cM={class:"thread-composer-attach-mode"},dM={class:"thread-composer-attach-mode-label"},fM={class:"thread-composer-attach-mode-buttons"},pM=["disabled"],hM=["disabled"],mM={class:"thread-composer-attach-mode"},vM={class:"thread-composer-attach-mode-label"},gM={class:"thread-composer-attach-mode-buttons"},yM=["disabled","onClick"],wM={class:"thread-composer-attach-mode"},bM={class:"thread-composer-attach-mode-label"},TM={class:"thread-composer-attach-mode-buttons"},SM=["disabled","onClick"],CM={key:0,class:"thread-composer-menu-error",role:"alert"},xM={key:0,class:"thread-composer-approval-tip",role:"status"},kM=hn({__name:"ThreadComposerAttachMenu",props:{open:{type:Boolean},isMobile:{type:Boolean},isInteractionDisabled:{type:Boolean},isComposerConfigDisabled:{type:Boolean},isApprovalPolicySaving:{type:Boolean},approvalPolicy:{},approvalPolicyError:{},approvalPolicyNotice:{},selectedCollaborationMode:{},collaborationModeChoices:{},approvalPolicyChoices:{},activeInProgressMode:{}},emits:["update:open","toggle","set-active-mode","select-photo","select-folder","capture-camera","select-collaboration-mode","select-approval-policy"],setup(e,{emit:t}){const n=t,{t:o}=da();function r(){n("toggle")}function a(v){n("set-active-mode",v)}function s(){n("select-photo")}function i(){n("select-folder")}function l(){n("capture-camera")}function d(v){n("select-collaboration-mode",v)}function c(v){n("select-approval-policy",v)}return(v,f)=>(_(),Qe(Qu,{open:e.open,align:"start",width:"lg","aria-label":h(o)("Add photos & files"),"onUpdate:open":f[2]||(f[2]=b=>n("update:open",b))},{trigger:dt(()=>[w("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":h(o)("Add photos & files"),disabled:e.isInteractionDisabled,onClick:r}," + ",8,sM)]),default:dt(()=>[w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:s},D(h(o)("Add photos & files")),9,iM),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:i},D(h(o)("Add folder")),9,lM),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:l},D(h(o)("Take photo")),9,uM),f[5]||(f[5]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",cM,[w("span",dM,D(h(o)("In-progress send")),1),w("div",fM,[w("button",{class:at(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="steer"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[0]||(f[0]=b=>a("steer"))},D(h(o)("Steer")),11,pM),w("button",{class:at(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="queue"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[1]||(f[1]=b=>a("queue"))},D(h(o)("Queue")),11,hM)])]),e.isMobile?(_(),F(ot,{key:0},[f[3]||(f[3]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",mM,[w("span",vM,D(h(o)("Plan mode")),1),w("div",gM,[(_(!0),F(ot,null,Zt(e.collaborationModeChoices,b=>(_(),F("button",{key:`mobile-plan-${b.value}`,class:at(["thread-composer-attach-mode-button",{"is-active":e.selectedCollaborationMode===b.value}]),type:"button",disabled:b.disabled||e.isComposerConfigDisabled,onClick:y=>d(b.value)},D(h(o)(b.labelKey)),11,yM))),128))])]),f[4]||(f[4]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",wM,[w("span",bM,D(h(o)("Approval policy")),1),w("div",TM,[(_(!0),F(ot,null,Zt(e.approvalPolicyChoices,b=>(_(),F("button",{key:`mobile-approval-${b.value}`,class:at(["thread-composer-attach-mode-button",{"is-active":e.approvalPolicy===b.value}]),type:"button",disabled:e.isApprovalPolicySaving,onClick:y=>c(b.value)},D(h(o)(b.label)),11,SM))),128))])]),e.approvalPolicyError?(_(),F("p",CM,D(e.approvalPolicyError),1)):ve("",!0),Oe(Xl,{name:"approval-tip"},{default:dt(()=>[e.approvalPolicyNotice?(_(),F("span",xM,D(e.approvalPolicyNotice),1)):ve("",!0)]),_:1})],64)):ve("",!0)]),_:1},8,["open","aria-label"]))}}),IM=It(kM,[["__scopeId","data-v-93f4c279"]]),AM=/(^|\s)(\/[a-zA-Z]*)$/,Mm=[{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 _M(e){var o,r,a;const t=[],n=new Set;for(const s of e){const i=s.name.trim().replace(/^\//u,"").toLowerCase().replace(/\s+/gu,"-");if(!i)continue;const l=s.path.trim()||i;n.has(l)||(n.add(l),t.push({id:i,description:((o=s.description)==null?void 0:o.trim())||"Run this skill",kind:"skill",group:"skill",skillPath:s.path,displayName:((r=s.displayName)==null?void 0:r.trim())||s.name.trim(),scope:((a=s.scope)==null?void 0:a.trim())||"user"}))}return t.sort((s,i)=>s.id.localeCompare(i.id))}function PM(e){const t=e.match(AM);if(!t)return null;const n=t[2]??"";return{query:n.slice(1).toLowerCase(),token:n,startIndex:e.length-n.length}}function RM(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 EM={class:"thread-composer-main"},MM={class:"thread-composer-input-row"},jM={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},LM={class:"thread-composer-drop-overlay-copy"},NM={key:1,class:"composer-popover"},$M=["onMousedown"],OM={key:1,class:"thread-composer-file-mention-icon-markdown"},DM={class:"thread-composer-file-mention-text"},FM={class:"thread-composer-file-mention-name"},BM={key:0,class:"thread-composer-file-mention-dir"},UM={key:1,class:"thread-composer-file-mention-empty"},zM={key:2,class:"thread-composer-file-mention-empty"},HM=["placeholder","disabled"],qM=["aria-label","title","disabled"],WM={class:"thread-composer-actions"},GM=["aria-label","title","disabled"],VM={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},KM=["aria-label","title","disabled"],YM=["aria-label","disabled"],JM={class:"thread-composer-plan-trigger-label"},QM=["aria-checked","disabled","onClick"],XM={class:"thread-composer-menu-item-copy"},ZM={class:"thread-composer-menu-item-title"},e1={key:0,class:"thread-composer-menu-item-sub"},t1={key:1,class:"thread-composer-menu-item-hint"},n1={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},o1=["aria-label","disabled"],r1={class:"thread-composer-approval-trigger-label"},a1=["aria-checked","disabled","onClick"],s1={class:"thread-composer-menu-item-copy"},i1={class:"thread-composer-menu-item-title"},l1={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},u1={key:0,class:"thread-composer-menu-error",role:"alert"},c1={key:0,class:"thread-composer-approval-tip",role:"status"},d1=["title","aria-label"],f1={class:"thread-composer-context-usage-value"},p1={key:0,class:"thread-composer-context-usage-compact"},h1=["disabled"],m1=["disabled"],v1=["disabled"],Ad=12e3,g1=2e3,y1="codex-web-local.thread-draft.v1.",w1=hn({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},fuzzyFileSearchResults:{},collaborationModes:{},selectedCollaborationMode:{},models:{},modelReasoningEfforts:{},selectedModel:{},selectedReasoningEffort:{},selectedSpeedMode:{},skills:{},threadTokenUsage:{},codexQuota:{},isTurnInProgress:{type:Boolean},isStopPending:{type:Boolean},isInterruptingTurn:{type:Boolean},isCompacting:{type:Boolean},externalSessionActive:{type:Boolean},isUpdatingSpeedMode:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean},dictationAutoSend:{type:Boolean},dictationLanguage:{},approvalPolicy:{},isApprovalPolicySaving:{type:Boolean},approvalPolicyError:{},approvalPolicyNotice:{},planPanel:{}},emits:["submit","interrupt","register-fuzzy-session","slash-command","update:selected-collaboration-mode","update:selected-model","update:selected-reasoning-effort","update:selected-speed-mode","update:approval-policy","save-approval-policy","implement-plan","compact-context"],setup(e,{expose:t,emit:n}){const o=e,r=n,{t:a}=da(),s=S(""),i=S([]),l=S([]),d=S([]),c=S([]),v=S(""),f=S(0),b=S(null),y=S(!1),{state:P,cancel:B}=NR({getLanguage:()=>o.dictationLanguage??"auto",onTranscript:C=>{if(s.value=s.value?`${s.value}
|
|
58
|
-
${C}`:C,v.value="",o.dictationAutoSend!==!1){const E=o.isTurnInProgress?Ne.value:"steer";zt(E);return}Nt(()=>{var E;return(E=H.value)==null?void 0:E.focus()})},onEmpty:()=>{v.value=o.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:C=>{if(C instanceof DOMException&&C.name==="NotAllowedError"){v.value="Microphone access was denied.";return}v.value=C instanceof Error?C.message:"Dictation failed."}}),L=S(null),j=S(null),U=S(null),H=S(null),{isMobile:be}=Df(),le=S(!1),W=S(!1),he=S(!1),Se=S(null),Pe=S(""),
|
|
59
|
-
`).length),st=K(()=>Ae.value||et.value>=6||Fe.value),mt=K(()=>Br(o.threadTokenUsage??null)),q=K(()=>{var C;return((C=mt.value)==null?void 0:C.summaryText)??""}),ae=K(()=>{var C;return((C=mt.value)==null?void 0:C.tooltipText)??""}),_e=K(()=>{var C;return((C=mt.value)==null?void 0:C.tone)??"healthy"});function Ye(){_e.value!=="healthy"&&r("compact-context")}function bt(C){if(!Number.isFinite(C))return"0";const E=Math.abs(C);return E>=1e6?`${(E>=1e7?(C/1e6).toFixed(0):(C/1e6).toFixed(1)).replace(/\.0$/,"")}M`:E>=1e3?`${(E>=1e5?(C/1e3).toFixed(0):(C/1e3).toFixed(1)).replace(/\.0$/,"")}k`:String(Math.round(C))}function Tt(C){const E=Math.max(0,C.inputTokens-C.cachedInputTokens),Q=[`${bt(C.totalTokens)} ${a("total")}`,`${bt(E)} ${a("input")}`];return C.cachedInputTokens>0&&Q.push(`${bt(C.cachedInputTokens)} ${a("cached")}`),C.outputTokens>0&&Q.push(`${bt(C.outputTokens)} ${a("output")}`),C.reasoningOutputTokens>0&&Q.push(`${bt(C.reasoningOutputTokens)} ${a("reasoning")}`),Q.join(" · ")}function At(C,E){if(!Number.isFinite(C)||!Number.isFinite(E)||E<=0)return 0;if(E<=Ad){const _t=Math.max(0,E-Math.max(0,C));return Math.max(0,Math.min(100,Math.round(_t/E*100)))}const Q=E-Ad,
|
|
60
|
-
`),percentRemaining:ye,tone:_t}}function zt(C="steer"){var Q;const E=s.value.trim();if(re.value){if(r("submit",{text:E,imageUrls:i.value.map(ye=>ye.url),fileAttachments:[...d.value],skills:l.value.map(ye=>({name:ye.name,path:ye.path})),mode:C}),Ps(o.activeThreadId),pa(),Ae.value=!1,c.value=[],le.value=!1,no(),Ee||be.value){(Q=H.value)==null||Q.blur();return}Nt(()=>{var ye;return(ye=H.value)==null?void 0:ye.focus()})}}function Ha(C){Ne.value=C}function fa(C){lt.value+=1,s.value=C.text,i.value=C.imageUrls.map((E,Q)=>({id:`queued-${Date.now()}-${Q}-${Math.random().toString(36).slice(2,8)}`,name:`${a("Image")} ${Q+1}`,url:E})),l.value=C.skills.map(E=>(o.skills??[]).find(Q=>Q.path===E.path)??{name:E.name,displayName:void 0,description:"",path:E.path}),d.value=C.fileAttachments.map(E=>({...E})),c.value=[],v.value="",b.value=null,f.value=0,le.value=!1,no(),wo(),ue+=1}function pa(){fa({text:"",imageUrls:[],fileAttachments:[],skills:[]}),Ae.value=!1}function ar(C){return`${y1}${C}`}function Ur(C){if(typeof window>"u")return null;const E=C.trim();if(!E)return null;try{const Q=window.localStorage.getItem(ar(E));if(!Q)return null;const ye=JSON.parse(Q);return typeof ye=="string"?{text:ye,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof ye.text=="string"?ye.text:"",imageUrls:Array.isArray(ye.imageUrls)?ye.imageUrls.filter(ct=>typeof ct=="string"):[],fileAttachments:Array.isArray(ye.fileAttachments)?ye.fileAttachments.filter(ct=>!!ct&&typeof ct.label=="string"&&typeof ct.path=="string"&&typeof ct.fsPath=="string"):[],skills:Array.isArray(ye.skills)?ye.skills.filter(ct=>!!ct&&typeof ct.name=="string"&&typeof ct.path=="string"):[]}}catch{return null}}function zr(C,E){if(typeof window>"u")return;const Q=C.trim();if(Q)try{if(E.text.trim().length>0||E.imageUrls.length>0||E.fileAttachments.length>0||E.skills.length>0){window.localStorage.setItem(ar(Q),JSON.stringify(E));return}window.localStorage.removeItem(ar(Q))}catch{}}function Ps(C){zr(C,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function qa(){return{text:s.value,imageUrls:i.value.map(C=>C.url),fileAttachments:d.value.map(C=>({...C})),skills:l.value.map(C=>({name:C.name,path:C.path}))}}function Wa(){r("interrupt")}function Uo(){const C=H.value;if(!C){Fe.value=!1;return}Fe.value=C.scrollHeight>C.clientHeight+2}function sr(){Ke||(Ke=!0,Nt(()=>{Ke=!1,Uo()}))}function Zn(){ke.value||(Ae.value=!Ae.value,sr(),Nt(()=>{var C;return(C=H.value)==null?void 0:C.focus()}))}function Rs(C){r("update:selected-model",C)}function ha(C){if(C===o.selectedCollaborationMode){W.value=!1;return}r("update:selected-collaboration-mode",C),W.value=!1}function Es(C){if(C===o.selectedCollaborationMode){le.value=!1;return}r("update:selected-collaboration-mode",C),le.value=!1}function zo(C){r("update:selected-reasoning-effort",C)}function Po(C){o.approvalPolicy===C||o.isApprovalPolicySaving===!0||(r("update:approval-policy",C),r("save-approval-policy"))}function Dn(){o.dictationClickToToggle}function Ga(){ke.value||(le.value=!le.value,W.value=!1,he.value=!1)}function Ms(){me.value||(W.value=!W.value,le.value=!1,he.value=!1)}function vt(){me.value||(he.value=!he.value,le.value=!1,W.value=!1)}function Ct(){var C;(C=L.value)==null||C.click()}function kt(){var C;(C=j.value)==null||C.click()}function mn(){var C;(C=U.value)==null||C.click()}function Fn(C){const E=i.value.find(Q=>Q.id===C);if(E&&xt(E.url)){const Q=eo(E.url);Q&&Hr(Q)}i.value=i.value.filter(Q=>Q.id!==C)}function ho(C){l.value=l.value.filter(E=>E.path!==C)}function Hr(C){d.value=d.value.filter(E=>E.fsPath!==C)}function qr(C){const E=c.value.find(ye=>ye.id===C);if(!E)return;const Q=new Set(E.filePaths);d.value=d.value.filter(ye=>!Q.has(ye.fsPath)),c.value=c.value.filter(ye=>ye.id!==C)}function mo(C,E){const Q=C.replace(/\\/g,"/");if(d.value.some(_t=>_t.fsPath===Q))return;const ye=Q.split("/").filter(Boolean),ct=(E==null?void 0:E.trim())||ye[ye.length-1]||Q;d.value=[...d.value,{label:ct,path:Q,fsPath:Q}]}function Ho(C){return C.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(C.name)}const Ro=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function Bn(C){return C.type.startsWith("video/")?!0:Ro.test(C.name)}function xt(C){const E=C.trim();if(!E)return!1;if(E.startsWith("data:video/"))return!0;try{const Q=new URL(E,window.location.href);return Ro.test(Q.pathname)?!0:Q.pathname==="/codex-local-image"?Ro.test(Q.searchParams.get("path")??""):!1}catch{return Ro.test(E)}}function eo(C){try{const E=new URL(C,window.location.href);return E.pathname!=="/codex-local-image"?"":decodeURIComponent(E.searchParams.get("path")??"").replace(/\\/g,"/")}catch{return""}}function vo(C){return C?Array.from(C):[]}function Eo(C){return C!==ue?!1:(f.value+=1,!0)}function Mo(C){C===ue&&(f.value=Math.max(0,f.value-1))}function en(C){if(C<=0)return;const E=b.value,Q=E?E.succeeded+E.failed:0;if(!E||Q>=E.total){b.value={total:C,succeeded:0,failed:0};return}b.value={...E,total:E.total+C}}function Un(C){const E=b.value;E&&(b.value={...E,succeeded:E.succeeded+(C==="success"?1:0),failed:E.failed+(C==="failure"?1:0)})}function ir(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function lr(C){const E=new Date,Q=[E.getFullYear(),String(E.getMonth()+1).padStart(2,"0"),String(E.getDate()).padStart(2,"0"),String(E.getHours()).padStart(2,"0"),String(E.getMinutes()).padStart(2,"0"),String(E.getSeconds()).padStart(2,"0")].join("-"),ye=C.type.startsWith("image/")&&C.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${Q}.${ye}`}function bn(){const C=new Date;return`pasted-text-${[C.getFullYear(),String(C.getMonth()+1).padStart(2,"0"),String(C.getDate()).padStart(2,"0"),String(C.getHours()).padStart(2,"0"),String(C.getMinutes()).padStart(2,"0"),String(C.getSeconds()).padStart(2,"0")].join("-")}.txt`}function ma(C){return C.name.trim()?C:new File([C],lr(C),{type:C.type||"image/png",lastModified:Date.now()})}async function tn(C,E){if(Eo(E))try{const Q=ma(C),ye=await wu(Q);if(E!==ue)return;if(!ye){Un("failure");return}i.value=[...i.value,{id:ir(),name:Q.name,url:`/codex-local-image?path=${encodeURIComponent(ye)}`}],Un("success")}catch{E===ue&&Un("failure")}finally{Mo(E)}}async function Wr(C,E){if(Eo(E))try{const Q=await wu(C);if(E!==ue)return;if(!Q){Un("failure");return}mo(Q),Un("success")}catch{E===ue&&Un("failure")}finally{Mo(E)}}async function go(C,E){if(Eo(E))try{const Q=ma(C),ye=await wu(Q);if(E!==ue)return;if(!ye){Un("failure");return}const ct=ye.replace(/\\/g,"/");i.value=[...i.value,{id:ir(),name:Q.name,url:`/codex-local-image?path=${encodeURIComponent(ct)}`}],mo(ct),Un("success")}catch{E===ue&&Un("failure")}finally{Mo(E)}}function Lt(C){const E=vo(C);if(E.length===0)return;en(E.length),le.value=!1,no();const Q=ue;for(const ye of E)Ho(ye)?tn(ye,Q):Bn(ye)?go(ye,Q):Wr(ye,Q)}function zn(){oe=0,y.value=!1}function sn(C){return C?Array.from(C.types??[]).includes("Files"):!1}async function to(C){if(!C||C.length===0)return;const E=lt.value,Q=Array.from(C),ct=(Q[0].webkitRelativePath||Q[0].name).split("/").filter(Boolean)[0]||"Folder",_t=`${Date.now()}-${Math.random().toString(36).slice(2)}`;c.value=[...c.value,{id:_t,name:ct,total:Q.length,processed:0,filePaths:[],isUploading:!0}];const _n=Kt=>{E===lt.value&&(c.value=c.value.map(Pn=>Pn.id===_t?Kt(Pn):Pn))};for(const Kt of Q)try{const Pn=await wu(Kt);if(E!==lt.value)return;if(Pn){const Wt=Kt.webkitRelativePath||Kt.name;mo(Pn,Wt),_n(vn=>({...vn,processed:vn.processed+1,filePaths:[...vn.filePaths,Pn]}));continue}_n(Wt=>({...Wt,processed:Wt.processed+1}))}catch{_n(Pn=>({...Pn,processed:Pn.processed+1}))}_n(Kt=>({...Kt,isUploading:!1}))}function nn(C){C&&(C.value="")}function Va(C){const E=C.target;Lt((E==null?void 0:E.files)??null),nn(E),le.value=!1}function on(C){const E=C.target;Lt((E==null?void 0:E.files)??null),nn(E),le.value=!1}function qo(C){const E=C.target;to((E==null?void 0:E.files)??null),nn(E),le.value=!1}function ur(C){ke.value||!sn(C.dataTransfer)||(C.preventDefault(),oe+=1,y.value=!0)}function Ht(C){ke.value||!sn(C.dataTransfer)||(C.preventDefault(),C.dataTransfer&&(C.dataTransfer.dropEffect="copy"),y.value=!0)}function js(C){y.value&&(C.preventDefault(),oe=Math.max(0,oe-1),oe===0&&zn())}function Gr(C){var E;ke.value||!sn(C.dataTransfer)||(C.preventDefault(),zn(),Lt(((E=C.dataTransfer)==null?void 0:E.files)??null))}function Wo(){!y.value&&oe===0||zn()}function yo(C){var _t,_n;if(ke.value)return;const E=((_t=C.clipboardData)==null?void 0:_t.getData("text/plain"))??"";if(E.length>=g1){C.preventDefault();const Kt=new File([E],bn(),{type:"text/plain",lastModified:Date.now()});Lt([Kt]);return}const Q=Array.from(((_n=C.clipboardData)==null?void 0:_n.items)??[]);if(Q.length===0)return;const ye=E.length>0,ct=Q.filter(Kt=>Kt.kind==="file"&&Kt.type.startsWith("image/")).map(Kt=>Kt.getAsFile()).filter(Kt=>Kt instanceof File);ct.length!==0&&(ye||C.preventDefault(),Lt(ct))}function qt(){v.value&&(v.value=""),sr(),Ya(),Vr()}function Ka(C){if(C.isComposing||C.keyCode===229)return;if(Y.value){if(C.key==="Escape"){C.preventDefault(),no();return}if(C.key==="ArrowDown"){C.preventDefault(),ge.value.length>0&&(pe.value=(pe.value+1)%ge.value.length);return}if(C.key==="ArrowUp"){if(C.preventDefault(),ge.value.length>0){const Q=ge.value.length;pe.value=(pe.value+Q-1)%Q}return}if(C.key==="Enter"||C.key==="Tab"){C.preventDefault();const Q=ge.value[pe.value];Q?oo(Q):no();return}}if(ne.value){if(C.key==="Escape"){C.preventDefault(),wo();return}if(C.key==="ArrowDown"){C.preventDefault(),de.value.length>0&&(te.value=(te.value+1)%de.value.length);return}if(C.key==="ArrowUp"){if(C.preventDefault(),de.value.length>0){const Q=de.value.length;te.value=(te.value+Q-1)%Q}return}if(C.key==="Enter"||C.key==="Tab"){C.preventDefault();const Q=de.value[te.value];Q?bo(Q):wo();return}}if(o.sendWithEnter!==!1?C.key==="Enter"&&!C.shiftKey:C.key==="Enter"&&(C.metaKey||C.ctrlKey)){C.preventDefault(),zt(o.isTurnInProgress?Ne.value:"steer");return}}function no(){if(Y.value=!1,Se.value=null,Pe.value="",ge.value=[],pe.value=0,N=!1,fe){const C=fe;fe="",Px(C)}}function Ya(){const C=H.value;if(!C){no();return}const E=C.selectionStart??s.value.length,ye=s.value.slice(0,E).match(/(^|\s)(@[^\s@]*)$/);if(!ye){no();return}const ct=ye[2]??"",_t=ct.length,_n=E-_t;ne.value&&wo(),Se.value=_n,Pe.value=ct.slice(1),Y.value=!0,jo()}function wo(){ne.value=!1,xe.value=null,$e.value="",te.value=0,de.value=Le.value}function Vr(){const C=H.value;if(!C){wo();return}const E=C.selectionStart??s.value.length,Q=s.value.slice(0,E),ye=PM(Q);if(!ye){wo();return}Y.value&&no(),xe.value=ye.startIndex,$e.value=ye.query,de.value=RM(Le.value,ye.query),te.value=0,ne.value=!0}function bo(C){const E=H.value,Q=xe.value;if(Q!==null&&E){const ye=E.selectionStart??s.value.length;s.value=`${s.value.slice(0,Q)}${s.value.slice(ye)}`}if(wo(),C.kind==="skill"){const ye=(o.skills??[]).find(_t=>_t.path===C.skillPath||_t.name===C.id);ye&&!l.value.some(_t=>_t.path===ye.path)&&(l.value=[...l.value,{...ye}]);const ct=s.value.trim();s.value=ct.length>0?`${ct} (Use the ${C.id} skill.)`:`Use the ${C.id} skill.`,Nt(()=>{E==null||E.focus(),Uo()});return}if(C.kind==="rpc"){r("slash-command",C.id);return}C.kind==="text"&&C.insertText&&(s.value=s.value.trimEnd(),s.value=s.value.length>0?`${s.value} ${C.insertText}`:C.insertText),C.kind==="local"&&C.id==="clear"&&(s.value=""),Nt(()=>{E==null||E.focus(),Uo()})}async function jo(){if(!Y.value)return;const C=(o.cwd??"").trim();if(!C){ge.value=[],N=!0;return}N=!1,ut&&clearTimeout(ut);const E=++Ze;ut=setTimeout(async()=>{const Q=`composer-${E}`,ye=Pe.value;try{if(fe||(await Ax([C],Q),fe=Q,r("register-fuzzy-session",Q)),await _x(fe,ye),!Y.value||E!==Ze)return;if(ge.value=(o.fuzzyFileSearchResults??[]).map(ct=>({path:ct.path})),pe.value=0,ge.value.length===0)try{const ct=await Yh(C,ye,20);if(!Y.value||E!==Ze)return;ge.value=ct,pe.value=0}catch{if(!Y.value||E!==Ze)return;ge.value=[]}}catch{if(!Y.value||E!==Ze)return;fe="";try{const ct=await Yh(C,ye,20);if(!Y.value||E!==Ze)return;ge.value=ct,pe.value=0}catch{if(!Y.value||E!==Ze)return;ge.value=[]}}},120)}function oo(C){const E=H.value,Q=Se.value;if(Q!==null&&E){const ye=E.selectionStart??s.value.length;s.value=`${s.value.slice(0,Q)}${s.value.slice(ye)}`.trimEnd()}mo(C.path),no(),Nt(()=>E==null?void 0:E.focus())}function cr(C){B(),fa(C),Nt(()=>{var E;(E=H.value)==null||E.focus(),Uo()})}function St(C){const E=C.trim();E&&(s.value=s.value.trim()?`${s.value.trim()}
|
|
61
|
-
${E}`:E,Nt(()=>{var Q;(Q=H.value)==null||Q.focus(),Uo()}))}function ln(C){const E=C.lastIndexOf("/");return E<0?C:C.slice(E+1)}function In(C){const E=C.lastIndexOf("/");return E<=0?"":C.slice(0,E)}function dr(C){const E=ln(C),Q=E.lastIndexOf(".");return Q<=0?"":E.slice(Q+1).toLowerCase()}function An(C){const E=dr(C);return E==="ts"?"TS":E==="tsx"?"TSX":E==="js"?"JS":E==="jsx"?"JSX":E==="json"?"{}":""}function Kr(C){const E=dr(C);return E.startsWith("ts")?"ts":E.startsWith("js")?"js":E==="json"?"json":"default"}function fr(C){const E=dr(C);return E==="md"||E==="mdx"}function dn(C){if(!le.value&&!W.value&&!he.value)return;const E=C.target;E&&(typeof E.closest=="function"&&E.closest(".composer-popover-anchor")||(le.value=!1,W.value=!1,he.value=!1))}return pi(()=>{document.addEventListener("click",dn),window.addEventListener("drop",Wo),window.addEventListener("dragend",Wo),window.addEventListener("blur",Wo),sr()}),t({hydrateDraft:cr,appendTextToDraft:St,hasUnsavedDraft:()=>je.value}),_s(()=>{document.removeEventListener("click",dn),window.removeEventListener("drop",Wo),window.removeEventListener("dragend",Wo),window.removeEventListener("blur",Wo),window.removeEventListener("pointerup",Dn),window.removeEventListener("pointercancel",Dn),window.removeEventListener("blur",Dn),ut&&clearTimeout(ut)}),tt(()=>o.activeThreadId,C=>{B(),Be&&zr(Be,qa()),pa();const E=Ur(C);E&&(fa(E),qt()),Be=C.trim()},{immediate:!0}),tt([s,i,d,l],()=>{Be&&zr(Be,qa())},{deep:!0}),tt(s,()=>{sr()}),tt(()=>o.cwd,()=>{Y.value&&jo()}),tt(()=>o.fuzzyFileSearchResults,C=>{!Y.value||!fe||(ge.value=(C??[]).map(E=>({path:E.path})),pe.value=0)}),tt(Ve,C=>{Ne.value=C}),(C,E)=>(_(),F("form",{class:"thread-composer",onSubmit:E[6]||(E[6]=gt(Q=>zt(e.isTurnInProgress?Ne.value:"steer"),["prevent"]))},[w("div",{class:at(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":y.value}])},[e.planPanel?(_(),Qe(UE,{key:0,"plan-panel":e.planPanel,onImplementPlan:E[0]||(E[0]=Q=>C.$emit("implement-plan"))},null,8,["plan-panel"])):ve("",!0),Oe(oM,{"selected-images":i.value,"folder-upload-groups":c.value,"standalone-file-attachments":Re.value,"selected-skills":l.value,"is-interaction-disabled":ke.value,onRemoveImage:Fn,onRemoveFolder:qr,onRemoveFile:Hr,onRemoveSkill:ho},null,8,["selected-images","folder-upload-groups","standalone-file-attachments","selected-skills","is-interaction-disabled"]),w("div",EM,[w("div",MM,[w("div",{class:at(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":y.value,"thread-composer-input-wrap--expanded":Ae.value}]),onDragenter:ur,onDragover:Ht,onDragleave:js,onDrop:Gr},[y.value?(_(),F("div",jM,[w("span",LM,D(h(a)("Drop images or files")),1)])):ve("",!0),Y.value?(_(),F("div",NM,[ge.value.length>0?(_(!0),F(ot,{key:0},Zt(ge.value,(Q,ye)=>(_(),F("button",{key:Q.path,class:at(["thread-composer-file-mention-row",{"is-active":ye===pe.value}]),type:"button",onMousedown:gt(ct=>oo(Q),["prevent"])},[An(Q.path)?(_(),F("span",{key:0,class:at(["thread-composer-file-mention-icon-badge",`is-${Kr(Q.path)}`])},D(An(Q.path)),3)):fr(Q.path)?(_(),F("span",OM,"↓")):(_(),Qe(el,{key:2,class:"thread-composer-file-mention-icon-file"})),w("span",DM,[w("span",FM,D(ln(Q.path)),1),In(Q.path)?(_(),F("span",BM,D(In(Q.path)),1)):ve("",!0)])],42,$M))),128)):h(N)?(_(),F("div",UM,D(h(a)("No searchable directory for this thread")),1)):(_(),F("div",zM,D(h(a)("No matching files")),1))])):ve("",!0),ne.value?(_(),Qe(mE,{key:2,commands:de.value,"highlighted-index":te.value,onSelect:bo},null,8,["commands","highlighted-index"])):ve("",!0),xn(w("textarea",{ref_key:"inputRef",ref:H,"onUpdate:modelValue":E[1]||(E[1]=Q=>s.value=Q),class:"thread-composer-input",placeholder:Ue.value,disabled:ke.value,onInput:qt,onKeydown:Ka,onPaste:yo},null,40,HM),[[Nn,s.value]]),st.value?(_(),F("button",{key:3,class:"thread-composer-expand",type:"button","aria-label":Ae.value?h(a)("Exit full screen composer"):h(a)("Expand composer"),title:Ae.value?h(a)("Exit full screen composer"):h(a)("Expand composer"),disabled:ke.value,onClick:Zn},[Ae.value?(_(),Qe(VR,{key:0,class:"thread-composer-expand-icon"})):(_(),Qe(HR,{key:1,class:"thread-composer-expand-icon"}))],8,qM)):ve("",!0)],34),w("div",WM,[e.isTurnInProgress&&!Je.value?(_(),F("button",{key:0,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?h(a)("Saving thread before stop is available"):h(a)("Stop"),title:e.isStopPending?h(a)("Saving thread before stop is available"):h(a)("Stop"),disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending||e.externalSessionActive===!0,onClick:Wa},[e.isStopPending?(_(),F("span",VM)):(_(),Qe(QR,{key:1,class:"thread-composer-stop-icon"}))],8,GM)):(_(),F("button",{key:1,class:at(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&Ne.value==="queue"}]),type:"button","aria-label":e.isCompacting?h(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress&&Ne.value==="queue"?h(a)("Queue message"):h(a)("Send message"),title:e.isCompacting?h(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress?`${h(a)("Send")} ${Ne.value==="queue"?h(a)("Queue"):h(a)("Steer")}`:h(a)("Send"),disabled:!re.value,onClick:E[2]||(E[2]=Q=>zt(e.isTurnInProgress?Ne.value:"steer"))},[Oe(FR,{class:"thread-composer-submit-icon"})],10,KM))])]),w("div",{class:at(["thread-composer-controls",{"thread-composer-controls--recording":He.value}])},[Oe(IM,{open:le.value,"is-mobile":h(be),"is-interaction-disabled":ke.value,"is-composer-config-disabled":me.value,"is-approval-policy-saving":e.isApprovalPolicySaving,"approval-policy":e.approvalPolicy,"approval-policy-error":e.approvalPolicyError,"approval-policy-notice":e.approvalPolicyNotice,"selected-collaboration-mode":e.selectedCollaborationMode,"collaboration-mode-choices":A.value,"approval-policy-choices":M,"active-in-progress-mode":Ne.value,"onUpdate:open":E[3]||(E[3]=Q=>le.value=Q),onToggle:Ga,onSetActiveMode:Ha,onSelectPhoto:Ct,onSelectFolder:mn,onCaptureCamera:kt,onSelectCollaborationMode:Es,onSelectApprovalPolicy:Po},null,8,["open","is-mobile","is-interaction-disabled","is-composer-config-disabled","is-approval-policy-saving","approval-policy","approval-policy-error","approval-policy-notice","selected-collaboration-mode","collaboration-mode-choices","active-in-progress-mode"]),h(be)?ve("",!0):(_(),Qe(Qu,{key:0,open:W.value,align:"start",width:"md","aria-label":h(a)("Plan mode"),"onUpdate:open":E[4]||(E[4]=Q=>W.value=Q)},{trigger:dt(()=>[w("button",{class:at(["thread-composer-plan-trigger",{"is-active":W.value}]),type:"button","aria-label":h(a)("Plan mode"),disabled:me.value,onClick:Ms},[w("span",JM,D(z.value),1),Oe(Cs,{class:"thread-composer-plan-trigger-chevron"})],10,YM)]),default:dt(()=>[(_(!0),F(ot,null,Zt(A.value,Q=>(_(),F("button",{key:Q.value,class:at(["thread-composer-menu-item",{"is-active":e.selectedCollaborationMode===Q.value}]),type:"button",role:"menuitemradio","aria-checked":e.selectedCollaborationMode===Q.value,disabled:Q.disabled||me.value,onClick:ye=>ha(Q.value)},[w("span",XM,[w("span",ZM,D(h(a)(Q.labelKey)),1),Q.subLabel?(_(),F("span",e1,D(Q.subLabel),1)):ve("",!0),Q.disabled?(_(),F("span",t1,D(h(a)("Not supported by this Codex version")),1)):ve("",!0)]),e.selectedCollaborationMode===Q.value?(_(),F("span",n1,"✓")):ve("",!0)],10,QM))),128))]),_:1},8,["open","aria-label"])),h(be)?ve("",!0):(_(),Qe(Qu,{key:1,open:he.value,align:"center",width:"md","aria-label":h(a)("Approval policy"),"onUpdate:open":E[5]||(E[5]=Q=>he.value=Q)},{trigger:dt(()=>[w("button",{class:at(["thread-composer-approval-trigger",{"is-active":he.value}]),type:"button","aria-label":h(a)("Approval policy"),disabled:me.value,onClick:vt},[w("span",r1,D(Z.value),1),Oe(Cs,{class:"thread-composer-approval-trigger-chevron"})],10,o1)]),default:dt(()=>[(_(),F(ot,null,Zt(M,Q=>w("button",{key:Q.value,class:at(["thread-composer-menu-item",{"is-active":e.approvalPolicy===Q.value}]),type:"button",role:"menuitemradio","aria-checked":e.approvalPolicy===Q.value,disabled:e.isApprovalPolicySaving,onClick:ye=>Po(Q.value)},[w("span",s1,[w("span",i1,D(h(a)(Q.label)),1)]),e.approvalPolicy===Q.value?(_(),F("span",l1,"✓")):ve("",!0)],10,a1)),64)),e.approvalPolicyError?(_(),F("p",u1,D(e.approvalPolicyError),1)):ve("",!0),Oe(Xl,{name:"approval-tip"},{default:dt(()=>[e.approvalPolicyNotice?(_(),F("span",c1,D(e.approvalPolicyNotice),1)):ve("",!0)]),_:1})]),_:1},8,["open","aria-label"])),Oe(aM,{models:e.models,"selected-model":e.selectedModel,"model-reasoning-efforts":e.modelReasoningEfforts,"selected-reasoning-effort":e.selectedReasoningEffort,"selected-speed-mode":e.selectedSpeedMode,disabled:e.disabled,"active-thread-id":e.activeThreadId,"onUpdate:selectedModel":Rs,"onUpdate:selectedReasoningEffort":zo},null,8,["models","selected-model","model-reasoning-efforts","selected-reasoning-effort","selected-speed-mode","disabled","active-thread-id"]),mt.value?(_(),F("button",{key:2,type:"button",class:at(["thread-composer-context-usage-inline",{"is-warning":_e.value==="warning","is-danger":_e.value==="danger"}]),title:ae.value,"aria-label":h(a)("Context"),onClick:Ye},[w("span",f1,D(q.value),1),_e.value!=="healthy"?(_(),F("span",p1,D(h(a)("Compact")),1)):ve("",!0)],10,d1)):ve("",!0)],2)])],2),w("input",{ref_key:"photoLibraryInputRef",ref:L,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:ke.value,onChange:Va},null,40,h1),w("input",{ref_key:"cameraCaptureInputRef",ref:j,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:ke.value,onChange:on},null,40,m1),w("input",{ref_key:"folderPickerInputRef",ref:U,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:ke.value,onChange:qo},null,40,v1)],32))}}),jm=It(w1,[["__scopeId","data-v-b91883d7"]]),b1=["aria-label"],T1=["aria-checked","onClick"],S1={class:"runtime-toggle-option-label"},C1=hn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:o}=da(),r=[{value:"local",label:o("Local project"),icon:Wf},{value:"worktree",label:o("New worktree"),icon:Ju}];function a(s){n("update:modelValue",s)}return(s,i)=>(_(),F("div",{class:"runtime-toggle",role:"radiogroup","aria-label":h(o)("Continue in")},[(_(),F(ot,null,Zt(r,l=>w("button",{key:l.value,class:at(["runtime-toggle-option",{"is-selected":e.modelValue===l.value}]),type:"button",role:"radio","aria-checked":e.modelValue===l.value,onClick:d=>a(l.value)},[(_(),Qe(_f(l.icon),{class:"runtime-toggle-option-icon"})),w("span",S1,D(l.label),1)],10,T1)),64))],8,b1))}}),x1=It(C1,[["__scopeId","data-v-4d282f1a"]]),k1={},I1={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 A1(e,t){return _(),F("svg",I1,[...t[0]||(t[0]=[w("path",{d:"M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12"},null,-1),w("path",{d:"M9 4l0 16"},null,-1)])])}const sy=It(k1,[["render",A1]]),_1={},P1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function R1(e,t){return _(),F("svg",P1,[...t[0]||(t[0]=[w("path",{d:"M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm12 -16h-8v14h8a1 1 0 0 0 1 -1v-12a1 1 0 0 0 -1 -1"},null,-1)])])}const E1=It(_1,[["render",R1]]),M1={class:"sidebar-thread-controls"},j1=["aria-label","title"],L1=["aria-label","title"],N1=hn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=da();return(n,o)=>(_(),F("div",M1,[w("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?h(t)("Expand sidebar"):h(t)("Collapse sidebar"),title:e.isSidebarCollapsed?h(t)("Expand sidebar"):h(t)("Collapse sidebar"),onClick:o[0]||(o[0]=r=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(_(),Qe(E1,{key:0,class:"sidebar-thread-controls-icon"})):(_(),Qe(sy,{key:1,class:"sidebar-thread-controls-icon"}))],8,j1),_o(n.$slots,"default",{},void 0),e.showNewThreadButton?(_(),F("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":h(t)("Start new thread"),title:h(t)("Start new thread"),onClick:o[1]||(o[1]=r=>n.$emit("start-new-thread"))},[Oe(el,{class:"sidebar-thread-controls-icon"})],8,L1)):ve("",!0)]))}}),Lm=It(N1,[["__scopeId","data-v-39c4ec05"]]),$1={},O1={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function D1(e,t){return _(),F("svg",O1,[...t[0]||(t[0]=[w("circle",{cx:"11",cy:"11",r:"8"},null,-1),w("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const Nm=It($1,[["render",D1]]),F1={},B1={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function U1(e,t){return _(),F("svg",B1,[...t[0]||(t[0]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065"}),w("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const z1=It(F1,[["render",U1]]),H1={},q1={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function W1(e,t){return _(),F("svg",q1,[...t[0]||(t[0]=[w("path",{d:"M5 7l5 5-5 5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),w("path",{d:"M12 17h7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])])}const G1=It(H1,[["render",W1]]),V1={},K1={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Y1(e,t){return _(),F("svg",K1,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 7a2 2 0 0 1 2-2h2.586A2 2 0 0 1 14 5.586L15.414 7H18a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2zm-4 4V5a2 2 0 0 1 2-2h2"},null,-1)])])}const $m=It(V1,[["render",Y1]]);function iy(e){var r;const t=e.replace(/\r\n/g,`
|
|
57
|
+
`).slice(0,jA),l=`Codex Web feedback: ${ey((d=e[0])==null?void 0:d.message)}`;return`mailto:${Zg}?subject=${Tm(l)}&body=${Tm(i)}`}function BA(){typeof window>"u"||(window.location.href=ty())}function UA(){if(!(typeof window>"u")&&(bm||(bm=!0,window.addEventListener("error",e=>{oi({kind:"window-error",message:e.error?_l(e.error):e.message,url:e.filename||window.location.href})}),window.addEventListener("unhandledrejection",e=>{oi({kind:"unhandled-rejection",message:_l(e.reason),url:window.location.href})})),!Cd)){if(typeof window.fetch!="function"){oi({kind:"fetch-error",message:"Feedback diagnostics could not monitor fetch: window.fetch is unavailable",url:window.location.href});return}try{xd=window.fetch.bind(window),window.fetch=async(e,t)=>{const n=LA(e),o=NA(e,t);try{const r=await xd(e,t);return r.ok||oi({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 oi({kind:"fetch-error",message:_l(r),url:n,method:o}),r}},Cd=!0}catch(e){xd=null,Cd=!1;try{oi({kind:"fetch-error",message:`Feedback diagnostics could not monitor fetch: ${_l(e)}`,url:window.location.href})}catch{}}}}function ny(){const e=K(()=>Wi.value.length>0);function t(n,o){oi({kind:"visible-error",message:n,url:o||(typeof window>"u"?void 0:window.location.href)})}return{diagnostics:Wi,hasFeedbackDiagnostics:e,recordVisibleFailure:t,openFeedbackMail:BA,buildFeedbackMailto:ty,feedbackMailtoBase:$A}}const oy="codex-web-local.recycle-bin.v1";function ry(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(oy);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 Cm(e){if(!(typeof window>"u"))try{window.localStorage.setItem(oy,JSON.stringify(e))}catch{}}const Ea=S(ry());function zA(){function e(){Ea.value=ry()}function t(r){Ea.value=[{...r,archivedAtIso:new Date().toISOString()},...Ea.value.filter(a=>a.id!==r.id)],Cm(Ea.value)}function n(r){Ea.value=Ea.value.filter(a=>a.id!==r),Cm(Ea.value)}async function o(r){if(!Ea.value.some(a=>a.id===r))return{ok:!1,error:"Thread is not in the recycle bin"};try{return await kk(r),n(r),{ok:!0}}catch(a){return{ok:!1,error:a instanceof Error?a.message:"Failed to restore thread"}}}return{records:Ea,loadRecords:e,recordArchivedThread:t,removeArchivedRecord:n,restoreArchivedThread:o}}const HA=["title","aria-label","disabled"],qA={key:1,class:"composer-dropdown-value"},WA={key:0,class:"composer-dropdown-search-wrap"},GA=["placeholder","onKeydown"],VA={class:"composer-dropdown-options",role:"listbox"},KA=["onClick"],YA={key:0,class:"composer-dropdown-empty"},JA=hn({__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),a=S(null),s=S(null),i=S(null),l=S(!1),d=S(""),c=S({});let v=!1;const f=K(()=>{var xe;const ne=n.options.find($e=>$e.value===n.modelValue);return ne?ne.label:((xe=n.placeholder)==null?void 0:xe.trim())||""}),b=K(()=>n.openDirection??"down"),y=K(()=>n.menuAlign??"start"),P=K(()=>n.iconOnly===!0),B=K(()=>n.enableSearch===!0),L=K(()=>n.variant==="pill"?"composer-dropdown-trigger--pill":""),j=K(()=>{var ne;return((ne=n.searchPlaceholder)==null?void 0:ne.trim())||"Quick search projects"}),U=K(()=>{var ne;return((ne=n.emptyLabel)==null?void 0:ne.trim())||"No results"}),H=K(()=>{var ne;return f.value||((ne=n.placeholder)==null?void 0:ne.trim())||"Select option"}),be=K(()=>{const ne=d.value.trim().toLowerCase();return ne?n.options.filter(xe=>xe.label.toLowerCase().includes(ne)||xe.value.toLowerCase().includes(ne)):n.options});function le(){n.disabled||(l.value=!l.value)}function W(ne,xe,$e){return Math.min($e,Math.max(xe,ne))}function he(){var oe,ue,Ee,Be;if(!l.value)return;const ne=r.value;if(!ne||typeof window>"u")return;const xe=ne.getBoundingClientRect(),$e=window.innerWidth,te=window.innerHeight,de=8,Le=8,Ae=Math.max(0,$e-de*2),Fe=((oe=s.value)==null?void 0:oe.offsetWidth)??((ue=a.value)==null?void 0:ue.offsetWidth)??224,Ke=((Ee=s.value)==null?void 0:Ee.offsetHeight)??((Be=a.value)==null?void 0:Be.offsetHeight)??0,lt=Math.min(Fe,Ae),Ze=Math.max(de,$e-lt-de),ut=y.value==="end"?xe.right-lt:xe.left,fe=W(ut,de,Ze);let N=b.value==="up"?xe.top-Ke-Le:xe.bottom+Le;Ke>0&&N+Ke>te-de&&(N=te-Ke-de),N=Math.max(de,N),c.value={position:"fixed",left:`${fe}px`,right:"auto",top:`${N}px`,bottom:"auto",width:`${lt}px`}}function Se(){v||typeof window>"u"||(window.addEventListener("resize",he),window.addEventListener("scroll",he,!0),v=!0)}function Pe(){!v||typeof window>"u"||(window.removeEventListener("resize",he),window.removeEventListener("scroll",he,!0),v=!1)}function ye(ne){o("update:modelValue",ne),l.value=!1,d.value=""}function Y(){if(d.value.length>0){d.value="";return}l.value=!1}function pe(ne){if(!l.value)return;const xe=r.value;if(!xe)return;const $e=ne.target;$e instanceof Node&&(xe.contains($e)||(l.value=!1,d.value=""))}return tt(l,ne=>{if(!ne){Pe(),c.value={};return}Se(),Nt(()=>{var xe;he(),window.requestAnimationFrame(he),B.value&&((xe=i.value)==null||xe.focus())})}),pi(()=>{window.addEventListener("pointerdown",pe)}),_s(()=>{window.removeEventListener("pointerdown",pe),Pe()}),(ne,xe)=>(_(),F("div",{ref_key:"rootRef",ref:r,class:"composer-dropdown"},[w("button",{class:at(["composer-dropdown-trigger",L.value]),type:"button",title:H.value,"aria-label":H.value,disabled:e.disabled,onClick:le},[e.selectedPrefixIcon?(_(),Qe(_f(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):ve("",!0),P.value?ve("",!0):(_(),F("span",qA,D(f.value),1)),Oe(Cs,{class:"composer-dropdown-chevron"})],10,HA),l.value?(_(),F("div",{key:0,ref_key:"menuWrapRef",ref:a,class:at(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":b.value==="up","composer-dropdown-menu-wrap-down":b.value==="down"}]),style:er(c.value)},[w("div",{ref_key:"menuRef",ref:s,class:"composer-dropdown-menu"},[B.value?(_(),F("div",WA,[xn(w("input",{ref_key:"searchInputRef",ref:i,"onUpdate:modelValue":xe[0]||(xe[0]=$e=>d.value=$e),class:"composer-dropdown-search-input",type:"text",placeholder:j.value,onKeydown:Ao(gt(Y,["prevent"]),["esc"])},null,40,GA),[[Nn,d.value]])])):ve("",!0),w("ul",VA,[(_(!0),F(ot,null,Zt(be.value,$e=>(_(),F("li",{key:$e.value},[w("button",{class:at(["composer-dropdown-option",{"is-selected":$e.value===e.modelValue}]),type:"button",onClick:te=>ye($e.value)},D($e.label),11,KA)]))),128)),be.value.length===0?(_(),F("li",YA,D(U.value),1)):ve("",!0)])],512)],6)):ve("",!0)],512))}}),ci=It(JA,[["__scopeId","data-v-48e2516e"]]),QA={},XA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ZA(e,t){return _(),F("svg",XA,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const of=It(QA,[["render",ZA]]),e_=["aria-label","onKeydown"],t_={class:"app-dialog-header"},n_={class:"app-dialog-title-wrap"},o_={class:"app-dialog-title"},r_={key:0,class:"app-dialog-subtitle"},a_=["aria-label","title"],s_={class:"app-dialog-body"},i_={key:0,class:"app-dialog-footer"},l_=hn({__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}=da();function a(){o("close")}function s(i){n.open&&i.key==="Escape"&&(i.preventDefault(),a())}return tt(()=>n.open,i=>{typeof window>"u"||(i?window.addEventListener("keydown",s):window.removeEventListener("keydown",s))},{immediate:!0}),_s(()=>{typeof window>"u"||window.removeEventListener("keydown",s)}),(i,l)=>(_(),Qe(Ki,{to:"body"},[e.open?(_(),F("div",{key:0,class:"app-dialog-overlay",onClick:gt(a,["self"])},[w("div",{class:at(["app-dialog-panel",`app-dialog-panel--${e.size}`]),role:"dialog","aria-modal":"true","aria-label":e.ariaLabel||e.title,onKeydown:Ao(gt(a,["prevent"]),["esc"])},[w("div",t_,[w("div",n_,[w("h3",o_,D(e.title),1),e.subtitle?(_(),F("p",r_,D(e.subtitle),1)):ve("",!0)]),w("button",{class:"app-dialog-close",type:"button","aria-label":m(r)("Close"),title:m(r)("Close"),onClick:a},[Oe(of,{class:"app-dialog-close-icon"})],8,a_)]),w("div",s_,[_o(i.$slots,"default",{},void 0)]),i.$slots.footer?(_(),F("div",i_,[_o(i.$slots,"footer",{},void 0)])):ve("",!0)],42,e_)])):ve("",!0)]))}}),kd=It(l_,[["__scopeId","data-v-0c988f32"]]),u_={key:0,class:"sidebar-menu-row-left"},c_={class:"sidebar-menu-row-main"},d_={key:1,class:"sidebar-menu-row-right"},f_={key:0,class:"sidebar-menu-row-right-default"},p_={key:1,class:"sidebar-menu-row-right-hover"},h_=hn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=PS(),o=K(()=>!!n.left),r=K(()=>!!n.right),a=K(()=>!!n["right-hover"]),s=K(()=>r.value||a.value);return(i,l)=>(_(),Qe(_f(t.as),jf({class:"sidebar-menu-row","data-has-left":o.value,"data-has-right":s.value,"data-has-right-hover":a.value,"data-force-right-hover":t.forceRightHover},i.$attrs),{default:dt(()=>[o.value?(_(),F("span",u_,[_o(i.$slots,"left",{},void 0,!0)])):ve("",!0),w("span",c_,[_o(i.$slots,"default",{},void 0,!0)]),s.value?(_(),F("span",d_,[r.value?(_(),F("span",f_,[_o(i.$slots,"right",{},void 0,!0)])):ve("",!0),a.value?(_(),F("span",p_,[_o(i.$slots,"right-hover",{},void 0,!0)])):ve("",!0)])):ve("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),hs=It(h_,[["__scopeId","data-v-5fc666fb"]]),m_={},v_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function g_(e,t){return _(),F("svg",v_,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 18v-6m0 0a4 4 0 0 1 4-4h2m-6 4a4 4 0 0 0-4-4H6m0-4a2 2 0 1 0 0 4a2 2 0 0 0 0-4m12 0a2 2 0 1 0 0 4a2 2 0 0 0 0-4m-6 14a2 2 0 1 0 0 4a2 2 0 0 0 0-4"},null,-1)])])}const Ju=It(m_,[["render",g_]]),y_={},w_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function b_(e,t){return _(),F("svg",w_,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"},null,-1)])])}const ay=It(y_,[["render",b_]]),T_=["data-menu-open"],S_={class:"thread-left-stack"},C_=["data-state"],x_=["data-confirming","title"],k_={key:0,class:"thread-delete-confirm-label"},I_={class:"thread-row-title-wrap"},A_={class:"thread-row-title-line"},__={class:"thread-row-title"},P_=["title"],R_={key:0,class:"thread-row-automation-count"},E_=["data-state"],M_={class:"thread-row-time"},j_=hn({__name:"SidebarThreadRow",props:{thread:{},selected:{type:Boolean},pinned:{type:Boolean},menuOpen:{type:Boolean},showStatusIndicator:{type:Boolean},threadState:{},inlineDeleteConfirming:{type:Boolean},automationCount:{},automationTooltip:{},requestLabel:{},relativeTime:{},deleteLabel:{},confirmDeleteLabel:{},confirmLabel:{},worktreeLabel:{},setMenuWrapRef:{type:Function}},emits:["select","inline-delete","menu-toggle","row-leave","row-contextmenu"],setup(e,{emit:t}){const n=e,o=t;function r(a){n.setMenuWrapRef(a instanceof HTMLDivElement?a:null)}return(a,s)=>(_(),F("li",{class:"thread-row-item","data-menu-open":n.menuOpen?"true":"false"},[Oe(hs,{class:"thread-row","data-active":n.selected,"data-pinned":n.pinned,"data-menu-open":n.menuOpen?"true":"false","force-right-hover":n.menuOpen,onClick:s[3]||(s[3]=i=>o("select")),onMouseleave:s[4]||(s[4]=i=>o("row-leave",i)),onContextmenu:s[5]||(s[5]=i=>o("row-contextmenu",i))},{left:dt(()=>[w("span",S_,[n.showStatusIndicator?(_(),F("span",{key:0,class:"thread-status-indicator","data-state":n.threadState},null,8,C_)):ve("",!0),w("button",{class:"thread-delete-button",type:"button","data-confirming":n.inlineDeleteConfirming,title:n.inlineDeleteConfirming?n.confirmDeleteLabel:n.deleteLabel,onClick:s[0]||(s[0]=gt(i=>o("inline-delete"),["stop"]))},[n.inlineDeleteConfirming?(_(),F("span",k_,D(n.confirmLabel),1)):(_(),Qe(ay,{key:1,class:"thread-icon"}))],8,x_)])]),right:dt(()=>[w("span",M_,D(n.relativeTime),1)]),"right-hover":dt(()=>[w("div",{ref:r,class:"thread-menu-wrap"},[w("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:s[2]||(s[2]=gt(i=>o("menu-toggle"),["stop"]))},[Oe(nf,{class:"thread-icon"})])])]),default:dt(()=>[w("button",{class:"thread-main-button",type:"button",onClick:s[1]||(s[1]=gt(i=>o("select"),["stop"]))},[w("span",I_,[w("span",A_,[w("span",__,D(n.thread.title),1),n.thread.hasWorktree?(_(),Qe(Ju,{key:0,class:"thread-row-worktree-icon",title:n.worktreeLabel},null,8,["title"])):ve("",!0),n.automationCount>0?(_(),F("span",{key:1,class:"thread-row-automation-chip",title:n.automationTooltip},[Oe(bs,{class:"thread-row-automation-icon"}),n.automationCount>1?(_(),F("span",R_,D(n.automationCount),1)):ve("",!0)],8,P_)):ve("",!0),n.thread.pendingRequestState?(_(),F("span",{key:2,class:"thread-row-request-chip","data-state":n.thread.pendingRequestState},D(n.requestLabel),9,E_)):ve("",!0)])])])]),_:1},8,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,T_))}}),Cu=It(j_,[["__scopeId","data-v-fac0242e"]]);function L_(e,t,n){return n.canPruneMissing?e.filter(o=>t.has(o)):e}function N_(e){const{getGroups:t,t:n}=e,o=S({}),r=S({}),a=S(!1),s=S("thread"),i=S(""),l=S(""),d=S(""),c=S("create"),v=S(!1),f=S("thread"),b=S(""),y=S(""),P=S(""),B=S(""),L=S(!1),j=S(!1),U=S({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),H=S({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),be=K(()=>{if(s.value==="project"){const ae=l.value;return ae?r.value[ae]??[]:[]}const q=i.value;return q?o.value[q]??[]:[]}),le=K(()=>fe(U.value.rrule)),W=K(()=>v.value&&c.value==="create"?f.value==="thread"?n("This creates a heartbeat automation attached to the selected chat."):n("This creates a project automation attached to the selected project folder."):s.value==="project"?n("This creates project automations attached to the selected project folder."):n("This creates heartbeat automations attached to the selected thread.")),he=K(()=>{var ae;const q=[];for(const _e of t())for(const Ye of _e.threads){const bt=((ae=Ye.title)==null?void 0:ae.trim())||Ye.id,Tt=e.getProjectDisplayName(_e.projectName);q.push({value:Ye.id,label:`${bt} · ${Tt}`,searchText:`${bt} ${Tt} ${Ye.id}`.toLowerCase()})}return q}),Se=K(()=>{const q=[];for(const ae of t()){const _e=e.getProjectAutomationKey(ae.projectName);if(!_e)continue;const Ye=e.getProjectDisplayName(ae.projectName);q.push({value:_e,label:Ye,searchText:`${Ye} ${_e}`.toLowerCase()})}return q}),Pe=K(()=>(f.value==="project"?Se.value:he.value).map(ae=>({value:ae.value,label:ae.label}))),ye=[{value:"minutes",label:n("minutes")},{value:"hours",label:n("hours")},{value:"days",label:n("days")}],Y=K(()=>[{value:"ACTIVE",label:n("Active")},{value:"PAUSED",label:n("Paused")}]);tt(Pe,q=>{var ae;v.value&&(q.some(_e=>_e.value===b.value)||(b.value=((ae=q[0])==null?void 0:ae.value)??""))});function pe(q){var ae;return((ae=o.value[q])==null?void 0:ae.length)??0}function ne(q){return pe(q)>0}function xe(q){var _e;const ae=e.getProjectAutomationKey(q);return ae?((_e=r.value[ae])==null?void 0:_e.length)??0:0}function $e(q){return xe(q)>0}function te(q){if(q.length===0)return"";if(q.length>1){const Ye=q.filter(bt=>bt.status==="ACTIVE").length;return`${q.length} ${n("automations")} • ${Ye} ${n("active")}`}const[ae]=q,_e=ae.status==="PAUSED"?"-":ae.nextRunAtMs?new Date(ae.nextRunAtMs).toLocaleString():n("Not scheduled");return`${ae.name} • ${n("Next run")}: ${_e}`}function de(q){return te(o.value[q]??[])}function Le(q){const ae=e.getProjectAutomationKey(q);return te(ae?r.value[ae]??[]:[])}function Ae(q){return String(Math.max(0,q)).padStart(2,"0")}function Fe(q,ae){const _e=typeof q=="number"?q:Number(q);return Number.isFinite(_e)?Math.max(1,Math.floor(_e)):ae}function Ke(q){const[ae,_e]=q.split(":"),Ye=Math.min(23,Math.max(0,Number(ae)||0)),bt=Math.min(59,Math.max(0,Number(_e)||0));return`FREQ=DAILY;BYHOUR=${Ye};BYMINUTE=${bt}`}function lt(q,ae){const _e=Fe(q,1);return ae==="minutes"?`FREQ=MINUTELY;INTERVAL=${_e}`:ae==="hours"?`FREQ=HOURLY;INTERVAL=${_e}`:`FREQ=DAILY;INTERVAL=${_e}`}function Ze(q){return Object.fromEntries(q.split(";").map(ae=>ae.trim()).filter(Boolean).map(ae=>{const[_e,...Ye]=ae.split("=");return[_e.toUpperCase(),Ye.join("=").trim()]}).filter(([ae,_e])=>ae&&_e))}function ut(q){var bt;const ae=Ze(q),_e=(bt=ae.FREQ)==null?void 0:bt.toUpperCase(),Ye=Fe(ae.INTERVAL,1);if(_e==="DAILY"&&ae.BYHOUR!==void 0&&ae.BYMINUTE!==void 0&&Ye===1){const Tt=Math.min(23,Math.max(0,Number(ae.BYHOUR)||0)),At=Math.min(59,Math.max(0,Number(ae.BYMINUTE)||0));return{mode:"daily",dailyTime:`${Ae(Tt)}:${Ae(At)}`,interval:1,intervalUnit:"hours"}}return _e==="MINUTELY"||_e==="HOURLY"||_e==="DAILY"&&ae.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:Ye,intervalUnit:_e==="MINUTELY"?"minutes":_e==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function fe(q){var bt;const ae=Ze(q),_e=(bt=ae.FREQ)==null?void 0:bt.toUpperCase(),Ye=Fe(ae.INTERVAL,1);if(_e==="DAILY"&&ae.BYHOUR!==void 0&&ae.BYMINUTE!==void 0&&Ye===1){const Tt=Math.min(23,Math.max(0,Number(ae.BYHOUR)||0)),At=Math.min(59,Math.max(0,Number(ae.BYMINUTE)||0));return`${n("RRULE")}: ${q} · ${n("runs daily at")} ${Ae(Tt)}:${Ae(At)}`}return _e==="MINUTELY"?`${n("RRULE")}: ${q} · ${n("runs every")} ${Ye} ${n("minute(s)")}`:_e==="HOURLY"?`${n("RRULE")}: ${q} · ${n("runs every")} ${Ye} ${n("hour(s)")}`:_e==="DAILY"&&ae.INTERVAL!==void 0?`${n("RRULE")}: ${q} · ${n("runs every")} ${Ye} ${n("day(s)")}`:q?`${n("RRULE")}: ${q}`:n("RRULE is required.")}function N(){const q=H.value;q.mode==="daily"?U.value.rrule=Ke(q.dailyTime):q.mode==="interval"&&(U.value.rrule=lt(q.interval,q.intervalUnit))}function oe(q){q!=="minutes"&&q!=="hours"&&q!=="days"||(H.value={...H.value,intervalUnit:q},N())}function ue(q){q!=="ACTIVE"&&q!=="PAUSED"||(U.value={...U.value,status:q})}function Ee(){H.value=ut(U.value.rrule)}function Be(q){H.value={...H.value,mode:q},N()}function A(q){var _e;s.value="thread",i.value=q,l.value="",v.value=!1,y.value="",P.value="";const ae=(_e=o.value[q])==null?void 0:_e[0];ae?je(ae.id):re(),a.value=!0,e.closeThreadMenu()}function M(q){var Ye;const ae=e.getProjectAutomationKey(q);if(!ae){s.value="project",i.value="",l.value="",v.value=!1,y.value=n("Project automation requires a resolved absolute project path."),P.value="",a.value=!0,e.closeProjectMenu();return}s.value="project",i.value="",l.value=ae,v.value=!1,y.value="",P.value="";const _e=(Ye=r.value[ae])==null?void 0:Ye[0];_e?je(_e.id):re(),a.value=!0,e.closeProjectMenu()}function z(q){s.value=q.scope,i.value=q.scope==="thread"?q.target:"",l.value=q.scope==="project"?q.target:"",v.value=!1,y.value="",P.value="",q.scope==="project"?r.value=He(r.value,q.target,q.automation):o.value=me(o.value,q.target,q.automation),je(q.automation.id),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function Z(){var q;v.value=!0,f.value="thread",b.value=((q=he.value[0])==null?void 0:q.value)??"",s.value="thread",i.value="",l.value="",y.value="",P.value="",re(),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function ce(q){var ae;f.value=q,b.value="",s.value=q==="project"?"project":"thread",b.value=((ae=Pe.value[0])==null?void 0:ae.value)??""}function re(){d.value="",c.value="create",y.value="",P.value="",U.value={name:s.value==="project"?"Project automation":"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},H.value=ut(U.value.rrule)}function je(q){const ae=be.value.find(_e=>_e.id===q);ae&&(d.value=ae.id,c.value="edit",y.value="",P.value="",U.value={name:ae.name,prompt:ae.prompt,rrule:ae.rrule,status:ae.status},H.value=ut(ae.rrule))}function Re(){a.value=!1,s.value="thread",i.value="",l.value="",d.value="",y.value="",P.value="",L.value=!1,j.value=!1}function ke(q,ae){return Object.fromEntries(Object.entries(q).filter(([_e])=>_e!==ae))}function me(q,ae,_e){const Ye=q[ae]??[],bt=Ye.findIndex(At=>At.id===_e.id),Tt=[...Ye];return bt>=0?Tt.splice(bt,1,_e):Tt.push(_e),{...q,[ae]:Tt}}function Ve(q,ae,_e){const Ye=(q[ae]??[]).filter(bt=>bt.id!==_e);return Ye.length>0?{...q,[ae]:Ye}:ke(q,ae)}function Ne(q,ae){return Object.fromEntries(Object.entries(q).filter(([_e])=>_e!==ae))}function He(q,ae,_e){const Ye=q[ae]??[],bt=Ye.findIndex(At=>At.id===_e.id),Tt=[...Ye];return bt>=0?Tt.splice(bt,1,_e):Tt.push(_e),{...q,[ae]:Tt}}async function Ue(){r.value=await Tx()}async function Je(q){await Kh(q).catch(()=>{}),o.value=ke(o.value,q)}async function et(){let q=i.value,ae=l.value;L.value=!0,y.value="",P.value="";try{if(N(),v.value&&c.value==="create"&&(f.value==="thread"?(q=b.value,ae="",s.value="thread",i.value=q,l.value=""):(ae=b.value,q="",s.value="project",i.value="",l.value=ae)),s.value==="thread"&&!q)throw new Error(n("Select a chat target for this automation"));if(s.value==="project"&&!ae)throw new Error(n("Select a project target for this automation"));const _e={id:d.value||void 0,name:U.value.name,prompt:U.value.prompt,rrule:U.value.rrule,status:U.value.status},Ye=s.value==="project"?await Cx({..._e,projectName:ae}):await Sx({..._e,threadId:q});s.value==="project"?await Ue():o.value=me(o.value,q,Ye),e.onAutomationsChanged(),je(Ye.id),P.value=n("Automation saved."),L.value=!1}catch(_e){y.value=_e instanceof Error?_e.message:n("Failed to save automation"),L.value=!1}}async function st(){const q=i.value,ae=l.value,_e=d.value;if(_e&&!(s.value==="thread"&&!q)&&!(s.value==="project"&&!ae)){L.value=!0,y.value="",P.value="";try{s.value==="project"?(await jg(ae,_e),await Ue()):(await Kh(q,_e),o.value=Ve(o.value,q,_e));const Ye=be.value[0];Ye?je(Ye.id):re(),e.onAutomationsChanged(),L.value=!1}catch(Ye){y.value=Ye instanceof Error?Ye.message:n("Failed to remove automation"),L.value=!1}}}async function mt(){const q=i.value,ae=d.value;if(!(!q||!ae)){j.value=!0,y.value="",P.value="";try{await xx(q,ae),P.value=n("Automation run queued.")}catch(_e){y.value=_e instanceof Error?_e.message:n("Failed to run automation")}finally{j.value=!1}}}return{automationByThreadId:o,automationByProjectName:r,automationDialogVisible:a,automationDialogScope:s,automationDialogThreadId:i,automationDialogProjectName:l,automationDialogAutomationId:d,automationDialogMode:c,automationTargetPickerVisible:v,automationTargetMode:f,automationTargetValue:b,automationDialogError:y,automationDialogNotice:P,projectAutomationActionError:B,isSavingAutomation:L,isRunningAutomation:j,automationDraft:U,automationScheduleDraft:H,automationDialogAutomations:be,automationSchedulePreview:le,automationDialogSubtitle:W,automationThreadTargetOptions:he,automationProjectTargetOptions:Se,automationTargetDropdownOptions:Pe,automationIntervalUnitOptions:ye,automationStatusOptions:Y,threadAutomationCount:pe,threadHasAutomation:ne,projectAutomationCount:xe,projectHasAutomation:$e,threadAutomationTooltip:de,projectAutomationTooltip:Le,syncAutomationRruleFromScheduleDraft:N,onAutomationIntervalUnitChange:oe,onAutomationStatusChange:ue,syncAutomationScheduleDraftFromRrule:Ee,setAutomationScheduleMode:Be,openAutomationDialog:A,openProjectAutomationDialog:M,openAutomationEditorFromPanel:z,openAutomationCreatorFromPanel:Z,setAutomationTargetMode:ce,startNewAutomationDraft:re,selectAutomationForEditing:je,closeAutomationDialog:Re,omitAutomationProject:Ne,reloadProjectAutomations:Ue,removeAutomationsForThread:Je,submitAutomationDialog:et,onDeleteAutomationFromDialog:st,onRunAutomationFromDialog:mt}}const $_=4,xm=6;function O_(e,t,n){if(e===null||n===0)return null;const o=Math.max(0,Math.min(e,n)),r=o>t?o-1:o,a=Math.max(0,Math.min(r,n-1));return a===t?null:a}function D_(e){const{getGroups:t,getFilteredGroups:n,isSearchActive:o,isCollapsed:r,getElevatedProjectName:a,onReorderProject:s,closeProjectMenu:i}=e,l=S(null),d=S(null),c=S(null);let v=null,f=null;const b=S(""),y=S({}),P=new Map,B=new WeakMap,L=typeof window<"u"?new ResizeObserver(fe=>{for(const N of fe){const oe=N.target,ue=B.get(oe);ue&&U(ue,oe)}}):null,j=()=>{var fe,N;return((fe=c.value)==null?void 0:fe.projectName)??((N=d.value)==null?void 0:N.projectName)??""};function U(fe,N){const oe=N.getBoundingClientRect().height;if(!Number.isFinite(oe)||oe<=0)return;const ue=y.value[fe];ue!==void 0&&Math.abs(ue-oe)<.5||(y.value={...y.value,[fe]:oe})}function H(fe,N){const oe=P.get(fe);oe&&oe!==N&&L&&L.unobserve(oe);const ue=N instanceof HTMLElement?N:N&&"$el"in N&&N.$el instanceof HTMLElement?N.$el:null;if(ue){P.set(fe,ue),B.set(ue,fe),U(fe,ue),L==null||L.observe(ue);return}oe&&(L==null||L.unobserve(oe)),P.delete(fe)}function be(fe){const N=y.value[fe]??0,oe=c.value,Ee=((oe==null?void 0:oe.projectName)===fe?oe.groupHeight:null)??N,Be=r(fe)?0:xm;return Math.max(0,Ee+Be)}const le=K(()=>{const fe=c.value;return fe?O_(fe.dropTargetIndexFull,fe.fromIndex,t().length):null}),W=K(()=>{const N=(o()?n():t()).map(A=>A.projectName),oe=c.value,ue=le.value;if(!oe||ue===null)return N;const Ee=[...N],[Be]=Ee.splice(oe.fromIndex,1);return Be?(Ee.splice(ue,0,Be),Ee):N}),he=K(()=>{const fe={};let N=0;for(const oe of W.value)fe[oe]=N,N+=be(oe);return fe}),Se=K(()=>{let fe=0;for(const N of W.value)fe+=be(N);return{height:`${Math.max(0,fe)}px`}});function Pe(fe,N){if(fe.button!==0||o()||d.value||c.value)return;const ue=t().findIndex(M=>M.projectName===N),Ee=P.get(N);if(ue<0||!Ee)return;const Be=Ee.getBoundingClientRect(),A=r(N)?0:xm;d.value={projectName:N,fromIndex:ue,startClientX:fe.clientX,startClientY:fe.clientY,pointerOffsetY:fe.clientY-Be.top,groupLeft:Be.left,groupWidth:Be.width,groupHeight:Be.height,groupOuterHeight:Be.height+A},fe.preventDefault(),ye()}function ye(){window.addEventListener("mousemove",pe),window.addEventListener("mouseup",ne),window.addEventListener("keydown",xe)}function Y(){window.removeEventListener("mousemove",pe),window.removeEventListener("mouseup",ne),window.removeEventListener("keydown",xe)}function pe(fe){v={clientX:fe.clientX,clientY:fe.clientY},te()}function ne(fe){de({clientX:fe.clientX,clientY:fe.clientY});const N=c.value;if(N&&le.value!==null){const oe=t().findIndex(ue=>ue.projectName===N.projectName);if(oe>=0){const ue=le.value;ue!==oe&&s(N.projectName,ue)}}$e({preserveToggleSuppression:!!N})}function xe(fe){fe.key==="Escape"&&(!d.value&&!c.value||(fe.preventDefault(),$e()))}function $e(fe={}){f!==null&&(window.cancelAnimationFrame(f),f=null),v=null,d.value=null,c.value=null,fe.preserveToggleSuppression||(b.value=""),Y()}function te(){f===null&&(f=window.requestAnimationFrame(()=>{if(f=null,!v)return;const fe=v;v=null,de(fe)}))}function de(fe){const N=d.value;if(!c.value&&N){const oe=fe.clientX-N.startClientX,ue=fe.clientY-N.startClientY;if(Math.hypot(oe,ue)<$_)return;i(),b.value=N.projectName,c.value={projectName:N.projectName,fromIndex:N.fromIndex,pointerOffsetY:N.pointerOffsetY,groupLeft:N.groupLeft,groupWidth:N.groupWidth,groupHeight:N.groupHeight,groupOuterHeight:N.groupOuterHeight,ghostTop:fe.clientY-N.pointerOffsetY,dropTargetIndexFull:null}}c.value&&Le(fe)}function Le(fe){const N=c.value;if(!N)return;if(N.ghostTop=fe.clientY-N.pointerOffsetY,!Ae(fe)){N.dropTargetIndexFull=null;return}const oe=fe.clientY,ue=l.value;if(!ue){N.dropTargetIndexFull=null;return}const Ee=t(),Be=ue.getBoundingClientRect(),A=new Map(Ee.map((ce,re)=>[ce.projectName,re])),M=Ee.map(ce=>ce.projectName).filter(ce=>ce!==N.projectName);let z=0,Z=Ee.length;for(const ce of M){const re=A.get(ce);if(re===void 0)continue;const je=be(ce),Re=Be.top+z+je/2;if(oe<Re){Z=re;break}z+=je}N.dropTargetIndexFull=Z}function Ae(fe){const N=l.value;if(!N)return!1;const oe=N.getBoundingClientRect(),ue=fe.clientX>=oe.left&&fe.clientX<=oe.right,Ee=fe.clientY>=oe.top-32&&fe.clientY<=oe.bottom+32;return ue&&Ee}function Fe(fe){var N;return((N=c.value)==null?void 0:N.projectName)===fe}function Ke(fe){const N=c.value,oe=he.value[fe]??0,ue=a()===fe;return!N||N.projectName!==fe?{position:"absolute",top:"0",left:"0",right:"0",zIndex:ue?"40":"1",transform:`translate3d(0, ${oe}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${N.groupLeft}px`,width:`${N.groupWidth}px`,height:`${N.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${N.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function lt(fe){return b.value===fe?(b.value="",!0):!1}function Ze(fe){const N=j();N&&!fe.includes(N)&&$e();const oe=new Set(fe),ue=Object.fromEntries(Object.entries(y.value).filter(([Ee])=>oe.has(Ee)));Object.keys(ue).length!==Object.keys(y.value).length&&(y.value=ue)}function ut(){for(const fe of P.values())L==null||L.unobserve(fe);P.clear(),$e()}return{groupsContainerRef:l,groupsContainerStyle:Se,setProjectGroupRef:H,isDraggingProject:Fe,projectGroupStyle:Ke,onProjectHandleMouseDown:Pe,takeToggleSuppression:lt,pruneProjectGroups:Ze,dispose:ut}}const F_={key:0,class:"pinned-section"},B_={class:"thread-tree-header"},U_={key:0,class:"thread-list"},z_={class:"projects-section"},H_={class:"thread-tree-header"},q_=["aria-expanded","aria-label","title"],W_={class:"organize-menu-title"},G_=["data-active"],V_={key:0},K_=["data-active"],Y_={key:0},J_=["data-active"],Q_={key:0},X_={class:"organize-menu-title"},Z_=["data-active"],eP={key:0},tP=["data-active"],nP={key:0},oP={key:0,class:"thread-tree-action-error"},rP={key:1,class:"thread-tree-no-results"},aP={key:2,class:"thread-tree-loading"},sP={key:3,class:"thread-list thread-list-global"},iP=["data-project-name","data-expanded","data-dragging"],lP={class:"project-icon-stack"},uP={class:"project-icon-folder"},cP={class:"project-icon-chevron"},dP=["data-dragging-handle","onMousedown"],fP=["title"],pP=["title"],hP={key:0,class:"thread-row-automation-count"},mP={class:"project-hover-controls"},vP=["onClick"],gP=["data-open-direction"],yP=["onClick"],wP=["onClick"],bP=["onClick"],TP=["onClick"],SP=["onClick"],CP=["onClick"],xP={class:"project-menu-label"},kP=["onInput"],IP=["aria-label","title","onClick"],AP={key:0,class:"thread-list"},_P={class:"project-empty"},PP=["onClick"],RP={class:"chats-section"},EP={class:"thread-tree-header"},MP={class:"chats-section-actions"},jP=["aria-label","title"],LP={key:0,class:"thread-tree-no-results"},NP={key:1,class:"thread-list thread-list-global"},$P=["data-open-direction"],OP=["disabled","title"],DP=["placeholder","onKeydown"],FP={class:"recycle-bin-content"},BP={key:0,class:"recycle-bin-empty"},UP={key:1,class:"recycle-bin-list"},zP={class:"recycle-bin-item-copy"},HP={class:"recycle-bin-item-title"},qP={key:0,class:"recycle-bin-item-meta"},WP={class:"recycle-bin-item-time"},GP={class:"recycle-bin-item-actions"},VP=["disabled","onClick"],KP=["onClick"],YP={key:2,class:"recycle-bin-error",role:"alert"},JP=["aria-label"],QP={class:"rename-thread-title"},XP={class:"rename-thread-subtitle"},ZP={key:0,class:"automation-target-picker"},eR={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},tR={class:"automation-target-dropdown"},nR=["aria-label"],oR=["onClick"],rR={class:"automation-thread-field"},aR={class:"automation-thread-label"},sR=["placeholder"],iR={class:"automation-thread-field"},lR={class:"automation-thread-label"},uR=["placeholder"],cR={class:"automation-thread-field"},dR={class:"automation-thread-label"},fR={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},pR={key:0,class:"automation-schedule-row"},hR={class:"automation-schedule-copy"},mR={key:1,class:"automation-schedule-row"},vR={class:"automation-schedule-copy"},gR={class:"automation-schedule-preview"},yR={class:"automation-thread-field"},wR={class:"automation-thread-label"},bR={key:2,class:"rename-thread-subtitle automation-thread-error"},TR={key:3,class:"rename-thread-subtitle automation-thread-notice"},SR={class:"rename-thread-actions"},CR=["disabled"],xR=["disabled"],kR=["disabled"],IR=["disabled"],km="codex-web-local.sidebar-section-expansion.v1",Im="codex-web-local.sidebar-chats-first.v1",Am="codex-web-local.sidebar-chat-sort-mode.v1",_m="codex-web-local.thread-view-mode.v1",Pm="codex-web-local.collapsed-projects.v1",AR=hn({__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}=da(),{recordVisibleFailure:a}=ny(),s=n,{records:i,loadRecords:l,recordArchivedThread:d,removeArchivedRecord:c,restoreArchivedThread:v}=zA(),f=S(!1),b=S(""),y=S("");function P(){xt.value=!1,b.value="",l(),f.value=!0}async function B(x){if(!y.value){y.value=x,b.value="";try{const R=await v(x);R.ok?s("restore-thread",x):b.value=R.error??"Failed to restore thread"}finally{y.value=""}}}const L=S({}),j=S({}),U=S(!0),H=S(!0),be=S(!0),le=S(!1),W=S(Mo(Im,!1)),he=S(en());let Se=!1;const Pe=S([]),ye=S({}),Y=S(""),pe=S([]),ne=S(""),xe=S(""),$e=S("hover"),te=S({}),de=S({}),Le=S({}),Ae=S("actions"),Fe=S(""),Ke=S(!1),lt=S(""),Ze=S(""),ut=S(null),fe=S(!1),N=S(""),oe=S(""),ue=N_({getGroups:()=>o.groups,t:r,getProjectDisplayName:mr,getProjectAutomationKey:qn,closeThreadMenu:we,closeProjectMenu:$t,onAutomationsChanged:()=>s("automations-changed")}),{automationByThreadId:Ee,automationByProjectName:Be,automationDialogVisible:A,automationDialogScope:M,automationDialogAutomationId:z,automationDialogMode:Z,automationTargetPickerVisible:ce,automationTargetMode:re,automationTargetValue:je,automationDialogError:Re,automationDialogNotice:ke,projectAutomationActionError:me,isSavingAutomation:Ve,isRunningAutomation:Ne,automationDraft:He,automationScheduleDraft:Ue,automationDialogAutomations:Je,automationSchedulePreview:et,automationDialogSubtitle:st,automationTargetDropdownOptions:mt,automationIntervalUnitOptions:q,automationStatusOptions:ae,threadAutomationCount:_e,threadHasAutomation:Ye,projectAutomationCount:bt,projectHasAutomation:Tt,threadAutomationTooltip:At,projectAutomationTooltip:Br,syncAutomationRruleFromScheduleDraft:zt,onAutomationIntervalUnitChange:Ha,onAutomationStatusChange:fa,syncAutomationScheduleDraftFromRrule:pa,setAutomationScheduleMode:ar,openAutomationDialog:Ur,openProjectAutomationDialog:zr,openAutomationEditorFromPanel:Ps,openAutomationCreatorFromPanel:qa,setAutomationTargetMode:Wa,startNewAutomationDraft:Uo,selectAutomationForEditing:sr,closeAutomationDialog:Zn,omitAutomationProject:Rs,reloadProjectAutomations:ha,removeAutomationsForThread:Es,submitAutomationDialog:zo,onDeleteAutomationFromDialog:Po,onRunAutomationFromDialog:Dn}=ue,Ga=D_({getGroups:()=>o.groups,getFilteredGroups:()=>Lt.value,isSearchActive:()=>bn.value,isCollapsed:un,getElevatedProjectName:()=>ne.value?ne.value:xe.value?Gr.value.get(xe.value)??"":"",onReorderProject:(x,R)=>s("reorder-project",{projectName:x,toIndex:R}),closeProjectMenu:$t}),{groupsContainerRef:Ms,groupsContainerStyle:vt,setProjectGroupRef:Ct,isDraggingProject:kt,projectGroupStyle:mn,onProjectHandleMouseDown:Fn,takeToggleSuppression:ho,pruneProjectGroups:Hr,dispose:qr}=Ga,mo=new Map,Ho=new Map,Ro=S(null),Bn=S(null),xt=S(!1),eo=S(Eo());function vo(){if(typeof window>"u")return{};try{const x=window.localStorage.getItem(Pm);if(!x)return{};const R=JSON.parse(x);return!R||typeof R!="object"||Array.isArray(R)?{}:R}catch{return{}}}function Eo(){return typeof window>"u"?"project":window.localStorage.getItem(_m)==="chronological"?"chronological":"project"}function Mo(x,R){if(typeof window>"u")return R;const k=window.localStorage.getItem(x);return k==="true"?!0:k==="false"?!1:R}function en(){return typeof window>"u"?"updated":window.localStorage.getItem(Am)==="created"?"created":"updated"}j.value=vo();function Un(){if(!(typeof window>"u"))try{const x=JSON.parse(window.localStorage.getItem(km)||"{}");typeof x.pinned=="boolean"&&(U.value=x.pinned),typeof x.projects=="boolean"&&(H.value=x.projects),typeof x.chats=="boolean"&&(be.value=x.chats)}catch{}}function ir(){typeof window>"u"||window.localStorage.setItem(km,JSON.stringify({pinned:U.value,projects:H.value,chats:be.value}))}Un(),tt(j,x=>{typeof window>"u"||window.localStorage.setItem(Pm,JSON.stringify(x))},{deep:!0}),tt(eo,x=>{typeof window>"u"||window.localStorage.setItem(_m,x)}),tt(W,x=>{typeof window>"u"||window.localStorage.setItem(Im,String(x))}),tt(he,x=>{typeof window>"u"||window.localStorage.setItem(Am,x)}),tt([U,H,be],ir);const lr=K(()=>o.searchQuery.trim().toLowerCase()),bn=K(()=>lr.value.length>0),ma=K(()=>o.searchMatchedThreadIds?new Set(o.searchMatchedThreadIds):null),tn=K(()=>new Set(Pe.value)),Wr=K(()=>new Set(pe.value));function go(x){if(Wr.value.has(x.id))return!1;if(!bn.value)return!0;if(ma.value)return ma.value.has(x.id);const R=lr.value;return x.title.toLowerCase().includes(R)||x.preview.toLowerCase().includes(R)}const Lt=K(()=>o.groups.flatMap(x=>{const R=x.threads.filter(k=>!Ku(k.cwd)&&go(k));return R.length>0?[{...x,threads:R}]:!bn.value&&x.threads.length===0?[{...x,threads:R}]:[]})),zn=K(()=>eo.value==="chronological"),sn=K(()=>{const x=[];for(const R of o.groups)for(const k of R.threads)tn.value.has(k.id)||go(k)&&x.push(k);return x.sort((R,k)=>{const G=new Date(R.updatedAtIso||R.createdAtIso).getTime();return new Date(k.updatedAtIso||k.createdAtIso).getTime()-G})}),to=K(()=>{const x=sn.value.filter(k=>Ku(k.cwd)),R=he.value==="created"?"createdAtIso":"updatedAtIso";return x.sort((k,G)=>{const We=new Date(k[R]||k.updatedAtIso||k.createdAtIso).getTime();return new Date(G[R]||G.updatedAtIso||G.createdAtIso).getTime()-We})}),nn=K(()=>bn.value||le.value?to.value:to.value.slice(0,10)),Va=K(()=>bn.value?!1:to.value.length>10),on=K(()=>{const x=new Map;for(const R of o.groups)for(const k of R.threads)Wr.value.has(k.id)||x.set(k.id,k);return x});tt(Pe,x=>{Se&&uI(x)}),tt([on,()=>o.isThreadListFullyLoaded],([x])=>{const R=L_(Pe.value,new Set(x.keys()),{canPruneMissing:o.isThreadListFullyLoaded});if(R.length===Pe.value.length)return;const k=new Set(R),G=Object.fromEntries(Object.entries(ye.value).filter(([We])=>k.has(We)));ye.value=G,Pe.value=R});let qo=0;async function ur(){if(o.isLoading)return;const x=Pe.value.filter(We=>!on.value.has(We)&&!ye.value[We]);if(x.length===0)return;const R=qo+=1,k=await Promise.all(x.map(async We=>{try{return await Sk(We)}catch{return null}}));if(R!==qo)return;const G={...ye.value};for(const We of k)We&&(G[We.id]=We);ye.value=G}tt([Pe,on,()=>o.isLoading],()=>{Se&&ur()}),pi(async()=>{const{threadIds:x}=await lI(),R=Array.isArray(x)?x.filter(k=>typeof k=="string").map(k=>k.trim()).filter((k,G,We)=>k.length>0&&We.indexOf(k)===G):[];R.length>0&&(Pe.value=R);try{Ee.value=await bx()}catch{Ee.value={}}try{await ha()}catch{Be.value={}}Se=!0,ur()});const Ht=K(()=>Ye(N.value)),js=K(()=>{const x=oe.value;return Ht.value?r('This will archive the thread "{title}" and remove the attached heartbeat automations.',{title:x}):r('This will archive the thread "{title}". You can find it later in archived threads.',{title:x})}),Gr=K(()=>{const x=new Map;for(const R of o.groups)for(const k of R.threads)x.set(k.id,R.projectName);return x}),Wo=K(()=>{const x=new Map;for(const R of o.groups){const k=R.threads.filter(G=>!tn.value.has(G.id)&&!Wr.value.has(G.id));x.set(R.projectName,k)}return x}),yo=K(()=>{const x=new Map;for(const R of o.groups)for(const k of R.threads){const G=new Date(k.updatedAtIso||k.createdAtIso).getTime();x.set(k.id,G)}return x}),qt=K(()=>{const x=xe.value;return x?on.value.get(x)??null:null}),Ka=K(()=>Pe.value.map(x=>on.value.get(x)??ye.value[x]??null).filter(x=>x!==null).filter(go));function no(){U.value=!U.value}function Ya(){H.value=!H.value}function wo(){be.value=!be.value}function Vr(x){if(Number.isNaN(x))return"n/a";const R=Math.abs(Date.now()-x);if(R<6e4)return r("now");const k=Math.floor(R/6e4);if(k<60)return`${k}m`;const G=Math.floor(k/60);return G<24?`${G}h`:`${Math.floor(G/24)}d`}function bo(x){const R=yo.value.get(x.id);return Vr(typeof R=="number"?R:new Date(x.updatedAtIso||x.createdAtIso).getTime())}function jo(x){const R=new Date(x).getTime();return Number.isNaN(R)?"":new Date(R).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function oo(x){return tn.value.has(x)}function cr(x){if(oo(x)){Pe.value=Pe.value.filter(R=>R!==x);return}Pe.value=[x,...Pe.value]}function St(x){cr(x),we()}function ln(x){Y.value="",s("select",x)}function In(x){x===o.selectedThreadId&&(s("copy-thread-chat",x),we())}function dr(x){s("fork-thread",x),we()}function An(x){return`${r("start new thread")} ${mr(x)}`}function Kr(x){s("start-new-thread",x)}function fr(x){s("browse-thread-files",x),we()}function dn(x){s("save-thread-project",x),we()}async function C(x){var k,G;const R=((G=(k=on.value.get(x))==null?void 0:k.cwd)==null?void 0:G.trim())??"";if(we(),!(!R||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(R)}catch{}}function E(x,R){if(xe.value===x&&$e.value==="hover"){if(R){const k=R.relatedTarget,G=Bn.value;if(k instanceof Node&&G&&G.contains(k))return}we()}}function Q(x){return xe.value===x}function we(){xe.value="",$e.value="hover",Le.value={}}function ct(x){if(Y.value="",xe.value===x){we();return}$e.value="hover",$t(),xt.value=!1,xe.value=x,Nt(()=>{Xa(x)})}function _t(x,R){x.preventDefault(),Y.value="",$e.value="contextmenu",xe.value=R}function _n(x,R){lt.value=x,Ze.value=R,Ke.value=!0,we(),Nt(()=>{var k,G;(k=ut.value)==null||k.focus(),(G=ut.value)==null||G.select()})}function Kt(){Ke.value=!1,lt.value="",Ze.value=""}function Pn(){const x=lt.value,R=Ze.value.trim();!x||!R||(s("rename-thread",{threadId:x,title:R}),Kt())}function Wt(x,R){Y.value="",N.value=x,oe.value=R,fe.value=!0,we()}function vn(){fe.value=!1,N.value="",oe.value=""}async function mi(){const x=N.value;x&&(Ls(x),vn())}function pr(x){return Y.value===x}function hr(x){if(Y.value!==x){Y.value=x,we();return}Ls(x),Y.value=""}function Ls(x){var k,G;const R=on.value.get(x)??null;Wr.value.has(x)||(pe.value=[x,...pe.value]),Y.value="",we(),d({id:x,title:((k=R==null?void 0:R.title)==null?void 0:k.trim())||"(untitled)",cwd:((G=R==null?void 0:R.cwd)==null?void 0:G.trim())??"",projectName:Gr.value.get(x)??""}),Pe.value=Pe.value.filter(We=>We!==x),s("archive",x),Ye(x)&&Es(x)}function mr(x){return o.projectDisplayNameById[x]??x}t({openAutomationEditorFromPanel:Ps,openAutomationCreatorFromPanel:qa,openRenameThreadDialog:_n,openRecycleBin:P});function Yr(x){return x.includes("/")||x.includes("\\")}function Tn(x){return Yr(x)?x:mr(x)}function vr(x){const R=Bo(x);if(!R)return!1;let k=0;for(const G of o.groups)if(Yr(G.projectName)&&Bo(G.projectName)===R&&(k+=1,k>1))return!0;return!1}function Lo(x){const R=o.projectDisplayNameById[x.projectName],k=mr(x.projectName),G=x.projectName;if(R&&!Yr(G)&&G!==k)return k.includes(G)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(G)?k:`${k} ${G}`;if(R&&Yr(G)){const ao=Bo(G),Co=Bo(qi(G)),cn=vr(G)?Co:ao;return cn&&cn!==k?`${k} ${cn}`:k}if(!k.includes("/")&&!k.includes("\\"))return k;const We=Bo(k)||k,Ot=Bo(qi(k));return Ot.startsWith(".")&&Ot!==We?`${We} ${Ot}`:x.threads.length>0||!vr(G)?We:Ot?`${We} ${Ot}`:We}function va(x){return ne.value===x}function $t(){ne.value="",Ae.value="actions",Fe.value=""}function ga(){const x=!xt.value;x&&($t(),we()),xt.value=x}function rn(x){eo.value=x,xt.value=!1}function gr(){W.value=!W.value}function ya(x){he.value=x}function Sn(x){s("request-project-git-status",x),Nt(()=>{Rn(x)})}function Ns(x){if(ne.value===x){$t();return}we(),xt.value=!1,ne.value=x,Ae.value="actions",Fe.value=mr(x),Sn(x)}function Ja(x){we(),xt.value=!1,ne.value=x,Ae.value="actions",Fe.value=mr(x),Sn(x)}function rl(x){return o.projectDisplayNameById[x.projectName]??Lo(x)}function Hn(x){we();const R=x.projectName;ne.value=R,Ae.value="rename",Fe.value=rl(x),Nt(()=>{Rn(R)})}function Yt(x){s("browse-project-files",x),$t()}function Gt(x){s("save-project",x),$t()}function vi(x){s("create-project-worktree",x),$t()}function al(x){s("rename-project",{projectName:x,displayName:Fe.value})}function $s(x){const R=qn(x);if(s("remove-project",x),R&&Tt(x)){me.value="";const k=Be.value;Be.value=Rs(Be.value,R),jg(R).then(ha).catch(async G=>{Be.value=k;const We=G instanceof Error?G.message:r("Failed to delete project automation");me.value=We,a(We);try{await ha()}catch{Be.value=k}}).finally(()=>{s("automations-changed")})}$t()}function qn(x){var k;const R=((k=o.projectCwdByName[x])==null?void 0:k.trim())??"";return Lx(R)?R:""}function gi(x,R){if(!x.altKey||x.key!=="ArrowUp"&&x.key!=="ArrowDown")return;const k=o.groups.findIndex(Ot=>Ot.projectName===R);if(k<0)return;const G=x.key==="ArrowUp"?-1:1,We=Math.max(0,Math.min(k+G,o.groups.length-1));We!==k&&(x.preventDefault(),s("reorder-project",{projectName:R,toIndex:We}))}function ro(x){return L.value[x]===!0}function un(x){return j.value[x]===!0}function Wn(x){L.value={...L.value,[x]:!ro(x)}}function yr(){le.value=!le.value}function wr(x){ho(x)||(j.value={...j.value,[x]:!un(x)})}function Go(x,R){const k=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(k){mo.set(x,k);return}mo.delete(x)}function wa(x,R){const k=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(k){Ho.set(x,k);return}Ho.delete(x)}function Qa(x){let R=x.parentElement;for(;R;){const k=window.getComputedStyle(R),G=k.overflowY||k.overflow;if(G==="auto"||G==="scroll"||G==="hidden"||G==="clip")return R.getBoundingClientRect();R=R.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function Jr(x,R){const k=x.getBoundingClientRect(),G=Qa(x),We=6,Ot=G.bottom-k.bottom,ao=k.top-G.top;return Ot>=R+We?"down":ao>Ot?"up":"down"}function yi(x,R){const k=Ho.get(x);if(!k)return"down";const G=Jr(k,R);return de.value={...de.value,[x]:G},G}function ba(x){return de.value[x]??"down"}function Rn(x){const R=mo.get(x);if(!R)return;const k=R.querySelector(".project-menu-panel"),G=(k==null?void 0:k.getBoundingClientRect().height)??0;te.value={...te.value,[x]:Jr(R,G)}}function To(x,R,k){return Math.min(Math.max(x,R),k)}function Xa(x){const R=Ho.get(x);if(!R)return;const k=Bn.value,G=k==null?void 0:k.getBoundingClientRect(),We=(G==null?void 0:G.height)||(k==null?void 0:k.offsetHeight)||112,Ot=(G==null?void 0:G.width)||(k==null?void 0:k.offsetWidth)||160,ao=yi(x,We),Co=R.getBoundingClientRect(),cn=8,br=4,es=Math.max(cn,window.innerWidth-Ot-cn),ts=To(Co.right-Ot,cn,es),Tr=To(ao==="up"?Co.top-We-br:Co.bottom+br,cn,Math.max(cn,window.innerHeight-We-cn));Le.value={left:`${Math.round(ts)}px`,top:`${Math.round(Tr)}px`}}function Ta(){const x=xe.value;x&&Xa(x)}function wi(){window.addEventListener("resize",Ta),document.addEventListener("scroll",Ta,!0)}function Os(){window.removeEventListener("resize",Ta),document.removeEventListener("scroll",Ta,!0)}function Gn(x){const R=ne.value;if(!R)return!1;const k=mo.get(R);if(!k)return!1;if((typeof x.composedPath=="function"?x.composedPath():[]).includes(k))return!0;const We=x.target;return We instanceof Node?k.contains(We):!1}function Vo(x){const R=xe.value;if(!R)return!1;const k=Ho.get(R);if(!k)return!1;const G=typeof x.composedPath=="function"?x.composedPath():[];if(G.includes(k))return!0;const We=Bn.value;if(We&&G.includes(We))return!0;const Ot=x.target;return Ot instanceof Node?!!(k.contains(Ot)||We&&We.contains(Ot)):!1}function Ds(x){if(xt.value){const R=Ro.value,k=typeof x.composedPath=="function"?x.composedPath():[];!!R&&(k.includes(R)||x.target instanceof Node&&R.contains(x.target))||(xt.value=!1)}ne.value&&(Gn(x)||$t(),xe.value&&(Vo(x)||we()))}function Fs(x){ne.value&&!Gn(x)&&$t(),xe.value&&!Vo(x)&&we()}function bi(){xt.value&&(xt.value=!1),ne.value&&$t(),xe.value&&we()}function sl(){window.addEventListener("pointerdown",Ds,{capture:!0}),window.addEventListener("focusin",Fs,{capture:!0}),window.addEventListener("blur",bi)}function Ti(){window.removeEventListener("pointerdown",Ds,{capture:!0}),window.removeEventListener("focusin",Fs,{capture:!0}),window.removeEventListener("blur",bi)}function Sa(x){return Wo.value.get(x.projectName)??[]}function Qr(x){if(bn.value)return Sa(x);if(un(x.projectName))return[];const R=Sa(x);return ro(x.projectName)?R:R.slice(0,10)}function Xr(x){return bn.value?!1:!un(x.projectName)&&Sa(x).length>10}function Za(x){return Sa(x).length>0}function So(x){var R;return!!x.pendingRequestState||x.inProgress||x.unread||((R=x.externalSession)==null?void 0:R.active)===!0}function No(x){return x.pendingRequestState==="approval"?r("Awaiting approval"):r("Awaiting response")}function $o(x){var R;return((R=x.externalSession)==null?void 0:R.active)===!0?"external":x.pendingRequestState==="approval"?"awaiting-approval":x.pendingRequestState==="response"?"awaiting-response":x.inProgress?"working":x.unread?"unread":"idle"}tt(()=>o.groups.map(x=>x.projectName),x=>{Hr(x)}),tt(()=>{const x=ne.value;return x?o.projectGitRepoByName[x]:void 0},()=>{const x=ne.value;x&&Nt(()=>{ne.value===x&&Rn(x)})});const Zr=K(()=>xt.value||ne.value!==""||xe.value!=="");return tt(Zr,x=>{if(x){sl();return}Ti()}),tt(xe,x=>{if(!x){Os();return}wi(),Nt(()=>{Xa(x)})}),_s(()=>{mo.clear(),Os(),Ti(),qr()}),(x,R)=>(_(),F("section",{class:at(["thread-tree-root",{"chats-first":W.value}])},[Ka.value.length>0?(_(),F("section",F_,[Oe(hs,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":U.value,onClick:no},{left:dt(()=>[U.value?(_(),Qe(Cs,{key:1,class:"thread-icon"})):(_(),Qe(Su,{key:0,class:"thread-icon"}))]),default:dt(()=>[w("span",B_,D(m(r)("Pinned")),1)]),_:1},8,["aria-expanded"]),U.value?(_(),F("ul",U_,[(_(!0),F(ot,null,Zt(Ka.value,k=>(_(),Qe(Cu,{key:k.id,thread:k,selected:k.id===e.selectedThreadId,pinned:oo(k.id),"menu-open":Q(k.id),"show-status-indicator":So(k),"thread-state":$o(k),"inline-delete-confirming":pr(k.id),"automation-count":m(_e)(k.id),"automation-tooltip":m(At)(k.id),"request-label":No(k),"relative-time":bo(k),"delete-label":m(r)("Delete thread"),"confirm-delete-label":m(r)("Confirm delete"),"confirm-label":m(r)("Confirm"),"worktree-label":m(r)("Worktree thread"),"set-menu-wrap-ref":G=>wa(k.id,G),onSelect:G=>ln(k.id),onInlineDelete:G=>hr(k.id),onMenuToggle:G=>ct(k.id),onRowLeave:G=>E(k.id,G),onRowContextmenu:G=>_t(G,k.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):ve("",!0)])):ve("",!0),w("section",z_,[Oe(hs,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":H.value,onClick:Ya},{left:dt(()=>[H.value?(_(),Qe(Cs,{key:1,class:"thread-icon"})):(_(),Qe(Su,{key:0,class:"thread-icon"}))]),right:dt(()=>[w("div",{ref_key:"organizeMenuWrapRef",ref:Ro,class:"organize-menu-wrap"},[w("button",{class:"organize-menu-trigger",type:"button","aria-expanded":xt.value,"aria-label":m(r)("Organize threads"),title:m(r)("Organize threads"),onClick:gt(ga,["stop"])},[Oe(nf,{class:"thread-icon"})],8,q_),xt.value?(_(),F("div",{key:0,class:"organize-menu-panel",onClick:R[4]||(R[4]=gt(()=>{},["stop"]))},[w("p",W_,D(m(r)("Organize")),1),w("button",{class:"organize-menu-item","data-active":eo.value==="project",type:"button",onClick:R[0]||(R[0]=k=>rn("project"))},[w("span",null,D(m(r)("By project")),1),eo.value==="project"?(_(),F("span",V_,"✓")):ve("",!0)],8,G_),w("button",{class:"organize-menu-item","data-active":eo.value==="chronological",type:"button",onClick:R[1]||(R[1]=k=>rn("chronological"))},[w("span",null,D(m(r)("Chronological list")),1),eo.value==="chronological"?(_(),F("span",Y_,"✓")):ve("",!0)],8,K_),w("button",{class:"organize-menu-item","data-active":W.value,type:"button",onClick:gr},[w("span",null,D(m(r)("Chats first")),1),W.value?(_(),F("span",Q_,"✓")):ve("",!0)],8,J_),R[40]||(R[40]=w("div",{class:"organize-menu-separator"},null,-1)),w("p",X_,D(m(r)("Sort by")),1),w("button",{class:"organize-menu-item","data-active":he.value==="created",type:"button",onClick:R[2]||(R[2]=k=>ya("created"))},[w("span",null,D(m(r)("Created")),1),he.value==="created"?(_(),F("span",eP,"✓")):ve("",!0)],8,Z_),w("button",{class:"organize-menu-item","data-active":he.value==="updated",type:"button",onClick:R[3]||(R[3]=k=>ya("updated"))},[w("span",null,D(m(r)("Updated")),1),he.value==="updated"?(_(),F("span",nP,"✓")):ve("",!0)],8,tP),R[41]||(R[41]=w("div",{class:"organize-menu-separator"},null,-1)),w("button",{class:"organize-menu-item",type:"button",onClick:P},[w("span",null,D(m(r)("Recycle bin")),1)])])):ve("",!0)],512)]),default:dt(()=>[w("span",H_,D(m(r)("Projects")),1)]),_:1},8,["aria-expanded"]),H.value?(_(),F(ot,{key:0},[m(me)?(_(),F("p",oP,D(m(me)),1)):ve("",!0),bn.value&&Lt.value.length===0?(_(),F("p",rP,D(m(r)("No matching threads")),1)):e.isLoading&&e.groups.length===0?(_(),F("p",aP,D(m(r)("Loading threads...")),1)):zn.value?(_(),F("ul",sP,[(_(!0),F(ot,null,Zt(sn.value,k=>(_(),Qe(Cu,{key:k.id,thread:k,selected:k.id===e.selectedThreadId,pinned:oo(k.id),"menu-open":Q(k.id),"show-status-indicator":So(k),"thread-state":$o(k),"inline-delete-confirming":pr(k.id),"automation-count":m(_e)(k.id),"automation-tooltip":m(At)(k.id),"request-label":No(k),"relative-time":bo(k),"delete-label":m(r)("Delete thread"),"confirm-delete-label":m(r)("Confirm delete"),"confirm-label":m(r)("Confirm"),"worktree-label":m(r)("Worktree thread"),"set-menu-wrap-ref":G=>wa(k.id,G),onSelect:G=>ln(k.id),onInlineDelete:G=>hr(k.id),onMenuToggle:G=>ct(k.id),onRowLeave:G=>E(k.id,G),onRowContextmenu:G=>_t(G,k.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):(_(),F("div",{key:4,ref_key:"groupsContainerRef",ref:Ms,class:"thread-tree-groups",style:er(m(vt))},[(_(!0),F(ot,null,Zt(Lt.value,k=>(_(),F("article",{key:k.projectName,ref_for:!0,ref:G=>m(Ct)(k.projectName,G),class:"project-group","data-project-name":k.projectName,"data-expanded":!un(k.projectName),"data-dragging":m(kt)(k.projectName),style:er(m(mn)(k.projectName))},[Oe(hs,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:G=>wr(k.projectName),onContextmenu:gt(G=>Ja(k.projectName),["prevent"]),onKeydown:[G=>gi(G,k.projectName),Ao(gt(G=>wr(k.projectName),["prevent"]),["enter"]),Ao(gt(G=>wr(k.projectName),["prevent"]),["space"])]},{left:dt(()=>[w("span",lP,[w("span",uP,[un(k.projectName)?(_(),Qe(Wf,{key:0,class:"thread-icon"})):(_(),Qe(xA,{key:1,class:"thread-icon"}))]),w("span",cP,[un(k.projectName)?(_(),Qe(Su,{key:0,class:"thread-icon"})):(_(),Qe(Cs,{key:1,class:"thread-icon"}))])])]),right:dt(()=>[w("div",mP,[w("div",{ref_for:!0,ref:G=>Go(k.projectName,G),class:"project-menu-wrap"},[w("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:gt(G=>Ns(k.projectName),["stop"])},[Oe(nf,{class:"thread-icon"})],8,vP),va(k.projectName)?(_(),F("div",{key:0,class:"project-menu-panel","data-open-direction":te.value[k.projectName]??"down",onClick:R[6]||(R[6]=gt(()=>{},["stop"]))},[Ae.value==="actions"?(_(),F(ot,{key:0},[w("button",{class:"project-menu-item",type:"button",onClick:G=>Yt(k.projectName)},D(m(r)("Browse files")),9,yP),w("button",{class:"project-menu-item",type:"button",onClick:G=>Gt(k.projectName)},D(m(r)("Export Project")),9,wP),w("button",{class:"project-menu-item",type:"button",onClick:G=>m(zr)(k.projectName)},D(m(Tt)(k.projectName)?m(r)("Manage automations…"):m(r)("Add automation…")),9,bP),e.projectGitRepoByName[k.projectName]?(_(),F("button",{key:0,class:"project-menu-item",type:"button",onClick:G=>vi(k.projectName)},D(m(r)("New worktree")),9,TP)):ve("",!0),w("button",{class:"project-menu-item",type:"button",onClick:G=>Hn(k)},D(m(r)("Rename project")),9,SP),w("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:G=>$s(k.projectName)},D(m(r)("Remove")),9,CP)],64)):(_(),F(ot,{key:1},[w("label",xP,D(m(r)("Project name")),1),xn(w("input",{"onUpdate:modelValue":R[5]||(R[5]=G=>Fe.value=G),class:"project-menu-input",type:"text",onInput:G=>al(k.projectName)},null,40,kP),[[Nn,Fe.value]])],64))],8,gP)):ve("",!0)],512),w("button",{class:"thread-start-button",type:"button","aria-label":An(k.projectName),title:An(k.projectName),onClick:gt(G=>Kr(k.projectName),["stop"])},[Oe(el,{class:"thread-icon"})],8,IP)])]),default:dt(()=>[w("span",{class:"project-main-button","data-dragging-handle":m(kt)(k.projectName),onMousedown:gt(G=>m(Fn)(G,k.projectName),["left"])},[w("span",{class:"project-title",title:Tn(k.projectName)},D(Lo(k)),9,fP),m(Tt)(k.projectName)?(_(),F("span",{key:0,class:"thread-row-automation-chip",title:m(Br)(k.projectName)},[Oe(bs,{class:"thread-row-automation-icon"}),m(bt)(k.projectName)>1?(_(),F("span",hP,D(m(bt)(k.projectName)),1)):ve("",!0)],8,pP)):ve("",!0)],40,dP)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),Za(k)?(_(),F("ul",AP,[(_(!0),F(ot,null,Zt(Qr(k),G=>(_(),Qe(Cu,{key:G.id,thread:G,selected:G.id===e.selectedThreadId,pinned:oo(G.id),"menu-open":Q(G.id),"show-status-indicator":So(G),"thread-state":$o(G),"inline-delete-confirming":pr(G.id),"automation-count":m(_e)(G.id),"automation-tooltip":m(At)(G.id),"request-label":No(G),"relative-time":bo(G),"delete-label":m(r)("Delete thread"),"confirm-delete-label":m(r)("Confirm delete"),"confirm-label":m(r)("Confirm"),"worktree-label":m(r)("Worktree thread"),"set-menu-wrap-ref":We=>wa(G.id,We),onSelect:We=>ln(G.id),onInlineDelete:We=>hr(G.id),onMenuToggle:We=>ct(G.id),onRowLeave:We=>E(G.id,We),onRowContextmenu:We=>_t(We,G.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):(_(),Qe(hs,{key:1,as:"p",class:"project-empty-row"},{left:dt(()=>[...R[42]||(R[42]=[w("span",{class:"project-empty-spacer"},null,-1)])]),default:dt(()=>[w("span",_P,D(m(r)("No threads")),1)]),_:1})),Xr(k)?(_(),Qe(hs,{key:2,class:"thread-show-more-row"},{left:dt(()=>[...R[43]||(R[43]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:dt(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:G=>Wn(k.projectName)},D(ro(k.projectName)?"Show less":"Show more"),9,PP)]),_:2},1024)):ve("",!0)],12,iP))),128))],4))],64)):ve("",!0)]),w("section",RP,[Oe(hs,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":be.value,onClick:wo},{left:dt(()=>[be.value?(_(),Qe(Cs,{key:1,class:"thread-icon"})):(_(),Qe(Su,{key:0,class:"thread-icon"}))]),right:dt(()=>[w("div",MP,[w("button",{class:"chats-section-action",type:"button","aria-label":m(r)("New chat"),title:m(r)("New chat"),onClick:R[7]||(R[7]=gt(k=>x.$emit("start-new-chat"),["stop"]))},[Oe(el,{class:"thread-icon"})],8,jP)])]),default:dt(()=>[w("span",EP,D(m(r)("Chats")),1)]),_:1},8,["aria-expanded"]),be.value&&to.value.length===0?(_(),F("p",LP,D(m(r)("No chats")),1)):be.value?(_(),F("ul",NP,[(_(!0),F(ot,null,Zt(nn.value,k=>(_(),Qe(Cu,{key:k.id,thread:k,selected:k.id===e.selectedThreadId,pinned:oo(k.id),"menu-open":Q(k.id),"show-status-indicator":So(k),"thread-state":$o(k),"inline-delete-confirming":pr(k.id),"automation-count":m(_e)(k.id),"automation-tooltip":m(At)(k.id),"request-label":No(k),"relative-time":bo(k),"delete-label":m(r)("Delete thread"),"confirm-delete-label":m(r)("Confirm delete"),"confirm-label":m(r)("Confirm"),"worktree-label":m(r)("Worktree thread"),"set-menu-wrap-ref":G=>wa(k.id,G),onSelect:G=>ln(k.id),onInlineDelete:G=>hr(k.id),onMenuToggle:G=>ct(k.id),onRowLeave:G=>E(k.id,G),onRowContextmenu:G=>_t(G,k.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):ve("",!0),be.value&&Va.value?(_(),Qe(hs,{key:2,class:"thread-show-more-row"},{left:dt(()=>[...R[44]||(R[44]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:dt(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:yr},D(le.value?"Show less":"Show more"),1)]),_:1})):ve("",!0)]),(_(),Qe(Ki,{to:"body"},[qt.value?(_(),F("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:Bn,class:"thread-menu-panel thread-menu-panel-fixed",style:er(Le.value),"data-open-direction":ba(qt.value.id),onClick:R[17]||(R[17]=gt(()=>{},["stop"]))},[w("button",{class:"thread-menu-item",type:"button",onClick:R[8]||(R[8]=k=>m(Ur)(qt.value.id))},D(m(Ye)(qt.value.id)?m(r)("Manage automations…"):m(r)("Add automation…")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[9]||(R[9]=k=>fr(qt.value.id))},D(m(r)("Browse files")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[10]||(R[10]=k=>dn(qt.value.id))},D(m(r)("Export Project")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[11]||(R[11]=k=>C(qt.value.id))},D(m(r)("Copy path")),1),w("button",{class:"thread-menu-item",type:"button",disabled:qt.value.id!==e.selectedThreadId,title:qt.value.id===e.selectedThreadId?m(r)("Copy chat"):m(r)("Open this chat before copying"),onClick:R[12]||(R[12]=k=>In(qt.value.id))},D(m(r)("Copy chat")),9,OP),w("button",{class:"thread-menu-item",type:"button",onClick:R[13]||(R[13]=k=>dr(qt.value.id))},D(m(r)("Create chat fork")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[14]||(R[14]=k=>St(qt.value.id))},D(oo(qt.value.id)?m(r)("Unpin thread"):m(r)("Pin thread")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[15]||(R[15]=k=>_n(qt.value.id,qt.value.title))},D(m(r)("Rename thread")),1),w("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:R[16]||(R[16]=k=>Wt(qt.value.id,qt.value.title))},D(m(r)("Delete thread")),1)],12,$P)):ve("",!0)])),Oe(kd,{open:Ke.value,title:m(r)("Rename thread"),subtitle:m(r)("Make it short and recognizable."),onClose:Kt},{footer:dt(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:Kt},D(m(r)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Pn},D(m(r)("Save")),1)]),default:dt(()=>[xn(w("input",{ref_key:"renameThreadInputRef",ref:ut,"onUpdate:modelValue":R[18]||(R[18]=k=>Ze.value=k),class:"rename-thread-input",type:"text",placeholder:m(r)("Add title..."),onKeydown:Ao(gt(Pn,["prevent"]),["enter"])},null,40,DP),[[Nn,Ze.value]])]),_:1},8,["open","title","subtitle"]),Oe(kd,{open:fe.value,title:Ht.value?m(r)("Archive chat and remove automations?"):m(r)("Delete thread?"),subtitle:js.value,onClose:vn},{footer:dt(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:vn},D(m(r)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:mi},D(Ht.value?m(r)("Archive and remove"):m(r)("Delete")),1)]),_:1},8,["open","title","subtitle"]),Oe(kd,{open:f.value,title:m(r)("Recycle bin"),subtitle:m(r)("Threads you removed are kept here so you can restore them."),size:"md",onClose:R[19]||(R[19]=k=>f.value=!1)},{default:dt(()=>[w("div",FP,[m(i).length===0?(_(),F("div",BP,D(m(r)("Recycle bin is empty.")),1)):(_(),F("ul",UP,[(_(!0),F(ot,null,Zt(m(i),k=>(_(),F("li",{key:k.id,class:"recycle-bin-item"},[w("div",zP,[w("span",HP,D(k.title),1),k.projectName?(_(),F("span",qP,D(k.projectName),1)):ve("",!0),w("span",WP,D(jo(k.archivedAtIso)),1)]),w("div",GP,[w("button",{class:"recycle-bin-button recycle-bin-button-primary",type:"button",disabled:y.value===k.id,onClick:G=>B(k.id)},D(y.value===k.id?m(r)("Restoring…"):m(r)("Restore")),9,VP),w("button",{class:"recycle-bin-button recycle-bin-button-danger",type:"button",onClick:G=>m(c)(k.id)},D(m(r)("Delete permanently")),9,KP)])]))),128))])),b.value?(_(),F("p",YP,D(b.value),1)):ve("",!0)])]),_:1},8,["open","title","subtitle"]),(_(),Qe(Ki,{to:"body"},[m(A)?(_(),F("div",{key:0,class:"rename-thread-overlay",onClick:R[39]||(R[39]=gt((...k)=>m(Zn)&&m(Zn)(...k),["self"]))},[w("div",{class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":m(M)==="project"?m(r)("Project automation"):m(r)("Thread automation")},[w("h3",QP,D(m(Z)==="edit"?m(r)("Edit automation"):m(r)("Add automation")),1),w("p",XP,D(m(st)),1),m(ce)&&m(Z)==="create"?(_(),F("div",ZP,[R[45]||(R[45]=w("span",{class:"automation-thread-label"},"Target",-1)),w("div",eR,[w("button",{class:at(["automation-target-mode",{"is-active":m(re)==="thread"}]),type:"button",onClick:R[20]||(R[20]=k=>m(Wa)("thread"))}," Existing chat ",2),w("button",{class:at(["automation-target-mode",{"is-active":m(re)==="project"}]),type:"button",onClick:R[21]||(R[21]=k=>m(Wa)("project"))}," Project ",2)]),w("div",tR,[Oe(ci,{modelValue:m(je),"onUpdate:modelValue":R[22]||(R[22]=k=>kn(je)?je.value=k:null),class:"automation-thread-dropdown",options:m(mt),placeholder:m(re)==="project"?"Select project":"Select chat","enable-search":"","search-placeholder":m(re)==="project"?"Search projects":"Search chats"},null,8,["modelValue","options","placeholder","search-placeholder"])])])):ve("",!0),m(Je).length>0?(_(),F("div",{key:1,class:"automation-thread-list","aria-label":m(M)==="project"?"Project automations":"Thread automations"},[(_(!0),F(ot,null,Zt(m(Je),k=>(_(),F("button",{key:k.id,class:at(["automation-thread-list-item",{"is-active":k.id===m(z)}]),type:"button",onClick:G=>m(sr)(k.id)},[w("span",null,D(k.name),1),w("small",null,D(k.status==="PAUSED"?"Paused":"Active"),1)],10,oR))),128)),w("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:R[23]||(R[23]=(...k)=>m(Uo)&&m(Uo)(...k))},D(m(r)("Add another automation")),1)],8,nR)):ve("",!0),w("label",rR,[w("span",aR,D(m(r)("Name")),1),xn(w("input",{"onUpdate:modelValue":R[24]||(R[24]=k=>m(He).name=k),class:"rename-thread-input",type:"text",placeholder:m(r)("Automation name")},null,8,sR),[[Nn,m(He).name]])]),w("label",iR,[w("span",lR,D(m(r)("Prompt")),1),xn(w("textarea",{"onUpdate:modelValue":R[25]||(R[25]=k=>m(He).prompt=k),class:"automation-thread-textarea",rows:"6",placeholder:m(r)("Describe what the automation should do")},null,8,uR),[[Nn,m(He).prompt]])]),w("div",cR,[w("span",dR,D(m(r)("Schedule")),1),w("div",fR,[w("button",{class:at(["automation-schedule-mode",{"is-active":m(Ue).mode==="daily"}]),type:"button",onClick:R[26]||(R[26]=k=>m(ar)("daily"))},D(m(r)("Daily")),3),w("button",{class:at(["automation-schedule-mode",{"is-active":m(Ue).mode==="interval"}]),type:"button",onClick:R[27]||(R[27]=k=>m(ar)("interval"))},D(m(r)("Interval")),3),w("button",{class:at(["automation-schedule-mode",{"is-active":m(Ue).mode==="advanced"}]),type:"button",onClick:R[28]||(R[28]=k=>m(ar)("advanced"))}," RRULE ",2)]),m(Ue).mode==="daily"?(_(),F("div",pR,[w("span",hR,D(m(r)("Run every day at")),1),xn(w("input",{"onUpdate:modelValue":R[29]||(R[29]=k=>m(Ue).dailyTime=k),class:"automation-schedule-time",type:"time",onInput:R[30]||(R[30]=(...k)=>m(zt)&&m(zt)(...k))},null,544),[[Nn,m(Ue).dailyTime]])])):m(Ue).mode==="interval"?(_(),F("div",mR,[w("span",vR,D(m(r)("Run every")),1),xn(w("input",{"onUpdate:modelValue":R[31]||(R[31]=k=>m(Ue).interval=k),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:R[32]||(R[32]=(...k)=>m(zt)&&m(zt)(...k))},null,544),[[Nn,m(Ue).interval,void 0,{number:!0}]]),Oe(ci,{class:"automation-schedule-unit-dropdown","model-value":m(Ue).intervalUnit,options:m(q),placeholder:m(r)("Unit"),"onUpdate:modelValue":m(Ha)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):ve("",!0),m(Ue).mode==="advanced"?xn((_(),F("input",{key:2,"onUpdate:modelValue":R[33]||(R[33]=k=>m(He).rrule=k),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:R[34]||(R[34]=(...k)=>m(pa)&&m(pa)(...k))},null,544)),[[Nn,m(He).rrule]]):ve("",!0),w("p",gR,D(m(et)),1)]),w("div",yR,[w("span",wR,D(m(r)("Status")),1),Oe(ci,{class:"automation-thread-dropdown","model-value":m(He).status,options:m(ae),placeholder:m(r)("Status"),"onUpdate:modelValue":m(fa)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),m(Re)?(_(),F("p",bR,D(m(Re)),1)):m(ke)?(_(),F("p",TR,D(m(ke)),1)):ve("",!0),w("div",SR,[m(Z)==="edit"&&m(M)==="thread"?(_(),F("button",{key:0,class:"rename-thread-button",type:"button",disabled:m(Ve)||m(Ne),onClick:R[35]||(R[35]=(...k)=>m(Dn)&&m(Dn)(...k))},D(m(Ne)?m(r)("Running…"):m(r)("Run now")),9,CR)):ve("",!0),m(Z)==="edit"?(_(),F("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:m(Ve)||m(Ne),onClick:R[36]||(R[36]=(...k)=>m(Po)&&m(Po)(...k))},D(m(r)("Remove")),9,xR)):ve("",!0),w("button",{class:"rename-thread-button",type:"button",disabled:m(Ve)||m(Ne),onClick:R[37]||(R[37]=(...k)=>m(Zn)&&m(Zn)(...k))},D(m(r)("Cancel")),9,kR),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:m(Ve)||m(Ne),onClick:R[38]||(R[38]=(...k)=>m(zo)&&m(zo)(...k))},D(m(Ve)?m(r)("Saving…"):m(r)("Save")),9,IR)])],8,JP)])):ve("",!0)]))],2))}}),_R=It(AR,[["__scopeId","data-v-e9f9e36a"]]),PR={class:"content-header"},RR=["title"],ER={class:"content-actions"},MR=hn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(_(),F("header",PR,[w("div",{class:at(["content-leading",{"is-accent":e.accent}])},[_o(t.$slots,"leading",{},void 0)],2),w("h1",{class:at(["content-title",{"is-accent":e.accent}]),title:e.title},D(e.title),11,RR),w("div",ER,[_o(t.$slots,"actions",{},void 0)])]))}}),jR=It(MR,[["__scopeId","data-v-61739409"]]),Rm=.0025,Id=3,Em=2,LR=256;function NR(e){var ye;const t=S("idle"),n=S(typeof navigator<"u"&&!!((ye=navigator.mediaDevices)!=null&&ye.getUserMedia)),o=S(0),r=S(null);let a=null,s=null,i=[],l=null,d=null,c=null,v=null,f=[],b=!1,y=!1,P=null;function B(){P&&(P.abort(),P=null),t.value==="transcribing"&&(t.value="idle")}function L(){const Y=r.value;if(!Y||typeof window>"u")return;const pe=Y.getContext("2d");if(!pe)return;const ne=Math.max(1,Math.floor(Y.clientWidth)),xe=Math.max(1,Math.floor(Y.clientHeight||36)),$e=window.devicePixelRatio||1,te=Math.max(1,Math.floor(ne*$e)),de=Math.max(1,Math.floor(xe*$e));(Y.width!==te||Y.height!==de)&&(Y.width=te,Y.height=de),pe.setTransform($e,0,0,$e,0,0),pe.clearRect(0,0,ne,xe);const Le=Math.max(12,Math.floor(ne/(Id+Em))),Ae=f.slice(-Le),Fe=Math.max(0,Le-Ae.length),Ke=xe/2,lt=getComputedStyle(Y).color||"#000000";for(let Ze=0;Ze<Le;Ze+=1){const ut=Ae[Ze-Fe]??0,N=Math.max(.08,Math.min(1,ut*18))*Ke,oe=Ze*(Id+Em);pe.globalAlpha=ut<=Rm?.35:1,pe.fillStyle=lt,pe.fillRect(oe,Ke-N,Id,N*2)}pe.globalAlpha=1}function j(){f=[],o.value=0,L()}function U(){c&&(c.disconnect(),c.onaudioprocess=null,c=null),d&&(d.disconnect(),d=null),l&&(l.close(),l=null),v=null}function H(Y){if(typeof window>"u")return;const pe=window.webkitAudioContext,ne=window.AudioContext??pe;ne&&(U(),j(),l=new ne,d=l.createMediaStreamSource(Y),c=l.createScriptProcessor(2048,1,1),v=performance.now(),c.onaudioprocess=xe=>{const $e=xe.inputBuffer.getChannelData(0);let te=0;for(let de=0;de<$e.length;de+=1){const Le=Math.abs($e[de]??0);te+=Le<Rm?0:Le}f.push(te/$e.length),f.length>LR&&f.shift(),v!==null&&(o.value=Math.max(0,performance.now()-v)),L()},d.connect(c),c.connect(l.destination),L())}async function be(){var Y;if(t.value==="transcribing"&&B(),!(t.value!=="idle"||!n.value||b)){b=!0,y=!1;try{s=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),i=[],a=new MediaRecorder(s),a.ondataavailable=pe=>{pe.data.size>0&&i.push(pe.data)},a.onstop=()=>{var xe;const pe=i,ne=(a==null?void 0:a.mimeType)||((xe=pe[0])==null?void 0:xe.type)||"audio/webm";Se(),he(pe,ne)},H(s),a.start(250),t.value="recording",y&&le()}catch(pe){Se(),t.value="idle",(Y=e.onError)==null||Y.call(e,pe)}finally{b=!1}}}function le(){if(b&&t.value==="idle"){y=!0;return}if(!(t.value!=="recording"||!a)&&a.state!=="inactive"){t.value="transcribing";try{a.requestData()}catch{}a.stop()}}function W(){y=!1,B(),Se(),t.value="idle"}async function he(Y,pe){var $e,te,de,Le,Ae;if(Y.length===0){($e=e.onEmpty)==null||$e.call(e),t.value="idle";return}const ne=new Blob(Y,{type:pe});t.value="transcribing";let xe=null;try{const Fe=pe.split(/[/;]/)[1]??"webm",Ke=new FormData;Ke.append("file",ne,`codex.${Fe}`);const lt=((te=e.getLanguage)==null?void 0:te.call(e).trim())??"";lt&<.toLowerCase()!=="auto"&&Ke.append("language",lt),xe=new AbortController,P=xe;const Ze=await fetch("/codex-api/transcribe",{method:"POST",body:Ke,signal:xe.signal}),ut=await Ze.text();let fe=null;try{fe=ut.trim()?JSON.parse(ut):null}catch{fe=null}if(!Ze.ok){const oe=(de=fe==null?void 0:fe.error)==null?void 0:de.trim(),ue=ut.trim();throw new Error(oe||ue||`Transcription failed: ${Ze.status}`)}const N=((fe==null?void 0:fe.text)??"").trim();N.length>0?e.onTranscript(N):(Le=e.onEmpty)==null||Le.call(e)}catch(Fe){if(Fe instanceof DOMException&&Fe.name==="AbortError")return;(Ae=e.onError)==null||Ae.call(e,Fe)}finally{xe&&P===xe&&(P=null),t.value==="transcribing"&&(t.value="idle")}}function Se(){U(),j(),a&&(a.ondataavailable=null,a.onstop=null,a=null),s&&(s.getTracks().forEach(Y=>Y.stop()),s=null),i=[]}_s(()=>{W()});function Pe(){if(t.value==="recording"){le();return}(t.value==="idle"||t.value==="transcribing")&&be()}return{state:t,isSupported:n,recordingDurationMs:o,waveformCanvasRef:r,startRecording:be,stopRecording:le,toggleRecording:Pe,cancel:W}}const $R={},OR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function DR(e,t){return _(),F("svg",OR,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m12 5l0 14m-6-8l6-6l6 6"},null,-1)])])}const FR=It($R,[["render",DR]]),BR={},UR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function zR(e,t){return _(),F("svg",UR,[...t[0]||(t[0]=[w("path",{d:"M4 8V4h4"},null,-1),w("path",{d:"M20 8V4h-4"},null,-1),w("path",{d:"M4 16v4h4"},null,-1),w("path",{d:"M20 16v4h-4"},null,-1)])])}const HR=It(BR,[["render",zR]]),qR={},WR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function GR(e,t){return _(),F("svg",WR,[...t[0]||(t[0]=[w("path",{d:"M8 4v4H4"},null,-1),w("path",{d:"M16 4v4h4"},null,-1),w("path",{d:"M8 20v-4H4"},null,-1),w("path",{d:"M16 20v-4h4"},null,-1)])])}const VR=It(qR,[["render",GR]]),KR={},YR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function JR(e,t){return _(),F("svg",YR,[...t[0]||(t[0]=[w("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),w("path",{fill:"currentColor",d:"M8 5a3 3 0 0 0 -3 3v8a3 3 0 0 0 3 3h8a3 3 0 0 0 3 -3v-8a3 3 0 0 0 -3 -3h-8z"},null,-1)])])}const QR=It(KR,[["render",JR]]),XR=["aria-label"],ZR=8,ti=8,eE=hn({__name:"ComposerPopover",props:{open:{type:Boolean},align:{},width:{},panelClass:{},ariaLabel:{}},emits:["update:open"],setup(e,{expose:t,emit:n}){const o=e,r=n,a=S(null),s=S(null),i=S({});let l=!1;const d=K(()=>o.open),c=K(()=>o.width==="lg"?"composer-popover-panel--lg":"composer-popover-panel--md");function v(L,j,U){return Math.min(Math.max(j,L),U)}function f(){var Pe,ye;if(!d.value)return;const L=a.value;if(!L||typeof window>"u")return;const j=L.getBoundingClientRect(),U=window.innerWidth,H=window.innerHeight,be=Math.max(0,U-ti*2),le=Math.min(((Pe=s.value)==null?void 0:Pe.offsetWidth)??288,be),W=((ye=s.value)==null?void 0:ye.offsetHeight)??0;let he;o.align==="end"?he=j.right-le:o.align==="center"?he=j.left+(j.width-le)/2:he=j.left,he=v(he,ti,Math.max(ti,U-le-ti));let Se=j.top-W-ZR;Se=v(Se,ti,Math.max(ti,H-W-ti)),i.value={position:"fixed",left:`${he}px`,right:"auto",top:`${Se}px`,bottom:"auto",width:`${le}px`}}function b(){l||typeof window>"u"||(window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),window.addEventListener("orientationchange",f),l=!0)}function y(){!l||typeof window>"u"||(window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0),window.removeEventListener("orientationchange",f),l=!1)}tt(d,L=>{if(!L){y(),i.value={};return}b(),Nt(()=>{var j;(j=s.value)==null||j.focus(),f(),window.requestAnimationFrame(f)})}),_s(()=>{y()});function P(){r("update:open",!o.open)}function B(L){var W,he,Se;if(L.key==="Escape"){r("update:open",!1);return}const j=s.value;if(!j)return;const U=Array.from(j.querySelectorAll("button")).filter(Pe=>!Pe.disabled&&Pe.offsetParent!==null);if(U.length===0)return;if(L.key==="Home"){L.preventDefault(),(W=U[0])==null||W.focus();return}if(L.key==="End"){L.preventDefault(),(he=U[U.length-1])==null||he.focus();return}if(L.key!=="ArrowDown"&&L.key!=="ArrowUp")return;L.preventDefault();let H=U.findIndex(Pe=>Pe===document.activeElement);H<0&&(H=L.key==="ArrowDown"?-1:0);const be=L.key==="ArrowDown"?1:-1,le=(H+be+U.length)%U.length;(Se=U[le])==null||Se.focus()}return t({root:a}),(L,j)=>(_(),F("div",{ref_key:"rootRef",ref:a,class:"composer-popover-anchor"},[_o(L.$slots,"trigger",{toggle:P,isOpen:d.value},void 0),Oe(Xl,{name:"composer-popover"},{default:dt(()=>[d.value?(_(),F("div",{key:0,ref_key:"panelRef",ref:s,class:at(["composer-popover-panel",[c.value,e.panelClass]]),style:er(i.value),role:"menu",tabindex:"-1","aria-label":e.ariaLabel,onKeydown:B},[_o(L.$slots,"default",{},void 0,!0)],46,XR)):ve("",!0)]),_:3})],512))}}),Qu=It(eE,[["__scopeId","data-v-f7444b02"]]),tE=["aria-label"],nE={class:"composer-popover-group-label"},oE=["aria-selected","onMousedown"],rE={class:"thread-composer-slash-body"},aE={class:"thread-composer-slash-name"},sE={class:"thread-composer-slash-desc"},iE={class:"thread-composer-slash-kind"},lE={class:"composer-popover-group-label composer-popover-group-label--skills"},uE=["aria-selected","onMousedown"],cE=["aria-label","title"],dE={class:"thread-composer-slash-body thread-composer-slash-body--skill"},fE={class:"thread-composer-slash-skill-name"},pE={class:"thread-composer-slash-desc thread-composer-slash-desc--skill"},hE=hn({__name:"ComposerSlashMenu",props:{commands:{},highlightedIndex:{}},emits:["select"],setup(e,{emit:t}){const n=e,o=t,{t:r}=da(),a=S(null),s=K(()=>n.commands.filter(v=>v.group!=="skill")),i=K(()=>n.commands.filter(v=>v.group==="skill"));tt(()=>n.highlightedIndex,async()=>{var v,f;await Nt(),(f=(v=a.value)==null?void 0:v.querySelector(".is-active"))==null||f.scrollIntoView({block:"nearest"})});function l(v){return r(v==="rpc"?"Action":v==="text"?"Prompt":v==="skill"?"Skill":"Local")}function d(v){return v==="system"?"S":v==="repo"?"R":v==="plugin"?"P":"U"}function c(v){return r(v==="system"?"System":v==="repo"?"Repo":v==="plugin"?"Plugin":"User")}return(v,f)=>(_(),F("div",{ref_key:"rootRef",ref:a,class:"composer-popover",role:"listbox","aria-label":m(r)("Commands")},[s.value.length>0?(_(),F(ot,{key:0},[w("div",nE,D(m(r)("Commands")),1),(_(!0),F(ot,null,Zt(s.value,(b,y)=>(_(),F("button",{key:b.id,class:at(["thread-composer-slash-row",{"is-active":y===e.highlightedIndex}]),type:"button",role:"option","aria-selected":y===e.highlightedIndex,onMousedown:gt(P=>o("select",b),["prevent"])},[f[0]||(f[0]=w("span",{class:"thread-composer-slash-prefix","aria-hidden":"true"},"/",-1)),w("span",rE,[w("span",aE,D(b.id),1),w("span",sE,D(m(r)(b.description)),1)]),w("span",iE,D(l(b.kind)),1)],42,oE))),128))],64)):ve("",!0),i.value.length>0?(_(),F(ot,{key:1},[w("div",lE,D(m(r)("Skills")),1),(_(!0),F(ot,null,Zt(i.value,(b,y)=>(_(),F("button",{key:b.skillPath||b.id,class:at(["thread-composer-slash-row thread-composer-slash-row--skill",{"is-active":s.value.length+y===e.highlightedIndex}]),type:"button",role:"option","aria-selected":s.value.length+y===e.highlightedIndex,onMousedown:gt(P=>o("select",b),["prevent"])},[w("span",{class:at(["thread-composer-slash-skill-icon",`is-${b.scope||"user"}`]),"aria-label":c(b.scope),title:c(b.scope)},D(d(b.scope)),11,cE),w("span",dE,[w("span",fE,D(b.displayName||b.id),1),w("span",pE,D(b.description),1)])],42,uE))),128))],64)):ve("",!0)],8,tE))}}),mE=It(hE,[["__scopeId","data-v-ca16aa11"]]),vE=["data-streaming"],gE=["aria-expanded"],yE={class:"thread-composer-plan-panel-title"},wE={key:0,class:"thread-composer-plan-panel-badge"},bE={class:"thread-composer-plan-panel-progress"},TE=["title"],SE=["data-status"],CE={class:"thread-composer-plan-panel-latest-text"},xE={class:"thread-composer-plan-panel-popover-content"},kE={class:"thread-composer-plan-panel-popover-scroll"},IE={class:"thread-composer-plan-panel-popover-head"},AE={class:"thread-composer-plan-panel-title"},_E={class:"thread-composer-plan-panel-progress"},PE={key:0,class:"thread-composer-plan-panel-popover-section"},RE={class:"thread-composer-plan-panel-section-label"},EE=["title"],ME={class:"thread-composer-plan-panel-popover-section"},jE={class:"thread-composer-plan-panel-section-label"},LE={class:"thread-composer-plan-panel-steps"},NE=["data-status"],$E=["data-status"],OE=["title"],DE={class:"thread-composer-plan-panel-popover-footer"},FE=["disabled","data-state"],BE=hn({__name:"ThreadComposerPlanPanel",props:{planPanel:{}},emits:["implement-plan"],setup(e,{emit:t}){const n=e,o=t,{t:r}=da(),a=S(!1),s=K(()=>{var f;return(((f=n.planPanel)==null?void 0:f.steps)??[]).filter(b=>b.status==="completed").length}),i=K(()=>{var f;const v=((f=n.planPanel)==null?void 0:f.steps)??[];if(v.length===0)return null;for(let b=v.length-1;b>=0;b-=1){const y=v[b];if(y.status==="inProgress")return y}return v[v.length-1]}),l=K(()=>{var y,P,B;const v=((P=(y=n.planPanel)==null?void 0:y.explanation)==null?void 0:P.trim())??"";if(!v)return"";const f=((B=v.split(/[。!?!?\n]/u)[0])==null?void 0:B.trim())??"";if(!f)return v;const b=80;return f.length>b?`${f.slice(0,b)}…`:f});function d(v){switch(v){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function c(){a.value=!1,o("implement-plan")}return(v,f)=>(_(),F("div",{class:"thread-composer-plan-panel","data-streaming":e.planPanel.streaming},[Oe(Qu,{open:a.value,align:"center",width:"lg","panel-class":"thread-composer-plan-panel-popover","aria-label":m(r)("Plan"),"onUpdate:open":f[1]||(f[1]=b=>a.value=b)},{trigger:dt(()=>{var b,y;return[w("button",{type:"button",class:"thread-composer-plan-panel-header","aria-expanded":a.value,onClick:f[0]||(f[0]=P=>a.value=!a.value)},[f[2]||(f[2]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",yE,D(m(r)("Plan")),1),e.planPanel.streaming?(_(),F("span",wE,D(m(r)("Updating")),1)):ve("",!0),w("span",bE,D(s.value)+"/"+D(e.planPanel.steps.length),1),w("span",{class:"thread-composer-plan-panel-latest",title:((b=i.value)==null?void 0:b.step)??""},[i.value?(_(),F("span",{key:0,class:"thread-composer-plan-panel-latest-status","data-status":i.value.status},D(d(i.value.status)),9,SE)):ve("",!0),w("span",CE,D(((y=i.value)==null?void 0:y.step)??""),1)],8,TE),Oe(Cs,{class:"thread-composer-plan-panel-chevron"})],8,gE)]}),default:dt(()=>[w("div",xE,[w("div",kE,[w("header",IE,[f[3]||(f[3]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",AE,D(m(r)("Plan")),1),w("span",_E,D(s.value)+"/"+D(e.planPanel.steps.length),1)]),e.planPanel.explanation?(_(),F("section",PE,[w("p",RE,D(m(r)("Summary")),1),w("p",{class:"thread-composer-plan-panel-explanation",title:e.planPanel.explanation},D(l.value),9,EE)])):ve("",!0),w("section",ME,[w("p",jE,D(m(r)("Steps"))+" ("+D(e.planPanel.steps.length)+")",1),w("ol",LE,[(_(!0),F(ot,null,Zt(e.planPanel.steps,(b,y)=>(_(),F("li",{key:`composer-plan-${e.planPanel.id}-${y}`,class:"thread-composer-plan-panel-step","data-status":b.status},[w("span",{class:"thread-composer-plan-panel-step-status","data-status":b.status},D(d(b.status)),9,$E),w("span",{class:"thread-composer-plan-panel-step-text",title:b.step},D(b.step),9,OE)],8,NE))),128))])])]),w("footer",DE,[w("button",{type:"button",class:"thread-composer-plan-panel-implement",disabled:e.planPanel.streaming||e.planPanel.implemented,"data-state":e.planPanel.implemented?"done":e.planPanel.streaming?"running":"idle",onClick:c},D(e.planPanel.implemented?m(r)("Plan executed"):e.planPanel.streaming?m(r)("Implementing…"):m(r)("Implement plan")),9,FE)])])]),_:1},8,["open","aria-label"])],8,vE))}}),UE=It(BE,[["__scopeId","data-v-856e4361"]]),zE={key:0,class:"thread-composer-attachments"},HE=["src"],qE=["src","alt"],WE=["aria-label","disabled","onClick"],GE={key:1,class:"thread-composer-folder-chips"},VE=["title"],KE={class:"thread-composer-folder-chip-meta"},YE=["aria-label","disabled","onClick"],JE={key:2,class:"thread-composer-file-chips"},QE=["title"],XE=["aria-label","disabled","onClick"],ZE={key:3,class:"thread-composer-skill-chips"},eM=["title","aria-label","onClick"],tM=["aria-label","onClick"],nM=hn({__name:"ThreadComposerAttachments",props:{selectedImages:{},folderUploadGroups:{},standaloneFileAttachments:{},selectedSkills:{},isInteractionDisabled:{type:Boolean}},emits:["remove-image","remove-folder","remove-file","remove-skill"],setup(e,{emit:t}){const n=t,o=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function r(l){const d=l.trim();return d?!!(/^video\/|^data:video\//i.test(d)||o.test(d)):!1}function a(l){return l.total<=0?0:Math.round(l.processed/l.total*100)}function s(l){const d=l.trim();return d?d.endsWith("/SKILL.md")?d:`${d.replace(/\/+$/,"")}/SKILL.md`:""}function i(l){const d=s(l.path);!d||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(d)}`,"_blank","noopener,noreferrer")}return(l,d)=>(_(),F(ot,null,[e.selectedImages.length>0?(_(),F("div",zE,[(_(!0),F(ot,null,Zt(e.selectedImages,c=>(_(),F("div",{key:c.id,class:"thread-composer-attachment"},[r(c.url)?(_(),F("video",{key:0,class:"thread-composer-attachment-image",src:c.url,controls:"",preload:"metadata"},null,8,HE)):(_(),F("img",{key:1,class:"thread-composer-attachment-image",src:c.url,alt:c.name||"Selected image"},null,8,qE)),w("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${c.name||"image"}`,disabled:e.isInteractionDisabled,onClick:v=>n("remove-image",c.id)}," x ",8,WE)]))),128))])):ve("",!0),e.folderUploadGroups.length>0?(_(),F("div",GE,[(_(!0),F(ot,null,Zt(e.folderUploadGroups,c=>(_(),F("span",{key:c.id,class:"thread-composer-folder-chip"},[Oe(Wf,{class:"thread-composer-folder-chip-icon"}),w("span",{class:"thread-composer-folder-chip-name",title:c.name},D(c.name),9,VE),w("span",KE,[c.isUploading?(_(),F(ot,{key:0},[ws(D(a(c))+"% uploading ("+D(c.processed)+"/"+D(c.total)+") ",1)],64)):(_(),F(ot,{key:1},[ws(D(c.filePaths.length)+" file"+D(c.filePaths.length===1?"":"s"),1)],64))]),w("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${c.name}`,disabled:e.isInteractionDisabled,onClick:v=>n("remove-folder",c.id)},"×",8,YE)]))),128))])):ve("",!0),e.standaloneFileAttachments.length>0?(_(),F("div",JE,[(_(!0),F(ot,null,Zt(e.standaloneFileAttachments,c=>(_(),F("span",{key:c.fsPath,class:"thread-composer-file-chip"},[Oe(el,{class:"thread-composer-file-chip-icon"}),w("span",{class:"thread-composer-file-chip-name",title:c.fsPath},D(c.label),9,QE),w("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${c.label}`,disabled:e.isInteractionDisabled,onClick:v=>n("remove-file",c.fsPath)},"×",8,XE)]))),128))])):ve("",!0),e.selectedSkills.length>0?(_(),F("div",ZE,[(_(!0),F(ot,null,Zt(e.selectedSkills,c=>(_(),F("span",{key:c.path,class:"thread-composer-skill-chip"},[w("button",{class:"thread-composer-skill-chip-name",type:"button",title:s(c.path),"aria-label":`Open ${c.displayName||c.name} SKILL.md`,onClick:v=>i(c)},D(c.displayName||c.name),9,eM),w("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${c.displayName||c.name}`,onClick:v=>n("remove-skill",c.path)},"×",8,tM)]))),128))])):ve("",!0)],64))}}),oM=It(nM,[["__scopeId","data-v-67fd7144"]]),rM=hn({__name:"ThreadComposerModelControls",props:{models:{},selectedModel:{},modelReasoningEfforts:{},selectedReasoningEffort:{},selectedSpeedMode:{},disabled:{type:Boolean},activeThreadId:{}},emits:["update:selected-model","update:selected-reasoning-effort"],setup(e,{emit:t}){const n=e,o=t,{t:r}=da(),a=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],s=K(()=>{var B;const y=(B=n.modelReasoningEfforts)==null?void 0:B[n.selectedModel];if(y===void 0)return a;const P=new Set(y);return a.filter(L=>P.has(L.value))});function i(y){return y.trim().replace(/^gpt/i,"GPT")}const l=K(()=>n.models.map(y=>({value:y,label:i(y)}))),d=K(()=>n.disabled||!n.activeThreadId),c=K(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(n.selectedModel.trim())),v=K(()=>n.selectedSpeedMode==="fast"&&c.value);function f(y){o("update:selected-model",y)}function b(y){o("update:selected-reasoning-effort",y)}return(y,P)=>(_(),F(ot,null,[Oe(ci,{class:"thread-composer-control thread-composer-model-control","model-value":e.selectedModel,options:l.value,"selected-prefix-icon":v.value?bs:null,placeholder:m(r)("Model"),"open-direction":"up",variant:"pill",disabled:d.value||e.models.length===0,"enable-search":"","search-placeholder":m(r)("Search models..."),"onUpdate:modelValue":f},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Oe(ci,{class:"thread-composer-control thread-composer-thinking-control","model-value":e.selectedReasoningEffort,options:s.value,placeholder:m(r)("Thinking"),"open-direction":"up",variant:"pill",disabled:d.value||s.value.length===0,"onUpdate:modelValue":b},null,8,["model-value","options","placeholder","disabled"])],64))}}),aM=It(rM,[["__scopeId","data-v-ad846e52"]]),sM=["aria-label","disabled"],iM=["disabled"],lM=["disabled"],uM=["disabled"],cM={class:"thread-composer-attach-mode"},dM={class:"thread-composer-attach-mode-label"},fM={class:"thread-composer-attach-mode-buttons"},pM=["disabled"],hM=["disabled"],mM={class:"thread-composer-attach-mode"},vM={class:"thread-composer-attach-mode-label"},gM={class:"thread-composer-attach-mode-buttons"},yM=["disabled","onClick"],wM={class:"thread-composer-attach-mode"},bM={class:"thread-composer-attach-mode-label"},TM={class:"thread-composer-attach-mode-buttons"},SM=["disabled","onClick"],CM={key:0,class:"thread-composer-menu-error",role:"alert"},xM={key:0,class:"thread-composer-approval-tip",role:"status"},kM=hn({__name:"ThreadComposerAttachMenu",props:{open:{type:Boolean},isMobile:{type:Boolean},isInteractionDisabled:{type:Boolean},isComposerConfigDisabled:{type:Boolean},isApprovalPolicySaving:{type:Boolean},approvalPolicy:{},approvalPolicyError:{},approvalPolicyNotice:{},selectedCollaborationMode:{},collaborationModeChoices:{},approvalPolicyChoices:{},activeInProgressMode:{}},emits:["update:open","toggle","set-active-mode","select-photo","select-folder","capture-camera","select-collaboration-mode","select-approval-policy"],setup(e,{emit:t}){const n=t,{t:o}=da();function r(){n("toggle")}function a(v){n("set-active-mode",v)}function s(){n("select-photo")}function i(){n("select-folder")}function l(){n("capture-camera")}function d(v){n("select-collaboration-mode",v)}function c(v){n("select-approval-policy",v)}return(v,f)=>(_(),Qe(Qu,{open:e.open,align:"start",width:"lg","aria-label":m(o)("Add photos & files"),"onUpdate:open":f[2]||(f[2]=b=>n("update:open",b))},{trigger:dt(()=>[w("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":m(o)("Add photos & files"),disabled:e.isInteractionDisabled,onClick:r}," + ",8,sM)]),default:dt(()=>[w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:s},D(m(o)("Add photos & files")),9,iM),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:i},D(m(o)("Add folder")),9,lM),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:l},D(m(o)("Take photo")),9,uM),f[5]||(f[5]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",cM,[w("span",dM,D(m(o)("In-progress send")),1),w("div",fM,[w("button",{class:at(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="steer"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[0]||(f[0]=b=>a("steer"))},D(m(o)("Steer")),11,pM),w("button",{class:at(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="queue"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[1]||(f[1]=b=>a("queue"))},D(m(o)("Queue")),11,hM)])]),e.isMobile?(_(),F(ot,{key:0},[f[3]||(f[3]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",mM,[w("span",vM,D(m(o)("Plan mode")),1),w("div",gM,[(_(!0),F(ot,null,Zt(e.collaborationModeChoices,b=>(_(),F("button",{key:`mobile-plan-${b.value}`,class:at(["thread-composer-attach-mode-button",{"is-active":e.selectedCollaborationMode===b.value}]),type:"button",disabled:b.disabled||e.isComposerConfigDisabled,onClick:y=>d(b.value)},D(m(o)(b.labelKey)),11,yM))),128))])]),f[4]||(f[4]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",wM,[w("span",bM,D(m(o)("Approval policy")),1),w("div",TM,[(_(!0),F(ot,null,Zt(e.approvalPolicyChoices,b=>(_(),F("button",{key:`mobile-approval-${b.value}`,class:at(["thread-composer-attach-mode-button",{"is-active":e.approvalPolicy===b.value}]),type:"button",disabled:e.isApprovalPolicySaving,onClick:y=>c(b.value)},D(m(o)(b.label)),11,SM))),128))])]),e.approvalPolicyError?(_(),F("p",CM,D(e.approvalPolicyError),1)):ve("",!0),Oe(Xl,{name:"approval-tip"},{default:dt(()=>[e.approvalPolicyNotice?(_(),F("span",xM,D(e.approvalPolicyNotice),1)):ve("",!0)]),_:1})],64)):ve("",!0)]),_:1},8,["open","aria-label"]))}}),IM=It(kM,[["__scopeId","data-v-93f4c279"]]),AM=/(^|\s)(\/[a-zA-Z]*)$/,Mm=[{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 _M(e){var o,r,a;const t=[],n=new Set;for(const s of e){const i=s.name.trim().replace(/^\//u,"").toLowerCase().replace(/\s+/gu,"-");if(!i)continue;const l=s.path.trim()||i;n.has(l)||(n.add(l),t.push({id:i,description:((o=s.description)==null?void 0:o.trim())||"Run this skill",kind:"skill",group:"skill",skillPath:s.path,displayName:((r=s.displayName)==null?void 0:r.trim())||s.name.trim(),scope:((a=s.scope)==null?void 0:a.trim())||"user"}))}return t.sort((s,i)=>s.id.localeCompare(i.id))}function PM(e){const t=e.match(AM);if(!t)return null;const n=t[2]??"";return{query:n.slice(1).toLowerCase(),token:n,startIndex:e.length-n.length}}function RM(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 EM={class:"thread-composer-main"},MM={class:"thread-composer-input-row"},jM={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},LM={class:"thread-composer-drop-overlay-copy"},NM={key:1,class:"composer-popover"},$M=["onMousedown"],OM={key:1,class:"thread-composer-file-mention-icon-markdown"},DM={class:"thread-composer-file-mention-text"},FM={class:"thread-composer-file-mention-name"},BM={key:0,class:"thread-composer-file-mention-dir"},UM={key:1,class:"thread-composer-file-mention-empty"},zM={key:2,class:"thread-composer-file-mention-empty"},HM=["placeholder","disabled"],qM=["aria-label","title","disabled"],WM={class:"thread-composer-actions"},GM=["aria-label","title","disabled"],VM={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},KM=["aria-label","title","disabled"],YM=["aria-label","disabled"],JM={class:"thread-composer-plan-trigger-label"},QM=["aria-checked","disabled","onClick"],XM={class:"thread-composer-menu-item-copy"},ZM={class:"thread-composer-menu-item-title"},e1={key:0,class:"thread-composer-menu-item-sub"},t1={key:1,class:"thread-composer-menu-item-hint"},n1={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},o1=["aria-label","disabled"],r1={class:"thread-composer-approval-trigger-label"},a1=["aria-checked","disabled","onClick"],s1={class:"thread-composer-menu-item-copy"},i1={class:"thread-composer-menu-item-title"},l1={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},u1={key:0,class:"thread-composer-menu-error",role:"alert"},c1={key:0,class:"thread-composer-approval-tip",role:"status"},d1=["title","aria-label"],f1={class:"thread-composer-context-usage-value"},p1={key:0,class:"thread-composer-context-usage-compact"},h1=["disabled"],m1=["disabled"],v1=["disabled"],Ad=12e3,g1=2e3,y1="codex-web-local.thread-draft.v1.",w1=hn({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},fuzzyFileSearchResults:{},collaborationModes:{},selectedCollaborationMode:{},models:{},modelReasoningEfforts:{},selectedModel:{},selectedReasoningEffort:{},selectedSpeedMode:{},skills:{},threadTokenUsage:{},codexQuota:{},isTurnInProgress:{type:Boolean},isStopPending:{type:Boolean},isInterruptingTurn:{type:Boolean},isCompacting:{type:Boolean},externalSessionActive:{type:Boolean},isUpdatingSpeedMode:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean},dictationAutoSend:{type:Boolean},dictationLanguage:{},approvalPolicy:{},isApprovalPolicySaving:{type:Boolean},approvalPolicyError:{},approvalPolicyNotice:{},planPanel:{}},emits:["submit","interrupt","register-fuzzy-session","slash-command","update:selected-collaboration-mode","update:selected-model","update:selected-reasoning-effort","update:selected-speed-mode","update:approval-policy","save-approval-policy","implement-plan","compact-context"],setup(e,{expose:t,emit:n}){const o=e,r=n,{t:a}=da(),s=S(""),i=S([]),l=S([]),d=S([]),c=S([]),v=S(""),f=S(0),b=S(null),y=S(!1),{state:P,cancel:B}=NR({getLanguage:()=>o.dictationLanguage??"auto",onTranscript:C=>{if(s.value=s.value?`${s.value}
|
|
58
|
+
${C}`:C,v.value="",o.dictationAutoSend!==!1){const E=o.isTurnInProgress?Ne.value:"steer";zt(E);return}Nt(()=>{var E;return(E=H.value)==null?void 0:E.focus()})},onEmpty:()=>{v.value=o.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:C=>{if(C instanceof DOMException&&C.name==="NotAllowedError"){v.value="Microphone access was denied.";return}v.value=C instanceof Error?C.message:"Dictation failed."}}),L=S(null),j=S(null),U=S(null),H=S(null),{isMobile:be}=Df(),le=S(!1),W=S(!1),he=S(!1),Se=S(null),Pe=S(""),ye=S([]),Y=S(!1),pe=S(0),ne=S(!1),xe=S(null),$e=S(""),te=S(0),de=S(Mm),Le=K(()=>[...Mm,..._M(o.skills??[])]),Ae=S(!1),Fe=S(!1);let Ke=!1;const lt=S(0);let Ze=0,ut=null,fe="",N=!1,oe=0,ue=0;const Ee=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let Be="";const A=K(()=>{const C=new Set((o.collaborationModes??[]).map(E=>E.value));return[{value:"default",labelKey:"Default",subLabel:"",disabled:!1},{value:"plan",labelKey:"Plan mode",subLabel:a("Agent proposes a plan before acting"),disabled:!1},{value:"execplans",labelKey:"Execution plans",subLabel:"",disabled:!C.has("execplans")}]}),M=[{value:"on-request",label:"When Codex requests it"},{value:"untrusted",label:"Unless trusted"},{value:"never",label:"Never"}],z=K(()=>{const C=A.value.find(E=>E.value===o.selectedCollaborationMode);return a(C?C.labelKey:"Plan mode")}),Z=K(()=>{const C=M.find(E=>E.value===o.approvalPolicy);return a(C?C.label:"Approval policy")}),ce=K(()=>o.selectedCollaborationMode==="plan"&&o.selectedModel.trim().length===0),re=K(()=>o.disabled||o.isUpdatingSpeedMode||!o.activeThreadId||ce.value||f.value>0?!1:s.value.trim().length>0||i.value.length>0||d.value.length>0),je=K(()=>s.value.trim().length>0||i.value.length>0||l.value.length>0||d.value.length>0||c.value.length>0),Re=K(()=>{const C=new Set;for(const E of c.value)for(const Q of E.filePaths)C.add(Q);return d.value.filter(E=>!C.has(E.fsPath))}),ke=K(()=>o.disabled||!o.activeThreadId||o.externalSessionActive===!0),me=K(()=>o.disabled||!o.activeThreadId),Ve=K(()=>o.inProgressSubmitMode==="steer"?"steer":"queue"),Ne=S(Ve.value),He=K(()=>P.value==="recording"),Ue=K(()=>o.activeThreadId?ce.value?a("Loading models for plan mode..."):a("Ask Codex anything, @ to add files, / for commands"):a("Select a thread to send a message")),Je=K(()=>s.value.trim().length>0||i.value.length>0||d.value.length>0),et=K(()=>s.value.split(`
|
|
59
|
+
`).length),st=K(()=>Ae.value||et.value>=6||Fe.value),mt=K(()=>Br(o.threadTokenUsage??null)),q=K(()=>{var C;return((C=mt.value)==null?void 0:C.summaryText)??""}),ae=K(()=>{var C;return((C=mt.value)==null?void 0:C.tooltipText)??""}),_e=K(()=>{var C;return((C=mt.value)==null?void 0:C.tone)??"healthy"});function Ye(){_e.value!=="healthy"&&r("compact-context")}function bt(C){if(!Number.isFinite(C))return"0";const E=Math.abs(C);return E>=1e6?`${(E>=1e7?(C/1e6).toFixed(0):(C/1e6).toFixed(1)).replace(/\.0$/,"")}M`:E>=1e3?`${(E>=1e5?(C/1e3).toFixed(0):(C/1e3).toFixed(1)).replace(/\.0$/,"")}k`:String(Math.round(C))}function Tt(C){const E=Math.max(0,C.inputTokens-C.cachedInputTokens),Q=[`${bt(C.totalTokens)} ${a("total")}`,`${bt(E)} ${a("input")}`];return C.cachedInputTokens>0&&Q.push(`${bt(C.cachedInputTokens)} ${a("cached")}`),C.outputTokens>0&&Q.push(`${bt(C.outputTokens)} ${a("output")}`),C.reasoningOutputTokens>0&&Q.push(`${bt(C.reasoningOutputTokens)} ${a("reasoning")}`),Q.join(" · ")}function At(C,E){if(!Number.isFinite(C)||!Number.isFinite(E)||E<=0)return 0;if(E<=Ad){const _t=Math.max(0,E-Math.max(0,C));return Math.max(0,Math.min(100,Math.round(_t/E*100)))}const Q=E-Ad,we=Math.max(0,C-Ad),ct=Math.max(0,Q-we);return Math.max(0,Math.min(100,Math.round(ct/Q*100)))}function Br(C){if(!C)return null;const E=C.modelContextWindow??null;if(typeof E!="number"||!Number.isFinite(E)||E<=0)return null;const Q=Math.max(0,C.last.totalTokens),we=At(Q,E),ct=Math.max(0,Math.min(100,100-we)),_t=we<=15?"danger":we<=35?"warning":"healthy";return{summaryText:`${we}% · ${bt(Q)} / ${bt(E)}`,tooltipText:[`${a("Context window")}: ${we}% ${a("left")} (${ct}% ${a("used")})`,`${a("In context")}: ${Q.toLocaleString()} / ${E.toLocaleString()} tokens`,`${a("Last turn")}: ${Tt(C.last)}`,`${a("Session total")}: ${Tt(C.total)}`].join(`
|
|
60
|
+
`),percentRemaining:we,tone:_t}}function zt(C="steer"){var Q;const E=s.value.trim();if(re.value){if(r("submit",{text:E,imageUrls:i.value.map(we=>we.url),fileAttachments:[...d.value],skills:l.value.map(we=>({name:we.name,path:we.path})),mode:C}),Ps(o.activeThreadId),pa(),Ae.value=!1,c.value=[],le.value=!1,no(),Ee||be.value){(Q=H.value)==null||Q.blur();return}Nt(()=>{var we;return(we=H.value)==null?void 0:we.focus()})}}function Ha(C){Ne.value=C}function fa(C){lt.value+=1,s.value=C.text,i.value=C.imageUrls.map((E,Q)=>({id:`queued-${Date.now()}-${Q}-${Math.random().toString(36).slice(2,8)}`,name:`${a("Image")} ${Q+1}`,url:E})),l.value=C.skills.map(E=>(o.skills??[]).find(Q=>Q.path===E.path)??{name:E.name,displayName:void 0,description:"",path:E.path}),d.value=C.fileAttachments.map(E=>({...E})),c.value=[],v.value="",b.value=null,f.value=0,le.value=!1,no(),wo(),ue+=1}function pa(){fa({text:"",imageUrls:[],fileAttachments:[],skills:[]}),Ae.value=!1}function ar(C){return`${y1}${C}`}function Ur(C){if(typeof window>"u")return null;const E=C.trim();if(!E)return null;try{const Q=window.localStorage.getItem(ar(E));if(!Q)return null;const we=JSON.parse(Q);return typeof we=="string"?{text:we,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof we.text=="string"?we.text:"",imageUrls:Array.isArray(we.imageUrls)?we.imageUrls.filter(ct=>typeof ct=="string"):[],fileAttachments:Array.isArray(we.fileAttachments)?we.fileAttachments.filter(ct=>!!ct&&typeof ct.label=="string"&&typeof ct.path=="string"&&typeof ct.fsPath=="string"):[],skills:Array.isArray(we.skills)?we.skills.filter(ct=>!!ct&&typeof ct.name=="string"&&typeof ct.path=="string"):[]}}catch{return null}}function zr(C,E){if(typeof window>"u")return;const Q=C.trim();if(Q)try{if(E.text.trim().length>0||E.imageUrls.length>0||E.fileAttachments.length>0||E.skills.length>0){window.localStorage.setItem(ar(Q),JSON.stringify(E));return}window.localStorage.removeItem(ar(Q))}catch{}}function Ps(C){zr(C,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function qa(){return{text:s.value,imageUrls:i.value.map(C=>C.url),fileAttachments:d.value.map(C=>({...C})),skills:l.value.map(C=>({name:C.name,path:C.path}))}}function Wa(){r("interrupt")}function Uo(){const C=H.value;if(!C){Fe.value=!1;return}Fe.value=C.scrollHeight>C.clientHeight+2}function sr(){Ke||(Ke=!0,Nt(()=>{Ke=!1,Uo()}))}function Zn(){ke.value||(Ae.value=!Ae.value,sr(),Nt(()=>{var C;return(C=H.value)==null?void 0:C.focus()}))}function Rs(C){r("update:selected-model",C)}function ha(C){if(C===o.selectedCollaborationMode){W.value=!1;return}r("update:selected-collaboration-mode",C),W.value=!1}function Es(C){if(C===o.selectedCollaborationMode){le.value=!1;return}r("update:selected-collaboration-mode",C),le.value=!1}function zo(C){r("update:selected-reasoning-effort",C)}function Po(C){o.approvalPolicy===C||o.isApprovalPolicySaving===!0||(r("update:approval-policy",C),r("save-approval-policy"))}function Dn(){o.dictationClickToToggle}function Ga(){ke.value||(le.value=!le.value,W.value=!1,he.value=!1)}function Ms(){me.value||(W.value=!W.value,le.value=!1,he.value=!1)}function vt(){me.value||(he.value=!he.value,le.value=!1,W.value=!1)}function Ct(){var C;(C=L.value)==null||C.click()}function kt(){var C;(C=j.value)==null||C.click()}function mn(){var C;(C=U.value)==null||C.click()}function Fn(C){const E=i.value.find(Q=>Q.id===C);if(E&&xt(E.url)){const Q=eo(E.url);Q&&Hr(Q)}i.value=i.value.filter(Q=>Q.id!==C)}function ho(C){l.value=l.value.filter(E=>E.path!==C)}function Hr(C){d.value=d.value.filter(E=>E.fsPath!==C)}function qr(C){const E=c.value.find(we=>we.id===C);if(!E)return;const Q=new Set(E.filePaths);d.value=d.value.filter(we=>!Q.has(we.fsPath)),c.value=c.value.filter(we=>we.id!==C)}function mo(C,E){const Q=C.replace(/\\/g,"/");if(d.value.some(_t=>_t.fsPath===Q))return;const we=Q.split("/").filter(Boolean),ct=(E==null?void 0:E.trim())||we[we.length-1]||Q;d.value=[...d.value,{label:ct,path:Q,fsPath:Q}]}function Ho(C){return C.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(C.name)}const Ro=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function Bn(C){return C.type.startsWith("video/")?!0:Ro.test(C.name)}function xt(C){const E=C.trim();if(!E)return!1;if(E.startsWith("data:video/"))return!0;try{const Q=new URL(E,window.location.href);return Ro.test(Q.pathname)?!0:Q.pathname==="/codex-local-image"?Ro.test(Q.searchParams.get("path")??""):!1}catch{return Ro.test(E)}}function eo(C){try{const E=new URL(C,window.location.href);return E.pathname!=="/codex-local-image"?"":decodeURIComponent(E.searchParams.get("path")??"").replace(/\\/g,"/")}catch{return""}}function vo(C){return C?Array.from(C):[]}function Eo(C){return C!==ue?!1:(f.value+=1,!0)}function Mo(C){C===ue&&(f.value=Math.max(0,f.value-1))}function en(C){if(C<=0)return;const E=b.value,Q=E?E.succeeded+E.failed:0;if(!E||Q>=E.total){b.value={total:C,succeeded:0,failed:0};return}b.value={...E,total:E.total+C}}function Un(C){const E=b.value;E&&(b.value={...E,succeeded:E.succeeded+(C==="success"?1:0),failed:E.failed+(C==="failure"?1:0)})}function ir(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function lr(C){const E=new Date,Q=[E.getFullYear(),String(E.getMonth()+1).padStart(2,"0"),String(E.getDate()).padStart(2,"0"),String(E.getHours()).padStart(2,"0"),String(E.getMinutes()).padStart(2,"0"),String(E.getSeconds()).padStart(2,"0")].join("-"),we=C.type.startsWith("image/")&&C.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${Q}.${we}`}function bn(){const C=new Date;return`pasted-text-${[C.getFullYear(),String(C.getMonth()+1).padStart(2,"0"),String(C.getDate()).padStart(2,"0"),String(C.getHours()).padStart(2,"0"),String(C.getMinutes()).padStart(2,"0"),String(C.getSeconds()).padStart(2,"0")].join("-")}.txt`}function ma(C){return C.name.trim()?C:new File([C],lr(C),{type:C.type||"image/png",lastModified:Date.now()})}async function tn(C,E){if(Eo(E))try{const Q=ma(C),we=await wu(Q);if(E!==ue)return;if(!we){Un("failure");return}i.value=[...i.value,{id:ir(),name:Q.name,url:`/codex-local-image?path=${encodeURIComponent(we)}`}],Un("success")}catch{E===ue&&Un("failure")}finally{Mo(E)}}async function Wr(C,E){if(Eo(E))try{const Q=await wu(C);if(E!==ue)return;if(!Q){Un("failure");return}mo(Q),Un("success")}catch{E===ue&&Un("failure")}finally{Mo(E)}}async function go(C,E){if(Eo(E))try{const Q=ma(C),we=await wu(Q);if(E!==ue)return;if(!we){Un("failure");return}const ct=we.replace(/\\/g,"/");i.value=[...i.value,{id:ir(),name:Q.name,url:`/codex-local-image?path=${encodeURIComponent(ct)}`}],mo(ct),Un("success")}catch{E===ue&&Un("failure")}finally{Mo(E)}}function Lt(C){const E=vo(C);if(E.length===0)return;en(E.length),le.value=!1,no();const Q=ue;for(const we of E)Ho(we)?tn(we,Q):Bn(we)?go(we,Q):Wr(we,Q)}function zn(){oe=0,y.value=!1}function sn(C){return C?Array.from(C.types??[]).includes("Files"):!1}async function to(C){if(!C||C.length===0)return;const E=lt.value,Q=Array.from(C),ct=(Q[0].webkitRelativePath||Q[0].name).split("/").filter(Boolean)[0]||"Folder",_t=`${Date.now()}-${Math.random().toString(36).slice(2)}`;c.value=[...c.value,{id:_t,name:ct,total:Q.length,processed:0,filePaths:[],isUploading:!0}];const _n=Kt=>{E===lt.value&&(c.value=c.value.map(Pn=>Pn.id===_t?Kt(Pn):Pn))};for(const Kt of Q)try{const Pn=await wu(Kt);if(E!==lt.value)return;if(Pn){const Wt=Kt.webkitRelativePath||Kt.name;mo(Pn,Wt),_n(vn=>({...vn,processed:vn.processed+1,filePaths:[...vn.filePaths,Pn]}));continue}_n(Wt=>({...Wt,processed:Wt.processed+1}))}catch{_n(Pn=>({...Pn,processed:Pn.processed+1}))}_n(Kt=>({...Kt,isUploading:!1}))}function nn(C){C&&(C.value="")}function Va(C){const E=C.target;Lt((E==null?void 0:E.files)??null),nn(E),le.value=!1}function on(C){const E=C.target;Lt((E==null?void 0:E.files)??null),nn(E),le.value=!1}function qo(C){const E=C.target;to((E==null?void 0:E.files)??null),nn(E),le.value=!1}function ur(C){ke.value||!sn(C.dataTransfer)||(C.preventDefault(),oe+=1,y.value=!0)}function Ht(C){ke.value||!sn(C.dataTransfer)||(C.preventDefault(),C.dataTransfer&&(C.dataTransfer.dropEffect="copy"),y.value=!0)}function js(C){y.value&&(C.preventDefault(),oe=Math.max(0,oe-1),oe===0&&zn())}function Gr(C){var E;ke.value||!sn(C.dataTransfer)||(C.preventDefault(),zn(),Lt(((E=C.dataTransfer)==null?void 0:E.files)??null))}function Wo(){!y.value&&oe===0||zn()}function yo(C){var _t,_n;if(ke.value)return;const E=((_t=C.clipboardData)==null?void 0:_t.getData("text/plain"))??"";if(E.length>=g1){C.preventDefault();const Kt=new File([E],bn(),{type:"text/plain",lastModified:Date.now()});Lt([Kt]);return}const Q=Array.from(((_n=C.clipboardData)==null?void 0:_n.items)??[]);if(Q.length===0)return;const we=E.length>0,ct=Q.filter(Kt=>Kt.kind==="file"&&Kt.type.startsWith("image/")).map(Kt=>Kt.getAsFile()).filter(Kt=>Kt instanceof File);ct.length!==0&&(we||C.preventDefault(),Lt(ct))}function qt(){v.value&&(v.value=""),sr(),Ya(),Vr()}function Ka(C){if(C.isComposing||C.keyCode===229)return;if(Y.value){if(C.key==="Escape"){C.preventDefault(),no();return}if(C.key==="ArrowDown"){C.preventDefault(),ye.value.length>0&&(pe.value=(pe.value+1)%ye.value.length);return}if(C.key==="ArrowUp"){if(C.preventDefault(),ye.value.length>0){const Q=ye.value.length;pe.value=(pe.value+Q-1)%Q}return}if(C.key==="Enter"||C.key==="Tab"){C.preventDefault();const Q=ye.value[pe.value];Q?oo(Q):no();return}}if(ne.value){if(C.key==="Escape"){C.preventDefault(),wo();return}if(C.key==="ArrowDown"){C.preventDefault(),de.value.length>0&&(te.value=(te.value+1)%de.value.length);return}if(C.key==="ArrowUp"){if(C.preventDefault(),de.value.length>0){const Q=de.value.length;te.value=(te.value+Q-1)%Q}return}if(C.key==="Enter"||C.key==="Tab"){C.preventDefault();const Q=de.value[te.value];Q?bo(Q):wo();return}}if(o.sendWithEnter!==!1?C.key==="Enter"&&!C.shiftKey:C.key==="Enter"&&(C.metaKey||C.ctrlKey)){C.preventDefault(),zt(o.isTurnInProgress?Ne.value:"steer");return}}function no(){if(Y.value=!1,Se.value=null,Pe.value="",ye.value=[],pe.value=0,N=!1,fe){const C=fe;fe="",Px(C)}}function Ya(){const C=H.value;if(!C){no();return}const E=C.selectionStart??s.value.length,we=s.value.slice(0,E).match(/(^|\s)(@[^\s@]*)$/);if(!we){no();return}const ct=we[2]??"",_t=ct.length,_n=E-_t;ne.value&&wo(),Se.value=_n,Pe.value=ct.slice(1),Y.value=!0,jo()}function wo(){ne.value=!1,xe.value=null,$e.value="",te.value=0,de.value=Le.value}function Vr(){const C=H.value;if(!C){wo();return}const E=C.selectionStart??s.value.length,Q=s.value.slice(0,E),we=PM(Q);if(!we){wo();return}Y.value&&no(),xe.value=we.startIndex,$e.value=we.query,de.value=RM(Le.value,we.query),te.value=0,ne.value=!0}function bo(C){const E=H.value,Q=xe.value;if(Q!==null&&E){const we=E.selectionStart??s.value.length;s.value=`${s.value.slice(0,Q)}${s.value.slice(we)}`}if(wo(),C.kind==="skill"){const we=(o.skills??[]).find(_t=>_t.path===C.skillPath||_t.name===C.id);we&&!l.value.some(_t=>_t.path===we.path)&&(l.value=[...l.value,{...we}]);const ct=s.value.trim();s.value=ct.length>0?`${ct} (Use the ${C.id} skill.)`:`Use the ${C.id} skill.`,Nt(()=>{E==null||E.focus(),Uo()});return}if(C.kind==="rpc"){r("slash-command",C.id);return}C.kind==="text"&&C.insertText&&(s.value=s.value.trimEnd(),s.value=s.value.length>0?`${s.value} ${C.insertText}`:C.insertText),C.kind==="local"&&C.id==="clear"&&(s.value=""),Nt(()=>{E==null||E.focus(),Uo()})}async function jo(){if(!Y.value)return;const C=(o.cwd??"").trim();if(!C){ye.value=[],N=!0;return}N=!1,ut&&clearTimeout(ut);const E=++Ze;ut=setTimeout(async()=>{const Q=`composer-${E}`,we=Pe.value;try{if(fe||(await Ax([C],Q),fe=Q,r("register-fuzzy-session",Q)),await _x(fe,we),!Y.value||E!==Ze)return;if(ye.value=(o.fuzzyFileSearchResults??[]).map(ct=>({path:ct.path})),pe.value=0,ye.value.length===0)try{const ct=await Yh(C,we,20);if(!Y.value||E!==Ze)return;ye.value=ct,pe.value=0}catch{if(!Y.value||E!==Ze)return;ye.value=[]}}catch{if(!Y.value||E!==Ze)return;fe="";try{const ct=await Yh(C,we,20);if(!Y.value||E!==Ze)return;ye.value=ct,pe.value=0}catch{if(!Y.value||E!==Ze)return;ye.value=[]}}},120)}function oo(C){const E=H.value,Q=Se.value;if(Q!==null&&E){const we=E.selectionStart??s.value.length;s.value=`${s.value.slice(0,Q)}${s.value.slice(we)}`.trimEnd()}mo(C.path),no(),Nt(()=>E==null?void 0:E.focus())}function cr(C){B(),fa(C),Nt(()=>{var E;(E=H.value)==null||E.focus(),Uo()})}function St(C){const E=C.trim();E&&(s.value=s.value.trim()?`${s.value.trim()}
|
|
61
|
+
${E}`:E,Nt(()=>{var Q;(Q=H.value)==null||Q.focus(),Uo()}))}function ln(C){const E=C.lastIndexOf("/");return E<0?C:C.slice(E+1)}function In(C){const E=C.lastIndexOf("/");return E<=0?"":C.slice(0,E)}function dr(C){const E=ln(C),Q=E.lastIndexOf(".");return Q<=0?"":E.slice(Q+1).toLowerCase()}function An(C){const E=dr(C);return E==="ts"?"TS":E==="tsx"?"TSX":E==="js"?"JS":E==="jsx"?"JSX":E==="json"?"{}":""}function Kr(C){const E=dr(C);return E.startsWith("ts")?"ts":E.startsWith("js")?"js":E==="json"?"json":"default"}function fr(C){const E=dr(C);return E==="md"||E==="mdx"}function dn(C){if(!le.value&&!W.value&&!he.value)return;const E=C.target;E&&(typeof E.closest=="function"&&E.closest(".composer-popover-anchor")||(le.value=!1,W.value=!1,he.value=!1))}return pi(()=>{document.addEventListener("click",dn),window.addEventListener("drop",Wo),window.addEventListener("dragend",Wo),window.addEventListener("blur",Wo),sr()}),t({hydrateDraft:cr,appendTextToDraft:St,hasUnsavedDraft:()=>je.value}),_s(()=>{document.removeEventListener("click",dn),window.removeEventListener("drop",Wo),window.removeEventListener("dragend",Wo),window.removeEventListener("blur",Wo),window.removeEventListener("pointerup",Dn),window.removeEventListener("pointercancel",Dn),window.removeEventListener("blur",Dn),ut&&clearTimeout(ut)}),tt(()=>o.activeThreadId,C=>{B(),Be&&zr(Be,qa()),pa();const E=Ur(C);E&&(fa(E),qt()),Be=C.trim()},{immediate:!0}),tt([s,i,d,l],()=>{Be&&zr(Be,qa())},{deep:!0}),tt(s,()=>{sr()}),tt(()=>o.cwd,()=>{Y.value&&jo()}),tt(()=>o.fuzzyFileSearchResults,C=>{!Y.value||!fe||(ye.value=(C??[]).map(E=>({path:E.path})),pe.value=0)}),tt(Ve,C=>{Ne.value=C}),(C,E)=>(_(),F("form",{class:"thread-composer",onSubmit:E[6]||(E[6]=gt(Q=>zt(e.isTurnInProgress?Ne.value:"steer"),["prevent"]))},[w("div",{class:at(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":y.value}])},[e.planPanel?(_(),Qe(UE,{key:0,"plan-panel":e.planPanel,onImplementPlan:E[0]||(E[0]=Q=>C.$emit("implement-plan"))},null,8,["plan-panel"])):ve("",!0),Oe(oM,{"selected-images":i.value,"folder-upload-groups":c.value,"standalone-file-attachments":Re.value,"selected-skills":l.value,"is-interaction-disabled":ke.value,onRemoveImage:Fn,onRemoveFolder:qr,onRemoveFile:Hr,onRemoveSkill:ho},null,8,["selected-images","folder-upload-groups","standalone-file-attachments","selected-skills","is-interaction-disabled"]),w("div",EM,[w("div",MM,[w("div",{class:at(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":y.value,"thread-composer-input-wrap--expanded":Ae.value}]),onDragenter:ur,onDragover:Ht,onDragleave:js,onDrop:Gr},[y.value?(_(),F("div",jM,[w("span",LM,D(m(a)("Drop images or files")),1)])):ve("",!0),Y.value?(_(),F("div",NM,[ye.value.length>0?(_(!0),F(ot,{key:0},Zt(ye.value,(Q,we)=>(_(),F("button",{key:Q.path,class:at(["thread-composer-file-mention-row",{"is-active":we===pe.value}]),type:"button",onMousedown:gt(ct=>oo(Q),["prevent"])},[An(Q.path)?(_(),F("span",{key:0,class:at(["thread-composer-file-mention-icon-badge",`is-${Kr(Q.path)}`])},D(An(Q.path)),3)):fr(Q.path)?(_(),F("span",OM,"↓")):(_(),Qe(el,{key:2,class:"thread-composer-file-mention-icon-file"})),w("span",DM,[w("span",FM,D(ln(Q.path)),1),In(Q.path)?(_(),F("span",BM,D(In(Q.path)),1)):ve("",!0)])],42,$M))),128)):m(N)?(_(),F("div",UM,D(m(a)("No searchable directory for this thread")),1)):(_(),F("div",zM,D(m(a)("No matching files")),1))])):ve("",!0),ne.value?(_(),Qe(mE,{key:2,commands:de.value,"highlighted-index":te.value,onSelect:bo},null,8,["commands","highlighted-index"])):ve("",!0),xn(w("textarea",{ref_key:"inputRef",ref:H,"onUpdate:modelValue":E[1]||(E[1]=Q=>s.value=Q),class:"thread-composer-input",placeholder:Ue.value,disabled:ke.value,onInput:qt,onKeydown:Ka,onPaste:yo},null,40,HM),[[Nn,s.value]]),st.value?(_(),F("button",{key:3,class:"thread-composer-expand",type:"button","aria-label":Ae.value?m(a)("Exit full screen composer"):m(a)("Expand composer"),title:Ae.value?m(a)("Exit full screen composer"):m(a)("Expand composer"),disabled:ke.value,onClick:Zn},[Ae.value?(_(),Qe(VR,{key:0,class:"thread-composer-expand-icon"})):(_(),Qe(HR,{key:1,class:"thread-composer-expand-icon"}))],8,qM)):ve("",!0)],34),w("div",WM,[e.isTurnInProgress&&!Je.value?(_(),F("button",{key:0,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?m(a)("Saving thread before stop is available"):m(a)("Stop"),title:e.isStopPending?m(a)("Saving thread before stop is available"):m(a)("Stop"),disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending||e.externalSessionActive===!0,onClick:Wa},[e.isStopPending?(_(),F("span",VM)):(_(),Qe(QR,{key:1,class:"thread-composer-stop-icon"}))],8,GM)):(_(),F("button",{key:1,class:at(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&Ne.value==="queue"}]),type:"button","aria-label":e.isCompacting?m(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress&&Ne.value==="queue"?m(a)("Queue message"):m(a)("Send message"),title:e.isCompacting?m(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress?`${m(a)("Send")} ${Ne.value==="queue"?m(a)("Queue"):m(a)("Steer")}`:m(a)("Send"),disabled:!re.value,onClick:E[2]||(E[2]=Q=>zt(e.isTurnInProgress?Ne.value:"steer"))},[Oe(FR,{class:"thread-composer-submit-icon"})],10,KM))])]),w("div",{class:at(["thread-composer-controls",{"thread-composer-controls--recording":He.value}])},[Oe(IM,{open:le.value,"is-mobile":m(be),"is-interaction-disabled":ke.value,"is-composer-config-disabled":me.value,"is-approval-policy-saving":e.isApprovalPolicySaving,"approval-policy":e.approvalPolicy,"approval-policy-error":e.approvalPolicyError,"approval-policy-notice":e.approvalPolicyNotice,"selected-collaboration-mode":e.selectedCollaborationMode,"collaboration-mode-choices":A.value,"approval-policy-choices":M,"active-in-progress-mode":Ne.value,"onUpdate:open":E[3]||(E[3]=Q=>le.value=Q),onToggle:Ga,onSetActiveMode:Ha,onSelectPhoto:Ct,onSelectFolder:mn,onCaptureCamera:kt,onSelectCollaborationMode:Es,onSelectApprovalPolicy:Po},null,8,["open","is-mobile","is-interaction-disabled","is-composer-config-disabled","is-approval-policy-saving","approval-policy","approval-policy-error","approval-policy-notice","selected-collaboration-mode","collaboration-mode-choices","active-in-progress-mode"]),m(be)?ve("",!0):(_(),Qe(Qu,{key:0,open:W.value,align:"start",width:"md","aria-label":m(a)("Plan mode"),"onUpdate:open":E[4]||(E[4]=Q=>W.value=Q)},{trigger:dt(()=>[w("button",{class:at(["thread-composer-plan-trigger",{"is-active":W.value}]),type:"button","aria-label":m(a)("Plan mode"),disabled:me.value,onClick:Ms},[w("span",JM,D(z.value),1),Oe(Cs,{class:"thread-composer-plan-trigger-chevron"})],10,YM)]),default:dt(()=>[(_(!0),F(ot,null,Zt(A.value,Q=>(_(),F("button",{key:Q.value,class:at(["thread-composer-menu-item",{"is-active":e.selectedCollaborationMode===Q.value}]),type:"button",role:"menuitemradio","aria-checked":e.selectedCollaborationMode===Q.value,disabled:Q.disabled||me.value,onClick:we=>ha(Q.value)},[w("span",XM,[w("span",ZM,D(m(a)(Q.labelKey)),1),Q.subLabel?(_(),F("span",e1,D(Q.subLabel),1)):ve("",!0),Q.disabled?(_(),F("span",t1,D(m(a)("Not supported by this Codex version")),1)):ve("",!0)]),e.selectedCollaborationMode===Q.value?(_(),F("span",n1,"✓")):ve("",!0)],10,QM))),128))]),_:1},8,["open","aria-label"])),m(be)?ve("",!0):(_(),Qe(Qu,{key:1,open:he.value,align:"center",width:"md","aria-label":m(a)("Approval policy"),"onUpdate:open":E[5]||(E[5]=Q=>he.value=Q)},{trigger:dt(()=>[w("button",{class:at(["thread-composer-approval-trigger",{"is-active":he.value}]),type:"button","aria-label":m(a)("Approval policy"),disabled:me.value,onClick:vt},[w("span",r1,D(Z.value),1),Oe(Cs,{class:"thread-composer-approval-trigger-chevron"})],10,o1)]),default:dt(()=>[(_(),F(ot,null,Zt(M,Q=>w("button",{key:Q.value,class:at(["thread-composer-menu-item",{"is-active":e.approvalPolicy===Q.value}]),type:"button",role:"menuitemradio","aria-checked":e.approvalPolicy===Q.value,disabled:e.isApprovalPolicySaving,onClick:we=>Po(Q.value)},[w("span",s1,[w("span",i1,D(m(a)(Q.label)),1)]),e.approvalPolicy===Q.value?(_(),F("span",l1,"✓")):ve("",!0)],10,a1)),64)),e.approvalPolicyError?(_(),F("p",u1,D(e.approvalPolicyError),1)):ve("",!0),Oe(Xl,{name:"approval-tip"},{default:dt(()=>[e.approvalPolicyNotice?(_(),F("span",c1,D(e.approvalPolicyNotice),1)):ve("",!0)]),_:1})]),_:1},8,["open","aria-label"])),Oe(aM,{models:e.models,"selected-model":e.selectedModel,"model-reasoning-efforts":e.modelReasoningEfforts,"selected-reasoning-effort":e.selectedReasoningEffort,"selected-speed-mode":e.selectedSpeedMode,disabled:e.disabled,"active-thread-id":e.activeThreadId,"onUpdate:selectedModel":Rs,"onUpdate:selectedReasoningEffort":zo},null,8,["models","selected-model","model-reasoning-efforts","selected-reasoning-effort","selected-speed-mode","disabled","active-thread-id"]),mt.value?(_(),F("button",{key:2,type:"button",class:at(["thread-composer-context-usage-inline",{"is-warning":_e.value==="warning","is-danger":_e.value==="danger"}]),title:ae.value,"aria-label":m(a)("Context"),onClick:Ye},[w("span",f1,D(q.value),1),_e.value!=="healthy"?(_(),F("span",p1,D(m(a)("Compact")),1)):ve("",!0)],10,d1)):ve("",!0)],2)])],2),w("input",{ref_key:"photoLibraryInputRef",ref:L,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:ke.value,onChange:Va},null,40,h1),w("input",{ref_key:"cameraCaptureInputRef",ref:j,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:ke.value,onChange:on},null,40,m1),w("input",{ref_key:"folderPickerInputRef",ref:U,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:ke.value,onChange:qo},null,40,v1)],32))}}),jm=It(w1,[["__scopeId","data-v-b91883d7"]]),b1=["aria-label"],T1=["aria-checked","onClick"],S1={class:"runtime-toggle-option-label"},C1=hn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:o}=da(),r=[{value:"local",label:o("Local project"),icon:Wf},{value:"worktree",label:o("New worktree"),icon:Ju}];function a(s){n("update:modelValue",s)}return(s,i)=>(_(),F("div",{class:"runtime-toggle",role:"radiogroup","aria-label":m(o)("Continue in")},[(_(),F(ot,null,Zt(r,l=>w("button",{key:l.value,class:at(["runtime-toggle-option",{"is-selected":e.modelValue===l.value}]),type:"button",role:"radio","aria-checked":e.modelValue===l.value,onClick:d=>a(l.value)},[(_(),Qe(_f(l.icon),{class:"runtime-toggle-option-icon"})),w("span",S1,D(l.label),1)],10,T1)),64))],8,b1))}}),x1=It(C1,[["__scopeId","data-v-4d282f1a"]]),k1={},I1={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 A1(e,t){return _(),F("svg",I1,[...t[0]||(t[0]=[w("path",{d:"M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12"},null,-1),w("path",{d:"M9 4l0 16"},null,-1)])])}const sy=It(k1,[["render",A1]]),_1={},P1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function R1(e,t){return _(),F("svg",P1,[...t[0]||(t[0]=[w("path",{d:"M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm12 -16h-8v14h8a1 1 0 0 0 1 -1v-12a1 1 0 0 0 -1 -1"},null,-1)])])}const E1=It(_1,[["render",R1]]),M1={class:"sidebar-thread-controls"},j1=["aria-label","title"],L1=["aria-label","title"],N1=hn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=da();return(n,o)=>(_(),F("div",M1,[w("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?m(t)("Expand sidebar"):m(t)("Collapse sidebar"),title:e.isSidebarCollapsed?m(t)("Expand sidebar"):m(t)("Collapse sidebar"),onClick:o[0]||(o[0]=r=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(_(),Qe(E1,{key:0,class:"sidebar-thread-controls-icon"})):(_(),Qe(sy,{key:1,class:"sidebar-thread-controls-icon"}))],8,j1),_o(n.$slots,"default",{},void 0),e.showNewThreadButton?(_(),F("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":m(t)("Start new thread"),title:m(t)("Start new thread"),onClick:o[1]||(o[1]=r=>n.$emit("start-new-thread"))},[Oe(el,{class:"sidebar-thread-controls-icon"})],8,L1)):ve("",!0)]))}}),Lm=It(N1,[["__scopeId","data-v-39c4ec05"]]),$1={},O1={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function D1(e,t){return _(),F("svg",O1,[...t[0]||(t[0]=[w("circle",{cx:"11",cy:"11",r:"8"},null,-1),w("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const Nm=It($1,[["render",D1]]),F1={},B1={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function U1(e,t){return _(),F("svg",B1,[...t[0]||(t[0]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065"}),w("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const z1=It(F1,[["render",U1]]),H1={},q1={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function W1(e,t){return _(),F("svg",q1,[...t[0]||(t[0]=[w("path",{d:"M5 7l5 5-5 5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),w("path",{d:"M12 17h7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])])}const G1=It(H1,[["render",W1]]),V1={},K1={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Y1(e,t){return _(),F("svg",K1,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 7a2 2 0 0 1 2-2h2.586A2 2 0 0 1 14 5.586L15.414 7H18a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2zm-4 4V5a2 2 0 0 1 2-2h2"},null,-1)])])}const $m=It(V1,[["render",Y1]]);function iy(e){var r;const t=e.replace(/\r\n/g,`
|
|
62
62
|
`).trim();if(!t)return null;const n=[],o=[];for(const a of t.split(`
|
|
63
63
|
`)){const s=a.trim();if(!s){n.length===0&&o.push("");continue}const i=s.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(i){const l=(i[1]??" ").toLowerCase();let d="pending";l==="x"&&(d="completed"),(l==="~"||l===">"||l==="-")&&(d="inProgress"),n.push({step:((r=i[2])==null?void 0:r.trim())??"",status:d});continue}o.push(s)}if(n.length===0){const a=J1(t);return a||null}return{explanation:o.join(`
|
|
64
64
|
`).trim(),steps:n.filter(a=>a.step.length>0)}}function J1(e){var a,s;const t=[],n=[],o=[];for(const i of e.split(`
|
|
@@ -71,13 +71,13 @@ ${E}`:E,Nt(()=>{var Q;(Q=H.value)==null||Q.focus(),Uo()}))}function ln(C){const
|
|
|
71
71
|
`).trim()}function gL(e){if(e.method!=="item/started"&&e.method!=="item/completed")return null;const t=qe(e.params),n=qe(t==null?void 0:t.item);if(!n||Me(n.type).toLowerCase()!=="reasoning")return null;const o=Me(n.id);return o?{itemId:o,text:vL(n)}:null}function yL(e){const t=qe(e.params);if(!t)return"";if(e.method==="item/started"){const n=qe(t.item);return!n||n.type!=="agentMessage"?"":Me(n.id)}return""}function wL(e){const t=qe(e.params);if(!t)return null;if(e.method==="item/agentMessage/delta"){const n=Me(t.itemId),o=Me(t.delta);if(!n||!o)return null;const r=Me(t.turnId)||Me(t.turn_id);return{messageId:n,delta:o,turnId:r||void 0}}return null}function bL(e){const t=qe(e.params);if(!t)return null;if(e.method==="item/completed"){const n=qe(t.item);if(!n||n.type!=="agentMessage")return null;const o=Me(n.id),r=Me(n.text);if(!o||!r)return null;const a=Me(t.turnId)||Me(t.turn_id);return{id:o,role:"assistant",text:r,messageType:"agentMessage",turnId:a||void 0}}return null}function TL(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function SL(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 CL(e){if(e.method!=="item/completed")return null;const t=qe(e.params),n=qe(t==null?void 0:t.item);if(!n)return null;const o=Me(n.id);if(!o)return null;if(n.type==="imageView"){const s=Me(n.path);return s?{id:o,role:"assistant",text:"",images:[TL(s)],messageType:"imageView"}:null}if(n.type!=="imageGeneration"&&n.type!=="image_generation")return null;const r=Me(n.result),a=r?SL(r):"";return a?{id:o,role:"assistant",text:"",images:[a],messageType:"imageView"}:null}function xL(e){if(e.method!=="item/commandExecution/outputDelta")return null;const t=qe(e.params);if(!t)return null;const n=Me(t.itemId),o=Me(t.delta);return!n||!o?null:{itemId:n,delta:o}}const Gi="__global__";function kL(e){return e==="item/commandExecution/requestApproval"||e==="item/fileChange/requestApproval"||e==="item/permissions/requestApproval"||e==="execCommandApproval"||e==="applyPatchApproval"}function Iy(e){const t=qe(e);if(!t)return null;const n=t.id,o=Me(t.method),r=t.params;if(typeof n!="number"||!Number.isInteger(n)||!o)return null;const a=qe(r),s=IL(o,a),i=Me(a==null?void 0:a.threadId)||Me(a==null?void 0:a.thread_id)||Me(a==null?void 0:a.conversationId)||Me(a==null?void 0:a.conversation_id)||Gi,l=Me(a==null?void 0:a.turnId)||Me(a==null?void 0:a.turn_id),d=Me(a==null?void 0:a.itemId)||Me(a==null?void 0:a.item_id)||Me(a==null?void 0:a.callId)||Me(a==null?void 0:a.call_id),c=Me(t.receivedAtIso)||new Date().toISOString();return{id:n,method:s,threadId:i,turnId:l,itemId:d,receivedAtIso:c,params:r??null}}function IL(e,t){const n=e.trim();return n&&(n==="item/commandExecution/requestApproval"||n==="execCommandApproval"||n==="exec_approval_request"||AL(t)?"item/commandExecution/requestApproval":n==="item/fileChange/requestApproval"||n==="applyPatchApproval"||n==="apply_patch_approval_request"||_L(t)?"item/fileChange/requestApproval":n==="item/tool/requestUserInput"||n==="request_user_input"||PL(t)?"item/tool/requestUserInput":n==="mcpServer/elicitation/request"||n==="elicitation_request"||EL(t)?"mcpServer/elicitation/request":n==="item/permissions/requestApproval"||ML(t)?"item/permissions/requestApproval":n==="item/tool/call"||n==="dynamic_tool_call_request"||RL(t)?"item/tool/call":n)}function AL(e){if(!e)return!1;const t=e.command;return Array.isArray(t)&&t.some(n=>typeof n=="string"&&n.trim().length>0)||typeof t=="string"&&t.trim().length>0?!0:Array.isArray(e.commandActions)}function _L(e){return e?typeof e.grantRoot=="string"&&e.grantRoot.trim().length>0||typeof e.grant_root=="string"&&e.grant_root.trim().length>0||qe(e.fileChanges)?!0:qe(e.changes)!==null:!1}function PL(e){return!!(e&&Array.isArray(e.questions))}function RL(e){return e?typeof e.toolName=="string"||typeof e.tool_name=="string"||typeof e.name=="string"||Array.isArray(e.arguments):!1}function EL(e){if(!e)return!1;const t=Me(e.mode);return typeof e.serverName=="string"&&typeof e.threadId=="string"&&typeof e.message=="string"&&(t==="form"||t==="url")}function ML(e){return e?typeof e.threadId=="string"&&typeof e.turnId=="string"&&typeof e.itemId=="string"&&qe(e.permissions)!==null:!1}function jL(e){if(e.method!=="item/tool/requestUserInput")return[];const t=qe(e.params),n=Array.isArray(t==null?void 0:t.questions)?t.questions:[],o=[];for(const r of n){const a=qe(r),s=Me(a==null?void 0:a.id).trim();s&&o.push(s)}return o}function LL(e,t){const n=t.threadId||Gi,o=e.pendingServerRequestsByThreadId.value[n]??[],r=o.findIndex(s=>s.id===t.id),a=[...o];r>=0?a.splice(r,1,t):a.push(t),e.pendingServerRequestsByThreadId.value={...e.pendingServerRequestsByThreadId.value,[n]:a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso))},e.applyThreadFlags()}function NL(e,t){const n={};for(const[o,r]of Object.entries(e.pendingServerRequestsByThreadId.value)){const a=r.filter(s=>s.id!==t);a.length>0&&(n[o]=a)}e.pendingServerRequestsByThreadId.value=n,e.pendingReplyErrorByRequestId.value[String(t)]&&(e.pendingReplyErrorByRequestId.value=yt(e.pendingReplyErrorByRequestId.value,String(t))),e.applyThreadFlags()}function $L(e,t){return e.pendingReplyErrorByRequestId.value[String(t)]??""}function OL(e,t){const n={},o=new Set;for(const a of t){const s=a.threadId||Gi,i=n[s]??[];i.push(a),n[s]=i,o.add(a.id)}for(const a of Object.values(n))a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso));e.pendingServerRequestsByThreadId.value=n;const r={};for(const[a,s]of Object.entries(e.pendingReplyErrorByRequestId.value))o.has(Number(a))&&(r[a]=s);e.pendingReplyErrorByRequestId.value=r}function Ay(e,t,n){const o=e.liveAgentMessagesByThreadId.value[t]??[];nl(o,n)||(e.liveAgentMessagesByThreadId.value={...e.liveAgentMessagesByThreadId.value,[t]:n})}function DL(e,t){t&&t in e.liveAgentMessagesByThreadId.value&&(e.liveAgentMessagesByThreadId.value=yt(e.liveAgentMessagesByThreadId.value,t))}function FL(e,t,n){const o=e.livePlanMessagesByThreadId.value[t]??[];nl(o,n)||(e.livePlanMessagesByThreadId.value={...e.livePlanMessagesByThreadId.value,[t]:n})}function BL(e,t,n){!t||!n||(e.lastPlanByThreadId.value={...e.lastPlanByThreadId.value,[t]:n},ky(e.lastPlanByThreadId.value))}function UL(e,t,n){const o=e.livePlanMessagesByThreadId.value[t]??[],r=wc(o,n);FL(e,t,r),BL(e,t,n)}function zL(e,t,n){const o=e.liveFileChangeMessagesByThreadId.value[t]??[],r=wc(o,n);Kf(e,t,r)}function HL(e,t,n){const o=e.liveAgentMessagesByThreadId.value[t]??[];let r=wc(o,n);const a=Ua(n.text);if(n.role==="assistant"&&a.length>0){const s=r.filter(i=>i.id===n.id||Ua(i.text)!==a);s.length!==r.length&&(r=s)}Ay(e,t,r)}function Kf(e,t,n){const o=e.liveFileChangeMessagesByThreadId.value[t]??[];nl(o,n)||(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:n})}function qL(e,t,n){const o=e.liveCommandsByThreadId.value[t]??[],r=wc(o,n);r!==o&&(e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:r})}function WL(e,t,n){const o=e.liveCommandsByThreadId.value[t];if(!o||o.length===0)return;const r=new Set(n.map(s=>s.id)),a=o.filter(s=>!r.has(s.id));a.length!==o.length&&(a.length===0?e.liveCommandsByThreadId.value=yt(e.liveCommandsByThreadId.value,t):e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:a})}function GL(e,t,n){const o=e.liveFileChangeMessagesByThreadId.value[t];if(!o||o.length===0)return;const r=new Set(n.map(l=>l.id)),a=new Set(n.filter(l=>l.messageType==="fileChange"&&typeof l.turnId=="string"&&l.turnId.length>0).map(l=>l.turnId)),s=new Set(n.filter(l=>l.messageType==="fileChange"&&typeof l.turnIndex=="number").map(l=>l.turnIndex)),i=o.filter(l=>!r.has(l.id)&&!(l.turnId&&a.has(l.turnId))&&!(typeof l.turnIndex=="number"&&s.has(l.turnIndex)));i.length!==o.length&&(i.length===0?e.liveFileChangeMessagesByThreadId.value=yt(e.liveFileChangeMessagesByThreadId.value,t):e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:i})}function VL(e,t,n,o){if(!t||!n)return;const r=e.liveFileChangeMessagesByThreadId.value[t];if(!r)return;const a=r.findIndex(i=>i.id===n||i.turnId===n);if(a<0)return;const s=[...r];s[a]={...s[a],fileChanges:o},Kf(e,t,s)}function KL(e,t,n,o){if(!t||!n)return;const r=e.liveFileChangeMessagesByThreadId.value[t];if(!r)return;const a=r.findIndex(l=>l.turnId===n);if(a<0)return;const s=[...r],i=s[a];s[a]={...i,fileChanges:(i.fileChanges??[]).map(l=>({...l,diff:o}))},Kf(e,t,s)}function YL(e,t){const n=e.persistedMessagesByThreadId.value[t]??[];let o=-1;for(const r of n)typeof r.turnIndex=="number"&&Number.isFinite(r.turnIndex)&&(o=Math.max(o,r.turnIndex));return o+1}function JL(e,t,n,o){if(!t||!n||!Number.isInteger(o)||o<0)return;const r=e.turnIndexByTurnIdByThreadId.value[t]??{};r[n]!==o&&(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...r,[n]:o}})}function QL(e,t,n){const o=e.turnIndexByTurnIdByThreadId.value[t]??{},r=Object.entries(o),a=Object.entries(n);r.length===a.length&&r.every(([s,i])=>n[s]===i)||(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...n}})}function XL(e,t,n){var r;if(!t||!n)return;const o=(r=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:r[n];return typeof o=="number"?o:void 0}function ZL(e,t){const n=e.liveFileChangeMessagesByThreadId.value[t];if(!n||n.length===0)return;const o=e.turnIndexByTurnIdByThreadId.value[t]??{};let r=!1;const a=n.map(s=>{if(typeof s.turnIndex=="number"||!s.turnId)return s;const i=o[s.turnId];return typeof i!="number"?s:(r=!0,{...s,turnIndex:i})});r&&(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:a})}const Km=8e3,eN=1500,tN=15*60*1e3;function nN(e){let t=qj(),n=!1,o=null;function r(){o===null&&(o=setTimeout(()=>{if(o=null,n&&(n=!1,typeof window<"u"))try{window.localStorage.setItem(by,JSON.stringify(t))}catch{}n&&r()},eN))}function a(c,v){if(!c||e.inProgressById.value[c]!==!0)return;const f=v.length>Km?v.slice(-Km):v;t[c]={text:f,ts:Date.now()},n=!0,r()}function s(c,v){if(!c)return;const f=v.trim(),b=e.liveReasoningTextByThreadId.value[c]??"";if(f.length===0){if(!b)return;e.liveReasoningTextByThreadId.value=yt(e.liveReasoningTextByThreadId.value,c);return}b!==f&&(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[c]:f},a(c,f))}function i(c,v){if(!c)return;const f=e.liveReasoningTextByThreadId.value[c]??"";s(c,`${f}${v}`)}function l(c){var b;if(!c||((b=e.liveReasoningTextByThreadId.value[c])==null?void 0:b.trim()))return;const f=t[c];f!=null&&f.text&&(Date.now()-f.ts>tN||(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[c]:f.text}))}function d(c){c&&c in t&&(delete t[c],n=!0,r())}return{setLiveReasoningText:s,appendLiveReasoningText:i,restoreLiveReasoningSnapshot:l,clearLiveReasoningSnapshot:d}}function oN(e,t){if(!t)return;const n=e.activeTurnIdByThreadId.value[t]??"";n&&e.activeReasoningTurnIdByThreadId.set(t,n)}function rN(e,t,n=!1){var l;if(!t)return;const o=e.liveReasoningTextByThreadId.value[t];if(o===void 0){n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear());return}const r=e.activeReasoningTurnIdByThreadId.get(t)??e.activeTurnIdByThreadId.value[t]??"";e.activeReasoningTurnIdByThreadId.delete(t);const a=r?(l=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:l[r]:void 0,s=uN(e,t),i=r||void 0;s.length>0?sN(e,t,s,i,a):n||aN(e,t,o,i,a),e.liveReasoningTextByThreadId.value=yt(e.liveReasoningTextByThreadId.value,t),n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear(),e.clearLiveReasoningSnapshot(t))}function aN(e,t,n,o,r){if(!t)return;const a=n.trim();if(!a)return;const s=e.persistedReasoningByThreadId.value[t]??[];if(s.some(d=>d.text===a))return;const i={id:`reasoning:local:${t}:${Date.now()}`,role:"system",text:a,messageType:"reasoning",reasoning:{summary:[],content:[a]},turnId:o||void 0,turnIndex:typeof r=="number"?r:void 0},l=[...s,i].slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:l},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function sN(e,t,n,o,r){if(!t||n.length===0)return;const s=[...e.persistedReasoningByThreadId.value[t]??[]];for(const l of n){const d=l.text.trim();if(!d)continue;const c=`reasoning:item:${t}:${l.itemId}`,v=s.findIndex(f=>f.id===c);if(v>=0){const f=s[v],b=l.anchorMessageId||f.reasoningAnchorMessageId,y=typeof r=="number"?r:f.turnIndex;if(f.text===d&&f.turnIndex===y&&f.reasoningAnchorMessageId===b)continue;s[v]={...f,text:d,reasoning:{summary:[],content:[d]},turnId:o||f.turnId,turnIndex:y,reasoningAnchorMessageId:b};continue}s.some(f=>f.text===d)||s.push({id:c,role:"system",text:d,messageType:"reasoning",reasoning:{summary:[],content:[d]},turnId:o||void 0,turnIndex:typeof r=="number"?r:void 0,reasoningAnchorMessageId:l.anchorMessageId||void 0})}const i=s.slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:i},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function iN(e,t,n,o){if(!t||!o)return;o.trim()&&e.reasoningItemTextByItemId.set(n,o.trim());const r=e.liveReasoningTextByThreadId.value[t]??"",a=e.reasoningAppendedTextByItemId.get(n)??"";if(r.endsWith(o)||a&&o===a){e.reasoningAppendedTextByItemId.set(n,o);return}if(a&&o.startsWith(a)){const i=o.slice(a.length);i&&e.appendLiveReasoningText(t,i),e.reasoningAppendedTextByItemId.set(n,o);return}const s=r.length>0&&!r.endsWith(`
|
|
72
72
|
`)?`
|
|
73
73
|
|
|
74
|
-
`:"";e.appendLiveReasoningText(t,`${s}${o}`),e.reasoningAppendedTextByItemId.set(n,o)}function lN(e,t){const n=qe(t.params);if(!n)return;const o=t.method==="item/started"||t.method==="item/completed",r=t.method==="item/reasoning/textDelta"||t.method==="item/reasoning/summaryTextDelta";if(!o&&!r)return;const a=qe(n.item),s=Me(r?n.itemId:a==null?void 0:a.id);if(!s)return;const i=Ln(t);if(!i)return;const l=r||Me(a==null?void 0:a.type).toLowerCase()==="reasoning"?"reasoning":"other",d=e.turnItemSequenceByThreadId.get(i)??[];d.some(c=>c.itemId===s)||e.turnItemSequenceByThreadId.set(i,[...d,{itemId:s,kind:l}])}function uN(e,t){var a;const n=e.turnItemSequenceByThreadId.get(t)??[],o=[];let r="";for(const s of n)if(s.kind==="reasoning"){const i=((a=e.reasoningItemTextByItemId.get(s.itemId))==null?void 0:a.trim())??"";i&&o.push({text:i,anchorMessageId:r,itemId:s.itemId})}else r=s.itemId;return o}function cN(e,t,n){if(!t||!n)return;const o=e.reasoningItemTextByItemId.get(t)??"";o.endsWith(n)||e.reasoningItemTextByItemId.set(t,`${o}${n}`)}function Ym(e){e.reasoningItemTextByItemId.clear()}const Pr="gpt-5.4-mini",_y="Codex CLI not found. Install @openai/codex or set CODEXUI_CODEX_COMMAND.",dN="big-pickle",fN=Ng;function pN(e){const t=S([]),n=S({}),o=S({}),r=S(Gj()),a=S(Dm(r.value,e.selectedThreadId.value)),s=S("medium"),i=S("standard"),l=S(""),d=S(""),c=S(!1),v=S({});let f=!1;function b(te){if(di(te)===Is){const Le=ms(l.value),Ae=xu(Le),Fe=Ae?tl(r.value[Ae]):"";if(Fe)return Fe}return Dm(r.value,te).trim()}function y(te){const de=te.trim();return ms(de?v.value[de]??l.value:l.value)}function P(te){return n.value[te.trim()]??fN}function B(te,de=s.value){const Le=te.trim(),Ae=P(Le);if(de&&Ae.includes(de))return de;if(Ae.includes("medium"))return"medium";const Fe=o.value[Le];return Fe&&Ae.includes(Fe)?Fe:Ae[0]??""}function L(te){s.value=B(te)}function j(te){const de={},Le={};for(const Ae of te)Ae.supportedReasoningEfforts!==null&&(de[Ae.id]=[...Ae.supportedReasoningEfforts]),Ae.defaultReasoningEffort&&(Le[Ae.id]=Ae.defaultReasoningEffort);n.value=de,o.value=Le}function U(...te){const de=[...t.value];for(const Le of te){const Ae=Le.trim();Ae&&!de.includes(Ae)&&de.push(Ae)}Oa(t.value,de)||(t.value=de)}function H(te){const de=te.trim();return t.value.length===0||de&&t.value.includes(de)?de:t.value[0]??""}function be(te,de){const Le=de.trim(),Ae=di(te),Fe=ms(l.value),Ke=Ae===Is?xu(Fe):"",lt=Ke||Ae;if(Le){const Ze=Lu(r.value);Ze[lt]=Le,Ke&&delete Ze[Ae],r.value=Ze}else{let Ze=$l(r.value,lt);Ke&&(Ze=$l(Ze,Ae)),r.value=Ze}Ae===di(e.selectedThreadId.value)?(a.value=b(e.selectedThreadId.value),U(a.value),L(a.value)):U(Le),Iu(r.value)}function le(te){be(e.selectedThreadId.value,te)}function W(te,de){const Le=te.trim();if(!Le)return;const Ae=de.trim();if(Ae){const Fe=Lu(r.value);Fe[Le]=Ae,r.value=Fe}else r.value=$l(r.value,Le);U(Ae),e.selectedThreadId.value===Le&&(a.value=b(e.selectedThreadId.value),L(a.value)),Iu(r.value)}function he(te,de){const Le=te.trim();if(!Le)return;const Ae=ms(de);Ae?v.value={...v.value,[Le]:Ae}:v.value[Le]&&(v.value=yt(v.value,Le))}function Se(te,de,Le){const Ae=de.trim();if(ms(Le)!=="opencode-zen")return Ae;const Ke=b(te).trim();return Ke&&!/^gpt-/i.test(Ke)?Ke:Ae&&!/^gpt-/i.test(Ae)?Ae:dN}async function Pe(te=e.selectedThreadId.value){te.trim()?W(te,Pr):le(Pr),U(Pr)}function ge(te){te&&!P(a.value).includes(te)||(f=!0,s.value=te)}async function Y(te){const de=te==="fast"?"fast":"standard";if(c.value||i.value===de)return;const Le=i.value;i.value=de,c.value=!0,e.error.value="";try{await jk(de)}catch(Ae){i.value=Le,e.error.value=Ae instanceof Error?Ae.message:"Failed to update Fast mode"}finally{c.value=!1}}function pe(te,de,Le){const Ae=te.trim()||"default",Fe=de||"default",Ke=Le==="plan"?"Plan":"Default",lt=i.value==="fast"?"Fast":"Standard";return[`Mode: ${Ke}`,`Model: ${Ae}`,`Thinking: ${Fe}`,`Speed: ${lt}`]}async function ne(te){d.value="";try{const de=await Ok(),Le=de.model.trim(),Ae=ms(de.providerId);l.value=Ae;const Fe=y(e.selectedThreadId.value),Ke=Fe!=="codex"&&Fe!=="custom",lt=b(e.selectedThreadId.value),Ze=await $k({includeProviderModels:Ke||(te==null?void 0:te.includeProviderModels)!==!1,requireProviderModels:Ke,providerId:Ke?Fe:void 0}),ut=Ze.map(Ee=>Ee.id);j(Ze);const fe=xu(Fe),N=fe?tl(r.value[fe]):"",oe=[...ut];!(te!=null&&te.providerChanged)&&Ke&&Fe===Ae&&Le&&!oe.includes(Le)&&oe.push(Le),t.value=oe;const ue=lt&&ut.includes(lt);if(!lt||!ue||te!=null&&te.providerChanged?te!=null&&te.providerChanged&&oe.length>0?N&&ut.includes(N)?le(N):Fe===Ae&&Le&&oe.includes(Le)?le(Le):le(oe[0]):Fe===Ae&&Le&&oe.includes(Le)?le(de.model):oe.length>0?le(oe[0]):le(""):a.value.trim()!==lt&&le(lt),fe&&a.value.trim().length>0){const Ee=Lu(r.value);Ee[fe]=a.value.trim();const Be=xu(Ae);Be&&Be!==fe&&Le&&(Ee[Be]=Le),r.value=Ee,Iu(r.value)}s.value=B(a.value,f?s.value:"medium"),i.value=de.speedMode}catch(de){d.value=dy(de)?_y:""}}function xe(te){a.value=H(b(te)),L(a.value)}function $e(te){const de=cy(r.value,te);de!==r.value&&(r.value=de,xe(e.selectedThreadId.value),Iu(de)),v.value=Xt(v.value,te)}return{activeProviderId:l,availableModelIds:t,availableModelReasoningEfforts:n,codexCliMissingError:d,isUpdatingSpeedMode:c,selectedModelId:a,selectedReasoningEffort:s,selectedSpeedMode:i,applyFallbackModelSelection:Pe,buildPendingTurnDetails:pe,pruneThreadModelState:$e,readModelIdForThread:b,refreshModelPreferences:ne,resolveThreadModelForProvider:Se,setSelectedModelId:le,setSelectedModelIdForThread:be,setSelectedReasoningEffort:ge,setThreadModelId:W,setThreadModelProviderId:he,syncSelectedThreadModel:xe,updateSelectedSpeedMode:Y}}function hN(e){const t=S([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),n=S(Vj()),o=S(_d(n.value,e.value));function r(d){const c=d==="plan"?"plan":"default",v=di(e.value);_d(n.value,e.value)===c&&o.value===c||(o.value=c,n.value=Fm(n.value,v,c),Ed(n.value))}function a(d,c){const v=c==="plan"?"plan":"default";n.value=Fm(n.value,d,v),d.trim()===e.value&&(o.value=v),Ed(n.value)}function s(d){o.value=_d(n.value,d)}function i(d){const c=cy(n.value,d);c!==n.value&&(n.value=c,s(e.value),Ed(c))}async function l(){try{const d=await Fk();t.value=d,d.some(c=>c.value===o.value)||r("default")}catch{}}return{availableCollaborationModes:t,selectedCollaborationMode:o,pruneThreadCollaborationState:i,refreshCollaborationModes:l,setSelectedCollaborationMode:r,setSelectedCollaborationModeForThread:a,syncSelectedThreadCollaborationMode:s}}const mN=500;function vN(){const e=S(null),t=S([]),n=K(()=>e.value);let o=null,r=null;function a(d){e.value=d}async function s(){if(r){await r;return}r=(async()=>{try{const d=await AI();a(d),t.value=d?[d]:[]}catch{}finally{r=null}})(),await r}function i(){if(typeof window>"u"){s();return}o!==null&&window.clearTimeout(o),o=window.setTimeout(()=>{o=null,s()},mN)}function l(){o===null||typeof window>"u"||(window.clearTimeout(o),o=null)}return{accountRateLimitSnapshots:t,codexQuota:n,refreshRateLimits:s,scheduleRateLimitRefresh:i,setCodexRateLimit:a,stopRateLimitRefresh:l}}function gN(e){const t=S(Zj()),n=S(tL());let o=null;function r(f,b={}){t.value=f,b.persist!==!1&&eL(f)}function a(f,b={}){n.value=f,b.persist!==!1&&nL(f)}async function s(f,b){try{const y=await Oi(),P={...y.labels};let B=!1;for(const L of y.order){if(!Nu(L,f))continue;const j=b.trim();j.length===0?P[L]!==void 0&&(delete P[L],B=!0):P[L]!==j&&(P[L]=j,B=!0)}B&&await Td({order:y.order,labels:P,active:y.active,projectOrder:y.projectOrder})}catch{}}function i(f,b){f.length===0||(n.value[f]??"")===b||(a({...n.value,[f]:b}),o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,s(f,b)},500))}async function l(){try{const f=await Oi(),b=_j(f,t.value,e.sourceGroups.value);await Td({order:b.order,labels:f.labels,active:b.active,projectOrder:b.projectOrder})}catch{}}async function d(f){var L;if(f.length===0)return;const b=t.value.filter(j=>j!==f);if(Oa(t.value,b)||r(b),e.sourceGroups.value=e.sourceGroups.value.filter(j=>j.projectName!==f),n.value[f]!==void 0){const j={...n.value};delete j[f],a(j)}e.applyThreadFlags();const y=Yn(e.projectGroups.value);e.pruneThreadScopedState(y),y.some(j=>j.id===e.selectedThreadId.value)||e.setSelectedThreadId(((L=y[0])==null?void 0:L.id)??"");const B=new Set;try{const j=await Oi();Aj(j,f).forEach(U=>{B.add(U)})}catch{}if(B.size>0)try{const j=await Oi(),U=j.order.filter(le=>!B.has(le)),H=j.active.filter(le=>!B.has(le)),be=H.length===0&&U.length>0?[U[0]]:H;await Td({order:U,labels:bj(j.labels,B),active:be,projectOrder:j.projectOrder.filter(le=>le!==f&&!B.has(le))});return}catch{}await l()}function c(f,b){if(f.length===0||e.sourceGroups.value.length===0)return;const y=e.sourceGroups.value.map(U=>U.projectName),P=y.indexOf(f);if(P===-1)return;const B=Math.max(0,Math.min(b,y.length-1)),L=aj(y,P,B);if(L===y)return;r($i(L,e.sourceGroups.value));const j=rf(e.sourceGroups.value,t.value);e.sourceGroups.value=Xu(e.sourceGroups.value,j),e.applyThreadFlags(),l()}function v(f){const b=f.trim();if(!b)return;const y=[b,...t.value.filter(B=>B!==b)];if(Oa(t.value,y))return;r(y);const P=rf(e.sourceGroups.value,t.value);e.sourceGroups.value=Xu(e.sourceGroups.value,P),e.applyThreadFlags(),l()}return{projectDisplayNameById:n,projectOrder:t,persistProjectOrderToWorkspaceRoots:l,pinProjectToTop:v,removeProject:d,renameProject:i,reorderProject:c,setProjectDisplayNames:a,setProjectOrder:r}}const yN=2e3;function wN(e){const t=S([]),n=S([]),o=S(!1);let r=null,a=null,s=!1,i=!1,l=0,d="";async function c(f={}){const b=e.getSelectedCwd().trim(),y=b||"__global__";if(r){await r;return}f.force!==!0&&s&&d===y&&Date.now()-l<yN||(r=(async()=>{try{t.value=await hI(b?[b]:void 0),s=!0,l=Date.now(),d=y}catch{}finally{r=null}})(),await r)}async function v(f={}){if(a){await a;return}f.force!==!0&&i||(o.value=!0,a=(async()=>{try{n.value=await zk(),i=!0}catch{}finally{o.value=!1,a=null}})(),await a)}return{hooksList:n,installedSkills:t,isHooksLoading:o,refreshHooks:v,refreshSkills:c}}const Py="codex-web-local.stashed-messages.v1",Ry="codex-web-local.auto-compact-threshold.v1",Au=10,bN=650;function TN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Py);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||!Array.isArray(r))continue;const a=r.filter(s=>!!s&&typeof s=="object"&&typeof s.id=="string"&&typeof s.text=="string");a.length>0&&(n[o]=a)}return n}catch{return{}}}function SN(){if(typeof window>"u")return Au;try{const e=window.localStorage.getItem(Ry);if(e===null)return Au;const t=Number(e);return Number.isFinite(t)&&t>=0?Math.round(t):Au}catch{return Au}}function CN(e){const t={};for(const[n,o]of Object.entries(e)){const r=n.trim();!r||o.length===0||(t[r]=o.map(a=>({id:a.id,text:a.text,imageUrls:[...a.imageUrls],skills:a.skills.map(s=>({name:s.name,path:s.path})),fileAttachments:a.fileAttachments.map(s=>({label:s.label,path:s.path,fsPath:s.fsPath})),collaborationMode:a.collaborationMode})))}return t}function xN(e){const t=S({}),n=S({}),o=S(TN()),r=S(SN());let a=!1;const s=K(()=>{const W=e.value;if(!W)return[];const he=t.value[W]??[];return[...(o.value[W]??[]).map(ge=>({...ge,awaitingCompaction:!0})),...he]});function i(){typeof window>"u"||window.localStorage.setItem(Py,JSON.stringify(o.value))}function l(){Zk(CN(t.value)).catch(()=>{})}async function d(){if(!a){a=!0;try{t.value=await fm()}catch{}}}async function c(W){if(n.value[W]!==!0){n.value={...n.value,[W]:!0};try{t.value=await fm()}catch{}finally{n.value=yt(n.value,W)}}}function v(W){c(W),!(typeof window>"u")&&window.setTimeout(()=>{c(W)},bN)}function f(W){const he=Number.isFinite(W)&&W>0?Math.round(W):0;he!==r.value&&(r.value=he,!(typeof window>"u")&&window.localStorage.setItem(Ry,String(he)))}function b(W){return o.value[W]??[]}function y(W,he){o.value={...o.value,[W]:[...b(W),he]},i()}function P(W){const he=[...b(W)];return he.length===0||(o.value=yt(o.value,W),i()),he}function B(W,he,Se){const ge=[...t.value[W]??[]],Y=typeof Se=="number"?Math.max(0,Math.min(Se,ge.length)):ge.length;ge.splice(Y,0,he),t.value={...t.value,[W]:ge},l()}function L(W,he){return b(W).find(Se=>Se.id===he)}function j(W,he){var Se;return(Se=t.value[W])==null?void 0:Se.find(Pe=>Pe.id===he)}function U(W){const he=e.value;if(!he)return;if(L(he,W)){const ge=b(he).filter(Y=>Y.id!==W);o.value=ge.length>0?{...o.value,[he]:ge}:yt(o.value,he),i();return}const Se=t.value[he];if(!Se)return;const Pe=Se.filter(ge=>ge.id!==W);t.value=Pe.length>0?{...t.value,[he]:Pe}:yt(t.value,he),l()}function H(W,he){const Se=e.value;if(!Se)return;const Pe=t.value[Se];if(!Pe||L(Se,W)||L(Se,he))return;const ge=Pe.findIndex(xe=>xe.id===W),Y=Pe.findIndex(xe=>xe.id===he);if(ge<0||Y<0||ge===Y)return;const pe=[...Pe],[ne]=pe.splice(ge,1);pe.splice(Y,0,ne),t.value={...t.value,[Se]:pe},l()}function be(W){const he=Xt(t.value,W);he!==t.value&&(t.value=he,l())}function le(){t.value={},n.value={},o.value={},i(),l()}return{appendStashedMessage:y,autoCompactThreshold:r,clearQueueState:le,enqueueQueuedMessage:B,findQueuedMessage:j,findStashedMessage:L,getStashedMessages:b,loadPersistedQueueStateIfNeeded:d,processQueuedMessages:c,pruneQueueState:be,removeQueuedMessage:U,reorderQueuedMessage:H,scheduleQueueStateRefresh:v,selectedThreadQueuedMessages:s,setAutoCompactThreshold:f,takeStashedMessages:P}}const kN=1e4,IN=2e3;function AN(e){const{selectedThreadId:t,projectGroups:n,inProgressById:o,applyThreadGroups:r,hydrateWorkspaceRootsStateIfNeeded:a,loadThreadTitleCacheIfNeeded:s,loadWorkspaceRootsStateForThreadList:i,pruneThreadScopedState:l,setSelectedThreadId:d}=e,c=S(!1),v=S(!1),f=S(!1);let b=null,y=0,P=null,B=null,L=!1,j=!1,U=[],H=null;function be(pe,ne){if(pe.length===0)return ne;if(ne.length===0)return pe;const xe=new Map;for(const te of Yn(pe))xe.set(te.id,te);for(const te of Yn(ne))xe.set(te.id,te);const $e=new Map;for(const te of xe.values()){const de=$e.get(te.projectName);de?de.push(te):$e.set(te.projectName,[te])}return Array.from($e.entries()).map(([te,de])=>({projectName:te,threads:de.sort((Le,Ae)=>new Date(Ae.updatedAtIso).getTime()-new Date(Le.updatedAtIso).getTime())})).sort((te,de)=>{var Fe,Ke;const Le=new Date(((Fe=te.threads[0])==null?void 0:Fe.updatedAtIso)??0).getTime();return new Date(((Ke=de.threads[0])==null?void 0:Ke.updatedAtIso)??0).getTime()-Le})}function le(){return Object.values(o.value).some(pe=>pe===!0)}function W(pe=H){if(!(!P||L||le())){if(H=pe,typeof window>"u"){he(pe);return}B!==null&&window.clearTimeout(B),B=window.setTimeout(()=>{B=null,!(!P||le())&&he(H)},kN)}}async function he(pe){if(!(L||!P||le())){L=!0;try{const ne=await em(P,Yk());P=ne.nextCursor,j=ne.nextCursor===null,f.value=j,U=be(U,ne.groups),r(U,pe)}catch{}finally{L=!1,P&&!le()&&W(pe)}}}async function Se(pe={}){if(b){await b;return}pe.force!==!0&&c.value&&Date.now()-y<IN||(b=(async()=>{var ne;c.value||(v.value=!0);try{const[xe,$e]=await Promise.all([em(),i(),s({force:pe.force===!0})]);H=$e;const te=xe.groups;U=te,P=xe.nextCursor,j=xe.nextCursor===null,f.value=j,await a(te,$e),r(U,$e),c.value=!0,y=Date.now(),j||W($e);const de=Yn(n.value);l(de),!de.some(Ae=>Ae.id===t.value)&&!t.value&&d(((ne=de[0])==null?void 0:ne.id)??"")}finally{v.value=!1}})().finally(()=>{b=null}),await b)}function Pe(pe){U=hy(U,pe)}function ge(){return P!==null}function Y(){B!==null&&typeof window<"u"&&(window.clearTimeout(B),B=null)}return{dispose:Y,hasActiveInProgressThreads:le,hasLoadedThreads:c,hasRemainingThreadPages:ge,isLoadingThreads:v,isThreadListFullyLoaded:f,loadThreads:Se,removeThreadFromLoadedLists:Pe,scheduleRemainingThreadPages:W}}const Jm=2e3;function _N(e){const t=S({}),n=S({}),o=S({}),r=S({}),a=S(!1),s=new Map,i=new Map,l=new Map;let d=0;async function c(y,P={}){var be;if(!y)return;const B=Date.now()-(l.get(y)??0)<Jm;if((be=e.turnErrorByThreadId.value[y])!=null&&be.transient&&(P.silent===!0||B))return;const L=s.get(y);if(L&&P.force!==!0){await L;return}const j=n.value[y]===!0,U=P.silent!==!0&&!j;U&&(d+=1,a.value=!0);const H=(async()=>{try{const le=e.currentThreadVersion(y),W=t.value[y]??"",he=Date.now()-(i.get(y)??0)<Jm;if(P.force===!0?!1:j&&(he||(le.length===0||W===le)&&e.inProgressById.value[y]!==!0)){e.markThreadAsRead(y);return}const ge=e.resumedThreadById.value[y]!==!0?await Zd(y):null,Y=ge??await Xd(y);Y.modelProvider&&e.setThreadModelProviderId(y,Y.modelProvider),Y.model&&e.setThreadModelId(y,e.resolveThreadModelForProvider(y,Y.model,Y.modelProvider)),ge&&(e.resumedThreadById.value={...e.resumedThreadById.value,[y]:!0});const{messages:pe,inProgress:ne,activeTurnId:xe,turnIndexByTurnId:$e}=Y;o.value={...o.value,[y]:Y.hasMoreOlder===!0},e.markThreadMessagesPersisted(y,pe),e.replaceTurnIndexLookupForThread(y,$e),e.rebindLiveFileChangeTurnIndices(y);const te=e.persistedMessagesByThreadId.value[y]??[],de=Um(te,pe,{preserveMissing:P.silent===!0||cj(te)});e.setPersistedMessagesForThread(y,de);const Le=e.liveAgentMessagesByThreadId.value[y]??[];if(ne){const Ae=pj(Le,pe);e.setLiveAgentMessagesForThread(y,Ae)}else e.clearLiveAgentMessagesForThread(y);e.removeLiveCommandsPersistedIn(y,pe),e.removeLiveFileChangesPersistedIn(y,pe),n.value={...n.value,[y]:!0},i.set(y,Date.now()),l.delete(y),le&&(t.value={...t.value,[y]:le}),e.setThreadInProgress(y,ne),Y.externalSession&&(e.externalSessionByThreadId.value={...e.externalSessionByThreadId.value,[y]:Y.externalSession}),e.clearTransientTurnErrorForThread(y),xe?e.activeTurnIdByThreadId.value={...e.activeTurnIdByThreadId.value,[y]:xe}:e.activeTurnIdByThreadId.value[y]&&(e.activeTurnIdByThreadId.value=yt(e.activeTurnIdByThreadId.value,y)),ne||e.clearCompletedTurnLiveState(y),e.markThreadAsRead(y)}catch(le){const W=le instanceof Error?le.message:"Unknown application error";throw e.selectedThreadId.value===y&&e.setTurnErrorForThread(y,W,{transient:!0}),l.set(y,Date.now()),le}finally{U&&(d=Math.max(0,d-1),d===0&&(a.value=!1))}})().finally(()=>{s.delete(y)});s.set(y,H),await H}async function v(y=e.selectedThreadId.value){if(!y||r.value[y]===!0||o.value[y]!==!0)return;const P=e.getFirstPersistedTurnId(y);if(!P){o.value={...o.value,[y]:!1};return}r.value={...r.value,[y]:!0};try{const B=await Ck(y,P),L=e.persistedMessagesByThreadId.value[y]??[],j=Um(B.messages,L,{preserveMissing:!0});e.setPersistedMessagesForThread(y,j),e.replaceTurnIndexLookupForThread(y,{...e.turnIndexByTurnIdByThreadId.value[y]??{},...B.turnIndexByTurnId}),e.rebindLiveFileChangeTurnIndices(y),o.value={...o.value,[y]:B.hasMoreOlder}}catch(B){throw e.error.value=B instanceof Error?B.message:"Failed to load earlier messages",B}finally{r.value={...r.value,[y]:!1}}}async function f(y,P={}){var B;y&&n.value[y]!==!0&&(P.silent===!0&&((B=e.turnErrorByThreadId.value[y])!=null&&B.transient)||await c(y,P))}function b(y){n.value=Xt(n.value,y),t.value=Xt(t.value,y)}return{ensureThreadMessagesLoaded:f,hasMoreOlderMessagesByThreadId:o,isLoadingMessages:a,loadMessages:c,loadOlderMessages:v,loadedMessagesByThreadId:n,loadedVersionByThreadId:t,loadingOlderMessagesByThreadId:r,pruneMessageHistoryState:b}}function PN(e){const t=S({});function n(s){const i=t.value;return Object.keys(i).length===0?s.map(l=>({projectName:l.projectName,threads:l.threads.map(d=>({...d,title:ys(d.title)}))})):s.map(l=>({projectName:l.projectName,threads:l.threads.map(d=>{const c=i[d.id];return{...d,title:ys(c??d.title)}})}))}async function o(s={}){if(!(s.force!==!0&&Object.keys(t.value).length>0))try{const i=await oI();if(Object.keys(i.titles).length>0){const l={};for(const[d,c]of Object.entries(i.titles))l[d]=ys(c);t.value=l}}catch{}}function r(s,i,l){const d=s.trim();if(d)return ys(d);const c=l.map(v=>v.label.trim()).find(v=>v.length>0);return c?ys(c):i.length>0?ys("[Image]"):"Untitled thread"}async function a(s,i,l,d=[],c=[]){if(t.value[s])return;const v=i.trim();if(!v){const b=r(i,d,c);t.value={...t.value,[s]:b},e.applyThreadFlags(),Yu(s,b);return}const f=v.length>300?v.slice(0,300):v;try{const b=await fI(f,l);if(!b||t.value[s])return;const y=b.length>uf?b.slice(0,uf):b;t.value={...t.value,[s]:y},e.applyThreadFlags(),Yu(s,y)}catch{}}return{applyCachedTitlesToGroups:n,loadThreadTitleCacheIfNeeded:o,requestThreadTitleGeneration:a,resolveFallbackThreadTitle:r,threadTitleById:t}}function RN(e){const t=S({}),n=S({});function o(){return{pendingServerRequestsByThreadId:t,pendingReplyErrorByRequestId:n,applyThreadFlags:e.applyThreadFlags}}function r(y){LL(o(),y)}function a(y){NL(o(),y)}function s(y){OL(o(),y)}function i(y){return $L(o(),y)}const l=K(()=>{const y=[],P=e.getSelectedThreadId();return P&&Array.isArray(t.value[P])&&y.push(...t.value[P]),Array.isArray(t.value[Gi])&&y.push(...t.value[Gi]),y.sort((B,L)=>B.receivedAtIso.localeCompare(L.receivedAtIso))});function d(y){return y?Array.isArray(t.value[y])?t.value[y]:[]:[]}function c(y){return y.some(P=>kL(P.method))?"approval":y.length>0?"response":null}function v(y){const P={};for(const[B,L]of Object.entries(t.value))(B===Gi||y.has(B))&&(P[B]=L);t.value=P}async function f(){try{const P=(await dm()).map(B=>Iy(B)).filter(B=>B!==null);s(P)}catch{}}async function b(y){try{const P=await dm();for(const B of P){const L=qe(B);if((L==null?void 0:L.id)===y)return!0}return!1}catch{return!0}}return{getThreadPendingRequests:d,loadPendingServerRequestsFromBridge:f,pendingReplyErrorByRequestId:n,pendingReplyErrorForRequest:i,pendingRequestStillExistsOnServer:b,pendingServerRequestsByThreadId:t,prunePendingServerRequestsByActiveThreads:v,readPendingRequestState:c,removePendingServerRequestById:a,replacePendingServerRequests:s,selectedThreadServerRequests:l,upsertPendingServerRequest:r}}const _u=220,EN=3e3,MN=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 jN(){const e=S([]),t=S([]),n=S(Qj()),o=S(""),r=S({}),a=S({}),s=S(Hj()),i=S({}),l=S({}),d=S(Uj()),c=S(zj()),v=S({}),f=new Map,b=new Map,y=new Map,P=new Map,B=S({}),L=S({}),j=S({}),H=nN({liveReasoningTextByThreadId:v,inProgressById:j}),be=S({});let le=!1;const W=S({}),{activeProviderId:he,availableModelIds:Se,availableModelReasoningEfforts:Pe,codexCliMissingError:ge,isUpdatingSpeedMode:Y,selectedModelId:pe,selectedReasoningEffort:ne,selectedSpeedMode:xe,applyFallbackModelSelection:$e,buildPendingTurnDetails:te,pruneThreadModelState:de,readModelIdForThread:Le,refreshModelPreferences:Ae,resolveThreadModelForProvider:Fe,setSelectedModelId:Ke,setSelectedModelIdForThread:lt,setSelectedReasoningEffort:Ze,setThreadModelId:ut,setThreadModelProviderId:fe,syncSelectedThreadModel:N,updateSelectedSpeedMode:oe}=pN({selectedThreadId:n,error:o}),{availableCollaborationModes:ue,selectedCollaborationMode:Ee,pruneThreadCollaborationState:Be,refreshCollaborationModes:A,setSelectedCollaborationMode:M,setSelectedCollaborationModeForThread:z,syncSelectedThreadCollaborationMode:Z}=hN(n),ce=S(Bj()),re=S(Wj()),{projectDisplayNameById:je,projectOrder:Re,pinProjectToTop:ke,removeProject:me,renameProject:Ve,reorderProject:Ne,setProjectDisplayNames:He,setProjectOrder:Ue}=gN({sourceGroups:t,projectGroups:e,selectedThreadId:n,applyThreadFlags:Tn,pruneThreadScopedState:Lo,setSelectedThreadId:vn}),Je=S({}),et=S({}),st=S({}),mt=S({}),q=S({}),ae=S({}),_e=_N({selectedThreadId:n,error:o,persistedMessagesByThreadId:r,liveAgentMessagesByThreadId:i,inProgressById:j,externalSessionByThreadId:be,resumedThreadById:Je,turnIndexByTurnIdByThreadId:et,turnErrorByThreadId:q,activeTurnIdByThreadId:ae,markThreadAsRead:va,markThreadMessagesPersisted:rl,replaceTurnIndexLookupForThread:Ti,rebindLiveFileChangeTurnIndices:Qr,setPersistedMessagesForThread:ro,setLiveAgentMessagesForThread:Wn,clearLiveAgentMessagesForThread:yr,removeLiveCommandsPersistedIn:R,removeLiveFileChangesPersistedIn:k,setThreadInProgress:rn,setThreadModelProviderId:fe,setThreadModelId:ut,resolveThreadModelForProvider:Fe,clearTransientTurnErrorForThread:vi,clearCompletedTurnLiveState:Ta,setTurnErrorForThread:Gt,getFirstPersistedTurnId:Wt,currentThreadVersion:$s}),{ensureThreadMessagesLoaded:Ye,hasMoreOlderMessagesByThreadId:bt,isLoadingMessages:Tt,loadMessages:At,loadOlderMessages:Br,loadedMessagesByThreadId:zt,loadedVersionByThreadId:Ha,loadingOlderMessagesByThreadId:fa,pruneMessageHistoryState:pa}=_e,ar=PN({applyThreadFlags:Tn}),{threadTitleById:Ur,applyCachedTitlesToGroups:zr,loadThreadTitleCacheIfNeeded:Ps,requestThreadTitleGeneration:qa}=ar,Wa=RN({applyThreadFlags:Tn,getSelectedThreadId:()=>n.value}),{getThreadPendingRequests:Uo,loadPendingServerRequestsFromBridge:sr,pendingReplyErrorByRequestId:Zn,pendingReplyErrorForRequest:Rs,pendingRequestStillExistsOnServer:ha,pendingServerRequestsByThreadId:Es,prunePendingServerRequestsByActiveThreads:zo,readPendingRequestState:Po,removePendingServerRequestById:Dn,selectedThreadServerRequests:Ga,upsertPendingServerRequest:Ms}=Wa,vt={liveReasoningTextByThreadId:v,persistedReasoningByThreadId:d,turnIndexByTurnIdByThreadId:et,activeTurnIdByThreadId:ae,activeReasoningTurnIdByThreadId:P,reasoningItemTextByItemId:b,reasoningAppendedTextByItemId:f,turnItemSequenceByThreadId:y,appendLiveReasoningText:(m,g)=>H.appendLiveReasoningText(m,g),clearLiveReasoningSnapshot:m=>H.clearLiveReasoningSnapshot(m),savePersistedReasoningMap:Rd},Ct=S({}),kt=S({}),mn=S({}),Fn=S({}),ho=S({}),{accountRateLimitSnapshots:Hr,codexQuota:qr,refreshRateLimits:mo,scheduleRateLimitRefresh:Ho,setCodexRateLimit:Ro,stopRateLimitRefresh:Bn}=vN(),xt=S(Kj()),eo=S(Yj()),vo=S(!1),Eo=S(!1),Mo=S(!1),en=S(new Set),Un=6e4,ir=S([]);let lr="";const bn=S(!1);function ma(m){var g;try{const I=new URL(m,"http://localhost");return I.pathname!=="/codex-local-image"?"":((g=I.searchParams.get("path"))==null?void 0:g.trim())??""}catch{return""}}function tn(m){const g=m.trim().toLowerCase();return g?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(g):!1}function Wr(m){var I;const g=r.value[m]??[];for(let $=g.length-1;$>=0;$-=1){const J=g[$];if(!(J.role!=="user"||!Array.isArray(J.images)||J.images.length===0))for(let ie=J.images.length-1;ie>=0;ie-=1){const X=((I=J.images[ie])==null?void 0:I.trim())??"";if(X&&ma(X))return X}}return""}let go=null,Lt=null;const zn=new Map;let sn=!1,to=!1;const nn=new Set;let Va=!1,on=!1;const qo=new Map,ur=new Set,Ht=AN({selectedThreadId:n,projectGroups:e,inProgressById:j,applyThreadGroups:eu,hydrateWorkspaceRootsStateIfNeeded:ts,loadThreadTitleCacheIfNeeded:Ps,loadWorkspaceRootsStateForThreadList:Tr,pruneThreadScopedState:Lo,setSelectedThreadId:vn}),js=K(()=>Yn(e.value)),Gr=K(()=>js.value.find(m=>m.id===n.value)??null),{appendStashedMessage:Wo,autoCompactThreshold:yo,clearQueueState:qt,enqueueQueuedMessage:Ka,findQueuedMessage:no,findStashedMessage:Ya,getStashedMessages:wo,loadPersistedQueueStateIfNeeded:Vr,pruneQueueState:bo,removeQueuedMessage:jo,reorderQueuedMessage:oo,scheduleQueueStateRefresh:cr,selectedThreadQueuedMessages:St,setAutoCompactThreshold:ln,takeStashedMessages:In}=xN(n),{hooksList:dr,installedSkills:An,isHooksLoading:Kr,refreshHooks:fr,refreshSkills:dn}=wN({getSelectedCwd:()=>{var m;return((m=Gr.value)==null?void 0:m.cwd)??""}}),C=K(()=>{const m=n.value;return!!(m&&eo.value[m]===!0)}),E=K(()=>{const m=n.value;return m?Ct.value[m]===!0:!1}),Q=K(()=>{const m=n.value;return m?ae.value[m]??"":""}),ye=K(()=>{var se;const m=n.value;if(!m)return null;const g=j.value[m]===!0,I=g?mt.value[m]:void 0,$=g?(v.value[m]??"").trim():"",J=(((se=q.value[m])==null?void 0:se.message)??"").trim();let ie="";if(!g&&J){const we=r.value[m]??[];for(let Ie=we.length-1;Ie>=0;Ie-=1){const ze=we[Ie];if(ze.messageType==="turnError"){ie=Ua(ze.text);break}}}const X=!g&&J&&ie===J?"":J;return!g&&!I&&!$&&!X?null:{activityLabel:(I==null?void 0:I.label)||"Thinking",activityDetails:(I==null?void 0:I.details)??[],reasoningText:$,errorText:X}}),ct=K(()=>{const m=n.value;return m?xt.value[m]??null:null}),_t=K(()=>{const m=n.value;if(!m)return[];const g=r.value[m]??[],I=a.value[m]??[],$=i.value[m]??[],J=B.value[m]??[],ie=L.value[m]??[],X=l.value[m]??[],se=d.value[m]??[],we=g.some(Pt=>Pt.messageType==="compaction.done"),Ie=en.value.has(m),ze=we&&!Ie?X.filter(Pt=>Pt.messageType!=="compaction.pending"&&Pt.messageType!=="compaction.done"):X,pt=Dj(m,g,se,[I,J,ie,$],ze),ht=st.value[m],it=ht?yj(pt,ht):pt;return wj(it,c.value[m])}),_n=K(()=>{const m=n.value;return m?Fn.value[m]??null:null}),Kt=K(()=>{const m=n.value;return m?bt.value[m]===!0:!1}),Pn=K(()=>{const m=n.value;return m?fa.value[m]===!0:!1});function Wt(m){var I;const g=r.value[m]??[];for(const $ of g){const J=((I=$.turnId)==null?void 0:I.trim())??"";if(J)return J}return""}function vn(m,g={}){n.value!==m&&(n.value=m,g.persist!==!1&&Xj(m),N(m),Z(m),on=!1)}function mi(m,g){const I=m.trim();if(!I)return;if(!g){if(!(I in xt.value))return;xt.value=yt(xt.value,I),Gm(xt.value);return}const $=xt.value[I];if($&&JSON.stringify($)===JSON.stringify(g))return;xt.value={...xt.value,[I]:g},Gm(xt.value);const J=wo(I);J&&J.length>0&&yo.value>0&&(g.remainingContextPercent!==null&&g.remainingContextPercent<=yo.value?en.value.has(I)||il(I):xo(I))}function pr(m,g){ho.value={...ho.value,[m]:g}}function hr(m){ho.value[m]&&(ho.value=yt(ho.value,m))}async function Ls(m){if(ur.has(m))return;const g=ho.value[m];if(!(!g||g.fallbackRetried)){ur.add(m),pr(m,{...g,fallbackRetried:!0});try{await $e(m);try{const I=await wd(m,1);ro(m,I),To(m),Wn(m,[]),Rn(m),B.value[m]&&(B.value=yt(B.value,m))}catch{}if(Gt(m,null),o.value="",$t(m,null),Yt(m,{label:"Thinking",details:te(Pr,g.effort,g.collaborationMode)}),rn(m,!0),Je.value[m]!==!0){const I=await Zd(m);I.model&&ut(m,Fe(m,I.model,I.modelProvider)),I.modelProvider&&fe(m,I.modelProvider),Je.value={...Je.value,[m]:!0}}await bd(m,g.text,g.imageUrls,Pr,g.effort||void 0,g.skills.length>0?g.skills:void 0,g.fileAttachments,g.collaborationMode),Ho(),nn.add(m),await Jo()}catch(I){const $=I instanceof Error?I.message:"Unknown application error";Gt(m,$),o.value=$,rn(m,!1),Yt(m,null)}finally{ur.delete(m)}}}function mr(m){if(!m||typeof window>"u")return;const g=zn.get(m);g!==void 0&&(window.clearTimeout(g),zn.delete(m))}function Yr(m){if(!m||typeof window>"u")return;mr(m);const g=window.setTimeout(()=>{zn.delete(m),nn.add(m),Jo()},EN);zn.set(m,g)}function Tn(){const g=zr(t.value).map(I=>({projectName:I.projectName,threads:I.threads.map($=>{const J=be.value[$.id]??$.externalSession??null,ie=j.value[$.id]===!0||(J==null?void 0:J.active)===!0,X=Po(Uo($.id)),se=n.value===$.id,we=W.value[$.id]===!0,Ie=oj($.updatedAtIso,ce.value[$.id],re.value);return{...$,inProgress:ie,unread:!se&&!ie&&(we||Ie),pendingRequestState:X,...J?{externalSession:J}:{}}})}));e.value=Xu(e.value,g)}function vr(m,g,I){const $=new Date().toISOString(),J=Xe(g),ie=nr(J),X={id:m,title:ys(I),projectName:ie,cwd:J,hasWorktree:J.includes("/.codex/worktrees/")||J.includes("/.git/worktrees/"),createdAtIso:$,updatedAtIso:$,preview:I,unread:!1,inProgress:!1},se=t.value.findIndex(Ie=>Ie.projectName===ie);if(se>=0){const ze=t.value[se].threads.filter(it=>it.id!==m),pt={projectName:ie,threads:[X,...ze]},ht=[...t.value];ht.splice(se,1,pt),t.value=ht}else t.value=[{projectName:ie,threads:[X]},...t.value];const we=$i(Re.value,t.value);Oa(Re.value,we)||Ue(we),Tn()}function Lo(m){const g=new Set(m.map(J=>J.id)),I=n.value.trim();I&&g.add(I),de(g),Be(g);const $=Xt(ce.value,g);if($!==ce.value&&(ce.value=$,qm($)),pa(g),Je.value=Xt(Je.value,g),et.value=Xt(et.value,g),r.value=Xt(r.value,g),i.value=Xt(i.value,g),v.value=Xt(v.value,g),B.value=Xt(B.value,g),L.value=Xt(L.value,g),st.value=Xt(st.value,g),mt.value=Xt(mt.value,g),q.value=Xt(q.value,g),ae.value=Xt(ae.value,g),P.size>0)for(const J of[...P.keys()])g.has(J)||P.delete(J);Nj(g),Ct.value=Xt(Ct.value,g),kt.value=Xt(kt.value,g),mn.value=Xt(mn.value,g),bo(g),xt.value=Xt(xt.value,g),W.value=Xt(W.value,g),j.value=Xt(j.value,g),zo(g)}function va(m){const g=Yn(t.value).find(I=>I.id===m);g&&(ce.value={...ce.value,[m]:g.updatedAtIso},qm(ce.value),W.value[m]&&(W.value=yt(W.value,m)),Tn())}function $t(m,g){if(!m)return;const I=st.value[m];if(g){if(mj(I,g))return;st.value={...st.value,[m]:g}}else I&&(st.value=yt(st.value,m))}function ga(m,g,I){if(!m||!g)return;const $={...c.value[m]??{}},J=Number.isFinite(I)?Math.max(0,Math.round(I)):0;J<=0?delete $[g]:$[g]=J,Object.keys($).length===0?c.value=yt(c.value,m):c.value={...c.value,[m]:$},Wm(c.value)}function rn(m,g){!m||j.value[m]===!0===g||(g?(j.value={...j.value,[m]:!0},yi(m)):(j.value=yt(j.value,m),Ta(m),gr(m),xo(m)),Tn(),!g&&!Ht.hasActiveInProgressThreads()&&Ht.hasRemainingThreadPages()&&Ht.scheduleRemainingThreadPages())}function gr(m){m&&(Ct.value[m]&&(Ct.value=yt(Ct.value,m)),kt.value[m]&&(kt.value=yt(kt.value,m)),mn.value[m]&&(mn.value=yt(mn.value,m)))}function ya(m){m&&(Ct.value={...Ct.value,[m]:!0},kt.value[m]&&(kt.value=yt(kt.value,m)),mn.value[m]&&(mn.value=yt(mn.value,m)))}function Sn(m){m&&Ct.value[m]===!0&&kt.value[m]===!0&&mn.value[m]===!0&&gr(m)}function Ns(m,g){!m||!g||Ct.value[m]===!0&&gr(m)}function Ja(m){const g=Object.keys(Ct.value);if(g.length===0)return;let I=kt.value,$=!1;for(const J of g)!m.has(J)||I[J]===!0||(I={...I,[J]:!0},$=!0);if($){kt.value=I;for(const J of g)Sn(J)}}function rl(m,g){m&&Ct.value[m]===!0&&g.some(I=>I.role==="user")&&(mn.value[m]!==!0&&(mn.value={...mn.value,[m]:!0}),Sn(m))}function Hn(m){m&&m!==n.value&&W.value[m]!==!0&&(W.value={...W.value,[m]:!0},Tn())}function Yt(m,g){if(!m)return;const I=mt.value[m];if(!g){I&&(mt.value=yt(mt.value,m));return}const $=Fs(g.label)||"Thinking",J=g.details.map(se=>Fs(se)).filter(se=>se.length>0&&se!==$),ie=Array.from(new Set([...(I==null?void 0:I.details)??[],...J])).slice(-3),X={label:$,details:ie};vj(I,X)||(mt.value={...mt.value,[m]:X})}function Gt(m,g,I={}){if(!m)return;const $=q.value[m],J=g?Ua(g):"";if(!J){$&&(q.value=yt(q.value,m));return}const ie=I.transient===!0;($==null?void 0:$.message)===J&&$.transient===ie||(q.value={...q.value,[m]:{message:J,transient:ie}})}function vi(m){var g;m&&(g=q.value[m])!=null&&g.transient&&Gt(m,null)}function al(){const m=Object.entries(q.value).filter(([,I])=>I==null?void 0:I.transient).map(([I])=>I);if(m.length===0)return;let g=q.value;for(const I of m)g=yt(g,I);q.value=g}function $s(m){const g=Yn(t.value).find(I=>I.id===m);return(g==null?void 0:g.updatedAtIso)??""}function qn(m,g){if(!m)return;const I={...eo.value};g?I[m]=!0:delete I[m],eo.value=I,Jj(I)}function gi(){const m=n.value;m&&qn(m,!C.value)}function ro(m,g){const I=r.value[m]??[];nl(I,g)||(r.value={...r.value,[m]:g})}function un(m,g,I=[],$=[],J=[]){const ie=r.value[m]??[],X={id:`optimistic-user:${m}:${Date.now()}`,role:"user",text:g,images:I.length>0?[...I]:void 0,skills:$.length>0?$.map(se=>({name:se.name,path:se.path})):void 0,fileAttachments:J.length>0?J.map(se=>({...se})):void 0,messageType:"userMessage.optimistic"};ro(m,[...ie,X])}function Wn(m,g){Ay(Gn,m,g)}function yr(m){DL(Gn,m)}function wr(m,g){UL(Gn,m,g)}function Go(m,g){HL(Gn,m,g)}function wa(m,g){zL(Gn,m,g)}function Qa(m,g){H.setLiveReasoningText(m,g)}function Jr(m,g){H.appendLiveReasoningText(m,g)}function yi(m){H.restoreLiveReasoningSnapshot(m)}function ba(m){oN(vt,m)}function Rn(m,g=!1){rN(vt,m,g)}function To(m){m&&m in a.value&&(a.value=yt(a.value,m))}function Xa(m){m&&m in L.value&&(L.value=yt(L.value,m))}function Ta(m){if(!m)return;To(m);const g=s.value[m];if(g&&g.messageType==="plan.live"){const I={...g,messageType:"plan",plan:g.plan?{...g.plan,isStreaming:!1}:g.plan};s.value={...s.value,[m]:I},ky(s.value)}Rn(m),jj(m),Yt(m,null),n.value,B.value[m]&&(B.value=yt(B.value,m)),ae.value[m]&&(ae.value=yt(ae.value,m)),hr(m)}function wi(m){var Ie;if(m.method!=="turn/plan/updated")return null;const g=qe(m.params),I=Ln(m),$=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),ie=(Array.isArray(g==null?void 0:g.plan)?g==null?void 0:g.plan:[]).map(ze=>qe(ze)).map(ze=>({step:Me(ze==null?void 0:ze.step),status:oL(ze==null?void 0:ze.status)})).filter(ze=>ze.step.length>0);if(!I||!$)return null;const se={explanation:Me(g==null?void 0:g.explanation).trim()||void 0,steps:ie,isStreaming:!0},we=(Ie=et.value[I])==null?void 0:Ie[$];return{threadId:I,message:{id:`${$}:plan`,role:"assistant",text:rL(se),messageType:"plan.live",plan:se,turnId:$||void 0,turnIndex:typeof we=="number"?we:void 0}}}function Os(m){var ze;if(m.method!=="item/plan/delta")return null;const g=qe(m.params),I=Ln(m),$=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),J=Me(g==null?void 0:g.delta);if(!I||!$||!J)return null;const ie=`${$}:plan`,X=(a.value[I]??[]).find(pt=>pt.id===ie),se=`${(X==null?void 0:X.text)??""}${J}`,we=X!=null&&X.plan?{...X.plan,isStreaming:!0}:void 0,Ie=(ze=et.value[I])==null?void 0:ze[$];return{threadId:I,message:{id:ie,role:"assistant",text:se,messageType:"plan.live",plan:we,turnId:$||void 0,turnIndex:typeof Ie=="number"?Ie:void 0}}}const Gn={liveCommandsByThreadId:B,liveFileChangeMessagesByThreadId:L,liveAgentMessagesByThreadId:i,livePlanMessagesByThreadId:a,lastPlanByThreadId:s},Vo={turnIndexByTurnIdByThreadId:et,persistedMessagesByThreadId:r,liveFileChangeMessagesByThreadId:L};function Ds(m){if(m.method==="server/request"){const g=Iy(m.params);return g&&Ms(g),!0}if(m.method==="server/request/resolved"){const g=qe(m.params),I=g==null?void 0:g.id;return typeof I=="number"&&Number.isInteger(I)&&Dn(I),!0}return!1}function Fs(m){return m.replace(/\s+/gu," ").trim()}function bi(m){return YL(Vo,m)}function sl(m,g,I){JL(Vo,m,g,I)}function Ti(m,g){QL(Vo,m,g)}function Sa(m,g){return XL(Vo,m,g)}function Qr(m){ZL(Vo,m)}function Xr(m,g,I){iN(vt,m,g,I)}function Za(m){lN(vt,m)}function So(m){var we;if(m.method!=="item/started"&&m.method!=="item/completed")return null;const g=qe(m.params),I=qe(g==null?void 0:g.item);if(!I||Me(I.type).toLowerCase()!=="plan")return null;const $=Ln(m),J=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),ie=Me(I.id),X=Me(I.text);if(!$||!ie||!X)return null;const se=$&&J?(we=et.value[$])==null?void 0:we[J]:void 0;return{threadId:$,message:{id:ie,role:"assistant",text:X,messageType:m.method==="item/completed"?"plan":"plan.live",plan:iy(X)??void 0,turnId:J||void 0,turnIndex:typeof se=="number"?se:void 0}}}function No(m){var Ie;if(m.method!=="item/started")return null;const g=qe(m.params),I=qe(g==null?void 0:g.item);if(!I||I.type!=="commandExecution")return null;const $=Me(I.id),J=Me(I.command);if(!$)return null;const ie=typeof I.cwd=="string"?I.cwd:null,X=Ln(m),se=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),we=X&&se?(Ie=et.value[X])==null?void 0:Ie[se]:void 0;return{id:$,role:"system",text:J,messageType:"commandExecution",commandExecution:{command:J,cwd:ie,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:se||void 0,turnIndex:typeof we=="number"?we:void 0}}function $o(m){var it;if(m.method!=="item/completed")return null;const g=qe(m.params),I=qe(g==null?void 0:g.item);if(!I||I.type!=="commandExecution")return null;const $=Me(I.id),J=Me(I.command);if(!$)return null;const ie=typeof I.cwd=="string"?I.cwd:null,X=Me(I.status),se=X==="failed"?"failed":X==="declined"?"declined":X==="interrupted"?"interrupted":"completed",we=typeof I.aggregatedOutput=="string"?I.aggregatedOutput:"",Ie=typeof I.exitCode=="number"?I.exitCode:null,ze=Ln(m),pt=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),ht=ze&&pt?(it=et.value[ze])==null?void 0:it[pt]:void 0;return{id:$,role:"system",text:J,messageType:"commandExecution",commandExecution:{command:J,cwd:ie,status:se,aggregatedOutput:we,exitCode:Ie},turnId:pt||void 0,turnIndex:typeof ht=="number"?ht:void 0}}function Zr(m){var Ie;if(m.method!=="item/completed")return null;const g=qe(m.params),I=qe(g==null?void 0:g.item);if(!I||I.type!=="fileChange")return null;const $=Me(I.id);if(!$)return null;const J=Me(g==null?void 0:g.threadId),ie=Me(g==null?void 0:g.turnId),X=J&&ie?(Ie=et.value[J])==null?void 0:Ie[ie]:void 0,se=Jd(I.changes),we=Dg(I.status);return se.length===0||we!=="completed"?null:{id:$,role:"system",text:"",messageType:"fileChange",fileChangeStatus:we,fileChanges:se,turnId:ie||void 0,turnIndex:typeof X=="number"?X:void 0}}function x(m,g){qL(Gn,m,g)}function R(m,g){WL(Gn,m,g)}function k(m,g){GL(Gn,m,g)}function G(m){if(m.method==="item/agentMessage/delta")return!0;const g=qe(m.params);if(!g)return!1;if(m.method==="item/completed"){const I=qe(g.item);return(I==null?void 0:I.type)==="agentMessage"}return!1}const We=new Set;function Ot(m){for(const g of We)try{g(m)}catch{}}function ao(m){return We.add(m),()=>{We.delete(m)}}function Co(m,g,I){VL(Gn,m,g,I)}function cn(m,g,I){KL(Gn,m,g,I)}function br(m){var kr,cl,ou,ra,Do,as,ki,fn;if(Ds(m))return;if(Za(m),m.method==="turn/started"){const Ce=Ln(m);Ce&&y.delete(Ce)}if(MN.has(m.method))return;if(m.method==="app/list/updated"||m.method==="mcpServer/startupStatus/updated"||m.method==="mcpServer/oauthLogin/completed"||m.method==="remoteControl/status/changed"){Ot(m.method);return}if(m.method==="skills/changed"){dn({force:!0});return}if(m.method==="hook/started"||m.method==="hook/completed"){fr({force:!0});return}if(m.method==="thread/status/changed"){const Ce=Ln(m);Ce&&Ce===n.value&&nn.add(Ce);return}if(m.method==="thread/archived"||m.method==="thread/unarchived"||m.method==="thread/deleted"||m.method==="thread/closed")return;if(m.method==="item/fileChange/patchUpdated"||m.method==="turn/diff/updated"){const Ce=qe(m.params),wt=Me(Ce==null?void 0:Ce.threadId);wt&&(m.method==="item/fileChange/patchUpdated"?Co(wt,Me(Ce==null?void 0:Ce.itemId),Jd(Ce==null?void 0:Ce.changes)):cn(wt,Me(Ce==null?void 0:Ce.turnId),Me(Ce==null?void 0:Ce.diff)??""),wt===n.value&&nn.add(wt));return}if(m.method==="account/rateLimits/updated"&&Ho(),m.method==="thread/name/updated"){const Ce=qe(m.params),wt=Me(Ce==null?void 0:Ce.threadId),Fo=Me(Ce==null?void 0:Ce.threadName);if(wt&&Fo){const so=ys(Fo);Ur.value={...Ur.value,[wt]:so},Tn(),Yu(wt,so)}}if(m.method==="thread/compacted"){const Ce=qe(m.params),wt=Me(Ce==null?void 0:Ce.threadId);wt&&(xr(wt,!1),Yo(wt,"done"),nn.add(wt));return}if(m.method==="fuzzyFileSearch/sessionUpdated"){const Ce=qe(m.params),wt=Me(Ce==null?void 0:Ce.sessionId);wt&&wt===lr&&(ir.value=Ix(Ce));return}if(m.method==="fuzzyFileSearch/sessionCompleted"){const Ce=qe(m.params),wt=Me(Ce==null?void 0:Ce.sessionId);wt&&wt===lr&&(lr="");return}if(m.method==="account/rateLimits/updated"){Ro(qg(m.params));return}const g=sL(m);if(g){mi(g.threadId,g.usage);return}const I=uL(m);I&&Yt(I.threadId,I.activity);const $=Ln(m),J=lL(m);!J&&$&&vi($);const ie=cL(m);ie&&(qo.set(ie.turnId,ie),sl(ie.threadId,ie.turnId,bi(ie.threadId)),ae.value={...ae.value,[ie.threadId]:ie.turnId},Ns(ie.threadId,ie.turnId),To(ie.threadId),Xa(ie.threadId),$t(ie.threadId,null),Gt(ie.threadId,null),rn(ie.threadId,!0),cr(ie.threadId),W.value[ie.threadId]&&(W.value=yt(W.value,ie.threadId)));const X=dL(m),se=iL(m),we=(X==null?void 0:X.threadId)??Ln(m),Ie=we?Le(we):"",ze=!!we&&!!se&&Ie!==Pr&&ku(new Error(se));if(X){ho.value[X.threadId];const Ce=qo.get(X.turnId);Ce&&qo.delete(X.turnId);const wt=Ss((kr=qe(m.params))==null?void 0:kr.durationMs)??Ss((ou=qe((cl=qe(m.params))==null?void 0:cl.turn))==null?void 0:ou.durationMs)??(typeof X.startedAtMs=="number"?X.completedAtMs-X.startedAtMs:null)??(Ce?X.completedAtMs-Ce.startedAtMs:null),Fo=typeof wt=="number"?Math.max(0,wt):0;$t(X.threadId,{turnId:X.turnId,durationMs:Fo}),ga(X.threadId,X.turnId,Fo),ae.value[X.threadId]&&(ae.value=yt(ae.value,X.threadId)),rn(X.threadId,!1),Yt(X.threadId,null),Hn(X.threadId),ze||(hr(X.threadId),cr(X.threadId))}if(se){const Ce=(X==null?void 0:X.threadId)||Ln(m);Ce&&Gt(Ce,se),o.value=se,Ce&&ze&&Ls(Ce)}else X&&Gt(X.threadId,null);if(J){const Ce=$,wt=Ce?Le(Ce):pe.value.trim();Ce&&Gt(Ce,J.message,{transient:J.transient}),o.value=J.message,wt!==Pr&&ku(new Error(J.message))&&(Ce?Ls(Ce):$e())}const pt=wi(m);pt&&(wr(pt.threadId,pt.message),Yt(pt.threadId,{label:"Planning",details:((ra=pt.message.plan)==null?void 0:ra.steps.map(Ce=>Ce.step).slice(0,2))??[]}));const ht=Os(m);ht&&(wr(ht.threadId,ht.message),Yt(ht.threadId,{label:"Planning",details:[]}));const it=So(m);if(it&&(wr(it.threadId,it.message),Yt(it.threadId,{label:"Planning",details:((Do=it.message.plan)==null?void 0:Do.steps.map(Ce=>Ce.step).slice(0,2))??[]})),!$||$!==n.value)return;yL(m);const Pt=wL(m);if(Pt){const Ce=(i.value[$]??[]).find(ru=>ru.id===Pt.messageId),wt=`${(Ce==null?void 0:Ce.text)??""}${Pt.delta}`,Fo=Pt.turnId??(Ce==null?void 0:Ce.turnId),so=Fo?(as=et.value[$])==null?void 0:as[Fo]:Ce==null?void 0:Ce.turnIndex;Go($,{id:Pt.messageId,role:"assistant",text:wt,messageType:"agentMessage.live",turnId:Fo,turnIndex:typeof so=="number"?so:void 0})}const Ia=bL(m);if(Ia){const Ce=Ia.turnId?(ki=et.value[$])==null?void 0:ki[Ia.turnId]:void 0;Go($,{...Ia,turnIndex:typeof Ce=="number"?Ce:void 0})}const Kn=CL(m);Kn&&Go($,Kn),fL(m)&&ba($);const oa=pL(m);oa&&(Jr($,oa.delta),cN(vt,oa.itemId,oa.delta));const Aa=gL(m);if(Aa&&(Xr($,Aa.itemId,Aa.text),ba($)),hL(m)){const Ce=v.value[$]??"";Ce.trim().length>0&&!Ce.endsWith(`
|
|
74
|
+
`:"";e.appendLiveReasoningText(t,`${s}${o}`),e.reasoningAppendedTextByItemId.set(n,o)}function lN(e,t){const n=qe(t.params);if(!n)return;const o=t.method==="item/started"||t.method==="item/completed",r=t.method==="item/reasoning/textDelta"||t.method==="item/reasoning/summaryTextDelta";if(!o&&!r)return;const a=qe(n.item),s=Me(r?n.itemId:a==null?void 0:a.id);if(!s)return;const i=Ln(t);if(!i)return;const l=r||Me(a==null?void 0:a.type).toLowerCase()==="reasoning"?"reasoning":"other",d=e.turnItemSequenceByThreadId.get(i)??[];d.some(c=>c.itemId===s)||e.turnItemSequenceByThreadId.set(i,[...d,{itemId:s,kind:l}])}function uN(e,t){var a;const n=e.turnItemSequenceByThreadId.get(t)??[],o=[];let r="";for(const s of n)if(s.kind==="reasoning"){const i=((a=e.reasoningItemTextByItemId.get(s.itemId))==null?void 0:a.trim())??"";i&&o.push({text:i,anchorMessageId:r,itemId:s.itemId})}else r=s.itemId;return o}function cN(e,t,n){if(!t||!n)return;const o=e.reasoningItemTextByItemId.get(t)??"";o.endsWith(n)||e.reasoningItemTextByItemId.set(t,`${o}${n}`)}function Ym(e){e.reasoningItemTextByItemId.clear()}const Pr="gpt-5.4-mini",_y="Codex CLI not found. Install @openai/codex or set CODEXUI_CODEX_COMMAND.",dN="big-pickle",fN=Ng;function pN(e){const t=S([]),n=S({}),o=S({}),r=S(Gj()),a=S(Dm(r.value,e.selectedThreadId.value)),s=S("medium"),i=S("standard"),l=S(""),d=S(""),c=S(!1),v=S({});let f=!1;function b(te){if(di(te)===Is){const Le=ms(l.value),Ae=xu(Le),Fe=Ae?tl(r.value[Ae]):"";if(Fe)return Fe}return Dm(r.value,te).trim()}function y(te){const de=te.trim();return ms(de?v.value[de]??l.value:l.value)}function P(te){return n.value[te.trim()]??fN}function B(te,de=s.value){const Le=te.trim(),Ae=P(Le);if(de&&Ae.includes(de))return de;if(Ae.includes("medium"))return"medium";const Fe=o.value[Le];return Fe&&Ae.includes(Fe)?Fe:Ae[0]??""}function L(te){s.value=B(te)}function j(te){const de={},Le={};for(const Ae of te)Ae.supportedReasoningEfforts!==null&&(de[Ae.id]=[...Ae.supportedReasoningEfforts]),Ae.defaultReasoningEffort&&(Le[Ae.id]=Ae.defaultReasoningEffort);n.value=de,o.value=Le}function U(...te){const de=[...t.value];for(const Le of te){const Ae=Le.trim();Ae&&!de.includes(Ae)&&de.push(Ae)}Oa(t.value,de)||(t.value=de)}function H(te){const de=te.trim();return t.value.length===0||de&&t.value.includes(de)?de:t.value[0]??""}function be(te,de){const Le=de.trim(),Ae=di(te),Fe=ms(l.value),Ke=Ae===Is?xu(Fe):"",lt=Ke||Ae;if(Le){const Ze=Lu(r.value);Ze[lt]=Le,Ke&&delete Ze[Ae],r.value=Ze}else{let Ze=$l(r.value,lt);Ke&&(Ze=$l(Ze,Ae)),r.value=Ze}Ae===di(e.selectedThreadId.value)?(a.value=b(e.selectedThreadId.value),U(a.value),L(a.value)):U(Le),Iu(r.value)}function le(te){be(e.selectedThreadId.value,te)}function W(te,de){const Le=te.trim();if(!Le)return;const Ae=de.trim();if(Ae){const Fe=Lu(r.value);Fe[Le]=Ae,r.value=Fe}else r.value=$l(r.value,Le);U(Ae),e.selectedThreadId.value===Le&&(a.value=b(e.selectedThreadId.value),L(a.value)),Iu(r.value)}function he(te,de){const Le=te.trim();if(!Le)return;const Ae=ms(de);Ae?v.value={...v.value,[Le]:Ae}:v.value[Le]&&(v.value=yt(v.value,Le))}function Se(te,de,Le){const Ae=de.trim();if(ms(Le)!=="opencode-zen")return Ae;const Ke=b(te).trim();return Ke&&!/^gpt-/i.test(Ke)?Ke:Ae&&!/^gpt-/i.test(Ae)?Ae:dN}async function Pe(te=e.selectedThreadId.value){te.trim()?W(te,Pr):le(Pr),U(Pr)}function ye(te){te&&!P(a.value).includes(te)||(f=!0,s.value=te)}async function Y(te){const de=te==="fast"?"fast":"standard";if(c.value||i.value===de)return;const Le=i.value;i.value=de,c.value=!0,e.error.value="";try{await jk(de)}catch(Ae){i.value=Le,e.error.value=Ae instanceof Error?Ae.message:"Failed to update Fast mode"}finally{c.value=!1}}function pe(te,de,Le){const Ae=te.trim()||"default",Fe=de||"default",Ke=Le==="plan"?"Plan":"Default",lt=i.value==="fast"?"Fast":"Standard";return[`Mode: ${Ke}`,`Model: ${Ae}`,`Thinking: ${Fe}`,`Speed: ${lt}`]}async function ne(te){d.value="";try{const de=await Ok(),Le=de.model.trim(),Ae=ms(de.providerId);l.value=Ae;const Fe=y(e.selectedThreadId.value),Ke=Fe!=="codex"&&Fe!=="custom",lt=b(e.selectedThreadId.value),Ze=await $k({includeProviderModels:Ke||(te==null?void 0:te.includeProviderModels)!==!1,requireProviderModels:Ke,providerId:Ke?Fe:void 0}),ut=Ze.map(Ee=>Ee.id);j(Ze);const fe=xu(Fe),N=fe?tl(r.value[fe]):"",oe=[...ut];!(te!=null&&te.providerChanged)&&Ke&&Fe===Ae&&Le&&!oe.includes(Le)&&oe.push(Le),t.value=oe;const ue=lt&&ut.includes(lt);if(!lt||!ue||te!=null&&te.providerChanged?te!=null&&te.providerChanged&&oe.length>0?N&&ut.includes(N)?le(N):Fe===Ae&&Le&&oe.includes(Le)?le(Le):le(oe[0]):Fe===Ae&&Le&&oe.includes(Le)?le(de.model):oe.length>0?le(oe[0]):le(""):a.value.trim()!==lt&&le(lt),fe&&a.value.trim().length>0){const Ee=Lu(r.value);Ee[fe]=a.value.trim();const Be=xu(Ae);Be&&Be!==fe&&Le&&(Ee[Be]=Le),r.value=Ee,Iu(r.value)}s.value=B(a.value,f?s.value:"medium"),i.value=de.speedMode}catch(de){d.value=dy(de)?_y:""}}function xe(te){a.value=H(b(te)),L(a.value)}function $e(te){const de=cy(r.value,te);de!==r.value&&(r.value=de,xe(e.selectedThreadId.value),Iu(de)),v.value=Xt(v.value,te)}return{activeProviderId:l,availableModelIds:t,availableModelReasoningEfforts:n,codexCliMissingError:d,isUpdatingSpeedMode:c,selectedModelId:a,selectedReasoningEffort:s,selectedSpeedMode:i,applyFallbackModelSelection:Pe,buildPendingTurnDetails:pe,pruneThreadModelState:$e,readModelIdForThread:b,refreshModelPreferences:ne,resolveThreadModelForProvider:Se,setSelectedModelId:le,setSelectedModelIdForThread:be,setSelectedReasoningEffort:ye,setThreadModelId:W,setThreadModelProviderId:he,syncSelectedThreadModel:xe,updateSelectedSpeedMode:Y}}function hN(e){const t=S([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),n=S(Vj()),o=S(_d(n.value,e.value));function r(d){const c=d==="plan"?"plan":"default",v=di(e.value);_d(n.value,e.value)===c&&o.value===c||(o.value=c,n.value=Fm(n.value,v,c),Ed(n.value))}function a(d,c){const v=c==="plan"?"plan":"default";n.value=Fm(n.value,d,v),d.trim()===e.value&&(o.value=v),Ed(n.value)}function s(d){o.value=_d(n.value,d)}function i(d){const c=cy(n.value,d);c!==n.value&&(n.value=c,s(e.value),Ed(c))}async function l(){try{const d=await Fk();t.value=d,d.some(c=>c.value===o.value)||r("default")}catch{}}return{availableCollaborationModes:t,selectedCollaborationMode:o,pruneThreadCollaborationState:i,refreshCollaborationModes:l,setSelectedCollaborationMode:r,setSelectedCollaborationModeForThread:a,syncSelectedThreadCollaborationMode:s}}const mN=500;function vN(){const e=S(null),t=S([]),n=K(()=>e.value);let o=null,r=null;function a(d){e.value=d}async function s(){if(r){await r;return}r=(async()=>{try{const d=await AI();a(d),t.value=d?[d]:[]}catch{}finally{r=null}})(),await r}function i(){if(typeof window>"u"){s();return}o!==null&&window.clearTimeout(o),o=window.setTimeout(()=>{o=null,s()},mN)}function l(){o===null||typeof window>"u"||(window.clearTimeout(o),o=null)}return{accountRateLimitSnapshots:t,codexQuota:n,refreshRateLimits:s,scheduleRateLimitRefresh:i,setCodexRateLimit:a,stopRateLimitRefresh:l}}function gN(e){const t=S(Zj()),n=S(tL());let o=null;function r(f,b={}){t.value=f,b.persist!==!1&&eL(f)}function a(f,b={}){n.value=f,b.persist!==!1&&nL(f)}async function s(f,b){try{const y=await Oi(),P={...y.labels};let B=!1;for(const L of y.order){if(!Nu(L,f))continue;const j=b.trim();j.length===0?P[L]!==void 0&&(delete P[L],B=!0):P[L]!==j&&(P[L]=j,B=!0)}B&&await Td({order:y.order,labels:P,active:y.active,projectOrder:y.projectOrder})}catch{}}function i(f,b){f.length===0||(n.value[f]??"")===b||(a({...n.value,[f]:b}),o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,s(f,b)},500))}async function l(){try{const f=await Oi(),b=_j(f,t.value,e.sourceGroups.value);await Td({order:b.order,labels:f.labels,active:b.active,projectOrder:b.projectOrder})}catch{}}async function d(f){var L;if(f.length===0)return;const b=t.value.filter(j=>j!==f);if(Oa(t.value,b)||r(b),e.sourceGroups.value=e.sourceGroups.value.filter(j=>j.projectName!==f),n.value[f]!==void 0){const j={...n.value};delete j[f],a(j)}e.applyThreadFlags();const y=Yn(e.projectGroups.value);e.pruneThreadScopedState(y),y.some(j=>j.id===e.selectedThreadId.value)||e.setSelectedThreadId(((L=y[0])==null?void 0:L.id)??"");const B=new Set;try{const j=await Oi();Aj(j,f).forEach(U=>{B.add(U)})}catch{}if(B.size>0)try{const j=await Oi(),U=j.order.filter(le=>!B.has(le)),H=j.active.filter(le=>!B.has(le)),be=H.length===0&&U.length>0?[U[0]]:H;await Td({order:U,labels:bj(j.labels,B),active:be,projectOrder:j.projectOrder.filter(le=>le!==f&&!B.has(le))});return}catch{}await l()}function c(f,b){if(f.length===0||e.sourceGroups.value.length===0)return;const y=e.sourceGroups.value.map(U=>U.projectName),P=y.indexOf(f);if(P===-1)return;const B=Math.max(0,Math.min(b,y.length-1)),L=aj(y,P,B);if(L===y)return;r($i(L,e.sourceGroups.value));const j=rf(e.sourceGroups.value,t.value);e.sourceGroups.value=Xu(e.sourceGroups.value,j),e.applyThreadFlags(),l()}function v(f){const b=f.trim();if(!b)return;const y=[b,...t.value.filter(B=>B!==b)];if(Oa(t.value,y))return;r(y);const P=rf(e.sourceGroups.value,t.value);e.sourceGroups.value=Xu(e.sourceGroups.value,P),e.applyThreadFlags(),l()}return{projectDisplayNameById:n,projectOrder:t,persistProjectOrderToWorkspaceRoots:l,pinProjectToTop:v,removeProject:d,renameProject:i,reorderProject:c,setProjectDisplayNames:a,setProjectOrder:r}}const yN=2e3;function wN(e){const t=S([]),n=S([]),o=S(!1);let r=null,a=null,s=!1,i=!1,l=0,d="";async function c(f={}){const b=e.getSelectedCwd().trim(),y=b||"__global__";if(r){await r;return}f.force!==!0&&s&&d===y&&Date.now()-l<yN||(r=(async()=>{try{t.value=await hI(b?[b]:void 0),s=!0,l=Date.now(),d=y}catch{}finally{r=null}})(),await r)}async function v(f={}){if(a){await a;return}f.force!==!0&&i||(o.value=!0,a=(async()=>{try{n.value=await zk(),i=!0}catch{}finally{o.value=!1,a=null}})(),await a)}return{hooksList:n,installedSkills:t,isHooksLoading:o,refreshHooks:v,refreshSkills:c}}const Py="codex-web-local.stashed-messages.v1",Ry="codex-web-local.auto-compact-threshold.v1",Au=10,bN=650;function TN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Py);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||!Array.isArray(r))continue;const a=r.filter(s=>!!s&&typeof s=="object"&&typeof s.id=="string"&&typeof s.text=="string");a.length>0&&(n[o]=a)}return n}catch{return{}}}function SN(){if(typeof window>"u")return Au;try{const e=window.localStorage.getItem(Ry);if(e===null)return Au;const t=Number(e);return Number.isFinite(t)&&t>=0?Math.round(t):Au}catch{return Au}}function CN(e){const t={};for(const[n,o]of Object.entries(e)){const r=n.trim();!r||o.length===0||(t[r]=o.map(a=>({id:a.id,text:a.text,imageUrls:[...a.imageUrls],skills:a.skills.map(s=>({name:s.name,path:s.path})),fileAttachments:a.fileAttachments.map(s=>({label:s.label,path:s.path,fsPath:s.fsPath})),collaborationMode:a.collaborationMode})))}return t}function xN(e){const t=S({}),n=S({}),o=S(TN()),r=S(SN());let a=!1;const s=K(()=>{const W=e.value;if(!W)return[];const he=t.value[W]??[];return[...(o.value[W]??[]).map(ye=>({...ye,awaitingCompaction:!0})),...he]});function i(){typeof window>"u"||window.localStorage.setItem(Py,JSON.stringify(o.value))}function l(){Zk(CN(t.value)).catch(()=>{})}async function d(){if(!a){a=!0;try{t.value=await fm()}catch{}}}async function c(W){if(n.value[W]!==!0){n.value={...n.value,[W]:!0};try{t.value=await fm()}catch{}finally{n.value=yt(n.value,W)}}}function v(W){c(W),!(typeof window>"u")&&window.setTimeout(()=>{c(W)},bN)}function f(W){const he=Number.isFinite(W)&&W>0?Math.round(W):0;he!==r.value&&(r.value=he,!(typeof window>"u")&&window.localStorage.setItem(Ry,String(he)))}function b(W){return o.value[W]??[]}function y(W,he){o.value={...o.value,[W]:[...b(W),he]},i()}function P(W){const he=[...b(W)];return he.length===0||(o.value=yt(o.value,W),i()),he}function B(W,he,Se){const ye=[...t.value[W]??[]],Y=typeof Se=="number"?Math.max(0,Math.min(Se,ye.length)):ye.length;ye.splice(Y,0,he),t.value={...t.value,[W]:ye},l()}function L(W,he){return b(W).find(Se=>Se.id===he)}function j(W,he){var Se;return(Se=t.value[W])==null?void 0:Se.find(Pe=>Pe.id===he)}function U(W){const he=e.value;if(!he)return;if(L(he,W)){const ye=b(he).filter(Y=>Y.id!==W);o.value=ye.length>0?{...o.value,[he]:ye}:yt(o.value,he),i();return}const Se=t.value[he];if(!Se)return;const Pe=Se.filter(ye=>ye.id!==W);t.value=Pe.length>0?{...t.value,[he]:Pe}:yt(t.value,he),l()}function H(W,he){const Se=e.value;if(!Se)return;const Pe=t.value[Se];if(!Pe||L(Se,W)||L(Se,he))return;const ye=Pe.findIndex(xe=>xe.id===W),Y=Pe.findIndex(xe=>xe.id===he);if(ye<0||Y<0||ye===Y)return;const pe=[...Pe],[ne]=pe.splice(ye,1);pe.splice(Y,0,ne),t.value={...t.value,[Se]:pe},l()}function be(W){const he=Xt(t.value,W);he!==t.value&&(t.value=he,l())}function le(){t.value={},n.value={},o.value={},i(),l()}return{appendStashedMessage:y,autoCompactThreshold:r,clearQueueState:le,enqueueQueuedMessage:B,findQueuedMessage:j,findStashedMessage:L,getStashedMessages:b,loadPersistedQueueStateIfNeeded:d,processQueuedMessages:c,pruneQueueState:be,removeQueuedMessage:U,reorderQueuedMessage:H,scheduleQueueStateRefresh:v,selectedThreadQueuedMessages:s,setAutoCompactThreshold:f,takeStashedMessages:P}}const kN=1e4,IN=2e3;function AN(e){const{selectedThreadId:t,projectGroups:n,inProgressById:o,applyThreadGroups:r,hydrateWorkspaceRootsStateIfNeeded:a,loadThreadTitleCacheIfNeeded:s,loadWorkspaceRootsStateForThreadList:i,pruneThreadScopedState:l,setSelectedThreadId:d}=e,c=S(!1),v=S(!1),f=S(!1);let b=null,y=0,P=null,B=null,L=!1,j=!1,U=[],H=null;function be(pe,ne){if(pe.length===0)return ne;if(ne.length===0)return pe;const xe=new Map;for(const te of Yn(pe))xe.set(te.id,te);for(const te of Yn(ne))xe.set(te.id,te);const $e=new Map;for(const te of xe.values()){const de=$e.get(te.projectName);de?de.push(te):$e.set(te.projectName,[te])}return Array.from($e.entries()).map(([te,de])=>({projectName:te,threads:de.sort((Le,Ae)=>new Date(Ae.updatedAtIso).getTime()-new Date(Le.updatedAtIso).getTime())})).sort((te,de)=>{var Fe,Ke;const Le=new Date(((Fe=te.threads[0])==null?void 0:Fe.updatedAtIso)??0).getTime();return new Date(((Ke=de.threads[0])==null?void 0:Ke.updatedAtIso)??0).getTime()-Le})}function le(){return Object.values(o.value).some(pe=>pe===!0)}function W(pe=H){if(!(!P||L||le())){if(H=pe,typeof window>"u"){he(pe);return}B!==null&&window.clearTimeout(B),B=window.setTimeout(()=>{B=null,!(!P||le())&&he(H)},kN)}}async function he(pe){if(!(L||!P||le())){L=!0;try{const ne=await em(P,Yk());P=ne.nextCursor,j=ne.nextCursor===null,f.value=j,U=be(U,ne.groups),r(U,pe)}catch{}finally{L=!1,P&&!le()&&W(pe)}}}async function Se(pe={}){if(b){await b;return}pe.force!==!0&&c.value&&Date.now()-y<IN||(b=(async()=>{var ne;c.value||(v.value=!0);try{const[xe,$e]=await Promise.all([em(),i(),s({force:pe.force===!0})]);H=$e;const te=xe.groups;U=te,P=xe.nextCursor,j=xe.nextCursor===null,f.value=j,await a(te,$e),r(U,$e),c.value=!0,y=Date.now(),j||W($e);const de=Yn(n.value);l(de),!de.some(Ae=>Ae.id===t.value)&&!t.value&&d(((ne=de[0])==null?void 0:ne.id)??"")}finally{v.value=!1}})().finally(()=>{b=null}),await b)}function Pe(pe){U=hy(U,pe)}function ye(){return P!==null}function Y(){B!==null&&typeof window<"u"&&(window.clearTimeout(B),B=null)}return{dispose:Y,hasActiveInProgressThreads:le,hasLoadedThreads:c,hasRemainingThreadPages:ye,isLoadingThreads:v,isThreadListFullyLoaded:f,loadThreads:Se,removeThreadFromLoadedLists:Pe,scheduleRemainingThreadPages:W}}const Jm=2e3;function _N(e){const t=S({}),n=S({}),o=S({}),r=S({}),a=S(!1),s=new Map,i=new Map,l=new Map;let d=0;async function c(y,P={}){var be;if(!y)return;const B=Date.now()-(l.get(y)??0)<Jm;if((be=e.turnErrorByThreadId.value[y])!=null&&be.transient&&(P.silent===!0||B))return;const L=s.get(y);if(L&&P.force!==!0){await L;return}const j=n.value[y]===!0,U=P.silent!==!0&&!j;U&&(d+=1,a.value=!0);const H=(async()=>{try{const le=e.currentThreadVersion(y),W=t.value[y]??"",he=Date.now()-(i.get(y)??0)<Jm;if(P.force===!0?!1:j&&(he||(le.length===0||W===le)&&e.inProgressById.value[y]!==!0)){e.markThreadAsRead(y);return}const ye=e.resumedThreadById.value[y]!==!0?await Zd(y):null,Y=ye??await Xd(y);Y.modelProvider&&e.setThreadModelProviderId(y,Y.modelProvider),Y.model&&e.setThreadModelId(y,e.resolveThreadModelForProvider(y,Y.model,Y.modelProvider)),ye&&(e.resumedThreadById.value={...e.resumedThreadById.value,[y]:!0});const{messages:pe,inProgress:ne,activeTurnId:xe,turnIndexByTurnId:$e}=Y;o.value={...o.value,[y]:Y.hasMoreOlder===!0},e.markThreadMessagesPersisted(y,pe),e.replaceTurnIndexLookupForThread(y,$e),e.rebindLiveFileChangeTurnIndices(y);const te=e.persistedMessagesByThreadId.value[y]??[],de=Um(te,pe,{preserveMissing:P.silent===!0||cj(te)});e.setPersistedMessagesForThread(y,de);const Le=e.liveAgentMessagesByThreadId.value[y]??[];if(ne){const Ae=pj(Le,pe);e.setLiveAgentMessagesForThread(y,Ae)}else e.clearLiveAgentMessagesForThread(y);e.removeLiveCommandsPersistedIn(y,pe),e.removeLiveFileChangesPersistedIn(y,pe),n.value={...n.value,[y]:!0},i.set(y,Date.now()),l.delete(y),le&&(t.value={...t.value,[y]:le}),e.setThreadInProgress(y,ne),Y.externalSession&&(e.externalSessionByThreadId.value={...e.externalSessionByThreadId.value,[y]:Y.externalSession}),e.clearTransientTurnErrorForThread(y),xe?e.activeTurnIdByThreadId.value={...e.activeTurnIdByThreadId.value,[y]:xe}:e.activeTurnIdByThreadId.value[y]&&(e.activeTurnIdByThreadId.value=yt(e.activeTurnIdByThreadId.value,y)),ne||e.clearCompletedTurnLiveState(y),e.markThreadAsRead(y)}catch(le){const W=le instanceof Error?le.message:"Unknown application error";throw e.selectedThreadId.value===y&&e.setTurnErrorForThread(y,W,{transient:!0}),l.set(y,Date.now()),le}finally{U&&(d=Math.max(0,d-1),d===0&&(a.value=!1))}})().finally(()=>{s.delete(y)});s.set(y,H),await H}async function v(y=e.selectedThreadId.value){if(!y||r.value[y]===!0||o.value[y]!==!0)return;const P=e.getFirstPersistedTurnId(y);if(!P){o.value={...o.value,[y]:!1};return}r.value={...r.value,[y]:!0};try{const B=await Ck(y,P),L=e.persistedMessagesByThreadId.value[y]??[],j=Um(B.messages,L,{preserveMissing:!0});e.setPersistedMessagesForThread(y,j),e.replaceTurnIndexLookupForThread(y,{...e.turnIndexByTurnIdByThreadId.value[y]??{},...B.turnIndexByTurnId}),e.rebindLiveFileChangeTurnIndices(y),o.value={...o.value,[y]:B.hasMoreOlder}}catch(B){throw e.error.value=B instanceof Error?B.message:"Failed to load earlier messages",B}finally{r.value={...r.value,[y]:!1}}}async function f(y,P={}){var B;y&&n.value[y]!==!0&&(P.silent===!0&&((B=e.turnErrorByThreadId.value[y])!=null&&B.transient)||await c(y,P))}function b(y){n.value=Xt(n.value,y),t.value=Xt(t.value,y)}return{ensureThreadMessagesLoaded:f,hasMoreOlderMessagesByThreadId:o,isLoadingMessages:a,loadMessages:c,loadOlderMessages:v,loadedMessagesByThreadId:n,loadedVersionByThreadId:t,loadingOlderMessagesByThreadId:r,pruneMessageHistoryState:b}}function PN(e){const t=S({});function n(s){const i=t.value;return Object.keys(i).length===0?s.map(l=>({projectName:l.projectName,threads:l.threads.map(d=>({...d,title:ys(d.title)}))})):s.map(l=>({projectName:l.projectName,threads:l.threads.map(d=>{const c=i[d.id];return{...d,title:ys(c??d.title)}})}))}async function o(s={}){if(!(s.force!==!0&&Object.keys(t.value).length>0))try{const i=await oI();if(Object.keys(i.titles).length>0){const l={};for(const[d,c]of Object.entries(i.titles))l[d]=ys(c);t.value=l}}catch{}}function r(s,i,l){const d=s.trim();if(d)return ys(d);const c=l.map(v=>v.label.trim()).find(v=>v.length>0);return c?ys(c):i.length>0?ys("[Image]"):"Untitled thread"}async function a(s,i,l,d=[],c=[]){if(t.value[s])return;const v=i.trim();if(!v){const b=r(i,d,c);t.value={...t.value,[s]:b},e.applyThreadFlags(),Yu(s,b);return}const f=v.length>300?v.slice(0,300):v;try{const b=await fI(f,l);if(!b||t.value[s])return;const y=b.length>uf?b.slice(0,uf):b;t.value={...t.value,[s]:y},e.applyThreadFlags(),Yu(s,y)}catch{}}return{applyCachedTitlesToGroups:n,loadThreadTitleCacheIfNeeded:o,requestThreadTitleGeneration:a,resolveFallbackThreadTitle:r,threadTitleById:t}}function RN(e){const t=S({}),n=S({});function o(){return{pendingServerRequestsByThreadId:t,pendingReplyErrorByRequestId:n,applyThreadFlags:e.applyThreadFlags}}function r(y){LL(o(),y)}function a(y){NL(o(),y)}function s(y){OL(o(),y)}function i(y){return $L(o(),y)}const l=K(()=>{const y=[],P=e.getSelectedThreadId();return P&&Array.isArray(t.value[P])&&y.push(...t.value[P]),Array.isArray(t.value[Gi])&&y.push(...t.value[Gi]),y.sort((B,L)=>B.receivedAtIso.localeCompare(L.receivedAtIso))});function d(y){return y?Array.isArray(t.value[y])?t.value[y]:[]:[]}function c(y){return y.some(P=>kL(P.method))?"approval":y.length>0?"response":null}function v(y){const P={};for(const[B,L]of Object.entries(t.value))(B===Gi||y.has(B))&&(P[B]=L);t.value=P}async function f(){try{const P=(await dm()).map(B=>Iy(B)).filter(B=>B!==null);s(P)}catch{}}async function b(y){try{const P=await dm();for(const B of P){const L=qe(B);if((L==null?void 0:L.id)===y)return!0}return!1}catch{return!0}}return{getThreadPendingRequests:d,loadPendingServerRequestsFromBridge:f,pendingReplyErrorByRequestId:n,pendingReplyErrorForRequest:i,pendingRequestStillExistsOnServer:b,pendingServerRequestsByThreadId:t,prunePendingServerRequestsByActiveThreads:v,readPendingRequestState:c,removePendingServerRequestById:a,replacePendingServerRequests:s,selectedThreadServerRequests:l,upsertPendingServerRequest:r}}const _u=220,EN=3e3,MN=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 jN(){const e=S([]),t=S([]),n=S(Qj()),o=S(""),r=S({}),a=S({}),s=S(Hj()),i=S({}),l=S({}),d=S(Uj()),c=S(zj()),v=S({}),f=new Map,b=new Map,y=new Map,P=new Map,B=S({}),L=S({}),j=S({}),H=nN({liveReasoningTextByThreadId:v,inProgressById:j}),be=S({});let le=!1;const W=S({}),{activeProviderId:he,availableModelIds:Se,availableModelReasoningEfforts:Pe,codexCliMissingError:ye,isUpdatingSpeedMode:Y,selectedModelId:pe,selectedReasoningEffort:ne,selectedSpeedMode:xe,applyFallbackModelSelection:$e,buildPendingTurnDetails:te,pruneThreadModelState:de,readModelIdForThread:Le,refreshModelPreferences:Ae,resolveThreadModelForProvider:Fe,setSelectedModelId:Ke,setSelectedModelIdForThread:lt,setSelectedReasoningEffort:Ze,setThreadModelId:ut,setThreadModelProviderId:fe,syncSelectedThreadModel:N,updateSelectedSpeedMode:oe}=pN({selectedThreadId:n,error:o}),{availableCollaborationModes:ue,selectedCollaborationMode:Ee,pruneThreadCollaborationState:Be,refreshCollaborationModes:A,setSelectedCollaborationMode:M,setSelectedCollaborationModeForThread:z,syncSelectedThreadCollaborationMode:Z}=hN(n),ce=S(Bj()),re=S(Wj()),{projectDisplayNameById:je,projectOrder:Re,pinProjectToTop:ke,removeProject:me,renameProject:Ve,reorderProject:Ne,setProjectDisplayNames:He,setProjectOrder:Ue}=gN({sourceGroups:t,projectGroups:e,selectedThreadId:n,applyThreadFlags:Tn,pruneThreadScopedState:Lo,setSelectedThreadId:vn}),Je=S({}),et=S({}),st=S({}),mt=S({}),q=S({}),ae=S({}),_e=_N({selectedThreadId:n,error:o,persistedMessagesByThreadId:r,liveAgentMessagesByThreadId:i,inProgressById:j,externalSessionByThreadId:be,resumedThreadById:Je,turnIndexByTurnIdByThreadId:et,turnErrorByThreadId:q,activeTurnIdByThreadId:ae,markThreadAsRead:va,markThreadMessagesPersisted:rl,replaceTurnIndexLookupForThread:Ti,rebindLiveFileChangeTurnIndices:Qr,setPersistedMessagesForThread:ro,setLiveAgentMessagesForThread:Wn,clearLiveAgentMessagesForThread:yr,removeLiveCommandsPersistedIn:R,removeLiveFileChangesPersistedIn:k,setThreadInProgress:rn,setThreadModelProviderId:fe,setThreadModelId:ut,resolveThreadModelForProvider:Fe,clearTransientTurnErrorForThread:vi,clearCompletedTurnLiveState:Ta,setTurnErrorForThread:Gt,getFirstPersistedTurnId:Wt,currentThreadVersion:$s}),{ensureThreadMessagesLoaded:Ye,hasMoreOlderMessagesByThreadId:bt,isLoadingMessages:Tt,loadMessages:At,loadOlderMessages:Br,loadedMessagesByThreadId:zt,loadedVersionByThreadId:Ha,loadingOlderMessagesByThreadId:fa,pruneMessageHistoryState:pa}=_e,ar=PN({applyThreadFlags:Tn}),{threadTitleById:Ur,applyCachedTitlesToGroups:zr,loadThreadTitleCacheIfNeeded:Ps,requestThreadTitleGeneration:qa}=ar,Wa=RN({applyThreadFlags:Tn,getSelectedThreadId:()=>n.value}),{getThreadPendingRequests:Uo,loadPendingServerRequestsFromBridge:sr,pendingReplyErrorByRequestId:Zn,pendingReplyErrorForRequest:Rs,pendingRequestStillExistsOnServer:ha,pendingServerRequestsByThreadId:Es,prunePendingServerRequestsByActiveThreads:zo,readPendingRequestState:Po,removePendingServerRequestById:Dn,selectedThreadServerRequests:Ga,upsertPendingServerRequest:Ms}=Wa,vt={liveReasoningTextByThreadId:v,persistedReasoningByThreadId:d,turnIndexByTurnIdByThreadId:et,activeTurnIdByThreadId:ae,activeReasoningTurnIdByThreadId:P,reasoningItemTextByItemId:b,reasoningAppendedTextByItemId:f,turnItemSequenceByThreadId:y,appendLiveReasoningText:(h,g)=>H.appendLiveReasoningText(h,g),clearLiveReasoningSnapshot:h=>H.clearLiveReasoningSnapshot(h),savePersistedReasoningMap:Rd},Ct=S({}),kt=S({}),mn=S({}),Fn=S({}),ho=S({}),{accountRateLimitSnapshots:Hr,codexQuota:qr,refreshRateLimits:mo,scheduleRateLimitRefresh:Ho,setCodexRateLimit:Ro,stopRateLimitRefresh:Bn}=vN(),xt=S(Kj()),eo=S(Yj()),vo=S(!1),Eo=S(!1),Mo=S(!1),en=S(new Set),Un=6e4,ir=S([]);let lr="";const bn=S(!1);function ma(h){var g;try{const I=new URL(h,"http://localhost");return I.pathname!=="/codex-local-image"?"":((g=I.searchParams.get("path"))==null?void 0:g.trim())??""}catch{return""}}function tn(h){const g=h.trim().toLowerCase();return g?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(g):!1}function Wr(h){var I;const g=r.value[h]??[];for(let $=g.length-1;$>=0;$-=1){const J=g[$];if(!(J.role!=="user"||!Array.isArray(J.images)||J.images.length===0))for(let ie=J.images.length-1;ie>=0;ie-=1){const X=((I=J.images[ie])==null?void 0:I.trim())??"";if(X&&ma(X))return X}}return""}let go=null,Lt=null;const zn=new Map;let sn=!1,to=!1;const nn=new Set;let Va=!1,on=!1;const qo=new Map,ur=new Set,Ht=AN({selectedThreadId:n,projectGroups:e,inProgressById:j,applyThreadGroups:eu,hydrateWorkspaceRootsStateIfNeeded:ts,loadThreadTitleCacheIfNeeded:Ps,loadWorkspaceRootsStateForThreadList:Tr,pruneThreadScopedState:Lo,setSelectedThreadId:vn}),js=K(()=>Yn(e.value)),Gr=K(()=>js.value.find(h=>h.id===n.value)??null),{appendStashedMessage:Wo,autoCompactThreshold:yo,clearQueueState:qt,enqueueQueuedMessage:Ka,findQueuedMessage:no,findStashedMessage:Ya,getStashedMessages:wo,loadPersistedQueueStateIfNeeded:Vr,pruneQueueState:bo,removeQueuedMessage:jo,reorderQueuedMessage:oo,scheduleQueueStateRefresh:cr,selectedThreadQueuedMessages:St,setAutoCompactThreshold:ln,takeStashedMessages:In}=xN(n),{hooksList:dr,installedSkills:An,isHooksLoading:Kr,refreshHooks:fr,refreshSkills:dn}=wN({getSelectedCwd:()=>{var h;return((h=Gr.value)==null?void 0:h.cwd)??""}}),C=K(()=>{const h=n.value;return!!(h&&eo.value[h]===!0)}),E=K(()=>{const h=n.value;return h?Ct.value[h]===!0:!1}),Q=K(()=>{const h=n.value;return h?ae.value[h]??"":""}),we=K(()=>{var se;const h=n.value;if(!h)return null;const g=j.value[h]===!0,I=g?mt.value[h]:void 0,$=g?(v.value[h]??"").trim():"",J=(((se=q.value[h])==null?void 0:se.message)??"").trim();let ie="";if(!g&&J){const ge=r.value[h]??[];for(let Ie=ge.length-1;Ie>=0;Ie-=1){const ze=ge[Ie];if(ze.messageType==="turnError"){ie=Ua(ze.text);break}}}const X=!g&&J&&ie===J?"":J;return!g&&!I&&!$&&!X?null:{activityLabel:(I==null?void 0:I.label)||"Thinking",activityDetails:(I==null?void 0:I.details)??[],reasoningText:$,errorText:X}}),ct=K(()=>{const h=n.value;return h?xt.value[h]??null:null}),_t=K(()=>{const h=n.value;if(!h)return[];const g=r.value[h]??[],I=a.value[h]??[],$=i.value[h]??[],J=B.value[h]??[],ie=L.value[h]??[],X=l.value[h]??[],se=d.value[h]??[],ge=g.some(Pt=>Pt.messageType==="compaction.done"),Ie=en.value.has(h),ze=ge&&!Ie?X.filter(Pt=>Pt.messageType!=="compaction.pending"&&Pt.messageType!=="compaction.done"):X,pt=Dj(h,g,se,[I,J,ie,$],ze),ht=st.value[h],it=ht?yj(pt,ht):pt;return wj(it,c.value[h])}),_n=K(()=>{const h=n.value;return h?Fn.value[h]??null:null}),Kt=K(()=>{const h=n.value;return h?bt.value[h]===!0:!1}),Pn=K(()=>{const h=n.value;return h?fa.value[h]===!0:!1});function Wt(h){var I;const g=r.value[h]??[];for(const $ of g){const J=((I=$.turnId)==null?void 0:I.trim())??"";if(J)return J}return""}function vn(h,g={}){n.value!==h&&(n.value=h,g.persist!==!1&&Xj(h),N(h),Z(h),on=!1)}function mi(h,g){const I=h.trim();if(!I)return;if(!g){if(!(I in xt.value))return;xt.value=yt(xt.value,I),Gm(xt.value);return}const $=xt.value[I];if($&&JSON.stringify($)===JSON.stringify(g))return;xt.value={...xt.value,[I]:g},Gm(xt.value);const J=wo(I);J&&J.length>0&&yo.value>0&&(g.remainingContextPercent!==null&&g.remainingContextPercent<=yo.value?en.value.has(I)||il(I):xo(I))}function pr(h,g){ho.value={...ho.value,[h]:g}}function hr(h){ho.value[h]&&(ho.value=yt(ho.value,h))}async function Ls(h){if(ur.has(h))return;const g=ho.value[h];if(!(!g||g.fallbackRetried)){ur.add(h),pr(h,{...g,fallbackRetried:!0});try{await $e(h);try{const I=await wd(h,1);ro(h,I),To(h),Wn(h,[]),Rn(h),B.value[h]&&(B.value=yt(B.value,h))}catch{}if(Gt(h,null),o.value="",$t(h,null),Yt(h,{label:"Thinking",details:te(Pr,g.effort,g.collaborationMode)}),rn(h,!0),Je.value[h]!==!0){const I=await Zd(h);I.model&&ut(h,Fe(h,I.model,I.modelProvider)),I.modelProvider&&fe(h,I.modelProvider),Je.value={...Je.value,[h]:!0}}await bd(h,g.text,g.imageUrls,Pr,g.effort||void 0,g.skills.length>0?g.skills:void 0,g.fileAttachments,g.collaborationMode),Ho(),nn.add(h),await Jo()}catch(I){const $=I instanceof Error?I.message:"Unknown application error";Gt(h,$),o.value=$,rn(h,!1),Yt(h,null)}finally{ur.delete(h)}}}function mr(h){if(!h||typeof window>"u")return;const g=zn.get(h);g!==void 0&&(window.clearTimeout(g),zn.delete(h))}function Yr(h){if(!h||typeof window>"u")return;mr(h);const g=window.setTimeout(()=>{zn.delete(h),nn.add(h),Jo()},EN);zn.set(h,g)}function Tn(){const g=zr(t.value).map(I=>({projectName:I.projectName,threads:I.threads.map($=>{const J=be.value[$.id]??$.externalSession??null,ie=j.value[$.id]===!0||(J==null?void 0:J.active)===!0,X=Po(Uo($.id)),se=n.value===$.id,ge=W.value[$.id]===!0,Ie=oj($.updatedAtIso,ce.value[$.id],re.value);return{...$,inProgress:ie,unread:!se&&!ie&&(ge||Ie),pendingRequestState:X,...J?{externalSession:J}:{}}})}));e.value=Xu(e.value,g)}function vr(h,g,I){const $=new Date().toISOString(),J=Xe(g),ie=nr(J),X={id:h,title:ys(I),projectName:ie,cwd:J,hasWorktree:J.includes("/.codex/worktrees/")||J.includes("/.git/worktrees/"),createdAtIso:$,updatedAtIso:$,preview:I,unread:!1,inProgress:!1},se=t.value.findIndex(Ie=>Ie.projectName===ie);if(se>=0){const ze=t.value[se].threads.filter(it=>it.id!==h),pt={projectName:ie,threads:[X,...ze]},ht=[...t.value];ht.splice(se,1,pt),t.value=ht}else t.value=[{projectName:ie,threads:[X]},...t.value];const ge=$i(Re.value,t.value);Oa(Re.value,ge)||Ue(ge),Tn()}function Lo(h){const g=new Set(h.map(J=>J.id)),I=n.value.trim();I&&g.add(I),de(g),Be(g);const $=Xt(ce.value,g);if($!==ce.value&&(ce.value=$,qm($)),pa(g),Je.value=Xt(Je.value,g),et.value=Xt(et.value,g),r.value=Xt(r.value,g),i.value=Xt(i.value,g),v.value=Xt(v.value,g),B.value=Xt(B.value,g),L.value=Xt(L.value,g),st.value=Xt(st.value,g),mt.value=Xt(mt.value,g),q.value=Xt(q.value,g),ae.value=Xt(ae.value,g),P.size>0)for(const J of[...P.keys()])g.has(J)||P.delete(J);Nj(g),Ct.value=Xt(Ct.value,g),kt.value=Xt(kt.value,g),mn.value=Xt(mn.value,g),bo(g),xt.value=Xt(xt.value,g),W.value=Xt(W.value,g),j.value=Xt(j.value,g),zo(g)}function va(h){const g=Yn(t.value).find(I=>I.id===h);g&&(ce.value={...ce.value,[h]:g.updatedAtIso},qm(ce.value),W.value[h]&&(W.value=yt(W.value,h)),Tn())}function $t(h,g){if(!h)return;const I=st.value[h];if(g){if(mj(I,g))return;st.value={...st.value,[h]:g}}else I&&(st.value=yt(st.value,h))}function ga(h,g,I){if(!h||!g)return;const $={...c.value[h]??{}},J=Number.isFinite(I)?Math.max(0,Math.round(I)):0;J<=0?delete $[g]:$[g]=J,Object.keys($).length===0?c.value=yt(c.value,h):c.value={...c.value,[h]:$},Wm(c.value)}function rn(h,g){!h||j.value[h]===!0===g||(g?(j.value={...j.value,[h]:!0},yi(h)):(j.value=yt(j.value,h),Ta(h),gr(h),xo(h)),Tn(),!g&&!Ht.hasActiveInProgressThreads()&&Ht.hasRemainingThreadPages()&&Ht.scheduleRemainingThreadPages())}function gr(h){h&&(Ct.value[h]&&(Ct.value=yt(Ct.value,h)),kt.value[h]&&(kt.value=yt(kt.value,h)),mn.value[h]&&(mn.value=yt(mn.value,h)))}function ya(h){h&&(Ct.value={...Ct.value,[h]:!0},kt.value[h]&&(kt.value=yt(kt.value,h)),mn.value[h]&&(mn.value=yt(mn.value,h)))}function Sn(h){h&&Ct.value[h]===!0&&kt.value[h]===!0&&mn.value[h]===!0&&gr(h)}function Ns(h,g){!h||!g||Ct.value[h]===!0&&gr(h)}function Ja(h){const g=Object.keys(Ct.value);if(g.length===0)return;let I=kt.value,$=!1;for(const J of g)!h.has(J)||I[J]===!0||(I={...I,[J]:!0},$=!0);if($){kt.value=I;for(const J of g)Sn(J)}}function rl(h,g){h&&Ct.value[h]===!0&&g.some(I=>I.role==="user")&&(mn.value[h]!==!0&&(mn.value={...mn.value,[h]:!0}),Sn(h))}function Hn(h){h&&h!==n.value&&W.value[h]!==!0&&(W.value={...W.value,[h]:!0},Tn())}function Yt(h,g){if(!h)return;const I=mt.value[h];if(!g){I&&(mt.value=yt(mt.value,h));return}const $=Fs(g.label)||"Thinking",J=g.details.map(se=>Fs(se)).filter(se=>se.length>0&&se!==$),ie=Array.from(new Set([...(I==null?void 0:I.details)??[],...J])).slice(-3),X={label:$,details:ie};vj(I,X)||(mt.value={...mt.value,[h]:X})}function Gt(h,g,I={}){if(!h)return;const $=q.value[h],J=g?Ua(g):"";if(!J){$&&(q.value=yt(q.value,h));return}const ie=I.transient===!0;($==null?void 0:$.message)===J&&$.transient===ie||(q.value={...q.value,[h]:{message:J,transient:ie}})}function vi(h){var g;h&&(g=q.value[h])!=null&&g.transient&&Gt(h,null)}function al(){const h=Object.entries(q.value).filter(([,I])=>I==null?void 0:I.transient).map(([I])=>I);if(h.length===0)return;let g=q.value;for(const I of h)g=yt(g,I);q.value=g}function $s(h){const g=Yn(t.value).find(I=>I.id===h);return(g==null?void 0:g.updatedAtIso)??""}function qn(h,g){if(!h)return;const I={...eo.value};g?I[h]=!0:delete I[h],eo.value=I,Jj(I)}function gi(){const h=n.value;h&&qn(h,!C.value)}function ro(h,g){const I=r.value[h]??[];nl(I,g)||(r.value={...r.value,[h]:g})}function un(h,g,I=[],$=[],J=[]){const ie=r.value[h]??[],X={id:`optimistic-user:${h}:${Date.now()}`,role:"user",text:g,images:I.length>0?[...I]:void 0,skills:$.length>0?$.map(se=>({name:se.name,path:se.path})):void 0,fileAttachments:J.length>0?J.map(se=>({...se})):void 0,messageType:"userMessage.optimistic"};ro(h,[...ie,X])}function Wn(h,g){Ay(Gn,h,g)}function yr(h){DL(Gn,h)}function wr(h,g){UL(Gn,h,g)}function Go(h,g){HL(Gn,h,g)}function wa(h,g){zL(Gn,h,g)}function Qa(h,g){H.setLiveReasoningText(h,g)}function Jr(h,g){H.appendLiveReasoningText(h,g)}function yi(h){H.restoreLiveReasoningSnapshot(h)}function ba(h){oN(vt,h)}function Rn(h,g=!1){rN(vt,h,g)}function To(h){h&&h in a.value&&(a.value=yt(a.value,h))}function Xa(h){h&&h in L.value&&(L.value=yt(L.value,h))}function Ta(h){if(!h)return;To(h);const g=s.value[h];if(g&&g.messageType==="plan.live"){const I={...g,messageType:"plan",plan:g.plan?{...g.plan,isStreaming:!1}:g.plan};s.value={...s.value,[h]:I},ky(s.value)}Rn(h),jj(h),Yt(h,null),n.value,B.value[h]&&(B.value=yt(B.value,h)),ae.value[h]&&(ae.value=yt(ae.value,h)),hr(h)}function wi(h){var Ie;if(h.method!=="turn/plan/updated")return null;const g=qe(h.params),I=Ln(h),$=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),ie=(Array.isArray(g==null?void 0:g.plan)?g==null?void 0:g.plan:[]).map(ze=>qe(ze)).map(ze=>({step:Me(ze==null?void 0:ze.step),status:oL(ze==null?void 0:ze.status)})).filter(ze=>ze.step.length>0);if(!I||!$)return null;const se={explanation:Me(g==null?void 0:g.explanation).trim()||void 0,steps:ie,isStreaming:!0},ge=(Ie=et.value[I])==null?void 0:Ie[$];return{threadId:I,message:{id:`${$}:plan`,role:"assistant",text:rL(se),messageType:"plan.live",plan:se,turnId:$||void 0,turnIndex:typeof ge=="number"?ge:void 0}}}function Os(h){var ze;if(h.method!=="item/plan/delta")return null;const g=qe(h.params),I=Ln(h),$=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),J=Me(g==null?void 0:g.delta);if(!I||!$||!J)return null;const ie=`${$}:plan`,X=(a.value[I]??[]).find(pt=>pt.id===ie),se=`${(X==null?void 0:X.text)??""}${J}`,ge=X!=null&&X.plan?{...X.plan,isStreaming:!0}:void 0,Ie=(ze=et.value[I])==null?void 0:ze[$];return{threadId:I,message:{id:ie,role:"assistant",text:se,messageType:"plan.live",plan:ge,turnId:$||void 0,turnIndex:typeof Ie=="number"?Ie:void 0}}}const Gn={liveCommandsByThreadId:B,liveFileChangeMessagesByThreadId:L,liveAgentMessagesByThreadId:i,livePlanMessagesByThreadId:a,lastPlanByThreadId:s},Vo={turnIndexByTurnIdByThreadId:et,persistedMessagesByThreadId:r,liveFileChangeMessagesByThreadId:L};function Ds(h){if(h.method==="server/request"){const g=Iy(h.params);return g&&Ms(g),!0}if(h.method==="server/request/resolved"){const g=qe(h.params),I=g==null?void 0:g.id;return typeof I=="number"&&Number.isInteger(I)&&Dn(I),!0}return!1}function Fs(h){return h.replace(/\s+/gu," ").trim()}function bi(h){return YL(Vo,h)}function sl(h,g,I){JL(Vo,h,g,I)}function Ti(h,g){QL(Vo,h,g)}function Sa(h,g){return XL(Vo,h,g)}function Qr(h){ZL(Vo,h)}function Xr(h,g,I){iN(vt,h,g,I)}function Za(h){lN(vt,h)}function So(h){var ge;if(h.method!=="item/started"&&h.method!=="item/completed")return null;const g=qe(h.params),I=qe(g==null?void 0:g.item);if(!I||Me(I.type).toLowerCase()!=="plan")return null;const $=Ln(h),J=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),ie=Me(I.id),X=Me(I.text);if(!$||!ie||!X)return null;const se=$&&J?(ge=et.value[$])==null?void 0:ge[J]:void 0;return{threadId:$,message:{id:ie,role:"assistant",text:X,messageType:h.method==="item/completed"?"plan":"plan.live",plan:iy(X)??void 0,turnId:J||void 0,turnIndex:typeof se=="number"?se:void 0}}}function No(h){var Ie;if(h.method!=="item/started")return null;const g=qe(h.params),I=qe(g==null?void 0:g.item);if(!I||I.type!=="commandExecution")return null;const $=Me(I.id),J=Me(I.command);if(!$)return null;const ie=typeof I.cwd=="string"?I.cwd:null,X=Ln(h),se=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),ge=X&&se?(Ie=et.value[X])==null?void 0:Ie[se]:void 0;return{id:$,role:"system",text:J,messageType:"commandExecution",commandExecution:{command:J,cwd:ie,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:se||void 0,turnIndex:typeof ge=="number"?ge:void 0}}function $o(h){var it;if(h.method!=="item/completed")return null;const g=qe(h.params),I=qe(g==null?void 0:g.item);if(!I||I.type!=="commandExecution")return null;const $=Me(I.id),J=Me(I.command);if(!$)return null;const ie=typeof I.cwd=="string"?I.cwd:null,X=Me(I.status),se=X==="failed"?"failed":X==="declined"?"declined":X==="interrupted"?"interrupted":"completed",ge=typeof I.aggregatedOutput=="string"?I.aggregatedOutput:"",Ie=typeof I.exitCode=="number"?I.exitCode:null,ze=Ln(h),pt=Me(g==null?void 0:g.turnId)||Me(g==null?void 0:g.turn_id),ht=ze&&pt?(it=et.value[ze])==null?void 0:it[pt]:void 0;return{id:$,role:"system",text:J,messageType:"commandExecution",commandExecution:{command:J,cwd:ie,status:se,aggregatedOutput:ge,exitCode:Ie},turnId:pt||void 0,turnIndex:typeof ht=="number"?ht:void 0}}function Zr(h){var Ie;if(h.method!=="item/completed")return null;const g=qe(h.params),I=qe(g==null?void 0:g.item);if(!I||I.type!=="fileChange")return null;const $=Me(I.id);if(!$)return null;const J=Me(g==null?void 0:g.threadId),ie=Me(g==null?void 0:g.turnId),X=J&&ie?(Ie=et.value[J])==null?void 0:Ie[ie]:void 0,se=Jd(I.changes),ge=Dg(I.status);return se.length===0||ge!=="completed"?null:{id:$,role:"system",text:"",messageType:"fileChange",fileChangeStatus:ge,fileChanges:se,turnId:ie||void 0,turnIndex:typeof X=="number"?X:void 0}}function x(h,g){qL(Gn,h,g)}function R(h,g){WL(Gn,h,g)}function k(h,g){GL(Gn,h,g)}function G(h){if(h.method==="item/agentMessage/delta")return!0;const g=qe(h.params);if(!g)return!1;if(h.method==="item/completed"){const I=qe(g.item);return(I==null?void 0:I.type)==="agentMessage"}return!1}const We=new Set;function Ot(h){for(const g of We)try{g(h)}catch{}}function ao(h){return We.add(h),()=>{We.delete(h)}}function Co(h,g,I){VL(Gn,h,g,I)}function cn(h,g,I){KL(Gn,h,g,I)}function br(h){var kr,cl,ou,ra,Do,as,ki,fn;if(Ds(h))return;if(Za(h),h.method==="turn/started"){const Ce=Ln(h);Ce&&y.delete(Ce)}if(MN.has(h.method))return;if(h.method==="app/list/updated"||h.method==="mcpServer/startupStatus/updated"||h.method==="mcpServer/oauthLogin/completed"||h.method==="remoteControl/status/changed"){Ot(h.method);return}if(h.method==="skills/changed"){dn({force:!0});return}if(h.method==="hook/started"||h.method==="hook/completed"){fr({force:!0});return}if(h.method==="thread/status/changed"){const Ce=Ln(h);Ce&&Ce===n.value&&nn.add(Ce);return}if(h.method==="thread/archived"||h.method==="thread/unarchived"||h.method==="thread/deleted"||h.method==="thread/closed")return;if(h.method==="item/fileChange/patchUpdated"||h.method==="turn/diff/updated"){const Ce=qe(h.params),wt=Me(Ce==null?void 0:Ce.threadId);wt&&(h.method==="item/fileChange/patchUpdated"?Co(wt,Me(Ce==null?void 0:Ce.itemId),Jd(Ce==null?void 0:Ce.changes)):cn(wt,Me(Ce==null?void 0:Ce.turnId),Me(Ce==null?void 0:Ce.diff)??""),wt===n.value&&nn.add(wt));return}if(h.method==="account/rateLimits/updated"&&Ho(),h.method==="thread/name/updated"){const Ce=qe(h.params),wt=Me(Ce==null?void 0:Ce.threadId),Fo=Me(Ce==null?void 0:Ce.threadName);if(wt&&Fo){const so=ys(Fo);Ur.value={...Ur.value,[wt]:so},Tn(),Yu(wt,so)}}if(h.method==="thread/compacted"){const Ce=qe(h.params),wt=Me(Ce==null?void 0:Ce.threadId);wt&&(xr(wt,!1),Yo(wt,"done"),nn.add(wt));return}if(h.method==="fuzzyFileSearch/sessionUpdated"){const Ce=qe(h.params),wt=Me(Ce==null?void 0:Ce.sessionId);wt&&wt===lr&&(ir.value=Ix(Ce));return}if(h.method==="fuzzyFileSearch/sessionCompleted"){const Ce=qe(h.params),wt=Me(Ce==null?void 0:Ce.sessionId);wt&&wt===lr&&(lr="");return}if(h.method==="account/rateLimits/updated"){Ro(qg(h.params));return}const g=sL(h);if(g){mi(g.threadId,g.usage);return}const I=uL(h);I&&Yt(I.threadId,I.activity);const $=Ln(h),J=lL(h);!J&&$&&vi($);const ie=cL(h);ie&&(qo.set(ie.turnId,ie),sl(ie.threadId,ie.turnId,bi(ie.threadId)),ae.value={...ae.value,[ie.threadId]:ie.turnId},Ns(ie.threadId,ie.turnId),To(ie.threadId),Xa(ie.threadId),$t(ie.threadId,null),Gt(ie.threadId,null),rn(ie.threadId,!0),cr(ie.threadId),W.value[ie.threadId]&&(W.value=yt(W.value,ie.threadId)));const X=dL(h),se=iL(h),ge=(X==null?void 0:X.threadId)??Ln(h),Ie=ge?Le(ge):"",ze=!!ge&&!!se&&Ie!==Pr&&ku(new Error(se));if(X){ho.value[X.threadId];const Ce=qo.get(X.turnId);Ce&&qo.delete(X.turnId);const wt=Ss((kr=qe(h.params))==null?void 0:kr.durationMs)??Ss((ou=qe((cl=qe(h.params))==null?void 0:cl.turn))==null?void 0:ou.durationMs)??(typeof X.startedAtMs=="number"?X.completedAtMs-X.startedAtMs:null)??(Ce?X.completedAtMs-Ce.startedAtMs:null),Fo=typeof wt=="number"?Math.max(0,wt):0;$t(X.threadId,{turnId:X.turnId,durationMs:Fo}),ga(X.threadId,X.turnId,Fo),ae.value[X.threadId]&&(ae.value=yt(ae.value,X.threadId)),rn(X.threadId,!1),Yt(X.threadId,null),Hn(X.threadId),ze||(hr(X.threadId),cr(X.threadId))}if(se){const Ce=(X==null?void 0:X.threadId)||Ln(h);Ce&&Gt(Ce,se),o.value=se,Ce&&ze&&Ls(Ce)}else X&&Gt(X.threadId,null);if(J){const Ce=$,wt=Ce?Le(Ce):pe.value.trim();Ce&&Gt(Ce,J.message,{transient:J.transient}),o.value=J.message,wt!==Pr&&ku(new Error(J.message))&&(Ce?Ls(Ce):$e())}const pt=wi(h);pt&&(wr(pt.threadId,pt.message),Yt(pt.threadId,{label:"Planning",details:((ra=pt.message.plan)==null?void 0:ra.steps.map(Ce=>Ce.step).slice(0,2))??[]}));const ht=Os(h);ht&&(wr(ht.threadId,ht.message),Yt(ht.threadId,{label:"Planning",details:[]}));const it=So(h);if(it&&(wr(it.threadId,it.message),Yt(it.threadId,{label:"Planning",details:((Do=it.message.plan)==null?void 0:Do.steps.map(Ce=>Ce.step).slice(0,2))??[]})),!$||$!==n.value)return;yL(h);const Pt=wL(h);if(Pt){const Ce=(i.value[$]??[]).find(ru=>ru.id===Pt.messageId),wt=`${(Ce==null?void 0:Ce.text)??""}${Pt.delta}`,Fo=Pt.turnId??(Ce==null?void 0:Ce.turnId),so=Fo?(as=et.value[$])==null?void 0:as[Fo]:Ce==null?void 0:Ce.turnIndex;Go($,{id:Pt.messageId,role:"assistant",text:wt,messageType:"agentMessage.live",turnId:Fo,turnIndex:typeof so=="number"?so:void 0})}const Ia=bL(h);if(Ia){const Ce=Ia.turnId?(ki=et.value[$])==null?void 0:ki[Ia.turnId]:void 0;Go($,{...Ia,turnIndex:typeof Ce=="number"?Ce:void 0})}const Kn=CL(h);Kn&&Go($,Kn),fL(h)&&ba($);const oa=pL(h);oa&&(Jr($,oa.delta),cN(vt,oa.itemId,oa.delta));const Aa=gL(h);if(Aa&&(Xr($,Aa.itemId,Aa.text),ba($)),hL(h)){const Ce=v.value[$]??"";Ce.trim().length>0&&!Ce.endsWith(`
|
|
75
75
|
|
|
76
76
|
`)&&Qa($,`${Ce}
|
|
77
77
|
|
|
78
|
-
`)}mL(m);const Qo=No(m);Qo&&(x($,Qo),Yt($,{label:"Running command",details:[((fn=Qo.commandExecution)==null?void 0:fn.command)??""]}));const Mn=xL(m);if(Mn){const Ce=(B.value[$]??[]).find(wt=>wt.id===Mn.itemId);Ce!=null&&Ce.commandExecution&&x($,{...Ce,commandExecution:{...Ce.commandExecution,aggregatedOutput:`${Ce.commandExecution.aggregatedOutput}${Mn.delta}`}})}const xi=$o(m);xi&&x($,xi);const ul=Zr(m);if(ul&&wa($,ul),G(m)&&Rn($,!0),m.method==="turn/completed"){on=!1,Rn($),Ym(vt),B.value[$]&&(B.value=yt(B.value,$));const Ce=Ln(m);Ce&&(mr(Ce),rn(Ce,!1),Yt(Ce,null),Hn(Ce),ze||(hr(Ce),cr(Ce)))}}function es(m){if(m.method==="thread/tokenUsage/updated"||m.method.startsWith("thread/realtime/"))return;const g=m.method,I=g==="turn/started"||g==="turn/completed"||g==="error",$=g.startsWith("thread/")||g==="turn/completed";if(!I&&!$)return;const J=Ln(m);J&&I&&nn.add(J),$&&(sn=!0,to=!0),!(Lt!==null||typeof window>"u")&&(Lt=window.setTimeout(()=>{Lt=null,Jo()},_u))}async function ts(m,g){if(!Va){Va=!0;try{if(!g)return;const I=[];for(const $ of bc(g)){const J=fi($);I.includes(J)||I.push(J)}if(I.length>0){const $=g.projectOrder.length>0?$i(I,m):$i(Re.value,m);Oa(Re.value,$)||Ue($,{persist:!1})}if(Object.keys(g.labels).length>0||(g.remoteProjects??[]).length>0){const $={...je.value};let J=!1;for(const[ie,X]of Object.entries(g.labels)){const se=Xe(ie).trim(),we=[fi(ie)];se&&we.push(se);for(const Ie of we)$[Ie]!==X&&($[Ie]=X,J=!0)}for(const ie of g.order){const X=fi(ie),se=nr(qi(ie));if(!se.startsWith(".")||se===X)continue;const we=`${X} ${se}`;$[X]!==void 0||$[X]===we||($[X]=we,J=!0)}for(const ie of g.remoteProjects??[]){const X=Ij(ie);$[ie.id]!==X&&($[ie.id]=X,J=!0)}J&&He($,{persist:!1})}}catch{}}}async function Tr(){try{return await Oi()}catch{return null}}function Tc(m,g){const I=lf(m,g),$=Rj(m,g),J=Ej($,g,I);if(!g||g.order.length===0&&(g.remoteProjects??[]).length===0)return J;const ie=new Set;for(const se of sf(g,I))ie.add(se);const X=J.filter(se=>ie.has(se.projectName)?!0:cf(se));return Pj(X,g,I)}function eu(m,g){const I=Tc(m,g),$=!!(g&&(g.order.length>0||g.projectOrder.length>0||(g.remoteProjects??[]).length>0)),J=g!=null&&g.projectOrder.length?$i(sf(g,lf(m,g)),I):$i(Re.value,I);Oa(Re.value,J)||Ue(J,{persist:!$});const ie=rf(I,Re.value);Ja(new Set(Yn(ie).map(we=>we.id)));const X=xj(t.value,ie,j.value);t.value=Xu(t.value,X),j.value=Xt(j.value,new Set(Yn(t.value).map(we=>we.id))),new Set(Yn(t.value).map(we=>we.id));const se={};for(const we of Yn(t.value))se[we.id]=we.externalSession??be.value[we.id]??null;be.value=se,Tn()}function Vn(m){Ht.removeThreadFromLoadedLists(m),t.value=hy(t.value,m),j.value=yt(j.value,m),Tn()}async function Sr(m={}){await Promise.allSettled([Ae({providerChanged:m.providerChanged,includeProviderModels:m.includeProviderModels}),mo(),A(),dn()])}function Cr(m={}){const g=()=>{Sr(m)};if(typeof window>"u"){g();return}window.setTimeout(g,0)}async function ea(m={}){o.value="",ge.value="";const g=m.includeSelectedThreadMessages!==!1,I=m.awaitAncillaryRefreshes===!0;try{if(await Vr(),await Ht.loadThreads({force:m.forceThreadRefresh===!0}),g)try{await At(n.value)}catch($){o.value=$ instanceof Error?$.message:"Unknown application error"}I?await Sr({providerChanged:m.providerChanged,includeProviderModels:m.providerChanged===!0||I}):Cr({providerChanged:m.providerChanged,includeProviderModels:!1})}catch($){o.value=$ instanceof Error?$.message:"Unknown application error",dy($)?ge.value=_y:ge.value=""}}async function En(m){vn(m);try{return await At(m),await Ae({includeProviderModels:!0}),dn(),"ok"}catch(g){const I=g instanceof Error?g.message:"Unknown application error";o.value=I;const $=tj(g)?"not-found":"error";return m.trim()&&Gt(m,I,{transient:!0}),$}}async function Si(m){const g=n.value===m,I=g?ej(Yn(e.value),m):"";g&&(vn(I),I&&At(I,{silent:!0}));try{await xk(m),Vn(m),await Ht.loadThreads(),g&&I&&n.value===I&&await Ye(I,{silent:!0})}catch($){o.value=$ instanceof Error?$.message:"Unknown application error"}}async function ns(m,g){const I=g.trim();if(!(!m||!I))try{await Ak(m,I),Ur.value={...Ur.value,[m]:I},Tn(),Yu(m,I)}catch($){o.value=$ instanceof Error?$.message:"Unknown application error"}}async function Ca(m){var X,se;const g=m.trim();if(!g)return"";const I=Yn(t.value).find(we=>we.id===g),$=((X=I==null?void 0:I.cwd)==null?void 0:X.trim())??"",J=((se=I==null?void 0:I.title)==null?void 0:se.trim())??"Forked chat",ie=Le(g);o.value="";try{const we=await nm(g,$||void 0,ie||void 0),Ie=we.threadId.trim();return Ie?(vr(Ie,$,J),ut(Ie,we.model),Je.value={...Je.value,[Ie]:!0},vn(Ie),await Ht.loadThreads(),await At(Ie),Ie):""}catch(we){return o.value=we instanceof Error?we.message:"Unknown application error",""}}async function tu(m,g){var X;const I=m.trim();if(!I||!Number.isInteger(g)||g<0)return"";if(j.value[I]===!0)return o.value="Finish the current turn before forking from a response.","";if(zt.value[I]!==!0)try{await At(I)}catch(se){return o.value=se instanceof Error?se.message:"Unknown application error",""}const $=r.value[I]??[];let J=-1;for(const se of $)typeof se.turnIndex=="number"&&Number.isFinite(se.turnIndex)&&(J=Math.max(J,se.turnIndex));if(J>=0&&g>J)return"";const ie=Yn(t.value).find(se=>se.id===I)??null;try{o.value="";const se=await nm(I),we=se.threadId.trim();if(!we)return"";const Ie=se.cwd.trim()||((X=ie==null?void 0:ie.cwd)==null?void 0:X.trim())||"",ze=Mj((ie==null?void 0:ie.title)||(ie==null?void 0:ie.preview)||"Untitled thread");vr(we,Ie,ze),ut(we,se.model),ro(we,se.messages),zt.value={...zt.value,[we]:!0},Je.value={...Je.value,[we]:!0},To(we),Wn(we,[]),Rn(we),B.value[we]&&(B.value=yt(B.value,we)),$t(we,null),Yt(we,null),Gt(we,null),rn(we,!1);const pt=J-g;if(pt>0){const ht=await wd(we,pt);ro(we,ht)}return await ns(we,ze),vn(we),Ht.loadThreads().catch(()=>{}),we}catch(se){return o.value=se instanceof Error?se.message:"Unknown application error",""}}async function xa(m,g,I=[],$=[],J=[]){if(!m||!g.trim()||I.length>0||$.length>0||J.length>0)return!1;const X=(Es.value[m]??[]).filter(Ie=>Ie.method==="item/tool/requestUserInput");if(X.length!==1)return!1;const[se]=X,we=jL(se);return we.length!==1?!1:ll({id:se.id,result:{answers:{[we[0]]:{answers:[g.trim()]}}}})}async function Ko(m,g,I,$,J,ie){if(le||yo.value<=0||j.value[m]===!0)return!1;const X=xt.value[m];if(!X||X.remainingContextPercent===null||X.remainingContextPercent>yo.value)return!1;const se=`stash-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,we=ie==="plan"?"plan":ie==="default"?"default":Ee.value;return Wo(m,{id:se,text:g,imageUrls:I,skills:$,fileAttachments:J,collaborationMode:we}),en.value.has(m)||il(m),!0}async function xo(m){const g=wo(m);if(!g||g.length===0||j.value[m]===!0)return;const I=In(m);le=!0;try{for(const $ of I)try{await Qt($.text,$.imageUrls,$.skills,"steer",$.fileAttachments,void 0,$.collaborationMode)}catch{}}finally{le=!1}}async function Qt(m,g=[],I=[],$="steer",J=[],ie,X){if(Y.value)return;const se=n.value,we=m.trim();if(!se||!we&&g.length===0&&J.length===0||await xa(se,we,g,I,J)||await Ko(se,we,g,I,J,X))return;const Ie=j.value[se]===!0;if(Ie&&$==="queue"){const ze=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;Ka(se,{id:ze,text:we,imageUrls:g,skills:I,fileAttachments:J,collaborationMode:X==="plan"?"plan":X==="default"?"default":Ee.value},ie);return}if(Ie){on=!0,un(se,we,g,I,J),ta(se,we,g,I,J,X).catch(ze=>{const pt=ze instanceof Error?ze.message:"Unknown application error";Gt(se,pt),o.value=pt});return}o.value="",on=!0,$t(se,null),un(se,we,g,I,J),Yt(se,{label:"Thinking",details:te(Le(se),ne.value,X==="plan"?"plan":X==="default"?"default":Ee.value)}),Gt(se,null),rn(se,!0);try{await ta(se,we,g,I,J,X)}catch(ze){on=!1,rn(se,!1),Yt(se,null);const pt=ze instanceof Error?ze.message:"Unknown application error";throw Gt(se,pt),o.value=pt,ze}}async function os(m,g,I=[],$=[],J=[]){if(Y.value)return"";const ie=m.trim(),X=g.trim(),se=Le(Is).trim(),we=Ee.value;if(!ie&&I.length===0&&J.length===0)return"";vo.value=!0,o.value="";let Ie="";try{try{const it=await tm(X||void 0,se||void 0);Ie=it.threadId,ut(Ie,it.model),fe(Ie,it.modelProvider||he.value),z(Ie,we)}catch(it){if(se&&se!==Pr&&ku(it)){await $e();const Pt=await tm(X||void 0,Pr);Ie=Pt.threadId,ut(Ie,Pt.model),fe(Ie,Pt.modelProvider||he.value),z(Ie,we)}else throw it}if(!Ie)return"";vr(Ie,X,ie||"[Image]"),un(Ie,ie,I,$,J),ya(Ie),Je.value={...Je.value,[Ie]:!0},vn(Ie),on=!0,$t(Ie,null),Yt(Ie,{label:"Thinking",details:te(Le(Ie),ne.value,we)}),Gt(Ie,null),rn(Ie,!0);const ze=Ie,pt=X||null,ht=ie;return ta(Ie,ie,I,$,J,we).catch(it=>{on=!1,rn(Ie,!1),Yt(Ie,null);const Pt=it instanceof Error?it.message:"Unknown application error";Gt(Ie,Pt),o.value=Pt}).finally(()=>{vo.value=!1}),qa(ze,ht,pt,I,J),Ie}catch(ze){on=!1,Ie&&(rn(Ie,!1),Yt(Ie,null));const pt=ze instanceof Error?ze.message:"Unknown application error";throw Ie&&Gt(Ie,pt),o.value=pt,vo.value=!1,ze}}async function ta(m,g,I=[],$=[],J=[],ie){const X=ne.value,se=ie==="plan"?"plan":ie==="default"?"default":Ee.value,we=g.trim(),Ie=[...I];if(Ie.length===0&&tn(we)){const ht=Wr(m);ht&&Ie.push(ht)}const ze=$.map(ht=>({name:ht.name,path:ht.path})),pt=J.map(ht=>({...ht}));pr(m,{text:we,imageUrls:[...Ie],skills:ze,fileAttachments:pt,effort:X,collaborationMode:se,fallbackRetried:!1});try{if(Je.value[m]!==!0){const Pt=await Zd(m);Pt.model&&ut(m,Fe(m,Pt.model,Pt.modelProvider)),Pt.modelProvider&&fe(m,Pt.modelProvider),Je.value={...Je.value,[m]:!0}}const ht=Le(m);let it="";try{it=await bd(m,g,Ie,ht||void 0,X||void 0,$.length>0?$:void 0,J,se)}catch(Pt){if(ht&&ht!==Pr&&ku(Pt))await $e(m),pr(m,{text:we,imageUrls:[...Ie],skills:ze,fileAttachments:pt,effort:X,collaborationMode:se,fallbackRetried:!0}),it=await bd(m,g,Ie,Pr,X||void 0,$.length>0?$:void 0,J,se);else throw Pt}it&&(ae.value={...ae.value,[m]:it},Ns(m,it)),nn.add(m),await Jo(),Yr(m)}catch(ht){throw ht}}async function ka(){const m=n.value;if(!m||j.value[m]!==!0||Ct.value[m]===!0)return;let g=ae.value[m];if(!g){const{activeTurnId:ie}=await Xd(m);g=ie,g&&(ae.value={...ae.value,[m]:g})}if(!g)throw new Error("Could not determine active turn id for interrupt");const I=_t.value.filter(ie=>ie.turnId===g),$=I.find(ie=>ie.role==="user"),J=I.some(ie=>{if(ie.role==="assistant")return!0;const X=ie.messageType??"";return X==="commandExecution"||X==="toolCall"||X==="worked"||X==="fileChange"||X==="plan"||X==="plan.live"||X==="compaction.done"||X==="turnError"});Eo.value=!0,o.value="";try{if(await _k(m,g),rn(m,!1),Yt(m,null),Gt(m,null),ae.value[m]&&(ae.value=yt(ae.value,m)),nn.add(m),sn=!0,await Jo(),$&&!J){const ie=(r.value[m]??[]).filter(se=>se.turnId!==g);ro(m,ie);const X=d.value[m];if(X){const se=X.filter(we=>we.turnId!==g);se.length!==X.length&&(d.value={...d.value,[m]:se},Rd(d.value))}Fn.value={...Fn.value,[m]:{text:$.text??"",imageUrls:$.images??[],fileAttachments:($.fileAttachments??[]).map(se=>({label:se.label,path:se.path,fsPath:se.fsPath??se.path})),skills:$.skills??[]}}}}catch(ie){const X=ie instanceof Error?ie.message:"Failed to interrupt active turn";Gt(m,X),o.value=X}finally{Eo.value=!1}}function Bs(m){m&&Fn.value[m]&&(Fn.value=yt(Fn.value,m))}async function rs(m){var I,$,J;const g=n.value;if(g&&!Mo.value&&m.trim()){Mo.value=!0,o.value="";try{j.value[g]===!0&&await ka();const ie=r.value[g]??[],X=ie.find(ht=>ht.turnId===m),se=typeof(X==null?void 0:X.turnIndex)=="number"?X.turnIndex:((I=et.value[g])==null?void 0:I[m])??-1;if(se<0)return;const we=ie.reduce((ht,it)=>typeof it.turnIndex=="number"&&it.turnIndex>ht?it.turnIndex:ht,-1);if(we<0||se>we)return;const Ie=we-se+1,ze=((J=($=Gr.value)==null?void 0:$.cwd)==null?void 0:J.trim())??"";ze&&await aA(g,m,ze);const pt=await wd(g,Ie);ro(g,pt),Wn(g,[]),Rn(g),B.value[g]&&(B.value=yt(B.value,g)),$t(g,null),Yt(g,null),Gt(g,null),sn=!0,await Jo()}catch(ie){o.value=ie instanceof Error?ie.message:"Failed to rollback thread"}finally{Mo.value=!1}}}function Yo(m,g){const $=(l.value[m]??[]).filter(J=>J.messageType!=="compaction.pending"&&J.messageType!=="compaction.done");$.push({id:`compaction:${g}:${m}:${Date.now()}`,role:"system",text:"",messageType:g==="pending"?"compaction.pending":"compaction.done"}),l.value={...l.value,[m]:$}}function xr(m,g){const I=new Set(en.value);g?I.add(m):I.delete(m),en.value=I}function Sc(m){lr=m.trim(),ir.value=[]}async function il(m){const g=m.trim();if(!(!g||en.value.has(g))){xr(g,!0),Yo(g,"pending");try{await Ik(g);const I=2e3,$=14,J=Date.now()+Un;let ie=0;for(;Date.now()<J&&ie<$&&en.value.has(g);){if((await Xd(g)).messages.some(we=>we.messageType==="compaction.done")){xr(g,!1),n.value===g&&await At(g,{silent:!0,force:!0}),Yo(g,"done"),xo(g);break}ie+=1,await Z1(I)}en.value.has(g)&&(xr(g,!1),Yo(g,"done"),xo(g))}catch(I){o.value=I instanceof Error?I.message:"Failed to compact thread",xr(g,!1),Yo(g,"done"),xo(g)}}}async function Jo(){if(bn.value){typeof window<"u"&&Lt===null&&(Lt=window.setTimeout(()=>{Lt=null,Jo()},_u));return}bn.value=!0;const m=sn,g=to,I=new Set(nn);sn=!1,to=!1,nn.clear();try{m&&await Ht.loadThreads({force:g});const $=n.value;if(!$)return;const J=I.has($),ie=j.value[$]===!0,X=$s($),se=Ha.value[$]??"";(X.length>0&&X!==se||J||ie&&zt.value[$]!==!0||m&&zt.value[$]!==!0)&&await At($,{silent:!0,force:J})}catch{}finally{bn.value=!1,(sn||nn.size>0)&&typeof window<"u"&&Lt===null&&(Lt=window.setTimeout(()=>{Lt=null,Jo()},_u))}}async function Ci(){await sr(),sn=!Ht.hasLoadedThreads.value,n.value&&zt.value[n.value]!==!0&&nn.add(n.value),await Jo()}function na(m){const g=qe(m.params),I=typeof(g==null?void 0:g.threadId)=="string"?g.threadId.trim():"";if(!I)return;const $=qe(g==null?void 0:g.externalSession),J=$&&typeof $.origin=="string"&&$.origin.trim().length>0?{origin:$.origin.trim(),active:$.active===!0,lastWriteAt:typeof $.lastWriteAt=="string"?$.lastWriteAt:null}:null;be.value={...be.value,[I]:J},rn(I,(J==null?void 0:J.active)===!0),Tn(),sn=!0,n.value===I&&nn.add(I),Lt===null&&typeof window<"u"&&(Lt=window.setTimeout(()=>{Lt=null,Jo()},_u))}function Us(){typeof window>"u"||go||(sr(),zs(),nu(),go=Jk(m=>{if(m.method==="ready"){al(),Ci();return}if(m.method==="externalSessionChanged"){na(m);return}br(m),es(m)}))}async function zs(){try{const m=await rI(),g=Object.entries(m);if(g.length===0)return;const I={...d.value};let $=!1;for(const[J,ie]of g){const X=ie.filter(ze=>!!ze&&typeof ze.id=="string");if(X.length===0)continue;const se=I[J]??[],we=new Set(se.map(ze=>ze.text)),Ie=[...se];for(const ze of X)we.has(ze.text)||(Ie.push(ze),we.add(ze.text));I[J]=Ie.slice(-20),$=!0}$&&(d.value=I,Rd(I))}catch{}}async function nu(){try{const m=await sI(),g=Object.entries(m);if(g.length===0)return;const I={...c.value};let $=!1;for(const[J,ie]of g){if(!J||!ie||typeof ie!="object"||Array.isArray(ie))continue;const X={};for(const[Ie,ze]of Object.entries(ie))!Ie||typeof ze!="number"||!Number.isFinite(ze)||ze<=0||(X[Ie]=Math.round(ze));if(Object.keys(X).length===0)continue;const se={...I[J]??{},...X},we=Object.keys(se);I[J]=we.length>200?Object.fromEntries(we.slice(-200).map(Ie=>[Ie,se[Ie]])):se,$=!0}$&&(c.value=I,Wm(I))}catch{}}async function ll(m){try{return await Qk(m.id,{result:m.result,error:m.error}),Dn(m.id),Zn.value=yt(Zn.value,String(m.id)),!0}catch(g){const I=g instanceof Error?g.message:"Failed to reply to server request";return await ha(m.id)?(o.value=I,Zn.value={...Zn.value,[String(m.id)]:I},!1):(Dn(m.id),Zn.value=yt(Zn.value,String(m.id)),!0)}}function Cn(){if(go&&(go(),go=null),sn=!1,nn.clear(),qo.clear(),Lt!==null&&typeof window<"u"&&(window.clearTimeout(Lt),Lt=null),Bn(),Ht.dispose(),typeof window<"u")for(const m of zn.values())window.clearTimeout(m);zn.clear(),on=!1,r.value={},a.value={},i.value={},v.value={},d.value={},c.value={},B.value={},L.value={},et.value={},mt.value={},st.value={},q.value={},ae.value={},P.clear(),Ym(vt),y.clear(),Lj(),Ct.value={},kt.value={},mn.value={},qt(),Ro(null),xt.value={}}function Oo(m){const g=n.value;if(!g)return;const I=Ya(g,m);if(I){jo(m),M(I.collaborationMode),le=!0,Qt(I.text,I.imageUrls,I.skills,"steer",I.fileAttachments).finally(()=>{le=!1});return}const $=no(g,m);$&&(jo(m),M($.collaborationMode),Qt($.text,$.imageUrls,$.skills,"steer",$.fileAttachments))}function ko(m,g={}){vn(m,g)}return{projectGroups:e,projectDisplayNameById:je,selectedThread:Gr,selectedThreadTokenUsage:ct,selectedThreadTerminalOpen:C,isSelectedThreadInterruptPending:E,selectedThreadServerRequests:Ga,selectedLiveOverlay:ye,selectedActiveTurnId:Q,lastPlanByThreadId:s,resolveThreadTurnIndex:Sa,codexQuota:qr,selectedThreadId:n,availableCollaborationModes:ue,availableModelIds:Se,availableModelReasoningEfforts:Pe,selectedCollaborationMode:Ee,selectedModelId:pe,selectedReasoningEffort:ne,selectedSpeedMode:xe,codexCliMissingError:ge,installedSkills:An,accountRateLimitSnapshots:Hr,messages:_t,hasMoreOlderMessages:Kt,isLoadingThreads:Ht.isLoadingThreads,isThreadListFullyLoaded:Ht.isThreadListFullyLoaded,isLoadingMessages:Tt,isLoadingOlderMessages:Pn,isSendingMessage:vo,isInterruptingTurn:Eo,isUpdatingSpeedMode:Y,isRollingBack:Mo,compactingThreadIds:en,fuzzyFileSearchResults:ir,registerFuzzyFileSearchSession:Sc,error:o,refreshAll:ea,refreshSkills:dn,refreshHooks:fr,hooksList:dr,isHooksLoading:Kr,onRealtimeEvent:ao,selectThread:En,loadMessages:At,loadOlderMessages:Br,ensureThreadMessagesLoaded:Ye,setThreadTerminalOpen:qn,toggleSelectedThreadTerminal:gi,archiveThreadById:Si,compactThreadById:il,renameThreadById:ns,forkThreadById:Ca,forkThreadFromTurn:tu,rollbackSelectedThread:rs,sendMessageToSelectedThread:Qt,sendMessageToNewThread:os,interruptSelectedThreadTurn:ka,interruptedUnsubmittedMessage:_n,clearInterruptedUnsubmittedMessage:Bs,selectedThreadQueuedMessages:St,removeQueuedMessage:jo,reorderQueuedMessage:oo,steerQueuedMessage:Oo,autoCompactThreshold:yo,setAutoCompactThreshold:ln,setSelectedCollaborationMode:M,readModelIdForThread:Le,setSelectedModelIdForThread:lt,setSelectedModelId:Ke,setSelectedReasoningEffort:Ze,updateSelectedSpeedMode:oe,respondToPendingServerRequest:ll,pendingReplyErrorForRequest:Rs,renameProject:Ve,removeProject:me,reorderProject:Ne,pinProjectToTop:ke,startPolling:Us,stopPolling:Cn,primeSelectedThread:ko}}const Ey="codex-web-local.sidebar-collapsed.v1",My="codex-web-local.accounts-section-collapsed.v1";function LN(){return typeof window>"u"?!1:window.localStorage.getItem(Ey)==="1"}function NN(e){typeof window>"u"||window.localStorage.setItem(Ey,e?"1":"0")}function $N(){if(typeof window>"u")return!0;const e=window.localStorage.getItem(My);return e===null?!0:e==="1"}function ON(){const e=S(LN()),t=S($N()),n=S(""),o=S(!1),r=S(null),a=S(null);let s=0,i=0,l=!1;function d(L){var j;if(e.value!==L){if(L){const U=(j=f())==null?void 0:j.scrollTop;typeof U=="number"&&(U>0||s===0)&&(s=U)}e.value=L,NN(L),L||y()}}function c(){o.value=!o.value,o.value?Nt(()=>{var L;return(L=a.value)==null?void 0:L.focus()}):n.value=""}function v(){var L;n.value="",(L=a.value)==null||L.focus()}function f(){return r.value?r.value:typeof document>"u"?null:document.querySelector(".mobile-drawer .sidebar-scrollable, .sidebar-scrollable")}function b(L){if(e.value||l)return;const U=(L==null?void 0:L.currentTarget)&&typeof HTMLElement<"u"&&L.currentTarget instanceof HTMLElement?L.currentTarget:f();s=(U==null?void 0:U.scrollTop)??s}function y(){const L=++i,j=s,U=90;l=!0;const H=()=>{L===i&&(s=j,l=!1)},be=le=>{if(L!==i)return;if(e.value){H();return}const W=f();if(W&&(W.scrollTop=j,Math.abs(W.scrollTop-j)<=1||le>=U)){H();return}if(le>=U||typeof window>"u"){H();return}window.requestAnimationFrame(()=>be(le+1))};Nt(()=>be(0))}function P(L){L.key==="Escape"&&(o.value=!1,n.value="")}function B(){t.value=!t.value,!(typeof window>"u")&&window.localStorage.setItem(My,t.value?"1":"0")}return{isSidebarCollapsed:e,isAccountsSectionCollapsed:t,sidebarSearchQuery:n,isSidebarSearchVisible:o,sidebarScrollableRef:r,sidebarSearchInputRef:a,setSidebarCollapsed:d,toggleSidebarSearch:c,clearSidebarSearch:v,onSidebarScroll:b,onSidebarSearchKeydown:P,restoreSidebarScrollPosition:y,toggleAccountsSectionCollapsed:B}}const jy="codex-web-local.right-panel-width.v1",DN=260,FN=640,Qm=320;function Ly(e){return Math.min(FN,Math.max(DN,e))}function BN(){if(typeof window>"u")return Qm;const e=window.localStorage.getItem(jy),t=Number(e);return Number.isFinite(t)?Ly(t):Qm}function UN(e){typeof window>"u"||window.localStorage.setItem(jy,String(e))}function zN(e){const{isMobile:t,canShowRightPanel:n,isVirtualKeyboardOpen:o}=e,r=S("git"),a=S([]),s=S(""),i=K(()=>a.value.find(ge=>ge.key===s.value)??null),l=S(!1),d=S(!1),c=S(!1),v=S(BN()),f=S(!1),b=S(!1);let y=null;function P(){y&&(clearTimeout(y),y=null)}function B(){f.value=!1,b.value=!1,P()}function L(ge){ge.preventDefault();const Y=ge.clientX,pe=v.value,ne=$e=>{const te=Y-$e.clientX;v.value=Ly(pe+te)},xe=()=>{UN(v.value),window.removeEventListener("mousemove",ne),window.removeEventListener("mouseup",xe)};window.addEventListener("mousemove",ne),window.addEventListener("mouseup",xe)}function j(){n()&&(t()&&!d.value&&(d.value=!0),t()||(c.value=!1),r.value=r.value==="terminal"?"git":"terminal",r.value!=="terminal"&&B())}function U(ge){r.value=ge,l.value=!1,t()||(c.value=!1),t()&&(d.value=!0),ge!=="terminal"&&B()}function H(ge){const Y=a.value.find(pe=>pe.path===ge.path);if(Y)s.value=Y.key;else{const pe={key:`preview-${Date.now()}`,path:ge.path,label:ge.label};a.value=[...a.value,pe],s.value=pe.key}U("preview")}function be(ge){a.value.some(Y=>Y.key===ge)&&(s.value=ge,U("preview"))}function le(ge){const Y=a.value.findIndex(xe=>xe.key===ge);if(Y<0)return;const pe=a.value.filter(xe=>xe.key!==ge);if(a.value=pe,s.value!==ge)return;if(pe.length===0){s.value="",r.value="files";return}const ne=pe[Math.min(Y,pe.length-1)];s.value=ne.key}function W(){if(t()){d.value=!1;return}c.value=!0,l.value=!1,B()}function he(){if(t()){d.value=!d.value;return}c.value=!c.value,c.value&&(l.value=!1,B())}function Se(){r.value="git",t()&&(d.value=!1),B()}function Pe(ge){if(f.value=ge,!ge){b.value=!1,P();return}b.value=!0,P(),y=setTimeout(()=>{y=null,o()||(b.value=!1)},1500)}return{activeRightPanelTab:r,filePreviewTabs:a,activeFilePreviewTabKey:s,activeFilePreviewTab:i,isRightPanelMenuOpen:l,isMobileRightPanelOpen:d,isRightPanelCollapsed:c,rightPanelWidth:v,isTerminalInputFocused:f,isTerminalKeyboardFocusFallbackActive:b,onRightResizeHandleMouseDown:L,toggleRightPanelTerminal:j,selectRightPanelTab:U,onOpenFilePreview:H,selectFilePreviewTab:be,closeFilePreviewTab:le,onCloseRightPanel:W,onToggleRightPanelToggle:he,onHideRightPanelTerminal:Se,onTerminalFocusChange:Pe,resetTerminalKeyboardFocusState:B,clearTerminalKeyboardFocusFallbackTimer:P}}function HN(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 qN(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!HN(e))throw new Error("Copy failed")}const WN=400;function GN(e,t,n,o){return e==="visible"&&!n&&t!==null&&o-t>=WN}const VN={class:"sidebar-root"},KN=["aria-pressed","aria-label","title"],YN={key:1,class:"sidebar-search-bar"},JN=["placeholder"],QN=["aria-label"],XN={class:"sidebar-skills-link-icon","aria-hidden":"true"},ZN={class:"sidebar-skills-link-copy"},e$={class:"sidebar-skills-link-title"},t$={class:"sidebar-skills-link-subtitle"},n$={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},o$={class:"sidebar-skills-link-copy"},r$={class:"sidebar-skills-link-title"},a$={class:"sidebar-skills-link-subtitle"},s$={class:"sidebar-settings-actions"},i$=["title","aria-label"],l$=["title","aria-label"],u$={class:"content-root-wrap"},c$={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},d$={key:1,class:"skills-route-header-icon","aria-hidden":"true"},f$={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},p$=["aria-label","title"],h$={class:"content-body"},m$={key:2,class:"content-grid content-grid-home"},v$={class:"new-thread-empty"},g$={class:"new-thread-hero"},y$=["title"],w$={class:"new-thread-folder-actions"},b$=["disabled"],T$={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},S$={class:"new-thread-launch-card-copy"},C$={class:"new-thread-launch-card-topline"},x$={class:"new-thread-launch-card-badge","aria-hidden":"true"},k$={class:"new-thread-launch-card-eyebrow"},I$={class:"new-thread-launch-card-title"},A$={class:"new-thread-launch-card-text"},_$={class:"new-thread-launch-card-actions"},P$=["aria-label","onKeydown"],R$={class:"new-thread-open-folder-header"},E$={class:"new-thread-open-folder-title"},M$={class:"new-thread-open-folder-label"},j$={class:"new-thread-open-folder-current"},L$=["placeholder","title","disabled","onKeydown"],N$=["disabled"],$$={class:"new-thread-open-folder-actions"},O$={class:"new-thread-open-folder-toggle"},D$=["aria-pressed","disabled"],F$={key:0,class:"new-thread-open-folder-create"},B$={class:"new-thread-open-folder-create-composer"},U$=["placeholder","onKeydown"],z$=["disabled"],H$={key:0,class:"new-thread-open-folder-error visible-error-with-feedback"},q$=["href"],W$=["placeholder","onKeydown"],G$={key:1,class:"new-thread-open-folder-error-actions"},V$={class:"new-thread-open-folder-error visible-error-with-feedback"},K$=["href"],Y$=["disabled"],J$={key:2,class:"new-thread-open-folder-status"},Q$={key:3,class:"new-thread-open-folder-status"},X$={key:4,class:"new-thread-open-folder-list"},Z$=["title","disabled","onClick"],eO={class:"new-thread-open-folder-item-name"},tO=["disabled","onClick"],nO=["aria-label","onKeydown"],oO={class:"new-thread-open-folder-header"},rO={class:"new-thread-open-folder-title"},aO=["disabled"],sO=["aria-label"],iO=["aria-selected","disabled"],lO=["aria-selected","disabled"],uO={class:"new-thread-project-field"},cO={class:"new-thread-open-folder-label"},dO=["disabled","placeholder"],fO={key:0,class:"new-thread-project-field"},pO={class:"new-thread-open-folder-label"},hO=["disabled","placeholder","onKeydown"],mO={key:1,class:"new-thread-project-field"},vO={class:"new-thread-open-folder-label"},gO=["disabled","onKeydown"],yO={key:2,class:"new-thread-open-folder-error visible-error-with-feedback"},wO=["href"],bO={class:"new-thread-project-modal-actions"},TO=["disabled"],SO=["disabled"],CO={key:3,class:"new-thread-branch-select"},xO={class:"new-thread-branch-select-label"},kO={class:"new-thread-branch-select-help"},IO={key:4,class:"new-thread-runtime-help"},AO={class:"worktree-init-status-title"},_O={class:"worktree-init-status-message"},PO={class:"composer-with-queue"},RO={key:0,class:"composer-runtime-error",role:"alert"},EO=["href"],MO={key:3,class:"content-grid"},jO={class:"content-thread"},LO={key:0,class:"external-session-banner",role:"alert"},NO={key:1,class:"composer-runtime-error",role:"alert"},$O=["href"],OO={key:2,class:"interrupt-recovered-banner",role:"status"},DO=["aria-label"],FO={class:"content-right-panel-header"},BO={class:"content-right-panel-tabs",role:"tablist"},UO=["aria-selected"],zO=["aria-selected"],HO=["aria-selected","title","onClick"],qO={class:"content-right-panel-tab-label"},WO=["aria-label","title","onClick"],GO={class:"content-right-panel-actions"},VO={class:"content-right-panel-add-wrap"},KO=["aria-label","title"],YO={key:0,class:"content-right-panel-menu"},JO=["aria-label","title"],QO={class:"content-right-panel-body"},XO={key:0,class:"project-zip-modal-backdrop",role:"presentation"},ZO=["aria-label"],eD={class:"project-zip-modal-header"},tD={class:"project-zip-modal-title"},nD=["aria-label","disabled"],oD={class:"project-zip-modal-copy"},rD={class:"project-zip-progress-label",role:"status","aria-live":"polite"},aD={class:"project-zip-progress-track"},sD={key:0,class:"project-zip-modal-error",role:"alert"},iD={class:"project-zip-modal-actions"},lD=["disabled"],uD=["disabled"],cD=["disabled"],dD=["aria-label"],fD={class:"codex-login-modal-header"},pD={class:"codex-login-modal-title"},hD=["aria-label","disabled"],mD={class:"codex-login-modal-copy"},vD=["href"],gD=["placeholder","disabled"],yD={key:1,class:"codex-login-modal-error visible-error-with-feedback"},wD=["href"],bD={class:"codex-login-modal-actions"},TD=["disabled"],SD=["disabled"],CD=400,Xm="codex-web-local.send-with-enter.v1",Zm="codex-web-local.in-progress-send-mode.v1",ev="codex-web-local.dark-mode.v1",tv="codex-web-local.dictation-click-to-toggle.v1",nv="codex-web-local.dictation-auto-send.v1",ov="codex-web-local.dictation-language.v1",rv="codex-web-local.chat-width.v1",xD=hn({__name:"App",setup(e){var Op,Dp;const t=Ar(()=>_r(()=>import("./ThreadConversation-B4NZvuHw.js"),__vite__mapDeps([0,1,2]))),n=Ar(()=>_r(()=>import("./ThreadTerminalPanel-BLHMQWJI.js"),__vite__mapDeps([3,4]))),o=Ar(()=>_r(()=>import("./ReviewPane-qS7hOyaM.js"),__vite__mapDeps([5,6]))),r=Ar(()=>_r(()=>import("./DirectoryHub-sS2h3U_D.js"),__vite__mapDeps([7,1,8]))),a=Ar(()=>_r(()=>import("./AutomationsPanel-DlBkLmKR.js"),__vite__mapDeps([9,10]))),s=Ar(()=>_r(()=>import("./SettingsDialog-C4aE-PFC.js"),__vite__mapDeps([11,12]))),i=Ar(()=>_r(()=>import("./RightGitPanel-K_jp1qHA.js"),__vite__mapDeps([13,14]))),l=Ar(()=>_r(()=>import("./RightFilesPanel-B5AIrAU3.js"),__vite__mapDeps([15,16]))),d=Ar(()=>_r(()=>import("./RightFilePreview-D1LmPrpY.js"),__vite__mapDeps([17,18]))),c=Ar(()=>_r(()=>import("./ThreadPendingRequestPanel-DNTrk7uR.js"),__vite__mapDeps([19,20]))),v=Ar(()=>_r(()=>import("./QueuedMessages-D_o6pC9F.js"),__vite__mapDeps([21,22]))),{t:f,uiLanguage:b,uiLanguageOptions:y,setUiLanguage:P}=da(),B="codex-mobile",L="0.1.113",j={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},U={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:H,projectDisplayNameById:be,selectedThread:le,selectedThreadTokenUsage:W,selectedThreadServerRequests:he,selectedLiveOverlay:Se,lastPlanByThreadId:Pe,resolveThreadTurnIndex:ge,selectedActiveTurnId:Y,codexQuota:pe,selectedThreadId:ne,availableCollaborationModes:xe,availableModelIds:$e,availableModelReasoningEfforts:te,selectedCollaborationMode:de,selectedReasoningEffort:Le,selectedSpeedMode:Ae,codexCliMissingError:Fe,installedSkills:Ke,accountRateLimitSnapshots:lt,messages:Ze,hasMoreOlderMessages:ut,isLoadingThreads:fe,isThreadListFullyLoaded:N,isLoadingMessages:oe,isLoadingOlderMessages:ue,isSendingMessage:Ee,isInterruptingTurn:Be,isSelectedThreadInterruptPending:A,isUpdatingSpeedMode:M,error:z,refreshAll:Z,refreshSkills:ce,refreshHooks:re,hooksList:je,isHooksLoading:Re,onRealtimeEvent:ke,selectThread:me,ensureThreadMessagesLoaded:Ve,loadMessages:Ne,loadOlderMessages:He,archiveThreadById:Ue,compactThreadById:Je,compactingThreadIds:et,fuzzyFileSearchResults:st,registerFuzzyFileSearchSession:mt,forkThreadById:q,renameThreadById:ae,forkThreadFromTurn:_e,sendMessageToSelectedThread:Ye,sendMessageToNewThread:bt,interruptSelectedThreadTurn:Tt,interruptedUnsubmittedMessage:At,clearInterruptedUnsubmittedMessage:Br,selectedThreadQueuedMessages:zt,removeQueuedMessage:Ha,reorderQueuedMessage:fa,steerQueuedMessage:pa,autoCompactThreshold:ar,setAutoCompactThreshold:Ur,setSelectedCollaborationMode:zr,readModelIdForThread:Ps,setSelectedModelIdForThread:qa,setSelectedReasoningEffort:Wa,updateSelectedSpeedMode:Uo,respondToPendingServerRequest:sr,pendingReplyErrorForRequest:Zn,renameProject:Rs,removeProject:ha,reorderProject:Es,pinProjectToTop:zo,startPolling:Po,stopPolling:Dn,primeSelectedThread:Ga,rollbackSelectedThread:Ms}=jN(),vt=ix(),Ct=sx(),{isMobile:kt}=Df();function mn(){return typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}const Fn=S(null),ho=S(null),Hr=S(null);let qr=null;const{buildFeedbackMailto:mo,feedbackMailtoBase:Ho,recordVisibleFailure:Ro}=ny(),Bn=Ho();function xt(u,p){p&&Ro(p);const T=u.currentTarget;T instanceof HTMLAnchorElement&&(T.href=mo())}const eo=S(null),vo=S(null),Eo=S(null),Mo=S(0);let en=null;function Un(){const u=Eo.value;if(!u)return;const p=window.getComputedStyle(u),T=Number.parseFloat(p.paddingLeft)+Number.parseFloat(p.paddingRight),O=Math.max(0,u.clientWidth-(Number.isFinite(T)?T:0)),V=window.getComputedStyle(u).getPropertyValue("--chat-column-max").trim(),Te=Number.parseFloat(V)*(V.endsWith("rem")?16:1),De=Number.isFinite(Te)&&Te>0?Math.min(O,Te):O;Mo.value=De}const ir=S(null),lr=S(null),bn=S(!0),ma=zN({isMobile:()=>kt.value,canShowRightPanel:()=>su.value,isVirtualKeyboardOpen:()=>pl.value}),{activeRightPanelTab:tn,filePreviewTabs:Wr,activeFilePreviewTabKey:go,activeFilePreviewTab:Lt,isRightPanelMenuOpen:zn,isMobileRightPanelOpen:sn,isRightPanelCollapsed:to,rightPanelWidth:nn,isTerminalInputFocused:Va,isTerminalKeyboardFocusFallbackActive:on,onRightResizeHandleMouseDown:qo,toggleRightPanelTerminal:ur,selectRightPanelTab:Ht,onOpenFilePreview:js,selectFilePreviewTab:Gr,closeFilePreviewTab:Wo,onCloseRightPanel:yo,onToggleRightPanelToggle:qt,onHideRightPanelTerminal:Ka,onTerminalFocusChange:no,resetTerminalKeyboardFocusState:Ya,clearTerminalKeyboardFocusFallbackTimer:wo}=ma,Vr=S(null),bo=S(!1),jo=S("");let oo=!1;const cr=S(!1),St=S(""),ln=S("local"),In=S({}),dr=new Map,An=S(""),Kr=S([]),fr=S(!1),dn=S({order:[],labels:{},projectOrder:[]}),C=S({phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""}),E=S({phase:"idle",title:"",message:""}),Q=ON(),{isSidebarCollapsed:ye,isAccountsSectionCollapsed:ct,sidebarSearchQuery:_t,isSidebarSearchVisible:_n,sidebarScrollableRef:Kt,sidebarSearchInputRef:Pn,setSidebarCollapsed:Wt,toggleSidebarSearch:vn,clearSidebarSearch:mi,onSidebarScroll:pr,onSidebarSearchKeydown:hr,toggleAccountsSectionCollapsed:Ls}=Q,mr=S(null),Yr=S(null),Tn=S(null),vr=S(null);let Lo=null,va=0,$t=0,ga=0,rn=0;const gr=S("New Project (1)"),ya=S(""),Sn=S(!1),Ns=S("general");let Ja=0;function rl(){if(Sn.value){Ja=Date.now(),Sn.value=!1;return}Date.now()-Ja<CD||(Sn.value=!0)}const Hn=S(!1),Yt=S(!1),Gt=S(new Set);async function vi(){try{Gt.value=new Set(await Bk())}catch{}finally{Yt.value=!0}}const al=K(()=>!Yt.value||Gt.value.has("hooks/list")),$s=K(()=>!Yt.value||["remoteControl/status/read","remoteControl/enable","remoteControl/pairing/start","remoteControl/client/list"].every(u=>Gt.value.has(u)));tt(Sn,u=>{u&&(re(),wi(),$s.value&&Ds())});const qn=S({enabled:!1,clients:[]}),gi=S(null),ro=S(!1),un=S(!1),Wn=S(""),yr=S(""),wr=S("");let Go=null,wa=!1,Qa=null;const Jr=S("never"),yi=S(!1),ba=S(!1),Rn=S(""),To=S("");let Xa=!1;const Ta=S(!1);async function wi(u={}){if(!(u.force!==!0&&Xa)){yi.value=!0,Rn.value="";try{Jr.value=await TI(),Xa=!0}catch(p){Rn.value=p instanceof Error?p.message:"Failed to load approval policy"}finally{yi.value=!1}}}function Os(u){Jr.value=u}async function Gn(){ba.value=!0,Rn.value="",To.value="";try{await SI(Jr.value),Ta.value=!0,To.value=f("Approval policy saved"),Vo&&clearTimeout(Vo),Vo=setTimeout(()=>{To.value=""},2200)}catch(u){Rn.value=u instanceof Error?u.message:"Failed to save approval policy"}finally{ba.value=!1}}let Vo=null;async function Ds(u={}){if(!(u.force!==!0&&wa)){ro.value=!0,yr.value="";try{const p=await bI();qn.value=p,wa=!0}catch(p){yr.value=p instanceof Error?p.message:"Failed to load remote control status"}finally{ro.value=!1}}}async function Fs(){const u=!qn.value.enabled;un.value=!0,Wn.value=u?"enable":"disable";try{await CI(u),qn.value={...qn.value,enabled:u},Sa(u?"Remote control enabled":"Remote control disabled")}catch(p){yr.value=p instanceof Error?p.message:"Failed to update remote control"}finally{un.value=!1,Wn.value=""}}async function bi(){un.value=!0,Wn.value="pairing";try{gi.value=await xI()}catch(u){yr.value=u instanceof Error?u.message:"Failed to start pairing"}finally{un.value=!1,Wn.value=""}}async function sl(){un.value=!0,Wn.value="clients";try{qn.value={...qn.value,clients:await kI()}}catch(u){yr.value=u instanceof Error?u.message:"Failed to load remote clients"}finally{un.value=!1,Wn.value=""}}async function Ti(u){un.value=!0,Wn.value=`revoke:${u}`;try{await II(u),qn.value={...qn.value,clients:qn.value.clients.filter(p=>p.clientId!==u)},Sa("Remote client removed")}catch(p){yr.value=p instanceof Error?p.message:"Failed to remove remote client"}finally{un.value=!1,Wn.value=""}}function Sa(u){wr.value=u,Go&&clearTimeout(Go),Go=setTimeout(()=>{wr.value=""},3e3)}const Qr=S(""),Xr=S(""),Za=S([]),So=S(null),No=S(null),$o=S(null),Zr=S(null),x=S(!1),R=S(!1),k=S({addedLineCount:0,removedLineCount:0}),G=S([]),We=S(""),Ot=S({}),ao=S(""),Co=S(""),cn=S({}),br=S(""),es=S(""),ts=S(!1),Tr=S(!1);function Tc(u,p){return`${u}\0${p?"with-reset-history":"without-reset-history"}`}const eu=S(null),Vn=S([]),Sr=S(!1),Cr=S(!1),ea=S(!1),En=S(!1),Si=S(!1),ns=S(""),Ca=S(""),tu=S(null),xa=S(""),Ko=S(""),xo=S(""),Qt=S(""),os=S(Qc(Xm,!0)),ta=S(Wb()),ka=S(qb()),Bs=S(Gb()),rs=S(Qc(tv,!1)),Yo=S(Qc(nv,!0)),xr=S(lT()),Sc=K(()=>uT()),il=K(()=>{const{loaded:u,total:p}=C.value,T=hp(u);return p&&p>0?`${T} / ${hp(p)}`:u>0?T:f("Preparing...")}),Jo=K(()=>{const{loaded:u,total:p,phase:T}=C.value;return T==="ready"?"100%":!p||p<=0?u>0?"55%":"20%":`${Math.min(100,Math.max(5,Math.round(u/p*100)))}%`}),Ci=S(!1),na=S(!1),Us=S(!1),zs=S(""),nu=S(!1),ll=S(null),Cn=S(!1),Oo=S(""),ko=S("codex"),m=K(()=>[{value:"codex",label:f("Codex")},{value:"openrouter",label:f("OpenRouter")},{value:"opencode-zen",label:f("OpenCode Zen")},{value:"custom",label:f("Custom endpoint")}]),g=S(""),I=S(""),$=S("responses"),J=S("responses"),ie=S(""),X=S(!1),se=S(""),we=S(""),Ie=S(""),ze=S(!1),pt=S(!1),ht=S(""),it=S(""),Pt=S(!1),Ia=S(!1),Kn=S("create"),Hs=S(""),oa=S(""),Aa=S(""),qs=S(!1),Qo=S(""),Mn=S(!1),xi=S(null),ul=S(null),kr=S(!1),cl=S(null),ou=S(null),ra=S(""),Do=S(""),as=S(""),ki=S([]),fn=S(""),Ce=S(!1),wt=S(!1),Fo=S(!1),so=S(""),ru=[z,Fe,We,Co,Qt,Oo,Ie,it,Qo,fn],Ny=K(()=>ru.some(u=>u.value.trim().length>0)),aa=S({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),Cc=S(null),xc=S(!1),kc=S(!1),Ws=S(typeof window<"u"?((Op=window.visualViewport)==null?void 0:Op.height)??window.innerHeight:0),Ic=S(typeof window<"u"?((Dp=window.visualViewport)==null?void 0:Dp.offsetTop)??0:0),dl=S(typeof window<"u"?window.innerHeight:0);let ss=null,Ac=!1,_c=!1,Pc=!1,fl=0;const Gs=K(()=>{const u=vt.params.threadId;return typeof u=="string"?u:""}),gn=K(()=>vt.name==="home"),is=K(()=>vt.name==="skills"),Vs=K(()=>vt.name==="automations"),Yf=K(()=>{const u=vt.query.automationId;return typeof u=="string"?u:""}),$y=K(()=>{var u;return Vs.value?f("Automations"):is.value?f("Skills"):gn.value?f("Start new thread"):((u=le.value)==null?void 0:u.title)??f("Choose a thread")}),Oy=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",Dy=K(()=>{var p,T;return(((T=(p=le.value)==null?void 0:p.title)==null?void 0:T.trim())??"")||Oy}),Ii=K(()=>Ze.value.filter(u=>{const p=dT(u.messageType,u.role);return p==="worked"?!0:!(p==="turnActivity.live"||p==="turnError.live"||p==="agentReasoning.live")})),Rc=S([]);tt(()=>[Ii.value,oe.value],([u,p])=>{p||(Rc.value=u)},{immediate:!0});const Fy=K(()=>oe.value&&Rc.value.length>0?Rc.value:Ii.value),Jf=new Set(["commandExecution","worked","toolCall","fileChange","agentMessage","agentMessage.live","plan"]),Ec=S(null);function By(u,p,T){const O=typeof p.turnIndex=="number"?p.turnIndex:-1;return O<0?!1:u.some((V,Te)=>Te>T&&typeof V.turnIndex=="number"&&V.turnIndex>=O&&Jf.has(V.messageType??""))}function Uy(u,p){return u.some(T=>typeof T.turnIndex=="number"&&T.turnIndex>=p&&Jf.has(T.messageType??""))}const Mc=K(()=>{const u=Ii.value,p=oe.value;for(let Te=u.length-1;Te>=0;Te-=1){const De=u[Te];if(De.messageType!=="plan"&&De.messageType!=="plan.live")continue;const Ft=Om(De);if(!Ft||Ec.value!==null&&De.id===Ec.value)return null;const gT=p?!0:By(u,De,Te);return{id:De.id,streaming:De.messageType==="plan.live",explanation:Ft.explanation,steps:Ft.steps,implemented:gT}}const T=ne.value?Pe.value[ne.value]??null:null;if(!T)return null;const O=Om(T);if(!O)return null;const V=typeof T.turnIndex=="number"?T.turnIndex:T.turnId?ge(ne.value,T.turnId)??-1:-1;return{id:T.id,streaming:T.messageType==="plan.live",explanation:O.explanation,steps:O.steps,implemented:p?!0:V>=0?Uy(u,V):!1}}),zy=K(()=>Se.value),Ks=K(()=>gn.value?"__new-thread__":ne.value),Qf=K(()=>Ps(Ks.value)),au=K(()=>{const u=he.value;return u.length>0?u[u.length-1]:null}),Hy=K(()=>au.value?Zn(au.value.id):""),yn=K(()=>{var u,p;return gn.value?St.value.trim():((p=(u=le.value)==null?void 0:u.cwd)==null?void 0:p.trim())??""}),su=K(()=>bn.value&&(gn.value&&yn.value.length>0||vt.name==="thread"&&ne.value.length>0)),qy=K(()=>su.value&&tn.value==="terminal"),pl=K(()=>!kt.value||Ws.value<=0||dl.value<=0?!1:dl.value-Ws.value>120),Wy=K(()=>pl.value||qy.value&&on.value),Xf=K(()=>{var u,p;return((p=(u=le.value)==null?void 0:u.cwd)==null?void 0:p.trim())??St.value.trim()}),jc=K(()=>{var u;return!gn.value&&((u=le.value)==null?void 0:u.inProgress)===!0}),Gy=K(()=>{const u=ne.value;return!!u&&et.value.has(u)}),Zf=K(()=>{var u,p;return!gn.value&&((p=(u=le.value)==null?void 0:u.externalSession)==null?void 0:p.active)===!0}),Lc=K(()=>Ee.value||Be.value||jc.value||he.value.length>0);function ep(){Ci.value&&(Ci.value=!1,dI(!0))}function Vy(){ep(),Ct.push({name:"skills",query:{tab:"plugins"}})}function Ky(){const u=ne.value;u&&Je(u)}function Nc(u,p){const T=Xe(u).trim(),O=Bo(T);return!T||!O?!1:p.some(V=>{const Te=Xe(V).trim();return Te!==T&&Bo(Te)===O})}function $c(u,p=""){const T=Xe(u).trim(),O=p.trim();if(O)return O;const V=Bo(T),Te=[...dn.value.order,...H.value.map(De=>{var Ft,Io;return((Io=(Ft=De.threads[0])==null?void 0:Ft.cwd)==null?void 0:Io.trim())??""}).filter(Boolean)];return Nc(T,Te)?T:V}function Yy(){const u=new Set(dn.value.order),p=dn.value.projectOrder.filter(T=>u.has(T));for(const T of dn.value.order)p.includes(T)||p.push(T);return p}function hl(u){const p=Xe(u).trim(),T=[...dn.value.order,...H.value.map(O=>{var V,Te;return((Te=(V=O.threads[0])==null?void 0:V.cwd)==null?void 0:Te.trim())??""}).filter(Boolean)];return Nc(p,T)?p:Bo(p)}function tp(u){const p=Xe(u).trim();if(!p)return"";const T=[...dn.value.order,...H.value.map(O=>{var V,Te;return((Te=(V=O.threads[0])==null?void 0:V.cwd)==null?void 0:Te.trim())??""}).filter(Boolean)];for(const O of dn.value.order){const V=Xe(O).trim();if(!V)continue;const Te=Bo(V),De=Nc(V,T)?V:Te;if(V===p||De===p||Te===p)return V}return""}const Oc=K(()=>{var O,V;const u=[],p=new Set;for(const Te of Yy()){const De=Te.trim();!De||p.has(De)||(p.add(De),u.push({value:De,label:$c(De,dn.value.labels[De])}))}for(const Te of H.value){const De=((V=(O=Te.threads[0])==null?void 0:O.cwd)==null?void 0:V.trim())??"";!De||p.has(De)||Ku(De)||(p.add(De),u.push({value:De,label:$c(De,be.value[Te.projectName])}))}const T=St.value.trim();return T&&!p.has(T)&&u.unshift({value:T,label:$c(T)}),u}),Ys=K(()=>{const u=St.value.trim();return u?In.value[u]===!0:!1}),Jy=K(()=>{var p,T;const u={};for(const O of H.value){const V=_i(O.projectName,((T=(p=O.threads[0])==null?void 0:p.cwd)==null?void 0:T.trim())??"");u[O.projectName]=V?In.value[V]===!0:!1}return u}),Dc=K(()=>{const u=An.value.trim(),p=[...Kr.value];return u&&!p.some(T=>T.value===u)&&p.unshift({value:u,label:u}),p}),np=K(()=>{const u=An.value.trim();if(!u)return"";const p=Dc.value.find(T=>T.value===u);return(p==null?void 0:p.label)??u}),op=K(()=>Do.value.trim()),rp=K(()=>{const u=ht.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),Qy=K(()=>rp.value&&op.value.trim().length>0&&!fn.value),ap=K(()=>{const u=oa.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),sp=K(()=>Hs.value.trim()?Kn.value==="create"?ap.value:Aa.value.trim().length>0:!1),ml=K(()=>{const u=Xe(ra.value).trim();return u||Do.value.trim()}),Xy=K(()=>Pt.value?"Creating…":"Create"),Zy=K(()=>Mn.value?Kn.value==="clone"?f("Cloning…"):f("Creating…"):Kn.value==="clone"?f("Clone repository"):f("Create project")),ew=K(()=>{const u=Do.value.trim(),p=as.value.trim();return!!(u&&p&&u!==p)}),ip=K(()=>{const u=[];ew.value&&u.push({key:`parent:${as.value}`,name:"..",path:as.value,kind:"parent"});for(const p of ki.value)u.push({key:`directory:${p.path}`,name:p.name,path:p.path,kind:"directory"});return u}),Fc=K(()=>{const u=so.value.trim().toLowerCase();return u?ip.value.filter(p=>p.kind==="parent"||p.name.toLowerCase().includes(u)):ip.value}),Ai=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,tw=K(()=>f(j[Bs.value].label)),nw=K(()=>{const u=j[Bs.value],p=Math.max(0,dl.value-Ws.value-Ic.value);return{"--chat-column-max":u.columnMax,"--chat-card-max":u.cardMax,"--visual-viewport-height":Ws.value>0?`${Ws.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,Ic.value)}px`,"--virtual-keyboard-inset":`${p}px`}}),ow=K(()=>{if(!aa.value.configured)return f("Not configured");const u=aa.value.active?f("Online"):f("Configured (offline)"),p=aa.value.allowAllUsers?f("allow all users"):`${aa.value.allowedUsers} ${f("allowed user(s)")}`,T=`${aa.value.mappedChats} ${f("chat(s)")}, ${aa.value.mappedThreads} ${f("thread(s)")}, ${p}`,O=aa.value.lastError?`, ${f("error")}: ${aa.value.lastError}`:"";return`${u}, ${T}${O}`});pi(()=>{var u,p;document.addEventListener("pointerdown",wp),window.addEventListener("keydown",yp),document.addEventListener("visibilitychange",bp),window.addEventListener("pageshow",Tp),window.addEventListener("focus",Sp),window.addEventListener("resize",Js),(u=window.visualViewport)==null||u.addEventListener("resize",Js),(p=window.visualViewport)==null||p.addEventListener("scroll",Js),Js(),pu(),Ai==null||Ai.addEventListener("change",pu),qr=ke(T=>{Hr.value&&Hr.value.refreshFromNotification(T)}),Qa=ke(T=>{T==="remoteControl/status/changed"&&Ds({force:!0})}),fT(),$b(),vi(),sw(),us(),Ir(),up(),Bc(),Xc(),ob(),wi()}),tt(ru,(u,p)=>{u.forEach((T,O)=>{if(T===p[O])return;const V=T.trim();V&&Ro(V)})}),tt(Eo,u=>{en&&(en.disconnect(),en=null),typeof ResizeObserver<"u"&&(en=new ResizeObserver(Un),u&&en.observe(u)),Un()},{immediate:!0}),Jl(()=>{var u,p;document.removeEventListener("pointerdown",wp),window.removeEventListener("keydown",yp),document.removeEventListener("visibilitychange",bp),window.removeEventListener("pageshow",Tp),window.removeEventListener("focus",Sp),window.removeEventListener("resize",Js),(u=window.visualViewport)==null||u.removeEventListener("resize",Js),(p=window.visualViewport)==null||p.removeEventListener("scroll",Js),Ai==null||Ai.removeEventListener("change",pu),en&&(en.disconnect(),en=null),ss!==null&&(window.clearInterval(ss),ss=null),Lo&&(clearTimeout(Lo),Lo=null),wo(),Dn(),qr&&(qr(),qr=null),Qa&&(Qa(),Qa=null),Go&&(clearTimeout(Go),Go=null)});function Js(){var u,p;typeof window>"u"||(dl.value=Math.max(dl.value,window.innerHeight),Ws.value=((u=window.visualViewport)==null?void 0:u.height)??window.innerHeight,Ic.value=((p=window.visualViewport)==null?void 0:p.offsetTop)??0)}tt(_t,u=>{const p=u.trim();if(Lo&&(clearTimeout(Lo),Lo=null),!p){vr.value=null;return}Lo=setTimeout(()=>{Rx(p,1e3).then(T=>{_t.value.trim()===p&&(vr.value=T.threadIds)}).catch(()=>{_t.value.trim()===p&&(vr.value=null)})},220)}),tt(pl,u=>{u||(on.value=!1)}),tt(Vn,()=>{if(typeof window>"u")return;if(!Vn.value.some(p=>p.quotaStatus==="loading")){ss!==null&&(window.clearInterval(ss),ss=null);return}ss===null&&(ss=window.setInterval(()=>{Ac||(Ac=!0,vl({silent:!0}).finally(()=>{Ac=!1}))},1500))},{deep:!0}),tt(lt,()=>{lp().then(u=>{u&&Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})})},{deep:!0});async function lp(){if(!_c||Pc||ko.value!=="codex"||Vn.value.length>0||lt.value.length===0)return!1;Pc=!0;const u=JSON.stringify(Vn.value.map(T=>T.accountId).sort());try{const T=await hm();Vn.value=T.accounts}catch{await vl({silent:!0})}const p=JSON.stringify(Vn.value.map(T=>T.accountId).sort());return u!==p}function rw(){ce({force:!0})}function aw(u){u&&Ne(u,{silent:!0,force:!0})}async function Bc(){try{aa.value=await nI()}catch(u){const p=u instanceof Error?u.message:"Failed to load Telegram status";aa.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:p}}}async function up(){try{const u=await tI();se.value=u.botToken,we.value=u.allowedUserIds.map(p=>String(p)).join(`
|
|
79
|
-
`),Ie.value=""}catch(u){Ie.value=u instanceof Error?u.message:"Failed to load Telegram configuration"}}async function sw(){const u=await cI();Ci.value=u.dismissed!==!0}function iw(u){const p=u.split(/[\n,]/).map(V=>V.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),T=p.includes("*"),O=Array.from(new Set(p.filter(V=>/^-?\d+$/.test(V)).map(V=>Number.parseInt(V,10))));return T?["*",...O]:O}async function lw(){const u=se.value.trim(),p=iw(
|
|
80
|
-
`),await Promise.all([up(),Bc()]),window.alert(f("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(T){Ie.value=T instanceof Error?T.message:f("Failed to connect Telegram bot"),Bc()}finally{ze.value=!1}}function uw(u){u&&(vt.name==="thread"&&Gs.value===u||(Ct.push({name:"thread",params:{threadId:u}}),kt.value&&Wt(!0)))}function cw(u){vt.name==="automations"&&Yf.value!==u&&Ct.replace({name:"automations",query:u?{automationId:u}:{}})}async function dw(u){var p;
|
|
81
|
-
`)}async function vl(u={}){try{const p=await _I();Vn.value=p.accounts,p.accounts.some(T=>T.storageId===xo.value)||(xo.value=""),p.accounts.some(T=>T.storageId===Ko.value)||(Ko.value="")}catch(p){if(u.silent===!0)return;Qt.value=p instanceof Error?p.message:f("Failed to load accounts")}}async function Iw(){if(!(Sr.value||Cr.value||ea.value||En.value)){Qt.value="",xo.value="",Ko.value="",Sr.value=!0;try{const u=await hm();Vn.value=u.accounts,Dn(),Po(),Z({includeSelectedThreadMessages:!0})}catch(u){Qt.value=u instanceof Error?u.message:f("Failed to refresh accounts")}finally{Sr.value=!1}}}async function Aw(u){if(!(Cr.value||Sr.value||ea.value||En.value)){if(Lc.value){Qt.value=f("Finish the current turn and pending requests before switching accounts.");return}Qt.value="",xo.value="",Ko.value="",Cr.value=!0;try{const p=await EI(u);Vn.value=Vn.value.map(T=>T.storageId===u?p:{...T,isActive:!1}),Dn(),Po(),Z({includeSelectedThreadMessages:!0}),vl({silent:!0})}catch(p){Qt.value=p instanceof Error?p.message:f("Failed to switch account")}finally{Cr.value=!1}}}async function _w(){var u;if(!(Sr.value||Cr.value||ea.value||En.value)){Qt.value="",Ca.value="",ea.value=!0;try{const p=await PI();ns.value=p,Si.value=!0,window.open(p,"_blank","noopener,noreferrer"),await Nt(),(u=tu.value)==null||u.focus()}catch(p){Qt.value=p instanceof Error?p.message:f("Failed to start Codex login")}finally{ea.value=!1}}}function zc(){En.value||(Si.value=!1,Ca.value="")}async function Pw(){const u=Ca.value.trim();u&&await Rw(u)}async function Rw(u){if(!(En.value||u.length===0)){Qt.value="",En.value=!0;try{const p=await RI(u);Vn.value=p.accounts,ns.value="",Ca.value="",Si.value=!1,Dn(),Po(),Z({includeSelectedThreadMessages:!0})}catch(p){Qt.value=p instanceof Error?p.message:f("Failed to complete Codex login")}finally{En.value=!1}}}async function Ew(u){if(Sr.value||Cr.value||ea.value||En.value||xa.value.length>0)return;const p=Vn.value.find(O=>O.storageId===u)??null;if(!p)return;if(Ko.value!==u){Ko.value=u;return}if(p.isActive&&Lc.value){Qt.value=f("Finish the current turn and pending requests before removing the active account.");return}const T=p.isActive;Qt.value="",Ko.value="",xa.value=u;try{const O=await MI(u);Vn.value=O.accounts,Dn(),Po(),T&&Z({includeSelectedThreadMessages:!0}),vl({silent:!0})}catch(O){Qt.value=O instanceof Error?O.message:f("Failed to remove account")}finally{xa.value=""}}function Mw(u){Ue(u)}function jw(u){Z({includeSelectedThreadMessages:!1,forceThreadRefresh:!0})}async function Lw(u){const p=await q(u);p&&(gn.value?await Ct.replace({name:"thread",params:{threadId:p}}):await Ct.push({name:"thread",params:{threadId:p}}),kt.value&&Wt(!0))}function fp(u){const p=u.trim().replace(/\\/gu,"/");return p?p.includes("/.codex/worktrees/")||p.includes("/.git/worktrees/"):!1}function _i(u,p=""){var Te,De,Ft;const T=H.value.find(Io=>Io.projectName===u);if(!T)return tp(u)||p.trim();const O=T.threads.find(Io=>!fp(Io.cwd));return(((Te=O==null?void 0:O.cwd)==null?void 0:Te.trim())??((Ft=(De=T.threads[0])==null?void 0:De.cwd)==null?void 0:Ft.trim())??"")||tp(u)||p.trim()}function Nw(u){var O,V;const p=H.value.find(Te=>Te.projectName===u),T=_i(u,((V=(O=p==null?void 0:p.threads[0])==null?void 0:O.cwd)==null?void 0:V.trim())??"");T&&(St.value=T),kt.value&&Wt(!0),!gn.value&&Ct.push({name:"home"})}function $w(u){var T;let p="";for(const O of H.value){const V=O.threads.find(Te=>Te.id===u);if((T=V==null?void 0:V.cwd)!=null&&T.trim()){p=V.cwd.trim();break}}!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}function lu(u){var T,O;const p=H.value.find(V=>V.projectName===u);return _i(u,((O=(T=p==null?void 0:p.threads[0])==null?void 0:T.cwd)==null?void 0:O.trim())??"")}const pp=K(()=>Object.fromEntries(H.value.map(u=>[u.projectName,lu(u.projectName).trim()]).filter(([,u])=>u.length>0)));function Ow(u){return(be.value[u]??u).trim()||u}function Dw(u){return Ow(u).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function Fw(u){const p=lu(u);!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}async function Bw(u){const p=lu(u);await vp(p)}async function Uw(u){const p=zw(u);await vp(p)}function zw(u){var p;for(const T of H.value){const O=T.threads.find(V=>V.id===u);if((p=O==null?void 0:O.cwd)!=null&&p.trim())return O.cwd.trim()}return""}function hp(u){if(!Number.isFinite(u)||u<=0)return"0 B";const p=["B","KB","MB","GB"];let T=u,O=0;for(;T>=1024&&O<p.length-1;)T/=1024,O+=1;return`${T>=10||O===0?T.toFixed(0):T.toFixed(1)} ${p[O]}`}function Hw(u,p){const T=URL.createObjectURL(u),O=document.createElement("a");O.href=T,O.download=p,document.body.appendChild(O),O.click(),document.body.removeChild(O),window.setTimeout(()=>URL.revokeObjectURL(T),3e4)}async function qw(u,p){const O={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(O))))throw new Error("File sharing is not supported in this browser.");await navigator.share(O)}function mp(){C.value.phase!=="exporting"&&(C.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""})}function Ww(){const{blob:u,fileName:p}=C.value;!u||!p||(C.value={...C.value,error:""},Hw(u,p))}async function Gw(){const{blob:u,fileName:p}=C.value;if(!(!u||!p))try{C.value={...C.value,error:""},await qw(u,p)}catch(T){if(T instanceof DOMException&&T.name==="AbortError")return;const O=T instanceof Error?T.message:"",V=T instanceof DOMException&&T.name==="NotAllowedError"||/permission denied|notallowed|not allowed|gesture/iu.test(O);C.value={...C.value,error:V?f("This browser blocked sharing the ZIP. Use Download instead."):O||f("Failed to share project. Use Download instead.")}}}async function vp(u){if(!(!u||typeof document>"u")){C.value={phase:"exporting",loaded:0,total:null,blob:null,fileName:"",error:""};try{const{blob:p,fileName:T}=await GI(u,({loaded:O,total:V})=>{C.value={...C.value,phase:"exporting",loaded:O,total:V}});C.value={phase:"ready",loaded:p.size,total:p.size,blob:p,fileName:T,error:""}}catch(p){if(C.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""},p instanceof DOMException&&p.name==="AbortError")return;const T=p instanceof Error?p.message:"Failed to export project.";window.alert(T)}}}async function Vw(u){const p=lu(u);if(!p||typeof window>"u"||(await uu(p),In.value[p]!==!0))return;const T=`${Dw(u)}-`,O=window.prompt("New worktree folder name",T);if(O===null)return;const V=O.trim();if(V){if(V.includes("/")||V.includes("\\")||V==="."||V===".."){window.alert("Worktree name must be a single folder name.");return}try{const Te=await $I(p,V),De=await Tu(Te.cwd,{createIfMissing:!1,label:""});if(!De)return;St.value=De,ln.value="local",zo(hl(De)),await us(),await Ir(),kt.value&&Wt(!0),gn.value||await Ct.push({name:"home"})}catch(Te){const De=Te instanceof Error?Te.message:"Failed to create worktree.";window.alert(De)}}}function Kw(){var T,O,V;const u=le.value;if(!u)return"";const p=((T=u.projectName)==null?void 0:T.trim())??"";return p?_i(p,((V=u.cwd)==null?void 0:V.trim())??""):((O=u.cwd)==null?void 0:O.trim())??""}function Hc(){const u=Kw();u&&(St.value=u),ln.value="local",kt.value&&Wt(!0),!gn.value&&Ct.push({name:"home"})}function Yw(){St.value="",ln.value="local",kt.value&&Wt(!0),!gn.value&&Ct.push({name:"home"})}async function uu(u){const p=u.trim();if(!p||Object.prototype.hasOwnProperty.call(In.value,p))return;const T=dr.get(p);if(T){const Te=await T;Object.prototype.hasOwnProperty.call(In.value,p)||(In.value={...In.value,[p]:Te});return}const O=FI(p).then(Te=>Te.isGitRepo).catch(()=>!1).finally(()=>{dr.delete(p)});dr.set(p,O);const V=await O;Object.prototype.hasOwnProperty.call(In.value,p)||(In.value={...In.value,[p]:V})}function Jw(u){Rs(u.projectName,u.displayName)}function Qw(u){ae(u.threadId,u.title)}async function Xw(u){await ha(u),await us(),Ir()}function Zw(u){Es(u.projectName,u.toIndex)}function eb(u){var O,V;const p=H.value.find(Te=>Te.projectName===u),T=_i(u,((V=(O=p==null?void 0:p.threads[0])==null?void 0:O.cwd)==null?void 0:V.trim())??"");uu(T)}function gp(u){tb(u)}async function tb(u){var O;const p=await sr(u),T=((O=u.followUpMessageText)==null?void 0:O.trim())??"";if(!(!p||!T||gn.value))try{await Ye(T,[],[],"steer",[])}catch{}}async function nb(u){const p=await _e(u.threadId,u.turnIndex);p&&(await Ct.push({name:"thread",params:{threadId:p}}),ne.value!==p&&await me(p),kt.value&&Wt(!0))}function yp(u){if(u.defaultPrevented)return;if(u.key==="Escape"&&Sn.value){Sn.value=!1;return}if(!u.ctrlKey&&!u.metaKey||u.shiftKey||u.altKey)return;const p=u.key.toLowerCase();if(p==="b"){if(!(mn()?u.metaKey&&!u.ctrlKey:u.ctrlKey&&!u.metaKey))return;u.preventDefault(),Wt(!ye.value);return}if(p==="j"&&vt.name==="thread"&&ne.value){u.preventDefault(),ur();return}p==="j"&&gn.value&&yn.value&&(u.preventDefault(),ur())}async function ob(){try{const u=await Mx();bn.value=u.available,!u.available&&tn.value==="terminal"&&(tn.value="git",Ya())}catch{bn.value=!1,tn.value==="terminal"&&(tn.value="git")}}function wp(u){var T,O;const p=u.target;if(p instanceof Node){if(Va.value){const V=p instanceof Element?p:p.parentElement;V!=null&&V.closest(".thread-terminal-panel")||Ya()}Sn.value&&((T=Yr.value)!=null&&T.containsTarget(p)||(O=Tn.value)!=null&&O.contains(p)||(Ja=Date.now(),Sn.value=!1))}}function rb(u){var T,O;if(!Sn.value)return;const p=u.target;p instanceof Node&&((T=Yr.value)!=null&&T.containsTarget(p)||(O=Tn.value)!=null&&O.contains(p)||(Ja=Date.now(),Sn.value=!1))}function ab(){var u;(u=Fn.value)==null||u.openRecycleBin()}function bp(){if(!(typeof document>"u")){if(document.visibilityState==="hidden"){Cc.value=Date.now(),xc.value=!1;return}qc()}}function Tp(u){u.persisted&&qc()}function Sp(){vt.name==="home"&&(us(),Ir()),qc()}function qc(){typeof window>"u"||typeof document>"u"||GN(document.visibilityState,Cc.value,xc.value,Date.now())&&(xc.value=!0,Cc.value=null,sb())}async function sb(){if(!kc.value){kc.value=!0;try{await Z({includeSelectedThreadMessages:!0}),await ed()}finally{kc.value=!1}}}function Cp(u){const p=u.text;cu();const T=Vr.value,O=u.mode==="queue"&&T&&T.threadId===ne.value?T.queueIndex:void 0;if(Vr.value=null,gn.value){pT(p,u.imageUrls,u.skills,u.fileAttachments);return}Ye(p,u.imageUrls,u.skills,u.mode,u.fileAttachments,O)}function ib(u){const p=zt.value.findIndex(Te=>Te.id===u),T=p>=0?zt.value[p]:void 0,O=vo.value;if(!T||!O||O.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Vr.value=ne.value?{threadId:ne.value,queueIndex:p}:null;const V={text:T.text,imageUrls:[...T.imageUrls],fileAttachments:T.fileAttachments.map(Te=>({...Te})),skills:T.skills.map(Te=>({...Te}))};O.hydrateDraft(V),Ha(u)}function cu(){if(!kt.value||gn.value)return;const u=()=>{var p;(p=ir.value)==null||p.jumpToLatest()};u(),Nt(()=>{u(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{u(),window.requestAnimationFrame(u)})})}function lb(u){St.value=u.trim(),it.value=""}function ub(u){An.value=u.trim()}function ls(u){const p=yn.value.trim();return!u||p!==u?!1:vt.name==="thread"||vt.name==="home"&&Ys.value}function xp(){va+=1,$t+=1,ga+=1,rn+=1,Za.value=[],So.value=null,No.value=null,$o.value=null,Zr.value=null,x.value=!1,R.value=!1,k.value={addedLineCount:0,removedLineCount:0},G.value=[],Ot.value={},ao.value="",Co.value="",cn.value={},br.value="",es.value="",We.value="",ts.value=!1}function kp(u){const p=u.trim();if(!p){k.value={addedLineCount:0,removedLineCount:0};return}const T=++rn;oA(p,"unstaged").then(O=>{T!==rn||!ls(p)||(k.value={addedLineCount:O.addedLineCount,removedLineCount:O.removedLineCount})}).catch(()=>{T!==rn||!ls(p)||(k.value={addedLineCount:0,removedLineCount:0})})}async function gl(u){var O,V,Te;const p=u.trim();if(!p){xp();return}const T=++va;ts.value=!0,We.value="";try{const De=await DI(p);if(T!==va||!ls(p))return;Za.value=De.options,So.value=De.currentBranch,No.value=De.headSha,$o.value=De.headSubject,Zr.value=De.headDate,x.value=De.detached,R.value=De.dirty,G.value=De.changedFiles,kp(p);const Ft=((O=De.currentBranch)==null?void 0:O.trim())||((Te=(V=De.options[0])==null?void 0:V.value)==null?void 0:Te.trim())||"";Ft&&Ip({branch:Ft,includeResetHistory:!0})}catch{if(T!==va||!ls(p))return;Za.value=[],So.value=null,No.value=null,$o.value=null,Zr.value=null,x.value=!1,R.value=!1,k.value={addedLineCount:0,removedLineCount:0},G.value=[]}finally{T===va&&(ts.value=!1)}}function cb(u){So.value=u.currentBranch,No.value=u.headSha,$o.value=u.headSubject,Zr.value=u.headDate,x.value=u.detached,R.value=u.dirty,G.value=u.changedFiles,kp(yn.value)}function db(u){if(Tr.value)return;const p=u.trim();if(!p||p===(So.value??""))return;const T=yn.value.trim();T&&(Tr.value=!0,We.value="",BI(T,p).then(O=>(So.value=O||p,No.value=null,$o.value=null,Zr.value=null,x.value=!1,Hn.value=!1,gl(T))).catch(O=>{const V=O instanceof Error?O.message:"Failed to switch branch";gl(T).finally(()=>{We.value=V})}).finally(()=>{Tr.value=!1}))}function fb(u){if(Tr.value)return;const p=u.branch.trim(),T=u.sha.trim(),O=yn.value.trim();!p||!T||!O||(Tr.value=!0,We.value="",HI(O,p,T).then(V=>(cb(V),Hn.value=!1,gl(O))).catch(V=>{const Te=V instanceof Error?V.message:"Failed to reset branch to commit";gl(O).finally(()=>{We.value=Te})}).finally(()=>{Tr.value=!1}))}function Ip(u){const p=(typeof u=="string"?u:u.branch).trim(),T=typeof u=="string"?!0:u.includeResetHistory!==!1,O=yn.value.trim(),V=Tc(p,T);if(!p||!O||ao.value===V||(Co.value="",Ot.value[V]))return;const Te=++$t;ao.value=V,UI(O,p,{includeResetHistory:T}).then(De=>{Te!==$t||!ls(O)||(Ot.value={...Ot.value,[V]:De})}).catch(De=>{Te!==$t||!ls(O)||(Co.value=De instanceof Error?De.message:"Failed to load branch commits")}).finally(()=>{Te===$t&&ao.value===V&&(ao.value="")})}function pb(u){const p=u.trim(),T=yn.value.trim();if(!p||!T||br.value===p||(es.value="",cn.value[p]))return;const O=++ga;br.value=p,zI(T,p).then(V=>{O!==ga||!ls(T)||(cn.value={...cn.value,[p]:V})}).catch(V=>{O!==ga||!ls(T)||(es.value=V instanceof Error?V.message:"Failed to load commit files")}).finally(()=>{O===ga&&br.value===p&&(br.value="")})}function hb(u){const p=u.path.trim(),T=u.sha.trim();!p||!T||(Qr.value=p,Xr.value=T,Hn.value=!0)}function mb(){Qr.value="",Xr.value="",Hn.value=!Hn.value}function vb(){!Qr.value&&!Xr.value||(Qr.value="",Xr.value="",Hn.value=!1)}async function gb(){const u=await fu();u&&(await Ir(),Hs.value=u,oa.value=gr.value.trim()||"New Project (1)",Aa.value="",Qo.value="",Kn.value="create",Ia.value=!0,Nt(()=>{var p;return(p=xi.value)==null?void 0:p.focus()}))}function du(){Mn.value||(Ia.value=!1,Qo.value="")}let Wc=!1,Gc=!1;function yb(){Wc=!0}function wb(){Wc&&(Wc=!1,Pi())}function bb(){Gc=!0}function Tb(){Gc&&(Gc=!1,du())}async function Sb(){const u=Hs.value.trim(),p=oa.value.trim();if(!ap.value)throw new Error("Enter a single project folder name.");const T=Rp(Pp(u,p));return T?Tu(T,{createIfMissing:!0,label:""}):""}async function Cb(){const u=Hs.value.trim(),p=Aa.value.trim();return p?JI(p,u):""}async function Vc(){if(!(!sp.value||Mn.value)){Qo.value="",Mn.value=!0;try{const u=Kn.value==="clone"?await Cb():await Sb();if(!u)return;St.value=u,zo(hl(u)),await us(),await Ir(),Ia.value=!1}catch(u){Qo.value=u instanceof Error?u.message:"Failed to create or clone project."}finally{Mn.value=!1}}}function xb(){kb(ul.value)}function kb(u){qs.value||!u||(u.value="",u.click())}async function Ib(u,p,T){qs.value=!0;try{const O=await fu();if(!O)return;const V=await p(O);if(!V.path)return;St.value=V.path,zo(hl(V.path)),await us(),await Z({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Ir()}catch(O){const V=O instanceof Error?O.message:T;window.alert(V)}finally{qs.value=!1,u&&(u.value="")}}async function Ab(u){var O;const p=u.target instanceof HTMLInputElement?u.target:null,T=((O=p==null?void 0:p.files)==null?void 0:O[0])??null;!T||qs.value||await Ib(p,V=>VI(T,V),"Failed to import project.")}async function _b(){const u=St.value.trim()||await fu();u&&(pt.value=!1,kr.value=!0,so.value="",await cs(u),fn.value||Nt(()=>{var p;return(p=cl.value)==null?void 0:p.focus()}))}function Pi(){fl+=1,kr.value=!1,Ce.value=!1,fn.value="",so.value="",ra.value="",yl()}async function Pb(u){!u||Ce.value||(so.value="",await cs(u))}function Rb(){const u=Do.value.trim();!kr.value||!u||cs(u)}function Eb(){const u=ml.value;!kr.value||!u||Ce.value||cs(u)}function Mb(){if(!kr.value||Ce.value||wt.value)return;const u=ml.value,p=Do.value.trim();!u||u===p||cs(u)}function jb(){const u=ml.value,p=Do.value.trim();if(u){if(u!==p){cs(u);return}Kc(u)}}async function Kc(u=ml.value){const p=Xe(u).trim();if(p){fn.value="",wt.value=!0;try{const T=await Tu(p,{createIfMissing:!1,label:""});if(!T){fn.value="Failed to open the selected folder.";return}St.value=T,zo(hl(T)),await us(),await Z({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Ir(),Pi()}catch(T){fn.value=T instanceof Error?T.message:"Failed to open the selected folder."}finally{wt.value=!1}}}async function Lb(){if(it.value="",pt.value){yl();return}if(!kr.value){const u=St.value.trim()||await fu();if(!u||(kr.value=!0,so.value="",await cs(u),fn.value))return}fn.value||(ht.value=gr.value,pt.value=!0,Nt(()=>{var u;return(u=eu.value)==null?void 0:u.focus()}))}function yl(){it.value="",ht.value="",pt.value=!1}async function Ap(){const u=ht.value.trim();if(!u)return;if(it.value="",fn.value){it.value="Reload the current folder before creating a new one.";return}Pt.value=!0;const p=op.value.trim(),T=Rp(Pp(p,u));if(!T){it.value="Unable to determine where the new folder should be created.",Pt.value=!1;return}if(!rp.value){it.value="Enter a single folder name.",Pt.value=!1;return}try{const O=await YI(T);if(!O){it.value="Failed to create the folder.";return}it.value="",so.value="",await cs(O),yl()}catch(O){it.value=O instanceof Error?O.message:"Failed to create folder."}finally{Pt.value=!1}}async function Nb(){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 T=await Tu(u,{createIfMissing:!1,label:""});if(!T)return!1;St.value=T,zo(hl(T)),await Ct.replace({name:"home"}),await us();const O=new URL(window.location.href);return O.searchParams.delete("openProjectPath"),window.history.replaceState({},"",O.toString()),!0}catch{return!1}}async function fu(){const u=_p();if(u)return u;try{const p=await mm();if(p)return ya.value=p,p}catch{}return""}async function Ir(){const u=_p();if(!u){gr.value="New Project (1)";return}try{const p=await XI(u);gr.value=p.name||"New Project (1)"}catch{gr.value="New Project (1)"}}function _p(){var T,O;const u=St.value.trim();if(u)return qi(u);const p=((O=(T=Oc.value[0])==null?void 0:T.value)==null?void 0:O.trim())??"";return p?qi(p):ya.value.trim()}async function $b(){try{ya.value=await mm()}catch{ya.value=""}}async function us(){try{const u=await Oi();dn.value={order:[...u.order],labels:{...u.labels},projectOrder:[...u.projectOrder]}}catch{dn.value={order:[],labels:{},projectOrder:[]}}}async function cs(u){const p=++fl,T=Xe(u).trim();ra.value=T,Do.value=T,fn.value="",Ce.value=!0;try{const O=await KI(u,{showHidden:Fo.value});if(p!==fl)return;ra.value=O.path,Do.value=O.path,as.value=O.parentPath,ki.value=O.entries}catch(O){if(p!==fl)return;fn.value=O instanceof Error?O.message:"Failed to load local folders.",as.value=qi(Do.value),ki.value=[],yl()}finally{p===fl&&(Ce.value=!1)}}function Pp(u,p){const T=Xe(u).trim(),O=Xe(p).trim().replace(/^[\\/]+/u,"");if(!T||!O)return"";const V=T.includes("\\")&&!T.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(T))return`${T.slice(0,2)}${V}${O}`;if(/^\/+$/u.test(T))return`/${O}`;const Te=T.replace(/[\\/]+$/u,"");return Te?`${Te}${V}${O}`:""}function Rp(u){const p=Xe(u).trim();if(!p)return"";const T=p.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(T){const[,V,Te,De=""]=T,Ft=Yc(De.split(/[\\/]+/u));return Ft.length>0?`\\\\${V}\\${Te}\\${Ft.join("\\")}`:`\\\\${V}\\${Te}`}const O=p.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(O){const[,V,Te=""]=O,De=p.includes("\\")&&!p.includes("/")?"\\":"/",Ft=Yc(Te.split(/[\\/]+/u));return Ft.length>0?`${V}${De}${Ft.join(De)}`:`${V}${De}`}if(p.startsWith("/")){const V=Yc(p.split("/"));return V.length>0?`/${V.join("/")}`:"/"}return p}function Yc(u){const p=[];for(const T of u){const O=T.trim();if(!(!O||O===".")){if(O===".."){p.length>0&&p.pop();continue}p.push(O)}}return p}function Ob(u){fa(u.draggedId,u.targetId)}function Ep(u){qa(Ks.value,u)}function Mp(u){Wa(u)}function jp(u){Uo(u)}function Db(){Tt()}const wl=S("");let Jc=null;tt(At,u=>{var p;u&&(u.text&&((p=vo.value)==null||p.hydrateDraft({text:u.text,imageUrls:u.imageUrls,fileAttachments:u.fileAttachments,skills:u.skills})),wl.value=u.text?f("Stopped: message not submitted, restored to input."):f("Stopped: message not submitted."),Jc&&clearTimeout(Jc),Jc=setTimeout(()=>{wl.value=""},6e3),Br(Ks.value))});function Lp(u){var T,O;const p=ne.value.trim();switch(u){case"compact":p&&Je(p);break;case"review":if(!p)return;Qr.value="",Xr.value="",Hn.value=!0;break;case"rename":p&&((O=Fn.value)==null||O.openRenameThreadDialog(p,((T=le.value)==null?void 0:T.title)??""));break;case"archive":p&&Ue(p);break;case"fork":p&&q(p);break;case"new":Hc();break;case"skills":is.value||Ct.push({name:"skills"});break}}function Fb(u){const p=u.turnId.trim();if(p.length>0){const T=[...Ii.value].reverse().find(O=>{var V;return O.role==="user"&&(((V=O.turnId)==null?void 0:V.trim())??"")===p&&O.text.trim().length>0});T!=null&&T.text&&vo.value&&vo.value.appendTextToDraft(T.text)}Ms(u.turnId)}function Bb(){gn.value||!ne.value||(Mc.value&&(Ec.value=Mc.value.id),zr("default"),cu(),Ye("Implement",[],[],"steer",[],void 0,"default"))}async function Ub(){if(gn.value||is.value||Vs.value||!le.value||Ii.value.length===0)return;const u=zb();try{await qN(u)}catch{}}function zb(){var T,O,V;const u=[],p=((O=(T=le.value)==null?void 0:T.title)==null?void 0:O.trim())||"Untitled thread";u.push(`# ${Hb(p)}`),u.push(""),u.push(`- Exported: ${new Date().toISOString()}`),u.push(`- Thread ID: ${((V=le.value)==null?void 0:V.id)??""}`),u.push(""),u.push("---"),u.push("");for(const Te of Ii.value){const De=Te.role?Te.role.toUpperCase():"MESSAGE";u.push(`## ${De}`),u.push("");const Ft=Te.text.trim();if(Ft&&(u.push(Ft),u.push("")),Te.commandExecution&&(u.push("```text"),u.push(`command: ${Te.commandExecution.command}`),u.push(`status: ${Te.commandExecution.status}`),Te.commandExecution.cwd&&u.push(`cwd: ${Te.commandExecution.cwd}`),Te.commandExecution.exitCode!==null&&u.push(`exitCode: ${Te.commandExecution.exitCode}`),u.push(Te.commandExecution.aggregatedOutput||"(no output)"),u.push("```"),u.push("")),Te.fileAttachments&&Te.fileAttachments.length>0){u.push("Attachments:");for(const Io of Te.fileAttachments)u.push(`- ${Io.path}`);u.push("")}if(Te.images&&Te.images.length>0){u.push("Images:");for(const Io of Te.images)u.push(`- ${Io}`);u.push("")}}return`${u.join(`
|
|
78
|
+
`)}mL(h);const Qo=No(h);Qo&&(x($,Qo),Yt($,{label:"Running command",details:[((fn=Qo.commandExecution)==null?void 0:fn.command)??""]}));const Mn=xL(h);if(Mn){const Ce=(B.value[$]??[]).find(wt=>wt.id===Mn.itemId);Ce!=null&&Ce.commandExecution&&x($,{...Ce,commandExecution:{...Ce.commandExecution,aggregatedOutput:`${Ce.commandExecution.aggregatedOutput}${Mn.delta}`}})}const xi=$o(h);xi&&x($,xi);const ul=Zr(h);if(ul&&wa($,ul),G(h)&&Rn($,!0),h.method==="turn/completed"){on=!1,Rn($),Ym(vt),B.value[$]&&(B.value=yt(B.value,$));const Ce=Ln(h);Ce&&(mr(Ce),rn(Ce,!1),Yt(Ce,null),Hn(Ce),ze||(hr(Ce),cr(Ce)))}}function es(h){if(h.method==="thread/tokenUsage/updated"||h.method.startsWith("thread/realtime/"))return;const g=h.method,I=g==="turn/started"||g==="turn/completed"||g==="error",$=g.startsWith("thread/")||g==="turn/completed";if(!I&&!$)return;const J=Ln(h);J&&I&&nn.add(J),$&&(sn=!0,to=!0),!(Lt!==null||typeof window>"u")&&(Lt=window.setTimeout(()=>{Lt=null,Jo()},_u))}async function ts(h,g){if(!Va){Va=!0;try{if(!g)return;const I=[];for(const $ of bc(g)){const J=fi($);I.includes(J)||I.push(J)}if(I.length>0){const $=g.projectOrder.length>0?$i(I,h):$i(Re.value,h);Oa(Re.value,$)||Ue($,{persist:!1})}if(Object.keys(g.labels).length>0||(g.remoteProjects??[]).length>0){const $={...je.value};let J=!1;for(const[ie,X]of Object.entries(g.labels)){const se=Xe(ie).trim(),ge=[fi(ie)];se&&ge.push(se);for(const Ie of ge)$[Ie]!==X&&($[Ie]=X,J=!0)}for(const ie of g.order){const X=fi(ie),se=nr(qi(ie));if(!se.startsWith(".")||se===X)continue;const ge=`${X} ${se}`;$[X]!==void 0||$[X]===ge||($[X]=ge,J=!0)}for(const ie of g.remoteProjects??[]){const X=Ij(ie);$[ie.id]!==X&&($[ie.id]=X,J=!0)}J&&He($,{persist:!1})}}catch{}}}async function Tr(){try{return await Oi()}catch{return null}}function Tc(h,g){const I=lf(h,g),$=Rj(h,g),J=Ej($,g,I);if(!g||g.order.length===0&&(g.remoteProjects??[]).length===0)return J;const ie=new Set;for(const se of sf(g,I))ie.add(se);const X=J.filter(se=>ie.has(se.projectName)?!0:cf(se));return Pj(X,g,I)}function eu(h,g){const I=Tc(h,g),$=!!(g&&(g.order.length>0||g.projectOrder.length>0||(g.remoteProjects??[]).length>0)),J=g!=null&&g.projectOrder.length?$i(sf(g,lf(h,g)),I):$i(Re.value,I);Oa(Re.value,J)||Ue(J,{persist:!$});const ie=rf(I,Re.value);Ja(new Set(Yn(ie).map(ge=>ge.id)));const X=xj(t.value,ie,j.value);t.value=Xu(t.value,X),j.value=Xt(j.value,new Set(Yn(t.value).map(ge=>ge.id))),new Set(Yn(t.value).map(ge=>ge.id));const se={};for(const ge of Yn(t.value))se[ge.id]=ge.externalSession??be.value[ge.id]??null;be.value=se,Tn()}function Vn(h){Ht.removeThreadFromLoadedLists(h),t.value=hy(t.value,h),j.value=yt(j.value,h),Tn()}async function Sr(h={}){await Promise.allSettled([Ae({providerChanged:h.providerChanged,includeProviderModels:h.includeProviderModels}),mo(),A(),dn()])}function Cr(h={}){const g=()=>{Sr(h)};if(typeof window>"u"){g();return}window.setTimeout(g,0)}async function ea(h={}){o.value="",ye.value="";const g=h.includeSelectedThreadMessages!==!1,I=h.awaitAncillaryRefreshes===!0;try{if(await Vr(),await Ht.loadThreads({force:h.forceThreadRefresh===!0}),g)try{await At(n.value)}catch($){o.value=$ instanceof Error?$.message:"Unknown application error"}I?await Sr({providerChanged:h.providerChanged,includeProviderModels:h.providerChanged===!0||I}):Cr({providerChanged:h.providerChanged,includeProviderModels:!1})}catch($){o.value=$ instanceof Error?$.message:"Unknown application error",dy($)?ye.value=_y:ye.value=""}}async function En(h){vn(h);try{return await At(h),await Ae({includeProviderModels:!0}),dn(),"ok"}catch(g){const I=g instanceof Error?g.message:"Unknown application error";o.value=I;const $=tj(g)?"not-found":"error";return h.trim()&&Gt(h,I,{transient:!0}),$}}async function Si(h){const g=n.value===h,I=g?ej(Yn(e.value),h):"";g&&(vn(I),I&&At(I,{silent:!0}));try{await xk(h),Vn(h),await Ht.loadThreads(),g&&I&&n.value===I&&await Ye(I,{silent:!0})}catch($){o.value=$ instanceof Error?$.message:"Unknown application error"}}async function ns(h,g){const I=g.trim();if(!(!h||!I))try{await Ak(h,I),Ur.value={...Ur.value,[h]:I},Tn(),Yu(h,I)}catch($){o.value=$ instanceof Error?$.message:"Unknown application error"}}async function Ca(h){var X,se;const g=h.trim();if(!g)return"";const I=Yn(t.value).find(ge=>ge.id===g),$=((X=I==null?void 0:I.cwd)==null?void 0:X.trim())??"",J=((se=I==null?void 0:I.title)==null?void 0:se.trim())??"Forked chat",ie=Le(g);o.value="";try{const ge=await nm(g,$||void 0,ie||void 0),Ie=ge.threadId.trim();return Ie?(vr(Ie,$,J),ut(Ie,ge.model),Je.value={...Je.value,[Ie]:!0},vn(Ie),await Ht.loadThreads(),await At(Ie),Ie):""}catch(ge){return o.value=ge instanceof Error?ge.message:"Unknown application error",""}}async function tu(h,g){var X;const I=h.trim();if(!I||!Number.isInteger(g)||g<0)return"";if(j.value[I]===!0)return o.value="Finish the current turn before forking from a response.","";if(zt.value[I]!==!0)try{await At(I)}catch(se){return o.value=se instanceof Error?se.message:"Unknown application error",""}const $=r.value[I]??[];let J=-1;for(const se of $)typeof se.turnIndex=="number"&&Number.isFinite(se.turnIndex)&&(J=Math.max(J,se.turnIndex));if(J>=0&&g>J)return"";const ie=Yn(t.value).find(se=>se.id===I)??null;try{o.value="";const se=await nm(I),ge=se.threadId.trim();if(!ge)return"";const Ie=se.cwd.trim()||((X=ie==null?void 0:ie.cwd)==null?void 0:X.trim())||"",ze=Mj((ie==null?void 0:ie.title)||(ie==null?void 0:ie.preview)||"Untitled thread");vr(ge,Ie,ze),ut(ge,se.model),ro(ge,se.messages),zt.value={...zt.value,[ge]:!0},Je.value={...Je.value,[ge]:!0},To(ge),Wn(ge,[]),Rn(ge),B.value[ge]&&(B.value=yt(B.value,ge)),$t(ge,null),Yt(ge,null),Gt(ge,null),rn(ge,!1);const pt=J-g;if(pt>0){const ht=await wd(ge,pt);ro(ge,ht)}return await ns(ge,ze),vn(ge),Ht.loadThreads().catch(()=>{}),ge}catch(se){return o.value=se instanceof Error?se.message:"Unknown application error",""}}async function xa(h,g,I=[],$=[],J=[]){if(!h||!g.trim()||I.length>0||$.length>0||J.length>0)return!1;const X=(Es.value[h]??[]).filter(Ie=>Ie.method==="item/tool/requestUserInput");if(X.length!==1)return!1;const[se]=X,ge=jL(se);return ge.length!==1?!1:ll({id:se.id,result:{answers:{[ge[0]]:{answers:[g.trim()]}}}})}async function Ko(h,g,I,$,J,ie){if(le||yo.value<=0||j.value[h]===!0)return!1;const X=xt.value[h];if(!X||X.remainingContextPercent===null||X.remainingContextPercent>yo.value)return!1;const se=`stash-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,ge=ie==="plan"?"plan":ie==="default"?"default":Ee.value;return Wo(h,{id:se,text:g,imageUrls:I,skills:$,fileAttachments:J,collaborationMode:ge}),en.value.has(h)||il(h),!0}async function xo(h){const g=wo(h);if(!g||g.length===0||j.value[h]===!0)return;const I=In(h);le=!0;try{for(const $ of I)try{await Qt($.text,$.imageUrls,$.skills,"steer",$.fileAttachments,void 0,$.collaborationMode)}catch{}}finally{le=!1}}async function Qt(h,g=[],I=[],$="steer",J=[],ie,X){if(Y.value)return;const se=n.value,ge=h.trim();if(!se||!ge&&g.length===0&&J.length===0||await xa(se,ge,g,I,J)||await Ko(se,ge,g,I,J,X))return;const Ie=j.value[se]===!0;if(Ie&&$==="queue"){const ze=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;Ka(se,{id:ze,text:ge,imageUrls:g,skills:I,fileAttachments:J,collaborationMode:X==="plan"?"plan":X==="default"?"default":Ee.value},ie);return}if(Ie){on=!0,un(se,ge,g,I,J),ta(se,ge,g,I,J,X).catch(ze=>{const pt=ze instanceof Error?ze.message:"Unknown application error";Gt(se,pt),o.value=pt});return}o.value="",on=!0,$t(se,null),un(se,ge,g,I,J),Yt(se,{label:"Thinking",details:te(Le(se),ne.value,X==="plan"?"plan":X==="default"?"default":Ee.value)}),Gt(se,null),rn(se,!0);try{await ta(se,ge,g,I,J,X)}catch(ze){on=!1,rn(se,!1),Yt(se,null);const pt=ze instanceof Error?ze.message:"Unknown application error";throw Gt(se,pt),o.value=pt,ze}}async function os(h,g,I=[],$=[],J=[]){if(Y.value)return"";const ie=h.trim(),X=g.trim(),se=Le(Is).trim(),ge=Ee.value;if(!ie&&I.length===0&&J.length===0)return"";vo.value=!0,o.value="";let Ie="";try{try{const it=await tm(X||void 0,se||void 0);Ie=it.threadId,ut(Ie,it.model),fe(Ie,it.modelProvider||he.value),z(Ie,ge)}catch(it){if(se&&se!==Pr&&ku(it)){await $e();const Pt=await tm(X||void 0,Pr);Ie=Pt.threadId,ut(Ie,Pt.model),fe(Ie,Pt.modelProvider||he.value),z(Ie,ge)}else throw it}if(!Ie)return"";vr(Ie,X,ie||"[Image]"),un(Ie,ie,I,$,J),ya(Ie),Je.value={...Je.value,[Ie]:!0},vn(Ie),on=!0,$t(Ie,null),Yt(Ie,{label:"Thinking",details:te(Le(Ie),ne.value,ge)}),Gt(Ie,null),rn(Ie,!0);const ze=Ie,pt=X||null,ht=ie;return ta(Ie,ie,I,$,J,ge).catch(it=>{on=!1,rn(Ie,!1),Yt(Ie,null);const Pt=it instanceof Error?it.message:"Unknown application error";Gt(Ie,Pt),o.value=Pt}).finally(()=>{vo.value=!1}),qa(ze,ht,pt,I,J),Ie}catch(ze){on=!1,Ie&&(rn(Ie,!1),Yt(Ie,null));const pt=ze instanceof Error?ze.message:"Unknown application error";throw Ie&&Gt(Ie,pt),o.value=pt,vo.value=!1,ze}}async function ta(h,g,I=[],$=[],J=[],ie){const X=ne.value,se=ie==="plan"?"plan":ie==="default"?"default":Ee.value,ge=g.trim(),Ie=[...I];if(Ie.length===0&&tn(ge)){const ht=Wr(h);ht&&Ie.push(ht)}const ze=$.map(ht=>({name:ht.name,path:ht.path})),pt=J.map(ht=>({...ht}));pr(h,{text:ge,imageUrls:[...Ie],skills:ze,fileAttachments:pt,effort:X,collaborationMode:se,fallbackRetried:!1});try{if(Je.value[h]!==!0){const Pt=await Zd(h);Pt.model&&ut(h,Fe(h,Pt.model,Pt.modelProvider)),Pt.modelProvider&&fe(h,Pt.modelProvider),Je.value={...Je.value,[h]:!0}}const ht=Le(h);let it="";try{it=await bd(h,g,Ie,ht||void 0,X||void 0,$.length>0?$:void 0,J,se)}catch(Pt){if(ht&&ht!==Pr&&ku(Pt))await $e(h),pr(h,{text:ge,imageUrls:[...Ie],skills:ze,fileAttachments:pt,effort:X,collaborationMode:se,fallbackRetried:!0}),it=await bd(h,g,Ie,Pr,X||void 0,$.length>0?$:void 0,J,se);else throw Pt}it&&(ae.value={...ae.value,[h]:it},Ns(h,it)),nn.add(h),await Jo(),Yr(h)}catch(ht){throw ht}}async function ka(){const h=n.value;if(!h||j.value[h]!==!0||Ct.value[h]===!0)return;let g=ae.value[h];if(!g){const{activeTurnId:ie}=await Xd(h);g=ie,g&&(ae.value={...ae.value,[h]:g})}if(!g)throw new Error("Could not determine active turn id for interrupt");const I=_t.value.filter(ie=>ie.turnId===g),$=I.find(ie=>ie.role==="user"),J=I.some(ie=>{if(ie.role==="assistant")return!0;const X=ie.messageType??"";return X==="commandExecution"||X==="toolCall"||X==="worked"||X==="fileChange"||X==="plan"||X==="plan.live"||X==="compaction.done"||X==="turnError"});Eo.value=!0,o.value="";try{if(await _k(h,g),rn(h,!1),Yt(h,null),Gt(h,null),ae.value[h]&&(ae.value=yt(ae.value,h)),nn.add(h),sn=!0,await Jo(),$&&!J){const ie=(r.value[h]??[]).filter(se=>se.turnId!==g);ro(h,ie);const X=d.value[h];if(X){const se=X.filter(ge=>ge.turnId!==g);se.length!==X.length&&(d.value={...d.value,[h]:se},Rd(d.value))}Fn.value={...Fn.value,[h]:{text:$.text??"",imageUrls:$.images??[],fileAttachments:($.fileAttachments??[]).map(se=>({label:se.label,path:se.path,fsPath:se.fsPath??se.path})),skills:$.skills??[]}}}}catch(ie){const X=ie instanceof Error?ie.message:"Failed to interrupt active turn";Gt(h,X),o.value=X}finally{Eo.value=!1}}function Bs(h){h&&Fn.value[h]&&(Fn.value=yt(Fn.value,h))}async function rs(h){var I,$,J;const g=n.value;if(g&&!Mo.value&&h.trim()){Mo.value=!0,o.value="";try{j.value[g]===!0&&await ka();const ie=r.value[g]??[],X=ie.find(ht=>ht.turnId===h),se=ie.reduce((ht,it)=>typeof it.turnIndex=="number"&&it.turnIndex>ht?it.turnIndex:ht,-1);if(se<0)return;let ge=typeof(X==null?void 0:X.turnIndex)=="number"?X.turnIndex:((I=et.value[g])==null?void 0:I[h])??-1;(ge<0||ge>se)&&(console.warn(`[rollback] turn ${h} not resolvable (index=${ge}), clamping to newest turn`),ge=se);const Ie=se-ge+1,ze=((J=($=Gr.value)==null?void 0:$.cwd)==null?void 0:J.trim())??"";ze&&await aA(g,h,ze);const pt=await wd(g,Ie);ro(g,pt),Wn(g,[]),Rn(g),B.value[g]&&(B.value=yt(B.value,g)),$t(g,null),Yt(g,null),Gt(g,null),sn=!0,await Jo()}catch(ie){o.value=ie instanceof Error?ie.message:"Failed to rollback thread"}finally{Mo.value=!1}}}function Yo(h,g){const $=(l.value[h]??[]).filter(J=>J.messageType!=="compaction.pending"&&J.messageType!=="compaction.done");$.push({id:`compaction:${g}:${h}:${Date.now()}`,role:"system",text:"",messageType:g==="pending"?"compaction.pending":"compaction.done"}),l.value={...l.value,[h]:$}}function xr(h,g){const I=new Set(en.value);g?I.add(h):I.delete(h),en.value=I}function Sc(h){lr=h.trim(),ir.value=[]}async function il(h){const g=h.trim();if(!(!g||en.value.has(g))){xr(g,!0),Yo(g,"pending");try{await Ik(g);const I=2e3,$=14,J=Date.now()+Un;let ie=0;for(;Date.now()<J&&ie<$&&en.value.has(g);){if((await Xd(g)).messages.some(ge=>ge.messageType==="compaction.done")){xr(g,!1),n.value===g&&await At(g,{silent:!0,force:!0}),Yo(g,"done"),xo(g);break}ie+=1,await Z1(I)}en.value.has(g)&&(xr(g,!1),Yo(g,"done"),xo(g))}catch(I){o.value=I instanceof Error?I.message:"Failed to compact thread",xr(g,!1),Yo(g,"done"),xo(g)}}}async function Jo(){if(bn.value){typeof window<"u"&&Lt===null&&(Lt=window.setTimeout(()=>{Lt=null,Jo()},_u));return}bn.value=!0;const h=sn,g=to,I=new Set(nn);sn=!1,to=!1,nn.clear();try{h&&await Ht.loadThreads({force:g});const $=n.value;if(!$)return;const J=I.has($),ie=j.value[$]===!0,X=$s($),se=Ha.value[$]??"";(X.length>0&&X!==se||J||ie&&zt.value[$]!==!0||h&&zt.value[$]!==!0)&&await At($,{silent:!0,force:J})}catch{}finally{bn.value=!1,(sn||nn.size>0)&&typeof window<"u"&&Lt===null&&(Lt=window.setTimeout(()=>{Lt=null,Jo()},_u))}}async function Ci(){await sr(),sn=!Ht.hasLoadedThreads.value,n.value&&zt.value[n.value]!==!0&&nn.add(n.value),await Jo()}function na(h){const g=qe(h.params),I=typeof(g==null?void 0:g.threadId)=="string"?g.threadId.trim():"";if(!I)return;const $=qe(g==null?void 0:g.externalSession),J=$&&typeof $.origin=="string"&&$.origin.trim().length>0?{origin:$.origin.trim(),active:$.active===!0,lastWriteAt:typeof $.lastWriteAt=="string"?$.lastWriteAt:null}:null;be.value={...be.value,[I]:J},rn(I,(J==null?void 0:J.active)===!0),Tn(),sn=!0,n.value===I&&nn.add(I),Lt===null&&typeof window<"u"&&(Lt=window.setTimeout(()=>{Lt=null,Jo()},_u))}function Us(){typeof window>"u"||go||(sr(),zs(),nu(),go=Jk(h=>{if(h.method==="ready"){al(),Ci();return}if(h.method==="externalSessionChanged"){na(h);return}br(h),es(h)}))}async function zs(){try{const h=await rI(),g=Object.entries(h);if(g.length===0)return;const I={...d.value};let $=!1;for(const[J,ie]of g){const X=ie.filter(ze=>!!ze&&typeof ze.id=="string");if(X.length===0)continue;const se=I[J]??[],ge=new Set(se.map(ze=>ze.text)),Ie=[...se];for(const ze of X)ge.has(ze.text)||(Ie.push(ze),ge.add(ze.text));I[J]=Ie.slice(-20),$=!0}$&&(d.value=I,Rd(I))}catch{}}async function nu(){try{const h=await sI(),g=Object.entries(h);if(g.length===0)return;const I={...c.value};let $=!1;for(const[J,ie]of g){if(!J||!ie||typeof ie!="object"||Array.isArray(ie))continue;const X={};for(const[Ie,ze]of Object.entries(ie))!Ie||typeof ze!="number"||!Number.isFinite(ze)||ze<=0||(X[Ie]=Math.round(ze));if(Object.keys(X).length===0)continue;const se={...I[J]??{},...X},ge=Object.keys(se);I[J]=ge.length>200?Object.fromEntries(ge.slice(-200).map(Ie=>[Ie,se[Ie]])):se,$=!0}$&&(c.value=I,Wm(I))}catch{}}async function ll(h){try{return await Qk(h.id,{result:h.result,error:h.error}),Dn(h.id),Zn.value=yt(Zn.value,String(h.id)),!0}catch(g){const I=g instanceof Error?g.message:"Failed to reply to server request";return await ha(h.id)?(o.value=I,Zn.value={...Zn.value,[String(h.id)]:I},!1):(Dn(h.id),Zn.value=yt(Zn.value,String(h.id)),!0)}}function Cn(){if(go&&(go(),go=null),sn=!1,nn.clear(),qo.clear(),Lt!==null&&typeof window<"u"&&(window.clearTimeout(Lt),Lt=null),Bn(),Ht.dispose(),typeof window<"u")for(const h of zn.values())window.clearTimeout(h);zn.clear(),on=!1,r.value={},a.value={},i.value={},v.value={},d.value={},c.value={},B.value={},L.value={},et.value={},mt.value={},st.value={},q.value={},ae.value={},P.clear(),Ym(vt),y.clear(),Lj(),Ct.value={},kt.value={},mn.value={},qt(),Ro(null),xt.value={}}function Oo(h){const g=n.value;if(!g)return;const I=Ya(g,h);if(I){jo(h),M(I.collaborationMode),le=!0,Qt(I.text,I.imageUrls,I.skills,"steer",I.fileAttachments).finally(()=>{le=!1});return}const $=no(g,h);$&&(jo(h),M($.collaborationMode),Qt($.text,$.imageUrls,$.skills,"steer",$.fileAttachments))}function ko(h,g={}){vn(h,g)}return{projectGroups:e,projectDisplayNameById:je,selectedThread:Gr,selectedThreadTokenUsage:ct,selectedThreadTerminalOpen:C,isSelectedThreadInterruptPending:E,selectedThreadServerRequests:Ga,selectedLiveOverlay:we,selectedActiveTurnId:Q,lastPlanByThreadId:s,resolveThreadTurnIndex:Sa,codexQuota:qr,selectedThreadId:n,availableCollaborationModes:ue,availableModelIds:Se,availableModelReasoningEfforts:Pe,selectedCollaborationMode:Ee,selectedModelId:pe,selectedReasoningEffort:ne,selectedSpeedMode:xe,codexCliMissingError:ye,installedSkills:An,accountRateLimitSnapshots:Hr,messages:_t,hasMoreOlderMessages:Kt,isLoadingThreads:Ht.isLoadingThreads,isThreadListFullyLoaded:Ht.isThreadListFullyLoaded,isLoadingMessages:Tt,isLoadingOlderMessages:Pn,isSendingMessage:vo,isInterruptingTurn:Eo,isUpdatingSpeedMode:Y,isRollingBack:Mo,compactingThreadIds:en,fuzzyFileSearchResults:ir,registerFuzzyFileSearchSession:Sc,error:o,refreshAll:ea,refreshSkills:dn,refreshHooks:fr,hooksList:dr,isHooksLoading:Kr,onRealtimeEvent:ao,selectThread:En,loadMessages:At,loadOlderMessages:Br,ensureThreadMessagesLoaded:Ye,setThreadTerminalOpen:qn,toggleSelectedThreadTerminal:gi,archiveThreadById:Si,compactThreadById:il,renameThreadById:ns,forkThreadById:Ca,forkThreadFromTurn:tu,rollbackSelectedThread:rs,sendMessageToSelectedThread:Qt,sendMessageToNewThread:os,interruptSelectedThreadTurn:ka,interruptedUnsubmittedMessage:_n,clearInterruptedUnsubmittedMessage:Bs,selectedThreadQueuedMessages:St,removeQueuedMessage:jo,reorderQueuedMessage:oo,steerQueuedMessage:Oo,autoCompactThreshold:yo,setAutoCompactThreshold:ln,setSelectedCollaborationMode:M,readModelIdForThread:Le,setSelectedModelIdForThread:lt,setSelectedModelId:Ke,setSelectedReasoningEffort:Ze,updateSelectedSpeedMode:oe,respondToPendingServerRequest:ll,pendingReplyErrorForRequest:Rs,renameProject:Ve,removeProject:me,reorderProject:Ne,pinProjectToTop:ke,startPolling:Us,stopPolling:Cn,primeSelectedThread:ko}}const Ey="codex-web-local.sidebar-collapsed.v1",My="codex-web-local.accounts-section-collapsed.v1";function LN(){return typeof window>"u"?!1:window.localStorage.getItem(Ey)==="1"}function NN(e){typeof window>"u"||window.localStorage.setItem(Ey,e?"1":"0")}function $N(){if(typeof window>"u")return!0;const e=window.localStorage.getItem(My);return e===null?!0:e==="1"}function ON(){const e=S(LN()),t=S($N()),n=S(""),o=S(!1),r=S(null),a=S(null);let s=0,i=0,l=!1;function d(L){var j;if(e.value!==L){if(L){const U=(j=f())==null?void 0:j.scrollTop;typeof U=="number"&&(U>0||s===0)&&(s=U)}e.value=L,NN(L),L||y()}}function c(){o.value=!o.value,o.value?Nt(()=>{var L;return(L=a.value)==null?void 0:L.focus()}):n.value=""}function v(){var L;n.value="",(L=a.value)==null||L.focus()}function f(){return r.value?r.value:typeof document>"u"?null:document.querySelector(".mobile-drawer .sidebar-scrollable, .sidebar-scrollable")}function b(L){if(e.value||l)return;const U=(L==null?void 0:L.currentTarget)&&typeof HTMLElement<"u"&&L.currentTarget instanceof HTMLElement?L.currentTarget:f();s=(U==null?void 0:U.scrollTop)??s}function y(){const L=++i,j=s,U=90;l=!0;const H=()=>{L===i&&(s=j,l=!1)},be=le=>{if(L!==i)return;if(e.value){H();return}const W=f();if(W&&(W.scrollTop=j,Math.abs(W.scrollTop-j)<=1||le>=U)){H();return}if(le>=U||typeof window>"u"){H();return}window.requestAnimationFrame(()=>be(le+1))};Nt(()=>be(0))}function P(L){L.key==="Escape"&&(o.value=!1,n.value="")}function B(){t.value=!t.value,!(typeof window>"u")&&window.localStorage.setItem(My,t.value?"1":"0")}return{isSidebarCollapsed:e,isAccountsSectionCollapsed:t,sidebarSearchQuery:n,isSidebarSearchVisible:o,sidebarScrollableRef:r,sidebarSearchInputRef:a,setSidebarCollapsed:d,toggleSidebarSearch:c,clearSidebarSearch:v,onSidebarScroll:b,onSidebarSearchKeydown:P,restoreSidebarScrollPosition:y,toggleAccountsSectionCollapsed:B}}const jy="codex-web-local.right-panel-width.v1",DN=260,FN=640,Qm=320;function Ly(e){return Math.min(FN,Math.max(DN,e))}function BN(){if(typeof window>"u")return Qm;const e=window.localStorage.getItem(jy),t=Number(e);return Number.isFinite(t)?Ly(t):Qm}function UN(e){typeof window>"u"||window.localStorage.setItem(jy,String(e))}function zN(e){const{isMobile:t,canShowRightPanel:n,isVirtualKeyboardOpen:o}=e,r=S("git"),a=S([]),s=S(""),i=K(()=>a.value.find(ye=>ye.key===s.value)??null),l=S(!1),d=S(!1),c=S(!1),v=S(BN()),f=S(!1),b=S(!1);let y=null;function P(){y&&(clearTimeout(y),y=null)}function B(){f.value=!1,b.value=!1,P()}function L(ye){ye.preventDefault();const Y=ye.clientX,pe=v.value,ne=$e=>{const te=Y-$e.clientX;v.value=Ly(pe+te)},xe=()=>{UN(v.value),window.removeEventListener("mousemove",ne),window.removeEventListener("mouseup",xe)};window.addEventListener("mousemove",ne),window.addEventListener("mouseup",xe)}function j(){n()&&(t()&&!d.value&&(d.value=!0),t()||(c.value=!1),r.value=r.value==="terminal"?"git":"terminal",r.value!=="terminal"&&B())}function U(ye){r.value=ye,l.value=!1,t()||(c.value=!1),t()&&(d.value=!0),ye!=="terminal"&&B()}function H(ye){const Y=a.value.find(pe=>pe.path===ye.path);if(Y)s.value=Y.key;else{const pe={key:`preview-${Date.now()}`,path:ye.path,label:ye.label};a.value=[...a.value,pe],s.value=pe.key}U("preview")}function be(ye){a.value.some(Y=>Y.key===ye)&&(s.value=ye,U("preview"))}function le(ye){const Y=a.value.findIndex(xe=>xe.key===ye);if(Y<0)return;const pe=a.value.filter(xe=>xe.key!==ye);if(a.value=pe,s.value!==ye)return;if(pe.length===0){s.value="",r.value="files";return}const ne=pe[Math.min(Y,pe.length-1)];s.value=ne.key}function W(){if(t()){d.value=!1;return}c.value=!0,l.value=!1,B()}function he(){if(t()){d.value=!d.value;return}c.value=!c.value,c.value&&(l.value=!1,B())}function Se(){r.value="git",t()&&(d.value=!1),B()}function Pe(ye){if(f.value=ye,!ye){b.value=!1,P();return}b.value=!0,P(),y=setTimeout(()=>{y=null,o()||(b.value=!1)},1500)}return{activeRightPanelTab:r,filePreviewTabs:a,activeFilePreviewTabKey:s,activeFilePreviewTab:i,isRightPanelMenuOpen:l,isMobileRightPanelOpen:d,isRightPanelCollapsed:c,rightPanelWidth:v,isTerminalInputFocused:f,isTerminalKeyboardFocusFallbackActive:b,onRightResizeHandleMouseDown:L,toggleRightPanelTerminal:j,selectRightPanelTab:U,onOpenFilePreview:H,selectFilePreviewTab:be,closeFilePreviewTab:le,onCloseRightPanel:W,onToggleRightPanelToggle:he,onHideRightPanelTerminal:Se,onTerminalFocusChange:Pe,resetTerminalKeyboardFocusState:B,clearTerminalKeyboardFocusFallbackTimer:P}}function HN(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 qN(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!HN(e))throw new Error("Copy failed")}const WN=400;function GN(e,t,n,o){return e==="visible"&&!n&&t!==null&&o-t>=WN}const VN={class:"sidebar-root"},KN=["aria-pressed","aria-label","title"],YN={key:1,class:"sidebar-search-bar"},JN=["placeholder"],QN=["aria-label"],XN={class:"sidebar-skills-link-icon","aria-hidden":"true"},ZN={class:"sidebar-skills-link-copy"},e$={class:"sidebar-skills-link-title"},t$={class:"sidebar-skills-link-subtitle"},n$={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},o$={class:"sidebar-skills-link-copy"},r$={class:"sidebar-skills-link-title"},a$={class:"sidebar-skills-link-subtitle"},s$={class:"sidebar-settings-actions"},i$=["title","aria-label"],l$=["title","aria-label"],u$={class:"content-root-wrap"},c$={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},d$={key:1,class:"skills-route-header-icon","aria-hidden":"true"},f$={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},p$=["aria-label","title"],h$={class:"content-body"},m$={key:2,class:"content-grid content-grid-home"},v$={class:"new-thread-empty"},g$={class:"new-thread-hero"},y$=["title"],w$={class:"new-thread-folder-actions"},b$=["disabled"],T$={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},S$={class:"new-thread-launch-card-copy"},C$={class:"new-thread-launch-card-topline"},x$={class:"new-thread-launch-card-badge","aria-hidden":"true"},k$={class:"new-thread-launch-card-eyebrow"},I$={class:"new-thread-launch-card-title"},A$={class:"new-thread-launch-card-text"},_$={class:"new-thread-launch-card-actions"},P$=["aria-label","onKeydown"],R$={class:"new-thread-open-folder-header"},E$={class:"new-thread-open-folder-title"},M$={class:"new-thread-open-folder-label"},j$={class:"new-thread-open-folder-current"},L$=["placeholder","title","disabled","onKeydown"],N$=["disabled"],$$={class:"new-thread-open-folder-actions"},O$={class:"new-thread-open-folder-toggle"},D$=["aria-pressed","disabled"],F$={key:0,class:"new-thread-open-folder-create"},B$={class:"new-thread-open-folder-create-composer"},U$=["placeholder","onKeydown"],z$=["disabled"],H$={key:0,class:"new-thread-open-folder-error visible-error-with-feedback"},q$=["href"],W$=["placeholder","onKeydown"],G$={key:1,class:"new-thread-open-folder-error-actions"},V$={class:"new-thread-open-folder-error visible-error-with-feedback"},K$=["href"],Y$=["disabled"],J$={key:2,class:"new-thread-open-folder-status"},Q$={key:3,class:"new-thread-open-folder-status"},X$={key:4,class:"new-thread-open-folder-list"},Z$=["title","disabled","onClick"],eO={class:"new-thread-open-folder-item-name"},tO=["disabled","onClick"],nO=["aria-label","onKeydown"],oO={class:"new-thread-open-folder-header"},rO={class:"new-thread-open-folder-title"},aO=["disabled"],sO=["aria-label"],iO=["aria-selected","disabled"],lO=["aria-selected","disabled"],uO={class:"new-thread-project-field"},cO={class:"new-thread-open-folder-label"},dO=["disabled","placeholder"],fO={key:0,class:"new-thread-project-field"},pO={class:"new-thread-open-folder-label"},hO=["disabled","placeholder","onKeydown"],mO={key:1,class:"new-thread-project-field"},vO={class:"new-thread-open-folder-label"},gO=["disabled","onKeydown"],yO={key:2,class:"new-thread-open-folder-error visible-error-with-feedback"},wO=["href"],bO={class:"new-thread-project-modal-actions"},TO=["disabled"],SO=["disabled"],CO={key:3,class:"new-thread-branch-select"},xO={class:"new-thread-branch-select-label"},kO={class:"new-thread-branch-select-help"},IO={key:4,class:"new-thread-runtime-help"},AO={class:"worktree-init-status-title"},_O={class:"worktree-init-status-message"},PO={class:"composer-with-queue"},RO={key:0,class:"composer-runtime-error",role:"alert"},EO=["href"],MO={key:3,class:"content-grid"},jO={class:"content-thread"},LO={key:0,class:"external-session-banner",role:"alert"},NO={key:1,class:"composer-runtime-error",role:"alert"},$O=["href"],OO={key:2,class:"interrupt-recovered-banner",role:"status"},DO=["aria-label"],FO={class:"content-right-panel-header"},BO={class:"content-right-panel-tabs",role:"tablist"},UO=["aria-selected"],zO=["aria-selected"],HO=["aria-selected","title","onClick"],qO={class:"content-right-panel-tab-label"},WO=["aria-label","title","onClick"],GO={class:"content-right-panel-actions"},VO={class:"content-right-panel-add-wrap"},KO=["aria-label","title"],YO={key:0,class:"content-right-panel-menu"},JO=["aria-label","title"],QO={class:"content-right-panel-body"},XO={key:0,class:"project-zip-modal-backdrop",role:"presentation"},ZO=["aria-label"],eD={class:"project-zip-modal-header"},tD={class:"project-zip-modal-title"},nD=["aria-label","disabled"],oD={class:"project-zip-modal-copy"},rD={class:"project-zip-progress-label",role:"status","aria-live":"polite"},aD={class:"project-zip-progress-track"},sD={key:0,class:"project-zip-modal-error",role:"alert"},iD={class:"project-zip-modal-actions"},lD=["disabled"],uD=["disabled"],cD=["disabled"],dD=["aria-label"],fD={class:"codex-login-modal-header"},pD={class:"codex-login-modal-title"},hD=["aria-label","disabled"],mD={class:"codex-login-modal-copy"},vD=["href"],gD=["placeholder","disabled"],yD={key:1,class:"codex-login-modal-error visible-error-with-feedback"},wD=["href"],bD={class:"codex-login-modal-actions"},TD=["disabled"],SD=["disabled"],CD=400,Xm="codex-web-local.send-with-enter.v1",Zm="codex-web-local.in-progress-send-mode.v1",ev="codex-web-local.dark-mode.v1",tv="codex-web-local.dictation-click-to-toggle.v1",nv="codex-web-local.dictation-auto-send.v1",ov="codex-web-local.dictation-language.v1",rv="codex-web-local.chat-width.v1",xD=hn({__name:"App",setup(e){var Op,Dp;const t=Ar(()=>_r(()=>import("./ThreadConversation-CcsAV6iU.js"),__vite__mapDeps([0,1,2]))),n=Ar(()=>_r(()=>import("./ThreadTerminalPanel-2PMt2IWn.js"),__vite__mapDeps([3,4]))),o=Ar(()=>_r(()=>import("./ReviewPane-DcvdhrcS.js"),__vite__mapDeps([5,6]))),r=Ar(()=>_r(()=>import("./DirectoryHub-Ciz8rVK4.js"),__vite__mapDeps([7,1,8]))),a=Ar(()=>_r(()=>import("./AutomationsPanel-BmeZ3J9i.js"),__vite__mapDeps([9,10]))),s=Ar(()=>_r(()=>import("./SettingsDialog-C-PIbb7v.js"),__vite__mapDeps([11,12]))),i=Ar(()=>_r(()=>import("./RightGitPanel-NcqihWb7.js"),__vite__mapDeps([13,14]))),l=Ar(()=>_r(()=>import("./RightFilesPanel-CFsAu6As.js"),__vite__mapDeps([15,16]))),d=Ar(()=>_r(()=>import("./RightFilePreview-BjmHDwE1.js"),__vite__mapDeps([17,18]))),c=Ar(()=>_r(()=>import("./ThreadPendingRequestPanel-C7aX0YrN.js"),__vite__mapDeps([19,20]))),v=Ar(()=>_r(()=>import("./QueuedMessages-p3CX5QzM.js"),__vite__mapDeps([21,22]))),{t:f,uiLanguage:b,uiLanguageOptions:y,setUiLanguage:P}=da(),B="codex-mobile",L="0.1.115",j={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},U={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:H,projectDisplayNameById:be,selectedThread:le,selectedThreadTokenUsage:W,selectedThreadServerRequests:he,selectedLiveOverlay:Se,lastPlanByThreadId:Pe,resolveThreadTurnIndex:ye,selectedActiveTurnId:Y,codexQuota:pe,selectedThreadId:ne,availableCollaborationModes:xe,availableModelIds:$e,availableModelReasoningEfforts:te,selectedCollaborationMode:de,selectedReasoningEffort:Le,selectedSpeedMode:Ae,codexCliMissingError:Fe,installedSkills:Ke,accountRateLimitSnapshots:lt,messages:Ze,hasMoreOlderMessages:ut,isLoadingThreads:fe,isThreadListFullyLoaded:N,isLoadingMessages:oe,isLoadingOlderMessages:ue,isSendingMessage:Ee,isInterruptingTurn:Be,isSelectedThreadInterruptPending:A,isUpdatingSpeedMode:M,error:z,refreshAll:Z,refreshSkills:ce,refreshHooks:re,hooksList:je,isHooksLoading:Re,onRealtimeEvent:ke,selectThread:me,ensureThreadMessagesLoaded:Ve,loadMessages:Ne,loadOlderMessages:He,archiveThreadById:Ue,compactThreadById:Je,compactingThreadIds:et,fuzzyFileSearchResults:st,registerFuzzyFileSearchSession:mt,forkThreadById:q,renameThreadById:ae,forkThreadFromTurn:_e,sendMessageToSelectedThread:Ye,sendMessageToNewThread:bt,interruptSelectedThreadTurn:Tt,interruptedUnsubmittedMessage:At,clearInterruptedUnsubmittedMessage:Br,selectedThreadQueuedMessages:zt,removeQueuedMessage:Ha,reorderQueuedMessage:fa,steerQueuedMessage:pa,autoCompactThreshold:ar,setAutoCompactThreshold:Ur,setSelectedCollaborationMode:zr,readModelIdForThread:Ps,setSelectedModelIdForThread:qa,setSelectedReasoningEffort:Wa,updateSelectedSpeedMode:Uo,respondToPendingServerRequest:sr,pendingReplyErrorForRequest:Zn,renameProject:Rs,removeProject:ha,reorderProject:Es,pinProjectToTop:zo,startPolling:Po,stopPolling:Dn,primeSelectedThread:Ga,rollbackSelectedThread:Ms}=jN(),vt=ix(),Ct=sx(),{isMobile:kt}=Df();function mn(){return typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}const Fn=S(null),ho=S(null),Hr=S(null);let qr=null;const{buildFeedbackMailto:mo,feedbackMailtoBase:Ho,recordVisibleFailure:Ro}=ny(),Bn=Ho();function xt(u,p){p&&Ro(p);const T=u.currentTarget;T instanceof HTMLAnchorElement&&(T.href=mo())}const eo=S(null),vo=S(null),Eo=S(null),Mo=S(0);let en=null;function Un(){const u=Eo.value;if(!u)return;const p=window.getComputedStyle(u),T=Number.parseFloat(p.paddingLeft)+Number.parseFloat(p.paddingRight),O=Math.max(0,u.clientWidth-(Number.isFinite(T)?T:0)),V=window.getComputedStyle(u).getPropertyValue("--chat-column-max").trim(),Te=Number.parseFloat(V)*(V.endsWith("rem")?16:1),De=Number.isFinite(Te)&&Te>0?Math.min(O,Te):O;Mo.value=De}const ir=S(null),lr=S(null),bn=S(!0),ma=zN({isMobile:()=>kt.value,canShowRightPanel:()=>su.value,isVirtualKeyboardOpen:()=>pl.value}),{activeRightPanelTab:tn,filePreviewTabs:Wr,activeFilePreviewTabKey:go,activeFilePreviewTab:Lt,isRightPanelMenuOpen:zn,isMobileRightPanelOpen:sn,isRightPanelCollapsed:to,rightPanelWidth:nn,isTerminalInputFocused:Va,isTerminalKeyboardFocusFallbackActive:on,onRightResizeHandleMouseDown:qo,toggleRightPanelTerminal:ur,selectRightPanelTab:Ht,onOpenFilePreview:js,selectFilePreviewTab:Gr,closeFilePreviewTab:Wo,onCloseRightPanel:yo,onToggleRightPanelToggle:qt,onHideRightPanelTerminal:Ka,onTerminalFocusChange:no,resetTerminalKeyboardFocusState:Ya,clearTerminalKeyboardFocusFallbackTimer:wo}=ma,Vr=S(null),bo=S(!1),jo=S("");let oo=!1;const cr=S(!1),St=S(""),ln=S("local"),In=S({}),dr=new Map,An=S(""),Kr=S([]),fr=S(!1),dn=S({order:[],labels:{},projectOrder:[]}),C=S({phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""}),E=S({phase:"idle",title:"",message:""}),Q=ON(),{isSidebarCollapsed:we,isAccountsSectionCollapsed:ct,sidebarSearchQuery:_t,isSidebarSearchVisible:_n,sidebarScrollableRef:Kt,sidebarSearchInputRef:Pn,setSidebarCollapsed:Wt,toggleSidebarSearch:vn,clearSidebarSearch:mi,onSidebarScroll:pr,onSidebarSearchKeydown:hr,toggleAccountsSectionCollapsed:Ls}=Q,mr=S(null),Yr=S(null),Tn=S(null),vr=S(null);let Lo=null,va=0,$t=0,ga=0,rn=0;const gr=S("New Project (1)"),ya=S(""),Sn=S(!1),Ns=S("general");let Ja=0;function rl(){if(Sn.value){Ja=Date.now(),Sn.value=!1;return}Date.now()-Ja<CD||(Sn.value=!0)}const Hn=S(!1),Yt=S(!1),Gt=S(new Set);async function vi(){try{Gt.value=new Set(await Bk())}catch{}finally{Yt.value=!0}}const al=K(()=>!Yt.value||Gt.value.has("hooks/list")),$s=K(()=>!Yt.value||["remoteControl/status/read","remoteControl/enable","remoteControl/pairing/start","remoteControl/client/list"].every(u=>Gt.value.has(u)));tt(Sn,u=>{u&&(re(),wi(),$s.value&&Ds())});const qn=S({enabled:!1,clients:[]}),gi=S(null),ro=S(!1),un=S(!1),Wn=S(""),yr=S(""),wr=S("");let Go=null,wa=!1,Qa=null;const Jr=S("never"),yi=S(!1),ba=S(!1),Rn=S(""),To=S("");let Xa=!1;const Ta=S(!1);async function wi(u={}){if(!(u.force!==!0&&Xa)){yi.value=!0,Rn.value="";try{Jr.value=await TI(),Xa=!0}catch(p){Rn.value=p instanceof Error?p.message:"Failed to load approval policy"}finally{yi.value=!1}}}function Os(u){Jr.value=u}async function Gn(){ba.value=!0,Rn.value="",To.value="";try{await SI(Jr.value),Ta.value=!0,To.value=f("Approval policy saved"),Vo&&clearTimeout(Vo),Vo=setTimeout(()=>{To.value=""},2200)}catch(u){Rn.value=u instanceof Error?u.message:"Failed to save approval policy"}finally{ba.value=!1}}let Vo=null;async function Ds(u={}){if(!(u.force!==!0&&wa)){ro.value=!0,yr.value="";try{const p=await bI();qn.value=p,wa=!0}catch(p){yr.value=p instanceof Error?p.message:"Failed to load remote control status"}finally{ro.value=!1}}}async function Fs(){const u=!qn.value.enabled;un.value=!0,Wn.value=u?"enable":"disable";try{await CI(u),qn.value={...qn.value,enabled:u},Sa(u?"Remote control enabled":"Remote control disabled")}catch(p){yr.value=p instanceof Error?p.message:"Failed to update remote control"}finally{un.value=!1,Wn.value=""}}async function bi(){un.value=!0,Wn.value="pairing";try{gi.value=await xI()}catch(u){yr.value=u instanceof Error?u.message:"Failed to start pairing"}finally{un.value=!1,Wn.value=""}}async function sl(){un.value=!0,Wn.value="clients";try{qn.value={...qn.value,clients:await kI()}}catch(u){yr.value=u instanceof Error?u.message:"Failed to load remote clients"}finally{un.value=!1,Wn.value=""}}async function Ti(u){un.value=!0,Wn.value=`revoke:${u}`;try{await II(u),qn.value={...qn.value,clients:qn.value.clients.filter(p=>p.clientId!==u)},Sa("Remote client removed")}catch(p){yr.value=p instanceof Error?p.message:"Failed to remove remote client"}finally{un.value=!1,Wn.value=""}}function Sa(u){wr.value=u,Go&&clearTimeout(Go),Go=setTimeout(()=>{wr.value=""},3e3)}const Qr=S(""),Xr=S(""),Za=S([]),So=S(null),No=S(null),$o=S(null),Zr=S(null),x=S(!1),R=S(!1),k=S({addedLineCount:0,removedLineCount:0}),G=S([]),We=S(""),Ot=S({}),ao=S(""),Co=S(""),cn=S({}),br=S(""),es=S(""),ts=S(!1),Tr=S(!1);function Tc(u,p){return`${u}\0${p?"with-reset-history":"without-reset-history"}`}const eu=S(null),Vn=S([]),Sr=S(!1),Cr=S(!1),ea=S(!1),En=S(!1),Si=S(!1),ns=S(""),Ca=S(""),tu=S(null),xa=S(""),Ko=S(""),xo=S(""),Qt=S(""),os=S(Qc(Xm,!0)),ta=S(Wb()),ka=S(qb()),Bs=S(Gb()),rs=S(Qc(tv,!1)),Yo=S(Qc(nv,!0)),xr=S(lT()),Sc=K(()=>uT()),il=K(()=>{const{loaded:u,total:p}=C.value,T=hp(u);return p&&p>0?`${T} / ${hp(p)}`:u>0?T:f("Preparing...")}),Jo=K(()=>{const{loaded:u,total:p,phase:T}=C.value;return T==="ready"?"100%":!p||p<=0?u>0?"55%":"20%":`${Math.min(100,Math.max(5,Math.round(u/p*100)))}%`}),Ci=S(!1),na=S(!1),Us=S(!1),zs=S(""),nu=S(!1),ll=S(null),Cn=S(!1),Oo=S(""),ko=S("codex"),h=K(()=>[{value:"codex",label:f("Codex")},{value:"openrouter",label:f("OpenRouter")},{value:"opencode-zen",label:f("OpenCode Zen")},{value:"custom",label:f("Custom endpoint")}]),g=S(""),I=S(""),$=S("responses"),J=S("responses"),ie=S(""),X=S(!1),se=S(""),ge=S(""),Ie=S(""),ze=S(!1),pt=S(!1),ht=S(""),it=S(""),Pt=S(!1),Ia=S(!1),Kn=S("create"),Hs=S(""),oa=S(""),Aa=S(""),qs=S(!1),Qo=S(""),Mn=S(!1),xi=S(null),ul=S(null),kr=S(!1),cl=S(null),ou=S(null),ra=S(""),Do=S(""),as=S(""),ki=S([]),fn=S(""),Ce=S(!1),wt=S(!1),Fo=S(!1),so=S(""),ru=[z,Fe,We,Co,Qt,Oo,Ie,it,Qo,fn],Ny=K(()=>ru.some(u=>u.value.trim().length>0)),aa=S({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),Cc=S(null),xc=S(!1),kc=S(!1),Ws=S(typeof window<"u"?((Op=window.visualViewport)==null?void 0:Op.height)??window.innerHeight:0),Ic=S(typeof window<"u"?((Dp=window.visualViewport)==null?void 0:Dp.offsetTop)??0:0),dl=S(typeof window<"u"?window.innerHeight:0);let ss=null,Ac=!1,_c=!1,Pc=!1,fl=0;const Gs=K(()=>{const u=vt.params.threadId;return typeof u=="string"?u:""}),gn=K(()=>vt.name==="home"),is=K(()=>vt.name==="skills"),Vs=K(()=>vt.name==="automations"),Yf=K(()=>{const u=vt.query.automationId;return typeof u=="string"?u:""}),$y=K(()=>{var u;return Vs.value?f("Automations"):is.value?f("Skills"):gn.value?f("Start new thread"):((u=le.value)==null?void 0:u.title)??f("Choose a thread")}),Oy=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",Dy=K(()=>{var p,T;return(((T=(p=le.value)==null?void 0:p.title)==null?void 0:T.trim())??"")||Oy}),Ii=K(()=>Ze.value.filter(u=>{const p=dT(u.messageType,u.role);return p==="worked"?!0:!(p==="turnActivity.live"||p==="turnError.live"||p==="agentReasoning.live")})),Rc=S([]);tt(()=>[Ii.value,oe.value],([u,p])=>{p||(Rc.value=u)},{immediate:!0});const Fy=K(()=>oe.value&&Rc.value.length>0?Rc.value:Ii.value),Jf=new Set(["commandExecution","worked","toolCall","fileChange","agentMessage","agentMessage.live","plan"]),Ec=S(null);function By(u,p,T){const O=typeof p.turnIndex=="number"?p.turnIndex:-1;return O<0?!1:u.some((V,Te)=>Te>T&&typeof V.turnIndex=="number"&&V.turnIndex>=O&&Jf.has(V.messageType??""))}function Uy(u,p){return u.some(T=>typeof T.turnIndex=="number"&&T.turnIndex>=p&&Jf.has(T.messageType??""))}const Mc=K(()=>{const u=Ii.value,p=oe.value;for(let Te=u.length-1;Te>=0;Te-=1){const De=u[Te];if(De.messageType!=="plan"&&De.messageType!=="plan.live")continue;const Ft=Om(De);if(!Ft||Ec.value!==null&&De.id===Ec.value)return null;const gT=p?!0:By(u,De,Te);return{id:De.id,streaming:De.messageType==="plan.live",explanation:Ft.explanation,steps:Ft.steps,implemented:gT}}const T=ne.value?Pe.value[ne.value]??null:null;if(!T)return null;const O=Om(T);if(!O)return null;const V=typeof T.turnIndex=="number"?T.turnIndex:T.turnId?ye(ne.value,T.turnId)??-1:-1;return{id:T.id,streaming:T.messageType==="plan.live",explanation:O.explanation,steps:O.steps,implemented:p?!0:V>=0?Uy(u,V):!1}}),zy=K(()=>Se.value),Ks=K(()=>gn.value?"__new-thread__":ne.value),Qf=K(()=>Ps(Ks.value)),au=K(()=>{const u=he.value;return u.length>0?u[u.length-1]:null}),Hy=K(()=>au.value?Zn(au.value.id):""),yn=K(()=>{var u,p;return gn.value?St.value.trim():((p=(u=le.value)==null?void 0:u.cwd)==null?void 0:p.trim())??""}),su=K(()=>bn.value&&(gn.value&&yn.value.length>0||vt.name==="thread"&&ne.value.length>0)),qy=K(()=>su.value&&tn.value==="terminal"),pl=K(()=>!kt.value||Ws.value<=0||dl.value<=0?!1:dl.value-Ws.value>120),Wy=K(()=>pl.value||qy.value&&on.value),Xf=K(()=>{var u,p;return((p=(u=le.value)==null?void 0:u.cwd)==null?void 0:p.trim())??St.value.trim()}),jc=K(()=>{var u;return!gn.value&&((u=le.value)==null?void 0:u.inProgress)===!0}),Gy=K(()=>{const u=ne.value;return!!u&&et.value.has(u)}),Zf=K(()=>{var u,p;return!gn.value&&((p=(u=le.value)==null?void 0:u.externalSession)==null?void 0:p.active)===!0}),Lc=K(()=>Ee.value||Be.value||jc.value||he.value.length>0);function ep(){Ci.value&&(Ci.value=!1,dI(!0))}function Vy(){ep(),Ct.push({name:"skills",query:{tab:"plugins"}})}function Ky(){const u=ne.value;u&&Je(u)}function Nc(u,p){const T=Xe(u).trim(),O=Bo(T);return!T||!O?!1:p.some(V=>{const Te=Xe(V).trim();return Te!==T&&Bo(Te)===O})}function $c(u,p=""){const T=Xe(u).trim(),O=p.trim();if(O)return O;const V=Bo(T),Te=[...dn.value.order,...H.value.map(De=>{var Ft,Io;return((Io=(Ft=De.threads[0])==null?void 0:Ft.cwd)==null?void 0:Io.trim())??""}).filter(Boolean)];return Nc(T,Te)?T:V}function Yy(){const u=new Set(dn.value.order),p=dn.value.projectOrder.filter(T=>u.has(T));for(const T of dn.value.order)p.includes(T)||p.push(T);return p}function hl(u){const p=Xe(u).trim(),T=[...dn.value.order,...H.value.map(O=>{var V,Te;return((Te=(V=O.threads[0])==null?void 0:V.cwd)==null?void 0:Te.trim())??""}).filter(Boolean)];return Nc(p,T)?p:Bo(p)}function tp(u){const p=Xe(u).trim();if(!p)return"";const T=[...dn.value.order,...H.value.map(O=>{var V,Te;return((Te=(V=O.threads[0])==null?void 0:V.cwd)==null?void 0:Te.trim())??""}).filter(Boolean)];for(const O of dn.value.order){const V=Xe(O).trim();if(!V)continue;const Te=Bo(V),De=Nc(V,T)?V:Te;if(V===p||De===p||Te===p)return V}return""}const Oc=K(()=>{var O,V;const u=[],p=new Set;for(const Te of Yy()){const De=Te.trim();!De||p.has(De)||(p.add(De),u.push({value:De,label:$c(De,dn.value.labels[De])}))}for(const Te of H.value){const De=((V=(O=Te.threads[0])==null?void 0:O.cwd)==null?void 0:V.trim())??"";!De||p.has(De)||Ku(De)||(p.add(De),u.push({value:De,label:$c(De,be.value[Te.projectName])}))}const T=St.value.trim();return T&&!p.has(T)&&u.unshift({value:T,label:$c(T)}),u}),Ys=K(()=>{const u=St.value.trim();return u?In.value[u]===!0:!1}),Jy=K(()=>{var p,T;const u={};for(const O of H.value){const V=_i(O.projectName,((T=(p=O.threads[0])==null?void 0:p.cwd)==null?void 0:T.trim())??"");u[O.projectName]=V?In.value[V]===!0:!1}return u}),Dc=K(()=>{const u=An.value.trim(),p=[...Kr.value];return u&&!p.some(T=>T.value===u)&&p.unshift({value:u,label:u}),p}),np=K(()=>{const u=An.value.trim();if(!u)return"";const p=Dc.value.find(T=>T.value===u);return(p==null?void 0:p.label)??u}),op=K(()=>Do.value.trim()),rp=K(()=>{const u=ht.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),Qy=K(()=>rp.value&&op.value.trim().length>0&&!fn.value),ap=K(()=>{const u=oa.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),sp=K(()=>Hs.value.trim()?Kn.value==="create"?ap.value:Aa.value.trim().length>0:!1),ml=K(()=>{const u=Xe(ra.value).trim();return u||Do.value.trim()}),Xy=K(()=>Pt.value?"Creating…":"Create"),Zy=K(()=>Mn.value?Kn.value==="clone"?f("Cloning…"):f("Creating…"):Kn.value==="clone"?f("Clone repository"):f("Create project")),ew=K(()=>{const u=Do.value.trim(),p=as.value.trim();return!!(u&&p&&u!==p)}),ip=K(()=>{const u=[];ew.value&&u.push({key:`parent:${as.value}`,name:"..",path:as.value,kind:"parent"});for(const p of ki.value)u.push({key:`directory:${p.path}`,name:p.name,path:p.path,kind:"directory"});return u}),Fc=K(()=>{const u=so.value.trim().toLowerCase();return u?ip.value.filter(p=>p.kind==="parent"||p.name.toLowerCase().includes(u)):ip.value}),Ai=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,tw=K(()=>f(j[Bs.value].label)),nw=K(()=>{const u=j[Bs.value],p=Math.max(0,dl.value-Ws.value-Ic.value);return{"--chat-column-max":u.columnMax,"--chat-card-max":u.cardMax,"--visual-viewport-height":Ws.value>0?`${Ws.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,Ic.value)}px`,"--virtual-keyboard-inset":`${p}px`}}),ow=K(()=>{if(!aa.value.configured)return f("Not configured");const u=aa.value.active?f("Online"):f("Configured (offline)"),p=aa.value.allowAllUsers?f("allow all users"):`${aa.value.allowedUsers} ${f("allowed user(s)")}`,T=`${aa.value.mappedChats} ${f("chat(s)")}, ${aa.value.mappedThreads} ${f("thread(s)")}, ${p}`,O=aa.value.lastError?`, ${f("error")}: ${aa.value.lastError}`:"";return`${u}, ${T}${O}`});pi(()=>{var u,p;document.addEventListener("pointerdown",wp),window.addEventListener("keydown",yp),document.addEventListener("visibilitychange",bp),window.addEventListener("pageshow",Tp),window.addEventListener("focus",Sp),window.addEventListener("resize",Js),(u=window.visualViewport)==null||u.addEventListener("resize",Js),(p=window.visualViewport)==null||p.addEventListener("scroll",Js),Js(),pu(),Ai==null||Ai.addEventListener("change",pu),qr=ke(T=>{Hr.value&&Hr.value.refreshFromNotification(T)}),Qa=ke(T=>{T==="remoteControl/status/changed"&&Ds({force:!0})}),fT(),$b(),vi(),sw(),us(),Ir(),up(),Bc(),Xc(),ob(),wi()}),tt(ru,(u,p)=>{u.forEach((T,O)=>{if(T===p[O])return;const V=T.trim();V&&Ro(V)})}),tt(Eo,u=>{en&&(en.disconnect(),en=null),typeof ResizeObserver<"u"&&(en=new ResizeObserver(Un),u&&en.observe(u)),Un()},{immediate:!0}),Jl(()=>{var u,p;document.removeEventListener("pointerdown",wp),window.removeEventListener("keydown",yp),document.removeEventListener("visibilitychange",bp),window.removeEventListener("pageshow",Tp),window.removeEventListener("focus",Sp),window.removeEventListener("resize",Js),(u=window.visualViewport)==null||u.removeEventListener("resize",Js),(p=window.visualViewport)==null||p.removeEventListener("scroll",Js),Ai==null||Ai.removeEventListener("change",pu),en&&(en.disconnect(),en=null),ss!==null&&(window.clearInterval(ss),ss=null),Lo&&(clearTimeout(Lo),Lo=null),wo(),Dn(),qr&&(qr(),qr=null),Qa&&(Qa(),Qa=null),Go&&(clearTimeout(Go),Go=null)});function Js(){var u,p;typeof window>"u"||(dl.value=Math.max(dl.value,window.innerHeight),Ws.value=((u=window.visualViewport)==null?void 0:u.height)??window.innerHeight,Ic.value=((p=window.visualViewport)==null?void 0:p.offsetTop)??0)}tt(_t,u=>{const p=u.trim();if(Lo&&(clearTimeout(Lo),Lo=null),!p){vr.value=null;return}Lo=setTimeout(()=>{Rx(p,1e3).then(T=>{_t.value.trim()===p&&(vr.value=T.threadIds)}).catch(()=>{_t.value.trim()===p&&(vr.value=null)})},220)}),tt(pl,u=>{u||(on.value=!1)}),tt(Vn,()=>{if(typeof window>"u")return;if(!Vn.value.some(p=>p.quotaStatus==="loading")){ss!==null&&(window.clearInterval(ss),ss=null);return}ss===null&&(ss=window.setInterval(()=>{Ac||(Ac=!0,vl({silent:!0}).finally(()=>{Ac=!1}))},1500))},{deep:!0}),tt(lt,()=>{lp().then(u=>{u&&Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})})},{deep:!0});async function lp(){if(!_c||Pc||ko.value!=="codex"||Vn.value.length>0||lt.value.length===0)return!1;Pc=!0;const u=JSON.stringify(Vn.value.map(T=>T.accountId).sort());try{const T=await hm();Vn.value=T.accounts}catch{await vl({silent:!0})}const p=JSON.stringify(Vn.value.map(T=>T.accountId).sort());return u!==p}function rw(){ce({force:!0})}function aw(u){u&&Ne(u,{silent:!0,force:!0})}async function Bc(){try{aa.value=await nI()}catch(u){const p=u instanceof Error?u.message:"Failed to load Telegram status";aa.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:p}}}async function up(){try{const u=await tI();se.value=u.botToken,ge.value=u.allowedUserIds.map(p=>String(p)).join(`
|
|
79
|
+
`),Ie.value=""}catch(u){Ie.value=u instanceof Error?u.message:"Failed to load Telegram configuration"}}async function sw(){const u=await cI();Ci.value=u.dismissed!==!0}function iw(u){const p=u.split(/[\n,]/).map(V=>V.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),T=p.includes("*"),O=Array.from(new Set(p.filter(V=>/^-?\d+$/.test(V)).map(V=>Number.parseInt(V,10))));return T?["*",...O]:O}async function lw(){const u=se.value.trim(),p=iw(ge.value);if(!u){Ie.value=f("Telegram bot token is required.");return}if(p.length===0){Ie.value=f("At least one allowed Telegram user ID or * is required.");return}ze.value=!0,Ie.value="";try{await eI(u,p),ge.value=p.map(T=>String(T)).join(`
|
|
80
|
+
`),await Promise.all([up(),Bc()]),window.alert(f("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(T){Ie.value=T instanceof Error?T.message:f("Failed to connect Telegram bot"),Bc()}finally{ze.value=!1}}function uw(u){u&&(vt.name==="thread"&&Gs.value===u||(Ct.push({name:"thread",params:{threadId:u}}),kt.value&&Wt(!0)))}function cw(u){vt.name==="automations"&&Yf.value!==u&&Ct.replace({name:"automations",query:u?{automationId:u}:{}})}async function dw(u){var p;we.value&&(Wt(!1),await Nt()),(p=Fn.value)==null||p.openAutomationEditorFromPanel(u)}async function fw(){var u;we.value&&(Wt(!1),await Nt()),(u=Fn.value)==null||u.openAutomationCreatorFromPanel()}function pw(){var u;vt.name==="automations"&&((u=ho.value)==null||u.loadAutomations())}async function hw(u){u&&ne.value===u&&await Ub()}function mw(u){return u.length>8?u.slice(-8):u}function cp(u){const p=[u.planType||f("unknown")];return u.authMode&&p.unshift(u.authMode),p.join(" · ")}function vw(u){if(!u)return!1;const p=u.toLowerCase();return p.includes("payment required")||/\b402\b/.test(p)}function iu(u){return u.unavailableReason==="payment_required"||vw(u.quotaError)}function gw(u){return Sr.value||Cr.value||ea.value||En.value||xa.value.length>0||u.isActive&&xa.value!==u.storageId&&Lc.value}function Uc(u){return Ko.value===u.storageId}function yw(u){return xo.value===u.storageId||Uc(u)}function ww(u){return iu(u)?f("Unavailable"):u.isActive?f("Active"):Cr.value?f("Switching…"):f("Switch")}function bw(u){return xa.value===u.storageId?f("Removing…"):Uc(u)?f("Click again to remove"):f("Remove")}function Tw(u){xo.value=u}function Sw(u){xo.value===u&&(xo.value=""),xa.value!==u&&Ko.value===u&&(Ko.value="")}function Cw(u){const p=u.quotaSnapshot;if(!p)return null;const T=[p==null?void 0:p.primary,p==null?void 0:p.secondary].filter(Te=>Te!==null),O=T.find(Te=>Te.windowMinutes===7*24*60);if(O)return O;const V=T.filter(Te=>typeof Te.windowMinutes=="number"&&Te.windowMinutes>=7*24*60).sort((Te,De)=>(Te.windowMinutes??0)-(De.windowMinutes??0))[0]??null;return V||(p.secondary??null)}function xw(u){if(typeof u!="number"||!Number.isFinite(u))return"";const p=new Date(u*1e3);return`${p.getMonth()+1}月${p.getDate()}日`}function dp(u){var Te,De;if(iu(u))return u.quotaError||f("402 Payment Required");const p=u.quotaSnapshot,T=Cw(u),O=(p==null?void 0:p.primary)??(p==null?void 0:p.secondary)??null,V=T??O;if(V){const Ft=Math.max(0,Math.min(100,100-Math.round(V.usedPercent))),Io=xw(V.resetsAt);return Io?`${Ft}% ${f("weekly remaining")} · ${Io}`:`${Ft}% ${f("weekly remaining")}`}return(Te=p==null?void 0:p.credits)!=null&&Te.unlimited?f("Unlimited credits"):(De=p==null?void 0:p.credits)!=null&&De.hasCredits&&p.credits.balance?`${p.credits.balance} ${f("credits")}`:u.quotaStatus==="loading"?f("Loading quota…"):u.quotaStatus==="error"?u.quotaError||f("Quota unavailable"):u.quotaStatus==="ready"||u.quotaStatus==="idle"?f("Quota unavailable"):f("Fetching account details…")}function kw(u){return[u.email||f("Account"),cp(u),iu(u)?f("Unavailable account"):null,dp(u),`${f("Workspace")} ${u.accountId}`].filter(Boolean).join(`
|
|
81
|
+
`)}async function vl(u={}){try{const p=await _I();Vn.value=p.accounts,p.accounts.some(T=>T.storageId===xo.value)||(xo.value=""),p.accounts.some(T=>T.storageId===Ko.value)||(Ko.value="")}catch(p){if(u.silent===!0)return;Qt.value=p instanceof Error?p.message:f("Failed to load accounts")}}async function Iw(){if(!(Sr.value||Cr.value||ea.value||En.value)){Qt.value="",xo.value="",Ko.value="",Sr.value=!0;try{const u=await hm();Vn.value=u.accounts,Dn(),Po(),Z({includeSelectedThreadMessages:!0})}catch(u){Qt.value=u instanceof Error?u.message:f("Failed to refresh accounts")}finally{Sr.value=!1}}}async function Aw(u){if(!(Cr.value||Sr.value||ea.value||En.value)){if(Lc.value){Qt.value=f("Finish the current turn and pending requests before switching accounts.");return}Qt.value="",xo.value="",Ko.value="",Cr.value=!0;try{const p=await EI(u);Vn.value=Vn.value.map(T=>T.storageId===u?p:{...T,isActive:!1}),Dn(),Po(),Z({includeSelectedThreadMessages:!0}),vl({silent:!0})}catch(p){Qt.value=p instanceof Error?p.message:f("Failed to switch account")}finally{Cr.value=!1}}}async function _w(){var u;if(!(Sr.value||Cr.value||ea.value||En.value)){Qt.value="",Ca.value="",ea.value=!0;try{const p=await PI();ns.value=p,Si.value=!0,window.open(p,"_blank","noopener,noreferrer"),await Nt(),(u=tu.value)==null||u.focus()}catch(p){Qt.value=p instanceof Error?p.message:f("Failed to start Codex login")}finally{ea.value=!1}}}function zc(){En.value||(Si.value=!1,Ca.value="")}async function Pw(){const u=Ca.value.trim();u&&await Rw(u)}async function Rw(u){if(!(En.value||u.length===0)){Qt.value="",En.value=!0;try{const p=await RI(u);Vn.value=p.accounts,ns.value="",Ca.value="",Si.value=!1,Dn(),Po(),Z({includeSelectedThreadMessages:!0})}catch(p){Qt.value=p instanceof Error?p.message:f("Failed to complete Codex login")}finally{En.value=!1}}}async function Ew(u){if(Sr.value||Cr.value||ea.value||En.value||xa.value.length>0)return;const p=Vn.value.find(O=>O.storageId===u)??null;if(!p)return;if(Ko.value!==u){Ko.value=u;return}if(p.isActive&&Lc.value){Qt.value=f("Finish the current turn and pending requests before removing the active account.");return}const T=p.isActive;Qt.value="",Ko.value="",xa.value=u;try{const O=await MI(u);Vn.value=O.accounts,Dn(),Po(),T&&Z({includeSelectedThreadMessages:!0}),vl({silent:!0})}catch(O){Qt.value=O instanceof Error?O.message:f("Failed to remove account")}finally{xa.value=""}}function Mw(u){Ue(u)}function jw(u){Z({includeSelectedThreadMessages:!1,forceThreadRefresh:!0})}async function Lw(u){const p=await q(u);p&&(gn.value?await Ct.replace({name:"thread",params:{threadId:p}}):await Ct.push({name:"thread",params:{threadId:p}}),kt.value&&Wt(!0))}function fp(u){const p=u.trim().replace(/\\/gu,"/");return p?p.includes("/.codex/worktrees/")||p.includes("/.git/worktrees/"):!1}function _i(u,p=""){var Te,De,Ft;const T=H.value.find(Io=>Io.projectName===u);if(!T)return tp(u)||p.trim();const O=T.threads.find(Io=>!fp(Io.cwd));return(((Te=O==null?void 0:O.cwd)==null?void 0:Te.trim())??((Ft=(De=T.threads[0])==null?void 0:De.cwd)==null?void 0:Ft.trim())??"")||tp(u)||p.trim()}function Nw(u){var O,V;const p=H.value.find(Te=>Te.projectName===u),T=_i(u,((V=(O=p==null?void 0:p.threads[0])==null?void 0:O.cwd)==null?void 0:V.trim())??"");T&&(St.value=T),kt.value&&Wt(!0),!gn.value&&Ct.push({name:"home"})}function $w(u){var T;let p="";for(const O of H.value){const V=O.threads.find(Te=>Te.id===u);if((T=V==null?void 0:V.cwd)!=null&&T.trim()){p=V.cwd.trim();break}}!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}function lu(u){var T,O;const p=H.value.find(V=>V.projectName===u);return _i(u,((O=(T=p==null?void 0:p.threads[0])==null?void 0:T.cwd)==null?void 0:O.trim())??"")}const pp=K(()=>Object.fromEntries(H.value.map(u=>[u.projectName,lu(u.projectName).trim()]).filter(([,u])=>u.length>0)));function Ow(u){return(be.value[u]??u).trim()||u}function Dw(u){return Ow(u).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function Fw(u){const p=lu(u);!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}async function Bw(u){const p=lu(u);await vp(p)}async function Uw(u){const p=zw(u);await vp(p)}function zw(u){var p;for(const T of H.value){const O=T.threads.find(V=>V.id===u);if((p=O==null?void 0:O.cwd)!=null&&p.trim())return O.cwd.trim()}return""}function hp(u){if(!Number.isFinite(u)||u<=0)return"0 B";const p=["B","KB","MB","GB"];let T=u,O=0;for(;T>=1024&&O<p.length-1;)T/=1024,O+=1;return`${T>=10||O===0?T.toFixed(0):T.toFixed(1)} ${p[O]}`}function Hw(u,p){const T=URL.createObjectURL(u),O=document.createElement("a");O.href=T,O.download=p,document.body.appendChild(O),O.click(),document.body.removeChild(O),window.setTimeout(()=>URL.revokeObjectURL(T),3e4)}async function qw(u,p){const O={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(O))))throw new Error("File sharing is not supported in this browser.");await navigator.share(O)}function mp(){C.value.phase!=="exporting"&&(C.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""})}function Ww(){const{blob:u,fileName:p}=C.value;!u||!p||(C.value={...C.value,error:""},Hw(u,p))}async function Gw(){const{blob:u,fileName:p}=C.value;if(!(!u||!p))try{C.value={...C.value,error:""},await qw(u,p)}catch(T){if(T instanceof DOMException&&T.name==="AbortError")return;const O=T instanceof Error?T.message:"",V=T instanceof DOMException&&T.name==="NotAllowedError"||/permission denied|notallowed|not allowed|gesture/iu.test(O);C.value={...C.value,error:V?f("This browser blocked sharing the ZIP. Use Download instead."):O||f("Failed to share project. Use Download instead.")}}}async function vp(u){if(!(!u||typeof document>"u")){C.value={phase:"exporting",loaded:0,total:null,blob:null,fileName:"",error:""};try{const{blob:p,fileName:T}=await GI(u,({loaded:O,total:V})=>{C.value={...C.value,phase:"exporting",loaded:O,total:V}});C.value={phase:"ready",loaded:p.size,total:p.size,blob:p,fileName:T,error:""}}catch(p){if(C.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""},p instanceof DOMException&&p.name==="AbortError")return;const T=p instanceof Error?p.message:"Failed to export project.";window.alert(T)}}}async function Vw(u){const p=lu(u);if(!p||typeof window>"u"||(await uu(p),In.value[p]!==!0))return;const T=`${Dw(u)}-`,O=window.prompt("New worktree folder name",T);if(O===null)return;const V=O.trim();if(V){if(V.includes("/")||V.includes("\\")||V==="."||V===".."){window.alert("Worktree name must be a single folder name.");return}try{const Te=await $I(p,V),De=await Tu(Te.cwd,{createIfMissing:!1,label:""});if(!De)return;St.value=De,ln.value="local",zo(hl(De)),await us(),await Ir(),kt.value&&Wt(!0),gn.value||await Ct.push({name:"home"})}catch(Te){const De=Te instanceof Error?Te.message:"Failed to create worktree.";window.alert(De)}}}function Kw(){var T,O,V;const u=le.value;if(!u)return"";const p=((T=u.projectName)==null?void 0:T.trim())??"";return p?_i(p,((V=u.cwd)==null?void 0:V.trim())??""):((O=u.cwd)==null?void 0:O.trim())??""}function Hc(){const u=Kw();u&&(St.value=u),ln.value="local",kt.value&&Wt(!0),!gn.value&&Ct.push({name:"home"})}function Yw(){St.value="",ln.value="local",kt.value&&Wt(!0),!gn.value&&Ct.push({name:"home"})}async function uu(u){const p=u.trim();if(!p||Object.prototype.hasOwnProperty.call(In.value,p))return;const T=dr.get(p);if(T){const Te=await T;Object.prototype.hasOwnProperty.call(In.value,p)||(In.value={...In.value,[p]:Te});return}const O=FI(p).then(Te=>Te.isGitRepo).catch(()=>!1).finally(()=>{dr.delete(p)});dr.set(p,O);const V=await O;Object.prototype.hasOwnProperty.call(In.value,p)||(In.value={...In.value,[p]:V})}function Jw(u){Rs(u.projectName,u.displayName)}function Qw(u){ae(u.threadId,u.title)}async function Xw(u){await ha(u),await us(),Ir()}function Zw(u){Es(u.projectName,u.toIndex)}function eb(u){var O,V;const p=H.value.find(Te=>Te.projectName===u),T=_i(u,((V=(O=p==null?void 0:p.threads[0])==null?void 0:O.cwd)==null?void 0:V.trim())??"");uu(T)}function gp(u){tb(u)}async function tb(u){var O;const p=await sr(u),T=((O=u.followUpMessageText)==null?void 0:O.trim())??"";if(!(!p||!T||gn.value))try{await Ye(T,[],[],"steer",[])}catch{}}async function nb(u){const p=await _e(u.threadId,u.turnIndex);p&&(await Ct.push({name:"thread",params:{threadId:p}}),ne.value!==p&&await me(p),kt.value&&Wt(!0))}function yp(u){if(u.defaultPrevented)return;if(u.key==="Escape"&&Sn.value){Sn.value=!1;return}if(!u.ctrlKey&&!u.metaKey||u.shiftKey||u.altKey)return;const p=u.key.toLowerCase();if(p==="b"){if(!(mn()?u.metaKey&&!u.ctrlKey:u.ctrlKey&&!u.metaKey))return;u.preventDefault(),Wt(!we.value);return}if(p==="j"&&vt.name==="thread"&&ne.value){u.preventDefault(),ur();return}p==="j"&&gn.value&&yn.value&&(u.preventDefault(),ur())}async function ob(){try{const u=await Mx();bn.value=u.available,!u.available&&tn.value==="terminal"&&(tn.value="git",Ya())}catch{bn.value=!1,tn.value==="terminal"&&(tn.value="git")}}function wp(u){var T,O;const p=u.target;if(p instanceof Node){if(Va.value){const V=p instanceof Element?p:p.parentElement;V!=null&&V.closest(".thread-terminal-panel")||Ya()}Sn.value&&((T=Yr.value)!=null&&T.containsTarget(p)||(O=Tn.value)!=null&&O.contains(p)||(Ja=Date.now(),Sn.value=!1))}}function rb(u){var T,O;if(!Sn.value)return;const p=u.target;p instanceof Node&&((T=Yr.value)!=null&&T.containsTarget(p)||(O=Tn.value)!=null&&O.contains(p)||(Ja=Date.now(),Sn.value=!1))}function ab(){var u;(u=Fn.value)==null||u.openRecycleBin()}function bp(){if(!(typeof document>"u")){if(document.visibilityState==="hidden"){Cc.value=Date.now(),xc.value=!1;return}qc()}}function Tp(u){u.persisted&&qc()}function Sp(){vt.name==="home"&&(us(),Ir()),qc()}function qc(){typeof window>"u"||typeof document>"u"||GN(document.visibilityState,Cc.value,xc.value,Date.now())&&(xc.value=!0,Cc.value=null,sb())}async function sb(){if(!kc.value){kc.value=!0;try{await Z({includeSelectedThreadMessages:!0}),await ed()}finally{kc.value=!1}}}function Cp(u){const p=u.text;cu();const T=Vr.value,O=u.mode==="queue"&&T&&T.threadId===ne.value?T.queueIndex:void 0;if(Vr.value=null,gn.value){pT(p,u.imageUrls,u.skills,u.fileAttachments);return}Ye(p,u.imageUrls,u.skills,u.mode,u.fileAttachments,O)}function ib(u){const p=zt.value.findIndex(Te=>Te.id===u),T=p>=0?zt.value[p]:void 0,O=vo.value;if(!T||!O||O.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Vr.value=ne.value?{threadId:ne.value,queueIndex:p}:null;const V={text:T.text,imageUrls:[...T.imageUrls],fileAttachments:T.fileAttachments.map(Te=>({...Te})),skills:T.skills.map(Te=>({...Te}))};O.hydrateDraft(V),Ha(u)}function cu(){if(!kt.value||gn.value)return;const u=()=>{var p;(p=ir.value)==null||p.jumpToLatest()};u(),Nt(()=>{u(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{u(),window.requestAnimationFrame(u)})})}function lb(u){St.value=u.trim(),it.value=""}function ub(u){An.value=u.trim()}function ls(u){const p=yn.value.trim();return!u||p!==u?!1:vt.name==="thread"||vt.name==="home"&&Ys.value}function xp(){va+=1,$t+=1,ga+=1,rn+=1,Za.value=[],So.value=null,No.value=null,$o.value=null,Zr.value=null,x.value=!1,R.value=!1,k.value={addedLineCount:0,removedLineCount:0},G.value=[],Ot.value={},ao.value="",Co.value="",cn.value={},br.value="",es.value="",We.value="",ts.value=!1}function kp(u){const p=u.trim();if(!p){k.value={addedLineCount:0,removedLineCount:0};return}const T=++rn;oA(p,"unstaged").then(O=>{T!==rn||!ls(p)||(k.value={addedLineCount:O.addedLineCount,removedLineCount:O.removedLineCount})}).catch(()=>{T!==rn||!ls(p)||(k.value={addedLineCount:0,removedLineCount:0})})}async function gl(u){var O,V,Te;const p=u.trim();if(!p){xp();return}const T=++va;ts.value=!0,We.value="";try{const De=await DI(p);if(T!==va||!ls(p))return;Za.value=De.options,So.value=De.currentBranch,No.value=De.headSha,$o.value=De.headSubject,Zr.value=De.headDate,x.value=De.detached,R.value=De.dirty,G.value=De.changedFiles,kp(p);const Ft=((O=De.currentBranch)==null?void 0:O.trim())||((Te=(V=De.options[0])==null?void 0:V.value)==null?void 0:Te.trim())||"";Ft&&Ip({branch:Ft,includeResetHistory:!0})}catch{if(T!==va||!ls(p))return;Za.value=[],So.value=null,No.value=null,$o.value=null,Zr.value=null,x.value=!1,R.value=!1,k.value={addedLineCount:0,removedLineCount:0},G.value=[]}finally{T===va&&(ts.value=!1)}}function cb(u){So.value=u.currentBranch,No.value=u.headSha,$o.value=u.headSubject,Zr.value=u.headDate,x.value=u.detached,R.value=u.dirty,G.value=u.changedFiles,kp(yn.value)}function db(u){if(Tr.value)return;const p=u.trim();if(!p||p===(So.value??""))return;const T=yn.value.trim();T&&(Tr.value=!0,We.value="",BI(T,p).then(O=>(So.value=O||p,No.value=null,$o.value=null,Zr.value=null,x.value=!1,Hn.value=!1,gl(T))).catch(O=>{const V=O instanceof Error?O.message:"Failed to switch branch";gl(T).finally(()=>{We.value=V})}).finally(()=>{Tr.value=!1}))}function fb(u){if(Tr.value)return;const p=u.branch.trim(),T=u.sha.trim(),O=yn.value.trim();!p||!T||!O||(Tr.value=!0,We.value="",HI(O,p,T).then(V=>(cb(V),Hn.value=!1,gl(O))).catch(V=>{const Te=V instanceof Error?V.message:"Failed to reset branch to commit";gl(O).finally(()=>{We.value=Te})}).finally(()=>{Tr.value=!1}))}function Ip(u){const p=(typeof u=="string"?u:u.branch).trim(),T=typeof u=="string"?!0:u.includeResetHistory!==!1,O=yn.value.trim(),V=Tc(p,T);if(!p||!O||ao.value===V||(Co.value="",Ot.value[V]))return;const Te=++$t;ao.value=V,UI(O,p,{includeResetHistory:T}).then(De=>{Te!==$t||!ls(O)||(Ot.value={...Ot.value,[V]:De})}).catch(De=>{Te!==$t||!ls(O)||(Co.value=De instanceof Error?De.message:"Failed to load branch commits")}).finally(()=>{Te===$t&&ao.value===V&&(ao.value="")})}function pb(u){const p=u.trim(),T=yn.value.trim();if(!p||!T||br.value===p||(es.value="",cn.value[p]))return;const O=++ga;br.value=p,zI(T,p).then(V=>{O!==ga||!ls(T)||(cn.value={...cn.value,[p]:V})}).catch(V=>{O!==ga||!ls(T)||(es.value=V instanceof Error?V.message:"Failed to load commit files")}).finally(()=>{O===ga&&br.value===p&&(br.value="")})}function hb(u){const p=u.path.trim(),T=u.sha.trim();!p||!T||(Qr.value=p,Xr.value=T,Hn.value=!0)}function mb(){Qr.value="",Xr.value="",Hn.value=!Hn.value}function vb(){!Qr.value&&!Xr.value||(Qr.value="",Xr.value="",Hn.value=!1)}async function gb(){const u=await fu();u&&(await Ir(),Hs.value=u,oa.value=gr.value.trim()||"New Project (1)",Aa.value="",Qo.value="",Kn.value="create",Ia.value=!0,Nt(()=>{var p;return(p=xi.value)==null?void 0:p.focus()}))}function du(){Mn.value||(Ia.value=!1,Qo.value="")}let Wc=!1,Gc=!1;function yb(){Wc=!0}function wb(){Wc&&(Wc=!1,Pi())}function bb(){Gc=!0}function Tb(){Gc&&(Gc=!1,du())}async function Sb(){const u=Hs.value.trim(),p=oa.value.trim();if(!ap.value)throw new Error("Enter a single project folder name.");const T=Rp(Pp(u,p));return T?Tu(T,{createIfMissing:!0,label:""}):""}async function Cb(){const u=Hs.value.trim(),p=Aa.value.trim();return p?JI(p,u):""}async function Vc(){if(!(!sp.value||Mn.value)){Qo.value="",Mn.value=!0;try{const u=Kn.value==="clone"?await Cb():await Sb();if(!u)return;St.value=u,zo(hl(u)),await us(),await Ir(),Ia.value=!1}catch(u){Qo.value=u instanceof Error?u.message:"Failed to create or clone project."}finally{Mn.value=!1}}}function xb(){kb(ul.value)}function kb(u){qs.value||!u||(u.value="",u.click())}async function Ib(u,p,T){qs.value=!0;try{const O=await fu();if(!O)return;const V=await p(O);if(!V.path)return;St.value=V.path,zo(hl(V.path)),await us(),await Z({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Ir()}catch(O){const V=O instanceof Error?O.message:T;window.alert(V)}finally{qs.value=!1,u&&(u.value="")}}async function Ab(u){var O;const p=u.target instanceof HTMLInputElement?u.target:null,T=((O=p==null?void 0:p.files)==null?void 0:O[0])??null;!T||qs.value||await Ib(p,V=>VI(T,V),"Failed to import project.")}async function _b(){const u=St.value.trim()||await fu();u&&(pt.value=!1,kr.value=!0,so.value="",await cs(u),fn.value||Nt(()=>{var p;return(p=cl.value)==null?void 0:p.focus()}))}function Pi(){fl+=1,kr.value=!1,Ce.value=!1,fn.value="",so.value="",ra.value="",yl()}async function Pb(u){!u||Ce.value||(so.value="",await cs(u))}function Rb(){const u=Do.value.trim();!kr.value||!u||cs(u)}function Eb(){const u=ml.value;!kr.value||!u||Ce.value||cs(u)}function Mb(){if(!kr.value||Ce.value||wt.value)return;const u=ml.value,p=Do.value.trim();!u||u===p||cs(u)}function jb(){const u=ml.value,p=Do.value.trim();if(u){if(u!==p){cs(u);return}Kc(u)}}async function Kc(u=ml.value){const p=Xe(u).trim();if(p){fn.value="",wt.value=!0;try{const T=await Tu(p,{createIfMissing:!1,label:""});if(!T){fn.value="Failed to open the selected folder.";return}St.value=T,zo(hl(T)),await us(),await Z({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Ir(),Pi()}catch(T){fn.value=T instanceof Error?T.message:"Failed to open the selected folder."}finally{wt.value=!1}}}async function Lb(){if(it.value="",pt.value){yl();return}if(!kr.value){const u=St.value.trim()||await fu();if(!u||(kr.value=!0,so.value="",await cs(u),fn.value))return}fn.value||(ht.value=gr.value,pt.value=!0,Nt(()=>{var u;return(u=eu.value)==null?void 0:u.focus()}))}function yl(){it.value="",ht.value="",pt.value=!1}async function Ap(){const u=ht.value.trim();if(!u)return;if(it.value="",fn.value){it.value="Reload the current folder before creating a new one.";return}Pt.value=!0;const p=op.value.trim(),T=Rp(Pp(p,u));if(!T){it.value="Unable to determine where the new folder should be created.",Pt.value=!1;return}if(!rp.value){it.value="Enter a single folder name.",Pt.value=!1;return}try{const O=await YI(T);if(!O){it.value="Failed to create the folder.";return}it.value="",so.value="",await cs(O),yl()}catch(O){it.value=O instanceof Error?O.message:"Failed to create folder."}finally{Pt.value=!1}}async function Nb(){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 T=await Tu(u,{createIfMissing:!1,label:""});if(!T)return!1;St.value=T,zo(hl(T)),await Ct.replace({name:"home"}),await us();const O=new URL(window.location.href);return O.searchParams.delete("openProjectPath"),window.history.replaceState({},"",O.toString()),!0}catch{return!1}}async function fu(){const u=_p();if(u)return u;try{const p=await mm();if(p)return ya.value=p,p}catch{}return""}async function Ir(){const u=_p();if(!u){gr.value="New Project (1)";return}try{const p=await XI(u);gr.value=p.name||"New Project (1)"}catch{gr.value="New Project (1)"}}function _p(){var T,O;const u=St.value.trim();if(u)return qi(u);const p=((O=(T=Oc.value[0])==null?void 0:T.value)==null?void 0:O.trim())??"";return p?qi(p):ya.value.trim()}async function $b(){try{ya.value=await mm()}catch{ya.value=""}}async function us(){try{const u=await Oi();dn.value={order:[...u.order],labels:{...u.labels},projectOrder:[...u.projectOrder]}}catch{dn.value={order:[],labels:{},projectOrder:[]}}}async function cs(u){const p=++fl,T=Xe(u).trim();ra.value=T,Do.value=T,fn.value="",Ce.value=!0;try{const O=await KI(u,{showHidden:Fo.value});if(p!==fl)return;ra.value=O.path,Do.value=O.path,as.value=O.parentPath,ki.value=O.entries}catch(O){if(p!==fl)return;fn.value=O instanceof Error?O.message:"Failed to load local folders.",as.value=qi(Do.value),ki.value=[],yl()}finally{p===fl&&(Ce.value=!1)}}function Pp(u,p){const T=Xe(u).trim(),O=Xe(p).trim().replace(/^[\\/]+/u,"");if(!T||!O)return"";const V=T.includes("\\")&&!T.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(T))return`${T.slice(0,2)}${V}${O}`;if(/^\/+$/u.test(T))return`/${O}`;const Te=T.replace(/[\\/]+$/u,"");return Te?`${Te}${V}${O}`:""}function Rp(u){const p=Xe(u).trim();if(!p)return"";const T=p.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(T){const[,V,Te,De=""]=T,Ft=Yc(De.split(/[\\/]+/u));return Ft.length>0?`\\\\${V}\\${Te}\\${Ft.join("\\")}`:`\\\\${V}\\${Te}`}const O=p.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(O){const[,V,Te=""]=O,De=p.includes("\\")&&!p.includes("/")?"\\":"/",Ft=Yc(Te.split(/[\\/]+/u));return Ft.length>0?`${V}${De}${Ft.join(De)}`:`${V}${De}`}if(p.startsWith("/")){const V=Yc(p.split("/"));return V.length>0?`/${V.join("/")}`:"/"}return p}function Yc(u){const p=[];for(const T of u){const O=T.trim();if(!(!O||O===".")){if(O===".."){p.length>0&&p.pop();continue}p.push(O)}}return p}function Ob(u){fa(u.draggedId,u.targetId)}function Ep(u){qa(Ks.value,u)}function Mp(u){Wa(u)}function jp(u){Uo(u)}function Db(){Tt()}const wl=S("");let Jc=null;tt(At,u=>{var p;u&&(u.text&&((p=vo.value)==null||p.hydrateDraft({text:u.text,imageUrls:u.imageUrls,fileAttachments:u.fileAttachments,skills:u.skills})),wl.value=u.text?f("Stopped: message not submitted, restored to input."):f("Stopped: message not submitted."),Jc&&clearTimeout(Jc),Jc=setTimeout(()=>{wl.value=""},6e3),Br(Ks.value))});function Lp(u){var T,O;const p=ne.value.trim();switch(u){case"compact":p&&Je(p);break;case"review":if(!p)return;Qr.value="",Xr.value="",Hn.value=!0;break;case"rename":p&&((O=Fn.value)==null||O.openRenameThreadDialog(p,((T=le.value)==null?void 0:T.title)??""));break;case"archive":p&&Ue(p);break;case"fork":p&&q(p);break;case"new":Hc();break;case"skills":is.value||Ct.push({name:"skills"});break}}function Fb(u){const p=u.turnId.trim();if(p.length>0){const T=[...Ii.value].reverse().find(O=>{var V;return O.role==="user"&&(((V=O.turnId)==null?void 0:V.trim())??"")===p&&O.text.trim().length>0});T!=null&&T.text&&vo.value&&vo.value.appendTextToDraft(T.text)}Ms(u.turnId)}function Bb(){gn.value||!ne.value||(Mc.value&&(Ec.value=Mc.value.id),zr("default"),cu(),Ye("Implement",[],[],"steer",[],void 0,"default"))}async function Ub(){if(gn.value||is.value||Vs.value||!le.value||Ii.value.length===0)return;const u=zb();try{await qN(u)}catch{}}function zb(){var T,O,V;const u=[],p=((O=(T=le.value)==null?void 0:T.title)==null?void 0:O.trim())||"Untitled thread";u.push(`# ${Hb(p)}`),u.push(""),u.push(`- Exported: ${new Date().toISOString()}`),u.push(`- Thread ID: ${((V=le.value)==null?void 0:V.id)??""}`),u.push(""),u.push("---"),u.push("");for(const Te of Ii.value){const De=Te.role?Te.role.toUpperCase():"MESSAGE";u.push(`## ${De}`),u.push("");const Ft=Te.text.trim();if(Ft&&(u.push(Ft),u.push("")),Te.commandExecution&&(u.push("```text"),u.push(`command: ${Te.commandExecution.command}`),u.push(`status: ${Te.commandExecution.status}`),Te.commandExecution.cwd&&u.push(`cwd: ${Te.commandExecution.cwd}`),Te.commandExecution.exitCode!==null&&u.push(`exitCode: ${Te.commandExecution.exitCode}`),u.push(Te.commandExecution.aggregatedOutput||"(no output)"),u.push("```"),u.push("")),Te.fileAttachments&&Te.fileAttachments.length>0){u.push("Attachments:");for(const Io of Te.fileAttachments)u.push(`- ${Io.path}`);u.push("")}if(Te.images&&Te.images.length>0){u.push("Images:");for(const Io of Te.images)u.push(`- ${Io}`);u.push("")}}return`${u.join(`
|
|
82
82
|
`).trimEnd()}
|
|
83
|
-
`}function Hb(u){return u.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Qc(u,p){if(typeof window>"u")return p;const T=window.localStorage.getItem(u);return T===null?p:T==="1"}function qb(){if(typeof window>"u")return"system";const u=window.localStorage.getItem(ev);return u==="light"||u==="dark"?u:"system"}function Wb(){if(typeof window>"u")return"steer";const u=window.localStorage.getItem(Zm);return u==="steer"||u==="queue"?u:"queue"}function Gb(){if(typeof window>"u")return"standard";const u=window.localStorage.getItem(rv);return u==="standard"||u==="wide"||u==="extra-wide"?u:"standard"}function Vb(){os.value=!os.value,window.localStorage.setItem(Xm,os.value?"1":"0")}function Kb(){ta.value=ta.value==="steer"?"queue":"steer",window.localStorage.setItem(Zm,ta.value)}function Yb(){const u=["system","light","dark"],p=u.indexOf(ka.value);ka.value=u[(p+1)%u.length],window.localStorage.setItem(ev,ka.value),pu()}function Jb(){const u=["standard","wide","extra-wide"],p=u.indexOf(Bs.value);Bs.value=u[(p+1)%u.length],window.localStorage.setItem(rv,Bs.value)}function Qb(){rs.value=!rs.value,window.localStorage.setItem(tv,rs.value?"1":"0")}function Xb(){Yo.value=!Yo.value,window.localStorage.setItem(nv,Yo.value?"1":"0")}async function Zb(u){if(!Us.value){Us.value=!0;try{if(u==="codex"){ko.value="codex";const p=await sm(!1);na.value=p.enabled}else if(u==="openrouter"){ko.value="openrouter";const p=await sm(!0);na.value=p.enabled,await Mi("","",{wireApi:J.value,provider:"openrouter"})}else u==="opencode-zen"?(ko.value="opencode-zen",await Mi("",ie.value.trim(),{wireApi:"responses",provider:"opencode-zen"}),na.value=!0):u==="custom"&&(ko.value="custom",g.value.trim()&&I.value.trim()&&(await Mi(g.value.trim(),I.value.trim(),{wireApi:$.value}),na.value=!0));Oo.value="",await Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Oo.value=p instanceof Error?p.message:"Failed to switch provider"}finally{Us.value=!1}}}async function eT(){if(Cn.value)return;const u=g.value.trim();if(u){Cn.value=!0;try{Oo.value="",await Mi(u,I.value.trim(),{wireApi:$.value}),na.value=!0;const p=await am();p.provider==="custom"&&!p.currentModel&&(Oo.value=f("Failed to resolve model from custom endpoint; check the URL and try again")),await Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Oo.value=p instanceof Error?p.message:"Failed to save custom endpoint"}finally{Cn.value=!1}}}async function tT(u){if(Cn.value||Us.value||J.value===u)return;const p=J.value;J.value=u,Cn.value=!0;try{Oo.value="",await Mi("","",{wireApi:u,provider:"openrouter"}),na.value=!0,await Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(T){J.value=p,Oo.value=T instanceof Error?T.message:"Failed to save OpenRouter API format"}finally{Cn.value=!1}}async function nT(){if(Cn.value)return;const u=ie.value.trim();if(u){Cn.value=!0;try{Oo.value="",await Mi("",u,{wireApi:"responses",provider:"opencode-zen"}),na.value=!0,await Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Oo.value=p instanceof Error?p.message:"Failed to save OpenCode Zen config"}finally{Cn.value=!1}}}async function oT(){if(!Cn.value){Cn.value=!0;try{const u=zs.value.trim();await im(u),zs.value="",await Xc(),await Z({includeSelectedThreadMessages:!1})}catch{}finally{Cn.value=!1}}}async function rT(){if(!Cn.value){Cn.value=!0;try{await im(""),zs.value="",await Xc(),await Z({includeSelectedThreadMessages:!1})}catch{}finally{Cn.value=!1}}}async function Xc(){try{const u=ko.value,p=await am();na.value=p.enabled,nu.value=p.customKey??!1,ll.value=p.maskedKey??null,p.enabled?p.provider==="opencode-zen"?ko.value="opencode-zen":p.provider==="custom"?(ko.value="custom",g.value=p.customBaseUrl??"",$.value=p.wireApi==="chat"?"chat":"responses"):(ko.value="openrouter",J.value=p.wireApi==="chat"?"chat":"responses"):ko.value="codex",_c=p.hasCodexAuth===!0,_c||(Pc=!1);const T=ko.value!==u;T&&await Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0});const O=await lp();O&&await Z({includeSelectedThreadMessages:!1,providerChanged:T||O,awaitAncillaryRefreshes:!0})}catch{}}function aT(u){const T=Zc(u.trim())||"auto";xr.value=T,window.localStorage.setItem(ov,T)}function sT(u){Ur(Number(u))}const iT=[{value:"0",label:f("Off")},{value:"5",label:"5%"},{value:"10",label:"10%"},{value:"15",label:"15%"},{value:"20",label:"20%"},{value:"25",label:"25%"}];function lT(){var T;if(typeof window>"u")return"auto";const u=((T=window.localStorage.getItem(ov))==null?void 0:T.trim())||"auto";return Zc(u)||"auto"}function uT(){const u=[{value:"auto",label:f("Auto-detect")}],p=new Set(["auto"]);function T(V){const Te=U[V]||V;return`${Te.charAt(0).toUpperCase()+Te.slice(1)} (${V})`}for(const V of typeof navigator<"u"?navigator.languages??[]:[]){const Te=Zc(V);!Te||p.has(Te)||(p.add(Te),u.push({value:Te,label:`${f("Preferred")}: ${T(Te)}`}))}for(const V of Object.keys(U))p.has(V)||(p.add(V),u.push({value:V,label:T(V)}));const O=xr.value.trim();return O&&!p.has(O)&&u.push({value:O,label:T(O)}),u}function Zc(u){const p=u.trim().toLowerCase();if(!p||p==="auto")return"";if(p in U)return p;const T=p.split("-")[0]??p;return T in U?T:""}function pu(){const u=document.documentElement;if(ka.value==="dark")u.classList.add("dark");else if(ka.value==="light")u.classList.remove("dark");else{const p=window.matchMedia("(prefers-color-scheme: dark)").matches;u.classList.toggle("dark",p)}}const cT=K(()=>({activeSettingsGroup:Ns.value,accounts:Vn.value,isAccountsSectionCollapsed:ct.value,isRefreshingAccounts:Sr.value,isSwitchingAccounts:Cr.value,isStartingCodexLogin:ea.value,isCompletingCodexLogin:En.value,accountActionError:Qt.value,codexLoginUrl:ns.value,feedbackMailto:Bn,isAccountUnavailable:iu,isRemoveConfirmationActive:Uc,isRemoveVisible:yw,buildAccountTitle:kw,formatAccountMeta:cp,formatAccountQuota:dp,shortAccountId:mw,isAccountActionDisabled:gw,getAccountSwitchLabel:ww,getAccountRemoveLabel:bw,onRefreshAccounts:Iw,onStartCodexLogin:_w,onSwitchAccount:Aw,onRemoveAccount:Ew,onAccountCardPointerEnter:Tw,onAccountCardPointerLeave:Sw,toggleAccountsSectionCollapsed:Ls,prepareFeedbackLink:xt,sendWithEnter:os.value,inProgressSendMode:ta.value,darkMode:ka.value,uiLanguage:b.value,uiLanguageOptions:y,chatWidthLabel:tw.value,dictationClickToToggle:rs.value,dictationAutoSend:Yo.value,dictationLanguage:xr.value,dictationLanguageOptions:Sc.value,autoCompactThreshold:ar.value,autoCompactThresholdOptions:iT,hasVisibleFeedbackError:Ny.value,selectedProvider:ko.value,providerDropdownOptions:m.value,freeModeLoading:Us.value,providerError:Oo.value,freeModeHasCustomKey:nu.value,freeModeCustomKey:zs.value,freeModeCustomKeyMasked:ll.value,freeModeCustomKeySaving:Cn.value,openRouterWireApi:J.value,opencodeZenKey:ie.value,customEndpointUrl:g.value,customEndpointKey:I.value,customEndpointWireApi:$.value,isTelegramConfigOpen:X.value,telegramStatusText:ow.value,telegramBotTokenDraft:se.value,telegramAllowedUserIdsDraft:we.value,telegramConfigError:Ie.value,isTelegramSaving:ze.value,supportsHooks:al.value,isHooksLoading:Re.value,hooksList:je.value,supportsRemoteControl:$s.value,remoteControlStatus:qn.value,isRemoteControlActionInFlight:un.value,remoteControlError:yr.value,remoteControlNotice:wr.value,isRemoteControlLoading:ro.value,remoteControlActionName:Wn.value,pairingCode:gi.value,accountRateLimitSnapshots:lt.value,worktreeName:B,appVersion:L,onClose:()=>{Sn.value=!1},onActiveSettingsGroupChange:u=>{Ns.value=u},toggleSendWithEnter:Vb,cycleInProgressSendMode:Kb,cycleDarkMode:Yb,onUiLanguageChange:P,cycleChatWidth:Jb,toggleDictationClickToToggle:Qb,toggleDictationAutoSend:Xb,onDictationLanguageChange:aT,onAutoCompactThresholdChange:sT,onProviderChange:Zb,onFreeModeCustomKeyChange:u=>{zs.value=u},clearFreeModeCustomKey:rT,saveFreeModeCustomKey:oT,setOpenRouterWireApi:tT,onOpencodeZenKeyChange:u=>{ie.value=u},saveOpencodeZen:nT,onCustomEndpointUrlChange:u=>{g.value=u},onCustomEndpointKeyChange:u=>{I.value=u},saveCustomEndpoint:eT,onCustomEndpointWireApiChange:u=>{$.value=u},onTelegramConfigOpenChange:u=>{X.value=u},onTelegramBotTokenDraftChange:u=>{se.value=u},onTelegramAllowedUserIdsDraftChange:u=>{we.value=u},saveTelegramConfig:lw,refreshHooks:re,toggleRemoteControl:Fs,startRemotePairing:bi,refreshRemoteClients:sl,revokeRemoteClient:Ti}));function dT(u,p){const T=(u??"").trim();return T.length>0?T:p.trim()||"message"}function Np(u){zr(u)}async function fT(){await Ct.isReady(),vt.name==="thread"&&Gs.value?Ga(Gs.value):(vt.name==="home"||vt.name==="skills"||vt.name==="automations")&&Ga("",{persist:!1}),await Z({includeSelectedThreadMessages:vt.name==="thread"}),vl({silent:!0}),await Nb(),cr.value=!0,await ed(),Po()}async function ed(){if(bo.value){oo=!0;return}bo.value=!0;try{do{if(oo=!1,vt.name==="home"||vt.name==="skills"||vt.name==="automations"){ne.value!==""&&await me("");continue}if(vt.name==="thread"){const u=Gs.value;if(!u)continue;if(ne.value!==u){if(await me(u)==="not-found")continue}else Ve(u,{silent:!0}).catch(()=>{})}}while(oo)}finally{bo.value=!1}}tt(()=>[vt.name,Gs.value,fe.value,ne.value],async()=>{cr.value&&await ed()}),tt(()=>[ne.value,yn.value],()=>{vb()}),tt(()=>[vt.name,yn.value],([u,p])=>{u==="thread"&&uu(p)},{immediate:!0}),tt(()=>ne.value,async u=>{if(cr.value&&!bo.value&&!(gn.value||is.value||Vs.value)){if(!u){vt.name!=="home"&&await Ct.replace({name:"home"});return}vt.name==="thread"&&Gs.value===u||await Ct.replace({name:"thread",params:{threadId:u}})}}),tt(()=>Oc.value,u=>{if(u.length===0){St.value="",Ir();return}const p=St.value.trim();p&&(u.some(O=>O.value===p)||(St.value="")),Ir()},{immediate:!0}),tt(()=>St.value,()=>{E.value={phase:"idle",title:"",message:""},Ir()}),tt(()=>[vt.name,St.value],([u,p])=>{u==="home"&&uu(p)},{immediate:!0}),tt(Ys,u=>{!u&&ln.value==="worktree"&&(ln.value="local")},{immediate:!0}),tt(()=>[ln.value,St.value],([u,p])=>{u!=="worktree"||!Ys.value||$p(p)},{immediate:!0}),tt(()=>ln.value,u=>{var p;if(u==="local"){E.value={phase:"idle",title:"",message:""};const T=St.value.trim();if(T&&fp(T)){const O=((p=le.value)==null?void 0:p.projectName)??Bo(T),V=_i(O,"");V&&(St.value=V)}return}Ys.value&&$p(St.value)}),tt(()=>vt.name,u=>{u!=="home"&&(E.value={phase:"idle",title:"",message:""}),u!=="thread"&&(Hn.value=!1)}),tt(()=>ne.value,()=>{E.value={phase:"idle",title:"",message:""}}),tt(()=>[vt.name,yn.value,Ys.value],([u,p,T])=>{if(!(u==="thread"||u==="home"&&T)){xp();return}$t+=1,Ot.value={},ao.value="",Co.value="",gl(p)},{immediate:!0}),tt(Dy,u=>{typeof document>"u"||(document.title=u)},{immediate:!0}),tt(kt,u=>{u&&!ye.value&&Wt(!0)},{immediate:!0});async function pT(u,p=[],T=[],O=[]){try{E.value={phase:"idle",title:"",message:""};let V=St.value;if(ln.value==="worktree"){E.value={phase:"running",title:f("Creating worktree"),message:f("Creating a worktree and running setup.")};try{const De=await NI(St.value,An.value);V=De.cwd,St.value=De.cwd,E.value={phase:"idle",title:"",message:""}}catch{E.value={phase:"error",title:f("Worktree setup failed"),message:f("Unable to create worktree. Try again or switch to Local project.")};return}}else if(!V.trim()){const De=await QI(u);V=De.cwd,St.value=De.cwd}const Te=await bt(u,V,p,T,O);if(!Te)return;await Ct.replace({name:"thread",params:{threadId:Te}}),cu()}catch{}}function hT(u){var O;if((O=u.prompt)!=null&&O.trim())return u.prompt.trim();const p=u.displayName.trim()||u.name.trim(),T=u.kind==="skill"?"skill":u.kind==="plugin"?"plugin":u.kind==="composio"?"Composio connector":"app";return`Test ${p} ${T}. Give me a list of what it can do and one useful example.`}function mT(u){return`${u.kind}:${u.name}:${u.skillPath??""}`}async function vT(u){var O;if(jo.value)return;jo.value=mT(u);const p=hT(u),T=(O=u.attachedSkills)!=null&&O.length?u.attachedSkills:u.kind==="skill"&&u.skillPath?[{name:u.name,path:u.skillPath}]:[];try{const V=Xf.value.trim()||yn.value.trim(),Te=await bt(p,V,[],T,[]);if(!Te)return;await Ct.replace({name:"thread",params:{threadId:Te}}),cu()}catch{}finally{jo.value=""}}async function $p(u){var T;const p=u.trim();if(!p){Kr.value=[],An.value="";return}fr.value=!0;try{const O=await OI(p);Kr.value=O;const V=An.value.trim();if(!(V.length>0&&O.some(De=>De.value===V))){const De=O.find(Ft=>Ft.value.trim()==="main");An.value=(De==null?void 0:De.value)??((T=O[0])==null?void 0:T.value)??""}}catch{Kr.value=[],An.value=""}finally{fr.value=!1}}return(u,p)=>(_(),F(ot,null,[Oe(px,{"is-sidebar-collapsed":h(ye),onCloseSidebar:p[37]||(p[37]=T=>h(Wt)(!0))},{sidebar:dt(()=>[w("section",VN,[w("div",{ref_key:"sidebarScrollableRef",ref:Kt,class:"sidebar-scrollable",onScroll:p[7]||(p[7]=(...T)=>h(pr)&&h(pr)(...T))},[h(ye)?ve("",!0):(_(),Qe(Lm,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":h(ye),"show-new-thread-button":!0,onToggleSidebar:p[1]||(p[1]=T=>h(Wt)(!h(ye))),onStartNewThread:Hc},{default:dt(()=>[w("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":h(_n),"aria-label":h(f)("Search threads"),title:h(f)("Search threads"),onClick:p[0]||(p[0]=(...T)=>h(vn)&&h(vn)(...T))},[Oe(Nm,{class:"sidebar-search-toggle-icon"})],8,KN)]),_:1},8,["is-sidebar-collapsed"])),!h(ye)&&h(_n)?(_(),F("div",YN,[Oe(Nm,{class:"sidebar-search-bar-icon"}),xn(w("input",{ref_key:"sidebarSearchInputRef",ref:Pn,"onUpdate:modelValue":p[2]||(p[2]=T=>kn(_t)?_t.value=T:null),class:"sidebar-search-input",type:"text",placeholder:h(f)("Filter threads..."),onKeydown:p[3]||(p[3]=(...T)=>h(hr)&&h(hr)(...T))},null,40,JN),[[Nn,h(_t)]]),h(_t).length>0?(_(),F("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":h(f)("Clear search"),onClick:p[4]||(p[4]=(...T)=>h(mi)&&h(mi)(...T))},[Oe(of,{class:"sidebar-search-clear-icon"})],8,QN)):ve("",!0)])):ve("",!0),h(ye)?ve("",!0):(_(),F("button",{key:2,class:at(["sidebar-skills-link",{"is-active":is.value}]),type:"button",onClick:p[5]||(p[5]=T=>{h(Ct).push({name:"skills"}),h(kt)&&h(Wt)(!0)})},[w("span",XN,[Oe(bs)]),w("span",ZN,[w("span",e$,D(h(f)("Skills")),1),w("span",t$,D(h(f)("Plugins, apps, MCPs")),1)])],2)),h(ye)?ve("",!0):(_(),F("button",{key:3,class:at(["sidebar-skills-link",{"is-active":Vs.value}]),type:"button",onClick:p[6]||(p[6]=T=>{h(Ct).push({name:"automations"}),h(kt)&&h(Wt)(!0)})},[w("span",n$,[Oe(bs)]),w("span",o$,[w("span",r$,D(h(f)("Automations")),1),w("span",a$,D(h(f)("Scheduled work")),1)])],2)),h(ye)?ve("",!0):(_(),Qe(_R,{key:4,ref_key:"sidebarThreadTreeRef",ref:Fn,groups:h(H),"project-display-name-by-id":h(be),"project-git-repo-by-name":Jy.value,"project-cwd-by-name":pp.value,"selected-thread-id":h(ne),"is-loading":h(fe),"is-thread-list-fully-loaded":h(N),"search-query":h(_t),"search-matched-thread-ids":vr.value,onSelect:uw,onArchive:Mw,onStartNewThread:Nw,onRenameProject:Jw,onBrowseThreadFiles:$w,onSaveThreadProject:Uw,onBrowseProjectFiles:Fw,onSaveProject:Bw,onRequestProjectGitStatus:eb,onCreateProjectWorktree:Vw,onRenameThread:Qw,onForkThread:Lw,onRemoveProject:Xw,onReorderProject:Zw,onCopyThreadChat:hw,onAutomationsChanged:pw,onRestoreThread:jw,onStartNewChat:Yw},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),h(ye)?ve("",!0):(_(),F("div",{key:0,ref_key:"settingsAreaRef",ref:mr,class:"sidebar-settings-area",onClick:rb},[Sn.value?(_(),Qe(h(s),jf({key:0,ref_key:"settingsDialogRef",ref:Yr},cT.value),null,16)):ve("",!0),w("div",s$,[w("button",{ref_key:"settingsButtonRef",ref:Tn,class:"sidebar-settings-icon-button",type:"button",title:h(f)("Settings"),"aria-label":h(f)("Settings"),onClick:gt(rl,["stop"])},[Oe(z1,{class:"sidebar-settings-icon"})],8,i$),w("button",{ref:"recycleBinButtonRef",class:"sidebar-settings-icon-button",type:"button",title:h(f)("Recycle bin"),"aria-label":h(f)("Recycle bin"),onClick:gt(ab,["stop"])},[Oe(ay,{class:"sidebar-settings-icon"})],8,l$)])],512))])]),content:dt(()=>[w("div",u$,[w("section",{class:at(["content-root",{"is-virtual-keyboard-open":Wy.value}]),style:er(nw.value)},[pl.value?(_(),F("span",c$)):ve("",!0),Oe(jR,{title:$y.value,accent:is.value||Vs.value},{leading:dt(()=>[h(ye)||h(kt)?(_(),Qe(Lm,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":h(ye),"show-new-thread-button":!0,onToggleSidebar:p[8]||(p[8]=T=>h(Wt)(!h(ye))),onStartNewThread:Hc},null,8,["is-sidebar-collapsed"])):ve("",!0),is.value?(_(),F("span",d$,[Oe(bs)])):Vs.value?(_(),F("span",f$,[Oe(bs)])):ve("",!0)]),actions:dt(()=>[su.value?(_(),F("button",{key:0,class:"content-header-right-panel-toggle",type:"button","aria-label":h(kt)?h(sn)?h(f)("Close side panel"):h(f)("Open side panel"):h(to)?h(f)("Open side panel"):h(f)("Close side panel"),title:h(kt)?h(sn)?h(f)("Close side panel"):h(f)("Open side panel"):h(to)?h(f)("Open side panel"):h(f)("Close side panel"),onClick:p[9]||(p[9]=(...T)=>h(qt)&&h(qt)(...T))},[Oe(sy,{class:"content-header-right-panel-toggle-icon"})],8,p$)):ve("",!0)]),_:1},8,["title","accent"]),w("section",h$,[is.value?(_(),Qe(h(r),{key:0,ref_key:"directoryHubRef",ref:Hr,cwd:Xf.value,"thread-id":Gs.value,"try-in-flight-key":jo.value,onSkillsChanged:rw,onTryItem:vT},null,8,["cwd","thread-id","try-in-flight-key"])):Vs.value?(_(),Qe(h(a),{key:1,ref_key:"automationsPanelRef",ref:ho,groups:h(H),"project-cwd-by-name":pp.value,"project-display-name-by-id":h(be),"selected-automation-id":Yf.value,onSelectAutomation:cw,onEditAutomation:dw,onCreateAutomation:fw},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):gn.value?(_(),F("div",m$,[w("div",v$,[w("p",g$,D(h(f)("Let's build")),1),Oe(ci,{class:"new-thread-folder-dropdown","model-value":St.value,options:Oc.value,placeholder:h(f)("Choose folder"),"enable-search":!0,"search-placeholder":h(f)("Quick search project"),disabled:!1,"onUpdate:modelValue":lb},null,8,["model-value","options","placeholder","search-placeholder"]),St.value?(_(),F("p",{key:0,class:"new-thread-folder-selected",title:St.value},D(h(f)("Selected folder"))+": "+D(St.value),9,y$)):ve("",!0),w("div",w$,[w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:_b},D(h(f)("Select folder")),1),w("button",{class:"new-thread-folder-action",type:"button",onClick:gb},D(h(f)("Create Project")),1),w("button",{class:"new-thread-folder-action",type:"button",disabled:qs.value,onClick:xb},D(qs.value?h(f)("Importing…"):h(f)("Import Project")),9,b$),w("input",{ref_key:"projectImportInputRef",ref:ul,class:"new-thread-project-import-input",type:"file",accept:".zip,application/zip",tabindex:"-1","aria-hidden":"true",onChange:Ab},null,544)]),Ci.value?(_(),F("section",T$,[w("div",S$,[w("div",C$,[w("span",x$,[Oe(bs)]),w("p",k$,D(h(f)("New in Codex")),1)]),w("h2",I$,D(h(f)("Plugins are here")),1),w("p",A$,D(h(f)("Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.")),1),p[42]||(p[42]=w("div",{class:"new-thread-launch-card-pills","aria-label":"Example integrations"},[w("span",{class:"new-thread-launch-card-pill"},"Gmail"),w("span",{class:"new-thread-launch-card-pill"},"Calendar"),w("span",{class:"new-thread-launch-card-pill"},"GitHub"),w("span",{class:"new-thread-launch-card-pill"},"Slack"),w("span",{class:"new-thread-launch-card-pill"},"Browser Use")],-1))]),w("div",_$,[w("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:Vy},D(h(f)("Explore Plugins & Apps")),1),w("button",{class:"new-thread-launch-card-button",type:"button",onClick:ep},D(h(f)("Dismiss")),1)])])):ve("",!0),(_(),Qe(Ki,{to:"body"},[kr.value?(_(),F("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:gt(yb,["self"]),onMouseup:wb},[w("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":h(f)("Select folder"),onKeydown:Ao(gt(Pi,["prevent"]),["esc"])},[w("div",R$,[w("p",E$,D(h(f)("Select folder")),1),w("button",{class:"new-thread-open-folder-close",type:"button",onClick:Pi},D(h(f)("Cancel")),1)]),w("p",M$,D(h(f)("Current folder")),1),w("div",j$,[xn(w("input",{ref_key:"existingFolderPathInputRef",ref:cl,"onUpdate:modelValue":p[10]||(p[10]=T=>ra.value=T),class:"new-thread-open-folder-path",type:"text",placeholder:h(f)("Current folder"),title:ra.value||h(f)("Unavailable"),disabled:Ce.value||wt.value,onBlur:Mb,onKeydown:[Ao(gt(jb,["prevent"]),["enter"]),Ao(gt(Pi,["prevent"]),["esc"])]},null,40,L$),[[Nn,ra.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!ml.value||Ce.value||wt.value,onClick:p[11]||(p[11]=T=>Kc())},D(wt.value?h(f)("Opening…"):h(f)("Open")),9,N$)]),w("div",$$,[w("label",O$,[xn(w("input",{"onUpdate:modelValue":p[12]||(p[12]=T=>Fo.value=T),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:Rb},null,544),[[UC,Fo.value]]),w("span",null,D(h(f)("Show hidden folders")),1)]),w("button",{class:at(["new-thread-folder-action",{"new-thread-folder-action-primary":pt.value}]),type:"button","aria-pressed":pt.value,disabled:!Do.value||Ce.value||wt.value||Pt.value||!!fn.value&&!pt.value,onClick:Lb},D(h(f)("New folder")),11,D$)]),pt.value?(_(),F("div",F$,[w("div",B$,[xn(w("input",{ref_key:"createFolderInputRef",ref:eu,"onUpdate:modelValue":p[13]||(p[13]=T=>ht.value=T),class:"new-thread-open-folder-create-input",type:"text",placeholder:h(f)("Folder name"),onKeydown:[Ao(gt(Ap,["prevent"]),["enter"]),Ao(gt(yl,["prevent"]),["esc"])]},null,40,U$),[[Nn,ht.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!Qy.value||Pt.value,onClick:Ap},D(Xy.value),9,z$)]),it.value?(_(),F("div",H$,[w("span",null,D(it.value),1),w("a",{class:"visible-error-feedback",href:h(Bn),onClick:p[14]||(p[14]=T=>xt(T,it.value))},D(h(f)("Send feedback")),9,q$)])):ve("",!0)])):ve("",!0),xn(w("input",{ref_key:"existingFolderFilterInputRef",ref:ou,"onUpdate:modelValue":p[15]||(p[15]=T=>so.value=T),class:"new-thread-open-folder-filter",type:"text",placeholder:h(f)("Filter folders..."),onKeydown:Ao(gt(Pi,["prevent"]),["esc"])},null,40,W$),[[Nn,so.value]]),fn.value?(_(),F("div",G$,[w("div",V$,[w("span",null,D(fn.value),1),w("a",{class:"visible-error-feedback",href:h(Bn),onClick:p[16]||(p[16]=T=>xt(T,fn.value))},D(h(f)("Send feedback")),9,K$)]),w("button",{class:"new-thread-folder-action",type:"button",disabled:Ce.value||wt.value,onClick:Eb},D(h(f)("Retry")),9,Y$)])):ve("",!0),Ce.value?(_(),F("p",J$,D(h(f)("Loading folders…")),1)):!fn.value&&Fc.value.length===0?(_(),F("p",Q$,D(so.value.trim()?h(f)("No folders match this filter."):h(f)("No subfolders found here.")),1)):Fc.value.length>0?(_(),F("ul",X$,[(_(!0),F(ot,null,Zt(Fc.value,T=>(_(),F("li",{key:T.key,class:"new-thread-open-folder-item"},[w("button",{class:"new-thread-open-folder-item-main",type:"button",title:T.path,disabled:Ce.value||wt.value,onClick:O=>Pb(T.path)},[w("span",eO,D(T.name),1)],8,Z$),T.kind==="directory"?(_(),F("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:Ce.value||wt.value,onClick:O=>Kc(T.path)},D(h(f)("Open")),9,tO)):ve("",!0)]))),128))])):ve("",!0)],40,P$)],32)):ve("",!0)])),(_(),Qe(Ki,{to:"body"},[Ia.value?(_(),F("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:gt(bb,["self"]),onMouseup:Tb},[w("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":h(f)("Create or clone project"),onKeydown:Ao(gt(du,["prevent"]),["esc"])},[w("div",oO,[w("p",rO,D(h(f)("Create or clone project")),1),w("button",{class:"new-thread-open-folder-close",type:"button",disabled:Mn.value,onClick:du},D(h(f)("Cancel")),9,aO)]),w("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":h(f)("Project source")},[w("button",{class:at(["new-thread-project-mode-tab",{"is-active":Kn.value==="create"}]),type:"button",role:"tab","aria-selected":Kn.value==="create",disabled:Mn.value,onClick:p[17]||(p[17]=T=>Kn.value="create")},D(h(f)("New project")),11,iO),w("button",{class:at(["new-thread-project-mode-tab",{"is-active":Kn.value==="clone"}]),type:"button",role:"tab","aria-selected":Kn.value==="clone",disabled:Mn.value,onClick:p[18]||(p[18]=T=>Kn.value="clone")},D(h(f)("Clone from GitHub")),11,lO)],8,sO),w("label",uO,[w("span",cO,D(h(f)("Destination folder")),1),xn(w("input",{"onUpdate:modelValue":p[19]||(p[19]=T=>Hs.value=T),class:"new-thread-open-folder-path",type:"text",disabled:Mn.value,placeholder:h(f)("Destination folder")},null,8,dO),[[Nn,Hs.value]])]),Kn.value==="create"?(_(),F("label",fO,[w("span",pO,D(h(f)("Project name")),1),xn(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:xi,"onUpdate:modelValue":p[20]||(p[20]=T=>oa.value=T),class:"new-thread-open-folder-create-input",type:"text",disabled:Mn.value,placeholder:h(f)("Project name"),onKeydown:Ao(gt(Vc,["prevent"]),["enter"])},null,40,hO),[[Nn,oa.value]])])):Kn.value==="clone"?(_(),F("label",mO,[w("span",vO,D(h(f)("GitHub repository URL")),1),xn(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:xi,"onUpdate:modelValue":p[21]||(p[21]=T=>Aa.value=T),class:"new-thread-open-folder-create-input",type:"url",disabled:Mn.value,placeholder:"https://github.com/owner/repo",onKeydown:Ao(gt(Vc,["prevent"]),["enter"])},null,40,gO),[[Nn,Aa.value]])])):ve("",!0),Qo.value?(_(),F("div",yO,[w("span",null,D(Qo.value),1),w("a",{class:"visible-error-feedback",href:h(Bn),onClick:p[22]||(p[22]=T=>xt(T,Qo.value))},D(h(f)("Send feedback")),9,wO)])):ve("",!0),w("div",bO,[w("button",{class:"new-thread-folder-action",type:"button",disabled:Mn.value,onClick:du},D(h(f)("Cancel")),9,TO),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!sp.value||Mn.value,onClick:Vc},D(Zy.value),9,SO)])],40,nO)],32)):ve("",!0)])),Ys.value?(_(),Qe(x1,{key:2,class:"new-thread-runtime-dropdown",modelValue:ln.value,"onUpdate:modelValue":p[23]||(p[23]=T=>ln.value=T)},null,8,["modelValue"])):ve("",!0),ln.value==="worktree"?(_(),F("div",CO,[w("p",xO,D(h(f)("Base branch")),1),Oe(ci,{class:"new-thread-branch-dropdown","model-value":An.value,options:Dc.value,placeholder:h(f)("Select branch"),"enable-search":!0,"search-placeholder":h(f)("Search branches..."),disabled:fr.value||Dc.value.length===0,"onUpdate:modelValue":ub},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),w("p",kO,D(fr.value?h(f)("Loading branches…"):np.value?h(f)("New worktree branch will start from {branch}.",{branch:np.value}):h(f)("No Git branches found for this folder.")),1)])):ve("",!0),Ys.value?(_(),F("p",IO,D(h(f)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):ve("",!0),E.value.phase!=="idle"?(_(),F("div",{key:5,class:at(["worktree-init-status",{"is-running":E.value.phase==="running","is-error":E.value.phase==="error"}])},[w("strong",AO,D(E.value.title),1),w("span",_O,D(E.value.message),1)],2)):ve("",!0)]),w("div",PO,[h(Fe)?(_(),F("div",RO,[w("span",null,D(h(f)(h(Fe))),1),w("a",{class:"visible-error-feedback",href:h(Bn),onClick:p[24]||(p[24]=T=>xt(T,h(Fe)))},D(h(f)("Send feedback")),9,EO)])):ve("",!0),Oe(jm,{ref_key:"homeThreadComposerRef",ref:eo,"active-thread-id":Ks.value,cwd:yn.value,"fuzzy-file-search-results":h(st),onRegisterFuzzySession:h(mt),"collaboration-modes":h(xe),"selected-collaboration-mode":h(de),models:h($e),"model-reasoning-efforts":h(te),"selected-model":Qf.value,"selected-reasoning-effort":h(Le),"selected-speed-mode":h(Ae),"is-updating-speed-mode":h(M),skills:h(Ke),"thread-token-usage":h(W),"codex-quota":h(pe),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":os.value,"in-progress-submit-mode":ta.value,"dictation-click-to-toggle":rs.value,"dictation-auto-send":Yo.value,"dictation-language":xr.value,onSubmit:Cp,"onUpdate:selectedCollaborationMode":Np,"onUpdate:selectedModel":Ep,"onUpdate:selectedReasoningEffort":Mp,"onUpdate:selectedSpeedMode":jp,"approval-policy":Jr.value,"is-approval-policy-saving":ba.value,"approval-policy-error":Rn.value,"approval-policy-notice":To.value,"onUpdate:approvalPolicy":Os,onSaveApprovalPolicy:Gn,onSlashCommand:Lp},null,8,["active-thread-id","cwd","fuzzy-file-search-results","onRegisterFuzzySession","collaboration-modes","selected-collaboration-mode","models","model-reasoning-efforts","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","thread-token-usage","codex-quota","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","dictation-language","approval-policy","is-approval-policy-saving","approval-policy-error","approval-policy-notice"])])])):(_(),F("div",MO,[Hn.value&&h(ne)&&yn.value?(_(),Qe(h(o),{key:0,"thread-id":h(ne),cwd:yn.value,"is-thread-in-progress":jc.value,"initial-file-path":Qr.value,"commit-sha":Xr.value,onClose:p[25]||(p[25]=T=>Hn.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress","initial-file-path","commit-sha"])):(_(),F(ot,{key:1},[w("div",jO,[Oe(h(t),{ref_key:"threadConversationRef",ref:ir,messages:Fy.value,"is-loading":h(oe),"active-thread-id":Ks.value,cwd:yn.value,"live-overlay":zy.value,"live-turn-id":h(Y),"pending-requests":h(he),"has-more-persisted-above":h(ut),"is-loading-persisted-above":h(ue),"load-earlier-messages":h(He),onForkThread:nb,onRollback:Fb,onFileChangesChanged:aw,onRespondServerRequest:gp},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"])]),w("div",{class:"composer-with-queue",ref_key:"composerQueueRef",ref:Eo},[Zf.value?(_(),F("div",LO,D(h(f)("This thread is running in the Codex TUI")),1)):ve("",!0),h(Fe)?(_(),F("div",NO,[w("span",null,D(h(f)(h(Fe))),1),w("a",{class:"visible-error-feedback",href:h(Bn),onClick:p[26]||(p[26]=T=>xt(T,h(Fe)))},D(h(f)("Send feedback")),9,$O)])):ve("",!0),Oe(h(v),{messages:h(zt),onEdit:ib,onSteer:h(pa),onDelete:h(Ha),onReorder:Ob},null,8,["messages","onSteer","onDelete"]),wl.value?(_(),F("div",OO,[w("span",null,D(wl.value),1),w("button",{type:"button",class:"interrupt-recovered-dismiss","aria-label":h(f)("Dismiss"),onClick:p[27]||(p[27]=T=>wl.value="")}," × ",8,DO)])):ve("",!0),au.value?(_(),Qe(h(c),{key:3,request:au.value,"request-count":h(he).length,"has-queue-above":h(zt).length>0,"panel-width":Mo.value,"visual-viewport-height":pl.value?Ws.value:0,"panel-error":Hy.value,onRespondServerRequest:gp},null,8,["request","request-count","has-queue-above","panel-width","visual-viewport-height","panel-error"])):(_(),Qe(jm,{key:4,ref_key:"threadComposerRef",ref:vo,"active-thread-id":Ks.value,cwd:yn.value,"fuzzy-file-search-results":h(st),onRegisterFuzzySession:h(mt),"collaboration-modes":h(xe),"selected-collaboration-mode":h(de),models:h($e),"model-reasoning-efforts":h(te),"selected-model":Qf.value,"selected-reasoning-effort":h(Le),"selected-speed-mode":h(Ae),"is-updating-speed-mode":h(M),skills:h(Ke),"thread-token-usage":h(W),"codex-quota":h(pe),"is-turn-in-progress":jc.value,"is-stop-pending":h(A),"is-interrupting-turn":h(Be),"is-compacting":Gy.value,"external-session-active":Zf.value,"has-queue-above":h(zt).length>0,"send-with-enter":os.value,"in-progress-submit-mode":ta.value,"dictation-click-to-toggle":rs.value,"dictation-auto-send":Yo.value,"dictation-language":xr.value,"onUpdate:selectedCollaborationMode":Np,onSubmit:Cp,"onUpdate:selectedModel":Ep,"onUpdate:selectedReasoningEffort":Mp,"onUpdate:selectedSpeedMode":jp,"approval-policy":Jr.value,"is-approval-policy-saving":ba.value,"approval-policy-error":Rn.value,"approval-policy-notice":To.value,"onUpdate:approvalPolicy":Os,onSaveApprovalPolicy:Gn,"plan-panel":Mc.value,onInterrupt:Db,onSlashCommand:Lp,onImplementPlan:Bb,onCompactContext:Ky},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),h(kt)&&h(sn)?(_(),F("div",{key:0,class:"content-right-panel-backdrop",role:"presentation",onClick:p[28]||(p[28]=(...T)=>h(yo)&&h(yo)(...T))})):ve("",!0),su.value&&(h(kt)||!h(to))?(_(),F("aside",{key:1,class:at(["content-right-panel",{"is-mobile-open":h(sn)}]),style:er({"--right-panel-width":`${h(nn)}px`})},[h(kt)?ve("",!0):(_(),F("div",{key:0,class:"content-right-panel-resize-handle","aria-hidden":"true",onMousedown:p[29]||(p[29]=(...T)=>h(qo)&&h(qo)(...T))},null,32)),w("div",FO,[w("div",BO,[w("button",{class:at(["content-right-panel-tab",{"is-active":h(tn)==="git"}]),type:"button",role:"tab","aria-selected":h(tn)==="git",onClick:p[30]||(p[30]=T=>h(Ht)("git"))},[Oe(Ju,{class:"content-right-panel-tab-icon"}),ws(" "+D(h(f)("Git")),1)],10,UO),w("button",{class:at(["content-right-panel-tab",{"is-active":h(tn)==="files"}]),type:"button",role:"tab","aria-selected":h(tn)==="files",onClick:p[31]||(p[31]=T=>h(Ht)("files"))},[Oe($m,{class:"content-right-panel-tab-icon"}),ws(" "+D(h(f)("Files")),1)],10,zO),(_(!0),F(ot,null,Zt(h(Wr),T=>(_(),F("button",{key:T.key,class:at(["content-right-panel-tab content-right-panel-tab--preview",{"is-active":h(tn)==="preview"&&h(go)===T.key}]),type:"button",role:"tab","aria-selected":h(tn)==="preview"&&h(go)===T.key,title:T.path,onClick:O=>h(Gr)(T.key)},[Oe(el,{class:"content-right-panel-tab-icon"}),w("span",qO,D(T.label),1),w("span",{class:"content-right-panel-tab-close",role:"button","aria-label":h(f)("Close"),title:h(f)("Close"),onClick:gt(O=>h(Wo)(T.key),["stop"])},"×",8,WO)],10,HO))),128))]),w("div",GO,[w("div",VO,[w("button",{ref:"rightPanelAddButtonRef",class:"content-right-panel-add",type:"button","aria-label":h(f)("Add panel"),title:h(f)("Add panel"),onClick:p[32]||(p[32]=gt(T=>zn.value=!h(zn),["stop"]))},"+",8,KO),Oe(Xl,{name:"right-panel-menu"},{default:dt(()=>[h(zn)?(_(),F("div",YO,[w("button",{type:"button",onClick:p[33]||(p[33]=T=>h(Ht)("terminal"))},[Oe(G1,{class:"content-right-panel-menu-icon"}),ws(" "+D(h(f)("Terminal panel")),1)]),w("button",{type:"button",onClick:p[34]||(p[34]=T=>h(Ht)("git"))},[Oe(Ju,{class:"content-right-panel-menu-icon"}),ws(" "+D(h(f)("Git panel")),1)]),w("button",{type:"button",onClick:p[35]||(p[35]=T=>h(Ht)("files"))},[Oe($m,{class:"content-right-panel-menu-icon"}),ws(" "+D(h(f)("Files panel")),1)])])):ve("",!0)]),_:1})]),w("button",{class:"content-right-panel-close",type:"button","aria-label":h(f)("Close panel"),title:h(f)("Close panel"),onClick:p[36]||(p[36]=(...T)=>h(yo)&&h(yo)(...T))},[Oe(of,{class:"content-right-panel-close-icon"})],8,JO)])]),w("div",QO,[h(tn)==="git"?(_(),Qe(h(i),{key:0,"current-branch":So.value,"head-sha":No.value,"head-subject":$o.value,"head-date":Zr.value,detached:x.value,dirty:R.value,"worktree-change-summary":k.value,"worktree-changes":G.value,branches:Za.value,"commits-by-branch":Ot.value,"commits-loading-for":ao.value,"commits-error":Co.value,"commit-files-by-sha":cn.value,"commit-files-loading-for":br.value,"commit-files-error":es.value,loading:ts.value,busy:Tr.value,error:We.value,"review-open":Hn.value,"show-review":h(vt).name==="thread"&&h(ne).length>0,onToggleReview:mb,onCheckoutBranch:db,onResetBranchToCommit:fb,onLoadCommits:Ip,onLoadCommitFiles:pb,onOpenCommitFile:hb},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"])):h(tn)==="files"?(_(),Qe(h(l),{key:1,cwd:yn.value,onOpenPreview:h(js)},null,8,["cwd","onOpenPreview"])):h(tn)==="preview"&&h(Lt)?(_(),Qe(h(d),{key:2,"file-path":h(Lt).path,name:h(Lt).label},null,8,["file-path","name"])):(_(),Qe(h(n),{key:3,ref_key:"threadTerminalPanelRef",ref:lr,"thread-id":Ks.value,cwd:yn.value,onHide:h(Ka),onTerminalFocusChange:h(no)},null,8,["thread-id","cwd","onHide","onTerminalFocusChange"]))])],6)):ve("",!0)])]),_:1},8,["is-sidebar-collapsed"]),C.value.phase!=="idle"?(_(),F("div",XO,[w("div",{class:"project-zip-modal",role:"dialog","aria-modal":"true","aria-label":h(f)("Export Project"),onClick:p[38]||(p[38]=gt(()=>{},["stop"]))},[w("div",eD,[w("h2",tD,D(h(f)("Export Project")),1),w("button",{class:"project-zip-modal-close",type:"button","aria-label":h(f)("Close"),disabled:C.value.phase==="exporting",onClick:mp}," × ",8,nD)]),w("p",oD,D(C.value.phase==="exporting"?h(f)("Preparing project ZIP..."):C.value.fileName),1),w("div",rD,[w("span",null,D(C.value.phase==="exporting"?h(f)("Exporting"):h(f)("Ready")),1),w("span",null,D(il.value),1)]),w("div",aD,[w("div",{class:"project-zip-progress-fill",style:er({width:Jo.value})},null,4)]),C.value.error?(_(),F("p",sD,D(C.value.error),1)):ve("",!0),w("div",iD,[w("button",{class:"project-zip-modal-cancel",type:"button",disabled:C.value.phase==="exporting",onClick:mp},D(h(f)("Close")),9,lD),w("button",{class:"project-zip-modal-action",type:"button",disabled:!C.value.blob,onClick:Ww},D(h(f)("Download")),9,uD),w("button",{class:"project-zip-modal-action project-zip-modal-action-primary",type:"button",disabled:!C.value.blob,onClick:Gw},D(h(f)("Share")),9,cD)])],8,ZO)])):ve("",!0),Si.value?(_(),F("div",{key:1,class:"codex-login-modal-backdrop",role:"presentation",onClick:zc},[w("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":h(f)("Complete Codex login"),onSubmit:gt(Pw,["prevent"]),onClick:p[41]||(p[41]=gt(()=>{},["stop"]))},[w("div",fD,[w("h2",pD,D(h(f)("Complete Codex login")),1),w("button",{class:"codex-login-modal-close",type:"button","aria-label":h(f)("Close"),disabled:En.value,onClick:zc}," × ",8,hD)]),w("p",mD,D(h(f)("Finish login in the browser, then paste the localhost callback URL here.")),1),ns.value?(_(),F("a",{key:0,class:"codex-login-modal-link",href:ns.value,target:"_blank",rel:"noreferrer"},D(h(f)("Open login URL")),9,vD)):ve("",!0),xn(w("input",{ref_key:"codexLoginCallbackInputRef",ref:tu,"onUpdate:modelValue":p[39]||(p[39]=T=>Ca.value=T),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:h(f)("Paste localhost callback URL"),disabled:En.value},null,8,gD),[[Nn,Ca.value]]),Qt.value?(_(),F("div",yD,[w("span",null,D(Qt.value),1),w("a",{class:"visible-error-feedback",href:h(Bn),onClick:p[40]||(p[40]=T=>xt(T,Qt.value))},D(h(f)("Send feedback")),9,wD)])):ve("",!0),w("div",bD,[w("button",{class:"codex-login-modal-cancel",type:"button",disabled:En.value,onClick:zc},D(h(f)("Cancel")),9,TD),w("button",{class:"codex-login-modal-submit",type:"submit",disabled:En.value||Ca.value.trim().length===0},D(En.value?h(f)("Completing…"):h(f)("Complete")),9,SD)])],40,dD)])):ve("",!0)],64))}}),kD=It(xD,[["__scopeId","data-v-72dcb7bb"]]),Pu={render:()=>null},ID=ax({history:O0(),routes:[{path:"/",name:"home",component:Pu},{path:"/thread/:threadId",name:"thread",component:Pu},{path:"/skills",name:"skills",component:Pu},{path:"/automations",name:"automations",component:Pu},{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");UA();KC(kD).use(ID).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(Xg("Service worker registration failed."),e)})});export{AD as $,Ju as A,_o as B,Cs as C,Su as D,hj as E,ot as F,_r as G,Df as H,of as I,Nt as J,_D as K,_f as L,FR as M,rA as N,pi as O,Jk as P,MD as Q,RD as R,jD as S,Ki as T,ED as U,LD as V,ci as W,sF as X,lF as Y,iF as Z,It as _,qN as a,Ao as a0,Wf as a1,xn as a2,Nn as a3,ix as a4,sx as a5,Bk as a6,zD as a7,ND as a8,$D as a9,UC as aA,rF as aB,aF as aC,OD as aa,VD as ab,XD as ac,ZD as ad,HD as ae,QD as af,FD as ag,DD as ah,BD as ai,UD as aj,eF as ak,nF as al,oF as am,qD as an,WD as ao,GD as ap,KD as aq,JD as ar,YD as as,tF as at,bx as au,Tx as av,bs as aw,QR as ax,PD as ay,el as az,HN as b,K as c,Om as d,hn as e,_ as f,Lf as g,Qe as h,F as i,w as j,ve as k,Zt as l,ws as m,at as n,_s as o,Oe as p,Xl as q,S as r,dt as s,D as t,h as u,da as v,gt as w,tt as x,er as y,ny as z};
|
|
83
|
+
`}function Hb(u){return u.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Qc(u,p){if(typeof window>"u")return p;const T=window.localStorage.getItem(u);return T===null?p:T==="1"}function qb(){if(typeof window>"u")return"system";const u=window.localStorage.getItem(ev);return u==="light"||u==="dark"?u:"system"}function Wb(){if(typeof window>"u")return"steer";const u=window.localStorage.getItem(Zm);return u==="steer"||u==="queue"?u:"queue"}function Gb(){if(typeof window>"u")return"standard";const u=window.localStorage.getItem(rv);return u==="standard"||u==="wide"||u==="extra-wide"?u:"standard"}function Vb(){os.value=!os.value,window.localStorage.setItem(Xm,os.value?"1":"0")}function Kb(){ta.value=ta.value==="steer"?"queue":"steer",window.localStorage.setItem(Zm,ta.value)}function Yb(){const u=["system","light","dark"],p=u.indexOf(ka.value);ka.value=u[(p+1)%u.length],window.localStorage.setItem(ev,ka.value),pu()}function Jb(){const u=["standard","wide","extra-wide"],p=u.indexOf(Bs.value);Bs.value=u[(p+1)%u.length],window.localStorage.setItem(rv,Bs.value)}function Qb(){rs.value=!rs.value,window.localStorage.setItem(tv,rs.value?"1":"0")}function Xb(){Yo.value=!Yo.value,window.localStorage.setItem(nv,Yo.value?"1":"0")}async function Zb(u){if(!Us.value){Us.value=!0;try{if(u==="codex"){ko.value="codex";const p=await sm(!1);na.value=p.enabled}else if(u==="openrouter"){ko.value="openrouter";const p=await sm(!0);na.value=p.enabled,await Mi("","",{wireApi:J.value,provider:"openrouter"})}else u==="opencode-zen"?(ko.value="opencode-zen",await Mi("",ie.value.trim(),{wireApi:"responses",provider:"opencode-zen"}),na.value=!0):u==="custom"&&(ko.value="custom",g.value.trim()&&I.value.trim()&&(await Mi(g.value.trim(),I.value.trim(),{wireApi:$.value}),na.value=!0));Oo.value="",await Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Oo.value=p instanceof Error?p.message:"Failed to switch provider"}finally{Us.value=!1}}}async function eT(){if(Cn.value)return;const u=g.value.trim();if(u){Cn.value=!0;try{Oo.value="",await Mi(u,I.value.trim(),{wireApi:$.value}),na.value=!0;const p=await am();p.provider==="custom"&&!p.currentModel&&(Oo.value=f("Failed to resolve model from custom endpoint; check the URL and try again")),await Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Oo.value=p instanceof Error?p.message:"Failed to save custom endpoint"}finally{Cn.value=!1}}}async function tT(u){if(Cn.value||Us.value||J.value===u)return;const p=J.value;J.value=u,Cn.value=!0;try{Oo.value="",await Mi("","",{wireApi:u,provider:"openrouter"}),na.value=!0,await Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(T){J.value=p,Oo.value=T instanceof Error?T.message:"Failed to save OpenRouter API format"}finally{Cn.value=!1}}async function nT(){if(Cn.value)return;const u=ie.value.trim();if(u){Cn.value=!0;try{Oo.value="",await Mi("",u,{wireApi:"responses",provider:"opencode-zen"}),na.value=!0,await Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Oo.value=p instanceof Error?p.message:"Failed to save OpenCode Zen config"}finally{Cn.value=!1}}}async function oT(){if(!Cn.value){Cn.value=!0;try{const u=zs.value.trim();await im(u),zs.value="",await Xc(),await Z({includeSelectedThreadMessages:!1})}catch{}finally{Cn.value=!1}}}async function rT(){if(!Cn.value){Cn.value=!0;try{await im(""),zs.value="",await Xc(),await Z({includeSelectedThreadMessages:!1})}catch{}finally{Cn.value=!1}}}async function Xc(){try{const u=ko.value,p=await am();na.value=p.enabled,nu.value=p.customKey??!1,ll.value=p.maskedKey??null,p.enabled?p.provider==="opencode-zen"?ko.value="opencode-zen":p.provider==="custom"?(ko.value="custom",g.value=p.customBaseUrl??"",$.value=p.wireApi==="chat"?"chat":"responses"):(ko.value="openrouter",J.value=p.wireApi==="chat"?"chat":"responses"):ko.value="codex",_c=p.hasCodexAuth===!0,_c||(Pc=!1);const T=ko.value!==u;T&&await Z({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0});const O=await lp();O&&await Z({includeSelectedThreadMessages:!1,providerChanged:T||O,awaitAncillaryRefreshes:!0})}catch{}}function aT(u){const T=Zc(u.trim())||"auto";xr.value=T,window.localStorage.setItem(ov,T)}function sT(u){Ur(Number(u))}const iT=[{value:"0",label:f("Off")},{value:"5",label:"5%"},{value:"10",label:"10%"},{value:"15",label:"15%"},{value:"20",label:"20%"},{value:"25",label:"25%"}];function lT(){var T;if(typeof window>"u")return"auto";const u=((T=window.localStorage.getItem(ov))==null?void 0:T.trim())||"auto";return Zc(u)||"auto"}function uT(){const u=[{value:"auto",label:f("Auto-detect")}],p=new Set(["auto"]);function T(V){const Te=U[V]||V;return`${Te.charAt(0).toUpperCase()+Te.slice(1)} (${V})`}for(const V of typeof navigator<"u"?navigator.languages??[]:[]){const Te=Zc(V);!Te||p.has(Te)||(p.add(Te),u.push({value:Te,label:`${f("Preferred")}: ${T(Te)}`}))}for(const V of Object.keys(U))p.has(V)||(p.add(V),u.push({value:V,label:T(V)}));const O=xr.value.trim();return O&&!p.has(O)&&u.push({value:O,label:T(O)}),u}function Zc(u){const p=u.trim().toLowerCase();if(!p||p==="auto")return"";if(p in U)return p;const T=p.split("-")[0]??p;return T in U?T:""}function pu(){const u=document.documentElement;if(ka.value==="dark")u.classList.add("dark");else if(ka.value==="light")u.classList.remove("dark");else{const p=window.matchMedia("(prefers-color-scheme: dark)").matches;u.classList.toggle("dark",p)}}const cT=K(()=>({activeSettingsGroup:Ns.value,accounts:Vn.value,isAccountsSectionCollapsed:ct.value,isRefreshingAccounts:Sr.value,isSwitchingAccounts:Cr.value,isStartingCodexLogin:ea.value,isCompletingCodexLogin:En.value,accountActionError:Qt.value,codexLoginUrl:ns.value,feedbackMailto:Bn,isAccountUnavailable:iu,isRemoveConfirmationActive:Uc,isRemoveVisible:yw,buildAccountTitle:kw,formatAccountMeta:cp,formatAccountQuota:dp,shortAccountId:mw,isAccountActionDisabled:gw,getAccountSwitchLabel:ww,getAccountRemoveLabel:bw,onRefreshAccounts:Iw,onStartCodexLogin:_w,onSwitchAccount:Aw,onRemoveAccount:Ew,onAccountCardPointerEnter:Tw,onAccountCardPointerLeave:Sw,toggleAccountsSectionCollapsed:Ls,prepareFeedbackLink:xt,sendWithEnter:os.value,inProgressSendMode:ta.value,darkMode:ka.value,uiLanguage:b.value,uiLanguageOptions:y,chatWidthLabel:tw.value,dictationClickToToggle:rs.value,dictationAutoSend:Yo.value,dictationLanguage:xr.value,dictationLanguageOptions:Sc.value,autoCompactThreshold:ar.value,autoCompactThresholdOptions:iT,hasVisibleFeedbackError:Ny.value,selectedProvider:ko.value,providerDropdownOptions:h.value,freeModeLoading:Us.value,providerError:Oo.value,freeModeHasCustomKey:nu.value,freeModeCustomKey:zs.value,freeModeCustomKeyMasked:ll.value,freeModeCustomKeySaving:Cn.value,openRouterWireApi:J.value,opencodeZenKey:ie.value,customEndpointUrl:g.value,customEndpointKey:I.value,customEndpointWireApi:$.value,isTelegramConfigOpen:X.value,telegramStatusText:ow.value,telegramBotTokenDraft:se.value,telegramAllowedUserIdsDraft:ge.value,telegramConfigError:Ie.value,isTelegramSaving:ze.value,supportsHooks:al.value,isHooksLoading:Re.value,hooksList:je.value,supportsRemoteControl:$s.value,remoteControlStatus:qn.value,isRemoteControlActionInFlight:un.value,remoteControlError:yr.value,remoteControlNotice:wr.value,isRemoteControlLoading:ro.value,remoteControlActionName:Wn.value,pairingCode:gi.value,accountRateLimitSnapshots:lt.value,worktreeName:B,appVersion:L,onClose:()=>{Sn.value=!1},onActiveSettingsGroupChange:u=>{Ns.value=u},toggleSendWithEnter:Vb,cycleInProgressSendMode:Kb,cycleDarkMode:Yb,onUiLanguageChange:P,cycleChatWidth:Jb,toggleDictationClickToToggle:Qb,toggleDictationAutoSend:Xb,onDictationLanguageChange:aT,onAutoCompactThresholdChange:sT,onProviderChange:Zb,onFreeModeCustomKeyChange:u=>{zs.value=u},clearFreeModeCustomKey:rT,saveFreeModeCustomKey:oT,setOpenRouterWireApi:tT,onOpencodeZenKeyChange:u=>{ie.value=u},saveOpencodeZen:nT,onCustomEndpointUrlChange:u=>{g.value=u},onCustomEndpointKeyChange:u=>{I.value=u},saveCustomEndpoint:eT,onCustomEndpointWireApiChange:u=>{$.value=u},onTelegramConfigOpenChange:u=>{X.value=u},onTelegramBotTokenDraftChange:u=>{se.value=u},onTelegramAllowedUserIdsDraftChange:u=>{ge.value=u},saveTelegramConfig:lw,refreshHooks:re,toggleRemoteControl:Fs,startRemotePairing:bi,refreshRemoteClients:sl,revokeRemoteClient:Ti}));function dT(u,p){const T=(u??"").trim();return T.length>0?T:p.trim()||"message"}function Np(u){zr(u)}async function fT(){await Ct.isReady(),vt.name==="thread"&&Gs.value?Ga(Gs.value):(vt.name==="home"||vt.name==="skills"||vt.name==="automations")&&Ga("",{persist:!1}),await Z({includeSelectedThreadMessages:vt.name==="thread"}),vl({silent:!0}),await Nb(),cr.value=!0,await ed(),Po()}async function ed(){if(bo.value){oo=!0;return}bo.value=!0;try{do{if(oo=!1,vt.name==="home"||vt.name==="skills"||vt.name==="automations"){ne.value!==""&&await me("");continue}if(vt.name==="thread"){const u=Gs.value;if(!u)continue;if(ne.value!==u){if(await me(u)==="not-found")continue}else Ve(u,{silent:!0}).catch(()=>{})}}while(oo)}finally{bo.value=!1}}tt(()=>[vt.name,Gs.value,fe.value,ne.value],async()=>{cr.value&&await ed()}),tt(()=>[ne.value,yn.value],()=>{vb()}),tt(()=>[vt.name,yn.value],([u,p])=>{u==="thread"&&uu(p)},{immediate:!0}),tt(()=>ne.value,async u=>{if(cr.value&&!bo.value&&!(gn.value||is.value||Vs.value)){if(!u){vt.name!=="home"&&await Ct.replace({name:"home"});return}vt.name==="thread"&&Gs.value===u||await Ct.replace({name:"thread",params:{threadId:u}})}}),tt(()=>Oc.value,u=>{if(u.length===0){St.value="",Ir();return}const p=St.value.trim();p&&(u.some(O=>O.value===p)||(St.value="")),Ir()},{immediate:!0}),tt(()=>St.value,()=>{E.value={phase:"idle",title:"",message:""},Ir()}),tt(()=>[vt.name,St.value],([u,p])=>{u==="home"&&uu(p)},{immediate:!0}),tt(Ys,u=>{!u&&ln.value==="worktree"&&(ln.value="local")},{immediate:!0}),tt(()=>[ln.value,St.value],([u,p])=>{u!=="worktree"||!Ys.value||$p(p)},{immediate:!0}),tt(()=>ln.value,u=>{var p;if(u==="local"){E.value={phase:"idle",title:"",message:""};const T=St.value.trim();if(T&&fp(T)){const O=((p=le.value)==null?void 0:p.projectName)??Bo(T),V=_i(O,"");V&&(St.value=V)}return}Ys.value&&$p(St.value)}),tt(()=>vt.name,u=>{u!=="home"&&(E.value={phase:"idle",title:"",message:""}),u!=="thread"&&(Hn.value=!1)}),tt(()=>ne.value,()=>{E.value={phase:"idle",title:"",message:""}}),tt(()=>[vt.name,yn.value,Ys.value],([u,p,T])=>{if(!(u==="thread"||u==="home"&&T)){xp();return}$t+=1,Ot.value={},ao.value="",Co.value="",gl(p)},{immediate:!0}),tt(Dy,u=>{typeof document>"u"||(document.title=u)},{immediate:!0}),tt(kt,u=>{u&&!we.value&&Wt(!0)},{immediate:!0});async function pT(u,p=[],T=[],O=[]){try{E.value={phase:"idle",title:"",message:""};let V=St.value;if(ln.value==="worktree"){E.value={phase:"running",title:f("Creating worktree"),message:f("Creating a worktree and running setup.")};try{const De=await NI(St.value,An.value);V=De.cwd,St.value=De.cwd,E.value={phase:"idle",title:"",message:""}}catch{E.value={phase:"error",title:f("Worktree setup failed"),message:f("Unable to create worktree. Try again or switch to Local project.")};return}}else if(!V.trim()){const De=await QI(u);V=De.cwd,St.value=De.cwd}const Te=await bt(u,V,p,T,O);if(!Te)return;await Ct.replace({name:"thread",params:{threadId:Te}}),cu()}catch{}}function hT(u){var O;if((O=u.prompt)!=null&&O.trim())return u.prompt.trim();const p=u.displayName.trim()||u.name.trim(),T=u.kind==="skill"?"skill":u.kind==="plugin"?"plugin":u.kind==="composio"?"Composio connector":"app";return`Test ${p} ${T}. Give me a list of what it can do and one useful example.`}function mT(u){return`${u.kind}:${u.name}:${u.skillPath??""}`}async function vT(u){var O;if(jo.value)return;jo.value=mT(u);const p=hT(u),T=(O=u.attachedSkills)!=null&&O.length?u.attachedSkills:u.kind==="skill"&&u.skillPath?[{name:u.name,path:u.skillPath}]:[];try{const V=Xf.value.trim()||yn.value.trim(),Te=await bt(p,V,[],T,[]);if(!Te)return;await Ct.replace({name:"thread",params:{threadId:Te}}),cu()}catch{}finally{jo.value=""}}async function $p(u){var T;const p=u.trim();if(!p){Kr.value=[],An.value="";return}fr.value=!0;try{const O=await OI(p);Kr.value=O;const V=An.value.trim();if(!(V.length>0&&O.some(De=>De.value===V))){const De=O.find(Ft=>Ft.value.trim()==="main");An.value=(De==null?void 0:De.value)??((T=O[0])==null?void 0:T.value)??""}}catch{Kr.value=[],An.value=""}finally{fr.value=!1}}return(u,p)=>(_(),F(ot,null,[Oe(px,{"is-sidebar-collapsed":m(we),onCloseSidebar:p[37]||(p[37]=T=>m(Wt)(!0))},{sidebar:dt(()=>[w("section",VN,[w("div",{ref_key:"sidebarScrollableRef",ref:Kt,class:"sidebar-scrollable",onScroll:p[7]||(p[7]=(...T)=>m(pr)&&m(pr)(...T))},[m(we)?ve("",!0):(_(),Qe(Lm,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":m(we),"show-new-thread-button":!0,onToggleSidebar:p[1]||(p[1]=T=>m(Wt)(!m(we))),onStartNewThread:Hc},{default:dt(()=>[w("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":m(_n),"aria-label":m(f)("Search threads"),title:m(f)("Search threads"),onClick:p[0]||(p[0]=(...T)=>m(vn)&&m(vn)(...T))},[Oe(Nm,{class:"sidebar-search-toggle-icon"})],8,KN)]),_:1},8,["is-sidebar-collapsed"])),!m(we)&&m(_n)?(_(),F("div",YN,[Oe(Nm,{class:"sidebar-search-bar-icon"}),xn(w("input",{ref_key:"sidebarSearchInputRef",ref:Pn,"onUpdate:modelValue":p[2]||(p[2]=T=>kn(_t)?_t.value=T:null),class:"sidebar-search-input",type:"text",placeholder:m(f)("Filter threads..."),onKeydown:p[3]||(p[3]=(...T)=>m(hr)&&m(hr)(...T))},null,40,JN),[[Nn,m(_t)]]),m(_t).length>0?(_(),F("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":m(f)("Clear search"),onClick:p[4]||(p[4]=(...T)=>m(mi)&&m(mi)(...T))},[Oe(of,{class:"sidebar-search-clear-icon"})],8,QN)):ve("",!0)])):ve("",!0),m(we)?ve("",!0):(_(),F("button",{key:2,class:at(["sidebar-skills-link",{"is-active":is.value}]),type:"button",onClick:p[5]||(p[5]=T=>{m(Ct).push({name:"skills"}),m(kt)&&m(Wt)(!0)})},[w("span",XN,[Oe(bs)]),w("span",ZN,[w("span",e$,D(m(f)("Skills")),1),w("span",t$,D(m(f)("Plugins, apps, MCPs")),1)])],2)),m(we)?ve("",!0):(_(),F("button",{key:3,class:at(["sidebar-skills-link",{"is-active":Vs.value}]),type:"button",onClick:p[6]||(p[6]=T=>{m(Ct).push({name:"automations"}),m(kt)&&m(Wt)(!0)})},[w("span",n$,[Oe(bs)]),w("span",o$,[w("span",r$,D(m(f)("Automations")),1),w("span",a$,D(m(f)("Scheduled work")),1)])],2)),m(we)?ve("",!0):(_(),Qe(_R,{key:4,ref_key:"sidebarThreadTreeRef",ref:Fn,groups:m(H),"project-display-name-by-id":m(be),"project-git-repo-by-name":Jy.value,"project-cwd-by-name":pp.value,"selected-thread-id":m(ne),"is-loading":m(fe),"is-thread-list-fully-loaded":m(N),"search-query":m(_t),"search-matched-thread-ids":vr.value,onSelect:uw,onArchive:Mw,onStartNewThread:Nw,onRenameProject:Jw,onBrowseThreadFiles:$w,onSaveThreadProject:Uw,onBrowseProjectFiles:Fw,onSaveProject:Bw,onRequestProjectGitStatus:eb,onCreateProjectWorktree:Vw,onRenameThread:Qw,onForkThread:Lw,onRemoveProject:Xw,onReorderProject:Zw,onCopyThreadChat:hw,onAutomationsChanged:pw,onRestoreThread:jw,onStartNewChat:Yw},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),m(we)?ve("",!0):(_(),F("div",{key:0,ref_key:"settingsAreaRef",ref:mr,class:"sidebar-settings-area",onClick:rb},[Sn.value?(_(),Qe(m(s),jf({key:0,ref_key:"settingsDialogRef",ref:Yr},cT.value),null,16)):ve("",!0),w("div",s$,[w("button",{ref_key:"settingsButtonRef",ref:Tn,class:"sidebar-settings-icon-button",type:"button",title:m(f)("Settings"),"aria-label":m(f)("Settings"),onClick:gt(rl,["stop"])},[Oe(z1,{class:"sidebar-settings-icon"})],8,i$),w("button",{ref:"recycleBinButtonRef",class:"sidebar-settings-icon-button",type:"button",title:m(f)("Recycle bin"),"aria-label":m(f)("Recycle bin"),onClick:gt(ab,["stop"])},[Oe(ay,{class:"sidebar-settings-icon"})],8,l$)])],512))])]),content:dt(()=>[w("div",u$,[w("section",{class:at(["content-root",{"is-virtual-keyboard-open":Wy.value}]),style:er(nw.value)},[pl.value?(_(),F("span",c$)):ve("",!0),Oe(jR,{title:$y.value,accent:is.value||Vs.value},{leading:dt(()=>[m(we)||m(kt)?(_(),Qe(Lm,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":m(we),"show-new-thread-button":!0,onToggleSidebar:p[8]||(p[8]=T=>m(Wt)(!m(we))),onStartNewThread:Hc},null,8,["is-sidebar-collapsed"])):ve("",!0),is.value?(_(),F("span",d$,[Oe(bs)])):Vs.value?(_(),F("span",f$,[Oe(bs)])):ve("",!0)]),actions:dt(()=>[su.value?(_(),F("button",{key:0,class:"content-header-right-panel-toggle",type:"button","aria-label":m(kt)?m(sn)?m(f)("Close side panel"):m(f)("Open side panel"):m(to)?m(f)("Open side panel"):m(f)("Close side panel"),title:m(kt)?m(sn)?m(f)("Close side panel"):m(f)("Open side panel"):m(to)?m(f)("Open side panel"):m(f)("Close side panel"),onClick:p[9]||(p[9]=(...T)=>m(qt)&&m(qt)(...T))},[Oe(sy,{class:"content-header-right-panel-toggle-icon"})],8,p$)):ve("",!0)]),_:1},8,["title","accent"]),w("section",h$,[is.value?(_(),Qe(m(r),{key:0,ref_key:"directoryHubRef",ref:Hr,cwd:Xf.value,"thread-id":Gs.value,"try-in-flight-key":jo.value,onSkillsChanged:rw,onTryItem:vT},null,8,["cwd","thread-id","try-in-flight-key"])):Vs.value?(_(),Qe(m(a),{key:1,ref_key:"automationsPanelRef",ref:ho,groups:m(H),"project-cwd-by-name":pp.value,"project-display-name-by-id":m(be),"selected-automation-id":Yf.value,onSelectAutomation:cw,onEditAutomation:dw,onCreateAutomation:fw},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):gn.value?(_(),F("div",m$,[w("div",v$,[w("p",g$,D(m(f)("Let's build")),1),Oe(ci,{class:"new-thread-folder-dropdown","model-value":St.value,options:Oc.value,placeholder:m(f)("Choose folder"),"enable-search":!0,"search-placeholder":m(f)("Quick search project"),disabled:!1,"onUpdate:modelValue":lb},null,8,["model-value","options","placeholder","search-placeholder"]),St.value?(_(),F("p",{key:0,class:"new-thread-folder-selected",title:St.value},D(m(f)("Selected folder"))+": "+D(St.value),9,y$)):ve("",!0),w("div",w$,[w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:_b},D(m(f)("Select folder")),1),w("button",{class:"new-thread-folder-action",type:"button",onClick:gb},D(m(f)("Create Project")),1),w("button",{class:"new-thread-folder-action",type:"button",disabled:qs.value,onClick:xb},D(qs.value?m(f)("Importing…"):m(f)("Import Project")),9,b$),w("input",{ref_key:"projectImportInputRef",ref:ul,class:"new-thread-project-import-input",type:"file",accept:".zip,application/zip",tabindex:"-1","aria-hidden":"true",onChange:Ab},null,544)]),Ci.value?(_(),F("section",T$,[w("div",S$,[w("div",C$,[w("span",x$,[Oe(bs)]),w("p",k$,D(m(f)("New in Codex")),1)]),w("h2",I$,D(m(f)("Plugins are here")),1),w("p",A$,D(m(f)("Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.")),1),p[42]||(p[42]=w("div",{class:"new-thread-launch-card-pills","aria-label":"Example integrations"},[w("span",{class:"new-thread-launch-card-pill"},"Gmail"),w("span",{class:"new-thread-launch-card-pill"},"Calendar"),w("span",{class:"new-thread-launch-card-pill"},"GitHub"),w("span",{class:"new-thread-launch-card-pill"},"Slack"),w("span",{class:"new-thread-launch-card-pill"},"Browser Use")],-1))]),w("div",_$,[w("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:Vy},D(m(f)("Explore Plugins & Apps")),1),w("button",{class:"new-thread-launch-card-button",type:"button",onClick:ep},D(m(f)("Dismiss")),1)])])):ve("",!0),(_(),Qe(Ki,{to:"body"},[kr.value?(_(),F("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:gt(yb,["self"]),onMouseup:wb},[w("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":m(f)("Select folder"),onKeydown:Ao(gt(Pi,["prevent"]),["esc"])},[w("div",R$,[w("p",E$,D(m(f)("Select folder")),1),w("button",{class:"new-thread-open-folder-close",type:"button",onClick:Pi},D(m(f)("Cancel")),1)]),w("p",M$,D(m(f)("Current folder")),1),w("div",j$,[xn(w("input",{ref_key:"existingFolderPathInputRef",ref:cl,"onUpdate:modelValue":p[10]||(p[10]=T=>ra.value=T),class:"new-thread-open-folder-path",type:"text",placeholder:m(f)("Current folder"),title:ra.value||m(f)("Unavailable"),disabled:Ce.value||wt.value,onBlur:Mb,onKeydown:[Ao(gt(jb,["prevent"]),["enter"]),Ao(gt(Pi,["prevent"]),["esc"])]},null,40,L$),[[Nn,ra.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!ml.value||Ce.value||wt.value,onClick:p[11]||(p[11]=T=>Kc())},D(wt.value?m(f)("Opening…"):m(f)("Open")),9,N$)]),w("div",$$,[w("label",O$,[xn(w("input",{"onUpdate:modelValue":p[12]||(p[12]=T=>Fo.value=T),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:Rb},null,544),[[UC,Fo.value]]),w("span",null,D(m(f)("Show hidden folders")),1)]),w("button",{class:at(["new-thread-folder-action",{"new-thread-folder-action-primary":pt.value}]),type:"button","aria-pressed":pt.value,disabled:!Do.value||Ce.value||wt.value||Pt.value||!!fn.value&&!pt.value,onClick:Lb},D(m(f)("New folder")),11,D$)]),pt.value?(_(),F("div",F$,[w("div",B$,[xn(w("input",{ref_key:"createFolderInputRef",ref:eu,"onUpdate:modelValue":p[13]||(p[13]=T=>ht.value=T),class:"new-thread-open-folder-create-input",type:"text",placeholder:m(f)("Folder name"),onKeydown:[Ao(gt(Ap,["prevent"]),["enter"]),Ao(gt(yl,["prevent"]),["esc"])]},null,40,U$),[[Nn,ht.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!Qy.value||Pt.value,onClick:Ap},D(Xy.value),9,z$)]),it.value?(_(),F("div",H$,[w("span",null,D(it.value),1),w("a",{class:"visible-error-feedback",href:m(Bn),onClick:p[14]||(p[14]=T=>xt(T,it.value))},D(m(f)("Send feedback")),9,q$)])):ve("",!0)])):ve("",!0),xn(w("input",{ref_key:"existingFolderFilterInputRef",ref:ou,"onUpdate:modelValue":p[15]||(p[15]=T=>so.value=T),class:"new-thread-open-folder-filter",type:"text",placeholder:m(f)("Filter folders..."),onKeydown:Ao(gt(Pi,["prevent"]),["esc"])},null,40,W$),[[Nn,so.value]]),fn.value?(_(),F("div",G$,[w("div",V$,[w("span",null,D(fn.value),1),w("a",{class:"visible-error-feedback",href:m(Bn),onClick:p[16]||(p[16]=T=>xt(T,fn.value))},D(m(f)("Send feedback")),9,K$)]),w("button",{class:"new-thread-folder-action",type:"button",disabled:Ce.value||wt.value,onClick:Eb},D(m(f)("Retry")),9,Y$)])):ve("",!0),Ce.value?(_(),F("p",J$,D(m(f)("Loading folders…")),1)):!fn.value&&Fc.value.length===0?(_(),F("p",Q$,D(so.value.trim()?m(f)("No folders match this filter."):m(f)("No subfolders found here.")),1)):Fc.value.length>0?(_(),F("ul",X$,[(_(!0),F(ot,null,Zt(Fc.value,T=>(_(),F("li",{key:T.key,class:"new-thread-open-folder-item"},[w("button",{class:"new-thread-open-folder-item-main",type:"button",title:T.path,disabled:Ce.value||wt.value,onClick:O=>Pb(T.path)},[w("span",eO,D(T.name),1)],8,Z$),T.kind==="directory"?(_(),F("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:Ce.value||wt.value,onClick:O=>Kc(T.path)},D(m(f)("Open")),9,tO)):ve("",!0)]))),128))])):ve("",!0)],40,P$)],32)):ve("",!0)])),(_(),Qe(Ki,{to:"body"},[Ia.value?(_(),F("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:gt(bb,["self"]),onMouseup:Tb},[w("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":m(f)("Create or clone project"),onKeydown:Ao(gt(du,["prevent"]),["esc"])},[w("div",oO,[w("p",rO,D(m(f)("Create or clone project")),1),w("button",{class:"new-thread-open-folder-close",type:"button",disabled:Mn.value,onClick:du},D(m(f)("Cancel")),9,aO)]),w("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":m(f)("Project source")},[w("button",{class:at(["new-thread-project-mode-tab",{"is-active":Kn.value==="create"}]),type:"button",role:"tab","aria-selected":Kn.value==="create",disabled:Mn.value,onClick:p[17]||(p[17]=T=>Kn.value="create")},D(m(f)("New project")),11,iO),w("button",{class:at(["new-thread-project-mode-tab",{"is-active":Kn.value==="clone"}]),type:"button",role:"tab","aria-selected":Kn.value==="clone",disabled:Mn.value,onClick:p[18]||(p[18]=T=>Kn.value="clone")},D(m(f)("Clone from GitHub")),11,lO)],8,sO),w("label",uO,[w("span",cO,D(m(f)("Destination folder")),1),xn(w("input",{"onUpdate:modelValue":p[19]||(p[19]=T=>Hs.value=T),class:"new-thread-open-folder-path",type:"text",disabled:Mn.value,placeholder:m(f)("Destination folder")},null,8,dO),[[Nn,Hs.value]])]),Kn.value==="create"?(_(),F("label",fO,[w("span",pO,D(m(f)("Project name")),1),xn(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:xi,"onUpdate:modelValue":p[20]||(p[20]=T=>oa.value=T),class:"new-thread-open-folder-create-input",type:"text",disabled:Mn.value,placeholder:m(f)("Project name"),onKeydown:Ao(gt(Vc,["prevent"]),["enter"])},null,40,hO),[[Nn,oa.value]])])):Kn.value==="clone"?(_(),F("label",mO,[w("span",vO,D(m(f)("GitHub repository URL")),1),xn(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:xi,"onUpdate:modelValue":p[21]||(p[21]=T=>Aa.value=T),class:"new-thread-open-folder-create-input",type:"url",disabled:Mn.value,placeholder:"https://github.com/owner/repo",onKeydown:Ao(gt(Vc,["prevent"]),["enter"])},null,40,gO),[[Nn,Aa.value]])])):ve("",!0),Qo.value?(_(),F("div",yO,[w("span",null,D(Qo.value),1),w("a",{class:"visible-error-feedback",href:m(Bn),onClick:p[22]||(p[22]=T=>xt(T,Qo.value))},D(m(f)("Send feedback")),9,wO)])):ve("",!0),w("div",bO,[w("button",{class:"new-thread-folder-action",type:"button",disabled:Mn.value,onClick:du},D(m(f)("Cancel")),9,TO),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!sp.value||Mn.value,onClick:Vc},D(Zy.value),9,SO)])],40,nO)],32)):ve("",!0)])),Ys.value?(_(),Qe(x1,{key:2,class:"new-thread-runtime-dropdown",modelValue:ln.value,"onUpdate:modelValue":p[23]||(p[23]=T=>ln.value=T)},null,8,["modelValue"])):ve("",!0),ln.value==="worktree"?(_(),F("div",CO,[w("p",xO,D(m(f)("Base branch")),1),Oe(ci,{class:"new-thread-branch-dropdown","model-value":An.value,options:Dc.value,placeholder:m(f)("Select branch"),"enable-search":!0,"search-placeholder":m(f)("Search branches..."),disabled:fr.value||Dc.value.length===0,"onUpdate:modelValue":ub},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),w("p",kO,D(fr.value?m(f)("Loading branches…"):np.value?m(f)("New worktree branch will start from {branch}.",{branch:np.value}):m(f)("No Git branches found for this folder.")),1)])):ve("",!0),Ys.value?(_(),F("p",IO,D(m(f)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):ve("",!0),E.value.phase!=="idle"?(_(),F("div",{key:5,class:at(["worktree-init-status",{"is-running":E.value.phase==="running","is-error":E.value.phase==="error"}])},[w("strong",AO,D(E.value.title),1),w("span",_O,D(E.value.message),1)],2)):ve("",!0)]),w("div",PO,[m(Fe)?(_(),F("div",RO,[w("span",null,D(m(f)(m(Fe))),1),w("a",{class:"visible-error-feedback",href:m(Bn),onClick:p[24]||(p[24]=T=>xt(T,m(Fe)))},D(m(f)("Send feedback")),9,EO)])):ve("",!0),Oe(jm,{ref_key:"homeThreadComposerRef",ref:eo,"active-thread-id":Ks.value,cwd:yn.value,"fuzzy-file-search-results":m(st),onRegisterFuzzySession:m(mt),"collaboration-modes":m(xe),"selected-collaboration-mode":m(de),models:m($e),"model-reasoning-efforts":m(te),"selected-model":Qf.value,"selected-reasoning-effort":m(Le),"selected-speed-mode":m(Ae),"is-updating-speed-mode":m(M),skills:m(Ke),"thread-token-usage":m(W),"codex-quota":m(pe),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":os.value,"in-progress-submit-mode":ta.value,"dictation-click-to-toggle":rs.value,"dictation-auto-send":Yo.value,"dictation-language":xr.value,onSubmit:Cp,"onUpdate:selectedCollaborationMode":Np,"onUpdate:selectedModel":Ep,"onUpdate:selectedReasoningEffort":Mp,"onUpdate:selectedSpeedMode":jp,"approval-policy":Jr.value,"is-approval-policy-saving":ba.value,"approval-policy-error":Rn.value,"approval-policy-notice":To.value,"onUpdate:approvalPolicy":Os,onSaveApprovalPolicy:Gn,onSlashCommand:Lp},null,8,["active-thread-id","cwd","fuzzy-file-search-results","onRegisterFuzzySession","collaboration-modes","selected-collaboration-mode","models","model-reasoning-efforts","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","thread-token-usage","codex-quota","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","dictation-language","approval-policy","is-approval-policy-saving","approval-policy-error","approval-policy-notice"])])])):(_(),F("div",MO,[Hn.value&&m(ne)&&yn.value?(_(),Qe(m(o),{key:0,"thread-id":m(ne),cwd:yn.value,"is-thread-in-progress":jc.value,"initial-file-path":Qr.value,"commit-sha":Xr.value,onClose:p[25]||(p[25]=T=>Hn.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress","initial-file-path","commit-sha"])):(_(),F(ot,{key:1},[w("div",jO,[Oe(m(t),{ref_key:"threadConversationRef",ref:ir,messages:Fy.value,"is-loading":m(oe),"active-thread-id":Ks.value,cwd:yn.value,"live-overlay":zy.value,"live-turn-id":m(Y),"pending-requests":m(he),"has-more-persisted-above":m(ut),"is-loading-persisted-above":m(ue),"load-earlier-messages":m(He),onForkThread:nb,onRollback:Fb,onFileChangesChanged:aw,onRespondServerRequest:gp},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"])]),w("div",{class:"composer-with-queue",ref_key:"composerQueueRef",ref:Eo},[Zf.value?(_(),F("div",LO,D(m(f)("This thread is running in the Codex TUI")),1)):ve("",!0),m(Fe)?(_(),F("div",NO,[w("span",null,D(m(f)(m(Fe))),1),w("a",{class:"visible-error-feedback",href:m(Bn),onClick:p[26]||(p[26]=T=>xt(T,m(Fe)))},D(m(f)("Send feedback")),9,$O)])):ve("",!0),Oe(m(v),{messages:m(zt),onEdit:ib,onSteer:m(pa),onDelete:m(Ha),onReorder:Ob},null,8,["messages","onSteer","onDelete"]),wl.value?(_(),F("div",OO,[w("span",null,D(wl.value),1),w("button",{type:"button",class:"interrupt-recovered-dismiss","aria-label":m(f)("Dismiss"),onClick:p[27]||(p[27]=T=>wl.value="")}," × ",8,DO)])):ve("",!0),au.value?(_(),Qe(m(c),{key:3,request:au.value,"request-count":m(he).length,"has-queue-above":m(zt).length>0,"panel-width":Mo.value,"visual-viewport-height":pl.value?Ws.value:0,"panel-error":Hy.value,onRespondServerRequest:gp},null,8,["request","request-count","has-queue-above","panel-width","visual-viewport-height","panel-error"])):(_(),Qe(jm,{key:4,ref_key:"threadComposerRef",ref:vo,"active-thread-id":Ks.value,cwd:yn.value,"fuzzy-file-search-results":m(st),onRegisterFuzzySession:m(mt),"collaboration-modes":m(xe),"selected-collaboration-mode":m(de),models:m($e),"model-reasoning-efforts":m(te),"selected-model":Qf.value,"selected-reasoning-effort":m(Le),"selected-speed-mode":m(Ae),"is-updating-speed-mode":m(M),skills:m(Ke),"thread-token-usage":m(W),"codex-quota":m(pe),"is-turn-in-progress":jc.value,"is-stop-pending":m(A),"is-interrupting-turn":m(Be),"is-compacting":Gy.value,"external-session-active":Zf.value,"has-queue-above":m(zt).length>0,"send-with-enter":os.value,"in-progress-submit-mode":ta.value,"dictation-click-to-toggle":rs.value,"dictation-auto-send":Yo.value,"dictation-language":xr.value,"onUpdate:selectedCollaborationMode":Np,onSubmit:Cp,"onUpdate:selectedModel":Ep,"onUpdate:selectedReasoningEffort":Mp,"onUpdate:selectedSpeedMode":jp,"approval-policy":Jr.value,"is-approval-policy-saving":ba.value,"approval-policy-error":Rn.value,"approval-policy-notice":To.value,"onUpdate:approvalPolicy":Os,onSaveApprovalPolicy:Gn,"plan-panel":Mc.value,onInterrupt:Db,onSlashCommand:Lp,onImplementPlan:Bb,onCompactContext:Ky},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),m(kt)&&m(sn)?(_(),F("div",{key:0,class:"content-right-panel-backdrop",role:"presentation",onClick:p[28]||(p[28]=(...T)=>m(yo)&&m(yo)(...T))})):ve("",!0),su.value&&(m(kt)||!m(to))?(_(),F("aside",{key:1,class:at(["content-right-panel",{"is-mobile-open":m(sn)}]),style:er({"--right-panel-width":`${m(nn)}px`})},[m(kt)?ve("",!0):(_(),F("div",{key:0,class:"content-right-panel-resize-handle","aria-hidden":"true",onMousedown:p[29]||(p[29]=(...T)=>m(qo)&&m(qo)(...T))},null,32)),w("div",FO,[w("div",BO,[w("button",{class:at(["content-right-panel-tab",{"is-active":m(tn)==="git"}]),type:"button",role:"tab","aria-selected":m(tn)==="git",onClick:p[30]||(p[30]=T=>m(Ht)("git"))},[Oe(Ju,{class:"content-right-panel-tab-icon"}),ws(" "+D(m(f)("Git")),1)],10,UO),w("button",{class:at(["content-right-panel-tab",{"is-active":m(tn)==="files"}]),type:"button",role:"tab","aria-selected":m(tn)==="files",onClick:p[31]||(p[31]=T=>m(Ht)("files"))},[Oe($m,{class:"content-right-panel-tab-icon"}),ws(" "+D(m(f)("Files")),1)],10,zO),(_(!0),F(ot,null,Zt(m(Wr),T=>(_(),F("button",{key:T.key,class:at(["content-right-panel-tab content-right-panel-tab--preview",{"is-active":m(tn)==="preview"&&m(go)===T.key}]),type:"button",role:"tab","aria-selected":m(tn)==="preview"&&m(go)===T.key,title:T.path,onClick:O=>m(Gr)(T.key)},[Oe(el,{class:"content-right-panel-tab-icon"}),w("span",qO,D(T.label),1),w("span",{class:"content-right-panel-tab-close",role:"button","aria-label":m(f)("Close"),title:m(f)("Close"),onClick:gt(O=>m(Wo)(T.key),["stop"])},"×",8,WO)],10,HO))),128))]),w("div",GO,[w("div",VO,[w("button",{ref:"rightPanelAddButtonRef",class:"content-right-panel-add",type:"button","aria-label":m(f)("Add panel"),title:m(f)("Add panel"),onClick:p[32]||(p[32]=gt(T=>zn.value=!m(zn),["stop"]))},"+",8,KO),Oe(Xl,{name:"right-panel-menu"},{default:dt(()=>[m(zn)?(_(),F("div",YO,[w("button",{type:"button",onClick:p[33]||(p[33]=T=>m(Ht)("terminal"))},[Oe(G1,{class:"content-right-panel-menu-icon"}),ws(" "+D(m(f)("Terminal panel")),1)]),w("button",{type:"button",onClick:p[34]||(p[34]=T=>m(Ht)("git"))},[Oe(Ju,{class:"content-right-panel-menu-icon"}),ws(" "+D(m(f)("Git panel")),1)]),w("button",{type:"button",onClick:p[35]||(p[35]=T=>m(Ht)("files"))},[Oe($m,{class:"content-right-panel-menu-icon"}),ws(" "+D(m(f)("Files panel")),1)])])):ve("",!0)]),_:1})]),w("button",{class:"content-right-panel-close",type:"button","aria-label":m(f)("Close panel"),title:m(f)("Close panel"),onClick:p[36]||(p[36]=(...T)=>m(yo)&&m(yo)(...T))},[Oe(of,{class:"content-right-panel-close-icon"})],8,JO)])]),w("div",QO,[m(tn)==="git"?(_(),Qe(m(i),{key:0,"current-branch":So.value,"head-sha":No.value,"head-subject":$o.value,"head-date":Zr.value,detached:x.value,dirty:R.value,"worktree-change-summary":k.value,"worktree-changes":G.value,branches:Za.value,"commits-by-branch":Ot.value,"commits-loading-for":ao.value,"commits-error":Co.value,"commit-files-by-sha":cn.value,"commit-files-loading-for":br.value,"commit-files-error":es.value,loading:ts.value,busy:Tr.value,error:We.value,"review-open":Hn.value,"show-review":m(vt).name==="thread"&&m(ne).length>0,onToggleReview:mb,onCheckoutBranch:db,onResetBranchToCommit:fb,onLoadCommits:Ip,onLoadCommitFiles:pb,onOpenCommitFile:hb},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"])):m(tn)==="files"?(_(),Qe(m(l),{key:1,cwd:yn.value,onOpenPreview:m(js)},null,8,["cwd","onOpenPreview"])):m(tn)==="preview"&&m(Lt)?(_(),Qe(m(d),{key:2,"file-path":m(Lt).path,name:m(Lt).label},null,8,["file-path","name"])):(_(),Qe(m(n),{key:3,ref_key:"threadTerminalPanelRef",ref:lr,"thread-id":Ks.value,cwd:yn.value,onHide:m(Ka),onTerminalFocusChange:m(no)},null,8,["thread-id","cwd","onHide","onTerminalFocusChange"]))])],6)):ve("",!0)])]),_:1},8,["is-sidebar-collapsed"]),C.value.phase!=="idle"?(_(),F("div",XO,[w("div",{class:"project-zip-modal",role:"dialog","aria-modal":"true","aria-label":m(f)("Export Project"),onClick:p[38]||(p[38]=gt(()=>{},["stop"]))},[w("div",eD,[w("h2",tD,D(m(f)("Export Project")),1),w("button",{class:"project-zip-modal-close",type:"button","aria-label":m(f)("Close"),disabled:C.value.phase==="exporting",onClick:mp}," × ",8,nD)]),w("p",oD,D(C.value.phase==="exporting"?m(f)("Preparing project ZIP..."):C.value.fileName),1),w("div",rD,[w("span",null,D(C.value.phase==="exporting"?m(f)("Exporting"):m(f)("Ready")),1),w("span",null,D(il.value),1)]),w("div",aD,[w("div",{class:"project-zip-progress-fill",style:er({width:Jo.value})},null,4)]),C.value.error?(_(),F("p",sD,D(C.value.error),1)):ve("",!0),w("div",iD,[w("button",{class:"project-zip-modal-cancel",type:"button",disabled:C.value.phase==="exporting",onClick:mp},D(m(f)("Close")),9,lD),w("button",{class:"project-zip-modal-action",type:"button",disabled:!C.value.blob,onClick:Ww},D(m(f)("Download")),9,uD),w("button",{class:"project-zip-modal-action project-zip-modal-action-primary",type:"button",disabled:!C.value.blob,onClick:Gw},D(m(f)("Share")),9,cD)])],8,ZO)])):ve("",!0),Si.value?(_(),F("div",{key:1,class:"codex-login-modal-backdrop",role:"presentation",onClick:zc},[w("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":m(f)("Complete Codex login"),onSubmit:gt(Pw,["prevent"]),onClick:p[41]||(p[41]=gt(()=>{},["stop"]))},[w("div",fD,[w("h2",pD,D(m(f)("Complete Codex login")),1),w("button",{class:"codex-login-modal-close",type:"button","aria-label":m(f)("Close"),disabled:En.value,onClick:zc}," × ",8,hD)]),w("p",mD,D(m(f)("Finish login in the browser, then paste the localhost callback URL here.")),1),ns.value?(_(),F("a",{key:0,class:"codex-login-modal-link",href:ns.value,target:"_blank",rel:"noreferrer"},D(m(f)("Open login URL")),9,vD)):ve("",!0),xn(w("input",{ref_key:"codexLoginCallbackInputRef",ref:tu,"onUpdate:modelValue":p[39]||(p[39]=T=>Ca.value=T),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:m(f)("Paste localhost callback URL"),disabled:En.value},null,8,gD),[[Nn,Ca.value]]),Qt.value?(_(),F("div",yD,[w("span",null,D(Qt.value),1),w("a",{class:"visible-error-feedback",href:m(Bn),onClick:p[40]||(p[40]=T=>xt(T,Qt.value))},D(m(f)("Send feedback")),9,wD)])):ve("",!0),w("div",bD,[w("button",{class:"codex-login-modal-cancel",type:"button",disabled:En.value,onClick:zc},D(m(f)("Cancel")),9,TD),w("button",{class:"codex-login-modal-submit",type:"submit",disabled:En.value||Ca.value.trim().length===0},D(En.value?m(f)("Completing…"):m(f)("Complete")),9,SD)])],40,dD)])):ve("",!0)],64))}}),kD=It(xD,[["__scopeId","data-v-72dcb7bb"]]),Pu={render:()=>null},ID=ax({history:O0(),routes:[{path:"/",name:"home",component:Pu},{path:"/thread/:threadId",name:"thread",component:Pu},{path:"/skills",name:"skills",component:Pu},{path:"/automations",name:"automations",component:Pu},{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");UA();KC(kD).use(ID).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(Xg("Service worker registration failed."),e)})});export{AD as $,Ju as A,_o as B,Cs as C,Su as D,hj as E,ot as F,_r as G,Df as H,of as I,Nt as J,_D as K,_f as L,FR as M,rA as N,pi as O,Jk as P,MD as Q,RD as R,jD as S,Ki as T,ED as U,LD as V,ci as W,sF as X,lF as Y,iF as Z,It as _,qN as a,Ao as a0,Wf as a1,xn as a2,Nn as a3,ix as a4,sx as a5,Bk as a6,zD as a7,ND as a8,$D as a9,UC as aA,rF as aB,aF as aC,OD as aa,VD as ab,XD as ac,ZD as ad,HD as ae,QD as af,FD as ag,DD as ah,BD as ai,UD as aj,eF as ak,nF as al,oF as am,qD as an,WD as ao,GD as ap,KD as aq,JD as ar,YD as as,tF as at,bx as au,Tx as av,bs as aw,QR as ax,PD as ay,el as az,HN as b,K as c,Om as d,hn as e,_ as f,Lf as g,Qe as h,F as i,w as j,ve as k,Zt as l,ws as m,at as n,_s as o,Oe as p,Xl as q,S as r,dt as s,D as t,m as u,da as v,gt as w,tt as x,er as y,ny as z};
|