codexui-android 0.1.108 → 0.1.110
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-DrI9_gvf.js +1 -0
- package/dist/assets/AutomationsPanel-Dy1km8EU.css +1 -0
- package/dist/assets/{DirectoryHub-BjsbwciN.css → DirectoryHub-BkBvhdUs.css} +1 -1
- package/dist/assets/DirectoryHub-e97BnXKM.js +2 -0
- package/dist/assets/ReviewPane-B5Ebl-29.css +1 -0
- package/dist/assets/ReviewPane-Q-Tx07Q7.js +1 -0
- package/dist/assets/{ThreadConversation-DKfW7vC7.js → ThreadConversation-C162xIoq.js} +18 -18
- package/dist/assets/{ThreadConversation-BwA4BCDu.css → ThreadConversation-wF1OnM7o.css} +1 -1
- package/dist/assets/{ThreadTerminalPanel-CrJKkAvB.js → ThreadTerminalPanel-C78jNJ5m.js} +1 -1
- package/dist/assets/index-BZZznPCP.css +1 -0
- package/dist/assets/index-xzqof2OU.js +63 -0
- package/dist/index.html +2 -2
- package/dist-cli/index.js +553 -93
- package/dist-cli/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/DirectoryHub-BeJqaP4D.js +0 -2
- package/dist/assets/ReviewPane-BAfo9D_N.css +0 -1
- package/dist/assets/ReviewPane-IP5BRZ-3.js +0 -1
- package/dist/assets/index-DfEYiJAK.js +0 -63
- package/dist/assets/index-KQ_3KeZN.css +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-C162xIoq.js","assets/ThreadConversation-wF1OnM7o.css","assets/ThreadTerminalPanel-C78jNJ5m.js","assets/ThreadTerminalPanel-nYqGBGVO.css","assets/ReviewPane-Q-Tx07Q7.js","assets/ReviewPane-B5Ebl-29.css","assets/DirectoryHub-e97BnXKM.js","assets/DirectoryHub-BkBvhdUs.css","assets/AutomationsPanel-DrI9_gvf.js","assets/AutomationsPanel-Dy1km8EU.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();/**
|
|
3
|
+
* @vue/shared v3.5.34
|
|
4
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
+
* @license MIT
|
|
6
|
+
**/function Fc(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const zt={},Ys=[],Yo=()=>{},Zh=()=>!1,Yl=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Jl=e=>e.startsWith("onUpdate:"),Rn=Object.assign,Uc=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Dg=Object.prototype.hasOwnProperty,Nt=(e,t)=>Dg.call(e,t),at=Array.isArray,Js=e=>Zi(e)==="[object Map]",ci=e=>Zi(e)==="[object Set]",Hd=e=>Zi(e)==="[object Date]",dt=e=>typeof e=="function",tn=e=>typeof e=="string",Ao=e=>typeof e=="symbol",Lt=e=>e!==null&&typeof e=="object",ep=e=>(Lt(e)||dt(e))&&dt(e.then)&&dt(e.catch),tp=Object.prototype.toString,Zi=e=>tp.call(e),Fg=e=>Zi(e).slice(8,-1),np=e=>Zi(e)==="[object Object]",Bc=e=>tn(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Li=Fc(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ql=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Ug=/-\w/g,vr=Ql(e=>e.replace(Ug,t=>t.slice(1).toUpperCase())),Bg=/\B([A-Z])/g,ts=Ql(e=>e.replace(Bg,"-$1").toLowerCase()),Xl=Ql(e=>e.charAt(0).toUpperCase()+e.slice(1)),Mu=Ql(e=>e?`on${Xl(e)}`:""),To=(e,t)=>!Object.is(e,t),$l=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},rp=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Zl=e=>{const t=parseFloat(e);return isNaN(t)?e:t},qg=e=>{const t=tn(e)?Number(e):NaN;return isNaN(t)?e:t};let Wd;const eu=()=>Wd||(Wd=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function ya(e){if(at(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=tn(r)?zg(r):ya(r);if(o)for(const a in o)t[a]=o[a]}return t}else if(tn(e)||Lt(e))return e}const Hg=/;(?![^(]*\))/g,Wg=/:([^]+)/,Vg=/\/\*[^]*?\*\//g;function zg(e){const t={};return e.replace(Vg,"").split(Hg).forEach(n=>{if(n){const r=n.split(Wg);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function Qe(e){let t="";if(tn(e))t=e;else if(at(e))for(let n=0;n<e.length;n++){const r=Qe(e[n]);r&&(t+=r+" ")}else if(Lt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const Gg="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Kg=Fc(Gg);function op(e){return!!e||e===""}function Yg(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=di(e[r],t[r]);return n}function di(e,t){if(e===t)return!0;let n=Hd(e),r=Hd(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=Ao(e),r=Ao(t),n||r)return e===t;if(n=at(e),r=at(t),n||r)return n&&r?Yg(e,t):!1;if(n=Lt(e),r=Lt(t),n||r){if(!n||!r)return!1;const o=Object.keys(e).length,a=Object.keys(t).length;if(o!==a)return!1;for(const s in e){const u=e.hasOwnProperty(s),c=t.hasOwnProperty(s);if(u&&!c||!u&&c||!di(e[s],t[s]))return!1}}return String(e)===String(t)}function qc(e,t){return e.findIndex(n=>di(n,t))}const ap=e=>!!(e&&e.__v_isRef===!0),I=e=>tn(e)?e:e==null?"":at(e)||Lt(e)&&(e.toString===tp||!dt(e.toString))?ap(e)?I(e.value):JSON.stringify(e,sp,2):String(e),sp=(e,t)=>ap(t)?sp(e,t.value):Js(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],a)=>(n[$u(r,a)+" =>"]=o,n),{})}:ci(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>$u(n))}:Ao(t)?$u(t):Lt(t)&&!at(t)&&!np(t)?String(t):t,$u=(e,t="")=>{var n;return Ao(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
|
|
7
|
+
* @vue/reactivity v3.5.34
|
|
8
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
9
|
+
* @license MIT
|
|
10
|
+
**/let Gn;class Jg{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&&Gn&&(Gn.active?(this.parent=Gn,this.index=(Gn.scopes||(Gn.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)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[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)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].resume();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].resume()}}run(t){if(this._active){const n=Gn;try{return Gn=this,t()}finally{Gn=n}}}on(){++this._on===1&&(this.prevScope=Gn,Gn=this)}off(){if(this._on>0&&--this._on===0){if(Gn===this)Gn=this.prevScope;else{let t=Gn;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const o=this.parent.scopes.pop();o&&o!==this&&(this.parent.scopes[this.index]=o,o.index=this.index)}this.parent=void 0}}}function Qg(){return Gn}let Kt;const ju=new WeakSet;class ip{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,Gn&&(Gn.active?Gn.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ju.has(this)&&(ju.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||up(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Vd(this),cp(this);const t=Kt,n=So;Kt=this,So=!0;try{return this.fn()}finally{dp(this),Kt=t,So=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Vc(t);this.deps=this.depsTail=void 0,Vd(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ju.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){uc(this)&&this.run()}get dirty(){return uc(this)}}let lp=0,Oi,Di;function up(e,t=!1){if(e.flags|=8,t){e.next=Di,Di=e;return}e.next=Oi,Oi=e}function Hc(){lp++}function Wc(){if(--lp>0)return;if(Di){let t=Di;for(Di=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Oi;){let t=Oi;for(Oi=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function cp(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function dp(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),Vc(r),Xg(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function uc(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(fp(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function fp(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Vi)||(e.globalVersion=Vi,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!uc(e))))return;e.flags|=2;const t=e.dep,n=Kt,r=So;Kt=e,So=!0;try{cp(e);const o=e.fn(e._value);(t.version===0||To(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{Kt=n,So=r,dp(e),e.flags&=-3}}function Vc(e,t=!1){const{dep:n,prevSub:r,nextSub:o}=e;if(r&&(r.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let a=n.computed.deps;a;a=a.nextDep)Vc(a,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Xg(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let So=!0;const hp=[];function ba(){hp.push(So),So=!1}function _a(){const e=hp.pop();So=e===void 0?!0:e}function Vd(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Kt;Kt=void 0;try{t()}finally{Kt=n}}}let Vi=0;class Zg{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 zc{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!Kt||!So||Kt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Kt)n=this.activeLink=new Zg(Kt,this),Kt.deps?(n.prevDep=Kt.depsTail,Kt.depsTail.nextDep=n,Kt.depsTail=n):Kt.deps=Kt.depsTail=n,pp(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=Kt.depsTail,n.nextDep=void 0,Kt.depsTail.nextDep=n,Kt.depsTail=n,Kt.deps===n&&(Kt.deps=r)}return n}trigger(t){this.version++,Vi++,this.notify(t)}notify(t){Hc();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Wc()}}}function pp(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)pp(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const cc=new WeakMap,Cs=Symbol(""),dc=Symbol(""),zi=Symbol("");function or(e,t,n){if(So&&Kt){let r=cc.get(e);r||cc.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new zc),o.map=r,o.key=n),o.track()}}function va(e,t,n,r,o,a){const s=cc.get(e);if(!s){Vi++;return}const u=c=>{c&&c.trigger()};if(Hc(),t==="clear")s.forEach(u);else{const c=at(e),m=c&&Bc(n);if(c&&n==="length"){const f=Number(r);s.forEach((w,_)=>{(_==="length"||_===zi||!Ao(_)&&_>=f)&&u(w)})}else switch((n!==void 0||s.has(void 0))&&u(s.get(n)),m&&u(s.get(zi)),t){case"add":c?m&&u(s.get("length")):(u(s.get(Cs)),Js(e)&&u(s.get(dc)));break;case"delete":c||(u(s.get(Cs)),Js(e)&&u(s.get(dc)));break;case"set":Js(e)&&u(s.get(Cs));break}}Wc()}function Ls(e){const t=Et(e);return t===e?t:(or(t,"iterate",zi),to(e)?t:t.map(Eo))}function tu(e){return or(e=Et(e),"iterate",zi),e}function zo(e,t){return Ta(e)?ni(Ss(e)?Eo(t):t):Eo(t)}const ey={__proto__:null,[Symbol.iterator](){return Nu(this,Symbol.iterator,e=>zo(this,e))},concat(...e){return Ls(this).concat(...e.map(t=>at(t)?Ls(t):t))},entries(){return Nu(this,"entries",e=>(e[1]=zo(this,e[1]),e))},every(e,t){return da(this,"every",e,t,void 0,arguments)},filter(e,t){return da(this,"filter",e,t,n=>n.map(r=>zo(this,r)),arguments)},find(e,t){return da(this,"find",e,t,n=>zo(this,n),arguments)},findIndex(e,t){return da(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return da(this,"findLast",e,t,n=>zo(this,n),arguments)},findLastIndex(e,t){return da(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return da(this,"forEach",e,t,void 0,arguments)},includes(...e){return Lu(this,"includes",e)},indexOf(...e){return Lu(this,"indexOf",e)},join(e){return Ls(this).join(e)},lastIndexOf(...e){return Lu(this,"lastIndexOf",e)},map(e,t){return da(this,"map",e,t,void 0,arguments)},pop(){return Ci(this,"pop")},push(...e){return Ci(this,"push",e)},reduce(e,...t){return zd(this,"reduce",e,t)},reduceRight(e,...t){return zd(this,"reduceRight",e,t)},shift(){return Ci(this,"shift")},some(e,t){return da(this,"some",e,t,void 0,arguments)},splice(...e){return Ci(this,"splice",e)},toReversed(){return Ls(this).toReversed()},toSorted(e){return Ls(this).toSorted(e)},toSpliced(...e){return Ls(this).toSpliced(...e)},unshift(...e){return Ci(this,"unshift",e)},values(){return Nu(this,"values",e=>zo(this,e))}};function Nu(e,t,n){const r=tu(e),o=r[t]();return r!==e&&!to(e)&&(o._next=o.next,o.next=()=>{const a=o._next();return a.done||(a.value=n(a.value)),a}),o}const ty=Array.prototype;function da(e,t,n,r,o,a){const s=tu(e),u=s!==e&&!to(e),c=s[t];if(c!==ty[t]){const w=c.apply(e,a);return u?Eo(w):w}let m=n;s!==e&&(u?m=function(w,_){return n.call(this,zo(e,w),_,e)}:n.length>2&&(m=function(w,_){return n.call(this,w,_,e)}));const f=c.call(s,m,r);return u&&o?o(f):f}function zd(e,t,n,r){const o=tu(e),a=o!==e&&!to(e);let s=n,u=!1;o!==e&&(a?(u=r.length===0,s=function(m,f,w){return u&&(u=!1,m=zo(e,m)),n.call(this,m,zo(e,f),w,e)}):n.length>3&&(s=function(m,f,w){return n.call(this,m,f,w,e)}));const c=o[t](s,...r);return u?zo(e,c):c}function Lu(e,t,n){const r=Et(e);or(r,"iterate",zi);const o=r[t](...n);return(o===-1||o===!1)&&Yc(n[0])?(n[0]=Et(n[0]),r[t](...n)):o}function Ci(e,t,n=[]){ba(),Hc();const r=Et(e)[t].apply(e,n);return Wc(),_a(),r}const ny=Fc("__proto__,__v_isRef,__isVue"),mp=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Ao));function ry(e){Ao(e)||(e=String(e));const t=Et(this);return or(t,"has",e),t.hasOwnProperty(e)}class vp{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const o=this._isReadonly,a=this._isShallow;if(n==="__v_isReactive")return!o;if(n==="__v_isReadonly")return o;if(n==="__v_isShallow")return a;if(n==="__v_raw")return r===(o?a?hy:bp:a?wp:yp).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const s=at(t);if(!o){let c;if(s&&(c=ey[n]))return c;if(n==="hasOwnProperty")return ry}const u=Reflect.get(t,n,sr(t)?t:r);if((Ao(n)?mp.has(n):ny(n))||(o||or(t,"get",n),a))return u;if(sr(u)){const c=s&&Bc(n)?u:u.value;return o&&Lt(c)?hc(c):c}return Lt(u)?o?hc(u):nu(u):u}}class gp extends vp{constructor(t=!1){super(!1,t)}set(t,n,r,o){let a=t[n];const s=at(t)&&Bc(n);if(!this._isShallow){const m=Ta(a);if(!to(r)&&!Ta(r)&&(a=Et(a),r=Et(r)),!s&&sr(a)&&!sr(r))return m||(a.value=r),!0}const u=s?Number(n)<t.length:Nt(t,n),c=Reflect.set(t,n,r,sr(t)?t:o);return t===Et(o)&&(u?To(r,a)&&va(t,"set",n,r):va(t,"add",n,r)),c}deleteProperty(t,n){const r=Nt(t,n);t[n];const o=Reflect.deleteProperty(t,n);return o&&r&&va(t,"delete",n,void 0),o}has(t,n){const r=Reflect.has(t,n);return(!Ao(n)||!mp.has(n))&&or(t,"has",n),r}ownKeys(t){return or(t,"iterate",at(t)?"length":Cs),Reflect.ownKeys(t)}}class oy extends vp{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const ay=new gp,sy=new oy,iy=new gp(!0);const fc=e=>e,wl=e=>Reflect.getPrototypeOf(e);function ly(e,t,n){return function(...r){const o=this.__v_raw,a=Et(o),s=Js(a),u=e==="entries"||e===Symbol.iterator&&s,c=e==="keys"&&s,m=o[e](...r),f=n?fc:t?ni:Eo;return!t&&or(a,"iterate",c?dc:Cs),Rn(Object.create(m),{next(){const{value:w,done:_}=m.next();return _?{value:w,done:_}:{value:u?[f(w[0]),f(w[1])]:f(w),done:_}}})}}function bl(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function uy(e,t){const n={get(o){const a=this.__v_raw,s=Et(a),u=Et(o);e||(To(o,u)&&or(s,"get",o),or(s,"get",u));const{has:c}=wl(s),m=t?fc:e?ni:Eo;if(c.call(s,o))return m(a.get(o));if(c.call(s,u))return m(a.get(u));a!==s&&a.get(o)},get size(){const o=this.__v_raw;return!e&&or(Et(o),"iterate",Cs),o.size},has(o){const a=this.__v_raw,s=Et(a),u=Et(o);return e||(To(o,u)&&or(s,"has",o),or(s,"has",u)),o===u?a.has(o):a.has(o)||a.has(u)},forEach(o,a){const s=this,u=s.__v_raw,c=Et(u),m=t?fc:e?ni:Eo;return!e&&or(c,"iterate",Cs),u.forEach((f,w)=>o.call(a,m(f),m(w),s))}};return Rn(n,e?{add:bl("add"),set:bl("set"),delete:bl("delete"),clear:bl("clear")}:{add(o){const a=Et(this),s=wl(a),u=Et(o),c=!t&&!to(o)&&!Ta(o)?u:o;return s.has.call(a,c)||To(o,c)&&s.has.call(a,o)||To(u,c)&&s.has.call(a,u)||(a.add(c),va(a,"add",c,c)),this},set(o,a){!t&&!to(a)&&!Ta(a)&&(a=Et(a));const s=Et(this),{has:u,get:c}=wl(s);let m=u.call(s,o);m||(o=Et(o),m=u.call(s,o));const f=c.call(s,o);return s.set(o,a),m?To(a,f)&&va(s,"set",o,a):va(s,"add",o,a),this},delete(o){const a=Et(this),{has:s,get:u}=wl(a);let c=s.call(a,o);c||(o=Et(o),c=s.call(a,o)),u&&u.call(a,o);const m=a.delete(o);return c&&va(a,"delete",o,void 0),m},clear(){const o=Et(this),a=o.size!==0,s=o.clear();return a&&va(o,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(o=>{n[o]=ly(o,e,t)}),n}function Gc(e,t){const n=uy(e,t);return(r,o,a)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(Nt(n,o)&&o in r?n:r,o,a)}const cy={get:Gc(!1,!1)},dy={get:Gc(!1,!0)},fy={get:Gc(!0,!1)};const yp=new WeakMap,wp=new WeakMap,bp=new WeakMap,hy=new WeakMap;function py(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function my(e){return e.__v_skip||!Object.isExtensible(e)?0:py(Fg(e))}function nu(e){return Ta(e)?e:Kc(e,!1,ay,cy,yp)}function _p(e){return Kc(e,!1,iy,dy,wp)}function hc(e){return Kc(e,!0,sy,fy,bp)}function Kc(e,t,n,r,o){if(!Lt(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const a=my(e);if(a===0)return e;const s=o.get(e);if(s)return s;const u=new Proxy(e,a===2?r:n);return o.set(e,u),u}function Ss(e){return Ta(e)?Ss(e.__v_raw):!!(e&&e.__v_isReactive)}function Ta(e){return!!(e&&e.__v_isReadonly)}function to(e){return!!(e&&e.__v_isShallow)}function Yc(e){return e?!!e.__v_raw:!1}function Et(e){const t=e&&e.__v_raw;return t?Et(t):e}function vy(e){return!Nt(e,"__v_skip")&&Object.isExtensible(e)&&rp(e,"__v_skip",!0),e}const Eo=e=>Lt(e)?nu(e):e,ni=e=>Lt(e)?hc(e):e;function sr(e){return e?e.__v_isRef===!0:!1}function x(e){return Tp(e,!1)}function gy(e){return Tp(e,!0)}function Tp(e,t){return sr(e)?e:new yy(e,t)}class yy{constructor(t,n){this.dep=new zc,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Et(t),this._value=n?t:Eo(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||to(t)||Ta(t);t=r?t:Et(t),To(t,n)&&(this._rawValue=t,this._value=r?t:Eo(t),this.dep.trigger())}}function S(e){return sr(e)?e.value:e}const wy={get:(e,t,n)=>t==="__v_raw"?e:S(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return sr(o)&&!sr(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}};function kp(e){return Ss(e)?e:new Proxy(e,wy)}class by{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new zc(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Vi-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Kt!==this)return up(this,!0),!0}get value(){const t=this.dep.track();return fp(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function _y(e,t,n=!1){let r,o;return dt(e)?r=e:(r=e.get,o=e.set),new by(r,o,n)}const _l={},Dl=new WeakMap;let ws;function Ty(e,t=!1,n=ws){if(n){let r=Dl.get(n);r||Dl.set(n,r=[]),r.push(e)}}function ky(e,t,n=zt){const{immediate:r,deep:o,once:a,scheduler:s,augmentJob:u,call:c}=n,m=Y=>o?Y:to(Y)||o===!1||o===0?ga(Y,1):ga(Y);let f,w,_,P,q=!1,O=!1;if(sr(e)?(w=()=>e.value,q=to(e)):Ss(e)?(w=()=>m(e),q=!0):at(e)?(O=!0,q=e.some(Y=>Ss(Y)||to(Y)),w=()=>e.map(Y=>{if(sr(Y))return Y.value;if(Ss(Y))return m(Y);if(dt(Y))return c?c(Y,2):Y()})):dt(e)?t?w=c?()=>c(e,2):e:w=()=>{if(_){ba();try{_()}finally{_a()}}const Y=ws;ws=f;try{return c?c(e,3,[P]):e(P)}finally{ws=Y}}:w=Yo,t&&o){const Y=w,Te=o===!0?1/0:o;w=()=>ga(Y(),Te)}const te=Qg(),F=()=>{f.stop(),te&&te.active&&Uc(te.effects,f)};if(a&&t){const Y=t;t=(...Te)=>{Y(...Te),F()}}let U=O?new Array(e.length).fill(_l):_l;const G=Y=>{if(!(!(f.flags&1)||!f.dirty&&!Y))if(t){const Te=f.run();if(o||q||(O?Te.some((Me,ae)=>To(Me,U[ae])):To(Te,U))){_&&_();const Me=ws;ws=f;try{const ae=[Te,U===_l?void 0:O&&U[0]===_l?[]:U,P];U=Te,c?c(t,3,ae):t(...ae)}finally{ws=Me}}}else f.run()};return u&&u(G),f=new ip(w),f.scheduler=s?()=>s(G,!1):G,P=Y=>Ty(Y,!1,f),_=f.onStop=()=>{const Y=Dl.get(f);if(Y){if(c)c(Y,4);else for(const Te of Y)Te();Dl.delete(f)}},t?r?G(!0):U=f.run():s?s(G.bind(null,!0),!0):f.run(),F.pause=f.pause.bind(f),F.resume=f.resume.bind(f),F.stop=F,F}function ga(e,t=1/0,n){if(t<=0||!Lt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,sr(e))ga(e.value,t,n);else if(at(e))for(let r=0;r<e.length;r++)ga(e[r],t,n);else if(ci(e)||Js(e))e.forEach(r=>{ga(r,t,n)});else if(np(e)){for(const r in e)ga(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&ga(e[r],t,n)}return e}/**
|
|
11
|
+
* @vue/runtime-core v3.5.34
|
|
12
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
13
|
+
* @license MIT
|
|
14
|
+
**/function el(e,t,n,r){try{return r?e(...r):e()}catch(o){tl(o,t,n)}}function Io(e,t,n,r){if(dt(e)){const o=el(e,t,n,r);return o&&ep(o)&&o.catch(a=>{tl(a,t,n)}),o}if(at(e)){const o=[];for(let a=0;a<e.length;a++)o.push(Io(e[a],t,n,r));return o}}function tl(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||zt;if(t){let u=t.parent;const c=t.proxy,m=`https://vuejs.org/error-reference/#runtime-${n}`;for(;u;){const f=u.ec;if(f){for(let w=0;w<f.length;w++)if(f[w](e,c,m)===!1)return}u=u.parent}if(a){ba(),el(a,null,10,[e,c,m]),_a();return}}Cy(e,n,o,r,s)}function Cy(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}const pr=[];let Wo=-1;const Qs=[];let Ka=null,Bs=0;const Cp=Promise.resolve();let Fl=null;function Ht(e){const t=Fl||Cp;return e?t.then(this?e.bind(this):e):t}function Sy(e){let t=Wo+1,n=pr.length;for(;t<n;){const r=t+n>>>1,o=pr[r],a=Gi(o);a<e||a===e&&o.flags&2?t=r+1:n=r}return t}function Jc(e){if(!(e.flags&1)){const t=Gi(e),n=pr[pr.length-1];!n||!(e.flags&2)&&t>=Gi(n)?pr.push(e):pr.splice(Sy(t),0,e),e.flags|=1,Sp()}}function Sp(){Fl||(Fl=Cp.then(Ap))}function xy(e){at(e)?Qs.push(...e):Ka&&e.id===-1?Ka.splice(Bs+1,0,e):e.flags&1||(Qs.push(e),e.flags|=1),Sp()}function Gd(e,t,n=Wo+1){for(;n<pr.length;n++){const r=pr[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;pr.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function xp(e){if(Qs.length){const t=[...new Set(Qs)].sort((n,r)=>Gi(n)-Gi(r));if(Qs.length=0,Ka){Ka.push(...t);return}for(Ka=t,Bs=0;Bs<Ka.length;Bs++){const n=Ka[Bs];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Ka=null,Bs=0}}const Gi=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Ap(e){try{for(Wo=0;Wo<pr.length;Wo++){const t=pr[Wo];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),el(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Wo<pr.length;Wo++){const t=pr[Wo];t&&(t.flags&=-2)}Wo=-1,pr.length=0,xp(),Fl=null,(pr.length||Qs.length)&&Ap()}}let Yn=null,Ep=null;function Ul(e){const t=Yn;return Yn=e,Ep=e&&e.type.__scopeId||null,t}function mt(e,t=Yn,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&Hl(-1);const a=Ul(t);let s;try{s=e(...o)}finally{Ul(a),r._d&&Hl(1)}return s};return r._n=!0,r._c=!0,r._d=!0,r}function jt(e,t){if(Yn===null)return e;const n=iu(Yn),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[a,s,u,c=zt]=t[o];a&&(dt(a)&&(a={mounted:a,updated:a}),a.deep&&ga(s),r.push({dir:a,instance:n,value:s,oldValue:void 0,arg:u,modifiers:c}))}return e}function ms(e,t,n,r){const o=e.dirs,a=t&&t.dirs;for(let s=0;s<o.length;s++){const u=o[s];a&&(u.oldValue=a[s].value);let c=u.dir[r];c&&(ba(),Io(c,n,8,[e.el,u,e,t]),_a())}}function jl(e,t){if(Kn){let n=Kn.provides;const r=Kn.parent&&Kn.parent.provides;r===n&&(n=Kn.provides=Object.create(r)),n[e]=t}}function xo(e,t,n=!1){const r=rd();if(r||Zs){let o=Zs?Zs._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&dt(t)?t.call(r&&r.proxy):t}}const Ay=Symbol.for("v-scx"),Ey=()=>xo(Ay);function ht(e,t,n){return Ip(e,t,n)}function Ip(e,t,n=zt){const{immediate:r,deep:o,flush:a,once:s}=n,u=Rn({},n),c=t&&r||!t&&a!=="post";let m;if(oi){if(a==="sync"){const P=Ey();m=P.__watcherHandles||(P.__watcherHandles=[])}else if(!c){const P=()=>{};return P.stop=Yo,P.resume=Yo,P.pause=Yo,P}}const f=Kn;u.call=(P,q,O)=>Io(P,f,q,O);let w=!1;a==="post"?u.scheduler=P=>{fr(P,f&&f.suspense)}:a!=="sync"&&(w=!0,u.scheduler=(P,q)=>{q?P():Jc(P)}),u.augmentJob=P=>{t&&(P.flags|=4),w&&(P.flags|=2,f&&(P.id=f.uid,P.i=f))};const _=ky(e,t,u);return oi&&(m?m.push(_):c&&_()),_}function Iy(e,t,n){const r=this.proxy,o=tn(e)?e.includes(".")?Pp(r,e):()=>r[e]:e.bind(r,r);let a;dt(t)?a=t:(a=t.handler,n=t);const s=rl(this),u=Ip(o,a.bind(r),n);return s(),u}function Pp(e,t){const n=t.split(".");return()=>{let r=e;for(let o=0;o<n.length&&r;o++)r=r[n[o]];return r}}const Ga=new WeakMap,Rp=Symbol("_vte"),Mp=e=>e.__isTeleport,bs=e=>e&&(e.disabled||e.disabled===""),Py=e=>e&&(e.defer||e.defer===""),Kd=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Yd=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,pc=(e,t)=>{const n=e&&e.to;return tn(n)?t?t(n):null:n},Ry={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,a,s,u,c,m){const{mc:f,pc:w,pbc:_,o:{insert:P,querySelector:q,createText:O,createComment:te,parentNode:F}}=m,U=bs(t.props);let{dynamicChildren:G}=t;const Y=(ae,Se,K)=>{ae.shapeFlag&16&&f(ae.children,Se,K,o,a,s,u,c)},Te=(ae=t)=>{const Se=bs(ae.props),K=ae.target=pc(ae.props,q),be=mc(K,ae,O,P);K&&(s!=="svg"&&Kd(K)?s="svg":s!=="mathml"&&Yd(K)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(K),Se||(Y(ae,K,be),Ri(ae,!1)))},Me=ae=>{const Se=()=>{if(Ga.get(ae)===Se){if(Ga.delete(ae),bs(ae.props)){const K=F(ae.el)||n;Y(ae,K,ae.anchor),Ri(ae,!0)}Te(ae)}};Ga.set(ae,Se),fr(Se,a)};if(e==null){const ae=t.el=O(""),Se=t.anchor=O("");if(P(ae,n,r),P(Se,n,r),Py(t.props)||a&&a.pendingBranch){Me(t);return}U&&(Y(t,n,Se),Ri(t,!0)),Te()}else{t.el=e.el;const ae=t.anchor=e.anchor,Se=Ga.get(e);if(Se){Se.flags|=8,Ga.delete(e),Me(t);return}t.targetStart=e.targetStart;const K=t.target=e.target,be=t.targetAnchor=e.targetAnchor,Ce=bs(e.props),ne=Ce?n:K,Ae=Ce?ae:be;if(s==="svg"||Kd(K)?s="svg":(s==="mathml"||Yd(K))&&(s="mathml"),G?(_(e.dynamicChildren,G,ne,o,a,s,u),td(e,t,!0)):c||w(e,t,ne,Ae,o,a,s,u,!1),U)Ce?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Tl(t,n,ae,m,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const We=t.target=pc(t.props,q);We&&Tl(t,We,null,m,0)}else Ce&&Tl(t,K,be,m,1);Ri(t,U)}},remove(e,t,n,{um:r,o:{remove:o}},a){const{shapeFlag:s,children:u,anchor:c,targetStart:m,targetAnchor:f,target:w,props:_}=e;let P=a||!bs(_);const q=Ga.get(e);if(q&&(q.flags|=8,Ga.delete(e),P=!1),w&&(o(m),o(f)),a&&o(c),s&16)for(let O=0;O<u.length;O++){const te=u[O];r(te,t,n,P,!!te.dynamicChildren)}},move:Tl,hydrate:My};function Tl(e,t,n,{o:{insert:r},m:o},a=2){a===0&&r(e.targetAnchor,t,n);const{el:s,anchor:u,shapeFlag:c,children:m,props:f}=e,w=a===2;if(w&&r(s,t,n),!Ga.has(e)&&(!w||bs(f))&&c&16)for(let _=0;_<m.length;_++)o(m[_],t,n,2);w&&r(u,t,n)}function My(e,t,n,r,o,a,{o:{nextSibling:s,parentNode:u,querySelector:c,insert:m,createText:f}},w){function _(te,F){let U=F;for(;U;){if(U&&U.nodeType===8){if(U.data==="teleport start anchor")t.targetStart=U;else if(U.data==="teleport anchor"){t.targetAnchor=U,te._lpa=t.targetAnchor&&s(t.targetAnchor);break}}U=s(U)}}function P(te,F){F.anchor=w(s(te),F,u(te),n,r,o,a)}const q=t.target=pc(t.props,c),O=bs(t.props);if(q){const te=q._lpa||q.firstChild;t.shapeFlag&16&&(O?(P(e,t),_(q,te),t.targetAnchor||mc(q,t,f,m,u(e)===q?e:null)):(t.anchor=s(e),_(q,te),t.targetAnchor||mc(q,t,f,m),w(te&&s(te),t,q,n,r,o,a))),Ri(t,O)}else O&&t.shapeFlag&16&&(P(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}const Xa=Ry;function Ri(e,t){const n=e.ctx;if(n&&n.ut){let r,o;for(t?(r=e.el,o=e.anchor):(r=e.targetStart,o=e.targetAnchor);r&&r!==o;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function mc(e,t,n,r,o=null){const a=t.targetStart=n(""),s=t.targetAnchor=n("");return a[Rp]=s,e&&(r(a,e,o),r(s,e,o)),s}const Vo=Symbol("_leaveCb"),Si=Symbol("_enterCb");function $y(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Ca(()=>{e.isMounted=!0}),ns(()=>{e.isUnmounting=!0}),e}const eo=[Function,Array],$p={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:eo,onEnter:eo,onAfterEnter:eo,onEnterCancelled:eo,onBeforeLeave:eo,onLeave:eo,onAfterLeave:eo,onLeaveCancelled:eo,onBeforeAppear:eo,onAppear:eo,onAfterAppear:eo,onAppearCancelled:eo},jp=e=>{const t=e.subTree;return t.component?jp(t.component):t},jy={name:"BaseTransition",props:$p,setup(e,{slots:t}){const n=rd(),r=$y();return()=>{const o=t.default&&Op(t.default(),!0),a=o&&o.length?Np(o):n.subTree?Q():void 0;if(!a)return;const s=Et(e),{mode:u}=s;if(r.isLeaving)return Ou(a);const c=Jd(a);if(!c)return Ou(a);let m=vc(c,s,r,n,w=>m=w);c.type!==ar&&Ki(c,m);let f=n.subTree&&Jd(n.subTree);if(f&&f.type!==ar&&!_s(f,c)&&jp(n).type!==ar){let w=vc(f,s,r,n);if(Ki(f,w),u==="out-in"&&c.type!==ar)return r.isLeaving=!0,w.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete w.afterLeave,f=void 0},Ou(a);u==="in-out"&&c.type!==ar?w.delayLeave=(_,P,q)=>{const O=Lp(r,f);O[String(f.key)]=f,_[Vo]=()=>{P(),_[Vo]=void 0,delete m.delayedLeave,f=void 0},m.delayedLeave=()=>{q(),delete m.delayedLeave,f=void 0}}:f=void 0}else f&&(f=void 0);return a}}};function Np(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==ar){t=n;break}}return t}const Ny=jy;function Lp(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function vc(e,t,n,r,o){const{appear:a,mode:s,persisted:u=!1,onBeforeEnter:c,onEnter:m,onAfterEnter:f,onEnterCancelled:w,onBeforeLeave:_,onLeave:P,onAfterLeave:q,onLeaveCancelled:O,onBeforeAppear:te,onAppear:F,onAfterAppear:U,onAppearCancelled:G}=t,Y=String(e.key),Te=Lp(n,e),Me=(K,be)=>{K&&Io(K,r,9,be)},ae=(K,be)=>{const Ce=be[1];Me(K,be),at(K)?K.every(ne=>ne.length<=1)&&Ce():K.length<=1&&Ce()},Se={mode:s,persisted:u,beforeEnter(K){let be=c;if(!n.isMounted)if(a)be=te||c;else return;K[Vo]&&K[Vo](!0);const Ce=Te[Y];Ce&&_s(e,Ce)&&Ce.el[Vo]&&Ce.el[Vo](),Me(be,[K])},enter(K){if(Te[Y]===e)return;let be=m,Ce=f,ne=w;if(!n.isMounted)if(a)be=F||m,Ce=U||f,ne=G||w;else return;let Ae=!1;K[Si]=qe=>{Ae||(Ae=!0,qe?Me(ne,[K]):Me(Ce,[K]),Se.delayedLeave&&Se.delayedLeave(),K[Si]=void 0)};const We=K[Si].bind(null,!1);be?ae(be,[K,We]):We()},leave(K,be){const Ce=String(e.key);if(K[Si]&&K[Si](!0),n.isUnmounting)return be();Me(_,[K]);let ne=!1;K[Vo]=We=>{ne||(ne=!0,be(),We?Me(O,[K]):Me(q,[K]),K[Vo]=void 0,Te[Ce]===e&&delete Te[Ce])};const Ae=K[Vo].bind(null,!1);Te[Ce]=e,P?ae(P,[K,Ae]):Ae()},clone(K){const be=vc(K,t,n,r,o);return o&&o(be),be}};return Se}function Ou(e){if(nl(e))return e=es(e),e.children=null,e}function Jd(e){if(!nl(e))return Mp(e.type)&&e.children?Np(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&&dt(n.default))return n.default()}}function Ki(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Ki(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 Op(e,t=!1,n){let r=[],o=0;for(let a=0;a<e.length;a++){let s=e[a];const u=n==null?s.key:String(n)+String(s.key!=null?s.key:a);s.type===Ke?(s.patchFlag&128&&o++,r=r.concat(Op(s.children,t,u))):(t||s.type!==ar)&&r.push(u!=null?es(s,{key:u}):s)}if(o>1)for(let a=0;a<r.length;a++)r[a].patchFlag=-2;return r}function Jn(e,t){return dt(e)?Rn({name:e.name},t,{setup:e}):e}function Qc(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Qd(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Bl=new WeakMap;function Fi(e,t,n,r,o=!1){if(at(e)){e.forEach((O,te)=>Fi(O,t&&(at(t)?t[te]:t),n,r,o));return}if(Xs(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Fi(e,t,n,r.component.subTree);return}const a=r.shapeFlag&4?iu(r.component):r.el,s=o?null:a,{i:u,r:c}=e,m=t&&t.r,f=u.refs===zt?u.refs={}:u.refs,w=u.setupState,_=Et(w),P=w===zt?Zh:O=>Qd(f,O)?!1:Nt(_,O),q=(O,te)=>!(te&&Qd(f,te));if(m!=null&&m!==c){if(Xd(t),tn(m))f[m]=null,P(m)&&(w[m]=null);else if(sr(m)){const O=t;q(m,O.k)&&(m.value=null),O.k&&(f[O.k]=null)}}if(dt(c))el(c,u,12,[s,f]);else{const O=tn(c),te=sr(c);if(O||te){const F=()=>{if(e.f){const U=O?P(c)?w[c]:f[c]:q()||!e.k?c.value:f[e.k];if(o)at(U)&&Uc(U,a);else if(at(U))U.includes(a)||U.push(a);else if(O)f[c]=[a],P(c)&&(w[c]=f[c]);else{const G=[a];q(c,e.k)&&(c.value=G),e.k&&(f[e.k]=G)}}else O?(f[c]=s,P(c)&&(w[c]=s)):te&&(q(c,e.k)&&(c.value=s),e.k&&(f[e.k]=s))};if(s){const U=()=>{F(),Bl.delete(e)};U.id=-1,Bl.set(e,U),fr(U,n)}else Xd(e),F()}}}function Xd(e){const t=Bl.get(e);t&&(t.flags|=8,Bl.delete(e))}const Zd=e=>e.nodeType===8;eu().requestIdleCallback;eu().cancelIdleCallback;function Ly(e,t){if(Zd(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(Zd(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}const Xs=e=>!!e.type.__asyncLoader;function xi(e){dt(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:o=200,hydrate:a,timeout:s,suspensible:u=!0,onError:c}=e;let m=null,f,w=0;const _=()=>(w++,m=null,P()),P=()=>{let q;return m||(q=m=t().catch(O=>{if(O=O instanceof Error?O:new Error(String(O)),c)return new Promise((te,F)=>{c(O,()=>te(_()),()=>F(O),w+1)});throw O}).then(O=>q!==m&&m?m:(O&&(O.__esModule||O[Symbol.toStringTag]==="Module")&&(O=O.default),f=O,O)))};return Jn({name:"AsyncComponentWrapper",__asyncLoader:P,__asyncHydrate(q,O,te){let F=!1;(O.bu||(O.bu=[])).push(()=>F=!0);const U=()=>{F||te()},G=a?()=>{const Y=a(U,Te=>Ly(q,Te));Y&&(O.bum||(O.bum=[])).push(Y)}:U;f?G():P().then(()=>!O.isUnmounted&&G())},get __asyncResolved(){return f},setup(){const q=Kn;if(Qc(q),f)return()=>kl(f,q);const O=G=>{m=null,tl(G,q,13,!r)};if(u&&q.suspense||oi)return P().then(G=>()=>kl(G,q)).catch(G=>(O(G),()=>r?Le(r,{error:G}):null));const te=x(!1),F=x(),U=x(!!o);return o&&setTimeout(()=>{U.value=!1},o),s!=null&&setTimeout(()=>{if(!te.value&&!F.value){const G=new Error(`Async component timed out after ${s}ms.`);O(G),F.value=G}},s),P().then(()=>{te.value=!0,q.parent&&nl(q.parent.vnode)&&q.parent.update()}).catch(G=>{O(G),F.value=G}),()=>{if(te.value&&f)return kl(f,q);if(F.value&&r)return Le(r,{error:F.value});if(n&&!U.value)return kl(n,q)}}})}function kl(e,t){const{ref:n,props:r,children:o,ce:a}=t.vnode,s=Le(e,r,o);return s.ref=n,s.ce=a,delete t.vnode.ce,s}const nl=e=>e.type.__isKeepAlive;function Oy(e,t){Dp(e,"a",t)}function Dy(e,t){Dp(e,"da",t)}function Dp(e,t,n=Kn){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(ru(t,r,n),n){let o=n.parent;for(;o&&o.parent;)nl(o.parent.vnode)&&Fy(r,t,n,o),o=o.parent}}function Fy(e,t,n,r){const o=ru(t,e,r,!0);ou(()=>{Uc(r[t],o)},n)}function ru(e,t,n=Kn,r=!1){if(n){const o=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=(...s)=>{ba();const u=rl(n),c=Io(t,n,e,s);return u(),_a(),c});return r?o.unshift(a):o.push(a),a}}const ka=e=>(t,n=Kn)=>{(!oi||e==="sp")&&ru(e,(...r)=>t(...r),n)},Uy=ka("bm"),Ca=ka("m"),By=ka("bu"),qy=ka("u"),ns=ka("bum"),ou=ka("um"),Hy=ka("sp"),Wy=ka("rtg"),Vy=ka("rtc");function zy(e,t=Kn){ru("ec",e,t)}const Gy="components",Fp=Symbol.for("v-ndc");function Xc(e){return tn(e)?Ky(Gy,e,!1)||e:e||Fp}function Ky(e,t,n=!0,r=!1){const o=Yn||Kn;if(o){const a=o.type;{const u=Mw(a,!1);if(u&&(u===t||u===vr(t)||u===Xl(vr(t))))return a}const s=ef(o[e]||a[e],t)||ef(o.appContext[e],t);return!s&&r?a:s}}function ef(e,t){return e&&(e[t]||e[vr(t)]||e[Xl(vr(t))])}function Dt(e,t,n,r){let o;const a=n,s=at(e);if(s||tn(e)){const u=s&&Ss(e);let c=!1,m=!1;u&&(c=!to(e),m=Ta(e),e=tu(e)),o=new Array(e.length);for(let f=0,w=e.length;f<w;f++)o[f]=t(c?m?ni(Eo(e[f])):Eo(e[f]):e[f],f,void 0,a)}else if(typeof e=="number"){o=new Array(e);for(let u=0;u<e;u++)o[u]=t(u+1,u,void 0,a)}else if(Lt(e))if(e[Symbol.iterator])o=Array.from(e,(u,c)=>t(u,c,void 0,a));else{const u=Object.keys(e);o=new Array(u.length);for(let c=0,m=u.length;c<m;c++){const f=u[c];o[c]=t(e[f],f,c,a)}}else o=[];return o}function Ko(e,t,n={},r,o){if(Yn.ce||Yn.parent&&Xs(Yn.parent)&&Yn.parent.ce){const m=Object.keys(n).length>0;return t!=="default"&&(n.name=t),k(),tt(Ke,null,[Le("slot",n,r)],m?-2:64)}let a=e[t];a&&a._c&&(a._d=!1),k();const s=a&&Up(a(n)),u=n.key||s&&s.key,c=tt(Ke,{key:(u&&!Ao(u)?u:`_${t}`)+(!s&&r?"_fb":"")},s||[],s&&e._===1?64:-2);return a&&a._c&&(a._d=!0),c}function Up(e){return e.some(t=>Yi(t)?!(t.type===ar||t.type===Ke&&!Up(t.children)):!0)?e:null}const gc=e=>e?sm(e)?iu(e):gc(e.parent):null,Ui=Rn(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=>gc(e.parent),$root:e=>gc(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>qp(e),$forceUpdate:e=>e.f||(e.f=()=>{Jc(e.update)}),$nextTick:e=>e.n||(e.n=Ht.bind(e.proxy)),$watch:e=>Iy.bind(e)}),Du=(e,t)=>e!==zt&&!e.__isScriptSetup&&Nt(e,t),Yy={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:o,props:a,accessCache:s,type:u,appContext:c}=e;if(t[0]!=="$"){const _=s[t];if(_!==void 0)switch(_){case 1:return r[t];case 2:return o[t];case 4:return n[t];case 3:return a[t]}else{if(Du(r,t))return s[t]=1,r[t];if(o!==zt&&Nt(o,t))return s[t]=2,o[t];if(Nt(a,t))return s[t]=3,a[t];if(n!==zt&&Nt(n,t))return s[t]=4,n[t];yc&&(s[t]=0)}}const m=Ui[t];let f,w;if(m)return t==="$attrs"&&or(e.attrs,"get",""),m(e);if((f=u.__cssModules)&&(f=f[t]))return f;if(n!==zt&&Nt(n,t))return s[t]=4,n[t];if(w=c.config.globalProperties,Nt(w,t))return w[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:a}=e;return Du(o,t)?(o[t]=n,!0):r!==zt&&Nt(r,t)?(r[t]=n,!0):Nt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:o,props:a,type:s}},u){let c;return!!(n[u]||e!==zt&&u[0]!=="$"&&Nt(e,u)||Du(t,u)||Nt(a,u)||Nt(r,u)||Nt(Ui,u)||Nt(o.config.globalProperties,u)||(c=s.__cssModules)&&c[u])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Nt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Jy(){return Qy().slots}function Qy(e){const t=rd();return t.setupContext||(t.setupContext=lm(t))}function tf(e){return at(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let yc=!0;function Xy(e){const t=qp(e),n=e.proxy,r=e.ctx;yc=!1,t.beforeCreate&&nf(t.beforeCreate,e,"bc");const{data:o,computed:a,methods:s,watch:u,provide:c,inject:m,created:f,beforeMount:w,mounted:_,beforeUpdate:P,updated:q,activated:O,deactivated:te,beforeDestroy:F,beforeUnmount:U,destroyed:G,unmounted:Y,render:Te,renderTracked:Me,renderTriggered:ae,errorCaptured:Se,serverPrefetch:K,expose:be,inheritAttrs:Ce,components:ne,directives:Ae,filters:We}=t;if(m&&Zy(m,r,null),s)for(const Ee in s){const Ie=s[Ee];dt(Ie)&&(r[Ee]=Ie.bind(n))}if(o){const Ee=o.call(n,n);Lt(Ee)&&(e.data=nu(Ee))}if(yc=!0,a)for(const Ee in a){const Ie=a[Ee],Ze=dt(Ie)?Ie.bind(n,n):dt(Ie.get)?Ie.get.bind(n,n):Yo,je=!dt(Ie)&&dt(Ie.set)?Ie.set.bind(n):Yo,et=Z({get:Ze,set:je});Object.defineProperty(r,Ee,{enumerable:!0,configurable:!0,get:()=>et.value,set:ze=>et.value=ze})}if(u)for(const Ee in u)Bp(u[Ee],r,n,Ee);if(c){const Ee=dt(c)?c.call(n):c;Reflect.ownKeys(Ee).forEach(Ie=>{jl(Ie,Ee[Ie])})}f&&nf(f,e,"c");function Be(Ee,Ie){at(Ie)?Ie.forEach(Ze=>Ee(Ze.bind(n))):Ie&&Ee(Ie.bind(n))}if(Be(Uy,w),Be(Ca,_),Be(By,P),Be(qy,q),Be(Oy,O),Be(Dy,te),Be(zy,Se),Be(Vy,Me),Be(Wy,ae),Be(ns,U),Be(ou,Y),Be(Hy,K),at(be))if(be.length){const Ee=e.exposed||(e.exposed={});be.forEach(Ie=>{Object.defineProperty(Ee,Ie,{get:()=>n[Ie],set:Ze=>n[Ie]=Ze,enumerable:!0})})}else e.exposed||(e.exposed={});Te&&e.render===Yo&&(e.render=Te),Ce!=null&&(e.inheritAttrs=Ce),ne&&(e.components=ne),Ae&&(e.directives=Ae),K&&Qc(e)}function Zy(e,t,n=Yo){at(e)&&(e=wc(e));for(const r in e){const o=e[r];let a;Lt(o)?"default"in o?a=xo(o.from||r,o.default,!0):a=xo(o.from||r):a=xo(o),sr(a)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>a.value,set:s=>a.value=s}):t[r]=a}}function nf(e,t,n){Io(at(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function Bp(e,t,n,r){let o=r.includes(".")?Pp(n,r):()=>n[r];if(tn(e)){const a=t[e];dt(a)&&ht(o,a)}else if(dt(e))ht(o,e.bind(n));else if(Lt(e))if(at(e))e.forEach(a=>Bp(a,t,n,r));else{const a=dt(e.handler)?e.handler.bind(n):t[e.handler];dt(a)&&ht(o,a,e)}}function qp(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:a,config:{optionMergeStrategies:s}}=e.appContext,u=a.get(t);let c;return u?c=u:!o.length&&!n&&!r?c=t:(c={},o.length&&o.forEach(m=>ql(c,m,s,!0)),ql(c,t,s)),Lt(t)&&a.set(t,c),c}function ql(e,t,n,r=!1){const{mixins:o,extends:a}=t;a&&ql(e,a,n,!0),o&&o.forEach(s=>ql(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const u=ew[s]||n&&n[s];e[s]=u?u(e[s],t[s]):t[s]}return e}const ew={data:rf,props:of,emits:of,methods:Mi,computed:Mi,beforeCreate:dr,created:dr,beforeMount:dr,mounted:dr,beforeUpdate:dr,updated:dr,beforeDestroy:dr,beforeUnmount:dr,destroyed:dr,unmounted:dr,activated:dr,deactivated:dr,errorCaptured:dr,serverPrefetch:dr,components:Mi,directives:Mi,watch:nw,provide:rf,inject:tw};function rf(e,t){return t?e?function(){return Rn(dt(e)?e.call(this,this):e,dt(t)?t.call(this,this):t)}:t:e}function tw(e,t){return Mi(wc(e),wc(t))}function wc(e){if(at(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function dr(e,t){return e?[...new Set([].concat(e,t))]:t}function Mi(e,t){return e?Rn(Object.create(null),e,t):t}function of(e,t){return e?at(e)&&at(t)?[...new Set([...e,...t])]:Rn(Object.create(null),tf(e),tf(t??{})):t}function nw(e,t){if(!e)return t;if(!t)return e;const n=Rn(Object.create(null),e);for(const r in t)n[r]=dr(e[r],t[r]);return n}function Hp(){return{app:null,config:{isNativeTag:Zh,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 rw=0;function ow(e,t){return function(r,o=null){dt(r)||(r=Rn({},r)),o!=null&&!Lt(o)&&(o=null);const a=Hp(),s=new WeakSet,u=[];let c=!1;const m=a.app={_uid:rw++,_component:r,_props:o,_container:null,_context:a,_instance:null,version:Nw,get config(){return a.config},set config(f){},use(f,...w){return s.has(f)||(f&&dt(f.install)?(s.add(f),f.install(m,...w)):dt(f)&&(s.add(f),f(m,...w))),m},mixin(f){return a.mixins.includes(f)||a.mixins.push(f),m},component(f,w){return w?(a.components[f]=w,m):a.components[f]},directive(f,w){return w?(a.directives[f]=w,m):a.directives[f]},mount(f,w,_){if(!c){const P=m._ceVNode||Le(r,o);return P.appContext=a,_===!0?_="svg":_===!1&&(_=void 0),e(P,f,_),c=!0,m._container=f,f.__vue_app__=m,iu(P.component)}},onUnmount(f){u.push(f)},unmount(){c&&(Io(u,m._instance,16),e(null,m._container),delete m._container.__vue_app__)},provide(f,w){return a.provides[f]=w,m},runWithContext(f){const w=Zs;Zs=m;try{return f()}finally{Zs=w}}};return m}}let Zs=null;const aw=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${vr(t)}Modifiers`]||e[`${ts(t)}Modifiers`];function sw(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||zt;let o=n;const a=t.startsWith("update:"),s=a&&aw(r,t.slice(7));s&&(s.trim&&(o=n.map(f=>tn(f)?f.trim():f)),s.number&&(o=n.map(Zl)));let u,c=r[u=Mu(t)]||r[u=Mu(vr(t))];!c&&a&&(c=r[u=Mu(ts(t))]),c&&Io(c,e,6,o);const m=r[u+"Once"];if(m){if(!e.emitted)e.emitted={};else if(e.emitted[u])return;e.emitted[u]=!0,Io(m,e,6,o)}}const iw=new WeakMap;function Wp(e,t,n=!1){const r=n?iw:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const a=e.emits;let s={},u=!1;if(!dt(e)){const c=m=>{const f=Wp(m,t,!0);f&&(u=!0,Rn(s,f))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!a&&!u?(Lt(e)&&r.set(e,null),null):(at(a)?a.forEach(c=>s[c]=null):Rn(s,a),Lt(e)&&r.set(e,s),s)}function au(e,t){return!e||!Yl(t)?!1:(t=t.slice(2).replace(/Once$/,""),Nt(e,t[0].toLowerCase()+t.slice(1))||Nt(e,ts(t))||Nt(e,t))}function af(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[a],slots:s,attrs:u,emit:c,render:m,renderCache:f,props:w,data:_,setupState:P,ctx:q,inheritAttrs:O}=e,te=Ul(e);let F,U;try{if(n.shapeFlag&4){const Y=o||r,Te=Y;F=Go(m.call(Te,Y,f,w,P,_,q)),U=u}else{const Y=t;F=Go(Y.length>1?Y(w,{attrs:u,slots:s,emit:c}):Y(w,null)),U=t.props?u:lw(u)}}catch(Y){Bi.length=0,tl(Y,e,1),F=Le(ar)}let G=F;if(U&&O!==!1){const Y=Object.keys(U),{shapeFlag:Te}=G;Y.length&&Te&7&&(a&&Y.some(Jl)&&(U=uw(U,a)),G=es(G,U,!1,!0))}return n.dirs&&(G=es(G,null,!1,!0),G.dirs=G.dirs?G.dirs.concat(n.dirs):n.dirs),n.transition&&Ki(G,n.transition),F=G,Ul(te),F}const lw=e=>{let t;for(const n in e)(n==="class"||n==="style"||Yl(n))&&((t||(t={}))[n]=e[n]);return t},uw=(e,t)=>{const n={};for(const r in e)(!Jl(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function cw(e,t,n){const{props:r,children:o,component:a}=e,{props:s,children:u,patchFlag:c}=t,m=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?sf(r,s,m):!!s;if(c&8){const f=t.dynamicProps;for(let w=0;w<f.length;w++){const _=f[w];if(Vp(s,r,_)&&!au(m,_))return!0}}}else return(o||u)&&(!u||!u.$stable)?!0:r===s?!1:r?s?sf(r,s,m):!0:!!s;return!1}function sf(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let o=0;o<r.length;o++){const a=r[o];if(Vp(t,e,a)&&!au(n,a))return!0}return!1}function Vp(e,t,n){const r=e[n],o=t[n];return n==="style"&&Lt(r)&&Lt(o)?!di(r,o):r!==o}function dw({vnode:e,parent:t,suspense:n},r){for(;t;){const o=t.subTree;if(o.suspense&&o.suspense.activeBranch===e&&(o.suspense.vnode.el=o.el=r,e=o),o===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const zp={},Gp=()=>Object.create(zp),Kp=e=>Object.getPrototypeOf(e)===zp;function fw(e,t,n,r=!1){const o={},a=Gp();e.propsDefaults=Object.create(null),Yp(e,t,o,a);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:_p(o):e.type.props?e.props=o:e.props=a,e.attrs=a}function hw(e,t,n,r){const{props:o,attrs:a,vnode:{patchFlag:s}}=e,u=Et(o),[c]=e.propsOptions;let m=!1;if((r||s>0)&&!(s&16)){if(s&8){const f=e.vnode.dynamicProps;for(let w=0;w<f.length;w++){let _=f[w];if(au(e.emitsOptions,_))continue;const P=t[_];if(c)if(Nt(a,_))P!==a[_]&&(a[_]=P,m=!0);else{const q=vr(_);o[q]=bc(c,u,q,P,e,!1)}else P!==a[_]&&(a[_]=P,m=!0)}}}else{Yp(e,t,o,a)&&(m=!0);let f;for(const w in u)(!t||!Nt(t,w)&&((f=ts(w))===w||!Nt(t,f)))&&(c?n&&(n[w]!==void 0||n[f]!==void 0)&&(o[w]=bc(c,u,w,void 0,e,!0)):delete o[w]);if(a!==u)for(const w in a)(!t||!Nt(t,w))&&(delete a[w],m=!0)}m&&va(e.attrs,"set","")}function Yp(e,t,n,r){const[o,a]=e.propsOptions;let s=!1,u;if(t)for(let c in t){if(Li(c))continue;const m=t[c];let f;o&&Nt(o,f=vr(c))?!a||!a.includes(f)?n[f]=m:(u||(u={}))[f]=m:au(e.emitsOptions,c)||(!(c in r)||m!==r[c])&&(r[c]=m,s=!0)}if(a){const c=Et(n),m=u||zt;for(let f=0;f<a.length;f++){const w=a[f];n[w]=bc(o,c,w,m[w],e,!Nt(m,w))}}return s}function bc(e,t,n,r,o,a){const s=e[n];if(s!=null){const u=Nt(s,"default");if(u&&r===void 0){const c=s.default;if(s.type!==Function&&!s.skipFactory&&dt(c)){const{propsDefaults:m}=o;if(n in m)r=m[n];else{const f=rl(o);r=m[n]=c.call(null,t),f()}}else r=c;o.ce&&o.ce._setProp(n,r)}s[0]&&(a&&!u?r=!1:s[1]&&(r===""||r===ts(n))&&(r=!0))}return r}const pw=new WeakMap;function Jp(e,t,n=!1){const r=n?pw:t.propsCache,o=r.get(e);if(o)return o;const a=e.props,s={},u=[];let c=!1;if(!dt(e)){const f=w=>{c=!0;const[_,P]=Jp(w,t,!0);Rn(s,_),P&&u.push(...P)};!n&&t.mixins.length&&t.mixins.forEach(f),e.extends&&f(e.extends),e.mixins&&e.mixins.forEach(f)}if(!a&&!c)return Lt(e)&&r.set(e,Ys),Ys;if(at(a))for(let f=0;f<a.length;f++){const w=vr(a[f]);lf(w)&&(s[w]=zt)}else if(a)for(const f in a){const w=vr(f);if(lf(w)){const _=a[f],P=s[w]=at(_)||dt(_)?{type:_}:Rn({},_),q=P.type;let O=!1,te=!0;if(at(q))for(let F=0;F<q.length;++F){const U=q[F],G=dt(U)&&U.name;if(G==="Boolean"){O=!0;break}else G==="String"&&(te=!1)}else O=dt(q)&&q.name==="Boolean";P[0]=O,P[1]=te,(O||Nt(P,"default"))&&u.push(w)}}const m=[s,u];return Lt(e)&&r.set(e,m),m}function lf(e){return e[0]!=="$"&&!Li(e)}const Zc=e=>e==="_"||e==="_ctx"||e==="$stable",ed=e=>at(e)?e.map(Go):[Go(e)],mw=(e,t,n)=>{if(t._n)return t;const r=mt((...o)=>ed(t(...o)),n);return r._c=!1,r},Qp=(e,t,n)=>{const r=e._ctx;for(const o in e){if(Zc(o))continue;const a=e[o];if(dt(a))t[o]=mw(o,a,r);else if(a!=null){const s=ed(a);t[o]=()=>s}}},Xp=(e,t)=>{const n=ed(t);e.slots.default=()=>n},Zp=(e,t,n)=>{for(const r in t)(n||!Zc(r))&&(e[r]=t[r])},vw=(e,t,n)=>{const r=e.slots=Gp();if(e.vnode.shapeFlag&32){const o=t._;o?(Zp(r,t,n),n&&rp(r,"_",o,!0)):Qp(t,r)}else t&&Xp(e,t)},gw=(e,t,n)=>{const{vnode:r,slots:o}=e;let a=!0,s=zt;if(r.shapeFlag&32){const u=t._;u?n&&u===1?a=!1:Zp(o,t,n):(a=!t.$stable,Qp(t,o)),s=t}else t&&(Xp(e,t),s={default:1});if(a)for(const u in o)!Zc(u)&&s[u]==null&&delete o[u]},fr=Tw;function yw(e){return ww(e)}function ww(e,t){const n=eu();n.__VUE__=!0;const{insert:r,remove:o,patchProp:a,createElement:s,createText:u,createComment:c,setText:m,setElementText:f,parentNode:w,nextSibling:_,setScopeId:P=Yo,insertStaticContent:q}=e,O=(E,$,V,se=null,ce=null,ie=null,me=void 0,ue=null,ge=!!$.dynamicChildren)=>{if(E===$)return;E&&!_s(E,$)&&(se=X(E),ze(E,ce,ie,!0),E=null),$.patchFlag===-2&&(ge=!1,$.dynamicChildren=null);const{type:he,ref:Fe,shapeFlag:_e}=$;switch(he){case su:te(E,$,V,se);break;case ar:F(E,$,V,se);break;case Nl:E==null&&U($,V,se,me);break;case Ke:ne(E,$,V,se,ce,ie,me,ue,ge);break;default:_e&1?Te(E,$,V,se,ce,ie,me,ue,ge):_e&6?Ae(E,$,V,se,ce,ie,me,ue,ge):(_e&64||_e&128)&&he.process(E,$,V,se,ce,ie,me,ue,ge,xe)}Fe!=null&&ce?Fi(Fe,E&&E.ref,ie,$||E,!$):Fe==null&&E&&E.ref!=null&&Fi(E.ref,null,ie,E,!0)},te=(E,$,V,se)=>{if(E==null)r($.el=u($.children),V,se);else{const ce=$.el=E.el;$.children!==E.children&&m(ce,$.children)}},F=(E,$,V,se)=>{E==null?r($.el=c($.children||""),V,se):$.el=E.el},U=(E,$,V,se)=>{[E.el,E.anchor]=q(E.children,$,V,se,E.el,E.anchor)},G=({el:E,anchor:$},V,se)=>{let ce;for(;E&&E!==$;)ce=_(E),r(E,V,se),E=ce;r($,V,se)},Y=({el:E,anchor:$})=>{let V;for(;E&&E!==$;)V=_(E),o(E),E=V;o($)},Te=(E,$,V,se,ce,ie,me,ue,ge)=>{if($.type==="svg"?me="svg":$.type==="math"&&(me="mathml"),E==null)Me($,V,se,ce,ie,me,ue,ge);else{const he=E.el&&E.el._isVueCE?E.el:null;try{he&&he._beginPatch(),K(E,$,ce,ie,me,ue,ge)}finally{he&&he._endPatch()}}},Me=(E,$,V,se,ce,ie,me,ue)=>{let ge,he;const{props:Fe,shapeFlag:_e,transition:Oe,dirs:$e}=E;if(ge=E.el=s(E.type,ie,Fe&&Fe.is,Fe),_e&8?f(ge,E.children):_e&16&&Se(E.children,ge,null,se,ce,Fu(E,ie),me,ue),$e&&ms(E,null,se,"created"),ae(ge,E,E.scopeId,me,se),Fe){for(const D in Fe)D!=="value"&&!Li(D)&&a(ge,D,null,Fe[D],ie,se);"value"in Fe&&a(ge,"value",null,Fe.value,ie),(he=Fe.onVnodeBeforeMount)&&Ho(he,se,E)}$e&&ms(E,null,se,"beforeMount");const Ge=bw(ce,Oe);Ge&&Oe.beforeEnter(ge),r(ge,$,V),((he=Fe&&Fe.onVnodeMounted)||Ge||$e)&&fr(()=>{try{he&&Ho(he,se,E),Ge&&Oe.enter(ge),$e&&ms(E,null,se,"mounted")}finally{}},ce)},ae=(E,$,V,se,ce)=>{if(V&&P(E,V),se)for(let ie=0;ie<se.length;ie++)P(E,se[ie]);if(ce){let ie=ce.subTree;if($===ie||nm(ie.type)&&(ie.ssContent===$||ie.ssFallback===$)){const me=ce.vnode;ae(E,me,me.scopeId,me.slotScopeIds,ce.parent)}}},Se=(E,$,V,se,ce,ie,me,ue,ge=0)=>{for(let he=ge;he<E.length;he++){const Fe=E[he]=ue?ma(E[he]):Go(E[he]);O(null,Fe,$,V,se,ce,ie,me,ue)}},K=(E,$,V,se,ce,ie,me)=>{const ue=$.el=E.el;let{patchFlag:ge,dynamicChildren:he,dirs:Fe}=$;ge|=E.patchFlag&16;const _e=E.props||zt,Oe=$.props||zt;let $e;if(V&&vs(V,!1),($e=Oe.onVnodeBeforeUpdate)&&Ho($e,V,$,E),Fe&&ms($,E,V,"beforeUpdate"),V&&vs(V,!0),(_e.innerHTML&&Oe.innerHTML==null||_e.textContent&&Oe.textContent==null)&&f(ue,""),he?be(E.dynamicChildren,he,ue,V,se,Fu($,ce),ie):me||Ie(E,$,ue,null,V,se,Fu($,ce),ie,!1),ge>0){if(ge&16)Ce(ue,_e,Oe,V,ce);else if(ge&2&&_e.class!==Oe.class&&a(ue,"class",null,Oe.class,ce),ge&4&&a(ue,"style",_e.style,Oe.style,ce),ge&8){const Ge=$.dynamicProps;for(let D=0;D<Ge.length;D++){const B=Ge[D],W=_e[B],oe=Oe[B];(oe!==W||B==="value")&&a(ue,B,W,oe,ce,V)}}ge&1&&E.children!==$.children&&f(ue,$.children)}else!me&&he==null&&Ce(ue,_e,Oe,V,ce);(($e=Oe.onVnodeUpdated)||Fe)&&fr(()=>{$e&&Ho($e,V,$,E),Fe&&ms($,E,V,"updated")},se)},be=(E,$,V,se,ce,ie,me)=>{for(let ue=0;ue<$.length;ue++){const ge=E[ue],he=$[ue],Fe=ge.el&&(ge.type===Ke||!_s(ge,he)||ge.shapeFlag&198)?w(ge.el):V;O(ge,he,Fe,null,se,ce,ie,me,!0)}},Ce=(E,$,V,se,ce)=>{if($!==V){if($!==zt)for(const ie in $)!Li(ie)&&!(ie in V)&&a(E,ie,$[ie],null,ce,se);for(const ie in V){if(Li(ie))continue;const me=V[ie],ue=$[ie];me!==ue&&ie!=="value"&&a(E,ie,ue,me,ce,se)}"value"in V&&a(E,"value",$.value,V.value,ce)}},ne=(E,$,V,se,ce,ie,me,ue,ge)=>{const he=$.el=E?E.el:u(""),Fe=$.anchor=E?E.anchor:u("");let{patchFlag:_e,dynamicChildren:Oe,slotScopeIds:$e}=$;$e&&(ue=ue?ue.concat($e):$e),E==null?(r(he,V,se),r(Fe,V,se),Se($.children||[],V,Fe,ce,ie,me,ue,ge)):_e>0&&_e&64&&Oe&&E.dynamicChildren&&E.dynamicChildren.length===Oe.length?(be(E.dynamicChildren,Oe,V,ce,ie,me,ue),($.key!=null||ce&&$===ce.subTree)&&td(E,$,!0)):Ie(E,$,V,Fe,ce,ie,me,ue,ge)},Ae=(E,$,V,se,ce,ie,me,ue,ge)=>{$.slotScopeIds=ue,E==null?$.shapeFlag&512?ce.ctx.activate($,V,se,me,ge):We($,V,se,ce,ie,me,ge):qe(E,$,ge)},We=(E,$,V,se,ce,ie,me)=>{const ue=E.component=Ew(E,se,ce);if(nl(E)&&(ue.ctx.renderer=xe),Iw(ue,!1,me),ue.asyncDep){if(ce&&ce.registerDep(ue,Be,me),!E.el){const ge=ue.subTree=Le(ar);F(null,ge,$,V),E.placeholder=ge.el}}else Be(ue,E,$,V,ce,ie,me)},qe=(E,$,V)=>{const se=$.component=E.component;if(cw(E,$,V))if(se.asyncDep&&!se.asyncResolved){Ee(se,$,V);return}else se.next=$,se.update();else $.el=E.el,se.vnode=$},Be=(E,$,V,se,ce,ie,me)=>{const ue=()=>{if(E.isMounted){let{next:_e,bu:Oe,u:$e,parent:Ge,vnode:D}=E;{const Pe=em(E);if(Pe){_e&&(_e.el=D.el,Ee(E,_e,me)),Pe.asyncDep.then(()=>{fr(()=>{E.isUnmounted||he()},ce)});return}}let B=_e,W;vs(E,!1),_e?(_e.el=D.el,Ee(E,_e,me)):_e=D,Oe&&$l(Oe),(W=_e.props&&_e.props.onVnodeBeforeUpdate)&&Ho(W,Ge,_e,D),vs(E,!0);const oe=af(E),ye=E.subTree;E.subTree=oe,O(ye,oe,w(ye.el),X(ye),E,ce,ie),_e.el=oe.el,B===null&&dw(E,oe.el),$e&&fr($e,ce),(W=_e.props&&_e.props.onVnodeUpdated)&&fr(()=>Ho(W,Ge,_e,D),ce)}else{let _e;const{el:Oe,props:$e}=$,{bm:Ge,m:D,parent:B,root:W,type:oe}=E,ye=Xs($);vs(E,!1),Ge&&$l(Ge),!ye&&(_e=$e&&$e.onVnodeBeforeMount)&&Ho(_e,B,$),vs(E,!0);{W.ce&&W.ce._hasShadowRoot()&&W.ce._injectChildStyle(oe,E.parent?E.parent.type:void 0);const Pe=E.subTree=af(E);O(null,Pe,V,se,E,ce,ie),$.el=Pe.el}if(D&&fr(D,ce),!ye&&(_e=$e&&$e.onVnodeMounted)){const Pe=$;fr(()=>Ho(_e,B,Pe),ce)}($.shapeFlag&256||B&&Xs(B.vnode)&&B.vnode.shapeFlag&256)&&E.a&&fr(E.a,ce),E.isMounted=!0,$=V=se=null}};E.scope.on();const ge=E.effect=new ip(ue);E.scope.off();const he=E.update=ge.run.bind(ge),Fe=E.job=ge.runIfDirty.bind(ge);Fe.i=E,Fe.id=E.uid,ge.scheduler=()=>Jc(Fe),vs(E,!0),he()},Ee=(E,$,V)=>{$.component=E;const se=E.vnode.props;E.vnode=$,E.next=null,hw(E,$.props,se,V),gw(E,$.children,V),ba(),Gd(E),_a()},Ie=(E,$,V,se,ce,ie,me,ue,ge=!1)=>{const he=E&&E.children,Fe=E?E.shapeFlag:0,_e=$.children,{patchFlag:Oe,shapeFlag:$e}=$;if(Oe>0){if(Oe&128){je(he,_e,V,se,ce,ie,me,ue,ge);return}else if(Oe&256){Ze(he,_e,V,se,ce,ie,me,ue,ge);return}}$e&8?(Fe&16&&vt(he,ce,ie),_e!==he&&f(V,_e)):Fe&16?$e&16?je(he,_e,V,se,ce,ie,me,ue,ge):vt(he,ce,ie,!0):(Fe&8&&f(V,""),$e&16&&Se(_e,V,se,ce,ie,me,ue,ge))},Ze=(E,$,V,se,ce,ie,me,ue,ge)=>{E=E||Ys,$=$||Ys;const he=E.length,Fe=$.length,_e=Math.min(he,Fe);let Oe;for(Oe=0;Oe<_e;Oe++){const $e=$[Oe]=ge?ma($[Oe]):Go($[Oe]);O(E[Oe],$e,V,null,ce,ie,me,ue,ge)}he>Fe?vt(E,ce,ie,!0,!1,_e):Se($,V,se,ce,ie,me,ue,ge,_e)},je=(E,$,V,se,ce,ie,me,ue,ge)=>{let he=0;const Fe=$.length;let _e=E.length-1,Oe=Fe-1;for(;he<=_e&&he<=Oe;){const $e=E[he],Ge=$[he]=ge?ma($[he]):Go($[he]);if(_s($e,Ge))O($e,Ge,V,null,ce,ie,me,ue,ge);else break;he++}for(;he<=_e&&he<=Oe;){const $e=E[_e],Ge=$[Oe]=ge?ma($[Oe]):Go($[Oe]);if(_s($e,Ge))O($e,Ge,V,null,ce,ie,me,ue,ge);else break;_e--,Oe--}if(he>_e){if(he<=Oe){const $e=Oe+1,Ge=$e<Fe?$[$e].el:se;for(;he<=Oe;)O(null,$[he]=ge?ma($[he]):Go($[he]),V,Ge,ce,ie,me,ue,ge),he++}}else if(he>Oe)for(;he<=_e;)ze(E[he],ce,ie,!0),he++;else{const $e=he,Ge=he,D=new Map;for(he=Ge;he<=Oe;he++){const ut=$[he]=ge?ma($[he]):Go($[he]);ut.key!=null&&D.set(ut.key,he)}let B,W=0;const oe=Oe-Ge+1;let ye=!1,Pe=0;const De=new Array(oe);for(he=0;he<oe;he++)De[he]=0;for(he=$e;he<=_e;he++){const ut=E[he];if(W>=oe){ze(ut,ce,ie,!0);continue}let gt;if(ut.key!=null)gt=D.get(ut.key);else for(B=Ge;B<=Oe;B++)if(De[B-Ge]===0&&_s(ut,$[B])){gt=B;break}gt===void 0?ze(ut,ce,ie,!0):(De[gt-Ge]=he+1,gt>=Pe?Pe=gt:ye=!0,O(ut,$[gt],V,null,ce,ie,me,ue,ge),W++)}const rt=ye?_w(De):Ys;for(B=rt.length-1,he=oe-1;he>=0;he--){const ut=Ge+he,gt=$[ut],ft=$[ut+1],Tt=ut+1<Fe?ft.el||tm(ft):se;De[he]===0?O(null,gt,V,Tt,ce,ie,me,ue,ge):ye&&(B<0||he!==rt[B]?et(gt,V,Tt,2):B--)}}},et=(E,$,V,se,ce=null)=>{const{el:ie,type:me,transition:ue,children:ge,shapeFlag:he}=E;if(he&6){et(E.component.subTree,$,V,se);return}if(he&128){E.suspense.move($,V,se);return}if(he&64){me.move(E,$,V,xe);return}if(me===Ke){r(ie,$,V);for(let _e=0;_e<ge.length;_e++)et(ge[_e],$,V,se);r(E.anchor,$,V);return}if(me===Nl){G(E,$,V);return}if(se!==2&&he&1&&ue)if(se===0)ue.beforeEnter(ie),r(ie,$,V),fr(()=>ue.enter(ie),ce);else{const{leave:_e,delayLeave:Oe,afterLeave:$e}=ue,Ge=()=>{E.ctx.isUnmounted?o(ie):r(ie,$,V)},D=()=>{ie._isLeaving&&ie[Vo](!0),_e(ie,()=>{Ge(),$e&&$e()})};Oe?Oe(ie,Ge,D):D()}else r(ie,$,V)},ze=(E,$,V,se=!1,ce=!1)=>{const{type:ie,props:me,ref:ue,children:ge,dynamicChildren:he,shapeFlag:Fe,patchFlag:_e,dirs:Oe,cacheIndex:$e,memo:Ge}=E;if(_e===-2&&(ce=!1),ue!=null&&(ba(),Fi(ue,null,V,E,!0),_a()),$e!=null&&($.renderCache[$e]=void 0),Fe&256){$.ctx.deactivate(E);return}const D=Fe&1&&Oe,B=!Xs(E);let W;if(B&&(W=me&&me.onVnodeBeforeUnmount)&&Ho(W,$,E),Fe&6)Ye(E.component,V,se);else{if(Fe&128){E.suspense.unmount(V,se);return}D&&ms(E,null,$,"beforeUnmount"),Fe&64?E.type.remove(E,$,V,xe,se):he&&!he.hasOnce&&(ie!==Ke||_e>0&&_e&64)?vt(he,$,V,!1,!0):(ie===Ke&&_e&384||!ce&&Fe&16)&&vt(ge,$,V),se&&ct(E)}const oe=Ge!=null&&$e==null;(B&&(W=me&&me.onVnodeUnmounted)||D||oe)&&fr(()=>{W&&Ho(W,$,E),D&&ms(E,null,$,"unmounted"),oe&&(E.el=null)},V)},ct=E=>{const{type:$,el:V,anchor:se,transition:ce}=E;if($===Ke){nt(V,se);return}if($===Nl){Y(E);return}const ie=()=>{o(V),ce&&!ce.persisted&&ce.afterLeave&&ce.afterLeave()};if(E.shapeFlag&1&&ce&&!ce.persisted){const{leave:me,delayLeave:ue}=ce,ge=()=>me(V,ie);ue?ue(E.el,ie,ge):ge()}else ie()},nt=(E,$)=>{let V;for(;E!==$;)V=_(E),o(E),E=V;o($)},Ye=(E,$,V)=>{const{bum:se,scope:ce,job:ie,subTree:me,um:ue,m:ge,a:he}=E;uf(ge),uf(he),se&&$l(se),ce.stop(),ie&&(ie.flags|=8,ze(me,E,$,V)),ue&&fr(ue,$),fr(()=>{E.isUnmounted=!0},$)},vt=(E,$,V,se=!1,ce=!1,ie=0)=>{for(let me=ie;me<E.length;me++)ze(E[me],$,V,se,ce)},X=E=>{if(E.shapeFlag&6)return X(E.component.subTree);if(E.shapeFlag&128)return E.suspense.next();const $=_(E.anchor||E.el),V=$&&$[Rp];return V?_(V):$};let ke=!1;const pe=(E,$,V)=>{let se;E==null?$._vnode&&(ze($._vnode,null,null,!0),se=$._vnode.component):O($._vnode||null,E,$,null,null,null,V),$._vnode=E,ke||(ke=!0,Gd(se),xp(),ke=!1)},xe={p:O,um:ze,m:et,r:ct,mt:We,mc:Se,pc:Ie,pbc:be,n:X,o:e};return{render:pe,hydrate:void 0,createApp:ow(pe)}}function Fu({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 vs({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function bw(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function td(e,t,n=!1){const r=e.children,o=t.children;if(at(r)&&at(o))for(let a=0;a<r.length;a++){const s=r[a];let u=o[a];u.shapeFlag&1&&!u.dynamicChildren&&((u.patchFlag<=0||u.patchFlag===32)&&(u=o[a]=ma(o[a]),u.el=s.el),!n&&u.patchFlag!==-2&&td(s,u)),u.type===su&&(u.patchFlag===-1&&(u=o[a]=ma(u)),u.el=s.el),u.type===ar&&!u.el&&(u.el=s.el)}}function _w(e){const t=e.slice(),n=[0];let r,o,a,s,u;const c=e.length;for(r=0;r<c;r++){const m=e[r];if(m!==0){if(o=n[n.length-1],e[o]<m){t[r]=o,n.push(r);continue}for(a=0,s=n.length-1;a<s;)u=a+s>>1,e[n[u]]<m?a=u+1:s=u;m<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,s=n[a-1];a-- >0;)n[a]=s,s=t[s];return n}function em(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:em(t)}function uf(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function tm(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?tm(t.subTree):null}const nm=e=>e.__isSuspense;function Tw(e,t){t&&t.pendingBranch?at(e)?t.effects.push(...e):t.effects.push(e):xy(e)}const Ke=Symbol.for("v-fgt"),su=Symbol.for("v-txt"),ar=Symbol.for("v-cmt"),Nl=Symbol.for("v-stc"),Bi=[];let mr=null;function k(e=!1){Bi.push(mr=e?null:[])}function kw(){Bi.pop(),mr=Bi[Bi.length-1]||null}let ri=1;function Hl(e,t=!1){ri+=e,e<0&&mr&&t&&(mr.hasOnce=!0)}function rm(e){return e.dynamicChildren=ri>0?mr||Ys:null,kw(),ri>0&&mr&&mr.push(e),e}function A(e,t,n,r,o,a){return rm(h(e,t,n,r,o,a,!0))}function tt(e,t,n,r,o){return rm(Le(e,t,n,r,o,!0))}function Yi(e){return e?e.__v_isVNode===!0:!1}function _s(e,t){return e.type===t.type&&e.key===t.key}const om=({key:e})=>e??null,Ll=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?tn(e)||sr(e)||dt(e)?{i:Yn,r:e,k:t,f:!!n}:e:null);function h(e,t=null,n=null,r=0,o=null,a=e===Ke?0:1,s=!1,u=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&om(t),ref:t&&Ll(t),scopeId:Ep,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:Yn};return u?(nd(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=tn(n)?8:16),ri>0&&!s&&mr&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&mr.push(c),c}const Le=Cw;function Cw(e,t=null,n=null,r=0,o=null,a=!1){if((!e||e===Fp)&&(e=ar),Yi(e)){const u=es(e,t,!0);return n&&nd(u,n),ri>0&&!a&&mr&&(u.shapeFlag&6?mr[mr.indexOf(e)]=u:mr.push(u)),u.patchFlag=-2,u}if($w(e)&&(e=e.__vccOpts),t){t=Sw(t);let{class:u,style:c}=t;u&&!tn(u)&&(t.class=Qe(u)),Lt(c)&&(Yc(c)&&!at(c)&&(c=Rn({},c)),t.style=ya(c))}const s=tn(e)?1:nm(e)?128:Mp(e)?64:Lt(e)?4:dt(e)?2:0;return h(e,t,n,r,o,s,a,!0)}function Sw(e){return e?Yc(e)||Kp(e)?Rn({},e):e:null}function es(e,t,n=!1,r=!1){const{props:o,ref:a,patchFlag:s,children:u,transition:c}=e,m=t?am(o||{},t):o,f={__v_isVNode:!0,__v_skip:!0,type:e.type,props:m,key:m&&om(m),ref:t&&t.ref?n&&a?at(a)?a.concat(Ll(t)):[a,Ll(t)]:Ll(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:u,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Ke?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&es(e.ssContent),ssFallback:e.ssFallback&&es(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&r&&Ki(f,c.clone(f)),f}function As(e=" ",t=0){return Le(su,null,e,t)}function dj(e,t){const n=Le(Nl,null,e);return n.staticCount=t,n}function Q(e="",t=!1){return t?(k(),tt(ar,null,e)):Le(ar,null,e)}function Go(e){return e==null||typeof e=="boolean"?Le(ar):at(e)?Le(Ke,null,e.slice()):Yi(e)?ma(e):Le(su,null,String(e))}function ma(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:es(e)}function nd(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(at(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),nd(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!Kp(t)?t._ctx=Yn:o===3&&Yn&&(Yn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else dt(t)?(t={default:t,_ctx:Yn},n=32):(t=String(t),r&64?(n=16,t=[As(t)]):n=8);e.children=t,e.shapeFlag|=n}function am(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const o in r)if(o==="class")t.class!==r.class&&(t.class=Qe([t.class,r.class]));else if(o==="style")t.style=ya([t.style,r.style]);else if(Yl(o)){const a=t[o],s=r[o];s&&a!==s&&!(at(a)&&a.includes(s))?t[o]=a?[].concat(a,s):s:s==null&&a==null&&!Jl(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function Ho(e,t,n,r=null){Io(e,t,7,[n,r])}const xw=Hp();let Aw=0;function Ew(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||xw,a={uid:Aw++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Jg(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Jp(r,o),emitsOptions:Wp(r,o),emit:null,emitted:null,propsDefaults:zt,inheritAttrs:r.inheritAttrs,ctx:zt,data:zt,props:zt,attrs:zt,slots:zt,refs:zt,setupState:zt,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=sw.bind(null,a),e.ce&&e.ce(a),a}let Kn=null;const rd=()=>Kn||Yn;let Wl,_c;{const e=eu(),t=(n,r)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(r),a=>{o.length>1?o.forEach(s=>s(a)):o[0](a)}};Wl=t("__VUE_INSTANCE_SETTERS__",n=>Kn=n),_c=t("__VUE_SSR_SETTERS__",n=>oi=n)}const rl=e=>{const t=Kn;return Wl(e),e.scope.on(),()=>{e.scope.off(),Wl(t)}},cf=()=>{Kn&&Kn.scope.off(),Wl(null)};function sm(e){return e.vnode.shapeFlag&4}let oi=!1;function Iw(e,t=!1,n=!1){t&&_c(t);const{props:r,children:o}=e.vnode,a=sm(e);fw(e,r,a,t),vw(e,o,n||t);const s=a?Pw(e,t):void 0;return t&&_c(!1),s}function Pw(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Yy);const{setup:r}=n;if(r){ba();const o=e.setupContext=r.length>1?lm(e):null,a=rl(e),s=el(r,e,0,[e.props,o]),u=ep(s);if(_a(),a(),(u||e.sp)&&!Xs(e)&&Qc(e),u){if(s.then(cf,cf),t)return s.then(c=>{df(e,c)}).catch(c=>{tl(c,e,0)});e.asyncDep=s}else df(e,s)}else im(e)}function df(e,t,n){dt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Lt(t)&&(e.setupState=kp(t)),im(e)}function im(e,t,n){const r=e.type;e.render||(e.render=r.render||Yo);{const o=rl(e);ba();try{Xy(e)}finally{_a(),o()}}}const Rw={get(e,t){return or(e,"get",""),e[t]}};function lm(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Rw),slots:e.slots,emit:e.emit,expose:t}}function iu(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(kp(vy(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Ui)return Ui[n](e)},has(t,n){return n in t||n in Ui}})):e.proxy}function Mw(e,t=!0){return dt(e)?e.displayName||e.name:e.name||t&&e.__name}function $w(e){return dt(e)&&"__vccOpts"in e}const Z=(e,t)=>_y(e,t,oi);function od(e,t,n){try{Hl(-1);const r=arguments.length;return r===2?Lt(t)&&!at(t)?Yi(t)?Le(e,null,[t]):Le(e,t):Le(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Yi(n)&&(n=[n]),Le(e,t,n))}finally{Hl(1)}}function fj(e,t,n,r){const o=n[r];if(o&&jw(o,e))return o;const a=t();return a.memo=e.slice(),a.cacheIndex=r,n[r]=a}function jw(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(To(n[r],t[r]))return!1;return ri>0&&mr&&mr.push(e),!0}const Nw="3.5.34";/**
|
|
15
|
+
* @vue/runtime-dom v3.5.34
|
|
16
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
17
|
+
* @license MIT
|
|
18
|
+
**/let Tc;const ff=typeof window<"u"&&window.trustedTypes;if(ff)try{Tc=ff.createPolicy("vue",{createHTML:e=>e})}catch{}const um=Tc?e=>Tc.createHTML(e):e=>e,Lw="http://www.w3.org/2000/svg",Ow="http://www.w3.org/1998/Math/MathML",pa=typeof document<"u"?document:null,hf=pa&&pa.createElement("template"),Dw={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const o=t==="svg"?pa.createElementNS(Lw,e):t==="mathml"?pa.createElementNS(Ow,e):n?pa.createElement(e,{is:n}):pa.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>pa.createTextNode(e),createComment:e=>pa.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>pa.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,o,a){const s=n?n.previousSibling:t.lastChild;if(o&&(o===a||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===a||!(o=o.nextSibling)););else{hf.innerHTML=um(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const u=hf.content;if(r==="svg"||r==="mathml"){const c=u.firstChild;for(;c.firstChild;)u.appendChild(c.firstChild);u.removeChild(c)}t.insertBefore(u,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Wa="transition",Ai="animation",Ji=Symbol("_vtc"),cm={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},Fw=Rn({},$p,cm),Uw=e=>(e.displayName="Transition",e.props=Fw,e),dm=Uw((e,{slots:t})=>od(Ny,Bw(e),t)),gs=(e,t=[])=>{at(e)?e.forEach(n=>n(...t)):e&&e(...t)},pf=e=>e?at(e)?e.some(t=>t.length>1):e.length>1:!1;function Bw(e){const t={};for(const ne in e)ne in cm||(t[ne]=e[ne]);if(e.css===!1)return t;const{name:n="v",type:r,duration:o,enterFromClass:a=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:u=`${n}-enter-to`,appearFromClass:c=a,appearActiveClass:m=s,appearToClass:f=u,leaveFromClass:w=`${n}-leave-from`,leaveActiveClass:_=`${n}-leave-active`,leaveToClass:P=`${n}-leave-to`}=e,q=qw(o),O=q&&q[0],te=q&&q[1],{onBeforeEnter:F,onEnter:U,onEnterCancelled:G,onLeave:Y,onLeaveCancelled:Te,onBeforeAppear:Me=F,onAppear:ae=U,onAppearCancelled:Se=G}=t,K=(ne,Ae,We,qe)=>{ne._enterCancelled=qe,ys(ne,Ae?f:u),ys(ne,Ae?m:s),We&&We()},be=(ne,Ae)=>{ne._isLeaving=!1,ys(ne,w),ys(ne,P),ys(ne,_),Ae&&Ae()},Ce=ne=>(Ae,We)=>{const qe=ne?ae:U,Be=()=>K(Ae,ne,We);gs(qe,[Ae,Be]),mf(()=>{ys(Ae,ne?c:a),fa(Ae,ne?f:u),pf(qe)||vf(Ae,r,O,Be)})};return Rn(t,{onBeforeEnter(ne){gs(F,[ne]),fa(ne,a),fa(ne,s)},onBeforeAppear(ne){gs(Me,[ne]),fa(ne,c),fa(ne,m)},onEnter:Ce(!1),onAppear:Ce(!0),onLeave(ne,Ae){ne._isLeaving=!0;const We=()=>be(ne,Ae);fa(ne,w),ne._enterCancelled?(fa(ne,_),wf(ne)):(wf(ne),fa(ne,_)),mf(()=>{ne._isLeaving&&(ys(ne,w),fa(ne,P),pf(Y)||vf(ne,r,te,We))}),gs(Y,[ne,We])},onEnterCancelled(ne){K(ne,!1,void 0,!0),gs(G,[ne])},onAppearCancelled(ne){K(ne,!0,void 0,!0),gs(Se,[ne])},onLeaveCancelled(ne){be(ne),gs(Te,[ne])}})}function qw(e){if(e==null)return null;if(Lt(e))return[Uu(e.enter),Uu(e.leave)];{const t=Uu(e);return[t,t]}}function Uu(e){return qg(e)}function fa(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Ji]||(e[Ji]=new Set)).add(t)}function ys(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Ji];n&&(n.delete(t),n.size||(e[Ji]=void 0))}function mf(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Hw=0;function vf(e,t,n,r){const o=e._endId=++Hw,a=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(a,n);const{type:s,timeout:u,propCount:c}=Ww(e,t);if(!s)return r();const m=s+"end";let f=0;const w=()=>{e.removeEventListener(m,_),a()},_=P=>{P.target===e&&++f>=c&&w()};setTimeout(()=>{f<c&&w()},u+1),e.addEventListener(m,_)}function Ww(e,t){const n=window.getComputedStyle(e),r=q=>(n[q]||"").split(", "),o=r(`${Wa}Delay`),a=r(`${Wa}Duration`),s=gf(o,a),u=r(`${Ai}Delay`),c=r(`${Ai}Duration`),m=gf(u,c);let f=null,w=0,_=0;t===Wa?s>0&&(f=Wa,w=s,_=a.length):t===Ai?m>0&&(f=Ai,w=m,_=c.length):(w=Math.max(s,m),f=w>0?s>m?Wa:Ai:null,_=f?f===Wa?a.length:c.length:0);const P=f===Wa&&/\b(?:transform|all)(?:,|$)/.test(r(`${Wa}Property`).toString());return{type:f,timeout:w,propCount:_,hasTransform:P}}function gf(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>yf(n)+yf(e[r])))}function yf(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function wf(e){return(e?e.ownerDocument:document).body.offsetHeight}function Vw(e,t,n){const r=e[Ji];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const bf=Symbol("_vod"),zw=Symbol("_vsh"),Gw=Symbol(""),Kw=/(?:^|;)\s*display\s*:/;function Yw(e,t,n){const r=e.style,o=tn(n);let a=!1;if(n&&!o){if(t)if(tn(t))for(const s of t.split(";")){const u=s.slice(0,s.indexOf(":")).trim();n[u]==null&&$i(r,u,"")}else for(const s in t)n[s]==null&&$i(r,s,"");for(const s in n){s==="display"&&(a=!0);const u=n[s];u!=null?Qw(e,s,!tn(t)&&t?t[s]:void 0,u)||$i(r,s,u):$i(r,s,"")}}else if(o){if(t!==n){const s=r[Gw];s&&(n+=";"+s),r.cssText=n,a=Kw.test(n)}}else t&&e.removeAttribute("style");bf in e&&(e[bf]=a?r.display:"",e[zw]&&(r.display="none"))}const _f=/\s*!important$/;function $i(e,t,n){if(at(n))n.forEach(r=>$i(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=Jw(e,t);_f.test(n)?e.setProperty(ts(r),n.replace(_f,""),"important"):e[r]=n}}const Tf=["Webkit","Moz","ms"],Bu={};function Jw(e,t){const n=Bu[t];if(n)return n;let r=vr(t);if(r!=="filter"&&r in e)return Bu[t]=r;r=Xl(r);for(let o=0;o<Tf.length;o++){const a=Tf[o]+r;if(a in e)return Bu[t]=a}return t}function Qw(e,t,n,r){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&tn(r)&&n===r}const kf="http://www.w3.org/1999/xlink";function Cf(e,t,n,r,o,a=Kg(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(kf,t.slice(6,t.length)):e.setAttributeNS(kf,t,n):n==null||a&&!op(n)?e.removeAttribute(t):e.setAttribute(t,a?"":Ao(n)?String(n):n)}function Sf(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?um(n):n);return}const a=e.tagName;if(t==="value"&&a!=="PROGRESS"&&!a.includes("-")){const u=a==="OPTION"?e.getAttribute("value")||"":e.value,c=n==null?e.type==="checkbox"?"on":"":String(n);(u!==c||!("_value"in e))&&(e.value=c),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const u=typeof e[t];u==="boolean"?n=op(n):n==null&&u==="string"?(n="",s=!0):u==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(o||t)}function Qa(e,t,n,r){e.addEventListener(t,n,r)}function Xw(e,t,n,r){e.removeEventListener(t,n,r)}const xf=Symbol("_vei");function Zw(e,t,n,r,o=null){const a=e[xf]||(e[xf]={}),s=a[t];if(r&&s)s.value=r;else{const[u,c]=eb(t);if(r){const m=a[t]=rb(r,o);Qa(e,u,m,c)}else s&&(Xw(e,u,s,c),a[t]=void 0)}}const Af=/(?:Once|Passive|Capture)$/;function eb(e){let t;if(Af.test(e)){t={};let r;for(;r=e.match(Af);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):ts(e.slice(2)),t]}let qu=0;const tb=Promise.resolve(),nb=()=>qu||(tb.then(()=>qu=0),qu=Date.now());function rb(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Io(ob(r,n.value),t,5,[r])};return n.value=e,n.attached=nb(),n}function ob(e,t){if(at(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>o=>!o._stopped&&r&&r(o))}else return t}const Ef=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,ab=(e,t,n,r,o,a)=>{const s=o==="svg";t==="class"?Vw(e,r,s):t==="style"?Yw(e,n,r):Yl(t)?Jl(t)||Zw(e,t,n,r,a):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):sb(e,t,r,s))?(Sf(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Cf(e,t,r,s,a,t!=="value")):e._isVueCE&&(ib(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!tn(r)))?Sf(e,vr(t),r,a,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Cf(e,t,r,s))};function sb(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ef(t)&&dt(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return Ef(t)&&tn(n)?!1:t in e}function ib(e,t){const n=e._def.props;if(!n)return!1;const r=vr(t);return Array.isArray(n)?n.some(o=>vr(o)===r):Object.keys(n).some(o=>vr(o)===r)}const ai=e=>{const t=e.props["onUpdate:modelValue"]||!1;return at(t)?n=>$l(t,n):t};function lb(e){e.target.composing=!0}function If(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const wa=Symbol("_assign");function Pf(e,t,n){return t&&(e=e.trim()),n&&(e=Zl(e)),e}const Yt={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[wa]=ai(o);const a=r||o.props&&o.props.type==="number";Qa(e,t?"change":"input",s=>{s.target.composing||e[wa](Pf(e.value,n,a))}),(n||a)&&Qa(e,"change",()=>{e.value=Pf(e.value,n,a)}),t||(Qa(e,"compositionstart",lb),Qa(e,"compositionend",If),Qa(e,"change",If))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:a}},s){if(e[wa]=ai(s),e.composing)return;const u=(a||e.type==="number")&&!/^0\d/.test(e.value)?Zl(e.value):e.value,c=t??"";if(u===c)return;const m=e.getRootNode();(m instanceof Document||m instanceof ShadowRoot)&&m.activeElement===e&&e.type!=="range"&&(r&&t===n||o&&e.value.trim()===c)||(e.value=c)}},ub={deep:!0,created(e,t,n){e[wa]=ai(n),Qa(e,"change",()=>{const r=e._modelValue,o=Qi(e),a=e.checked,s=e[wa];if(at(r)){const u=qc(r,o),c=u!==-1;if(a&&!c)s(r.concat(o));else if(!a&&c){const m=[...r];m.splice(u,1),s(m)}}else if(ci(r)){const u=new Set(r);a?u.add(o):u.delete(o),s(u)}else s(fm(e,a))})},mounted:Rf,beforeUpdate(e,t,n){e[wa]=ai(n),Rf(e,t,n)}};function Rf(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(at(t))o=qc(t,r.props.value)>-1;else if(ci(t))o=t.has(r.props.value);else{if(t===n)return;o=di(t,fm(e,!0))}e.checked!==o&&(e.checked=o)}const Hu={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const o=ci(t);Qa(e,"change",()=>{const a=Array.prototype.filter.call(e.options,s=>s.selected).map(s=>n?Zl(Qi(s)):Qi(s));e[wa](e.multiple?o?new Set(a):a:a[0]),e._assigning=!0,Ht(()=>{e._assigning=!1})}),e[wa]=ai(r)},mounted(e,{value:t}){Mf(e,t)},beforeUpdate(e,t,n){e[wa]=ai(n)},updated(e,{value:t}){e._assigning||Mf(e,t)}};function Mf(e,t){const n=e.multiple,r=at(t);if(!(n&&!r&&!ci(t))){for(let o=0,a=e.options.length;o<a;o++){const s=e.options[o],u=Qi(s);if(n)if(r){const c=typeof u;c==="string"||c==="number"?s.selected=t.some(m=>String(m)===String(u)):s.selected=qc(t,u)>-1}else s.selected=t.has(u);else if(di(Qi(s),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Qi(e){return"_value"in e?e._value:e.value}function fm(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const cb=["ctrl","shift","alt","meta"],db={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)=>cb.some(n=>e[`${n}Key`]&&!t.includes(n))},Xe=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((o,...a)=>{for(let s=0;s<t.length;s++){const u=db[t[s]];if(u&&u(o,t))return}return e(o,...a)}))},fb={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},on=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(o=>{if(!("key"in o))return;const a=ts(o.key);if(t.some(s=>s===a||fb[s]===a))return e(o)}))},hb=Rn({patchProp:ab},Dw);let $f;function pb(){return $f||($f=yw(hb))}const mb=((...e)=>{const t=pb().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=gb(r);if(!o)return;const a=t._component;!dt(a)&&!a.render&&!a.template&&(a.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,vb(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t});function vb(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function gb(e){return tn(e)?document.querySelector(e):e}const yb="modulepreload",wb=function(e){return"/"+e},jf={},Ei=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let s=function(m){return Promise.all(m.map(f=>Promise.resolve(f).then(w=>({status:"fulfilled",value:w}),w=>({status:"rejected",reason:w}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),c=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));o=s(n.map(m=>{if(m=wb(m),m in jf)return;jf[m]=!0;const f=m.endsWith(".css"),w=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${w}`))return;const _=document.createElement("link");if(_.rel=f?"stylesheet":yb,f||(_.as="script"),_.crossOrigin="",_.href=m,c&&_.setAttribute("nonce",c),document.head.appendChild(_),f)return new Promise((P,q)=>{_.addEventListener("load",P),_.addEventListener("error",()=>q(new Error(`Unable to preload CSS for ${m}`)))})}))}function a(s){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=s,window.dispatchEvent(u),!u.defaultPrevented)throw s}return o.then(s=>{for(const u of s||[])u.status==="rejected"&&a(u.reason);return t().catch(a)})};/*!
|
|
19
|
+
* vue-router v4.6.4
|
|
20
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
21
|
+
* @license MIT
|
|
22
|
+
*/const qs=typeof document<"u";function hm(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function bb(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&hm(e.default)}const $t=Object.assign;function Wu(e,t){const n={};for(const r in t){const o=t[r];n[r]=Po(o)?o.map(e):e(o)}return n}const qi=()=>{},Po=Array.isArray;function Nf(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const pm=/#/g,_b=/&/g,Tb=/\//g,kb=/=/g,Cb=/\?/g,mm=/\+/g,Sb=/%5B/g,xb=/%5D/g,vm=/%5E/g,Ab=/%60/g,gm=/%7B/g,Eb=/%7C/g,ym=/%7D/g,Ib=/%20/g;function ad(e){return e==null?"":encodeURI(""+e).replace(Eb,"|").replace(Sb,"[").replace(xb,"]")}function Pb(e){return ad(e).replace(gm,"{").replace(ym,"}").replace(vm,"^")}function kc(e){return ad(e).replace(mm,"%2B").replace(Ib,"+").replace(pm,"%23").replace(_b,"%26").replace(Ab,"`").replace(gm,"{").replace(ym,"}").replace(vm,"^")}function Rb(e){return kc(e).replace(kb,"%3D")}function Mb(e){return ad(e).replace(pm,"%23").replace(Cb,"%3F")}function $b(e){return Mb(e).replace(Tb,"%2F")}function Xi(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const jb=/\/$/,Nb=e=>e.replace(jb,"");function Vu(e,t,n="/"){let r,o={},a="",s="";const u=t.indexOf("#");let c=t.indexOf("?");return c=u>=0&&c>u?-1:c,c>=0&&(r=t.slice(0,c),a=t.slice(c,u>0?u:t.length),o=e(a.slice(1))),u>=0&&(r=r||t.slice(0,u),s=t.slice(u,t.length)),r=Fb(r??t,n),{fullPath:r+a+s,path:r,query:o,hash:Xi(s)}}function Lb(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Lf(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Ob(e,t,n){const r=t.matched.length-1,o=n.matched.length-1;return r>-1&&r===o&&si(t.matched[r],n.matched[o])&&wm(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function si(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function wm(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Db(e[n],t[n]))return!1;return!0}function Db(e,t){return Po(e)?Of(e,t):Po(t)?Of(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Of(e,t){return Po(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Fb(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),o=r[r.length-1];(o===".."||o===".")&&r.push("");let a=n.length-1,s,u;for(s=0;s<r.length;s++)if(u=r[s],u!==".")if(u==="..")a>1&&a--;else break;return n.slice(0,a).join("/")+"/"+r.slice(s).join("/")}const Va={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Cc=(function(e){return e.pop="pop",e.push="push",e})({}),zu=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Ub(e){if(!e)if(qs){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Nb(e)}const Bb=/^[^#]+#/;function qb(e,t){return e.replace(Bb,"#")+t}function Hb(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const lu=()=>({left:window.scrollX,top:window.scrollY});function Wb(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),o=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!o)return;t=Hb(o,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function Df(e,t){return(history.state?history.state.position-t:-1)+e}const Sc=new Map;function Vb(e,t){Sc.set(e,t)}function zb(e){const t=Sc.get(e);return Sc.delete(e),t}function Gb(e){return typeof e=="string"||e&&typeof e=="object"}function bm(e){return typeof e=="string"||typeof e=="symbol"}let vn=(function(e){return e[e.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",e[e.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",e[e.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",e[e.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",e[e.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",e})({});const _m=Symbol("");vn.MATCHER_NOT_FOUND+"",vn.NAVIGATION_GUARD_REDIRECT+"",vn.NAVIGATION_ABORTED+"",vn.NAVIGATION_CANCELLED+"",vn.NAVIGATION_DUPLICATED+"";function ii(e,t){return $t(new Error,{type:e,[_m]:!0},t)}function ha(e,t){return e instanceof Error&&_m in e&&(t==null||!!(e.type&t))}const Kb=["params","query","hash"];function Yb(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Kb)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Jb(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<n.length;++r){const o=n[r].replace(mm," "),a=o.indexOf("="),s=Xi(a<0?o:o.slice(0,a)),u=a<0?null:Xi(o.slice(a+1));if(s in t){let c=t[s];Po(c)||(c=t[s]=[c]),c.push(u)}else t[s]=u}return t}function Ff(e){let t="";for(let n in e){const r=e[n];if(n=Rb(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(Po(r)?r.map(o=>o&&kc(o)):[r&&kc(r)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+n,o!=null&&(t+="="+o))})}return t}function Qb(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=Po(r)?r.map(o=>o==null?null:""+o):r==null?r:""+r)}return t}const Xb=Symbol(""),Uf=Symbol(""),uu=Symbol(""),sd=Symbol(""),xc=Symbol("");function Ii(){let e=[];function t(r){return e.push(r),()=>{const o=e.indexOf(r);o>-1&&e.splice(o,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Ya(e,t,n,r,o,a=s=>s()){const s=r&&(r.enterCallbacks[o]=r.enterCallbacks[o]||[]);return()=>new Promise((u,c)=>{const m=_=>{_===!1?c(ii(vn.NAVIGATION_ABORTED,{from:n,to:t})):_ instanceof Error?c(_):Gb(_)?c(ii(vn.NAVIGATION_GUARD_REDIRECT,{from:t,to:_})):(s&&r.enterCallbacks[o]===s&&typeof _=="function"&&s.push(_),u())},f=a(()=>e.call(r&&r.instances[o],t,n,m));let w=Promise.resolve(f);e.length<3&&(w=w.then(m)),w.catch(_=>c(_))})}function Gu(e,t,n,r,o=a=>a()){const a=[];for(const s of e)for(const u in s.components){let c=s.components[u];if(!(t!=="beforeRouteEnter"&&!s.instances[u]))if(hm(c)){const m=(c.__vccOpts||c)[t];m&&a.push(Ya(m,n,r,s,u,o))}else{let m=c();a.push(()=>m.then(f=>{if(!f)throw new Error(`Couldn't resolve component "${u}" at "${s.path}"`);const w=bb(f)?f.default:f;s.mods[u]=f,s.components[u]=w;const _=(w.__vccOpts||w)[t];return _&&Ya(_,n,r,s,u,o)()}))}}return a}function Zb(e,t){const n=[],r=[],o=[],a=Math.max(t.matched.length,e.matched.length);for(let s=0;s<a;s++){const u=t.matched[s];u&&(e.matched.find(m=>si(m,u))?r.push(u):n.push(u));const c=e.matched[s];c&&(t.matched.find(m=>si(m,c))||o.push(c))}return[n,r,o]}/*!
|
|
23
|
+
* vue-router v4.6.4
|
|
24
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
25
|
+
* @license MIT
|
|
26
|
+
*/let e0=()=>location.protocol+"//"+location.host;function Tm(e,t){const{pathname:n,search:r,hash:o}=t,a=e.indexOf("#");if(a>-1){let s=o.includes(e.slice(a))?e.slice(a).length:1,u=o.slice(s);return u[0]!=="/"&&(u="/"+u),Lf(u,"")}return Lf(n,e)+r+o}function t0(e,t,n,r){let o=[],a=[],s=null;const u=({state:_})=>{const P=Tm(e,location),q=n.value,O=t.value;let te=0;if(_){if(n.value=P,t.value=_,s&&s===q){s=null;return}te=O?_.position-O.position:0}else r(P);o.forEach(F=>{F(n.value,q,{delta:te,type:Cc.pop,direction:te?te>0?zu.forward:zu.back:zu.unknown})})};function c(){s=n.value}function m(_){o.push(_);const P=()=>{const q=o.indexOf(_);q>-1&&o.splice(q,1)};return a.push(P),P}function f(){if(document.visibilityState==="hidden"){const{history:_}=window;if(!_.state)return;_.replaceState($t({},_.state,{scroll:lu()}),"")}}function w(){for(const _ of a)_();a=[],window.removeEventListener("popstate",u),window.removeEventListener("pagehide",f),document.removeEventListener("visibilitychange",f)}return window.addEventListener("popstate",u),window.addEventListener("pagehide",f),document.addEventListener("visibilitychange",f),{pauseListeners:c,listen:m,destroy:w}}function Bf(e,t,n,r=!1,o=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:o?lu():null}}function n0(e){const{history:t,location:n}=window,r={value:Tm(e,n)},o={value:t.state};o.value||a(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(c,m,f){const w=e.indexOf("#"),_=w>-1?(n.host&&document.querySelector("base")?e:e.slice(w))+c:e0()+e+c;try{t[f?"replaceState":"pushState"](m,"",_),o.value=m}catch(P){console.error(P),n[f?"replace":"assign"](_)}}function s(c,m){a(c,$t({},t.state,Bf(o.value.back,c,o.value.forward,!0),m,{position:o.value.position}),!0),r.value=c}function u(c,m){const f=$t({},o.value,t.state,{forward:c,scroll:lu()});a(f.current,f,!0),a(c,$t({},Bf(r.value,c,null),{position:f.position+1},m),!1),r.value=c}return{location:r,state:o,push:u,replace:s}}function r0(e){e=Ub(e);const t=n0(e),n=t0(e,t.state,t.location,t.replace);function r(a,s=!0){s||n.pauseListeners(),history.go(a)}const o=$t({location:"",base:e,go:r,createHref:qb.bind(null,e)},t,n);return Object.defineProperty(o,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(o,"state",{enumerable:!0,get:()=>t.state.value}),o}function o0(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),r0(e)}let Ts=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var In=(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})(In||{});const a0={type:Ts.Static,value:""},s0=/[a-zA-Z0-9_]/;function i0(e){if(!e)return[[]];if(e==="/")return[[a0]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(P){throw new Error(`ERR (${n})/"${m}": ${P}`)}let n=In.Static,r=n;const o=[];let a;function s(){a&&o.push(a),a=[]}let u=0,c,m="",f="";function w(){m&&(n===In.Static?a.push({type:Ts.Static,value:m}):n===In.Param||n===In.ParamRegExp||n===In.ParamRegExpEnd?(a.length>1&&(c==="*"||c==="+")&&t(`A repeatable param (${m}) must be alone in its segment. eg: '/:ids+.`),a.push({type:Ts.Param,value:m,regexp:f,repeatable:c==="*"||c==="+",optional:c==="*"||c==="?"})):t("Invalid state to consume buffer"),m="")}function _(){m+=c}for(;u<e.length;){if(c=e[u++],c==="\\"&&n!==In.ParamRegExp){r=n,n=In.EscapeNext;continue}switch(n){case In.Static:c==="/"?(m&&w(),s()):c===":"?(w(),n=In.Param):_();break;case In.EscapeNext:_(),n=r;break;case In.Param:c==="("?n=In.ParamRegExp:s0.test(c)?_():(w(),n=In.Static,c!=="*"&&c!=="?"&&c!=="+"&&u--);break;case In.ParamRegExp:c===")"?f[f.length-1]=="\\"?f=f.slice(0,-1)+c:n=In.ParamRegExpEnd:f+=c;break;case In.ParamRegExpEnd:w(),n=In.Static,c!=="*"&&c!=="?"&&c!=="+"&&u--,f="";break;default:t("Unknown state");break}}return n===In.ParamRegExp&&t(`Unfinished custom RegExp for param "${m}"`),w(),s(),o}const qf="[^/]+?",l0={sensitive:!1,strict:!1,start:!0,end:!0};var hr=(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})(hr||{});const u0=/[.+*?^${}()[\]/\\]/g;function c0(e,t){const n=$t({},l0,t),r=[];let o=n.start?"^":"";const a=[];for(const m of e){const f=m.length?[]:[hr.Root];n.strict&&!m.length&&(o+="/");for(let w=0;w<m.length;w++){const _=m[w];let P=hr.Segment+(n.sensitive?hr.BonusCaseSensitive:0);if(_.type===Ts.Static)w||(o+="/"),o+=_.value.replace(u0,"\\$&"),P+=hr.Static;else if(_.type===Ts.Param){const{value:q,repeatable:O,optional:te,regexp:F}=_;a.push({name:q,repeatable:O,optional:te});const U=F||qf;if(U!==qf){P+=hr.BonusCustomRegExp;try{`${U}`}catch(Y){throw new Error(`Invalid custom RegExp for param "${q}" (${U}): `+Y.message)}}let G=O?`((?:${U})(?:/(?:${U}))*)`:`(${U})`;w||(G=te&&m.length<2?`(?:/${G})`:"/"+G),te&&(G+="?"),o+=G,P+=hr.Dynamic,te&&(P+=hr.BonusOptional),O&&(P+=hr.BonusRepeatable),U===".*"&&(P+=hr.BonusWildcard)}f.push(P)}r.push(f)}if(n.strict&&n.end){const m=r.length-1;r[m][r[m].length-1]+=hr.BonusStrict}n.strict||(o+="/?"),n.end?o+="$":n.strict&&!o.endsWith("/")&&(o+="(?:/|$)");const s=new RegExp(o,n.sensitive?"":"i");function u(m){const f=m.match(s),w={};if(!f)return null;for(let _=1;_<f.length;_++){const P=f[_]||"",q=a[_-1];w[q.name]=P&&q.repeatable?P.split("/"):P}return w}function c(m){let f="",w=!1;for(const _ of e){(!w||!f.endsWith("/"))&&(f+="/"),w=!1;for(const P of _)if(P.type===Ts.Static)f+=P.value;else if(P.type===Ts.Param){const{value:q,repeatable:O,optional:te}=P,F=q in m?m[q]:"";if(Po(F)&&!O)throw new Error(`Provided param "${q}" is an array but it is not repeatable (* or + modifiers)`);const U=Po(F)?F.join("/"):F;if(!U)if(te)_.length<2&&(f.endsWith("/")?f=f.slice(0,-1):w=!0);else throw new Error(`Missing required param "${q}"`);f+=U}}return f||"/"}return{re:s,score:r,keys:a,parse:u,stringify:c}}function d0(e,t){let n=0;for(;n<e.length&&n<t.length;){const r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?e.length===1&&e[0]===hr.Static+hr.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===hr.Static+hr.Segment?1:-1:0}function km(e,t){let n=0;const r=e.score,o=t.score;for(;n<r.length&&n<o.length;){const a=d0(r[n],o[n]);if(a)return a;n++}if(Math.abs(o.length-r.length)===1){if(Hf(r))return 1;if(Hf(o))return-1}return o.length-r.length}function Hf(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const f0={strict:!1,end:!0,sensitive:!1};function h0(e,t,n){const r=c0(i0(e.path),n),o=$t(r,{record:e,parent:t,children:[],alias:[]});return t&&!o.record.aliasOf==!t.record.aliasOf&&t.children.push(o),o}function p0(e,t){const n=[],r=new Map;t=Nf(f0,t);function o(w){return r.get(w)}function a(w,_,P){const q=!P,O=Vf(w);O.aliasOf=P&&P.record;const te=Nf(t,w),F=[O];if("alias"in w){const Y=typeof w.alias=="string"?[w.alias]:w.alias;for(const Te of Y)F.push(Vf($t({},O,{components:P?P.record.components:O.components,path:Te,aliasOf:P?P.record:O})))}let U,G;for(const Y of F){const{path:Te}=Y;if(_&&Te[0]!=="/"){const Me=_.record.path,ae=Me[Me.length-1]==="/"?"":"/";Y.path=_.record.path+(Te&&ae+Te)}if(U=h0(Y,_,te),P?P.alias.push(U):(G=G||U,G!==U&&G.alias.push(U),q&&w.name&&!zf(U)&&s(w.name)),Cm(U)&&c(U),O.children){const Me=O.children;for(let ae=0;ae<Me.length;ae++)a(Me[ae],U,P&&P.children[ae])}P=P||U}return G?()=>{s(G)}:qi}function s(w){if(bm(w)){const _=r.get(w);_&&(r.delete(w),n.splice(n.indexOf(_),1),_.children.forEach(s),_.alias.forEach(s))}else{const _=n.indexOf(w);_>-1&&(n.splice(_,1),w.record.name&&r.delete(w.record.name),w.children.forEach(s),w.alias.forEach(s))}}function u(){return n}function c(w){const _=g0(w,n);n.splice(_,0,w),w.record.name&&!zf(w)&&r.set(w.record.name,w)}function m(w,_){let P,q={},O,te;if("name"in w&&w.name){if(P=r.get(w.name),!P)throw ii(vn.MATCHER_NOT_FOUND,{location:w});te=P.record.name,q=$t(Wf(_.params,P.keys.filter(G=>!G.optional).concat(P.parent?P.parent.keys.filter(G=>G.optional):[]).map(G=>G.name)),w.params&&Wf(w.params,P.keys.map(G=>G.name))),O=P.stringify(q)}else if(w.path!=null)O=w.path,P=n.find(G=>G.re.test(O)),P&&(q=P.parse(O),te=P.record.name);else{if(P=_.name?r.get(_.name):n.find(G=>G.re.test(_.path)),!P)throw ii(vn.MATCHER_NOT_FOUND,{location:w,currentLocation:_});te=P.record.name,q=$t({},_.params,w.params),O=P.stringify(q)}const F=[];let U=P;for(;U;)F.unshift(U.record),U=U.parent;return{name:te,path:O,params:q,matched:F,meta:v0(F)}}e.forEach(w=>a(w));function f(){n.length=0,r.clear()}return{addRoute:a,resolve:m,removeRoute:s,clearRoutes:f,getRoutes:u,getRecordMatcher:o}}function Wf(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Vf(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:m0(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 m0(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function zf(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function v0(e){return e.reduce((t,n)=>$t(t,n.meta),{})}function g0(e,t){let n=0,r=t.length;for(;n!==r;){const a=n+r>>1;km(e,t[a])<0?r=a:n=a+1}const o=y0(e);return o&&(r=t.lastIndexOf(o,r-1)),r}function y0(e){let t=e;for(;t=t.parent;)if(Cm(t)&&km(e,t)===0)return t}function Cm({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Gf(e){const t=xo(uu),n=xo(sd),r=Z(()=>{const c=S(e.to);return t.resolve(c)}),o=Z(()=>{const{matched:c}=r.value,{length:m}=c,f=c[m-1],w=n.matched;if(!f||!w.length)return-1;const _=w.findIndex(si.bind(null,f));if(_>-1)return _;const P=Kf(c[m-2]);return m>1&&Kf(f)===P&&w[w.length-1].path!==P?w.findIndex(si.bind(null,c[m-2])):_}),a=Z(()=>o.value>-1&&k0(n.params,r.value.params)),s=Z(()=>o.value>-1&&o.value===n.matched.length-1&&wm(n.params,r.value.params));function u(c={}){if(T0(c)){const m=t[S(e.replace)?"replace":"push"](S(e.to)).catch(qi);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>m),m}return Promise.resolve()}return{route:r,href:Z(()=>r.value.href),isActive:a,isExactActive:s,navigate:u}}function w0(e){return e.length===1?e[0]:e}const b0=Jn({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:Gf,setup(e,{slots:t}){const n=nu(Gf(e)),{options:r}=xo(uu),o=Z(()=>({[Yf(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Yf(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&w0(t.default(n));return e.custom?a:od("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:o.value},a)}}}),_0=b0;function T0(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 k0(e,t){for(const n in t){const r=t[n],o=e[n];if(typeof r=="string"){if(r!==o)return!1}else if(!Po(o)||o.length!==r.length||r.some((a,s)=>a.valueOf()!==o[s].valueOf()))return!1}return!0}function Kf(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Yf=(e,t,n)=>e??t??n,C0=Jn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=xo(xc),o=Z(()=>e.route||r.value),a=xo(Uf,0),s=Z(()=>{let m=S(a);const{matched:f}=o.value;let w;for(;(w=f[m])&&!w.components;)m++;return m}),u=Z(()=>o.value.matched[s.value]);jl(Uf,Z(()=>s.value+1)),jl(Xb,u),jl(xc,o);const c=x();return ht(()=>[c.value,u.value,e.name],([m,f,w],[_,P,q])=>{f&&(f.instances[w]=m,P&&P!==f&&m&&m===_&&(f.leaveGuards.size||(f.leaveGuards=P.leaveGuards),f.updateGuards.size||(f.updateGuards=P.updateGuards))),m&&f&&(!P||!si(f,P)||!_)&&(f.enterCallbacks[w]||[]).forEach(O=>O(m))},{flush:"post"}),()=>{const m=o.value,f=e.name,w=u.value,_=w&&w.components[f];if(!_)return Jf(n.default,{Component:_,route:m});const P=w.props[f],q=P?P===!0?m.params:typeof P=="function"?P(m):P:null,te=od(_,$t({},q,t,{onVnodeUnmounted:F=>{F.component.isUnmounted&&(w.instances[f]=null)},ref:c}));return Jf(n.default,{Component:te,route:m})||te}}});function Jf(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const S0=C0;function x0(e){const t=p0(e.routes,e),n=e.parseQuery||Jb,r=e.stringifyQuery||Ff,o=e.history,a=Ii(),s=Ii(),u=Ii(),c=gy(Va);let m=Va;qs&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const f=Wu.bind(null,X=>""+X),w=Wu.bind(null,$b),_=Wu.bind(null,Xi);function P(X,ke){let pe,xe;return bm(X)?(pe=t.getRecordMatcher(X),xe=ke):xe=X,t.addRoute(xe,pe)}function q(X){const ke=t.getRecordMatcher(X);ke&&t.removeRoute(ke)}function O(){return t.getRoutes().map(X=>X.record)}function te(X){return!!t.getRecordMatcher(X)}function F(X,ke){if(ke=$t({},ke||c.value),typeof X=="string"){const V=Vu(n,X,ke.path),se=t.resolve({path:V.path},ke),ce=o.createHref(V.fullPath);return $t(V,se,{params:_(se.params),hash:Xi(V.hash),redirectedFrom:void 0,href:ce})}let pe;if(X.path!=null)pe=$t({},X,{path:Vu(n,X.path,ke.path).path});else{const V=$t({},X.params);for(const se in V)V[se]==null&&delete V[se];pe=$t({},X,{params:w(V)}),ke.params=w(ke.params)}const xe=t.resolve(pe,ke),Ve=X.hash||"";xe.params=f(_(xe.params));const E=Lb(r,$t({},X,{hash:Pb(Ve),path:xe.path})),$=o.createHref(E);return $t({fullPath:E,hash:Ve,query:r===Ff?Qb(X.query):X.query||{}},xe,{redirectedFrom:void 0,href:$})}function U(X){return typeof X=="string"?Vu(n,X,c.value.path):$t({},X)}function G(X,ke){if(m!==X)return ii(vn.NAVIGATION_CANCELLED,{from:ke,to:X})}function Y(X){return ae(X)}function Te(X){return Y($t(U(X),{replace:!0}))}function Me(X,ke){const pe=X.matched[X.matched.length-1];if(pe&&pe.redirect){const{redirect:xe}=pe;let Ve=typeof xe=="function"?xe(X,ke):xe;return typeof Ve=="string"&&(Ve=Ve.includes("?")||Ve.includes("#")?Ve=U(Ve):{path:Ve},Ve.params={}),$t({query:X.query,hash:X.hash,params:Ve.path!=null?{}:X.params},Ve)}}function ae(X,ke){const pe=m=F(X),xe=c.value,Ve=X.state,E=X.force,$=X.replace===!0,V=Me(pe,xe);if(V)return ae($t(U(V),{state:typeof V=="object"?$t({},Ve,V.state):Ve,force:E,replace:$}),ke||pe);const se=pe;se.redirectedFrom=ke;let ce;return!E&&Ob(r,xe,pe)&&(ce=ii(vn.NAVIGATION_DUPLICATED,{to:se,from:xe}),et(xe,xe,!0,!1)),(ce?Promise.resolve(ce):be(se,xe)).catch(ie=>ha(ie)?ha(ie,vn.NAVIGATION_GUARD_REDIRECT)?ie:je(ie):Ie(ie,se,xe)).then(ie=>{if(ie){if(ha(ie,vn.NAVIGATION_GUARD_REDIRECT))return ae($t({replace:$},U(ie.to),{state:typeof ie.to=="object"?$t({},Ve,ie.to.state):Ve,force:E}),ke||se)}else ie=ne(se,xe,!0,$,Ve);return Ce(se,xe,ie),ie})}function Se(X,ke){const pe=G(X,ke);return pe?Promise.reject(pe):Promise.resolve()}function K(X){const ke=nt.values().next().value;return ke&&typeof ke.runWithContext=="function"?ke.runWithContext(X):X()}function be(X,ke){let pe;const[xe,Ve,E]=Zb(X,ke);pe=Gu(xe.reverse(),"beforeRouteLeave",X,ke);for(const V of xe)V.leaveGuards.forEach(se=>{pe.push(Ya(se,X,ke))});const $=Se.bind(null,X,ke);return pe.push($),vt(pe).then(()=>{pe=[];for(const V of a.list())pe.push(Ya(V,X,ke));return pe.push($),vt(pe)}).then(()=>{pe=Gu(Ve,"beforeRouteUpdate",X,ke);for(const V of Ve)V.updateGuards.forEach(se=>{pe.push(Ya(se,X,ke))});return pe.push($),vt(pe)}).then(()=>{pe=[];for(const V of E)if(V.beforeEnter)if(Po(V.beforeEnter))for(const se of V.beforeEnter)pe.push(Ya(se,X,ke));else pe.push(Ya(V.beforeEnter,X,ke));return pe.push($),vt(pe)}).then(()=>(X.matched.forEach(V=>V.enterCallbacks={}),pe=Gu(E,"beforeRouteEnter",X,ke,K),pe.push($),vt(pe))).then(()=>{pe=[];for(const V of s.list())pe.push(Ya(V,X,ke));return pe.push($),vt(pe)}).catch(V=>ha(V,vn.NAVIGATION_CANCELLED)?V:Promise.reject(V))}function Ce(X,ke,pe){u.list().forEach(xe=>K(()=>xe(X,ke,pe)))}function ne(X,ke,pe,xe,Ve){const E=G(X,ke);if(E)return E;const $=ke===Va,V=qs?history.state:{};pe&&(xe||$?o.replace(X.fullPath,$t({scroll:$&&V&&V.scroll},Ve)):o.push(X.fullPath,Ve)),c.value=X,et(X,ke,pe,$),je()}let Ae;function We(){Ae||(Ae=o.listen((X,ke,pe)=>{if(!Ye.listening)return;const xe=F(X),Ve=Me(xe,Ye.currentRoute.value);if(Ve){ae($t(Ve,{replace:!0,force:!0}),xe).catch(qi);return}m=xe;const E=c.value;qs&&Vb(Df(E.fullPath,pe.delta),lu()),be(xe,E).catch($=>ha($,vn.NAVIGATION_ABORTED|vn.NAVIGATION_CANCELLED)?$:ha($,vn.NAVIGATION_GUARD_REDIRECT)?(ae($t(U($.to),{force:!0}),xe).then(V=>{ha(V,vn.NAVIGATION_ABORTED|vn.NAVIGATION_DUPLICATED)&&!pe.delta&&pe.type===Cc.pop&&o.go(-1,!1)}).catch(qi),Promise.reject()):(pe.delta&&o.go(-pe.delta,!1),Ie($,xe,E))).then($=>{$=$||ne(xe,E,!1),$&&(pe.delta&&!ha($,vn.NAVIGATION_CANCELLED)?o.go(-pe.delta,!1):pe.type===Cc.pop&&ha($,vn.NAVIGATION_ABORTED|vn.NAVIGATION_DUPLICATED)&&o.go(-1,!1)),Ce(xe,E,$)}).catch(qi)}))}let qe=Ii(),Be=Ii(),Ee;function Ie(X,ke,pe){je(X);const xe=Be.list();return xe.length?xe.forEach(Ve=>Ve(X,ke,pe)):console.error(X),Promise.reject(X)}function Ze(){return Ee&&c.value!==Va?Promise.resolve():new Promise((X,ke)=>{qe.add([X,ke])})}function je(X){return Ee||(Ee=!X,We(),qe.list().forEach(([ke,pe])=>X?pe(X):ke()),qe.reset()),X}function et(X,ke,pe,xe){const{scrollBehavior:Ve}=e;if(!qs||!Ve)return Promise.resolve();const E=!pe&&zb(Df(X.fullPath,0))||(xe||!pe)&&history.state&&history.state.scroll||null;return Ht().then(()=>Ve(X,ke,E)).then($=>$&&Wb($)).catch($=>Ie($,X,ke))}const ze=X=>o.go(X);let ct;const nt=new Set,Ye={currentRoute:c,listening:!0,addRoute:P,removeRoute:q,clearRoutes:t.clearRoutes,hasRoute:te,getRoutes:O,resolve:F,options:e,push:Y,replace:Te,go:ze,back:()=>ze(-1),forward:()=>ze(1),beforeEach:a.add,beforeResolve:s.add,afterEach:u.add,onError:Be.add,isReady:Ze,install(X){X.component("RouterLink",_0),X.component("RouterView",S0),X.config.globalProperties.$router=Ye,Object.defineProperty(X.config.globalProperties,"$route",{enumerable:!0,get:()=>S(c)}),qs&&!ct&&c.value===Va&&(ct=!0,Y(o.location).catch(xe=>{}));const ke={};for(const xe in Va)Object.defineProperty(ke,xe,{get:()=>c.value[xe],enumerable:!0});X.provide(uu,Ye),X.provide(sd,_p(ke)),X.provide(xc,c);const pe=X.unmount;nt.add(X),X.unmount=function(){nt.delete(X),nt.size<1&&(m=Va,Ae&&Ae(),Ae=null,c.value=Va,ct=!1,Ee=!1),pe()}}};function vt(X){return X.reduce((ke,pe)=>ke.then(()=>K(pe)),Promise.resolve())}return Ye}function A0(){return xo(uu)}function E0(e){return xo(sd)}const Qf=768;function id(){const e=x(typeof window<"u"?window.innerWidth<Qf:!1);let t=null;function n(r){e.value=r.matches}return Ca(()=>{t=window.matchMedia(`(max-width: ${Qf-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),ou(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const I0={key:0,class:"desktop-sidebar"},P0={class:"desktop-main"},Xf="codex-web-local.sidebar-width.v1",R0=260,M0=620,Zf=320,$0=Jn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=id();function r(m){return Math.min(M0,Math.max(R0,m))}function o(){if(typeof window>"u")return Zf;const m=window.localStorage.getItem(Xf),f=Number(m);return Number.isFinite(f)?r(f):Zf}const a=x(o()),s=Z(()=>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 u(m){typeof window>"u"||window.localStorage.setItem(Xf,String(m))}function c(m){m.preventDefault();const f=m.clientX,w=a.value,_=q=>{const O=q.clientX-f;a.value=r(w+O)},P=()=>{u(a.value),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",P)};window.addEventListener("mousemove",_),window.addEventListener("mouseup",P)}return(m,f)=>(k(),A("div",{class:Qe(["desktop-layout",{"is-mobile":S(n)}]),style:ya(s.value)},[S(n)?(k(),tt(Xa,{key:0,to:"body"},[Le(dm,{name:"drawer"},{default:mt(()=>[e.isSidebarCollapsed?Q("",!0):(k(),A("div",{key:0,class:"mobile-drawer-backdrop",onClick:f[1]||(f[1]=w=>m.$emit("close-sidebar"))},[h("aside",{class:"mobile-drawer",onClick:f[0]||(f[0]=Xe(()=>{},["stop"]))},[Ko(m.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):Q("",!0),S(n)?Q("",!0):(k(),A(Ke,{key:1},[e.isSidebarCollapsed?Q("",!0):(k(),A("aside",I0,[Ko(m.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?Q("",!0):(k(),A("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:c},null,32))],64)),h("section",P0,[Ko(m.$slots,"content",{},void 0)])],6))}}),xt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n},j0=xt($0,[["__scopeId","data-v-4c6dbcd7"]]);function eh(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Jo extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function oo(e,t){if(typeof e=="string"&&e.length>0)return e;const n=eh(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const o=eh(r);return o&&typeof o.message=="string"&&o.message.length>0?o.message:typeof n.message=="string"&&n.message.length>0?n.message:typeof n.detail=="string"&&n.detail.length>0?n.detail:t}function Ro(e,t,n){return e instanceof Jo?e:e instanceof Error?new Jo(e.message||t,{code:"unknown_error",method:n}):new Jo(t,{code:"unknown_error",method:n})}function Sm(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function N0(e,t){const n={method:e,params:t??null};let r;try{r=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(u){throw new Jo(u instanceof Error?u.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let o=null,a=null;try{a=await r.text(),o=JSON.parse(a)}catch{o=null}if(!r.ok){const u=oo(o,"")||(a==null?void 0:a.slice(0,500))||"",c=`RPC ${e} failed with HTTP ${r.status}`;throw new Jo(u?`${c}: ${u}`:c,{code:"http_error",method:e,status:r.status})}const s=o;if(!s||typeof s!="object"||!("result"in s))throw new Jo(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return s.result}async function L0(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Jo(oo(t,`Method catalog failed with HTTP ${e.status}`),{code:"http_error",method:"meta/methods",status:e.status});const n=t;return Array.isArray(n.data)?n.data:[]}function O0(e){const t=Sm(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 th(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function D0(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const o=()=>{r!==null&&(window.clearTimeout(r),r=null)},a=(m,f)=>{if(n||r!==null)return;const w=Math.min(1e3*2**f,1e4);r=window.setTimeout(()=>{r=null,!n&&m()},w)},s=m=>{const f=O0(m);f&&e(f)},u=(m=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const f=new EventSource("/codex-api/events");let w=!1;f.onmessage=_=>{try{s(JSON.parse(_.data))}catch{}},f.addEventListener("ready",_=>{try{const P=_.data?JSON.parse(_.data):{ok:!0};th(e,P)}catch{th(e)}}),f.onerror=()=>{n||w||f.readyState===EventSource.CLOSED&&(w=!0,f.close(),a(()=>u(m+1),m))},t=()=>{w=!0,f.close()}},c=(m=0)=>{if(typeof WebSocket>"u"||n){u();return}t==null||t();const f=window.location.protocol==="https:"?"wss:":"ws:",w=new WebSocket(`${f}//${window.location.host}/codex-api/ws`);let _=!1,P=!1,q=window.setTimeout(()=>{_||n||P||(P=!0,w.close(),u())},2500);w.onopen=()=>{_=!0,o(),q!==null&&(window.clearTimeout(q),q=null)},w.onmessage=O=>{try{s(JSON.parse(String(O.data)))}catch{}},w.onerror=()=>{},w.onclose=()=>{if(q!==null&&(window.clearTimeout(q),q=null),!(n||P)){if(!_){u();return}a(()=>c(m+1),m)}},t=()=>{P=!0,q!==null&&(window.clearTimeout(q),q=null),w.close()}};return typeof WebSocket<"u"?c():u(),()=>{n=!0,o(),t==null||t()}}async function F0(e){let t;try{t=await fetch("/codex-api/server-requests/respond",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(r){throw new Jo(r instanceof Error?r.message:"Failed to reply to server request",{code:"network_error",method:"server-requests/respond"})}let n=null;try{n=await t.json()}catch{n=null}if(!t.ok)throw new Jo(oo(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function U0(){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 Jo(oo(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Sm(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function B0(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function ot(e){return B0(e)}function xm(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function q0(e){const t=ot(e);return t.startsWith("/")||xm(t)}function H0(e){const t=ot(e).replace(/[\\/]+/gu,"/");return xm(t)?t.toLowerCase():t}function zr(e){const t=ot(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function ei(e){const t=ot(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function no(e){return zr(e)||ot(e)||"Projectless"}function Vl(e){const t=ot(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function nh(e){return new Date(e*1e3).toISOString()}function W0(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const V0=/^##\s+(.+?):\s+(.+?)\s*$/,z0=/^#\s*files mentioned by the user\s*:?\s*$/i;function G0(e){var o,a;const t=e.split(`
|
|
27
|
+
`).findIndex(s=>z0.test(s.trim()));if(t<0)return[];const n=e.split(`
|
|
28
|
+
`).slice(t+1),r=[];for(const s of n){const u=s.trim();if(!u)continue;const c=u.match(V0);if(!c)break;const m=(o=c[1])==null?void 0:o.trim(),f=(a=c[2])==null?void 0:a.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");m&&f&&r.push({label:m,path:f})}return r}function K0(e){const t=/(?:^|\n)\s{0,3}#{0,6}\s*my request for codex\s*:?\s*/giu,n=Array.from(e.matchAll(t));if(n.length===0)return e.trim();const r=n.at(-1);if(!r||typeof r.index!="number")return e.trim();const o=r.index+r[0].length;return e.slice(o).trim()}function Am(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function Y0(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 J0(e){return e.replace(/</giu,"<").replace(/>/giu,">").replace(/&/giu,"&")}function Ku(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?J0(n[1].trim()):""}function Q0(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=Ku(t,"current_time_iso"),r=Ku(t,"instructions");return!n||!r?null:{automationId:Ku(t,"automation_id"),currentTimeIso:n,instructions:r}}function X0(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],r=[],o=[],a=[];for(const[m,f]of t.entries()){if(f.type==="text"&&typeof f.text=="string"&&f.text.length>0&&n.push(f.text),f.type==="image"&&typeof f.url=="string"&&f.url.trim().length>0&&r.push(f.url.trim()),f.type==="localImage"&&typeof f.path=="string"&&f.path.trim().length>0&&r.push(Am(f.path.trim())),f.type==="skill"){const w=typeof f.name=="string"?f.name.trim():"",_=typeof f.path=="string"?f.path.trim():"";w&&_&&o.push({name:w,path:_})}f.type!=="text"&&f.type!=="image"&&f.type!=="localImage"&&f.type!=="skill"&&a.push({id:`${e}:user-content:${m}`,role:"user",text:"",messageType:`userContent.${f.type}`,rawPayload:W0(f),isUnhandled:!0})}const s=n.join(`
|
|
29
|
+
`),u=G0(s),c=Q0(s);return{text:(c==null?void 0:c.instructions)??K0(s),images:r,skills:o,fileAttachments:u,rawBlocks:a,isAutomationRun:c!==null,automationDisplayName:(c==null?void 0:c.automationId)||null}}function Z0(e){var a;const t=e.replace(/\r\n/g,`
|
|
30
|
+
`).trim();if(!t)return null;const n=t.split(`
|
|
31
|
+
`),r=[],o=[];for(const s of n){const u=s.trim();if(!u){r.length===0&&o.push("");continue}const c=u.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(c){const m=(c[1]??" ").toLowerCase(),f=(a=c[2])==null?void 0:a.trim();if(!f)continue;let w="pending";m==="x"&&(w="completed"),(m==="~"||m===">"||m==="-")&&(w="inProgress"),r.push({step:f,status:w});continue}o.push(u)}return r.length===0?null:{explanation:o.join(`
|
|
32
|
+
`).trim()||void 0,steps:r}}function rh(e){if(!e)return 0;const t=e.replace(/\r\n/g,`
|
|
33
|
+
`),n=t.endsWith(`
|
|
34
|
+
`)?t.slice(0,-1):t;return n?n.split(`
|
|
35
|
+
`).length:0}function e_(e){let t=0,n=0;for(const r of e.replace(/\r\n/g,`
|
|
36
|
+
`).split(`
|
|
37
|
+
`))if(r&&!(r.startsWith("+++")||r.startsWith("---")||r.startsWith("@@"))){if(r.startsWith("+")){t+=1;continue}r.startsWith("-")&&(n+=1)}return{addedLineCount:t,removedLineCount:n}}function Em(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function Im(e){const t=Array.isArray(e)?e:[],n=[];for(const r of t){const o=r,a=typeof o.path=="string"?o.path:"",s=typeof o.diff=="string"?o.diff:"",u=o.kind,c=u==null?void 0:u.type;if(!a||c!=="add"&&c!=="delete"&&c!=="update")continue;const m=c==="update"&&typeof(u==null?void 0:u.move_path)=="string"?u.move_path:null,f=c==="update"?e_(s):c==="add"?{addedLineCount:rh(s),removedLineCount:0}:{addedLineCount:0,removedLineCount:rh(s)};n.push({path:a,operation:c,movedToPath:m,diff:s,...f})}return n}function t_(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=X0(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0||t.skills.length>0)&&n.push({id:e.id,role:"user",text:t.text,images:t.images,skills:t.skills.length>0?t.skills:void 0,fileAttachments:t.fileAttachments.length>0?t.fileAttachments:void 0,messageType:e.type,isAutomationRun:t.isAutomationRun,automationDisplayName:t.automationDisplayName}),n.push(...t.rawBlocks),n.length===0?[]:n}if(e.type==="imageView"){const t=typeof e.path=="string"?e.path.trim():"";return t?[{id:e.id,role:"assistant",text:"",images:[Am(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?Y0(t.result):"";return n?[{id:e.id,role:"assistant",text:"",images:[n],messageType:"imageView"}]:[]}}if(e.type==="reasoning")return[];if(e.type==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:Z0(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=n_(t.status),r=typeof t.command=="string"?t.command:"",o=typeof t.cwd=="string"?t.cwd:null,a=typeof t.aggregatedOutput=="string"?t.aggregatedOutput:"",s=typeof t.exitCode=="number"?t.exitCode:null;return[{id:e.id,role:"system",text:r,messageType:"commandExecution",commandExecution:{command:r,cwd:o,status:n,aggregatedOutput:a,exitCode:s}}]}if(e.type==="fileChange"){const t=Im(e.changes),n=Em(e.status);return t.length===0||n!=="completed"?[]:[{id:e.id,role:"system",text:"",messageType:"fileChange",fileChangeStatus:n,fileChanges:t}]}return[]}function n_(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function r_(e){const t=e,n=[t.name,t.title,e.preview];for(const r of n)if(typeof r=="string"&&r.trim().length>0)return r.trim();return""}function o_(e){const t=r_(e);return t.length>0?t:"Untitled thread"}function ld(e){return(e==null?void 0:e.status)==="inProgress"}function a_(e){const t=e;if(t.inProgress===!0||t.status==="inProgress"||t.turnStatus==="inProgress")return!0;const r=(Array.isArray(e.turns)?e.turns:[]).at(-1);return ld(r)}function Pm(e){const t=e,n=ot(typeof t.cwd=="string"?t.cwd:e.cwd),r=H0(n),o=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||r.includes("/.codex/worktrees/")||r.includes("/.git/worktrees/");return{id:e.id,title:o_(e),projectName:no(n),cwd:n,hasWorktree:o,createdAtIso:nh(e.createdAt),updatedAtIso:nh(e.updatedAt),preview:e.preview,unread:!1,inProgress:a_(e)}}function s_(e){return Pm(e.thread)}function i_(e){const t=new Map;for(const n of e){const r=t.get(n.projectName);r?r.push(n):t.set(n.projectName,[n])}return Array.from(t.entries()).map(([n,r])=>({projectName:n,threads:r.sort((o,a)=>new Date(a.updatedAtIso).getTime()-new Date(o.updatedAtIso).getTime())})).sort((n,r)=>{var s,u;const o=new Date(((s=n.threads[0])==null?void 0:s.updatedAtIso)??0).getTime();return new Date(((u=r.threads[0])==null?void 0:u.updatedAtIso)??0).getTime()-o})}function l_(e){const t=e.data.map(Pm);return i_(t)}function ol(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],r=[];for(let o=0;o<n.length;o++){const a=t+o,s=n[o],u=typeof(s==null?void 0:s.id)=="string"?s.id:void 0,c=Array.isArray(s.items)?s.items:[];for(const m of c)for(const f of t_(m))r.push({...f,turnId:u,turnIndex:a})}return r}function ud(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return ld(t.at(-1))}function cd(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];for(let n=t.length-1;n>=0;n-=1){const r=t[n];if(ld(r)&&typeof r.id=="string"&&r.id.trim().length>0)return r.id.trim()}return""}const u_=5e3;function Yu(e){return e&&e.length>0?e:null}function Ju(e){return e&&e.length>0?e:null}let Cl=null,Hi=null;const oh=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function it(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function fe(e){return typeof e=="string"&&e.length>0?e:null}function Pn(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function ro(e){return typeof e=="boolean"?e:null}function Vs(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function c_(e){return e==="payment_required"?e:null}function d_(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function ah(e){const t=it(e);if(!t)return null;const n=Pn(t.usedPercent??t.used_percent);if(n===null)return null;const r=Pn(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:Pn(t.resetsAt??t.resets_at)}}function f_(e){const t=it(e);if(!t)return null;const n=ro(t.hasCredits??t.has_credits),r=ro(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:fe(t.balance)}}function Ac(e){const t=it(e);if(!t)return null;const n=ah(t.primary),r=ah(t.secondary),o=f_(t.credits);return!n&&!r&&!o?null:{limitId:fe(t.limitId??t.limit_id),limitName:fe(t.limitName??t.limit_name),primary:n,secondary:r,credits:o,planType:fe(t.planType??t.plan_type)}}function Rm(e,t=null){const n=it(e);if(!n)return null;const r=fe(n.accountId),o=fe(n.quotaStatus),a=o==="loading"||o==="ready"||o==="error"?o:"idle";return r?{accountId:r,authMode:fe(n.authMode),email:fe(n.email),planType:fe(n.planType),lastRefreshedAtIso:fe(n.lastRefreshedAtIso)??"",lastActivatedAtIso:fe(n.lastActivatedAtIso),quotaSnapshot:Ac(n.quotaSnapshot),quotaUpdatedAtIso:fe(n.quotaUpdatedAtIso),quotaStatus:a,quotaError:fe(n.quotaError),unavailableReason:c_(n.unavailableReason)??(d_(fe(n.quotaError))?"payment_required":null),isActive:ro(n.isActive)??r===t}:null}function Mm(e){const t=it(e);if(!t)return null;const n=it(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=Ac(n==null?void 0:n.codex);return r||Ac(t.rateLimits??t.rate_limits)}async function It(e,t){try{return await N0(e,t)}catch(n){throw Ro(n,`RPC ${e} failed`,e)}}function dd(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],r={};for(let o=0;o<n.length;o+=1){const a=t+o,s=n[o];typeof(s==null?void 0:s.id)!="string"||s.id.length===0||(r[s.id]=a)}return r}function cu(e){const t=it(e),n=t==null?void 0:t.threadTurnStartIndex;return Math.max(0,Math.floor(typeof n=="number"?n:0))}function h_(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}function p_(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}const m_=50,v_=100;async function g_(e,t){const n=await It("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:l_(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function y_(e){const t=await It("thread/read",{threadId:e,includeTurns:!1});return s_(t)}async function w_(e){const t=await It("thread/read",{threadId:e,includeTurns:!0}),n=cu(t);return{messages:ol(t,n),inProgress:ud(t),activeTurnId:cd(t),hasMoreOlder:n>0,turnIndexByTurnId:dd(t,n)}}async function b_(e,t,n=10){const r=new URLSearchParams({threadId:e,beforeTurnId:t,limit:String(n)}),o=await fetch(`/codex-api/thread-turn-page?${r.toString()}`);if(!o.ok)throw new Error(`Older thread page request failed with ${o.status}`);const a=await o.json();if(!a.result)throw new Error("Older thread page response did not include a thread result");const s=Math.max(0,Math.floor(typeof a.startTurnIndex=="number"?a.startTurnIndex:0));return{messages:ol(a.result,s),inProgress:ud(a.result),activeTurnId:cd(a.result),hasMoreOlder:a.hasMoreOlder===!0,startTurnIndex:s,turnIndexByTurnId:dd(a.result,s)}}async function sh(e=null,t=m_){try{return await g_(e,t)}catch(n){throw Ro(n,"Failed to load thread groups","thread/list")}}function __(){return v_}async function T_(e){try{return await y_(e)}catch(t){throw Ro(t,`Failed to load thread ${e}`,"thread/read")}}async function ih(e){try{return await w_(e)}catch(t){throw Ro(t,`Failed to load thread ${e}`,"thread/read")}}async function k_(e,t,n){try{return await b_(e,t,n)}catch(r){throw Ro(r,`Failed to load earlier messages for thread ${e}`,"thread/read")}}function C_(e){const t=it(e);if(!t)return null;const n=fe(t.key),r=typeof t.text=="string"?t.text:"",o=fe(t.kind);return!n||!o||o!=="meta"&&o!=="hunk"&&o!=="add"&&o!=="remove"&&o!=="context"?null:{key:n,kind:o,text:r,oldLine:Pn(t.oldLine),newLine:Pn(t.newLine)}}function S_(e){const t=it(e);if(!t)return null;const n=fe(t.id),r=typeof t.header=="string"?t.header:"",o=typeof t.patch=="string"?t.patch:"";return n?{id:n,header:r,patch:o,addedLineCount:Pn(t.addedLineCount)??0,removedLineCount:Pn(t.removedLineCount)??0,oldStart:Pn(t.oldStart),oldLineCount:Pn(t.oldLineCount)??0,newStart:Pn(t.newStart),newLineCount:Pn(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(a=>C_(a)).filter(a=>a!==null):[]}:null}function x_(e){const t=it(e);if(!t)return null;const n=fe(t.id),r=fe(t.path),o=fe(t.absolutePath),a=fe(t.operation);return!n||!r||!o||!a||a!=="add"&&a!=="delete"&&a!=="update"&&a!=="rename"?null:{id:n,path:r,absolutePath:o,previousPath:fe(t.previousPath),previousAbsolutePath:fe(t.previousAbsolutePath),operation:a,addedLineCount:Pn(t.addedLineCount)??0,removedLineCount:Pn(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(s=>S_(s)).filter(s=>s!==null):[]}}function $m(e){const t=it(e),n=it(t==null?void 0:t.data),r=it(n==null?void 0:n.summary),o=fe(n==null?void 0:n.scope)==="baseBranch"?"baseBranch":"workspace",a=fe(n==null?void 0:n.workspaceView)==="staged"?"staged":"unstaged";return{cwd:fe(n==null?void 0:n.cwd)??"",gitRoot:fe(n==null?void 0:n.gitRoot),isGitRepo:ro(n==null?void 0:n.isGitRepo)??!1,scope:o,workspaceView:a,baseBranch:fe(n==null?void 0:n.baseBranch),baseBranchOptions:Array.isArray(n==null?void 0:n.baseBranchOptions)?n.baseBranchOptions.map(s=>fe(s)).filter(s=>typeof s=="string"&&s.length>0):[],headBranch:fe(n==null?void 0:n.headBranch),mergeBaseSha:fe(n==null?void 0:n.mergeBaseSha),generatedAtIso:fe(n==null?void 0:n.generatedAtIso)??"",summary:{fileCount:Pn(r==null?void 0:r.fileCount)??0,addedLineCount:Pn(r==null?void 0:r.addedLineCount)??0,removedLineCount:Pn(r==null?void 0:r.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(s=>x_(s)).filter(s=>s!==null):[]}}function A_(e){var r;const t=e.trim();if(!t)return{absolutePath:null,startLine:null,endLine:null};const n=t.match(/^(.*?):(\d+)-(\d+)$/u);return n?{absolutePath:((r=n[1])==null?void 0:r.trim())||null,startLine:Number(n[2]),endLine:Number(n[3])}:{absolutePath:t||null,startLine:null,endLine:null}}function E_(e){var s;const t=e.replace(/\r\n/g,`
|
|
38
|
+
`).trim();if(!t)return{reviewText:"",summary:"",findings:[]};const n=t.search(/\n(?:Full review comments|Review comment):\n/iu),r=n>=0?t.slice(0,n).trim():t,o=n>=0?t.slice(n).trim():"",a=[];if(o){const c=o.replace(/^(?:Full review comments|Review comment):\n*/iu,"").trim().matchAll(/^- (.+?) — (.+)\n?((?: .*(?:\n|$))*)/gmu);let m=0;for(const f of c){const w=((s=f[1])==null?void 0:s.trim())??"",_=A_(f[2]??""),P=(f[0]??"").trim(),q=(f[3]??"").split(`
|
|
39
|
+
`).map(O=>O.replace(/^ /u,"")).join(`
|
|
40
|
+
`).trim();a.push({id:`finding:${m}`,title:w||`Finding ${m+1}`,body:q,path:_.absolutePath?_.absolutePath.split("/").filter(Boolean).slice(-1)[0]??_.absolutePath:null,absolutePath:_.absolutePath,startLine:_.startLine,endLine:_.endLine,rawText:P}),m+=1}}return{reviewText:t,summary:r,findings:a}}function lh(e,t){const n=Array.isArray(e.thread.turns)?e.thread.turns:[];for(let r=n.length-1;r>=0;r-=1){const o=n[r],a=Array.isArray(o==null?void 0:o.items)?o.items:[];for(let s=a.length-1;s>=0;s-=1){const u=a[s];if((u==null?void 0:u.type)!==t)continue;const c=typeof u.review=="string"?u.review.trim():"";if(c)return c}}return null}async function hj(e){const t=await It("thread/read",{threadId:e,includeTurns:!0}),n=lh(t,"exitedReviewMode");return{enteredReviewLabel:lh(t,"enteredReviewMode"),result:n?E_(n):null}}async function pj(){return L0()}function zl(e){const t=it(e);if(!t)return null;const n=fe(t.id),r=fe(t.kind),o=fe(t.name),a=fe(t.prompt),s=fe(t.rrule),u=fe(t.status);return!n||!o||!a||!s||r!=="heartbeat"&&r!=="cron"||u!=="ACTIVE"&&u!=="PAUSED"?null:{id:n,kind:r,name:o,prompt:a,rrule:s,status:u,targetThreadId:fe(t.targetThreadId),cwds:Array.isArray(t.cwds)?t.cwds.filter(c=>typeof c=="string"&&c.trim().length>0):[],createdAtMs:Pn(t.createdAtMs),updatedAtMs:Pn(t.updatedAtMs),nextRunAtMs:Pn(t.nextRunAtMs)}}function jm(e){if(Array.isArray(e))return e.flatMap(n=>{const r=zl(n);return r?[r]:[]});const t=zl(e);return t?[t]:[]}async function I_(){var o;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(oo(t,"Failed to load thread automations"));const n=it((o=it(t))==null?void 0:o.data),r={};if(!n)return r;for(const[a,s]of Object.entries(n)){const u=jm(s);u.length>0&&(r[a]=u)}return r}async function P_(){var o;const e=await fetch("/codex-api/project-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(oo(t,"Failed to load project automations"));const n=it((o=it(t))==null?void 0:o.data),r={};if(!n)return r;for(const[a,s]of Object.entries(n)){const u=jm(s);u.length>0&&(r[a]=u)}return r}async function R_(e){var o;const t=await fetch("/codex-api/thread-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(oo(n,"Failed to save thread automation"));const r=zl((o=it(n))==null?void 0:o.data);if(!r)throw new Error("Thread automation response was malformed");return r}async function M_(e){var o;const t=await fetch("/codex-api/project-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(oo(n,"Failed to save project automation"));const r=zl((o=it(n))==null?void 0:o.data);if(!r)throw new Error("Project automation response was malformed");return r}async function uh(e,t){const n=new URLSearchParams({threadId:e});t&&n.set("automationId",t);const r=await fetch(`/codex-api/thread-automation?${n.toString()}`,{method:"DELETE"}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error(oo(o,"Failed to delete thread automation"))}async function ch(e,t){const n=new URLSearchParams({projectName:e});t&&n.set("automationId",t);const r=await fetch(`/codex-api/project-automation?${n.toString()}`,{method:"DELETE"}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error(oo(o,"Failed to delete project automation"))}async function $_(e,t){const n=await fetch("/codex-api/thread-automation/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,automationId:t})}),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(oo(r,"Failed to run thread automation"))}function j_(e){return D0(e)}function N_(e){const t=it(e);if(!t)return null;const n=fe(t.id),r=fe(t.threadId),o=fe(t.cwd),a=fe(t.shell);return!n||!r||!o||!a?null:{id:n,threadId:r,cwd:o,shell:a,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:ro(t.truncated)??!1}}async function fi(e,t){const n=await fetch(e,t),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(oo(r,`Terminal request failed with HTTP ${n.status}`));return r}async function mj(e){var r;const t=await fi("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=N_((r=it(t))==null?void 0:r.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function L_(){const e=await fi("/codex-api/thread-terminal/status"),t=it(e);return{available:ro(t==null?void 0:t.available)??!1,reason:fe(t==null?void 0:t.reason)||null}}async function O_(e){const t=await fi(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=it(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(o=>{const a=it(o),s=fe(a==null?void 0:a.label),u=fe(a==null?void 0:a.value),c=fe(a==null?void 0:a.source);return!s||!u||c!=="package"&&c!=="script"&&c!=="make"?[]:[{label:s,value:u,source:c}]})}async function vj(e,t){await fi("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function gj(e,t,n){await fi("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function yj(e){await fi("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}async function D_(e,t){await F0({id:e,...t})}async function F_(){return U0()}async function U_(){try{const e=await It("account/rateLimits/read");return Mm(e)}catch(e){throw Ro(e,"Failed to load account rate limits","account/rateLimits/read")}}function du(e){const t=it(e),n=fe(t==null?void 0:t.activeAccountId),r=Array.isArray(t==null?void 0:t.accounts)?t==null?void 0:t.accounts:[];return{activeAccountId:n,importedAccountId:fe(t==null?void 0:t.importedAccountId)??void 0,accounts:r.map(o=>Rm(o,n)).filter(o=>o!==null)}}async function B_(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(Mn(t,"Failed to load accounts"));const n=it(t);return du(n==null?void 0:n.data)}async function q_(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Mn(t,"Failed to refresh accounts"));const n=it(t);return du(n==null?void 0:n.data)}async function H_(){const e=await fetch("/codex-api/accounts/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Mn(t,"Failed to start Codex login"));const n=it(t),r=it(n==null?void 0:n.data),o=fe(r==null?void 0:r.loginUrl);if(!o)throw new Error("Failed to start Codex login");return o}async function W_(e){const t=await fetch("/codex-api/accounts/login/complete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callbackUrl:e})}),n=await t.json();if(!t.ok)throw new Error(Mn(n,"Failed to complete Codex login"));const r=it(n);return du(r==null?void 0:r.data)}async function V_(e){const t=await fetch("/codex-api/accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accountId:e})}),n=await t.json();if(!t.ok)throw new Error(Mn(n,"Failed to switch account"));const r=it(n),o=it(r==null?void 0:r.data),a=Rm(o==null?void 0:o.account,fe(o==null?void 0:o.activeAccountId));if(!a)throw new Error("Failed to switch account");return a}async function z_(e){const t=await fetch("/codex-api/accounts/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accountId:e})}),n=await t.json();if(!t.ok)throw new Error(Mn(n,"Failed to remove account"));const r=it(n);return du(r==null?void 0:r.data)}async function Qu(e){const t=await It("thread/resume",{threadId:e}),n=cu(t),r=ol(t,n);return{model:Gl(t),messages:r,inProgress:ud(t),activeTurnId:cd(t),hasMoreOlder:n>0,turnIndexByTurnId:dd(t,n)}}async function G_(e){await It("thread/archive",{threadId:e})}async function K_(e,t){await It("thread/name/set",{threadId:e,name:t})}async function Xu(e,t){const n=await It("thread/rollback",{threadId:e,numTurns:t});return ol(n,cu(n))}async function Y_(e,t,n){try{const r=await fetch("/codex-api/thread/rollback-files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,turnId:t,cwd:n})});return r.ok?await r.json():{reverted:0,errors:["Server error"]}}catch{return{reverted:0,errors:["Network error"]}}}function Ec(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.id;if(typeof r=="string"&&r.length>0)return r}return""}function J_(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.cwd;if(typeof r=="string"&&r.length>0)return r}return""}function Gl(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}async function dh(e,t){try{const n={};typeof e=="string"&&e.trim().length>0&&(n.cwd=e.trim()),typeof t=="string"&&t.trim().length>0&&(n.model=t.trim());const r=await It("thread/start",n),o=Ec(r);if(!o)throw new Error("thread/start did not return a thread id");return{threadId:o,model:Gl(r)}}catch(n){throw Ro(n,"Failed to start a new thread","thread/start")}}async function fh(e,t,n){if(arguments.length<=1)try{const r=await It("thread/fork",{threadId:e,persistExtendedHistory:!0}),o=Ec(r);if(!o)throw new Error("thread/fork did not return a thread id");return{threadId:o,cwd:J_(r),model:Gl(r),messages:ol(r,cu(r))}}catch(r){throw Ro(r,`Failed to fork thread ${e}`,"thread/fork")}try{const r=e.trim();if(!r)throw new Error("thread/fork requires threadId");const o={threadId:r};typeof t=="string"&&t.trim().length>0&&(o.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(o.model=n.trim());const a=await It("thread/fork",o),s=Ec(a);if(!s)throw new Error("thread/fork did not return a thread id");return{threadId:s,model:Gl(a)}}catch(r){throw Ro(r,`Failed to fork thread ${e}`,"thread/fork")}}function hh(e){var t;if(!e)return null;try{const n=new URL(e,"http://localhost");if(n.pathname!=="/codex-local-image")return null;const r=((t=n.searchParams.get("path"))==null?void 0:t.trim())??"";return r.length>0?r:null}catch{return null}}function Q_(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
|
|
41
|
+
`;for(const r of t)n+=`
|
|
42
|
+
## ${r.label}: ${r.path}
|
|
43
|
+
`;return`${n}
|
|
44
|
+
## My request for Codex:
|
|
45
|
+
|
|
46
|
+
${e}
|
|
47
|
+
`}function X_(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function Z_(e,t,n){var c;const r=(t==null?void 0:t.trim())??"";if(r)return{model:r,reasoningEffort:e==="plan"?Yu(n):Ju(n)};let o=null;try{o=await Lm()}catch{o=null}const a=(o==null?void 0:o.model.trim())??"";if(a)return{model:a,reasoningEffort:e==="plan"?Yu(n??(o==null?void 0:o.reasoningEffort)):Ju(n??(o==null?void 0:o.reasoningEffort))};let s=[];try{s=await Nm()}catch{s=[]}const u=((c=s.find(m=>m.trim().length>0))==null?void 0:c.trim())??"";if(u)return{model:u,reasoningEffort:e==="plan"?Yu(n??(o==null?void 0:o.reasoningEffort)):Ju(n??(o==null?void 0:o.reasoningEffort))};throw new Error(`${e==="plan"?"Plan":"Default"} mode requires an available model. Wait for models to load and try again.`)}async function Zu(e,t,n=[],r,o,a,s=[],u){var c;try{const m=(r==null?void 0:r.trim())??"",f=[];for(const U of n){const G=hh(U.trim());G&&f.push({label:X_(G),path:G,fsPath:G})}const w=[...s,...f],_=w.filter((U,G)=>w.findIndex(Y=>Y.fsPath===U.fsPath)===G),q=[{type:"text",text:Q_(t,_)}];for(const U of n){const G=U.trim();if(!G)continue;const Y=hh(G);if(Y){q.push({type:"localImage",path:Y});continue}q.push({type:"image",url:G,image_url:G})}if(a)for(const U of a)q.push({type:"skill",name:U.name,path:U.path});const O=_.map(U=>({label:U.label,path:U.path,fsPath:U.fsPath})),te={threadId:e,input:q};if(O.length>0&&(te.attachments=O),m&&(te.model=m),typeof o=="string"&&o.length>0&&(te.effort=o),u){const U=await Z_(u,m,o);te.collaborationMode={mode:u,settings:{model:U.model,reasoning_effort:U.reasoningEffort,developer_instructions:null}}}const F=await It("turn/start",te);return typeof((c=F==null?void 0:F.turn)==null?void 0:c.id)=="string"?F.turn.id.trim():""}catch(m){throw Ro(m,`Failed to start turn for thread ${e}`,"turn/start")}}async function eT(e,t){const n=e.trim(),r=(t==null?void 0:t.trim())||"";if(n)try{if(!r)throw new Error("turn/interrupt requires turnId");await It("turn/interrupt",{threadId:n,turnId:r})}catch(o){throw Ro(o,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function tT(e){const t=e==="fast"?"fast":"standard";await It("config/batchWrite",{edits:[{keyPath:"features.fast_mode",value:!0,mergeStrategy:"upsert"},{keyPath:"service_tier",value:t==="fast"?"fast":null,mergeStrategy:t==="fast"?"upsert":"replace"}],filePath:null,expectedVersion:null})}async function nT(){return await(await fetch("/codex-api/free-mode/status")).json()}async function ph(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function mh(e){return await(await fetch("/codex-api/free-mode/custom-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e})})).json()}async function Os(e,t,n){return await(await fetch("/codex-api/free-mode/custom-provider",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:e,apiKey:t,wireApi:n==null?void 0:n.wireApi,provider:n==null?void 0:n.provider})})).json()}async function Nm(e={}){const t=await It("model/list",{}),n=[];for(const r of t.data){const o=r.id||r.model;!o||n.includes(o)||n.push(o)}if(e.includeProviderModels===!1)return n;try{const r=await fetch("/codex-api/provider-models",{signal:AbortSignal.timeout(u_)});let o=null;try{o=await r.json()}catch{o=null}if(r.ok&&Array.isArray(o==null?void 0:o.data)){if(o.exclusive)return o.data.filter(a=>typeof a=="string"&&a.trim().length>0);for(const a of o.data){if(typeof a!="string")continue;const s=a.trim();!s||n.includes(s)||n.push(s)}}}catch{}return n}async function Lm(){const e=await It("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=h_(e.config.model_reasoning_effort),o=p_(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:o}}function Om(e){const t=it(e);if(!t)return null;const n=fe(t.id),r=fe(t.name);return!n||!r?null:{id:n,name:r,description:fe(t.description)??"",installUrl:fe(t.installUrl??t.install_url)??"",needsAuth:ro(t.needsAuth??t.needs_auth)??!1}}function rT(e){const t=it(e);if(!t)return null;const n=fe(t.name),r=fe(t.path);if(!n||!r)return null;const o=it(t.interface);return{name:n,path:r,description:fe(t.description)??"",enabled:ro(t.enabled)??!0,displayName:fe((o==null?void 0:o.displayName)??(o==null?void 0:o.display_name))??n,shortDescription:fe(t.shortDescription??t.short_description)??""}}function Dm(e,t={}){const n=it(e);if(!n)return null;const r=fe(n.id),o=fe(n.name);if(!r||!o)return null;const a=it(n.interface),s=it(n.source),u=fe(s==null?void 0:s.type)??"",c=fe(s==null?void 0:s.path),m=fe(s==null?void 0:s.url)??"",f=u==="remote"?t.name??null:null,w=t.path??(u==="local"?c:null),_=fe((a==null?void 0:a.displayName)??(a==null?void 0:a.display_name))??o,P=fe((a==null?void 0:a.shortDescription)??(a==null?void 0:a.short_description)),q=fe((a==null?void 0:a.longDescription)??(a==null?void 0:a.long_description))??"";return{id:r,name:o,displayName:_,description:P??q,longDescription:q,developerName:fe((a==null?void 0:a.developerName)??(a==null?void 0:a.developer_name))??"",category:fe(a==null?void 0:a.category)??"",marketplaceName:t.name??"",marketplaceDisplayName:t.displayName??t.name??"",marketplacePath:w,remoteMarketplaceName:f,sourceType:u,sourceUrl:m,installed:ro(n.installed)??!1,enabled:ro(n.enabled)??!0,installPolicy:fe(n.installPolicy??n.install_policy)??"",authPolicy:fe(n.authPolicy??n.auth_policy)??"",logoUrl:fe((a==null?void 0:a.logoUrl)??(a==null?void 0:a.logo_url))??"",logoPath:fe(a==null?void 0:a.logo)??"",composerIconUrl:fe((a==null?void 0:a.composerIconUrl)??(a==null?void 0:a.composer_icon_url))??"",composerIconPath:fe((a==null?void 0:a.composerIcon)??(a==null?void 0:a.composer_icon))??"",brandColor:fe((a==null?void 0:a.brandColor)??(a==null?void 0:a.brand_color))??"",capabilities:Vs(a==null?void 0:a.capabilities),defaultPrompt:Vs((a==null?void 0:a.defaultPrompt)??(a==null?void 0:a.default_prompt)),screenshotUrls:Vs((a==null?void 0:a.screenshotUrls)??(a==null?void 0:a.screenshot_urls)),screenshots:Vs(a==null?void 0:a.screenshots),websiteUrl:fe((a==null?void 0:a.websiteUrl)??(a==null?void 0:a.website_url))??"",privacyPolicyUrl:fe((a==null?void 0:a.privacyPolicyUrl)??(a==null?void 0:a.privacy_policy_url))??"",termsOfServiceUrl:fe((a==null?void 0:a.termsOfServiceUrl)??(a==null?void 0:a.terms_of_service_url))??""}}function oT(e,t=0){const n=it(e);if(!n)return null;const r=fe(n.id),o=fe(n.name);if(!r||!o)return null;const a=it(n.branding),s=it(n.appMetadata??n.app_metadata);return{id:r,name:o,description:fe(n.description)??fe((s==null?void 0:s.seoDescription)??(s==null?void 0:s.seo_description))??"",logoUrl:fe(n.logoUrl??n.logo_url)??"",logoUrlDark:fe(n.logoUrlDark??n.logo_url_dark)??"",distributionChannel:fe(n.distributionChannel??n.distribution_channel)??"",installUrl:fe(n.installUrl??n.install_url)??"",isAccessible:ro(n.isAccessible??n.is_accessible)??!1,isEnabled:ro(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:Vs(n.pluginDisplayNames??n.plugin_display_names),category:fe(a==null?void 0:a.category)??"",developer:fe(a==null?void 0:a.developer)??fe(s==null?void 0:s.developer)??"",website:fe(a==null?void 0:a.website)??"",privacyPolicy:fe((a==null?void 0:a.privacyPolicy)??(a==null?void 0:a.privacy_policy))??"",termsOfService:fe((a==null?void 0:a.termsOfService)??(a==null?void 0:a.terms_of_service))??"",catalogRank:t}}function aT(e){const t=it(e);if(!t)return null;const n=fe(t.name);if(!n)return null;const r=it(t.tools)??{},o=Object.entries(r).map(([c,m])=>{const f=it(m);return{name:fe(f==null?void 0:f.name)??c,title:fe(f==null?void 0:f.title)??"",description:fe(f==null?void 0:f.description)??""}}),a=Array.isArray(t.resources)?t.resources.map(c=>{const m=it(c);return{name:fe(m==null?void 0:m.name)??"",title:fe(m==null?void 0:m.title)??"",uri:fe(m==null?void 0:m.uri)??"",description:fe(m==null?void 0:m.description)??""}}).filter(c=>c.name||c.uri):[],s=t.resourceTemplates??t.resource_templates,u=Array.isArray(s)?s.map(c=>{const m=it(c);return{name:fe(m==null?void 0:m.name)??"",title:fe(m==null?void 0:m.title)??"",uriTemplate:fe((m==null?void 0:m.uriTemplate)??(m==null?void 0:m.uri_template))??"",description:fe(m==null?void 0:m.description)??""}}).filter(c=>c.name||c.uriTemplate):[];return{name:n,authStatus:fe(t.authStatus??t.auth_status)??"unsupported",tools:o,resources:a,resourceTemplates:u}}async function wj(e){const t={};e&&e.length>0&&(t.cwds=e);const n=await It("plugin/list",t),r=[];for(const o of n.marketplaces??[]){const a=it(o);if(!a)continue;const s=it(a.interface),u={name:fe(a.name)??"",displayName:fe((s==null?void 0:s.displayName)??(s==null?void 0:s.display_name))??"",path:fe(a.path)},c=Array.isArray(a.plugins)?a.plugins:[];for(const m of c){const f=Dm(m,u);f&&r.push(f)}}return r}async function bj(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await It("plugin/read",t),r=it(n.plugin);if(!r)throw new Error("Plugin detail response is empty");const o=Dm(r.summary,{name:fe(r.marketplaceName)??e.marketplaceName,displayName:e.marketplaceDisplayName,path:fe(r.marketplacePath)??e.marketplacePath})??e;return{summary:o,description:fe(r.description)??o.longDescription,apps:Array.isArray(r.apps)?r.apps.map(Om).filter(a=>a!==null):[],skills:Array.isArray(r.skills)?r.skills.map(rT).filter(a=>a!==null):[],mcpServers:Vs(r.mcpServers??r.mcp_servers)}}async function _j(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await It("plugin/install",t),r=n.appsNeedingAuth??n.apps_needing_auth??[];return{authPolicy:fe(n.authPolicy??n.auth_policy)??"",appsNeedingAuth:r.map(Om).filter(o=>o!==null)}}async function Tj(e){await It("plugin/uninstall",{pluginId:e})}async function kj(e,t){await It("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function Cj(e){const t=[];let n=null,r=0;do{const o={limit:100};n&&(o.cursor=n),e&&(o.threadId=e);const a=await It("app/list",o);for(const s of a.data??[]){const u=oT(s,r);u&&t.push(u),r+=1}n=fe(a.nextCursor??a.next_cursor)}while(n);return t}async function Sj(e,t){await It("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function xj(){const e=[];let t=null;do{const n={};t&&(n.cursor=t);const r=await It("mcpServerStatus/list",n);for(const o of r.data??[]){const a=aT(o);a&&e.push(a)}t=fe(r.nextCursor??r.next_cursor)}while(t);return e}async function Aj(){await It("config/mcpServer/reload",{})}async function Ej(e){const t=await It("mcpServer/oauth/login",{name:e});return{authorizationUrl:fe(t.authorizationUrl??t.authorization_url)??""}}async function Ij(){const e=await fetch("/codex-api/composio/status");if(!e.ok)throw new Error(`Failed to load Composio status (${e.status})`);return await e.json()}async function Pj(e="",t=null,n=50){const r=new URLSearchParams;e.trim()&&r.set("query",e.trim()),t&&r.set("cursor",t),n&&Number.isFinite(n)&&r.set("limit",String(Math.max(1,Math.floor(n))));const o=r.toString(),a=await fetch(`/codex-api/composio/connectors${o?`?${o}`:""}`);if(!a.ok)throw new Error(`Failed to list Composio connectors (${a.status})`);const s=await a.json();return{data:Array.isArray(s.data)?s.data:[],nextCursor:typeof s.nextCursor=="string"&&s.nextCursor.length>0?s.nextCursor:null,total:typeof s.total=="number"&&Number.isFinite(s.total)?Math.max(0,Math.floor(s.total)):0}}async function Rj(e){const t=await fetch(`/codex-api/composio/connector?slug=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`Failed to load Composio connector (${t.status})`);return await t.json()}async function Mj(e){const t=await fetch("/codex-api/composio/link",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e})});if(!t.ok)throw new Error(`Failed to start Composio login (${t.status})`);return await t.json()}async function $j(){const e=await fetch("/codex-api/composio/login",{method:"POST"});if(!e.ok)throw new Error(`Failed to start Composio CLI login (${e.status})`);return await e.json()}async function jj(){const e=await fetch("/codex-api/composio/install",{method:"POST"});if(!e.ok)throw new Error(`Failed to install Composio CLI (${e.status})`);return await e.json()}function sT(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function iT(){try{const e=await It("collaborationMode/list",{}),t=new Set,n=[];for(const r of e.data){const o=r.mode;o!=="default"&&o!=="plan"||t.has(o)||(t.add(o),n.push({value:o,label:sT(r.name||o)||(o==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of oh)t.has(r.value)||n.push(r);return n.sort((r,o)=>r.value===o.value?0:r.value==="default"?-1:1)}}catch{}return oh}function lT(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=a=>{if(!Array.isArray(a))return[];const s=[];for(const u of a)typeof u=="string"&&u.length>0&&!s.includes(u)&&s.push(u);return s},r=t.labels,o={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[a,s]of Object.entries(r)){const u=typeof a=="string"?ot(a):"";u.length>0&&typeof s=="string"&&(o[u]=s)}return{order:n(t.order).map(a=>ot(a)),labels:o,active:n(t.active).map(a=>ot(a)),projectOrder:n(t.projectOrder).map(a=>ot(a)),remoteProjects:Array.isArray(t.remoteProjects)?t.remoteProjects.flatMap(a=>{if(!a||typeof a!="object"||Array.isArray(a))return[];const s=a,u=typeof s.id=="string"?s.id.trim():"";return u?[{id:u,hostId:typeof s.hostId=="string"?s.hostId.trim():"",remotePath:typeof s.remotePath=="string"?ot(s.remotePath):"",label:typeof s.label=="string"?s.label.trim():""}]:[]}):[]}}function uT(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=typeof t.id=="string"?t.id.trim():"";if(!n)return null;const r=Array.isArray(t.imageUrls)?t.imageUrls.filter(s=>typeof s=="string"&&s.trim().length>0):[],o=Array.isArray(t.skills)?t.skills.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const u=s,c=typeof u.name=="string"?u.name.trim():"",m=typeof u.path=="string"?u.path.trim():"";return c&&m?[{name:c,path:m}]:[]}):[],a=Array.isArray(t.fileAttachments)?t.fileAttachments.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const u=s,c=typeof u.label=="string"?u.label.trim():"",m=typeof u.path=="string"?u.path.trim():"",f=typeof u.fsPath=="string"?u.fsPath.trim():"";return c&&m&&f?[{label:c,path:m,fsPath:f}]:[]}):[];return{id:n,text:typeof t.text=="string"?t.text:"",imageUrls:r,skills:o,fileAttachments:a,collaborationMode:t.collaborationMode==="plan"?"plan":"default"}}function Fm(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e)){const o=n.trim();if(!o||!Array.isArray(r))continue;const a=r.flatMap(s=>{const u=uT(s);return u?[u]:[]});a.length>0&&(t[o]=a)}return t}async function Hs(){return Hi?Ic(Hi):(Cl||(Cl=cT().then(e=>(Hi=e,e)).finally(()=>{Cl=null})),Ic(await Cl))}async function cT(){const e=await fetch("/codex-api/workspace-roots-state"),t=await e.json();if(!e.ok)throw new Error("Failed to load workspace roots state");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return lT(n.data)}function Ic(e){var t;return{order:[...e.order],labels:{...e.labels},active:[...e.active],projectOrder:[...e.projectOrder],remoteProjects:((t=e.remoteProjects)==null?void 0:t.map(n=>({...n})))??[]}}function Um(){Hi=null}async function vh(){const e=await fetch("/codex-api/thread-queue-state"),t=await e.json();if(!e.ok)throw new Error("Failed to load thread queue state");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return Fm(n.data)}async function dT(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Fm(e))})).ok)throw new Error("Failed to save thread queue state")}async function fT(e,t){const n=(t??"").trim(),r=await fetch("/codex-api/worktree/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,baseBranch:n||void 0})}),o=await r.json();if(!r.ok||!o.data)throw new Error(o.error||"Failed to create worktree");return{...o.data,cwd:ot(o.data.cwd),gitRoot:ot(o.data.gitRoot)}}async function hT(e,t){const n=await fetch("/codex-api/worktree/create-permanent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,worktreeName:t})}),r=await n.json();if(!n.ok||!r.data)throw new Error(r.error||"Failed to create worktree");return{...r.data,cwd:ot(r.data.cwd),gitRoot:ot(r.data.gitRoot)}}async function pT(e){const t=e.trim();if(!t)return[];const n=new URLSearchParams({sourceCwd:t}),r=await fetch(`/codex-api/worktree/branches?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to load branches");const a=Array.isArray(o.data)?o.data:[],s=[],u=new Set;for(const c of a){if(!c||typeof c!="object"||Array.isArray(c))continue;const m=c,f=typeof m.value=="string"?m.value.trim():"",w=typeof m.label=="string"?m.label.trim():"";!f||u.has(f)||(u.add(f),s.push({value:f,label:w||f}))}return s}async function mT(e){const t=e.trim();if(!t)return{currentBranch:null,headSha:null,headSubject:null,headDate:null,detached:!1,dirty:!1,gitRoot:"",options:[]};const n=new URLSearchParams({cwd:t}),r=await fetch(`/codex-api/git/branches?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to load Git branch state");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=a.currentBranch,u=typeof s=="string"&&s.trim()?s.trim():null,c=Array.isArray(a.options)?a.options:[],m=[],f=new Set;for(const O of c){if(!O||typeof O!="object"||Array.isArray(O))continue;const te=O,F=typeof te.value=="string"?te.value.trim():"",U=typeof te.label=="string"?te.label.trim():"";!F||f.has(F)||(f.add(F),m.push({value:F,label:U||F,isCurrent:te.isCurrent===!0,isRemote:te.isRemote===!0}))}u&&!f.has(u)&&m.unshift({value:u,label:u,isCurrent:!0});const w=a.headSha,_=a.headSubject,P=a.headDate,q=a.gitRoot;return{currentBranch:u,headSha:typeof w=="string"&&w.trim()?w.trim():null,headSubject:typeof _=="string"&&_.trim()?_.trim():null,headDate:typeof P=="string"&&P.trim()?P.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof q=="string"?ot(q):"",options:m}}async function vT(e){const t=e.trim();if(!t)return{isGitRepo:!1,gitRoot:""};const n=new URLSearchParams({cwd:t}),r=await fetch(`/codex-api/git/repository-status?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to read Git repository status");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{isGitRepo:a.isGitRepo===!0,gitRoot:typeof a.gitRoot=="string"?ot(a.gitRoot):""}}async function gT(e,t){var a;const n=await fetch("/codex-api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim()})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to switch branch");const o=(a=r.data)==null?void 0:a.currentBranch;return typeof o=="string"&&o.trim()?o.trim():null}async function yT(e,t){const n=e.trim(),r=t.trim();if(!n||!r)return[];const o=new URLSearchParams({cwd:n,branch:r}),a=await fetch(`/codex-api/git/branch-commits?${o.toString()}`),s=await a.json();if(!a.ok)throw new Error(s.error||"Failed to load branch commits");return(Array.isArray(s.data)?s.data:[]).flatMap(c=>{if(!c||typeof c!="object"||Array.isArray(c))return[];const m=c,f=typeof m.sha=="string"?m.sha.trim():"",w=typeof m.shortSha=="string"?m.shortSha.trim():"",_=typeof m.subject=="string"?m.subject.trim():"",P=typeof m.date=="string"?m.date.trim():"";return!f||!w?[]:[{sha:f,shortSha:w,subject:_||w,date:P}]})}async function wT(e,t,n){const r=await fetch("/codex-api/git/reset-to-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim(),sha:n.trim()})}),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to reset branch to commit");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{currentBranch:typeof a.currentBranch=="string"&&a.currentBranch.trim()?a.currentBranch.trim():null,headSha:typeof a.headSha=="string"&&a.headSha.trim()?a.headSha.trim():null,headSubject:typeof a.headSubject=="string"&&a.headSubject.trim()?a.headSubject.trim():null,headDate:typeof a.headDate=="string"&&a.headDate.trim()?a.headDate.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof a.gitRoot=="string"?ot(a.gitRoot):"",options:[]}}async function Nj(e,t,n,r){const o=new URLSearchParams({cwd:e,scope:t,workspaceView:n});r&&r.trim()&&o.set("baseBranch",r.trim());const a=await fetch(`/codex-api/review/snapshot?${o.toString()}`),s=await a.json();if(!a.ok)throw new Error(Mn(s,"Failed to load review snapshot"));return $m(s)}async function Lj(e){const t=await fetch("/codex-api/review/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();if(!t.ok)throw new Error(Mn(n,"Failed to apply review action"));return $m(n)}async function Oj(e){const t=await fetch("/codex-api/review/git/init",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e})}),n=await t.json();if(!t.ok)throw new Error(Mn(n,"Failed to initialize Git"))}async function Dj(e,t,n,r){const o=t==="baseBranch"?{type:"baseBranch",branch:(r??"").trim()}:{type:"uncommittedChanges"};if(o.type==="baseBranch"&&!o.branch)throw new Error("Base branch is unavailable");await It("review/start",{threadId:e,target:o,delivery:"inline"})}async function gh(){const e=await fetch("/codex-api/home-directory"),t=await e.json();if(!e.ok)throw new Error("Failed to load home directory");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return typeof r.path=="string"?r.path.trim():""}async function bT(e,t){const n=new URLSearchParams({path:e});(t==null?void 0:t.showHidden)===!0&&n.set("showHidden","1");const r=await fetch(`/codex-local-directories?${n.toString()}`),o=await fu(r);if(!r.ok){const c=Mn(o,"Failed to load local directories");throw new Error(c)}const a=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},u=Array.isArray(s.entries)?s.entries:[];return{path:typeof s.path=="string"?ot(s.path):"",parentPath:typeof s.parentPath=="string"?ot(s.parentPath):"",entries:u.flatMap(c=>{if(!c||typeof c!="object"||Array.isArray(c))return[];const m=c,f=typeof m.name=="string"?m.name.trim():"",w=typeof m.path=="string"?ot(m.path):"";return f&&w?[{name:f,path:w}]:[]})}}async function fu(e){const t=await e.text();if(!t)return{};try{return JSON.parse(t)}catch{throw new Error(`Expected JSON response from ${e.url||"request"}`)}}async function ec(e){if(!(await fetch("/codex-api/workspace-roots-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save workspace roots state");Hi=Ic(e)}async function Sl(e,t){const n=await fetch("/codex-api/project-root",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,createIfMissing:(t==null?void 0:t.createIfMissing)===!0,label:(t==null?void 0:t.label)??""})}),r=await n.json();if(!n.ok){const u=Mn(r,"Failed to open project root");throw new Error(u)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=typeof a.path=="string"?ot(a.path):"";return Um(),s}async function _T(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await fu(t);if(!t.ok){const s=Mn(n,"Failed to create local directory");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},o=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=typeof o.path=="string"?ot(o.path):"";return a&&Um(),a}async function TT(e,t){const n=await fetch("/codex-api/github-clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e,basePath:t})}),r=await fu(n);if(!n.ok){const s=Mn(r,"Failed to clone GitHub repository");throw new Error(s)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return typeof a.path=="string"?ot(a.path):""}async function kT(e){const t=await fetch("/codex-api/projectless-thread-cwd",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e??null})}),n=await fu(t);if(!t.ok){const s=Mn(n,"Failed to create new chat folder");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},o=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=typeof o.cwd=="string"?ot(o.cwd):"";if(!a)throw new Error("Failed to create new chat folder");return{cwd:a,outputDirectory:typeof o.outputDirectory=="string"?ot(o.outputDirectory):a,workspaceRoot:typeof o.workspaceRoot=="string"?ot(o.workspaceRoot):""}}async function CT(e){const t=new URLSearchParams({basePath:e}),n=await fetch(`/codex-api/project-root-suggestion?${t.toString()}`),r=await n.json();if(!n.ok){const s=Mn(r,"Failed to suggest project name");throw new Error(s)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{name:typeof a.name=="string"?a.name.trim():"",path:typeof a.path=="string"?ot(a.path):""}}async function ST(e,t,n=20){const r=e.trim();if(!r)return[];const o=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:r,query:t.trim(),limit:n})}),a=await o.json();if(!o.ok){const m=Mn(a,"Failed to search files");throw new Error(m)}const s=a&&typeof a=="object"&&!Array.isArray(a)?a:{},u=Array.isArray(s.data)?s.data:[],c=[];for(const m of u){if(!m||typeof m!="object"||Array.isArray(m))continue;const w=m.path,_=typeof w=="string"?w.trim():"";_&&c.push({path:_})}return c}async function xT(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to search threads");return r.data??{threadIds:[],indexedThreadCount:0}}async function AT(e,t){const n=await fetch("/codex-api/telegram/configure-bot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botToken:e,allowedUserIds:t})}),r=await n.json();if(!n.ok){const o=Mn(r,"Failed to connect Telegram bot");throw new Error(o)}}async function ET(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const s=Mn(t,"Failed to load Telegram configuration");throw new Error(s)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{},o=Array.isArray(r.allowedUserIds)?r.allowedUserIds:[],a=[];for(const s of o){if(s==="*"){a.push("*");continue}typeof s=="number"&&Number.isFinite(s)&&a.push(Math.trunc(s))}return{botToken:typeof r.botToken=="string"?r.botToken:"",allowedUserIds:a}}async function IT(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const o=Mn(t,"Failed to load Telegram status");throw new Error(o)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return{configured:r.configured===!0,active:r.active===!0,mappedChats:typeof r.mappedChats=="number"?r.mappedChats:0,mappedThreads:typeof r.mappedThreads=="number"?r.mappedThreads:0,allowedUsers:typeof r.allowedUsers=="number"?r.allowedUsers:0,allowAllUsers:r.allowAllUsers===!0,lastError:typeof r.lastError=="string"?r.lastError:""}}function Mn(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},r=n.message;if(typeof r=="string"&&r.trim().length>0)return r;const o=n.error;return typeof o=="string"&&o.trim().length>0?o:t}async function PT(){try{const e=await fetch("/codex-api/thread-titles");return e.ok?(await e.json()).data??{titles:{},order:[]}:{titles:{},order:[]}}catch{return{titles:{},order:[]}}}async function tc(e,t){try{await fetch("/codex-api/thread-titles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,title:t})})}catch{}}async function RT(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function MT(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function $T(){var e;try{const t=await fetch("/codex-api/preferences/first-launch-plugins-card");return t.ok?{dismissed:((e=(await t.json()).data)==null?void 0:e.dismissed)===!0}:{dismissed:!1}}catch{return{dismissed:!1}}}async function jT(e){try{await fetch("/codex-api/preferences/first-launch-plugins-card",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({dismissed:e})})}catch{}}async function NT(e,t){var n;try{return((n=(await It("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}function Pc(e){return e?e.endsWith("/SKILL.md")?e:`${e}/SKILL.md`:""}function LT(e,t){const n=Pc(e),r=n.split("/").filter(Boolean);if(r.length<2)return null;const o=r.lastIndexOf("skills");if(o>=2){const c=r[o-2]??"";if(c){const m=`/${[...r.slice(0,o+1),c,"SKILL.md"].join("/")}`;if(t.has(m))return{rootPath:m,rootName:c,isNested:m!==n}}}const a=r.indexOf("skills");if(a<0||a+1>=r.length-1)return null;const s=r[a+1]??"";if(!s)return null;const u=`/${[...r.slice(0,a+2),"SKILL.md"].join("/")}`;return t.has(u)?{rootPath:u,rootName:s,isNested:u!==n}:{rootPath:u,rootName:s,isNested:u!==n}}async function OT(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await It("skills/list",t),r=n.data.flatMap(s=>s.skills),o=new Set(r.map(s=>Pc(s.path)).filter(Boolean)),a=new Map;for(const s of n.data)for(const u of s.skills){if(!u.name)continue;const c=LT(u.path,o),m=Pc(u.path),w=!!(c!=null&&c.isNested&&o.has(c.rootPath))?c.rootPath:m,_=m===w,P=a.get(w),q={name:u.name,displayName:c&&w===c.rootPath?c.rootName:void 0,description:u.shortDescription||u.description||"",path:w,scope:u.scope,enabled:u.enabled,__hasRoot:_};if(!P){a.set(w,q);continue}if(P.enabled=P.enabled||u.enabled,!P.__hasRoot&&_){a.set(w,q);continue}!P.displayName&&q.displayName&&(P.displayName=q.displayName),!P.description&&q.description&&(P.description=q.description)}return Array.from(a.values()).map(({__hasRoot:s,...u})=>u)}catch{return[]}}async function DT(){try{const e=await fetch("/codex-api/prompts");if(!e.ok)return[];const t=await e.json();return Array.isArray(t.data)?t.data:[]}catch{return[]}}async function FT(e,t){try{const n=await fetch("/codex-api/prompts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,content:t})});return n.ok?(await n.json()).data??null:null}catch{return null}}async function UT(e){try{const t=new URLSearchParams({path:e});return(await fetch(`/codex-api/prompts?${t.toString()}`,{method:"DELETE"})).ok}catch{return!1}}const BT=6e4;async function nc(e){const t=new AbortController,n=setTimeout(()=>t.abort(),BT);try{const r=new FormData;r.append("file",e);const o=await fetch("/codex-api/upload-file",{method:"POST",body:r,signal:t.signal});return o.ok?(await o.json()).path??null:null}catch{return null}finally{clearTimeout(n)}}const qT={},HT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function WT(e,t){return k(),A("svg",HT,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const ks=xt(qT,[["render",WT]]),VT={},zT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function GT(e,t){return k(),A("svg",zT,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const ji=xt(VT,[["render",GT]]),KT={},YT={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function JT(e,t){return k(),A("svg",YT,[...t[0]||(t[0]=[h("path",{fill:"currentColor",d:"M6 12a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4"},null,-1)])])}const Ds=xt(KT,[["render",JT]]),QT={},XT={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function ZT(e,t){return k(),A("svg",XT,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 20h4L18.5 9.5a2.828 2.828 0 1 0-4-4L4 16zm9.5-13.5l4 4"},null,-1)])])}const li=xt(QT,[["render",ZT]]),ek={},tk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function nk(e,t){return k(),A("svg",tk,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"},null,-1)])])}const fd=xt(ek,[["render",nk]]),rk={},ok={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ak(e,t){return k(),A("svg",ok,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m5 19l2.757-7.351A1 1 0 0 1 8.693 11H21a1 1 0 0 1 .986 1.164l-.996 5.211A2 2 0 0 1 19.026 19za2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v2"},null,-1)])])}const sk=xt(rk,[["render",ak]]),ik={},lk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function uk(e,t){return k(),A("svg",lk,[...t[0]||(t[0]=[h("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 zs=xt(ik,[["render",uk]]),ck={},dk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function fk(e,t){return k(),A("svg",dk,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 3L4 14h6l-1 7l9-11h-6z"},null,-1)])])}const ko=xt(ck,[["render",fk]]),hk={},pk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function mk(e,t){return k(),A("svg",pk,[...t[0]||(t[0]=[h("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 xl=xt(hk,[["render",mk]]),Bm="codex-web-local.ui-language.v1",vk={English:"English","Simplified Chinese":"简体中文","Search threads":"搜索线程","Filter threads...":"筛选线程...","Clear search":"清除搜索",Chats:"聊天",Projects:"项目",Pinned:"已固定","Chats first":"聊天优先","Sort by":"排序",Created:"创建时间",Updated:"更新时间","New chat":"新聊天","No chats":"没有聊天","Skills Hub":"技能中心","Expand accounts":"展开账户","Collapse accounts":"折叠账户",Accounts:"账户","Reloading…":"重新加载中…",Reload:"重新加载","Run `codex login`, then click reload.":"先运行 `codex login`,然后点击重新加载。",Account:"账户",Workspace:"工作区","Require ⌘ + enter to send":"需要 ⌘ + Enter 才发送","When busy, send as":"忙碌时发送方式",Steer:"引导",Queue:"排队",Appearance:"外观",System:"跟随系统",Dark:"深色",Light:"浅色","Chat width":"聊天宽度","Click to toggle dictation":"点击切换语音输入","Auto send dictation":"语音输入后自动发送",Provider:"提供方","Choose the API provider for the Codex backend":"选择 Codex 后端使用的 API 提供方","OpenRouter API key":"OpenRouter API Key","Get API key":"获取 API Key","Remove custom key, use community keys":"移除自定义 key,改用社区 key",Set:"设置",Save:"保存","API format":"API 格式","OpenRouter API format":"OpenRouter API 格式",Responses:"Responses",Completions:"Completions","OpenCode Zen API key":"OpenCode Zen API Key","Custom endpoint URL":"自定义端点 URL","API key":"API Key","Custom endpoint API format":"自定义端点 API 格式","UI language":"界面语言","Choose the interface language for the app.":"选择应用界面语言。","Dictation language":"听写语言","Auto-detect":"自动检测","Search language...":"搜索语言...",Telegram:"Telegram","Bot token":"Bot Token","Allowed Telegram user IDs":"允许的 Telegram 用户 ID","Put one Telegram user ID per line or separate them with commas. Use `*` to allow all Telegram users. Unauthorized users will see their own ID in the rejection message so they can copy it here.":"每行填写一个 Telegram 用户 ID,或用逗号分隔。使用 `*` 可允许所有 Telegram 用户。未授权用户会在拒绝消息中看到自己的 ID,方便复制到这里。","Saving…":"保存中…","Save Telegram config":"保存 Telegram 配置",Context:"上下文","Worktree name and version":"工作树名称和版本",Settings:"设置","Toggle terminal":"切换终端","Open terminal":"打开终端","Terminal command":"终端命令","No commands":"没有命令","Search branches...":"搜索分支...","Let's build":"开始构建","Choose folder":"选择文件夹","Quick search project":"快速搜索项目","Selected folder":"已选文件夹","Select folder":"选择文件夹","Create Project":"创建项目","Create or clone":"创建或克隆","Create or clone project":"创建或克隆项目","Project source":"项目来源","New project":"新项目","Destination folder":"目标文件夹","New project name":"新项目名称","GitHub repository URL":"GitHub 仓库 URL","Create project":"创建项目","Creating…":"创建中…","Clone repository":"克隆仓库","Clone from GitHub":"从 GitHub 克隆","Cloning…":"克隆中…","Current folder":"当前文件夹",Unavailable:"不可用","Opening…":"打开中…",Open:"打开","Show hidden folders":"显示隐藏文件夹","New folder":"新建文件夹","Folder name":"文件夹名称","Filter folders...":"筛选文件夹...",Retry:"重试","Loading folders…":"加载文件夹中…","No folders match this filter.":"没有匹配此筛选条件的文件夹。","No subfolders found here.":"这里没有子文件夹。","Base branch":"基础分支","Select branch":"选择分支","Loading branches…":"加载分支中…","No Git branches found for this folder.":"此文件夹未找到 Git 分支。","Local project":"本地项目","New worktree":"新工作树","Service worker registration failed.":"Service Worker 注册失败。","No matching files":"没有匹配的文件","Add photos & files":"添加图片和文件","Add folder":"添加文件夹","Take photo":"拍照","In-progress send":"执行中发送","Fast mode":"快速模式","Plan mode":"规划模式","Agent proposes a plan before acting":"代理在执行前先提出计划",Model:"模型","Search models...":"搜索模型...",Skills:"技能","Search skills...":"搜索技能...","Search skills and prompts...":"搜索技能和提示词...",Thinking:"思考强度","Saving thread before stop is available":"线程保存后才能停止",Stop:"停止","Queue message":"加入队列","Send message":"发送消息",Send:"发送","Drop images or files":"拖放图片或文件","Selected image":"已选图片","Loading messages...":"加载消息中...",Plan:"计划",Updating:"更新中","Edit this message":"编辑此消息","Edit message":"编辑消息","Fork thread from this response":"从此回复分叉线程",Fork:"分叉","Response copied":"回复已复制","Copy response":"复制回复","Jump to latest":"跳转到最新","Jump to latest output":"跳转到最新输出","Close image preview":"关闭图片预览","Expanded message image":"放大消息图片","Changed files":"已更改文件","Close diff viewer":"关闭 diff 查看器","No diff available":"没有可用 diff","This summary was restored from the final answer text, but the thread history does not include patch diff content for this file.":"此摘要是从最终回答文本恢复的,但线程历史中不包含该文件的补丁 diff 内容。",Review:"审查","Close review pane":"关闭审查面板",Compare:"比较",Branch:"分支",Changes:"更改","Reviewing…":"审查中…","Run review":"运行审查","Loading review state":"加载审查状态中","This folder is not a Git repository":"此文件夹不是 Git 仓库","Initialize Git to review local changes and run Codex review.":"初始化 Git 后即可审查本地更改并运行 Codex review。","Initializing…":"初始化中…","Initialize Git":"初始化 Git","Base branch unavailable":"基础分支不可用","Could not resolve `origin/HEAD`, `main`, or `master` for this repository.":"无法为此仓库解析 `origin/HEAD`、`main` 或 `master`。","No changes in this scope":"此范围内没有更改","Your current workspace is clean.":"当前工作区很干净。","No merge diff found against the base branch.":"未找到相对基础分支的合并 diff。","No unified diff available.":"没有可用的统一 diff。",Summary:"摘要","No structured findings yet":"暂时没有结构化发现","The latest review only returned summary text.":"最近一次审查仅返回了摘要文本。","Run review to populate this pane.":"运行审查后会填充此面板。",Findings:"发现",Added:"新增",Deleted:"删除",Renamed:"重命名",Modified:"修改","Repository review":"仓库审查","Staged changes":"已暂存更改","Workspace changes":"工作区更改","Unstage all":"全部取消暂存","Stage all":"全部暂存","Revert all":"全部还原","Unstage file":"取消暂存文件","Stage file":"暂存文件","Revert file":"还原文件","Unstage hunk":"取消暂存代码块","Stage hunk":"暂存代码块","Revert hunk":"还原代码块","Failed to load review snapshot":"加载审查快照失败","Failed to apply review action":"应用审查操作失败","Failed to initialize Git":"初始化 Git 失败","Reviewing current changes":"正在审查当前更改","Failed to start review":"启动审查失败","Review in progress":"审查进行中","Failed to load review result":"加载审查结果失败",pin:"固定","Worktree thread":"工作树线程",Threads:"线程","Organize threads":"整理线程",Organize:"整理","By project":"按项目","Chronological list":"按时间顺序","No matching threads":"没有匹配的线程","Loading threads...":"加载线程中...","Edit name":"编辑名称",Remove:"移除","Project name":"项目名称","No threads":"没有线程","Thread title":"线程标题","Rename thread":"重命名线程","Make it short and recognizable.":"尽量简短且易识别。","Add title...":"输入标题...",Cancel:"取消","Delete thread":"删除线程","Thread automation":"线程自动化","This creates a heartbeat automation attached to the selected thread.":"这会创建一个附加到所选线程的心跳自动化。",Name:"名称","Automation name":"自动化名称",Prompt:"提示词","Search prompt...":"搜索提示词...","Describe what the automation should do":"描述自动化需要执行的内容","Schedule (RRULE)":"计划(RRULE)",Status:"状态",Active:"启用",Paused:"暂停","Expand sidebar":"展开侧边栏","Collapse sidebar":"折叠侧边栏","Start new thread":"新建线程","No skills found":"未找到技能","No results":"没有结果","Approval choices":"审批选项","No, and tell Codex what to do differently":"不允许,并告诉 Codex 应如何调整",Skip:"跳过",Server:"服务器","Open authorization link":"打开授权链接",Value:"值",Choice:"选项","Select true or false":"选择 true 或 false",True:"True",False:"False","Select an option":"选择一个选项",Decline:"拒绝",Continue:"继续","Other answer":"其他答案","Fail Tool Call":"使工具调用失败","Success (Empty)":"成功(空结果)","Return Empty Result":"返回空结果","New terminal":"新终端","Hide terminal":"隐藏终端",Close:"关闭","Edit queued message":"编辑排队消息","Send now without interrupting work":"立即发送且不中断当前工作","Delete queued message":"删除排队消息","AppServer API":"AppServer API","Loading method catalog...":"加载方法目录中...",Disabled:"已禁用",Installed:"已安装","Browse files":"浏览文件","Loading skill contents...":"加载技能内容中...","View on GitHub":"在 GitHub 查看","Show all":"显示全部","Hide all":"隐藏全部","No types yet":"还没有类型","Manage installed skills on this machine":"管理此机器上已安装的技能","Skills Sync (GitHub)":"技能同步(GitHub)",Connected:"已连接","Logged in as":"已登录为","Not connected":"未连接",Startup:"启动",Action:"动作","Manual sync":"手动同步","GitHub device login":"GitHub 设备登录","and enter code:":"并输入代码:","Login with GitHub":"使用 GitHub 登录","Device Login":"设备登录","Logout GitHub":"退出 GitHub","Syncing...":"同步中...","Startup Sync":"启动同步","Pulling...":"拉取中...",Pull:"拉取","Pushing...":"推送中...",Push:"推送","Installed ({count})":"已安装({count})","Find skills":"查找技能","Search the Skills registry with npx skills find.":"使用 npx skills find 搜索 Skills 注册表。","Searching...":"搜索中...","Search results ({count})":"搜索结果({count})","No matching skills found.":"未找到匹配的技能。","No installed skills found.":"未找到已安装的技能。","Continue in":"运行方式","Search daily":"搜索(日)","Search weekly":"搜索(周)","Search monthly":"搜索(月)","Trending daily":"热门(日)","Trending weekly":"热门(周)","Trending monthly":"热门(月)",Newest:"最新","A-Z":"A-Z","Loading skills...":"加载技能中...","Choose a thread":"选择一个线程","New worktree branch will start from {branch}.":"新工作树分支将从 {branch} 开始。","Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.":"本地项目会直接使用所选文件夹。新工作树会在第一次提问前创建一个隔离的 Git worktree。","Not configured":"未配置",Online:"在线","Configured (offline)":"已配置(离线)","allow all users":"允许所有用户","allowed user(s)":"个允许用户","chat(s)":"个聊天","thread(s)":"个线程",error:"错误",unknown:"未知","Switching…":"切换中…",Switch:"切换","Removing…":"移除中…","Click again to remove":"再次点击以移除","402 Payment Required":"402 需要付费","weekly remaining":"周剩余额度","Unlimited credits":"无限额度",credits:"额度","Loading quota…":"加载额度中…","Quota unavailable":"额度不可用","Fetching account details…":"获取账户详情中…","Unavailable account":"不可用账户","Waiting for Codex thread/tokenUsage/updated events for this thread.":"等待此线程的 Codex tokenUsage 更新事件。","Current context usage":"当前上下文使用量","Cumulative thread usage":"累计线程使用量","Model context window":"模型上下文窗口","Remaining context":"剩余上下文",tokens:"tokens","Model context window is unavailable in the latest usage event.":"最新使用事件中未提供模型上下文窗口。","Awaiting data":"等待数据中",left:"剩余",used:"已用","Updates after the next token usage event":"下次 token 使用事件后更新","Window size unavailable":"窗口大小不可用","Telegram bot token is required.":"需要填写 Telegram Bot Token。","At least one allowed Telegram user ID or * is required.":"至少需要一个允许的 Telegram 用户 ID 或 `*`。","Telegram bot configured. Only allowlisted Telegram users can use the bridge.":"Telegram 机器人已配置。只有白名单中的 Telegram 用户可以使用桥接。","Failed to connect Telegram bot":"连接 Telegram 机器人失败","Failed to load accounts":"加载账户失败","Failed to refresh accounts":"刷新账户失败",Login:"登录","Starting login…":"正在启动登录…","Open login URL":"打开登录链接","Paste localhost callback URL":"粘贴 localhost 回调 URL","Complete Codex login":"完成 Codex 登录","Finish login in the browser, then paste the localhost callback URL here.":"在浏览器中完成登录,然后在这里粘贴 localhost 回调 URL。",Complete:"完成","Completing…":"正在完成…","Failed to start Codex login":"启动 Codex 登录失败","Failed to complete Codex login":"完成 Codex 登录失败","Click Login, or run `codex login`, then click reload.":"点击登录,或运行 `codex login`,然后点击重新加载。","Finish the current turn and pending requests before switching accounts.":"请先完成当前轮次并处理待处理请求后再切换账户。","Failed to switch account":"切换账户失败","Finish the current turn and pending requests before removing the active account.":"请先完成当前轮次并处理待处理请求后再移除当前活动账户。","Failed to remove account":"移除账户失败",enabled:"已启用",disabled:"已禁用","Saving speed setting...":"保存速度设置中...","About 1.5x faster, with credits used at 2x":"速度约提升 1.5 倍,额度消耗为 2 倍","Default speed with normal credit usage":"默认速度,按正常额度消耗","Stop dictation":"停止听写","Click to dictate":"点击开始听写","Hold to dictate":"按住听写",failed:"失败",attaching:"正在附加",Attaching:"正在附加","Attaching file...":"正在附加文件...","files...":"个文件...",attached:"已附加","Could not attach file.":"无法附加文件。","Could not attach":"无法附加","files.":"个文件。","Select a thread to send a message":"选择一个线程后才能发送消息","Loading models for plan mode...":"正在为规划模式加载模型...","Type a message... (@ for files)":"输入消息...(@ 选择文件)",Hide:"隐藏",Terminal:"终端","Terminal input failed":"终端输入失败","Terminal attach failed":"终端附加失败","Creating worktree":"创建工作树","Creating a worktree and running setup.":"正在创建工作树并执行初始化。","Worktree setup failed":"工作树初始化失败","Unable to create worktree. Try again or switch to Local project.":"无法创建工作树。请重试,或切换到本地项目。",Edit:"编辑",image:"图片",images:"图片",file:"文件",files:"文件",skill:"技能",skills:"技能","(empty queued message)":"(空的排队消息)",Files:"文件",Unstaged:"未暂存",Staged:"已暂存",Refresh:"刷新",Against:"对比",selected:"已选","Reject Request":"拒绝请求","Uninstalling...":"卸载中...",Uninstall:"卸载","Installing...":"安装中...",Install:"安装",Disable:"禁用",Enable:"启用","When enabled, press Enter to send. When disabled, use Command+Enter to send.":"启用时按 Enter 发送;禁用时使用 Command+Enter 发送。","If a turn is still running, choose whether a new prompt should steer the current turn or be queued.":"如果当前轮次仍在运行,选择新提示是引导当前轮次还是加入队列。","Switch between system theme, light mode, and dark mode.":"在跟随系统、浅色和深色主题之间切换。","Choose how wide the conversation column and composer can grow on desktop screens.":"选择桌面端会话列和输入框的最大宽度。","Use click-to-start and click-to-stop dictation instead of hold-to-talk.":"使用点击开始/停止听写,而不是按住说话。","Automatically send transcribed dictation when recording stops.":"录音停止后自动发送转写结果。","Show or hide GitHub trending project cards on the new thread screen.":"显示或隐藏新线程页面上的 GitHub 热门项目卡片。","Choose transcription language or keep auto-detect.":"选择转写语言,或保持自动检测。",Standard:"标准",Wide:"宽","Extra wide":"超宽"},yh={en:"English","zh-CN":"简体中文"};function gk(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(Bm))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const hu=x(gk());function qm(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}qm(hu.value);function yk(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??"")):e}function wk(e){hu.value=e,qm(e),typeof window<"u"&&window.localStorage.setItem(Bm,e)}function Hm(e,t){const n=hu.value==="zh-CN"?vk[e]??e:e;return yk(n,t)}function rs(){return{uiLanguage:hu,uiLanguageOptions:[{value:"en",label:yh.en},{value:"zh-CN",label:yh["zh-CN"]}],t:Hm,setUiLanguage:wk}}const bk={key:0,class:"sidebar-menu-row-left"},_k={class:"sidebar-menu-row-main"},Tk={key:1,class:"sidebar-menu-row-right"},kk={key:0,class:"sidebar-menu-row-right-default"},Ck={key:1,class:"sidebar-menu-row-right-hover"},Sk=Jn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=Jy(),r=Z(()=>!!n.left),o=Z(()=>!!n.right),a=Z(()=>!!n["right-hover"]),s=Z(()=>o.value||a.value);return(u,c)=>(k(),tt(Xc(t.as),am({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":s.value,"data-has-right-hover":a.value,"data-force-right-hover":t.forceRightHover},u.$attrs),{default:mt(()=>[r.value?(k(),A("span",bk,[Ko(u.$slots,"left",{},void 0,!0)])):Q("",!0),h("span",_k,[Ko(u.$slots,"default",{},void 0,!0)]),s.value?(k(),A("span",Tk,[o.value?(k(),A("span",kk,[Ko(u.$slots,"right",{},void 0,!0)])):Q("",!0),a.value?(k(),A("span",Ck,[Ko(u.$slots,"right-hover",{},void 0,!0)])):Q("",!0)])):Q("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),bo=xt(Sk,[["__scopeId","data-v-36239f39"]]);function xk(e,t,n){return n.canPruneMissing?e.filter(r=>t.has(r)):e}const Ak={key:0,class:"pinned-section"},Ek={class:"thread-tree-header"},Ik={key:0,class:"thread-list"},Pk=["data-menu-open"],Rk={class:"thread-left-stack"},Mk=["data-state"],$k=["data-confirming","title","onClick"],jk={key:0,class:"thread-delete-confirm-label"},Nk=["onClick"],Lk={class:"thread-row-title-wrap"},Ok={class:"thread-row-title-line"},Dk={class:"thread-row-title"},Fk=["title"],Uk={key:0,class:"thread-row-automation-count"},Bk=["data-state"],qk={class:"thread-row-time"},Hk=["onClick"],Wk={class:"projects-section"},Vk={class:"thread-tree-header"},zk=["aria-expanded","aria-label","title"],Gk={class:"organize-menu-title"},Kk=["data-active"],Yk={key:0},Jk=["data-active"],Qk={key:0},Xk=["data-active"],Zk={key:0},e1={class:"organize-menu-title"},t1=["data-active"],n1={key:0},r1=["data-active"],o1={key:0},a1={key:0,class:"thread-tree-no-results"},s1={key:1,class:"thread-tree-loading"},i1={key:2,class:"thread-list thread-list-global"},l1=["data-menu-open"],u1={class:"thread-left-stack"},c1=["data-state"],d1=["data-confirming","title","onClick"],f1={key:0,class:"thread-delete-confirm-label"},h1=["onClick"],p1={class:"thread-row-title-wrap"},m1={class:"thread-row-title-line"},v1={class:"thread-row-title"},g1=["title"],y1={key:0,class:"thread-row-automation-count"},w1=["data-state"],b1={class:"thread-row-time"},_1=["onClick"],T1=["data-project-name","data-expanded","data-dragging"],k1={class:"project-icon-stack"},C1={class:"project-icon-folder"},S1={class:"project-icon-chevron"},x1=["data-dragging-handle","onMousedown"],A1=["title"],E1=["title"],I1={key:0,class:"thread-row-automation-count"},P1={class:"project-hover-controls"},R1=["onClick"],M1=["data-open-direction"],$1=["onClick"],j1=["onClick"],N1=["onClick"],L1=["onClick"],O1=["onClick"],D1={class:"project-menu-label"},F1=["onInput"],U1=["aria-label","title","onClick"],B1={key:0,class:"thread-list"},q1=["data-menu-open"],H1={class:"thread-left-stack"},W1=["data-state"],V1=["data-confirming","title","onClick"],z1={key:0,class:"thread-delete-confirm-label"},G1=["onClick"],K1={class:"thread-row-title-wrap"},Y1={class:"thread-row-title-line"},J1={class:"thread-row-title"},Q1=["title"],X1={key:0,class:"thread-row-automation-count"},Z1=["data-state"],eC={class:"thread-row-time"},tC=["onClick"],nC={class:"project-empty"},rC=["onClick"],oC={class:"chats-section"},aC={class:"thread-tree-header"},sC={class:"chats-section-actions"},iC=["aria-label","title"],lC={key:0,class:"thread-tree-no-results"},uC={key:1,class:"thread-list thread-list-global"},cC=["data-menu-open"],dC={class:"thread-left-stack"},fC=["data-state"],hC=["data-confirming","title","onClick"],pC={key:0,class:"thread-delete-confirm-label"},mC=["onClick"],vC={class:"thread-row-title-wrap"},gC={class:"thread-row-title-line"},yC={class:"thread-row-title"},wC=["title"],bC={key:0,class:"thread-row-automation-count"},_C=["data-state"],TC={class:"thread-row-time"},kC=["onClick"],CC=["data-open-direction"],SC={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},xC={class:"rename-thread-title"},AC=["onKeydown"],EC={class:"rename-thread-actions"},IC={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},PC={class:"rename-thread-title"},RC={class:"rename-thread-subtitle"},MC={class:"rename-thread-actions"},$C=["aria-label"],jC={class:"rename-thread-title"},NC={class:"rename-thread-subtitle"},LC={key:0,class:"automation-target-picker"},OC={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},DC={class:"automation-target-dropdown"},FC=["placeholder"],UC=["value"],BC=["aria-label"],qC=["onClick"],HC={class:"automation-thread-field"},WC={class:"automation-thread-field"},VC={class:"automation-thread-field"},zC={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},GC={key:0,class:"automation-schedule-row"},KC={key:1,class:"automation-schedule-row"},YC={class:"automation-schedule-preview"},JC={class:"automation-thread-field"},QC={value:"ACTIVE"},XC={value:"PAUSED"},ZC={key:2,class:"rename-thread-subtitle automation-thread-error"},eS={key:3,class:"rename-thread-subtitle automation-thread-notice"},tS={class:"rename-thread-actions"},nS=["disabled"],rS=["disabled"],oS=["disabled"],aS=["disabled"],sS=4,wh=6,bh="codex-web-local.sidebar-section-expansion.v1",_h="codex-web-local.sidebar-chats-first.v1",Th="codex-web-local.sidebar-chat-sort-mode.v1",kh="codex-web-local.thread-view-mode.v1",Ch="codex-web-local.collapsed-projects.v1",iS=Jn({__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","browse-project-files","request-project-git-status","create-project-worktree","rename-project","rename-thread","remove-project","reorder-project","export-thread","fork-thread","start-new-chat","automations-changed"],setup(e,{expose:t,emit:n}){const r=e,{t:o}=rs(),a=n,s=x({}),u=x({}),c=x(!0),m=x(!0),f=x(!0),w=x(!1),_=x(Jt(_h,!1)),P=x(Dn());let q=!1;const O=x([]),te=x({}),F=x(""),U=x([]),G=x(""),Y=x(""),Te=x({}),Me=x({}),ae=x({}),Se=x("actions"),K=x(""),be=x(!1),Ce=x(""),ne=x(""),Ae=x(null),We=x(!1),qe=x(""),Be=x(""),Ee=x({}),Ie=x({}),Ze=x(!1),je=x("thread"),et=x(""),ze=x(""),ct=x(""),nt=x("create"),Ye=x(!1),vt=x("thread"),X=x(""),ke=x(""),pe=x(""),xe=x(""),Ve=x(!1),E=x(!1),$=x({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),V=x({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),se=Z(()=>{if(je.value==="project"){const b=ze.value;return b?Ie.value[b]??[]:[]}const v=et.value;return v?Ee.value[v]??[]:[]}),ce=Z(()=>nn($.value.rrule)),ie=Z(()=>Ye.value&&nt.value==="create"?vt.value==="thread"?"This creates a heartbeat automation attached to the selected chat.":"This creates a project automation attached to the selected project folder.":je.value==="project"?"This creates project automations attached to the selected project folder.":"This creates heartbeat automations attached to the selected thread."),me=Z(()=>{var b;const v=[];for(const y of r.groups)for(const R of y.threads){const ve=((b=R.title)==null?void 0:b.trim())||R.id,st=Hn(y.projectName);v.push({value:R.id,label:`${ve} · ${st}`,searchText:`${ve} ${st} ${R.id}`.toLowerCase()})}return v}),ue=Z(()=>{const v=[];for(const b of r.groups){const y=nr(b.projectName);if(!y)continue;const R=Hn(b.projectName);v.push({value:y,label:R,searchText:`${R} ${y}`.toLowerCase()})}return v}),ge=Z(()=>{const v=X.value.trim().toLowerCase(),b=vt.value==="project"?ue.value:me.value;return v?b.filter(y=>y.searchText.includes(v)):b});ht(ge,v=>{var b;Ye.value&&(v.some(y=>y.value===ke.value)||(ke.value=((b=v[0])==null?void 0:b.value)??""))});const he=x(null),Fe=x(null),_e=x(null);let Oe=null,$e=null;const Ge=x(""),D=x({}),B=new Map,W=new Map,oe=new Map,ye=new WeakMap,Pe=x(null),De=x(null),rt=x(!1),ut=x(Tt()),gt=typeof window<"u"?new ResizeObserver(v=>{for(const b of v){const y=b.target,R=ye.get(y);R&&Es(R,y)}}):null;function ft(){if(typeof window>"u")return{};try{const v=window.localStorage.getItem(Ch);if(!v)return{};const b=JSON.parse(v);return!b||typeof b!="object"||Array.isArray(b)?{}:b}catch{return{}}}function Tt(){return typeof window>"u"?"project":window.localStorage.getItem(kh)==="chronological"?"chronological":"project"}function Jt(v,b){if(typeof window>"u")return b;const y=window.localStorage.getItem(v);return y==="true"?!0:y==="false"?!1:b}function Dn(){return typeof window>"u"?"updated":window.localStorage.getItem(Th)==="created"?"created":"updated"}u.value=ft();function ao(){if(!(typeof window>"u"))try{const v=JSON.parse(window.localStorage.getItem(bh)||"{}");typeof v.pinned=="boolean"&&(c.value=v.pinned),typeof v.projects=="boolean"&&(m.value=v.projects),typeof v.chats=="boolean"&&(f.value=v.chats)}catch{}}function Sa(){typeof window>"u"||window.localStorage.setItem(bh,JSON.stringify({pinned:c.value,projects:m.value,chats:f.value}))}ao(),ht(u,v=>{typeof window>"u"||window.localStorage.setItem(Ch,JSON.stringify(v))},{deep:!0}),ht(ut,v=>{typeof window>"u"||window.localStorage.setItem(kh,v)}),ht(_,v=>{typeof window>"u"||window.localStorage.setItem(_h,String(v))}),ht(P,v=>{typeof window>"u"||window.localStorage.setItem(Th,v)}),ht([c,m,f],Sa);const kn=Z(()=>r.searchQuery.trim().toLowerCase()),Cn=Z(()=>kn.value.length>0),so=Z(()=>r.searchMatchedThreadIds?new Set(r.searchMatchedThreadIds):null),Mo=Z(()=>new Set(O.value)),wn=Z(()=>new Set(U.value));function cn(v){if(wn.value.has(v.id))return!1;if(!Cn.value)return!0;if(so.value)return so.value.has(v.id);const b=kn.value;return v.title.toLowerCase().includes(b)||v.preview.toLowerCase().includes(b)}const gr=Z(()=>r.groups.flatMap(v=>{const b=v.threads.filter(y=>!Vl(y.cwd)&&cn(y));return b.length>0?[{...v,threads:b}]:!Cn.value&&v.threads.length===0?[{...v,threads:b}]:[]})),io=Z(()=>ut.value==="chronological"),jr=Z(()=>{const v=[];for(const b of r.groups)for(const y of b.threads)Mo.value.has(y.id)||cn(y)&&v.push(y);return v.sort((b,y)=>{const R=new Date(b.updatedAtIso||b.createdAtIso).getTime();return new Date(y.updatedAtIso||y.createdAtIso).getTime()-R})}),yr=Z(()=>{const v=jr.value.filter(y=>Vl(y.cwd)),b=P.value==="created"?"createdAtIso":"updatedAtIso";return v.sort((y,R)=>{const ve=new Date(y[b]||y.updatedAtIso||y.createdAtIso).getTime();return new Date(R[b]||R.updatedAtIso||R.createdAtIso).getTime()-ve})}),xa=Z(()=>Cn.value||w.value?yr.value:yr.value.slice(0,10)),Qo=Z(()=>Cn.value?!1:yr.value.length>10),Qn=Z(()=>{const v=new Map;for(const b of r.groups)for(const y of b.threads)wn.value.has(y.id)||v.set(y.id,y);return v});ht(O,v=>{q&&MT(v)}),ht([Qn,()=>r.isThreadListFullyLoaded],([v])=>{const b=xk(O.value,new Set(v.keys()),{canPruneMissing:r.isThreadListFullyLoaded});if(b.length===O.value.length)return;const y=new Set(b),R=Object.fromEntries(Object.entries(te.value).filter(([ve])=>y.has(ve)));te.value=R,O.value=b});let lo=0;async function $o(){if(r.isLoading)return;const v=O.value.filter(ve=>!Qn.value.has(ve)&&!te.value[ve]);if(v.length===0)return;const b=lo+=1,y=await Promise.all(v.map(async ve=>{try{return await T_(ve)}catch{return null}}));if(b!==lo)return;const R={...te.value};for(const ve of y)ve&&(R[ve.id]=ve);te.value=R}ht([O,Qn,()=>r.isLoading],()=>{q&&$o()}),Ca(async()=>{const{threadIds:v}=await RT(),b=Array.isArray(v)?v.filter(y=>typeof y=="string").map(y=>y.trim()).filter((y,R,ve)=>y.length>0&&ve.indexOf(y)===R):[];b.length>0&&(O.value=b);try{Ee.value=await I_()}catch{Ee.value={}}try{Ie.value=await P_()}catch{Ie.value={}}q=!0,$o()});const an=Z(()=>gn(qe.value)),pt=Z(()=>{const v=new Map;for(const b of r.groups)for(const y of b.threads)v.set(y.id,b.projectName);return v}),Qt=Z(()=>{const v=new Map;for(const b of r.groups){const y=b.threads.filter(R=>!Mo.value.has(R.id)&&!wn.value.has(R.id));v.set(b.projectName,y)}return v}),Fn=Z(()=>{const v=new Map;for(const b of r.groups)for(const y of b.threads){const R=new Date(y.updatedAtIso||y.createdAtIso).getTime();v.set(y.id,R)}return v}),Ot=Z(()=>{const v=Y.value;return v?Qn.value.get(v)??null:null}),sn=Z(()=>O.value.map(v=>Qn.value.get(v)??te.value[v]??null).filter(v=>v!==null).filter(cn));function uo(){c.value=!c.value}function Gr(){m.value=!m.value}function dn(){f.value=!f.value}const fn=Z(()=>{const v=_e.value;if(!v||v.dropTargetIndexFull===null||r.groups.length===0)return null;const b=Math.max(0,Math.min(v.dropTargetIndexFull,r.groups.length)),y=b>v.fromIndex?b-1:b,R=Math.max(0,Math.min(y,r.groups.length-1));return R===v.fromIndex?null:R}),Ft=Z(()=>{const b=(Cn.value?gr.value:r.groups).map(Mt=>Mt.projectName),y=_e.value,R=fn.value;if(!y||R===null)return b;const ve=[...b],[st]=ve.splice(y.fromIndex,1);return st?(ve.splice(R,0,st),ve):b}),$n=Z(()=>{const v={};let b=0;for(const y of Ft.value)v[y]=b,b+=yn(y);return v}),wr=Z(()=>{let v=0;for(const b of Ft.value)v+=yn(b);return{height:`${Math.max(0,v)}px`}});function co(v){if(Number.isNaN(v))return"n/a";const b=Math.abs(Date.now()-v);if(b<6e4)return"now";const y=Math.floor(b/6e4);if(y<60)return`${y}m`;const R=Math.floor(y/60);return R<24?`${R}h`:`${Math.floor(R/24)}d`}function jo(v){const b=Fn.value.get(v.id);return co(typeof b=="number"?b:new Date(v.updatedAtIso||v.createdAtIso).getTime())}function jn(v){return Mo.value.has(v)}function fo(v){if(jn(v)){O.value=O.value.filter(b=>b!==v);return}O.value=[v,...O.value]}function br(v){fo(v),yt()}function bn(v){F.value="",a("select",v)}function gn(v){return _n(v)>0}function _n(v){var b;return((b=Ee.value[v])==null?void 0:b.length)??0}function _r(v){return Nr(v)>0}function Nr(v){var y;const b=nr(v);return b?((y=Ie.value[b])==null?void 0:y.length)??0:0}function ho(v){if(v.length===0)return"";if(v.length>1){const R=v.filter(ve=>ve.status==="ACTIVE").length;return`${v.length} automations • ${R} active`}const[b]=v,y=b.status==="PAUSED"?"-":b.nextRunAtMs?new Date(b.nextRunAtMs).toLocaleString():"Not scheduled";return`${b.name} • Next run: ${y}`}function Nn(v){return ho(Ee.value[v]??[])}function Lr(v){const b=nr(v);return ho(b?Ie.value[b]??[]:[])}function Un(v){return String(Math.max(0,v)).padStart(2,"0")}function Pt(v,b){const y=typeof v=="number"?v:Number(v);return Number.isFinite(y)?Math.max(1,Math.floor(y)):b}function ir(v){const[b,y]=v.split(":"),R=Math.min(23,Math.max(0,Number(b)||0)),ve=Math.min(59,Math.max(0,Number(y)||0));return`FREQ=DAILY;BYHOUR=${R};BYMINUTE=${ve}`}function Tr(v,b){const y=Pt(v,1);return b==="minutes"?`FREQ=MINUTELY;INTERVAL=${y}`:b==="hours"?`FREQ=HOURLY;INTERVAL=${y}`:`FREQ=DAILY;INTERVAL=${y}`}function kr(v){return Object.fromEntries(v.split(";").map(b=>b.trim()).filter(Boolean).map(b=>{const[y,...R]=b.split("=");return[y.toUpperCase(),R.join("=").trim()]}).filter(([b,y])=>b&&y))}function Wt(v){var ve;const b=kr(v),y=(ve=b.FREQ)==null?void 0:ve.toUpperCase(),R=Pt(b.INTERVAL,1);if(y==="DAILY"&&b.BYHOUR!==void 0&&b.BYMINUTE!==void 0&&R===1){const st=Math.min(23,Math.max(0,Number(b.BYHOUR)||0)),Mt=Math.min(59,Math.max(0,Number(b.BYMINUTE)||0));return{mode:"daily",dailyTime:`${Un(st)}:${Un(Mt)}`,interval:1,intervalUnit:"hours"}}return y==="MINUTELY"||y==="HOURLY"||y==="DAILY"&&b.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:R,intervalUnit:y==="MINUTELY"?"minutes":y==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function nn(v){var ve;const b=kr(v),y=(ve=b.FREQ)==null?void 0:ve.toUpperCase(),R=Pt(b.INTERVAL,1);if(y==="DAILY"&&b.BYHOUR!==void 0&&b.BYMINUTE!==void 0&&R===1){const st=Math.min(23,Math.max(0,Number(b.BYHOUR)||0)),Mt=Math.min(59,Math.max(0,Number(b.BYMINUTE)||0));return`RRULE: ${v} · runs daily at ${Un(st)}:${Un(Mt)}`}return y==="MINUTELY"?`RRULE: ${v} · runs every ${R} minute${R===1?"":"s"}`:y==="HOURLY"?`RRULE: ${v} · runs every ${R} hour${R===1?"":"s"}`:y==="DAILY"&&b.INTERVAL!==void 0?`RRULE: ${v} · runs every ${R} day${R===1?"":"s"}`:v?`RRULE: ${v}`:"RRULE is required."}function Ln(){const v=V.value;v.mode==="daily"?$.value.rrule=ir(v.dailyTime):v.mode==="interval"&&($.value.rrule=Tr(v.interval,v.intervalUnit))}function Cr(){V.value=Wt($.value.rrule)}function lr(v){V.value={...V.value,mode:v},Ln()}function Xn(v){a("export-thread",v),yt()}function Or(v){a("fork-thread",v),yt()}function po(v){return`start new thread ${Hn(v)}`}function ur(v){a("start-new-thread",v)}function rn(v){a("browse-thread-files",v),yt()}async function kt(v){var y,R;const b=((R=(y=Qn.value.get(v))==null?void 0:y.cwd)==null?void 0:R.trim())??"";if(yt(),!(!b||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(b)}catch{}}function Sn(v,b){if(Y.value===v){if(b){const y=b.relatedTarget,R=De.value;if(y instanceof Node&&R&&R.contains(y))return}yt()}}function Ut(v){return Y.value===v}function yt(){Y.value="",ae.value={}}function Bt(v){if(F.value="",Y.value===v){yt();return}Xt(),rt.value=!1,Y.value=v,Ht(()=>{Yr(v)})}function Sr(v,b){v.preventDefault(),F.value="",Y.value=b}function Bn(v,b){Ce.value=v,ne.value=b,be.value=!0,yt(),Ht(()=>{var y,R;(y=Ae.value)==null||y.focus(),(R=Ae.value)==null||R.select()})}function Tn(){be.value=!1,Ce.value="",ne.value=""}function Xo(){const v=Ce.value,b=ne.value.trim();!v||!b||(a("rename-thread",{threadId:v,title:b}),Tn())}function Dr(v,b){F.value="",qe.value=v,Be.value=b,We.value=!0,yt()}function xn(){We.value=!1,qe.value="",Be.value=""}async function M(){const v=qe.value;v&&(Ne(v),xn())}function L(v){return F.value===v}function ee(v){if(F.value!==v){F.value=v,yt();return}Ne(v),F.value=""}function Ne(v){wn.value.has(v)||(U.value=[v,...U.value]),F.value="",yt(),O.value=O.value.filter(b=>b!==v),a("archive",v),gn(v)&&(uh(v).catch(()=>{}),Ee.value=Kr(Ee.value,v))}function wt(v){var y;je.value="thread",et.value=v,ze.value="",Ye.value=!1,pe.value="",xe.value="";const b=(y=Ee.value[v])==null?void 0:y[0];b?qn(b.id):xr(),Ze.value=!0,yt()}function Gt(v){var R;const b=nr(v);if(!b){je.value="project",et.value="",ze.value="",Ye.value=!1,pe.value="Project automation requires a resolved absolute project path.",xe.value="",Ze.value=!0,Xt();return}je.value="project",et.value="",ze.value=b,Ye.value=!1,pe.value="",xe.value="";const y=(R=Ie.value[b])==null?void 0:R[0];y?qn(y.id):xr(),Ze.value=!0,Xt()}function ln(v){je.value=v.scope,et.value=v.scope==="thread"?v.target:"",ze.value=v.scope==="project"?v.target:"",Ye.value=!1,pe.value="",xe.value="",v.scope==="project"?Ie.value=Rt(Ie.value,v.target,v.automation):Ee.value=Ue(Ee.value,v.target,v.automation),qn(v.automation.id),Ze.value=!0,Xt(),yt()}function Vt(){var v;Ye.value=!0,vt.value="thread",X.value="",ke.value=((v=me.value[0])==null?void 0:v.value)??"",je.value="thread",et.value="",ze.value="",pe.value="",xe.value="",xr(),Ze.value=!0,Xt(),yt()}function hn(v){var b,y;vt.value=v,X.value="",ke.value="",je.value=v==="project"?"project":"thread",v==="thread"?ke.value=((b=ge.value[0])==null?void 0:b.value)??"":v==="project"&&(ke.value=((y=ge.value[0])==null?void 0:y.value)??"")}function xr(){ct.value="",nt.value="create",pe.value="",xe.value="",$.value={name:je.value==="project"?"Project automation":"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},V.value=Wt($.value.rrule)}function qn(v){const b=se.value.find(y=>y.id===v);b&&(ct.value=b.id,nt.value="edit",pe.value="",xe.value="",$.value={name:b.name,prompt:b.prompt,rrule:b.rrule,status:b.status},V.value=Wt(b.rrule))}function Fr(){Ze.value=!1,je.value="thread",et.value="",ze.value="",ct.value="",pe.value="",xe.value="",Ve.value=!1,E.value=!1}function Kr(v,b){return Object.fromEntries(Object.entries(v).filter(([y])=>y!==b))}function Ue(v,b,y){const R=v[b]??[],ve=R.findIndex(Mt=>Mt.id===y.id),st=[...R];return ve>=0?st.splice(ve,1,y):st.push(y),{...v,[b]:st}}function Re(v,b,y){const R=(v[b]??[]).filter(ve=>ve.id!==y);return R.length>0?{...v,[b]:R}:Kr(v,b)}function Ar(v,b){return Object.fromEntries(Object.entries(v).filter(([y])=>y!==b))}function Rt(v,b,y){const R=v[b]??[],ve=R.findIndex(Mt=>Mt.id===y.id),st=[...R];return ve>=0?st.splice(ve,1,y):st.push(y),{...v,[b]:st}}function Er(v,b,y){const R=(v[b]??[]).filter(ve=>ve.id!==y);return R.length>0?{...v,[b]:R}:Ar(v,b)}async function Zn(){let v=et.value,b=ze.value;Ve.value=!0,pe.value="",xe.value="";try{if(Ln(),Ye.value&&nt.value==="create"&&(vt.value==="thread"?(v=ke.value,b="",je.value="thread",et.value=v,ze.value=""):(b=ke.value,v="",je.value="project",et.value="",ze.value=b)),je.value==="thread"&&!v)throw new Error("Select a chat target for this automation");if(je.value==="project"&&!b)throw new Error("Select a project target for this automation");const y={id:ct.value||void 0,name:$.value.name,prompt:$.value.prompt,rrule:$.value.rrule,status:$.value.status},R=je.value==="project"?await M_({...y,projectName:b}):await R_({...y,threadId:v});je.value==="project"?Ie.value=Rt(Ie.value,b,R):Ee.value=Ue(Ee.value,v,R),a("automations-changed"),qn(R.id),xe.value="Automation saved.",Ve.value=!1}catch(y){pe.value=y instanceof Error?y.message:"Failed to save automation",Ve.value=!1}}async function un(){const v=et.value,b=ze.value,y=ct.value;if(y&&!(je.value==="thread"&&!v)&&!(je.value==="project"&&!b)){Ve.value=!0,pe.value="",xe.value="";try{je.value==="project"?(await ch(b,y),Ie.value=Er(Ie.value,b,y)):(await uh(v,y),Ee.value=Re(Ee.value,v,y));const R=se.value[0];R?qn(R.id):xr(),a("automations-changed"),Ve.value=!1}catch(R){pe.value=R instanceof Error?R.message:"Failed to remove automation",Ve.value=!1}}}async function Zo(){const v=et.value,b=ct.value;if(!(!v||!b)){E.value=!0,pe.value="",xe.value="";try{await $_(v,b),xe.value="Automation run queued."}catch(y){pe.value=y instanceof Error?y.message:"Failed to run automation"}finally{E.value=!1}}}function Hn(v){return r.projectDisplayNameById[v]??v}t({openAutomationEditorFromPanel:ln,openAutomationCreatorFromPanel:Vt});function er(v){return v.includes("/")||v.includes("\\")}function ea(v){return er(v)?v:Hn(v)}function Aa(v){const b=zr(v);if(!b)return!1;let y=0;for(const R of r.groups)if(er(R.projectName)&&zr(R.projectName)===b&&(y+=1,y>1))return!0;return!1}function ta(v){const b=r.projectDisplayNameById[v.projectName],y=Hn(v.projectName),R=v.projectName;if(b&&!er(R)&&R!==y)return y.includes(R)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(R)?y:`${y} ${R}`;if(b&&er(R)){const Mt=zr(R),Wr=zr(ei(R)),Zt=Aa(R)?Wr:Mt;return Zt&&Zt!==y?`${y} ${Zt}`:y}if(!y.includes("/")&&!y.includes("\\"))return y;const ve=zr(y)||y,st=zr(ei(y));return st.startsWith(".")&&st!==ve?`${ve} ${st}`:v.threads.length>0||!Aa(R)?ve:st?`${ve} ${st}`:ve}function na(v){return G.value===v}function Xt(){G.value="",Se.value="actions",K.value=""}function Ea(){const v=!rt.value;v&&(Xt(),yt()),rt.value=v}function Ur(v){ut.value=v,rt.value=!1}function No(){_.value=!_.value}function Wn(v){P.value=v}function Br(v){a("request-project-git-status",v),Ht(()=>{ia(v)})}function Ia(v){if(G.value===v){Xt();return}yt(),rt.value=!1,G.value=v,Se.value="actions",K.value=Hn(v),Br(v)}function tr(v){yt(),rt.value=!1,G.value=v,Se.value="actions",K.value=Hn(v),Br(v)}function mo(v){return r.projectDisplayNameById[v.projectName]??ta(v)}function ra(v){yt();const b=v.projectName;G.value=b,Se.value="rename",K.value=mo(v),Ht(()=>{ia(b)})}function oa(v){a("browse-project-files",v),Xt()}function Lo(v){a("create-project-worktree",v),Xt()}function An(v){a("rename-project",{projectName:v,displayName:K.value})}function os(v){const b=nr(v);a("remove-project",v),b&&_r(v)&&(ch(b).catch(()=>{}),Ie.value=Ar(Ie.value,b)),Xt()}function nr(v){var y;const b=((y=r.projectCwdByName[v])==null?void 0:y.trim())??"";return q0(b)?b:""}function as(v,b){if(!v.altKey||v.key!=="ArrowUp"&&v.key!=="ArrowDown")return;const y=r.groups.findIndex(st=>st.projectName===b);if(y<0)return;const R=v.key==="ArrowUp"?-1:1,ve=Math.max(0,Math.min(y+R,r.groups.length-1));ve!==y&&(v.preventDefault(),a("reorder-project",{projectName:b,toIndex:ve}))}function Pa(v){return s.value[v]===!0}function On(v){return u.value[v]===!0}function Ir(v){s.value={...s.value,[v]:!Pa(v)}}function aa(){w.value=!w.value}function sa(v){if(Ge.value===v){Ge.value="";return}u.value={...u.value,[v]:!On(v)}}function yn(v){const b=D.value[v]??0,y=_e.value,ve=((y==null?void 0:y.projectName)===v?y.groupHeight:null)??b,st=On(v)?0:wh;return Math.max(0,ve+st)}function Vn(v,b){const y=b instanceof HTMLElement?b:b&&"$el"in b&&b.$el instanceof HTMLElement?b.$el:null;if(y){W.set(v,y);return}W.delete(v)}function zn(v,b){const y=b instanceof HTMLElement?b:b&&"$el"in b&&b.$el instanceof HTMLElement?b.$el:null;if(y){oe.set(v,y);return}oe.delete(v)}function ss(v){let b=v.parentElement;for(;b;){const y=window.getComputedStyle(b),R=y.overflowY||y.overflow;if(R==="auto"||R==="scroll"||R==="hidden"||R==="clip")return b.getBoundingClientRect();b=b.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function Pr(v,b){const y=v.getBoundingClientRect(),R=ss(v),ve=6,st=R.bottom-y.bottom,Mt=y.top-R.top;return st>=b+ve?"down":Mt>st?"up":"down"}function Rr(v,b){const y=oe.get(v);if(!y)return"down";const R=Pr(y,b);return Me.value={...Me.value,[v]:R},R}function Ra(v){return Me.value[v]??"down"}function ia(v){const b=W.get(v);if(!b)return;const y=b.querySelector(".project-menu-panel"),R=(y==null?void 0:y.getBoundingClientRect().height)??0;Te.value={...Te.value,[v]:Pr(b,R)}}function la(v,b,y){return Math.min(Math.max(v,b),y)}function Yr(v){const b=oe.get(v);if(!b)return;const y=De.value,R=y==null?void 0:y.getBoundingClientRect(),ve=(R==null?void 0:R.height)||(y==null?void 0:y.offsetHeight)||112,st=(R==null?void 0:R.width)||(y==null?void 0:y.offsetWidth)||160,Mt=Rr(v,ve),Wr=b.getBoundingClientRect(),Zt=8,pn=4,Uo=Math.max(Zt,window.innerWidth-st-Zt),Bo=la(Wr.right-st,Zt,Uo),Fa=la(Mt==="up"?Wr.top-ve-pn:Wr.bottom+pn,Zt,Math.max(Zt,window.innerHeight-ve-Zt));ae.value={left:`${Math.round(Bo)}px`,top:`${Math.round(Fa)}px`}}function Jr(){const v=Y.value;v&&Yr(v)}function ua(){window.addEventListener("resize",Jr),document.addEventListener("scroll",Jr,!0)}function qr(){window.removeEventListener("resize",Jr),document.removeEventListener("scroll",Jr,!0)}function Ma(v){const b=G.value;if(!b)return!1;const y=W.get(b);if(!y)return!1;if((typeof v.composedPath=="function"?v.composedPath():[]).includes(y))return!0;const ve=v.target;return ve instanceof Node?y.contains(ve):!1}function Oo(v){const b=Y.value;if(!b)return!1;const y=oe.get(b);if(!y)return!1;const R=typeof v.composedPath=="function"?v.composedPath():[];if(R.includes(y))return!0;const ve=De.value;if(ve&&R.includes(ve))return!0;const st=v.target;return st instanceof Node?!!(y.contains(st)||ve&&ve.contains(st)):!1}function Qr(v){if(rt.value){const b=Pe.value,y=typeof v.composedPath=="function"?v.composedPath():[];!!b&&(y.includes(b)||v.target instanceof Node&&b.contains(v.target))||(rt.value=!1)}G.value&&(Ma(v)||Xt(),Y.value&&(Oo(v)||yt()))}function qt(v){G.value&&!Ma(v)&&Xt(),Y.value&&!Oo(v)&&yt()}function Hr(){rt.value&&(rt.value=!1),G.value&&Xt(),Y.value&&yt()}function Xr(){window.addEventListener("pointerdown",Qr,{capture:!0}),window.addEventListener("focusin",qt,{capture:!0}),window.addEventListener("blur",Hr)}function is(){window.removeEventListener("pointerdown",Qr,{capture:!0}),window.removeEventListener("focusin",qt,{capture:!0}),window.removeEventListener("blur",Hr)}function Es(v,b){const y=b.getBoundingClientRect().height;if(!Number.isFinite(y)||y<=0)return;const R=D.value[v];R!==void 0&&Math.abs(R-y)<.5||(D.value={...D.value,[v]:y})}function Is(v,b){const y=B.get(v);y&&y!==b&>&>.unobserve(y);const R=b instanceof HTMLElement?b:b&&"$el"in b&&b.$el instanceof HTMLElement?b.$el:null;if(R){B.set(v,R),ye.set(R,v),Es(v,R),gt==null||gt.observe(R);return}y&&(gt==null||gt.unobserve(y)),B.delete(v)}function hi(v,b){if(v.button!==0||Cn.value||Fe.value||_e.value)return;const y=r.groups.findIndex(Mt=>Mt.projectName===b),R=B.get(b);if(y<0||!R)return;const ve=R.getBoundingClientRect(),st=On(b)?0:wh;Fe.value={projectName:b,fromIndex:y,startClientX:v.clientX,startClientY:v.clientY,pointerOffsetY:v.clientY-ve.top,groupLeft:ve.left,groupWidth:ve.width,groupHeight:ve.height,groupOuterHeight:ve.height+st},v.preventDefault(),Zr()}function Zr(){window.addEventListener("mousemove",vo),window.addEventListener("mouseup",$a),window.addEventListener("keydown",go)}function pi(){window.removeEventListener("mousemove",vo),window.removeEventListener("mouseup",$a),window.removeEventListener("keydown",go)}function vo(v){Oe={clientX:v.clientX,clientY:v.clientY},Ps()}function $a(v){Do({clientX:v.clientX,clientY:v.clientY});const b=_e.value;if(b&&fn.value!==null){const y=r.groups.findIndex(R=>R.projectName===b.projectName);if(y>=0){const R=fn.value;R!==y&&a("reorder-project",{projectName:b.projectName,toIndex:R})}}At({preserveToggleSuppression:!!b})}function go(v){v.key==="Escape"&&(!Fe.value&&!_e.value||(v.preventDefault(),At()))}function At(v={}){$e!==null&&(window.cancelAnimationFrame($e),$e=null),Oe=null,Fe.value=null,_e.value=null,v.preserveToggleSuppression||(Ge.value=""),pi()}function Ps(){$e===null&&($e=window.requestAnimationFrame(()=>{if($e=null,!Oe)return;const v=Oe;Oe=null,Do(v)}))}function Do(v){const b=Fe.value;if(!_e.value&&b){const y=v.clientX-b.startClientX,R=v.clientY-b.startClientY;if(Math.hypot(y,R)<sS)return;Xt(),Ge.value=b.projectName,_e.value={projectName:b.projectName,fromIndex:b.fromIndex,pointerOffsetY:b.pointerOffsetY,groupLeft:b.groupLeft,groupWidth:b.groupWidth,groupHeight:b.groupHeight,groupOuterHeight:b.groupOuterHeight,ghostTop:v.clientY-b.pointerOffsetY,dropTargetIndexFull:null}}_e.value&&rr(v)}function rr(v){const b=_e.value;if(!b)return;if(b.ghostTop=v.clientY-b.pointerOffsetY,!ja(v)){b.dropTargetIndexFull=null;return}const y=v.clientY,R=he.value;if(!R){b.dropTargetIndexFull=null;return}const ve=R.getBoundingClientRect(),st=new Map(r.groups.map((pn,Uo)=>[pn.projectName,Uo])),Mt=r.groups.map(pn=>pn.projectName).filter(pn=>pn!==b.projectName);let Wr=0,Zt=r.groups.length;for(const pn of Mt){const Uo=st.get(pn);if(Uo===void 0)continue;const Bo=yn(pn),Fa=ve.top+Wr+Bo/2;if(y<Fa){Zt=Uo;break}Wr+=Bo}b.dropTargetIndexFull=Zt}function ja(v){const b=he.value;if(!b)return!1;const y=b.getBoundingClientRect(),R=v.clientX>=y.left&&v.clientX<=y.right,ve=v.clientY>=y.top-32&&v.clientY<=y.bottom+32;return R&&ve}function ls(v){var b;return((b=_e.value)==null?void 0:b.projectName)===v}function Na(v){const b=_e.value,y=$n.value[v]??0,R=Y.value?pt.value.get(Y.value)??"":"",ve=G.value===v||R===v;return!b||b.projectName!==v?{position:"absolute",top:"0",left:"0",right:"0",zIndex:ve?"40":"1",transform:`translate3d(0, ${y}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${b.groupLeft}px`,width:`${b.groupWidth}px`,height:`${b.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${b.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function yo(v){return Qt.value.get(v.projectName)??[]}function mi(v){if(Cn.value)return yo(v);if(On(v.projectName))return[];const b=yo(v);return Pa(v.projectName)?b:b.slice(0,10)}function us(v){return Cn.value?!1:!On(v.projectName)&&yo(v).length>10}function La(v){return yo(v).length>0}function Oa(v){return!!v.pendingRequestState||v.inProgress||v.unread}function Fo(v){return v.pendingRequestState==="approval"?"Awaiting approval":"Awaiting response"}function Da(v){return v.pendingRequestState==="approval"?"awaiting-approval":v.pendingRequestState==="response"?"awaiting-response":v.inProgress?"working":v.unread?"unread":"idle"}ht(()=>r.groups.map(v=>v.projectName),v=>{var ve,st;const b=((ve=_e.value)==null?void 0:ve.projectName)??((st=Fe.value)==null?void 0:st.projectName)??"";b&&!r.groups.some(Mt=>Mt.projectName===b)&&At();const y=new Set(v),R=Object.fromEntries(Object.entries(D.value).filter(([Mt])=>y.has(Mt)));Object.keys(R).length!==Object.keys(D.value).length&&(D.value=R)}),ht(()=>{const v=G.value;return v?r.projectGitRepoByName[v]:void 0},()=>{const v=G.value;v&&Ht(()=>{G.value===v&&ia(v)})});const Rs=Z(()=>rt.value||G.value!==""||Y.value!=="");return ht(Rs,v=>{if(v){Xr();return}is()}),ht(Y,v=>{if(!v){qr();return}ua(),Ht(()=>{Yr(v)})}),ns(()=>{for(const v of B.values())gt==null||gt.unobserve(v);B.clear(),W.clear(),qr(),is(),At()}),(v,b)=>(k(),A("section",{class:Qe(["thread-tree-root",{"chats-first":_.value}])},[sn.value.length>0?(k(),A("section",Ak,[Le(bo,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":c.value,onClick:uo},{left:mt(()=>[c.value?(k(),tt(ks,{key:1,class:"thread-icon"})):(k(),tt(ji,{key:0,class:"thread-icon"}))]),default:mt(()=>[h("span",Ek,I(S(o)("Pinned")),1)]),_:1},8,["aria-expanded"]),c.value?(k(),A("ul",Ik,[(k(!0),A(Ke,null,Dt(sn.value,y=>(k(),A("li",{key:y.id,class:"thread-row-item","data-menu-open":Ut(y.id)?"true":"false"},[Le(bo,{class:"thread-row","data-active":y.id===e.selectedThreadId,"data-pinned":jn(y.id),"data-menu-open":Ut(y.id)?"true":"false","force-right-hover":Ut(y.id),onClick:R=>bn(y.id),onMouseleave:R=>Sn(y.id,R),onContextmenu:R=>Sr(R,y.id)},{left:mt(()=>[h("span",Rk,[Oa(y)?(k(),A("span",{key:0,class:"thread-status-indicator","data-state":Da(y)},null,8,Mk)):Q("",!0),h("button",{class:"thread-delete-button",type:"button","data-confirming":L(y.id),title:L(y.id)?"Confirm delete":S(o)("Delete thread"),onClick:Xe(R=>ee(y.id),["stop"])},[L(y.id)?(k(),A("span",jk,"Confirm")):(k(),tt(xl,{key:1,class:"thread-icon"}))],8,$k)])]),right:mt(()=>[h("span",qk,I(jo(y)),1)]),"right-hover":mt(()=>[h("div",{ref_for:!0,ref:R=>zn(y.id,R),class:"thread-menu-wrap"},[h("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Xe(R=>Bt(y.id),["stop"])},[Le(Ds,{class:"thread-icon"})],8,Hk)],512)]),default:mt(()=>[h("button",{class:"thread-main-button",type:"button",onClick:Xe(R=>bn(y.id),["stop"])},[h("span",Lk,[h("span",Ok,[h("span",Dk,I(y.title),1),y.hasWorktree?(k(),tt(zs,{key:0,class:"thread-row-worktree-icon",title:S(o)("Worktree thread")},null,8,["title"])):Q("",!0),gn(y.id)?(k(),A("span",{key:1,class:"thread-row-automation-chip",title:Nn(y.id)},[Le(ko,{class:"thread-row-automation-icon"}),_n(y.id)>1?(k(),A("span",Uk,I(_n(y.id)),1)):Q("",!0)],8,Fk)):Q("",!0),y.pendingRequestState?(k(),A("span",{key:2,class:"thread-row-request-chip","data-state":y.pendingRequestState},I(Fo(y)),9,Bk)):Q("",!0)])])],8,Nk)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,Pk))),128))])):Q("",!0)])):Q("",!0),h("section",Wk,[Le(bo,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":m.value,onClick:Gr},{left:mt(()=>[m.value?(k(),tt(ks,{key:1,class:"thread-icon"})):(k(),tt(ji,{key:0,class:"thread-icon"}))]),right:mt(()=>[h("div",{ref_key:"organizeMenuWrapRef",ref:Pe,class:"organize-menu-wrap"},[h("button",{class:"organize-menu-trigger",type:"button","aria-expanded":rt.value,"aria-label":S(o)("Organize threads"),title:S(o)("Organize threads"),onClick:Xe(Ea,["stop"])},[Le(Ds,{class:"thread-icon"})],8,zk),rt.value?(k(),A("div",{key:0,class:"organize-menu-panel",onClick:b[4]||(b[4]=Xe(()=>{},["stop"]))},[h("p",Gk,I(S(o)("Organize")),1),h("button",{class:"organize-menu-item","data-active":ut.value==="project",type:"button",onClick:b[0]||(b[0]=y=>Ur("project"))},[h("span",null,I(S(o)("By project")),1),ut.value==="project"?(k(),A("span",Yk,"✓")):Q("",!0)],8,Kk),h("button",{class:"organize-menu-item","data-active":ut.value==="chronological",type:"button",onClick:b[1]||(b[1]=y=>Ur("chronological"))},[h("span",null,I(S(o)("Chronological list")),1),ut.value==="chronological"?(k(),A("span",Qk,"✓")):Q("",!0)],8,Jk),h("button",{class:"organize-menu-item","data-active":_.value,type:"button",onClick:No},[h("span",null,I(S(o)("Chats first")),1),_.value?(k(),A("span",Zk,"✓")):Q("",!0)],8,Xk),b[32]||(b[32]=h("div",{class:"organize-menu-separator"},null,-1)),h("p",e1,I(S(o)("Sort by")),1),h("button",{class:"organize-menu-item","data-active":P.value==="created",type:"button",onClick:b[2]||(b[2]=y=>Wn("created"))},[h("span",null,I(S(o)("Created")),1),P.value==="created"?(k(),A("span",n1,"✓")):Q("",!0)],8,t1),h("button",{class:"organize-menu-item","data-active":P.value==="updated",type:"button",onClick:b[3]||(b[3]=y=>Wn("updated"))},[h("span",null,I(S(o)("Updated")),1),P.value==="updated"?(k(),A("span",o1,"✓")):Q("",!0)],8,r1)])):Q("",!0)],512)]),default:mt(()=>[h("span",Vk,I(S(o)("Projects")),1)]),_:1},8,["aria-expanded"]),m.value?(k(),A(Ke,{key:0},[Cn.value&&gr.value.length===0?(k(),A("p",a1,I(S(o)("No matching threads")),1)):e.isLoading&&e.groups.length===0?(k(),A("p",s1,I(S(o)("Loading threads...")),1)):io.value?(k(),A("ul",i1,[(k(!0),A(Ke,null,Dt(jr.value,y=>(k(),A("li",{key:y.id,class:"thread-row-item","data-menu-open":Ut(y.id)?"true":"false"},[Le(bo,{class:"thread-row","data-active":y.id===e.selectedThreadId,"data-pinned":jn(y.id),"data-menu-open":Ut(y.id)?"true":"false","force-right-hover":Ut(y.id),onClick:R=>bn(y.id),onMouseleave:R=>Sn(y.id,R),onContextmenu:R=>Sr(R,y.id)},{left:mt(()=>[h("span",u1,[Oa(y)?(k(),A("span",{key:0,class:"thread-status-indicator","data-state":Da(y)},null,8,c1)):Q("",!0),h("button",{class:"thread-delete-button",type:"button","data-confirming":L(y.id),title:L(y.id)?"Confirm delete":S(o)("Delete thread"),onClick:Xe(R=>ee(y.id),["stop"])},[L(y.id)?(k(),A("span",f1,"Confirm")):(k(),tt(xl,{key:1,class:"thread-icon"}))],8,d1)])]),right:mt(()=>[h("span",b1,I(jo(y)),1)]),"right-hover":mt(()=>[h("div",{ref_for:!0,ref:R=>zn(y.id,R),class:"thread-menu-wrap"},[h("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Xe(R=>Bt(y.id),["stop"])},[Le(Ds,{class:"thread-icon"})],8,_1)],512)]),default:mt(()=>[h("button",{class:"thread-main-button",type:"button",onClick:Xe(R=>bn(y.id),["stop"])},[h("span",p1,[h("span",m1,[h("span",v1,I(y.title),1),y.hasWorktree?(k(),tt(zs,{key:0,class:"thread-row-worktree-icon",title:S(o)("Worktree thread")},null,8,["title"])):Q("",!0),gn(y.id)?(k(),A("span",{key:1,class:"thread-row-automation-chip",title:Nn(y.id)},[Le(ko,{class:"thread-row-automation-icon"}),_n(y.id)>1?(k(),A("span",y1,I(_n(y.id)),1)):Q("",!0)],8,g1)):Q("",!0),y.pendingRequestState?(k(),A("span",{key:2,class:"thread-row-request-chip","data-state":y.pendingRequestState},I(Fo(y)),9,w1)):Q("",!0)])])],8,h1)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,l1))),128))])):(k(),A("div",{key:3,ref_key:"groupsContainerRef",ref:he,class:"thread-tree-groups",style:ya(wr.value)},[(k(!0),A(Ke,null,Dt(gr.value,y=>(k(),A("article",{key:y.projectName,ref_for:!0,ref:R=>Is(y.projectName,R),class:"project-group","data-project-name":y.projectName,"data-expanded":!On(y.projectName),"data-dragging":ls(y.projectName),style:ya(Na(y.projectName))},[Le(bo,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:R=>sa(y.projectName),onContextmenu:Xe(R=>tr(y.projectName),["prevent"]),onKeydown:[R=>as(R,y.projectName),on(Xe(R=>sa(y.projectName),["prevent"]),["enter"]),on(Xe(R=>sa(y.projectName),["prevent"]),["space"])]},{left:mt(()=>[h("span",k1,[h("span",C1,[On(y.projectName)?(k(),tt(fd,{key:0,class:"thread-icon"})):(k(),tt(sk,{key:1,class:"thread-icon"}))]),h("span",S1,[On(y.projectName)?(k(),tt(ji,{key:0,class:"thread-icon"})):(k(),tt(ks,{key:1,class:"thread-icon"}))])])]),right:mt(()=>[h("div",P1,[h("div",{ref_for:!0,ref:R=>Vn(y.projectName,R),class:"project-menu-wrap"},[h("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:Xe(R=>Ia(y.projectName),["stop"])},[Le(Ds,{class:"thread-icon"})],8,R1),na(y.projectName)?(k(),A("div",{key:0,class:"project-menu-panel","data-open-direction":Te.value[y.projectName]??"down",onClick:b[6]||(b[6]=Xe(()=>{},["stop"]))},[Se.value==="actions"?(k(),A(Ke,{key:0},[h("button",{class:"project-menu-item",type:"button",onClick:R=>oa(y.projectName)}," Browse files ",8,$1),h("button",{class:"project-menu-item",type:"button",onClick:R=>Gt(y.projectName)},I(_r(y.projectName)?"Manage automations…":"Add automation…"),9,j1),e.projectGitRepoByName[y.projectName]?(k(),A("button",{key:0,class:"project-menu-item",type:"button",onClick:R=>Lo(y.projectName)}," New worktree ",8,N1)):Q("",!0),h("button",{class:"project-menu-item",type:"button",onClick:R=>ra(y)}," Rename project ",8,L1),h("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:R=>os(y.projectName)}," Remove ",8,O1)],64)):(k(),A(Ke,{key:1},[h("label",D1,I(S(o)("Project name")),1),jt(h("input",{"onUpdate:modelValue":b[5]||(b[5]=R=>K.value=R),class:"project-menu-input",type:"text",onInput:R=>An(y.projectName)},null,40,F1),[[Yt,K.value]])],64))],8,M1)):Q("",!0)],512),h("button",{class:"thread-start-button",type:"button","aria-label":po(y.projectName),title:po(y.projectName),onClick:Xe(R=>ur(y.projectName),["stop"])},[Le(li,{class:"thread-icon"})],8,U1)])]),default:mt(()=>[h("span",{class:"project-main-button","data-dragging-handle":ls(y.projectName),onMousedown:Xe(R=>hi(R,y.projectName),["left"])},[h("span",{class:"project-title",title:ea(y.projectName)},I(ta(y)),9,A1),_r(y.projectName)?(k(),A("span",{key:0,class:"thread-row-automation-chip",title:Lr(y.projectName)},[Le(ko,{class:"thread-row-automation-icon"}),Nr(y.projectName)>1?(k(),A("span",I1,I(Nr(y.projectName)),1)):Q("",!0)],8,E1)):Q("",!0)],40,x1)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),La(y)?(k(),A("ul",B1,[(k(!0),A(Ke,null,Dt(mi(y),R=>(k(),A("li",{key:R.id,class:"thread-row-item","data-menu-open":Ut(R.id)?"true":"false"},[Le(bo,{class:"thread-row","data-active":R.id===e.selectedThreadId,"data-pinned":jn(R.id),"data-menu-open":Ut(R.id)?"true":"false","force-right-hover":Ut(R.id),onClick:ve=>bn(R.id),onMouseleave:ve=>Sn(R.id,ve),onContextmenu:ve=>Sr(ve,R.id)},{left:mt(()=>[h("span",H1,[Oa(R)?(k(),A("span",{key:0,class:"thread-status-indicator","data-state":Da(R)},null,8,W1)):Q("",!0),h("button",{class:"thread-delete-button",type:"button","data-confirming":L(R.id),title:L(R.id)?"Confirm delete":S(o)("Delete thread"),onClick:Xe(ve=>ee(R.id),["stop"])},[L(R.id)?(k(),A("span",z1,"Confirm")):(k(),tt(xl,{key:1,class:"thread-icon"}))],8,V1)])]),right:mt(()=>[h("span",eC,I(jo(R)),1)]),"right-hover":mt(()=>[h("div",{ref_for:!0,ref:ve=>zn(R.id,ve),class:"thread-menu-wrap"},[h("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Xe(ve=>Bt(R.id),["stop"])},[Le(Ds,{class:"thread-icon"})],8,tC)],512)]),default:mt(()=>[h("button",{class:"thread-main-button",type:"button",onClick:Xe(ve=>bn(R.id),["stop"])},[h("span",K1,[h("span",Y1,[h("span",J1,I(R.title),1),R.hasWorktree?(k(),tt(zs,{key:0,class:"thread-row-worktree-icon",title:S(o)("Worktree thread")},null,8,["title"])):Q("",!0),gn(R.id)?(k(),A("span",{key:1,class:"thread-row-automation-chip",title:Nn(R.id)},[Le(ko,{class:"thread-row-automation-icon"}),_n(R.id)>1?(k(),A("span",X1,I(_n(R.id)),1)):Q("",!0)],8,Q1)):Q("",!0),R.pendingRequestState?(k(),A("span",{key:2,class:"thread-row-request-chip","data-state":R.pendingRequestState},I(Fo(R)),9,Z1)):Q("",!0)])])],8,G1)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,q1))),128))])):(k(),tt(bo,{key:1,as:"p",class:"project-empty-row"},{left:mt(()=>[...b[33]||(b[33]=[h("span",{class:"project-empty-spacer"},null,-1)])]),default:mt(()=>[h("span",nC,I(S(o)("No threads")),1)]),_:1})),us(y)?(k(),tt(bo,{key:2,class:"thread-show-more-row"},{left:mt(()=>[...b[34]||(b[34]=[h("span",{class:"thread-show-more-spacer"},null,-1)])]),default:mt(()=>[h("button",{class:"thread-show-more-button",type:"button",onClick:R=>Ir(y.projectName)},I(Pa(y.projectName)?"Show less":"Show more"),9,rC)]),_:2},1024)):Q("",!0)],12,T1))),128))],4))],64)):Q("",!0)]),h("section",oC,[Le(bo,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":f.value,onClick:dn},{left:mt(()=>[f.value?(k(),tt(ks,{key:1,class:"thread-icon"})):(k(),tt(ji,{key:0,class:"thread-icon"}))]),right:mt(()=>[h("div",sC,[h("button",{class:"chats-section-action",type:"button","aria-label":S(o)("New chat"),title:S(o)("New chat"),onClick:b[7]||(b[7]=Xe(y=>v.$emit("start-new-chat"),["stop"]))},[Le(li,{class:"thread-icon"})],8,iC)])]),default:mt(()=>[h("span",aC,I(S(o)("Chats")),1)]),_:1},8,["aria-expanded"]),f.value&&yr.value.length===0?(k(),A("p",lC,I(S(o)("No chats")),1)):f.value?(k(),A("ul",uC,[(k(!0),A(Ke,null,Dt(xa.value,y=>(k(),A("li",{key:y.id,class:"thread-row-item","data-menu-open":Ut(y.id)?"true":"false"},[Le(bo,{class:"thread-row","data-active":y.id===e.selectedThreadId,"data-pinned":jn(y.id),"data-menu-open":Ut(y.id)?"true":"false","force-right-hover":Ut(y.id),onClick:R=>bn(y.id),onMouseleave:R=>Sn(y.id,R),onContextmenu:R=>Sr(R,y.id)},{left:mt(()=>[h("span",dC,[Oa(y)?(k(),A("span",{key:0,class:"thread-status-indicator","data-state":Da(y)},null,8,fC)):Q("",!0),h("button",{class:"thread-delete-button",type:"button","data-confirming":L(y.id),title:L(y.id)?"Confirm delete":S(o)("Delete thread"),onClick:Xe(R=>ee(y.id),["stop"])},[L(y.id)?(k(),A("span",pC,"Confirm")):(k(),tt(xl,{key:1,class:"thread-icon"}))],8,hC)])]),right:mt(()=>[h("span",TC,I(jo(y)),1)]),"right-hover":mt(()=>[h("div",{ref_for:!0,ref:R=>zn(y.id,R),class:"thread-menu-wrap"},[h("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Xe(R=>Bt(y.id),["stop"])},[Le(Ds,{class:"thread-icon"})],8,kC)],512)]),default:mt(()=>[h("button",{class:"thread-main-button",type:"button",onClick:Xe(R=>bn(y.id),["stop"])},[h("span",vC,[h("span",gC,[h("span",yC,I(y.title),1),y.hasWorktree?(k(),tt(zs,{key:0,class:"thread-row-worktree-icon",title:S(o)("Worktree thread")},null,8,["title"])):Q("",!0),gn(y.id)?(k(),A("span",{key:1,class:"thread-row-automation-chip",title:Nn(y.id)},[Le(ko,{class:"thread-row-automation-icon"}),_n(y.id)>1?(k(),A("span",bC,I(_n(y.id)),1)):Q("",!0)],8,wC)):Q("",!0),y.pendingRequestState?(k(),A("span",{key:2,class:"thread-row-request-chip","data-state":y.pendingRequestState},I(Fo(y)),9,_C)):Q("",!0)])])],8,mC)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover","onClick","onMouseleave","onContextmenu"])],8,cC))),128))])):Q("",!0),f.value&&Qo.value?(k(),tt(bo,{key:2,class:"thread-show-more-row"},{left:mt(()=>[...b[35]||(b[35]=[h("span",{class:"thread-show-more-spacer"},null,-1)])]),default:mt(()=>[h("button",{class:"thread-show-more-button",type:"button",onClick:aa},I(w.value?"Show less":"Show more"),1)]),_:1})):Q("",!0)]),(k(),tt(Xa,{to:"body"},[Ot.value?(k(),A("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:De,class:"thread-menu-panel thread-menu-panel-fixed",style:ya(ae.value),"data-open-direction":Ra(Ot.value.id),onClick:b[16]||(b[16]=Xe(()=>{},["stop"]))},[h("button",{class:"thread-menu-item",type:"button",onClick:b[8]||(b[8]=y=>wt(Ot.value.id))},I(gn(Ot.value.id)?"Manage automations…":"Add automation…"),1),h("button",{class:"thread-menu-item",type:"button",onClick:b[9]||(b[9]=y=>rn(Ot.value.id))}," Browse files "),h("button",{class:"thread-menu-item",type:"button",onClick:b[10]||(b[10]=y=>kt(Ot.value.id))}," Copy path "),h("button",{class:"thread-menu-item",type:"button",onClick:b[11]||(b[11]=y=>Xn(Ot.value.id))}," Export chat "),h("button",{class:"thread-menu-item",type:"button",onClick:b[12]||(b[12]=y=>Or(Ot.value.id))}," Create chat fork "),h("button",{class:"thread-menu-item",type:"button",onClick:b[13]||(b[13]=y=>br(Ot.value.id))},I(jn(Ot.value.id)?"Unpin thread":"Pin thread"),1),h("button",{class:"thread-menu-item",type:"button",onClick:b[14]||(b[14]=y=>Bn(Ot.value.id,Ot.value.title))},I(S(o)("Rename thread")),1),h("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:b[15]||(b[15]=y=>Dr(Ot.value.id,Ot.value.title))},I(S(o)("Delete thread")),1)],12,CC)):Q("",!0)])),(k(),tt(Xa,{to:"body"},[be.value?(k(),A("div",{key:0,class:"rename-thread-overlay",onClick:Xe(Tn,["self"])},[h("div",SC,[h("h3",xC,I(S(o)("Rename thread")),1),b[36]||(b[36]=h("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),jt(h("input",{ref_key:"renameThreadInputRef",ref:Ae,"onUpdate:modelValue":b[17]||(b[17]=y=>ne.value=y),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[on(Xe(Xo,["prevent"]),["enter"]),on(Xe(Tn,["prevent"]),["esc"])]},null,40,AC),[[Yt,ne.value]]),h("div",EC,[h("button",{class:"rename-thread-button",type:"button",onClick:Tn},I(S(o)("Cancel")),1),h("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Xo},I(S(o)("Save")),1)])])])):Q("",!0)])),(k(),tt(Xa,{to:"body"},[We.value?(k(),A("div",{key:0,class:"rename-thread-overlay",onClick:Xe(xn,["self"])},[h("div",IC,[h("h3",PC,I(an.value?"Archive chat and remove automations?":"Delete thread?"),1),h("p",RC,[an.value?(k(),A(Ke,{key:0},[As(' This will archive the thread "'+I(Be.value)+'" and remove the attached heartbeat automations. ',1)],64)):(k(),A(Ke,{key:1},[As(' This will archive the thread "'+I(Be.value)+'". You can find it later in archived threads. ',1)],64))]),h("div",MC,[h("button",{class:"rename-thread-button",type:"button",onClick:xn},"Cancel"),h("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:M},I(an.value?"Archive and remove":"Delete"),1)])])])):Q("",!0)])),(k(),tt(Xa,{to:"body"},[Ze.value?(k(),A("div",{key:0,class:"rename-thread-overlay",onClick:Xe(Fr,["self"])},[h("div",{class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":je.value==="project"?"Project automation":"Thread automation"},[h("h3",jC,I(nt.value==="edit"?"Edit automation":"Add automation"),1),h("p",NC,I(ie.value),1),Ye.value&&nt.value==="create"?(k(),A("div",LC,[b[37]||(b[37]=h("span",{class:"automation-thread-label"},"Target",-1)),h("div",OC,[h("button",{class:Qe(["automation-target-mode",{"is-active":vt.value==="thread"}]),type:"button",onClick:b[18]||(b[18]=y=>hn("thread"))}," Existing chat ",2),h("button",{class:Qe(["automation-target-mode",{"is-active":vt.value==="project"}]),type:"button",onClick:b[19]||(b[19]=y=>hn("project"))}," Project ",2)]),h("div",DC,[jt(h("input",{"onUpdate:modelValue":b[20]||(b[20]=y=>X.value=y),class:"rename-thread-input",type:"search",placeholder:vt.value==="project"?"Search projects":"Search chats"},null,8,FC),[[Yt,X.value]]),jt(h("select",{"onUpdate:modelValue":b[21]||(b[21]=y=>ke.value=y),class:"automation-thread-select",size:"5"},[(k(!0),A(Ke,null,Dt(ge.value,y=>(k(),A("option",{key:y.value,value:y.value},I(y.label),9,UC))),128))],512),[[Hu,ke.value]])])])):Q("",!0),se.value.length>0?(k(),A("div",{key:1,class:"automation-thread-list","aria-label":je.value==="project"?"Project automations":"Thread automations"},[(k(!0),A(Ke,null,Dt(se.value,y=>(k(),A("button",{key:y.id,class:Qe(["automation-thread-list-item",{"is-active":y.id===ct.value}]),type:"button",onClick:R=>qn(y.id)},[h("span",null,I(y.name),1),h("small",null,I(y.status==="PAUSED"?"Paused":"Active"),1)],10,qC))),128)),h("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:xr}," Add another automation ")],8,BC)):Q("",!0),h("label",HC,[b[38]||(b[38]=h("span",{class:"automation-thread-label"},"Name",-1)),jt(h("input",{"onUpdate:modelValue":b[22]||(b[22]=y=>$.value.name=y),class:"rename-thread-input",type:"text",placeholder:"Automation name"},null,512),[[Yt,$.value.name]])]),h("label",WC,[b[39]||(b[39]=h("span",{class:"automation-thread-label"},"Prompt",-1)),jt(h("textarea",{"onUpdate:modelValue":b[23]||(b[23]=y=>$.value.prompt=y),class:"automation-thread-textarea",rows:"6",placeholder:"Describe what the automation should do"},null,512),[[Yt,$.value.prompt]])]),h("div",VC,[b[43]||(b[43]=h("span",{class:"automation-thread-label"},"Schedule",-1)),h("div",zC,[h("button",{class:Qe(["automation-schedule-mode",{"is-active":V.value.mode==="daily"}]),type:"button",onClick:b[24]||(b[24]=y=>lr("daily"))}," Daily ",2),h("button",{class:Qe(["automation-schedule-mode",{"is-active":V.value.mode==="interval"}]),type:"button",onClick:b[25]||(b[25]=y=>lr("interval"))}," Interval ",2),h("button",{class:Qe(["automation-schedule-mode",{"is-active":V.value.mode==="advanced"}]),type:"button",onClick:b[26]||(b[26]=y=>lr("advanced"))}," RRULE ",2)]),V.value.mode==="daily"?(k(),A("div",GC,[b[40]||(b[40]=h("span",{class:"automation-schedule-copy"},"Run every day at",-1)),jt(h("input",{"onUpdate:modelValue":b[27]||(b[27]=y=>V.value.dailyTime=y),class:"automation-schedule-time",type:"time",onInput:Ln},null,544),[[Yt,V.value.dailyTime]])])):V.value.mode==="interval"?(k(),A("div",KC,[b[42]||(b[42]=h("span",{class:"automation-schedule-copy"},"Run every",-1)),jt(h("input",{"onUpdate:modelValue":b[28]||(b[28]=y=>V.value.interval=y),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:Ln},null,544),[[Yt,V.value.interval,void 0,{number:!0}]]),jt(h("select",{"onUpdate:modelValue":b[29]||(b[29]=y=>V.value.intervalUnit=y),class:"automation-schedule-unit",onChange:Ln},[...b[41]||(b[41]=[h("option",{value:"minutes"},"minutes",-1),h("option",{value:"hours"},"hours",-1),h("option",{value:"days"},"days",-1)])],544),[[Hu,V.value.intervalUnit]])])):Q("",!0),V.value.mode==="advanced"?jt((k(),A("input",{key:2,"onUpdate:modelValue":b[30]||(b[30]=y=>$.value.rrule=y),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:Cr},null,544)),[[Yt,$.value.rrule]]):Q("",!0),h("p",YC,I(ce.value),1)]),h("label",JC,[b[44]||(b[44]=h("span",{class:"automation-thread-label"},"Status",-1)),jt(h("select",{"onUpdate:modelValue":b[31]||(b[31]=y=>$.value.status=y),class:"automation-thread-select"},[h("option",QC,I(S(o)("Active")),1),h("option",XC,I(S(o)("Paused")),1)],512),[[Hu,$.value.status]])]),pe.value?(k(),A("p",ZC,I(pe.value),1)):xe.value?(k(),A("p",eS,I(xe.value),1)):Q("",!0),h("div",tS,[nt.value==="edit"&&je.value==="thread"?(k(),A("button",{key:0,class:"rename-thread-button",type:"button",disabled:Ve.value||E.value,onClick:Zo},I(E.value?"Running…":"Run now"),9,nS)):Q("",!0),nt.value==="edit"?(k(),A("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:Ve.value||E.value,onClick:un}," Remove ",8,rS)):Q("",!0),h("button",{class:"rename-thread-button",type:"button",disabled:Ve.value||E.value,onClick:Fr},I(S(o)("Cancel")),9,oS),h("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:Ve.value||E.value,onClick:Zn},I(Ve.value?"Saving…":"Save"),9,aS)])],8,$C)])):Q("",!0)]))],2))}}),lS=xt(iS,[["__scopeId","data-v-0fb551da"]]),uS={class:"content-header"},cS=["title"],dS={class:"content-actions"},fS=Jn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(k(),A("header",uS,[h("div",{class:Qe(["content-leading",{"is-accent":e.accent}])},[Ko(t.$slots,"leading",{},void 0)],2),h("h1",{class:Qe(["content-title",{"is-accent":e.accent}]),title:e.title},I(e.title),11,cS),h("div",dS,[Ko(t.$slots,"actions",{},void 0)])]))}}),hS=xt(fS,[["__scopeId","data-v-f96f7210"]]),Sh=.0025,rc=3,xh=2,pS=256;function mS(e){var Ce;const t=x("idle"),n=x(typeof navigator<"u"&&!!((Ce=navigator.mediaDevices)!=null&&Ce.getUserMedia)),r=x(0),o=x(null);let a=null,s=null,u=[],c=null,m=null,f=null,w=null,_=[],P=!1,q=!1,O=null;function te(){O&&(O.abort(),O=null),t.value==="transcribing"&&(t.value="idle")}function F(){const ne=o.value;if(!ne||typeof window>"u")return;const Ae=ne.getContext("2d");if(!Ae)return;const We=Math.max(1,Math.floor(ne.clientWidth)),qe=Math.max(1,Math.floor(ne.clientHeight||36)),Be=window.devicePixelRatio||1,Ee=Math.max(1,Math.floor(We*Be)),Ie=Math.max(1,Math.floor(qe*Be));(ne.width!==Ee||ne.height!==Ie)&&(ne.width=Ee,ne.height=Ie),Ae.setTransform(Be,0,0,Be,0,0),Ae.clearRect(0,0,We,qe);const Ze=Math.max(12,Math.floor(We/(rc+xh))),je=_.slice(-Ze),et=Math.max(0,Ze-je.length),ze=qe/2,ct=getComputedStyle(ne).color||"#000000";for(let nt=0;nt<Ze;nt+=1){const Ye=je[nt-et]??0,X=Math.max(.08,Math.min(1,Ye*18))*ze,ke=nt*(rc+xh);Ae.globalAlpha=Ye<=Sh?.35:1,Ae.fillStyle=ct,Ae.fillRect(ke,ze-X,rc,X*2)}Ae.globalAlpha=1}function U(){_=[],r.value=0,F()}function G(){f&&(f.disconnect(),f.onaudioprocess=null,f=null),m&&(m.disconnect(),m=null),c&&(c.close(),c=null),w=null}function Y(ne){if(typeof window>"u")return;const Ae=window.webkitAudioContext,We=window.AudioContext??Ae;We&&(G(),U(),c=new We,m=c.createMediaStreamSource(ne),f=c.createScriptProcessor(2048,1,1),w=performance.now(),f.onaudioprocess=qe=>{const Be=qe.inputBuffer.getChannelData(0);let Ee=0;for(let Ie=0;Ie<Be.length;Ie+=1){const Ze=Math.abs(Be[Ie]??0);Ee+=Ze<Sh?0:Ze}_.push(Ee/Be.length),_.length>pS&&_.shift(),w!==null&&(r.value=Math.max(0,performance.now()-w)),F()},m.connect(f),f.connect(c.destination),F())}async function Te(){var ne;if(t.value==="transcribing"&&te(),!(t.value!=="idle"||!n.value||P)){P=!0,q=!1;try{s=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),u=[],a=new MediaRecorder(s),a.ondataavailable=Ae=>{Ae.data.size>0&&u.push(Ae.data)},a.onstop=()=>{var qe;const Ae=u,We=(a==null?void 0:a.mimeType)||((qe=Ae[0])==null?void 0:qe.type)||"audio/webm";K(),Se(Ae,We)},Y(s),a.start(250),t.value="recording",q&&Me()}catch(Ae){K(),t.value="idle",(ne=e.onError)==null||ne.call(e,Ae)}finally{P=!1}}}function Me(){if(P&&t.value==="idle"){q=!0;return}if(!(t.value!=="recording"||!a)&&a.state!=="inactive"){t.value="transcribing";try{a.requestData()}catch{}a.stop()}}function ae(){q=!1,te(),K(),t.value="idle"}async function Se(ne,Ae){var Be,Ee,Ie,Ze,je;if(ne.length===0){(Be=e.onEmpty)==null||Be.call(e),t.value="idle";return}const We=new Blob(ne,{type:Ae});t.value="transcribing";let qe=null;try{const et=Ae.split(/[/;]/)[1]??"webm",ze=new FormData;ze.append("file",We,`codex.${et}`);const ct=((Ee=e.getLanguage)==null?void 0:Ee.call(e).trim())??"";ct&&ct.toLowerCase()!=="auto"&&ze.append("language",ct),qe=new AbortController,O=qe;const nt=await fetch("/codex-api/transcribe",{method:"POST",body:ze,signal:qe.signal}),Ye=await nt.text();let vt=null;try{vt=Ye.trim()?JSON.parse(Ye):null}catch{vt=null}if(!nt.ok){const ke=(Ie=vt==null?void 0:vt.error)==null?void 0:Ie.trim(),pe=Ye.trim();throw new Error(ke||pe||`Transcription failed: ${nt.status}`)}const X=((vt==null?void 0:vt.text)??"").trim();X.length>0?e.onTranscript(X):(Ze=e.onEmpty)==null||Ze.call(e)}catch(et){if(et instanceof DOMException&&et.name==="AbortError")return;(je=e.onError)==null||je.call(e,et)}finally{qe&&O===qe&&(O=null),t.value==="transcribing"&&(t.value="idle")}}function K(){G(),U(),a&&(a.ondataavailable=null,a.onstop=null,a=null),s&&(s.getTracks().forEach(ne=>ne.stop()),s=null),u=[]}ns(()=>{ae()});function be(){if(t.value==="recording"){Me();return}(t.value==="idle"||t.value==="transcribing")&&Te()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:o,startRecording:Te,stopRecording:Me,toggleRecording:be,cancel:ae}}const vS={},gS={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function yS(e,t){return k(),A("svg",gS,[...t[0]||(t[0]=[h("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 wS=xt(vS,[["render",yS]]),bS={},_S={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function TS(e,t){return k(),A("svg",_S,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 2m0 3a3 3 0 0 1 3-3h0a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h0a3 3 0 0 1-3-3zM5 10a7 7 0 0 0 14 0M8 21h8M12 17v4"},null,-1)])])}const kS=xt(bS,[["render",TS]]),CS={},SS={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function xS(e,t){return k(),A("svg",SS,[...t[0]||(t[0]=[h("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),h("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 Ah=xt(CS,[["render",xS]]),AS=["title","aria-label","disabled"],ES={key:1,class:"composer-dropdown-value"},IS={class:"composer-dropdown-menu"},PS={key:0,class:"composer-dropdown-search-wrap"},RS=["placeholder","onKeydown"],MS={class:"composer-dropdown-options",role:"listbox"},$S=["onClick"],jS={key:0,class:"composer-dropdown-empty"},NS=Jn({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},selectedPrefixIcon:{},iconOnly:{type:Boolean},openDirection:{},enableSearch:{type:Boolean},searchPlaceholder:{},emptyLabel:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,o=x(null),a=x(null),s=x(!1),u=x(""),c=Z(()=>{var Te;const Y=n.options.find(Me=>Me.value===n.modelValue);return Y?Y.label:((Te=n.placeholder)==null?void 0:Te.trim())||""}),m=Z(()=>n.openDirection??"down"),f=Z(()=>n.iconOnly===!0),w=Z(()=>n.enableSearch===!0),_=Z(()=>{var Y;return((Y=n.searchPlaceholder)==null?void 0:Y.trim())||"Quick search projects"}),P=Z(()=>{var Y;return((Y=n.emptyLabel)==null?void 0:Y.trim())||"No results"}),q=Z(()=>{var Y;return c.value||((Y=n.placeholder)==null?void 0:Y.trim())||"Select option"}),O=Z(()=>{const Y=u.value.trim().toLowerCase();return Y?n.options.filter(Te=>Te.label.toLowerCase().includes(Y)||Te.value.toLowerCase().includes(Y)):n.options});function te(){n.disabled||(s.value=!s.value)}function F(Y){r("update:modelValue",Y),s.value=!1,u.value=""}function U(){if(u.value.length>0){u.value="";return}s.value=!1}function G(Y){if(!s.value)return;const Te=o.value;if(!Te)return;const Me=Y.target;Me instanceof Node&&(Te.contains(Me)||(s.value=!1,u.value=""))}return ht(s,Y=>{Y&&w.value&&Ht(()=>{var Te;return(Te=a.value)==null?void 0:Te.focus()})}),Ca(()=>{window.addEventListener("pointerdown",G)}),ns(()=>{window.removeEventListener("pointerdown",G)}),(Y,Te)=>(k(),A("div",{ref_key:"rootRef",ref:o,class:"composer-dropdown"},[h("button",{class:"composer-dropdown-trigger",type:"button",title:q.value,"aria-label":q.value,disabled:e.disabled,onClick:te},[e.selectedPrefixIcon?(k(),tt(Xc(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):Q("",!0),f.value?Q("",!0):(k(),A("span",ES,I(c.value),1)),Le(ks,{class:"composer-dropdown-chevron"})],8,AS),s.value?(k(),A("div",{key:0,class:Qe(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":m.value==="up","composer-dropdown-menu-wrap-down":m.value==="down"}])},[h("div",IS,[w.value?(k(),A("div",PS,[jt(h("input",{ref_key:"searchInputRef",ref:a,"onUpdate:modelValue":Te[0]||(Te[0]=Me=>u.value=Me),class:"composer-dropdown-search-input",type:"text",placeholder:_.value,onKeydown:on(Xe(U,["prevent"]),["esc"])},null,40,RS),[[Yt,u.value]])])):Q("",!0),h("ul",MS,[(k(!0),A(Ke,null,Dt(O.value,Me=>(k(),A("li",{key:Me.value},[h("button",{class:Qe(["composer-dropdown-option",{"is-selected":Me.value===e.modelValue}]),type:"button",onClick:ae=>F(Me.value)},I(Me.label),11,$S)]))),128)),O.value.length===0?(k(),A("li",jS,I(P.value),1)):Q("",!0)])])],2)):Q("",!0)],512))}}),Gs=xt(NS,[["__scopeId","data-v-5243a93d"]]),LS=["disabled"],OS={class:"search-dropdown-value"},DS={class:"search-dropdown-search-wrap"},FS={class:"search-dropdown-search-row"},US=["placeholder","onKeydown"],BS=["aria-label","title"],qS={key:0,class:"search-dropdown-list",role:"listbox"},HS=["onPointerenter"],WS=["onClick"],VS={class:"search-dropdown-option-check"},zS=["title"],GS={class:"search-dropdown-option-copy"},KS={class:"search-dropdown-option-label-row"},YS={class:"search-dropdown-option-label"},JS={key:0,class:"search-dropdown-option-type"},QS={key:0,class:"search-dropdown-option-desc"},XS=["aria-label","title","onClick"],ZS={key:1,class:"search-dropdown-empty"},ex=Jn({__name:"ComposerSearchDropdown",props:{options:{},selectedValues:{},placeholder:{},searchPlaceholder:{},disabled:{type:Boolean},openDirection:{},createLabel:{},allowRemove:{type:Boolean},removeLabel:{},displayLabelOverride:{}},emits:["toggle","create","remove"],setup(e,{emit:t}){const n=e,r=t,o=x(null),a=x(null),s=x(null),u=x(!1),c=x(""),m=x(0),f=x({}),{t:w}=rs(),_=Z(()=>n.openDirection??"down"),P=Z(()=>new Set(n.selectedValues)),q=Z(()=>{var ae;if((ae=n.displayLabelOverride)!=null&&ae.trim())return n.displayLabelOverride.trim();if(n.selectedValues.length===0)return n.placeholder||w("Select...");if(n.selectedValues.length===1){const Se=n.options.find(K=>K.value===n.selectedValues[0]);return(Se==null?void 0:Se.label)||n.placeholder||w("Select...")}return`${n.selectedValues.length} ${w("selected")}`}),O=Z(()=>{const ae=c.value.toLowerCase().trim();return ae?n.options.filter(Se=>{var K;return Se.label.toLowerCase().includes(ae)||(((K=Se.description)==null?void 0:K.toLowerCase().includes(ae))??!1)}):n.options});function te(){const ae=a.value,Se=o.value;if(!ae||!Se)return;const K=Se.getBoundingClientRect(),be=window.innerWidth,Ce=window.innerHeight,ne=Math.min(384,be-16),Ae=Math.max(8,Math.min(K.right-ne,be-ne-8));if(be<640){f.value={position:"fixed",left:"0.5rem",right:"0.5rem",width:"auto",top:_.value==="up"?"auto":`${K.bottom+8}px`,bottom:_.value==="up"?`${Ce-K.top+8}px`:"auto",zIndex:"120"};return}f.value={position:"fixed",width:`${ne}px`,left:`${Ae}px`,top:_.value==="up"?"auto":`${K.bottom+8}px`,bottom:_.value==="up"?`${Ce-K.top+8}px`:"auto",zIndex:"120"}}function F(){n.disabled||(u.value=!u.value,u.value&&(c.value="",m.value=0,Ht(()=>{var ae;Ht(()=>{te()}),(ae=s.value)==null||ae.focus()})))}function U(ae){r("toggle",ae.value,!P.value.has(ae.value)),u.value=!1}function G(ae){O.value.length!==0&&(m.value=(m.value+ae+O.value.length)%O.value.length)}function Y(){const ae=O.value[m.value];ae&&U(ae)}function Te(ae){if(!u.value)return;const Se=o.value,K=a.value;if(!Se)return;const be=ae.target;be instanceof Node&&(Se.contains(be)||K!=null&&K.contains(be)||(u.value=!1))}ht(c,()=>{m.value=0});function Me(){u.value&&te()}return Ca(()=>{window.addEventListener("pointerdown",Te),window.addEventListener("resize",Me),window.addEventListener("scroll",Me,!0)}),ns(()=>{window.removeEventListener("pointerdown",Te),window.removeEventListener("resize",Me),window.removeEventListener("scroll",Me,!0)}),(ae,Se)=>(k(),A("div",{ref_key:"rootRef",ref:o,class:"search-dropdown"},[h("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:F},[h("span",OS,I(q.value),1),Le(ks,{class:"search-dropdown-chevron"})],8,LS),(k(),tt(Xa,{to:"body"},[u.value?(k(),A("div",{key:0,ref_key:"menuRef",ref:a,class:Qe(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":_.value==="up","search-dropdown-menu-wrap-down":_.value==="down"}]),style:ya(f.value)},[h("div",DS,[h("div",FS,[jt(h("input",{ref_key:"searchRef",ref:s,"onUpdate:modelValue":Se[0]||(Se[0]=K=>c.value=K),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[Se[1]||(Se[1]=on(Xe(K=>u.value=!1,["prevent"]),["escape"])),on(Xe(Y,["prevent"]),["enter"]),Se[2]||(Se[2]=on(Xe(K=>G(1),["prevent"]),["arrow-down"])),Se[3]||(Se[3]=on(Xe(K=>G(-1),["prevent"]),["arrow-up"]))]},null,40,US),[[Yt,c.value]]),e.createLabel?(k(),A("button",{key:0,class:"search-dropdown-create-icon",type:"button","aria-label":e.createLabel,title:e.createLabel,onClick:Se[4]||(Se[4]=K=>r("create"))}," + ",8,BS)):Q("",!0)]),e.createLabel?(k(),A("button",{key:0,class:"search-dropdown-create",type:"button",onClick:Se[5]||(Se[5]=K=>r("create"))},I(e.createLabel),1)):Q("",!0)]),O.value.length>0?(k(),A("ul",qS,[(k(!0),A(Ke,null,Dt(O.value,(K,be)=>(k(),A("li",{key:K.value},[h("div",{class:Qe(["search-dropdown-option",{"is-selected":P.value.has(K.value),"is-highlighted":be===m.value}]),onPointerenter:Ce=>m.value=be},[h("button",{class:"search-dropdown-option-main",type:"button",onClick:Ce=>U(K)},[h("span",VS,I(P.value.has(K.value)?"✓":""),1),K.badge?(k(),A("span",{key:0,class:Qe(["search-dropdown-option-badge",K.badgeTone?`is-${K.badgeTone}`:""]),title:K.badgeLabel||K.badge,"aria-hidden":"true"},I(K.badge),11,zS)):Q("",!0),h("span",GS,[h("span",KS,[h("span",YS,I(K.label),1),K.badgeLabel?(k(),A("span",JS,I(K.badgeLabel),1)):Q("",!0)]),K.description?(k(),A("span",QS,I(K.description),1)):Q("",!0)])],8,WS),e.allowRemove&&K.removable?(k(),A("button",{key:0,class:"search-dropdown-option-remove",type:"button","aria-label":`${e.removeLabel} ${K.label}`,title:`${e.removeLabel} ${K.label}`,onClick:Xe(Ce=>r("remove",K.value),["stop"])}," × ",8,XS)):Q("",!0)],42,HS)]))),128))])):(k(),A("div",ZS,I(S(w)("No results")),1))],6)):Q("",!0)]))],512))}}),tx=xt(ex,[["__scopeId","data-v-65ed7fdf"]]),nx={key:0,class:"thread-composer-dictation-error"},rx={key:0,class:"thread-composer-attachments"},ox=["src","alt"],ax=["aria-label","disabled","onClick"],sx={key:1,class:"thread-composer-folder-chips"},ix=["title"],lx={class:"thread-composer-folder-chip-meta"},ux=["aria-label","disabled","onClick"],cx={key:2,class:"thread-composer-file-chips"},dx=["title"],fx=["aria-label","disabled","onClick"],hx={key:3,class:"thread-composer-skill-chips"},px=["title","aria-label","onClick"],mx=["aria-label","onClick"],vx={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},gx={key:1,class:"thread-composer-file-mentions"},yx=["onMousedown"],wx={key:1,class:"thread-composer-file-mention-icon-markdown"},bx={class:"thread-composer-file-mention-text"},_x={class:"thread-composer-file-mention-name"},Tx={key:0,class:"thread-composer-file-mention-dir"},kx={key:1,class:"thread-composer-file-mention-empty"},Cx=["placeholder","disabled"],Sx=["aria-label","disabled"],xx={key:0,class:"thread-composer-attach-menu"},Ax=["disabled"],Ex=["disabled"],Ix=["disabled"],Px={class:"thread-composer-attach-mode"},Rx={class:"thread-composer-attach-mode-label"},Mx={class:"thread-composer-attach-mode-buttons"},$x=["disabled"],jx=["disabled"],Nx=["aria-checked","aria-label","disabled"],Lx={class:"thread-composer-attach-setting-copy"},Ox={class:"thread-composer-attach-setting-label"},Dx={class:"thread-composer-attach-setting-description"},Fx=["aria-checked","aria-label","disabled"],Ux={class:"thread-composer-attach-setting-copy"},Bx={class:"thread-composer-attach-setting-label"},qx={class:"thread-composer-attach-setting-description"},Hx={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},Wx={key:1,class:"thread-composer-dictation-timer"},Vx=["aria-label","title","disabled"],zx=["aria-label","title","disabled"],Gx={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},Kx=["aria-label","title","disabled"],Yx=["disabled"],Jx=["disabled"],Qx=["disabled"],Xx=2e3,oc="prompt:",Zx="codex-web-local.thread-draft.v1.",eA=Jn({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},collaborationModes:{},selectedCollaborationMode:{},models:{},selectedModel:{},selectedReasoningEffort:{},selectedSpeedMode:{},skills:{},threadTokenUsage:{},codexQuota:{},isTurnInProgress:{type:Boolean},isStopPending:{type:Boolean},isInterruptingTurn:{type:Boolean},isUpdatingSpeedMode:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean},dictationAutoSend:{type:Boolean},dictationLanguage:{}},emits:["submit","interrupt","update:selected-collaboration-mode","update:selected-model","update:selected-reasoning-effort","update:selected-speed-mode"],setup(e,{expose:t,emit:n}){const r=e,o=n,{t:a}=rs(),s=x(""),u=x([]),c=x([]),m=x([]),f=x([]),w=x([]),_=x(""),P=x(0),q=x(null),O=x(!1),{state:te,isSupported:F,recordingDurationMs:U,waveformCanvasRef:G,startRecording:Y,stopRecording:Te,toggleRecording:Me,cancel:ae}=mS({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:M=>{if(s.value=s.value?`${s.value}
|
|
48
|
+
${M}`:M,_.value="",r.dictationAutoSend!==!1){const L=r.isTurnInProgress?$e.value:"steer";Pe(L);return}Ht(()=>{var L;return(L=ne.value)==null?void 0:L.focus()})},onEmpty:()=>{_.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:M=>{if(M instanceof DOMException&&M.name==="NotAllowedError"){_.value="Microphone access was denied.";return}_.value=M instanceof Error?M.message:"Dictation failed."}}),Se=x(null),K=x(null),be=x(null),Ce=x(null),ne=x(null),{isMobile:Ae}=id(),We=x(!1),qe=x(null),Be=x(""),Ee=x([]),Ie=x(!1),Ze=x(0),je=x(0);let et=0,ze=null,ct=!1,nt=0,Ye=0;const vt=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let X="";const ke=[{value:"none",label:"None"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"Extra high"}];function pe(M){return M.trim().replace(/^gpt/i,"GPT")}const xe=Z(()=>r.models.map(M=>({value:M,label:pe(M)}))),Ve=Z(()=>r.selectedCollaborationMode==="plan"),E=Z(()=>r.selectedCollaborationMode==="plan"&&r.selectedModel.trim().length===0),$=Z(()=>c.value.map(M=>M.path)),V=Z(()=>[...(r.skills??[]).map(M=>{const L=Xo(M);return{value:M.path,label:M.name,description:M.description,badge:L.badge,badgeLabel:L.badgeLabel,badgeTone:L.badgeTone,removable:!1}}),...m.value.map(M=>({value:po(M.path),label:M.name,description:M.description,badge:"T",badgeLabel:"Prompt",badgeTone:"prompt",removable:!0}))]),se=Z(()=>r.disabled||r.isUpdatingSpeedMode||!r.activeThreadId||E.value||P.value>0?!1:s.value.trim().length>0||u.value.length>0||f.value.length>0),ce=Z(()=>s.value.trim().length>0||u.value.length>0||c.value.length>0||f.value.length>0||w.value.length>0),ie=Z(()=>{const M=new Set;for(const L of w.value)for(const ee of L.filePaths)M.add(ee);return f.value.filter(L=>!M.has(L.fsPath))}),me=Z(()=>r.disabled||!r.activeThreadId),ue=Z(()=>r.disabled||!r.activeThreadId),ge=Z(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(r.selectedModel.trim())),he=Z(()=>r.selectedSpeedMode==="fast"&&ge.value),Fe=Z(()=>me.value||r.isUpdatingSpeedMode===!0),_e=Z(()=>r.isUpdatingSpeedMode?a("Saving speed setting..."):r.selectedSpeedMode==="fast"?a("About 1.5x faster, with credits used at 2x"):a("Default speed with normal credit usage")),Oe=Z(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),$e=x(Oe.value),Ge=Z(()=>te.value==="recording"),D=Z(()=>te.value==="recording"?a("Stop dictation"):r.dictationClickToToggle?a("Click to dictate"):a("Hold to dictate")),B=Z(()=>te.value==="idle"?_.value.trim():""),W=Z(()=>{const M=Math.max(0,Math.floor(U.value/1e3)),L=Math.floor(M/60),ee=M%60;return`${L}:${String(ee).padStart(2,"0")}`}),oe=Z(()=>r.activeThreadId?E.value?a("Loading models for plan mode..."):a("Type a message... (@ for files)"):a("Select a thread to send a message")),ye=Z(()=>s.value.trim().length>0||u.value.length>0||f.value.length>0);function Pe(M="steer"){var ee;const L=s.value.trim();if(se.value){if(o("submit",{text:L,imageUrls:u.value.map(Ne=>Ne.url),fileAttachments:[...f.value],skills:c.value.map(Ne=>({name:Ne.name,path:Ne.path})),mode:M}),Jt(r.activeThreadId),ut(),w.value=[],We.value=!1,Wt(),vt||Ae.value){(ee=ne.value)==null||ee.blur();return}Ht(()=>{var Ne;return(Ne=ne.value)==null?void 0:Ne.focus()})}}function De(M){$e.value=M}function rt(M){je.value+=1,s.value=M.text,u.value=M.imageUrls.map((L,ee)=>({id:`queued-${Date.now()}-${ee}-${Math.random().toString(36).slice(2,8)}`,name:`Image ${ee+1}`,url:L})),c.value=M.skills.map(L=>(r.skills??[]).find(ee=>ee.path===L.path)??{name:L.name,displayName:void 0,description:"",path:L.path}),f.value=M.fileAttachments.map(L=>({...L})),w.value=[],_.value="",q.value=null,P.value=0,We.value=!1,Wt(),Ye+=1}function ut(){rt({text:"",imageUrls:[],fileAttachments:[],skills:[]})}function gt(M){return`${Zx}${M}`}function ft(M){if(typeof window>"u")return null;const L=M.trim();if(!L)return null;try{const ee=window.localStorage.getItem(gt(L));if(!ee)return null;const Ne=JSON.parse(ee);return typeof Ne=="string"?{text:Ne,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof Ne.text=="string"?Ne.text:"",imageUrls:Array.isArray(Ne.imageUrls)?Ne.imageUrls.filter(wt=>typeof wt=="string"):[],fileAttachments:Array.isArray(Ne.fileAttachments)?Ne.fileAttachments.filter(wt=>!!wt&&typeof wt.label=="string"&&typeof wt.path=="string"&&typeof wt.fsPath=="string"):[],skills:Array.isArray(Ne.skills)?Ne.skills.filter(wt=>!!wt&&typeof wt.name=="string"&&typeof wt.path=="string"):[]}}catch{return null}}function Tt(M,L){if(typeof window>"u")return;const ee=M.trim();if(ee)try{if(L.text.trim().length>0||L.imageUrls.length>0||L.fileAttachments.length>0||L.skills.length>0){window.localStorage.setItem(gt(ee),JSON.stringify(L));return}window.localStorage.removeItem(gt(ee))}catch{}}function Jt(M){Tt(M,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Dn(){return{text:s.value,imageUrls:u.value.map(M=>M.url),fileAttachments:f.value.map(M=>({...M})),skills:c.value.map(M=>({name:M.name,path:M.path}))}}function ao(){o("interrupt")}function Sa(M){o("update:selected-model",M)}function kn(){o("update:selected-collaboration-mode",Ve.value?"default":"plan")}function Cn(M){o("update:selected-reasoning-effort",M)}function so(){Fe.value||o("update:selected-speed-mode",r.selectedSpeedMode==="fast"?"standard":"fast")}function Mo(){r.dictationClickToToggle&&(_.value&&(_.value=""),Me())}function wn(M){if(r.dictationClickToToggle||(M.preventDefault(),ct))return;ct=!0;const L=M.currentTarget;if(L)try{L.setPointerCapture(M.pointerId)}catch{}_.value&&(_.value=""),window.addEventListener("pointerup",cn),window.addEventListener("pointercancel",cn),window.addEventListener("blur",cn),Y()}function cn(){r.dictationClickToToggle||ct&&(ct=!1,window.removeEventListener("pointerup",cn),window.removeEventListener("pointercancel",cn),window.removeEventListener("blur",cn),Te())}function gr(){me.value||(We.value=!We.value)}function io(){var M;(M=K.value)==null||M.click()}function jr(){var M;(M=be.value)==null||M.click()}function yr(){var M;(M=Ce.value)==null||M.click()}function xa(M){u.value=u.value.filter(L=>L.id!==M)}function Qo(M){c.value=c.value.filter(L=>L.path!==M)}function Qn(M){const L=M.trim();return L?L.endsWith("/SKILL.md")?L:`${L.replace(/\/+$/,"")}/SKILL.md`:""}function lo(M){const L=Qn(M.path);!L||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(L)}`,"_blank","noopener,noreferrer")}function $o(M){f.value=f.value.filter(L=>L.fsPath!==M)}function an(M){const L=w.value.find(Ne=>Ne.id===M);if(!L)return;const ee=new Set(L.filePaths);f.value=f.value.filter(Ne=>!ee.has(Ne.fsPath)),w.value=w.value.filter(Ne=>Ne.id!==M)}function pt(M){return M.total<=0?0:Math.round(M.processed/M.total*100)}function Qt(M,L){const ee=M.replace(/\\/g,"/");if(f.value.some(Gt=>Gt.fsPath===ee))return;const Ne=ee.split("/").filter(Boolean),wt=(L==null?void 0:L.trim())||Ne[Ne.length-1]||ee;f.value=[...f.value,{label:wt,path:ee,fsPath:ee}]}function Fn(M){return M.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(M.name)}function Ot(M){return M?Array.from(M):[]}function sn(M){return M!==Ye?!1:(P.value+=1,!0)}function uo(M){M===Ye&&(P.value=Math.max(0,P.value-1))}function Gr(M){if(M<=0)return;const L=q.value,ee=L?L.succeeded+L.failed:0;if(!L||ee>=L.total){q.value={total:M,succeeded:0,failed:0};return}q.value={...L,total:L.total+M}}function dn(M){const L=q.value;L&&(q.value={...L,succeeded:L.succeeded+(M==="success"?1:0),failed:L.failed+(M==="failure"?1:0)})}function fn(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function Ft(M){const L=new Date,ee=[L.getFullYear(),String(L.getMonth()+1).padStart(2,"0"),String(L.getDate()).padStart(2,"0"),String(L.getHours()).padStart(2,"0"),String(L.getMinutes()).padStart(2,"0"),String(L.getSeconds()).padStart(2,"0")].join("-"),Ne=M.type.startsWith("image/")&&M.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${ee}.${Ne}`}function $n(){const M=new Date;return`pasted-text-${[M.getFullYear(),String(M.getMonth()+1).padStart(2,"0"),String(M.getDate()).padStart(2,"0"),String(M.getHours()).padStart(2,"0"),String(M.getMinutes()).padStart(2,"0"),String(M.getSeconds()).padStart(2,"0")].join("-")}.txt`}function wr(M){return M.name.trim()?M:new File([M],Ft(M),{type:M.type||"image/png",lastModified:Date.now()})}async function co(M,L){if(sn(L))try{const ee=wr(M),Ne=await nc(ee);if(L!==Ye)return;if(!Ne){dn("failure");return}u.value=[...u.value,{id:fn(),name:ee.name,url:`/codex-local-image?path=${encodeURIComponent(Ne)}`}],dn("success")}catch{L===Ye&&dn("failure")}finally{uo(L)}}async function jo(M,L){if(sn(L))try{const ee=await nc(M);if(L!==Ye)return;if(!ee){dn("failure");return}Qt(ee),dn("success")}catch{L===Ye&&dn("failure")}finally{uo(L)}}function jn(M){const L=Ot(M);if(L.length===0)return;Gr(L.length),We.value=!1,Wt();const ee=Ye;for(const Ne of L)Fn(Ne)?co(Ne,ee):jo(Ne,ee)}function fo(){nt=0,O.value=!1}function br(M){return M?Array.from(M.types??[]).includes("Files"):!1}async function bn(M){if(!M||M.length===0)return;const L=je.value,ee=Array.from(M),wt=(ee[0].webkitRelativePath||ee[0].name).split("/").filter(Boolean)[0]||"Folder",Gt=`${Date.now()}-${Math.random().toString(36).slice(2)}`;w.value=[...w.value,{id:Gt,name:wt,total:ee.length,processed:0,filePaths:[],isUploading:!0}];const ln=Vt=>{L===je.value&&(w.value=w.value.map(hn=>hn.id===Gt?Vt(hn):hn))};for(const Vt of ee)try{const hn=await nc(Vt);if(L!==je.value)return;if(hn){const xr=Vt.webkitRelativePath||Vt.name;Qt(hn,xr),ln(qn=>({...qn,processed:qn.processed+1,filePaths:[...qn.filePaths,hn]}));continue}ln(xr=>({...xr,processed:xr.processed+1}))}catch{ln(hn=>({...hn,processed:hn.processed+1}))}ln(Vt=>({...Vt,isUploading:!1}))}function gn(M){M&&(M.value="")}function _n(M){const L=M.target;jn((L==null?void 0:L.files)??null),gn(L),We.value=!1}function _r(M){const L=M.target;jn((L==null?void 0:L.files)??null),gn(L),We.value=!1}function Nr(M){const L=M.target;bn((L==null?void 0:L.files)??null),gn(L),We.value=!1}function ho(M){me.value||!br(M.dataTransfer)||(M.preventDefault(),nt+=1,O.value=!0)}function Nn(M){me.value||!br(M.dataTransfer)||(M.preventDefault(),M.dataTransfer&&(M.dataTransfer.dropEffect="copy"),O.value=!0)}function Lr(M){O.value&&(M.preventDefault(),nt=Math.max(0,nt-1),nt===0&&fo())}function Un(M){var L;me.value||!br(M.dataTransfer)||(M.preventDefault(),fo(),jn(((L=M.dataTransfer)==null?void 0:L.files)??null))}function Pt(){!O.value&&nt===0||fo()}function ir(M){var Gt,ln;if(me.value)return;const L=((Gt=M.clipboardData)==null?void 0:Gt.getData("text/plain"))??"";if(L.length>=Xx){M.preventDefault();const Vt=new File([L],$n(),{type:"text/plain",lastModified:Date.now()});jn([Vt]);return}const ee=Array.from(((ln=M.clipboardData)==null?void 0:ln.items)??[]);if(ee.length===0)return;const Ne=L.length>0,wt=ee.filter(Vt=>Vt.kind==="file"&&Vt.type.startsWith("image/")).map(Vt=>Vt.getAsFile()).filter(Vt=>Vt instanceof File);wt.length!==0&&(Ne||M.preventDefault(),jn(wt))}function Tr(){_.value&&(_.value=""),nn()}function kr(M){if(Ie.value){if(M.key==="Escape"){M.preventDefault(),Wt();return}if(M.key==="ArrowDown"){M.preventDefault(),Ee.value.length>0&&(Ze.value=(Ze.value+1)%Ee.value.length);return}if(M.key==="ArrowUp"){if(M.preventDefault(),Ee.value.length>0){const ee=Ee.value.length;Ze.value=(Ze.value+ee-1)%ee}return}if(M.key==="Enter"||M.key==="Tab"){M.preventDefault();const ee=Ee.value[Ze.value];ee?Cr(ee):Wt();return}}if(r.sendWithEnter!==!1?M.key==="Enter"&&!M.shiftKey:M.key==="Enter"&&(M.metaKey||M.ctrlKey)){M.preventDefault(),Pe(r.isTurnInProgress?$e.value:"steer");return}}function Wt(){Ie.value=!1,qe.value=null,Be.value="",Ee.value=[],Ze.value=0}function nn(){const M=ne.value;if(!M){Wt();return}const L=M.selectionStart??s.value.length,Ne=s.value.slice(0,L).match(/(^|\s)(@[^\s@]*)$/);if(!Ne){Wt();return}const wt=Ne[2]??"",Gt=wt.length,ln=L-Gt;qe.value=ln,Be.value=wt.slice(1),Ie.value=!0,Ln()}async function Ln(){if(!Ie.value)return;const M=(r.cwd??"").trim();if(!M){Ee.value=[];return}ze&&clearTimeout(ze);const L=++et;ze=setTimeout(async()=>{try{const ee=await ST(M,Be.value,20);if(!Ie.value||L!==et)return;Ee.value=ee,Ze.value=0}catch{if(!Ie.value||L!==et)return;Ee.value=[]}},120)}function Cr(M){const L=ne.value,ee=qe.value;if(ee!==null&&L){const Ne=L.selectionStart??s.value.length;s.value=`${s.value.slice(0,ee)}${s.value.slice(Ne)}`.trimEnd()}Qt(M.path),Wt(),Ht(()=>L==null?void 0:L.focus())}function lr(M){ae(),rt(M),Ht(()=>{var L;return(L=ne.value)==null?void 0:L.focus()})}function Xn(M){const L=M.trim();L&&(ae(),s.value.trim().length>0?s.value=`${s.value.trimEnd()}
|
|
49
|
+
${L}`:s.value=L,Ht(()=>{var ee;return(ee=ne.value)==null?void 0:ee.focus()}))}async function Or(){m.value=await DT()}function po(M){return`${oc}${M}`}function ur(M){return M.startsWith(oc)?M.slice(oc.length):null}async function rn(){var Ne;const M=((Ne=window.prompt(a("Prompt name")))==null?void 0:Ne.trim())??"";if(!M)return;const L=window.prompt(a("Prompt content"))??"";if(!L.trim())return;const ee=await FT(M,L);ee&&(await Or(),Xn(ee.content))}async function kt(M){const L=ur(M)??M,ee=m.value.find(Gt=>Gt.path===L);!window.confirm(ee?`${a("Remove prompt")} "${ee.name}"?`:a("Remove prompt"))||!await UT(L)||await Or()}function Sn(M){const L=m.value.find(ee=>ee.path===M);L&&Xn(L.content)}function Ut(M){const L=M.lastIndexOf("/");return L<0?M:M.slice(L+1)}function yt(M){const L=M.lastIndexOf("/");return L<=0?"":M.slice(0,L)}function Bt(M){const L=Ut(M),ee=L.lastIndexOf(".");return ee<=0?"":L.slice(ee+1).toLowerCase()}function Sr(M){const L=Bt(M);return L==="ts"?"TS":L==="tsx"?"TSX":L==="js"?"JS":L==="jsx"?"JSX":L==="json"?"{}":""}function Bn(M){const L=Bt(M);return L.startsWith("ts")?"ts":L.startsWith("js")?"js":L==="json"?"json":"default"}function Tn(M){const L=Bt(M);return L==="md"||L==="mdx"}function Xo(M){return M.path.toLowerCase().includes("/plugins/cache/")?{badge:"P",badgeLabel:"Plugin",badgeTone:"plugin"}:M.scope==="repo"?{badge:"R",badgeLabel:"Repo",badgeTone:"repo"}:M.scope==="system"?{badge:"S",badgeLabel:"System",badgeTone:"system"}:{badge:"U",badgeLabel:"User",badgeTone:"user"}}function Dr(M,L){const ee=ur(M);if(ee){Sn(ee);return}if(L){const Ne=(r.skills??[]).find(wt=>wt.path===M);Ne&&!c.value.some(wt=>wt.path===M)&&(c.value=[...c.value,Ne])}else c.value=c.value.filter(Ne=>Ne.path!==M)}function xn(M){if(!We.value)return;const L=Se.value;if(!L)return;const ee=M.target;!ee||L.contains(ee)||(We.value=!1)}return Ca(()=>{document.addEventListener("click",xn),window.addEventListener("drop",Pt),window.addEventListener("dragend",Pt),window.addEventListener("blur",Pt),Or()}),t({hydrateDraft:lr,appendTextToDraft:Xn,hasUnsavedDraft:()=>ce.value}),ns(()=>{document.removeEventListener("click",xn),window.removeEventListener("drop",Pt),window.removeEventListener("dragend",Pt),window.removeEventListener("blur",Pt),window.removeEventListener("pointerup",cn),window.removeEventListener("pointercancel",cn),window.removeEventListener("blur",cn),ze&&clearTimeout(ze)}),ht(()=>r.activeThreadId,M=>{ae(),X&&Tt(X,Dn()),ut();const L=ft(M);L&&(rt(L),Tr()),X=M.trim()},{immediate:!0}),ht([s,u,f,c],()=>{X&&Tt(X,Dn())},{deep:!0}),ht(()=>r.cwd,()=>{Ie.value&&Ln()}),ht(Oe,M=>{$e.value=M}),(M,L)=>(k(),A("form",{class:"thread-composer",onSubmit:L[4]||(L[4]=Xe(ee=>Pe(e.isTurnInProgress?$e.value:"steer"),["prevent"]))},[B.value?(k(),A("p",nx,I(B.value),1)):Q("",!0),h("div",{class:Qe(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":O.value}])},[u.value.length>0?(k(),A("div",rx,[(k(!0),A(Ke,null,Dt(u.value,ee=>(k(),A("div",{key:ee.id,class:"thread-composer-attachment"},[h("img",{class:"thread-composer-attachment-image",src:ee.url,alt:ee.name||"Selected image"},null,8,ox),h("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${ee.name||"image"}`,disabled:me.value,onClick:Ne=>xa(ee.id)}," x ",8,ax)]))),128))])):Q("",!0),w.value.length>0?(k(),A("div",sx,[(k(!0),A(Ke,null,Dt(w.value,ee=>(k(),A("span",{key:ee.id,class:"thread-composer-folder-chip"},[Le(fd,{class:"thread-composer-folder-chip-icon"}),h("span",{class:"thread-composer-folder-chip-name",title:ee.name},I(ee.name),9,ix),h("span",lx,[ee.isUploading?(k(),A(Ke,{key:0},[As(I(pt(ee))+"% uploading ("+I(ee.processed)+"/"+I(ee.total)+") ",1)],64)):(k(),A(Ke,{key:1},[As(I(ee.filePaths.length)+" file"+I(ee.filePaths.length===1?"":"s"),1)],64))]),h("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${ee.name}`,disabled:me.value,onClick:Ne=>an(ee.id)},"×",8,ux)]))),128))])):Q("",!0),ie.value.length>0?(k(),A("div",cx,[(k(!0),A(Ke,null,Dt(ie.value,ee=>(k(),A("span",{key:ee.fsPath,class:"thread-composer-file-chip"},[Le(li,{class:"thread-composer-file-chip-icon"}),h("span",{class:"thread-composer-file-chip-name",title:ee.fsPath},I(ee.label),9,dx),h("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${ee.label}`,disabled:me.value,onClick:Ne=>$o(ee.fsPath)},"×",8,fx)]))),128))])):Q("",!0),c.value.length>0?(k(),A("div",hx,[(k(!0),A(Ke,null,Dt(c.value,ee=>(k(),A("span",{key:ee.path,class:"thread-composer-skill-chip"},[h("button",{class:"thread-composer-skill-chip-name",type:"button",title:Qn(ee.path),"aria-label":`Open ${ee.displayName||ee.name} SKILL.md`,onClick:Ne=>lo(ee)},I(ee.displayName||ee.name),9,px),h("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${ee.displayName||ee.name}`,onClick:Ne=>Qo(ee.path)},"×",8,mx)]))),128))])):Q("",!0),h("div",{class:Qe(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":O.value}]),onDragenter:ho,onDragover:Nn,onDragleave:Lr,onDrop:Un},[O.value?(k(),A("div",vx,[...L[5]||(L[5]=[h("span",{class:"thread-composer-drop-overlay-copy"},"Drop images or files",-1)])])):Q("",!0),Ie.value?(k(),A("div",gx,[Ee.value.length>0?(k(!0),A(Ke,{key:0},Dt(Ee.value,(ee,Ne)=>(k(),A("button",{key:ee.path,class:Qe(["thread-composer-file-mention-row",{"is-active":Ne===Ze.value}]),type:"button",onMousedown:Xe(wt=>Cr(ee),["prevent"])},[Sr(ee.path)?(k(),A("span",{key:0,class:Qe(["thread-composer-file-mention-icon-badge",`is-${Bn(ee.path)}`])},I(Sr(ee.path)),3)):Tn(ee.path)?(k(),A("span",wx,"↓")):(k(),tt(li,{key:2,class:"thread-composer-file-mention-icon-file"})),h("span",bx,[h("span",_x,I(Ut(ee.path)),1),yt(ee.path)?(k(),A("span",Tx,I(yt(ee.path)),1)):Q("",!0)])],42,yx))),128)):(k(),A("div",kx,I(S(a)("No matching files")),1))])):Q("",!0),jt(h("textarea",{ref_key:"inputRef",ref:ne,"onUpdate:modelValue":L[0]||(L[0]=ee=>s.value=ee),class:"thread-composer-input",placeholder:oe.value,disabled:me.value,onInput:Tr,onKeydown:kr,onPaste:ir},null,40,Cx),[[Yt,s.value]])],34),h("div",{class:Qe(["thread-composer-controls",{"thread-composer-controls--recording":Ge.value}])},[h("div",{ref_key:"attachMenuRootRef",ref:Se,class:"thread-composer-attach"},[h("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":S(a)("Add photos & files"),disabled:me.value,onClick:gr}," + ",8,Sx),We.value?(k(),A("div",xx,[h("button",{class:"thread-composer-attach-item",type:"button",disabled:me.value,onClick:io},I(S(a)("Add photos & files")),9,Ax),h("button",{class:"thread-composer-attach-item",type:"button",disabled:me.value,onClick:yr},I(S(a)("Add folder")),9,Ex),h("button",{class:"thread-composer-attach-item",type:"button",disabled:me.value,onClick:jr},I(S(a)("Take photo")),9,Ix),L[6]||(L[6]=h("div",{class:"thread-composer-attach-separator"},null,-1)),h("div",Px,[h("span",Rx,I(S(a)("In-progress send")),1),h("div",Mx,[h("button",{class:Qe(["thread-composer-attach-mode-button",{"is-active":$e.value==="steer"}]),type:"button",disabled:me.value,onClick:L[1]||(L[1]=ee=>De("steer"))},I(S(a)("Steer")),11,$x),h("button",{class:Qe(["thread-composer-attach-mode-button",{"is-active":$e.value==="queue"}]),type:"button",disabled:me.value,onClick:L[2]||(L[2]=ee=>De("queue"))},I(S(a)("Queue")),11,jx)])]),L[7]||(L[7]=h("div",{class:"thread-composer-attach-separator"},null,-1)),ge.value?(k(),A("button",{key:0,class:"thread-composer-attach-setting",type:"button",role:"switch","aria-checked":e.selectedSpeedMode==="fast","aria-label":`${S(a)("Fast mode")} ${e.selectedSpeedMode==="fast"?S(a)("enabled"):S(a)("disabled")}`,disabled:Fe.value,onClick:so},[h("span",Lx,[h("span",Ox,I(S(a)("Fast mode")),1),h("span",Dx,I(_e.value),1)]),h("span",{class:Qe(["thread-composer-attach-switch",{"is-on":e.selectedSpeedMode==="fast","is-busy":e.isUpdatingSpeedMode,"is-disabled":Fe.value}])},null,2)],8,Nx)):Q("",!0),h("button",{class:"thread-composer-attach-setting",type:"button",role:"switch","aria-checked":Ve.value,"aria-label":Ve.value?S(a)("Disable plan mode"):S(a)("Enable plan mode"),disabled:ue.value,onClick:kn},[h("span",Ux,[h("span",Bx,I(S(a)("Plan mode")),1),h("span",qx,I(S(a)("Agent proposes a plan before acting")),1)]),h("span",{class:Qe(["thread-composer-attach-switch",{"is-on":Ve.value}])},null,2)],8,Fx)])):Q("",!0)],512),Ge.value?Q("",!0):(k(),A(Ke,{key:0},[Le(Gs,{class:"thread-composer-control","model-value":e.selectedModel,options:xe.value,"selected-prefix-icon":he.value?ko:null,placeholder:S(a)("Model"),"open-direction":"up",disabled:ue.value||e.models.length===0,"enable-search":"","search-placeholder":S(a)("Search models..."),"onUpdate:modelValue":Sa},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Le(tx,{class:"thread-composer-control",options:V.value,"selected-values":$.value,placeholder:S(a)("Skills"),"search-placeholder":S(a)("Search skills and prompts..."),"create-label":S(a)("Add new prompt"),"allow-remove":!0,"remove-label":S(a)("Remove prompt"),"open-direction":"up",disabled:ue.value,onToggle:Dr,onCreate:rn,onRemove:kt},null,8,["options","selected-values","placeholder","search-placeholder","create-label","remove-label","disabled"]),Le(Gs,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:ke,placeholder:S(a)("Thinking"),"open-direction":"up",disabled:ue.value,"onUpdate:modelValue":Cn},null,8,["model-value","placeholder","disabled"])],64)),h("div",{class:Qe(["thread-composer-actions",{"thread-composer-actions--recording":Ge.value}])},[S(te)==="recording"?(k(),A("div",Hx,[h("canvas",{ref_key:"dictationWaveformCanvasRef",ref:G,class:"thread-composer-dictation-waveform"},null,512)])):Q("",!0),S(te)==="recording"?(k(),A("span",Wx,I(W.value),1)):Q("",!0),S(F)?(k(),A("button",{key:2,class:Qe(["thread-composer-mic",{"thread-composer-mic--active":S(te)==="recording"}]),type:"button","aria-label":D.value,title:D.value,disabled:me.value,onClick:Mo,onPointerdown:wn,onPointerup:cn,onPointercancel:cn},[S(te)==="recording"?(k(),tt(Ah,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):(k(),tt(kS,{key:1,class:"thread-composer-mic-icon"}))],42,Vx)):Q("",!0),e.isTurnInProgress&&!ye.value?(k(),A("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?S(a)("Saving thread before stop is available"):S(a)("Stop"),title:e.isStopPending?S(a)("Saving thread before stop is available"):S(a)("Stop"),disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending,onClick:ao},[e.isStopPending?(k(),A("span",Gx)):(k(),tt(Ah,{key:1,class:"thread-composer-stop-icon"}))],8,zx)):(k(),A("button",{key:4,class:Qe(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&$e.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&$e.value==="queue"?S(a)("Queue message"):S(a)("Send message"),title:e.isTurnInProgress?`${S(a)("Send")} ${$e.value==="queue"?S(a)("Queue"):S(a)("Steer")}`:S(a)("Send"),disabled:!se.value,onClick:L[3]||(L[3]=ee=>Pe(e.isTurnInProgress?$e.value:"steer"))},[Le(wS,{class:"thread-composer-submit-icon"})],10,Kx))],2)],2)],2),h("input",{ref_key:"photoLibraryInputRef",ref:K,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:me.value,onChange:_n},null,40,Yx),h("input",{ref_key:"cameraCaptureInputRef",ref:be,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:me.value,onChange:_r},null,40,Jx),h("input",{ref_key:"folderPickerInputRef",ref:Ce,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:me.value,onChange:Nr},null,40,Qx)],32))}}),Eh=xt(eA,[["__scopeId","data-v-9f6b9876"]]),tA={key:0,class:"thread-pending-request"},nA={class:"thread-pending-request-title"},rA=["title"],oA={class:"thread-pending-request-approval"},aA=["aria-label"],sA=["aria-pressed","onClick"],iA={class:"thread-pending-request-option-index"},lA={class:"thread-pending-request-option-label"},uA={class:"thread-pending-request-footer thread-pending-request-footer--approval"},cA=["value","placeholder"],dA={class:"thread-pending-request-header"},fA={class:"thread-pending-request-heading"},hA={class:"thread-pending-request-eyebrow"},pA={class:"thread-pending-request-title"},mA={key:0,class:"thread-pending-request-counter"},vA={key:0,class:"thread-pending-request-preview"},gA={class:"thread-pending-request-preview-code"},yA={key:1,class:"thread-pending-request-user-input"},wA={key:0,class:"thread-pending-request-question-description"},bA=["href"],_A={class:"thread-pending-request-question-title"},TA={key:0},kA={key:0,class:"thread-pending-request-question-text"},CA={key:1,class:"thread-pending-request-input-wrap"},SA={class:"thread-pending-request-select-label"},xA=["type","value","onInput"],AA={key:2,class:"thread-pending-request-select-wrap"},EA={class:"thread-pending-request-select-label"},IA=["value","onChange"],PA={key:0,value:""},RA={value:"true"},MA={value:"false"},$A={key:3,class:"thread-pending-request-select-wrap"},jA={class:"thread-pending-request-select-label"},NA=["value","onChange"],LA={key:0,value:""},OA=["value"],DA={key:4,class:"thread-pending-request-question-options"},FA=["checked","onChange"],UA={class:"thread-pending-request-checkbox-label"},BA={key:2,class:"thread-pending-request-validation-error"},qA={class:"thread-pending-request-footer"},HA={key:2,class:"thread-pending-request-user-input"},WA={class:"thread-pending-request-question-title"},VA={key:0,class:"thread-pending-request-question-text"},zA={key:1,class:"thread-pending-request-question-options"},GA={class:"thread-pending-request-select-wrap"},KA={class:"thread-pending-request-select-label"},YA=["value","onChange"],JA=["value"],QA={key:0,class:"thread-pending-request-question-description"},XA={key:2,class:"thread-pending-request-input-wrap"},ZA={class:"thread-pending-request-select-label"},eE=["value","placeholder","onInput"],tE={class:"thread-pending-request-footer"},nE={key:3,class:"thread-pending-request-actions"},rE={key:4,class:"thread-pending-request-actions"},oE=Jn({__name:"ThreadPendingRequestPanel",props:{request:{},requestCount:{},hasQueueAbove:{type:Boolean}},emits:["respondServerRequest"],setup(e,{emit:t}){const n=e,r=t,o=x("accept"),a=x(""),s=x({}),u=x({}),c=x({}),m=x(""),{t:f}=rs();function w(D){return D!==null&&typeof D=="object"&&!Array.isArray(D)?D:null}function _(D){return typeof D=="string"?D.trim():""}function P(D){return typeof D=="string"?D:null}function q(D){return/^[A-Za-z0-9_./:@%+=,-]+$/.test(D)?D:JSON.stringify(D)}function O(D){const W=(Array.isArray(D.commandActions)?D.commandActions:[]).map(oe=>w(oe)).map(oe=>_(oe==null?void 0:oe.command)).find(oe=>oe.length>0);if(W)return W.replace(/\s+/g," ").trim();if(Array.isArray(D.command)){const oe=D.command.filter(ye=>typeof ye=="string").map(ye=>ye.trim()).filter(ye=>ye.length>0);if(oe.length>0)return oe.map(ye=>q(ye)).join(" ")}return Se(_(D.command))}function te(D){return D.method==="item/commandExecution/requestApproval"||D.method==="execCommandApproval"}function F(D){return D.method==="item/fileChange/requestApproval"||D.method==="applyPatchApproval"}function U(D){return D.method==="item/permissions/requestApproval"}function G(D){return te(D)||F(D)||U(D)}function Y(D){return D.method==="mcpServer/elicitation/request"}function Te(D){const B=w(D.params);return _(B==null?void 0:B.reason)||_(B==null?void 0:B.prompt)||_(B==null?void 0:B.message)}function Me(D){return G(D)?"Awaiting approval":Y(D)?"MCP server input required":D.method==="item/tool/requestUserInput"?"Awaiting response":D.method==="item/tool/call"?"Tool call waiting for response":D.method}function ae(D){const B=Te(D);return B||(te(D)?"Do you want to run this command?":F(D)?"Do you want to make these changes?":U(D)?"Do you want to grant these permissions?":Y(D)?"An MCP server needs your input before Codex can continue.":D.method==="item/tool/requestUserInput"?"Codex needs your answer before it can continue.":"Codex is waiting for a response before it can continue.")}function Se(D){var Pe;const B=D.trim();if(!B)return"";const W=B.match(/-Command\s+(.+)$/i),oe=((Pe=W==null?void 0:W[1])==null?void 0:Pe.trim())??B;return(oe.startsWith('"')&&oe.endsWith('"')?oe.slice(1,-1):oe).replace(/\\"/g,'"').replace(/`"/g,'"').replace(/""/g,'"').replace(/\s+/g," ").trim()}function K(D){const B=w(D.params);if(!B)return"";if(te(D))return O(B);if(F(D)){const W=_(B.grantRoot)||_(B.grant_root);if(W)return W.replace(/\s+/g," ").trim();const oe=w(B.fileChanges)??w(B.changes);if(!oe)return"";const ye=Object.keys(oe).map(Pe=>Pe.trim()).filter(Pe=>Pe.length>0);return ye.length===0?"":ye.slice(0,3).join(", ")}return U(D)?be(B.permissions):Y(D)?_(B.serverName)||_(B.url):""}function be(D){const B=w(D);if(!B)return"";const W=[],oe=w(B.fileSystem),ye=w(B.network),Pe=Array.isArray(oe==null?void 0:oe.read)?oe.read.filter(rt=>typeof rt=="string"):[],De=Array.isArray(oe==null?void 0:oe.write)?oe.write.filter(rt=>typeof rt=="string"):[];return Pe.length>0&&W.push(`Read: ${Pe.join(", ")}`),De.length>0&&W.push(`Write: ${De.join(", ")}`),(ye==null?void 0:ye.enabled)===!0&&W.push("Network access"),W.join(" • ")}function Ce(D){return!D||!G(D)?[]:[{id:"accept",label:"Yes"},{id:"acceptForSession",label:"Yes for Session"}]}const ne=Z(()=>Ce(n.request));ht(()=>{var D;return((D=n.request)==null?void 0:D.id)??0},()=>{var D;a.value="",s.value={},u.value={},c.value={},m.value="",o.value=((D=ne.value[0])==null?void 0:D.id)??"accept"},{immediate:!0}),ht(ne,D=>{var B;o.value!=="decline"&&(D.some(W=>W.id===o.value)||(o.value=((B=D[0])==null?void 0:B.id)??"accept"))},{immediate:!0});function Ae(D,B){return`${String(D)}:${B}`}function We(D){const B=w(D.params),W=Array.isArray(B==null?void 0:B.questions)?B.questions:[],oe=[];for(const ye of W){const Pe=w(ye);if(!Pe)continue;const De=_(Pe.id);if(!De)continue;const rt=Array.isArray(Pe.options)?Pe.options.map(ut=>w(ut)).map(ut=>({label:_(ut==null?void 0:ut.label),description:_(ut==null?void 0:ut.description)})).filter(ut=>ut.label.length>0):[];oe.push({id:De,header:_(Pe.header),question:_(Pe.question),isOther:Pe.isOther===!0,options:rt})}return oe}function qe(D,B,W){const oe=Ae(D,B),ye=s.value[oe];return typeof ye=="string"&&ye.length>0?ye:W}function Be(D,B){return u.value[Ae(D,B)]??""}function Ee(D,B,W){const oe=W.target;if(!(oe instanceof HTMLSelectElement))return;const ye=Ae(D,B);s.value={...s.value,[ye]:oe.value}}function Ie(D,B,W){const oe=W.target;if(!(oe instanceof HTMLInputElement))return;const ye=Ae(D,B);u.value={...u.value,[ye]:oe.value}}function Ze(D,B,W){var ye,Pe;const oe=qe(D,B,((ye=W[0])==null?void 0:ye.label)||"");return((Pe=W.find(De=>De.label===oe))==null?void 0:Pe.description)??""}function je(D,B){return`${String(D)}:${B}`}function et(D){var B;return _((B=w(D.params))==null?void 0:B.serverName)}function ze(D){var W;const B=_((W=w(D.params))==null?void 0:W.url);if(!B)return"";try{const oe=new URL(B),ye=oe.protocol.toLowerCase();return ye==="https:"||ye==="http:"?oe.toString():""}catch{return""}}function ct(D){const B=w(D.params),W=w(B==null?void 0:B.requestedSchema),oe=w(W==null?void 0:W.properties);if(!oe)return[];const ye=new Set(Array.isArray(W==null?void 0:W.required)?W.required.filter(Pe=>typeof Pe=="string"):[]);return Object.entries(oe).map(([Pe,De])=>nt(Pe,w(De),ye.has(Pe))).filter(Pe=>Pe!==null)}function nt(D,B,W){if(!B)return null;const oe=_(B.title)||D,ye=_(B.description),Pe=_(B.type);if(Pe==="boolean")return{key:D,label:oe,description:ye,required:W,kind:"boolean",inputType:"checkbox",options:[],defaultValue:typeof B.default=="boolean"?B.default:null,hasExplicitDefault:typeof B.default=="boolean"};if(Pe==="number"||Pe==="integer")return{key:D,label:oe,description:ye,required:W,kind:"number",inputType:"number",options:[],defaultValue:typeof B.default=="number"?B.default:null,hasExplicitDefault:typeof B.default=="number"};const De=Ye(B);if(Pe==="array")return{key:D,label:oe,description:ye,required:W,kind:"multiEnum",inputType:"checkbox",options:De,defaultValue:Array.isArray(B.default)?B.default.filter(ut=>typeof ut=="string"):[],hasExplicitDefault:Array.isArray(B.default)};const rt=P(B.default);return De.length>0?{key:D,label:oe,description:ye,required:W,kind:"singleEnum",inputType:"select",options:De,defaultValue:rt,hasExplicitDefault:rt!==null}:{key:D,label:oe,description:ye,required:W,kind:"string",inputType:vt(B),options:[],defaultValue:rt,hasExplicitDefault:rt!==null}}function Ye(D){const W=(Array.isArray(D.oneOf)?D.oneOf:Array.isArray(D.anyOf)?D.anyOf:[]).map(De=>w(De)).map(De=>({value:_(De==null?void 0:De.const),label:_(De==null?void 0:De.title)||_(De==null?void 0:De.const)})).filter(De=>De.value.length>0);if(W.length>0)return W;const oe=w(D.items);if(oe){const De=Ye(oe);if(De.length>0)return De}const ye=Array.isArray(D.enum)?D.enum.filter(De=>typeof De=="string"):[],Pe=Array.isArray(D.enumNames)?D.enumNames.filter(De=>typeof De=="string"):[];return ye.map((De,rt)=>({value:De,label:Pe[rt]||De}))}function vt(D){const B=_(D.format);return B==="email"?"email":B==="uri"?"url":B==="date"?"date":B==="date-time"?"datetime-local":"text"}function X(D,B){const W=c.value[je(D,B.key)];return W!==void 0?W:B.defaultValue}function ke(D,B){const W=X(D,B);return Array.isArray(W)?W.filter(oe=>typeof oe=="string"):[]}function pe(D,B,W){const oe=W.target;if(!(oe instanceof HTMLInputElement)&&!(oe instanceof HTMLSelectElement))return;const ye=oe.value,Pe=(B.kind==="number",ye);c.value={...c.value,[je(D,B.key)]:ye.length>0?Pe:null},m.value=""}function xe(D,B,W){const oe=W.target;if(!(oe instanceof HTMLSelectElement))return;let ye=null;oe.value==="true"?ye=!0:oe.value==="false"&&(ye=!1),c.value={...c.value,[je(D,B.key)]:ye},m.value=""}function Ve(D,B,W,oe){const ye=oe.target;if(!(ye instanceof HTMLInputElement))return;const Pe=new Set(ke(D,B));ye.checked?Pe.add(W):Pe.delete(W),c.value={...c.value,[je(D,B.key)]:Array.from(Pe)},m.value=""}function E(D){return D===!0?"true":D===!1?"false":""}function $(D,B){const W=X(D,B);return B.kind==="multiEnum"?Array.isArray(W)&&W.length>0:B.kind==="boolean"?typeof W=="boolean":B.kind==="number"&&typeof W=="number"?!0:typeof W=="string"&&W.trim().length>0}function V(D){const B=ct(D).filter(W=>W.required&&!$(D.id,W)).map(W=>W.label);return B.length===0?"":B.length===1?`Answer the required field: ${B[0]}.`:`Answer the required fields: ${B.join(", ")}.`}function se(D){const B={};for(const W of ct(D)){const oe=X(D.id,W);if(W.kind==="multiEnum"){const Pe=Array.isArray(oe)?oe:[];(Pe.length>0||W.required)&&(B[W.key]=Pe);continue}if(W.kind==="boolean"){typeof oe=="boolean"&&(B[W.key]=oe);continue}if(W.kind==="number"){const Pe=typeof oe=="number"?oe:Number(String(oe).trim());Number.isNaN(Pe)||(B[W.key]=Pe);continue}const ye=String(oe??"").trim();(ye.length>0||W.required)&&(B[W.key]=ye)}return B}function ce(D){o.value=D}function ie(){o.value="decline"}function me(D){const B=D.target;B instanceof HTMLInputElement&&(a.value=B.value,o.value="decline")}function ue(D,B){var W;if(U(D)){if(B==="decline"||B==="cancel"){r("respondServerRequest",{id:D.id,error:{code:-32e3,message:B==="cancel"?"Cancelled from CodexUI.":"Declined from CodexUI."}});return}const oe=w((W=w(D.params))==null?void 0:W.permissions)??{};r("respondServerRequest",{id:D.id,result:{permissions:oe,scope:B==="acceptForSession"?"session":"turn"}});return}r("respondServerRequest",{id:D.id,result:{decision:B}})}function ge(D){const B=a.value.trim(),W=B.length>0?"decline":o.value;if(U(D)){ue(D,W);return}r("respondServerRequest",{id:D.id,result:{decision:W},followUpMessageText:B||void 0})}function he(D,B){const W=w(D.params),oe={action:B};if(B==="accept"&&_(W==null?void 0:W.mode)==="form"){const ye=V(D);if(ye){m.value=ye;return}oe.content=se(D)}r("respondServerRequest",{id:D.id,result:oe})}function Fe(D){var oe;const B=We(D),W={};for(const ye of B){const Pe=qe(D.id,ye.id,((oe=ye.options[0])==null?void 0:oe.label)||""),De=Be(D.id,ye.id).trim(),rt=[Pe,De].map(ut=>ut.trim()).filter(ut=>ut.length>0);W[ye.id]={answers:rt}}r("respondServerRequest",{id:D.id,result:{answers:W}})}function _e(D){r("respondServerRequest",{id:D.id,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from CodexUI."}]}})}function Oe(D){r("respondServerRequest",{id:D.id,result:{success:!0,contentItems:[]}})}function $e(D){r("respondServerRequest",{id:D.id,result:{}})}function Ge(D){r("respondServerRequest",{id:D.id,error:{code:-32e3,message:"Rejected from CodexUI."}})}return(D,B)=>e.request?(k(),A("section",tA,[h("article",{class:Qe(["thread-pending-request-shell",{"thread-pending-request-shell--no-top-radius":e.hasQueueAbove}])},[G(e.request)?(k(),A(Ke,{key:0},[h("p",nA,I(ae(e.request)),1),K(e.request)?(k(),A("p",{key:0,class:"thread-pending-request-command-line",title:K(e.request)},I(K(e.request)),9,rA)):Q("",!0),h("section",oA,[h("div",{class:"thread-pending-request-options",role:"radiogroup","aria-label":S(f)("Approval choices")},[(k(!0),A(Ke,null,Dt(ne.value,(W,oe)=>(k(),A("button",{key:W.id,type:"button",class:Qe(["thread-pending-request-option",{"is-selected":o.value===W.id}]),"aria-pressed":o.value===W.id,onClick:ye=>ce(W.id)},[h("span",iA,I(oe+1)+".",1),h("span",lA,I(W.label),1)],10,sA))),128))],8,aA),h("footer",uA,[h("label",{class:Qe(["thread-pending-request-inline-input",{"is-active":o.value==="decline"||a.value.length>0}])},[B[11]||(B[11]=h("span",{class:"thread-pending-request-option-index"},"3.",-1)),h("input",{class:"thread-pending-request-inline-control",type:"text",value:a.value,placeholder:S(f)("No, and tell Codex what to do differently"),onFocus:ie,onInput:me,onKeydown:B[0]||(B[0]=on(Xe(W=>ge(e.request),["prevent"]),["enter"]))},null,40,cA)],2),h("button",{type:"button",class:"thread-pending-request-secondary",onClick:B[1]||(B[1]=W=>ue(e.request,"cancel"))},I(S(f)("Skip")),1),h("button",{type:"button",class:"thread-pending-request-primary",onClick:B[2]||(B[2]=W=>ge(e.request))},I(S(f)("Send")),1)])])],64)):(k(),A(Ke,{key:1},[h("header",dA,[h("div",fA,[h("p",hA,I(Me(e.request)),1),h("p",pA,I(ae(e.request)),1)]),(e.requestCount??0)>1?(k(),A("span",mA,I(e.requestCount??0)+" pending",1)):Q("",!0)]),K(e.request)?(k(),A("div",vA,[h("code",gA,I(K(e.request)),1)])):Q("",!0),e.request.method==="mcpServer/elicitation/request"?(k(),A("section",yA,[et(e.request)?(k(),A("p",wA,I(S(f)("Server"))+": "+I(et(e.request)),1)):Q("",!0),ze(e.request)?(k(),A("a",{key:1,class:"thread-pending-request-link",href:ze(e.request),target:"_blank",rel:"noopener noreferrer"},I(S(f)("Open authorization link")),9,bA)):Q("",!0),(k(!0),A(Ke,null,Dt(ct(e.request),W=>(k(),A("div",{key:`${e.request.id}:${W.key}`,class:"thread-pending-request-question"},[h("p",_A,[As(I(W.label),1),W.required?(k(),A("span",TA," *")):Q("",!0)]),W.description?(k(),A("p",kA,I(W.description),1)):Q("",!0),W.kind==="string"||W.kind==="number"?(k(),A("label",CA,[h("span",SA,I(S(f)("Value")),1),h("input",{class:"thread-pending-request-input",type:W.inputType,value:String(X(e.request.id,W)??""),onInput:oe=>pe(e.request.id,W,oe)},null,40,xA)])):W.kind==="boolean"?(k(),A("label",AA,[h("span",EA,I(S(f)("Choice")),1),h("select",{class:"thread-pending-request-select",value:E(X(e.request.id,W)),onChange:oe=>xe(e.request.id,W,oe)},[W.hasExplicitDefault?Q("",!0):(k(),A("option",PA,I(S(f)("Select true or false")),1)),h("option",RA,I(S(f)("True")),1),h("option",MA,I(S(f)("False")),1)],40,IA)])):W.kind==="singleEnum"?(k(),A("label",$A,[h("span",jA,I(S(f)("Choice")),1),h("select",{class:"thread-pending-request-select",value:String(X(e.request.id,W)??""),onChange:oe=>pe(e.request.id,W,oe)},[W.hasExplicitDefault?Q("",!0):(k(),A("option",LA,I(S(f)("Select an option")),1)),(k(!0),A(Ke,null,Dt(W.options,oe=>(k(),A("option",{key:`${e.request.id}:${W.key}:${oe.value}`,value:oe.value},I(oe.label),9,OA))),128))],40,NA)])):(k(),A("div",DA,[(k(!0),A(Ke,null,Dt(W.options,oe=>(k(),A("label",{key:`${e.request.id}:${W.key}:${oe.value}`,class:"thread-pending-request-checkbox-row"},[h("input",{class:"thread-pending-request-checkbox",type:"checkbox",checked:ke(e.request.id,W).includes(oe.value),onChange:ye=>Ve(e.request.id,W,oe.value,ye)},null,40,FA),h("span",UA,I(oe.label),1)]))),128))]))]))),128)),m.value?(k(),A("p",BA,I(m.value),1)):Q("",!0),h("footer",qA,[h("button",{type:"button",class:"thread-pending-request-secondary",onClick:B[3]||(B[3]=W=>he(e.request,"cancel"))},I(S(f)("Cancel")),1),h("button",{type:"button",class:"thread-pending-request-secondary",onClick:B[4]||(B[4]=W=>he(e.request,"decline"))},I(S(f)("Decline")),1),h("button",{type:"button",class:"thread-pending-request-primary",onClick:B[5]||(B[5]=W=>he(e.request,"accept"))},I(S(f)("Continue")),1)])])):e.request.method==="item/tool/requestUserInput"?(k(),A("section",HA,[(k(!0),A(Ke,null,Dt(We(e.request),W=>{var oe;return k(),A("div",{key:`${e.request.id}:${W.id}`,class:"thread-pending-request-question"},[h("p",WA,I(W.header||W.question),1),W.question?(k(),A("p",VA,I(W.question),1)):Q("",!0),W.options.length>0?(k(),A("div",zA,[h("label",GA,[h("span",KA,I(S(f)("Choice")),1),h("select",{class:"thread-pending-request-select",value:qe(e.request.id,W.id,((oe=W.options[0])==null?void 0:oe.label)||""),onChange:ye=>Ee(e.request.id,W.id,ye)},[(k(!0),A(Ke,null,Dt(W.options,ye=>(k(),A("option",{key:`${e.request.id}:${W.id}:${ye.label}`,value:ye.label},I(ye.label),9,JA))),128))],40,YA)]),Ze(e.request.id,W.id,W.options)?(k(),A("p",QA,I(Ze(e.request.id,W.id,W.options)),1)):Q("",!0)])):Q("",!0),W.isOther?(k(),A("label",XA,[h("span",ZA,I(S(f)("Other answer")),1),h("input",{class:"thread-pending-request-input",type:"text",value:Be(e.request.id,W.id),placeholder:S(f)("Other answer"),onInput:ye=>Ie(e.request.id,W.id,ye)},null,40,eE)])):Q("",!0)])}),128)),h("footer",tE,[h("button",{type:"button",class:"thread-pending-request-primary",onClick:B[6]||(B[6]=W=>Fe(e.request))},I(S(f)("Send")),1)])])):e.request.method==="item/tool/call"?(k(),A("section",nE,[h("button",{type:"button",class:"thread-pending-request-primary",onClick:B[7]||(B[7]=W=>_e(e.request))},I(S(f)("Fail Tool Call")),1),h("button",{type:"button",class:"thread-pending-request-secondary",onClick:B[8]||(B[8]=W=>Oe(e.request))},I(S(f)("Success (Empty)")),1)])):(k(),A("section",rE,[h("button",{type:"button",class:"thread-pending-request-primary",onClick:B[9]||(B[9]=W=>$e(e.request))},I(S(f)("Return Empty Result")),1),h("button",{type:"button",class:"thread-pending-request-secondary",onClick:B[10]||(B[10]=W=>Ge(e.request))},I(S(f)("Reject Request")),1)]))],64))],2)])):Q("",!0)}}),aE=xt(oE,[["__scopeId","data-v-72a9d2d9"]]),sE={key:0,class:"queued-messages"},iE={class:"queued-messages-inner"},lE=["onDragstart","onDragover","onDragleave","onDrop"],uE=["aria-label","title"],cE={class:"queued-row-text"},dE={class:"queued-row-actions"},fE=["title","onClick"],hE=["title","onClick"],pE=["aria-label","title","onClick"],mE=Jn({__name:"QueuedMessages",props:{messages:{}},emits:["edit","steer","delete","reorder"],setup(e,{emit:t}){const n=t,{t:r}=rs(),o=x(""),a=x("");function s(_,P){var q;o.value=P,a.value="",(q=_.dataTransfer)==null||q.setData("text/plain",P),_.dataTransfer&&(_.dataTransfer.effectAllowed="move")}function u(_){!o.value||o.value===_||(a.value=_)}function c(_){a.value===_&&(a.value="")}function m(_){const P=o.value;f(),!(!P||P===_)&&n("reorder",{draggedId:P,targetId:_})}function f(){o.value="",a.value=""}function w(_){var U,G,Y;const P=_.text.trim();if(P)return P;const q=[],O=((U=_.imageUrls)==null?void 0:U.length)??0,te=((G=_.fileAttachments)==null?void 0:G.length)??0,F=((Y=_.skills)==null?void 0:Y.length)??0;return O>0&&q.push(`${O} ${r(O===1?"image":"images")}`),te>0&&q.push(`${te} ${r(te===1?"file":"files")}`),F>0&&q.push(`${F} ${r(F===1?"skill":"skills")}`),q.join(", ")||r("(empty queued message)")}return(_,P)=>e.messages.length>0?(k(),A("div",sE,[h("div",iE,[(k(!0),A(Ke,null,Dt(e.messages,q=>(k(),A("div",{key:q.id,class:Qe(["queued-row",{"is-dragging":o.value===q.id,"is-drop-target":a.value===q.id&&o.value!==q.id}]),draggable:"true",onDragstart:O=>s(O,q.id),onDragover:Xe(O=>u(q.id),["prevent"]),onDragleave:O=>c(q.id),onDrop:Xe(O=>m(q.id),["prevent"]),onDragend:f},[h("button",{class:"queued-row-drag",type:"button","aria-label":S(r)("Drag to reorder queued message"),title:S(r)("Drag to reorder queued message")},[...P[0]||(P[0]=[h("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[h("path",{fill:"currentColor",d:"M9 5.5A1.5 1.5 0 1 1 6 5.5a1.5 1.5 0 0 1 3 0m0 6.5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0m-1.5 8A1.5 1.5 0 1 0 7.5 17a1.5 1.5 0 0 0 0 3m10-13A1.5 1.5 0 1 0 17.5 4a1.5 1.5 0 0 0 0 3m1.5 5a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0m-1.5 8a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3"})],-1)])],8,uE),P[2]||(P[2]=h("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})],-1)),h("span",cE,I(w(q)),1),h("div",dE,[h("button",{class:"queued-row-edit",type:"button",title:S(r)("Edit queued message"),onClick:O=>_.$emit("edit",q.id)},I(S(r)("Edit")),9,fE),h("button",{class:"queued-row-steer",type:"button",title:S(r)("Send now without interrupting work"),onClick:O=>_.$emit("steer",q.id)},I(S(r)("Steer")),9,hE),h("button",{class:"queued-row-delete",type:"button","aria-label":S(r)("Delete queued message"),title:S(r)("Delete queued message"),onClick:O=>_.$emit("delete",q.id)},[...P[1]||(P[1]=[h("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"})],-1)])],8,pE)])],42,lE))),128))])])):Q("",!0)}}),vE=xt(mE,[["__scopeId","data-v-b7a3edb8"]]),gE={key:0,class:"rate-limit-status","aria-live":"polite"},yE=["title"],wE={class:"rate-limit-card-header"},bE={class:"rate-limit-card-title"},_E={key:0,class:"rate-limit-card-plan"},TE={class:"rate-limit-card-metrics"},kE={key:0,class:"rate-limit-card-footer"},CE=Jn({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){function t(F){var U,G;return((U=F.limitId)==null?void 0:U.trim())||((G=F.limitName)==null?void 0:G.trim())||"__default__"}function n(F){var U,G;return((U=F.limitName)==null?void 0:U.trim())||((G=F.limitId)==null?void 0:G.trim())||"Rate limits"}function r(F){const U=F.trim();return U?U.replace(/[_-]+/g," ").replace(/\b\w/g,G=>G.toUpperCase()):""}function o(F){return!F||F<=0?"Window":F%1440===0?`${F/1440}d`:F%60===0?`${F/60}h`:F<60?`${F}m`:`${Math.round(F/60*10)/10}h`}function a(F){const U=Math.max(0,Math.min(100,100-F));return`${Math.round(U)}% left`}function s(F){return`${Math.round(F)}%`}function u(F,U){return{key:U,label:`${o(F.windowDurationMins)} ${a(F.usedPercent)}`}}function c(F){const U=[];return F.primary&&U.push(u(F.primary,"primary")),F.secondary&&U.push(u(F.secondary,"secondary")),U}function m(F){if(!F)return"";const U=new Date(F*1e3),G=U.getMonth()+1,Y=String(U.getDate()).padStart(2,"0"),Te=String(U.getHours()).padStart(2,"0"),Me=String(U.getMinutes()).padStart(2,"0");return`${G}.${Y} ${Te}:${Me}`}function f(F){if(!(F!=null&&F.resetsAt))return"";const U=F.resetsAt*1e3-Date.now();if(U<=0)return"Resetting now";const G=Math.round(U/6e4);if(G<60)return`Resets in ${G}m`;const Y=Math.round(G/60);return Y<24?`Resets in ${Y}h`:`Resets in ${Math.round(Y/24)}d`}function w(F){return[F.primary,F.secondary].filter(U=>U!==null)}function _(F){const U=w(F);return U.length===0?null:[...U].sort((G,Y)=>{const Te=G.windowDurationMins??Number.MAX_SAFE_INTEGER,Me=Y.windowDurationMins??Number.MAX_SAFE_INTEGER;return Te!==Me?Te-Me:(G.resetsAt??Number.MAX_SAFE_INTEGER)-(Y.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function P(F){const U=w(F);if(U.length===0)return"";const G=[...U].sort((Te,Me)=>{const ae=Te.windowDurationMins??-1,Se=Me.windowDurationMins??-1;return ae!==Se?Se-ae:(Me.resetsAt??-1)-(Te.resetsAt??-1)})[0],Y=m(G.resetsAt);return Y||""}function q(F){const U=F.credits;return U?U.unlimited?"Unlimited credits":U.balance?`Credits ${U.balance}`:U.hasCredits?"Credits available":"":""}function O(F){return[f(_(F)),P(F),q(F)].filter(U=>U.length>0)}function te(F){const U=[n(F)];for(const G of c(F))U.push(G.label);for(const G of w(F))U.push(`${o(G.windowDurationMins)} used ${s(G.usedPercent)}`);for(const G of O(F))U.push(G);return U.join(`
|
|
50
|
+
`)}return(F,U)=>e.snapshots.length>0?(k(),A("aside",gE,[(k(!0),A(Ke,null,Dt(e.snapshots,G=>(k(),A("div",{key:t(G),class:"rate-limit-card",title:te(G)},[h("div",wE,[h("span",bE,I(n(G)),1),G.planType?(k(),A("span",_E,I(r(G.planType)),1)):Q("",!0)]),h("div",TE,[(k(!0),A(Ke,null,Dt(c(G),Y=>(k(),A("span",{key:Y.key,class:"rate-limit-card-metric"},I(Y.label),1))),128))]),O(G).length>0?(k(),A("div",kE,I(O(G).join(" | ")),1)):Q("",!0)],8,yE))),128))])):Q("",!0)}}),SE=xt(CE,[["__scopeId","data-v-df88906b"]]),xE=["disabled","title","aria-label"],AE={class:"header-git-trigger-label"},EE={key:0,class:"header-git-dirty-dot","aria-label":"Uncommitted changes"},IE={key:0,class:"header-git-menu-wrap"},PE={class:"header-git-menu"},RE={class:"header-git-state"},ME={class:"header-git-state-label"},$E={class:"header-git-state-value"},jE={key:0,class:"header-git-state-meta"},NE={class:"header-git-search-wrap"},LE=["onKeydown"],OE={class:"header-git-branches",role:"listbox"},DE={class:"header-git-branch-row"},FE=["aria-label","onClick"],UE=["disabled","onClick"],BE={class:"header-git-branch-name"},qE={key:0,class:"header-git-branch-meta"},HE={key:1,class:"header-git-branch-meta"},WE={key:0,class:"header-git-commits"},VE={key:0,class:"header-git-commits-empty"},zE={key:1,class:"header-git-commits-empty is-error"},GE=["disabled","title","onClick"],KE={class:"header-git-commit-top"},YE={class:"header-git-commit-meta"},JE={key:0,class:"header-git-branch-meta"},QE={class:"header-git-commit-subject"},XE={key:2,class:"header-git-commits-empty"},ZE={key:0,class:"header-git-empty"},eI=Jn({__name:"HeaderGitBranchDropdown",props:{currentBranch:{},headSha:{},headSubject:{},headDate:{},detached:{type:Boolean},dirty:{type:Boolean},branches:{},commitsByBranch:{},commitsLoadingFor:{},commitsError:{},loading:{type:Boolean},busy:{type:Boolean},error:{},reviewOpen:{type:Boolean},showReview:{type:Boolean}},emits:["toggleReview","checkoutBranch","resetBranchToCommit","loadCommits"],setup(e,{emit:t}){const n=e,r=t,o=x(null),a=x(null),s=x(!1),u=x(""),c=x(""),m=Z(()=>n.showReview!==!1),f=Z(()=>n.currentBranch?n.currentBranch:n.headSubject?n.headSubject:n.headSha?`Detached ${n.headSha}`:n.loading?"Loading branch...":"Detached HEAD"),w=Z(()=>n.detached?[n.headSha,n.headDate].filter(Boolean).join(" · "):""),_=Z(()=>`Git branch: ${f.value}`),P=Z(()=>n.loading&&n.branches.length===0),q=Z(()=>n.busy||n.loading),O=Z(()=>n.error||(n.dirty?"Tracked changes must be committed, stashed, or discarded before switching or resetting. Untracked files are allowed unless Git would overwrite them.":"")),te=Z(()=>n.error?"error":"info"),F=Z(()=>{const K=u.value.trim().toLowerCase(),be=n.branches;return K?be.filter(Ce=>Ce.label.toLowerCase().includes(K)||Ce.value.toLowerCase().includes(K)):be});function U(){P.value||(s.value=!s.value)}function G(K){c.value=c.value===K?"":K,c.value&&r("loadCommits",K)}function Y(K){var Ce;const be=((Ce=n.headSha)==null?void 0:Ce.trim())??"";return be?K.sha===be||K.shortSha===be||K.sha.startsWith(be):!1}function Te(K,be){return K.isRemote?"Remote branches cannot be reset from this menu":`Reset ${K.value} to ${be.shortSha}`}function Me(K,be){K.isRemote||r("resetBranchToCommit",{branch:K.value,sha:be.sha})}function ae(){if(u.value){u.value="";return}s.value=!1}function Se(K){if(!s.value)return;const be=o.value,Ce=K.target;!be||!(Ce instanceof Node)||be.contains(Ce)||(s.value=!1,u.value="")}return ht(s,K=>{K&&Ht(()=>{var be;return(be=a.value)==null?void 0:be.focus()})}),Ca(()=>window.addEventListener("pointerdown",Se)),ns(()=>window.removeEventListener("pointerdown",Se)),(K,be)=>(k(),A("div",{ref_key:"rootRef",ref:o,class:Qe(["header-git-dropdown",{"is-review-open":e.reviewOpen}])},[h("button",{class:"header-git-trigger",type:"button",disabled:P.value,title:_.value,"aria-label":_.value,onClick:U},[Le(zs,{class:"header-git-trigger-icon"}),h("span",AE,I(f.value),1),e.dirty?(k(),A("span",EE)):Q("",!0),Le(ks,{class:"header-git-trigger-chevron"})],8,xE),s.value?(k(),A("div",IE,[h("div",PE,[m.value?(k(),A("button",{key:0,class:"header-git-review-row",type:"button",onClick:be[0]||(be[0]=Ce=>r("toggleReview"))},[Le(li,{class:"header-git-row-icon"}),h("span",null,I(e.reviewOpen?"Review (Open)":"Review"),1)])):Q("",!0),h("div",RE,[h("span",ME,I(e.detached?"Detached HEAD":"Current branch"),1),h("span",$E,I(f.value),1),w.value?(k(),A("span",jE,I(w.value),1)):Q("",!0)]),O.value?(k(),A("div",{key:1,class:Qe(["header-git-status",{"is-error":te.value==="error"}])},I(O.value),3)):Q("",!0),h("div",NE,[jt(h("input",{ref_key:"searchInputRef",ref:a,"onUpdate:modelValue":be[1]||(be[1]=Ce=>u.value=Ce),class:"header-git-search",type:"text",placeholder:"Search branches...",onKeydown:on(Xe(ae,["prevent"]),["esc"])},null,40,LE),[[Yt,u.value]])]),h("ul",OE,[(k(!0),A(Ke,null,Dt(F.value,Ce=>(k(),A("li",{key:Ce.value,class:"header-git-branch-item"},[h("div",DE,[h("button",{class:"header-git-branch-expand",type:"button","aria-label":c.value===Ce.value?"Hide commits":"Show commits",onClick:ne=>G(Ce.value)},[Le(ji,{class:Qe(["header-git-expand-icon",{"is-expanded":c.value===Ce.value}])},null,8,["class"])],8,FE),h("button",{class:Qe(["header-git-branch-button",{"is-current":Ce.value===e.currentBranch}]),type:"button",disabled:q.value,onClick:ne=>r("checkoutBranch",Ce.value)},[h("span",BE,I(Ce.label),1),Ce.value===e.currentBranch?(k(),A("span",qE,"current")):Ce.isRemote?(k(),A("span",HE,"remote")):Q("",!0)],10,UE)]),c.value===Ce.value?(k(),A("div",WE,[e.commitsLoadingFor===Ce.value?(k(),A("div",VE,"Loading commits...")):e.commitsError?(k(),A("div",zE,I(e.commitsError),1)):Q("",!0),(k(!0),A(Ke,null,Dt(e.commitsByBranch[Ce.value]||[],ne=>(k(),A("button",{key:ne.sha,class:Qe(["header-git-commit",{"is-current":Y(ne)}]),type:"button",disabled:q.value||Ce.isRemote,title:Te(Ce,ne),onClick:Ae=>Me(Ce,ne)},[h("span",KE,[h("code",null,I(ne.shortSha),1),h("span",YE,[Y(ne)?(k(),A("span",JE,"current")):Q("",!0),h("span",null,I(ne.date),1)])]),h("span",QE,I(ne.subject),1)],10,GE))),128)),e.commitsLoadingFor!==Ce.value&&!e.commitsError&&(e.commitsByBranch[Ce.value]||[]).length===0?(k(),A("div",XE," No commits found. ")):Q("",!0)])):Q("",!0)]))),128)),F.value.length===0?(k(),A("li",ZE,"No branches found.")):Q("",!0)])])])):Q("",!0)],2))}}),tI=xt(eI,[["__scopeId","data-v-5f4121b3"]]),nI=["aria-label"],rI=["aria-checked","onClick"],oI={class:"runtime-toggle-option-label"},aI=Jn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:r}=rs(),o=[{value:"local",label:r("Local project"),icon:fd},{value:"worktree",label:r("New worktree"),icon:zs}];function a(s){n("update:modelValue",s)}return(s,u)=>(k(),A("div",{class:"runtime-toggle",role:"radiogroup","aria-label":S(r)("Continue in")},[(k(),A(Ke,null,Dt(o,c=>h("button",{key:c.value,class:Qe(["runtime-toggle-option",{"is-selected":e.modelValue===c.value}]),type:"button",role:"radio","aria-checked":e.modelValue===c.value,onClick:m=>a(c.value)},[(k(),tt(Xc(c.icon),{class:"runtime-toggle-option-icon"})),h("span",oI,I(c.label),1)],10,rI)),64))],8,nI))}}),sI=xt(aI,[["__scopeId","data-v-0f175c28"]]),iI={},lI={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 uI(e,t){return k(),A("svg",lI,[...t[0]||(t[0]=[h("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),h("path",{d:"M9 4l0 16"},null,-1)])])}const cI=xt(iI,[["render",uI]]),dI={},fI={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function hI(e,t){return k(),A("svg",fI,[...t[0]||(t[0]=[h("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 pI=xt(dI,[["render",hI]]),mI={class:"sidebar-thread-controls"},vI=["aria-label","title"],gI=["aria-label","title"],yI=Jn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=rs();return(n,r)=>(k(),A("div",mI,[h("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?S(t)("Expand sidebar"):S(t)("Collapse sidebar"),title:e.isSidebarCollapsed?S(t)("Expand sidebar"):S(t)("Collapse sidebar"),onClick:r[0]||(r[0]=o=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(k(),tt(pI,{key:0,class:"sidebar-thread-controls-icon"})):(k(),tt(cI,{key:1,class:"sidebar-thread-controls-icon"}))],8,vI),Ko(n.$slots,"default",{},void 0),e.showNewThreadButton?(k(),A("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":S(t)("Start new thread"),title:S(t)("Start new thread"),onClick:r[1]||(r[1]=o=>n.$emit("start-new-thread"))},[Le(li,{class:"sidebar-thread-controls-icon"})],8,gI)):Q("",!0)]))}}),Ih=xt(yI,[["__scopeId","data-v-2369affb"]]),wI={},bI={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function _I(e,t){return k(),A("svg",bI,[...t[0]||(t[0]=[h("circle",{cx:"11",cy:"11",r:"8"},null,-1),h("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const Ph=xt(wI,[["render",_I]]),TI={},kI={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function CI(e,t){return k(),A("svg",kI,[...t[0]||(t[0]=[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("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"}),h("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const SI=xt(TI,[["render",CI]]),xI={},AI={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function EI(e,t){return k(),A("svg",AI,[...t[0]||(t[0]=[h("path",{d:"M5 7l5 5-5 5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),h("path",{d:"M12 17h7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])])}const II=xt(xI,[["render",EI]]),PI={},RI={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function MI(e,t){return k(),A("svg",RI,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const $I=xt(PI,[["render",MI]]);function $r(e){return e.flatMap(t=>t.threads)}function jI(e,t){var r,o;const n=e.findIndex(a=>a.id===t);return n<0?"":((r=e[n+1])==null?void 0:r.id)??((o=e[n-1])==null?void 0:o.id)??""}const Wm="codex-web-local.thread-read-state.v1",Rh="codex-web-local.thread-unread-cutoff.v1",Vm="codex-web-local.thread-token-usage.v1",zm="codex-web-local.thread-terminal-open.v1",Rc="codex-web-local.selected-thread-id.v1",Mc="codex-web-local.selected-model-by-context.v1",Gm="codex-web-local.selected-model-id.v1",Km="codex-web-local.project-order.v1",Ym="codex-web-local.project-display-name.v1",$c="codex-web-local.collaboration-mode-by-context.v1",NI="codex-web-local.collaboration-mode.v1",Za="__new-thread__",Jm="__new-thread-provider__::",ac=220,LI=1e4,OI=500,DI=3e3,FI=2e3,Mh=["none","minimal","low","medium","high","xhigh"],Fs="__global__",_o="gpt-5.4-mini";function UI(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Wm);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function $h(e){typeof window>"u"||window.localStorage.setItem(Wm,JSON.stringify(e))}function BI(){if(typeof window>"u")return"";const e=window.localStorage.getItem(Rh);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(Rh,t),t}function qI(e,t){if(!e||!t)return!1;const n=new Date(e).getTime(),r=new Date(t).getTime();return!Number.isFinite(n)||!Number.isFinite(r)?!1:n>r}function HI(e,t,n){return qI(e,t??n)}function Qm(e){return e==="plan"?"plan":"default"}function ui(e){return typeof e=="string"?e.trim():""}function Co(){return Object.create(null)}function Ni(e){const t=Co();for(const[n,r]of Object.entries(e))t[n]=r;return t}function Wi(e,t){if(!(t in e))return e;const n=Co();for(const[r,o]of Object.entries(e))r!==t&&(n[r]=o);return n}function jh(e,t){let n=!1;const r=Co();for(const[o,a]of Object.entries(e)){if(o===Za||o.startsWith(Jm)||t.has(o)){r[o]=a;continue}n=!0}return n?r:e}function Xm(e){return e.trim().toLowerCase()||"codex"}function WI(e){return e===Za}function sc(e){const t=Xm(e);return`${Jm}${t}`}function ti(e){return e.trim()||Za}function VI(){if(typeof window>"u")return Co();try{const n=window.localStorage.getItem(Mc);if(n){const r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))return Co();const o=Co();for(const[a,s]of Object.entries(r)){if(typeof a!="string"||a.length===0)continue;const u=ui(s);u&&(o[a]=u)}return o}}catch{}const e=ui(window.localStorage.getItem(Gm)),t=Co();return e&&(t[Za]=e),t}function Nh(e,t){const n=ti(t),r=ui(e[n]);return r||ui(e[Za])}function Al(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(Mc):window.localStorage.setItem(Mc,JSON.stringify(e)),window.localStorage.removeItem(Gm)}catch{}}function zI(){if(typeof window>"u")return Co();try{const e=window.localStorage.getItem($c);if(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return Co();const n=Co();for(const[r,o]of Object.entries(t)){if(typeof r!="string"||r.length===0)continue;const a=Qm(o);a==="plan"&&(n[r]=a)}return n}}catch{}return Co()}function El(e,t){const n=ti(t);return Qm(e[n])}function Lh(e,t,n){const r=ti(t);if(WI(r))return Wi(e,r);if(n==="plan"){const o=Ni(e);return o[r]="plan",o}return Wi(e,r)}function ic(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem($c):window.localStorage.setItem($c,JSON.stringify(e)),window.localStorage.removeItem(NI)}catch{}}function Zm(e,t,n){return Math.min(Math.max(e,t),n)}function Ws(e){if(typeof e=="number"&&Number.isFinite(e))return Math.max(0,Math.trunc(e));if(typeof e=="string"&&e.trim().length>0){const t=Number(e);if(Number.isFinite(t))return Math.max(0,Math.trunc(t))}return null}function Oh(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:Ws(t.totalTokens)??0,inputTokens:Ws(t.inputTokens)??0,cachedInputTokens:Ws(t.cachedInputTokens)??0,outputTokens:Ws(t.outputTokens)??0,reasoningOutputTokens:Ws(t.reasoningOutputTokens)??0}}function GI(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=Oh(t.total),r=Oh(t.last);if(!n||!r)return null;const o=Ws(t.modelContextWindow),a=r.totalTokens,s=typeof o=="number"?Math.max(o-a,0):null,u=typeof o=="number"&&o>0?Zm(Math.round((s??0)/o*100),0,100):null;return{total:n,last:r,modelContextWindow:o,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:u}}function KI(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Vm);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r)continue;const a=GI(o);a&&(n[r]=a)}return n}catch{return{}}}function Dh(e){typeof window>"u"||window.localStorage.setItem(Vm,JSON.stringify(e))}function YI(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(zm);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t))r&&typeof o=="boolean"&&(n[r]=o);return n}catch{return{}}}function JI(e){typeof window>"u"||window.localStorage.setItem(zm,JSON.stringify(e))}function QI(){return typeof window>"u"?"":window.localStorage.getItem(Rc)??""}function XI(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Rc);return}window.localStorage.setItem(Rc,e)}}function ZI(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Km);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const r of t){if(typeof r!="string"||r.length===0)continue;const o=no(r);o.length>0&&!n.includes(o)&&n.push(o)}return n}catch{return[]}}function Pi(e){typeof window>"u"||window.localStorage.setItem(Km,JSON.stringify(e))}function eP(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ym);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){const a=typeof r=="string"?no(r):"";a.length>0&&typeof o=="string"&&(n[a]=o)}return n}catch{return{}}}function Fh(e){typeof window>"u"||window.localStorage.setItem(Ym,JSON.stringify(e))}function Us(e,t){const n=[];for(const r of e)n.includes(r)||n.push(r);for(const r of t)n.includes(r.projectName)||n.push(r.projectName);return Ja(e,n)?e:n}function lc(e,t){const n=new Map(e.map(o=>[o.projectName,o])),r=t.map(o=>n.get(o)??null).filter(o=>o!==null);for(const o of e)t.includes(o.projectName)||r.push(o);return r}function Ja(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];if(n.length!==r.length)return!1;for(let o=0;o<n.length;o+=1)if(n[o]!==r[o])return!1;return!0}function tP(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const r=[...e],[o]=r.splice(t,1);return r.splice(n,0,o),r}function nP(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function rP(e=[],t=[]){var n,r,o,a;if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1)if(((n=e[s])==null?void 0:n.step)!==((r=t[s])==null?void 0:r.step)||((o=e[s])==null?void 0:o.status)!==((a=t[s])==null?void 0:a.status))return!1;return!0}function oP(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&rP(e.steps,t.steps)}function Il(e){if(!(e instanceof Error))return!1;const t=e.message.toLowerCase();return t.includes("not supported when using codex with a chatgpt account")||t.includes("model is not supported")||t.includes("requires a newer version of codex")}function jc(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Ja(e.images,t.images)&&aP(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&nP(e.commandExecution,t.commandExecution)&&oP(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function Ks(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Uh(e,t,n={}){const r=new Map(e.map(f=>[f.id,f])),o=new Map(t.map(f=>[f.id,f])),a=t.map(f=>{const w=r.get(f.id);return w&&jc(w,f)?w:f});if(n.preserveMissing!==!0)return Ks(e,a)?e:a;const s=e.map(f=>{const w=o.get(f.id);return!w||jc(f,w)?f:w}),u=new Set(e.map(f=>f.id)),c=a.filter(f=>!u.has(f.id)),m=[...s,...c];return Ks(e,m)?e:m}function aP(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){const r=e[n],o=t[n];if(r.path!==o.path||r.operation!==o.operation||r.movedToPath!==o.movedToPath||r.diff!==o.diff||r.addedLineCount!==o.addedLineCount||r.removedLineCount!==o.removedLineCount)return!1}return!0}function Nc(e){return e.replace(/\s+/gu," ").trim()}function sP(e,t){const n=new Set(t.map(a=>a.id)),r=new Set(t.filter(a=>a.role==="assistant").map(a=>Nc(a.text)).filter(a=>a.length>0));if(r.size===0)return e;const o=e.filter(a=>{if(a.messageType!=="agentMessage.live")return!0;if(n.has(a.id))return!1;const s=Nc(a.text);return s.length===0?!1:!r.has(s)});return o.length===e.length?e:o}function Pl(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const r=e[n];if(jc(r,t))return e;const o=[...e];return o.splice(n,1,t),o}const ev="worked";function za(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function iP(e){if(!Number.isFinite(e)||e<=0)return"<1s";const t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),o=t%60,a=[];n>0&&a.push(`${n}h`),(r>0||n>0)&&a.push(`${r}m`);const s=o>0||a.length===0?o:0;return a.push(`${s}s`),a.join(" ")}function lP(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function uP(e,t){if(!e&&!t)return!0;if(!e||!t||e.label!==t.label||e.details.length!==t.details.length)return!1;for(let n=0;n<e.details.length;n+=1)if(e.details[n]!==t.details[n])return!1;return!0}function cP(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${iP(e.durationMs)}`,messageType:ev,turnId:e.turnId}}function dP(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function fP(e,t){const n=cP(t),r=e.filter(s=>s.messageType!==ev),o=dP(r);if(o<0)return[...r,n];const a=[...r];return a.splice(o,0,n),a}function St(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function hP(e,t){if(t.size===0)return e;let n=!1;const r={};for(const[o,a]of Object.entries(e)){if(t.has(o)){n=!0;continue}r[o]=a}return n?r:e}function pP(e,t){return e.id===t.id&&e.title===t.title&&e.projectName===t.projectName&&e.cwd===t.cwd&&e.createdAtIso===t.createdAtIso&&e.updatedAtIso===t.updatedAtIso&&e.preview===t.preview&&e.unread===t.unread&&e.inProgress===t.inProgress&&e.pendingRequestState===t.pendingRequestState}function mP(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function vP(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function mn(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function Bh(e,t){const n=t.trim();if(!n)return e;let r=!1;const o=[];for(const a of e){const s=a.threads.filter(c=>c.id!==n),u=s.length!==a.threads.length;u&&(r=!0),s.length>0?o.push(u?{...a,threads:s}:a):a.threads.length===0&&o.push(a)}return r?o:e}function Rl(e,t){const n=new Map(e.map(o=>[o.projectName,o])),r=t.map(o=>{const a=n.get(o.projectName),s=new Map((a==null?void 0:a.threads.map(c=>[c.id,c]))??[]),u=o.threads.map(c=>{const m=s.get(c.id);return m&&pP(m,c)?m:c});return a&&a.projectName===o.projectName&&mP(a.threads,u)?a:{projectName:o.projectName,threads:u}});return vP(e,r)?e:r}function gP(e,t,n){const r=new Set($r(t).map(u=>u.id)),o=$r(e).filter(u=>n[u.id]===!0&&!r.has(u.id));if(o.length===0)return t;const a=new Map(t.map(u=>[u.projectName,u])),s=t.map(u=>({projectName:u.projectName,threads:[...u.threads]}));for(const u of o){if(a.get(u.projectName)){const m=s.findIndex(f=>f.projectName===u.projectName);m>=0&&(s[m]={projectName:s[m].projectName,threads:[u,...s[m].threads]});continue}s.push({projectName:u.projectName,threads:[u]})}return s}function xs(e){return no(e)}function yP(e){const t=e.trim();if(!t)return"";const n=t.lastIndexOf(":");return n>=0?t.slice(n+1):t}function wP(e){const t=e.label||no(e.remotePath),n=yP(e.hostId);return n?`${t} ${n}`:t}function tv(e){const t=(e==null?void 0:e.remoteProjects)??[];return new Map(t.map(n=>[n.id,n]))}function pu(e){if(!e)return[];const t=new Set(e.order),n=new Set((e.remoteProjects??[]).map(o=>o.id)),r=e.projectOrder.filter(o=>t.has(o)||n.has(o));for(const o of e.order)r.includes(o)||r.push(o);for(const o of n)r.includes(o)||r.push(o);return r}function Lc(e,t){const n=tv(e);return pu(e).map(r=>{if(n.has(r))return r;const o=ot(r).trim(),a=xs(o);return t.has(a)?o:a})}function Ol(e,t){return ot(e).trim()===t||xs(e)===t}function bP(e,t){const n=new Set;for(const r of e.order)Ol(r,t)&&n.add(r);for(const r of e.active)Ol(r,t)&&n.add(r);for(const r of Object.keys(e.labels))Ol(r,t)&&n.add(r);return n}function _P(e,t,n){var m,f;const r=new Set((e.remoteProjects??[]).map(w=>w.id)),o=new Map;for(const w of e.order){const _=xs(w);o.has(_)||o.set(_,w)}for(const w of n){const _=((f=(m=w.threads[0])==null?void 0:m.cwd)==null?void 0:f.trim())??"";_&&o.set(w.projectName,_)}const a=[],s=w=>{w&&!a.includes(w)&&a.push(w)};for(const w of t){if(r.has(w)){s(w);continue}const _=o.get(w);_&&s(_)}for(const w of pu(e))s(w);const u=a.filter(w=>e.order.includes(w));for(const w of e.order)u.includes(w)||u.push(w);const c=e.active.filter(w=>u.includes(w));return c.length===0&&u.length>0&&c.push(u[0]),{order:u,active:c,projectOrder:a}}function TP(e,t,n){const r=Lc(t,n);if(r.length===0)return e;const o=new Map(r.map((a,s)=>[a,s]));return[...e].sort((a,s)=>{if(Dc(a)||Dc(s))return 0;const u=o.get(a.projectName)??Number.POSITIVE_INFINITY,c=o.get(s.projectName)??Number.POSITIVE_INFINITY;return u===c?0:u-c})}function Oc(e,t){const n=new Map,r=new Map,o=s=>{const u=ot(s).trim();if(!u)return;const c=no(u),m=n.get(c)??new Set;m.add(u),n.set(c,m)};for(const s of(t==null?void 0:t.order)??[]){const u=ot(s).trim();if(!u)continue;const c=no(u);Kl(u)||r.set(c,(r.get(c)??0)+1),o(s)}for(const s of e)for(const u of s.threads){const c=ot(u.cwd).trim(),m=no(c),f=(t==null?void 0:t.order.some(w=>ot(w).trim()===c))===!0;Kl(c)&&!f&&r.get(m)===1||o(u.cwd)}const a=new Set;for(const[s,u]of n.entries())u.size>1&&a.add(s);return a}function Kl(e){return e.includes("/.codex/worktrees/")}function kP(e,t){const n=Oc(e,t);if(n.size===0)return e;const r=new Set,o=new Set,a=new Map,s=new Set;for(const m of(t==null?void 0:t.order)??[]){const f=ot(m).trim();if(!f||(s.add(f),Kl(f)))continue;const w=no(f);r.has(w)?(r.delete(w),o.add(w),a.delete(w)):o.has(w)||(r.add(w),a.set(w,f))}const u=[],c=new Map;for(const m of e)for(const f of m.threads){const w=ot(f.cwd).trim(),_=no(w),P=s.has(w),q=Kl(w)&&!P&&r.has(_);let O=m.projectName;q&&n.has(_)?O=a.get(_)??m.projectName:w&&n.has(_)&&(O=w);const te=f.projectName===O?f:{...f,projectName:O},F=c.get(O);if(F)F.threads.push(te);else{const U={projectName:O,threads:[te]};c.set(O,U),u.push(U)}}return u}function CP(e,t,n){if(!t||t.order.length===0&&(t.remoteProjects??[]).length===0)return e;const r=new Set(e.map(s=>s.projectName)),o=[...e],a=tv(t);for(const s of pu(t)){if(a.has(s)){if(r.has(s))continue;o.push({projectName:s,threads:[]}),r.add(s);continue}const u=ot(s).trim();if(!u)continue;const c=xs(u),m=n.has(c)?u:c;r.has(m)||(o.push({projectName:m,threads:[]}),r.add(m))}return o}function SP(e){const t=e.split(`
|
|
51
|
+
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function xP(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function Dc(e){return e.threads.some(t=>t.cwd.trim().length===0||Vl(t.cwd))}function AP(){const e=x([]),t=x([]),n=x(QI()),r=x({}),o=x({}),a=x({}),s=x({}),u=x({}),c=x({}),m=x({}),f=x({}),w=x({});let _=!1;const P=x({}),q=x([]),O=x([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),te=x(zI()),F=x(VI()),U=x(El(te.value,n.value)),G=x(Nh(F.value,n.value)),Y=x("medium"),Te=x("standard"),Me=x(""),ae=x(UI()),Se=x(BI()),K=x(ZI()),be=x(eP()),Ce=x({}),ne=x({}),Ae=x({}),We=x({}),qe=x({}),Be=x({}),Ee=x({}),Ie=x({}),Ze=x({}),je=x({}),et=x({}),ze=x({}),ct=x({}),nt=x({}),Ye=x({}),vt=x(null),X=x(KI()),ke=x(YI()),pe=x({}),xe=x([]),Ve=x([]),E=x(!1),$=x(!1),V=x(!1),se=x(!1),ce=x(!1),ie=x(!1),me=x(!1),ue=x(""),ge=x(!1),he=x(!1);function Fe(i){var d;try{const g=new URL(i,"http://localhost");return g.pathname!=="/codex-local-image"?"":((d=g.searchParams.get("path"))==null?void 0:d.trim())??""}catch{return""}}function _e(i){const d=i.trim().toLowerCase();return d?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(d):!1}function Oe(i){var g;const d=r.value[i]??[];for(let T=d.length-1;T>=0;T-=1){const j=d[T];if(!(j.role!=="user"||!Array.isArray(j.images)||j.images.length===0))for(let N=j.images.length-1;N>=0;N-=1){const H=((g=j.images[N])==null?void 0:g.trim())??"";if(H&&Fe(H))return H}}return""}let $e=null,Ge=null,D=null;const B=new Map;let W=null;const oe=new Map;let ye=null,Pe=null,De=!1;const rt=new Set,ut=new Map;let gt=null,ft=null,Tt=!1,Jt=!1,Dn=[],ao=null,Sa=!1,kn=!1;const Cn=new Map,so=new Set,Mo=Z(()=>$r(e.value)),wn=Z(()=>Mo.value.find(i=>i.id===n.value)??null),cn=Z(()=>{const i=n.value;return!!(i&&ke.value[i]===!0)}),gr=Z(()=>{const i=n.value;return i?et.value[i]===!0:!1}),io=Z(()=>{const i=[],d=n.value;return d&&Array.isArray(nt.value[d])&&i.push(...nt.value[d]),Array.isArray(nt.value[Fs])&&i.push(...nt.value[Fs]),i.sort((g,T)=>g.receivedAtIso.localeCompare(T.receivedAtIso))}),jr=Z(()=>{var N;const i=n.value;if(!i)return null;const d=m.value[i]===!0,g=d?Ie.value[i]:void 0,T=d?(s.value[i]??"").trim():"",j=(((N=Ze.value[i])==null?void 0:N.message)??"").trim();return!g&&!T&&!j?null:{activityLabel:(g==null?void 0:g.label)||"Thinking",activityDetails:(g==null?void 0:g.details)??[],reasoningText:T,errorText:j}}),yr=Z(()=>vt.value),xa=Z(()=>{const i=n.value;return i?X.value[i]??null:null}),Qo=Z(()=>{const i=n.value;if(!i)return[];const d=r.value[i]??[],g=o.value[i]??[],T=a.value[i]??[],j=u.value[i]??[],N=c.value[i]??[],H=[...d,...g,...j,...N,...T],J=Ee.value[i];return J?fP(H,J):H}),Qn=Z(()=>{const i=n.value;return i?Ae.value[i]===!0:!1}),lo=Z(()=>{const i=n.value;return i?We.value[i]===!0:!1});function $o(i){var g;const d=r.value[i]??[];for(const T of d){const j=((g=T.turnId)==null?void 0:g.trim())??"";if(j)return j}return""}function an(i){if(ti(i)===Za){const g=sc(Me.value),T=g?ui(F.value[g]):"";if(T)return T}return Nh(F.value,i).trim()}function pt(...i){const d=[...q.value];for(const g of i){const T=g.trim();T&&!d.includes(T)&&d.push(T)}Ja(q.value,d)||(q.value=d)}function Qt(i){n.value!==i&&(n.value=i,XI(i),G.value=an(i),pt(G.value),U.value=El(te.value,i),kn=!1)}function Fn(i,d){const g=d.trim(),T=ti(i);if(g){const j=Ni(F.value);j[T]=g,F.value=j}else F.value=Wi(F.value,T);if(i.trim()===n.value?(G.value=an(n.value),pt(G.value)):pt(g),T===Za){const j=sc(Me.value);if(j)if(g){const N=Ni(F.value);N[j]=g,F.value=N}else F.value=Wi(F.value,j)}Al(F.value)}function Ot(i){Fn(n.value,i)}function sn(i,d){const g=i.trim();if(!g)return;const T=d.trim();if(T){const j=Ni(F.value);j[g]=T,F.value=j}else F.value=Wi(F.value,g);pt(T),n.value===g&&(G.value=an(n.value)),Al(F.value)}function uo(i,d){const g=i.trim();if(!g)return;if(!d){if(!(g in X.value))return;X.value=St(X.value,g),Dh(X.value);return}const T=X.value[g];T&&JSON.stringify(T)===JSON.stringify(d)||(X.value={...X.value,[g]:d},Dh(X.value))}function Gr(i){const d=i==="plan"?"plan":"default",g=ti(n.value);El(te.value,n.value)===d&&U.value===d||(U.value=d,te.value=Lh(te.value,g,d),ic(te.value))}function dn(i,d){const g=d==="plan"?"plan":"default";te.value=Lh(te.value,i,g),i.trim()===n.value&&(U.value=g),ic(te.value)}function fn(i){vt.value=i}async function Ft(i=n.value){i.trim()?sn(i,_o):Ot(_o),pt(_o)}function $n(i,d){Ye.value={...Ye.value,[i]:d}}function wr(i){Ye.value[i]&&(Ye.value=St(Ye.value,i))}async function co(i){if(so.has(i))return;const d=Ye.value[i];if(!(!d||d.fallbackRetried)){so.add(i),$n(i,{...d,fallbackRetried:!0});try{await Ft(i);try{const g=await Xu(i,1);Bn(i,g),ln(i),Tn(i,[]),Gt(i),u.value[i]&&(u.value=St(u.value,i))}catch{}kt(i,null),ue.value="",Wt(i,null),rn(i,{label:"Thinking",details:br(_o,d.effort,d.collaborationMode)}),nn(i,!0),qe.value[i]!==!0&&await Qu(i),await Zu(i,d.text,d.imageUrls,_o,d.effort||void 0,d.skills.length>0?d.skills:void 0,d.fileAttachments,d.collaborationMode),qe.value={...qe.value,[i]:!0},_n(),rt.add(i),await wo()}catch(g){const T=g instanceof Error?g.message:"Unknown application error";kt(i,T),ue.value=T,nn(i,!1),rn(i,null)}finally{so.delete(i)}}}function jo(i){i&&!Mh.includes(i)||(Y.value=i)}async function jn(i){const d=i==="fast"?"fast":"standard";if(ie.value||Te.value===d)return;const g=Te.value;Te.value=d,ie.value=!0,ue.value="";try{await tT(d)}catch(T){Te.value=g,ue.value=T instanceof Error?T.message:"Failed to update Fast mode"}finally{ie.value=!1}}async function fo(){try{const i=await iT();O.value=i,i.some(d=>d.value===U.value)||Gr("default")}catch{}}function br(i,d,g=U.value){const T=i.trim()||"default",j=d||"default",N=g==="plan"?"Plan":"Default",H=Te.value==="fast"?"Fast":"Standard";return[`Mode: ${N}`,`Model: ${T}`,`Thinking: ${j}`,`Speed: ${H}`]}async function bn(i){try{const[d,g]=await Promise.all([Nm({includeProviderModels:(i==null?void 0:i.includeProviderModels)!==!1}),Lm()]),T=an(n.value),j=g.model.trim(),N=Xm(g.providerId);Me.value=N;const H=sc(N),J=H?ui(F.value[H]):"",le=[...d];if(!(i!=null&&i.providerChanged))for(const Je of[T,j])Je&&!le.includes(Je)&&le.push(Je);q.value=le;const we=T&&d.includes(T);if((!T||!we||i!=null&&i.providerChanged)&&(i!=null&&i.providerChanged&&le.length>0?J&&le.includes(J)?Ot(J):j&&le.includes(j)?Ot(j):Ot(le[0]):j&&le.includes(j)?Ot(g.model):le.length>0?Ot(le[0]):Ot("")),H&&G.value.trim().length>0){const Je=Ni(F.value);Je[H]=G.value.trim(),F.value=Je,Al(F.value)}g.reasoningEffort&&Mh.includes(g.reasoningEffort)&&(Y.value=g.reasoningEffort),Te.value=g.speedMode}catch{}}async function gn(){if(Pe){await Pe;return}Pe=(async()=>{try{const i=await U_();fn(i),Ve.value=i?[i]:[]}catch{}finally{Pe=null}})(),await Pe}function _n(){if(typeof window>"u"){gn();return}D!==null&&window.clearTimeout(D),D=window.setTimeout(()=>{D=null,gn()},OI)}function _r(i){if(!i||typeof window>"u")return;const d=B.get(i);d!==void 0&&(window.clearTimeout(d),B.delete(i))}function Nr(i){if(!i||typeof window>"u")return;_r(i);const d=window.setTimeout(()=>{B.delete(i),rt.add(i),wo()},DI);B.set(i,d)}function ho(i){const d=pe.value;return Object.keys(d).length===0?i:i.map(g=>({projectName:g.projectName,threads:g.threads.map(T=>{const j=d[T.id];return j?{...T,title:j}:T})}))}function Nn(i){return i?Array.isArray(nt.value[i])?nt.value[i]:[]:[]}function Lr(i){return i==="item/commandExecution/requestApproval"||i==="item/fileChange/requestApproval"||i==="item/permissions/requestApproval"||i==="execCommandApproval"||i==="applyPatchApproval"}function Un(i){return i.some(d=>Lr(d.method))?"approval":i.length>0?"response":null}function Pt(){const d=ho(t.value).map(g=>({projectName:g.projectName,threads:g.threads.map(T=>{const j=m.value[T.id]===!0,N=Un(Nn(T.id)),H=n.value===T.id,J=P.value[T.id]===!0,le=HI(T.updatedAtIso,ae.value[T.id],Se.value);return{...T,inProgress:j,unread:!H&&!j&&(J||le),pendingRequestState:N}})}));e.value=Rl(e.value,d)}function ir(i,d,g){const T=new Date().toISOString(),j=ot(d),N=no(j),H={id:i,title:SP(g),projectName:N,cwd:j,hasWorktree:j.includes("/.codex/worktrees/")||j.includes("/.git/worktrees/"),createdAtIso:T,updatedAtIso:T,preview:g,unread:!1,inProgress:!1},J=t.value.findIndex(we=>we.projectName===N);if(J>=0){const Je=t.value[J].threads.filter(Ct=>Ct.id!==i),_t={projectName:N,threads:[H,...Je]},bt=[...t.value];bt.splice(J,1,_t),t.value=bt}else t.value=[{projectName:N,threads:[H]},...t.value];const le=Us(K.value,t.value);Ja(K.value,le)||(K.value=le,Pi(K.value)),Pt()}function Tr(i){const d=new Set(i.map(le=>le.id)),g=n.value.trim();g&&d.add(g);const T=jh(F.value,d);T!==F.value&&(F.value=T,G.value=an(n.value),pt(G.value),Al(T));const j=jh(te.value,d);j!==te.value&&(te.value=j,U.value=El(j,n.value),ic(j));const N=mn(ae.value,d);N!==ae.value&&(ae.value=N,$h(N)),ne.value=mn(ne.value,d),Ce.value=mn(Ce.value,d),qe.value=mn(qe.value,d),Be.value=mn(Be.value,d),r.value=mn(r.value,d),a.value=mn(a.value,d),s.value=mn(s.value,d),u.value=mn(u.value,d),c.value=mn(c.value,d),Ee.value=mn(Ee.value,d),Ie.value=mn(Ie.value,d),Ze.value=mn(Ze.value,d),je.value=mn(je.value,d),et.value=mn(et.value,d),ze.value=mn(ze.value,d),ct.value=mn(ct.value,d);const H=mn(f.value,d);H!==f.value&&(f.value=H,Zr()),X.value=mn(X.value,d),P.value=mn(P.value,d),m.value=mn(m.value,d);const J={};for(const[le,we]of Object.entries(nt.value))(le===Fs||d.has(le))&&(J[le]=we);nt.value=J}function kr(i){const d=$r(t.value).find(g=>g.id===i);d&&(ae.value={...ae.value,[i]:d.updatedAtIso},$h(ae.value),P.value[i]&&(P.value=St(P.value,i)),Pt())}function Wt(i,d){if(!i)return;const g=Ee.value[i];if(d){if(lP(g,d))return;Ee.value={...Ee.value,[i]:d}}else g&&(Ee.value=St(Ee.value,i))}function nn(i,d){!i||m.value[i]===!0===d||(d?m.value={...m.value,[i]:!0}:(m.value=St(m.value,i),hn(i),Ln(i)),Pt(),!d&&!go()&>&&At())}function Ln(i){i&&(et.value[i]&&(et.value=St(et.value,i)),ze.value[i]&&(ze.value=St(ze.value,i)),ct.value[i]&&(ct.value=St(ct.value,i)))}function Cr(i){i&&(et.value={...et.value,[i]:!0},ze.value[i]&&(ze.value=St(ze.value,i)),ct.value[i]&&(ct.value=St(ct.value,i)))}function lr(i){i&&et.value[i]===!0&&ze.value[i]===!0&&ct.value[i]===!0&&Ln(i)}function Xn(i,d){!i||!d||et.value[i]===!0&&Ln(i)}function Or(i){const d=Object.keys(et.value);if(d.length===0)return;let g=ze.value,T=!1;for(const j of d)!i.has(j)||g[j]===!0||(g={...g,[j]:!0},T=!0);if(T){ze.value=g;for(const j of d)lr(j)}}function po(i,d){i&&et.value[i]===!0&&d.some(g=>g.role==="user")&&(ct.value[i]!==!0&&(ct.value={...ct.value,[i]:!0}),lr(i))}function ur(i){i&&i!==n.value&&P.value[i]!==!0&&(P.value={...P.value,[i]:!0},Pt())}function rn(i,d){if(!i)return;const g=Ie.value[i];if(!d){g&&(Ie.value=St(Ie.value,i));return}const T=mo(d.label)||"Thinking",j=d.details.map(J=>mo(J)).filter(J=>J.length>0&&J!==T),N=Array.from(new Set([...(g==null?void 0:g.details)??[],...j])).slice(-3),H={label:T,details:N};uP(g,H)||(Ie.value={...Ie.value,[i]:H})}function kt(i,d,g={}){if(!i)return;const T=Ze.value[i],j=d?Nc(d):"";if(!j){T&&(Ze.value=St(Ze.value,i));return}const N=g.transient===!0;(T==null?void 0:T.message)===j&&T.transient===N||(Ze.value={...Ze.value,[i]:{message:j,transient:N}})}function Sn(i){var d;i&&(d=Ze.value[i])!=null&&d.transient&&kt(i,null)}function Ut(){const i=Object.entries(Ze.value).filter(([,g])=>g==null?void 0:g.transient).map(([g])=>g);if(i.length===0)return;let d=Ze.value;for(const g of i)d=St(d,g);Ze.value=d}function yt(i){const d=$r(t.value).find(g=>g.id===i);return(d==null?void 0:d.updatedAtIso)??""}function Bt(i,d){if(!i)return;const g={...ke.value};d?g[i]=!0:delete g[i],ke.value=g,JI(g)}function Sr(){const i=n.value;i&&Bt(i,!cn.value)}function Bn(i,d){const g=r.value[i]??[];Ks(g,d)||(r.value={...r.value,[i]:d})}function Tn(i,d){const g=a.value[i]??[];Ks(g,d)||(a.value={...a.value,[i]:d})}function Xo(i){i&&i in a.value&&(a.value=St(a.value,i))}function Dr(i,d){const g=c.value[i]??[];Ks(g,d)||(c.value={...c.value,[i]:d})}function xn(i,d){const g=o.value[i]??[];Ks(g,d)||(o.value={...o.value,[i]:d})}function M(i,d){const g=o.value[i]??[],T=Pl(g,d);xn(i,T)}function L(i,d){const g=a.value[i]??[],T=Pl(g,d);Tn(i,T)}function ee(i,d){const g=c.value[i]??[],T=Pl(g,d);Dr(i,T)}function Ne(i,d){if(!i)return;const g=d.trim(),T=s.value[i]??"";if(g.length===0){if(!T)return;s.value=St(s.value,i);return}T!==g&&(s.value={...s.value,[i]:g})}function wt(i,d){if(!i)return;const g=s.value[i]??"";Ne(i,`${g}${d}`)}function Gt(i){i&&i in s.value&&(s.value=St(s.value,i))}function ln(i){i&&i in o.value&&(o.value=St(o.value,i))}function Vt(i){i&&i in c.value&&(c.value=St(c.value,i))}function hn(i){i&&(ln(i),Gt(i),rn(i,null),n.value,u.value[i]&&(u.value=St(u.value,i)),je.value[i]&&(je.value=St(je.value,i)),wr(i))}function xr(i){return i==="completed"?"completed":i==="inProgress"||i==="in_progress"?"inProgress":"pending"}function qn(i){var g;const d=[];(g=i.explanation)!=null&&g.trim()&&d.push(i.explanation.trim());for(const T of i.steps){const j=T.status==="completed"?"x":T.status==="inProgress"?"~":" ";d.push(`- [${j}] ${T.step}`)}return d.join(`
|
|
52
|
+
`).trim()}function Fr(i){if(i.method!=="turn/plan/updated")return null;const d=Ue(i.params),g=un(i),T=Re(d==null?void 0:d.turnId)||Re(d==null?void 0:d.turn_id),N=(Array.isArray(d==null?void 0:d.plan)?d==null?void 0:d.plan:[]).map(le=>Ue(le)).map(le=>({step:Re(le==null?void 0:le.step),status:xr(le==null?void 0:le.status)})).filter(le=>le.step.length>0);if(!g||!T)return null;const J={explanation:Re(d==null?void 0:d.explanation).trim()||void 0,steps:N,isStreaming:!0};return{threadId:g,message:{id:`${T}:plan`,role:"assistant",text:qn(J),messageType:"plan.live",plan:J}}}function Kr(i){if(i.method!=="item/plan/delta")return null;const d=Ue(i.params),g=un(i),T=Re(d==null?void 0:d.turnId)||Re(d==null?void 0:d.turn_id),j=Re(d==null?void 0:d.delta);if(!g||!T||!j)return null;const N=`${T}:plan`,H=(o.value[g]??[]).find(we=>we.id===N),J=`${(H==null?void 0:H.text)??""}${j}`,le=H!=null&&H.plan?{...H.plan,isStreaming:!0}:void 0;return{threadId:g,message:{id:N,role:"assistant",text:J,messageType:"plan.live",plan:le}}}function Ue(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)?i:null}function Re(i){return typeof i=="string"?i:""}function Ar(i){return typeof i=="number"&&Number.isFinite(i)?i:null}function Rt(i){const d=Ue(i);if(!d)return null;const g=Ar(d.totalTokens??d.total_tokens),T=Ar(d.inputTokens??d.input_tokens),j=Ar(d.cachedInputTokens??d.cached_input_tokens),N=Ar(d.outputTokens??d.output_tokens),H=Ar(d.reasoningOutputTokens??d.reasoning_output_tokens);return g===null||T===null||j===null||N===null||H===null?null:{totalTokens:g,inputTokens:T,cachedInputTokens:j,outputTokens:N,reasoningOutputTokens:H}}function Er(i){const d=Ue(i);if(!d)return null;const g=Rt(d.total),T=Rt(d.last);if(!g||!T)return null;const j=Ar(d.modelContextWindow??d.model_context_window),N=T.totalTokens,H=typeof j=="number"?Math.max(j-N,0):null,J=typeof j=="number"&&j>0?Zm(Math.round((H??0)/j*100),0,100):null;return{total:g,last:T,modelContextWindow:j,currentContextTokens:N,remainingContextTokens:H,remainingContextPercent:J}}function Zn(i){if(i.method!=="thread/tokenUsage/updated")return null;const d=Ue(i.params),g=un(i),T=Er((d==null?void 0:d.tokenUsage)??(d==null?void 0:d.token_usage));return!g||!T?null:{threadId:g,usage:T}}function un(i){const d=Ue(i.params);if(!d)return"";const g=Re(d.threadId);if(g)return g;const T=Re(d.thread_id);if(T)return T;const j=Re(d.conversationId);if(j)return j;const N=Re(d.conversation_id);if(N)return N;const H=Ue(d.thread),J=Re(H==null?void 0:H.id);if(J)return J;const le=Ue(d.turn),we=Re(le==null?void 0:le.threadId);if(we)return we;const Je=Re(le==null?void 0:le.thread_id);return Je||""}function Zo(i){if(i.method!=="turn/completed")return"";const d=Ue(i.params),g=Ue(d==null?void 0:d.turn);if(!g||g.status!=="failed")return"";const T=Ue(g.error);return Re(T==null?void 0:T.message)}function Hn(i){var T;if(i.method!=="error")return null;const d=Ue(i.params),g=Re(d==null?void 0:d.message)||Re((T=Ue(d==null?void 0:d.error))==null?void 0:T.message);return g?{message:g,transient:(d==null?void 0:d.willRetry)===!0}:null}function er(i){const d=Ue(i);if(!d)return null;const g=d.id,T=Re(d.method),j=d.params;if(typeof g!="number"||!Number.isInteger(g)||!T)return null;const N=Ue(j),H=ea(T,N),J=Re(N==null?void 0:N.threadId)||Re(N==null?void 0:N.thread_id)||Re(N==null?void 0:N.conversationId)||Re(N==null?void 0:N.conversation_id)||Fs,le=Re(N==null?void 0:N.turnId)||Re(N==null?void 0:N.turn_id),we=Re(N==null?void 0:N.itemId)||Re(N==null?void 0:N.item_id)||Re(N==null?void 0:N.callId)||Re(N==null?void 0:N.call_id),Je=Re(d.receivedAtIso)||new Date().toISOString();return{id:g,method:H,threadId:J,turnId:le,itemId:we,receivedAtIso:Je,params:j??null}}function ea(i,d){const g=i.trim();return g&&(g==="item/commandExecution/requestApproval"||g==="execCommandApproval"||g==="exec_approval_request"||Aa(d)?"item/commandExecution/requestApproval":g==="item/fileChange/requestApproval"||g==="applyPatchApproval"||g==="apply_patch_approval_request"||ta(d)?"item/fileChange/requestApproval":g==="item/tool/requestUserInput"||g==="request_user_input"||na(d)?"item/tool/requestUserInput":g==="mcpServer/elicitation/request"||g==="elicitation_request"||Ea(d)?"mcpServer/elicitation/request":g==="item/permissions/requestApproval"||Ur(d)?"item/permissions/requestApproval":g==="item/tool/call"||g==="dynamic_tool_call_request"||Xt(d)?"item/tool/call":g)}function Aa(i){if(!i)return!1;const d=i.command;return Array.isArray(d)&&d.some(g=>typeof g=="string"&&g.trim().length>0)||typeof d=="string"&&d.trim().length>0?!0:Array.isArray(i.commandActions)}function ta(i){return i?typeof i.grantRoot=="string"&&i.grantRoot.trim().length>0||typeof i.grant_root=="string"&&i.grant_root.trim().length>0||Ue(i.fileChanges)?!0:Ue(i.changes)!==null:!1}function na(i){return!!(i&&Array.isArray(i.questions))}function Xt(i){return i?typeof i.toolName=="string"||typeof i.tool_name=="string"||typeof i.name=="string"||Array.isArray(i.arguments):!1}function Ea(i){if(!i)return!1;const d=Re(i.mode);return typeof i.serverName=="string"&&typeof i.threadId=="string"&&typeof i.message=="string"&&(d==="form"||d==="url")}function Ur(i){return i?typeof i.threadId=="string"&&typeof i.turnId=="string"&&typeof i.itemId=="string"&&Ue(i.permissions)!==null:!1}function No(i){if(i.method!=="item/tool/requestUserInput")return[];const d=Ue(i.params),g=Array.isArray(d==null?void 0:d.questions)?d.questions:[],T=[];for(const j of g){const N=Ue(j),H=Re(N==null?void 0:N.id).trim();H&&T.push(H)}return T}function Wn(i){const d=i.threadId||Fs,g=nt.value[d]??[],T=g.findIndex(N=>N.id===i.id),j=[...g];T>=0?j.splice(T,1,i):j.push(i),nt.value={...nt.value,[d]:j.sort((N,H)=>N.receivedAtIso.localeCompare(H.receivedAtIso))},Pt()}function Br(i){const d={};for(const[g,T]of Object.entries(nt.value)){const j=T.filter(N=>N.id!==i);j.length>0&&(d[g]=j)}nt.value=d,Pt()}function Ia(i){const d={};for(const g of i){const T=g.threadId||Fs,j=d[T]??[];j.push(g),d[T]=j}for(const g of Object.values(d))g.sort((T,j)=>T.receivedAtIso.localeCompare(j.receivedAtIso));nt.value=d}function tr(i){if(i.method==="server/request"){const d=er(i.params);return d&&Wn(d),!0}if(i.method==="server/request/resolved"){const d=Ue(i.params),g=d==null?void 0:d.id;return typeof g=="number"&&Number.isInteger(g)&&Br(g),!0}return!1}function mo(i){return i.replace(/\s+/gu," ").trim()}function ra(i){const d=un(i);if(!d)return null;if(i.method==="turn/started")return{threadId:d,activity:{label:"Thinking",details:[]}};if(i.method==="item/started"){const g=Ue(i.params),T=Ue(g==null?void 0:g.item),j=Re(T==null?void 0:T.type).toLowerCase();if(j==="reasoning")return{threadId:d,activity:{label:"Thinking",details:[]}};if(j==="agentmessage")return{threadId:d,activity:{label:"Writing response",details:[]}};if(j==="commandexecution"){const N=Re(T==null?void 0:T.command);return{threadId:d,activity:{label:"Running command",details:N?[N]:[]}}}if(j==="filechange"){const H=(Array.isArray(T==null?void 0:T.changes)?T.changes:[])[0],J=Re(H==null?void 0:H.path);return{threadId:d,activity:{label:"Applying changes",details:J?[J]:[]}}}}return i.method==="item/commandExecution/outputDelta"?{threadId:d,activity:{label:"Running command",details:[]}}:i.method==="item/fileChange/outputDelta"?{threadId:d,activity:{label:"Applying changes",details:[]}}:i.method==="item/reasoning/summaryTextDelta"||i.method==="item/reasoning/summaryPartAdded"?{threadId:d,activity:{label:"Thinking",details:[]}}:i.method==="item/agentMessage/delta"?{threadId:d,activity:{label:"Writing response",details:[]}}:null}function oa(i){if(i.method!=="turn/started")return null;const d=Ue(i.params);if(!d)return null;const g=un(i);if(!g)return null;const T=Ue(d.turn),j=Re(T==null?void 0:T.id)||Re(d.turnId)||`${g}:unknown`;if(!j)return null;const N=za(Re(T==null?void 0:T.startedAt))??za(Re(d.startedAt))??za(i.atIso)??Date.now();return{threadId:g,turnId:j,startedAtMs:N}}function Lo(i){if(i.method!=="turn/completed")return null;const d=Ue(i.params);if(!d)return null;const g=un(i);if(!g)return null;const T=Ue(d.turn),j=Re(T==null?void 0:T.id)||Re(d.turnId)||`${g}:unknown`;if(!j)return null;const N=za(Re(T==null?void 0:T.completedAt))??za(Re(d.completedAt))??za(i.atIso)??Date.now(),H=za(Re(T==null?void 0:T.startedAt))??za(Re(d.startedAt))??void 0;return{threadId:g,turnId:j,completedAtMs:N,startedAtMs:H}}function An(i){return`${i}:live-reasoning`}function os(i){const d=r.value[i]??[];let g=-1;for(const T of d)typeof T.turnIndex=="number"&&Number.isFinite(T.turnIndex)&&(g=Math.max(g,T.turnIndex));return g+1}function nr(i,d,g){if(!i||!d||!Number.isInteger(g)||g<0)return;const T=Be.value[i]??{};T[d]!==g&&(Be.value={...Be.value,[i]:{...T,[d]:g}})}function as(i,d){const g=Be.value[i]??{},T=Object.entries(g),j=Object.entries(d);T.length===j.length&&T.every(([N,H])=>d[N]===H)||(Be.value={...Be.value,[i]:{...d}})}function Pa(i){const d=c.value[i];if(!d||d.length===0)return;const g=Be.value[i]??{};let T=!1;const j=d.map(N=>{if(typeof N.turnIndex=="number"||!N.turnId)return N;const H=g[N.turnId];return typeof H!="number"?N:(T=!0,{...N,turnIndex:H})});T&&(c.value={...c.value,[i]:j})}function On(i){const d=Ue(i.params);if(!d)return"";if(i.method==="item/started"){const g=Ue(d.item);return!g||g.type!=="reasoning"?"":Re(g.id)}return""}function Ir(i){const d=Ue(i.params);if(!d)return null;if(i.method==="item/reasoning/summaryTextDelta"){const g=Re(d.itemId),T=Re(d.delta);return!g||!T?null:{messageId:An(g),delta:T}}return null}function aa(i){const d=Ue(i.params);if(!d)return"";if(i.method==="item/reasoning/summaryPartAdded"){const g=Re(d.itemId);return g?An(g):""}return""}function sa(i){const d=Ue(i.params);if(!d)return"";if(i.method==="item/completed"){const g=Ue(d.item);return!g||g.type!=="reasoning"?"":An(Re(g.id))}return""}function yn(i){const d=Ue(i.params);if(!d)return"";if(i.method==="item/started"){const g=Ue(d.item);return!g||g.type!=="agentMessage"?"":Re(g.id)}return""}function Vn(i){const d=Ue(i.params);if(!d)return null;if(i.method==="item/agentMessage/delta"){const g=Re(d.itemId),T=Re(d.delta);return!g||!T?null:{messageId:g,delta:T}}return null}function zn(i){const d=Ue(i.params);if(!d)return null;if(i.method==="item/completed"){const g=Ue(d.item);if(!g||g.type!=="agentMessage")return null;const T=Re(g.id),j=Re(g.text);return!T||!j?null:{id:T,role:"assistant",text:j,messageType:"agentMessage.live"}}return null}function ss(i){return`/codex-local-image?path=${encodeURIComponent(i)}`}function Pr(i){const d=i.trim();if(!d)return"";if(d.startsWith("data:")||d.startsWith("http://")||d.startsWith("https://")||d.startsWith("/codex-local-image?"))return d;const g=d.replace(/\s+/gu,"");return/^[A-Za-z0-9+/]+={0,2}$/u.test(g)?`data:image/png;base64,${g}`:""}function Rr(i){if(i.method!=="item/completed")return null;const d=Ue(i.params),g=Ue(d==null?void 0:d.item);if(!g)return null;const T=Re(g.id);if(!T)return null;if(g.type==="imageView"){const H=Re(g.path);return H?{id:T,role:"assistant",text:"",images:[ss(H)],messageType:"imageView"}:null}if(g.type!=="imageGeneration"&&g.type!=="image_generation")return null;const j=Re(g.result),N=j?Pr(j):"";return N?{id:T,role:"assistant",text:"",images:[N],messageType:"imageView"}:null}function Ra(i){var we;if(i.method!=="item/started")return null;const d=Ue(i.params),g=Ue(d==null?void 0:d.item);if(!g||g.type!=="commandExecution")return null;const T=Re(g.id),j=Re(g.command);if(!T)return null;const N=typeof g.cwd=="string"?g.cwd:null,H=un(i),J=Re(d==null?void 0:d.turnId)||Re(d==null?void 0:d.turn_id),le=H&&J?(we=Be.value[H])==null?void 0:we[J]:void 0;return{id:T,role:"system",text:j,messageType:"commandExecution",commandExecution:{command:j,cwd:N,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:J||void 0,turnIndex:typeof le=="number"?le:void 0}}function ia(i){if(i.method!=="item/commandExecution/outputDelta")return null;const d=Ue(i.params);if(!d)return null;const g=Re(d.itemId),T=Re(d.delta);return!g||!T?null:{itemId:g,delta:T}}function la(i){var Ct;if(i.method!=="item/completed")return null;const d=Ue(i.params),g=Ue(d==null?void 0:d.item);if(!g||g.type!=="commandExecution")return null;const T=Re(g.id),j=Re(g.command);if(!T)return null;const N=typeof g.cwd=="string"?g.cwd:null,H=Re(g.status),J=H==="failed"?"failed":H==="declined"?"declined":H==="interrupted"?"interrupted":"completed",le=typeof g.aggregatedOutput=="string"?g.aggregatedOutput:"",we=typeof g.exitCode=="number"?g.exitCode:null,Je=un(i),_t=Re(d==null?void 0:d.turnId)||Re(d==null?void 0:d.turn_id),bt=Je&&_t?(Ct=Be.value[Je])==null?void 0:Ct[_t]:void 0;return{id:T,role:"system",text:j,messageType:"commandExecution",commandExecution:{command:j,cwd:N,status:J,aggregatedOutput:le,exitCode:we},turnId:_t||void 0,turnIndex:typeof bt=="number"?bt:void 0}}function Yr(i){var we;if(i.method!=="item/completed")return null;const d=Ue(i.params),g=Ue(d==null?void 0:d.item);if(!g||g.type!=="fileChange")return null;const T=Re(g.id);if(!T)return null;const j=Re(d==null?void 0:d.threadId),N=Re(d==null?void 0:d.turnId),H=j&&N?(we=Be.value[j])==null?void 0:we[N]:void 0,J=Im(g.changes),le=Em(g.status);return J.length===0||le!=="completed"?null:{id:T,role:"system",text:"",messageType:"fileChange",fileChangeStatus:le,fileChanges:J,turnId:N||void 0,turnIndex:typeof H=="number"?H:void 0}}function Jr(i,d){const g=u.value[i]??[],T=Pl(g,d);T!==g&&(u.value={...u.value,[i]:T})}function ua(i,d){const g=u.value[i];if(!g||g.length===0)return;const T=new Set(d.map(N=>N.id)),j=g.filter(N=>!T.has(N.id));j.length!==g.length&&(j.length===0?u.value=St(u.value,i):u.value={...u.value,[i]:j})}function qr(i,d){const g=c.value[i];if(!g||g.length===0)return;const T=new Set(d.map(J=>J.id)),j=new Set(d.filter(J=>J.messageType==="fileChange"&&typeof J.turnId=="string"&&J.turnId.length>0).map(J=>J.turnId)),N=new Set(d.filter(J=>J.messageType==="fileChange"&&typeof J.turnIndex=="number").map(J=>J.turnIndex)),H=g.filter(J=>!T.has(J.id)&&!(J.turnId&&j.has(J.turnId))&&!(typeof J.turnIndex=="number"&&N.has(J.turnIndex)));H.length!==g.length&&(H.length===0?c.value=St(c.value,i):c.value={...c.value,[i]:H})}function Ma(i){if(i.method==="item/agentMessage/delta")return!0;const d=Ue(i.params);if(!d)return!1;if(i.method==="item/completed"){const g=Ue(d.item);return(g==null?void 0:g.type)==="agentMessage"}return!1}function Oo(i){var yi,dl,qa,wi,hs;if(tr(i))return;if(i.method==="account/rateLimits/updated"&&_n(),i.method==="thread/name/updated"){const lt=Ue(i.params),Mr=Re(lt==null?void 0:lt.threadId),ca=Re(lt==null?void 0:lt.threadName);Mr&&ca&&(pe.value={...pe.value,[Mr]:ca},Pt(),tc(Mr,ca))}if(i.method==="account/rateLimits/updated"){fn(Mm(i.params));return}const d=Zn(i);if(d){uo(d.threadId,d.usage);return}const g=ra(i);g&&rn(g.threadId,g.activity);const T=un(i),j=Hn(i);!j&&T&&Sn(T);const N=oa(i);N&&(Cn.set(N.turnId,N),nr(N.threadId,N.turnId,os(N.threadId)),je.value={...je.value,[N.threadId]:N.turnId},Xn(N.threadId,N.turnId),ln(N.threadId),Vt(N.threadId),Wt(N.threadId,null),kt(N.threadId,null),nn(N.threadId,!0),st(N.threadId),P.value[N.threadId]&&(P.value=St(P.value,N.threadId)));const H=Lo(i),J=Zo(i),le=(H==null?void 0:H.threadId)??un(i),we=le?an(le):"",Je=!!le&&!!J&&we!==_o&&Il(new Error(J));if(H){Ye.value[H.threadId];const lt=Cn.get(H.turnId);lt&&Cn.delete(H.turnId);const Mr=Ar((yi=Ue(i.params))==null?void 0:yi.durationMs)??Ar((qa=Ue((dl=Ue(i.params))==null?void 0:dl.turn))==null?void 0:qa.durationMs)??(typeof H.startedAtMs=="number"?H.completedAtMs-H.startedAtMs:null)??(lt?H.completedAtMs-lt.startedAtMs:null),ca=typeof Mr=="number"?Math.max(0,Mr):0;Wt(H.threadId,{turnId:H.turnId,durationMs:ca}),je.value[H.threadId]&&(je.value=St(je.value,H.threadId)),nn(H.threadId,!1),rn(H.threadId,null),ur(H.threadId),Je||(wr(H.threadId),st(H.threadId))}if(J){const lt=(H==null?void 0:H.threadId)||un(i);lt&&kt(lt,J),ue.value=J,lt&&Je&&co(lt)}else H&&kt(H.threadId,null);if(j){const lt=T,Mr=lt?an(lt):G.value.trim();lt&&kt(lt,j.message,{transient:j.transient}),ue.value=j.message,Mr!==_o&&Il(new Error(j.message))&&(lt?co(lt):Ft())}const _t=Fr(i);_t&&(M(_t.threadId,_t.message),rn(_t.threadId,{label:"Planning",details:((wi=_t.message.plan)==null?void 0:wi.steps.map(lt=>lt.step).slice(0,2))??[]}));const bt=Kr(i);if(bt&&(M(bt.threadId,bt.message),rn(bt.threadId,{label:"Planning",details:[]})),!T||T!==n.value)return;yn(i);const Ct=Vn(i);if(Ct){const lt=(a.value[T]??[]).find(ca=>ca.id===Ct.messageId),Mr=`${(lt==null?void 0:lt.text)??""}${Ct.delta}`;L(T,{id:Ct.messageId,role:"assistant",text:Mr,messageType:"agentMessage.live"})}const En=zn(i);En&&L(T,En);const cs=Rr(i);cs&&L(T,cs),On(i);const $s=Ir(i);if($s&&wt(T,$s.delta),aa(i)){const lt=s.value[T]??"";lt.trim().length>0&&!lt.endsWith(`
|
|
53
|
+
|
|
54
|
+
`)&&Ne(T,`${lt}
|
|
55
|
+
|
|
56
|
+
`)}sa(i);const ds=Ra(i);ds&&(Jr(T,ds),rn(T,{label:"Running command",details:[((hs=ds.commandExecution)==null?void 0:hs.command)??""]}));const fs=ia(i);if(fs){const lt=(u.value[T]??[]).find(Mr=>Mr.id===fs.itemId);lt!=null&<.commandExecution&&Jr(T,{...lt,commandExecution:{...lt.commandExecution,aggregatedOutput:`${lt.commandExecution.aggregatedOutput}${fs.delta}`}})}const js=la(i);js&&Jr(T,js);const cl=Yr(i);if(cl&&ee(T,cl),Ma(i)&&Gt(T),i.method==="turn/completed"){kn=!1,Gt(T),u.value[T]&&(u.value=St(u.value,T));const lt=un(i);lt&&(nn(lt,!1),rn(lt,null),ur(lt),Je||(wr(lt),st(lt)))}}function Qr(i){if(i.method==="thread/tokenUsage/updated")return;const d=i.method,g=d==="turn/started"||d==="turn/completed"||d==="error",T=d.startsWith("thread/")||d==="turn/completed";if(!g&&!T)return;const j=un(i);j&&g&&rt.add(j),T&&(De=!0),!(Ge!==null||typeof window>"u")&&(Ge=window.setTimeout(()=>{Ge=null,wo()},ac))}async function qt(i,d){if(!Sa){Sa=!0;try{if(!d)return;const g=[];for(const T of pu(d)){const j=xs(T);g.includes(j)||g.push(j)}if(g.length>0){const T=d.projectOrder.length>0?Us(g,i):Us(K.value,i);Ja(K.value,T)||(K.value=T)}if(Object.keys(d.labels).length>0||(d.remoteProjects??[]).length>0){const T={...be.value};let j=!1;for(const[N,H]of Object.entries(d.labels)){const J=ot(N).trim(),le=[xs(N)];J&&le.push(J);for(const we of le)T[we]!==H&&(T[we]=H,j=!0)}for(const N of d.order){const H=xs(N),J=no(ei(N));if(!J.startsWith(".")||J===H)continue;const le=`${H} ${J}`;T[H]!==void 0||T[H]===le||(T[H]=le,j=!0)}for(const N of d.remoteProjects??[]){const H=wP(N);T[N.id]!==H&&(T[N.id]=H,j=!0)}j&&(be.value=T)}}catch{}}}async function Hr(){if(!(Object.keys(pe.value).length>0))try{const i=await PT();Object.keys(i.titles).length>0&&(pe.value=i.titles)}catch{}}async function Xr(){try{return await Hs()}catch{return null}}async function is(i,d,g){if(pe.value[i])return;const T=d.trim();if(!T)return;const j=T.length>300?T.slice(0,300):T;try{const N=await NT(j,g);if(!N||pe.value[i])return;pe.value={...pe.value,[i]:N},Pt(),tc(i,N)}catch{}}function Es(i,d){const g=Oc(i,d),T=kP(i,d),j=CP(T,d,g);if(!d||d.order.length===0&&(d.remoteProjects??[]).length===0)return j;const N=new Set;for(const J of Lc(d,g))N.add(J);const H=j.filter(J=>N.has(J.projectName)?!0:Dc(J));return TP(H,d,g)}function Is(i,d){const g=Es(i,d),T=!!(d&&(d.order.length>0||d.projectOrder.length>0||(d.remoteProjects??[]).length>0)),j=d!=null&&d.projectOrder.length?Us(Lc(d,Oc(i,d)),g):Us(K.value,g);Ja(K.value,j)||(K.value=j,T||Pi(K.value));const N=lc(g,K.value);Or(new Set($r(N).map(J=>J.id)));const H=gP(t.value,N,m.value);t.value=Rl(t.value,H),m.value=mn(m.value,new Set($r(t.value).map(J=>J.id))),Pt()}function hi(i){const d={};for(const[g,T]of Object.entries(i)){const j=g.trim();!j||T.length===0||(d[j]=T.map(N=>({id:N.id,text:N.text,imageUrls:[...N.imageUrls],skills:N.skills.map(H=>({name:H.name,path:H.path})),fileAttachments:N.fileAttachments.map(H=>({label:H.label,path:H.path,fsPath:H.fsPath})),collaborationMode:N.collaborationMode})))}return d}function Zr(){dT(hi(f.value)).catch(()=>{})}async function pi(){if(!_){_=!0;try{f.value=await vh()}catch{}}}function vo(i){Dn=Bh(Dn,i),t.value=Bh(t.value,i),m.value=St(m.value,i),Pt()}function $a(i,d){if(i.length===0)return d;if(d.length===0)return i;const g=new Map;for(const j of $r(i))g.set(j.id,j);for(const j of $r(d))g.set(j.id,j);const T=new Map;for(const j of g.values()){const N=T.get(j.projectName);N?N.push(j):T.set(j.projectName,[j])}return Array.from(T.entries()).map(([j,N])=>({projectName:j,threads:N.sort((H,J)=>new Date(J.updatedAtIso).getTime()-new Date(H.updatedAtIso).getTime())})).sort((j,N)=>{var le,we;const H=new Date(((le=j.threads[0])==null?void 0:le.updatedAtIso)??0).getTime();return new Date(((we=N.threads[0])==null?void 0:we.updatedAtIso)??0).getTime()-H})}function go(){return Object.values(m.value).some(i=>i===!0)}function At(i=ao){if(!(!gt||Tt||go())){if(ao=i,typeof window>"u"){Ps(i);return}ft!==null&&window.clearTimeout(ft),ft=window.setTimeout(()=>{ft=null,!(!gt||go())&&Ps(ao)},LI)}}async function Ps(i){if(!(Tt||!gt||go())){Tt=!0;try{const d=await sh(gt,__());gt=d.nextCursor,Jt=d.nextCursor===null,V.value=Jt,Dn=$a(Dn,d.groups),Is(Dn,i)}catch{}finally{Tt=!1,gt&&!go()&&At(i)}}}async function Do(){if(W){await W;return}W=(async()=>{var i;he.value||(E.value=!0);try{const[d,g]=await Promise.all([sh(),Xr(),Hr()]);ao=g;const T=d.groups;Dn=he.value?$a(Dn,T):T,gt=he.value&&!Jt?gt:d.nextCursor,Jt=d.nextCursor===null,V.value=Jt,await qt(T,g),Is(Dn,g),he.value=!0,Jt||At(g);const j=$r(e.value);Tr(j),!j.some(H=>H.id===n.value)&&!n.value&&Qt(((i=j[0])==null?void 0:i.id)??"")}finally{E.value=!1}})().finally(()=>{W=null}),await W}async function rr(i,d={}){if(!i)return;const g=oe.get(i);if(g){await g;return}const T=ne.value[i]===!0,j=d.silent!==!0&&!T;j&&($.value=!0);const N=(async()=>{try{const H=yt(i),J=Ce.value[i]??"",le=Date.now()-(ut.get(i)??0)<FI;if(T&&(le||(H.length===0||J===H)&&m.value[i]!==!0)){kr(i);return}const _t=qe.value[i]!==!0?await Qu(i):null,bt=_t??await ih(i);_t&&(sn(i,_t.model),qe.value={...qe.value,[i]:!0});const{messages:Ct,inProgress:En,activeTurnId:cs,turnIndexByTurnId:$s}=bt;Ae.value={...Ae.value,[i]:bt.hasMoreOlder===!0},po(i,Ct),as(i,$s),Pa(i);const ul=r.value[i]??[],ds=Uh(ul,Ct,{preserveMissing:d.silent===!0});Bn(i,ds);const fs=a.value[i]??[];if(En){const js=sP(fs,Ct);Tn(i,js)}else Xo(i);ua(i,Ct),qr(i,Ct),ne.value={...ne.value,[i]:!0},ut.set(i,Date.now()),H&&(Ce.value={...Ce.value,[i]:H}),nn(i,En),cs?je.value={...je.value,[i]:cs}:je.value[i]&&(je.value=St(je.value,i)),En||hn(i),kr(i)}finally{j&&($.value=!1)}})().finally(()=>{oe.delete(i)});oe.set(i,N),await N}async function ja(i=n.value){if(!i||We.value[i]===!0||Ae.value[i]!==!0)return;const d=$o(i);if(!d){Ae.value={...Ae.value,[i]:!1};return}We.value={...We.value,[i]:!0};try{const g=await k_(i,d),T=r.value[i]??[],j=Uh(g.messages,T,{preserveMissing:!0});Bn(i,j),as(i,{...Be.value[i]??{},...g.turnIndexByTurnId}),Pa(i),Ae.value={...Ae.value,[i]:g.hasMoreOlder}}catch(g){throw ue.value=g instanceof Error?g.message:"Failed to load earlier messages",g}finally{We.value={...We.value,[i]:!1}}}async function ls(i,d={}){i&&ne.value[i]!==!0&&await rr(i,d)}async function Na(){if(ye){await ye;return}ye=(async()=>{var i,d;try{const g=((d=(i=wn.value)==null?void 0:i.cwd)==null?void 0:d.trim())??"";xe.value=await OT(g?[g]:void 0)}catch{}finally{ye=null}})(),await ye}async function yo(i={}){await Promise.allSettled([bn({providerChanged:i.providerChanged,includeProviderModels:i.includeProviderModels}),gn(),fo(),Na()])}function mi(i={}){const d=()=>{yo(i)};if(typeof window>"u"){d();return}window.setTimeout(d,0)}async function us(i={}){ue.value="";const d=i.includeSelectedThreadMessages!==!1,g=i.awaitAncillaryRefreshes===!0;try{await pi(),await Do(),d&&await rr(n.value),g?await yo({providerChanged:i.providerChanged,includeProviderModels:i.providerChanged===!0||g}):mi({providerChanged:i.providerChanged,includeProviderModels:!1})}catch(T){ue.value=T instanceof Error?T.message:"Unknown application error"}}async function La(i){Qt(i);try{await rr(i),Na()}catch(d){ue.value=d instanceof Error?d.message:"Unknown application error"}}async function Oa(i){const d=n.value===i,g=d?jI($r(e.value),i):"";d&&(Qt(g),g&&rr(g,{silent:!0}));try{await G_(i),vo(i),await Do(),d&&g&&n.value===g&&await ls(g,{silent:!0})}catch(T){ue.value=T instanceof Error?T.message:"Unknown application error"}}async function Fo(i,d){const g=d.trim();if(!(!i||!g))try{await K_(i,g),pe.value={...pe.value,[i]:g},Pt(),tc(i,g)}catch(T){ue.value=T instanceof Error?T.message:"Unknown application error"}}async function Da(i){var H,J;const d=i.trim();if(!d)return"";const g=$r(t.value).find(le=>le.id===d),T=((H=g==null?void 0:g.cwd)==null?void 0:H.trim())??"",j=((J=g==null?void 0:g.title)==null?void 0:J.trim())??"Forked chat",N=an(d);ue.value="";try{const le=await fh(d,T||void 0,N||void 0),we=le.threadId.trim();return we?(ir(we,T,j),sn(we,le.model),qe.value={...qe.value,[we]:!0},Qt(we),await Do(),await rr(we),we):""}catch(le){return ue.value=le instanceof Error?le.message:"Unknown application error",""}}async function Rs(i,d){var H;const g=i.trim();if(!g||!Number.isInteger(d)||d<0)return"";if(m.value[g]===!0)return ue.value="Finish the current turn before forking from a response.","";if(ne.value[g]!==!0)try{await rr(g)}catch(J){return ue.value=J instanceof Error?J.message:"Unknown application error",""}const T=r.value[g]??[];let j=-1;for(const J of T)typeof J.turnIndex=="number"&&Number.isFinite(J.turnIndex)&&(j=Math.max(j,J.turnIndex));if(j>=0&&d>j)return"";const N=$r(t.value).find(J=>J.id===g)??null;try{ue.value="";const J=await fh(g),le=J.threadId.trim();if(!le)return"";const we=J.cwd.trim()||((H=N==null?void 0:N.cwd)==null?void 0:H.trim())||"",Je=xP((N==null?void 0:N.title)||(N==null?void 0:N.preview)||"Untitled thread");ir(le,we,Je),sn(le,J.model),Bn(le,J.messages),ne.value={...ne.value,[le]:!0},qe.value={...qe.value,[le]:!0},ln(le),Tn(le,[]),Gt(le),u.value[le]&&(u.value=St(u.value,le)),Wt(le,null),rn(le,null),kt(le,null),nn(le,!1);const _t=j-d;if(_t>0){const bt=await Xu(le,_t);Bn(le,bt)}return await Fo(le,Je),Qt(le),Do().catch(()=>{}),le}catch(J){return ue.value=J instanceof Error?J.message:"Unknown application error",""}}async function v(i,d,g=[],T=[],j=[]){if(!i||!d.trim()||g.length>0||T.length>0||j.length>0)return!1;const H=(nt.value[i]??[]).filter(we=>we.method==="item/tool/requestUserInput");if(H.length!==1)return!1;const[J]=H,le=No(J);return le.length!==1?!1:ll({id:J.id,result:{answers:{[le[0]]:{answers:[d.trim()]}}}})}async function b(i,d=[],g=[],T="steer",j=[],N,H){if(ie.value)return;const J=n.value,le=i.trim();if(!J||!le&&d.length===0&&j.length===0||await v(J,le,d,g,j))return;const we=m.value[J]===!0;if(we&&T==="queue"){const Je=f.value[J]??[],_t=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,bt=[...Je],Ct=typeof N=="number"?Math.max(0,Math.min(N,bt.length)):bt.length;bt.splice(Ct,0,{id:_t,text:le,imageUrls:d,skills:g,fileAttachments:j,collaborationMode:H==="plan"?"plan":H==="default"?"default":U.value}),f.value={...f.value,[J]:bt},Zr();return}if(we){kn=!0,R(J,le,d,g,j,H).catch(Je=>{const _t=Je instanceof Error?Je.message:"Unknown application error";kt(J,_t),ue.value=_t});return}ue.value="",kn=!0,Wt(J,null),rn(J,{label:"Thinking",details:br(an(J),Y.value,H==="plan"?"plan":H==="default"?"default":U.value)}),kt(J,null),nn(J,!0);try{await R(J,le,d,g,j,H)}catch(Je){kn=!1,nn(J,!1),rn(J,null);const _t=Je instanceof Error?Je.message:"Unknown application error";throw kt(J,_t),ue.value=_t,Je}}async function y(i,d,g=[],T=[],j=[]){if(ie.value)return"";const N=i.trim(),H=d.trim(),J=an(Za).trim(),le=U.value;if(!N&&g.length===0&&j.length===0)return"";se.value=!0,ue.value="";let we="";try{try{const Ct=await dh(H||void 0,J||void 0);we=Ct.threadId,sn(we,Ct.model),dn(we,le)}catch(Ct){if(J&&J!==_o&&Il(Ct)){await Ft();const En=await dh(H||void 0,_o);we=En.threadId,sn(we,En.model),dn(we,le)}else throw Ct}if(!we)return"";ir(we,H,N||"[Image]"),Cr(we),qe.value={...qe.value,[we]:!0},Qt(we),kn=!0,Wt(we,null),rn(we,{label:"Thinking",details:br(an(we),Y.value,le)}),kt(we,null),nn(we,!0);const Je=we,_t=H||null,bt=N;return R(we,N,g,T,j,le).catch(Ct=>{kn=!1,nn(we,!1),rn(we,null);const En=Ct instanceof Error?Ct.message:"Unknown application error";kt(we,En),ue.value=En}).finally(()=>{se.value=!1}),is(Je,bt,_t),we}catch(Je){kn=!1,we&&(nn(we,!1),rn(we,null));const _t=Je instanceof Error?Je.message:"Unknown application error";throw we&&kt(we,_t),ue.value=_t,se.value=!1,Je}}async function R(i,d,g=[],T=[],j=[],N){const H=Y.value,J=N==="plan"?"plan":N==="default"?"default":U.value,le=d.trim(),we=[...g];if(we.length===0&&_e(le)){const bt=Oe(i);bt&&we.push(bt)}const Je=T.map(bt=>({name:bt.name,path:bt.path})),_t=j.map(bt=>({...bt}));$n(i,{text:le,imageUrls:[...we],skills:Je,fileAttachments:_t,effort:H,collaborationMode:J,fallbackRetried:!1});try{if(qe.value[i]!==!0){const En=await Qu(i);sn(i,En.model)}const bt=an(i);let Ct="";try{Ct=await Zu(i,d,we,bt||void 0,H||void 0,T.length>0?T:void 0,j,J)}catch(En){if(bt&&bt!==_o&&Il(En))await Ft(i),$n(i,{text:le,imageUrls:[...we],skills:Je,fileAttachments:_t,effort:H,collaborationMode:J,fallbackRetried:!0}),Ct=await Zu(i,d,we,_o,H||void 0,T.length>0?T:void 0,j,J);else throw En}Ct&&(je.value={...je.value,[i]:Ct},Xn(i,Ct)),qe.value={...qe.value,[i]:!0},rt.add(i),await wo(),Nr(i)}catch(bt){throw bt}}async function ve(i){if(w.value[i]!==!0){w.value={...w.value,[i]:!0};try{f.value=await vh()}catch{}finally{w.value=St(w.value,i)}}}function st(i){ve(i),!(typeof window>"u")&&window.setTimeout(()=>{ve(i)},650)}async function Mt(){const i=n.value;if(!i||m.value[i]!==!0||et.value[i]===!0)return;let d=je.value[i];if(!d){const{activeTurnId:g}=await ih(i);d=g,d&&(je.value={...je.value,[i]:d})}if(!d)throw new Error("Could not determine active turn id for interrupt");ce.value=!0,ue.value="";try{await eT(i,d),nn(i,!1),rn(i,null),kt(i,null),je.value[i]&&(je.value=St(je.value,i)),rt.add(i),De=!0,await wo()}catch(g){const T=g instanceof Error?g.message:"Failed to interrupt active turn";kt(i,T),ue.value=T}finally{ce.value=!1}}async function Wr(i){var J,le;const d=n.value;if(!d||me.value||!i.trim())return;const g=r.value[d]??[],T=g.find(we=>we.turnId===i),j=typeof(T==null?void 0:T.turnIndex)=="number"?T.turnIndex:-1;if(j<0)return;const N=g.reduce((we,Je)=>typeof Je.turnIndex=="number"&&Je.turnIndex>we?Je.turnIndex:we,-1);if(N<0||j>N)return;const H=N-j+1;if(!(H<1)){me.value=!0,ue.value="";try{const we=((le=(J=wn.value)==null?void 0:J.cwd)==null?void 0:le.trim())??"";we&&await Y_(d,i,we);const Je=await Xu(d,H);Bn(d,Je),Tn(d,[]),Gt(d),u.value[d]&&(u.value=St(u.value,d)),Wt(d,null),rn(d,null),kt(d,null),De=!0,await wo()}catch(we){ue.value=we instanceof Error?we.message:"Failed to rollback thread"}finally{me.value=!1}}}let Zt=null;async function pn(i,d){try{const g=await Hs(),T={...g.labels};let j=!1;for(const N of g.order){if(!Ol(N,i))continue;const H=d.trim();H.length===0?T[N]!==void 0&&(delete T[N],j=!0):T[N]!==H&&(T[N]=H,j=!0)}j&&await ec({order:g.order,labels:T,active:g.active,projectOrder:g.projectOrder})}catch{}}function Uo(i,d){i.length===0||(be.value[i]??"")===d||(be.value={...be.value,[i]:d},Fh(be.value),Zt!==null&&clearTimeout(Zt),Zt=setTimeout(()=>{Zt=null,pn(i,d)},500))}async function Bo(i){var N;if(i.length===0)return;const d=K.value.filter(H=>H!==i);if(Ja(K.value,d)||(K.value=d,Pi(K.value)),t.value=t.value.filter(H=>H.projectName!==i),be.value[i]!==void 0){const H={...be.value};delete H[i],be.value=H,Fh(H)}Pt();const g=$r(e.value);Tr(g),g.some(H=>H.id===n.value)||Qt(((N=g[0])==null?void 0:N.id)??"");const j=new Set;try{const H=await Hs();bP(H,i).forEach(J=>{j.add(J)})}catch{}if(j.size>0)try{const H=await Hs(),J=H.order.filter(Je=>!j.has(Je)),le=H.active.filter(Je=>!j.has(Je)),we=le.length===0&&J.length>0?[J[0]]:le;await ec({order:J,labels:hP(H.labels,j),active:we,projectOrder:H.projectOrder.filter(Je=>Je!==i&&!j.has(Je))});return}catch{}await Ms()}function Fa(i,d){if(i.length===0||t.value.length===0)return;const g=t.value.map(le=>le.projectName),T=g.indexOf(i);if(T===-1)return;const j=Math.max(0,Math.min(d,g.length-1)),N=tP(g,T,j);if(N===g)return;const H=Us(N,t.value);K.value=H,Pi(K.value);const J=lc(t.value,K.value);t.value=Rl(t.value,J),Pt(),Ms()}function al(i){const d=i.trim();if(!d)return;const g=[d,...K.value.filter(j=>j!==d)];if(Ja(K.value,g))return;K.value=g,Pi(K.value);const T=lc(t.value,K.value);t.value=Rl(t.value,T),Pt(),Ms()}async function Ms(){try{const i=await Hs(),d=_P(i,K.value,t.value);await ec({order:d.order,labels:i.labels,active:d.active,projectOrder:d.projectOrder})}catch{}}async function wo(){if(ge.value){typeof window<"u"&&Ge===null&&(Ge=window.setTimeout(()=>{Ge=null,wo()},ac));return}ge.value=!0;const i=De,d=new Set(rt);De=!1,rt.clear();try{i&&await Do();const g=n.value;if(!g)return;const T=d.has(g),j=m.value[g]===!0,N=yt(g),H=Ce.value[g]??"";(N.length>0&&N!==H||j&&ne.value[g]!==!0||T&&ne.value[g]!==!0||i&&ne.value[g]!==!0)&&await rr(g,{silent:!0})}catch{}finally{ge.value=!1,(De||rt.size>0)&&typeof window<"u"&&Ge===null&&(Ge=window.setTimeout(()=>{Ge=null,wo()},ac))}}async function sl(){await Ua(),De=!he.value,n.value&&ne.value[n.value]!==!0&&rt.add(n.value),await wo()}function il(){typeof window>"u"||$e||(Ua(),$e=j_(i=>{if(i.method==="ready"){Ut(),sl();return}Oo(i),Qr(i)}))}async function Ua(){try{const d=(await F_()).map(g=>er(g)).filter(g=>g!==null);Ia(d)}catch{}}async function ll(i){try{return await D_(i.id,{result:i.result,error:i.error}),Br(i.id),!0}catch(d){return ue.value=d instanceof Error?d.message:"Failed to reply to server request",!1}}function mu(){if($e&&($e(),$e=null),De=!1,rt.clear(),Cn.clear(),Ge!==null&&typeof window<"u"&&(window.clearTimeout(Ge),Ge=null),D!==null&&typeof window<"u"&&(window.clearTimeout(D),D=null),ft!==null&&typeof window<"u"&&(window.clearTimeout(ft),ft=null),typeof window<"u")for(const i of B.values())window.clearTimeout(i);B.clear(),kn=!1,r.value={},o.value={},a.value={},s.value={},u.value={},c.value={},Be.value={},Ie.value={},Ee.value={},Ze.value={},je.value={},et.value={},ze.value={},ct.value={},f.value={},w.value={},Zr(),vt.value=null,X.value={}}const vu=Z(()=>{const i=n.value;return i?f.value[i]??[]:[]});function vi(i){const d=n.value;if(!d)return;const g=f.value[d];if(!g)return;const T=g.filter(j=>j.id!==i);f.value=T.length>0?{...f.value,[d]:T}:St(f.value,d),Zr()}function gi(i,d){const g=n.value;if(!g)return;const T=f.value[g];if(!T)return;const j=T.findIndex(le=>le.id===i),N=T.findIndex(le=>le.id===d);if(j<0||N<0||j===N)return;const H=[...T],[J]=H.splice(j,1);H.splice(N,0,J),f.value={...f.value,[g]:H},Zr()}function Ba(i){const d=n.value;if(!d)return;const g=f.value[d];if(!g)return;const T=g.find(j=>j.id===i);T&&(vi(i),Gr(T.collaborationMode),b(T.text,T.imageUrls,T.skills,"steer",T.fileAttachments))}function gu(i){Qt(i)}return{projectGroups:e,projectDisplayNameById:be,selectedThread:wn,selectedThreadTokenUsage:xa,selectedThreadTerminalOpen:cn,isSelectedThreadInterruptPending:gr,selectedThreadServerRequests:io,selectedLiveOverlay:jr,codexQuota:yr,selectedThreadId:n,availableCollaborationModes:O,availableModelIds:q,selectedCollaborationMode:U,selectedModelId:G,selectedReasoningEffort:Y,selectedSpeedMode:Te,installedSkills:xe,accountRateLimitSnapshots:Ve,messages:Qo,hasMoreOlderMessages:Qn,isLoadingThreads:E,isThreadListFullyLoaded:V,isLoadingMessages:$,isLoadingOlderMessages:lo,isSendingMessage:se,isInterruptingTurn:ce,isUpdatingSpeedMode:ie,isRollingBack:me,error:ue,refreshAll:us,refreshSkills:Na,selectThread:La,loadMessages:rr,loadOlderMessages:ja,ensureThreadMessagesLoaded:ls,setThreadTerminalOpen:Bt,toggleSelectedThreadTerminal:Sr,archiveThreadById:Oa,renameThreadById:Fo,forkThreadById:Da,forkThreadFromTurn:Rs,rollbackSelectedThread:Wr,sendMessageToSelectedThread:b,sendMessageToNewThread:y,interruptSelectedThreadTurn:Mt,selectedThreadQueuedMessages:vu,removeQueuedMessage:vi,reorderQueuedMessage:gi,steerQueuedMessage:Ba,setSelectedCollaborationMode:Gr,readModelIdForThread:an,setSelectedModelIdForThread:Fn,setSelectedModelId:Ot,setSelectedReasoningEffort:jo,updateSelectedSpeedMode:jn,respondToPendingServerRequest:ll,renameProject:Uo,removeProject:Bo,reorderProject:Fa,pinProjectToTop:al,startPolling:il,stopPolling:mu,primeSelectedThread:gu}}const EP={class:"sidebar-root"},IP={class:"sidebar-scrollable"},PP=["aria-pressed","aria-label","title"],RP={key:1,class:"sidebar-search-bar"},MP=["placeholder"],$P=["aria-label"],jP={class:"sidebar-skills-link-icon","aria-hidden":"true"},NP={class:"sidebar-skills-link-copy"},LP={class:"sidebar-skills-link-title"},OP={class:"sidebar-skills-link-subtitle"},DP={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},FP={class:"sidebar-skills-link-copy"},UP={class:"sidebar-skills-link-title"},BP={class:"sidebar-skills-link-subtitle"},qP={class:"sidebar-settings-account-section"},HP={class:"sidebar-settings-account-header"},WP={class:"sidebar-settings-account-header-main"},VP=["aria-expanded","title"],zP={class:"sidebar-settings-account-collapse-icon"},GP={class:"sidebar-settings-account-title"},KP={class:"sidebar-settings-account-count"},YP=["disabled"],JP={key:0,class:"sidebar-settings-account-error"},QP={class:"sidebar-settings-account-login"},XP=["disabled"],ZP=["href"],eR={key:1,class:"sidebar-settings-account-empty"},tR={key:2,class:"sidebar-settings-account-list"},nR=["title","onMouseenter","onMouseleave"],rR={class:"sidebar-settings-account-main"},oR={class:"sidebar-settings-account-email"},aR={class:"sidebar-settings-account-meta"},sR={class:"sidebar-settings-account-quota"},iR={class:"sidebar-settings-account-id"},lR={class:"sidebar-settings-account-actions"},uR=["disabled","onClick"],cR=["disabled","onClick"],dR=["title"],fR={class:"sidebar-settings-label"},hR=["title"],pR={class:"sidebar-settings-label"},mR={class:"sidebar-settings-value"},vR=["title"],gR={class:"sidebar-settings-label"},yR={class:"sidebar-settings-value"},wR=["title"],bR={class:"sidebar-settings-label"},_R=["value"],TR=["value"],kR=["title"],CR={class:"sidebar-settings-label"},SR={class:"sidebar-settings-value"},xR=["title"],AR={class:"sidebar-settings-label"},ER=["title"],IR={class:"sidebar-settings-label"},PR=["title"],RR={class:"sidebar-settings-label"},MR=["value","disabled"],$R={key:0,class:"sidebar-settings-row sidebar-settings-error"},jR={key:1,class:"sidebar-settings-row sidebar-settings-row--input"},NR={class:"sidebar-settings-provider-info"},LR={class:"sidebar-settings-label"},OR={class:"sidebar-settings-provider-link",href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer"},DR={class:"sidebar-settings-key-group"},FR={class:"sidebar-settings-key-masked"},UR=["disabled","title"],BR=["placeholder"],qR=["disabled"],HR={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},WR={class:"sidebar-settings-label"},VR=["aria-label"],zR=["disabled"],GR=["disabled"],KR={key:2,class:"sidebar-settings-row sidebar-settings-row--input"},YR={class:"sidebar-settings-provider-info"},JR={class:"sidebar-settings-label"},QR={class:"sidebar-settings-provider-link",href:"https://opencode.ai/auth",target:"_blank",rel:"noopener noreferrer"},XR={class:"sidebar-settings-key-group"},ZR=["placeholder"],eM=["disabled"],tM={key:3,class:"sidebar-settings-row sidebar-settings-row--input"},nM={class:"sidebar-settings-label"},rM={class:"sidebar-settings-key-group"},oM=["placeholder"],aM={class:"sidebar-settings-label",style:{"margin-top":"4px"}},sM={class:"sidebar-settings-key-group"},iM=["placeholder"],lM=["disabled"],uM={class:"sidebar-settings-row sidebar-settings-row--select",style:{"margin-top":"4px",padding:"0"}},cM={class:"sidebar-settings-label"},dM=["aria-label"],fM=["title"],hM={class:"sidebar-settings-label"},pM={class:"sidebar-settings-label"},mM={class:"sidebar-settings-value"},vM={key:4,class:"sidebar-settings-telegram-panel"},gM={class:"sidebar-settings-field"},yM={class:"sidebar-settings-field-label"},wM={class:"sidebar-settings-field"},bM={class:"sidebar-settings-field-label"},_M={class:"sidebar-settings-field-help"},TM={key:0,class:"sidebar-settings-telegram-error"},kM={class:"sidebar-settings-telegram-actions"},CM=["disabled"],SM=["data-state","title"],xM={class:"sidebar-settings-label"},AM=["data-state"],EM={class:"sidebar-settings-context-meta"},IM={class:"sidebar-settings-rate-limits"},PM=["aria-label"],RM={class:"sidebar-settings-button-version"},MM={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},$M={key:1,class:"skills-route-header-icon","aria-hidden":"true"},jM={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},NM={class:"content-body"},LM={key:2,class:"content-grid content-grid-home"},OM={class:"new-thread-empty"},DM={class:"new-thread-hero"},FM=["title"],UM={class:"new-thread-folder-actions"},BM={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},qM={class:"new-thread-launch-card-copy"},HM={class:"new-thread-launch-card-topline"},WM={class:"new-thread-launch-card-badge","aria-hidden":"true"},VM={class:"new-thread-launch-card-eyebrow"},zM={class:"new-thread-launch-card-title"},GM={class:"new-thread-launch-card-text"},KM={class:"new-thread-launch-card-actions"},YM=["aria-label","onKeydown"],JM={class:"new-thread-open-folder-header"},QM={class:"new-thread-open-folder-title"},XM={class:"new-thread-open-folder-label"},ZM={class:"new-thread-open-folder-current"},e$=["placeholder","title","disabled","onKeydown"],t$=["disabled"],n$={class:"new-thread-open-folder-actions"},r$={class:"new-thread-open-folder-toggle"},o$=["aria-pressed","disabled"],a$={key:0,class:"new-thread-open-folder-create"},s$={class:"new-thread-open-folder-create-composer"},i$=["placeholder","onKeydown"],l$=["disabled"],u$={key:0,class:"new-thread-open-folder-error"},c$=["placeholder","onKeydown"],d$={key:1,class:"new-thread-open-folder-error-actions"},f$={class:"new-thread-open-folder-error"},h$=["disabled"],p$={key:2,class:"new-thread-open-folder-status"},m$={key:3,class:"new-thread-open-folder-status"},v$={key:4,class:"new-thread-open-folder-list"},g$=["title","disabled","onClick"],y$={class:"new-thread-open-folder-item-name"},w$=["disabled","onClick"],b$=["aria-label","onKeydown"],_$={class:"new-thread-open-folder-header"},T$={class:"new-thread-open-folder-title"},k$=["disabled"],C$=["aria-label"],S$=["aria-selected","disabled"],x$=["aria-selected","disabled"],A$={class:"new-thread-project-field"},E$={class:"new-thread-open-folder-label"},I$=["disabled","placeholder"],P$={key:0,class:"new-thread-project-field"},R$={class:"new-thread-open-folder-label"},M$=["disabled","placeholder","onKeydown"],$$={key:1,class:"new-thread-project-field"},j$={class:"new-thread-open-folder-label"},N$=["disabled","onKeydown"],L$={key:2,class:"new-thread-open-folder-error"},O$={class:"new-thread-project-modal-actions"},D$=["disabled"],F$=["disabled"],U$={key:3,class:"new-thread-branch-select"},B$={class:"new-thread-branch-select-label"},q$={class:"new-thread-branch-select-help"},H$={key:4,class:"new-thread-runtime-help"},W$={class:"worktree-init-status-title"},V$={class:"worktree-init-status-message"},z$={class:"composer-with-queue"},G$={key:3,class:"content-grid"},K$={class:"content-thread"},Y$={class:"composer-with-queue"},J$=["aria-label"],Q$={class:"codex-login-modal-header"},X$={class:"codex-login-modal-title"},Z$=["aria-label","disabled"],ej={class:"codex-login-modal-copy"},tj=["href"],nj=["placeholder","disabled"],rj={key:1,class:"codex-login-modal-error"},oj={class:"codex-login-modal-actions"},aj=["disabled"],sj=["disabled"],qh="codex-web-local.sidebar-collapsed.v1",Hh="codex-web-local.accounts-section-collapsed.v1",Wh="codex-web-local.terminal-quick-commands.v1",Vh="__toggle_terminal__",zh="codex-web-local.send-with-enter.v1",Gh="codex-web-local.in-progress-send-mode.v1",Kh="codex-web-local.dark-mode.v1",Yh="codex-web-local.dictation-click-to-toggle.v1",Jh="codex-web-local.dictation-auto-send.v1",Qh="codex-web-local.dictation-language.v1",Xh="codex-web-local.chat-width.v1",ij=400,lj=Jn({__name:"App",setup(e){var Bd,qd;const t=xi(()=>Ei(()=>import("./ThreadConversation-C162xIoq.js"),__vite__mapDeps([0,1]))),n=xi(()=>Ei(()=>import("./ThreadTerminalPanel-C78jNJ5m.js"),__vite__mapDeps([2,3]))),r=xi(()=>Ei(()=>import("./ReviewPane-Q-Tx07Q7.js"),__vite__mapDeps([4,5]))),o=xi(()=>Ei(()=>import("./DirectoryHub-e97BnXKM.js"),__vite__mapDeps([6,7]))),a=xi(()=>Ei(()=>import("./AutomationsPanel-DrI9_gvf.js"),__vite__mapDeps([8,9]))),{t:s,uiLanguage:u,uiLanguageOptions:c,setUiLanguage:m}=rs(),f="e5e9",w="0.1.87",_={sendWithEnter:s("When enabled, press Enter to send. When disabled, use Command+Enter to send."),inProgressSendMode:s("If a turn is still running, choose whether a new prompt should steer the current turn or be queued."),appearance:s("Switch between system theme, light mode, and dark mode."),chatWidth:s("Choose how wide the conversation column and composer can grow on desktop screens."),dictationClickToToggle:s("Use click-to-start and click-to-stop dictation instead of hold-to-talk."),dictationAutoSend:s("Automatically send transcribed dictation when recording stops."),dictationLanguage:s("Choose transcription language or keep auto-detect.")},P={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},q={en:"english",zh:"chinese",de:"german",es:"spanish",ru:"russian",ko:"korean",fr:"french",ja:"japanese",pt:"portuguese",tr:"turkish",pl:"polish",ca:"catalan",nl:"dutch",ar:"arabic",sv:"swedish",it:"italian",id:"indonesian",hi:"hindi",fi:"finnish",vi:"vietnamese",he:"hebrew",uk:"ukrainian",el:"greek",ms:"malay",cs:"czech",ro:"romanian",da:"danish",hu:"hungarian",ta:"tamil",no:"norwegian",th:"thai",ur:"urdu",hr:"croatian",bg:"bulgarian",lt:"lithuanian",la:"latin",mi:"maori",ml:"malayalam",cy:"welsh",sk:"slovak",te:"telugu",fa:"persian",lv:"latvian",bn:"bengali",sr:"serbian",az:"azerbaijani",sl:"slovenian",kn:"kannada",et:"estonian",mk:"macedonian",br:"breton",eu:"basque",is:"icelandic",hy:"armenian",ne:"nepali",mn:"mongolian",bs:"bosnian",kk:"kazakh",sq:"albanian",sw:"swahili",gl:"galician",mr:"marathi",pa:"punjabi",si:"sinhala",km:"khmer",sn:"shona",yo:"yoruba",so:"somali",af:"afrikaans",oc:"occitan",ka:"georgian",be:"belarusian",tg:"tajik",sd:"sindhi",gu:"gujarati",am:"amharic",yi:"yiddish",lo:"lao",uz:"uzbek",fo:"faroese",ht:"haitian creole",ps:"pashto",tk:"turkmen",nn:"nynorsk",mt:"maltese",sa:"sanskrit",lb:"luxembourgish",my:"myanmar",bo:"tibetan",tl:"tagalog",mg:"malagasy",as:"assamese",tt:"tatar",haw:"hawaiian",ln:"lingala",ha:"hausa",ba:"bashkir",jw:"javanese",su:"sundanese",yue:"cantonese"},{projectGroups:O,projectDisplayNameById:te,selectedThread:F,selectedThreadTokenUsage:U,selectedThreadTerminalOpen:G,selectedThreadServerRequests:Y,selectedLiveOverlay:Te,codexQuota:Me,selectedThreadId:ae,availableCollaborationModes:Se,availableModelIds:K,selectedCollaborationMode:be,selectedReasoningEffort:Ce,selectedSpeedMode:ne,installedSkills:Ae,accountRateLimitSnapshots:We,messages:qe,hasMoreOlderMessages:Be,isLoadingThreads:Ee,isThreadListFullyLoaded:Ie,isLoadingMessages:Ze,isLoadingOlderMessages:je,isSendingMessage:et,isInterruptingTurn:ze,isSelectedThreadInterruptPending:ct,isUpdatingSpeedMode:nt,refreshAll:Ye,refreshSkills:vt,selectThread:X,ensureThreadMessagesLoaded:ke,loadOlderMessages:pe,setThreadTerminalOpen:xe,toggleSelectedThreadTerminal:Ve,archiveThreadById:E,forkThreadById:$,renameThreadById:V,forkThreadFromTurn:se,sendMessageToSelectedThread:ce,sendMessageToNewThread:ie,interruptSelectedThreadTurn:me,selectedThreadQueuedMessages:ue,removeQueuedMessage:ge,reorderQueuedMessage:he,steerQueuedMessage:Fe,setSelectedCollaborationMode:_e,readModelIdForThread:Oe,setSelectedModelIdForThread:$e,setSelectedReasoningEffort:Ge,updateSelectedSpeedMode:D,respondToPendingServerRequest:B,renameProject:W,removeProject:oe,reorderProject:ye,pinProjectToTop:Pe,startPolling:De,stopPolling:rt,primeSelectedThread:ut,rollbackSelectedThread:gt}=AP(),ft=E0(),Tt=A0(),{isMobile:Jt}=id(),Dn=x(null),ao=x(null),Sa=x(null),kn=x(null),Cn=x(null),so=x(null),Mo=x(null),wn=x(!1),cn=x(!1),gr=x(!1),io=x(!0),jr=x([]),yr=x($v()),xa=x(""),Qo=x(null),Qn=x(!1),lo=x("");let $o=!1;const an=x(!1),pt=x(""),Qt=x("local"),Fn=x({}),Ot=new Map,sn=x(""),uo=x([]),Gr=x(!1),dn=x({order:[],labels:{},projectOrder:[]}),fn=x({phase:"idle",title:"",message:""}),Ft=x(Ag()),$n=x(""),wr=x(!1),co=x(null),jo=x(null),jn=x(null),fo=x(null),br=x(null);let bn=null,gn=null,_n=0,_r=0;const Nr=x("New Project (1)"),ho=x(""),Nn=x(!1),Lr=x(Ig()),Un=x(!1),Pt=x([]),ir=x(null),Tr=x(null),kr=x(null),Wt=x(null),nn=x(!1),Ln=x(!1),Cr=x(""),lr=x({}),Xn=x(""),Or=x(""),po=x(!1),ur=x(!1),rn=x(null),kt=x([]),Sn=x(!1),Ut=x(!1),yt=x(!1),Bt=x(!1),Sr=x(!1),Bn=x(""),Tn=x(""),Xo=x(null),Dr=x(""),xn=x(""),M=x(""),L=x(""),ee=x(Au(zh,!0)),Ne=x(pg()),wt=x(hg()),Gt=x(mg()),ln=x(Au(Yh,!1)),Vt=x(Au(Jh,!0)),hn=x(Sg()),xr=Z(()=>xg()),qn=x(!1),Fr=x(!1),Kr=x(!1),Ue=x(""),Re=x(!1),Ar=x(null),Rt=x(!1),Er=x(""),Zn=x("codex"),un=x(""),Zo=x(""),Hn=x("responses"),er=x("responses"),ea=x(""),Aa=x(!1),ta=x(""),na=x(""),Xt=x(""),Ea=x(!1),Ur=x(!1),No=x(""),Wn=x(""),Br=x(!1),Ia=x(!1),tr=x("create"),mo=x(""),ra=x(""),oa=x(""),Lo=x(""),An=x(!1),os=x(null),nr=x(!1),as=x(null),Pa=x(null),On=x(""),Ir=x(""),aa=x(""),sa=x([]),yn=x(""),Vn=x(!1),zn=x(!1),ss=x(!1),Pr=x(""),Rr=x({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),Ra=x(null),ia=x(!1),la=x(!1),Yr=x(typeof window<"u"?((Bd=window.visualViewport)==null?void 0:Bd.height)??window.innerHeight:0),Jr=x(typeof window<"u"?((qd=window.visualViewport)==null?void 0:qd.offsetTop)??0:0),ua=x(typeof window<"u"?window.innerHeight:0);let qr=null,Ma=!1,Oo=0;const Qr=Z(()=>{const l=ft.params.threadId;return typeof l=="string"?l:""}),qt=Z(()=>ft.name==="home"),Hr=Z(()=>ft.name==="skills"),Xr=Z(()=>ft.name==="automations"),is=Z(()=>{const l=ft.query.automationId;return typeof l=="string"?l:""}),Es=Z(()=>{var l;return Xr.value?s("Automations"):Hr.value?s("Skills"):qt.value?s("Start new thread"):((l=F.value)==null?void 0:l.title)??s("Choose a thread")}),Is=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",hi=Z(()=>{var p,C;return(((C=(p=F.value)==null?void 0:p.title)==null?void 0:C.trim())??"")||Is}),Zr=Z(()=>qe.value.filter(l=>{const p=Rg(l.messageType,l.role);return p==="worked"?!0:!(p==="turnActivity.live"||p==="turnError.live"||p==="agentReasoning.live")})),pi=Z(()=>Te.value),vo=Z(()=>qt.value?"__new-thread__":ae.value),$a=Z(()=>Oe(vo.value)),go=Z(()=>{const l=Y.value;return l.length>0?l[l.length-1]:null}),At=Z(()=>{var l,p;return qt.value?pt.value.trim():((p=(l=F.value)==null?void 0:l.cwd)==null?void 0:p.trim())??""}),Ps=Z(()=>io.value&&(qt.value&&At.value.length>0||ft.name==="thread"&&ae.value.length>0)),Do=Z(()=>ft.name==="thread"&&ae.value.length>0||qt.value&&pn.value),rr=Z(()=>qt.value?wn.value:G.value),ja=Z(()=>!Jt.value||Yr.value<=0||ua.value<=0?!1:ua.value-Yr.value>120),ls=Z(()=>ja.value||rr.value&&gr.value),Na=Z(()=>{var l,p;return((p=(l=F.value)==null?void 0:l.cwd)==null?void 0:p.trim())??pt.value.trim()}),yo=Z(()=>{var l;return!qt.value&&((l=F.value)==null?void 0:l.inProgress)===!0}),mi=Z(()=>!qt.value&&!Hr.value&&!Xr.value&&ae.value.trim().length>0),us=Z(()=>et.value||ze.value||yo.value||Y.value.length>0);function La(l){return Number.isFinite(l)?new Intl.NumberFormat("en-US",{notation:l>=1e3?"compact":"standard",maximumFractionDigits:l>=1e5?0:1}).format(Math.max(0,Math.trunc(l))):"0"}function Oa(l){if(!l)return s("Waiting for Codex thread/tokenUsage/updated events for this thread.");const p=[`${s("Current context usage")}: ${l.currentContextTokens.toLocaleString()} ${s("tokens")}`,`${s("Cumulative thread usage")}: ${l.total.totalTokens.toLocaleString()} ${s("tokens")}`];return typeof l.modelContextWindow=="number"?(p.unshift(`${s("Model context window")}: ${l.modelContextWindow.toLocaleString()} ${s("tokens")}`),p.push(`${s("Remaining context")}: ${(l.remainingContextTokens??0).toLocaleString()} ${s("tokens")}`)):p.push(s("Model context window is unavailable in the latest usage event.")),p.join(`
|
|
57
|
+
`)}function Fo(){qn.value&&(qn.value=!1,jT(!0))}function Da(){Fo(),Tt.push({name:"skills",query:{tab:"plugins"}})}const Rs=Z(()=>{var p;const l=(p=U.value)==null?void 0:p.remainingContextPercent;return l===null||typeof l!="number"?"pending":l<=10?"danger":l<=25?"warning":"ok"}),v=Z(()=>{const l=U.value;return l?typeof l.remainingContextTokens=="number"?`${La(l.remainingContextTokens)} ${s("left")}`:`${La(l.currentContextTokens)} ${s("used")}`:s("Awaiting data")}),b=Z(()=>{const l=U.value;return l?typeof l.modelContextWindow=="number"?`${La(l.currentContextTokens)} ${s("used")} / ${La(l.modelContextWindow)}`:s("Window size unavailable"):s("Updates after the next token usage event")}),y=Z(()=>Oa(U.value));function R(l,p){const C=ot(l).trim(),z=zr(C);return!C||!z?!1:p.some(re=>{const de=ot(re).trim();return de!==C&&zr(de)===z})}function ve(l,p=""){const C=ot(l).trim(),z=p.trim();if(z)return z;const re=zr(C),de=[...dn.value.order,...O.value.map(He=>{var en,Vr;return((Vr=(en=He.threads[0])==null?void 0:en.cwd)==null?void 0:Vr.trim())??""}).filter(Boolean)];return R(C,de)?C:re}function st(){const l=new Set(dn.value.order),p=dn.value.projectOrder.filter(C=>l.has(C));for(const C of dn.value.order)p.includes(C)||p.push(C);return p}function Mt(l){const p=ot(l).trim(),C=[...dn.value.order,...O.value.map(z=>{var re,de;return((de=(re=z.threads[0])==null?void 0:re.cwd)==null?void 0:de.trim())??""}).filter(Boolean)];return R(p,C)?p:zr(p)}function Wr(l){const p=ot(l).trim();if(!p)return"";const C=[...dn.value.order,...O.value.map(z=>{var re,de;return((de=(re=z.threads[0])==null?void 0:re.cwd)==null?void 0:de.trim())??""}).filter(Boolean)];for(const z of dn.value.order){const re=ot(z).trim();if(!re)continue;const de=zr(re),He=R(re,C)?re:de;if(re===p||He===p||de===p)return re}return""}const Zt=Z(()=>{var z,re;const l=[],p=new Set;for(const de of st()){const He=de.trim();!He||p.has(He)||(p.add(He),l.push({value:He,label:ve(He,dn.value.labels[He])}))}for(const de of O.value){const He=((re=(z=de.threads[0])==null?void 0:z.cwd)==null?void 0:re.trim())??"";!He||p.has(He)||Vl(He)||(p.add(He),l.push({value:He,label:ve(He,te.value[de.projectName])}))}const C=pt.value.trim();return C&&!p.has(C)&&l.unshift({value:C,label:ve(C)}),l}),pn=Z(()=>{const l=pt.value.trim();return l?Fn.value[l]===!0:!1}),Uo=Z(()=>{var p,C;const l={};for(const z of O.value){const re=bi(z.projectName,((C=(p=z.threads[0])==null?void 0:p.cwd)==null?void 0:C.trim())??"");l[z.projectName]=re?Fn.value[re]===!0:!1}return l}),Bo=Z(()=>{const l=sn.value.trim(),p=[...uo.value];return l&&!p.some(C=>C.value===l)&&p.unshift({value:l,label:l}),p}),Fa=Z(()=>{const l=sn.value.trim();if(!l)return"";const p=Bo.value.find(C=>C.value===l);return(p==null?void 0:p.label)??l}),al=Z(()=>Ir.value.trim()),Ms=Z(()=>{const l=No.value.trim();return!l||l==="."||l===".."?!1:!/[\\/]/u.test(l)}),wo=Z(()=>Ms.value&&al.value.trim().length>0&&!yn.value),sl=Z(()=>{const l=ra.value.trim();return!l||l==="."||l===".."?!1:!/[\\/]/u.test(l)}),il=Z(()=>mo.value.trim()?tr.value==="create"?sl.value:oa.value.trim().length>0:!1),Ua=Z(()=>{const l=ot(On.value).trim();return l||Ir.value.trim()}),ll=Z(()=>Br.value?"Creating…":"Create"),mu=Z(()=>An.value?tr.value==="clone"?s("Cloning…"):s("Creating…"):tr.value==="clone"?s("Clone repository"):s("Create project")),vu=Z(()=>{const l=Ir.value.trim(),p=aa.value.trim();return!!(l&&p&&l!==p)}),vi=Z(()=>{const l=[];vu.value&&l.push({key:`parent:${aa.value}`,name:"..",path:aa.value,kind:"parent"});for(const p of sa.value)l.push({key:`directory:${p.path}`,name:p.name,path:p.path,kind:"directory"});return l}),gi=Z(()=>{const l=Pr.value.trim().toLowerCase();return l?vi.value.filter(p=>p.kind==="parent"||p.name.toLowerCase().includes(l)):vi.value}),Ba=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,gu=Z(()=>s(P[Gt.value].label)),i=Z(()=>rr.value?s("Terminal"):s("Open terminal")),d=Z(()=>{const l=new Map(yr.value.map(C=>[C.value,C]));return[...jr.value.map((C,z)=>({label:C.label,value:C.value,usageCount:0,lastUsedAt:0,...l.get(C.value)??{},custom:!1,sourceIndex:z}))].sort(Mv)}),g=Z(()=>[{label:rr.value?s("Hide terminal"):s("Open terminal"),value:Vh},...d.value.map(l=>({label:l.label,value:l.value}))]),T=Z(()=>{const l=P[Gt.value],p=Math.max(0,ua.value-Yr.value-Jr.value);return{"--chat-column-max":l.columnMax,"--chat-card-max":l.cardMax,"--visual-viewport-height":Yr.value>0?`${Yr.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,Jr.value)}px`,"--virtual-keyboard-inset":`${p}px`}}),j=Z(()=>{if(!Rr.value.configured)return s("Not configured");const l=Rr.value.active?s("Online"):s("Configured (offline)"),p=Rr.value.allowAllUsers?s("allow all users"):`${Rr.value.allowedUsers} ${s("allowed user(s)")}`,C=`${Rr.value.mappedChats} ${s("chat(s)")}, ${Rr.value.mappedThreads} ${s("thread(s)")}, ${p}`,z=Rr.value.lastError?`, ${s("error")}: ${Rr.value.lastError}`:"";return`${l}, ${C}${z}`});Ca(()=>{var l,p;document.addEventListener("pointerdown",kd),window.addEventListener("keydown",gd),document.addEventListener("visibilitychange",Cd),window.addEventListener("pageshow",Sd),window.addEventListener("focus",xd),window.addEventListener("resize",N),(l=window.visualViewport)==null||l.addEventListener("resize",N),(p=window.visualViewport)==null||p.addEventListener("scroll",N),N(),yl(),Ba==null||Ba.addEventListener("change",yl),Mg(),og(),we(),ps(),qo(),le(),J(),Iu(),Ov(),yd()}),ou(()=>{var l,p;document.removeEventListener("pointerdown",kd),window.removeEventListener("keydown",gd),document.removeEventListener("visibilitychange",Cd),window.removeEventListener("pageshow",Sd),window.removeEventListener("focus",xd),window.removeEventListener("resize",N),(l=window.visualViewport)==null||l.removeEventListener("resize",N),(p=window.visualViewport)==null||p.removeEventListener("scroll",N),Ba==null||Ba.removeEventListener("change",yl),qr!==null&&(window.clearInterval(qr),qr=null),bn&&(clearTimeout(bn),bn=null),pl(),rt()});function N(){var l,p;typeof window>"u"||(ua.value=Math.max(ua.value,window.innerHeight),Yr.value=((l=window.visualViewport)==null?void 0:l.height)??window.innerHeight,Jr.value=((p=window.visualViewport)==null?void 0:p.offsetTop)??0)}ht($n,l=>{const p=l.trim();if(bn&&(clearTimeout(bn),bn=null),!p){br.value=null;return}bn=setTimeout(()=>{xT(p,1e3).then(C=>{$n.value.trim()===p&&(br.value=C.threadIds)}).catch(()=>{$n.value.trim()===p&&(br.value=null)})},220)}),ht(ja,l=>{l||(gr.value=!1)}),ht(kt,()=>{if(typeof window>"u")return;if(!kt.value.some(p=>p.quotaStatus==="loading")){qr!==null&&(window.clearInterval(qr),qr=null);return}qr===null&&(qr=window.setInterval(()=>{Ma||(Ma=!0,fl({silent:!0}).finally(()=>{Ma=!1}))},1500))},{deep:!0});function H(){vt()}async function J(){try{Rr.value=await IT()}catch(l){const p=l instanceof Error?l.message:"Failed to load Telegram status";Rr.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:p}}}async function le(){try{const l=await ET();ta.value=l.botToken,na.value=l.allowedUserIds.map(p=>String(p)).join(`
|
|
58
|
+
`),Xt.value=""}catch(l){Xt.value=l instanceof Error?l.message:"Failed to load Telegram configuration"}}async function we(){const l=await $T();qn.value=l.dismissed!==!0}function Je(l){const p=l.split(/[\n,]/).map(re=>re.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),C=p.includes("*"),z=Array.from(new Set(p.filter(re=>/^-?\d+$/.test(re)).map(re=>Number.parseInt(re,10))));return C?["*",...z]:z}async function _t(){const l=ta.value.trim(),p=Je(na.value);if(!l){Xt.value=s("Telegram bot token is required.");return}if(p.length===0){Xt.value=s("At least one allowed Telegram user ID or * is required.");return}Ea.value=!0,Xt.value="";try{await AT(l,p),na.value=p.map(C=>String(C)).join(`
|
|
59
|
+
`),await Promise.all([le(),J()]),window.alert(s("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(C){Xt.value=C instanceof Error?C.message:s("Failed to connect Telegram bot"),J()}finally{Ea.value=!1}}function bt(){wr.value=!wr.value,wr.value?Ht(()=>{var l;return(l=co.value)==null?void 0:l.focus()}):$n.value=""}function Ct(){var l;$n.value="",(l=co.value)==null||l.focus()}function En(l){l.key==="Escape"&&(wr.value=!1,$n.value="")}function cs(l){l&&(ft.name==="thread"&&Qr.value===l||(Tt.push({name:"thread",params:{threadId:l}}),Jt.value&&cr(!0)))}function $s(l){ft.name==="automations"&&is.value!==l&&Tt.replace({name:"automations",query:l?{automationId:l}:{}})}async function ul(l){var p;Ft.value&&(cr(!1),await Ht()),(p=Dn.value)==null||p.openAutomationEditorFromPanel(l)}async function ds(){var l;Ft.value&&(cr(!1),await Ht()),(l=Dn.value)==null||l.openAutomationCreatorFromPanel()}function fs(){var l;ft.name==="automations"&&((l=ao.value)==null||l.loadAutomations())}async function js(l){l&&(ae.value!==l&&(await X(l),await Tt.push({name:"thread",params:{threadId:l}})),await Ht(),ug())}function cl(l){return l.length>8?l.slice(-8):l}function yi(l){const p=[l.planType||s("unknown")];return l.authMode&&p.unshift(l.authMode),p.join(" · ")}function dl(l){if(!l)return!1;const p=l.toLowerCase();return p.includes("payment required")||/\b402\b/.test(p)}function qa(l){return l.unavailableReason==="payment_required"||dl(l.quotaError)}function wi(l){return Sn.value||Ut.value||yt.value||Bt.value||Dr.value.length>0||l.isActive&&Dr.value!==l.accountId&&us.value}function hs(l){return xn.value===l.accountId}function lt(l){return M.value===l.accountId||hs(l)}function Mr(l){return qa(l)?s("Unavailable"):l.isActive?s("Active"):Ut.value?s("Switching…"):s("Switch")}function ca(l){return Dr.value===l.accountId?s("Removing…"):hs(l)?s("Click again to remove"):s("Remove")}function nv(l){M.value=l}function rv(l){M.value===l&&(M.value=""),Dr.value!==l&&xn.value===l&&(xn.value="")}function ov(l){const p=l.quotaSnapshot;if(!p)return null;const C=[p==null?void 0:p.primary,p==null?void 0:p.secondary].filter(de=>de!==null),z=C.find(de=>de.windowMinutes===10080);if(z)return z;const re=C.filter(de=>typeof de.windowMinutes=="number"&&de.windowMinutes>=10080).sort((de,He)=>(de.windowMinutes??0)-(He.windowMinutes??0))[0]??null;return re||(p.secondary??null)}function av(l){if(typeof l!="number"||!Number.isFinite(l))return"";const p=new Date(l*1e3);return`${p.getMonth()+1}月${p.getDate()}日`}function hd(l){var de,He;if(qa(l))return l.quotaError||s("402 Payment Required");const p=l.quotaSnapshot,C=ov(l),z=(p==null?void 0:p.primary)??(p==null?void 0:p.secondary)??null,re=C??z;if(re){const en=Math.max(0,Math.min(100,100-Math.round(re.usedPercent))),Vr=av(re.resetsAt);return Vr?`${en}% ${s("weekly remaining")} · ${Vr}`:`${en}% ${s("weekly remaining")}`}return(de=p==null?void 0:p.credits)!=null&&de.unlimited?s("Unlimited credits"):(He=p==null?void 0:p.credits)!=null&&He.hasCredits&&p.credits.balance?`${p.credits.balance} ${s("credits")}`:l.quotaStatus==="loading"?s("Loading quota…"):l.quotaStatus==="error"?l.quotaError||s("Quota unavailable"):l.quotaStatus==="ready"||l.quotaStatus==="idle"?s("Quota unavailable"):s("Fetching account details…")}function sv(l){return[l.email||s("Account"),yi(l),qa(l)?s("Unavailable account"):null,hd(l),`${s("Workspace")} ${l.accountId}`].filter(Boolean).join(`
|
|
60
|
+
`)}async function fl(l={}){try{const p=await B_();kt.value=p.accounts,p.accounts.some(C=>C.accountId===M.value)||(M.value=""),p.accounts.some(C=>C.accountId===xn.value)||(xn.value="")}catch(p){if(l.silent===!0)return;L.value=p instanceof Error?p.message:s("Failed to load accounts")}}async function iv(){if(!(Sn.value||Ut.value||yt.value||Bt.value)){L.value="",M.value="",xn.value="",Sn.value=!0;try{const l=await q_();kt.value=l.accounts,rt(),De(),Ye({includeSelectedThreadMessages:!0})}catch(l){L.value=l instanceof Error?l.message:s("Failed to refresh accounts")}finally{Sn.value=!1}}}async function lv(){var l;if(!(Sn.value||Ut.value||yt.value||Bt.value)){L.value="",Tn.value="",yt.value=!0;try{const p=await H_();Bn.value=p,Sr.value=!0,window.open(p,"_blank","noopener,noreferrer"),await Ht(),(l=Xo.value)==null||l.focus()}catch(p){L.value=p instanceof Error?p.message:s("Failed to start Codex login")}finally{yt.value=!1}}}function yu(){Bt.value||(Sr.value=!1,Tn.value="")}async function uv(){const l=Tn.value.trim();l&&await cv(l)}async function cv(l){if(!(Bt.value||l.length===0)){L.value="",Bt.value=!0;try{const p=await W_(l);kt.value=p.accounts,Bn.value="",Tn.value="",Sr.value=!1,rt(),De(),Ye({includeSelectedThreadMessages:!0})}catch(p){L.value=p instanceof Error?p.message:s("Failed to complete Codex login")}finally{Bt.value=!1}}}async function dv(l){if(!(Ut.value||Sn.value||yt.value||Bt.value)){if(us.value){L.value=s("Finish the current turn and pending requests before switching accounts.");return}L.value="",M.value="",xn.value="",Ut.value=!0;try{const p=await V_(l);kt.value=kt.value.map(C=>C.accountId===l?p:{...C,isActive:!1}),rt(),De(),Ye({includeSelectedThreadMessages:!0}),fl({silent:!0})}catch(p){L.value=p instanceof Error?p.message:s("Failed to switch account")}finally{Ut.value=!1}}}async function fv(l){if(Sn.value||Ut.value||yt.value||Bt.value||Dr.value.length>0)return;const p=kt.value.find(z=>z.accountId===l)??null;if(!p)return;if(xn.value!==l){xn.value=l;return}if(p.isActive&&us.value){L.value=s("Finish the current turn and pending requests before removing the active account.");return}const C=p.isActive;L.value="",xn.value="",Dr.value=l;try{const z=await z_(l);kt.value=z.accounts,rt(),De(),C&&Ye({includeSelectedThreadMessages:!0}),fl({silent:!0})}catch(z){L.value=z instanceof Error?z.message:s("Failed to remove account")}finally{Dr.value=""}}function hv(l){E(l)}async function pv(l){const p=await $(l);p&&(qt.value?await Tt.replace({name:"thread",params:{threadId:p}}):await Tt.push({name:"thread",params:{threadId:p}}),Jt.value&&cr(!0))}function pd(l){const p=l.trim().replace(/\\/gu,"/");return p?p.includes("/.codex/worktrees/")||p.includes("/.git/worktrees/"):!1}function bi(l,p=""){var de,He,en;const C=O.value.find(Vr=>Vr.projectName===l);if(!C)return Wr(l)||p.trim();const z=C.threads.find(Vr=>!pd(Vr.cwd));return(((de=z==null?void 0:z.cwd)==null?void 0:de.trim())??((en=(He=C.threads[0])==null?void 0:He.cwd)==null?void 0:en.trim())??"")||Wr(l)||p.trim()}function mv(l){var z,re;const p=O.value.find(de=>de.projectName===l),C=bi(l,((re=(z=p==null?void 0:p.threads[0])==null?void 0:z.cwd)==null?void 0:re.trim())??"");C&&(pt.value=C),Jt.value&&cr(!0),!qt.value&&Tt.push({name:"home"})}function vv(l){var C;let p="";for(const z of O.value){const re=z.threads.find(de=>de.id===l);if((C=re==null?void 0:re.cwd)!=null&&C.trim()){p=re.cwd.trim();break}}!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}function wu(l){var C,z;const p=O.value.find(re=>re.projectName===l);return bi(l,((z=(C=p==null?void 0:p.threads[0])==null?void 0:C.cwd)==null?void 0:z.trim())??"")}const md=Z(()=>Object.fromEntries(O.value.map(l=>[l.projectName,wu(l.projectName).trim()]).filter(([,l])=>l.length>0)));function gv(l){return(te.value[l]??l).trim()||l}function yv(l){return gv(l).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function wv(l){const p=wu(l);!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}async function bv(l){const p=wu(l);if(!p||typeof window>"u"||(await hl(p),Fn.value[p]!==!0))return;const C=`${yv(l)}-`,z=window.prompt("New worktree folder name",C);if(z===null)return;const re=z.trim();if(re){if(re.includes("/")||re.includes("\\")||re==="."||re===".."){window.alert("Worktree name must be a single folder name.");return}try{const de=await hT(p,re),He=await Sl(de.cwd,{createIfMissing:!1,label:""});if(!He)return;pt.value=He,Qt.value="local",Pe(Mt(He)),await ps(),await qo(),Jt.value&&cr(!0),qt.value||await Tt.push({name:"home"})}catch(de){const He=de instanceof Error?de.message:"Failed to create worktree.";window.alert(He)}}}function bu(){pt.value="",Qt.value="local",Jt.value&&cr(!0),!qt.value&&Tt.push({name:"home"})}async function hl(l){const p=l.trim();if(!p||Object.prototype.hasOwnProperty.call(Fn.value,p))return;const C=Ot.get(p);if(C){const de=await C;Object.prototype.hasOwnProperty.call(Fn.value,p)||(Fn.value={...Fn.value,[p]:de});return}const z=vT(p).then(de=>de.isGitRepo).catch(()=>!1).finally(()=>{Ot.delete(p)});Ot.set(p,z);const re=await z;Object.prototype.hasOwnProperty.call(Fn.value,p)||(Fn.value={...Fn.value,[p]:re})}function _v(l){W(l.projectName,l.displayName)}function Tv(l){V(l.threadId,l.title)}async function kv(l){await oe(l),await ps(),qo()}function Cv(l){ye(l.projectName,l.toIndex)}function Sv(l){var z,re;const p=O.value.find(de=>de.projectName===l),C=bi(l,((re=(z=p==null?void 0:p.threads[0])==null?void 0:z.cwd)==null?void 0:re.trim())??"");hl(C)}function vd(l){xv(l)}async function xv(l){var z;const p=await B(l),C=((z=l.followUpMessageText)==null?void 0:z.trim())??"";if(!(!p||!C||qt.value))try{await ce(C,[],[],"steer",[])}catch{}}async function Av(l){const p=await se(l.threadId,l.turnIndex);p&&(await Tt.push({name:"thread",params:{threadId:p}}),ae.value!==p&&await X(p),Jt.value&&cr(!0))}function cr(l){Ft.value!==l&&(Ft.value=l,Eg(l))}function gd(l){if(l.defaultPrevented)return;if(l.key==="Escape"&&Nn.value){Nn.value=!1;return}if(!l.ctrlKey&&!l.metaKey||l.shiftKey||l.altKey)return;const p=l.key.toLowerCase();if(p==="b"){l.preventDefault(),cr(!Ft.value);return}if(p==="j"&&ft.name==="thread"&&ae.value){l.preventDefault(),_u();return}p==="j"&&qt.value&&At.value&&(l.preventDefault(),_u())}function _u(){if(io.value){if(qt.value){if(!At.value)return;wn.value=!wn.value,wn.value||_i();return}Ve(),G.value||_i()}}function Ev(l){if(xa.value="",!!l){if(l===Vh){_u();return}Iv(l)}}async function Iv(l){if(!io.value||!At.value)return;if(qt.value)wn.value=!0;else if(ae.value)xe(ae.value,!0);else return;const p=await Pv();if(p)try{await p.runQuickCommand(l),Rv(l)}catch{}}async function Pv(){for(let l=0;l<20;l+=1){await Ht();const p=qt.value?so.value:Mo.value;if(p)return p;await new Promise(C=>window.setTimeout(C,25))}return null}async function yd(){const l=At.value.trim();if(!l){jr.value=[];return}try{jr.value=await O_(l)}catch{jr.value=[]}}function Rv(l){const p=wd(l);if(!p)return;const C=yr.value.find(en=>en.value===p),z=jr.value.findIndex(en=>en.value===p),re=z>=0?jr.value[z]:null;if(!re)return;const de={label:(C==null?void 0:C.label)||(re==null?void 0:re.label)||p,value:p,custom:!1,usageCount:((C==null?void 0:C.usageCount)??0)+1,lastUsedAt:Date.now(),sourceIndex:z>=0?z:void 0},He=[...yr.value.filter(en=>en.value!==p),de];yr.value=He,jv(He)}function wd(l){return l.trim().replace(/\s+/g," ")}function Mv(l,p){if(p.usageCount!==l.usageCount)return p.usageCount-l.usageCount;if(p.lastUsedAt!==l.lastUsedAt)return p.lastUsedAt-l.lastUsedAt;const C=typeof l.sourceIndex=="number"?l.sourceIndex:Number.MAX_SAFE_INTEGER,z=typeof p.sourceIndex=="number"?p.sourceIndex:Number.MAX_SAFE_INTEGER;return C-z}function $v(){if(typeof window>"u")return[];try{const l=window.localStorage.getItem(Wh);if(!l)return[];const p=JSON.parse(l);if(!Array.isArray(p))return[];const C=new Set,z=[];for(const re of p){const de=re!==null&&typeof re=="object"&&!Array.isArray(re)?re:null,He=wd(bd(de==null?void 0:de.value));!He||C.has(He)||(C.add(He),z.push({label:bd(de==null?void 0:de.label)||He,value:He,custom:(de==null?void 0:de.custom)!==!1,usageCount:_d(de==null?void 0:de.usageCount),lastUsedAt:_d(de==null?void 0:de.lastUsedAt)}))}return z}catch{return[]}}function jv(l){typeof window>"u"||window.localStorage.setItem(Wh,JSON.stringify(l.map(p=>({label:p.label,value:p.value,custom:p.custom===!0,usageCount:p.usageCount,lastUsedAt:p.lastUsedAt}))))}function bd(l){return typeof l=="string"?l:""}function _d(l){if(typeof l=="number"&&Number.isFinite(l))return Math.max(0,Math.trunc(l));if(typeof l=="string"){const p=Number(l);if(Number.isFinite(p))return Math.max(0,Math.trunc(p))}return 0}function Td(l){if(cn.value=l,!l){gr.value=!1,pl();return}gr.value=!0,pl(),gn=setTimeout(()=>{gn=null,ja.value||(gr.value=!1)},1500)}function Nv(){wn.value=!1,_i()}function Lv(){ae.value&&xe(ae.value,!1),_i()}function _i(){cn.value=!1,gr.value=!1,pl()}function pl(){gn&&(clearTimeout(gn),gn=null)}async function Ov(){try{const l=await L_();io.value=l.available,l.available||(wn.value=!1,ae.value&&xe(ae.value,!1))}catch{io.value=!1,wn.value=!1}}function kd(l){var C,z;const p=l.target;if(p instanceof Node){if(cn.value){const re=p instanceof Element?p:p.parentElement;re!=null&&re.closest(".thread-terminal-panel")||_i()}Nn.value&&((C=jn.value)!=null&&C.contains(p)||(z=fo.value)!=null&&z.contains(p)||(Nn.value=!1))}}function Dv(l){var C,z;if(!Nn.value)return;const p=l.target;p instanceof Node&&((C=jn.value)!=null&&C.contains(p)||(z=fo.value)!=null&&z.contains(p)||(Nn.value=!1))}function Cd(){if(!(typeof document>"u")&&Jt.value){if(document.visibilityState==="hidden"){Ra.value=Date.now(),ia.value=!1;return}Tu()}}function Sd(l){l.persisted&&Tu()}function xd(){ft.name==="home"&&(ps(),qo()),Tu()}function Tu(){typeof window>"u"||typeof document>"u"||!Jt.value||document.visibilityState!=="visible"||ia.value||Ra.value===null||Date.now()-Ra.value<ij||(ia.value=!0,Ra.value=null,Fv())}async function Fv(){if(!la.value){la.value=!0;try{await Ye({includeSelectedThreadMessages:!0,awaitAncillaryRefreshes:!0}),await Ru()}finally{la.value=!1}}}function Ad(l){const p=l.text;ml();const C=Qo.value,z=l.mode==="queue"&&C&&C.threadId===ae.value?C.queueIndex:void 0;if(Qo.value=null,qt.value){jg(p,l.imageUrls,l.skills,l.fileAttachments);return}ce(p,l.imageUrls,l.skills,l.mode,l.fileAttachments,z)}function Uv(l){const p=ue.value.findIndex(de=>de.id===l),C=p>=0?ue.value[p]:void 0,z=kn.value;if(!C||!z||z.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;Qo.value=ae.value?{threadId:ae.value,queueIndex:p}:null;const re={text:C.text,imageUrls:[...C.imageUrls],fileAttachments:C.fileAttachments.map(de=>({...de})),skills:C.skills.map(de=>({...de}))};z.hydrateDraft(re),ge(l)}function ml(){if(!Jt.value||qt.value)return;const l=()=>{var p;(p=Cn.value)==null||p.jumpToLatest()};l(),Ht(()=>{l(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{l(),window.requestAnimationFrame(l)})})}function Bv(l){pt.value=l.trim(),Wn.value=""}function qv(l){sn.value=l.trim()}function vl(l){const p=At.value.trim();return!l||p!==l?!1:ft.name==="thread"||ft.name==="home"&&pn.value}function Ed(){_n+=1,_r+=1,Pt.value=[],ir.value=null,Tr.value=null,kr.value=null,Wt.value=null,nn.value=!1,Ln.value=!1,lr.value={},Xn.value="",Or.value="",Cr.value="",po.value=!1}async function Ti(l){const p=l.trim();if(!p){Ed();return}const C=++_n;po.value=!0,Cr.value="";try{const z=await mT(p);if(C!==_n||!vl(p))return;Pt.value=z.options,ir.value=z.currentBranch,Tr.value=z.headSha,kr.value=z.headSubject,Wt.value=z.headDate,nn.value=z.detached,Ln.value=z.dirty}catch{if(C!==_n||!vl(p))return;Pt.value=[],ir.value=null,Tr.value=null,kr.value=null,Wt.value=null,nn.value=!1,Ln.value=!1}finally{C===_n&&(po.value=!1)}}function Hv(l){ir.value=l.currentBranch,Tr.value=l.headSha,kr.value=l.headSubject,Wt.value=l.headDate,nn.value=l.detached,Ln.value=l.dirty}function Wv(l){if(ur.value)return;const p=l.trim();if(!p||p===(ir.value??""))return;const C=At.value.trim();C&&(ur.value=!0,Cr.value="",gT(C,p).then(z=>(ir.value=z||p,Tr.value=null,kr.value=null,Wt.value=null,nn.value=!1,Un.value=!1,Ti(C))).catch(z=>{const re=z instanceof Error?z.message:"Failed to switch branch";Ti(C).finally(()=>{Cr.value=re})}).finally(()=>{ur.value=!1}))}function Vv(l){if(ur.value)return;const p=l.branch.trim(),C=l.sha.trim(),z=At.value.trim();!p||!C||!z||(ur.value=!0,Cr.value="",wT(z,p,C).then(re=>(Hv(re),Un.value=!1,Ti(z))).catch(re=>{const de=re instanceof Error?re.message:"Failed to reset branch to commit";Ti(z).finally(()=>{Cr.value=de})}).finally(()=>{ur.value=!1}))}function zv(l){const p=l.trim(),C=At.value.trim();if(!p||!C||Xn.value===p||lr.value[p])return;const z=++_r;Xn.value=p,Or.value="",yT(C,p).then(re=>{z!==_r||!vl(C)||(lr.value={...lr.value,[p]:re})}).catch(re=>{z!==_r||!vl(C)||(Or.value=re instanceof Error?re.message:"Failed to load branch commits")}).finally(()=>{z===_r&&Xn.value===p&&(Xn.value="")})}async function Gv(){const l=await Su();l&&(await qo(),mo.value=l,ra.value=Nr.value.trim()||"New Project (1)",oa.value="",Lo.value="",tr.value="create",Ia.value=!0,Ht(()=>{var p;return(p=os.value)==null?void 0:p.focus()}))}function gl(){An.value||(Ia.value=!1,Lo.value="")}async function Kv(){const l=mo.value.trim(),p=ra.value.trim();if(!sl.value)throw new Error("Enter a single project folder name.");const C=Md(Rd(l,p));return C?Sl(C,{createIfMissing:!0,label:""}):""}async function Yv(){const l=mo.value.trim(),p=oa.value.trim();return p?TT(p,l):""}async function ku(){if(!(!il.value||An.value)){Lo.value="",An.value=!0;try{const l=tr.value==="clone"?await Yv():await Kv();if(!l)return;pt.value=l,Pe(Mt(l)),await ps(),await qo(),Ia.value=!1}catch(l){Lo.value=l instanceof Error?l.message:"Failed to create or clone project."}finally{An.value=!1}}}async function Jv(){const l=pt.value.trim()||await Su();l&&(Ur.value=!1,nr.value=!0,Pr.value="",await Ha(l),yn.value||Ht(()=>{var p;return(p=as.value)==null?void 0:p.focus()}))}function Ns(){Oo+=1,nr.value=!1,Vn.value=!1,yn.value="",Pr.value="",On.value="",ki()}async function Qv(l){!l||Vn.value||(Pr.value="",await Ha(l))}function Xv(){const l=Ir.value.trim();!nr.value||!l||Ha(l)}function Zv(){const l=Ua.value;!nr.value||!l||Vn.value||Ha(l)}function eg(){if(!nr.value||Vn.value||zn.value)return;const l=Ua.value,p=Ir.value.trim();!l||l===p||Ha(l)}function tg(){const l=Ua.value,p=Ir.value.trim();if(l){if(l!==p){Ha(l);return}Cu(l)}}async function Cu(l=Ua.value){const p=ot(l).trim();if(p){yn.value="",zn.value=!0;try{const C=await Sl(p,{createIfMissing:!1,label:""});if(!C){yn.value="Failed to open the selected folder.";return}pt.value=C,Pe(Mt(C)),await ps(),await qo(),Ns()}catch(C){yn.value=C instanceof Error?C.message:"Failed to open the selected folder."}finally{zn.value=!1}}}async function ng(){if(Wn.value="",Ur.value){ki();return}if(!nr.value){const l=pt.value.trim()||await Su();if(!l||(nr.value=!0,Pr.value="",await Ha(l),yn.value))return}yn.value||(No.value=Nr.value,Ur.value=!0,Ht(()=>{var l;return(l=rn.value)==null?void 0:l.focus()}))}function ki(){Wn.value="",No.value="",Ur.value=!1}async function Id(){const l=No.value.trim();if(!l)return;if(Wn.value="",yn.value){Wn.value="Reload the current folder before creating a new one.";return}Br.value=!0;const p=al.value.trim(),C=Md(Rd(p,l));if(!C){Wn.value="Unable to determine where the new folder should be created.",Br.value=!1;return}if(!Ms.value){Wn.value="Enter a single folder name.",Br.value=!1;return}try{const z=await _T(C);if(!z){Wn.value="Failed to create the folder.";return}Wn.value="",Pr.value="",await Ha(z),ki()}catch(z){Wn.value=z instanceof Error?z.message:"Failed to create folder."}finally{Br.value=!1}}async function rg(){var p;if(typeof window>"u")return!1;const l=((p=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:p.trim())??"";if(!l)return!1;try{const C=await Sl(l,{createIfMissing:!1,label:""});if(!C)return!1;pt.value=C,Pe(Mt(C)),await Tt.replace({name:"home"}),await ps();const z=new URL(window.location.href);return z.searchParams.delete("openProjectPath"),window.history.replaceState({},"",z.toString()),!0}catch{return!1}}async function Su(){const l=Pd();if(l)return l;try{const p=await gh();if(p)return ho.value=p,p}catch{}return""}async function qo(){const l=Pd();if(!l){Nr.value="New Project (1)";return}try{const p=await CT(l);Nr.value=p.name||"New Project (1)"}catch{Nr.value="New Project (1)"}}function Pd(){var C,z;const l=pt.value.trim();if(l)return ei(l);const p=((z=(C=Zt.value[0])==null?void 0:C.value)==null?void 0:z.trim())??"";return p?ei(p):ho.value.trim()}async function og(){try{ho.value=await gh()}catch{ho.value=""}}async function ps(){try{const l=await Hs();dn.value={order:[...l.order],labels:{...l.labels},projectOrder:[...l.projectOrder]}}catch{dn.value={order:[],labels:{},projectOrder:[]}}}async function Ha(l){const p=++Oo,C=ot(l).trim();On.value=C,Ir.value=C,yn.value="",Vn.value=!0;try{const z=await bT(l,{showHidden:ss.value});if(p!==Oo)return;On.value=z.path,Ir.value=z.path,aa.value=z.parentPath,sa.value=z.entries}catch(z){if(p!==Oo)return;yn.value=z instanceof Error?z.message:"Failed to load local folders.",aa.value=ei(Ir.value),sa.value=[],ki()}finally{p===Oo&&(Vn.value=!1)}}function Rd(l,p){const C=ot(l).trim(),z=ot(p).trim().replace(/^[\\/]+/u,"");if(!C||!z)return"";const re=C.includes("\\")&&!C.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(C))return`${C.slice(0,2)}${re}${z}`;if(/^\/+$/u.test(C))return`/${z}`;const de=C.replace(/[\\/]+$/u,"");return de?`${de}${re}${z}`:""}function Md(l){const p=ot(l).trim();if(!p)return"";const C=p.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(C){const[,re,de,He=""]=C,en=xu(He.split(/[\\/]+/u));return en.length>0?`\\\\${re}\\${de}\\${en.join("\\")}`:`\\\\${re}\\${de}`}const z=p.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(z){const[,re,de=""]=z,He=p.includes("\\")&&!p.includes("/")?"\\":"/",en=xu(de.split(/[\\/]+/u));return en.length>0?`${re}${He}${en.join(He)}`:`${re}${He}`}if(p.startsWith("/")){const re=xu(p.split("/"));return re.length>0?`/${re.join("/")}`:"/"}return p}function xu(l){const p=[];for(const C of l){const z=C.trim();if(!(!z||z===".")){if(z===".."){p.length>0&&p.pop();continue}p.push(z)}}return p}function ag(l){he(l.draggedId,l.targetId)}function $d(l){$e(vo.value,l)}function jd(l){Ge(l)}function Nd(l){D(l)}function sg(){me()}function ig(l){const p=l.turnId.trim();if(p.length>0){const C=[...Zr.value].reverse().find(z=>{var re;return z.role==="user"&&(((re=z.turnId)==null?void 0:re.trim())??"")===p&&z.text.trim().length>0});C!=null&&C.text&&kn.value&&kn.value.appendTextToDraft(C.text)}gt(l.turnId)}function lg(l){qt.value||!ae.value||(_e("default"),ml(),ce("Implement",[],[],"steer",[],void 0,"default"))}function ug(){if(qt.value||Hr.value||Xr.value||typeof document>"u"||!F.value||Zr.value.length===0)return;const l=cg(),p=dg(),C=new Blob([l],{type:"text/markdown;charset=utf-8"}),z=URL.createObjectURL(C),re=document.createElement("a");re.href=z,re.download=p,document.body.appendChild(re),re.click(),document.body.removeChild(re),window.setTimeout(()=>URL.revokeObjectURL(z),0)}function cg(){var C,z,re;const l=[],p=((z=(C=F.value)==null?void 0:C.title)==null?void 0:z.trim())||"Untitled thread";l.push(`# ${fg(p)}`),l.push(""),l.push(`- Exported: ${new Date().toISOString()}`),l.push(`- Thread ID: ${((re=F.value)==null?void 0:re.id)??""}`),l.push(""),l.push("---"),l.push("");for(const de of Zr.value){const He=de.role?de.role.toUpperCase():"MESSAGE";l.push(`## ${He}`),l.push("");const en=de.text.trim();if(en&&(l.push(en),l.push("")),de.commandExecution&&(l.push("```text"),l.push(`command: ${de.commandExecution.command}`),l.push(`status: ${de.commandExecution.status}`),de.commandExecution.cwd&&l.push(`cwd: ${de.commandExecution.cwd}`),de.commandExecution.exitCode!==null&&l.push(`exitCode: ${de.commandExecution.exitCode}`),l.push(de.commandExecution.aggregatedOutput||"(no output)"),l.push("```"),l.push("")),de.fileAttachments&&de.fileAttachments.length>0){l.push("Attachments:");for(const Vr of de.fileAttachments)l.push(`- ${Vr.path}`);l.push("")}if(de.images&&de.images.length>0){l.push("Images:");for(const Vr of de.images)l.push(`- ${Vr}`);l.push("")}}return`${l.join(`
|
|
61
|
+
`).trimEnd()}
|
|
62
|
+
`}function dg(){var re,de;const C=(((de=(re=F.value)==null?void 0:re.title)==null?void 0:de.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",z=new Date().toISOString().replace(/[:.]/g,"-");return`${C}-${z}.md`}function fg(l){return l.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Au(l,p){if(typeof window>"u")return p;const C=window.localStorage.getItem(l);return C===null?p:C==="1"}function hg(){if(typeof window>"u")return"system";const l=window.localStorage.getItem(Kh);return l==="light"||l==="dark"?l:"system"}function pg(){if(typeof window>"u")return"steer";const l=window.localStorage.getItem(Gh);return l==="steer"||l==="queue"?l:"queue"}function mg(){if(typeof window>"u")return"standard";const l=window.localStorage.getItem(Xh);return l==="standard"||l==="wide"||l==="extra-wide"?l:"standard"}function vg(){ee.value=!ee.value,window.localStorage.setItem(zh,ee.value?"1":"0")}function gg(){Ne.value=Ne.value==="steer"?"queue":"steer",window.localStorage.setItem(Gh,Ne.value)}function yg(){const l=["system","light","dark"],p=l.indexOf(wt.value);wt.value=l[(p+1)%l.length],window.localStorage.setItem(Kh,wt.value),yl()}function wg(){const l=["standard","wide","extra-wide"],p=l.indexOf(Gt.value);Gt.value=l[(p+1)%l.length],window.localStorage.setItem(Xh,Gt.value)}function bg(){ln.value=!ln.value,window.localStorage.setItem(Yh,ln.value?"1":"0")}function _g(){Vt.value=!Vt.value,window.localStorage.setItem(Jh,Vt.value?"1":"0")}async function Tg(l){if(!Kr.value){Kr.value=!0;try{if(l==="codex"){Zn.value="codex";const p=await ph(!1);Fr.value=p.enabled}else if(l==="openrouter"){Zn.value="openrouter";const p=await ph(!0);Fr.value=p.enabled,await Os("","",{wireApi:er.value,provider:"openrouter"})}else l==="opencode-zen"?(Zn.value="opencode-zen",await Os("",ea.value.trim(),{wireApi:"chat",provider:"opencode-zen"}),Fr.value=!0):l==="custom"&&(Zn.value="custom",un.value.trim()&&Zo.value.trim()&&(await Os(un.value.trim(),Zo.value.trim(),{wireApi:Hn.value}),Fr.value=!0));Er.value="",await Ye({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0}),ft.name==="thread"&&Tt.push({name:"home"})}catch(p){Er.value=p instanceof Error?p.message:"Failed to switch provider"}finally{Kr.value=!1}}}async function Eu(){if(Rt.value)return;const l=un.value.trim();if(l){Rt.value=!0;try{Er.value="",await Os(l,Zo.value.trim(),{wireApi:Hn.value}),Fr.value=!0,await Ye({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Er.value=p instanceof Error?p.message:"Failed to save custom endpoint"}finally{Rt.value=!1}}}async function Ld(l){if(Rt.value||Kr.value||er.value===l)return;const p=er.value;er.value=l,Rt.value=!0;try{Er.value="",await Os("","",{wireApi:l,provider:"openrouter"}),Fr.value=!0,await Ye({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(C){er.value=p,Er.value=C instanceof Error?C.message:"Failed to save OpenRouter API format"}finally{Rt.value=!1}}async function Od(){if(Rt.value)return;const l=ea.value.trim();if(l){Rt.value=!0;try{Er.value="",await Os("",l,{wireApi:"chat",provider:"opencode-zen"}),Fr.value=!0,await Ye({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Er.value=p instanceof Error?p.message:"Failed to save OpenCode Zen config"}finally{Rt.value=!1}}}async function Dd(){if(!Rt.value){Rt.value=!0;try{const l=Ue.value.trim();await mh(l),Ue.value="",await Iu(),await Ye({includeSelectedThreadMessages:!1})}catch{}finally{Rt.value=!1}}}async function kg(){if(!Rt.value){Rt.value=!0;try{await mh(""),Ue.value="",await Iu(),await Ye({includeSelectedThreadMessages:!1})}catch{}finally{Rt.value=!1}}}async function Iu(){try{const l=await nT();Fr.value=l.enabled,Re.value=l.customKey??!1,Ar.value=l.maskedKey??null,l.enabled?l.provider==="opencode-zen"?Zn.value="opencode-zen":l.provider==="custom"?(Zn.value="custom",un.value=l.customBaseUrl??"",Hn.value=l.wireApi==="chat"?"chat":"responses"):(Zn.value="openrouter",er.value=l.wireApi==="chat"?"chat":"responses"):Zn.value="codex"}catch{}}function Cg(l){const C=Pu(l.trim())||"auto";hn.value=C,window.localStorage.setItem(Qh,C)}function Sg(){var C;if(typeof window>"u")return"auto";const l=((C=window.localStorage.getItem(Qh))==null?void 0:C.trim())||"auto";return Pu(l)||"auto"}function xg(){const l=[{value:"auto",label:s("Auto-detect")}],p=new Set(["auto"]);function C(re){const de=q[re]||re;return`${de.charAt(0).toUpperCase()+de.slice(1)} (${re})`}for(const re of typeof navigator<"u"?navigator.languages??[]:[]){const de=Pu(re);!de||p.has(de)||(p.add(de),l.push({value:de,label:`Preferred: ${C(de)}`}))}for(const re of Object.keys(q))p.has(re)||(p.add(re),l.push({value:re,label:C(re)}));const z=hn.value.trim();return z&&!p.has(z)&&l.push({value:z,label:C(z)}),l}function Pu(l){const p=l.trim().toLowerCase();if(!p||p==="auto")return"";if(p in q)return p;const C=p.split("-")[0]??p;return C in q?C:""}function yl(){const l=document.documentElement;if(wt.value==="dark")l.classList.add("dark");else if(wt.value==="light")l.classList.remove("dark");else{const p=window.matchMedia("(prefers-color-scheme: dark)").matches;l.classList.toggle("dark",p)}}function Ag(){return typeof window>"u"?!1:window.localStorage.getItem(qh)==="1"}function Eg(l){typeof window>"u"||window.localStorage.setItem(qh,l?"1":"0")}function Ig(){if(typeof window>"u")return!0;const l=window.localStorage.getItem(Hh);return l===null?!0:l==="1"}function Pg(){Lr.value=!Lr.value,!(typeof window>"u")&&window.localStorage.setItem(Hh,Lr.value?"1":"0")}function Rg(l,p){const C=(l??"").trim();return C.length>0?C:p.trim()||"message"}function Fd(l){_e(l)}async function Mg(){await Tt.isReady(),ft.name==="thread"&&Qr.value&&ut(Qr.value),await Ye({includeSelectedThreadMessages:ft.name==="thread"}),fl({silent:!0}),await rg(),an.value=!0,await Ru(),De()}function $g(l){return l?O.value.some(p=>p.threads.some(C=>C.id===l)):!1}async function Ru(){if(Qn.value){$o=!0;return}Qn.value=!0;try{do{if($o=!1,ft.name==="home"||ft.name==="skills"||ft.name==="automations"){ae.value!==""&&await X("");continue}if(ft.name==="thread"){const l=Qr.value;if(!l)continue;if(ae.value!==l){if(!$g(l)){ae.value?await Tt.replace({name:"thread",params:{threadId:ae.value}}):await Tt.replace({name:"home"});continue}await X(l)}else ke(l,{silent:!0})}}while($o)}finally{Qn.value=!1}}ht(()=>[ft.name,Qr.value,Ee.value,ae.value],async()=>{an.value&&await Ru()}),ht(()=>At.value,()=>{yd()}),ht(()=>[ft.name,At.value],([l,p])=>{l==="thread"&&hl(p)},{immediate:!0}),ht(()=>ae.value,async l=>{if(an.value&&!Qn.value&&!(qt.value||Hr.value||Xr.value)){if(!l){ft.name!=="home"&&await Tt.replace({name:"home"});return}ft.name==="thread"&&Qr.value===l||await Tt.replace({name:"thread",params:{threadId:l}})}}),ht(()=>Zt.value,l=>{if(l.length===0){pt.value="",qo();return}const p=pt.value.trim();p&&(l.some(z=>z.value===p)||(pt.value="")),qo()},{immediate:!0}),ht(()=>pt.value,()=>{fn.value={phase:"idle",title:"",message:""},qo()}),ht(()=>[ft.name,pt.value],([l,p])=>{l==="home"&&hl(p)},{immediate:!0}),ht(pn,l=>{!l&&Qt.value==="worktree"&&(Qt.value="local")},{immediate:!0}),ht(()=>[Qt.value,pt.value],([l,p])=>{l!=="worktree"||!pn.value||Ud(p)},{immediate:!0}),ht(()=>Qt.value,l=>{var p;if(l==="local"){fn.value={phase:"idle",title:"",message:""};const C=pt.value.trim();if(C&&pd(C)){const z=((p=F.value)==null?void 0:p.projectName)??zr(C),re=bi(z,"");re&&(pt.value=re)}return}pn.value&&Ud(pt.value)}),ht(()=>ft.name,l=>{l!=="home"&&(fn.value={phase:"idle",title:"",message:""}),l!=="thread"&&(Un.value=!1)}),ht(()=>ae.value,()=>{fn.value={phase:"idle",title:"",message:""}}),ht(()=>[ft.name,At.value,pn.value],([l,p,C])=>{if(!(l==="thread"||l==="home"&&C)){Ed();return}_r+=1,lr.value={},Xn.value="",Or.value="",Ti(p)},{immediate:!0}),ht(hi,l=>{typeof document>"u"||(document.title=l)},{immediate:!0}),ht(Jt,l=>{l&&!Ft.value&&cr(!0)},{immediate:!0});async function jg(l,p=[],C=[],z=[]){try{fn.value={phase:"idle",title:"",message:""};let re=pt.value;if(Qt.value==="worktree"){fn.value={phase:"running",title:s("Creating worktree"),message:s("Creating a worktree and running setup.")};try{const He=await fT(pt.value,sn.value);re=He.cwd,pt.value=He.cwd,fn.value={phase:"idle",title:"",message:""}}catch{fn.value={phase:"error",title:s("Worktree setup failed"),message:s("Unable to create worktree. Try again or switch to Local project.")};return}}else if(!re.trim()){const He=await kT(l);re=He.cwd,pt.value=He.cwd}const de=await ie(l,re,p,C,z);if(!de)return;await Tt.replace({name:"thread",params:{threadId:de}}),ml()}catch{}}function Ng(l){var z;if((z=l.prompt)!=null&&z.trim())return l.prompt.trim();const p=l.displayName.trim()||l.name.trim(),C=l.kind==="skill"?"skill":l.kind==="plugin"?"plugin":l.kind==="composio"?"Composio connector":"app";return`Test ${p} ${C}. Give me a list of what it can do and one useful example.`}function Lg(l){return`${l.kind}:${l.name}:${l.skillPath??""}`}async function Og(l){var z;if(lo.value)return;lo.value=Lg(l);const p=Ng(l),C=(z=l.attachedSkills)!=null&&z.length?l.attachedSkills:l.kind==="skill"&&l.skillPath?[{name:l.name,path:l.skillPath}]:[];try{const re=Na.value.trim()||At.value.trim(),de=await ie(p,re,[],C,[]);if(!de)return;await Tt.replace({name:"thread",params:{threadId:de}}),ml()}catch{}finally{lo.value=""}}async function Ud(l){var C;const p=l.trim();if(!p){uo.value=[],sn.value="";return}Gr.value=!0;try{const z=await pT(p);uo.value=z;const re=sn.value.trim();if(!(re.length>0&&z.some(He=>He.value===re))){const He=z.find(en=>en.value.trim()==="main");sn.value=(He==null?void 0:He.value)??((C=z[0])==null?void 0:C.value)??""}}catch{uo.value=[],sn.value=""}finally{Gr.value=!1}}return(l,p)=>(k(),A(Ke,null,[Le(j0,{"is-sidebar-collapsed":Ft.value,onCloseSidebar:p[33]||(p[33]=C=>cr(!0))},{sidebar:mt(()=>[h("section",EP,[h("div",IP,[Ft.value?Q("",!0):(k(),tt(Ih,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":Ft.value,"show-new-thread-button":!0,onToggleSidebar:p[0]||(p[0]=C=>cr(!Ft.value)),onStartNewThread:bu},{default:mt(()=>[h("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":wr.value,"aria-label":S(s)("Search threads"),title:S(s)("Search threads"),onClick:bt},[Le(Ph,{class:"sidebar-search-toggle-icon"})],8,PP)]),_:1},8,["is-sidebar-collapsed"])),!Ft.value&&wr.value?(k(),A("div",RP,[Le(Ph,{class:"sidebar-search-bar-icon"}),jt(h("input",{ref_key:"sidebarSearchInputRef",ref:co,"onUpdate:modelValue":p[1]||(p[1]=C=>$n.value=C),class:"sidebar-search-input",type:"text",placeholder:S(s)("Filter threads..."),onKeydown:En},null,40,MP),[[Yt,$n.value]]),$n.value.length>0?(k(),A("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":S(s)("Clear search"),onClick:Ct},[Le($I,{class:"sidebar-search-clear-icon"})],8,$P)):Q("",!0)])):Q("",!0),Ft.value?Q("",!0):(k(),A("button",{key:2,class:Qe(["sidebar-skills-link",{"is-active":Hr.value}]),type:"button",onClick:p[2]||(p[2]=C=>{S(Tt).push({name:"skills"}),S(Jt)&&cr(!0)})},[h("span",jP,[Le(ko)]),h("span",NP,[h("span",LP,I(S(s)("Skills")),1),h("span",OP,I(S(s)("Plugins, apps, MCPs")),1)])],2)),Ft.value?Q("",!0):(k(),A("button",{key:3,class:Qe(["sidebar-skills-link",{"is-active":Xr.value}]),type:"button",onClick:p[3]||(p[3]=C=>{S(Tt).push({name:"automations"}),S(Jt)&&cr(!0)})},[h("span",DP,[Le(ko)]),h("span",FP,[h("span",UP,I(S(s)("Automations")),1),h("span",BP,I(S(s)("Scheduled work")),1)])],2)),Ft.value?Q("",!0):(k(),tt(lS,{key:4,ref_key:"sidebarThreadTreeRef",ref:Dn,groups:S(O),"project-display-name-by-id":S(te),"project-git-repo-by-name":Uo.value,"project-cwd-by-name":md.value,"selected-thread-id":S(ae),"is-loading":S(Ee),"is-thread-list-fully-loaded":S(Ie),"search-query":$n.value,"search-matched-thread-ids":br.value,onSelect:cs,onArchive:hv,onStartNewThread:mv,onRenameProject:_v,onBrowseThreadFiles:vv,onBrowseProjectFiles:wv,onRequestProjectGitStatus:Sv,onCreateProjectWorktree:bv,onRenameThread:Tv,onForkThread:pv,onRemoveProject:kv,onReorderProject:Cv,onExportThread:js,onAutomationsChanged:fs,onStartNewChat:bu},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"]))]),Ft.value?Q("",!0):(k(),A("div",{key:0,ref_key:"settingsAreaRef",ref:jo,class:"sidebar-settings-area",onClick:Dv},[Le(dm,{name:"settings-panel"},{default:mt(()=>[Nn.value?(k(),A("div",{key:0,ref_key:"settingsPanelRef",ref:jn,class:"sidebar-settings-panel",onClick:p[17]||(p[17]=Xe(()=>{},["stop"]))},[h("div",qP,[h("div",HP,[h("div",WP,[h("button",{class:"sidebar-settings-account-collapse",type:"button","aria-expanded":!Lr.value,title:Lr.value?S(s)("Expand accounts"):S(s)("Collapse accounts"),onClick:Pg},[h("span",zP,I(Lr.value?"▸":"▾"),1)],8,VP),h("span",GP,I(S(s)("Accounts")),1),h("span",KP,I(kt.value.length),1)]),h("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:Sn.value||Ut.value||yt.value||Bt.value,onClick:iv},I(Sn.value?S(s)("Reloading…"):S(s)("Reload")),9,YP)]),Lr.value?Q("",!0):(k(),A(Ke,{key:0},[L.value?(k(),A("p",JP,I(L.value),1)):Q("",!0),h("div",QP,[h("button",{class:"sidebar-settings-account-login-button",type:"button",disabled:Sn.value||Ut.value||yt.value||Bt.value,onClick:lv},I(yt.value?S(s)("Starting login…"):S(s)("Login")),9,XP),Bn.value?(k(),A("a",{key:0,class:"sidebar-settings-account-login-link",href:Bn.value,target:"_blank",rel:"noreferrer"},I(S(s)("Open login URL")),9,ZP)):Q("",!0)]),kt.value.length===0?(k(),A("p",eR,I(S(s)("Click Login, or run `codex login`, then click reload.")),1)):(k(),A("div",tR,[(k(!0),A(Ke,null,Dt(kt.value,C=>(k(),A("article",{key:C.accountId,class:Qe(["sidebar-settings-account-item",{"is-active":C.isActive,"is-unavailable":qa(C),"is-confirming-remove":hs(C),"is-remove-visible":lt(C)}]),title:sv(C),onMouseenter:z=>nv(C.accountId),onMouseleave:z=>rv(C.accountId)},[h("div",rR,[h("p",oR,I(C.email||S(s)("Account")),1),h("p",aR,I(yi(C)),1),h("p",sR,I(hd(C)),1),h("p",iR," Workspace "+I(cl(C.accountId)),1)]),h("div",lR,[h("button",{class:"sidebar-settings-account-switch",type:"button",disabled:wi(C)||C.isActive||qa(C),onClick:z=>dv(C.accountId)},I(Mr(C)),9,uR),h("button",{class:Qe(["sidebar-settings-account-remove",{"is-visible":lt(C),"is-confirming":hs(C)}]),type:"button",disabled:wi(C),onClick:z=>fv(C.accountId)},I(ca(C)),11,cR)])],42,nR))),128))]))],64))]),h("button",{class:"sidebar-settings-row",type:"button",title:_.sendWithEnter,onClick:vg},[h("span",fR,I(S(s)("Require ⌘ + enter to send")),1),h("span",{class:Qe(["sidebar-settings-toggle",{"is-on":!ee.value}])},null,2)],8,dR),h("button",{class:"sidebar-settings-row",type:"button",title:_.inProgressSendMode,onClick:gg},[h("span",pR,I(S(s)("When busy, send as")),1),h("span",mR,I(Ne.value==="steer"?S(s)("Steer"):S(s)("Queue")),1)],8,hR),h("button",{class:"sidebar-settings-row",type:"button",title:_.appearance,onClick:yg},[h("span",gR,I(S(s)("Appearance")),1),h("span",yR,I(wt.value==="system"?S(s)("System"):wt.value==="dark"?S(s)("Dark"):S(s)("Light")),1)],8,vR),h("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:S(s)("Choose the interface language for the app.")},[h("span",bR,I(S(s)("UI language")),1),h("select",{class:"sidebar-settings-provider-select",value:S(u),onChange:p[4]||(p[4]=C=>S(m)(C.target.value))},[(k(!0),A(Ke,null,Dt(S(c),C=>(k(),A("option",{key:C.value,value:C.value},I(C.label),9,TR))),128))],40,_R)],8,wR),h("button",{class:"sidebar-settings-row",type:"button",title:_.chatWidth,onClick:wg},[h("span",CR,I(S(s)("Chat width")),1),h("span",SR,I(gu.value),1)],8,kR),h("button",{class:"sidebar-settings-row",type:"button",title:_.dictationClickToToggle,onClick:bg},[h("span",AR,I(S(s)("Click to toggle dictation")),1),h("span",{class:Qe(["sidebar-settings-toggle",{"is-on":ln.value}])},null,2)],8,xR),h("button",{class:"sidebar-settings-row",type:"button",title:_.dictationAutoSend,onClick:_g},[h("span",IR,I(S(s)("Auto send dictation")),1),h("span",{class:Qe(["sidebar-settings-toggle",{"is-on":Vt.value}])},null,2)],8,ER),h("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:S(s)("Choose the API provider for the Codex backend")},[h("span",RR,I(S(s)("Provider")),1),h("select",{class:"sidebar-settings-provider-select",value:Zn.value,disabled:Kr.value,onChange:p[5]||(p[5]=C=>Tg(C.target.value))},[...p[36]||(p[36]=[h("option",{value:"codex"},"Codex",-1),h("option",{value:"openrouter"},"OpenRouter",-1),h("option",{value:"opencode-zen"},"OpenCode Zen",-1),h("option",{value:"custom"},"Custom endpoint",-1)])],40,MR)],8,PR),Er.value?(k(),A("div",$R,I(Er.value),1)):Q("",!0),Zn.value==="openrouter"?(k(),A("div",jR,[h("div",NR,[h("span",LR,I(S(s)("OpenRouter API key")),1),h("a",OR,I(S(s)("Get API key")),1)]),h("div",DR,[Re.value&&!Ue.value?(k(),A(Ke,{key:0},[h("span",FR,I(Ar.value),1),h("button",{class:"sidebar-settings-key-clear",type:"button",disabled:Rt.value,title:S(s)("Remove custom key, use community keys"),onClick:kg},"✕",8,UR)],64)):(k(),A(Ke,{key:1},[jt(h("input",{"onUpdate:modelValue":p[6]||(p[6]=C=>Ue.value=C),class:"sidebar-settings-key-input",type:"password",placeholder:S(s)("sk-or-v1-... (optional, uses free keys if empty)"),onKeydown:on(Dd,["enter"])},null,40,BR),[[Yt,Ue.value]]),h("button",{class:"sidebar-settings-key-save",type:"button",disabled:Rt.value||!Ue.value.trim(),onClick:Dd},I(Rt.value?"...":S(s)("Set")),9,qR)],64))]),h("div",HR,[h("span",WR,I(S(s)("API format")),1),h("div",{class:"sidebar-settings-segmented",role:"group","aria-label":S(s)("OpenRouter API format")},[h("button",{type:"button",class:Qe(["sidebar-settings-segmented-option",{"is-active":er.value==="responses"}]),disabled:Rt.value||Kr.value,onClick:p[7]||(p[7]=C=>Ld("responses"))}," Responses ",10,zR),h("button",{type:"button",class:Qe(["sidebar-settings-segmented-option",{"is-active":er.value==="chat"}]),disabled:Rt.value||Kr.value,onClick:p[8]||(p[8]=C=>Ld("chat"))}," Completions ",10,GR)],8,VR)])])):Q("",!0),Zn.value==="opencode-zen"?(k(),A("div",KR,[h("div",YR,[h("span",JR,I(S(s)("OpenCode Zen API key")),1),h("a",QR,I(S(s)("Get API key")),1)]),h("div",XR,[jt(h("input",{"onUpdate:modelValue":p[9]||(p[9]=C=>ea.value=C),class:"sidebar-settings-key-input",type:"password",placeholder:S(s)("sk-..."),onKeydown:on(Od,["enter"])},null,40,ZR),[[Yt,ea.value]]),h("button",{class:"sidebar-settings-key-save",type:"button",disabled:Rt.value||!ea.value.trim(),onClick:Od},I(Rt.value?"...":S(s)("Save")),9,eM)])])):Q("",!0),Zn.value==="custom"?(k(),A("div",tM,[h("span",nM,I(S(s)("Custom endpoint URL")),1),h("div",rM,[jt(h("input",{"onUpdate:modelValue":p[10]||(p[10]=C=>un.value=C),class:"sidebar-settings-key-input",type:"url",placeholder:S(s)("https://api.example.com/v1"),onKeydown:on(Eu,["enter"])},null,40,oM),[[Yt,un.value]])]),h("span",aM,I(S(s)("API key")),1),h("div",sM,[jt(h("input",{"onUpdate:modelValue":p[11]||(p[11]=C=>Zo.value=C),class:"sidebar-settings-key-input",type:"password",placeholder:S(s)("Bearer token (optional)"),onKeydown:on(Eu,["enter"])},null,40,iM),[[Yt,Zo.value]]),h("button",{class:"sidebar-settings-key-save",type:"button",disabled:Rt.value||!un.value.trim(),onClick:Eu},I(Rt.value?"...":S(s)("Save")),9,lM)]),h("div",uM,[h("span",cM,I(S(s)("API format")),1),h("div",{class:"sidebar-settings-segmented",role:"group","aria-label":S(s)("Custom endpoint API format")},[h("button",{type:"button",class:Qe(["sidebar-settings-segmented-option",{"is-active":Hn.value==="responses"}]),onClick:p[12]||(p[12]=C=>Hn.value="responses")}," Responses ",2),h("button",{type:"button",class:Qe(["sidebar-settings-segmented-option",{"is-active":Hn.value==="chat"}]),onClick:p[13]||(p[13]=C=>Hn.value="chat")}," Completions ",2)],8,dM)])])):Q("",!0),h("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:_.dictationLanguage},[h("span",hM,I(S(s)("Dictation language")),1),Le(Gs,{class:"sidebar-settings-language-dropdown","model-value":hn.value,options:xr.value,placeholder:S(s)("Auto-detect"),"open-direction":"up","enable-search":!0,"search-placeholder":S(s)("Search language..."),"onUpdate:modelValue":Cg},null,8,["model-value","options","placeholder","search-placeholder"])],8,fM),h("button",{class:"sidebar-settings-row",type:"button","aria-live":"polite",onClick:p[14]||(p[14]=C=>Aa.value=!Aa.value)},[h("span",pM,I(S(s)("Telegram")),1),h("span",mM,I(j.value),1)]),Aa.value?(k(),A("div",vM,[h("label",gM,[h("span",yM,I(S(s)("Bot token")),1),jt(h("input",{"onUpdate:modelValue":p[15]||(p[15]=C=>ta.value=C),class:"sidebar-settings-input",type:"password",placeholder:"123456:ABCDEF",autocomplete:"off",spellcheck:"false"},null,512),[[Yt,ta.value]])]),h("label",wM,[h("span",bM,I(S(s)("Allowed Telegram user IDs")),1),jt(h("textarea",{"onUpdate:modelValue":p[16]||(p[16]=C=>na.value=C),class:"sidebar-settings-textarea",rows:"3",placeholder:`123456789
|
|
63
|
+
987654321`,spellcheck:"false"},null,512),[[Yt,na.value]])]),h("div",_M,I(S(s)("Put one Telegram user ID per line or separate them with commas. Use `*` to allow all Telegram users. Unauthorized users will see their own ID in the rejection message so they can copy it here.")),1),Xt.value?(k(),A("div",TM,I(Xt.value),1)):Q("",!0),h("div",kM,[h("button",{class:"sidebar-settings-telegram-save",type:"button",disabled:Ea.value,onClick:_t},I(Ea.value?S(s)("Saving…"):S(s)("Save Telegram config")),9,CM)])])):Q("",!0),mi.value?(k(),A("div",{key:5,class:"sidebar-settings-row sidebar-settings-context-row","data-state":Rs.value,title:y.value},[h("span",xM,I(S(s)("Context")),1),h("span",{class:"sidebar-settings-context-value","data-state":Rs.value},[As(I(v.value)+" ",1),h("span",EM,I(b.value),1)],8,AM)],8,SM)):Q("",!0),h("div",IM,[Le(SE,{snapshots:S(We)},null,8,["snapshots"])]),h("div",{class:"sidebar-settings-build-label","aria-label":S(s)("Worktree name and version")}," WT "+I(S(f))+" · v"+I(S(w)),9,PM)],512)):Q("",!0)]),_:1}),h("button",{ref_key:"settingsButtonRef",ref:fo,class:"sidebar-settings-button",type:"button",onClick:p[18]||(p[18]=Xe(C=>Nn.value=!Nn.value,["stop"]))},[Le(SI,{class:"sidebar-settings-icon"}),h("span",null,I(S(s)("Settings")),1),h("span",RM,I(S(f))+" · v"+I(S(w)),1)],512)],512))])]),content:mt(()=>[h("section",{class:Qe(["content-root",{"is-virtual-keyboard-open":ls.value,"is-terminal-open":rr.value}]),style:ya(T.value)},[ja.value?(k(),A("span",MM)):Q("",!0),Le(hS,{title:Es.value,accent:Hr.value||Xr.value},{leading:mt(()=>[Ft.value||S(Jt)?(k(),tt(Ih,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":Ft.value,"show-new-thread-button":!0,onToggleSidebar:p[19]||(p[19]=C=>cr(!Ft.value)),onStartNewThread:bu},null,8,["is-sidebar-collapsed"])):Q("",!0),Hr.value?(k(),A("span",$M,[Le(ko)])):Xr.value?(k(),A("span",jM,[Le(ko)])):Q("",!0)]),actions:mt(()=>[Ps.value?(k(),tt(Gs,{key:0,class:Qe(["content-header-terminal-command",{"is-open":rr.value}]),"model-value":xa.value,options:g.value,placeholder:i.value,"selected-prefix-icon":II,"icon-only":!0,"empty-label":S(s)("No commands"),"onUpdate:modelValue":Ev},null,8,["class","model-value","options","placeholder","empty-label"])):Q("",!0),Do.value?(k(),tt(tI,{key:1,class:"content-header-branch-dropdown","current-branch":ir.value,"head-sha":Tr.value,"head-subject":kr.value,"head-date":Wt.value,detached:nn.value,dirty:Ln.value,branches:Pt.value,"commits-by-branch":lr.value,"commits-loading-for":Xn.value,"commits-error":Or.value,loading:po.value,busy:ur.value,error:Cr.value,"review-open":Un.value,"show-review":S(ft).name==="thread"&&S(ae).length>0,onToggleReview:p[20]||(p[20]=C=>Un.value=!Un.value),onCheckoutBranch:Wv,onResetBranchToCommit:Vv,onLoadCommits:zv},null,8,["current-branch","head-sha","head-subject","head-date","detached","dirty","branches","commits-by-branch","commits-loading-for","commits-error","loading","busy","error","review-open","show-review"])):Q("",!0)]),_:1},8,["title","accent"]),h("section",NM,[Hr.value?(k(),tt(S(o),{key:0,cwd:Na.value,"thread-id":Qr.value,"try-in-flight-key":lo.value,onSkillsChanged:H,onTryItem:Og},null,8,["cwd","thread-id","try-in-flight-key"])):Xr.value?(k(),tt(S(a),{key:1,ref_key:"automationsPanelRef",ref:ao,groups:S(O),"project-cwd-by-name":md.value,"project-display-name-by-id":S(te),"selected-automation-id":is.value,onSelectAutomation:$s,onEditAutomation:ul,onCreateAutomation:ds},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):qt.value?(k(),A("div",LM,[h("div",OM,[h("p",DM,I(S(s)("Let's build")),1),Le(Gs,{class:"new-thread-folder-dropdown","model-value":pt.value,options:Zt.value,placeholder:S(s)("Choose folder"),"enable-search":!0,"search-placeholder":S(s)("Quick search project"),disabled:!1,"onUpdate:modelValue":Bv},null,8,["model-value","options","placeholder","search-placeholder"]),pt.value?(k(),A("p",{key:0,class:"new-thread-folder-selected",title:pt.value},I(S(s)("Selected folder"))+": "+I(pt.value),9,FM)):Q("",!0),h("div",UM,[h("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:Jv},I(S(s)("Select folder")),1),h("button",{class:"new-thread-folder-action",type:"button",onClick:Gv},I(S(s)("Create Project")),1)]),qn.value?(k(),A("section",BM,[h("div",qM,[h("div",HM,[h("span",WM,[Le(ko)]),h("p",VM,I(S(s)("New in Codex")),1)]),h("h2",zM,I(S(s)("Plugins are here")),1),h("p",GM,I(S(s)("Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.")),1),p[37]||(p[37]=h("div",{class:"new-thread-launch-card-pills","aria-label":"Example integrations"},[h("span",{class:"new-thread-launch-card-pill"},"Gmail"),h("span",{class:"new-thread-launch-card-pill"},"Calendar"),h("span",{class:"new-thread-launch-card-pill"},"GitHub"),h("span",{class:"new-thread-launch-card-pill"},"Slack"),h("span",{class:"new-thread-launch-card-pill"},"Browser Use")],-1))]),h("div",KM,[h("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:Da},I(S(s)("Explore Plugins & Apps")),1),h("button",{class:"new-thread-launch-card-button",type:"button",onClick:Fo},I(S(s)("Dismiss")),1)])])):Q("",!0),(k(),tt(Xa,{to:"body"},[nr.value?(k(),A("div",{key:0,class:"new-thread-open-folder-overlay",onClick:Xe(Ns,["self"])},[h("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":S(s)("Select folder"),onKeydown:on(Xe(Ns,["prevent"]),["esc"])},[h("div",JM,[h("p",QM,I(S(s)("Select folder")),1),h("button",{class:"new-thread-open-folder-close",type:"button",onClick:Ns},I(S(s)("Cancel")),1)]),h("p",XM,I(S(s)("Current folder")),1),h("div",ZM,[jt(h("input",{ref_key:"existingFolderPathInputRef",ref:as,"onUpdate:modelValue":p[21]||(p[21]=C=>On.value=C),class:"new-thread-open-folder-path",type:"text",placeholder:S(s)("Current folder"),title:On.value||S(s)("Unavailable"),disabled:Vn.value||zn.value,onBlur:eg,onKeydown:[on(Xe(tg,["prevent"]),["enter"]),on(Xe(Ns,["prevent"]),["esc"])]},null,40,e$),[[Yt,On.value]]),h("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!Ua.value||Vn.value||zn.value,onClick:p[22]||(p[22]=C=>Cu())},I(zn.value?S(s)("Opening…"):S(s)("Open")),9,t$)]),h("div",n$,[h("label",r$,[jt(h("input",{"onUpdate:modelValue":p[23]||(p[23]=C=>ss.value=C),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:Xv},null,544),[[ub,ss.value]]),h("span",null,I(S(s)("Show hidden folders")),1)]),h("button",{class:Qe(["new-thread-folder-action",{"new-thread-folder-action-primary":Ur.value}]),type:"button","aria-pressed":Ur.value,disabled:!Ir.value||Vn.value||zn.value||Br.value||!!yn.value&&!Ur.value,onClick:ng},I(S(s)("New folder")),11,o$)]),Ur.value?(k(),A("div",a$,[h("div",s$,[jt(h("input",{ref_key:"createFolderInputRef",ref:rn,"onUpdate:modelValue":p[24]||(p[24]=C=>No.value=C),class:"new-thread-open-folder-create-input",type:"text",placeholder:S(s)("Folder name"),onKeydown:[on(Xe(Id,["prevent"]),["enter"]),on(Xe(ki,["prevent"]),["esc"])]},null,40,i$),[[Yt,No.value]]),h("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!wo.value||Br.value,onClick:Id},I(ll.value),9,l$)]),Wn.value?(k(),A("p",u$,I(Wn.value),1)):Q("",!0)])):Q("",!0),jt(h("input",{ref_key:"existingFolderFilterInputRef",ref:Pa,"onUpdate:modelValue":p[25]||(p[25]=C=>Pr.value=C),class:"new-thread-open-folder-filter",type:"text",placeholder:S(s)("Filter folders..."),onKeydown:on(Xe(Ns,["prevent"]),["esc"])},null,40,c$),[[Yt,Pr.value]]),yn.value?(k(),A("div",d$,[h("p",f$,I(yn.value),1),h("button",{class:"new-thread-folder-action",type:"button",disabled:Vn.value||zn.value,onClick:Zv},I(S(s)("Retry")),9,h$)])):Q("",!0),Vn.value?(k(),A("p",p$,I(S(s)("Loading folders…")),1)):!yn.value&&gi.value.length===0?(k(),A("p",m$,I(Pr.value.trim()?S(s)("No folders match this filter."):S(s)("No subfolders found here.")),1)):gi.value.length>0?(k(),A("ul",v$,[(k(!0),A(Ke,null,Dt(gi.value,C=>(k(),A("li",{key:C.key,class:"new-thread-open-folder-item"},[h("button",{class:"new-thread-open-folder-item-main",type:"button",title:C.path,disabled:Vn.value||zn.value,onClick:z=>Qv(C.path)},[h("span",y$,I(C.name),1)],8,g$),C.kind==="directory"?(k(),A("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:Vn.value||zn.value,onClick:z=>Cu(C.path)},I(S(s)("Open")),9,w$)):Q("",!0)]))),128))])):Q("",!0)],40,YM)])):Q("",!0)])),(k(),tt(Xa,{to:"body"},[Ia.value?(k(),A("div",{key:0,class:"new-thread-open-folder-overlay",onClick:Xe(gl,["self"])},[h("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":S(s)("Create or clone project"),onKeydown:on(Xe(gl,["prevent"]),["esc"])},[h("div",_$,[h("p",T$,I(S(s)("Create or clone project")),1),h("button",{class:"new-thread-open-folder-close",type:"button",disabled:An.value,onClick:gl},I(S(s)("Cancel")),9,k$)]),h("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":S(s)("Project source")},[h("button",{class:Qe(["new-thread-project-mode-tab",{"is-active":tr.value==="create"}]),type:"button",role:"tab","aria-selected":tr.value==="create",disabled:An.value,onClick:p[26]||(p[26]=C=>tr.value="create")},I(S(s)("New project")),11,S$),h("button",{class:Qe(["new-thread-project-mode-tab",{"is-active":tr.value==="clone"}]),type:"button",role:"tab","aria-selected":tr.value==="clone",disabled:An.value,onClick:p[27]||(p[27]=C=>tr.value="clone")},I(S(s)("Clone from GitHub")),11,x$)],8,C$),h("label",A$,[h("span",E$,I(S(s)("Destination folder")),1),jt(h("input",{"onUpdate:modelValue":p[28]||(p[28]=C=>mo.value=C),class:"new-thread-open-folder-path",type:"text",disabled:An.value,placeholder:S(s)("Destination folder")},null,8,I$),[[Yt,mo.value]])]),tr.value==="create"?(k(),A("label",P$,[h("span",R$,I(S(s)("Project name")),1),jt(h("input",{ref_key:"projectSetupPrimaryInputRef",ref:os,"onUpdate:modelValue":p[29]||(p[29]=C=>ra.value=C),class:"new-thread-open-folder-create-input",type:"text",disabled:An.value,placeholder:S(s)("Project name"),onKeydown:on(Xe(ku,["prevent"]),["enter"])},null,40,M$),[[Yt,ra.value]])])):(k(),A("label",$$,[h("span",j$,I(S(s)("GitHub repository URL")),1),jt(h("input",{ref_key:"projectSetupPrimaryInputRef",ref:os,"onUpdate:modelValue":p[30]||(p[30]=C=>oa.value=C),class:"new-thread-open-folder-create-input",type:"url",disabled:An.value,placeholder:"https://github.com/owner/repo",onKeydown:on(Xe(ku,["prevent"]),["enter"])},null,40,N$),[[Yt,oa.value]])])),Lo.value?(k(),A("p",L$,I(Lo.value),1)):Q("",!0),h("div",O$,[h("button",{class:"new-thread-folder-action",type:"button",disabled:An.value,onClick:gl},I(S(s)("Cancel")),9,D$),h("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!il.value||An.value,onClick:ku},I(mu.value),9,F$)])],40,b$)])):Q("",!0)])),pn.value?(k(),tt(sI,{key:2,class:"new-thread-runtime-dropdown",modelValue:Qt.value,"onUpdate:modelValue":p[31]||(p[31]=C=>Qt.value=C)},null,8,["modelValue"])):Q("",!0),Qt.value==="worktree"?(k(),A("div",U$,[h("p",B$,I(S(s)("Base branch")),1),Le(Gs,{class:"new-thread-branch-dropdown","model-value":sn.value,options:Bo.value,placeholder:S(s)("Select branch"),"enable-search":!0,"search-placeholder":S(s)("Search branches..."),disabled:Gr.value||Bo.value.length===0,"onUpdate:modelValue":qv},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),h("p",q$,I(Gr.value?S(s)("Loading branches…"):Fa.value?S(s)("New worktree branch will start from {branch}.",{branch:Fa.value}):S(s)("No Git branches found for this folder.")),1)])):Q("",!0),pn.value?(k(),A("p",H$,I(S(s)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):Q("",!0),fn.value.phase!=="idle"?(k(),A("div",{key:5,class:Qe(["worktree-init-status",{"is-running":fn.value.phase==="running","is-error":fn.value.phase==="error"}])},[h("strong",W$,I(fn.value.title),1),h("span",V$,I(fn.value.message),1)],2)):Q("",!0)]),h("div",z$,[wn.value&&At.value?(k(),tt(S(n),{key:0,ref_key:"homeTerminalPanelRef",ref:so,class:"content-thread-terminal-panel","thread-id":vo.value,cwd:At.value,onHide:Nv,onTerminalFocusChange:Td},null,8,["thread-id","cwd"])):Q("",!0),Le(Eh,{ref_key:"homeThreadComposerRef",ref:Sa,"active-thread-id":vo.value,cwd:At.value,"collaboration-modes":S(Se),"selected-collaboration-mode":S(be),models:S(K),"selected-model":$a.value,"selected-reasoning-effort":S(Ce),"selected-speed-mode":S(ne),"is-updating-speed-mode":S(nt),skills:S(Ae),"thread-token-usage":S(U),"codex-quota":S(Me),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":ee.value,"in-progress-submit-mode":Ne.value,"dictation-click-to-toggle":ln.value,"dictation-auto-send":Vt.value,"dictation-language":hn.value,onSubmit:Ad,"onUpdate:selectedCollaborationMode":Fd,"onUpdate:selectedModel":$d,"onUpdate:selectedReasoningEffort":jd,"onUpdate:selectedSpeedMode":Nd},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","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"])])])):(k(),A("div",G$,[Un.value&&S(ae)&&At.value?(k(),tt(S(r),{key:0,"thread-id":S(ae),cwd:At.value,"is-thread-in-progress":yo.value,onClose:p[32]||(p[32]=C=>Un.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress"])):(k(),A(Ke,{key:1},[h("div",K$,[Le(S(t),{ref_key:"threadConversationRef",ref:Cn,messages:Zr.value,"is-loading":S(Ze),"active-thread-id":vo.value,cwd:At.value,"live-overlay":pi.value,"pending-requests":S(Y),"has-more-persisted-above":S(Be),"is-loading-persisted-above":S(je),"load-earlier-messages":S(pe),onForkThread:Av,onRollback:ig,onImplementPlan:lg,onRespondServerRequest:vd},null,8,["messages","is-loading","active-thread-id","cwd","live-overlay","pending-requests","has-more-persisted-above","is-loading-persisted-above","load-earlier-messages"])]),h("div",Y$,[Le(vE,{messages:S(ue),onEdit:Uv,onSteer:S(Fe),onDelete:S(ge),onReorder:ag},null,8,["messages","onSteer","onDelete"]),S(G)&&S(ae)&&At.value?(k(),tt(S(n),{key:0,ref_key:"threadTerminalPanelRef",ref:Mo,class:"content-thread-terminal-panel","thread-id":S(ae),cwd:At.value,onHide:Lv,onTerminalFocusChange:Td},null,8,["thread-id","cwd"])):Q("",!0),go.value?(k(),tt(aE,{key:1,request:go.value,"request-count":S(Y).length,"has-queue-above":S(ue).length>0,onRespondServerRequest:vd},null,8,["request","request-count","has-queue-above"])):(k(),tt(Eh,{key:2,ref_key:"threadComposerRef",ref:kn,"active-thread-id":vo.value,cwd:At.value,"collaboration-modes":S(Se),"selected-collaboration-mode":S(be),models:S(K),"selected-model":$a.value,"selected-reasoning-effort":S(Ce),"selected-speed-mode":S(ne),"is-updating-speed-mode":S(nt),skills:S(Ae),"thread-token-usage":S(U),"codex-quota":S(Me),"is-turn-in-progress":yo.value,"is-stop-pending":S(ct),"is-interrupting-turn":S(ze),"has-queue-above":S(ue).length>0,"send-with-enter":ee.value,"in-progress-submit-mode":Ne.value,"dictation-click-to-toggle":ln.value,"dictation-auto-send":Vt.value,"dictation-language":hn.value,"onUpdate:selectedCollaborationMode":Fd,onSubmit:Ad,"onUpdate:selectedModel":$d,"onUpdate:selectedReasoningEffort":jd,"onUpdate:selectedSpeedMode":Nd,onInterrupt:sg},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","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","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","dictation-language"]))])],64))]))])],6)]),_:1},8,["is-sidebar-collapsed"]),Sr.value?(k(),A("div",{key:0,class:"codex-login-modal-backdrop",role:"presentation",onClick:yu},[h("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":S(s)("Complete Codex login"),onSubmit:Xe(uv,["prevent"]),onClick:p[35]||(p[35]=Xe(()=>{},["stop"]))},[h("div",Q$,[h("h2",X$,I(S(s)("Complete Codex login")),1),h("button",{class:"codex-login-modal-close",type:"button","aria-label":S(s)("Close"),disabled:Bt.value,onClick:yu}," × ",8,Z$)]),h("p",ej,I(S(s)("Finish login in the browser, then paste the localhost callback URL here.")),1),Bn.value?(k(),A("a",{key:0,class:"codex-login-modal-link",href:Bn.value,target:"_blank",rel:"noreferrer"},I(S(s)("Open login URL")),9,tj)):Q("",!0),jt(h("input",{ref_key:"codexLoginCallbackInputRef",ref:Xo,"onUpdate:modelValue":p[34]||(p[34]=C=>Tn.value=C),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:S(s)("Paste localhost callback URL"),disabled:Bt.value},null,8,nj),[[Yt,Tn.value]]),L.value?(k(),A("p",rj,I(L.value),1)):Q("",!0),h("div",oj,[h("button",{class:"codex-login-modal-cancel",type:"button",disabled:Bt.value,onClick:yu},I(S(s)("Cancel")),9,aj),h("button",{class:"codex-login-modal-submit",type:"submit",disabled:Bt.value||Tn.value.trim().length===0},I(Bt.value?S(s)("Completing…"):S(s)("Complete")),9,sj)])],40,J$)])):Q("",!0)],64))}}),uj=xt(lj,[["__scopeId","data-v-6d9f5bf7"]]),Ml={render:()=>null},cj=x0({history:o0(),routes:[{path:"/",name:"home",component:Ml},{path:"/thread/:threadId",name:"thread",component:Ml},{path:"/skills",name:"skills",component:Ml},{path:"/automations",name:"automations",component:Ml},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexui. github: https://github.com/friuns2/codexUI");mb(uj).use(cj).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(Hm("Service worker registration failed."),e)})});export{dj as $,tt as A,Xc as B,j_ as C,vj as D,mj as E,Ke as F,gj as G,O_ as H,li as I,rs as J,yj as K,jt as L,Hu as M,Nj as N,Oj as O,Dj as P,hj as Q,Lj as R,fd as S,dm as T,Xa as U,Yt as V,ji as W,Ko as X,E0 as Y,A0 as Z,xt as _,h as a,pj as a0,wj as a1,Cj as a2,Ij as a3,Pj as a4,bj as a5,Ej as a6,Rj as a7,$j as a8,jj as a9,_j as aa,Tj as ab,kj as ac,Sj as ad,Aj as ae,xj as af,Mj as ag,I_ as ah,P_ as ai,ko as aj,on as ak,Ah as al,Ca as b,A as c,Jn as d,ns as e,Q as f,Qe as g,fj as h,Le as i,zs as j,wS as k,$I as l,Xe as m,Ht as n,k as o,ya as p,S as q,Dt as r,As as s,I as t,id as u,mt as v,ht as w,x,Z as y,Ei as z};
|