codex-mobile-re 0.1.119 → 0.1.121
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/README.md +214 -214
- package/dist/assets/{AutomationsPanel-CxjvFbfc.js → AutomationsPanel-Dx0KVoCE.js} +1 -1
- package/dist/assets/{AutomationsPanel-VRBbmMYW.css → AutomationsPanel-ulx5N8pM.css} +1 -1
- package/dist/assets/{DirectoryHub-DmZLEiwB.css → DirectoryHub-BOBZNd77.css} +1 -1
- package/dist/assets/DirectoryHub-BOPhx2Of.js +2 -0
- package/dist/assets/{QueuedMessages-D-8W4gcK.js → QueuedMessages-Dq60IlFJ.js} +1 -1
- package/dist/assets/{ReviewPane-ZrWfZEd_.css → ReviewPane-B8ZRIB5L.css} +1 -1
- package/dist/assets/{ReviewPane-Be2UtBz_.js → ReviewPane-UleDl12M.js} +1 -1
- package/dist/assets/{RightFilePreview-uQztLDUY.js → RightFilePreview-Baikjk70.js} +1 -1
- package/dist/assets/{RightFilesPanel-l-aqQaW6.css → RightFilesPanel-BB__afAJ.css} +1 -1
- package/dist/assets/{RightFilesPanel-CY7PX2sN.js → RightFilesPanel-DNsqEfsl.js} +1 -1
- package/dist/assets/{RightGitPanel-F4KEU11C.js → RightGitPanel-D5vGDcb7.js} +2 -2
- package/dist/assets/{SettingsDialog-CfChVi0L.css → SettingsDialog-CSepwxFJ.css} +1 -1
- package/dist/assets/{SettingsDialog-BXgykQJ7.js → SettingsDialog-eR-iNCMC.js} +3 -3
- package/dist/assets/ThreadConversation-9lNMJVzu.js +39 -0
- package/dist/assets/{ThreadConversation-DkD0ZJIg.css → ThreadConversation-BFwLGxZ1.css} +1 -1
- package/dist/assets/ThreadPendingRequestPanel-BVMOch66.js +1 -0
- package/dist/assets/{ThreadTerminalPanel-CHuA4GMX.js → ThreadTerminalPanel-ClNIUPAl.js} +1 -1
- package/dist/assets/index-BBn90yC5.js +83 -0
- package/dist/assets/{index-Xx6RYcTM.css → index-UrMf1oyy.css} +1 -1
- package/dist/index.html +2 -2
- package/dist-cli/index.js +430 -137
- package/dist-cli/index.js.map +1 -1
- package/package.json +94 -94
- package/dist/assets/DirectoryHub-TQgBZjYj.js +0 -2
- package/dist/assets/ThreadConversation-C4Up0abe.js +0 -39
- package/dist/assets/ThreadPendingRequestPanel-Csyl1ur1.js +0 -1
- package/dist/assets/index-BFbeARme.js +0 -83
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-9lNMJVzu.js","assets/sanitizeHtml-Bd3No2dT.js","assets/ThreadConversation-BFwLGxZ1.css","assets/ThreadTerminalPanel-ClNIUPAl.js","assets/ThreadTerminalPanel-O7IxAyfy.css","assets/ReviewPane-UleDl12M.js","assets/ReviewPane-B8ZRIB5L.css","assets/DirectoryHub-BOPhx2Of.js","assets/DirectoryHub-BOBZNd77.css","assets/AutomationsPanel-Dx0KVoCE.js","assets/AutomationsPanel-ulx5N8pM.css","assets/SettingsDialog-eR-iNCMC.js","assets/SettingsDialog-CSepwxFJ.css","assets/RightGitPanel-D5vGDcb7.js","assets/RightGitPanel-BTq9Wdmr.css","assets/RightFilesPanel-DNsqEfsl.js","assets/RightFilesPanel-BB__afAJ.css","assets/RightFilePreview-Baikjk70.js","assets/RightFilePreview-BythLbi1.css","assets/ThreadPendingRequestPanel-BVMOch66.js","assets/ThreadPendingRequestPanel-BptJdqbc.css","assets/QueuedMessages-Dq60IlFJ.js","assets/QueuedMessages-BM1najM7.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&o(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?a.credentials="include":r.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function o(r){if(r.ep)return;r.ep=!0;const a=n(r);fetch(r.href,a)}})();/**
|
|
3
|
+
* @vue/shared v3.5.40
|
|
4
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
+
* @license MIT
|
|
6
|
+
**/function Tf(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Bt={},Gi=[],pa=()=>{},cv=()=>!1,rc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),ac=e=>e.startsWith("onUpdate:"),mn=Object.assign,Sf=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},xT=Object.prototype.hasOwnProperty,Lt=(e,t)=>xT.call(e,t),rt=Array.isArray,Vi=e=>Kl(e)==="[object Map]",sc=e=>Kl(e)==="[object Set]",Wp=e=>Kl(e)==="[object Date]",ht=e=>typeof e=="function",Kt=e=>typeof e=="string",$r=e=>typeof e=="symbol",Nt=e=>e!==null&&typeof e=="object",dv=e=>(Nt(e)||ht(e))&&ht(e.then)&&ht(e.catch),fv=Object.prototype.toString,Kl=e=>fv.call(e),kT=e=>Kl(e).slice(8,-1),pv=e=>Kl(e)==="[object Object]",Cf=e=>Kt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ml=Tf(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ic=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},IT=/-\w/g,po=ic(e=>e.replace(IT,t=>t.slice(1).toUpperCase())),AT=/\B([A-Z])/g,Ds=ic(e=>e.replace(AT,"-$1").toLowerCase()),lc=ic(e=>e.charAt(0).toUpperCase()+e.slice(1)),rd=ic(e=>e?`on${lc(e)}`:""),Rr=(e,t)=>!Object.is(e,t),ju=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},hv=(e,t,n,o=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:o,value:n})},xf=e=>{const t=parseFloat(e);return isNaN(t)?e:t},_T=e=>{const t=Kt(e)?Number(e):NaN;return isNaN(t)?e:t};let Gp;const uc=()=>Gp||(Gp=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function or(e){if(rt(e)){const t={};for(let n=0;n<e.length;n++){const o=e[n],r=Kt(o)?MT(o):or(o);if(r)for(const a in r)t[a]=r[a]}return t}else if(Kt(e)||Nt(e))return e}const PT=/;(?![^(]*\))/g,RT=/:([^]+)/,ET=/\/\*[^]*?\*\//g;function MT(e){const t={};return e.replace(ET,"").split(PT).forEach(n=>{if(n){const o=n.split(RT);o.length>1&&(t[o[0].trim()]=o[1].trim())}}),t}function ut(e){let t="";if(Kt(e))t=e;else if(rt(e))for(let n=0;n<e.length;n++){const o=ut(e[n]);o&&(t+=o+" ")}else if(Nt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const jT="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",LT=Tf(jT);function mv(e){return!!e||e===""}function NT(e,t){if(e.length!==t.length)return!1;let n=!0;for(let o=0;n&&o<e.length;o++)n=Yl(e[o],t[o]);return n}function Yl(e,t){if(e===t)return!0;let n=Wp(e),o=Wp(t);if(n||o)return n&&o?e.getTime()===t.getTime():!1;if(n=$r(e),o=$r(t),n||o)return e===t;if(n=rt(e),o=rt(t),n||o)return n&&o?NT(e,t):!1;if(n=Nt(e),o=Nt(t),n||o){if(!n||!o)return!1;const r=Object.keys(e).length,a=Object.keys(t).length;if(r!==a)return!1;for(const s in e){const i=e.hasOwnProperty(s),l=t.hasOwnProperty(s);if(i&&!l||!i&&l||!Yl(e[s],t[s]))return!1}}return String(e)===String(t)}function vv(e,t){return e.findIndex(n=>Yl(n,t))}const gv=e=>!!(e&&e.__v_isRef===!0),D=e=>Kt(e)?e:e==null?"":rt(e)||Nt(e)&&(e.toString===fv||!ht(e.toString))?gv(e)?D(e.value):JSON.stringify(e,yv,2):String(e),yv=(e,t)=>gv(t)?yv(e,t.value):Vi(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[o,r],a)=>(n[ad(o,a)+" =>"]=r,n),{})}:sc(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>ad(n))}:$r(t)?ad(t):Nt(t)&&!rt(t)&&!pv(t)?String(t):t,ad=(e,t="")=>{var n;return $r(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
|
|
7
|
+
* @vue/reactivity v3.5.40
|
|
8
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
9
|
+
* @license MIT
|
|
10
|
+
**/let Nn;class $T{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&&Nn&&(Nn.active?(this.parent=Nn,this.index=(Nn.scopes||(Nn.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes){const o=this.scopes.slice();for(t=0,n=o.length;t<n;t++)o[t].pause()}for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes){const r=this.scopes.slice();for(t=0,n=r.length;t<n;t++)r[t].resume()}const o=this.effects.slice();for(t=0,n=o.length;t<n;t++)o[t].resume()}}run(t){if(this._active){const n=Nn;try{return Nn=this,t()}finally{Nn=n}}}on(){++this._on===1&&(this.prevScope=Nn,Nn=this)}off(){if(this._on>0&&--this._on===0){if(Nn===this)Nn=this.prevScope;else{let t=Nn;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,o;for(n=0,o=this.effects.length;n<o;n++)this.effects[n].stop();for(this.effects.length=0,n=0,o=this.cleanups.length;n<o;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){const r=this.scopes.slice();for(n=0,o=r.length;n<o;n++)r[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}}function OT(){return Nn}let qt;const sd=new WeakSet;class wv{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,Nn&&(Nn.active?Nn.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,sd.has(this)&&(sd.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Tv(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Vp(this),Sv(this);const t=qt,n=jr;qt=this,jr=!0;try{return this.fn()}finally{Cv(this),qt=t,jr=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Af(t);this.deps=this.depsTail=void 0,Vp(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?sd.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Od(this)&&this.run()}get dirty(){return Od(this)}}let bv=0,jl,Ll;function Tv(e,t=!1){if(e.flags|=8,t){e.next=Ll,Ll=e;return}e.next=jl,jl=e}function kf(){bv++}function If(){if(--bv>0)return;if(Ll){let t=Ll;for(Ll=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;jl;){let t=jl;for(jl=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(o){e||(e=o)}t=n}}if(e)throw e}function Sv(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Cv(e){let t,n=e.depsTail,o=n;for(;o;){const r=o.prevDep;o.version===-1?(o===n&&(n=r),Af(o),DT(o)):t=o,o.dep.activeLink=o.prevActiveLink,o.prevActiveLink=void 0,o=r}e.deps=t,e.depsTail=n}function Od(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(xv(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function xv(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Bl)||(e.globalVersion=Bl,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Od(e))))return;e.flags|=2;const t=e.dep,n=qt,o=jr;qt=e,jr=!0;try{Sv(e);const r=e.fn(e._value);(t.version===0||Rr(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{qt=n,jr=o,Cv(e),e.flags&=-3}}function Af(e,t=!1){const{dep:n,prevSub:o,nextSub:r}=e;if(o&&(o.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=o,e.nextSub=void 0),n.subs===e&&(n.subs=o,!o&&n.computed)){n.computed.flags&=-5;for(let a=n.computed.deps;a;a=a.nextDep)Af(a,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function DT(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let jr=!0;const kv=[];function Va(){kv.push(jr),jr=!1}function Ka(){const e=kv.pop();jr=e===void 0?!0:e}function Vp(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=qt;qt=void 0;try{t()}finally{qt=n}}}let Bl=0;class FT{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 _f{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(!qt||!jr||qt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==qt)n=this.activeLink=new FT(qt,this),qt.deps?(n.prevDep=qt.depsTail,qt.depsTail.nextDep=n,qt.depsTail=n):qt.deps=qt.depsTail=n,Iv(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const o=n.nextDep;o.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=o),n.prevDep=qt.depsTail,n.nextDep=void 0,qt.depsTail.nextDep=n,qt.depsTail=n,qt.deps===n&&(qt.deps=o)}return n}trigger(t){this.version++,Bl++,this.notify(t)}notify(t){kf();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{If()}}}function Iv(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let o=t.deps;o;o=o.nextDep)Iv(o)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Dd=new WeakMap,gi=Symbol(""),Fd=Symbol(""),Ul=Symbol("");function Yn(e,t,n){if(jr&&qt){let o=Dd.get(e);o||Dd.set(e,o=new Map);let r=o.get(n);r||(o.set(n,r=new _f),r.map=o,r.key=n),r.track()}}function za(e,t,n,o,r,a){const s=Dd.get(e);if(!s){Bl++;return}const i=l=>{l&&l.trigger()};if(kf(),t==="clear")s.forEach(i);else{const l=rt(e),d=l&&Cf(n);if(l&&n==="length"){const c=Number(o);s.forEach((v,f)=>{(f==="length"||f===Ul||!$r(f)&&f>=c)&&i(v)})}else switch((n!==void 0||s.has(void 0))&&i(s.get(n)),d&&i(s.get(Ul)),t){case"add":l?d&&i(s.get("length")):(i(s.get(gi)),Vi(e)&&i(s.get(Fd)));break;case"delete":l||(i(s.get(gi)),Vi(e)&&i(s.get(Fd)));break;case"set":Vi(e)&&i(s.get(gi));break}}If()}function Di(e){const t=Pt(e);return t===e?t:(Yn(t,"iterate",Ul),rr(e)?t:t.map(Or))}function cc(e){return Yn(e=Pt(e),"iterate",Ul),e}function da(e,t){return Ya(e)?tl(yi(e)?Or(t):t):Or(t)}const BT={__proto__:null,[Symbol.iterator](){return id(this,Symbol.iterator,e=>da(this,e))},concat(...e){return Di(this).concat(...e.map(t=>rt(t)?Di(t):t))},entries(){return id(this,"entries",e=>(e[1]=da(this,e[1]),e))},every(e,t){return $a(this,"every",e,t,void 0,arguments)},filter(e,t){return $a(this,"filter",e,t,n=>n.map(o=>da(this,o)),arguments)},find(e,t){return $a(this,"find",e,t,n=>da(this,n),arguments)},findIndex(e,t){return $a(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return $a(this,"findLast",e,t,n=>da(this,n),arguments)},findLastIndex(e,t){return $a(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return $a(this,"forEach",e,t,void 0,arguments)},includes(...e){return ld(this,"includes",e)},indexOf(...e){return ld(this,"indexOf",e)},join(e){return Di(this).join(e)},lastIndexOf(...e){return ld(this,"lastIndexOf",e)},map(e,t){return $a(this,"map",e,t,void 0,arguments)},pop(){return Cl(this,"pop")},push(...e){return Cl(this,"push",e)},reduce(e,...t){return Kp(this,"reduce",e,t)},reduceRight(e,...t){return Kp(this,"reduceRight",e,t)},shift(){return Cl(this,"shift")},some(e,t){return $a(this,"some",e,t,void 0,arguments)},splice(...e){return Cl(this,"splice",e)},toReversed(){return Di(this).toReversed()},toSorted(e){return Di(this).toSorted(e)},toSpliced(...e){return Di(this).toSpliced(...e)},unshift(...e){return Cl(this,"unshift",e)},values(){return id(this,"values",e=>da(this,e))}};function id(e,t,n){const o=cc(e),r=o[t]();return o!==e&&!rr(e)&&(r._next=r.next,r.next=()=>{const a=r._next();return a.done||(a.value=n(a.value)),a}),r}const UT=Array.prototype;function $a(e,t,n,o,r,a){const s=cc(e),i=s!==e&&!rr(e),l=s[t];if(l!==UT[t]){const v=l.apply(e,a);return i?Or(v):v}let d=n;s!==e&&(i?d=function(v,f){return n.call(this,da(e,v),f,e)}:n.length>2&&(d=function(v,f){return n.call(this,v,f,e)}));const c=l.call(s,d,o);return i&&r?r(c):c}function Kp(e,t,n,o){const r=cc(e),a=r!==e&&!rr(e);let s=n,i=!1;r!==e&&(a?(i=o.length===0,s=function(d,c,v){return i&&(i=!1,d=da(e,d)),n.call(this,d,da(e,c),v,e)}):n.length>3&&(s=function(d,c,v){return n.call(this,d,c,v,e)}));const l=r[t](s,...o);return i?da(e,l):l}function ld(e,t,n){const o=Pt(e);Yn(o,"iterate",Ul);const r=o[t](...n);return(r===-1||r===!1)&&Ef(n[0])?(n[0]=Pt(n[0]),o[t](...n)):r}function Cl(e,t,n=[]){Va(),kf();const o=Pt(e)[t].apply(e,n);return If(),Ka(),o}const zT=Tf("__proto__,__v_isRef,__isVue"),Av=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter($r));function HT(e){$r(e)||(e=String(e));const t=Pt(this);return Yn(t,"has",e),t.hasOwnProperty(e)}class _v{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,o){if(n==="__v_skip")return t.__v_skip;const r=this._isReadonly,a=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return a;if(n==="__v_raw")return o===(r?a?ZT:Mv:a?Ev:Rv).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(o)?t:void 0;const s=rt(t);if(!r){let l;if(s&&(l=BT[n]))return l;if(n==="hasOwnProperty")return HT}const i=Reflect.get(t,n,Pn(t)?t:o);if(($r(n)?Av.has(n):zT(n))||(r||Yn(t,"get",n),a))return i;if(Pn(i)){const l=s&&Cf(n)?i:i.value;return r&&Nt(l)?Ud(l):l}return Nt(i)?r?Ud(i):dc(i):i}}class Pv extends _v{constructor(t=!1){super(!1,t)}set(t,n,o,r){let a=t[n];const s=rt(t)&&Cf(n);if(!this._isShallow){const d=Ya(a);if(!rr(o)&&!Ya(o)&&(a=Pt(a),o=Pt(o)),!s&&Pn(a)&&!Pn(o))return d||(a.value=o),!0}const i=s?Number(n)<t.length:Lt(t,n),l=Reflect.set(t,n,o,Pn(t)?t:r);return t===Pt(r)&&l&&(i?Rr(o,a)&&za(t,"set",n,o):za(t,"add",n,o)),l}deleteProperty(t,n){const o=Lt(t,n);t[n];const r=Reflect.deleteProperty(t,n);return r&&o&&za(t,"delete",n,void 0),r}has(t,n){const o=Reflect.has(t,n);return(!$r(n)||!Av.has(n))&&Yn(t,"has",n),o}ownKeys(t){return Yn(t,"iterate",rt(t)?"length":gi),Reflect.ownKeys(t)}}class qT extends _v{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const WT=new Pv,GT=new qT,VT=new Pv(!0);const Bd=e=>e,gu=e=>Reflect.getPrototypeOf(e);function KT(e,t,n){return function(...o){const r=this.__v_raw,a=Pt(r),s=Vi(a),i=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,d=r[e](...o),c=n?Bd:t?tl:Or;return!t&&Yn(a,"iterate",l?Fd:gi),mn(Object.create(d),{next(){const{value:v,done:f}=d.next();return f?{value:v,done:f}:{value:i?[c(v[0]),c(v[1])]:c(v),done:f}}})}}function yu(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function YT(e,t){const n={get(r){const a=this.__v_raw,s=Pt(a),i=Pt(r);e||(Rr(r,i)&&Yn(s,"get",r),Yn(s,"get",i));const{has:l}=gu(s),d=t?Bd:e?tl:Or;if(l.call(s,r))return d(a.get(r));if(l.call(s,i))return d(a.get(i));a!==s&&a.get(r)},get size(){const r=this.__v_raw;return!e&&Yn(Pt(r),"iterate",gi),r.size},has(r){const a=this.__v_raw,s=Pt(a),i=Pt(r);return e||(Rr(r,i)&&Yn(s,"has",r),Yn(s,"has",i)),r===i?a.has(r):a.has(r)||a.has(i)},forEach(r,a){const s=this,i=s.__v_raw,l=Pt(i),d=t?Bd:e?tl:Or;return!e&&Yn(l,"iterate",gi),i.forEach((c,v)=>r.call(a,d(c),d(v),s))}};return mn(n,e?{add:yu("add"),set:yu("set"),delete:yu("delete"),clear:yu("clear")}:{add(r){const a=Pt(this),s=gu(a),i=Pt(r),l=!t&&!rr(r)&&!Ya(r)?i:r;return s.has.call(a,l)||Rr(r,l)&&s.has.call(a,r)||Rr(i,l)&&s.has.call(a,i)||(a.add(l),za(a,"add",l,l)),this},set(r,a){!t&&!rr(a)&&!Ya(a)&&(a=Pt(a));const s=Pt(this),{has:i,get:l}=gu(s);let d=i.call(s,r);d||(r=Pt(r),d=i.call(s,r));const c=l.call(s,r);return s.set(r,a),d?Rr(a,c)&&za(s,"set",r,a):za(s,"add",r,a),this},delete(r){const a=Pt(this),{has:s,get:i}=gu(a);let l=s.call(a,r);l||(r=Pt(r),l=s.call(a,r)),i&&i.call(a,r);const d=a.delete(r);return l&&za(a,"delete",r,void 0),d},clear(){const r=Pt(this),a=r.size!==0,s=r.clear();return a&&za(r,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=KT(r,e,t)}),n}function Pf(e,t){const n=YT(e,t);return(o,r,a)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?o:Reflect.get(Lt(n,r)&&r in o?n:o,r,a)}const JT={get:Pf(!1,!1)},QT={get:Pf(!1,!0)},XT={get:Pf(!0,!1)};const Rv=new WeakMap,Ev=new WeakMap,Mv=new WeakMap,ZT=new WeakMap;function eS(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function dc(e){return Ya(e)?e:Rf(e,!1,WT,JT,Rv)}function jv(e){return Rf(e,!1,VT,QT,Ev)}function Ud(e){return Rf(e,!0,GT,XT,Mv)}function Rf(e,t,n,o,r){if(!Nt(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const a=r.get(e);if(a)return a;const s=eS(kT(e));if(s===0)return e;const i=new Proxy(e,s===2?o:n);return r.set(e,i),i}function yi(e){return Ya(e)?yi(e.__v_raw):!!(e&&e.__v_isReactive)}function Ya(e){return!!(e&&e.__v_isReadonly)}function rr(e){return!!(e&&e.__v_isShallow)}function Ef(e){return e?!!e.__v_raw:!1}function Pt(e){const t=e&&e.__v_raw;return t?Pt(t):e}function tS(e){return!Lt(e,"__v_skip")&&Object.isExtensible(e)&&hv(e,"__v_skip",!0),e}const Or=e=>Nt(e)?dc(e):e,tl=e=>Nt(e)?Ud(e):e;function Pn(e){return e?e.__v_isRef===!0:!1}function S(e){return Lv(e,!1)}function nS(e){return Lv(e,!0)}function Lv(e,t){return Pn(e)?e:new oS(e,t)}class oS{constructor(t,n){this.dep=new _f,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Pt(t),this._value=n?t:Or(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,o=this.__v_isShallow||rr(t)||Ya(t);t=o?t:Pt(t),Rr(t,n)&&(this._rawValue=t,this._value=o?t:Or(t),this.dep.trigger())}}function m(e){return Pn(e)?e.value:e}const rS={get:(e,t,n)=>t==="__v_raw"?e:m(Reflect.get(e,t,n)),set:(e,t,n,o)=>{const r=e[t];return Pn(r)&&!Pn(n)?(r.value=n,!0):Reflect.set(e,t,n,o)}};function Nv(e){return yi(e)?e:new Proxy(e,rS)}class aS{constructor(t,n,o){this.fn=t,this.setter=n,this._value=void 0,this.dep=new _f(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Bl-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=o}notify(){if(this.flags|=16,!(this.flags&8)&&qt!==this)return Tv(this,!0),!0}get value(){const t=this.dep.track();return xv(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function sS(e,t,n=!1){let o,r;return ht(e)?o=e:(o=e.get,r=e.set),new aS(o,r,n)}const wu={},Bu=new WeakMap;let di;function iS(e,t=!1,n=di){if(n){let o=Bu.get(n);o||Bu.set(n,o=[]),o.push(e)}}function lS(e,t,n=Bt){const{immediate:o,deep:r,once:a,scheduler:s,augmentJob:i,call:l}=n,d=q=>r?q:rr(q)||r===!1||r===0?Ha(q,1):Ha(q);let c,v,f,b,y=!1,P=!1;if(Pn(e)?(v=()=>e.value,y=rr(e)):yi(e)?(v=()=>d(e),y=!0):rt(e)?(P=!0,y=e.some(q=>yi(q)||rr(q)),v=()=>e.map(q=>{if(Pn(q))return q.value;if(yi(q))return d(q);if(ht(q))return l?l(q,2):q()})):ht(e)?t?v=l?()=>l(e,2):e:v=()=>{if(f){Va();try{f()}finally{Ka()}}const q=di;di=c;try{return l?l(e,3,[b]):e(b)}finally{di=q}}:v=pa,t&&r){const q=v,be=r===!0?1/0:r;v=()=>Ha(q(),be)}const B=OT(),$=()=>{c.stop(),B&&B.active&&Sf(B.effects,c)};if(a&&t){const q=t;t=(...be)=>{const ce=q(...be);return $(),ce}}let j=P?new Array(e.length).fill(wu):wu;const H=q=>{if(!(!(c.flags&1)||!c.dirty&&!q))if(t){const be=c.run();if(q||r||y||(P?be.some((ce,W)=>Rr(ce,j[W])):Rr(be,j))){f&&f();const ce=di;di=c;try{const W=[be,j===wu?void 0:P&&j[0]===wu?[]:j,b];j=be,l?l(t,3,W):t(...W)}finally{di=ce}}}else c.run()};return i&&i(H),c=new wv(v),c.scheduler=s?()=>s(H,!1):H,b=q=>iS(q,!1,c),f=c.onStop=()=>{const q=Bu.get(c);if(q){if(l)l(q,4);else for(const be of q)be();Bu.delete(c)}},t?o?H(!0):j=c.run():s?s(H.bind(null,!0),!0):c.run(),$.pause=c.pause.bind(c),$.resume=c.resume.bind(c),$.stop=$,$}function Ha(e,t=1/0,n){if(t<=0||!Nt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Pn(e))Ha(e.value,t,n);else if(rt(e))for(let o=0;o<e.length;o++)Ha(e[o],t,n);else if(sc(e)||Vi(e))e.forEach(o=>{Ha(o,t,n)});else if(pv(e)){for(const o in e)Ha(e[o],t,n);for(const o of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,o)&&Ha(e[o],t,n)}return e}/**
|
|
11
|
+
* @vue/runtime-core v3.5.40
|
|
12
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
13
|
+
* @license MIT
|
|
14
|
+
**/function Jl(e,t,n,o){try{return o?e(...o):e()}catch(r){Ql(r,t,n)}}function sr(e,t,n,o){if(ht(e)){const r=Jl(e,t,n,o);return r&&dv(r)&&r.catch(a=>{Ql(a,t,n)}),r}if(rt(e)){const r=[];for(let a=0;a<e.length;a++)r.push(sr(e[a],t,n,o));return r}}function Ql(e,t,n,o=!0){const r=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Bt;if(t){let i=t.parent;const l=t.proxy,d=`https://vuejs.org/error-reference/#runtime-${n}`;for(;i;){const c=i.ec;if(c){for(let v=0;v<c.length;v++)if(c[v](e,l,d)===!1)return}i=i.parent}if(a){Va(),Jl(a,null,10,[e,l,d]),Ka();return}}uS(e,n,r,o,s)}function uS(e,t,n,o=!0,r=!1){if(r)throw e;console.error(e)}const co=[];let ca=-1;const Ki=[];let As=null,Ui=0;const $v=Promise.resolve();let Uu=null;function Ft(e){const t=Uu||$v;return e?t.then(this?e.bind(this):e):t}function cS(e){let t=ca+1,n=co.length;for(;t<n;){const o=t+n>>>1,r=co[o],a=zl(r);a<e||a===e&&r.flags&2?t=o+1:n=o}return t}function Mf(e){if(!(e.flags&1)){const t=zl(e),n=co[co.length-1];!n||!(e.flags&2)&&t>=zl(n)?co.push(e):co.splice(cS(t),0,e),e.flags|=1,Ov()}}function Ov(){Uu||(Uu=$v.then(Fv))}function dS(e){rt(e)?Ki.push(...e):As&&e.id===-1?As.splice(Ui+1,0,e):e.flags&1||(Ki.push(e),e.flags|=1),Ov()}function Yp(e,t,n=ca+1){for(;n<co.length;n++){const o=co[n];if(o&&o.flags&2){if(e&&o.id!==e.uid)continue;co.splice(n,1),n--,o.flags&4&&(o.flags&=-2),o(),o.flags&4||(o.flags&=-2)}}}function Dv(e){if(Ki.length){const t=[...new Set(Ki)].sort((n,o)=>zl(n)-zl(o));if(Ki.length=0,As){As.push(...t);return}for(As=t,Ui=0;Ui<As.length;Ui++){const n=As[Ui];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}As=null,Ui=0}}const zl=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Fv(e){try{for(ca=0;ca<co.length;ca++){const t=co[ca];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Jl(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;ca<co.length;ca++){const t=co[ca];t&&(t.flags&=-2)}ca=-1,co.length=0,Dv(),Uu=null,(co.length||Ki.length)&&Fv()}}let Fn=null,Bv=null;function zu(e){const t=Fn;return Fn=e,Bv=e&&e.type.__scopeId||null,t}function pt(e,t=Fn,n){if(!t||e._n)return e;const o=(...r)=>{o._d&&Wu(-1);const a=zu(t),s=qa.length;let i;try{i=e(...r)}finally{for(let l=qa.length;l>s;l--)Df();zu(a),o._d&&Wu(1)}return i};return o._n=!0,o._c=!0,o._d=!0,o}function _n(e,t){if(Fn===null)return e;const n=mc(Fn),o=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[a,s,i,l=Bt]=t[r];a&&(ht(a)&&(a={mounted:a,updated:a}),a.deep&&Ha(s),o.push({dir:a,instance:n,value:s,oldValue:void 0,arg:i,modifiers:l}))}return e}function si(e,t,n,o){const r=e.dirs,a=t&&t.dirs;for(let s=0;s<r.length;s++){const i=r[s];a&&(i.oldValue=a[s].value);let l=i.dir[o];l&&(Va(),sr(l,n,8,[e.el,i,e,t]),Ka())}}function Lu(e,t){if(Dn){let n=Dn.provides;const o=Dn.parent&&Dn.parent.provides;o===n&&(n=Dn.provides=Object.create(o)),n[e]=t}}function Lr(e,t,n=!1){const o=Bf();if(o||Ji){let r=Ji?Ji._context.provides:o?o.parent==null||o.ce?o.vnode.appContext&&o.vnode.appContext.provides:o.parent.provides:void 0;if(r&&e in r)return r[e];if(arguments.length>1)return n&&ht(t)?t.call(o&&o.proxy):t}}const fS=Symbol.for("v-scx"),pS=()=>Lr(fS);function ot(e,t,n){return Uv(e,t,n)}function Uv(e,t,n=Bt){const{immediate:o,deep:r,flush:a,once:s}=n,i=mn({},n),l=t&&o||!t&&a!=="post";let d;if(rl){if(a==="sync"){const b=pS();d=b.__watcherHandles||(b.__watcherHandles=[])}else if(!l){const b=()=>{};return b.stop=pa,b.resume=pa,b.pause=pa,b}}const c=Dn;i.call=(b,y,P)=>sr(b,c,y,P);let v=!1;a==="post"?i.scheduler=b=>{lo(b,c&&c.suspense)}:a!=="sync"&&(v=!0,i.scheduler=(b,y)=>{y?b():Mf(b)}),i.augmentJob=b=>{t&&(b.flags|=4),v&&(b.flags|=2,c&&(b.id=c.uid,b.i=c))};const f=lS(e,t,i);return rl&&(d?d.push(f):l&&f()),f}function hS(e,t,n){const o=this.proxy,r=Kt(e)?e.includes(".")?zv(o,e):()=>o[e]:e.bind(o,o);let a;ht(t)?a=t:(a=t.handler,n=t);const s=eu(this),i=Uv(r,a.bind(o),n);return s(),i}function zv(e,t){const n=t.split(".");return()=>{let o=e;for(let r=0;r<n.length&&o;r++)o=o[n[r]];return o}}const xs=new WeakMap,Hv=Symbol("_vte"),qv=e=>e.__isTeleport,pi=e=>e&&(e.disabled||e.disabled===""),mS=e=>e&&(e.defer||e.defer===""),Jp=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Qp=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,zd=(e,t)=>{const n=e&&e.to;return Kt(n)?t?t(n):null:n},vS={name:"Teleport",__isTeleport:!0,process(e,t,n,o,r,a,s,i,l,d){const{mc:c,pc:v,pbc:f,o:{insert:b,querySelector:y,createText:P,createComment:B,parentNode:$}}=d,j=pi(t.props);let{dynamicChildren:H}=t;const q=(W,he,Se)=>{W.shapeFlag&16&&c(W.children,he,Se,r,a,s,i,l)},be=(W=t)=>{const he=pi(W.props),Se=W.target=zd(W.props,y),_e=Hd(Se,W,P,b);Se&&(s!=="svg"&&Jp(Se)?s="svg":s!=="mathml"&&Qp(Se)&&(s="mathml"),r&&r.isCE&&(r.ce._teleportTargets||(r.ce._teleportTargets=new Set)).add(Se),he||(q(W,Se,_e),_l(W,!1)))},ce=W=>{const he=()=>{if(xs.get(W)===he){if(xs.delete(W),pi(W.props)){const Se=$(W.el)||n;q(W,Se,W.anchor),_l(W,!0)}be(W)}};xs.set(W,he),lo(he,a)};if(e==null){const W=t.el=P(""),he=t.anchor=P("");if(b(W,n,o),b(he,n,o),mS(t.props)||a&&a.pendingBranch){ce(t);return}j&&(q(t,n,he),_l(t,!0)),be()}else{t.el=e.el;const W=t.anchor=e.anchor,he=xs.get(e);if(he){he.flags|=8,xs.delete(e),ce(t);return}t.targetStart=e.targetStart;const Se=t.target=e.target,_e=t.targetAnchor=e.targetAnchor,ye=pi(e.props),X=ye?n:Se,pe=ye?W:_e;if(s==="svg"||Jp(Se)?s="svg":(s==="mathml"||Qp(Se))&&(s="mathml"),H?(f(e.dynamicChildren,H,X,r,a,s,i),Of(e,t,!0)):l||v(e,t,X,pe,r,a,s,i,!1),j)ye?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):bu(t,n,W,d,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const re=zd(t.props,y);re&&(t.target=re,bu(t,re,null,d,0))}else ye&&bu(t,Se,_e,d,1);_l(t,j)}},remove(e,t,n,{um:o,o:{remove:r}},a){const{shapeFlag:s,children:i,anchor:l,targetStart:d,targetAnchor:c,target:v,props:f}=e,b=pi(f),y=a||!b,P=xs.get(e);if(P&&(P.flags|=8,xs.delete(e)),v&&(r(d),r(c)),a&&r(l),!P&&(b||v)&&s&16)for(let B=0;B<i.length;B++){const $=i[B];o($,t,n,y,!!$.dynamicChildren)}},move:bu,hydrate:gS};function bu(e,t,n,{o:{insert:o},m:r},a=2){a===0&&o(e.targetAnchor,t,n);const{el:s,anchor:i,shapeFlag:l,children:d,props:c}=e,v=a===2;if(v&&o(s,t,n),!xs.has(e)&&(!v||pi(c))&&l&16)for(let f=0;f<d.length;f++)r(d[f],t,n,2);v&&o(i,t,n)}function gS(e,t,n,o,r,a,{o:{nextSibling:s,parentNode:i,querySelector:l,insert:d,createText:c}},v){function f(B,$){let j=$;for(;j;){if(j&&j.nodeType===8){if(j.data==="teleport start anchor")t.targetStart=j;else if(j.data==="teleport anchor"){t.targetAnchor=j,B._lpa=t.targetAnchor&&s(t.targetAnchor);break}}j=s(j)}}function b(B,$){$.anchor=v(s(B),$,i(B),n,o,r,a)}const y=t.target=zd(t.props,l),P=pi(t.props);if(y){const B=y._lpa||y.firstChild;t.shapeFlag&16&&(P?(b(e,t),f(y,B),t.targetAnchor||Hd(y,t,c,d,i(e)===y?e:null)):(t.anchor=s(e),f(y,B),t.targetAnchor||Hd(y,t,c,d),v(B&&s(B),t,y,n,o,r,a))),_l(t,P)}else P&&t.shapeFlag&16&&(b(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}const nl=vS;function _l(e,t){const n=e.ctx;if(n&&n.ut){let o,r;for(t?(o=e.el,r=e.anchor):(o=e.targetStart,r=e.targetAnchor);o&&o!==r;)o.nodeType===1&&o.setAttribute("data-v-owner",n.uid),o=o.nextSibling;n.ut()}}function Hd(e,t,n,o,r=null){const a=t.targetStart=n(""),s=t.targetAnchor=n("");return a[Hv]=s,e&&(o(a,e,r),o(s,e,r)),s}const nr=Symbol("_leaveCb"),xl=Symbol("_enterCb");function yS(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Ti(()=>{e.isMounted=!0}),Fs(()=>{e.isUnmounting=!0}),e}const tr=[Function,Array],Wv={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:tr,onEnter:tr,onAfterEnter:tr,onEnterCancelled:tr,onBeforeLeave:tr,onLeave:tr,onAfterLeave:tr,onLeaveCancelled:tr,onBeforeAppear:tr,onAppear:tr,onAfterAppear:tr,onAppearCancelled:tr},Gv=e=>{const t=e.subTree;return t.component?Gv(t.component):t},wS={name:"BaseTransition",props:Wv,setup(e,{slots:t}){const n=Bf(),o=yS();return()=>{const r=t.default&&Yv(t.default(),!0),a=r&&r.length?Vv(r):n.subTree?ve():void 0;if(!a)return;const s=Pt(e),{mode:i}=s;if(o.isLeaving)return ud(a);const l=Xp(a);if(!l)return ud(a);let d=qd(l,s,o,n,v=>d=v);l.type!==Jn&&Hl(l,d);let c=n.subTree&&Xp(n.subTree);if(c&&c.type!==Jn&&!hi(c,l)&&Gv(n).type!==Jn){let v=qd(c,s,o,n);if(Hl(c,v),i==="out-in"&&l.type!==Jn)return o.isLeaving=!0,v.afterLeave=()=>{o.isLeaving=!1,n.job.flags&8||n.update(),delete v.afterLeave,c=void 0},ud(a);i==="in-out"&&l.type!==Jn?v.delayLeave=(f,b,y)=>{const P=Kv(o,c);P[String(c.key)]=c,f[nr]=()=>{b(),f[nr]=void 0,delete d.delayedLeave,c=void 0},d.delayedLeave=()=>{y(),delete d.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return a}}};function Vv(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Jn){t=n;break}}return t}const bS=wS;function Kv(e,t){const{leavingVNodes:n}=e;let o=n.get(t.type);return o||(o=Object.create(null),n.set(t.type,o)),o}function qd(e,t,n,o,r){const{appear:a,mode:s,persisted:i=!1,onBeforeEnter:l,onEnter:d,onAfterEnter:c,onEnterCancelled:v,onBeforeLeave:f,onLeave:b,onAfterLeave:y,onLeaveCancelled:P,onBeforeAppear:B,onAppear:$,onAfterAppear:j,onAppearCancelled:H}=t,q=String(e.key),be=Kv(n,e),ce=(Se,_e)=>{Se&&sr(Se,o,9,_e)},W=(Se,_e)=>{const ye=_e[1];ce(Se,_e),rt(Se)?Se.every(X=>X.length<=1)&&ye():Se.length<=1&&ye()},he={mode:s,persisted:i,beforeEnter(Se){let _e=l;if(!n.isMounted)if(a)_e=B||l;else return;Se[nr]&&Se[nr](!0);const ye=be[q];ye&&hi(e,ye)&&ye.el[nr]&&ye.el[nr](),ce(_e,[Se])},enter(Se){if(be[q]===e)return;let _e=d,ye=c,X=v;if(!n.isMounted)if(a)_e=$||d,ye=j||c,X=H||v;else return;let pe=!1;Se[xl]=xe=>{pe||(pe=!0,xe?ce(X,[Se]):ce(ye,[Se]),he.delayedLeave&&he.delayedLeave(),Se[xl]=void 0)};const re=Se[xl].bind(null,!1);_e?W(_e,[Se,re]):re()},leave(Se,_e){const ye=String(e.key);if(Se[xl]&&Se[xl](!0),n.isUnmounting)return _e();ce(f,[Se]);let X=!1;Se[nr]=re=>{X||(X=!0,_e(),re?ce(P,[Se]):ce(y,[Se]),Se[nr]=void 0,be[ye]===e&&delete be[ye])};const pe=Se[nr].bind(null,!1);be[ye]=e,b?W(b,[Se,pe]):pe()},clone(Se){const _e=qd(Se,t,n,o,r);return r&&r(_e),_e}};return he}function ud(e){if(Xl(e))return e=Os(e),e.children=null,e}function Xp(e){if(!Xl(e))return qv(e.type)&&e.children?Vv(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&&ht(n.default))return n.default()}}function Hl(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Hl(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 Yv(e,t=!1,n){let o=[],r=0;for(let a=0;a<e.length;a++){let s=e[a];const i=n==null?s.key:String(n)+String(s.key!=null?s.key:a);s.type===lt?(s.patchFlag&128&&r++,o=o.concat(Yv(s.children,t,i))):(t||s.type!==Jn)&&o.push(i!=null?Os(s,{key:i}):s)}if(r>1)for(let a=0;a<o.length;a++)o[a].patchFlag=-2;return o}function vn(e,t){return ht(e)?mn({name:e.name},t,{setup:e}):e}function jf(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Zp(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Hu=new WeakMap;function Nl(e,t,n,o,r=!1){if(rt(e)){e.forEach((P,B)=>Nl(P,t&&(rt(t)?t[B]:t),n,o,r));return}if(Yi(o)&&!r){o.shapeFlag&512&&o.type.__asyncResolved&&o.component.subTree.component&&Nl(e,t,n,o.component.subTree);return}const a=o.shapeFlag&4?mc(o.component):o.el,s=r?null:a,{i,r:l}=e,d=t&&t.r,c=i.refs===Bt?i.refs={}:i.refs,v=i.setupState,f=Pt(v),b=v===Bt?cv:P=>Zp(c,P)?!1:Lt(f,P),y=(P,B)=>!(B&&Zp(c,B));if(d!=null&&d!==l){if(eh(t),Kt(d))c[d]=null,b(d)&&(v[d]=null);else if(Pn(d)){const P=t;y(d,P.k)&&(d.value=null),P.k&&(c[P.k]=null)}}if(ht(l))Jl(l,i,12,[s,c]);else{const P=Kt(l),B=Pn(l);if(P||B){const $=()=>{if(e.f){const j=P?b(l)?v[l]:c[l]:y()||!e.k?l.value:c[e.k];if(r)rt(j)&&Sf(j,a);else if(rt(j))j.includes(a)||j.push(a);else if(P)c[l]=[a],b(l)&&(v[l]=c[l]);else{const H=[a];y(l,e.k)&&(l.value=H),e.k&&(c[e.k]=H)}}else P?(c[l]=s,b(l)&&(v[l]=s)):B&&(y(l,e.k)&&(l.value=s),e.k&&(c[e.k]=s))};if(s){const j=()=>{$(),Hu.delete(e)};j.id=-1,Hu.set(e,j),lo(j,n)}else eh(e),$()}}}function eh(e){const t=Hu.get(e);t&&(t.flags|=8,Hu.delete(e))}const th=e=>e.nodeType===8;uc().requestIdleCallback;uc().cancelIdleCallback;function TS(e,t){if(th(e)&&e.data==="["){let n=1,o=e.nextSibling;for(;o;){if(o.nodeType===1){if(t(o)===!1)break}else if(th(o))if(o.data==="]"){if(--n===0)break}else o.data==="["&&n++;o=o.nextSibling}}else t(e)}const Yi=e=>!!e.type.__asyncLoader;function Ar(e){ht(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:o,delay:r=200,hydrate:a,timeout:s,suspensible:i=!0,onError:l}=e;let d=null,c,v=0;const f=()=>(v++,d=null,b()),b=()=>{let y;return d||(y=d=t().catch(P=>{if(P=P instanceof Error?P:new Error(String(P)),l)return new Promise((B,$)=>{l(P,()=>B(f()),()=>$(P),v+1)});throw P}).then(P=>y!==d&&d?d:(P&&(P.__esModule||P[Symbol.toStringTag]==="Module")&&(P=P.default),c=P,P)))};return vn({name:"AsyncComponentWrapper",__asyncLoader:b,__asyncHydrate(y,P,B){const $=y.isConnected;let j=!1;(P.bu||(P.bu=[])).push(()=>j=!0);const H=()=>{j||!y.parentNode||$&&!y.isConnected||B()},q=a?()=>{const be=a(H,ce=>TS(y,ce));be&&(P.bum||(P.bum=[])).push(be)}:H;c?q():b().then(()=>!P.isUnmounted&&q())},get __asyncResolved(){return c},setup(){const y=Dn;if(jf(y),c)return()=>Tu(c,y);const P=be=>{d=null,Ql(be,y,13,!o)};if(i&&y.suspense||rl)return b().then(be=>()=>Tu(be,y)).catch(be=>(P(be),()=>o?Fe(o,{error:be}):null));const B=S(!1),$=S(),j=S(!!r);let H,q;return Zl(()=>{H!=null&&clearTimeout(H),q!=null&&clearTimeout(q)}),r&&(q=setTimeout(()=>{y.isUnmounted||(j.value=!1)},r)),s!=null&&(H=setTimeout(()=>{if(!y.isUnmounted&&!B.value&&!$.value){const be=new Error(`Async component timed out after ${s}ms.`);P(be),$.value=be}},s)),b().then(()=>{y.isUnmounted||(B.value=!0,y.parent&&Xl(y.parent.vnode)&&y.parent.update())}).catch(be=>{if(y.isUnmounted){d=null;return}P(be),$.value=be}),()=>{if(B.value&&c)return Tu(c,y);if($.value&&o)return Fe(o,{error:$.value});if(n&&!j.value)return Tu(n,y)}}})}function Tu(e,t){const{ref:n,props:o,children:r,ce:a}=t.vnode,s=Fe(e,o,r);return s.ref=n,s.ce=a,delete t.vnode.ce,s}const Xl=e=>e.type.__isKeepAlive;function SS(e,t){Jv(e,"a",t)}function CS(e,t){Jv(e,"da",t)}function Jv(e,t,n=Dn){const o=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(fc(t,o,n),n){let r=n.parent;for(;r&&r.parent;)Xl(r.parent.vnode)&&xS(o,t,n,r),r=r.parent}}function xS(e,t,n,o){const r=fc(t,e,o,!0);Zl(()=>{Sf(o[t],r)},n)}function fc(e,t,n=Dn,o=!1){if(n){const r=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=(...s)=>{Va();const i=eu(n),l=sr(t,n,e,s);return i(),Ka(),l});return o?r.unshift(a):r.push(a),a}}const Qa=e=>(t,n=Dn)=>{(!rl||e==="sp")&&fc(e,(...o)=>t(...o),n)},kS=Qa("bm"),Ti=Qa("m"),IS=Qa("bu"),AS=Qa("u"),Fs=Qa("bum"),Zl=Qa("um"),_S=Qa("sp"),PS=Qa("rtg"),RS=Qa("rtc");function ES(e,t=Dn){fc("ec",e,t)}const MS="components",Qv=Symbol.for("v-ndc");function Lf(e){return Kt(e)?jS(MS,e,!1)||e:e||Qv}function jS(e,t,n=!0,o=!1){const r=Fn||Dn;if(r){const a=r.type;{const i=v0(a,!1);if(i&&(i===t||i===po(t)||i===lc(po(t))))return a}const s=nh(r[e]||a[e],t)||nh(r.appContext[e],t);return!s&&o?a:s}}function nh(e,t){return e&&(e[t]||e[po(t)]||e[lc(po(t))])}function en(e,t,n,o){let r;const a=n,s=rt(e);if(s||Kt(e)){const i=s&&yi(e);let l=!1,d=!1;i&&(l=!rr(e),d=Ya(e),e=cc(e)),r=new Array(e.length);for(let c=0,v=e.length;c<v;c++)r[c]=t(l?d?tl(Or(e[c])):Or(e[c]):e[c],c,void 0,a)}else if(typeof e=="number"){r=new Array(e);for(let i=0;i<e;i++)r[i]=t(i+1,i,void 0,a)}else if(Nt(e))if(e[Symbol.iterator])r=Array.from(e,(i,l)=>t(i,l,void 0,a));else{const i=Object.keys(e);r=new Array(i.length);for(let l=0,d=i.length;l<d;l++){const c=i[l];r[l]=t(e[c],c,l,a)}}else r=[];return r}function ko(e,t,n={},o,r,a){if(Fn.ce||Fn.parent&&Yi(Fn.parent)&&Fn.parent.ce){const d=a!=null&&n.key==null?mn({},n,{key:a}):n,c=Object.keys(d).length>0;return t!=="default"&&(d.name=t),_(),Qe(lt,null,[Fe("slot",d,o)],c?-2:64)}let s=e[t];s&&s._c&&(s._d=!1);const i=qa.length;_();let l;try{const d=s&&Xv(s(n)),c=n.key||a||d&&d.key;l=Qe(lt,{key:(c&&!$r(c)?c:`_${t}`)+(!d&&o?"_fb":"")},d||(o?o():[]),d&&e._===1?64:-2)}catch(d){for(let c=qa.length;c>i;c--)Df();throw d}finally{s&&s._c&&(s._d=!0)}return l}function Xv(e){return e.some(t=>ql(t)?!(t.type===Jn||t.type===lt&&!Xv(t.children)):!0)?e:null}const Wd=e=>e?gg(e)?mc(e):Wd(e.parent):null,$l=mn(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=>Wd(e.parent),$root:e=>Wd(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>eg(e),$forceUpdate:e=>e.f||(e.f=()=>{Mf(e.update)}),$nextTick:e=>e.n||(e.n=Ft.bind(e.proxy)),$watch:e=>hS.bind(e)}),cd=(e,t)=>e!==Bt&&!e.__isScriptSetup&&Lt(e,t),LS={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:o,data:r,props:a,accessCache:s,type:i,appContext:l}=e;if(t[0]!=="$"){const f=s[t];if(f!==void 0)switch(f){case 1:return o[t];case 2:return r[t];case 4:return n[t];case 3:return a[t]}else{if(cd(o,t))return s[t]=1,o[t];if(r!==Bt&&Lt(r,t))return s[t]=2,r[t];if(Lt(a,t))return s[t]=3,a[t];if(n!==Bt&&Lt(n,t))return s[t]=4,n[t];Gd&&(s[t]=0)}}const d=$l[t];let c,v;if(d)return t==="$attrs"&&Yn(e.attrs,"get",""),d(e);if((c=i.__cssModules)&&(c=c[t]))return c;if(n!==Bt&&Lt(n,t))return s[t]=4,n[t];if(v=l.config.globalProperties,Lt(v,t))return v[t]},set({_:e},t,n){const{data:o,setupState:r,ctx:a}=e;return cd(r,t)?(r[t]=n,!0):o!==Bt&&Lt(o,t)?(o[t]=n,!0):Lt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:o,appContext:r,props:a,type:s}},i){let l;return!!(n[i]||e!==Bt&&i[0]!=="$"&&Lt(e,i)||cd(t,i)||Lt(a,i)||Lt(o,i)||Lt($l,i)||Lt(r.config.globalProperties,i)||(l=s.__cssModules)&&l[i])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Lt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function NS(){return $S().slots}function $S(e){const t=Bf();return t.setupContext||(t.setupContext=wg(t))}function oh(e){return rt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Gd=!0;function OS(e){const t=eg(e),n=e.proxy,o=e.ctx;Gd=!1,t.beforeCreate&&rh(t.beforeCreate,e,"bc");const{data:r,computed:a,methods:s,watch:i,provide:l,inject:d,created:c,beforeMount:v,mounted:f,beforeUpdate:b,updated:y,activated:P,deactivated:B,beforeDestroy:$,beforeUnmount:j,destroyed:H,unmounted:q,render:be,renderTracked:ce,renderTriggered:W,errorCaptured:he,serverPrefetch:Se,expose:_e,inheritAttrs:ye,components:X,directives:pe,filters:re}=t;if(d&&DS(d,o,null),s)for(const Ne in s){const ae=s[Ne];ht(ae)&&(o[Ne]=ae.bind(n))}if(r){const Ne=r.call(n,n);Nt(Ne)&&(e.data=dc(Ne))}if(Gd=!0,a)for(const Ne in a){const ae=a[Ne],Ee=ht(ae)?ae.bind(n,n):ht(ae.get)?ae.get.bind(n,n):pa,ke=!ht(ae)&&ht(ae.set)?ae.set.bind(n):pa,Ie=Y({get:Ee,set:ke});Object.defineProperty(o,Ne,{enumerable:!0,configurable:!0,get:()=>Ie.value,set:ze=>Ie.value=ze})}if(i)for(const Ne in i)Zv(i[Ne],o,n,Ne);if(l){const Ne=ht(l)?l.call(n):l;Reflect.ownKeys(Ne).forEach(ae=>{Lu(ae,Ne[ae])})}c&&rh(c,e,"c");function $e(Ne,ae){rt(ae)?ae.forEach(Ee=>Ne(Ee.bind(n))):ae&&Ne(ae.bind(n))}if($e(kS,v),$e(Ti,f),$e(IS,b),$e(AS,y),$e(SS,P),$e(CS,B),$e(ES,he),$e(RS,ce),$e(PS,W),$e(Fs,j),$e(Zl,q),$e(_S,Se),rt(_e))if(_e.length){const Ne=e.exposed||(e.exposed={});_e.forEach(ae=>{Object.defineProperty(Ne,ae,{get:()=>n[ae],set:Ee=>n[ae]=Ee,enumerable:!0})})}else e.exposed||(e.exposed={});be&&e.render===pa&&(e.render=be),ye!=null&&(e.inheritAttrs=ye),X&&(e.components=X),pe&&(e.directives=pe),Se&&jf(e)}function DS(e,t,n=pa){rt(e)&&(e=Vd(e));for(const o in e){const r=e[o];let a;Nt(r)?"default"in r?a=Lr(r.from||o,r.default,!0):a=Lr(r.from||o):a=Lr(r),Pn(a)?Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get:()=>a.value,set:s=>a.value=s}):t[o]=a}}function rh(e,t,n){sr(rt(e)?e.map(o=>o.bind(t.proxy)):e.bind(t.proxy),t,n)}function Zv(e,t,n,o){let r=o.includes(".")?zv(n,o):()=>n[o];if(Kt(e)){const a=t[e];ht(a)&&ot(r,a)}else if(ht(e))ot(r,e.bind(n));else if(Nt(e))if(rt(e))e.forEach(a=>Zv(a,t,n,o));else{const a=ht(e.handler)?e.handler.bind(n):t[e.handler];ht(a)&&ot(r,a,e)}}function eg(e){const t=e.type,{mixins:n,extends:o}=t,{mixins:r,optionsCache:a,config:{optionMergeStrategies:s}}=e.appContext,i=a.get(t);let l;return i?l=i:!r.length&&!n&&!o?l=t:(l={},r.length&&r.forEach(d=>qu(l,d,s,!0)),qu(l,t,s)),Nt(t)&&a.set(t,l),l}function qu(e,t,n,o=!1){const{mixins:r,extends:a}=t;a&&qu(e,a,n,!0),r&&r.forEach(s=>qu(e,s,n,!0));for(const s in t)if(!(o&&s==="expose")){const i=FS[s]||n&&n[s];e[s]=i?i(e[s],t[s]):t[s]}return e}const FS={data:ah,props:sh,emits:sh,methods:Pl,computed:Pl,beforeCreate:io,created:io,beforeMount:io,mounted:io,beforeUpdate:io,updated:io,beforeDestroy:io,beforeUnmount:io,destroyed:io,unmounted:io,activated:io,deactivated:io,errorCaptured:io,serverPrefetch:io,components:Pl,directives:Pl,watch:US,provide:ah,inject:BS};function ah(e,t){return t?e?function(){return mn(ht(e)?e.call(this,this):e,ht(t)?t.call(this,this):t)}:t:e}function BS(e,t){return Pl(Vd(e),Vd(t))}function Vd(e){if(rt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function io(e,t){return e?[...new Set([].concat(e,t))]:t}function Pl(e,t){return e?mn(Object.create(null),e,t):t}function sh(e,t){return e?rt(e)&&rt(t)?[...new Set([...e,...t])]:mn(Object.create(null),oh(e),oh(t??{})):t}function US(e,t){if(!e)return t;if(!t)return e;const n=mn(Object.create(null),e);for(const o in t)n[o]=io(e[o],t[o]);return n}function tg(){return{app:null,config:{isNativeTag:cv,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let zS=0;function HS(e,t){return function(o,r=null){ht(o)||(o=mn({},o)),r!=null&&!Nt(r)&&(r=null);const a=tg(),s=new WeakSet,i=[];let l=!1;const d=a.app={_uid:zS++,_component:o,_props:r,_container:null,_context:a,_instance:null,version:w0,get config(){return a.config},set config(c){},use(c,...v){return s.has(c)||(c&&ht(c.install)?(s.add(c),c.install(d,...v)):ht(c)&&(s.add(c),c(d,...v))),d},mixin(c){return a.mixins.includes(c)||a.mixins.push(c),d},component(c,v){return v?(a.components[c]=v,d):a.components[c]},directive(c,v){return v?(a.directives[c]=v,d):a.directives[c]},mount(c,v,f){if(!l){const b=d._ceVNode||Fe(o,r);return b.appContext=a,f===!0?f="svg":f===!1&&(f=void 0),e(b,c,f),l=!0,d._container=c,c.__vue_app__=d,mc(b.component)}},onUnmount(c){i.push(c)},unmount(){l&&(sr(i,d._instance,16),e(null,d._container),delete d._container.__vue_app__)},provide(c,v){return a.provides[c]=v,d},runWithContext(c){const v=Ji;Ji=d;try{return c()}finally{Ji=v}}};return d}}let Ji=null;const qS=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${po(t)}Modifiers`]||e[`${Ds(t)}Modifiers`];function WS(e,t,...n){if(e.isUnmounted)return;const o=e.vnode.props||Bt;let r=n;const a=t.startsWith("update:"),s=a&&qS(o,t.slice(7));s&&(s.trim&&(r=n.map(c=>Kt(c)?c.trim():c)),s.number&&(r=n.map(xf)));let i,l=o[i=rd(t)]||o[i=rd(po(t))];!l&&a&&(l=o[i=rd(Ds(t))]),l&&sr(l,e,6,r);const d=o[i+"Once"];if(d){if(!e.emitted)e.emitted={};else if(e.emitted[i])return;e.emitted[i]=!0,sr(d,e,6,r)}}const GS=new WeakMap;function ng(e,t,n=!1){const o=n?GS:t.emitsCache,r=o.get(e);if(r!==void 0)return r;const a=e.emits;let s={},i=!1;if(!ht(e)){const l=d=>{const c=ng(d,t,!0);c&&(i=!0,mn(s,c))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!a&&!i?(Nt(e)&&o.set(e,null),null):(rt(a)?a.forEach(l=>s[l]=null):mn(s,a),Nt(e)&&o.set(e,s),s)}function pc(e,t){return!e||!rc(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),Lt(e,t[0].toLowerCase()+t.slice(1))||Lt(e,Ds(t))||Lt(e,t))}function ih(e){const{type:t,vnode:n,proxy:o,withProxy:r,propsOptions:[a],slots:s,attrs:i,emit:l,render:d,renderCache:c,props:v,data:f,setupState:b,ctx:y,inheritAttrs:P}=e,B=zu(e);let $,j;try{if(n.shapeFlag&4){const q=r||o,be=q;$=fa(d.call(be,q,c,v,b,f,y)),j=i}else{const q=t;$=fa(q.length>1?q(v,{attrs:i,slots:s,emit:l}):q(v,null)),j=t.props?i:VS(i)}}catch(q){qa.length=0,Ql(q,e,1),$=Fe(Jn)}let H=$;if(j&&P!==!1){const q=Object.keys(j),{shapeFlag:be}=H;q.length&&be&7&&(a&&q.some(ac)&&(j=KS(j,a)),H=Os(H,j,!1,!0))}return n.dirs&&(H=Os(H,null,!1,!0),H.dirs=H.dirs?H.dirs.concat(n.dirs):n.dirs),n.transition&&Hl(H,n.transition),$=H,zu(B),$}const VS=e=>{let t;for(const n in e)(n==="class"||n==="style"||rc(n))&&((t||(t={}))[n]=e[n]);return t},KS=(e,t)=>{const n={};for(const o in e)(!ac(o)||!(o.slice(9)in t))&&(n[o]=e[o]);return n};function YS(e,t,n){const{props:o,children:r,component:a}=e,{props:s,children:i,patchFlag:l}=t,d=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return o?lh(o,s,d):!!s;if(l&8){const c=t.dynamicProps;for(let v=0;v<c.length;v++){const f=c[v];if(og(s,o,f)&&!pc(d,f))return!0}}}else return(r||i)&&(!i||!i.$stable)?!0:o===s?!1:o?s?lh(o,s,d):!0:!!s;return!1}function lh(e,t,n){const o=Object.keys(t);if(o.length!==Object.keys(e).length)return!0;for(let r=0;r<o.length;r++){const a=o[r];if(og(t,e,a)&&!pc(n,a))return!0}return!1}function og(e,t,n){const o=e[n],r=t[n];return n==="style"&&Nt(o)&&Nt(r)?!Yl(o,r):o!==r}function JS({vnode:e,parent:t,suspense:n},o){for(;t;){const r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.suspense.vnode.el=r.el=o,e=r),r===e)(e=t.vnode).el=o,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=o)}const rg={},ag=()=>Object.create(rg),sg=e=>Object.getPrototypeOf(e)===rg;function QS(e,t,n,o=!1){const r={},a=ag();e.propsDefaults=Object.create(null),ig(e,t,r,a);for(const s in e.propsOptions[0])s in r||(r[s]=void 0);n?e.props=o?r:jv(r):e.type.props?e.props=r:e.props=a,e.attrs=a}function XS(e,t,n,o){const{props:r,attrs:a,vnode:{patchFlag:s}}=e,i=Pt(r),[l]=e.propsOptions;let d=!1;if((o||s>0)&&!(s&16)){if(s&8){const c=e.vnode.dynamicProps;for(let v=0;v<c.length;v++){let f=c[v];if(pc(e.emitsOptions,f))continue;const b=t[f];if(l)if(Lt(a,f))b!==a[f]&&(a[f]=b,d=!0);else{const y=po(f);r[y]=Kd(l,i,y,b,e,!1)}else b!==a[f]&&(a[f]=b,d=!0)}}}else{ig(e,t,r,a)&&(d=!0);let c;for(const v in i)(!t||!Lt(t,v)&&((c=Ds(v))===v||!Lt(t,c)))&&(l?n&&(n[v]!==void 0||n[c]!==void 0)&&(r[v]=Kd(l,i,v,void 0,e,!0)):delete r[v]);if(a!==i)for(const v in a)(!t||!Lt(t,v))&&(delete a[v],d=!0)}d&&za(e.attrs,"set","")}function ig(e,t,n,o){const[r,a]=e.propsOptions;let s=!1,i;if(t)for(let l in t){if(Ml(l))continue;const d=t[l];let c;r&&Lt(r,c=po(l))?!a||!a.includes(c)?n[c]=d:(i||(i={}))[c]=d:pc(e.emitsOptions,l)||(!(l in o)||d!==o[l])&&(o[l]=d,s=!0)}if(a){const l=Pt(n),d=i||Bt;for(let c=0;c<a.length;c++){const v=a[c];n[v]=Kd(r,l,v,d[v],e,!Lt(d,v))}}return s}function Kd(e,t,n,o,r,a){const s=e[n];if(s!=null){const i=Lt(s,"default");if(i&&o===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&ht(l)){const{propsDefaults:d}=r;if(n in d)o=d[n];else{const c=eu(r);o=d[n]=l.call(null,t),c()}}else o=l;r.ce&&r.ce._setProp(n,o)}s[0]&&(a&&!i?o=!1:s[1]&&(o===""||o===Ds(n))&&(o=!0))}return o}const ZS=new WeakMap;function lg(e,t,n=!1){const o=n?ZS:t.propsCache,r=o.get(e);if(r)return r;const a=e.props,s={},i=[];let l=!1;if(!ht(e)){const c=v=>{l=!0;const[f,b]=lg(v,t,!0);mn(s,f),b&&i.push(...b)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!a&&!l)return Nt(e)&&o.set(e,Gi),Gi;if(rt(a))for(let c=0;c<a.length;c++){const v=po(a[c]);uh(v)&&(s[v]=Bt)}else if(a)for(const c in a){const v=po(c);if(uh(v)){const f=a[c],b=s[v]=rt(f)||ht(f)?{type:f}:mn({},f),y=b.type;let P=!1,B=!0;if(rt(y))for(let $=0;$<y.length;++$){const j=y[$],H=ht(j)&&j.name;if(H==="Boolean"){P=!0;break}else H==="String"&&(B=!1)}else P=ht(y)&&y.name==="Boolean";b[0]=P,b[1]=B,(P||Lt(b,"default"))&&i.push(v)}}const d=[s,i];return Nt(e)&&o.set(e,d),d}function uh(e){return e[0]!=="$"&&!Ml(e)}const Nf=e=>e==="_"||e==="_ctx"||e==="$stable",$f=e=>rt(e)?e.map(fa):[fa(e)],e0=(e,t,n)=>{if(t._n)return t;const o=pt((...r)=>$f(t(...r)),n);return o._c=!1,o},ug=(e,t,n)=>{const o=e._ctx;for(const r in e){if(Nf(r))continue;const a=e[r];if(ht(a))t[r]=e0(r,a,o);else if(a!=null){const s=$f(a);t[r]=()=>s}}},cg=(e,t)=>{const n=$f(t);e.slots.default=()=>n},dg=(e,t,n)=>{for(const o in t)(n||!Nf(o))&&(e[o]=t[o])},t0=(e,t,n)=>{const o=e.slots=ag();if(e.vnode.shapeFlag&32){const r=t._;r?(dg(o,t,n),n&&hv(o,"_",r,!0)):ug(t,o)}else t&&cg(e,t)},n0=(e,t,n)=>{const{vnode:o,slots:r}=e;let a=!0,s=Bt;if(o.shapeFlag&32){const i=t._;i?n&&i===1?a=!1:dg(r,t,n):(a=!t.$stable,ug(t,r)),s=t}else t&&(cg(e,t),s={default:1});if(a)for(const i in r)!Nf(i)&&s[i]==null&&delete r[i]},lo=i0;function o0(e){return r0(e)}function r0(e,t){const n=uc();n.__VUE__=!0;const{insert:o,remove:r,patchProp:a,createElement:s,createText:i,createComment:l,setText:d,setElementText:c,parentNode:v,nextSibling:f,setScopeId:b=pa,insertStaticContent:y}=e,P=(A,M,z,ee=null,de=null,te=null,Me=void 0,je=null,Ce=!!M.dynamicChildren)=>{if(A===M)return;A&&!hi(A,M)&&(ee=N(A),ze(A,de,te,!0),A=null),M.patchFlag===-2&&(Ce=!1,M.dynamicChildren=null);const{type:me,ref:Ve,shapeFlag:Le}=M;switch(me){case hc:B(A,M,z,ee);break;case Jn:$(A,M,z,ee);break;case Nu:A==null&&j(M,z,ee,Me);break;case lt:X(A,M,z,ee,de,te,Me,je,Ce);break;default:Le&1?be(A,M,z,ee,de,te,Me,je,Ce):Le&6?pe(A,M,z,ee,de,te,Me,je,Ce):(Le&64||Le&128)&&me.process(A,M,z,ee,de,te,Me,je,Ce,Oe)}Ve!=null&&de?Nl(Ve,A&&A.ref,te,M||A,!M):Ve==null&&A&&A.ref!=null&&Nl(A.ref,null,te,A,!0)},B=(A,M,z,ee)=>{if(A==null)o(M.el=i(M.children),z,ee);else{const de=M.el=A.el;M.children!==A.children&&d(de,M.children)}},$=(A,M,z,ee)=>{A==null?o(M.el=l(M.children||""),z,ee):M.el=A.el},j=(A,M,z,ee)=>{[A.el,A.anchor]=y(A.children,M,z,ee,A.el,A.anchor)},H=({el:A,anchor:M},z,ee)=>{let de;for(;A&&A!==M;)de=f(A),o(A,z,ee),A=de;o(M,z,ee)},q=({el:A,anchor:M})=>{let z;for(;A&&A!==M;)z=f(A),r(A),A=z;r(M)},be=(A,M,z,ee,de,te,Me,je,Ce)=>{if(M.type==="svg"?Me="svg":M.type==="math"&&(Me="mathml"),A==null)ce(M,z,ee,de,te,Me,je,Ce);else{const me=A.el&&A.el._isVueCE?A.el:null;try{me&&me._beginPatch(),Se(A,M,de,te,Me,je,Ce)}finally{me&&me._endPatch()}}},ce=(A,M,z,ee,de,te,Me,je)=>{let Ce,me;const{props:Ve,shapeFlag:Le,transition:He,dirs:qe}=A;if(Ce=A.el=s(A.type,te,Ve&&Ve.is,Ve),Le&8?c(Ce,A.children):Le&16&&he(A.children,Ce,null,ee,de,dd(A,te),Me,je),qe&&si(A,null,ee,"created"),W(Ce,A,A.scopeId,Me,ee),Ve){for(const nt in Ve)nt!=="value"&&!Ml(nt)&&a(Ce,nt,null,Ve[nt],te,ee);"value"in Ve&&a(Ce,"value",null,Ve.value,te),(me=Ve.onVnodeBeforeMount)&&ua(me,ee,A)}qe&&si(A,null,ee,"beforeMount");const dt=a0(de,He);dt&&He.beforeEnter(Ce),o(Ce,M,z),((me=Ve&&Ve.onVnodeMounted)||dt||qe)&&lo(()=>{try{me&&ua(me,ee,A),dt&&He.enter(Ce),qe&&si(A,null,ee,"mounted")}finally{}},de)},W=(A,M,z,ee,de)=>{if(z&&b(A,z),ee)for(let te=0;te<ee.length;te++)b(A,ee[te]);if(de){let te=de.subTree;if(M===te||hg(te.type)&&(te.ssContent===M||te.ssFallback===M)){const Me=de.vnode;W(A,Me,Me.scopeId,Me.slotScopeIds,de.parent)}}},he=(A,M,z,ee,de,te,Me,je,Ce=0)=>{for(let me=Ce;me<A.length;me++){const Ve=A[me]=je?Ua(A[me]):fa(A[me]);P(null,Ve,M,z,ee,de,te,Me,je)}},Se=(A,M,z,ee,de,te,Me)=>{const je=M.el=A.el;let{patchFlag:Ce,dynamicChildren:me,dirs:Ve}=M;Ce|=A.patchFlag&16;const Le=A.props||Bt,He=M.props||Bt;let qe;if(z&&ii(z,!1),(qe=He.onVnodeBeforeUpdate)&&ua(qe,z,M,A),Ve&&si(M,A,z,"beforeUpdate"),z&&ii(z,!0),me&&(!A.dynamicChildren||A.dynamicChildren.length!==me.length)&&(Ce=0,Me=!1,me=null),(Le.innerHTML&&He.innerHTML==null||Le.textContent&&He.textContent==null)&&c(je,""),me?_e(A.dynamicChildren,me,je,z,ee,dd(M,de),te):Me||ae(A,M,je,null,z,ee,dd(M,de),te,!1),Ce>0){if(Ce&16)ye(je,Le,He,z,de);else if(Ce&2&&Le.class!==He.class&&a(je,"class",null,He.class,de),Ce&4&&a(je,"style",Le.style,He.style,de),Ce&8){const dt=M.dynamicProps;for(let nt=0;nt<dt.length;nt++){const Ze=dt[nt],vt=Le[Ze],V=He[Ze];(V!==vt||Ze==="value")&&a(je,Ze,vt,V,de,z)}}Ce&1&&A.children!==M.children&&c(je,M.children)}else!Me&&me==null&&ye(je,Le,He,z,de);((qe=He.onVnodeUpdated)||Ve)&&lo(()=>{qe&&ua(qe,z,M,A),Ve&&si(M,A,z,"updated")},ee)},_e=(A,M,z,ee,de,te,Me)=>{for(let je=0;je<M.length;je++){const Ce=A[je],me=M[je],Ve=Ce.el&&(Ce.type===lt||!hi(Ce,me)||Ce.shapeFlag&198)?v(Ce.el):z;P(Ce,me,Ve,null,ee,de,te,Me,!0)}},ye=(A,M,z,ee,de)=>{if(M!==z){if(M!==Bt)for(const te in M)!Ml(te)&&!(te in z)&&a(A,te,M[te],null,de,ee);for(const te in z){if(Ml(te))continue;const Me=z[te],je=M[te];Me!==je&&te!=="value"&&a(A,te,je,Me,de,ee)}"value"in z&&a(A,"value",M.value,z.value,de)}},X=(A,M,z,ee,de,te,Me,je,Ce)=>{const me=M.el=A?A.el:i(""),Ve=M.anchor=A?A.anchor:i("");let{patchFlag:Le,dynamicChildren:He,slotScopeIds:qe}=M;qe&&(je=je?je.concat(qe):qe),A==null?(o(me,z,ee),o(Ve,z,ee),he(M.children||[],z,Ve,de,te,Me,je,Ce)):Le>0&&Le&64&&He&&A.dynamicChildren&&A.dynamicChildren.length===He.length?(_e(A.dynamicChildren,He,z,de,te,Me,je),(M.key!=null||de&&M===de.subTree)&&Of(A,M,!0)):ae(A,M,z,Ve,de,te,Me,je,Ce)},pe=(A,M,z,ee,de,te,Me,je,Ce)=>{M.slotScopeIds=je,A==null?M.shapeFlag&512?de.ctx.activate(M,z,ee,Me,Ce):re(M,z,ee,de,te,Me,Ce):xe(A,M,Ce)},re=(A,M,z,ee,de,te,Me)=>{const je=A.component=f0(A,ee,de);if(Xl(A)&&(je.ctx.renderer=Oe),p0(je,!1,Me),je.asyncDep){if(de&&de.registerDep(je,$e,Me),!A.el){const Ce=je.subTree=Fe(Jn);$(null,Ce,M,z),A.placeholder=Ce.el}}else $e(je,A,M,z,de,te,Me)},xe=(A,M,z)=>{const ee=M.component=A.component;if(YS(A,M,z))if(ee.asyncDep&&!ee.asyncResolved){Ne(ee,M,z);return}else ee.next=M,ee.update();else M.el=A.el,ee.vnode=M},$e=(A,M,z,ee,de,te,Me)=>{const je=()=>{if(A.isMounted){let{next:Le,bu:He,u:qe,parent:dt,vnode:nt}=A;{const ge=fg(A);if(ge){Le&&(Le.el=nt.el,Ne(A,Le,Me)),ge.asyncDep.then(()=>{lo(()=>{A.isUnmounted||me()},de)});return}}let Ze=Le,vt;ii(A,!1),Le?(Le.el=nt.el,Ne(A,Le,Me)):Le=nt,He&&ju(He),(vt=Le.props&&Le.props.onVnodeBeforeUpdate)&&ua(vt,dt,Le,nt),ii(A,!0);const V=ih(A),le=A.subTree;A.subTree=V,P(le,V,v(le.el),N(le),A,de,te),Le.el=V.el,Ze===null&&JS(A,V.el),qe&&lo(qe,de),(vt=Le.props&&Le.props.onVnodeUpdated)&&lo(()=>ua(vt,dt,Le,nt),de)}else{let Le;const{el:He,props:qe}=M,{bm:dt,m:nt,parent:Ze,root:vt,type:V}=A,le=Yi(M);ii(A,!1),dt&&ju(dt),!le&&(Le=qe&&qe.onVnodeBeforeMount)&&ua(Le,Ze,M),ii(A,!0);{vt.ce&&vt.ce._hasShadowRoot()&&vt.ce._injectChildStyle(V,A.parent?A.parent.type:void 0);const ge=A.subTree=ih(A);P(null,ge,z,ee,A,de,te),M.el=ge.el}if(nt&&lo(nt,de),!le&&(Le=qe&&qe.onVnodeMounted)){const ge=M;lo(()=>ua(Le,Ze,ge),de)}(M.shapeFlag&256||Ze&&Yi(Ze.vnode)&&Ze.vnode.shapeFlag&256)&&A.a&&lo(A.a,de),A.isMounted=!0,M=z=ee=null}};A.scope.on();const Ce=A.effect=new wv(je);A.scope.off();const me=A.update=Ce.run.bind(Ce),Ve=A.job=Ce.runIfDirty.bind(Ce);Ve.i=A,Ve.id=A.uid,Ce.scheduler=()=>Mf(Ve),ii(A,!0),me()},Ne=(A,M,z)=>{M.component=A;const ee=A.vnode.props;A.vnode=M,A.next=null,XS(A,M.props,ee,z),n0(A,M.children,z),Va(),Yp(A),Ka()},ae=(A,M,z,ee,de,te,Me,je,Ce=!1)=>{const me=A&&A.children,Ve=A?A.shapeFlag:0,Le=M.children,{patchFlag:He,shapeFlag:qe}=M;if(He>0){if(He&128){ke(me,Le,z,ee,de,te,Me,je,Ce);return}else if(He&256){Ee(me,Le,z,ee,de,te,Me,je,Ce);return}}qe&8?(Ve&16&&ue(me,de,te),Le!==me&&c(z,Le)):Ve&16?qe&16?ke(me,Le,z,ee,de,te,Me,je,Ce):ue(me,de,te,!0):(Ve&8&&c(z,""),qe&16&&he(Le,z,ee,de,te,Me,je,Ce))},Ee=(A,M,z,ee,de,te,Me,je,Ce)=>{A=A||Gi,M=M||Gi;const me=A.length,Ve=M.length,Le=Math.min(me,Ve);let He;for(He=0;He<Le;He++){const qe=M[He]=Ce?Ua(M[He]):fa(M[He]);P(A[He],qe,z,null,de,te,Me,je,Ce)}me>Ve?ue(A,de,te,!0,!1,Le):he(M,z,ee,de,te,Me,je,Ce,Le)},ke=(A,M,z,ee,de,te,Me,je,Ce)=>{let me=0;const Ve=M.length;let Le=A.length-1,He=Ve-1;for(;me<=Le&&me<=He;){const qe=A[me],dt=M[me]=Ce?Ua(M[me]):fa(M[me]);if(hi(qe,dt))P(qe,dt,z,null,de,te,Me,je,Ce);else break;me++}for(;me<=Le&&me<=He;){const qe=A[Le],dt=M[He]=Ce?Ua(M[He]):fa(M[He]);if(hi(qe,dt))P(qe,dt,z,null,de,te,Me,je,Ce);else break;Le--,He--}if(me>Le){if(me<=He){const qe=He+1,dt=qe<Ve?M[qe].el:ee;for(;me<=He;)P(null,M[me]=Ce?Ua(M[me]):fa(M[me]),z,dt,de,te,Me,je,Ce),me++}}else if(me>He)for(;me<=Le;)ze(A[me],de,te,!0),me++;else{const qe=me,dt=me,nt=new Map;for(me=dt;me<=He;me++){const St=M[me]=Ce?Ua(M[me]):fa(M[me]);St.key!=null&&nt.set(St.key,me)}let Ze,vt=0;const V=He-dt+1;let le=!1,ge=0;const Je=new Array(V);for(me=0;me<V;me++)Je[me]=0;for(me=qe;me<=Le;me++){const St=A[me];if(vt>=V){ze(St,de,te,!0);continue}let $t;if(St.key!=null)$t=nt.get(St.key);else for(Ze=dt;Ze<=He;Ze++)if(Je[Ze-dt]===0&&hi(St,M[Ze])){$t=Ze;break}$t===void 0?ze(St,de,te,!0):(Je[$t-dt]=me+1,$t>=ge?ge=$t:le=!0,P(St,M[$t],z,null,de,te,Me,je,Ce),vt++)}const Tt=le?s0(Je):Gi;for(Ze=Tt.length-1,me=V-1;me>=0;me--){const St=dt+me,$t=M[St],Rn=M[St+1],cn=St+1<Ve?Rn.el||pg(Rn):ee;Je[me]===0?P(null,$t,z,cn,de,te,Me,je,Ce):le&&(Ze<0||me!==Tt[Ze]?Ie($t,z,cn,2):Ze--)}}},Ie=(A,M,z,ee,de=null)=>{const{el:te,type:Me,transition:je,children:Ce,shapeFlag:me}=A;if(me&6){Ie(A.component.subTree,M,z,ee);return}if(me&128){A.suspense.move(M,z,ee);return}if(me&64){Me.move(A,M,z,Oe);return}if(Me===lt){o(te,M,z);for(let Le=0;Le<Ce.length;Le++)Ie(Ce[Le],M,z,ee);o(A.anchor,M,z);return}if(Me===Nu){H(A,M,z);return}if(ee!==2&&me&1&&je)if(ee===0)je.persisted&&!te[nr]?o(te,M,z):(je.beforeEnter(te),o(te,M,z),lo(()=>je.enter(te),de));else{const{leave:Le,delayLeave:He,afterLeave:qe}=je,dt=()=>{A.ctx.isUnmounted?r(te):o(te,M,z)},nt=()=>{const Ze=te._isLeaving||!!te[nr];te._isLeaving&&te[nr](!0),je.persisted&&!Ze?dt():Le(te,()=>{dt(),qe&&qe()})};He?He(te,dt,nt):nt()}else o(te,M,z)},ze=(A,M,z,ee=!1,de=!1)=>{const{type:te,props:Me,ref:je,children:Ce,dynamicChildren:me,shapeFlag:Ve,patchFlag:Le,dirs:He,cacheIndex:qe,memo:dt}=A;if(Le===-2&&(de=!1),je!=null&&(Va(),Nl(je,null,z,A,!0),Ka()),qe!=null&&(M.renderCache[qe]=void 0),Ve&256){M.ctx.deactivate(A);return}const nt=Ve&1&&He,Ze=!Yi(A);let vt;if(Ze&&(vt=Me&&Me.onVnodeBeforeUnmount)&&ua(vt,M,A),Ve&6)ct(A.component,z,ee);else{if(Ve&128){A.suspense.unmount(z,ee);return}nt&&si(A,null,M,"beforeUnmount"),Ve&64?A.type.remove(A,M,z,Oe,ee):me&&!me.hasOnce&&(te!==lt||Le>0&&Le&64)?ue(me,M,z,!1,!0):(te===lt&&Le&384||!de&&Ve&16)&&ue(Ce,M,z),ee&&st(A)}const V=dt!=null&&qe==null;(Ze&&(vt=Me&&Me.onVnodeUnmounted)||nt||V)&&lo(()=>{vt&&ua(vt,M,A),nt&&si(A,null,M,"unmounted"),V&&(A.el=null)},z)},st=A=>{const{type:M,el:z,anchor:ee,transition:de}=A;if(M===lt){tt(z,ee);return}if(M===Nu){q(A);return}const te=()=>{r(z),de&&!de.persisted&&de.afterLeave&&de.afterLeave()};if(A.shapeFlag&1&&de&&!de.persisted){const{leave:Me,delayLeave:je}=de,Ce=()=>Me(z,te);je?je(A.el,te,Ce):Ce()}else te()},tt=(A,M)=>{let z;for(;A!==M;)z=f(A),r(A),A=z;r(M)},ct=(A,M,z)=>{const{bum:ee,scope:de,job:te,subTree:Me,um:je,m:Ce,a:me}=A;ch(Ce),ch(me),ee&&ju(ee),de.stop(),te&&(te.flags|=8,ze(Me,A,M,z)),je&&lo(je,M),lo(()=>{A.isUnmounted=!0},M)},ue=(A,M,z,ee=!1,de=!1,te=0)=>{for(let Me=te;Me<A.length;Me++)ze(A[Me],M,z,ee,de)},N=A=>{if(A.shapeFlag&6)return N(A.component.subTree);if(A.shapeFlag&128)return A.suspense.next();const M=f(A.anchor||A.el),z=M&&M[Hv];return z?f(z):M};let ie=!1;const se=(A,M,z)=>{let ee;A==null?M._vnode&&(ze(M._vnode,null,null,!0),ee=M._vnode.component):P(M._vnode||null,A,M,null,null,null,z),M._vnode=A,ie||(ie=!0,Yp(ee),Dv(),ie=!1)},Oe={p:P,um:ze,m:Ie,r:st,mt:re,mc:he,pc:ae,pbc:_e,n:N,o:e};return{render:se,hydrate:void 0,createApp:HS(se)}}function dd({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 ii({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function a0(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Of(e,t,n=!1){const o=e.children,r=t.children;if(rt(o)&&rt(r))for(let a=0;a<o.length;a++){const s=o[a];let i=r[a];i.shapeFlag&1&&!i.dynamicChildren&&((i.patchFlag<=0||i.patchFlag===32)&&(i=r[a]=Ua(r[a]),i.el=s.el),!n&&i.patchFlag!==-2&&Of(s,i)),i.type===hc&&(i.patchFlag===-1&&(i=r[a]=Ua(i)),i.el=s.el),i.type===Jn&&!i.el&&(i.el=s.el)}}function s0(e){const t=e.slice(),n=[0];let o,r,a,s,i;const l=e.length;for(o=0;o<l;o++){const d=e[o];if(d!==0){if(r=n[n.length-1],e[r]<d){t[o]=r,n.push(o);continue}for(a=0,s=n.length-1;a<s;)i=a+s>>1,e[n[i]]<d?a=i+1:s=i;d<e[n[a]]&&(a>0&&(t[o]=n[a-1]),n[a]=o)}}for(a=n.length,s=n[a-1];a-- >0;)n[a]=s,s=t[s];return n}function fg(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:fg(t)}function ch(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function pg(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?pg(t.subTree):null}const hg=e=>e.__isSuspense;function i0(e,t){t&&t.pendingBranch?rt(e)?t.effects.push(...e):t.effects.push(e):dS(e)}const lt=Symbol.for("v-fgt"),hc=Symbol.for("v-txt"),Jn=Symbol.for("v-cmt"),Nu=Symbol.for("v-stc"),qa=[];let fo=null;function _(e=!1){qa.push(fo=e?null:[])}function Df(){qa.pop(),fo=qa[qa.length-1]||null}let ol=1;function Wu(e,t=!1){ol+=e,e<0&&fo&&t&&(fo.hasOnce=!0)}function mg(e){return e.dynamicChildren=ol>0?fo||Gi:null,Df(),ol>0&&fo&&fo.push(e),e}function F(e,t,n,o,r,a){return mg(w(e,t,n,o,r,a,!0))}function Qe(e,t,n,o,r){return mg(Fe(e,t,n,o,r,!0))}function ql(e){return e?e.__v_isVNode===!0:!1}function hi(e,t){return e.type===t.type&&e.key===t.key}const vg=({key:e})=>e??null,$u=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Kt(e)||Pn(e)||ht(e)?{i:Fn,r:e,k:t,f:!!n}:e:null);function w(e,t=null,n=null,o=0,r=null,a=e===lt?0:1,s=!1,i=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&vg(t),ref:t&&$u(t),scopeId:Bv,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:o,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:Fn};return i?(Gu(l,n),a&128&&e.normalize(l)):n&&(l.shapeFlag|=Kt(n)?8:16),ol>0&&!s&&fo&&(l.patchFlag>0||a&6)&&l.patchFlag!==32&&fo.push(l),l}const Fe=l0;function l0(e,t=null,n=null,o=0,r=null,a=!1){if((!e||e===Qv)&&(e=Jn),ql(e)){const i=Os(e,t,!0);return n&&Gu(i,n),ol>0&&!a&&fo&&(i.shapeFlag&6?fo[fo.indexOf(e)]=i:fo.push(i)),i.patchFlag=-2,i}if(g0(e)&&(e=e.__vccOpts),t){t=u0(t);let{class:i,style:l}=t;i&&!Kt(i)&&(t.class=ut(i)),Nt(l)&&(Ef(l)&&!rt(l)&&(l=mn({},l)),t.style=or(l))}const s=Kt(e)?1:hg(e)?128:qv(e)?64:Nt(e)?4:ht(e)?2:0;return w(e,t,n,o,r,s,a,!0)}function u0(e){return e?Ef(e)||sg(e)?mn({},e):e:null}function Os(e,t,n=!1,o=!1){const{props:r,ref:a,patchFlag:s,children:i,transition:l}=e,d=t?Ff(r||{},t):r,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:d,key:d&&vg(d),ref:t&&t.ref?n&&a?rt(a)?a.concat($u(t)):[a,$u(t)]:$u(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:i,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==lt?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Os(e.ssContent),ssFallback:e.ssFallback&&Os(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&o&&Hl(c,l.clone(c)),c}function Rs(e=" ",t=0){return Fe(hc,null,e,t)}function BD(e,t){const n=Fe(Nu,null,e);return n.staticCount=t,n}function ve(e="",t=!1){return t?(_(),Qe(Jn,null,e)):Fe(Jn,null,e)}function fa(e){return e==null||typeof e=="boolean"?Fe(Jn):rt(e)?Fe(lt,null,e.slice()):ql(e)?Ua(e):Fe(hc,null,String(e))}function Ua(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Os(e)}function Gu(e,t){let n=0;const{shapeFlag:o}=e;if(t==null)t=null;else if(rt(t))n=16;else if(typeof t=="object")if(o&65){const r=t.default;r&&(r._c&&(r._d=!1),Gu(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!sg(t)?t._ctx=Fn:r===3&&Fn&&(Fn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(ht(t)){if(o&65){Gu(e,{default:t});return}t={default:t,_ctx:Fn},n=32}else t=String(t),o&64?(n=16,t=[Rs(t)]):n=8;e.children=t,e.shapeFlag|=n}function Ff(...e){const t={};for(let n=0;n<e.length;n++){const o=e[n];for(const r in o)if(r==="class")t.class!==o.class&&(t.class=ut([t.class,o.class]));else if(r==="style")t.style=or([t.style,o.style]);else if(rc(r)){const a=t[r],s=o[r];s&&a!==s&&!(rt(a)&&a.includes(s))?t[r]=a?[].concat(a,s):s:s==null&&a==null&&!ac(r)&&(t[r]=s)}else r!==""&&(t[r]=o[r])}return t}function ua(e,t,n,o=null){sr(e,t,7,[n,o])}const c0=tg();let d0=0;function f0(e,t,n){const o=e.type,r=(t?t.appContext:e.appContext)||c0,a={uid:d0++,vnode:e,type:o,parent:t,appContext:r,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new $T(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(r.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:lg(o,r),emitsOptions:ng(o,r),emit:null,emitted:null,propsDefaults:Bt,inheritAttrs:o.inheritAttrs,ctx:Bt,data:Bt,props:Bt,attrs:Bt,slots:Bt,refs:Bt,setupState:Bt,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=WS.bind(null,a),e.ce&&e.ce(a),a}let Dn=null;const Bf=()=>Dn||Fn;let Vu,Yd;{const e=uc(),t=(n,o)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(o),a=>{r.length>1?r.forEach(s=>s(a)):r[0](a)}};Vu=t("__VUE_INSTANCE_SETTERS__",n=>Dn=n),Yd=t("__VUE_SSR_SETTERS__",n=>rl=n)}const eu=e=>{const t=Dn;return Vu(e),e.scope.on(),()=>{e.scope.off(),Vu(t)}},dh=()=>{Dn&&Dn.scope.off(),Vu(null)};function gg(e){return e.vnode.shapeFlag&4}let rl=!1;function p0(e,t=!1,n=!1){t&&Yd(t);const{props:o,children:r}=e.vnode,a=gg(e);QS(e,o,a,t),t0(e,r,n||t);const s=a?h0(e,t):void 0;return t&&Yd(!1),s}function h0(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,LS);const{setup:o}=n;if(o){Va();const r=e.setupContext=o.length>1?wg(e):null,a=eu(e),s=Jl(o,e,0,[e.props,r]),i=dv(s);if(Ka(),a(),(i||e.sp)&&!Yi(e)&&jf(e),i){if(s.then(dh,dh),t)return s.then(l=>{fh(e,l)}).catch(l=>{Ql(l,e,0)});e.asyncDep=s}else fh(e,s)}else yg(e)}function fh(e,t,n){ht(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Nt(t)&&(e.setupState=Nv(t)),yg(e)}function yg(e,t,n){const o=e.type;e.render||(e.render=o.render||pa);{const r=eu(e);Va();try{OS(e)}finally{Ka(),r()}}}const m0={get(e,t){return Yn(e,"get",""),e[t]}};function wg(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,m0),slots:e.slots,emit:e.emit,expose:t}}function mc(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Nv(tS(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in $l)return $l[n](e)},has(t,n){return n in t||n in $l}})):e.proxy}function v0(e,t=!0){return ht(e)?e.displayName||e.name:e.name||t&&e.__name}function g0(e){return ht(e)&&"__vccOpts"in e}const Y=(e,t)=>sS(e,t,rl);function Uf(e,t,n){try{Wu(-1);const o=arguments.length;return o===2?Nt(t)&&!rt(t)?ql(t)?Fe(e,null,[t]):Fe(e,t):Fe(e,null,t):(o>3?n=Array.prototype.slice.call(arguments,2):o===3&&ql(n)&&(n=[n]),Fe(e,t,n))}finally{Wu(1)}}function UD(e,t,n,o){const r=n[o];if(r&&y0(r,e))return r;const a=t();return a.memo=e.slice(),a.cacheIndex=o,n[o]=a}function y0(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let o=0;o<n.length;o++)if(Rr(n[o],t[o]))return!1;return ol>0&&fo&&fo.push(e),!0}const w0="3.5.40";/**
|
|
15
|
+
* @vue/runtime-dom v3.5.40
|
|
16
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
17
|
+
* @license MIT
|
|
18
|
+
**/let Jd;const ph=typeof window<"u"&&window.trustedTypes;if(ph)try{Jd=ph.createPolicy("vue",{createHTML:e=>e})}catch{}const bg=Jd?e=>Jd.createHTML(e):e=>e,b0="http://www.w3.org/2000/svg",T0="http://www.w3.org/1998/Math/MathML",Ba=typeof document<"u"?document:null,hh=Ba&&Ba.createElement("template"),S0={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,o)=>{const r=t==="svg"?Ba.createElementNS(b0,e):t==="mathml"?Ba.createElementNS(T0,e):n?Ba.createElement(e,{is:n}):Ba.createElement(e);return e==="select"&&o&&o.multiple!=null&&r.setAttribute("multiple",o.multiple),r},createText:e=>Ba.createTextNode(e),createComment:e=>Ba.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ba.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,o,r,a){const s=n?n.previousSibling:t.lastChild;if(r&&(r===a||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===a||!(r=r.nextSibling)););else{hh.innerHTML=bg(o==="svg"?`<svg>${e}</svg>`:o==="mathml"?`<math>${e}</math>`:e);const i=hh.content;if(o==="svg"||o==="mathml"){const l=i.firstChild;for(;l.firstChild;)i.appendChild(l.firstChild);i.removeChild(l)}t.insertBefore(i,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Ss="transition",kl="animation",Wl=Symbol("_vtc"),Tg={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},C0=mn({},Wv,Tg),x0=e=>(e.displayName="Transition",e.props=C0,e),tu=x0((e,{slots:t})=>Uf(bS,k0(e),t)),li=(e,t=[])=>{rt(e)?e.forEach(n=>n(...t)):e&&e(...t)},mh=e=>e?rt(e)?e.some(t=>t.length>1):e.length>1:!1;function k0(e){const t={};for(const X in e)X in Tg||(t[X]=e[X]);if(e.css===!1)return t;const{name:n="v",type:o,duration:r,enterFromClass:a=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:i=`${n}-enter-to`,appearFromClass:l=a,appearActiveClass:d=s,appearToClass:c=i,leaveFromClass:v=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:b=`${n}-leave-to`}=e,y=I0(r),P=y&&y[0],B=y&&y[1],{onBeforeEnter:$,onEnter:j,onEnterCancelled:H,onLeave:q,onLeaveCancelled:be,onBeforeAppear:ce=$,onAppear:W=j,onAppearCancelled:he=H}=t,Se=(X,pe,re,xe)=>{X._enterCancelled=xe,ui(X,pe?c:i),ui(X,pe?d:s),re&&re()},_e=(X,pe)=>{X._isLeaving=!1,ui(X,v),ui(X,b),ui(X,f),pe&&pe()},ye=X=>(pe,re)=>{const xe=X?W:j,$e=()=>Se(pe,X,re);li(xe,[pe,$e]),vh(()=>{ui(pe,X?l:a),Oa(pe,X?c:i),mh(xe)||gh(pe,o,P,$e)})};return mn(t,{onBeforeEnter(X){li($,[X]),Oa(X,a),Oa(X,s)},onBeforeAppear(X){li(ce,[X]),Oa(X,l),Oa(X,d)},onEnter:ye(!1),onAppear:ye(!0),onLeave(X,pe){X._isLeaving=!0;const re=()=>_e(X,pe);Oa(X,v),X._enterCancelled?(Oa(X,f),bh(X)):(bh(X),Oa(X,f)),vh(()=>{X._isLeaving&&(ui(X,v),Oa(X,b),mh(q)||gh(X,o,B,re))}),li(q,[X,re])},onEnterCancelled(X){Se(X,!1,void 0,!0),li(H,[X])},onAppearCancelled(X){Se(X,!0,void 0,!0),li(he,[X])},onLeaveCancelled(X){_e(X),li(be,[X])}})}function I0(e){if(e==null)return null;if(Nt(e))return[fd(e.enter),fd(e.leave)];{const t=fd(e);return[t,t]}}function fd(e){return _T(e)}function Oa(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Wl]||(e[Wl]=new Set)).add(t)}function ui(e,t){t.split(/\s+/).forEach(o=>o&&e.classList.remove(o));const n=e[Wl];n&&(n.delete(t),n.size||(e[Wl]=void 0))}function vh(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let A0=0;function gh(e,t,n,o){const r=e._endId=++A0,a=()=>{r===e._endId&&o()};if(n!=null)return setTimeout(a,n);const{type:s,timeout:i,propCount:l}=_0(e,t);if(!s)return o();const d=s+"end";let c=0;const v=()=>{e.removeEventListener(d,f),a()},f=b=>{b.target===e&&++c>=l&&v()};setTimeout(()=>{c<l&&v()},i+1),e.addEventListener(d,f)}function _0(e,t){const n=window.getComputedStyle(e),o=y=>(n[y]||"").split(", "),r=o(`${Ss}Delay`),a=o(`${Ss}Duration`),s=yh(r,a),i=o(`${kl}Delay`),l=o(`${kl}Duration`),d=yh(i,l);let c=null,v=0,f=0;t===Ss?s>0&&(c=Ss,v=s,f=a.length):t===kl?d>0&&(c=kl,v=d,f=l.length):(v=Math.max(s,d),c=v>0?s>d?Ss:kl:null,f=c?c===Ss?a.length:l.length:0);const b=c===Ss&&/\b(?:transform|all)(?:,|$)/.test(o(`${Ss}Property`).toString());return{type:c,timeout:v,propCount:f,hasTransform:b}}function yh(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,o)=>wh(n)+wh(e[o])))}function wh(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function bh(e){return(e?e.ownerDocument:document).body.offsetHeight}function P0(e,t,n){const o=e[Wl];o&&(t=(t?[t,...o]:[...o]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Ku=Symbol("_vod"),Sg=Symbol("_vsh"),zD={name:"show",beforeMount(e,{value:t},{transition:n}){e[Ku]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Il(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:o}){!t!=!n&&(o?t?(o.beforeEnter(e),Il(e,!0),o.enter(e)):o.leave(e,()=>{Il(e,!1)}):Il(e,t))},beforeUnmount(e,{value:t}){Il(e,t)}};function Il(e,t){e.style.display=t?e[Ku]:"none",e[Sg]=!t}const R0=Symbol(""),E0=/(?:^|;)\s*display\s*:/;function M0(e,t,n){const o=e.style,r=Kt(n);let a=!1;if(n&&!r){if(t)if(Kt(t))for(const s of t.split(";")){const i=s.slice(0,s.indexOf(":")).trim();n[i]==null&&Rl(o,i,"")}else for(const s in t)n[s]==null&&Rl(o,s,"");for(const s in n){s==="display"&&(a=!0);const i=n[s];i!=null?L0(e,s,!Kt(t)&&t?t[s]:void 0,i)||Rl(o,s,i):Rl(o,s,"")}}else if(r){if(t!==n){const s=o[R0];s&&(n+=";"+s),o.cssText=n,a=E0.test(n)}}else t&&e.removeAttribute("style");Ku in e&&(e[Ku]=a?o.display:"",e[Sg]&&(o.display="none"))}const Th=/\s*!important$/;function Rl(e,t,n){if(rt(n))n.forEach(o=>Rl(e,t,o));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const o=j0(e,t);Th.test(n)?e.setProperty(Ds(o),n.replace(Th,""),"important"):e[o]=n}}const Sh=["Webkit","Moz","ms"],pd={};function j0(e,t){const n=pd[t];if(n)return n;let o=po(t);if(o!=="filter"&&o in e)return pd[t]=o;o=lc(o);for(let r=0;r<Sh.length;r++){const a=Sh[r]+o;if(a in e)return pd[t]=a}return t}function L0(e,t,n,o){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Kt(o)&&n===o}const Ch="http://www.w3.org/1999/xlink";function xh(e,t,n,o,r,a=LT(t)){o&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Ch,t.slice(6,t.length)):e.setAttributeNS(Ch,t,n):n==null||a&&!mv(n)?e.removeAttribute(t):e.setAttribute(t,a?"":$r(n)?String(n):n)}function kh(e,t,n,o,r){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?bg(n):n);return}const a=e.tagName;if(t==="value"&&a!=="PROGRESS"&&!a.includes("-")){const i=a==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(i!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const i=typeof e[t];i==="boolean"?n=mv(n):n==null&&i==="string"?(n="",s=!0):i==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(r||t)}function mi(e,t,n,o){e.addEventListener(t,n,o)}function N0(e,t,n,o){e.removeEventListener(t,n,o)}const Ih=Symbol("_vei");function $0(e,t,n,o,r=null){const a=e[Ih]||(e[Ih]={}),s=a[t];if(o&&s)s.value=o;else{const[i,l]=F0(t);if(o){const d=a[t]=z0(o,r);mi(e,i,d,l)}else s&&(N0(e,i,s,l),a[t]=void 0)}}const O0=/(Once|Passive|Capture)$/,D0=/^on:?(?:Once|Passive|Capture)$/;function F0(e){let t,n;for(;(n=e.match(O0))&&!D0.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):Ds(e.slice(2)),t]}let hd=0;const B0=Promise.resolve(),U0=()=>hd||(B0.then(()=>hd=0),hd=Date.now());function z0(e,t){const n=o=>{if(!o._vts)o._vts=Date.now();else if(o._vts<=n.attached)return;const r=n.value;if(rt(r)){const a=o.stopImmediatePropagation;o.stopImmediatePropagation=()=>{a.call(o),o._stopped=!0};const s=r.slice(),i=[o];for(let l=0;l<s.length&&!o._stopped;l++){const d=s[l];d&&sr(d,t,5,i)}}else sr(r,t,5,[o])};return n.value=e,n.attached=U0(),n}const Ah=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,H0=(e,t,n,o,r,a)=>{const s=r==="svg";t==="class"?P0(e,o,s):t==="style"?M0(e,n,o):rc(t)?ac(t)||$0(e,t,n,o,a):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):q0(e,t,o,s))?(kh(e,t,o),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&xh(e,t,o,s,a,t!=="value")):e._isVueCE&&(W0(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Kt(o)))?kh(e,po(t),o,a,t):(t==="true-value"?e._trueValue=o:t==="false-value"&&(e._falseValue=o),xh(e,t,o,s))};function q0(e,t,n,o){if(o)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ah(t)&&ht(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return Ah(t)&&Kt(n)?!1:t in e}function W0(e,t){const n=e._def.props;if(!n)return!1;const o=po(t);return Array.isArray(n)?n.some(r=>po(r)===o):Object.keys(n).some(r=>po(r)===o)}const Yu=e=>{const t=e.props["onUpdate:modelValue"]||!1;return rt(t)?n=>ju(t,n):t};function G0(e){e.target.composing=!0}function _h(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Qi=Symbol("_assign");function Ph(e,t,n){return t&&(e=e.trim()),n&&(e=xf(e)),e}const On={created(e,{modifiers:{lazy:t,trim:n,number:o}},r){e[Qi]=Yu(r);const a=o||r.props&&r.props.type==="number";mi(e,t?"change":"input",s=>{s.target.composing||e[Qi](Ph(e.value,n,a))}),(n||a)&&mi(e,"change",()=>{e.value=Ph(e.value,n,a)}),t||(mi(e,"compositionstart",G0),mi(e,"compositionend",_h),mi(e,"change",_h))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:o,trim:r,number:a}},s){if(e[Qi]=Yu(s),e.composing)return;const i=(a||e.type==="number")&&!/^0\d/.test(e.value)?xf(e.value):e.value,l=t??"";if(i===l)return;const d=e.getRootNode();(d instanceof Document||d instanceof ShadowRoot)&&d.activeElement===e&&e.type!=="range"&&(o&&t===n||r&&e.value.trim()===l)||(e.value=l)}},V0={deep:!0,created(e,t,n){e[Qi]=Yu(n),mi(e,"change",()=>{const o=e._modelValue,r=K0(e),a=e.checked,s=e[Qi];if(rt(o)){const i=vv(o,r),l=i!==-1;if(a&&!l)s(o.concat(r));else if(!a&&l){const d=[...o];d.splice(i,1),s(d)}}else if(sc(o)){const i=new Set(o);a?i.add(r):i.delete(r),s(i)}else s(Cg(e,a))})},mounted:Rh,beforeUpdate(e,t,n){e[Qi]=Yu(n),Rh(e,t,n)}};function Rh(e,{value:t,oldValue:n},o){e._modelValue=t;let r;if(rt(t))r=vv(t,o.props.value)>-1;else if(sc(t))r=t.has(o.props.value);else{if(t===n)return;r=Yl(t,Cg(e,!0))}e.checked!==r&&(e.checked=r)}function K0(e){return"_value"in e?e._value:e.value}function Cg(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const Y0=["ctrl","shift","alt","meta"],J0={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)=>Y0.some(n=>e[`${n}Key`]&&!t.includes(n))},wt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),o=t.join(".");return n[o]||(n[o]=(r,...a)=>{for(let s=0;s<t.length;s++){const i=J0[t[s]];if(i&&i(r,t))return}return e(r,...a)})},Q0={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},xo=(e,t)=>{const n=e._withKeys||(e._withKeys={}),o=t.join(".");return n[o]||(n[o]=r=>{if(!("key"in r))return;const a=Ds(r.key);if(t.some(s=>s===a||Q0[s]===a))return e(r)})},X0=mn({patchProp:H0},S0);let Eh;function Z0(){return Eh||(Eh=o0(X0))}const eC=(...e)=>{const t=Z0().createApp(...e),{mount:n}=t;return t.mount=o=>{const r=nC(o);if(!r)return;const a=t._component;!ht(a)&&!a.render&&!a.template&&(a.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const s=n(r,!1,tC(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),s},t};function tC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function nC(e){return Kt(e)?document.querySelector(e):e}const oC="modulepreload",rC=function(e){return"/"+e},Mh={},_r=function(t,n,o){let r=Promise.resolve();if(n&&n.length>0){let s=function(d){return Promise.all(d.map(c=>Promise.resolve(c).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));r=s(n.map(d=>{if(d=rC(d),d in Mh)return;Mh[d]=!0;const c=d.endsWith(".css"),v=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${v}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":oC,c||(f.as="script"),f.crossOrigin="",f.href=d,l&&f.setAttribute("nonce",l),document.head.appendChild(f),c)return new Promise((b,y)=>{f.addEventListener("load",b),f.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${d}`)))})}))}function a(s){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=s,window.dispatchEvent(i),!i.defaultPrevented)throw s}return r.then(s=>{for(const i of s||[])i.status==="rejected"&&a(i.reason);return t().catch(a)})};/*!
|
|
19
|
+
* vue-router v4.6.4
|
|
20
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
21
|
+
* @license MIT
|
|
22
|
+
*/const zi=typeof document<"u";function xg(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function aC(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&xg(e.default)}const jt=Object.assign;function md(e,t){const n={};for(const o in t){const r=t[o];n[o]=Dr(r)?r.map(e):e(r)}return n}const Ol=()=>{},Dr=Array.isArray;function jh(e,t){const n={};for(const o in e)n[o]=o in t?t[o]:e[o];return n}const kg=/#/g,sC=/&/g,iC=/\//g,lC=/=/g,uC=/\?/g,Ig=/\+/g,cC=/%5B/g,dC=/%5D/g,Ag=/%5E/g,fC=/%60/g,_g=/%7B/g,pC=/%7C/g,Pg=/%7D/g,hC=/%20/g;function zf(e){return e==null?"":encodeURI(""+e).replace(pC,"|").replace(cC,"[").replace(dC,"]")}function mC(e){return zf(e).replace(_g,"{").replace(Pg,"}").replace(Ag,"^")}function Qd(e){return zf(e).replace(Ig,"%2B").replace(hC,"+").replace(kg,"%23").replace(sC,"%26").replace(fC,"`").replace(_g,"{").replace(Pg,"}").replace(Ag,"^")}function vC(e){return Qd(e).replace(lC,"%3D")}function gC(e){return zf(e).replace(kg,"%23").replace(uC,"%3F")}function yC(e){return gC(e).replace(iC,"%2F")}function Gl(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const wC=/\/$/,bC=e=>e.replace(wC,"");function vd(e,t,n="/"){let o,r={},a="",s="";const i=t.indexOf("#");let l=t.indexOf("?");return l=i>=0&&l>i?-1:l,l>=0&&(o=t.slice(0,l),a=t.slice(l,i>0?i:t.length),r=e(a.slice(1))),i>=0&&(o=o||t.slice(0,i),s=t.slice(i,t.length)),o=xC(o??t,n),{fullPath:o+a+s,path:o,query:r,hash:Gl(s)}}function TC(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Lh(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function SC(e,t,n){const o=t.matched.length-1,r=n.matched.length-1;return o>-1&&o===r&&al(t.matched[o],n.matched[r])&&Rg(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function al(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Rg(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!CC(e[n],t[n]))return!1;return!0}function CC(e,t){return Dr(e)?Nh(e,t):Dr(t)?Nh(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Nh(e,t){return Dr(t)?e.length===t.length&&e.every((n,o)=>n===t[o]):e.length===1&&e[0]===t}function xC(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),o=e.split("/"),r=o[o.length-1];(r===".."||r===".")&&o.push("");let a=n.length-1,s,i;for(s=0;s<o.length;s++)if(i=o[s],i!==".")if(i==="..")a>1&&a--;else break;return n.slice(0,a).join("/")+"/"+o.slice(s).join("/")}const Cs={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Xd=function(e){return e.pop="pop",e.push="push",e}({}),gd=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function kC(e){if(!e)if(zi){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),bC(e)}const IC=/^[^#]+#/;function AC(e,t){return e.replace(IC,"#")+t}function _C(e,t){const n=document.documentElement.getBoundingClientRect(),o=e.getBoundingClientRect();return{behavior:t.behavior,left:o.left-n.left-(t.left||0),top:o.top-n.top-(t.top||0)}}const vc=()=>({left:window.scrollX,top:window.scrollY});function PC(e){let t;if("el"in e){const n=e.el,o=typeof n=="string"&&n.startsWith("#"),r=typeof n=="string"?o?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!r)return;t=_C(r,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function $h(e,t){return(history.state?history.state.position-t:-1)+e}const Zd=new Map;function RC(e,t){Zd.set(e,t)}function EC(e){const t=Zd.get(e);return Zd.delete(e),t}function MC(e){return typeof e=="string"||e&&typeof e=="object"}function Eg(e){return typeof e=="string"||typeof e=="symbol"}let rn=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 Mg=Symbol("");rn.MATCHER_NOT_FOUND+"",rn.NAVIGATION_GUARD_REDIRECT+"",rn.NAVIGATION_ABORTED+"",rn.NAVIGATION_CANCELLED+"",rn.NAVIGATION_DUPLICATED+"";function sl(e,t){return jt(new Error,{type:e,[Mg]:!0},t)}function Da(e,t){return e instanceof Error&&Mg in e&&(t==null||!!(e.type&t))}const jC=["params","query","hash"];function LC(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of jC)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function NC(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let o=0;o<n.length;++o){const r=n[o].replace(Ig," "),a=r.indexOf("="),s=Gl(a<0?r:r.slice(0,a)),i=a<0?null:Gl(r.slice(a+1));if(s in t){let l=t[s];Dr(l)||(l=t[s]=[l]),l.push(i)}else t[s]=i}return t}function Oh(e){let t="";for(let n in e){const o=e[n];if(n=vC(n),o==null){o!==void 0&&(t+=(t.length?"&":"")+n);continue}(Dr(o)?o.map(r=>r&&Qd(r)):[o&&Qd(o)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+n,r!=null&&(t+="="+r))})}return t}function $C(e){const t={};for(const n in e){const o=e[n];o!==void 0&&(t[n]=Dr(o)?o.map(r=>r==null?null:""+r):o==null?o:""+o)}return t}const OC=Symbol(""),Dh=Symbol(""),gc=Symbol(""),Hf=Symbol(""),ef=Symbol("");function Al(){let e=[];function t(o){return e.push(o),()=>{const r=e.indexOf(o);r>-1&&e.splice(r,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function _s(e,t,n,o,r,a=s=>s()){const s=o&&(o.enterCallbacks[r]=o.enterCallbacks[r]||[]);return()=>new Promise((i,l)=>{const d=f=>{f===!1?l(sl(rn.NAVIGATION_ABORTED,{from:n,to:t})):f instanceof Error?l(f):MC(f)?l(sl(rn.NAVIGATION_GUARD_REDIRECT,{from:t,to:f})):(s&&o.enterCallbacks[r]===s&&typeof f=="function"&&s.push(f),i())},c=a(()=>e.call(o&&o.instances[r],t,n,d));let v=Promise.resolve(c);e.length<3&&(v=v.then(d)),v.catch(f=>l(f))})}function yd(e,t,n,o,r=a=>a()){const a=[];for(const s of e)for(const i in s.components){let l=s.components[i];if(!(t!=="beforeRouteEnter"&&!s.instances[i]))if(xg(l)){const d=(l.__vccOpts||l)[t];d&&a.push(_s(d,n,o,s,i,r))}else{let d=l();a.push(()=>d.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${i}" at "${s.path}"`);const v=aC(c)?c.default:c;s.mods[i]=c,s.components[i]=v;const f=(v.__vccOpts||v)[t];return f&&_s(f,n,o,s,i,r)()}))}}return a}function DC(e,t){const n=[],o=[],r=[],a=Math.max(t.matched.length,e.matched.length);for(let s=0;s<a;s++){const i=t.matched[s];i&&(e.matched.find(d=>al(d,i))?o.push(i):n.push(i));const l=e.matched[s];l&&(t.matched.find(d=>al(d,l))||r.push(l))}return[n,o,r]}/*!
|
|
23
|
+
* vue-router v4.6.4
|
|
24
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
25
|
+
* @license MIT
|
|
26
|
+
*/let FC=()=>location.protocol+"//"+location.host;function jg(e,t){const{pathname:n,search:o,hash:r}=t,a=e.indexOf("#");if(a>-1){let s=r.includes(e.slice(a))?e.slice(a).length:1,i=r.slice(s);return i[0]!=="/"&&(i="/"+i),Lh(i,"")}return Lh(n,e)+o+r}function BC(e,t,n,o){let r=[],a=[],s=null;const i=({state:f})=>{const b=jg(e,location),y=n.value,P=t.value;let B=0;if(f){if(n.value=b,t.value=f,s&&s===y){s=null;return}B=P?f.position-P.position:0}else o(b);r.forEach($=>{$(n.value,y,{delta:B,type:Xd.pop,direction:B?B>0?gd.forward:gd.back:gd.unknown})})};function l(){s=n.value}function d(f){r.push(f);const b=()=>{const y=r.indexOf(f);y>-1&&r.splice(y,1)};return a.push(b),b}function c(){if(document.visibilityState==="hidden"){const{history:f}=window;if(!f.state)return;f.replaceState(jt({},f.state,{scroll:vc()}),"")}}function v(){for(const f of a)f();a=[],window.removeEventListener("popstate",i),window.removeEventListener("pagehide",c),document.removeEventListener("visibilitychange",c)}return window.addEventListener("popstate",i),window.addEventListener("pagehide",c),document.addEventListener("visibilitychange",c),{pauseListeners:l,listen:d,destroy:v}}function Fh(e,t,n,o=!1,r=!1){return{back:e,current:t,forward:n,replaced:o,position:window.history.length,scroll:r?vc():null}}function UC(e){const{history:t,location:n}=window,o={value:jg(e,n)},r={value:t.state};r.value||a(o.value,{back:null,current:o.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(l,d,c){const v=e.indexOf("#"),f=v>-1?(n.host&&document.querySelector("base")?e:e.slice(v))+l:FC()+e+l;try{t[c?"replaceState":"pushState"](d,"",f),r.value=d}catch(b){console.error(b),n[c?"replace":"assign"](f)}}function s(l,d){a(l,jt({},t.state,Fh(r.value.back,l,r.value.forward,!0),d,{position:r.value.position}),!0),o.value=l}function i(l,d){const c=jt({},r.value,t.state,{forward:l,scroll:vc()});a(c.current,c,!0),a(l,jt({},Fh(o.value,l,null),{position:c.position+1},d),!1),o.value=l}return{location:o,state:r,push:i,replace:s}}function zC(e){e=kC(e);const t=UC(e),n=BC(e,t.state,t.location,t.replace);function o(a,s=!0){s||n.pauseListeners(),history.go(a)}const r=jt({location:"",base:e,go:o,createHref:AC.bind(null,e)},t,n);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>t.state.value}),r}function HC(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),zC(e)}let vi=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var Tn=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}(Tn||{});const qC={type:vi.Static,value:""},WC=/[a-zA-Z0-9_]/;function GC(e){if(!e)return[[]];if(e==="/")return[[qC]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(b){throw new Error(`ERR (${n})/"${d}": ${b}`)}let n=Tn.Static,o=n;const r=[];let a;function s(){a&&r.push(a),a=[]}let i=0,l,d="",c="";function v(){d&&(n===Tn.Static?a.push({type:vi.Static,value:d}):n===Tn.Param||n===Tn.ParamRegExp||n===Tn.ParamRegExpEnd?(a.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),a.push({type:vi.Param,value:d,regexp:c,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),d="")}function f(){d+=l}for(;i<e.length;){if(l=e[i++],l==="\\"&&n!==Tn.ParamRegExp){o=n,n=Tn.EscapeNext;continue}switch(n){case Tn.Static:l==="/"?(d&&v(),s()):l===":"?(v(),n=Tn.Param):f();break;case Tn.EscapeNext:f(),n=o;break;case Tn.Param:l==="("?n=Tn.ParamRegExp:WC.test(l)?f():(v(),n=Tn.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--);break;case Tn.ParamRegExp:l===")"?c[c.length-1]=="\\"?c=c.slice(0,-1)+l:n=Tn.ParamRegExpEnd:c+=l;break;case Tn.ParamRegExpEnd:v(),n=Tn.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--,c="";break;default:t("Unknown state");break}}return n===Tn.ParamRegExp&&t(`Unfinished custom RegExp for param "${d}"`),v(),s(),r}const Bh="[^/]+?",VC={sensitive:!1,strict:!1,start:!0,end:!0};var uo=function(e){return e[e._multiplier=10]="_multiplier",e[e.Root=90]="Root",e[e.Segment=40]="Segment",e[e.SubSegment=30]="SubSegment",e[e.Static=40]="Static",e[e.Dynamic=20]="Dynamic",e[e.BonusCustomRegExp=10]="BonusCustomRegExp",e[e.BonusWildcard=-50]="BonusWildcard",e[e.BonusRepeatable=-20]="BonusRepeatable",e[e.BonusOptional=-8]="BonusOptional",e[e.BonusStrict=.7000000000000001]="BonusStrict",e[e.BonusCaseSensitive=.25]="BonusCaseSensitive",e}(uo||{});const KC=/[.+*?^${}()[\]/\\]/g;function YC(e,t){const n=jt({},VC,t),o=[];let r=n.start?"^":"";const a=[];for(const d of e){const c=d.length?[]:[uo.Root];n.strict&&!d.length&&(r+="/");for(let v=0;v<d.length;v++){const f=d[v];let b=uo.Segment+(n.sensitive?uo.BonusCaseSensitive:0);if(f.type===vi.Static)v||(r+="/"),r+=f.value.replace(KC,"\\$&"),b+=uo.Static;else if(f.type===vi.Param){const{value:y,repeatable:P,optional:B,regexp:$}=f;a.push({name:y,repeatable:P,optional:B});const j=$||Bh;if(j!==Bh){b+=uo.BonusCustomRegExp;try{`${j}`}catch(q){throw new Error(`Invalid custom RegExp for param "${y}" (${j}): `+q.message)}}let H=P?`((?:${j})(?:/(?:${j}))*)`:`(${j})`;v||(H=B&&d.length<2?`(?:/${H})`:"/"+H),B&&(H+="?"),r+=H,b+=uo.Dynamic,B&&(b+=uo.BonusOptional),P&&(b+=uo.BonusRepeatable),j===".*"&&(b+=uo.BonusWildcard)}c.push(b)}o.push(c)}if(n.strict&&n.end){const d=o.length-1;o[d][o[d].length-1]+=uo.BonusStrict}n.strict||(r+="/?"),n.end?r+="$":n.strict&&!r.endsWith("/")&&(r+="(?:/|$)");const s=new RegExp(r,n.sensitive?"":"i");function i(d){const c=d.match(s),v={};if(!c)return null;for(let f=1;f<c.length;f++){const b=c[f]||"",y=a[f-1];v[y.name]=b&&y.repeatable?b.split("/"):b}return v}function l(d){let c="",v=!1;for(const f of e){(!v||!c.endsWith("/"))&&(c+="/"),v=!1;for(const b of f)if(b.type===vi.Static)c+=b.value;else if(b.type===vi.Param){const{value:y,repeatable:P,optional:B}=b,$=y in d?d[y]:"";if(Dr($)&&!P)throw new Error(`Provided param "${y}" is an array but it is not repeatable (* or + modifiers)`);const j=Dr($)?$.join("/"):$;if(!j)if(B)f.length<2&&(c.endsWith("/")?c=c.slice(0,-1):v=!0);else throw new Error(`Missing required param "${y}"`);c+=j}}return c||"/"}return{re:s,score:o,keys:a,parse:i,stringify:l}}function JC(e,t){let n=0;for(;n<e.length&&n<t.length;){const o=t[n]-e[n];if(o)return o;n++}return e.length<t.length?e.length===1&&e[0]===uo.Static+uo.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===uo.Static+uo.Segment?1:-1:0}function Lg(e,t){let n=0;const o=e.score,r=t.score;for(;n<o.length&&n<r.length;){const a=JC(o[n],r[n]);if(a)return a;n++}if(Math.abs(r.length-o.length)===1){if(Uh(o))return 1;if(Uh(r))return-1}return r.length-o.length}function Uh(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const QC={strict:!1,end:!0,sensitive:!1};function XC(e,t,n){const o=YC(GC(e.path),n),r=jt(o,{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function ZC(e,t){const n=[],o=new Map;t=jh(QC,t);function r(v){return o.get(v)}function a(v,f,b){const y=!b,P=Hh(v);P.aliasOf=b&&b.record;const B=jh(t,v),$=[P];if("alias"in v){const q=typeof v.alias=="string"?[v.alias]:v.alias;for(const be of q)$.push(Hh(jt({},P,{components:b?b.record.components:P.components,path:be,aliasOf:b?b.record:P})))}let j,H;for(const q of $){const{path:be}=q;if(f&&be[0]!=="/"){const ce=f.record.path,W=ce[ce.length-1]==="/"?"":"/";q.path=f.record.path+(be&&W+be)}if(j=XC(q,f,B),b?b.alias.push(j):(H=H||j,H!==j&&H.alias.push(j),y&&v.name&&!qh(j)&&s(v.name)),Ng(j)&&l(j),P.children){const ce=P.children;for(let W=0;W<ce.length;W++)a(ce[W],j,b&&b.children[W])}b=b||j}return H?()=>{s(H)}:Ol}function s(v){if(Eg(v)){const f=o.get(v);f&&(o.delete(v),n.splice(n.indexOf(f),1),f.children.forEach(s),f.alias.forEach(s))}else{const f=n.indexOf(v);f>-1&&(n.splice(f,1),v.record.name&&o.delete(v.record.name),v.children.forEach(s),v.alias.forEach(s))}}function i(){return n}function l(v){const f=nx(v,n);n.splice(f,0,v),v.record.name&&!qh(v)&&o.set(v.record.name,v)}function d(v,f){let b,y={},P,B;if("name"in v&&v.name){if(b=o.get(v.name),!b)throw sl(rn.MATCHER_NOT_FOUND,{location:v});B=b.record.name,y=jt(zh(f.params,b.keys.filter(H=>!H.optional).concat(b.parent?b.parent.keys.filter(H=>H.optional):[]).map(H=>H.name)),v.params&&zh(v.params,b.keys.map(H=>H.name))),P=b.stringify(y)}else if(v.path!=null)P=v.path,b=n.find(H=>H.re.test(P)),b&&(y=b.parse(P),B=b.record.name);else{if(b=f.name?o.get(f.name):n.find(H=>H.re.test(f.path)),!b)throw sl(rn.MATCHER_NOT_FOUND,{location:v,currentLocation:f});B=b.record.name,y=jt({},f.params,v.params),P=b.stringify(y)}const $=[];let j=b;for(;j;)$.unshift(j.record),j=j.parent;return{name:B,path:P,params:y,matched:$,meta:tx($)}}e.forEach(v=>a(v));function c(){n.length=0,o.clear()}return{addRoute:a,resolve:d,removeRoute:s,clearRoutes:c,getRoutes:i,getRecordMatcher:r}}function zh(e,t){const n={};for(const o of t)o in e&&(n[o]=e[o]);return n}function Hh(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:ex(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 ex(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const o in e.components)t[o]=typeof n=="object"?n[o]:n;return t}function qh(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function tx(e){return e.reduce((t,n)=>jt(t,n.meta),{})}function nx(e,t){let n=0,o=t.length;for(;n!==o;){const a=n+o>>1;Lg(e,t[a])<0?o=a:n=a+1}const r=ox(e);return r&&(o=t.lastIndexOf(r,o-1)),o}function ox(e){let t=e;for(;t=t.parent;)if(Ng(t)&&Lg(e,t)===0)return t}function Ng({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Wh(e){const t=Lr(gc),n=Lr(Hf),o=Y(()=>{const l=m(e.to);return t.resolve(l)}),r=Y(()=>{const{matched:l}=o.value,{length:d}=l,c=l[d-1],v=n.matched;if(!c||!v.length)return-1;const f=v.findIndex(al.bind(null,c));if(f>-1)return f;const b=Gh(l[d-2]);return d>1&&Gh(c)===b&&v[v.length-1].path!==b?v.findIndex(al.bind(null,l[d-2])):f}),a=Y(()=>r.value>-1&&lx(n.params,o.value.params)),s=Y(()=>r.value>-1&&r.value===n.matched.length-1&&Rg(n.params,o.value.params));function i(l={}){if(ix(l)){const d=t[m(e.replace)?"replace":"push"](m(e.to)).catch(Ol);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>d),d}return Promise.resolve()}return{route:o,href:Y(()=>o.value.href),isActive:a,isExactActive:s,navigate:i}}function rx(e){return e.length===1?e[0]:e}const ax=vn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Wh,setup(e,{slots:t}){const n=dc(Wh(e)),{options:o}=Lr(gc),r=Y(()=>({[Vh(e.activeClass,o.linkActiveClass,"router-link-active")]:n.isActive,[Vh(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&rx(t.default(n));return e.custom?a:Uf("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:r.value},a)}}}),sx=ax;function ix(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 lx(e,t){for(const n in t){const o=t[n],r=e[n];if(typeof o=="string"){if(o!==r)return!1}else if(!Dr(r)||r.length!==o.length||o.some((a,s)=>a.valueOf()!==r[s].valueOf()))return!1}return!0}function Gh(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Vh=(e,t,n)=>e??t??n,ux=vn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const o=Lr(ef),r=Y(()=>e.route||o.value),a=Lr(Dh,0),s=Y(()=>{let d=m(a);const{matched:c}=r.value;let v;for(;(v=c[d])&&!v.components;)d++;return d}),i=Y(()=>r.value.matched[s.value]);Lu(Dh,Y(()=>s.value+1)),Lu(OC,i),Lu(ef,r);const l=S();return ot(()=>[l.value,i.value,e.name],([d,c,v],[f,b,y])=>{c&&(c.instances[v]=d,b&&b!==c&&d&&d===f&&(c.leaveGuards.size||(c.leaveGuards=b.leaveGuards),c.updateGuards.size||(c.updateGuards=b.updateGuards))),d&&c&&(!b||!al(c,b)||!f)&&(c.enterCallbacks[v]||[]).forEach(P=>P(d))},{flush:"post"}),()=>{const d=r.value,c=e.name,v=i.value,f=v&&v.components[c];if(!f)return Kh(n.default,{Component:f,route:d});const b=v.props[c],y=b?b===!0?d.params:typeof b=="function"?b(d):b:null,B=Uf(f,jt({},y,t,{onVnodeUnmounted:$=>{$.component.isUnmounted&&(v.instances[c]=null)},ref:l}));return Kh(n.default,{Component:B,route:d})||B}}});function Kh(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const cx=ux;function dx(e){const t=ZC(e.routes,e),n=e.parseQuery||NC,o=e.stringifyQuery||Oh,r=e.history,a=Al(),s=Al(),i=Al(),l=nS(Cs);let d=Cs;zi&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=md.bind(null,N=>""+N),v=md.bind(null,yC),f=md.bind(null,Gl);function b(N,ie){let se,Oe;return Eg(N)?(se=t.getRecordMatcher(N),Oe=ie):Oe=N,t.addRoute(Oe,se)}function y(N){const ie=t.getRecordMatcher(N);ie&&t.removeRoute(ie)}function P(){return t.getRoutes().map(N=>N.record)}function B(N){return!!t.getRecordMatcher(N)}function $(N,ie){if(ie=jt({},ie||l.value),typeof N=="string"){const z=vd(n,N,ie.path),ee=t.resolve({path:z.path},ie),de=r.createHref(z.fullPath);return jt(z,ee,{params:f(ee.params),hash:Gl(z.hash),redirectedFrom:void 0,href:de})}let se;if(N.path!=null)se=jt({},N,{path:vd(n,N.path,ie.path).path});else{const z=jt({},N.params);for(const ee in z)z[ee]==null&&delete z[ee];se=jt({},N,{params:v(z)}),ie.params=v(ie.params)}const Oe=t.resolve(se,ie),De=N.hash||"";Oe.params=c(f(Oe.params));const A=TC(o,jt({},N,{hash:mC(De),path:Oe.path})),M=r.createHref(A);return jt({fullPath:A,hash:De,query:o===Oh?$C(N.query):N.query||{}},Oe,{redirectedFrom:void 0,href:M})}function j(N){return typeof N=="string"?vd(n,N,l.value.path):jt({},N)}function H(N,ie){if(d!==N)return sl(rn.NAVIGATION_CANCELLED,{from:ie,to:N})}function q(N){return W(N)}function be(N){return q(jt(j(N),{replace:!0}))}function ce(N,ie){const se=N.matched[N.matched.length-1];if(se&&se.redirect){const{redirect:Oe}=se;let De=typeof Oe=="function"?Oe(N,ie):Oe;return typeof De=="string"&&(De=De.includes("?")||De.includes("#")?De=j(De):{path:De},De.params={}),jt({query:N.query,hash:N.hash,params:De.path!=null?{}:N.params},De)}}function W(N,ie){const se=d=$(N),Oe=l.value,De=N.state,A=N.force,M=N.replace===!0,z=ce(se,Oe);if(z)return W(jt(j(z),{state:typeof z=="object"?jt({},De,z.state):De,force:A,replace:M}),ie||se);const ee=se;ee.redirectedFrom=ie;let de;return!A&&SC(o,Oe,se)&&(de=sl(rn.NAVIGATION_DUPLICATED,{to:ee,from:Oe}),Ie(Oe,Oe,!0,!1)),(de?Promise.resolve(de):_e(ee,Oe)).catch(te=>Da(te)?Da(te,rn.NAVIGATION_GUARD_REDIRECT)?te:ke(te):ae(te,ee,Oe)).then(te=>{if(te){if(Da(te,rn.NAVIGATION_GUARD_REDIRECT))return W(jt({replace:M},j(te.to),{state:typeof te.to=="object"?jt({},De,te.to.state):De,force:A}),ie||ee)}else te=X(ee,Oe,!0,M,De);return ye(ee,Oe,te),te})}function he(N,ie){const se=H(N,ie);return se?Promise.reject(se):Promise.resolve()}function Se(N){const ie=tt.values().next().value;return ie&&typeof ie.runWithContext=="function"?ie.runWithContext(N):N()}function _e(N,ie){let se;const[Oe,De,A]=DC(N,ie);se=yd(Oe.reverse(),"beforeRouteLeave",N,ie);for(const z of Oe)z.leaveGuards.forEach(ee=>{se.push(_s(ee,N,ie))});const M=he.bind(null,N,ie);return se.push(M),ue(se).then(()=>{se=[];for(const z of a.list())se.push(_s(z,N,ie));return se.push(M),ue(se)}).then(()=>{se=yd(De,"beforeRouteUpdate",N,ie);for(const z of De)z.updateGuards.forEach(ee=>{se.push(_s(ee,N,ie))});return se.push(M),ue(se)}).then(()=>{se=[];for(const z of A)if(z.beforeEnter)if(Dr(z.beforeEnter))for(const ee of z.beforeEnter)se.push(_s(ee,N,ie));else se.push(_s(z.beforeEnter,N,ie));return se.push(M),ue(se)}).then(()=>(N.matched.forEach(z=>z.enterCallbacks={}),se=yd(A,"beforeRouteEnter",N,ie,Se),se.push(M),ue(se))).then(()=>{se=[];for(const z of s.list())se.push(_s(z,N,ie));return se.push(M),ue(se)}).catch(z=>Da(z,rn.NAVIGATION_CANCELLED)?z:Promise.reject(z))}function ye(N,ie,se){i.list().forEach(Oe=>Se(()=>Oe(N,ie,se)))}function X(N,ie,se,Oe,De){const A=H(N,ie);if(A)return A;const M=ie===Cs,z=zi?history.state:{};se&&(Oe||M?r.replace(N.fullPath,jt({scroll:M&&z&&z.scroll},De)):r.push(N.fullPath,De)),l.value=N,Ie(N,ie,se,M),ke()}let pe;function re(){pe||(pe=r.listen((N,ie,se)=>{if(!ct.listening)return;const Oe=$(N),De=ce(Oe,ct.currentRoute.value);if(De){W(jt(De,{replace:!0,force:!0}),Oe).catch(Ol);return}d=Oe;const A=l.value;zi&&RC($h(A.fullPath,se.delta),vc()),_e(Oe,A).catch(M=>Da(M,rn.NAVIGATION_ABORTED|rn.NAVIGATION_CANCELLED)?M:Da(M,rn.NAVIGATION_GUARD_REDIRECT)?(W(jt(j(M.to),{force:!0}),Oe).then(z=>{Da(z,rn.NAVIGATION_ABORTED|rn.NAVIGATION_DUPLICATED)&&!se.delta&&se.type===Xd.pop&&r.go(-1,!1)}).catch(Ol),Promise.reject()):(se.delta&&r.go(-se.delta,!1),ae(M,Oe,A))).then(M=>{M=M||X(Oe,A,!1),M&&(se.delta&&!Da(M,rn.NAVIGATION_CANCELLED)?r.go(-se.delta,!1):se.type===Xd.pop&&Da(M,rn.NAVIGATION_ABORTED|rn.NAVIGATION_DUPLICATED)&&r.go(-1,!1)),ye(Oe,A,M)}).catch(Ol)}))}let xe=Al(),$e=Al(),Ne;function ae(N,ie,se){ke(N);const Oe=$e.list();return Oe.length?Oe.forEach(De=>De(N,ie,se)):console.error(N),Promise.reject(N)}function Ee(){return Ne&&l.value!==Cs?Promise.resolve():new Promise((N,ie)=>{xe.add([N,ie])})}function ke(N){return Ne||(Ne=!N,re(),xe.list().forEach(([ie,se])=>N?se(N):ie()),xe.reset()),N}function Ie(N,ie,se,Oe){const{scrollBehavior:De}=e;if(!zi||!De)return Promise.resolve();const A=!se&&EC($h(N.fullPath,0))||(Oe||!se)&&history.state&&history.state.scroll||null;return Ft().then(()=>De(N,ie,A)).then(M=>M&&PC(M)).catch(M=>ae(M,N,ie))}const ze=N=>r.go(N);let st;const tt=new Set,ct={currentRoute:l,listening:!0,addRoute:b,removeRoute:y,clearRoutes:t.clearRoutes,hasRoute:B,getRoutes:P,resolve:$,options:e,push:q,replace:be,go:ze,back:()=>ze(-1),forward:()=>ze(1),beforeEach:a.add,beforeResolve:s.add,afterEach:i.add,onError:$e.add,isReady:Ee,install(N){N.component("RouterLink",sx),N.component("RouterView",cx),N.config.globalProperties.$router=ct,Object.defineProperty(N.config.globalProperties,"$route",{enumerable:!0,get:()=>m(l)}),zi&&!st&&l.value===Cs&&(st=!0,q(r.location).catch(Oe=>{}));const ie={};for(const Oe in Cs)Object.defineProperty(ie,Oe,{get:()=>l.value[Oe],enumerable:!0});N.provide(gc,ct),N.provide(Hf,jv(ie)),N.provide(ef,l);const se=N.unmount;tt.add(N),N.unmount=function(){tt.delete(N),tt.size<1&&(d=Cs,pe&&pe(),pe=null,l.value=Cs,st=!1,Ne=!1),se()}}};function ue(N){return N.reduce((ie,se)=>ie.then(()=>Se(se)),Promise.resolve())}return ct}function fx(){return Lr(gc)}function px(e){return Lr(Hf)}const Yh=768;function qf(){const e=S(typeof window<"u"?window.innerWidth<Yh:!1);let t=null;function n(o){e.value=o.matches}return Ti(()=>{t=window.matchMedia(`(max-width: ${Yh-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Zl(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const hx={key:0,class:"desktop-sidebar"},mx={class:"desktop-main"},Jh="codex-web-local.sidebar-width.v1",vx=260,gx=620,Qh=320,yx=vn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=qf();function o(d){return Math.min(gx,Math.max(vx,d))}function r(){if(typeof window>"u")return Qh;const d=window.localStorage.getItem(Jh),c=Number(d);return Number.isFinite(c)?o(c):Qh}const a=S(r()),s=Y(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${a.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function i(d){typeof window>"u"||window.localStorage.setItem(Jh,String(d))}function l(d){d.preventDefault();const c=d.clientX,v=a.value,f=y=>{const P=y.clientX-c;a.value=o(v+P)},b=()=>{i(a.value),window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",b)};window.addEventListener("mousemove",f),window.addEventListener("mouseup",b)}return(d,c)=>(_(),F("div",{class:ut(["desktop-layout",{"is-mobile":m(n)}]),style:or(s.value)},[m(n)?(_(),Qe(nl,{key:0,to:"body"},[Fe(tu,{name:"drawer"},{default:pt(()=>[e.isSidebarCollapsed?ve("",!0):(_(),F("div",{key:0,class:"mobile-drawer-backdrop",onClick:c[1]||(c[1]=v=>d.$emit("close-sidebar"))},[w("aside",{class:"mobile-drawer",onClick:c[0]||(c[0]=wt(()=>{},["stop"]))},[ko(d.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):ve("",!0),m(n)?ve("",!0):(_(),F(lt,{key:1},[e.isSidebarCollapsed?ve("",!0):(_(),F("aside",hx,[ko(d.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?ve("",!0):(_(),F("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),w("section",mx,[ko(d.$slots,"content",{},void 0)])],6))}}),xt=(e,t)=>{const n=e.__vccOpts||e;for(const[o,r]of t)n[o]=r;return n},wx=xt(yx,[["__scopeId","data-v-782e512b"]]);function Xh(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Nr extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function ir(e,t){if(typeof e=="string"&&e.length>0)return e;const n=Xh(e);if(!n)return t;const o=n.error;if(typeof o=="string"&&o.length>0)return o;const r=Xh(o);return r&&typeof r.message=="string"&&r.message.length>0?r.message:typeof n.message=="string"&&n.message.length>0?n.message:typeof n.detail=="string"&&n.detail.length>0?n.detail:t}function Fr(e,t,n){return e instanceof Nr?e:e instanceof Error?new Nr(e.message||t,{code:"unknown_error",method:n}):new Nr(t,{code:"unknown_error",method:n})}function $g(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function bx(e,t){const n={method:e,params:t??null};let o;try{o=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(i){throw new Nr(i instanceof Error?i.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let r=null,a=null;try{a=await o.text(),r=JSON.parse(a)}catch{r=null}if(!o.ok){const i=ir(r,"")||(a==null?void 0:a.slice(0,500))||"",l=`RPC ${e} failed with HTTP ${o.status}`;throw new Nr(i?`${l}: ${i}`:l,{code:"http_error",method:e,status:o.status})}const s=r;if(!s||typeof s!="object"||!("result"in s))throw new Nr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:o.status});return s.result}async function Tx(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Nr(ir(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 Sx(e){const t=$g(e);if(!t||typeof t.method!="string"||t.method.length===0)return null;const n=typeof t.atIso=="string"&&t.atIso.length>0?t.atIso:new Date().toISOString();return{method:t.method,params:t.params??null,atIso:n}}function Zh(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function Cx(e){if(typeof window>"u")return()=>{};let t=null,n=!1,o=null;const r=()=>{o!==null&&(window.clearTimeout(o),o=null)},a=(d,c)=>{if(n||o!==null)return;const v=Math.min(1e3*2**c,1e4);o=window.setTimeout(()=>{o=null,!n&&d()},v)},s=d=>{const c=Sx(d);c&&e(c)},i=(d=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const c=new EventSource("/codex-api/events");let v=!1;c.onmessage=f=>{try{s(JSON.parse(f.data))}catch{}},c.addEventListener("ready",f=>{try{const b=f.data?JSON.parse(f.data):{ok:!0};Zh(e,b)}catch{Zh(e)}}),c.onerror=()=>{n||v||c.readyState===EventSource.CLOSED&&(v=!0,c.close(),a(()=>i(d+1),d))},t=()=>{v=!0,c.close()}},l=(d=0)=>{if(typeof WebSocket>"u"||n){i();return}t==null||t();const c=window.location.protocol==="https:"?"wss:":"ws:",v=new WebSocket(`${c}//${window.location.host}/codex-api/ws`);let f=!1,b=!1,y=window.setTimeout(()=>{f||n||b||(b=!0,v.close(),i())},2500);v.onopen=()=>{f=!0,r(),y!==null&&(window.clearTimeout(y),y=null)},v.onmessage=P=>{try{s(JSON.parse(String(P.data)))}catch{}},v.onerror=()=>{},v.onclose=()=>{if(y!==null&&(window.clearTimeout(y),y=null),!(n||b)){if(!f){i();return}a(()=>l(d+1),d)}},t=()=>{b=!0,y!==null&&(window.clearTimeout(y),y=null),v.close()}};return typeof WebSocket<"u"?l():i(),()=>{n=!0,r(),t==null||t()}}async function xx(e){let t;try{t=await fetch("/codex-api/server-requests/respond",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(o){throw new Nr(o instanceof Error?o.message:"Failed to reply to server request",{code:"network_error",method:"server-requests/respond"})}let n=null;try{n=await t.json()}catch{n=null}if(!t.ok)throw new Nr(ir(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function kx(){const e=await fetch("/codex-api/server-requests/pending");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Nr(ir(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=$g(t),o=n==null?void 0:n.data;return Array.isArray(o)?o:[]}async function at(e,t){try{return await bx(e,t)}catch(n){throw Fr(n,`RPC ${e} failed`,e)}}function Qt(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},o=n.message;if(typeof o=="string"&&o.trim().length>0)return o;const r=n.error;return typeof r=="string"&&r.trim().length>0?r:t}function Ge(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function ne(e){return typeof e=="string"&&e.length>0?e:null}function Wt(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Qn(e){return typeof e=="boolean"?e:null}function Er(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}async function Si(e){const t=await e.text();if(!t)return{};try{return JSON.parse(t)}catch{throw new Error(`Expected JSON response from ${e.url||"request"}`)}}function Ju(e){const t=Ge(e);if(!t)return null;const n=ne(t.id),o=ne(t.kind),r=ne(t.name),a=ne(t.prompt),s=ne(t.rrule),i=ne(t.status);return!n||!r||!a||!s||o!=="heartbeat"&&o!=="cron"||i!=="ACTIVE"&&i!=="PAUSED"?null:{id:n,kind:o,name:r,prompt:a,rrule:s,status:i,targetThreadId:ne(t.targetThreadId),cwds:Array.isArray(t.cwds)?t.cwds.filter(l=>typeof l=="string"&&l.trim().length>0):[],createdAtMs:Wt(t.createdAtMs),updatedAtMs:Wt(t.updatedAtMs),nextRunAtMs:Wt(t.nextRunAtMs)}}function Og(e){if(Array.isArray(e))return e.flatMap(n=>{const o=Ju(n);return o?[o]:[]});const t=Ju(e);return t?[t]:[]}async function Ix(){var r;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(ir(t,"Failed to load thread automations"));const n=Ge((r=Ge(t))==null?void 0:r.data),o={};if(!n)return o;for(const[a,s]of Object.entries(n)){const i=Og(s);i.length>0&&(o[a]=i)}return o}async function Ax(){var r;const e=await fetch("/codex-api/project-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(ir(t,"Failed to load project automations"));const n=Ge((r=Ge(t))==null?void 0:r.data),o={};if(!n)return o;for(const[a,s]of Object.entries(n)){const i=Og(s);i.length>0&&(o[a]=i)}return o}async function _x(e){var r;const t=await fetch("/codex-api/thread-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(ir(n,"Failed to save thread automation"));const o=Ju((r=Ge(n))==null?void 0:r.data);if(!o)throw new Error("Thread automation response was malformed");return o}async function Px(e){var r;const t=await fetch("/codex-api/project-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(ir(n,"Failed to save project automation"));const o=Ju((r=Ge(n))==null?void 0:r.data);if(!o)throw new Error("Project automation response was malformed");return o}async function em(e,t){const n=new URLSearchParams({threadId:e});t&&n.set("automationId",t);const o=await fetch(`/codex-api/thread-automation?${n.toString()}`,{method:"DELETE"}),r=await o.json().catch(()=>null);if(!o.ok)throw new Error(ir(r,"Failed to delete thread automation"))}async function Dg(e,t){const n=new URLSearchParams({projectName:e});t&&n.set("automationId",t);const o=await fetch(`/codex-api/project-automation?${n.toString()}`,{method:"DELETE"}),r=await o.json().catch(()=>null);if(!o.ok)throw new Error(ir(r,"Failed to delete project automation"))}async function Rx(e,t){const n=await fetch("/codex-api/thread-automation/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,automationId:t})}),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(ir(o,"Failed to run thread automation"))}const Ex=new Set(["node_modules","dist","build","out",".next",".nuxt","coverage","__pycache__",".cache",".turbo","target",".venv","venv",".idea",".vscode","output"]);function Fg(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>n.startsWith(".")||Ex.has(n))}function Mx(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=Array.isArray(t.files)?t.files:[],o=[];for(const r of n){if(!r||typeof r!="object"||Array.isArray(r))continue;const s=r.path,i=typeof s=="string"?s.trim():"";!i||Fg(i)||o.push({path:i})}return o}async function jx(e,t){await at("fuzzyFileSearch/sessionStart",{sessionId:t,roots:e})}async function Lx(e,t){await at("fuzzyFileSearch/sessionUpdate",{sessionId:e,query:t})}async function Nx(e){await at("fuzzyFileSearch/sessionStop",{sessionId:e}).catch(()=>{})}async function tm(e,t,n=20){const o=e.trim();if(!o)return[];const r=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:o,query:t.trim(),limit:n})}),a=await r.json();if(!r.ok){const d=Qt(a,"Failed to search files");throw new Error(d)}const s=a&&typeof a=="object"&&!Array.isArray(a)?a:{},i=Array.isArray(s.data)?s.data:[],l=[];for(const d of i){if(!d||typeof d!="object"||Array.isArray(d))continue;const v=d.path,f=typeof v=="string"?v.trim():"";!f||Fg(f)||l.push({path:f})}return l}async function $x(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),o=await n.json();if(!n.ok)throw new Error(o.error||"Failed to search threads");return o.data??{threadIds:[],indexedThreadCount:0}}function Ox(e){const t=Ge(e);if(!t)return null;const n=ne(t.id),o=ne(t.threadId),r=ne(t.cwd),a=ne(t.shell);return!n||!o||!r||!a?null:{id:n,threadId:o,cwd:r,shell:a,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:Qn(t.truncated)??!1}}async function dl(e,t){const n=await fetch(e,t),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(ir(o,`Terminal request failed with HTTP ${n.status}`));return o}async function HD(e){var o;const t=await dl("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=Ox((o=Ge(t))==null?void 0:o.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function Dx(){const e=await dl("/codex-api/thread-terminal/status"),t=Ge(e);return{available:Qn(t==null?void 0:t.available)??!1,reason:ne(t==null?void 0:t.reason)||null}}async function qD(e){const t=await dl(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=Ge(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(r=>{const a=Ge(r),s=ne(a==null?void 0:a.label),i=ne(a==null?void 0:a.value),l=ne(a==null?void 0:a.source);return!s||!i||l!=="package"&&l!=="script"&&l!=="make"?[]:[{label:s,value:i,source:l}]})}async function WD(e,t){await dl("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function GD(e,t,n){await dl("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function VD(e){await dl("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}const Bg=["none","minimal","low","medium","high","xhigh","max","ultra"];function il(e){return typeof e=="string"&&Bg.some(t=>t===e)}function Fx(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function Xe(e){return Fx(e)}function Ug(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function Bx(e){const t=Xe(e);return t.startsWith("/")||Ug(t)}function Ux(e){const t=Xe(e).replace(/[\\/]+/gu,"/");return Ug(t)?t.toLowerCase():t}function Uo(e){const t=Xe(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function Xi(e){const t=Xe(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function ar(e){return Uo(e)||Xe(e)||"Projectless"}function Qu(e){const t=Xe(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function nm(e){return new Date(e*1e3).toISOString()}function zx(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Hx(e){const t=e.error;return typeof(t==null?void 0:t.message)=="string"?t.message.trim():""}const qx=/^##\s+(.+?):\s+(.+?)\s*$/,Wx=/^#\s*files mentioned by the user\s*:?\s*$/i;function Gx(e){var r,a;const t=e.split(`
|
|
27
|
+
`).findIndex(s=>Wx.test(s.trim()));if(t<0)return[];const n=e.split(`
|
|
28
|
+
`).slice(t+1),o=[];for(const s of n){const i=s.trim();if(!i)continue;const l=i.match(qx);if(!l)break;const d=(r=l[1])==null?void 0:r.trim(),c=(a=l[2])==null?void 0:a.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");d&&c&&o.push({label:d,path:c})}return o}function Vx(e){const t=/(?:^|\n)\s{0,3}#{0,6}\s*my request for codex\s*:?\s*/giu,n=Array.from(e.matchAll(t));if(n.length===0)return e.trim();const o=n.at(-1);if(!o||typeof o.index!="number")return e.trim();const r=o.index+o[0].length;return e.slice(r).trim()}function zg(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function Kx(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 Yx(e){const t=e.aggregatedOutputSpill;if(!t||typeof t!="object"||Array.isArray(t))return;const n=t,o=typeof n.ref=="string"?n.ref.trim():"",r=i=>typeof i=="number"&&Number.isFinite(i)&&i>0?Math.trunc(i):0,a=r(n.totalBytes),s=r(n.omittedBytes);if(!(s<=0))return{ref:o,totalBytes:a,omittedBytes:s}}function Jx(e){return e.replace(/</giu,"<").replace(/>/giu,">").replace(/&/giu,"&")}function wd(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?Jx(n[1].trim()):""}function Qx(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=wd(t,"current_time_iso"),o=wd(t,"instructions");return!n||!o?null:{automationId:wd(t,"automation_id"),currentTimeIso:n,instructions:o}}function Xx(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],o=[],r=[],a=[];for(const[d,c]of t.entries()){if(c.type==="text"&&typeof c.text=="string"&&c.text.length>0&&n.push(c.text),c.type==="image"&&typeof c.url=="string"&&c.url.trim().length>0&&o.push(c.url.trim()),c.type==="localImage"&&typeof c.path=="string"&&c.path.trim().length>0&&o.push(zg(c.path.trim())),c.type==="skill"){const v=typeof c.name=="string"?c.name.trim():"",f=typeof c.path=="string"?c.path.trim():"";v&&f&&r.push({name:v,path:f})}c.type!=="text"&&c.type!=="image"&&c.type!=="localImage"&&c.type!=="skill"&&a.push({id:`${e}:user-content:${d}`,role:"user",text:"",messageType:`userContent.${c.type}`,rawPayload:zx(c),isUnhandled:!0})}const s=n.join(`
|
|
29
|
+
`),i=Gx(s),l=Qx(s);return{text:(l==null?void 0:l.instructions)??Vx(s),images:o,skills:r,fileAttachments:i,rawBlocks:a,isAutomationRun:l!==null,automationDisplayName:(l==null?void 0:l.automationId)||null}}function Zx(e){var a;const t=e.replace(/\r\n/g,`
|
|
30
|
+
`).trim();if(!t)return null;const n=t.split(`
|
|
31
|
+
`),o=[],r=[];for(const s of n){const i=s.trim();if(!i){o.length===0&&r.push("");continue}const l=i.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(l){const d=(l[1]??" ").toLowerCase(),c=(a=l[2])==null?void 0:a.trim();if(!c)continue;let v="pending";d==="x"&&(v="completed"),(d==="~"||d===">"||d==="-")&&(v="inProgress"),o.push({step:c,status:v});continue}r.push(i)}return o.length===0?null:{explanation:r.join(`
|
|
32
|
+
`).trim()||void 0,steps:o}}function om(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 ek(e){let t=0,n=0;for(const o of e.replace(/\r\n/g,`
|
|
36
|
+
`).split(`
|
|
37
|
+
`))if(o&&!(o.startsWith("+++")||o.startsWith("---")||o.startsWith("@@"))){if(o.startsWith("+")){t+=1;continue}o.startsWith("-")&&(n+=1)}return{addedLineCount:t,removedLineCount:n}}function Hg(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function tf(e){const t=Array.isArray(e)?e:[],n=[];for(const o of t){const r=o,a=typeof r.path=="string"?r.path:"",s=typeof r.diff=="string"?r.diff:"",i=r.kind,l=i==null?void 0:i.type;if(!a||l!=="add"&&l!=="delete"&&l!=="update")continue;const d=l==="update"&&typeof(i==null?void 0:i.move_path)=="string"?i.move_path:null,c=l==="update"?ek(s):l==="add"?{addedLineCount:om(s),removedLineCount:0}:{addedLineCount:0,removedLineCount:om(s)};n.push({path:a,operation:l,movedToPath:d,diff:s,...c})}return n}function tk(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=Xx(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:[zg(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?Kx(t.result):"";return n?[{id:e.id,role:"assistant",text:"",images:[n],messageType:"imageView"}]:[]}}if(e.type==="reasoning"){const t=e,n=Array.isArray(t.summary)?t.summary.filter(i=>typeof i=="string"):[],o=Array.isArray(t.content)?t.content.filter(i=>typeof i=="string"):[],r=n.join(`
|
|
38
|
+
`).trim(),s=o.join(`
|
|
39
|
+
`).trim()||r;return s?[{id:e.id,role:"assistant",text:s,messageType:"reasoning",reasoning:{summary:n,content:o}}]:[]}if(e.type==="mcpToolCall"){const t=e,n=typeof t.server=="string"?t.server:"",o=typeof t.tool=="string"?t.tool:"";if(!n&&!o)return[];const r=t.status;let a="completed";const s=typeof r=="string"?r:r==null?void 0:r.type;(s==="inProgress"||s==="in_progress")&&(a="inProgress"),(s==="failed"||s==="error")&&(a="failed");const i=typeof t.error=="object"&&t.error!==null?String(t.error.message??""):"",l=typeof t.durationMs=="number"?t.durationMs:null;return[{id:e.id,role:"system",text:o,messageType:"toolCall",toolCall:{server:n,tool:o,status:a,error:i,durationMs:l}}]}if(e.type==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:Zx(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=nk(t.status),o=typeof t.command=="string"?t.command:"",r=typeof t.cwd=="string"?t.cwd:null,a=typeof t.aggregatedOutput=="string"?t.aggregatedOutput:"",s=typeof t.exitCode=="number"?t.exitCode:null;return[{id:e.id,role:"system",text:o,messageType:"commandExecution",commandExecution:{command:o,cwd:r,status:n,aggregatedOutput:a,exitCode:s,outputSpill:Yx(t)}}]}if(e.type==="fileChange"){const t=tf(e.changes),n=Hg(e.status);return t.length===0||n!=="completed"?[]:[{id:e.id,role:"system",text:"",messageType:"fileChange",fileChangeStatus:n,fileChanges:t}]}return e.type==="contextCompaction"?[{id:e.id,role:"system",text:"",messageType:"compaction.done"}]:[]}function nk(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function ok(e){const t=e,n=[t.name,t.title,e.preview];for(const o of n)if(typeof o=="string"&&o.trim().length>0)return o.trim();return""}function rk(e){const t=ok(e);return t.length>0?t:"Untitled thread"}function Wf(e){return(e==null?void 0:e.status)==="inProgress"}function Gf(e){const n=e.externalSession;if(!n||typeof n!="object"||Array.isArray(n))return null;const o=n,r=typeof o.origin=="string"&&o.origin.trim().length>0?o.origin.trim():"";return r?{origin:r,active:o.active===!0,lastWriteAt:typeof o.lastWriteAt=="string"?o.lastWriteAt:null}:null}function ak(e){var t;return((t=Gf(e))==null?void 0:t.active)===!0}function qg(e){const t=e;if(t.inProgress===!0||t.status==="inProgress"||t.turnStatus==="inProgress")return!0;const n=t.status;if(n&&typeof n=="object"){const a=n.type;if(a==="active"||a==="inProgress")return!0}const r=(Array.isArray(e.turns)?e.turns:[]).at(-1);return Wf(r)||ak(e)}function Wg(e){const t=e,n=Xe(typeof t.cwd=="string"?t.cwd:e.cwd),o=Ux(n),r=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||o.includes("/.codex/worktrees/")||o.includes("/.git/worktrees/");return{id:e.id,title:rk(e),projectName:ar(n),cwd:n,hasWorktree:r,createdAtIso:nm(e.createdAt),updatedAtIso:nm(e.updatedAt),preview:e.preview,historyMode:t.historyMode==="paginated"?"paginated":"legacy",unread:!1,inProgress:qg(e),externalSession:Gf(e)}}function sk(e){return Wg(e.thread)}function ik(e){const t=new Map;for(const n of e){const o=t.get(n.projectName);o?o.push(n):t.set(n.projectName,[n])}return Array.from(t.entries()).map(([n,o])=>({projectName:n,threads:o.sort((r,a)=>new Date(a.updatedAtIso).getTime()-new Date(r.updatedAtIso).getTime())})).sort((n,o)=>{var s,i;const r=new Date(((s=n.threads[0])==null?void 0:s.updatedAtIso)??0).getTime();return new Date(((i=o.threads[0])==null?void 0:i.updatedAtIso)??0).getTime()-r})}function lk(e){const t=e.data.map(Wg);return ik(t)}function fl(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],o=[];for(let r=0;r<n.length;r++){const a=t+r,s=n[r],i=typeof(s==null?void 0:s.id)=="string"?s.id.trim():"",l=i.length>0?i:void 0,d=Array.isArray(s.items)?s.items:[],c=[];for(const f of d)for(const b of tk(f))c.push({...b,turnId:l,turnIndex:a});const v=Hx(s);if(s.status==="failed"&&v){const f=l??`turn-${a}`;c.push({id:`${f}-error`,role:"system",text:v,messageType:"turnError",turnId:l,turnIndex:a})}o.push(...c)}return ck(uk(o))}function uk(e){var n;let t=-1;for(let o=e.length-1;o>=0;o-=1)if(((n=e[o])==null?void 0:n.messageType)==="compaction.done"){t=o;break}return t<0?e:e.filter((o,r)=>o.messageType!=="compaction.done"||r===t)}function ck(e){var s,i,l;let t=-1;for(let d=0;d<e.length;d+=1)if(((s=e[d])==null?void 0:s.messageType)==="compaction.done"){t=d;break}if(t<0)return e;const n=e[t],o=n.turnIndex;let r=-1;for(let d=0;d<e.length;d+=1)if(((i=e[d])==null?void 0:i.turnIndex)===o&&((l=e[d])==null?void 0:l.role)==="user"){r=d;break}if(r<0||t<=r)return e;const a=e.filter((d,c)=>c!==t);return a.splice(r+1,0,n),a}function Vf(e){if(qg(e.thread))return!0;const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Wf(t.at(-1))}function Gg(e){return Gf(e.thread)}function Kf(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];for(let n=t.length-1;n>=0;n-=1){const o=t[n];if(Wf(o)&&typeof o.id=="string"&&o.id.trim().length>0)return o.id.trim()}return""}const dk=50,fk=3e4,Fi=new Map,pk=5e3;function bd(e){return e&&e.length>0?e:null}function Td(e){return e&&e.length>0?e:null}function hk(e){return il(e)?e:""}function mk(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}function Yf(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],o={};for(let r=0;r<n.length;r+=1){const a=t+r,s=n[r];typeof(s==null?void 0:s.id)!="string"||s.id.length===0||(o[s.id]=a)}return o}function yc(e){const t=Ge(e),n=t==null?void 0:t.threadTurnStartIndex;return Math.max(0,Math.floor(typeof n=="number"?n:0))}function nf(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const o=n.id;if(typeof o=="string"&&o.length>0)return o}return""}function vk(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const o=n.cwd;if(typeof o=="string"&&o.length>0)return o}return""}function Vl(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}function wc(e){var r,a;const t=Ge(e);if(!t)return"";const n=((r=ne(t.modelProvider))==null?void 0:r.trim())??"";if(n)return n;const o=Ge(t.thread);return((a=ne(o==null?void 0:o.modelProvider))==null?void 0:a.trim())??""}function rm(e){var t;if(!e)return null;try{const n=new URL(e,"http://localhost");if(n.pathname!=="/codex-local-image")return null;const o=((t=n.searchParams.get("path"))==null?void 0:t.trim())??"";return o.length>0?o:null}catch{return null}}function gk(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
|
|
40
|
+
`;for(const o of t)n+=`
|
|
41
|
+
## ${o.label}: ${o.path}
|
|
42
|
+
`;return`${n}
|
|
43
|
+
## My request for Codex:
|
|
44
|
+
|
|
45
|
+
${e}
|
|
46
|
+
`}function yk(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function wk(e){try{const t=(e==null?void 0:e.trim())??"",n=t?`/codex-api/provider-models?provider=${encodeURIComponent(t)}`:"/codex-api/provider-models",o=await fetch(n,{signal:AbortSignal.timeout(pk)});let r=null;try{r=await o.json()}catch{r=null}if(o.ok&&Array.isArray(r==null?void 0:r.data))return{ids:r.data.map(a=>typeof a=="string"?a.trim():"").filter((a,s,i)=>a.length>0&&i.indexOf(a)===s),exclusive:r.exclusive===!0}}catch{}return null}function bk(e){var s;const t=Ge(e);if(!t)return null;const n=((s=ne(t.id??t.model))==null?void 0:s.trim())??"";if(!n)return null;const o=t.supportedReasoningEfforts??t.supported_reasoning_efforts,r=Array.isArray(o)?o.flatMap(i=>{const l=Ge(i),d=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return il(d)?[d]:[]}).filter((i,l,d)=>d.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:r,defaultReasoningEffort:il(a)?a:null}}function am(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function Tk(e={}){const t=e.includeProviderModels!==!1,n=t?await wk(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(am);const o=await at("model/list",{}),r=[];for(const a of o.data){const s=bk(a);!s||r.some(i=>i.id===s.id)||r.push(s)}if(!t||!n)return r;for(const a of n.ids)r.some(s=>s.id===a)||r.push(am(a));return r}async function Sk(e={}){return(await Tk(e)).map(t=>t.id)}async function Ck(){const e=await at("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",o=hk(e.config.model_reasoning_effort),r=mk(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:o,speedMode:r}}async function xk(e,t,n){var l;const o=(t==null?void 0:t.trim())??"";if(o)return{model:o,reasoningEffort:e==="plan"?bd(n):Td(n)};let r=null;try{r=await Ck()}catch{r=null}const a=(r==null?void 0:r.model.trim())??"";if(a)return{model:a,reasoningEffort:e==="plan"?bd(n??(r==null?void 0:r.reasoningEffort)):Td(n??(r==null?void 0:r.reasoningEffort))};let s=[];try{s=await Sk()}catch{s=[]}const i=((l=s.find(d=>d.trim().length>0))==null?void 0:l.trim())??"";if(i)return{model:i,reasoningEffort:e==="plan"?bd(n??(r==null?void 0:r.reasoningEffort)):Td(n??(r==null?void 0:r.reasoningEffort))};throw new Error(`${e==="plan"?"Plan":"Default"} mode requires an available model. Wait for models to load and try again.`)}async function kk(e,t){const n=await at("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:lk(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function Ik(e){const t=await at("thread/read",{threadId:e,includeTurns:!1});return sk(t)}async function Ak(e){const t=await at("thread/read",{threadId:e,includeTurns:!0}),n=yc(t),o=fl(t,n);return{model:Vl(t),modelProvider:wc(t),messages:o,inProgress:Vf(t),activeTurnId:Kf(t),hasMoreOlder:n>0,turnIndexByTurnId:Yf(t,n),externalSession:Gg(t)}}async function _k(e,t,n=10){const o=new URLSearchParams({threadId:e,beforeTurnId:t,limit:String(n)}),r=await fetch(`/codex-api/thread-turn-page?${o.toString()}`);if(!r.ok)throw new Error(`Older thread page request failed with ${r.status}`);const a=await r.json();if(!a.result)throw new Error("Older thread page response did not include a thread result");const s=Math.max(0,Math.floor(typeof a.startTurnIndex=="number"?a.startTurnIndex:0));return{messages:fl(a.result,s),inProgress:Vf(a.result),activeTurnId:Kf(a.result),hasMoreOlder:a.hasMoreOlder===!0,startTurnIndex:s,turnIndexByTurnId:Yf(a.result,s)}}async function sm(e=null,t=dk){try{return await kk(e,t)}catch(n){throw Fr(n,"Failed to load thread groups","thread/list")}}async function Pk(e){try{return await Ik(e)}catch(t){throw Fr(t,`Failed to load thread ${e}`,"thread/read")}}async function of(e){try{return await Ak(e)}catch(t){throw Fr(t,`Failed to load thread ${e}`,"thread/read")}}async function Rk(e,t,n){try{return await _k(e,t,n)}catch(o){throw Fr(o,`Failed to load earlier messages for thread ${e}`,"thread/read")}}async function KD(e){const t=new URLSearchParams({ref:e}),n=await fetch(`/codex-api/command-output?${t.toString()}`);if(!n.ok)throw new Error(`Command output request failed with ${n.status}`);const o=await n.json();return typeof o.text=="string"?o.text:""}async function rf(e){const t=Fi.get(e);if(t)return t;const n=(async()=>{const r=await at("thread/resume",{threadId:e}),a=yc(r),s=fl(r,a);return{model:Vl(r),modelProvider:wc(r),messages:s,inProgress:Vf(r),activeTurnId:Kf(r),hasMoreOlder:a>0,turnIndexByTurnId:Yf(r,a),externalSession:Gg(r)}})();Fi.set(e,n);const o=globalThis.setTimeout(()=>{Fi.get(e)===n&&Fi.delete(e)},fk);return n.finally(()=>{globalThis.clearTimeout(o),globalThis.setTimeout(()=>{Fi.get(e)===n&&Fi.delete(e)},2e3)}).catch(()=>{}),n}async function Ek(e){await at("thread/archive",{threadId:e})}async function Mk(e){await at("thread/unarchive",{threadId:e})}async function jk(e){await at("thread/compact/start",{threadId:e})}async function Lk(e,t){await at("thread/name/set",{threadId:e,name:t})}async function Sd(e,t){const n=await at("thread/rollback",{threadId:e,numTurns:t});return fl(n,yc(n))}async function Nk(e,t){const n=await at("thread/revert",{threadId:e,beforeTurnId:t});if(!n.turnsBackwardsCursor)return[];const o=await at("thread/turns/list",{threadId:e,cursor:n.turnsBackwardsCursor,sortDirection:"desc",limit:200,itemsView:"full"});return fl({thread:{...n.thread,turns:o.data}},0)}async function im(e,t){try{const n={};typeof e=="string"&&e.trim().length>0&&(n.cwd=e.trim()),typeof t=="string"&&t.trim().length>0&&(n.model=t.trim());const o=await at("thread/start",n),r=nf(o);if(!r)throw new Error("thread/start did not return a thread id");return{threadId:r,model:Vl(o),modelProvider:wc(o)}}catch(n){throw Fr(n,"Failed to start a new thread","thread/start")}}async function lm(e,t,n){if(arguments.length<=1)try{const o=await at("thread/fork",{threadId:e,persistExtendedHistory:!0}),r=nf(o);if(!r)throw new Error("thread/fork did not return a thread id");return{threadId:r,cwd:vk(o),model:Vl(o),messages:fl(o,yc(o))}}catch(o){throw Fr(o,`Failed to fork thread ${e}`,"thread/fork")}try{const o=e.trim();if(!o)throw new Error("thread/fork requires threadId");const r={threadId:o};typeof t=="string"&&t.trim().length>0&&(r.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(r.model=n.trim());const a=await at("thread/fork",r),s=nf(a);if(!s)throw new Error("thread/fork did not return a thread id");return{threadId:s,model:Vl(a),modelProvider:wc(a)}}catch(o){throw Fr(o,`Failed to fork thread ${e}`,"thread/fork")}}async function Cd(e,t,n=[],o,r,a,s=[],i){var l;try{const d=(o==null?void 0:o.trim())??"",c=[];for(const j of n){const H=rm(j.trim());H&&c.push({label:yk(H),path:H,fsPath:H})}const v=[...s,...c],f=v.filter((j,H)=>v.findIndex(q=>q.fsPath===j.fsPath)===H),y=[{type:"text",text:gk(t,f)}];for(const j of n){const H=j.trim();if(!H)continue;const q=rm(H);if(q){y.push({type:"localImage",path:q});continue}y.push({type:"image",url:H,image_url:H})}if(a)for(const j of a)y.push({type:"skill",name:j.name,path:j.path});const P=f.map(j=>({label:j.label,path:j.path,fsPath:j.fsPath})),B={threadId:e,input:y};if(P.length>0&&(B.attachments=P),d&&(B.model=d),typeof r=="string"&&r.length>0&&(B.effort=r),i){const j=await xk(i,d,r);B.collaborationMode={mode:i,settings:{model:j.model,reasoning_effort:j.reasoningEffort,developer_instructions:null}}}const $=await at("turn/start",B);return typeof((l=$==null?void 0:$.turn)==null?void 0:l.id)=="string"?$.turn.id.trim():""}catch(d){throw Fr(d,`Failed to start turn for thread ${e}`,"turn/start")}}async function $k(e,t){const n=e.trim(),o=(t==null?void 0:t.trim())||"";if(n)try{if(!o)throw new Error("turn/interrupt requires turnId");await at("turn/interrupt",{threadId:n,turnId:o})}catch(r){throw Fr(r,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}const Ok=5e3,Dk=3e4,um=new Map,cm=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function Fk(e){return il(e)?e:""}function Bk(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}async function Uk(e){const t=e==="fast"?"fast":"standard";await at("config/batchWrite",{edits:[{keyPath:"features.fast_mode",value:!0,mergeStrategy:"upsert"},{keyPath:"service_tier",value:t==="fast"?"fast":null,mergeStrategy:t==="fast"?"upsert":"replace"}],filePath:null,expectedVersion:null})}async function dm(){return await(await fetch("/codex-api/free-mode/status")).json()}async function fm(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function pm(e){return await(await fetch("/codex-api/free-mode/custom-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e})})).json()}async function Bi(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 zk(e){const t=(e==null?void 0:e.trim())??"",n=t,o=um.get(n);if(o&&Date.now()-o.fetchedAt<Dk)return o.result;let r=null;try{const a=t?`/codex-api/provider-models?provider=${encodeURIComponent(t)}`:"/codex-api/provider-models",s=await fetch(a,{signal:AbortSignal.timeout(Ok)});let i=null;try{i=await s.json()}catch{i=null}s.ok&&Array.isArray(i==null?void 0:i.data)&&(r={ids:i.data.map(l=>typeof l=="string"?l.trim():"").filter((l,d,c)=>l.length>0&&c.indexOf(l)===d),exclusive:i.exclusive===!0})}catch{}return um.set(n,{fetchedAt:Date.now(),result:r}),r}function Hk(e){var s;const t=Ge(e);if(!t)return null;const n=((s=ne(t.id??t.model))==null?void 0:s.trim())??"";if(!n)return null;const o=t.supportedReasoningEfforts??t.supported_reasoning_efforts,r=Array.isArray(o)?o.flatMap(i=>{const l=Ge(i),d=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return il(d)?[d]:[]}).filter((i,l,d)=>d.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:r,defaultReasoningEffort:il(a)?a:null}}function hm(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function qk(e={}){const t=e.includeProviderModels!==!1,n=t?await zk(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(hm);const o=await at("model/list",{}),r=[];for(const a of o.data){const s=Hk(a);!s||r.some(i=>i.id===s.id)||r.push(s)}if(!t||!n)return r;for(const a of n.ids)r.some(s=>s.id===a)||r.push(hm(a));return r}async function Wk(){const e=await at("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",o=Fk(e.config.model_reasoning_effort),r=Bk(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:o,speedMode:r}}function Gk(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function Vk(){try{const e=await at("collaborationMode/list",{}),t=new Set,n=[];for(const o of e.data){const r=o.mode;r!=="default"&&r!=="plan"&&r!=="execplans"||t.has(r)||(t.add(r),n.push({value:r,label:Gk(o.name||r)||(r==="plan"?"Plan":"Default")}))}if(n.length>0){for(const o of cm)t.has(o.value)||n.push(o);return n.sort((o,r)=>o.value===r.value?0:o.value==="default"?-1:1)}}catch{}return cm}async function Kk(){return Tx()}function Yk(e){const t=Ge(e);if(!t)return null;const n=ne(t.event??t.name??t.hookName),o=ne(t.command??t.cmd);return!n||!o?null:{event:n,command:o,timeout:Wt(t.timeout??t.timeout_ms),enabled:Qn(t.enabled??t.active)}}async function Jk(){const e=await at("hooks/list",{}),t=[];for(const n of e.data??[]){const o=Ge(n);o&&t.push({cwd:ne(o.cwd)??"",hooks:Array.isArray(o.hooks)?o.hooks.map(Yk).filter(r=>r!==null):[],warnings:Er(o.warnings),errors:Er(o.errors)})}return t}async function YD(e){await at("marketplace/add",{source:e})}async function JD(e){await at("marketplace/remove",{marketplaceName:e})}async function QD(){const e=await at("marketplace/upgrade",{});return{selectedMarketplaces:Er(e.selectedMarketplaces??e.selected_marketplaces),upgradedRoots:Er(e.upgradedRoots??e.upgraded_roots),errors:Er(e.errors)}}function Qk(e){const t=Ge(e);if(!t)return null;const n=ne(t.remotePluginId??t.remote_plugin_id??t.id);return n?{remotePluginId:n,pluginName:ne(t.pluginName??t.plugin_name??t.name)??n,shareUrl:ne(t.shareUrl??t.share_url??t.url)??"",createdAt:ne(t.createdAt??t.created_at)??""}:null}async function XD(e){const t=await at("plugin/share/save",{pluginPath:e});return{remotePluginId:ne(t.remotePluginId??t.remote_plugin_id)??"",shareUrl:ne(t.shareUrl??t.share_url??t.url)??""}}async function ZD(){const e=await at("plugin/share/list",{});return(e.data??e.shares??[]).map(Qk).filter(n=>n!==null)}async function eF(e){await at("plugin/share/delete",{remotePluginId:e})}async function tF(e){await at("plugin/share/checkout",{remotePluginId:e})}function Vg(e){const t=Ge(e);if(!t)return null;const n=ne(t.id),o=ne(t.name);return!n||!o?null:{id:n,name:o,description:ne(t.description)??"",installUrl:ne(t.installUrl??t.install_url)??"",needsAuth:Qn(t.needsAuth??t.needs_auth)??!1}}function Xk(e){const t=Ge(e);if(!t)return null;const n=ne(t.name),o=ne(t.path);if(!n||!o)return null;const r=Ge(t.interface);return{name:n,path:o,description:ne(t.description)??"",enabled:Qn(t.enabled)??!0,displayName:ne((r==null?void 0:r.displayName)??(r==null?void 0:r.display_name))??n,shortDescription:ne(t.shortDescription??t.short_description)??""}}function Kg(e,t={}){const n=Ge(e);if(!n)return null;const o=ne(n.id),r=ne(n.name);if(!o||!r)return null;const a=Ge(n.interface),s=Ge(n.source),i=ne(s==null?void 0:s.type)??"",l=ne(s==null?void 0:s.path),d=ne(s==null?void 0:s.url)??"",c=i==="remote"?t.name??null:null,v=t.path??(i==="local"?l:null),f=ne((a==null?void 0:a.displayName)??(a==null?void 0:a.display_name))??r,b=ne((a==null?void 0:a.shortDescription)??(a==null?void 0:a.short_description)),y=ne((a==null?void 0:a.longDescription)??(a==null?void 0:a.long_description))??"";return{id:o,name:r,displayName:f,description:b??y,longDescription:y,developerName:ne((a==null?void 0:a.developerName)??(a==null?void 0:a.developer_name))??"",category:ne(a==null?void 0:a.category)??"",marketplaceName:t.name??"",marketplaceDisplayName:t.displayName??t.name??"",marketplacePath:v,remoteMarketplaceName:c,sourceType:i,sourceUrl:d,installed:Qn(n.installed)??!1,enabled:Qn(n.enabled)??!0,installPolicy:ne(n.installPolicy??n.install_policy)??"",authPolicy:ne(n.authPolicy??n.auth_policy)??"",logoUrl:ne((a==null?void 0:a.logoUrl)??(a==null?void 0:a.logo_url))??"",logoPath:ne(a==null?void 0:a.logo)??"",composerIconUrl:ne((a==null?void 0:a.composerIconUrl)??(a==null?void 0:a.composer_icon_url))??"",composerIconPath:ne((a==null?void 0:a.composerIcon)??(a==null?void 0:a.composer_icon))??"",brandColor:ne((a==null?void 0:a.brandColor)??(a==null?void 0:a.brand_color))??"",capabilities:Er(a==null?void 0:a.capabilities),defaultPrompt:Er((a==null?void 0:a.defaultPrompt)??(a==null?void 0:a.default_prompt)),screenshotUrls:Er((a==null?void 0:a.screenshotUrls)??(a==null?void 0:a.screenshot_urls)),screenshots:Er(a==null?void 0:a.screenshots),websiteUrl:ne((a==null?void 0:a.websiteUrl)??(a==null?void 0:a.website_url))??"",privacyPolicyUrl:ne((a==null?void 0:a.privacyPolicyUrl)??(a==null?void 0:a.privacy_policy_url))??"",termsOfServiceUrl:ne((a==null?void 0:a.termsOfServiceUrl)??(a==null?void 0:a.terms_of_service_url))??""}}function Zk(e,t=0){const n=Ge(e);if(!n)return null;const o=ne(n.id),r=ne(n.name);if(!o||!r)return null;const a=Ge(n.branding),s=Ge(n.appMetadata??n.app_metadata);return{id:o,name:r,description:ne(n.description)??ne((s==null?void 0:s.seoDescription)??(s==null?void 0:s.seo_description))??"",logoUrl:ne(n.logoUrl??n.logo_url)??"",logoUrlDark:ne(n.logoUrlDark??n.logo_url_dark)??"",distributionChannel:ne(n.distributionChannel??n.distribution_channel)??"",installUrl:ne(n.installUrl??n.install_url)??"",isAccessible:Qn(n.isAccessible??n.is_accessible)??!1,isEnabled:Qn(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:Er(n.pluginDisplayNames??n.plugin_display_names),category:ne(a==null?void 0:a.category)??"",developer:ne(a==null?void 0:a.developer)??ne(s==null?void 0:s.developer)??"",website:ne(a==null?void 0:a.website)??"",privacyPolicy:ne((a==null?void 0:a.privacyPolicy)??(a==null?void 0:a.privacy_policy))??"",termsOfService:ne((a==null?void 0:a.termsOfService)??(a==null?void 0:a.terms_of_service))??"",catalogRank:t}}function eI(e){const t=Ge(e);if(!t)return null;const n=ne(t.name);if(!n)return null;const o=Ge(t.tools)??{},r=Object.entries(o).map(([l,d])=>{const c=Ge(d);return{name:ne(c==null?void 0:c.name)??l,title:ne(c==null?void 0:c.title)??"",description:ne(c==null?void 0:c.description)??""}}),a=Array.isArray(t.resources)?t.resources.map(l=>{const d=Ge(l);return{name:ne(d==null?void 0:d.name)??"",title:ne(d==null?void 0:d.title)??"",uri:ne(d==null?void 0:d.uri)??"",description:ne(d==null?void 0:d.description)??""}}).filter(l=>l.name||l.uri):[],s=t.resourceTemplates??t.resource_templates,i=Array.isArray(s)?s.map(l=>{const d=Ge(l);return{name:ne(d==null?void 0:d.name)??"",title:ne(d==null?void 0:d.title)??"",uriTemplate:ne((d==null?void 0:d.uriTemplate)??(d==null?void 0:d.uri_template))??"",description:ne(d==null?void 0:d.description)??""}}).filter(l=>l.name||l.uriTemplate):[];return{name:n,authStatus:ne(t.authStatus??t.auth_status)??"unsupported",tools:r,resources:a,resourceTemplates:i}}async function nF(e){const t={};e&&e.length>0&&(t.cwds=e);const n=await at("plugin/list",t),o=[];for(const r of n.marketplaces??[]){const a=Ge(r);if(!a)continue;const s=Ge(a.interface),i={name:ne(a.name)??"",displayName:ne((s==null?void 0:s.displayName)??(s==null?void 0:s.display_name))??"",path:ne(a.path)},l=Array.isArray(a.plugins)?a.plugins:[];for(const d of l){const c=Kg(d,i);c&&o.push(c)}}return o}async function oF(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await at("plugin/read",t),o=Ge(n.plugin);if(!o)throw new Error("Plugin detail response is empty");const r=Kg(o.summary,{name:ne(o.marketplaceName)??e.marketplaceName,displayName:e.marketplaceDisplayName,path:ne(o.marketplacePath)??e.marketplacePath})??e;return{summary:r,description:ne(o.description)??r.longDescription,apps:Array.isArray(o.apps)?o.apps.map(Vg).filter(a=>a!==null):[],skills:Array.isArray(o.skills)?o.skills.map(Xk).filter(a=>a!==null):[],mcpServers:Er(o.mcpServers??o.mcp_servers)}}async function rF(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await at("plugin/install",t),o=n.appsNeedingAuth??n.apps_needing_auth??[];return{authPolicy:ne(n.authPolicy??n.auth_policy)??"",appsNeedingAuth:o.map(Vg).filter(r=>r!==null)}}async function aF(e){await at("plugin/uninstall",{pluginId:e})}async function sF(e,t){await at("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function iF(e){const t=[];let n=null,o=0;do{const r={limit:100};n&&(r.cursor=n),e&&(r.threadId=e);const a=await at("app/list",r);for(const s of a.data??[]){const i=Zk(s,o);i&&t.push(i),o+=1}n=ne(a.nextCursor??a.next_cursor)}while(n);return t}async function lF(e,t){await at("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function uF(){const e=[];let t=null;do{const n={};t&&(n.cursor=t);const o=await at("mcpServerStatus/list",n);for(const r of o.data??[]){const a=eI(r);a&&e.push(a)}t=ne(o.nextCursor??o.next_cursor)}while(t);return e}async function cF(){await at("config/mcpServer/reload",{})}async function dF(e){const t=await at("mcpServer/oauth/login",{name:e});return{authorizationUrl:ne(t.authorizationUrl??t.authorization_url)??""}}async function fF(){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 pF(e="",t=null,n=50){const o=new URLSearchParams;e.trim()&&o.set("query",e.trim()),t&&o.set("cursor",t),n&&Number.isFinite(n)&&o.set("limit",String(Math.max(1,Math.floor(n))));const r=o.toString(),a=await fetch(`/codex-api/composio/connectors${r?`?${r}`:""}`);if(!a.ok)throw new Error(`Failed to list Composio connectors (${a.status})`);const s=await a.json();return{data:Array.isArray(s.data)?s.data:[],nextCursor:typeof s.nextCursor=="string"&&s.nextCursor.length>0?s.nextCursor:null,total:typeof s.total=="number"&&Number.isFinite(s.total)?Math.max(0,Math.floor(s.total)):0}}async function hF(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 mF(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 vF(){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 gF(){const e=await fetch("/codex-api/composio/install",{method:"POST"});if(!e.ok)throw new Error(`Failed to install Composio CLI (${e.status})`);return await e.json()}function mm(e){const t=Ge(e);if(!t)return null;const n=Wt(t.usedPercent??t.used_percent);if(n===null)return null;const o=Wt(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:o,windowMinutes:o,resetsAt:Wt(t.resetsAt??t.resets_at)}}function tI(e){const t=Ge(e);if(!t)return null;const n=Qn(t.hasCredits??t.has_credits),o=Qn(t.unlimited);return n===null||o===null?null:{hasCredits:n,unlimited:o,balance:ne(t.balance)}}function vm(e){const t=Ge(e);if(!t)return null;const n=mm(t.primary),o=mm(t.secondary),r=tI(t.credits);return!n&&!o&&!r?null:{limitId:ne(t.limitId??t.limit_id),limitName:ne(t.limitName??t.limit_name),primary:n,secondary:o,credits:r,planType:ne(t.planType??t.plan_type)}}function Yg(e){const t=Ge(e);if(!t)return null;const n=Ge(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),o=vm(n==null?void 0:n.codex);return o||vm(t.rateLimits??t.rate_limits)}const nI=100;function oI(){return nI}function rI(e){return Cx(e)}async function aI(e,t){await xx({id:e,...t})}async function gm(){return kx()}function sI(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=typeof t.id=="string"?t.id.trim():"";if(!n)return null;const o=Array.isArray(t.imageUrls)?t.imageUrls.filter(s=>typeof s=="string"&&s.trim().length>0):[],r=Array.isArray(t.skills)?t.skills.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const i=s,l=typeof i.name=="string"?i.name.trim():"",d=typeof i.path=="string"?i.path.trim():"";return l&&d?[{name:l,path:d}]:[]}):[],a=Array.isArray(t.fileAttachments)?t.fileAttachments.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const i=s,l=typeof i.label=="string"?i.label.trim():"",d=typeof i.path=="string"?i.path.trim():"",c=typeof i.fsPath=="string"?i.fsPath.trim():"";return l&&d&&c?[{label:l,path:d,fsPath:c}]:[]}):[];return{id:n,text:typeof t.text=="string"?t.text:"",imageUrls:o,skills:r,fileAttachments:a,collaborationMode:t.collaborationMode==="plan"?"plan":"default"}}function Jg(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,o]of Object.entries(e)){const r=n.trim();if(!r||!Array.isArray(o))continue;const a=o.flatMap(s=>{const i=sI(s);return i?[i]:[]});a.length>0&&(t[r]=a)}return t}async function ym(){const e=await fetch("/codex-api/thread-queue-state"),t=await e.json();if(!e.ok)throw new Error("Failed to load thread queue state");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return Jg(n.data)}async function iI(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Jg(e))})).ok)throw new Error("Failed to save thread queue state")}async function lI(e,t){const n=await fetch("/codex-api/telegram/configure-bot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botToken:e,allowedUserIds:t})}),o=await n.json();if(!n.ok){const r=Qt(o,"Failed to connect Telegram bot");throw new Error(r)}}async function uI(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const s=Qt(t,"Failed to load Telegram configuration");throw new Error(s)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},o=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{},r=Array.isArray(o.allowedUserIds)?o.allowedUserIds:[],a=[];for(const s of r){if(s==="*"){a.push("*");continue}typeof s=="number"&&Number.isFinite(s)&&a.push(Math.trunc(s))}return{botToken:typeof o.botToken=="string"?o.botToken:"",allowedUserIds:a}}async function cI(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const r=Qt(t,"Failed to load Telegram status");throw new Error(r)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},o=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return{configured:o.configured===!0,active:o.active===!0,mappedChats:typeof o.mappedChats=="number"?o.mappedChats:0,mappedThreads:typeof o.mappedThreads=="number"?o.mappedThreads:0,allowedUsers:typeof o.allowedUsers=="number"?o.allowedUsers:0,allowAllUsers:o.allowAllUsers===!0,lastError:typeof o.lastError=="string"?o.lastError:""}}async function dI(){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 Xu(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 fI(){try{const e=await fetch("/codex-api/thread-reasoning");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function pI(e,t){try{await fetch("/codex-api/thread-reasoning",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,messages:t})})}catch{}}async function hI(){try{const e=await fetch("/codex-api/thread-turn-durations");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function mI(e,t,n){try{await fetch("/codex-api/thread-turn-durations",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,turnId:t,durationMs:n})})}catch{}}async function vI(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function gI(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function yI(){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 wI(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 bI(e,t){var n;try{return((n=(await at("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}function af(e){return e?e.endsWith("/SKILL.md")?e:`${e}/SKILL.md`:""}function TI(e,t){const n=af(e),o=n.split("/").filter(Boolean);if(o.length<2)return null;const r=o.lastIndexOf("skills");if(r>=2){const l=o[r-2]??"";if(l){const d=`/${[...o.slice(0,r+1),l,"SKILL.md"].join("/")}`;if(t.has(d))return{rootPath:d,rootName:l,isNested:d!==n}}}const a=o.indexOf("skills");if(a<0||a+1>=o.length-1)return null;const s=o[a+1]??"";if(!s)return null;const i=`/${[...o.slice(0,a+2),"SKILL.md"].join("/")}`;return t.has(i)?{rootPath:i,rootName:s,isNested:i!==n}:{rootPath:i,rootName:s,isNested:i!==n}}async function SI(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await at("skills/list",t),o=n.data.flatMap(s=>s.skills),r=new Set(o.map(s=>af(s.path)).filter(Boolean)),a=new Map;for(const s of n.data)for(const i of s.skills){if(!i.name)continue;const l=TI(i.path,r),d=af(i.path),v=!!(l!=null&&l.isNested&&r.has(l.rootPath))?l.rootPath:d,f=d===v,b=a.get(v),y={name:i.name,displayName:l&&v===l.rootPath?l.rootName:void 0,description:i.shortDescription||i.description||"",path:v,scope:i.scope,enabled:i.enabled,__hasRoot:f};if(!b){a.set(v,y);continue}if(b.enabled=b.enabled||i.enabled,!b.__hasRoot&&f){a.set(v,y);continue}!b.displayName&&y.displayName&&(b.displayName=y.displayName),!b.description&&y.description&&(b.description=y.description)}return Array.from(a.values()).map(({__hasRoot:s,...i})=>i)}catch{return[]}}const CI=6e4;async function Su(e){const t=new AbortController,n=setTimeout(()=>t.abort(),CI);try{const o=new FormData;o.append("file",e);const r=await fetch("/codex-api/upload-file",{method:"POST",body:o,signal:t.signal});return r.ok?(await r.json()).path??null:null}catch{return null}finally{clearTimeout(n)}}function xI(e){return e==="payment_required"?e:null}function kI(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function wm(e){const t=Ge(e);if(!t)return null;const n=Wt(t.usedPercent??t.used_percent);if(n===null)return null;const o=Wt(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:o,windowMinutes:o,resetsAt:Wt(t.resetsAt??t.resets_at)}}function II(e){const t=Ge(e);if(!t)return null;const n=Qn(t.hasCredits??t.has_credits),o=Qn(t.unlimited);return n===null||o===null?null:{hasCredits:n,unlimited:o,balance:ne(t.balance)}}function AI(e){const t=Ge(e);if(!t)return null;const n=wm(t.primary),o=wm(t.secondary),r=II(t.credits);return!n&&!o&&!r?null:{limitId:ne(t.limitId??t.limit_id),limitName:ne(t.limitName??t.limit_name),primary:n,secondary:o,credits:r,planType:ne(t.planType??t.plan_type)}}function Qg(e,t=null,n=null){const o=Ge(e);if(!o)return null;const r=ne(o.accountId),a=ne(o.storageId)??r,s=ne(o.quotaStatus),i=s==="loading"||s==="ready"||s==="error"?s:"idle";return r?{accountId:r,storageId:a??r,userId:ne(o.userId),authMode:ne(o.authMode),email:ne(o.email),planType:ne(o.planType),lastRefreshedAtIso:ne(o.lastRefreshedAtIso)??"",lastActivatedAtIso:ne(o.lastActivatedAtIso),quotaSnapshot:AI(o.quotaSnapshot),quotaUpdatedAtIso:ne(o.quotaUpdatedAtIso),quotaStatus:i,quotaError:ne(o.quotaError),unavailableReason:xI(o.unavailableReason)??(kI(ne(o.quotaError))?"payment_required":null),isActive:Qn(o.isActive)??(a===n||r===t)}:null}function Xg(e){const t=Ge(e);if(!t)return null;const n=ne(t.clientId??t.client_id??t.id);return n?{clientId:n,deviceName:ne(t.deviceName??t.device_name??t.name)??"",lastSeenAt:ne(t.lastSeenAt??t.last_seen_at??t.lastSeen)}:null}async function _I(){const e=await at("remoteControl/status/read",{}),t=Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[];return{enabled:Qn(e.enabled)??!1,clients:t.map(Xg).filter(n=>n!==null)}}async function PI(){var o;const e=await fetch("/codex-api/approval-policy"),t=await e.json();if(!e.ok)throw new Error(t.error||"Failed to read approval policy");const n=ne((o=t.data)==null?void 0:o.policy)??"";return n==="untrusted"||n==="on-failure"||n==="on-request"||n==="never"?n:"never"}async function RI(e){const t=await fetch("/codex-api/approval-policy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({policy:e})}),n=await t.json();if(!t.ok)throw new Error(n.error||"Failed to save approval policy")}async function EI(e){await at(e?"remoteControl/enable":"remoteControl/disable",{})}async function MI(){const e=await at("remoteControl/pairing/start",{});return{pairingCode:ne(e.pairingCode??e.pairing_code??e.code)??"",expiresAt:ne(e.expiresAt??e.expires_at)}}async function jI(){const e=await at("remoteControl/client/list",{});return(Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[]).map(Xg).filter(n=>n!==null)}async function LI(e){await at("remoteControl/client/revoke",{clientId:e})}async function NI(){try{const e=await at("account/rateLimits/read");return Yg(e)}catch(e){throw Fr(e,"Failed to load account rate limits","account/rateLimits/read")}}function bc(e){const t=Ge(e),n=ne(t==null?void 0:t.activeAccountId),o=ne(t==null?void 0:t.activeStorageId),r=Array.isArray(t==null?void 0:t.accounts)?t==null?void 0:t.accounts:[];return{activeAccountId:n,activeStorageId:o,importedAccountId:ne(t==null?void 0:t.importedAccountId)??void 0,importedStorageId:ne(t==null?void 0:t.importedStorageId)??void 0,accounts:r.map(a=>Qg(a,n,o)).filter(a=>a!==null)}}async function $I(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(Qt(t,"Failed to load accounts"));const n=Ge(t);return bc(n==null?void 0:n.data)}async function bm(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Qt(t,"Failed to refresh accounts"));const n=Ge(t);return bc(n==null?void 0:n.data)}async function OI(){const e=await fetch("/codex-api/accounts/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Qt(t,"Failed to start Codex login"));const n=Ge(t),o=Ge(n==null?void 0:n.data),r=ne(o==null?void 0:o.loginUrl);if(!r)throw new Error("Failed to start Codex login");return r}async function DI(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(Qt(n,"Failed to complete Codex login"));const o=Ge(n);return bc(o==null?void 0:o.data)}async function FI(e){const t=await fetch("/codex-api/accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storageId:e})}),n=await t.json();if(!t.ok)throw new Error(Qt(n,"Failed to switch account"));const o=Ge(n),r=Ge(o==null?void 0:o.data),a=Qg(r==null?void 0:r.account,ne(r==null?void 0:r.activeAccountId),ne(r==null?void 0:r.activeStorageId));if(!a)throw new Error("Failed to switch account");return a}async function BI(e){const t=await fetch("/codex-api/accounts/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storageId:e})}),n=await t.json();if(!t.ok)throw new Error(Qt(n,"Failed to remove account"));const o=Ge(n);return bc(o==null?void 0:o.data)}let Cu=null,Dl=null;function UI(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=a=>{if(!Array.isArray(a))return[];const s=[];for(const i of a)typeof i=="string"&&i.length>0&&!s.includes(i)&&s.push(i);return s},o=t.labels,r={};if(o&&typeof o=="object"&&!Array.isArray(o))for(const[a,s]of Object.entries(o)){const i=typeof a=="string"?Xe(a):"";i.length>0&&typeof s=="string"&&(r[i]=s)}return{order:n(t.order).map(a=>Xe(a)),labels:r,active:n(t.active).map(a=>Xe(a)),projectOrder:n(t.projectOrder).map(a=>Xe(a)),remoteProjects:Array.isArray(t.remoteProjects)?t.remoteProjects.flatMap(a=>{if(!a||typeof a!="object"||Array.isArray(a))return[];const s=a,i=typeof s.id=="string"?s.id.trim():"";return i?[{id:i,hostId:typeof s.hostId=="string"?s.hostId.trim():"",remotePath:typeof s.remotePath=="string"?Xe(s.remotePath):"",label:typeof s.label=="string"?s.label.trim():""}]:[]}):[]}}async function Wi(){return Dl?sf(Dl):(Cu||(Cu=zI().then(e=>(Dl=e,e)).finally(()=>{Cu=null})),sf(await Cu))}async function zI(){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 UI(n.data)}function sf(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 Jf(){Dl=null}async function HI(e,t){const n=(t??"").trim(),o=await fetch("/codex-api/worktree/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,baseBranch:n||void 0})}),r=await o.json();if(!o.ok||!r.data)throw new Error(r.error||"Failed to create worktree");return{...r.data,cwd:Xe(r.data.cwd),gitRoot:Xe(r.data.gitRoot)}}async function qI(e,t){const n=await fetch("/codex-api/worktree/create-permanent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,worktreeName:t})}),o=await n.json();if(!n.ok||!o.data)throw new Error(o.error||"Failed to create worktree");return{...o.data,cwd:Xe(o.data.cwd),gitRoot:Xe(o.data.gitRoot)}}async function WI(e){const t=e.trim();if(!t)return[];const n=new URLSearchParams({sourceCwd:t}),o=await fetch(`/codex-api/worktree/branches?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to load branches");const a=Array.isArray(r.data)?r.data:[],s=[],i=new Set;for(const l of a){if(!l||typeof l!="object"||Array.isArray(l))continue;const d=l,c=typeof d.value=="string"?d.value.trim():"",v=typeof d.label=="string"?d.label.trim():"";!c||i.has(c)||(i.add(c),s.push({value:c,label:v||c}))}return s}async function GI(e){const t=e.trim();if(!t)return{currentBranch:null,headSha:null,headSubject:null,headDate:null,detached:!1,dirty:!1,gitRoot:"",options:[],changedFiles:[]};const n=new URLSearchParams({cwd:t}),o=await fetch(`/codex-api/git/branches?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to load Git branch state");const a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},s=a.currentBranch,i=typeof s=="string"&&s.trim()?s.trim():null,l=Array.isArray(a.options)?a.options:[],d=[],c=new Set;for(const B of l){if(!B||typeof B!="object"||Array.isArray(B))continue;const $=B,j=typeof $.value=="string"?$.value.trim():"",H=typeof $.label=="string"?$.label.trim():"";!j||c.has(j)||(c.add(j),d.push({value:j,label:H||j,isCurrent:$.isCurrent===!0,isRemote:$.isRemote===!0}))}i&&!c.has(i)&&d.unshift({value:i,label:i,isCurrent:!0});const v=a.headSha,f=a.headSubject,b=a.headDate,y=a.gitRoot,P=Zg(a.changedFiles);return{currentBranch:i,headSha:typeof v=="string"&&v.trim()?v.trim():null,headSubject:typeof f=="string"&&f.trim()?f.trim():null,headDate:typeof b=="string"&&b.trim()?b.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof y=="string"?Xe(y):"",options:d,changedFiles:P}}function Zg(e){const t=Array.isArray(e)?e:[],n=[];for(const o of t){if(!o||typeof o!="object"||Array.isArray(o))continue;const r=o,a=r.path,s=typeof a=="string"?Xe(a.trim()):"";if(!s)continue;const i=r.status,l=typeof i=="string"?i.trim():"",d=r.label,c=typeof d=="string"&&d.trim()?d.trim():l;n.push({path:s,previousPath:typeof r.previousPath=="string"&&r.previousPath.trim()?Xe(r.previousPath.trim()):null,status:l,label:c,addedLineCount:typeof r.addedLineCount=="number"?r.addedLineCount:null,removedLineCount:typeof r.removedLineCount=="number"?r.removedLineCount:null})}return n}async function VI(e){const t=e.trim();if(!t)return{isGitRepo:!1,gitRoot:""};const n=new URLSearchParams({cwd:t}),o=await fetch(`/codex-api/git/repository-status?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to read Git repository status");const a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{isGitRepo:a.isGitRepo===!0,gitRoot:typeof a.gitRoot=="string"?Xe(a.gitRoot):""}}async function KI(e,t){var a;const n=await fetch("/codex-api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim()})}),o=await n.json();if(!n.ok)throw new Error(o.error||"Failed to switch branch");const r=(a=o.data)==null?void 0:a.currentBranch;return typeof r=="string"&&r.trim()?r.trim():null}async function YI(e,t,n={}){const o=e.trim(),r=t.trim();if(!o||!r)return[];const a=new URLSearchParams({cwd:o,branch:r,includeResetHistory:n.includeResetHistory===!1?"false":"true"}),s=await fetch(`/codex-api/git/branch-commits?${a.toString()}`),i=await s.json();if(!s.ok)throw new Error(i.error||"Failed to load branch commits");return(Array.isArray(i.data)?i.data:[]).flatMap(d=>{if(!d||typeof d!="object"||Array.isArray(d))return[];const c=d,v=typeof c.sha=="string"?c.sha.trim():"",f=typeof c.shortSha=="string"?c.shortSha.trim():"",b=typeof c.subject=="string"?c.subject.trim():"",y=typeof c.date=="string"?c.date.trim():"";return!v||!f?[]:[{sha:v,shortSha:f,subject:b||f,date:y}]})}async function JI(e,t){const n=e.trim(),o=t.trim();if(!n||!o)return[];const r=new URLSearchParams({cwd:n,sha:o}),a=await fetch(`/codex-api/git/commit-files?${r.toString()}`),s=await a.json();if(!a.ok)throw new Error(s.error||"Failed to load commit files");return(Array.isArray(s.data)?s.data:[]).flatMap(l=>{if(!l||typeof l!="object"||Array.isArray(l))return[];const d=l,c=typeof d.path=="string"?d.path:"",v=typeof d.previousPath=="string"&&d.previousPath.length>0?d.previousPath:null,f=typeof d.status=="string"?d.status.trim():"",b=typeof d.label=="string"?d.label.trim():"",y=typeof d.addedLineCount=="number"&&Number.isFinite(d.addedLineCount)?d.addedLineCount:null,P=typeof d.removedLineCount=="number"&&Number.isFinite(d.removedLineCount)?d.removedLineCount:null;return!c||!f?[]:[{path:c,previousPath:v,status:f,label:b||f,addedLineCount:y,removedLineCount:P}]})}async function QI(e,t,n){const o=await fetch("/codex-api/git/reset-to-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim(),sha:n.trim()})}),r=await o.json();if(!o.ok)throw new Error(r.error||"Failed to reset branch to commit");const a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{currentBranch:typeof a.currentBranch=="string"&&a.currentBranch.trim()?a.currentBranch.trim():null,headSha:typeof a.headSha=="string"&&a.headSha.trim()?a.headSha.trim():null,headSubject:typeof a.headSubject=="string"&&a.headSubject.trim()?a.headSubject.trim():null,headDate:typeof a.headDate=="string"&&a.headDate.trim()?a.headDate.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof a.gitRoot=="string"?Xe(a.gitRoot):"",options:[],changedFiles:Zg(a.changedFiles)}}async function xd(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");Dl=sf(e)}async function xu(e,t){const n=await fetch("/codex-api/project-root",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,createIfMissing:(t==null?void 0:t.createIfMissing)===!0,label:(t==null?void 0:t.label)??""})}),o=await n.json();if(!n.ok){const i=Qt(o,"Failed to open project root");throw new Error(i)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},s=typeof a.path=="string"?Xe(a.path):"";return Jf(),s}function XI(e){return`/codex-api/project-zip?${new URLSearchParams({cwd:e}).toString()}`}function ZI(e,t){var a;const n=e.headers.get("content-disposition")??"",o=n.match(/filename\*=UTF-8''([^;]+)/iu);if(o!=null&&o[1])try{return decodeURIComponent(o[1])}catch{return o[1]}const r=n.match(/filename="?([^";]+)"?/iu);return((a=r==null?void 0:r[1])==null?void 0:a.trim())||t}async function eA(e,t){var c;const n=await fetch(XI(e));if(!n.ok){const v=await n.json().catch(()=>null),f="Failed to export project",b=Qt(v,f),y=[n.status?String(n.status):"",n.statusText].filter(Boolean).join(" "),P=b!==f?b:y?`Failed to export project: ${y}`:f;throw new Error(P)}const o=Number(n.headers.get("content-length")??""),r=Number.isFinite(o)&&o>0?o:null,a=ZI(n,"project.zip"),s=(c=n.body)==null?void 0:c.getReader();if(!s){const v=await n.blob();return t==null||t({loaded:v.size,total:v.size||r}),{blob:v,fileName:a}}const i=[];let l=0;for(t==null||t({loaded:l,total:r});;){const{done:v,value:f}=await s.read();if(v)break;f&&(i.push(new Uint8Array(f)),l+=f.byteLength,t==null||t({loaded:l,total:r}))}const d=i.map(v=>{const f=new Uint8Array(v.byteLength);return f.set(v),f.buffer});return{blob:new Blob(d,{type:n.headers.get("content-type")??"application/zip"}),fileName:a}}async function tA(e,t){const n=new URLSearchParams({parent:t}),o=await fetch(`/codex-api/project-import?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e}),r=await Si(o);if(!o.ok){const l=Qt(r,"Failed to import project");throw new Error(l)}const a=r&&typeof r=="object"&&!Array.isArray(r)?r:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=typeof s.path=="string"?Xe(s.path):"";return i&&Jf(),{path:i,importedSessions:typeof s.importedSessions=="number"?s.importedSessions:0}}async function Tm(){const e=await fetch("/codex-api/home-directory"),t=await e.json();if(!e.ok)throw new Error("Failed to load home directory");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},o=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return typeof o.path=="string"?o.path.trim():""}async function nA(e,t){const n=new URLSearchParams({path:e});(t==null?void 0:t.showHidden)===!0&&n.set("showHidden","1");const o=await fetch(`/codex-local-directories?${n.toString()}`),r=await Si(o);if(!o.ok){const l=Qt(r,"Failed to load local directories");throw new Error(l)}const a=r&&typeof r=="object"&&!Array.isArray(r)?r:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=Array.isArray(s.entries)?s.entries:[];return{path:typeof s.path=="string"?Xe(s.path):"",parentPath:typeof s.parentPath=="string"?Xe(s.parentPath):"",entries:i.flatMap(l=>{if(!l||typeof l!="object"||Array.isArray(l))return[];const d=l,c=typeof d.name=="string"?d.name.trim():"",v=typeof d.path=="string"?Xe(d.path):"";return c&&v?[{name:c,path:v}]:[]})}}async function yF(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-files?${t.toString()}`),o=await Si(n);if(!n.ok){const i=Qt(o,"Failed to load workspace files");throw new Error(i)}const a=(o&&typeof o=="object"&&!Array.isArray(o)?o:{}).data;return(Array.isArray(a)?a:[]).flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const l=i,d=typeof l.path=="string"?Xe(l.path):"",c=typeof l.relativePath=="string"?l.relativePath.trim():"";return!d||!c?[]:[{path:d,relativePath:c,isDirectory:l.isDirectory===!0}]})}async function wF(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-preview?${t.toString()}`),o=await Si(n);if(!n.ok){const i=Qt(o,"Failed to preview file");throw new Error(i)}const a=(o&&typeof o=="object"&&!Array.isArray(o)?o:{}).data,s=a&&typeof a=="object"&&!Array.isArray(a)?a:{};return{path:typeof s.path=="string"?s.path:e,name:typeof s.name=="string"?s.name:"",size:typeof s.size=="number"?s.size:0,isText:s.isText===!0,isImage:s.isImage===!0,content:typeof s.content=="string"?s.content:void 0,truncated:s.truncated===!0}}async function oA(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await Si(t);if(!t.ok){const s=Qt(n,"Failed to create local directory");throw new Error(s)}const o=n&&typeof n=="object"&&!Array.isArray(n)?n:{},r=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},a=typeof r.path=="string"?Xe(r.path):"";return a&&Jf(),a}async function rA(e,t){const n=await fetch("/codex-api/github-clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e,basePath:t})}),o=await Si(n);if(!n.ok){const s=Qt(o,"Failed to clone GitHub repository");throw new Error(s)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return typeof a.path=="string"?Xe(a.path):""}async function aA(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 Si(t);if(!t.ok){const s=Qt(n,"Failed to create new chat folder");throw new Error(s)}const o=n&&typeof n=="object"&&!Array.isArray(n)?n:{},r=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},a=typeof r.cwd=="string"?Xe(r.cwd):"";if(!a)throw new Error("Failed to create new chat folder");return{cwd:a,outputDirectory:typeof r.outputDirectory=="string"?Xe(r.outputDirectory):a,workspaceRoot:typeof r.workspaceRoot=="string"?Xe(r.workspaceRoot):""}}async function sA(e){const t=new URLSearchParams({basePath:e}),n=await fetch(`/codex-api/project-root-suggestion?${t.toString()}`),o=await n.json();if(!n.ok){const s=Qt(o,"Failed to suggest project name");throw new Error(s)}const r=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{};return{name:typeof a.name=="string"?a.name.trim():"",path:typeof a.path=="string"?Xe(a.path):""}}function iA(e){const t=Ge(e);if(!t)return null;const n=ne(t.key),o=typeof t.text=="string"?t.text:"",r=ne(t.kind);return!n||!r||r!=="meta"&&r!=="hunk"&&r!=="add"&&r!=="remove"&&r!=="context"?null:{key:n,kind:r,text:o,oldLine:Wt(t.oldLine),newLine:Wt(t.newLine)}}function lA(e){const t=Ge(e);if(!t)return null;const n=ne(t.id),o=typeof t.header=="string"?t.header:"",r=typeof t.patch=="string"?t.patch:"";return n?{id:n,header:o,patch:r,addedLineCount:Wt(t.addedLineCount)??0,removedLineCount:Wt(t.removedLineCount)??0,oldStart:Wt(t.oldStart),oldLineCount:Wt(t.oldLineCount)??0,newStart:Wt(t.newStart),newLineCount:Wt(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(a=>iA(a)).filter(a=>a!==null):[]}:null}function uA(e){const t=Ge(e);if(!t)return null;const n=ne(t.id),o=ne(t.path),r=ne(t.absolutePath),a=ne(t.operation);return!n||!o||!r||!a||a!=="add"&&a!=="delete"&&a!=="update"&&a!=="rename"?null:{id:n,path:o,absolutePath:r,previousPath:ne(t.previousPath),previousAbsolutePath:ne(t.previousAbsolutePath),operation:a,addedLineCount:Wt(t.addedLineCount)??0,removedLineCount:Wt(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(s=>lA(s)).filter(s=>s!==null):[]}}function ey(e){const t=Ge(e),n=Ge(t==null?void 0:t.data),o=Ge(n==null?void 0:n.summary),r=ne(n==null?void 0:n.scope),a=r==="baseBranch"||r==="commit"?r:"workspace",s=ne(n==null?void 0:n.workspaceView)==="staged"?"staged":"unstaged";return{cwd:ne(n==null?void 0:n.cwd)??"",gitRoot:ne(n==null?void 0:n.gitRoot),isGitRepo:Qn(n==null?void 0:n.isGitRepo)??!1,scope:a,workspaceView:s,baseBranch:ne(n==null?void 0:n.baseBranch),baseBranchOptions:Array.isArray(n==null?void 0:n.baseBranchOptions)?n.baseBranchOptions.map(i=>ne(i)).filter(i=>typeof i=="string"&&i.length>0):[],commitSha:ne(n==null?void 0:n.commitSha),headBranch:ne(n==null?void 0:n.headBranch),mergeBaseSha:ne(n==null?void 0:n.mergeBaseSha),generatedAtIso:ne(n==null?void 0:n.generatedAtIso)??"",summary:{fileCount:Wt(o==null?void 0:o.fileCount)??0,addedLineCount:Wt(o==null?void 0:o.addedLineCount)??0,removedLineCount:Wt(o==null?void 0:o.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(i=>uA(i)).filter(i=>i!==null):[]}}function cA(e){const t=Ge(e),n=Ge(t==null?void 0:t.data);return{fileCount:Wt(n==null?void 0:n.fileCount)??0,addedLineCount:Wt(n==null?void 0:n.addedLineCount)??0,removedLineCount:Wt(n==null?void 0:n.removedLineCount)??0}}async function bF(e,t,n,o,r){const a=new URLSearchParams({cwd:e,scope:t,workspaceView:n});o&&o.trim()&&a.set("baseBranch",o.trim()),r&&r.trim()&&a.set("commitSha",r.trim());const s=await fetch(`/codex-api/review/snapshot?${a.toString()}`),i=await s.json();if(!s.ok)throw new Error(Qt(i,"Failed to load review snapshot"));return ey(i)}async function dA(e,t){const n=new URLSearchParams({cwd:e,workspaceView:t}),o=await fetch(`/codex-api/review/summary?${n.toString()}`),r=await o.json();if(!o.ok)throw new Error(Qt(r,"Failed to load review summary"));return cA(r)}async function TF(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(Qt(n,"Failed to apply review action"));return ey(n)}async function SF(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(Qt(n,"Failed to initialize Git"))}async function fA(e,t,n,o,r,a,s){try{const i=await fetch("/codex-api/thread/rollback-files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,turnId:t,cwd:n,action:o,patchIds:r,scope:a,filePaths:s})}),l=await i.json().catch(()=>({}));if(!i.ok){const d=typeof l.message=="string"&&l.message.trim()?l.message.trim():typeof l.error=="string"&&l.error.trim()?l.error.trim():"Server error";return{changed:0,errors:Array.isArray(l.errors)&&l.errors.length>0?l.errors:[d],message:l.message}}return{changed:l.changed??l.reverted??l.applied??0,errors:Array.isArray(l.errors)?l.errors:[],message:l.message,revertedPatchIds:Array.isArray(l.revertedPatchIds)?l.revertedPatchIds:[],appliedPatchIds:Array.isArray(l.appliedPatchIds)?l.appliedPatchIds:[]}}catch(i){return{changed:0,errors:[i instanceof Error?i.message:"Network error"]}}}async function pA(e,t,n){const o=await fA(e,t,n,"undo");return{reverted:o.changed,errors:o.errors}}const hA={},mA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function vA(e,t){return _(),F("svg",mA,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const Ls=xt(hA,[["render",vA]]),gA={},yA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function wA(e,t){return _(),F("svg",yA,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const ku=xt(gA,[["render",wA]]),bA={},TA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function SA(e,t){return _(),F("svg",TA,[...t[0]||(t[0]=[w("path",{fill:"currentColor",d:"M6 12a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4"},null,-1)])])}const lf=xt(bA,[["render",SA]]),CA={},xA={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function kA(e,t){return _(),F("svg",xA,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 20h4L18.5 9.5a2.828 2.828 0 1 0-4-4L4 16zm9.5-13.5l4 4"},null,-1)])])}const ll=xt(CA,[["render",kA]]),IA={},AA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function _A(e,t){return _(),F("svg",AA,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"},null,-1)])])}const Qf=xt(IA,[["render",_A]]),PA={},RA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function EA(e,t){return _(),F("svg",RA,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m5 19l2.757-7.351A1 1 0 0 1 8.693 11H21a1 1 0 0 1 .986 1.164l-.996 5.211A2 2 0 0 1 19.026 19za2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v2"},null,-1)])])}const MA=xt(PA,[["render",EA]]),jA={},LA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function NA(e,t){return _(),F("svg",LA,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 3L4 14h6l-1 7l9-11h-6z"},null,-1)])])}const Es=xt(jA,[["render",NA]]),ty="codex-web-local.ui-language.v1",$A={English:"English","Simplified Chinese":"简体中文",Commands:"命令",Command:"命令",Local:"本地","Compact the current thread context":"压缩当前线程上下文","Open the code review pane":"打开代码审查面板","Rename the current thread":"重命名当前线程","Archive the current thread":"归档当前线程","Fork the current thread":"派生当前线程","Start a new thread":"新建线程","Open the skills page":"打开技能页面","Generate or update AGENTS.md":"生成或更新 AGENTS.md","Show help about Codex":"显示 Codex 使用帮助","Mention files with @":"使用 @ 提及文件","Show the current git diff":"显示当前 git diff","Clear the input":"清空输入","Search threads":"搜索线程","Filter threads...":"筛选线程...","Clear search":"清除搜索",Chats:"聊天",Projects:"项目",Pinned:"已固定","Chats first":"聊天优先","Sort by":"排序",Created:"创建时间",Updated:"更新时间","New chat":"新聊天","No chats":"没有聊天","Skills Hub":"技能中心","Expand accounts":"展开账户","Collapse accounts":"折叠账户",Accounts:"账户","Reloading…":"重新加载中…",Reload:"重新加载","Run `codex login`, then click reload.":"先运行 `codex login`,然后点击重新加载。",Account:"账户",Workspace:"工作区","Require ⌘ + enter to send":"需要 ⌘ + Enter 才发送","When busy, send as":"忙碌时发送方式",Steer:"引导",Queue:"排队",Appearance:"外观",System:"跟随系统",Dark:"深色",Light:"浅色","Chat width":"聊天宽度","Click to toggle dictation":"点击切换语音输入","Auto send dictation":"语音输入后自动发送",Provider:"提供方","Choose the API provider for the Codex backend":"选择 Codex 后端使用的 API 提供方","OpenRouter API key":"OpenRouter API Key","Get API key":"获取 API Key","Remove custom key, use community keys":"移除自定义 key,改用社区 key",Set:"设置",Save:"保存","API format":"API 格式","OpenRouter API format":"OpenRouter API 格式",Responses:"Responses",Completions:"Completions","OpenCode Zen API key":"OpenCode Zen API Key","Custom endpoint URL":"自定义端点 URL","API key":"API Key","Custom endpoint API format":"自定义端点 API 格式","UI language":"界面语言","Choose the interface language for the app.":"选择应用界面语言。","Dictation language":"听写语言","Auto-detect":"自动检测","Search language...":"搜索语言...",Telegram:"Telegram","Bot token":"Bot Token","Allowed Telegram user IDs":"允许的 Telegram 用户 ID","Put one Telegram user ID per line or separate them with commas. Use `*` to allow all Telegram users. Unauthorized users will see their own ID in the rejection message so they can copy it here.":"每行填写一个 Telegram 用户 ID,或用逗号分隔。使用 `*` 可允许所有 Telegram 用户。未授权用户会在拒绝消息中看到自己的 ID,方便复制到这里。","Saving…":"保存中…","Save Telegram config":"保存 Telegram 配置",Context:"上下文","Worktree name and version":"工作树名称和版本",Settings:"设置","General settings":"常规","Models & providers":"模型与提供商",Integrations:"集成","Usage & about":"用量与关于","Thinking process":"思考过程","Turn process":"本轮过程","Collapse turn process":"收起本轮过程","Expand turn process":"展开本轮过程","{n} process items":"{n} 个过程项","Working…":"执行中…",Processed:"已处理","{n} tools":"{n} 个工具","{n} thoughts":"{n} 条思考","{n} commands":"{n} 个命令","Question navigation":"问题导航","Jump to question {n}":"跳转到问题 {n}","Read {n} files":"已读 {n} 个文件","Search {n} files":"搜索 {n} 个文件","{n} read calls":"{n} 次只读调用","Modified {n} files":"已修改 {n} 个文件","Delegated {n} tasks":"已委派 {n} 个任务","Explored {n} items":"已探索 {n} 项","Stopped: message not submitted, restored to input.":"已停止:消息未提交,已回填到输入框。","Stopped: message not submitted.":"已停止:消息未提交。","Load earlier ({n} turns)":"展开前 {n} 轮对话","Load earlier messages":"加载更早的消息",Steps:"步骤","Implement plan":"执行计划","Plan executed":"计划已执行","Implementing…":"执行中…","Toggle terminal":"切换终端","Open terminal":"打开终端","Terminal command":"终端命令","No commands":"没有命令","Search branches...":"搜索分支...","Let's build":"开始构建","Choose folder":"选择文件夹","Quick search project":"快速搜索项目","Selected folder":"已选文件夹","Select folder":"选择文件夹","Create Project":"创建项目","Create or clone":"创建或克隆","Create or clone project":"创建或克隆项目","Project source":"项目来源","New project":"新项目","Destination folder":"目标文件夹","New project name":"新项目名称","GitHub repository URL":"GitHub 仓库 URL","Create project":"创建项目","Creating…":"创建中…","Clone repository":"克隆仓库","Clone from GitHub":"从 GitHub 克隆","Cloning…":"克隆中…","Current folder":"当前文件夹",Unavailable:"不可用","Opening…":"打开中…",Open:"打开","Show hidden folders":"显示隐藏文件夹","New folder":"新建文件夹","Folder name":"文件夹名称","Filter folders...":"筛选文件夹...",Retry:"重试","Loading folders…":"加载文件夹中…","No folders match this filter.":"没有匹配此筛选条件的文件夹。","No subfolders found here.":"这里没有子文件夹。","Base branch":"基础分支","Select branch":"选择分支","Loading branches…":"加载分支中…","No Git branches found for this folder.":"此文件夹未找到 Git 分支。","Local project":"本地项目","New worktree":"新工作树","Service worker registration failed.":"Service Worker 注册失败。","No matching files":"没有匹配的文件","Add photos & files":"添加图片和文件","Add folder":"添加文件夹","Take photo":"拍照","In-progress send":"执行中发送","Fast mode":"快速模式","Plan mode":"规划模式","Agent proposes a plan before acting":"代理在执行前先提出计划",Model:"模型","Search models...":"搜索模型...",Skills:"技能","Search skills...":"搜索技能...","Search skills and prompts...":"搜索技能和提示词...",Thinking:"思考强度","Saving thread before stop is available":"线程保存后才能停止",Stop:"停止","This thread is running in the Codex TUI":"该线程正在 Codex TUI 中运行","Queue message":"加入队列","Send message":"发送消息",Send:"发送","Drop images or files":"拖放图片或文件","Selected image":"已选图片","Loading messages...":"加载消息中...",Plan:"计划",Updating:"更新中",Step:"步骤","Edit this message":"编辑此消息","Edit message":"编辑消息","Rollback this message":"回退此消息",Rollback:"回退","Fork thread from this response":"从此回复分叉线程",Fork:"分叉","Response copied":"回复已复制","Copy response":"复制回复","Jump to latest":"跳转到最新","Jump to latest output":"跳转到最新输出","Close image preview":"关闭图片预览","Expanded message image":"放大消息图片","Changed files":"已更改文件","Close diff viewer":"关闭 diff 查看器","No diff available":"没有可用 diff","This summary was restored from the final answer text, but the thread history does not include patch diff content for this file.":"此摘要是从最终回答文本恢复的,但线程历史中不包含该文件的补丁 diff 内容。",Review:"审查",Commit:"提交","Close review pane":"关闭审查面板",Compare:"比较",Branch:"分支",Changes:"更改","Loading review state":"加载审查状态中","This folder is not a Git repository":"此文件夹不是 Git 仓库","Initialize Git to review local changes and run Codex review.":"初始化 Git 后即可审查本地更改并运行 Codex review。","Initializing…":"初始化中…","Initialize Git":"初始化 Git","Base branch unavailable":"基础分支不可用","Could not resolve `origin/HEAD`, `main`, or `master` for this repository.":"无法为此仓库解析 `origin/HEAD`、`main` 或 `master`。","No changes in this scope":"此范围内没有更改","No file changes in this commit.":"此提交中没有文件更改。","Your current workspace is clean.":"当前工作区很干净。","No merge diff found against the base branch.":"未找到相对基础分支的合并 diff。","No unified diff available.":"没有可用的统一 diff。",Summary:"摘要",Added:"新增",Deleted:"删除",Renamed:"重命名",Modified:"修改","Repository review":"仓库审查","Staged changes":"已暂存更改","Workspace changes":"工作区更改","Unstage all":"全部取消暂存","Stage all":"全部暂存","Revert all":"全部还原","Unstage file":"取消暂存文件","Stage file":"暂存文件","Revert file":"还原文件","Unstage hunk":"取消暂存代码块","Stage hunk":"暂存代码块","Revert hunk":"还原代码块","Failed to load review snapshot":"加载审查快照失败","Failed to apply review action":"应用审查操作失败","Failed to initialize Git":"初始化 Git 失败","Reviewing current changes":"正在审查当前更改","Failed to start review":"启动审查失败","Review in progress":"审查进行中","Failed to load review result":"加载审查结果失败",pin:"固定","Worktree thread":"工作树线程",Threads:"线程","Organize threads":"整理线程",Organize:"整理","By project":"按项目","Chronological list":"按时间顺序","No matching threads":"没有匹配的线程","Loading threads...":"加载线程中...","Edit name":"编辑名称",Remove:"移除","Project name":"项目名称","No threads":"没有线程","Thread title":"线程标题","Rename thread":"重命名线程","Make it short and recognizable.":"尽量简短且易识别。","Add title...":"输入标题...",Cancel:"取消","Delete thread":"删除线程","Thread automation":"线程自动化","This creates a heartbeat automation attached to the selected thread.":"这会创建一个附加到所选线程的心跳自动化。",Name:"名称","Automation name":"自动化名称",Prompt:"提示词","Search prompt...":"搜索提示词...","Describe what the automation should do":"描述自动化需要执行的内容","Schedule (RRULE)":"计划(RRULE)",Status:"状态",Active:"启用",Paused:"暂停","Expand sidebar":"展开侧边栏","Collapse sidebar":"折叠侧边栏","Start new thread":"新建线程","No skills found":"未找到技能","No results":"没有结果","Approval choices":"审批选项","No, and tell Codex what to do differently":"不允许,并告诉 Codex 应如何调整",Skip:"跳过",Yes:"是","Yes for Session":"本次会话内允许",pending:"条待处理","Do you want to run this command?":"是否运行此命令?","Do you want to make these changes?":"是否进行这些更改?","Do you want to grant these permissions?":"是否授予这些权限?","An MCP server needs your input before Codex can continue.":"MCP 服务器需要你的输入,Codex 才能继续。","Codex needs your answer before it can continue.":"Codex 需要你的回答才能继续。","Codex is waiting for a response before it can continue.":"Codex 正在等待你的回复,然后才能继续。",Server:"服务器","Open authorization link":"打开授权链接",Value:"值",Choice:"选项","Select true or false":"选择 true 或 false",True:"True",False:"False","Select an option":"选择一个选项",Decline:"拒绝",Continue:"继续","Other answer":"其他答案","Fail Tool Call":"使工具调用失败","Success (Empty)":"成功(空结果)","Return Empty Result":"返回空结果","New terminal":"新终端","Hide terminal":"隐藏终端",Close:"关闭","Edit queued message":"编辑排队消息","Send now without interrupting work":"立即发送且不中断当前工作","Delete queued message":"删除排队消息","AppServer API":"AppServer API","Loading method catalog...":"加载方法目录中...",Disabled:"已禁用",Installed:"已安装","Browse files":"浏览文件","Loading skill contents...":"加载技能内容中...","View on GitHub":"在 GitHub 查看","Show all":"显示全部","Hide all":"隐藏全部","No types yet":"还没有类型","Manage installed skills on this machine":"管理此机器上已安装的技能","Skills Sync (GitHub)":"技能同步(GitHub)",Connected:"已连接","Logged in as":"已登录为","Not connected":"未连接",Startup:"启动",Action:"动作",Skill:"技能","Manual sync":"手动同步","GitHub device login":"GitHub 设备登录","and enter code:":"并输入代码:","Login with GitHub":"使用 GitHub 登录","Device Login":"设备登录","Logout GitHub":"退出 GitHub","Syncing...":"同步中...","Startup Sync":"启动同步","Pulling...":"拉取中...",Pull:"拉取","Pushing...":"推送中...",Push:"推送","Installed ({count})":"已安装({count})","Find skills":"查找技能","Search the Skills registry with npx skills find.":"使用 npx skills find 搜索 Skills 注册表。","Searching...":"搜索中...","Search results ({count})":"搜索结果({count})","No matching skills found.":"未找到匹配的技能。","No installed skills found.":"未找到已安装的技能。","Continue in":"运行方式","Search daily":"搜索(日)","Search weekly":"搜索(周)","Search monthly":"搜索(月)","Trending daily":"热门(日)","Trending weekly":"热门(周)","Trending monthly":"热门(月)",Newest:"最新","A-Z":"A-Z","Loading skills...":"加载技能中...","Choose a thread":"选择一个线程","New worktree branch will start from {branch}.":"新工作树分支将从 {branch} 开始。","Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.":"本地项目会直接使用所选文件夹。新工作树会在第一次提问前创建一个隔离的 Git worktree。","Not configured":"未配置",Online:"在线","Configured (offline)":"已配置(离线)","allow all users":"允许所有用户","allowed user(s)":"个允许用户","chat(s)":"个聊天","thread(s)":"个线程",error:"错误",unknown:"未知","Switching…":"切换中…",Switch:"切换","Removing…":"移除中…","Click again to remove":"再次点击以移除","402 Payment Required":"402 需要付费","weekly remaining":"周剩余额度","Unlimited credits":"无限额度",credits:"额度","Loading quota…":"加载额度中…","Quota unavailable":"额度不可用","Fetching account details…":"获取账户详情中…","Unavailable account":"不可用账户","Waiting for Codex thread/tokenUsage/updated events for this thread.":"等待此线程的 Codex tokenUsage 更新事件。","Current context usage":"当前上下文使用量","Cumulative thread usage":"累计线程使用量","Model context window":"模型上下文窗口","Remaining context":"剩余上下文",tokens:"tokens","Model context window is unavailable in the latest usage event.":"最新使用事件中未提供模型上下文窗口。","Awaiting data":"等待数据中",left:"剩余",used:"已用","Updates after the next token usage event":"下次 token 使用事件后更新","Window size unavailable":"窗口大小不可用","Telegram bot token is required.":"需要填写 Telegram Bot Token。","At least one allowed Telegram user ID or * is required.":"至少需要一个允许的 Telegram 用户 ID 或 `*`。","Telegram bot configured. Only allowlisted Telegram users can use the bridge.":"Telegram 机器人已配置。只有白名单中的 Telegram 用户可以使用桥接。","Failed to connect Telegram bot":"连接 Telegram 机器人失败","Failed to load accounts":"加载账户失败","Failed to refresh accounts":"刷新账户失败",Login:"登录","Starting login…":"正在启动登录…","Open login URL":"打开登录链接","Paste localhost callback URL":"粘贴 localhost 回调 URL","Complete Codex login":"完成 Codex 登录","Finish login in the browser, then paste the localhost callback URL here.":"在浏览器中完成登录,然后在这里粘贴 localhost 回调 URL。",Complete:"完成","Completing…":"正在完成…","Failed to start Codex login":"启动 Codex 登录失败","Failed to complete Codex login":"完成 Codex 登录失败","Click Login, or run `codex login`, then click reload.":"点击登录,或运行 `codex login`,然后点击重新加载。","Finish the current turn and pending requests before switching accounts.":"请先完成当前轮次并处理待处理请求后再切换账户。","Failed to switch account":"切换账户失败","Finish the current turn and pending requests before removing the active account.":"请先完成当前轮次并处理待处理请求后再移除当前活动账户。","Failed to remove account":"移除账户失败",enabled:"已启用",disabled:"已禁用","Saving speed setting...":"保存速度设置中...","About 1.5x faster, with credits used at 2x":"速度约提升 1.5 倍,额度消耗为 2 倍","Default speed with normal credit usage":"默认速度,按正常额度消耗","Stop dictation":"停止听写","Click to dictate":"点击开始听写","Hold to dictate":"按住听写",failed:"失败",attaching:"正在附加",Attaching:"正在附加","Attaching file...":"正在附加文件...","files...":"个文件...",attached:"已附加","Could not attach file.":"无法附加文件。","Could not attach":"无法附加","files.":"个文件。","Select a thread to send a message":"选择一个线程后才能发送消息","Loading models for plan mode...":"正在为规划模式加载模型...","Ask Codex anything, @ to add files, / for commands":"向 Codex 提问,@ 添加文件,/ 执行命令",Hide:"隐藏",Terminal:"终端","Terminal input failed":"终端输入失败","Terminal attach failed":"终端附加失败","Creating worktree":"创建工作树","Creating a worktree and running setup.":"正在创建工作树并执行初始化。","Worktree setup failed":"工作树初始化失败","Unable to create worktree. Try again or switch to Local project.":"无法创建工作树。请重试,或切换到本地项目。",Edit:"编辑","Edit automation":"编辑自动化",image:"图片",images:"图片",file:"文件",files:"文件",skill:"技能",skills:"技能","(empty queued message)":"(空的排队消息)",Files:"文件",Unstaged:"未暂存",Staged:"已暂存",Refresh:"刷新",Against:"对比",selected:"已选","Reject Request":"拒绝请求","Uninstalling...":"卸载中...",Uninstall:"卸载","Installing...":"安装中...",Install:"安装",Disable:"禁用",Enable:"启用","When enabled, press Enter to send. When disabled, use Command+Enter to send.":"启用时按 Enter 发送;禁用时使用 Command+Enter 发送。","If a turn is still running, choose whether a new prompt should steer the current turn or be queued.":"如果当前轮次仍在运行,选择新提示是引导当前轮次还是加入队列。","Switch between system theme, light mode, and dark mode.":"在跟随系统、浅色和深色主题之间切换。","Choose how wide the conversation column and composer can grow on desktop screens.":"选择桌面端会话列和输入框的最大宽度。","Use click-to-start and click-to-stop dictation instead of hold-to-talk.":"使用点击开始/停止听写,而不是按住说话。","Automatically send transcribed dictation when recording stops.":"录音停止后自动发送转写结果。","Show or hide GitHub trending project cards on the new thread screen.":"显示或隐藏新线程页面上的 GitHub 热门项目卡片。","Choose transcription language or keep auto-detect.":"选择转写语言,或保持自动检测。",Standard:"标准",Wide:"宽","Extra wide":"超宽",Hooks:"Hooks","Reload lifecycle hooks":"重新加载生命周期 Hooks","Hooks are not supported by this Codex version.":"当前 Codex 版本不支持 Hooks。","Loading hooks…":"加载 Hooks 中…","No hooks registered.":"未注册任何 Hooks。",Global:"全局",Enabled:"已启用","Compacting thread context…":"正在压缩上下文…","Context compacted":"上下文已压缩","Approval policy":"审批策略","Choose when Codex asks for your permission before running commands or changing files.":"选择 Codex 在执行命令或修改文件前何时征求你的许可。","Only untrusted commands":"仅不受信任的命令","After a command fails":"命令失败后","When Codex requests it":"请求时",Never:"从不","Unless trusted":"除非信任",Default:"默认","Execution plans":"执行计划","Not supported by this Codex version":"当前 Codex 版本不支持","Remote control":"远程控制","Enable or disable remote control":"启用或禁用远程控制","Remote control is not supported by this Codex version.":"当前 Codex 版本不支持远程控制。","Pair a new device":"配对新设备","Generate code":"生成配对码","Paired devices":"已配对设备","No paired devices.":"暂无已配对设备。",Revoke:"撤销","Starting…":"启动中…","Add panel":"添加面板","Approval policy saved":"审批策略已保存",Automations:"自动化","Bearer token (optional)":"Bearer Token(可选)","Close panel":"关闭面板","Close side panel":"关闭侧边面板",Codex:"Codex",Compact:"压缩","Compacting…":"正在压缩…","Compacts context before send":"发送前压缩上下文","Auto-compact before send":"发送前自动压缩","Compacting context — the message will send after compaction":"正在压缩上下文——消息将在压缩完成后发送","Auto-compact at or below remaining context percentage. 0 disables auto-compaction and falls back to server-side compaction.":"当剩余上下文占比等于或低于该百分比时,发送前先自动压缩上下文。0 表示关闭,退回服务端自动压缩。","Custom endpoint":"自定义端点","Failed to resolve model from custom endpoint; check the URL and try again":"无法从自定义端点获取模型,请检查 URL 后重试",Off:"关闭",Dismiss:"忽略",Download:"下载","Drag to reorder queued message":"拖动可重新排列排队消息","Exit full screen composer":"退出全屏输入框","Expand composer":"展开输入框","Explore Plugins & Apps":"探索插件与应用","Export Project":"导出项目",Exporting:"正在导出","Failed to share project. Use Download instead.":"项目分享失败,请改用下载。","Files panel":"文件面板","Filter files...":"筛选文件...",Git:"Git","Git panel":"Git 面板","Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.":"将 Codex 接入 Gmail、日历、GitHub、Slack、Browser Use 等应用,让它可以立即帮你处理实际工作。","Import Project":"导入项目","Importing…":"正在导入…","Issue detected":"发现问题","Loading files...":"加载文件中...","Loading…":"加载中…","New in Codex":"Codex 新功能","No files in workspace.":"工作区中没有文件。","No searchable directory for this thread":"此线程没有可搜索的目录","Open side panel":"打开侧边面板","OpenCode Zen":"OpenCode Zen",OpenRouter:"OpenRouter",Plugin:"插件","Plugins are here":"插件来了","Plugins, apps, MCPs":"插件、应用、MCP","Preparing project ZIP...":"正在准备项目 ZIP...","Preparing...":"正在准备...",Ready:"就绪",Repo:"仓库","Scheduled work":"定时任务",Search:"搜索","Search options...":"搜索选项...","Send feedback":"发送反馈",Share:"分享","Skills directory":"技能目录","Terminal panel":"终端面板","This browser blocked sharing the ZIP. Use Download instead.":"浏览器阻止了分享 ZIP,请改用下载。",User:"用户","sk-or-v1-... (optional, uses free keys if empty)":"sk-or-v1-...(可选,留空则使用免费 key)","File preview":"文件预览","Loading file…":"正在加载文件…","Failed to preview file":"文件预览失败","This file type cannot be previewed.":"此文件类型无法预览。","Open in browser":"在浏览器中打开","File is large; showing the first part.":"文件较大,仅显示开头部分。","Confirm delete":"确认删除",Confirm:"确认",Authenticated:"已认证",Failed:"失败","Logged in":"已登录",Unknown:"未知","No auth":"无需认证","No auth required":"无需认证","Connection required":"需要连接","Composio workspace":"Composio 工作区","Apps needing auth":"需要认证的应用","Plugin shares":"插件分享",Connector:"连接器",connected:"已连接",account:"个账户",accounts:"个账户",Manage:"管理",Reconnect:"重新连接",Connect:"连接",App:"应用",Plugins:"插件",Apps:"应用","Composio CLI shares the login and connections from this machine.":"Composio CLI 共享本机的登录状态与连接。","Bearer token":"Bearer Token","Login required":"需要登录","Auth unsupported":"不支持认证","Status unknown":"状态未知","OpenAI catalog":"OpenAI 目录","Ecosystem directory":"生态系统目录",Expired:"已过期",Pending:"待处理","Plugins make Codex work your way.":"插件让 Codex 按你的方式工作。","Connect Codex to external apps and services.":"将 Codex 连接到外部应用与服务。","Browse Composio connectors, auth state, and ready-to-try integrations.":"浏览 Composio 连接器、认证状态与可直接尝试的集成。","MCPs first, then installed skills and GitHub sync state.":"先看 MCP,再是已安装技能与 GitHub 同步状态。","Close plugin detail":"关闭插件详情","Close plugin shares":"关闭插件分享","Close Composio detail":"关闭 Composio 详情","Add another automation":"再添加一个自动化","New thread":"新建线程",methods:"个方法",Schedule:"计划",Daily:"每天",days:"天",Interval:"间隔","Run every day at":"每天运行时间","Run every":"每隔",Unit:"单位","Running…":"运行中…","Run now":"立即运行","Archive and remove":"归档并移除",Delete:"删除",'This will archive the thread "{title}" and remove the attached heartbeat automations.':"这将归档线程「{title}」并移除其关联的心跳自动化。",'This will archive the thread "{title}". You can find it later in archived threads.':"这将归档线程「{title}」。你之后可以在已归档线程中找到它。","Recycle bin":"回收站","Threads you removed are kept here so you can restore them.":"被移除的线程会保存在这里,你可以随时还原。","Recycle bin is empty.":"回收站是空的。",Restore:"还原","Restoring…":"还原中…","Delete permanently":"永久删除","Delete thread?":"删除线程?","Archive chat and remove automations?":"归档聊天并移除自动化?",active:"个进行中",added:"已新增","Add automation":"添加自动化","Add automation…":"添加自动化…",ago:"前","Answer the required field":"请填写必填字段",app:"应用",automations:"个自动化",cached:"缓存",changed:"已更改",Checkout:"检出","Checking out...":"检出中…","command:":"命令:","Context window":"上下文窗口","Copy path":"复制路径",Credits:"额度","cwd:":"工作目录:","day(s)":"天",deleted:"已删除",Detached:"已分离",edited:"已编辑",Edited:"已编辑",Every:"每","exitCode:":"退出码:","Failed to connect {name}":"连接 {name} 失败","Failed to start login for {name}":"为 {name} 启动登录失败","file changed":"个文件已更改","files changed":"个文件已更改","hour(s)":"小时",hours:"小时",Image:"图片",input:"输入","Last turn":"上一轮","Manage automations…":"管理自动化…","minute(s)":"分钟",minutes:"分钟",moved:"已移动","Network access":"网络访问",Next:"下次","Next run":"下次运行","Not scheduled":"未计划",RRULE:"规则","No login URL returned for {name}":"未返回 {name} 的登录链接","Opened {name} authorization":"已打开 {name} 授权",output:"输出",plugin:"插件","plugin installed":"插件已安装","plugin uninstalled":"插件已卸载",Preferred:"首选","Primary window":"主窗口","Project automation":"项目自动化",Read:"读取",reasoning:"推理","Removing...":"移除中…","resets in":"重置于","Resets in":"重置于","runs every":"每","Secondary window":"次窗口","Session total":"会话总计","Share this plugin":"共享此插件","Sharing...":"共享中…",Show:"显示","skill installed":"技能已安装","skill uninstalled":"技能已卸载","start new thread":"新建线程","status:":"状态:",total:"总计","Weekly refresh":"每周刷新",Write:"写入","Current branch":"当前分支","Credits available":"额度可用","Custom schedule":"自定义计划","Detached HEAD":"已分离 HEAD","Every minute":"每分钟",Hourly:"每小时","In context":"上下文内","Loading branch...":"加载分支中...","Rate limits":"速率限制","Resetting now":"正在重置",unlimited:"无限",Weekly:"每周",Window:"窗口","Automation details":"自动化详情","Automation run queued.":"自动化运行已排队。","Automation saved.":"自动化已保存。","Awaiting approval":"等待审批","Awaiting response":"等待响应",Branches:"分支",command:"个命令",commands:"个命令","Command approval required":"需要命令审批",Commits:"提交",Completed:"已完成","Copied commit ref":"已复制提交引用",Copy:"复制","Copy chat":"复制聊天","Create a new automation":"创建新自动化","Create chat fork":"创建聊天分叉",current:"当前",Declined:"已拒绝",Done:"完成","Rollback this turn?":"回退到该轮?",Exit:"退出","Failed to delete project automation":"删除项目自动化失败","Failed to install skill":"安装技能失败","Failed to load automations":"加载自动化失败","Failed to load skills":"加载技能失败","Failed to remove automation":"移除自动化失败","Failed to run automation":"运行自动化失败","Failed to save automation":"保存自动化失败","Failed to search skills":"搜索技能失败","Failed to uninstall skill":"卸载技能失败","Failed to update file changes.":"更新文件变更失败。","Failed to update skill":"更新技能失败","File change approval required":"需要文件变更审批",Heartbeat:"心跳","Input required":"需要输入","Install completed but no local skill path was returned":"安装完成,但未返回本地技能路径","Install completed but the local skill was not found after refresh":"安装完成,但刷新后未找到本地技能","Install failed":"安装失败",Interrupted:"已中断","latest:":"最新:","Loading automations...":"加载自动化中...","Loading commits...":"加载提交中...","MCP server input required":"需要 MCP 服务器输入","Modified files":"修改的文件","New automation":"新自动化","No automations yet":"还没有自动化","No branches found.":"未找到分支。","No commits found.":"未找到提交。","No file changes.":"无文件更改。","No file changes to redo.":"没有可重做的文件变更。","No file changes to undo.":"没有可撤销的文件变更。","No messages in this thread yet.":"此线程还没有消息。",now:"刚刚","Open this chat before copying":"请先打开此聊天再复制","Pin thread":"固定线程","Unpin thread":"取消固定线程",paused:"个已暂停","Permissions approval required":"需要权限审批",Project:"项目","Project automation requires a resolved absolute project path.":"项目自动化需要已解析的绝对项目路径。",Redo:"重做","Redo file changes?":"重做文件变更?","Redo the file changes from this turn? This reapplies the edits to the working tree.":"重做本轮的文件变更?这会重新将修改应用到工作树。",Redoing:"正在重做","Refreshing...":"刷新中...","Rejected from codex-web-local UI.":"已在 codex-web-local 界面中拒绝。","Rename project":"重命名项目",Reset:"重置","Reset-history refs":"重置历史引用",remote:"远程","Review Worktree Changes":"审查工作树更改","Review Worktree Changes (Open)":"审查工作树更改(打开)",Running:"运行中","Search commits...":"搜索提交...","Search skills":"搜索技能","Select a branch.":"请选择一个分支。","Select a chat target for this automation":"为此自动化选择一个聊天目标","Select a project target for this automation":"为此自动化选择一个项目目标",Stopped:"已停止","Command blocked by a permission or sandbox restriction; no approval prompt was shown. Check the approval policy or trusted directories if you expected one.":"命令因权限或沙箱限制被拦截,未弹出审批提示。如预期应出现审批,请检查审批策略或受信任目录。","Output trimmed: {omitted} omitted of {total}.":"输出已截断:省略 {omitted}(共 {total})。","Show full output":"查看完整输出","Loading full output…":"正在加载完整输出…","Could not load the full output.":"无法加载完整输出。",Target:"目标","This creates a heartbeat automation attached to the selected chat.":"这会在所选聊天上创建一个心跳自动化。","This creates a project automation attached to the selected project folder.":"这会在所选项目文件夹上创建一个项目自动化。","This creates heartbeat automations attached to the selected thread.":"这会在所选线程上创建心跳自动化。","This creates project automations attached to the selected project folder.":"这会在所选项目文件夹上创建项目自动化。","This rolls the thread back to this turn so you can edit the message. Later replies will be removed.":"将线程回退到本轮,以便你编辑消息。之后的回复将被移除。","Tool call rejected from codex-web-local UI.":"工具调用已在 codex-web-local 界面中拒绝。","Tool call waiting for response":"工具调用等待响应","Tracked changes must be committed, stashed, or discarded before switching or resetting. Untracked files are allowed unless Git would overwrite them.":"切换或重置前,必须提交、暂存或丢弃已跟踪的更改。除非 Git 会覆盖,否则允许存在未跟踪的文件。",Undo:"撤销","Undo file changes?":"撤销文件变更?","Undo the file changes from this turn? This modifies the working tree and Codex cannot revert it automatically.":"撤销本轮的文件变更?这会修改工作树,Codex 无法自动还原。","Undo the changes to {file}? This modifies the working tree and Codex cannot revert it automatically.":"撤销对 {file} 的变更?这会修改工作树,Codex 无法自动还原。","Redo the changes to {file}? This reapplies the edits to the working tree.":"重做对 {file} 的变更?这会重新应用对工作树的编辑。",Undoing:"正在撤销","Uninstall failed":"卸载失败","Use a thread or project menu to add an automation.":"请通过线程或项目菜单添加自动化。"},Sm={en:"English","zh-CN":"简体中文"};function OA(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(ty))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const Tc=S(OA());function ny(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}ny(Tc.value);function DA(e,t){return t?e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??"")):e}function FA(e){Tc.value=e,ny(e),typeof window<"u"&&window.localStorage.setItem(ty,e)}function oy(e,t){const n=Tc.value==="zh-CN"?$A[e]??e:e;return DA(n,t)}function ha(){return{uiLanguage:Tc,uiLanguageOptions:[{value:"en",label:Sm.en},{value:"zh-CN",label:Sm["zh-CN"]}],t:oy,setUiLanguage:FA}}const ry="brutalstrikedevs@gmail.com",BA=20,UA=6500,Cm=1800,kd=12,xm=240,km=/token|secret|password|passwd|credential|authorization|auth|bearer|cookie|session|key/i,Zi=S([]);let Im=!1,Id=!1,Ad=null;function El(e){if(e instanceof Error)return e.stack||e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function zA(e){return typeof e=="string"?e:e instanceof URL?e.toString():e.url}function HA(e,t){var o;const n=(o=t==null?void 0:t.method)==null?void 0:o.trim();return n?n.toUpperCase():typeof e=="object"&&"method"in e&&typeof e.method=="string"&&e.method.trim()?e.method.trim().toUpperCase():"GET"}function ay(e){return((e||"").split(/\r?\n/,1)[0]??"").replace(/\s+/g," ").trim().slice(0,80)||"issue report"}function Am(e){return encodeURIComponent(e)}function qA(){return`mailto:${ry}`}function WA(){var t;if(typeof document>"u")return"unknown";const e=((t=document.body)==null?void 0:t.innerText.replace(/\r\n/g,`
|
|
47
|
+
`).replace(/[ \t]+/g," ").replace(/\n{3,}/g,`
|
|
48
|
+
|
|
49
|
+
`).trim())??"";return e?e.length>Cm?`${e.slice(0,Cm)}
|
|
50
|
+
...[truncated]`:e:"No visible page text captured."}function GA(e,t){const n=t.replace(/\r\n/g,`
|
|
51
|
+
`).replace(/[ \t]+/g," ").trim();return n?km.test(e)||km.test(n)?`[omitted sensitive value, ${n.length} chars]`:n.length>xm?`${n.slice(0,xm)}...[truncated, ${n.length} chars total]`:n:""}function _m(e,t){if(!e)return`${t}: unavailable`;try{const n=[],o=Math.min(e.length,kd);for(let a=0;a<o;a+=1){const s=e.key(a);s&&n.push(`${s}=${GA(s,e.getItem(s)??"")}`)}const r=e.length>kd?`
|
|
52
|
+
...${e.length-kd} more item(s)`:"";return`${t}:
|
|
53
|
+
${n.join(`
|
|
54
|
+
`)||"empty"}${r}`}catch(n){return`${t}: unavailable (${ay(El(n))})`}}function VA(){return typeof window>"u"?"unknown":[`Path: ${window.location.pathname||"/"}`,`Hash: ${window.location.hash||"(none)"}`,`Search: ${window.location.search||"(none)"}`,`Online: ${typeof navigator>"u"?"unknown":String(navigator.onLine)}`,`Language: ${typeof navigator>"u"?"unknown":navigator.language}`,`Platform: ${typeof navigator>"u"?"unknown":navigator.platform}`,_m(window.localStorage,"localStorage"),_m(window.sessionStorage,"sessionStorage")].join(`
|
|
55
|
+
`)}function fi(e){const t=e.message.trim();if(!t)return;const n=Zi.value[0];if(n&&n.kind===e.kind&&n.message===t&&n.url===e.url&&n.method===e.method&&n.status===e.status)return;const o={...e,message:t,atIso:e.atIso??new Date().toISOString()};Zi.value=[o,...Zi.value].slice(0,BA)}function sy(e=Zi.value){var d;const t=typeof window>"u"?"unknown":`${window.innerWidth}x${window.innerHeight} @${window.devicePixelRatio||1}x`,n=typeof window>"u"?"unknown":window.location.href,o=typeof navigator>"u"?"unknown":navigator.userAgent,r="0.1.121",a="codex-mobile",s=e.slice(0,12).map((c,v)=>[`${v+1}. [${c.atIso}] ${c.kind}`,c.method?`${c.method}`:"",c.url??"",typeof c.status=="number"?`${c.status} ${c.statusText??""}`.trim():"",c.message].filter(Boolean).join(" | ")).join(`
|
|
56
|
+
`),i=["What happened?","","","Context",`URL: ${n}`,`User agent: ${o}`,`Viewport: ${t}`,`App version: ${r}`,`Worktree: ${a}`,"","Browser/app state",VA(),"","Recent diagnostics",s||"No diagnostics captured.","","Visible page text",WA()].join(`
|
|
57
|
+
`).slice(0,UA),l=`Codex Web feedback: ${ay((d=e[0])==null?void 0:d.message)}`;return`mailto:${ry}?subject=${Am(l)}&body=${Am(i)}`}function KA(){typeof window>"u"||(window.location.href=sy())}function YA(){if(!(typeof window>"u")&&(Im||(Im=!0,window.addEventListener("error",e=>{fi({kind:"window-error",message:e.error?El(e.error):e.message,url:e.filename||window.location.href})}),window.addEventListener("unhandledrejection",e=>{fi({kind:"unhandled-rejection",message:El(e.reason),url:window.location.href})})),!Id)){if(typeof window.fetch!="function"){fi({kind:"fetch-error",message:"Feedback diagnostics could not monitor fetch: window.fetch is unavailable",url:window.location.href});return}try{Ad=window.fetch.bind(window),window.fetch=async(e,t)=>{const n=zA(e),o=HA(e,t);try{const r=await Ad(e,t);return r.ok||fi({kind:n.includes("/codex-api/")?"api-response":"fetch-error",message:`Request failed with HTTP ${r.status}`,url:n,method:o,status:r.status,statusText:r.statusText}),r}catch(r){throw fi({kind:"fetch-error",message:El(r),url:n,method:o}),r}},Id=!0}catch(e){Ad=null,Id=!1;try{fi({kind:"fetch-error",message:`Feedback diagnostics could not monitor fetch: ${El(e)}`,url:window.location.href})}catch{}}}}function iy(){const e=Y(()=>Zi.value.length>0);function t(n,o){fi({kind:"visible-error",message:n,url:o||(typeof window>"u"?void 0:window.location.href)})}return{diagnostics:Zi,hasFeedbackDiagnostics:e,recordVisibleFailure:t,openFeedbackMail:KA,buildFeedbackMailto:sy,feedbackMailtoBase:qA}}const ly="codex-web-local.recycle-bin.v1";function uy(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(ly);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>!!n&&typeof n.id=="string"&&typeof n.title=="string"):[]}catch{return[]}}function Pm(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ly,JSON.stringify(e))}catch{}}const Fa=S(uy());function JA(){function e(){Fa.value=uy()}function t(r){Fa.value=[{...r,archivedAtIso:new Date().toISOString()},...Fa.value.filter(a=>a.id!==r.id)],Pm(Fa.value)}function n(r){Fa.value=Fa.value.filter(a=>a.id!==r),Pm(Fa.value)}async function o(r){if(!Fa.value.some(a=>a.id===r))return{ok:!1,error:"Thread is not in the recycle bin"};try{return await Mk(r),n(r),{ok:!0}}catch(a){return{ok:!1,error:a instanceof Error?a.message:"Failed to restore thread"}}}return{records:Fa,loadRecords:e,recordArchivedThread:t,removeArchivedRecord:n,restoreArchivedThread:o}}function Rm(e){const t=Date.parse(e.updatedAtIso);return Number.isFinite(t)?t:0}function QA(e){let t=!1;const n=e.map(o=>{const r=[],a=new Map;for(const s of o.threads){const i=a.get(s.id);if(i===void 0){a.set(s.id,r.length),r.push(s);continue}t=!0,Rm(s)>Rm(r[i])&&(r[i]=s)}return r.length===o.threads.length?o:{...o,threads:r}});return t?n:e}const XA=["title","aria-label","disabled"],ZA={key:1,class:"composer-dropdown-value"},e_={key:0,class:"composer-dropdown-search-wrap"},t_=["placeholder","onKeydown"],n_={class:"composer-dropdown-options",role:"listbox"},o_=["onClick"],r_={key:0,class:"composer-dropdown-empty"},a_=vn({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},selectedPrefixIcon:{},iconOnly:{type:Boolean},openDirection:{},menuAlign:{},enableSearch:{type:Boolean},searchPlaceholder:{},emptyLabel:{},variant:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,o=t,r=S(null),a=S(null),s=S(null),i=S(null),l=S(!1),d=S(""),c=S({});let v=!1;const f=Y(()=>{var xe;const re=n.options.find($e=>$e.value===n.modelValue);return re?re.label:((xe=n.placeholder)==null?void 0:xe.trim())||""}),b=Y(()=>n.openDirection??"down"),y=Y(()=>n.menuAlign??"start"),P=Y(()=>n.iconOnly===!0),B=Y(()=>n.enableSearch===!0),$=Y(()=>n.variant==="pill"?"composer-dropdown-trigger--pill":""),j=Y(()=>{var re;return((re=n.searchPlaceholder)==null?void 0:re.trim())||"Quick search projects"}),H=Y(()=>{var re;return((re=n.emptyLabel)==null?void 0:re.trim())||"No results"}),q=Y(()=>{var re;return f.value||((re=n.placeholder)==null?void 0:re.trim())||"Select option"}),be=Y(()=>{const re=d.value.trim().toLowerCase();return re?n.options.filter(xe=>xe.label.toLowerCase().includes(re)||xe.value.toLowerCase().includes(re)):n.options});function ce(){n.disabled||(l.value=!l.value)}function W(re,xe,$e){return Math.min($e,Math.max(xe,re))}function he(){var ie,se,Oe,De;if(!l.value)return;const re=r.value;if(!re||typeof window>"u")return;const xe=re.getBoundingClientRect(),$e=window.innerWidth,Ne=window.innerHeight,ae=8,Ee=8,ke=Math.max(0,$e-ae*2),Ie=((ie=s.value)==null?void 0:ie.offsetWidth)??((se=a.value)==null?void 0:se.offsetWidth)??224,ze=((Oe=s.value)==null?void 0:Oe.offsetHeight)??((De=a.value)==null?void 0:De.offsetHeight)??0,st=Math.min(Ie,ke),tt=Math.max(ae,$e-st-ae),ct=y.value==="end"?xe.right-st:xe.left,ue=W(ct,ae,tt);let N=b.value==="up"?xe.top-ze-Ee:xe.bottom+Ee;ze>0&&N+ze>Ne-ae&&(N=Ne-ze-ae),N=Math.max(ae,N),c.value={position:"fixed",left:`${ue}px`,right:"auto",top:`${N}px`,bottom:"auto",width:`${st}px`}}function Se(){v||typeof window>"u"||(window.addEventListener("resize",he),window.addEventListener("scroll",he,!0),v=!0)}function _e(){!v||typeof window>"u"||(window.removeEventListener("resize",he),window.removeEventListener("scroll",he,!0),v=!1)}function ye(re){o("update:modelValue",re),l.value=!1,d.value=""}function X(){if(d.value.length>0){d.value="";return}l.value=!1}function pe(re){if(!l.value)return;const xe=r.value;if(!xe)return;const $e=re.target;$e instanceof Node&&(xe.contains($e)||(l.value=!1,d.value=""))}return ot(l,re=>{if(!re){_e(),c.value={};return}Se(),Ft(()=>{var xe;he(),window.requestAnimationFrame(he),B.value&&((xe=i.value)==null||xe.focus())})}),Ti(()=>{window.addEventListener("pointerdown",pe)}),Fs(()=>{window.removeEventListener("pointerdown",pe),_e()}),(re,xe)=>(_(),F("div",{ref_key:"rootRef",ref:r,class:"composer-dropdown"},[w("button",{class:ut(["composer-dropdown-trigger",$.value]),type:"button",title:q.value,"aria-label":q.value,disabled:e.disabled,onClick:ce},[e.selectedPrefixIcon?(_(),Qe(Lf(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):ve("",!0),P.value?ve("",!0):(_(),F("span",ZA,D(f.value),1)),Fe(Ls,{class:"composer-dropdown-chevron"})],10,XA),l.value?(_(),F("div",{key:0,ref_key:"menuWrapRef",ref:a,class:ut(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":b.value==="up","composer-dropdown-menu-wrap-down":b.value==="down"}]),style:or(c.value)},[w("div",{ref_key:"menuRef",ref:s,class:"composer-dropdown-menu"},[B.value?(_(),F("div",e_,[_n(w("input",{ref_key:"searchInputRef",ref:i,"onUpdate:modelValue":xe[0]||(xe[0]=$e=>d.value=$e),class:"composer-dropdown-search-input",type:"text",placeholder:j.value,onKeydown:xo(wt(X,["prevent"]),["esc"])},null,40,t_),[[On,d.value]])])):ve("",!0),w("ul",n_,[(_(!0),F(lt,null,en(be.value,$e=>(_(),F("li",{key:$e.value},[w("button",{class:ut(["composer-dropdown-option",{"is-selected":$e.value===e.modelValue}]),type:"button",onClick:Ne=>ye($e.value)},D($e.label),11,o_)]))),128)),be.value.length===0?(_(),F("li",r_,D(H.value),1)):ve("",!0)])],512)],6)):ve("",!0)],512))}}),wi=xt(a_,[["__scopeId","data-v-48e2516e"]]),s_={},i_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function l_(e,t){return _(),F("svg",i_,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const uf=xt(s_,[["render",l_]]),u_=["aria-label","onKeydown"],c_={class:"app-dialog-header"},d_={class:"app-dialog-title-wrap"},f_={class:"app-dialog-title"},p_={key:0,class:"app-dialog-subtitle"},h_=["aria-label","title"],m_={class:"app-dialog-body"},v_={key:0,class:"app-dialog-footer"},g_=vn({__name:"AppDialog",props:{open:{type:Boolean},title:{},subtitle:{default:""},ariaLabel:{default:""},size:{default:"sm"}},emits:["close"],setup(e,{emit:t}){const n=e,o=t,{t:r}=ha();function a(){o("close")}function s(i){n.open&&i.key==="Escape"&&(i.preventDefault(),a())}return ot(()=>n.open,i=>{typeof window>"u"||(i?window.addEventListener("keydown",s):window.removeEventListener("keydown",s))},{immediate:!0}),Fs(()=>{typeof window>"u"||window.removeEventListener("keydown",s)}),(i,l)=>(_(),Qe(nl,{to:"body"},[e.open?(_(),F("div",{key:0,class:"app-dialog-overlay",onClick:wt(a,["self"])},[w("div",{class:ut(["app-dialog-panel",`app-dialog-panel--${e.size}`]),role:"dialog","aria-modal":"true","aria-label":e.ariaLabel||e.title,onKeydown:xo(wt(a,["prevent"]),["esc"])},[w("div",c_,[w("div",d_,[w("h3",f_,D(e.title),1),e.subtitle?(_(),F("p",p_,D(e.subtitle),1)):ve("",!0)]),w("button",{class:"app-dialog-close",type:"button","aria-label":m(r)("Close"),title:m(r)("Close"),onClick:a},[Fe(uf,{class:"app-dialog-close-icon"})],8,h_)]),w("div",m_,[ko(i.$slots,"default",{},void 0)]),i.$slots.footer?(_(),F("div",v_,[ko(i.$slots,"footer",{},void 0)])):ve("",!0)],42,u_)])):ve("",!0)]))}}),_d=xt(g_,[["__scopeId","data-v-0c988f32"]]),y_={key:0,class:"sidebar-menu-row-left"},w_={class:"sidebar-menu-row-main"},b_={key:1,class:"sidebar-menu-row-right"},T_={key:0,class:"sidebar-menu-row-right-default"},S_={key:1,class:"sidebar-menu-row-right-hover"},C_=vn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=NS(),o=Y(()=>!!n.left),r=Y(()=>!!n.right),a=Y(()=>!!n["right-hover"]),s=Y(()=>r.value||a.value);return(i,l)=>(_(),Qe(Lf(t.as),Ff({class:"sidebar-menu-row","data-has-left":o.value,"data-has-right":s.value,"data-has-right-hover":a.value,"data-force-right-hover":t.forceRightHover},i.$attrs),{default:pt(()=>[o.value?(_(),F("span",y_,[ko(i.$slots,"left",{},void 0,!0)])):ve("",!0),w("span",w_,[ko(i.$slots,"default",{},void 0,!0)]),s.value?(_(),F("span",b_,[r.value?(_(),F("span",T_,[ko(i.$slots,"right",{},void 0,!0)])):ve("",!0),a.value?(_(),F("span",S_,[ko(i.$slots,"right-hover",{},void 0,!0)])):ve("",!0)])):ve("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),ks=xt(C_,[["__scopeId","data-v-5fc666fb"]]),x_={},k_={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function I_(e,t){return _(),F("svg",k_,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 18v-6m0 0a4 4 0 0 1 4-4h2m-6 4a4 4 0 0 0-4-4H6m0-4a2 2 0 1 0 0 4a2 2 0 0 0 0-4m12 0a2 2 0 1 0 0 4a2 2 0 0 0 0-4m-6 14a2 2 0 1 0 0 4a2 2 0 0 0 0-4"},null,-1)])])}const Zu=xt(x_,[["render",I_]]),A_={},__={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function P_(e,t){return _(),F("svg",__,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"},null,-1)])])}const cy=xt(A_,[["render",P_]]),R_=["data-menu-open"],E_={class:"thread-left-stack"},M_=["data-state"],j_=["data-confirming","title"],L_={key:0,class:"thread-delete-confirm-label"},N_={class:"thread-row-title-wrap"},$_={class:"thread-row-title-line"},O_={class:"thread-row-title"},D_=["title"],F_={key:0,class:"thread-row-automation-count"},B_=["data-state"],U_={class:"thread-row-time"},z_=vn({__name:"SidebarThreadRow",props:{thread:{},selected:{type:Boolean},pinned:{type:Boolean},menuOpen:{type:Boolean},showStatusIndicator:{type:Boolean},threadState:{},inlineDeleteConfirming:{type:Boolean},automationCount:{},automationTooltip:{},requestLabel:{},relativeTime:{},deleteLabel:{},confirmDeleteLabel:{},confirmLabel:{},worktreeLabel:{},setMenuWrapRef:{type:Function}},emits:["select","inline-delete","menu-toggle","row-leave","row-contextmenu"],setup(e,{emit:t}){const n=e,o=t;function r(a){n.setMenuWrapRef(a instanceof HTMLDivElement?a:null)}return(a,s)=>(_(),F("li",{class:"thread-row-item","data-menu-open":n.menuOpen?"true":"false"},[Fe(ks,{class:"thread-row","data-active":n.selected,"data-pinned":n.pinned,"data-menu-open":n.menuOpen?"true":"false","force-right-hover":n.menuOpen,onClick:s[3]||(s[3]=i=>o("select")),onMouseleave:s[4]||(s[4]=i=>o("row-leave",i)),onContextmenu:s[5]||(s[5]=i=>o("row-contextmenu",i))},{left:pt(()=>[w("span",E_,[n.showStatusIndicator?(_(),F("span",{key:0,class:"thread-status-indicator","data-state":n.threadState},null,8,M_)):ve("",!0),w("button",{class:"thread-delete-button",type:"button","data-confirming":n.inlineDeleteConfirming,title:n.inlineDeleteConfirming?n.confirmDeleteLabel:n.deleteLabel,onClick:s[0]||(s[0]=wt(i=>o("inline-delete"),["stop"]))},[n.inlineDeleteConfirming?(_(),F("span",L_,D(n.confirmLabel),1)):(_(),Qe(cy,{key:1,class:"thread-icon"}))],8,j_)])]),right:pt(()=>[w("span",U_,D(n.relativeTime),1)]),"right-hover":pt(()=>[w("div",{ref:r,class:"thread-menu-wrap"},[w("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:s[2]||(s[2]=wt(i=>o("menu-toggle"),["stop"]))},[Fe(lf,{class:"thread-icon"})])])]),default:pt(()=>[w("button",{class:"thread-main-button",type:"button",onClick:s[1]||(s[1]=wt(i=>o("select"),["stop"]))},[w("span",N_,[w("span",$_,[w("span",O_,D(n.thread.title),1),n.thread.hasWorktree?(_(),Qe(Zu,{key:0,class:"thread-row-worktree-icon",title:n.worktreeLabel},null,8,["title"])):ve("",!0),n.automationCount>0?(_(),F("span",{key:1,class:"thread-row-automation-chip",title:n.automationTooltip},[Fe(Es,{class:"thread-row-automation-icon"}),n.automationCount>1?(_(),F("span",F_,D(n.automationCount),1)):ve("",!0)],8,D_)):ve("",!0),n.thread.pendingRequestState?(_(),F("span",{key:2,class:"thread-row-request-chip","data-state":n.thread.pendingRequestState},D(n.requestLabel),9,B_)):ve("",!0)])])])]),_:1},8,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,R_))}}),Iu=xt(z_,[["__scopeId","data-v-f14bf478"]]);function H_(e,t,n){return n.canPruneMissing?e.filter(o=>t.has(o)):e}function q_(e){const{getGroups:t,t:n}=e,o=S({}),r=S({}),a=S(!1),s=S("thread"),i=S(""),l=S(""),d=S(""),c=S("create"),v=S(!1),f=S("thread"),b=S(""),y=S(""),P=S(""),B=S(""),$=S(!1),j=S(!1),H=S({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),q=S({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),be=Y(()=>{if(s.value==="project"){const le=l.value;return le?r.value[le]??[]:[]}const V=i.value;return V?o.value[V]??[]:[]}),ce=Y(()=>ue(H.value.rrule)),W=Y(()=>v.value&&c.value==="create"?f.value==="thread"?n("This creates a heartbeat automation attached to the selected chat."):n("This creates a project automation attached to the selected project folder."):s.value==="project"?n("This creates project automations attached to the selected project folder."):n("This creates heartbeat automations attached to the selected thread.")),he=Y(()=>{var le;const V=[];for(const ge of t())for(const Je of ge.threads){const Tt=((le=Je.title)==null?void 0:le.trim())||Je.id,St=e.getProjectDisplayName(ge.projectName);V.push({value:Je.id,label:`${Tt} · ${St}`,searchText:`${Tt} ${St} ${Je.id}`.toLowerCase()})}return V}),Se=Y(()=>{const V=[];for(const le of t()){const ge=e.getProjectAutomationKey(le.projectName);if(!ge)continue;const Je=e.getProjectDisplayName(le.projectName);V.push({value:ge,label:Je,searchText:`${Je} ${ge}`.toLowerCase()})}return V}),_e=Y(()=>(f.value==="project"?Se.value:he.value).map(le=>({value:le.value,label:le.label}))),ye=[{value:"minutes",label:n("minutes")},{value:"hours",label:n("hours")},{value:"days",label:n("days")}],X=Y(()=>[{value:"ACTIVE",label:n("Active")},{value:"PAUSED",label:n("Paused")}]);ot(_e,V=>{var le;v.value&&(V.some(ge=>ge.value===b.value)||(b.value=((le=V[0])==null?void 0:le.value)??""))});function pe(V){var le;return((le=o.value[V])==null?void 0:le.length)??0}function re(V){return pe(V)>0}function xe(V){var ge;const le=e.getProjectAutomationKey(V);return le?((ge=r.value[le])==null?void 0:ge.length)??0:0}function $e(V){return xe(V)>0}function Ne(V){if(V.length===0)return"";if(V.length>1){const Je=V.filter(Tt=>Tt.status==="ACTIVE").length;return`${V.length} ${n("automations")} • ${Je} ${n("active")}`}const[le]=V,ge=le.status==="PAUSED"?"-":le.nextRunAtMs?new Date(le.nextRunAtMs).toLocaleString():n("Not scheduled");return`${le.name} • ${n("Next run")}: ${ge}`}function ae(V){return Ne(o.value[V]??[])}function Ee(V){const le=e.getProjectAutomationKey(V);return Ne(le?r.value[le]??[]:[])}function ke(V){return String(Math.max(0,V)).padStart(2,"0")}function Ie(V,le){const ge=typeof V=="number"?V:Number(V);return Number.isFinite(ge)?Math.max(1,Math.floor(ge)):le}function ze(V){const[le,ge]=V.split(":"),Je=Math.min(23,Math.max(0,Number(le)||0)),Tt=Math.min(59,Math.max(0,Number(ge)||0));return`FREQ=DAILY;BYHOUR=${Je};BYMINUTE=${Tt}`}function st(V,le){const ge=Ie(V,1);return le==="minutes"?`FREQ=MINUTELY;INTERVAL=${ge}`:le==="hours"?`FREQ=HOURLY;INTERVAL=${ge}`:`FREQ=DAILY;INTERVAL=${ge}`}function tt(V){return Object.fromEntries(V.split(";").map(le=>le.trim()).filter(Boolean).map(le=>{const[ge,...Je]=le.split("=");return[ge.toUpperCase(),Je.join("=").trim()]}).filter(([le,ge])=>le&&ge))}function ct(V){var Tt;const le=tt(V),ge=(Tt=le.FREQ)==null?void 0:Tt.toUpperCase(),Je=Ie(le.INTERVAL,1);if(ge==="DAILY"&&le.BYHOUR!==void 0&&le.BYMINUTE!==void 0&&Je===1){const St=Math.min(23,Math.max(0,Number(le.BYHOUR)||0)),$t=Math.min(59,Math.max(0,Number(le.BYMINUTE)||0));return{mode:"daily",dailyTime:`${ke(St)}:${ke($t)}`,interval:1,intervalUnit:"hours"}}return ge==="MINUTELY"||ge==="HOURLY"||ge==="DAILY"&&le.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:Je,intervalUnit:ge==="MINUTELY"?"minutes":ge==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function ue(V){var Tt;const le=tt(V),ge=(Tt=le.FREQ)==null?void 0:Tt.toUpperCase(),Je=Ie(le.INTERVAL,1);if(ge==="DAILY"&&le.BYHOUR!==void 0&&le.BYMINUTE!==void 0&&Je===1){const St=Math.min(23,Math.max(0,Number(le.BYHOUR)||0)),$t=Math.min(59,Math.max(0,Number(le.BYMINUTE)||0));return`${n("RRULE")}: ${V} · ${n("runs daily at")} ${ke(St)}:${ke($t)}`}return ge==="MINUTELY"?`${n("RRULE")}: ${V} · ${n("runs every")} ${Je} ${n("minute(s)")}`:ge==="HOURLY"?`${n("RRULE")}: ${V} · ${n("runs every")} ${Je} ${n("hour(s)")}`:ge==="DAILY"&&le.INTERVAL!==void 0?`${n("RRULE")}: ${V} · ${n("runs every")} ${Je} ${n("day(s)")}`:V?`${n("RRULE")}: ${V}`:n("RRULE is required.")}function N(){const V=q.value;V.mode==="daily"?H.value.rrule=ze(V.dailyTime):V.mode==="interval"&&(H.value.rrule=st(V.interval,V.intervalUnit))}function ie(V){V!=="minutes"&&V!=="hours"&&V!=="days"||(q.value={...q.value,intervalUnit:V},N())}function se(V){V!=="ACTIVE"&&V!=="PAUSED"||(H.value={...H.value,status:V})}function Oe(){q.value=ct(H.value.rrule)}function De(V){q.value={...q.value,mode:V},N()}function A(V){var ge;s.value="thread",i.value=V,l.value="",v.value=!1,y.value="",P.value="";const le=(ge=o.value[V])==null?void 0:ge[0];le?Me(le.id):te(),a.value=!0,e.closeThreadMenu()}function M(V){var Je;const le=e.getProjectAutomationKey(V);if(!le){s.value="project",i.value="",l.value="",v.value=!1,y.value=n("Project automation requires a resolved absolute project path."),P.value="",a.value=!0,e.closeProjectMenu();return}s.value="project",i.value="",l.value=le,v.value=!1,y.value="",P.value="";const ge=(Je=r.value[le])==null?void 0:Je[0];ge?Me(ge.id):te(),a.value=!0,e.closeProjectMenu()}function z(V){s.value=V.scope,i.value=V.scope==="thread"?V.target:"",l.value=V.scope==="project"?V.target:"",v.value=!1,y.value="",P.value="",V.scope==="project"?r.value=He(r.value,V.target,V.automation):o.value=me(o.value,V.target,V.automation),Me(V.automation.id),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function ee(){var V;v.value=!0,f.value="thread",b.value=((V=he.value[0])==null?void 0:V.value)??"",s.value="thread",i.value="",l.value="",y.value="",P.value="",te(),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function de(V){var le;f.value=V,b.value="",s.value=V==="project"?"project":"thread",b.value=((le=_e.value[0])==null?void 0:le.value)??""}function te(){d.value="",c.value="create",y.value="",P.value="",H.value={name:s.value==="project"?"Project automation":"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},q.value=ct(H.value.rrule)}function Me(V){const le=be.value.find(ge=>ge.id===V);le&&(d.value=le.id,c.value="edit",y.value="",P.value="",H.value={name:le.name,prompt:le.prompt,rrule:le.rrule,status:le.status},q.value=ct(le.rrule))}function je(){a.value=!1,s.value="thread",i.value="",l.value="",d.value="",y.value="",P.value="",$.value=!1,j.value=!1}function Ce(V,le){return Object.fromEntries(Object.entries(V).filter(([ge])=>ge!==le))}function me(V,le,ge){const Je=V[le]??[],Tt=Je.findIndex($t=>$t.id===ge.id),St=[...Je];return Tt>=0?St.splice(Tt,1,ge):St.push(ge),{...V,[le]:St}}function Ve(V,le,ge){const Je=(V[le]??[]).filter(Tt=>Tt.id!==ge);return Je.length>0?{...V,[le]:Je}:Ce(V,le)}function Le(V,le){return Object.fromEntries(Object.entries(V).filter(([ge])=>ge!==le))}function He(V,le,ge){const Je=V[le]??[],Tt=Je.findIndex($t=>$t.id===ge.id),St=[...Je];return Tt>=0?St.splice(Tt,1,ge):St.push(ge),{...V,[le]:St}}async function qe(){r.value=await Ax()}async function dt(V){await em(V).catch(()=>{}),o.value=Ce(o.value,V)}async function nt(){let V=i.value,le=l.value;$.value=!0,y.value="",P.value="";try{if(N(),v.value&&c.value==="create"&&(f.value==="thread"?(V=b.value,le="",s.value="thread",i.value=V,l.value=""):(le=b.value,V="",s.value="project",i.value="",l.value=le)),s.value==="thread"&&!V)throw new Error(n("Select a chat target for this automation"));if(s.value==="project"&&!le)throw new Error(n("Select a project target for this automation"));const ge={id:d.value||void 0,name:H.value.name,prompt:H.value.prompt,rrule:H.value.rrule,status:H.value.status},Je=s.value==="project"?await Px({...ge,projectName:le}):await _x({...ge,threadId:V});s.value==="project"?await qe():o.value=me(o.value,V,Je),e.onAutomationsChanged(),Me(Je.id),P.value=n("Automation saved."),$.value=!1}catch(ge){y.value=ge instanceof Error?ge.message:n("Failed to save automation"),$.value=!1}}async function Ze(){const V=i.value,le=l.value,ge=d.value;if(ge&&!(s.value==="thread"&&!V)&&!(s.value==="project"&&!le)){$.value=!0,y.value="",P.value="";try{s.value==="project"?(await Dg(le,ge),await qe()):(await em(V,ge),o.value=Ve(o.value,V,ge));const Je=be.value[0];Je?Me(Je.id):te(),e.onAutomationsChanged(),$.value=!1}catch(Je){y.value=Je instanceof Error?Je.message:n("Failed to remove automation"),$.value=!1}}}async function vt(){const V=i.value,le=d.value;if(!(!V||!le)){j.value=!0,y.value="",P.value="";try{await Rx(V,le),P.value=n("Automation run queued.")}catch(ge){y.value=ge instanceof Error?ge.message:n("Failed to run automation")}finally{j.value=!1}}}return{automationByThreadId:o,automationByProjectName:r,automationDialogVisible:a,automationDialogScope:s,automationDialogThreadId:i,automationDialogProjectName:l,automationDialogAutomationId:d,automationDialogMode:c,automationTargetPickerVisible:v,automationTargetMode:f,automationTargetValue:b,automationDialogError:y,automationDialogNotice:P,projectAutomationActionError:B,isSavingAutomation:$,isRunningAutomation:j,automationDraft:H,automationScheduleDraft:q,automationDialogAutomations:be,automationSchedulePreview:ce,automationDialogSubtitle:W,automationThreadTargetOptions:he,automationProjectTargetOptions:Se,automationTargetDropdownOptions:_e,automationIntervalUnitOptions:ye,automationStatusOptions:X,threadAutomationCount:pe,threadHasAutomation:re,projectAutomationCount:xe,projectHasAutomation:$e,threadAutomationTooltip:ae,projectAutomationTooltip:Ee,syncAutomationRruleFromScheduleDraft:N,onAutomationIntervalUnitChange:ie,onAutomationStatusChange:se,syncAutomationScheduleDraftFromRrule:Oe,setAutomationScheduleMode:De,openAutomationDialog:A,openProjectAutomationDialog:M,openAutomationEditorFromPanel:z,openAutomationCreatorFromPanel:ee,setAutomationTargetMode:de,startNewAutomationDraft:te,selectAutomationForEditing:Me,closeAutomationDialog:je,omitAutomationProject:Le,reloadProjectAutomations:qe,removeAutomationsForThread:dt,submitAutomationDialog:nt,onDeleteAutomationFromDialog:Ze,onRunAutomationFromDialog:vt}}const W_=4,Em=6;function G_(e,t,n){if(e===null||n===0)return null;const o=Math.max(0,Math.min(e,n)),r=o>t?o-1:o,a=Math.max(0,Math.min(r,n-1));return a===t?null:a}function V_(e){const{getGroups:t,getFilteredGroups:n,isSearchActive:o,isCollapsed:r,getElevatedProjectName:a,onReorderProject:s,closeProjectMenu:i}=e,l=S(null),d=S(null),c=S(null);let v=null,f=null;const b=S(""),y=S({}),P=new Map,B=new WeakMap,$=typeof window<"u"?new ResizeObserver(ue=>{for(const N of ue){const ie=N.target,se=B.get(ie);se&&H(se,ie)}}):null,j=()=>{var ue,N;return((ue=c.value)==null?void 0:ue.projectName)??((N=d.value)==null?void 0:N.projectName)??""};function H(ue,N){const ie=N.getBoundingClientRect().height;if(!Number.isFinite(ie)||ie<=0)return;const se=y.value[ue];se!==void 0&&Math.abs(se-ie)<.5||(y.value={...y.value,[ue]:ie})}function q(ue,N){const ie=P.get(ue);ie&&ie!==N&&$&&$.unobserve(ie);const se=N instanceof HTMLElement?N:N&&"$el"in N&&N.$el instanceof HTMLElement?N.$el:null;if(se){P.set(ue,se),B.set(se,ue),H(ue,se),$==null||$.observe(se);return}ie&&($==null||$.unobserve(ie)),P.delete(ue)}function be(ue){const N=y.value[ue]??0,ie=c.value,Oe=((ie==null?void 0:ie.projectName)===ue?ie.groupHeight:null)??N,De=r(ue)?0:Em;return Math.max(0,Oe+De)}const ce=Y(()=>{const ue=c.value;return ue?G_(ue.dropTargetIndexFull,ue.fromIndex,t().length):null}),W=Y(()=>{const N=(o()?n():t()).map(A=>A.projectName),ie=c.value,se=ce.value;if(!ie||se===null)return N;const Oe=[...N],[De]=Oe.splice(ie.fromIndex,1);return De?(Oe.splice(se,0,De),Oe):N}),he=Y(()=>{const ue={};let N=0;for(const ie of W.value)ue[ie]=N,N+=be(ie);return ue}),Se=Y(()=>{let ue=0;for(const N of W.value)ue+=be(N);return{height:`${Math.max(0,ue)}px`}});function _e(ue,N){if(ue.button!==0||o()||d.value||c.value)return;const se=t().findIndex(M=>M.projectName===N),Oe=P.get(N);if(se<0||!Oe)return;const De=Oe.getBoundingClientRect(),A=r(N)?0:Em;d.value={projectName:N,fromIndex:se,startClientX:ue.clientX,startClientY:ue.clientY,pointerOffsetY:ue.clientY-De.top,groupLeft:De.left,groupWidth:De.width,groupHeight:De.height,groupOuterHeight:De.height+A},ue.preventDefault(),ye()}function ye(){window.addEventListener("mousemove",pe),window.addEventListener("mouseup",re),window.addEventListener("keydown",xe)}function X(){window.removeEventListener("mousemove",pe),window.removeEventListener("mouseup",re),window.removeEventListener("keydown",xe)}function pe(ue){v={clientX:ue.clientX,clientY:ue.clientY},Ne()}function re(ue){ae({clientX:ue.clientX,clientY:ue.clientY});const N=c.value;if(N&&ce.value!==null){const ie=t().findIndex(se=>se.projectName===N.projectName);if(ie>=0){const se=ce.value;se!==ie&&s(N.projectName,se)}}$e({preserveToggleSuppression:!!N})}function xe(ue){ue.key==="Escape"&&(!d.value&&!c.value||(ue.preventDefault(),$e()))}function $e(ue={}){f!==null&&(window.cancelAnimationFrame(f),f=null),v=null,d.value=null,c.value=null,ue.preserveToggleSuppression||(b.value=""),X()}function Ne(){f===null&&(f=window.requestAnimationFrame(()=>{if(f=null,!v)return;const ue=v;v=null,ae(ue)}))}function ae(ue){const N=d.value;if(!c.value&&N){const ie=ue.clientX-N.startClientX,se=ue.clientY-N.startClientY;if(Math.hypot(ie,se)<W_)return;i(),b.value=N.projectName,c.value={projectName:N.projectName,fromIndex:N.fromIndex,pointerOffsetY:N.pointerOffsetY,groupLeft:N.groupLeft,groupWidth:N.groupWidth,groupHeight:N.groupHeight,groupOuterHeight:N.groupOuterHeight,ghostTop:ue.clientY-N.pointerOffsetY,dropTargetIndexFull:null}}c.value&&Ee(ue)}function Ee(ue){const N=c.value;if(!N)return;if(N.ghostTop=ue.clientY-N.pointerOffsetY,!ke(ue)){N.dropTargetIndexFull=null;return}const ie=ue.clientY,se=l.value;if(!se){N.dropTargetIndexFull=null;return}const Oe=t(),De=se.getBoundingClientRect(),A=new Map(Oe.map((de,te)=>[de.projectName,te])),M=Oe.map(de=>de.projectName).filter(de=>de!==N.projectName);let z=0,ee=Oe.length;for(const de of M){const te=A.get(de);if(te===void 0)continue;const Me=be(de),je=De.top+z+Me/2;if(ie<je){ee=te;break}z+=Me}N.dropTargetIndexFull=ee}function ke(ue){const N=l.value;if(!N)return!1;const ie=N.getBoundingClientRect(),se=ue.clientX>=ie.left&&ue.clientX<=ie.right,Oe=ue.clientY>=ie.top-32&&ue.clientY<=ie.bottom+32;return se&&Oe}function Ie(ue){var N;return((N=c.value)==null?void 0:N.projectName)===ue}function ze(ue){const N=c.value,ie=he.value[ue]??0,se=a()===ue;return!N||N.projectName!==ue?{position:"absolute",top:"0",left:"0",right:"0",zIndex:se?"40":"1",transform:`translate3d(0, ${ie}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${N.groupLeft}px`,width:`${N.groupWidth}px`,height:`${N.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${N.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function st(ue){return b.value===ue?(b.value="",!0):!1}function tt(ue){const N=j();N&&!ue.includes(N)&&$e();const ie=new Set(ue),se=Object.fromEntries(Object.entries(y.value).filter(([Oe])=>ie.has(Oe)));Object.keys(se).length!==Object.keys(y.value).length&&(y.value=se)}function ct(){for(const ue of P.values())$==null||$.unobserve(ue);P.clear(),$e()}return{groupsContainerRef:l,groupsContainerStyle:Se,setProjectGroupRef:q,isDraggingProject:Ie,projectGroupStyle:ze,onProjectHandleMouseDown:_e,takeToggleSuppression:st,pruneProjectGroups:tt,dispose:ct}}const K_={key:0,class:"pinned-section"},Y_={class:"thread-tree-header"},J_={key:0,class:"thread-list"},Q_={class:"projects-section"},X_={class:"thread-tree-header"},Z_=["aria-expanded","aria-label","title"],eP={class:"organize-menu-title"},tP=["data-active"],nP={key:0},oP=["data-active"],rP={key:0},aP=["data-active"],sP={key:0},iP={class:"organize-menu-title"},lP=["data-active"],uP={key:0},cP=["data-active"],dP={key:0},fP={key:0,class:"thread-tree-action-error"},pP={key:1,class:"thread-tree-no-results"},hP={key:2,class:"thread-tree-loading"},mP={key:3,class:"thread-list thread-list-global"},vP=["data-project-name","data-expanded","data-dragging"],gP={class:"project-icon-stack"},yP={class:"project-icon-folder"},wP={class:"project-icon-chevron"},bP=["data-dragging-handle","onMousedown"],TP=["title"],SP=["title"],CP={key:0,class:"thread-row-automation-count"},xP={class:"project-hover-controls"},kP=["onClick"],IP=["data-open-direction"],AP=["onClick"],_P=["onClick"],PP=["onClick"],RP=["onClick"],EP=["onClick"],MP=["onClick"],jP={class:"project-menu-label"},LP=["onInput"],NP=["aria-label","title","onClick"],$P={key:0,class:"thread-list"},OP={class:"project-empty"},DP=["onClick"],FP={class:"chats-section"},BP={class:"thread-tree-header"},UP={class:"chats-section-actions"},zP=["aria-label","title"],HP={key:0,class:"thread-tree-no-results"},qP={key:1,class:"thread-list thread-list-global"},WP=["data-open-direction"],GP=["disabled","title"],VP=["placeholder","onKeydown"],KP={class:"recycle-bin-content"},YP={key:0,class:"recycle-bin-empty"},JP={key:1,class:"recycle-bin-list"},QP={class:"recycle-bin-item-copy"},XP={class:"recycle-bin-item-title"},ZP={key:0,class:"recycle-bin-item-meta"},eR={class:"recycle-bin-item-time"},tR={class:"recycle-bin-item-actions"},nR=["disabled","onClick"],oR=["onClick"],rR={key:2,class:"recycle-bin-error",role:"alert"},aR=["aria-label"],sR={class:"rename-thread-title"},iR={class:"rename-thread-subtitle"},lR={key:0,class:"automation-target-picker"},uR={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},cR={class:"automation-target-dropdown"},dR=["aria-label"],fR=["onClick"],pR={class:"automation-thread-field"},hR={class:"automation-thread-label"},mR=["placeholder"],vR={class:"automation-thread-field"},gR={class:"automation-thread-label"},yR=["placeholder"],wR={class:"automation-thread-field"},bR={class:"automation-thread-label"},TR={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},SR={key:0,class:"automation-schedule-row"},CR={class:"automation-schedule-copy"},xR={key:1,class:"automation-schedule-row"},kR={class:"automation-schedule-copy"},IR={class:"automation-schedule-preview"},AR={class:"automation-thread-field"},_R={class:"automation-thread-label"},PR={key:2,class:"rename-thread-subtitle automation-thread-error"},RR={key:3,class:"rename-thread-subtitle automation-thread-notice"},ER={class:"rename-thread-actions"},MR=["disabled"],jR=["disabled"],LR=["disabled"],NR=["disabled"],Mm="codex-web-local.sidebar-section-expansion.v1",jm="codex-web-local.sidebar-chats-first.v1",Lm="codex-web-local.sidebar-chat-sort-mode.v1",Nm="codex-web-local.thread-view-mode.v1",$m="codex-web-local.collapsed-projects.v1",$R=vn({__name:"SidebarThreadTree",props:{groups:{},projectDisplayNameById:{},projectGitRepoByName:{},projectCwdByName:{},selectedThreadId:{},isLoading:{type:Boolean},isThreadListFullyLoaded:{type:Boolean},searchQuery:{},searchMatchedThreadIds:{}},emits:["select","archive","start-new-thread","browse-thread-files","save-thread-project","browse-project-files","save-project","request-project-git-status","create-project-worktree","rename-project","rename-thread","remove-project","reorder-project","copy-thread-chat","fork-thread","start-new-chat","automations-changed","restore-thread"],setup(e,{expose:t,emit:n}){const o=e,{t:r}=ha(),{recordVisibleFailure:a}=iy(),s=n,{records:i,loadRecords:l,recordArchivedThread:d,removeArchivedRecord:c,restoreArchivedThread:v}=JA(),f=S(!1),b=S(""),y=S("");function P(){an.value=!1,b.value="",l(),f.value=!0}async function B(C){if(!y.value){y.value=C,b.value="";try{const R=await v(C);R.ok?s("restore-thread",C):b.value=R.error??"Failed to restore thread"}finally{y.value=""}}}const $=S({}),j=S({}),H=S(!0),q=S(!0),be=S(!0),ce=S(!1),W=S(Zn(jm,!1)),he=S(Go());let Se=!1;const _e=S([]),ye=S({}),X=S(""),pe=S([]),re=S(""),xe=S(""),$e=S("hover"),Ne=S({}),ae=S({}),Ee=S({}),ke=S("actions"),Ie=S(""),ze=S(!1),st=S(""),tt=S(""),ct=S(null),ue=S(!1),N=S(""),ie=S(""),se=q_({getGroups:()=>o.groups,t:r,getProjectDisplayName:qr,getProjectAutomationKey:Vt,closeThreadMenu:Ye,closeProjectMenu:At,onAutomationsChanged:()=>s("automations-changed")}),{automationByThreadId:Oe,automationByProjectName:De,automationDialogVisible:A,automationDialogScope:M,automationDialogAutomationId:z,automationDialogMode:ee,automationTargetPickerVisible:de,automationTargetMode:te,automationTargetValue:Me,automationDialogError:je,automationDialogNotice:Ce,projectAutomationActionError:me,isSavingAutomation:Ve,isRunningAutomation:Le,automationDraft:He,automationScheduleDraft:qe,automationDialogAutomations:dt,automationSchedulePreview:nt,automationDialogSubtitle:Ze,automationTargetDropdownOptions:vt,automationIntervalUnitOptions:V,automationStatusOptions:le,threadAutomationCount:ge,threadHasAutomation:Je,projectAutomationCount:Tt,projectHasAutomation:St,threadAutomationTooltip:$t,projectAutomationTooltip:Rn,syncAutomationRruleFromScheduleDraft:cn,onAutomationIntervalUnitChange:Io,onAutomationStatusChange:ma,syncAutomationScheduleDraftFromRrule:va,setAutomationScheduleMode:lr,openAutomationDialog:Bs,openProjectAutomationDialog:Ao,openAutomationEditorFromPanel:Xa,openAutomationCreatorFromPanel:Za,setAutomationTargetMode:es,startNewAutomationDraft:zo,selectAutomationForEditing:Br,closeAutomationDialog:ur,omitAutomationProject:Ho,reloadProjectAutomations:ga,removeAutomationsForThread:Us,submitAutomationDialog:ts,onDeleteAutomationFromDialog:ya,onRunAutomationFromDialog:ho}=se,_o=V_({getGroups:()=>o.groups,getFilteredGroups:()=>Ko.value,isSearchActive:()=>eo.value,isCollapsed:yo,getElevatedProjectName:()=>re.value?re.value:xe.value?Gt.value.get(xe.value)??"":"",onReorderProject:(C,R)=>s("reorder-project",{projectName:C,toIndex:R}),closeProjectMenu:At}),{groupsContainerRef:cr,groupsContainerStyle:ns,setProjectGroupRef:Po,isDraggingProject:it,projectGroupStyle:kt,onProjectHandleMouseDown:Ct,takeToggleSuppression:qo,pruneProjectGroups:Sn,dispose:os}=_o,Bn=new Map,mo=new Map,Wo=S(null),dr=S(null),an=S(!1),It=S(Ro());function Xn(){if(typeof window>"u")return{};try{const C=window.localStorage.getItem($m);if(!C)return{};const R=JSON.parse(C);return!R||typeof R!="object"||Array.isArray(R)?{}:R}catch{return{}}}function Ro(){return typeof window>"u"?"project":window.localStorage.getItem(Nm)==="chronological"?"chronological":"project"}function Zn(C,R){if(typeof window>"u")return R;const x=window.localStorage.getItem(C);return x==="true"?!0:x==="false"?!1:R}function Go(){return typeof window>"u"?"updated":window.localStorage.getItem(Lm)==="created"?"created":"updated"}j.value=Xn();function Cn(){if(!(typeof window>"u"))try{const C=JSON.parse(window.localStorage.getItem(Mm)||"{}");typeof C.pinned=="boolean"&&(H.value=C.pinned),typeof C.projects=="boolean"&&(q.value=C.projects),typeof C.chats=="boolean"&&(be.value=C.chats)}catch{}}function xn(){typeof window>"u"||window.localStorage.setItem(Mm,JSON.stringify({pinned:H.value,projects:q.value,chats:be.value}))}Cn(),ot(j,C=>{typeof window>"u"||window.localStorage.setItem($m,JSON.stringify(C))},{deep:!0}),ot(It,C=>{typeof window>"u"||window.localStorage.setItem(Nm,C)}),ot(W,C=>{typeof window>"u"||window.localStorage.setItem(jm,String(C))}),ot(he,C=>{typeof window>"u"||window.localStorage.setItem(Lm,C)}),ot([H,q,be],xn);const En=Y(()=>o.searchQuery.trim().toLowerCase()),eo=Y(()=>En.value.length>0),fr=Y(()=>o.searchMatchedThreadIds?new Set(o.searchMatchedThreadIds):null),vo=Y(()=>new Set(_e.value)),Vo=Y(()=>new Set(pe.value));function tn(C){if(Vo.value.has(C.id))return!1;if(!eo.value)return!0;if(fr.value)return fr.value.has(C.id);const R=En.value;return C.title.toLowerCase().includes(R)||C.preview.toLowerCase().includes(R)}const Eo=Y(()=>QA(o.groups)),Ko=Y(()=>Eo.value.flatMap(C=>{const R=C.threads.filter(x=>!Qu(x.cwd)&&tn(x));return R.length>0?[{...C,threads:R}]:!eo.value&&C.threads.length===0?[{...C,threads:R}]:[]})),to=Y(()=>It.value==="chronological"),Yt=Y(()=>{const C=[];for(const R of Eo.value)for(const x of R.threads)vo.value.has(x.id)||tn(x)&&C.push(x);return C.sort((R,x)=>{const K=new Date(R.updatedAtIso||R.createdAtIso).getTime();return new Date(x.updatedAtIso||x.createdAtIso).getTime()-K})}),sn=Y(()=>{const C=Yt.value.filter(x=>Qu(x.cwd)),R=he.value==="created"?"createdAtIso":"updatedAtIso";return C.sort((x,K)=>{const Ke=new Date(x[R]||x.updatedAtIso||x.createdAtIso).getTime();return new Date(K[R]||K.updatedAtIso||K.createdAtIso).getTime()-Ke})}),Mn=Y(()=>eo.value||ce.value?sn.value:sn.value.slice(0,10)),wa=Y(()=>eo.value?!1:sn.value.length>10),Ut=Y(()=>{const C=new Map;for(const R of Eo.value)for(const x of R.threads)Vo.value.has(x.id)||C.set(x.id,x);return C});ot(_e,C=>{Se&&gI(C)}),ot([Ut,()=>o.isThreadListFullyLoaded],([C])=>{const R=H_(_e.value,new Set(C.keys()),{canPruneMissing:o.isThreadListFullyLoaded});if(R.length===_e.value.length)return;const x=new Set(R),K=Object.fromEntries(Object.entries(ye.value).filter(([Ke])=>x.has(Ke)));ye.value=K,_e.value=R});let Ur=0;async function jn(){if(o.isLoading)return;const C=_e.value.filter(Ke=>!Ut.value.has(Ke)&&!ye.value[Ke]);if(C.length===0)return;const R=Ur+=1,x=await Promise.all(C.map(async Ke=>{try{return await Pk(Ke)}catch{return null}}));if(R!==Ur)return;const K={...ye.value};for(const Ke of x)Ke&&(K[Ke.id]=Ke);ye.value=K}ot([_e,Ut,()=>o.isLoading],()=>{Se&&jn()}),Ti(async()=>{const{threadIds:C}=await vI(),R=Array.isArray(C)?C.filter(x=>typeof x=="string").map(x=>x.trim()).filter((x,K,Ke)=>x.length>0&&Ke.indexOf(x)===K):[];R.length>0&&(_e.value=R);try{Oe.value=await Ix()}catch{Oe.value={}}try{await ga()}catch{De.value={}}Se=!0,jn()});const Mo=Y(()=>Je(N.value)),jo=Y(()=>{const C=ie.value;return Mo.value?r('This will archive the thread "{title}" and remove the attached heartbeat automations.',{title:C}):r('This will archive the thread "{title}". You can find it later in archived threads.',{title:C})}),Gt=Y(()=>{const C=new Map;for(const R of o.groups)for(const x of R.threads)C.set(x.id,R.projectName);return C}),zs=Y(()=>{const C=new Map;for(const R of o.groups){const x=R.threads.filter(K=>!vo.value.has(K.id)&&!Vo.value.has(K.id));C.set(R.projectName,x)}return C}),pr=Y(()=>{const C=new Map;for(const R of o.groups)for(const x of R.threads){const K=new Date(x.updatedAtIso||x.createdAtIso).getTime();C.set(x.id,K)}return C}),zt=Y(()=>{const C=xe.value;return C?Ut.value.get(C)??null:null}),ln=Y(()=>_e.value.map(C=>Ut.value.get(C)??ye.value[C]??null).filter(C=>C!==null).filter(tn));function Hs(){H.value=!H.value}function Lo(){q.value=!q.value}function rs(){be.value=!be.value}function ba(C){if(Number.isNaN(C))return"n/a";const R=Math.abs(Date.now()-C);if(R<6e4)return r("now");const x=Math.floor(R/6e4);if(x<60)return`${x}m`;const K=Math.floor(x/60);return K<24?`${K}h`:`${Math.floor(K/24)}d`}function go(C){const R=pr.value.get(C.id);return ba(typeof R=="number"?R:new Date(C.updatedAtIso||C.createdAtIso).getTime())}function hr(C){const R=new Date(C).getTime();return Number.isNaN(R)?"":new Date(R).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function no(C){return vo.value.has(C)}function mr(C){if(no(C)){_e.value=_e.value.filter(R=>R!==C);return}_e.value=[C,..._e.value]}function zr(C){mr(C),Ye()}function ft(C){X.value="",s("select",C)}function gn(C){C===o.selectedThreadId&&(s("copy-thread-chat",C),Ye())}function Ln(C){s("fork-thread",C),Ye()}function Hr(C){return`${r("start new thread")} ${qr(C)}`}function oo(C){s("start-new-thread",C)}function vr(C){s("browse-thread-files",C),Ye()}function k(C){s("save-thread-project",C),Ye()}async function E(C){var x,K;const R=((K=(x=Ut.value.get(C))==null?void 0:x.cwd)==null?void 0:K.trim())??"";if(Ye(),!(!R||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(R)}catch{}}function U(C,R){if(xe.value===C&&$e.value==="hover"){if(R){const x=R.relatedTarget,K=dr.value;if(x instanceof Node&&K&&K.contains(x))return}Ye()}}function Ae(C){return xe.value===C}function Ye(){xe.value="",$e.value="hover",Ee.value={}}function gt(C){if(X.value="",xe.value===C){Ye();return}$e.value="hover",At(),an.value=!1,xe.value=C,Ft(()=>{Sr(C)})}function kn(C,R){C.preventDefault(),X.value="",$e.value="contextmenu",xe.value=R}function Rt(C,R){st.value=C,tt.value=R,ze.value=!0,Ye(),Ft(()=>{var x,K;(x=ct.value)==null||x.focus(),(K=ct.value)==null||K.select()})}function dn(){ze.value=!1,st.value="",tt.value=""}function gr(){const C=st.value,R=tt.value.trim();!C||!R||(s("rename-thread",{threadId:C,title:R}),dn())}function Ta(C,R){X.value="",N.value=C,ie.value=R,ue.value=!0,Ye()}function nn(){ue.value=!1,N.value="",ie.value=""}async function Ci(){const C=N.value;C&&(Ca(C),nn())}function Un(C){return X.value===C}function Sa(C){if(X.value!==C){X.value=C,Ye();return}Ca(C),X.value=""}function Ca(C){var x,K;const R=Ut.value.get(C)??null;Vo.value.has(C)||(pe.value=[C,...pe.value]),X.value="",Ye(),d({id:C,title:((x=R==null?void 0:R.title)==null?void 0:x.trim())||"(untitled)",cwd:((K=R==null?void 0:R.cwd)==null?void 0:K.trim())??"",projectName:Gt.value.get(C)??""}),_e.value=_e.value.filter(Ke=>Ke!==C),s("archive",C),Je(C)&&Us(C)}function qr(C){return o.projectDisplayNameById[C]??C}t({openAutomationEditorFromPanel:Xa,openAutomationCreatorFromPanel:Za,openRenameThreadDialog:Rt,openRecycleBin:P});function as(C){return C.includes("/")||C.includes("\\")}function xa(C){return as(C)?C:qr(C)}function ka(C){const R=Uo(C);if(!R)return!1;let x=0;for(const K of o.groups)if(as(K.projectName)&&Uo(K.projectName)===R&&(x+=1,x>1))return!0;return!1}function Wr(C){const R=o.projectDisplayNameById[C.projectName],x=qr(C.projectName),K=C.projectName;if(R&&!as(K)&&K!==x)return x.includes(K)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(K)?x:`${x} ${K}`;if(R&&as(K)){const To=Uo(K),so=Uo(Xi(K)),Jt=ka(K)?so:To;return Jt&&Jt!==x?`${x} ${Jt}`:x}if(!x.includes("/")&&!x.includes("\\"))return x;const Ke=Uo(x)||x,Dt=Uo(Xi(x));return Dt.startsWith(".")&&Dt!==Ke?`${Ke} ${Dt}`:C.threads.length>0||!ka(K)?Ke:Dt?`${Ke} ${Dt}`:Ke}function yr(C){return re.value===C}function At(){re.value="",ke.value="actions",Ie.value=""}function Yo(){const C=!an.value;C&&(At(),Ye()),an.value=C}function wr(C){It.value=C,an.value=!1}function ss(){W.value=!W.value}function zn(C){he.value=C}function Ia(C){s("request-project-git-status",C),Ft(()=>{Gr(C)})}function Ot(C){if(re.value===C){At();return}Ye(),an.value=!1,re.value=C,ke.value="actions",Ie.value=qr(C),Ia(C)}function is(C){Ye(),an.value=!1,re.value=C,ke.value="actions",Ie.value=qr(C),Ia(C)}function ls(C){return o.projectDisplayNameById[C.projectName]??Wr(C)}function xi(C){Ye();const R=C.projectName;re.value=R,ke.value="rename",Ie.value=ls(C),Ft(()=>{Gr(R)})}function Hn(C){s("browse-project-files",C),At()}function qs(C){s("save-project",C),At()}function Ws(C){s("create-project-worktree",C),At()}function ki(C){s("rename-project",{projectName:C,displayName:Ie.value})}function on(C){const R=Vt(C);if(s("remove-project",C),R&&St(C)){me.value="";const x=De.value;De.value=Ho(De.value,R),Dg(R).then(ga).catch(async K=>{De.value=x;const Ke=K instanceof Error?K.message:r("Failed to delete project automation");me.value=Ke,a(Ke);try{await ga()}catch{De.value=x}}).finally(()=>{s("automations-changed")})}At()}function Vt(C){var x;const R=((x=o.projectCwdByName[C])==null?void 0:x.trim())??"";return Bx(R)?R:""}function ro(C,R){if(!C.altKey||C.key!=="ArrowUp"&&C.key!=="ArrowDown")return;const x=o.groups.findIndex(Dt=>Dt.projectName===R);if(x<0)return;const K=C.key==="ArrowUp"?-1:1,Ke=Math.max(0,Math.min(x+K,o.groups.length-1));Ke!==x&&(C.preventDefault(),s("reorder-project",{projectName:R,toIndex:Ke}))}function us(C){return $.value[C]===!0}function yo(C){return j.value[C]===!0}function wo(C){$.value={...$.value,[C]:!us(C)}}function No(){ce.value=!ce.value}function yn(C){qo(C)||(j.value={...j.value,[C]:!yo(C)})}function Aa(C,R){const x=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(x){Bn.set(C,x);return}Bn.delete(C)}function qn(C,R){const x=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(x){mo.set(C,x);return}mo.delete(C)}function Ii(C){let R=C.parentElement;for(;R;){const x=window.getComputedStyle(R),K=x.overflowY||x.overflow;if(K==="auto"||K==="scroll"||K==="hidden"||K==="clip")return R.getBoundingClientRect();R=R.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function br(C,R){const x=C.getBoundingClientRect(),K=Ii(C),Ke=6,Dt=K.bottom-x.bottom,To=x.top-K.top;return Dt>=R+Ke?"down":To>Dt?"up":"down"}function Tr(C,R){const x=mo.get(C);if(!x)return"down";const K=br(x,R);return ae.value={...ae.value,[C]:K},K}function Ai(C){return ae.value[C]??"down"}function Gr(C){const R=Bn.get(C);if(!R)return;const x=R.querySelector(".project-menu-panel"),K=(x==null?void 0:x.getBoundingClientRect().height)??0;Ne.value={...Ne.value,[C]:br(R,K)}}function Jo(C,R,x){return Math.min(Math.max(C,R),x)}function Sr(C){const R=mo.get(C);if(!R)return;const x=dr.value,K=x==null?void 0:x.getBoundingClientRect(),Ke=(K==null?void 0:K.height)||(x==null?void 0:x.offsetHeight)||112,Dt=(K==null?void 0:K.width)||(x==null?void 0:x.offsetWidth)||160,To=Tr(C,Ke),so=R.getBoundingClientRect(),Jt=8,Zr=4,ea=Math.max(Jt,window.innerWidth-Dt-Jt),fs=Jo(so.right-Dt,Jt,ea),ps=Jo(To==="up"?so.top-Ke-Zr:so.bottom+Zr,Jt,Math.max(Jt,window.innerHeight-Ke-Jt));Ee.value={left:`${Math.round(fs)}px`,top:`${Math.round(ps)}px`}}function Vr(){const C=xe.value;C&&Sr(C)}function Kr(){window.addEventListener("resize",Vr),document.addEventListener("scroll",Vr,!0)}function Yr(){window.removeEventListener("resize",Vr),document.removeEventListener("scroll",Vr,!0)}function Gs(C){const R=re.value;if(!R)return!1;const x=Bn.get(R);if(!x)return!1;if((typeof C.composedPath=="function"?C.composedPath():[]).includes(x))return!0;const Ke=C.target;return Ke instanceof Node?x.contains(Ke):!1}function cs(C){const R=xe.value;if(!R)return!1;const x=mo.get(R);if(!x)return!1;const K=typeof C.composedPath=="function"?C.composedPath():[];if(K.includes(x))return!0;const Ke=dr.value;if(Ke&&K.includes(Ke))return!0;const Dt=C.target;return Dt instanceof Node?!!(x.contains(Dt)||Ke&&Ke.contains(Dt)):!1}function ds(C){if(an.value){const R=Wo.value,x=typeof C.composedPath=="function"?C.composedPath():[];!!R&&(x.includes(R)||C.target instanceof Node&&R.contains(C.target))||(an.value=!1)}re.value&&(Gs(C)||At(),xe.value&&(cs(C)||Ye()))}function Vs(C){re.value&&!Gs(C)&&At(),xe.value&&!cs(C)&&Ye()}function ao(){an.value&&(an.value=!1),re.value&&At(),xe.value&&Ye()}function _a(){window.addEventListener("pointerdown",ds,{capture:!0}),window.addEventListener("focusin",Vs,{capture:!0}),window.addEventListener("blur",ao)}function _i(){window.removeEventListener("pointerdown",ds,{capture:!0}),window.removeEventListener("focusin",Vs,{capture:!0}),window.removeEventListener("blur",ao)}function Pa(C){return zs.value.get(C.projectName)??[]}function Pi(C){if(eo.value)return Pa(C);if(yo(C.projectName))return[];const R=Pa(C);return us(C.projectName)?R:R.slice(0,10)}function Jr(C){return eo.value?!1:!yo(C.projectName)&&Pa(C).length>10}function Qr(C){return Pa(C).length>0}function Cr(C){var R;return!!C.pendingRequestState||C.inProgress||C.unread||((R=C.externalSession)==null?void 0:R.active)===!0}function bo(C){return C.pendingRequestState==="approval"?r("Awaiting approval"):r("Awaiting response")}function $o(C){var R;return((R=C.externalSession)==null?void 0:R.active)===!0?"external":C.pendingRequestState==="approval"?"awaiting-approval":C.pendingRequestState==="response"?"awaiting-response":C.inProgress?"working":C.unread?"unread":"idle"}ot(()=>o.groups.map(C=>C.projectName),C=>{Sn(C)}),ot(()=>{const C=re.value;return C?o.projectGitRepoByName[C]:void 0},()=>{const C=re.value;C&&Ft(()=>{re.value===C&&Gr(C)})});const Xr=Y(()=>an.value||re.value!==""||xe.value!=="");return ot(Xr,C=>{if(C){_a();return}_i()}),ot(xe,C=>{if(!C){Yr();return}Kr(),Ft(()=>{Sr(C)})}),Fs(()=>{Bn.clear(),Yr(),_i(),os()}),(C,R)=>(_(),F("section",{class:ut(["thread-tree-root",{"chats-first":W.value}])},[ln.value.length>0?(_(),F("section",K_,[Fe(ks,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":H.value,onClick:Hs},{left:pt(()=>[H.value?(_(),Qe(Ls,{key:1,class:"thread-icon"})):(_(),Qe(ku,{key:0,class:"thread-icon"}))]),default:pt(()=>[w("span",Y_,D(m(r)("Pinned")),1)]),_:1},8,["aria-expanded"]),H.value?(_(),F("ul",J_,[(_(!0),F(lt,null,en(ln.value,x=>(_(),Qe(Iu,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:no(x.id),"menu-open":Ae(x.id),"show-status-indicator":Cr(x),"thread-state":$o(x),"inline-delete-confirming":Un(x.id),"automation-count":m(ge)(x.id),"automation-tooltip":m($t)(x.id),"request-label":bo(x),"relative-time":go(x),"delete-label":m(r)("Delete thread"),"confirm-delete-label":m(r)("Confirm delete"),"confirm-label":m(r)("Confirm"),"worktree-label":m(r)("Worktree thread"),"set-menu-wrap-ref":K=>qn(x.id,K),onSelect:K=>ft(x.id),onInlineDelete:K=>Sa(x.id),onMenuToggle:K=>gt(x.id),onRowLeave:K=>U(x.id,K),onRowContextmenu:K=>kn(K,x.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):ve("",!0)])):ve("",!0),w("section",Q_,[Fe(ks,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":q.value,onClick:Lo},{left:pt(()=>[q.value?(_(),Qe(Ls,{key:1,class:"thread-icon"})):(_(),Qe(ku,{key:0,class:"thread-icon"}))]),right:pt(()=>[w("div",{ref_key:"organizeMenuWrapRef",ref:Wo,class:"organize-menu-wrap"},[w("button",{class:"organize-menu-trigger",type:"button","aria-expanded":an.value,"aria-label":m(r)("Organize threads"),title:m(r)("Organize threads"),onClick:wt(Yo,["stop"])},[Fe(lf,{class:"thread-icon"})],8,Z_),an.value?(_(),F("div",{key:0,class:"organize-menu-panel",onClick:R[4]||(R[4]=wt(()=>{},["stop"]))},[w("p",eP,D(m(r)("Organize")),1),w("button",{class:"organize-menu-item","data-active":It.value==="project",type:"button",onClick:R[0]||(R[0]=x=>wr("project"))},[w("span",null,D(m(r)("By project")),1),It.value==="project"?(_(),F("span",nP,"✓")):ve("",!0)],8,tP),w("button",{class:"organize-menu-item","data-active":It.value==="chronological",type:"button",onClick:R[1]||(R[1]=x=>wr("chronological"))},[w("span",null,D(m(r)("Chronological list")),1),It.value==="chronological"?(_(),F("span",rP,"✓")):ve("",!0)],8,oP),w("button",{class:"organize-menu-item","data-active":W.value,type:"button",onClick:ss},[w("span",null,D(m(r)("Chats first")),1),W.value?(_(),F("span",sP,"✓")):ve("",!0)],8,aP),R[40]||(R[40]=w("div",{class:"organize-menu-separator"},null,-1)),w("p",iP,D(m(r)("Sort by")),1),w("button",{class:"organize-menu-item","data-active":he.value==="created",type:"button",onClick:R[2]||(R[2]=x=>zn("created"))},[w("span",null,D(m(r)("Created")),1),he.value==="created"?(_(),F("span",uP,"✓")):ve("",!0)],8,lP),w("button",{class:"organize-menu-item","data-active":he.value==="updated",type:"button",onClick:R[3]||(R[3]=x=>zn("updated"))},[w("span",null,D(m(r)("Updated")),1),he.value==="updated"?(_(),F("span",dP,"✓")):ve("",!0)],8,cP),R[41]||(R[41]=w("div",{class:"organize-menu-separator"},null,-1)),w("button",{class:"organize-menu-item",type:"button",onClick:P},[w("span",null,D(m(r)("Recycle bin")),1)])])):ve("",!0)],512)]),default:pt(()=>[w("span",X_,D(m(r)("Projects")),1)]),_:1},8,["aria-expanded"]),q.value?(_(),F(lt,{key:0},[m(me)?(_(),F("p",fP,D(m(me)),1)):ve("",!0),eo.value&&Ko.value.length===0?(_(),F("p",pP,D(m(r)("No matching threads")),1)):e.isLoading&&e.groups.length===0?(_(),F("p",hP,D(m(r)("Loading threads...")),1)):to.value?(_(),F("ul",mP,[(_(!0),F(lt,null,en(Yt.value,x=>(_(),Qe(Iu,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:no(x.id),"menu-open":Ae(x.id),"show-status-indicator":Cr(x),"thread-state":$o(x),"inline-delete-confirming":Un(x.id),"automation-count":m(ge)(x.id),"automation-tooltip":m($t)(x.id),"request-label":bo(x),"relative-time":go(x),"delete-label":m(r)("Delete thread"),"confirm-delete-label":m(r)("Confirm delete"),"confirm-label":m(r)("Confirm"),"worktree-label":m(r)("Worktree thread"),"set-menu-wrap-ref":K=>qn(x.id,K),onSelect:K=>ft(x.id),onInlineDelete:K=>Sa(x.id),onMenuToggle:K=>gt(x.id),onRowLeave:K=>U(x.id,K),onRowContextmenu:K=>kn(K,x.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):(_(),F("div",{key:4,ref_key:"groupsContainerRef",ref:cr,class:"thread-tree-groups",style:or(m(ns))},[(_(!0),F(lt,null,en(Ko.value,x=>(_(),F("article",{key:x.projectName,ref_for:!0,ref:K=>m(Po)(x.projectName,K),class:"project-group","data-project-name":x.projectName,"data-expanded":!yo(x.projectName),"data-dragging":m(it)(x.projectName),style:or(m(kt)(x.projectName))},[Fe(ks,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:K=>yn(x.projectName),onContextmenu:wt(K=>is(x.projectName),["prevent"]),onKeydown:[K=>ro(K,x.projectName),xo(wt(K=>yn(x.projectName),["prevent"]),["enter"]),xo(wt(K=>yn(x.projectName),["prevent"]),["space"])]},{left:pt(()=>[w("span",gP,[w("span",yP,[yo(x.projectName)?(_(),Qe(Qf,{key:0,class:"thread-icon"})):(_(),Qe(MA,{key:1,class:"thread-icon"}))]),w("span",wP,[yo(x.projectName)?(_(),Qe(ku,{key:0,class:"thread-icon"})):(_(),Qe(Ls,{key:1,class:"thread-icon"}))])])]),right:pt(()=>[w("div",xP,[w("div",{ref_for:!0,ref:K=>Aa(x.projectName,K),class:"project-menu-wrap"},[w("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:wt(K=>Ot(x.projectName),["stop"])},[Fe(lf,{class:"thread-icon"})],8,kP),yr(x.projectName)?(_(),F("div",{key:0,class:"project-menu-panel","data-open-direction":Ne.value[x.projectName]??"down",onClick:R[6]||(R[6]=wt(()=>{},["stop"]))},[ke.value==="actions"?(_(),F(lt,{key:0},[w("button",{class:"project-menu-item",type:"button",onClick:K=>Hn(x.projectName)},D(m(r)("Browse files")),9,AP),w("button",{class:"project-menu-item",type:"button",onClick:K=>qs(x.projectName)},D(m(r)("Export Project")),9,_P),w("button",{class:"project-menu-item",type:"button",onClick:K=>m(Ao)(x.projectName)},D(m(St)(x.projectName)?m(r)("Manage automations…"):m(r)("Add automation…")),9,PP),e.projectGitRepoByName[x.projectName]?(_(),F("button",{key:0,class:"project-menu-item",type:"button",onClick:K=>Ws(x.projectName)},D(m(r)("New worktree")),9,RP)):ve("",!0),w("button",{class:"project-menu-item",type:"button",onClick:K=>xi(x)},D(m(r)("Rename project")),9,EP),w("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:K=>on(x.projectName)},D(m(r)("Remove")),9,MP)],64)):(_(),F(lt,{key:1},[w("label",jP,D(m(r)("Project name")),1),_n(w("input",{"onUpdate:modelValue":R[5]||(R[5]=K=>Ie.value=K),class:"project-menu-input",type:"text",onInput:K=>ki(x.projectName)},null,40,LP),[[On,Ie.value]])],64))],8,IP)):ve("",!0)],512),w("button",{class:"thread-start-button",type:"button","aria-label":Hr(x.projectName),title:Hr(x.projectName),onClick:wt(K=>oo(x.projectName),["stop"])},[Fe(ll,{class:"thread-icon"})],8,NP)])]),default:pt(()=>[w("span",{class:"project-main-button","data-dragging-handle":m(it)(x.projectName),onMousedown:wt(K=>m(Ct)(K,x.projectName),["left"])},[w("span",{class:"project-title",title:xa(x.projectName)},D(Wr(x)),9,TP),m(St)(x.projectName)?(_(),F("span",{key:0,class:"thread-row-automation-chip",title:m(Rn)(x.projectName)},[Fe(Es,{class:"thread-row-automation-icon"}),m(Tt)(x.projectName)>1?(_(),F("span",CP,D(m(Tt)(x.projectName)),1)):ve("",!0)],8,SP)):ve("",!0)],40,bP)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),Qr(x)?(_(),F("ul",$P,[(_(!0),F(lt,null,en(Pi(x),K=>(_(),Qe(Iu,{key:K.id,thread:K,selected:K.id===e.selectedThreadId,pinned:no(K.id),"menu-open":Ae(K.id),"show-status-indicator":Cr(K),"thread-state":$o(K),"inline-delete-confirming":Un(K.id),"automation-count":m(ge)(K.id),"automation-tooltip":m($t)(K.id),"request-label":bo(K),"relative-time":go(K),"delete-label":m(r)("Delete thread"),"confirm-delete-label":m(r)("Confirm delete"),"confirm-label":m(r)("Confirm"),"worktree-label":m(r)("Worktree thread"),"set-menu-wrap-ref":Ke=>qn(K.id,Ke),onSelect:Ke=>ft(K.id),onInlineDelete:Ke=>Sa(K.id),onMenuToggle:Ke=>gt(K.id),onRowLeave:Ke=>U(K.id,Ke),onRowContextmenu:Ke=>kn(Ke,K.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):(_(),Qe(ks,{key:1,as:"p",class:"project-empty-row"},{left:pt(()=>[...R[42]||(R[42]=[w("span",{class:"project-empty-spacer"},null,-1)])]),default:pt(()=>[w("span",OP,D(m(r)("No threads")),1)]),_:1})),Jr(x)?(_(),Qe(ks,{key:2,class:"thread-show-more-row"},{left:pt(()=>[...R[43]||(R[43]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:pt(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:K=>wo(x.projectName)},D(us(x.projectName)?"Show less":"Show more"),9,DP)]),_:2},1024)):ve("",!0)],12,vP))),128))],4))],64)):ve("",!0)]),w("section",FP,[Fe(ks,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":be.value,onClick:rs},{left:pt(()=>[be.value?(_(),Qe(Ls,{key:1,class:"thread-icon"})):(_(),Qe(ku,{key:0,class:"thread-icon"}))]),right:pt(()=>[w("div",UP,[w("button",{class:"chats-section-action",type:"button","aria-label":m(r)("New chat"),title:m(r)("New chat"),onClick:R[7]||(R[7]=wt(x=>C.$emit("start-new-chat"),["stop"]))},[Fe(ll,{class:"thread-icon"})],8,zP)])]),default:pt(()=>[w("span",BP,D(m(r)("Chats")),1)]),_:1},8,["aria-expanded"]),be.value&&sn.value.length===0?(_(),F("p",HP,D(m(r)("No chats")),1)):be.value?(_(),F("ul",qP,[(_(!0),F(lt,null,en(Mn.value,x=>(_(),Qe(Iu,{key:x.id,thread:x,selected:x.id===e.selectedThreadId,pinned:no(x.id),"menu-open":Ae(x.id),"show-status-indicator":Cr(x),"thread-state":$o(x),"inline-delete-confirming":Un(x.id),"automation-count":m(ge)(x.id),"automation-tooltip":m($t)(x.id),"request-label":bo(x),"relative-time":go(x),"delete-label":m(r)("Delete thread"),"confirm-delete-label":m(r)("Confirm delete"),"confirm-label":m(r)("Confirm"),"worktree-label":m(r)("Worktree thread"),"set-menu-wrap-ref":K=>qn(x.id,K),onSelect:K=>ft(x.id),onInlineDelete:K=>Sa(x.id),onMenuToggle:K=>gt(x.id),onRowLeave:K=>U(x.id,K),onRowContextmenu:K=>kn(K,x.id)},null,8,["thread","selected","pinned","menu-open","show-status-indicator","thread-state","inline-delete-confirming","automation-count","automation-tooltip","request-label","relative-time","delete-label","confirm-delete-label","confirm-label","worktree-label","set-menu-wrap-ref","onSelect","onInlineDelete","onMenuToggle","onRowLeave","onRowContextmenu"]))),128))])):ve("",!0),be.value&&wa.value?(_(),Qe(ks,{key:2,class:"thread-show-more-row"},{left:pt(()=>[...R[44]||(R[44]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:pt(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:No},D(ce.value?"Show less":"Show more"),1)]),_:1})):ve("",!0)]),(_(),Qe(nl,{to:"body"},[zt.value?(_(),F("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:dr,class:"thread-menu-panel thread-menu-panel-fixed",style:or(Ee.value),"data-open-direction":Ai(zt.value.id),onClick:R[17]||(R[17]=wt(()=>{},["stop"]))},[w("button",{class:"thread-menu-item",type:"button",onClick:R[8]||(R[8]=x=>m(Bs)(zt.value.id))},D(m(Je)(zt.value.id)?m(r)("Manage automations…"):m(r)("Add automation…")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[9]||(R[9]=x=>vr(zt.value.id))},D(m(r)("Browse files")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[10]||(R[10]=x=>k(zt.value.id))},D(m(r)("Export Project")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[11]||(R[11]=x=>E(zt.value.id))},D(m(r)("Copy path")),1),w("button",{class:"thread-menu-item",type:"button",disabled:zt.value.id!==e.selectedThreadId,title:zt.value.id===e.selectedThreadId?m(r)("Copy chat"):m(r)("Open this chat before copying"),onClick:R[12]||(R[12]=x=>gn(zt.value.id))},D(m(r)("Copy chat")),9,GP),w("button",{class:"thread-menu-item",type:"button",onClick:R[13]||(R[13]=x=>Ln(zt.value.id))},D(m(r)("Create chat fork")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[14]||(R[14]=x=>zr(zt.value.id))},D(no(zt.value.id)?m(r)("Unpin thread"):m(r)("Pin thread")),1),w("button",{class:"thread-menu-item",type:"button",onClick:R[15]||(R[15]=x=>Rt(zt.value.id,zt.value.title))},D(m(r)("Rename thread")),1),w("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:R[16]||(R[16]=x=>Ta(zt.value.id,zt.value.title))},D(m(r)("Delete thread")),1)],12,WP)):ve("",!0)])),Fe(_d,{open:ze.value,title:m(r)("Rename thread"),subtitle:m(r)("Make it short and recognizable."),onClose:dn},{footer:pt(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:dn},D(m(r)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:gr},D(m(r)("Save")),1)]),default:pt(()=>[_n(w("input",{ref_key:"renameThreadInputRef",ref:ct,"onUpdate:modelValue":R[18]||(R[18]=x=>tt.value=x),class:"rename-thread-input",type:"text",placeholder:m(r)("Add title..."),onKeydown:xo(wt(gr,["prevent"]),["enter"])},null,40,VP),[[On,tt.value]])]),_:1},8,["open","title","subtitle"]),Fe(_d,{open:ue.value,title:Mo.value?m(r)("Archive chat and remove automations?"):m(r)("Delete thread?"),subtitle:jo.value,onClose:nn},{footer:pt(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:nn},D(m(r)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:Ci},D(Mo.value?m(r)("Archive and remove"):m(r)("Delete")),1)]),_:1},8,["open","title","subtitle"]),Fe(_d,{open:f.value,title:m(r)("Recycle bin"),subtitle:m(r)("Threads you removed are kept here so you can restore them."),size:"md",onClose:R[19]||(R[19]=x=>f.value=!1)},{default:pt(()=>[w("div",KP,[m(i).length===0?(_(),F("div",YP,D(m(r)("Recycle bin is empty.")),1)):(_(),F("ul",JP,[(_(!0),F(lt,null,en(m(i),x=>(_(),F("li",{key:x.id,class:"recycle-bin-item"},[w("div",QP,[w("span",XP,D(x.title),1),x.projectName?(_(),F("span",ZP,D(x.projectName),1)):ve("",!0),w("span",eR,D(hr(x.archivedAtIso)),1)]),w("div",tR,[w("button",{class:"recycle-bin-button recycle-bin-button-primary",type:"button",disabled:y.value===x.id,onClick:K=>B(x.id)},D(y.value===x.id?m(r)("Restoring…"):m(r)("Restore")),9,nR),w("button",{class:"recycle-bin-button recycle-bin-button-danger",type:"button",onClick:K=>m(c)(x.id)},D(m(r)("Delete permanently")),9,oR)])]))),128))])),b.value?(_(),F("p",rR,D(b.value),1)):ve("",!0)])]),_:1},8,["open","title","subtitle"]),(_(),Qe(nl,{to:"body"},[m(A)?(_(),F("div",{key:0,class:"rename-thread-overlay",onClick:R[39]||(R[39]=wt((...x)=>m(ur)&&m(ur)(...x),["self"]))},[w("div",{class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":m(M)==="project"?m(r)("Project automation"):m(r)("Thread automation")},[w("h3",sR,D(m(ee)==="edit"?m(r)("Edit automation"):m(r)("Add automation")),1),w("p",iR,D(m(Ze)),1),m(de)&&m(ee)==="create"?(_(),F("div",lR,[R[45]||(R[45]=w("span",{class:"automation-thread-label"},"Target",-1)),w("div",uR,[w("button",{class:ut(["automation-target-mode",{"is-active":m(te)==="thread"}]),type:"button",onClick:R[20]||(R[20]=x=>m(es)("thread"))}," Existing chat ",2),w("button",{class:ut(["automation-target-mode",{"is-active":m(te)==="project"}]),type:"button",onClick:R[21]||(R[21]=x=>m(es)("project"))}," Project ",2)]),w("div",cR,[Fe(wi,{modelValue:m(Me),"onUpdate:modelValue":R[22]||(R[22]=x=>Pn(Me)?Me.value=x:null),class:"automation-thread-dropdown",options:m(vt),placeholder:m(te)==="project"?"Select project":"Select chat","enable-search":"","search-placeholder":m(te)==="project"?"Search projects":"Search chats"},null,8,["modelValue","options","placeholder","search-placeholder"])])])):ve("",!0),m(dt).length>0?(_(),F("div",{key:1,class:"automation-thread-list","aria-label":m(M)==="project"?"Project automations":"Thread automations"},[(_(!0),F(lt,null,en(m(dt),x=>(_(),F("button",{key:x.id,class:ut(["automation-thread-list-item",{"is-active":x.id===m(z)}]),type:"button",onClick:K=>m(Br)(x.id)},[w("span",null,D(x.name),1),w("small",null,D(x.status==="PAUSED"?"Paused":"Active"),1)],10,fR))),128)),w("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:R[23]||(R[23]=(...x)=>m(zo)&&m(zo)(...x))},D(m(r)("Add another automation")),1)],8,dR)):ve("",!0),w("label",pR,[w("span",hR,D(m(r)("Name")),1),_n(w("input",{"onUpdate:modelValue":R[24]||(R[24]=x=>m(He).name=x),class:"rename-thread-input",type:"text",placeholder:m(r)("Automation name")},null,8,mR),[[On,m(He).name]])]),w("label",vR,[w("span",gR,D(m(r)("Prompt")),1),_n(w("textarea",{"onUpdate:modelValue":R[25]||(R[25]=x=>m(He).prompt=x),class:"automation-thread-textarea",rows:"6",placeholder:m(r)("Describe what the automation should do")},null,8,yR),[[On,m(He).prompt]])]),w("div",wR,[w("span",bR,D(m(r)("Schedule")),1),w("div",TR,[w("button",{class:ut(["automation-schedule-mode",{"is-active":m(qe).mode==="daily"}]),type:"button",onClick:R[26]||(R[26]=x=>m(lr)("daily"))},D(m(r)("Daily")),3),w("button",{class:ut(["automation-schedule-mode",{"is-active":m(qe).mode==="interval"}]),type:"button",onClick:R[27]||(R[27]=x=>m(lr)("interval"))},D(m(r)("Interval")),3),w("button",{class:ut(["automation-schedule-mode",{"is-active":m(qe).mode==="advanced"}]),type:"button",onClick:R[28]||(R[28]=x=>m(lr)("advanced"))}," RRULE ",2)]),m(qe).mode==="daily"?(_(),F("div",SR,[w("span",CR,D(m(r)("Run every day at")),1),_n(w("input",{"onUpdate:modelValue":R[29]||(R[29]=x=>m(qe).dailyTime=x),class:"automation-schedule-time",type:"time",onInput:R[30]||(R[30]=(...x)=>m(cn)&&m(cn)(...x))},null,544),[[On,m(qe).dailyTime]])])):m(qe).mode==="interval"?(_(),F("div",xR,[w("span",kR,D(m(r)("Run every")),1),_n(w("input",{"onUpdate:modelValue":R[31]||(R[31]=x=>m(qe).interval=x),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:R[32]||(R[32]=(...x)=>m(cn)&&m(cn)(...x))},null,544),[[On,m(qe).interval,void 0,{number:!0}]]),Fe(wi,{class:"automation-schedule-unit-dropdown","model-value":m(qe).intervalUnit,options:m(V),placeholder:m(r)("Unit"),"onUpdate:modelValue":m(Io)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):ve("",!0),m(qe).mode==="advanced"?_n((_(),F("input",{key:2,"onUpdate:modelValue":R[33]||(R[33]=x=>m(He).rrule=x),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:R[34]||(R[34]=(...x)=>m(va)&&m(va)(...x))},null,544)),[[On,m(He).rrule]]):ve("",!0),w("p",IR,D(m(nt)),1)]),w("div",AR,[w("span",_R,D(m(r)("Status")),1),Fe(wi,{class:"automation-thread-dropdown","model-value":m(He).status,options:m(le),placeholder:m(r)("Status"),"onUpdate:modelValue":m(ma)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),m(je)?(_(),F("p",PR,D(m(je)),1)):m(Ce)?(_(),F("p",RR,D(m(Ce)),1)):ve("",!0),w("div",ER,[m(ee)==="edit"&&m(M)==="thread"?(_(),F("button",{key:0,class:"rename-thread-button",type:"button",disabled:m(Ve)||m(Le),onClick:R[35]||(R[35]=(...x)=>m(ho)&&m(ho)(...x))},D(m(Le)?m(r)("Running…"):m(r)("Run now")),9,MR)):ve("",!0),m(ee)==="edit"?(_(),F("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:m(Ve)||m(Le),onClick:R[36]||(R[36]=(...x)=>m(ya)&&m(ya)(...x))},D(m(r)("Remove")),9,jR)):ve("",!0),w("button",{class:"rename-thread-button",type:"button",disabled:m(Ve)||m(Le),onClick:R[37]||(R[37]=(...x)=>m(ur)&&m(ur)(...x))},D(m(r)("Cancel")),9,LR),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:m(Ve)||m(Le),onClick:R[38]||(R[38]=(...x)=>m(ts)&&m(ts)(...x))},D(m(Ve)?m(r)("Saving…"):m(r)("Save")),9,NR)])],8,aR)])):ve("",!0)]))],2))}}),OR=xt($R,[["__scopeId","data-v-7545cfca"]]),DR={class:"content-header"},FR=["title"],BR={class:"content-actions"},UR=vn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(_(),F("header",DR,[w("div",{class:ut(["content-leading",{"is-accent":e.accent}])},[ko(t.$slots,"leading",{},void 0)],2),w("h1",{class:ut(["content-title",{"is-accent":e.accent}]),title:e.title},D(e.title),11,FR),w("div",BR,[ko(t.$slots,"actions",{},void 0)])]))}}),zR=xt(UR,[["__scopeId","data-v-61739409"]]),Om=.0025,Pd=3,Dm=2,HR=256;function qR(e){var ye;const t=S("idle"),n=S(typeof navigator<"u"&&!!((ye=navigator.mediaDevices)!=null&&ye.getUserMedia)),o=S(0),r=S(null);let a=null,s=null,i=[],l=null,d=null,c=null,v=null,f=[],b=!1,y=!1,P=null;function B(){P&&(P.abort(),P=null),t.value==="transcribing"&&(t.value="idle")}function $(){const X=r.value;if(!X||typeof window>"u")return;const pe=X.getContext("2d");if(!pe)return;const re=Math.max(1,Math.floor(X.clientWidth)),xe=Math.max(1,Math.floor(X.clientHeight||36)),$e=window.devicePixelRatio||1,Ne=Math.max(1,Math.floor(re*$e)),ae=Math.max(1,Math.floor(xe*$e));(X.width!==Ne||X.height!==ae)&&(X.width=Ne,X.height=ae),pe.setTransform($e,0,0,$e,0,0),pe.clearRect(0,0,re,xe);const Ee=Math.max(12,Math.floor(re/(Pd+Dm))),ke=f.slice(-Ee),Ie=Math.max(0,Ee-ke.length),ze=xe/2,st=getComputedStyle(X).color||"#000000";for(let tt=0;tt<Ee;tt+=1){const ct=ke[tt-Ie]??0,N=Math.max(.08,Math.min(1,ct*18))*ze,ie=tt*(Pd+Dm);pe.globalAlpha=ct<=Om?.35:1,pe.fillStyle=st,pe.fillRect(ie,ze-N,Pd,N*2)}pe.globalAlpha=1}function j(){f=[],o.value=0,$()}function H(){c&&(c.disconnect(),c.onaudioprocess=null,c=null),d&&(d.disconnect(),d=null),l&&(l.close(),l=null),v=null}function q(X){if(typeof window>"u")return;const pe=window.webkitAudioContext,re=window.AudioContext??pe;re&&(H(),j(),l=new re,d=l.createMediaStreamSource(X),c=l.createScriptProcessor(2048,1,1),v=performance.now(),c.onaudioprocess=xe=>{const $e=xe.inputBuffer.getChannelData(0);let Ne=0;for(let ae=0;ae<$e.length;ae+=1){const Ee=Math.abs($e[ae]??0);Ne+=Ee<Om?0:Ee}f.push(Ne/$e.length),f.length>HR&&f.shift(),v!==null&&(o.value=Math.max(0,performance.now()-v)),$()},d.connect(c),c.connect(l.destination),$())}async function be(){var X;if(t.value==="transcribing"&&B(),!(t.value!=="idle"||!n.value||b)){b=!0,y=!1;try{s=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),i=[],a=new MediaRecorder(s),a.ondataavailable=pe=>{pe.data.size>0&&i.push(pe.data)},a.onstop=()=>{var xe;const pe=i,re=(a==null?void 0:a.mimeType)||((xe=pe[0])==null?void 0:xe.type)||"audio/webm";Se(),he(pe,re)},q(s),a.start(250),t.value="recording",y&&ce()}catch(pe){Se(),t.value="idle",(X=e.onError)==null||X.call(e,pe)}finally{b=!1}}}function ce(){if(b&&t.value==="idle"){y=!0;return}if(!(t.value!=="recording"||!a)&&a.state!=="inactive"){t.value="transcribing";try{a.requestData()}catch{}a.stop()}}function W(){y=!1,B(),Se(),t.value="idle"}async function he(X,pe){var $e,Ne,ae,Ee,ke;if(X.length===0){($e=e.onEmpty)==null||$e.call(e),t.value="idle";return}const re=new Blob(X,{type:pe});t.value="transcribing";let xe=null;try{const Ie=pe.split(/[/;]/)[1]??"webm",ze=new FormData;ze.append("file",re,`codex.${Ie}`);const st=((Ne=e.getLanguage)==null?void 0:Ne.call(e).trim())??"";st&&st.toLowerCase()!=="auto"&&ze.append("language",st),xe=new AbortController,P=xe;const tt=await fetch("/codex-api/transcribe",{method:"POST",body:ze,signal:xe.signal}),ct=await tt.text();let ue=null;try{ue=ct.trim()?JSON.parse(ct):null}catch{ue=null}if(!tt.ok){const ie=(ae=ue==null?void 0:ue.error)==null?void 0:ae.trim(),se=ct.trim();throw new Error(ie||se||`Transcription failed: ${tt.status}`)}const N=((ue==null?void 0:ue.text)??"").trim();N.length>0?e.onTranscript(N):(Ee=e.onEmpty)==null||Ee.call(e)}catch(Ie){if(Ie instanceof DOMException&&Ie.name==="AbortError")return;(ke=e.onError)==null||ke.call(e,Ie)}finally{xe&&P===xe&&(P=null),t.value==="transcribing"&&(t.value="idle")}}function Se(){H(),j(),a&&(a.ondataavailable=null,a.onstop=null,a=null),s&&(s.getTracks().forEach(X=>X.stop()),s=null),i=[]}Fs(()=>{W()});function _e(){if(t.value==="recording"){ce();return}(t.value==="idle"||t.value==="transcribing")&&be()}return{state:t,isSupported:n,recordingDurationMs:o,waveformCanvasRef:r,startRecording:be,stopRecording:ce,toggleRecording:_e,cancel:W}}const WR={},GR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function VR(e,t){return _(),F("svg",GR,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m12 5l0 14m-6-8l6-6l6 6"},null,-1)])])}const KR=xt(WR,[["render",VR]]),YR={},JR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function QR(e,t){return _(),F("svg",JR,[...t[0]||(t[0]=[w("path",{d:"M4 8V4h4"},null,-1),w("path",{d:"M20 8V4h-4"},null,-1),w("path",{d:"M4 16v4h4"},null,-1),w("path",{d:"M20 16v4h-4"},null,-1)])])}const XR=xt(YR,[["render",QR]]),ZR={},eE={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function tE(e,t){return _(),F("svg",eE,[...t[0]||(t[0]=[w("path",{d:"M8 4v4H4"},null,-1),w("path",{d:"M16 4v4h4"},null,-1),w("path",{d:"M8 20v-4H4"},null,-1),w("path",{d:"M16 20v-4h4"},null,-1)])])}const nE=xt(ZR,[["render",tE]]),oE={},rE={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function aE(e,t){return _(),F("svg",rE,[...t[0]||(t[0]=[w("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),w("path",{fill:"currentColor",d:"M8 5a3 3 0 0 0 -3 3v8a3 3 0 0 0 3 3h8a3 3 0 0 0 3 -3v-8a3 3 0 0 0 -3 -3h-8z"},null,-1)])])}const sE=xt(oE,[["render",aE]]),iE=["aria-label"],lE=8,ci=8,uE=vn({__name:"ComposerPopover",props:{open:{type:Boolean},align:{},width:{},panelClass:{},ariaLabel:{}},emits:["update:open"],setup(e,{expose:t,emit:n}){const o=e,r=n,a=S(null),s=S(null),i=S({});let l=!1;const d=Y(()=>o.open),c=Y(()=>o.width==="lg"?"composer-popover-panel--lg":"composer-popover-panel--md");function v($,j,H){return Math.min(Math.max(j,$),H)}function f(){var _e,ye;if(!d.value)return;const $=a.value;if(!$||typeof window>"u")return;const j=$.getBoundingClientRect(),H=window.innerWidth,q=window.innerHeight,be=Math.max(0,H-ci*2),ce=Math.min(((_e=s.value)==null?void 0:_e.offsetWidth)??288,be),W=((ye=s.value)==null?void 0:ye.offsetHeight)??0;let he;o.align==="end"?he=j.right-ce:o.align==="center"?he=j.left+(j.width-ce)/2:he=j.left,he=v(he,ci,Math.max(ci,H-ce-ci));let Se=j.top-W-lE;Se=v(Se,ci,Math.max(ci,q-W-ci)),i.value={position:"fixed",left:`${he}px`,right:"auto",top:`${Se}px`,bottom:"auto",width:`${ce}px`}}function b(){l||typeof window>"u"||(window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),window.addEventListener("orientationchange",f),l=!0)}function y(){!l||typeof window>"u"||(window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0),window.removeEventListener("orientationchange",f),l=!1)}ot(d,$=>{if(!$){y(),i.value={};return}b(),Ft(()=>{var j;(j=s.value)==null||j.focus(),f(),window.requestAnimationFrame(f)})}),Fs(()=>{y()});function P(){r("update:open",!o.open)}function B($){var W,he,Se;if($.key==="Escape"){r("update:open",!1);return}const j=s.value;if(!j)return;const H=Array.from(j.querySelectorAll("button")).filter(_e=>!_e.disabled&&_e.offsetParent!==null);if(H.length===0)return;if($.key==="Home"){$.preventDefault(),(W=H[0])==null||W.focus();return}if($.key==="End"){$.preventDefault(),(he=H[H.length-1])==null||he.focus();return}if($.key!=="ArrowDown"&&$.key!=="ArrowUp")return;$.preventDefault();let q=H.findIndex(_e=>_e===document.activeElement);q<0&&(q=$.key==="ArrowDown"?-1:0);const be=$.key==="ArrowDown"?1:-1,ce=(q+be+H.length)%H.length;(Se=H[ce])==null||Se.focus()}return t({root:a}),($,j)=>(_(),F("div",{ref_key:"rootRef",ref:a,class:"composer-popover-anchor"},[ko($.$slots,"trigger",{toggle:P,isOpen:d.value},void 0),Fe(tu,{name:"composer-popover"},{default:pt(()=>[d.value?(_(),F("div",{key:0,ref_key:"panelRef",ref:s,class:ut(["composer-popover-panel",[c.value,e.panelClass]]),style:or(i.value),role:"menu",tabindex:"-1","aria-label":e.ariaLabel,onKeydown:B},[ko($.$slots,"default",{},void 0,!0)],46,iE)):ve("",!0)]),_:3})],512))}}),ec=xt(uE,[["__scopeId","data-v-f7444b02"]]),cE=["aria-label"],dE={class:"composer-popover-group-label"},fE=["aria-selected","onMousedown"],pE={class:"thread-composer-slash-body"},hE={class:"thread-composer-slash-name"},mE={class:"thread-composer-slash-desc"},vE={class:"thread-composer-slash-kind"},gE={class:"composer-popover-group-label composer-popover-group-label--skills"},yE=["aria-selected","onMousedown"],wE=["aria-label","title"],bE={class:"thread-composer-slash-body thread-composer-slash-body--skill"},TE={class:"thread-composer-slash-skill-name"},SE={class:"thread-composer-slash-desc thread-composer-slash-desc--skill"},CE=vn({__name:"ComposerSlashMenu",props:{commands:{},highlightedIndex:{}},emits:["select"],setup(e,{emit:t}){const n=e,o=t,{t:r}=ha(),a=S(null),s=Y(()=>n.commands.filter(v=>v.group!=="skill")),i=Y(()=>n.commands.filter(v=>v.group==="skill"));ot(()=>n.highlightedIndex,async()=>{var v,f;await Ft(),(f=(v=a.value)==null?void 0:v.querySelector(".is-active"))==null||f.scrollIntoView({block:"nearest"})});function l(v){return r(v==="rpc"?"Action":v==="text"?"Prompt":v==="skill"?"Skill":"Local")}function d(v){return v==="system"?"S":v==="repo"?"R":v==="plugin"?"P":"U"}function c(v){return r(v==="system"?"System":v==="repo"?"Repo":v==="plugin"?"Plugin":"User")}return(v,f)=>(_(),F("div",{ref_key:"rootRef",ref:a,class:"composer-popover",role:"listbox","aria-label":m(r)("Commands")},[s.value.length>0?(_(),F(lt,{key:0},[w("div",dE,D(m(r)("Commands")),1),(_(!0),F(lt,null,en(s.value,(b,y)=>(_(),F("button",{key:b.id,class:ut(["thread-composer-slash-row",{"is-active":y===e.highlightedIndex}]),type:"button",role:"option","aria-selected":y===e.highlightedIndex,onMousedown:wt(P=>o("select",b),["prevent"])},[f[0]||(f[0]=w("span",{class:"thread-composer-slash-prefix","aria-hidden":"true"},"/",-1)),w("span",pE,[w("span",hE,D(b.id),1),w("span",mE,D(m(r)(b.description)),1)]),w("span",vE,D(l(b.kind)),1)],42,fE))),128))],64)):ve("",!0),i.value.length>0?(_(),F(lt,{key:1},[w("div",gE,D(m(r)("Skills")),1),(_(!0),F(lt,null,en(i.value,(b,y)=>(_(),F("button",{key:b.skillPath||b.id,class:ut(["thread-composer-slash-row thread-composer-slash-row--skill",{"is-active":s.value.length+y===e.highlightedIndex}]),type:"button",role:"option","aria-selected":s.value.length+y===e.highlightedIndex,onMousedown:wt(P=>o("select",b),["prevent"])},[w("span",{class:ut(["thread-composer-slash-skill-icon",`is-${b.scope||"user"}`]),"aria-label":c(b.scope),title:c(b.scope)},D(d(b.scope)),11,wE),w("span",bE,[w("span",TE,D(b.displayName||b.id),1),w("span",SE,D(b.description),1)])],42,yE))),128))],64)):ve("",!0)],8,cE))}}),xE=xt(CE,[["__scopeId","data-v-ca16aa11"]]),kE=["data-streaming"],IE=["aria-expanded"],AE={class:"thread-composer-plan-panel-title"},_E={key:0,class:"thread-composer-plan-panel-badge"},PE={class:"thread-composer-plan-panel-progress"},RE=["title"],EE=["data-status"],ME={class:"thread-composer-plan-panel-latest-text"},jE={class:"thread-composer-plan-panel-popover-content"},LE={class:"thread-composer-plan-panel-popover-scroll"},NE={class:"thread-composer-plan-panel-popover-head"},$E={class:"thread-composer-plan-panel-title"},OE={class:"thread-composer-plan-panel-progress"},DE={key:0,class:"thread-composer-plan-panel-popover-section"},FE={class:"thread-composer-plan-panel-section-label"},BE=["title"],UE={class:"thread-composer-plan-panel-popover-section"},zE={class:"thread-composer-plan-panel-section-label"},HE={class:"thread-composer-plan-panel-steps"},qE=["data-status"],WE=["data-status"],GE=["title"],VE={class:"thread-composer-plan-panel-popover-footer"},KE=["disabled","data-state"],YE=vn({__name:"ThreadComposerPlanPanel",props:{planPanel:{}},emits:["implement-plan"],setup(e,{emit:t}){const n=e,o=t,{t:r}=ha(),a=S(!1),s=Y(()=>{var f;return(((f=n.planPanel)==null?void 0:f.steps)??[]).filter(b=>b.status==="completed").length}),i=Y(()=>{var f;const v=((f=n.planPanel)==null?void 0:f.steps)??[];if(v.length===0)return null;for(let b=v.length-1;b>=0;b-=1){const y=v[b];if(y.status==="inProgress")return y}return v[v.length-1]}),l=Y(()=>{var y,P,B;const v=((P=(y=n.planPanel)==null?void 0:y.explanation)==null?void 0:P.trim())??"";if(!v)return"";const f=((B=v.split(/[。!?!?\n]/u)[0])==null?void 0:B.trim())??"";if(!f)return v;const b=80;return f.length>b?`${f.slice(0,b)}…`:f});function d(v){switch(v){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function c(){a.value=!1,o("implement-plan")}return(v,f)=>(_(),F("div",{class:"thread-composer-plan-panel","data-streaming":e.planPanel.streaming},[Fe(ec,{open:a.value,align:"center",width:"lg","panel-class":"thread-composer-plan-panel-popover","aria-label":m(r)("Plan"),"onUpdate:open":f[1]||(f[1]=b=>a.value=b)},{trigger:pt(()=>{var b,y;return[w("button",{type:"button",class:"thread-composer-plan-panel-header","aria-expanded":a.value,onClick:f[0]||(f[0]=P=>a.value=!a.value)},[f[2]||(f[2]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",AE,D(m(r)("Plan")),1),e.planPanel.streaming?(_(),F("span",_E,D(m(r)("Updating")),1)):ve("",!0),w("span",PE,D(s.value)+"/"+D(e.planPanel.steps.length),1),w("span",{class:"thread-composer-plan-panel-latest",title:((b=i.value)==null?void 0:b.step)??""},[i.value?(_(),F("span",{key:0,class:"thread-composer-plan-panel-latest-status","data-status":i.value.status},D(d(i.value.status)),9,EE)):ve("",!0),w("span",ME,D(((y=i.value)==null?void 0:y.step)??""),1)],8,RE),Fe(Ls,{class:"thread-composer-plan-panel-chevron"})],8,IE)]}),default:pt(()=>[w("div",jE,[w("div",LE,[w("header",NE,[f[3]||(f[3]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",$E,D(m(r)("Plan")),1),w("span",OE,D(s.value)+"/"+D(e.planPanel.steps.length),1)]),e.planPanel.explanation?(_(),F("section",DE,[w("p",FE,D(m(r)("Summary")),1),w("p",{class:"thread-composer-plan-panel-explanation",title:e.planPanel.explanation},D(l.value),9,BE)])):ve("",!0),w("section",UE,[w("p",zE,D(m(r)("Steps"))+" ("+D(e.planPanel.steps.length)+")",1),w("ol",HE,[(_(!0),F(lt,null,en(e.planPanel.steps,(b,y)=>(_(),F("li",{key:`composer-plan-${e.planPanel.id}-${y}`,class:"thread-composer-plan-panel-step","data-status":b.status},[w("span",{class:"thread-composer-plan-panel-step-status","data-status":b.status},D(d(b.status)),9,WE),w("span",{class:"thread-composer-plan-panel-step-text",title:b.step},D(b.step),9,GE)],8,qE))),128))])])]),w("footer",VE,[w("button",{type:"button",class:"thread-composer-plan-panel-implement",disabled:e.planPanel.streaming||e.planPanel.implemented,"data-state":e.planPanel.implemented?"done":e.planPanel.streaming?"running":"idle",onClick:c},D(e.planPanel.implemented?m(r)("Plan executed"):e.planPanel.streaming?m(r)("Implementing…"):m(r)("Implement plan")),9,KE)])])]),_:1},8,["open","aria-label"])],8,kE))}}),JE=xt(YE,[["__scopeId","data-v-b1cbf479"]]),QE={key:0,class:"thread-composer-attachments"},XE=["src"],ZE=["src","alt"],eM=["aria-label","disabled","onClick"],tM={key:1,class:"thread-composer-folder-chips"},nM=["title"],oM={class:"thread-composer-folder-chip-meta"},rM=["aria-label","disabled","onClick"],aM={key:2,class:"thread-composer-file-chips"},sM=["title"],iM=["aria-label","disabled","onClick"],lM={key:3,class:"thread-composer-skill-chips"},uM=["title","aria-label","onClick"],cM=["aria-label","onClick"],dM=vn({__name:"ThreadComposerAttachments",props:{selectedImages:{},folderUploadGroups:{},standaloneFileAttachments:{},selectedSkills:{},isInteractionDisabled:{type:Boolean}},emits:["remove-image","remove-folder","remove-file","remove-skill"],setup(e,{emit:t}){const n=t,o=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function r(l){const d=l.trim();return d?!!(/^video\/|^data:video\//i.test(d)||o.test(d)):!1}function a(l){return l.total<=0?0:Math.round(l.processed/l.total*100)}function s(l){const d=l.trim();return d?d.endsWith("/SKILL.md")?d:`${d.replace(/\/+$/,"")}/SKILL.md`:""}function i(l){const d=s(l.path);!d||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(d)}`,"_blank","noopener,noreferrer")}return(l,d)=>(_(),F(lt,null,[e.selectedImages.length>0?(_(),F("div",QE,[(_(!0),F(lt,null,en(e.selectedImages,c=>(_(),F("div",{key:c.id,class:"thread-composer-attachment"},[r(c.url)?(_(),F("video",{key:0,class:"thread-composer-attachment-image",src:c.url,controls:"",preload:"metadata"},null,8,XE)):(_(),F("img",{key:1,class:"thread-composer-attachment-image",src:c.url,alt:c.name||"Selected image"},null,8,ZE)),w("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${c.name||"image"}`,disabled:e.isInteractionDisabled,onClick:v=>n("remove-image",c.id)}," x ",8,eM)]))),128))])):ve("",!0),e.folderUploadGroups.length>0?(_(),F("div",tM,[(_(!0),F(lt,null,en(e.folderUploadGroups,c=>(_(),F("span",{key:c.id,class:"thread-composer-folder-chip"},[Fe(Qf,{class:"thread-composer-folder-chip-icon"}),w("span",{class:"thread-composer-folder-chip-name",title:c.name},D(c.name),9,nM),w("span",oM,[c.isUploading?(_(),F(lt,{key:0},[Rs(D(a(c))+"% uploading ("+D(c.processed)+"/"+D(c.total)+") ",1)],64)):(_(),F(lt,{key:1},[Rs(D(c.filePaths.length)+" file"+D(c.filePaths.length===1?"":"s"),1)],64))]),w("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${c.name}`,disabled:e.isInteractionDisabled,onClick:v=>n("remove-folder",c.id)},"×",8,rM)]))),128))])):ve("",!0),e.standaloneFileAttachments.length>0?(_(),F("div",aM,[(_(!0),F(lt,null,en(e.standaloneFileAttachments,c=>(_(),F("span",{key:c.fsPath,class:"thread-composer-file-chip"},[Fe(ll,{class:"thread-composer-file-chip-icon"}),w("span",{class:"thread-composer-file-chip-name",title:c.fsPath},D(c.label),9,sM),w("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${c.label}`,disabled:e.isInteractionDisabled,onClick:v=>n("remove-file",c.fsPath)},"×",8,iM)]))),128))])):ve("",!0),e.selectedSkills.length>0?(_(),F("div",lM,[(_(!0),F(lt,null,en(e.selectedSkills,c=>(_(),F("span",{key:c.path,class:"thread-composer-skill-chip"},[w("button",{class:"thread-composer-skill-chip-name",type:"button",title:s(c.path),"aria-label":`Open ${c.displayName||c.name} SKILL.md`,onClick:v=>i(c)},D(c.displayName||c.name),9,uM),w("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${c.displayName||c.name}`,onClick:v=>n("remove-skill",c.path)},"×",8,cM)]))),128))])):ve("",!0)],64))}}),fM=xt(dM,[["__scopeId","data-v-acea11fd"]]),pM=vn({__name:"ThreadComposerModelControls",props:{models:{},selectedModel:{},modelReasoningEfforts:{},selectedReasoningEffort:{},selectedSpeedMode:{},disabled:{type:Boolean},activeThreadId:{}},emits:["update:selected-model","update:selected-reasoning-effort"],setup(e,{emit:t}){const n=e,o=t,{t:r}=ha(),a=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],s=Y(()=>{var B;const y=(B=n.modelReasoningEfforts)==null?void 0:B[n.selectedModel];if(y===void 0)return a;const P=new Set(y);return a.filter($=>P.has($.value))});function i(y){return y.trim().replace(/^gpt/i,"GPT")}const l=Y(()=>n.models.map(y=>({value:y,label:i(y)}))),d=Y(()=>n.disabled||!n.activeThreadId),c=Y(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(n.selectedModel.trim())),v=Y(()=>n.selectedSpeedMode==="fast"&&c.value);function f(y){o("update:selected-model",y)}function b(y){o("update:selected-reasoning-effort",y)}return(y,P)=>(_(),F(lt,null,[Fe(wi,{class:"thread-composer-control thread-composer-model-control","model-value":e.selectedModel,options:l.value,"selected-prefix-icon":v.value?Es:null,placeholder:m(r)("Model"),"open-direction":"up",variant:"pill",disabled:d.value||e.models.length===0,"enable-search":"","search-placeholder":m(r)("Search models..."),"onUpdate:modelValue":f},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Fe(wi,{class:"thread-composer-control thread-composer-thinking-control","model-value":e.selectedReasoningEffort,options:s.value,placeholder:m(r)("Thinking"),"open-direction":"up",variant:"pill",disabled:d.value||s.value.length===0,"onUpdate:modelValue":b},null,8,["model-value","options","placeholder","disabled"])],64))}}),hM=xt(pM,[["__scopeId","data-v-05288bd3"]]),mM=["aria-label","disabled"],vM=["disabled"],gM=["disabled"],yM=["disabled"],wM={class:"thread-composer-attach-mode"},bM={class:"thread-composer-attach-mode-label"},TM={class:"thread-composer-attach-mode-buttons"},SM=["disabled"],CM=["disabled"],xM={class:"thread-composer-attach-mode"},kM={class:"thread-composer-attach-mode-label"},IM={class:"thread-composer-attach-mode-buttons"},AM=["disabled","onClick"],_M={class:"thread-composer-attach-mode"},PM={class:"thread-composer-attach-mode-label"},RM={class:"thread-composer-attach-mode-buttons"},EM=["disabled","onClick"],MM={key:0,class:"thread-composer-menu-error",role:"alert"},jM={key:0,class:"thread-composer-approval-tip",role:"status"},LM=vn({__name:"ThreadComposerAttachMenu",props:{open:{type:Boolean},isMobile:{type:Boolean},isInteractionDisabled:{type:Boolean},isComposerConfigDisabled:{type:Boolean},isApprovalPolicySaving:{type:Boolean},approvalPolicy:{},approvalPolicyError:{},approvalPolicyNotice:{},selectedCollaborationMode:{},collaborationModeChoices:{},approvalPolicyChoices:{},activeInProgressMode:{}},emits:["update:open","toggle","set-active-mode","select-photo","select-folder","capture-camera","select-collaboration-mode","select-approval-policy"],setup(e,{emit:t}){const n=t,{t:o}=ha();function r(){n("toggle")}function a(v){n("set-active-mode",v)}function s(){n("select-photo")}function i(){n("select-folder")}function l(){n("capture-camera")}function d(v){n("select-collaboration-mode",v)}function c(v){n("select-approval-policy",v)}return(v,f)=>(_(),Qe(ec,{open:e.open,align:"start",width:"lg","aria-label":m(o)("Add photos & files"),"onUpdate:open":f[2]||(f[2]=b=>n("update:open",b))},{trigger:pt(()=>[w("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":m(o)("Add photos & files"),disabled:e.isInteractionDisabled,onClick:r}," + ",8,mM)]),default:pt(()=>[w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:s},D(m(o)("Add photos & files")),9,vM),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:i},D(m(o)("Add folder")),9,gM),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:l},D(m(o)("Take photo")),9,yM),f[5]||(f[5]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",wM,[w("span",bM,D(m(o)("In-progress send")),1),w("div",TM,[w("button",{class:ut(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="steer"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[0]||(f[0]=b=>a("steer"))},D(m(o)("Steer")),11,SM),w("button",{class:ut(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="queue"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[1]||(f[1]=b=>a("queue"))},D(m(o)("Queue")),11,CM)])]),e.isMobile?(_(),F(lt,{key:0},[f[3]||(f[3]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",xM,[w("span",kM,D(m(o)("Plan mode")),1),w("div",IM,[(_(!0),F(lt,null,en(e.collaborationModeChoices,b=>(_(),F("button",{key:`mobile-plan-${b.value}`,class:ut(["thread-composer-attach-mode-button",{"is-active":e.selectedCollaborationMode===b.value}]),type:"button",disabled:b.disabled||e.isComposerConfigDisabled,onClick:y=>d(b.value)},D(m(o)(b.labelKey)),11,AM))),128))])]),f[4]||(f[4]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",_M,[w("span",PM,D(m(o)("Approval policy")),1),w("div",RM,[(_(!0),F(lt,null,en(e.approvalPolicyChoices,b=>(_(),F("button",{key:`mobile-approval-${b.value}`,class:ut(["thread-composer-attach-mode-button",{"is-active":e.approvalPolicy===b.value}]),type:"button",disabled:e.isApprovalPolicySaving,onClick:y=>c(b.value)},D(m(o)(b.label)),11,EM))),128))])]),e.approvalPolicyError?(_(),F("p",MM,D(e.approvalPolicyError),1)):ve("",!0),Fe(tu,{name:"approval-tip"},{default:pt(()=>[e.approvalPolicyNotice?(_(),F("span",jM,D(e.approvalPolicyNotice),1)):ve("",!0)]),_:1})],64)):ve("",!0)]),_:1},8,["open","aria-label"]))}}),NM=xt(LM,[["__scopeId","data-v-24be0643"]]),$M=/(^|\s)(\/[a-zA-Z]*)$/,Fm=[{id:"compact",description:"Compact the current thread context",kind:"rpc",group:"builtin"},{id:"review",description:"Open the code review pane",kind:"rpc",group:"builtin"},{id:"rename",description:"Rename the current thread",kind:"rpc",group:"builtin"},{id:"archive",description:"Archive the current thread",kind:"rpc",group:"builtin"},{id:"fork",description:"Fork the current thread",kind:"rpc",group:"builtin"},{id:"new",description:"Start a new thread",kind:"rpc",group:"builtin"},{id:"skills",description:"Open the skills page",kind:"rpc",group:"builtin"},{id:"init",description:"Generate or update AGENTS.md",kind:"text",group:"builtin",insertText:"Create or update the AGENTS.md file for this project: include an overview, architecture notes, development conventions, and a workflow guide based on the codebase."},{id:"help",description:"Show help about Codex",kind:"text",group:"builtin",insertText:"How do I use Codex? Point me to the official documentation and explain the available commands."},{id:"mention",description:"Mention files with @",kind:"text",group:"builtin",insertText:"Please review the files I mention with @, starting with: "},{id:"diff",description:"Show the current git diff",kind:"text",group:"builtin",insertText:"Show the current git diff of this project and summarize the changes."},{id:"clear",description:"Clear the input",kind:"local",group:"builtin"}];function OM(e){var o,r,a;const t=[],n=new Set;for(const s of e){const i=s.name.trim().replace(/^\//u,"").toLowerCase().replace(/\s+/gu,"-");if(!i)continue;const l=s.path.trim()||i;n.has(l)||(n.add(l),t.push({id:i,description:((o=s.description)==null?void 0:o.trim())||"Run this skill",kind:"skill",group:"skill",skillPath:s.path,displayName:((r=s.displayName)==null?void 0:r.trim())||s.name.trim(),scope:((a=s.scope)==null?void 0:a.trim())||"user"}))}return t.sort((s,i)=>s.id.localeCompare(i.id))}function DM(e){const t=e.match($M);if(!t)return null;const n=t[2]??"";return{query:n.slice(1).toLowerCase(),token:n,startIndex:e.length-n.length}}function FM(e,t){const n=t.trim().toLowerCase();if(!n)return e;const o=e.filter(r=>r.id===n);return o.length>0?o:e.filter(r=>r.id.startsWith(n))}const BM={class:"thread-composer-main"},UM={class:"thread-composer-input-row"},zM={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},HM={class:"thread-composer-drop-overlay-copy"},qM={key:1,class:"composer-popover"},WM=["onMousedown"],GM={key:1,class:"thread-composer-file-mention-icon-markdown"},VM={class:"thread-composer-file-mention-text"},KM={class:"thread-composer-file-mention-name"},YM={key:0,class:"thread-composer-file-mention-dir"},JM={key:1,class:"thread-composer-file-mention-empty"},QM={key:2,class:"thread-composer-file-mention-empty"},XM=["placeholder","disabled"],ZM=["aria-label","title","disabled"],e1={class:"thread-composer-actions"},t1=["aria-label","title","disabled"],n1={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},o1=["aria-label","title","disabled"],r1=["aria-label","disabled"],a1={class:"thread-composer-plan-trigger-label"},s1=["aria-checked","disabled","onClick"],i1={class:"thread-composer-menu-item-copy"},l1={class:"thread-composer-menu-item-title"},u1={key:0,class:"thread-composer-menu-item-sub"},c1={key:1,class:"thread-composer-menu-item-hint"},d1={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},f1=["aria-label","disabled"],p1={class:"thread-composer-approval-trigger-label"},h1=["aria-checked","disabled","onClick"],m1={class:"thread-composer-menu-item-copy"},v1={class:"thread-composer-menu-item-title"},g1={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},y1={key:0,class:"thread-composer-menu-error",role:"alert"},w1={key:0,class:"thread-composer-approval-tip",role:"status"},b1=["title","aria-label"],T1={class:"thread-composer-context-usage-value"},S1={key:0,class:"thread-composer-context-usage-compact"},C1=["disabled"],x1=["disabled"],k1=["disabled"],Rd=12e3,I1=2e3,A1="codex-web-local.thread-draft.v1.",_1=vn({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},fuzzyFileSearchResults:{},collaborationModes:{},selectedCollaborationMode:{},models:{},modelReasoningEfforts:{},selectedModel:{},selectedReasoningEffort:{},selectedSpeedMode:{},skills:{},threadTokenUsage:{},codexQuota:{},isTurnInProgress:{type:Boolean},isStopPending:{type:Boolean},isInterruptingTurn:{type:Boolean},isCompacting:{type:Boolean},externalSessionActive:{type:Boolean},isUpdatingSpeedMode:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean},dictationAutoSend:{type:Boolean},dictationLanguage:{},approvalPolicy:{},isApprovalPolicySaving:{type:Boolean},approvalPolicyError:{},approvalPolicyNotice:{},planPanel:{}},emits:["submit","interrupt","register-fuzzy-session","slash-command","update:selected-collaboration-mode","update:selected-model","update:selected-reasoning-effort","update:selected-speed-mode","update:approval-policy","save-approval-policy","implement-plan","compact-context"],setup(e,{expose:t,emit:n}){const o=e,r=n,{t:a}=ha(),s=S(""),i=S([]),l=S([]),d=S([]),c=S([]),v=S(""),f=S(0),b=S(null),y=S(!1),{state:P,cancel:B}=qR({getLanguage:()=>o.dictationLanguage??"auto",onTranscript:k=>{if(s.value=s.value?`${s.value}
|
|
58
|
+
${k}`:k,v.value="",o.dictationAutoSend!==!1){const E=o.isTurnInProgress?Le.value:"steer";cn(E);return}Ft(()=>{var E;return(E=q.value)==null?void 0:E.focus()})},onEmpty:()=>{v.value=o.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:k=>{if(k instanceof DOMException&&k.name==="NotAllowedError"){v.value="Microphone access was denied.";return}v.value=k instanceof Error?k.message:"Dictation failed."}}),$=S(null),j=S(null),H=S(null),q=S(null),{isMobile:be}=qf(),ce=S(!1),W=S(!1),he=S(!1),Se=S(null),_e=S(""),ye=S([]),X=S(!1),pe=S(0),re=S(!1),xe=S(null),$e=S(""),Ne=S(0),ae=S(Fm),Ee=Y(()=>[...Fm,...OM(o.skills??[])]),ke=S(!1),Ie=S(!1);let ze=!1;const st=S(0);let tt=0,ct=null,ue="",N=!1,ie=0,se=0;const Oe=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let De="";const A=Y(()=>{const k=new Set((o.collaborationModes??[]).map(E=>E.value));return[{value:"default",labelKey:"Default",subLabel:"",disabled:!1},{value:"plan",labelKey:"Plan mode",subLabel:a("Agent proposes a plan before acting"),disabled:!1},{value:"execplans",labelKey:"Execution plans",subLabel:"",disabled:!k.has("execplans")}]}),M=[{value:"on-request",label:"When Codex requests it"},{value:"untrusted",label:"Unless trusted"},{value:"never",label:"Never"}],z=Y(()=>{const k=A.value.find(E=>E.value===o.selectedCollaborationMode);return a(k?k.labelKey:"Plan mode")}),ee=Y(()=>{const k=M.find(E=>E.value===o.approvalPolicy);return a(k?k.label:"Approval policy")}),de=Y(()=>o.selectedCollaborationMode==="plan"&&o.selectedModel.trim().length===0),te=Y(()=>o.disabled||o.isUpdatingSpeedMode||!o.activeThreadId||de.value||f.value>0?!1:s.value.trim().length>0||i.value.length>0||d.value.length>0),Me=Y(()=>s.value.trim().length>0||i.value.length>0||l.value.length>0||d.value.length>0||c.value.length>0),je=Y(()=>{const k=new Set;for(const E of c.value)for(const U of E.filePaths)k.add(U);return d.value.filter(E=>!k.has(E.fsPath))}),Ce=Y(()=>o.disabled||!o.activeThreadId||o.externalSessionActive===!0),me=Y(()=>o.disabled||!o.activeThreadId),Ve=Y(()=>o.inProgressSubmitMode==="steer"?"steer":"queue"),Le=S(Ve.value),He=Y(()=>P.value==="recording"),qe=Y(()=>o.activeThreadId?de.value?a("Loading models for plan mode..."):a("Ask Codex anything, @ to add files, / for commands"):a("Select a thread to send a message")),dt=Y(()=>s.value.trim().length>0||i.value.length>0||d.value.length>0),nt=Y(()=>s.value.split(`
|
|
59
|
+
`).length),Ze=Y(()=>ke.value||nt.value>=6||Ie.value),vt=Y(()=>Rn(o.threadTokenUsage??null)),V=Y(()=>{var k;return((k=vt.value)==null?void 0:k.summaryText)??""}),le=Y(()=>{var k;return((k=vt.value)==null?void 0:k.tooltipText)??""}),ge=Y(()=>{var k;return((k=vt.value)==null?void 0:k.tone)??"healthy"});function Je(){ge.value!=="healthy"&&r("compact-context")}function Tt(k){if(!Number.isFinite(k))return"0";const E=Math.abs(k);return E>=1e6?`${(E>=1e7?(k/1e6).toFixed(0):(k/1e6).toFixed(1)).replace(/\.0$/,"")}M`:E>=1e3?`${(E>=1e5?(k/1e3).toFixed(0):(k/1e3).toFixed(1)).replace(/\.0$/,"")}k`:String(Math.round(k))}function St(k){const E=Math.max(0,k.inputTokens-k.cachedInputTokens),U=[`${Tt(k.totalTokens)} ${a("total")}`,`${Tt(E)} ${a("input")}`];return k.cachedInputTokens>0&&U.push(`${Tt(k.cachedInputTokens)} ${a("cached")}`),k.outputTokens>0&&U.push(`${Tt(k.outputTokens)} ${a("output")}`),k.reasoningOutputTokens>0&&U.push(`${Tt(k.reasoningOutputTokens)} ${a("reasoning")}`),U.join(" · ")}function $t(k,E){if(!Number.isFinite(k)||!Number.isFinite(E)||E<=0)return 0;if(E<=Rd){const gt=Math.max(0,E-Math.max(0,k));return Math.max(0,Math.min(100,Math.round(gt/E*100)))}const U=E-Rd,Ae=Math.max(0,k-Rd),Ye=Math.max(0,U-Ae);return Math.max(0,Math.min(100,Math.round(Ye/U*100)))}function Rn(k){if(!k)return null;const E=k.modelContextWindow??null;if(typeof E!="number"||!Number.isFinite(E)||E<=0)return null;const U=Math.max(0,k.last.totalTokens),Ae=$t(U,E),Ye=Math.max(0,Math.min(100,100-Ae)),gt=Ae<=15?"danger":Ae<=35?"warning":"healthy";return{summaryText:`${Ae}% · ${Tt(U)} / ${Tt(E)}`,tooltipText:[`${a("Context window")}: ${Ae}% ${a("left")} (${Ye}% ${a("used")})`,`${a("In context")}: ${U.toLocaleString()} / ${E.toLocaleString()} tokens`,`${a("Last turn")}: ${St(k.last)}`,`${a("Session total")}: ${St(k.total)}`].join(`
|
|
60
|
+
`),percentRemaining:Ae,tone:gt}}function cn(k="steer"){var U;const E=s.value.trim();if(te.value){if(r("submit",{text:E,imageUrls:i.value.map(Ae=>Ae.url),fileAttachments:[...d.value],skills:l.value.map(Ae=>({name:Ae.name,path:Ae.path})),mode:k}),Xa(o.activeThreadId),va(),ke.value=!1,c.value=[],ce.value=!1,ln(),Oe||be.value){(U=q.value)==null||U.blur();return}Ft(()=>{var Ae;return(Ae=q.value)==null?void 0:Ae.focus()})}}function Io(k){Le.value=k}function ma(k){st.value+=1,s.value=k.text,i.value=k.imageUrls.map((E,U)=>({id:`queued-${Date.now()}-${U}-${Math.random().toString(36).slice(2,8)}`,name:`${a("Image")} ${U+1}`,url:E})),l.value=k.skills.map(E=>(o.skills??[]).find(U=>U.path===E.path)??{name:E.name,displayName:void 0,description:"",path:E.path}),d.value=k.fileAttachments.map(E=>({...E})),c.value=[],v.value="",b.value=null,f.value=0,ce.value=!1,ln(),Lo(),se+=1}function va(){ma({text:"",imageUrls:[],fileAttachments:[],skills:[]}),ke.value=!1}function lr(k){return`${A1}${k}`}function Bs(k){if(typeof window>"u")return null;const E=k.trim();if(!E)return null;try{const U=window.localStorage.getItem(lr(E));if(!U)return null;const Ae=JSON.parse(U);return typeof Ae=="string"?{text:Ae,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof Ae.text=="string"?Ae.text:"",imageUrls:Array.isArray(Ae.imageUrls)?Ae.imageUrls.filter(Ye=>typeof Ye=="string"):[],fileAttachments:Array.isArray(Ae.fileAttachments)?Ae.fileAttachments.filter(Ye=>!!Ye&&typeof Ye.label=="string"&&typeof Ye.path=="string"&&typeof Ye.fsPath=="string"):[],skills:Array.isArray(Ae.skills)?Ae.skills.filter(Ye=>!!Ye&&typeof Ye.name=="string"&&typeof Ye.path=="string"):[]}}catch{return null}}function Ao(k,E){if(typeof window>"u")return;const U=k.trim();if(U)try{if(E.text.trim().length>0||E.imageUrls.length>0||E.fileAttachments.length>0||E.skills.length>0){window.localStorage.setItem(lr(U),JSON.stringify(E));return}window.localStorage.removeItem(lr(U))}catch{}}function Xa(k){Ao(k,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Za(){return{text:s.value,imageUrls:i.value.map(k=>k.url),fileAttachments:d.value.map(k=>({...k})),skills:l.value.map(k=>({name:k.name,path:k.path}))}}function es(){r("interrupt")}function zo(){const k=q.value;if(!k){Ie.value=!1;return}Ie.value=k.scrollHeight>k.clientHeight+2}function Br(){ze||(ze=!0,Ft(()=>{ze=!1,zo()}))}function ur(){Ce.value||(ke.value=!ke.value,Br(),Ft(()=>{var k;return(k=q.value)==null?void 0:k.focus()}))}function Ho(k){r("update:selected-model",k)}function ga(k){if(k===o.selectedCollaborationMode){W.value=!1;return}r("update:selected-collaboration-mode",k),W.value=!1}function Us(k){if(k===o.selectedCollaborationMode){ce.value=!1;return}r("update:selected-collaboration-mode",k),ce.value=!1}function ts(k){r("update:selected-reasoning-effort",k)}function ya(k){o.approvalPolicy===k||o.isApprovalPolicySaving===!0||(r("update:approval-policy",k),r("save-approval-policy"))}function ho(){o.dictationClickToToggle}function _o(){Ce.value||(ce.value=!ce.value,W.value=!1,he.value=!1)}function cr(){me.value||(W.value=!W.value,ce.value=!1,he.value=!1)}function ns(){me.value||(he.value=!he.value,ce.value=!1,W.value=!1)}function Po(){var k;(k=$.value)==null||k.click()}function it(){var k;(k=j.value)==null||k.click()}function kt(){var k;(k=H.value)==null||k.click()}function Ct(k){const E=i.value.find(U=>U.id===k);if(E&&an(E.url)){const U=It(E.url);U&&Sn(U)}i.value=i.value.filter(U=>U.id!==k)}function qo(k){l.value=l.value.filter(E=>E.path!==k)}function Sn(k){d.value=d.value.filter(E=>E.fsPath!==k)}function os(k){const E=c.value.find(Ae=>Ae.id===k);if(!E)return;const U=new Set(E.filePaths);d.value=d.value.filter(Ae=>!U.has(Ae.fsPath)),c.value=c.value.filter(Ae=>Ae.id!==k)}function Bn(k,E){const U=k.replace(/\\/g,"/");if(d.value.some(gt=>gt.fsPath===U))return;const Ae=U.split("/").filter(Boolean),Ye=(E==null?void 0:E.trim())||Ae[Ae.length-1]||U;d.value=[...d.value,{label:Ye,path:U,fsPath:U}]}function mo(k){return k.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(k.name)}const Wo=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function dr(k){return k.type.startsWith("video/")?!0:Wo.test(k.name)}function an(k){const E=k.trim();if(!E)return!1;if(E.startsWith("data:video/"))return!0;try{const U=new URL(E,window.location.href);return Wo.test(U.pathname)?!0:U.pathname==="/codex-local-image"?Wo.test(U.searchParams.get("path")??""):!1}catch{return Wo.test(E)}}function It(k){try{const E=new URL(k,window.location.href);return E.pathname!=="/codex-local-image"?"":decodeURIComponent(E.searchParams.get("path")??"").replace(/\\/g,"/")}catch{return""}}function Xn(k){return k?Array.from(k):[]}function Ro(k){return k!==se?!1:(f.value+=1,!0)}function Zn(k){k===se&&(f.value=Math.max(0,f.value-1))}function Go(k){if(k<=0)return;const E=b.value,U=E?E.succeeded+E.failed:0;if(!E||U>=E.total){b.value={total:k,succeeded:0,failed:0};return}b.value={...E,total:E.total+k}}function Cn(k){const E=b.value;E&&(b.value={...E,succeeded:E.succeeded+(k==="success"?1:0),failed:E.failed+(k==="failure"?1:0)})}function xn(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function En(k){const E=new Date,U=[E.getFullYear(),String(E.getMonth()+1).padStart(2,"0"),String(E.getDate()).padStart(2,"0"),String(E.getHours()).padStart(2,"0"),String(E.getMinutes()).padStart(2,"0"),String(E.getSeconds()).padStart(2,"0")].join("-"),Ae=k.type.startsWith("image/")&&k.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${U}.${Ae}`}function eo(){const k=new Date;return`pasted-text-${[k.getFullYear(),String(k.getMonth()+1).padStart(2,"0"),String(k.getDate()).padStart(2,"0"),String(k.getHours()).padStart(2,"0"),String(k.getMinutes()).padStart(2,"0"),String(k.getSeconds()).padStart(2,"0")].join("-")}.txt`}function fr(k){return k.name.trim()?k:new File([k],En(k),{type:k.type||"image/png",lastModified:Date.now()})}async function vo(k,E){if(Ro(E))try{const U=fr(k),Ae=await Su(U);if(E!==se)return;if(!Ae){Cn("failure");return}i.value=[...i.value,{id:xn(),name:U.name,url:`/codex-local-image?path=${encodeURIComponent(Ae)}`}],Cn("success")}catch{E===se&&Cn("failure")}finally{Zn(E)}}async function Vo(k,E){if(Ro(E))try{const U=await Su(k);if(E!==se)return;if(!U){Cn("failure");return}Bn(U),Cn("success")}catch{E===se&&Cn("failure")}finally{Zn(E)}}async function tn(k,E){if(Ro(E))try{const U=fr(k),Ae=await Su(U);if(E!==se)return;if(!Ae){Cn("failure");return}const Ye=Ae.replace(/\\/g,"/");i.value=[...i.value,{id:xn(),name:U.name,url:`/codex-local-image?path=${encodeURIComponent(Ye)}`}],Bn(Ye),Cn("success")}catch{E===se&&Cn("failure")}finally{Zn(E)}}function Eo(k){const E=Xn(k);if(E.length===0)return;Go(E.length),ce.value=!1,ln();const U=se;for(const Ae of E)mo(Ae)?vo(Ae,U):dr(Ae)?tn(Ae,U):Vo(Ae,U)}function Ko(){ie=0,y.value=!1}function to(k){return k?Array.from(k.types??[]).includes("Files"):!1}async function Yt(k){if(!k||k.length===0)return;const E=st.value,U=Array.from(k),Ye=(U[0].webkitRelativePath||U[0].name).split("/").filter(Boolean)[0]||"Folder",gt=`${Date.now()}-${Math.random().toString(36).slice(2)}`;c.value=[...c.value,{id:gt,name:Ye,total:U.length,processed:0,filePaths:[],isUploading:!0}];const kn=Rt=>{E===st.value&&(c.value=c.value.map(dn=>dn.id===gt?Rt(dn):dn))};for(const Rt of U)try{const dn=await Su(Rt);if(E!==st.value)return;if(dn){const gr=Rt.webkitRelativePath||Rt.name;Bn(dn,gr),kn(Ta=>({...Ta,processed:Ta.processed+1,filePaths:[...Ta.filePaths,dn]}));continue}kn(gr=>({...gr,processed:gr.processed+1}))}catch{kn(dn=>({...dn,processed:dn.processed+1}))}kn(Rt=>({...Rt,isUploading:!1}))}function sn(k){k&&(k.value="")}function Mn(k){const E=k.target;Eo((E==null?void 0:E.files)??null),sn(E),ce.value=!1}function wa(k){const E=k.target;Eo((E==null?void 0:E.files)??null),sn(E),ce.value=!1}function Ut(k){const E=k.target;Yt((E==null?void 0:E.files)??null),sn(E),ce.value=!1}function Ur(k){Ce.value||!to(k.dataTransfer)||(k.preventDefault(),ie+=1,y.value=!0)}function jn(k){Ce.value||!to(k.dataTransfer)||(k.preventDefault(),k.dataTransfer&&(k.dataTransfer.dropEffect="copy"),y.value=!0)}function Mo(k){y.value&&(k.preventDefault(),ie=Math.max(0,ie-1),ie===0&&Ko())}function jo(k){var E;Ce.value||!to(k.dataTransfer)||(k.preventDefault(),Ko(),Eo(((E=k.dataTransfer)==null?void 0:E.files)??null))}function Gt(){!y.value&&ie===0||Ko()}function zs(k){var gt,kn;if(Ce.value)return;const E=((gt=k.clipboardData)==null?void 0:gt.getData("text/plain"))??"";if(E.length>=I1){k.preventDefault();const Rt=new File([E],eo(),{type:"text/plain",lastModified:Date.now()});Eo([Rt]);return}const U=Array.from(((kn=k.clipboardData)==null?void 0:kn.items)??[]);if(U.length===0)return;const Ae=E.length>0,Ye=U.filter(Rt=>Rt.kind==="file"&&Rt.type.startsWith("image/")).map(Rt=>Rt.getAsFile()).filter(Rt=>Rt instanceof File);Ye.length!==0&&(Ae||k.preventDefault(),Eo(Ye))}function pr(){v.value&&(v.value=""),Br(),Hs(),rs()}function zt(k){if(k.isComposing||k.keyCode===229)return;if(X.value){if(k.key==="Escape"){k.preventDefault(),ln();return}if(k.key==="ArrowDown"){k.preventDefault(),ye.value.length>0&&(pe.value=(pe.value+1)%ye.value.length);return}if(k.key==="ArrowUp"){if(k.preventDefault(),ye.value.length>0){const U=ye.value.length;pe.value=(pe.value+U-1)%U}return}if(k.key==="Enter"||k.key==="Tab"){k.preventDefault();const U=ye.value[pe.value];U?hr(U):ln();return}}if(re.value){if(k.key==="Escape"){k.preventDefault(),Lo();return}if(k.key==="ArrowDown"){k.preventDefault(),ae.value.length>0&&(Ne.value=(Ne.value+1)%ae.value.length);return}if(k.key==="ArrowUp"){if(k.preventDefault(),ae.value.length>0){const U=ae.value.length;Ne.value=(Ne.value+U-1)%U}return}if(k.key==="Enter"||k.key==="Tab"){k.preventDefault();const U=ae.value[Ne.value];U?ba(U):Lo();return}}if(o.sendWithEnter!==!1?k.key==="Enter"&&!k.shiftKey:k.key==="Enter"&&(k.metaKey||k.ctrlKey)){k.preventDefault(),cn(o.isTurnInProgress?Le.value:"steer");return}}function ln(){if(X.value=!1,Se.value=null,_e.value="",ye.value=[],pe.value=0,N=!1,ue){const k=ue;ue="",Nx(k)}}function Hs(){const k=q.value;if(!k){ln();return}const E=k.selectionStart??s.value.length,Ae=s.value.slice(0,E).match(/(^|\s)(@[^\s@]*)$/);if(!Ae){ln();return}const Ye=Ae[2]??"",gt=Ye.length,kn=E-gt;re.value&&Lo(),Se.value=kn,_e.value=Ye.slice(1),X.value=!0,go()}function Lo(){re.value=!1,xe.value=null,$e.value="",Ne.value=0,ae.value=Ee.value}function rs(){const k=q.value;if(!k){Lo();return}const E=k.selectionStart??s.value.length,U=s.value.slice(0,E),Ae=DM(U);if(!Ae){Lo();return}X.value&&ln(),xe.value=Ae.startIndex,$e.value=Ae.query,ae.value=FM(Ee.value,Ae.query),Ne.value=0,re.value=!0}function ba(k){const E=q.value,U=xe.value;if(U!==null&&E){const Ae=E.selectionStart??s.value.length;s.value=`${s.value.slice(0,U)}${s.value.slice(Ae)}`}if(Lo(),k.kind==="skill"){const Ae=(o.skills??[]).find(gt=>gt.path===k.skillPath||gt.name===k.id);Ae&&!l.value.some(gt=>gt.path===Ae.path)&&(l.value=[...l.value,{...Ae}]);const Ye=s.value.trim();s.value=Ye.length>0?`${Ye} (Use the ${k.id} skill.)`:`Use the ${k.id} skill.`,Ft(()=>{E==null||E.focus(),zo()});return}if(k.kind==="rpc"){r("slash-command",k.id);return}k.kind==="text"&&k.insertText&&(s.value=s.value.trimEnd(),s.value=s.value.length>0?`${s.value} ${k.insertText}`:k.insertText),k.kind==="local"&&k.id==="clear"&&(s.value=""),Ft(()=>{E==null||E.focus(),zo()})}async function go(){if(!X.value)return;const k=(o.cwd??"").trim();if(!k){ye.value=[],N=!0;return}N=!1,ct&&clearTimeout(ct);const E=++tt;ct=setTimeout(async()=>{const U=`composer-${E}`,Ae=_e.value;try{if(ue||(await jx([k],U),ue=U,r("register-fuzzy-session",U)),await Lx(ue,Ae),!X.value||E!==tt)return;if(ye.value=(o.fuzzyFileSearchResults??[]).map(Ye=>({path:Ye.path})),pe.value=0,ye.value.length===0)try{const Ye=await tm(k,Ae,20);if(!X.value||E!==tt)return;ye.value=Ye,pe.value=0}catch{if(!X.value||E!==tt)return;ye.value=[]}}catch{if(!X.value||E!==tt)return;ue="";try{const Ye=await tm(k,Ae,20);if(!X.value||E!==tt)return;ye.value=Ye,pe.value=0}catch{if(!X.value||E!==tt)return;ye.value=[]}}},120)}function hr(k){const E=q.value,U=Se.value;if(U!==null&&E){const Ae=E.selectionStart??s.value.length;s.value=`${s.value.slice(0,U)}${s.value.slice(Ae)}`.trimEnd()}Bn(k.path),ln(),Ft(()=>E==null?void 0:E.focus())}function no(k){B(),ma(k),Ft(()=>{var E;(E=q.value)==null||E.focus(),zo()})}function mr(k){const E=k.trim();E&&(s.value=s.value.trim()?`${s.value.trim()}
|
|
61
|
+
${E}`:E,Ft(()=>{var U;(U=q.value)==null||U.focus(),zo()}))}function zr(k){const E=k.lastIndexOf("/");return E<0?k:k.slice(E+1)}function ft(k){const E=k.lastIndexOf("/");return E<=0?"":k.slice(0,E)}function gn(k){const E=zr(k),U=E.lastIndexOf(".");return U<=0?"":E.slice(U+1).toLowerCase()}function Ln(k){const E=gn(k);return E==="ts"?"TS":E==="tsx"?"TSX":E==="js"?"JS":E==="jsx"?"JSX":E==="json"?"{}":""}function Hr(k){const E=gn(k);return E.startsWith("ts")?"ts":E.startsWith("js")?"js":E==="json"?"json":"default"}function oo(k){const E=gn(k);return E==="md"||E==="mdx"}function vr(k){if(!ce.value&&!W.value&&!he.value)return;const E=k.target;E&&(typeof E.closest=="function"&&E.closest(".composer-popover-anchor")||(ce.value=!1,W.value=!1,he.value=!1))}return Ti(()=>{document.addEventListener("click",vr),window.addEventListener("drop",Gt),window.addEventListener("dragend",Gt),window.addEventListener("blur",Gt),Br()}),t({hydrateDraft:no,appendTextToDraft:mr,hasUnsavedDraft:()=>Me.value}),Fs(()=>{document.removeEventListener("click",vr),window.removeEventListener("drop",Gt),window.removeEventListener("dragend",Gt),window.removeEventListener("blur",Gt),window.removeEventListener("pointerup",ho),window.removeEventListener("pointercancel",ho),window.removeEventListener("blur",ho),ct&&clearTimeout(ct)}),ot(()=>o.activeThreadId,k=>{B(),De&&Ao(De,Za()),va();const E=Bs(k);E&&(ma(E),pr()),De=k.trim()},{immediate:!0}),ot([s,i,d,l],()=>{De&&Ao(De,Za())},{deep:!0}),ot(s,()=>{Br()}),ot(()=>o.cwd,()=>{X.value&&go()}),ot(()=>o.fuzzyFileSearchResults,k=>{!X.value||!ue||(ye.value=(k??[]).map(E=>({path:E.path})),pe.value=0)}),ot(Ve,k=>{Le.value=k}),(k,E)=>(_(),F("form",{class:"thread-composer",onSubmit:E[6]||(E[6]=wt(U=>cn(e.isTurnInProgress?Le.value:"steer"),["prevent"]))},[w("div",{class:ut(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":y.value}])},[e.planPanel?(_(),Qe(JE,{key:0,"plan-panel":e.planPanel,onImplementPlan:E[0]||(E[0]=U=>k.$emit("implement-plan"))},null,8,["plan-panel"])):ve("",!0),Fe(fM,{"selected-images":i.value,"folder-upload-groups":c.value,"standalone-file-attachments":je.value,"selected-skills":l.value,"is-interaction-disabled":Ce.value,onRemoveImage:Ct,onRemoveFolder:os,onRemoveFile:Sn,onRemoveSkill:qo},null,8,["selected-images","folder-upload-groups","standalone-file-attachments","selected-skills","is-interaction-disabled"]),w("div",BM,[w("div",UM,[w("div",{class:ut(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":y.value,"thread-composer-input-wrap--expanded":ke.value}]),onDragenter:Ur,onDragover:jn,onDragleave:Mo,onDrop:jo},[y.value?(_(),F("div",zM,[w("span",HM,D(m(a)("Drop images or files")),1)])):ve("",!0),X.value?(_(),F("div",qM,[ye.value.length>0?(_(!0),F(lt,{key:0},en(ye.value,(U,Ae)=>(_(),F("button",{key:U.path,class:ut(["thread-composer-file-mention-row",{"is-active":Ae===pe.value}]),type:"button",onMousedown:wt(Ye=>hr(U),["prevent"])},[Ln(U.path)?(_(),F("span",{key:0,class:ut(["thread-composer-file-mention-icon-badge",`is-${Hr(U.path)}`])},D(Ln(U.path)),3)):oo(U.path)?(_(),F("span",GM,"↓")):(_(),Qe(ll,{key:2,class:"thread-composer-file-mention-icon-file"})),w("span",VM,[w("span",KM,D(zr(U.path)),1),ft(U.path)?(_(),F("span",YM,D(ft(U.path)),1)):ve("",!0)])],42,WM))),128)):m(N)?(_(),F("div",JM,D(m(a)("No searchable directory for this thread")),1)):(_(),F("div",QM,D(m(a)("No matching files")),1))])):ve("",!0),re.value?(_(),Qe(xE,{key:2,commands:ae.value,"highlighted-index":Ne.value,onSelect:ba},null,8,["commands","highlighted-index"])):ve("",!0),_n(w("textarea",{ref_key:"inputRef",ref:q,"onUpdate:modelValue":E[1]||(E[1]=U=>s.value=U),class:"thread-composer-input",placeholder:qe.value,disabled:Ce.value,onInput:pr,onKeydown:zt,onPaste:zs},null,40,XM),[[On,s.value]]),Ze.value?(_(),F("button",{key:3,class:"thread-composer-expand",type:"button","aria-label":ke.value?m(a)("Exit full screen composer"):m(a)("Expand composer"),title:ke.value?m(a)("Exit full screen composer"):m(a)("Expand composer"),disabled:Ce.value,onClick:ur},[ke.value?(_(),Qe(nE,{key:0,class:"thread-composer-expand-icon"})):(_(),Qe(XR,{key:1,class:"thread-composer-expand-icon"}))],8,ZM)):ve("",!0)],34),w("div",e1,[e.isTurnInProgress&&!dt.value?(_(),F("button",{key:0,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?m(a)("Saving thread before stop is available"):m(a)("Stop"),title:e.isStopPending?m(a)("Saving thread before stop is available"):m(a)("Stop"),disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending||e.externalSessionActive===!0,onClick:es},[e.isStopPending?(_(),F("span",n1)):(_(),Qe(sE,{key:1,class:"thread-composer-stop-icon"}))],8,t1)):(_(),F("button",{key:1,class:ut(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&Le.value==="queue"}]),type:"button","aria-label":e.isCompacting?m(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress&&Le.value==="queue"?m(a)("Queue message"):m(a)("Send message"),title:e.isCompacting?m(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress?`${m(a)("Send")} ${Le.value==="queue"?m(a)("Queue"):m(a)("Steer")}`:m(a)("Send"),disabled:!te.value,onClick:E[2]||(E[2]=U=>cn(e.isTurnInProgress?Le.value:"steer"))},[Fe(KR,{class:"thread-composer-submit-icon"})],10,o1))])]),w("div",{class:ut(["thread-composer-controls",{"thread-composer-controls--recording":He.value}])},[Fe(NM,{open:ce.value,"is-mobile":m(be),"is-interaction-disabled":Ce.value,"is-composer-config-disabled":me.value,"is-approval-policy-saving":e.isApprovalPolicySaving,"approval-policy":e.approvalPolicy,"approval-policy-error":e.approvalPolicyError,"approval-policy-notice":e.approvalPolicyNotice,"selected-collaboration-mode":e.selectedCollaborationMode,"collaboration-mode-choices":A.value,"approval-policy-choices":M,"active-in-progress-mode":Le.value,"onUpdate:open":E[3]||(E[3]=U=>ce.value=U),onToggle:_o,onSetActiveMode:Io,onSelectPhoto:Po,onSelectFolder:kt,onCaptureCamera:it,onSelectCollaborationMode:Us,onSelectApprovalPolicy:ya},null,8,["open","is-mobile","is-interaction-disabled","is-composer-config-disabled","is-approval-policy-saving","approval-policy","approval-policy-error","approval-policy-notice","selected-collaboration-mode","collaboration-mode-choices","active-in-progress-mode"]),m(be)?ve("",!0):(_(),Qe(ec,{key:0,open:W.value,align:"start",width:"md","aria-label":m(a)("Plan mode"),"onUpdate:open":E[4]||(E[4]=U=>W.value=U)},{trigger:pt(()=>[w("button",{class:ut(["thread-composer-plan-trigger",{"is-active":W.value}]),type:"button","aria-label":m(a)("Plan mode"),disabled:me.value,onClick:cr},[w("span",a1,D(z.value),1),Fe(Ls,{class:"thread-composer-plan-trigger-chevron"})],10,r1)]),default:pt(()=>[(_(!0),F(lt,null,en(A.value,U=>(_(),F("button",{key:U.value,class:ut(["thread-composer-menu-item",{"is-active":e.selectedCollaborationMode===U.value}]),type:"button",role:"menuitemradio","aria-checked":e.selectedCollaborationMode===U.value,disabled:U.disabled||me.value,onClick:Ae=>ga(U.value)},[w("span",i1,[w("span",l1,D(m(a)(U.labelKey)),1),U.subLabel?(_(),F("span",u1,D(U.subLabel),1)):ve("",!0),U.disabled?(_(),F("span",c1,D(m(a)("Not supported by this Codex version")),1)):ve("",!0)]),e.selectedCollaborationMode===U.value?(_(),F("span",d1,"✓")):ve("",!0)],10,s1))),128))]),_:1},8,["open","aria-label"])),m(be)?ve("",!0):(_(),Qe(ec,{key:1,open:he.value,align:"center",width:"md","aria-label":m(a)("Approval policy"),"onUpdate:open":E[5]||(E[5]=U=>he.value=U)},{trigger:pt(()=>[w("button",{class:ut(["thread-composer-approval-trigger",{"is-active":he.value}]),type:"button","aria-label":m(a)("Approval policy"),disabled:me.value,onClick:ns},[w("span",p1,D(ee.value),1),Fe(Ls,{class:"thread-composer-approval-trigger-chevron"})],10,f1)]),default:pt(()=>[(_(),F(lt,null,en(M,U=>w("button",{key:U.value,class:ut(["thread-composer-menu-item",{"is-active":e.approvalPolicy===U.value}]),type:"button",role:"menuitemradio","aria-checked":e.approvalPolicy===U.value,disabled:e.isApprovalPolicySaving,onClick:Ae=>ya(U.value)},[w("span",m1,[w("span",v1,D(m(a)(U.label)),1)]),e.approvalPolicy===U.value?(_(),F("span",g1,"✓")):ve("",!0)],10,h1)),64)),e.approvalPolicyError?(_(),F("p",y1,D(e.approvalPolicyError),1)):ve("",!0),Fe(tu,{name:"approval-tip"},{default:pt(()=>[e.approvalPolicyNotice?(_(),F("span",w1,D(e.approvalPolicyNotice),1)):ve("",!0)]),_:1})]),_:1},8,["open","aria-label"])),Fe(hM,{models:e.models,"selected-model":e.selectedModel,"model-reasoning-efforts":e.modelReasoningEfforts,"selected-reasoning-effort":e.selectedReasoningEffort,"selected-speed-mode":e.selectedSpeedMode,disabled:e.disabled,"active-thread-id":e.activeThreadId,"onUpdate:selectedModel":Ho,"onUpdate:selectedReasoningEffort":ts},null,8,["models","selected-model","model-reasoning-efforts","selected-reasoning-effort","selected-speed-mode","disabled","active-thread-id"]),vt.value?(_(),F("button",{key:2,type:"button",class:ut(["thread-composer-context-usage-inline",{"is-warning":ge.value==="warning","is-danger":ge.value==="danger"}]),title:le.value,"aria-label":m(a)("Context"),onClick:Je},[w("span",T1,D(V.value),1),ge.value!=="healthy"?(_(),F("span",S1,D(m(a)("Compact")),1)):ve("",!0)],10,b1)):ve("",!0)],2)])],2),w("input",{ref_key:"photoLibraryInputRef",ref:$,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:Ce.value,onChange:Mn},null,40,C1),w("input",{ref_key:"cameraCaptureInputRef",ref:j,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:Ce.value,onChange:wa},null,40,x1),w("input",{ref_key:"folderPickerInputRef",ref:H,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:Ce.value,onChange:Ut},null,40,k1)],32))}}),Bm=xt(_1,[["__scopeId","data-v-b38ffbf2"]]),P1=["aria-label"],R1=["aria-checked","onClick"],E1={class:"runtime-toggle-option-label"},M1=vn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:o}=ha(),r=[{value:"local",label:o("Local project"),icon:Qf},{value:"worktree",label:o("New worktree"),icon:Zu}];function a(s){n("update:modelValue",s)}return(s,i)=>(_(),F("div",{class:"runtime-toggle",role:"radiogroup","aria-label":m(o)("Continue in")},[(_(),F(lt,null,en(r,l=>w("button",{key:l.value,class:ut(["runtime-toggle-option",{"is-selected":e.modelValue===l.value}]),type:"button",role:"radio","aria-checked":e.modelValue===l.value,onClick:d=>a(l.value)},[(_(),Qe(Lf(l.icon),{class:"runtime-toggle-option-icon"})),w("span",E1,D(l.label),1)],10,R1)),64))],8,P1))}}),j1=xt(M1,[["__scopeId","data-v-4d282f1a"]]),L1={},N1={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 $1(e,t){return _(),F("svg",N1,[...t[0]||(t[0]=[w("path",{d:"M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12"},null,-1),w("path",{d:"M9 4l0 16"},null,-1)])])}const dy=xt(L1,[["render",$1]]),O1={},D1={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function F1(e,t){return _(),F("svg",D1,[...t[0]||(t[0]=[w("path",{d:"M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm12 -16h-8v14h8a1 1 0 0 0 1 -1v-12a1 1 0 0 0 -1 -1"},null,-1)])])}const B1=xt(O1,[["render",F1]]),U1={class:"sidebar-thread-controls"},z1=["aria-label","title"],H1=["aria-label","title"],q1=vn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=ha();return(n,o)=>(_(),F("div",U1,[w("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?m(t)("Expand sidebar"):m(t)("Collapse sidebar"),title:e.isSidebarCollapsed?m(t)("Expand sidebar"):m(t)("Collapse sidebar"),onClick:o[0]||(o[0]=r=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(_(),Qe(B1,{key:0,class:"sidebar-thread-controls-icon"})):(_(),Qe(dy,{key:1,class:"sidebar-thread-controls-icon"}))],8,z1),ko(n.$slots,"default",{},void 0),e.showNewThreadButton?(_(),F("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":m(t)("Start new thread"),title:m(t)("Start new thread"),onClick:o[1]||(o[1]=r=>n.$emit("start-new-thread"))},[Fe(ll,{class:"sidebar-thread-controls-icon"})],8,H1)):ve("",!0)]))}}),Um=xt(q1,[["__scopeId","data-v-39c4ec05"]]),W1={},G1={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function V1(e,t){return _(),F("svg",G1,[...t[0]||(t[0]=[w("circle",{cx:"11",cy:"11",r:"8"},null,-1),w("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const zm=xt(W1,[["render",V1]]),K1={},Y1={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function J1(e,t){return _(),F("svg",Y1,[...t[0]||(t[0]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065"}),w("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const Q1=xt(K1,[["render",J1]]),X1={},Z1={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function ej(e,t){return _(),F("svg",Z1,[...t[0]||(t[0]=[w("path",{d:"M5 7l5 5-5 5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),w("path",{d:"M12 17h7",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])])}const tj=xt(X1,[["render",ej]]),nj={},oj={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function rj(e,t){return _(),F("svg",oj,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 7a2 2 0 0 1 2-2h2.586A2 2 0 0 1 14 5.586L15.414 7H18a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2zm-4 4V5a2 2 0 0 1 2-2h2"},null,-1)])])}const Hm=xt(nj,[["render",rj]]);function fy(e){var r;const t=e.replace(/\r\n/g,`
|
|
62
|
+
`).trim();if(!t)return null;const n=[],o=[];for(const a of t.split(`
|
|
63
|
+
`)){const s=a.trim();if(!s){n.length===0&&o.push("");continue}const i=s.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(i){const l=(i[1]??" ").toLowerCase();let d="pending";l==="x"&&(d="completed"),(l==="~"||l===">"||l==="-")&&(d="inProgress"),n.push({step:((r=i[2])==null?void 0:r.trim())??"",status:d});continue}o.push(s)}if(n.length===0){const a=aj(t);return a||null}return{explanation:o.join(`
|
|
64
|
+
`).trim(),steps:n.filter(a=>a.step.length>0)}}function aj(e){var a,s;const t=[],n=[],o=[];for(const i of e.split(`
|
|
65
|
+
`)){const l=i.trim();if(!l){t.length===0&&n.length===0&&o.push("");continue}const d=l.match(/^\d+[.)]\s+(.+)$/);if(d){t.push({step:((a=d[1])==null?void 0:a.trim())??"",status:"pending"});continue}const c=l.match(/^[-*]\s+(.+)$/);if(c){n.push({step:((s=c[1])==null?void 0:s.trim())??"",status:"pending"});continue}o.push(l)}const r=t.length>0?t:n;return r.length===0?null:{explanation:sj(o.join(`
|
|
66
|
+
`)),steps:r.filter(i=>i.step.length>0)}}function sj(e){return e.split(`
|
|
67
|
+
`).map(t=>t.replace(/^\s*#{1,6}\s*/,"")).join(`
|
|
68
|
+
`).trim()}function qm(e){var t;return e.plan&&e.plan.steps.length>0?{explanation:((t=e.plan.explanation)==null?void 0:t.trim())??"",steps:e.plan.steps}:fy(e.text)}const py="modelSwitch",hy=20;function ij(e){return e.messageType===py}const Wa="__new-thread__",my="__new-thread-provider__::";function vy(e){return e==="plan"?"plan":"default"}function ul(e){return typeof e=="string"?e.trim():""}function Mr(){return Object.create(null)}function Ou(e){const t=Mr();for(const[n,o]of Object.entries(e))t[n]=o;return t}function Fl(e,t){if(!(t in e))return e;const n=Mr();for(const[o,r]of Object.entries(e))o!==t&&(n[o]=r);return n}function gy(e,t){let n=!1;const o=Mr();for(const[r,a]of Object.entries(e)){if(r===Wa||r.startsWith(my)||t.has(r)){o[r]=a;continue}n=!0}return n?o:e}function Is(e){const t=e.trim().toLowerCase().replace(/_/g,"-");return!t||t==="openai"?"codex":t}function lj(e){return e===Wa}function Au(e){const t=Is(e);return t?`${my}${t}`:""}function Ns(e){return e.trim()||Wa}function Ed(e,t){const n=Ns(t),o=ul(e[n]);return o||ul(e[Wa])}function Md(e,t){const n=Ns(t);return vy(e[n])}function Wm(e,t,n){const o=Ns(t);if(lj(o))return Fl(e,o);if(n==="plan"){const r=Ou(e);return r[o]="plan",r}return Fl(e,o)}function uj(e){return new Promise(t=>{typeof window<"u"?window.setTimeout(t,e):globalThis.setTimeout(t,e)})}function Kn(e){return e.flatMap(t=>t.threads)}function cj(e,t){var o,r;const n=e.findIndex(a=>a.id===t);return n<0?"":((o=e[n+1])==null?void 0:o.id)??((r=e[n-1])==null?void 0:r.id)??""}function yy(e){return(e instanceof Error?e.message:String(e??"")).includes("Codex CLI is not available")}function dj(e){if(e instanceof Nr&&e.status===404)return!0;const t=e instanceof Error?e.message:String(e??"");return/\b404\b|thread.*not found|conversation.*not found|no such thread|no rollout found for thread id/i.test(t)}function fj(e,t){if(!e||!t)return!1;const n=new Date(e).getTime(),o=new Date(t).getTime();return!Number.isFinite(n)||!Number.isFinite(o)?!1:n>o}function pj(e,t,n){return fj(e,t??n)}function wy(e,t,n){return Math.min(Math.max(e,t),n)}function Hi(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 Gm(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:Hi(t.totalTokens)??0,inputTokens:Hi(t.inputTokens)??0,cachedInputTokens:Hi(t.cachedInputTokens)??0,outputTokens:Hi(t.outputTokens)??0,reasoningOutputTokens:Hi(t.reasoningOutputTokens)??0}}function hj(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=Gm(t.total),o=Gm(t.last);if(!n||!o)return null;const r=Hi(t.modelContextWindow),a=o.totalTokens,s=typeof r=="number"?Math.max(r-a,0):null,i=typeof r=="number"&&r>0?wy(Math.round((s??0)/r*100),0,100):null;return{total:n,last:o,modelContextWindow:r,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function qi(e,t){const n=[];for(const o of e)n.includes(o)||n.push(o);for(const o of t)n.includes(o.projectName)||n.push(o.projectName);return Ga(e,n)?e:n}function cf(e,t){const n=new Map(e.map(r=>[r.projectName,r])),o=t.map(r=>n.get(r)??null).filter(r=>r!==null);for(const r of e)t.includes(r.projectName)||o.push(r);return o}function Ga(e,t){const n=Array.isArray(e)?e:[],o=Array.isArray(t)?t:[];if(n.length!==o.length)return!1;for(let r=0;r<n.length;r+=1)if(n[r]!==o[r])return!1;return!0}function mj(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const o=[...e],[r]=o.splice(t,1);return o.splice(n,0,r),o}function vj(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function gj(e=[],t=[]){var n,o,r,a;if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1)if(((n=e[s])==null?void 0:n.step)!==((o=t[s])==null?void 0:o.step)||((r=e[s])==null?void 0:r.status)!==((a=t[s])==null?void 0:a.status))return!1;return!0}function yj(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&gj(e.steps,t.steps)}function _u(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 df(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Ga(e.images,t.images)&&wj(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&vj(e.commandExecution,t.commandExecution)&&yj(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function cl(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 Vm(e,t,n={}){const o=new Map(e.map(c=>[c.id,c])),r=new Map(t.map(c=>[c.id,c])),a=t.map(c=>{const v=o.get(c.id);return v&&df(v,c)?v:c});if(n.preserveMissing!==!0)return cl(e,a)?e:a;const s=e.map(c=>{const v=r.get(c.id);return!v||df(c,v)?c:v}).filter(c=>!Xf(c)||!Tj(c,t)),i=new Set(e.map(c=>c.id)),l=a.filter(c=>!i.has(c.id)),d=[...s,...l];return cl(e,d)?e:d}function wj(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){const o=e[n],r=t[n];if(o.path!==r.path||o.operation!==r.operation||o.movedToPath!==r.movedToPath||o.diff!==r.diff||o.addedLineCount!==r.addedLineCount||o.removedLineCount!==r.removedLineCount)return!1}return!0}function Ja(e){return e.replace(/\s+/gu," ").trim()}function Xf(e){return e.messageType==="userMessage.optimistic"}function bj(e){return e.some(Xf)}function Tj(e,t){if(e.role!=="user")return!1;const n=Ja(e.text),o=Array.isArray(e.images)?e.images:[],r=Array.isArray(e.fileAttachments)?e.fileAttachments.length:0,a=Array.isArray(e.skills)?e.skills.length:0;return t.some(s=>{if(s===e||s.role!=="user"||Xf(s))return!1;const i=Ja(s.text),l=Array.isArray(s.images)?s.images:[],d=Array.isArray(s.fileAttachments)?s.fileAttachments.length:0,c=Array.isArray(s.skills)?s.skills.length:0;return i===n&&Ga(l,o)&&d===r&&c===a})}function Sj(e){const t=[];let n=new Map;for(const o of e){if(!(o.role==="assistant"&&typeof o.messageType=="string"&&(o.messageType==="agentMessage"||o.messageType==="agentMessage.live"))){o.role==="user"&&(n=new Map),t.push(o);continue}const a=Ja(o.text);if(a.length===0){t.push(o);continue}const s=n.get(a);if(typeof s=="number"){t.splice(s,1);for(const[i,l]of n)l>s&&n.set(i,l-1);n.set(a,t.length),t.push(o)}else n.set(a,t.length),t.push(o)}return t}function Cj(e,t){const n=new Set(t.map(a=>a.id)),o=new Set(t.filter(a=>a.role==="assistant").map(a=>Ja(a.text)).filter(a=>a.length>0));if(o.size===0)return e;const r=e.filter(a=>{if(a.messageType!=="agentMessage.live")return!0;if(n.has(a.id))return!1;const s=Ja(a.text);return s.length===0?!1:!o.has(s)});return r.length===e.length?e:r}function Sc(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const o=e[n];if(df(o,t))return e;const r=[...e];return r.splice(n,1,t),r}const Zf="worked";function Ms(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function xj(e){if(!Number.isFinite(e)||e<=0)return"<1s";const t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60,a=[];n>0&&a.push(`${n}h`),(o>0||n>0)&&a.push(`${o}m`);const s=r>0||a.length===0?r:0;return a.push(`${s}s`),a.join(" ")}function kj(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function Ij(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 by(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${xj(e.durationMs)}`,messageType:Zf,turnId:e.turnId,durationMs:e.durationMs}}function Aj(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function _j(e,t){const n=by(t),o=e.filter(s=>s.messageType!==Zf),r=Aj(o);if(r<0)return[...o,n];const a=[...o];return a.splice(r,0,n),a}function Pj(e,t){if(!t)return e;const n=new Set;for(const r of e)r.messageType===Zf&&r.turnId&&n.add(r.turnId);const o=[];for(const[r,a]of Object.entries(t))!r||n.has(r)||typeof a!="number"||!Number.isFinite(a)||a<=0||(o.push(by({turnId:r,durationMs:Math.round(a)})),n.add(r));return o.length===0?e:[...e,...o]}function bt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function Rj(e,t){if(t.size===0)return e;let n=!1;const o={};for(const[r,a]of Object.entries(e)){if(t.has(r)){n=!0;continue}o[r]=a}return n?o:e}function Ej(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 Mj(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 jj(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 Zt(e,t){const n=Object.entries(e).filter(([o])=>t.has(o));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function Ty(e,t){const n=t.trim();if(!n)return e;let o=!1;const r=[];for(const a of e){const s=a.threads.filter(l=>l.id!==n),i=s.length!==a.threads.length;i&&(o=!0),s.length>0?r.push(i?{...a,threads:s}:a):a.threads.length===0&&r.push(a)}return o?r:e}function tc(e,t){const n=new Map(e.map(r=>[r.projectName,r])),o=t.map(r=>{const a=n.get(r.projectName),s=new Map((a==null?void 0:a.threads.map(l=>[l.id,l]))??[]),i=r.threads.map(l=>{const d=s.get(l.id);return d&&Ej(d,l)?d:l});return a&&a.projectName===r.projectName&&Mj(a.threads,i)?a:{projectName:r.projectName,threads:i}});return jj(e,o)?e:o}function Lj(e,t,n){const o=new Set(Kn(t).map(i=>i.id)),r=Kn(e).filter(i=>n[i.id]===!0&&!o.has(i.id));if(r.length===0)return t;const a=new Map(t.map(i=>[i.projectName,i])),s=t.map(i=>({projectName:i.projectName,threads:[...i.threads]}));for(const i of r){if(a.get(i.projectName)){const d=s.findIndex(c=>c.projectName===i.projectName);d>=0&&(s[d]={projectName:s[d].projectName,threads:[i,...s[d].threads]});continue}s.push({projectName:i.projectName,threads:[i]})}return s}function bi(e){return ar(e)}function Nj(e){const t=e.trim();if(!t)return"";const n=t.lastIndexOf(":");return n>=0?t.slice(n+1):t}function $j(e){const t=e.label||ar(e.remotePath),n=Nj(e.hostId);return n?`${t} ${n}`:t}function Sy(e){const t=(e==null?void 0:e.remoteProjects)??[];return new Map(t.map(n=>[n.id,n]))}function Cc(e){if(!e)return[];const t=new Set(e.order),n=new Set((e.remoteProjects??[]).map(r=>r.id)),o=e.projectOrder.filter(r=>t.has(r)||n.has(r));for(const r of e.order)o.includes(r)||o.push(r);for(const r of n)o.includes(r)||o.push(r);return o}function ff(e,t){const n=Sy(e);return Cc(e).map(o=>{if(n.has(o))return o;const r=Xe(o).trim(),a=bi(r);return t.has(a)?r:a})}function Du(e,t){return Xe(e).trim()===t||bi(e)===t}function Oj(e,t){const n=new Set;for(const o of e.order)Du(o,t)&&n.add(o);for(const o of e.active)Du(o,t)&&n.add(o);for(const o of Object.keys(e.labels))Du(o,t)&&n.add(o);return n}function Dj(e,t,n){var d,c;const o=new Set((e.remoteProjects??[]).map(v=>v.id)),r=new Map;for(const v of e.order){const f=bi(v);r.has(f)||r.set(f,v)}for(const v of n){const f=((c=(d=v.threads[0])==null?void 0:d.cwd)==null?void 0:c.trim())??"";f&&r.set(v.projectName,f)}const a=[],s=v=>{v&&!a.includes(v)&&a.push(v)};for(const v of t){if(o.has(v)){s(v);continue}const f=r.get(v);f&&s(f)}for(const v of Cc(e))s(v);const i=a.filter(v=>e.order.includes(v));for(const v of e.order)i.includes(v)||i.push(v);const l=e.active.filter(v=>i.includes(v));return l.length===0&&i.length>0&&l.push(i[0]),{order:i,active:l,projectOrder:a}}function Fj(e,t,n){const o=ff(t,n);if(o.length===0)return e;const r=new Map(o.map((a,s)=>[a,s]));return[...e].sort((a,s)=>{if(mf(a)||mf(s))return 0;const i=r.get(a.projectName)??Number.POSITIVE_INFINITY,l=r.get(s.projectName)??Number.POSITIVE_INFINITY;return i===l?0:i-l})}function pf(e,t){const n=new Map,o=new Map,r=s=>{const i=Xe(s).trim();if(!i)return;const l=ar(i),d=n.get(l)??new Set;d.add(i),n.set(l,d)};for(const s of(t==null?void 0:t.order)??[]){const i=Xe(s).trim();if(!i)continue;const l=ar(i);nc(i)||o.set(l,(o.get(l)??0)+1),r(s)}for(const s of e)for(const i of s.threads){const l=Xe(i.cwd).trim(),d=ar(l),c=(t==null?void 0:t.order.some(v=>Xe(v).trim()===l))===!0;nc(l)&&!c&&o.get(d)===1||r(i.cwd)}const a=new Set;for(const[s,i]of n.entries())i.size>1&&a.add(s);return a}function nc(e){return e.includes("/.codex/worktrees/")}function Bj(e,t){const n=pf(e,t);if(n.size===0)return e;const o=new Set,r=new Set,a=new Map,s=new Set;for(const d of(t==null?void 0:t.order)??[]){const c=Xe(d).trim();if(!c||(s.add(c),nc(c)))continue;const v=ar(c);o.has(v)?(o.delete(v),r.add(v),a.delete(v)):r.has(v)||(o.add(v),a.set(v,c))}const i=[],l=new Map;for(const d of e)for(const c of d.threads){const v=Xe(c.cwd).trim(),f=ar(v),b=s.has(v),y=nc(v)&&!b&&o.has(f);let P=d.projectName;y&&n.has(f)?P=a.get(f)??d.projectName:v&&n.has(f)&&(P=v);const B=c.projectName===P?c:{...c,projectName:P},$=l.get(P);if($)$.threads.push(B);else{const j={projectName:P,threads:[B]};l.set(P,j),i.push(j)}}return i}function Uj(e,t,n){if(!t||t.order.length===0&&(t.remoteProjects??[]).length===0)return e;const o=new Set(e.map(s=>s.projectName)),r=[...e],a=Sy(t);for(const s of Cc(t)){if(a.has(s)){if(o.has(s))continue;r.push({projectName:s,threads:[]}),o.add(s);continue}const i=Xe(s).trim();if(!i)continue;const l=bi(i),d=n.has(l)?i:l;o.has(d)||(r.push({projectName:d,threads:[]}),o.add(d))}return r}const hf=20;function Ps(e){const t=e.split(`
|
|
69
|
+
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,hf):"Untitled thread"}function zj(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function mf(e){return e.threads.some(t=>t.cwd.trim().length===0||Qu(t.cwd))}const $s=new Map;let Fu=0;function jd(e,t){const n=`${e}:${t.id}`,o=$s.get(n);return o!==void 0?o:(Fu+=1,$s.set(n,Fu),Fu)}function Hj(e){const t=`${e}:`;for(const n of[...$s.keys()])n.startsWith(t)&&$s.delete(n)}function qj(){$s.clear(),Fu=0}function Wj(e){if($s.size!==0)for(const t of[...$s.keys()]){const n=t.indexOf(":"),o=n>0?t.slice(0,n):"";e.has(o)||$s.delete(t)}}function Km(e,t){const n=t.trim();if(!n)return-1;const o=e.findIndex(i=>i.id===n);if(o>=0)return o;const r=`session-cmd-${n}`,a=e.findIndex(i=>i.id===r);if(a>=0)return a;const s="session-cmd-";if(n.startsWith(s)){const i=e.findIndex(l=>l.id===n.slice(s.length));if(i>=0)return i}return-1}function Gj(e,t){var a,s;if(t.length===0)return e;const n=[...e],o=[],r=new Map;for(const i of t){const l=((a=i.reasoningAnchorMessageId)==null?void 0:a.trim())??"";if(l&&Km(n,l)>=0)continue;const d=i.turnIndex;if(typeof d!="number"||!Number.isFinite(d))continue;const c=r.get(d)??[];c.push(i),r.set(d,c)}for(const i of[...t].reverse()){const l=((s=i.reasoningAnchorMessageId)==null?void 0:s.trim())??"";if(l){const y=Km(n,l);if(y>=0){n.splice(y+1,0,i);continue}}const d=i.turnIndex;if(typeof d!="number"||!Number.isFinite(d)){o.push(i);continue}let c=-1,v=-1;const f=[];for(let y=0;y<n.length;y+=1)n[y].turnIndex===d&&(v=y,n[y].role==="user"?c=y:n[y].messageType!=="reasoning"&&f.push(y));if(f.some(y=>{const P=n[y].messageType;return P==="commandExecution"||P==="toolCall"||P==="fileChange"||P==="worked"})){const P=(r.get(d)??[]).indexOf(i),B=P>=0?P:0;n.splice(f[Math.min(B,f.length-1)]+1,0,i)}else if(c>=0)n.splice(c+1,0,i);else if(v>=0)n.splice(v+1,0,i);else continue}return o.length>0?[...n,...o.reverse()]:n}function Vj(e,t,n){const o=new Set(n.map(s=>s.id)),r=new Map;for(const s of t)for(const i of s)o.has(i.id)||r.has(i.id)||r.set(i.id,i);const a=Array.from(r.values());for(const s of a)jd(e,s);return a.sort((s,i)=>jd(e,s)-jd(e,i))}function Kj(e,t,n,o,r){const a=Vj(e,o,t),s=new Map;let i;for(let f=0;f<t.length;f+=1){const b=t[f];b.role!=="user"||!Number.isInteger(b.turnIndex)||b.turnIndex<0||(i!==void 0&&s.set(i,f),i=b.turnIndex)}i!==void 0&&s.set(i,t.length);const l=new Map,d=[];for(const f of a){const b=f.turnIndex,y=Number.isInteger(b)&&b>=0?s.get(b):void 0;if(y===void 0){d.push(f);continue}const P=l.get(y);P?P.push(f):l.set(y,[f])}const c=[];for(let f=0;f<=t.length;f+=1)c.push(...l.get(f)??[]),f<t.length&&c.push(t[f]);c.push(...d);const v=Sj(c);return[...Gj(v,n),...r]}const Cy="codex-web-local.thread-read-state.v1",Ym="codex-web-local.thread-unread-cutoff.v1",xy="codex-web-local.thread-token-usage.v1",ky="codex-web-local.thread-reasoning.v1",vf="codex-web-local.thread-turn-durations.v1",Iy="codex-web-local.thread-last-plan.v1",Ay="codex-web-local.live-reasoning-snapshot.v1",_y="codex-web-local.thread-terminal-open.v1",gf="codex-web-local.selected-thread-id.v1",yf="codex-web-local.selected-model-by-context.v1",Py="codex-web-local.selected-model-id.v1",Ry="codex-web-local.project-order.v1",Ey="codex-web-local.project-display-name.v1",wf="codex-web-local.collaboration-mode-by-context.v1",Yj="codex-web-local.collaboration-mode.v1";function Jj(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Cy);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Jm(e){typeof window>"u"||window.localStorage.setItem(Cy,JSON.stringify(e))}function Qj(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(ky);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Ld(e){if(!(typeof window>"u")){try{window.localStorage.setItem(ky,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e))t&&n.length>0&&pI(t,n)}}function Xj(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(vf);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){if(!o||!r||typeof r!="object"||Array.isArray(r))continue;const a={};for(const[s,i]of Object.entries(r))!s||typeof i!="number"||!Number.isFinite(i)||i<=0||(a[s]=Math.round(i));Object.keys(a).length>0&&(n[o]=a)}return n}catch{return{}}}function Qm(e){if(!(typeof window>"u")){try{Object.keys(e).length===0?window.localStorage.removeItem(vf):window.localStorage.setItem(vf,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e))if(t)for(const[o,r]of Object.entries(n))!o||typeof r!="number"||r<=0||mI(t,o,r)}}function Zj(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Iy);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function My(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Iy,JSON.stringify(e))}catch{}}function eL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ay);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){const a=r;typeof(a==null?void 0:a.text)=="string"&&a.text.trim()&&typeof a.ts=="number"&&(n[o]={text:a.text,ts:a.ts})}return n}catch{return{}}}function tL(){if(typeof window>"u")return"";const e=window.localStorage.getItem(Ym);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(Ym,t),t}function nL(){if(typeof window>"u")return Mr();try{const n=window.localStorage.getItem(yf);if(n){const o=JSON.parse(n);if(!o||typeof o!="object"||Array.isArray(o))return Mr();const r=Mr();for(const[a,s]of Object.entries(o)){if(typeof a!="string"||a.length===0)continue;const i=ul(s);i&&(r[a]=i)}return r}}catch{}const e=ul(window.localStorage.getItem(Py)),t=Mr();return e&&(t[Wa]=e),t}function Pu(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(yf):window.localStorage.setItem(yf,JSON.stringify(e)),window.localStorage.removeItem(Py)}catch{}}function oL(){if(typeof window>"u")return Mr();try{const e=window.localStorage.getItem(wf);if(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return Mr();const n=Mr();for(const[o,r]of Object.entries(t)){if(typeof o!="string"||o.length===0)continue;const a=vy(r);a==="plan"&&(n[o]=a)}return n}}catch{}return Mr()}function Nd(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(wf):window.localStorage.setItem(wf,JSON.stringify(e)),window.localStorage.removeItem(Yj)}catch{}}function rL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(xy);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){if(!o)continue;const a=hj(r);a&&(n[o]=a)}return n}catch{return{}}}function $d(e){typeof window>"u"||window.localStorage.setItem(xy,JSON.stringify(e))}const bf="codex-web-local.thread-model-switch-markers.v1";function aL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(bf);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){if(!o||!Array.isArray(r))continue;const a=r.filter(s=>!!s&&typeof s=="object"&&ij(s)).slice(0,hy);a.length>0&&(n[o]=a)}return n}catch{return{}}}function sL(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(bf):window.localStorage.setItem(bf,JSON.stringify(e))}catch{}}function iL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(_y);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t))o&&typeof r=="boolean"&&(n[o]=r);return n}catch{return{}}}function lL(e){typeof window>"u"||window.localStorage.setItem(_y,JSON.stringify(e))}function uL(){return typeof window>"u"?"":window.localStorage.getItem(gf)??""}function cL(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(gf);return}window.localStorage.setItem(gf,e)}}function dL(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Ry);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const o of t){if(typeof o!="string"||o.length===0)continue;const r=ar(o);r.length>0&&!n.includes(r)&&n.push(r)}return n}catch{return[]}}function fL(e){typeof window>"u"||window.localStorage.setItem(Ry,JSON.stringify(e))}function pL(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ey);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){const a=typeof o=="string"?ar(o):"";a.length>0&&typeof r=="string"&&(n[a]=r)}return n}catch{return{}}}function hL(e){typeof window>"u"||window.localStorage.setItem(Ey,JSON.stringify(e))}function mL(e){return e==="completed"?"completed":e==="inProgress"||e==="in_progress"?"inProgress":"pending"}function vL(e){var n;const t=[];(n=e.explanation)!=null&&n.trim()&&t.push(e.explanation.trim());for(const o of e.steps){const r=o.status==="completed"?"x":o.status==="inProgress"?"~":" ";t.push(`- [${r}] ${o.step}`)}return t.join(`
|
|
70
|
+
`).trim()}function We(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function Re(e){return typeof e=="string"?e:""}function js(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function Xm(e){const t=We(e);if(!t)return null;const n=js(t.totalTokens??t.total_tokens),o=js(t.inputTokens??t.input_tokens),r=js(t.cachedInputTokens??t.cached_input_tokens),a=js(t.outputTokens??t.output_tokens),s=js(t.reasoningOutputTokens??t.reasoning_output_tokens);return n===null||o===null||r===null||a===null||s===null?null:{totalTokens:n,inputTokens:o,cachedInputTokens:r,outputTokens:a,reasoningOutputTokens:s}}function gL(e){const t=We(e);if(!t)return null;const n=Xm(t.total),o=Xm(t.last);if(!n||!o)return null;const r=js(t.modelContextWindow??t.model_context_window),a=o.totalTokens,s=typeof r=="number"?Math.max(r-a,0):null,i=typeof r=="number"&&r>0?wy(Math.round((s??0)/r*100),0,100):null;return{total:n,last:o,modelContextWindow:r,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function yL(e){if(e.method!=="thread/tokenUsage/updated")return null;const t=We(e.params),n=$n(e),o=gL((t==null?void 0:t.tokenUsage)??(t==null?void 0:t.token_usage));return!n||!o?null:{threadId:n,usage:o}}function $n(e){const t=We(e.params);if(!t)return"";const n=Re(t.threadId);if(n)return n;const o=Re(t.thread_id);if(o)return o;const r=Re(t.conversationId);if(r)return r;const a=Re(t.conversation_id);if(a)return a;const s=We(t.thread),i=Re(s==null?void 0:s.id);if(i)return i;const l=We(t.turn),d=Re(l==null?void 0:l.threadId);if(d)return d;const c=Re(l==null?void 0:l.thread_id);return c||""}function wL(e){if(e.method!=="turn/completed")return"";const t=We(e.params),n=We(t==null?void 0:t.turn);if(!n||n.status!=="failed")return"";const o=We(n.error);return Re(o==null?void 0:o.message)}function bL(e){var o;if(e.method!=="error")return null;const t=We(e.params),n=Re(t==null?void 0:t.message)||Re((o=We(t==null?void 0:t.error))==null?void 0:o.message);return n?{message:n,transient:(t==null?void 0:t.willRetry)===!0}:null}function TL(e){const t=$n(e);if(!t)return null;if(e.method==="turn/started")return{threadId:t,activity:{label:"Thinking",details:[]}};if(e.method==="item/started"){const n=We(e.params),o=We(n==null?void 0:n.item),r=Re(o==null?void 0:o.type).toLowerCase();if(r==="reasoning")return{threadId:t,activity:{label:"Thinking",details:[]}};if(r==="agentmessage")return{threadId:t,activity:{label:"Writing response",details:[]}};if(r==="commandexecution"){const a=Re(o==null?void 0:o.command);return{threadId:t,activity:{label:"Running command",details:a?[a]:[]}}}if(r==="filechange"){const s=(Array.isArray(o==null?void 0:o.changes)?o.changes:[])[0],i=Re(s==null?void 0:s.path);return{threadId:t,activity:{label:"Applying changes",details:i?[i]:[]}}}}return e.method==="item/commandExecution/outputDelta"?{threadId:t,activity:{label:"Running command",details:[]}}:e.method==="item/fileChange/outputDelta"?{threadId:t,activity:{label:"Applying changes",details:[]}}:e.method==="item/reasoning/summaryTextDelta"||e.method==="item/reasoning/summaryPartAdded"||e.method==="item/reasoning/textDelta"?{threadId:t,activity:{label:"Thinking",details:[]}}:e.method==="item/agentMessage/delta"?{threadId:t,activity:{label:"Writing response",details:[]}}:null}function SL(e){if(e.method!=="turn/started")return null;const t=We(e.params);if(!t)return null;const n=$n(e);if(!n)return null;const o=We(t.turn),r=Re(o==null?void 0:o.id)||Re(t.turnId)||`${n}:unknown`;if(!r)return null;const a=Ms(Re(o==null?void 0:o.startedAt))??Ms(Re(t.startedAt))??Ms(e.atIso)??Date.now();return{threadId:n,turnId:r,startedAtMs:a}}function CL(e){if(e.method!=="turn/completed")return null;const t=We(e.params);if(!t)return null;const n=$n(e);if(!n)return null;const o=We(t.turn),r=Re(o==null?void 0:o.id)||Re(t.turnId)||`${n}:unknown`;if(!r)return null;const a=Ms(Re(o==null?void 0:o.completedAt))??Ms(Re(t.completedAt))??Ms(e.atIso)??Date.now(),s=Ms(Re(o==null?void 0:o.startedAt))??Ms(Re(t.startedAt))??void 0;return{threadId:n,turnId:r,completedAtMs:a,startedAtMs:s}}function oc(e){return`${e}:live-reasoning`}function xL(e){const t=We(e.params);if(!t)return"";if(e.method==="item/started"){const n=We(t.item);return!n||n.type!=="reasoning"?"":Re(n.id)}return""}function kL(e){const t=We(e.params);if(!t)return null;if(e.method==="item/reasoning/summaryTextDelta"){const n=Re(t.itemId),o=Re(t.delta);return!n||!o?null:{messageId:oc(n),itemId:n,delta:o}}if(e.method==="item/reasoning/textDelta"){const n=Re(t.itemId),o=Re(t.delta);return!n||!o?null:{messageId:oc(n),itemId:n,delta:o}}return null}function IL(e){const t=We(e.params);if(!t)return"";if(e.method==="item/reasoning/summaryPartAdded"){const n=Re(t.itemId);return n?oc(n):""}return""}function AL(e){const t=We(e.params);if(!t)return"";if(e.method==="item/completed"){const n=We(t.item);return!n||n.type!=="reasoning"?"":oc(Re(n.id))}return""}function _L(e){var n;const t=[];for(const o of["content","summary"]){const r=Array.isArray(e[o])?e[o]:[];for(const a of r){const s=typeof a=="string"?a:(n=We(a))==null?void 0:n.text;typeof s=="string"&&s.trim()&&t.push(s)}}return t.join(`
|
|
71
|
+
`).trim()}function PL(e){if(e.method!=="item/started"&&e.method!=="item/completed")return null;const t=We(e.params),n=We(t==null?void 0:t.item);if(!n||Re(n.type).toLowerCase()!=="reasoning")return null;const o=Re(n.id);return o?{itemId:o,text:_L(n)}:null}function RL(e){const t=We(e.params);if(!t)return"";if(e.method==="item/started"){const n=We(t.item);return!n||n.type!=="agentMessage"?"":Re(n.id)}return""}function EL(e){const t=We(e.params);if(!t)return null;if(e.method==="item/agentMessage/delta"){const n=Re(t.itemId),o=Re(t.delta);if(!n||!o)return null;const r=Re(t.turnId)||Re(t.turn_id);return{messageId:n,delta:o,turnId:r||void 0}}return null}function ML(e){const t=We(e.params);if(!t)return null;if(e.method==="item/completed"){const n=We(t.item);if(!n||n.type!=="agentMessage")return null;const o=Re(n.id),r=Re(n.text);if(!o||!r)return null;const a=Re(t.turnId)||Re(t.turn_id);return{id:o,role:"assistant",text:r,messageType:"agentMessage",turnId:a||void 0}}return null}function jL(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function LL(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 NL(e){if(e.method!=="item/completed")return null;const t=We(e.params),n=We(t==null?void 0:t.item);if(!n)return null;const o=Re(n.id);if(!o)return null;if(n.type==="imageView"){const s=Re(n.path);return s?{id:o,role:"assistant",text:"",images:[jL(s)],messageType:"imageView"}:null}if(n.type!=="imageGeneration"&&n.type!=="image_generation")return null;const r=Re(n.result),a=r?LL(r):"";return a?{id:o,role:"assistant",text:"",images:[a],messageType:"imageView"}:null}function $L(e){if(e.method!=="item/commandExecution/outputDelta")return null;const t=We(e.params);if(!t)return null;const n=Re(t.itemId),o=Re(t.delta);return!n||!o?null:{itemId:n,delta:o}}const el="__global__";function OL(e){return e==="item/commandExecution/requestApproval"||e==="item/fileChange/requestApproval"||e==="item/permissions/requestApproval"||e==="execCommandApproval"||e==="applyPatchApproval"}function jy(e){const t=We(e);if(!t)return null;const n=t.id,o=Re(t.method),r=t.params;if(typeof n!="number"||!Number.isInteger(n)||!o)return null;const a=We(r),s=DL(o,a),i=Re(a==null?void 0:a.threadId)||Re(a==null?void 0:a.thread_id)||Re(a==null?void 0:a.conversationId)||Re(a==null?void 0:a.conversation_id)||el,l=Re(a==null?void 0:a.turnId)||Re(a==null?void 0:a.turn_id),d=Re(a==null?void 0:a.itemId)||Re(a==null?void 0:a.item_id)||Re(a==null?void 0:a.callId)||Re(a==null?void 0:a.call_id),c=Re(t.receivedAtIso)||new Date().toISOString();return{id:n,method:s,threadId:i,turnId:l,itemId:d,receivedAtIso:c,params:r??null}}function DL(e,t){const n=e.trim();return n&&(n==="item/commandExecution/requestApproval"||n==="execCommandApproval"||n==="exec_approval_request"||FL(t)?"item/commandExecution/requestApproval":n==="item/fileChange/requestApproval"||n==="applyPatchApproval"||n==="apply_patch_approval_request"||BL(t)?"item/fileChange/requestApproval":n==="item/tool/requestUserInput"||n==="request_user_input"||UL(t)?"item/tool/requestUserInput":n==="mcpServer/elicitation/request"||n==="elicitation_request"||HL(t)?"mcpServer/elicitation/request":n==="item/permissions/requestApproval"||qL(t)?"item/permissions/requestApproval":n==="item/tool/call"||n==="dynamic_tool_call_request"||zL(t)?"item/tool/call":n)}function FL(e){if(!e)return!1;const t=e.command;return Array.isArray(t)&&t.some(n=>typeof n=="string"&&n.trim().length>0)||typeof t=="string"&&t.trim().length>0?!0:Array.isArray(e.commandActions)}function BL(e){return e?typeof e.grantRoot=="string"&&e.grantRoot.trim().length>0||typeof e.grant_root=="string"&&e.grant_root.trim().length>0||We(e.fileChanges)?!0:We(e.changes)!==null:!1}function UL(e){return!!(e&&Array.isArray(e.questions))}function zL(e){return e?typeof e.toolName=="string"||typeof e.tool_name=="string"||typeof e.name=="string"||Array.isArray(e.arguments):!1}function HL(e){if(!e)return!1;const t=Re(e.mode);return typeof e.serverName=="string"&&typeof e.threadId=="string"&&typeof e.message=="string"&&(t==="form"||t==="url")}function qL(e){return e?typeof e.threadId=="string"&&typeof e.turnId=="string"&&typeof e.itemId=="string"&&We(e.permissions)!==null:!1}function WL(e){if(e.method!=="item/tool/requestUserInput")return[];const t=We(e.params),n=Array.isArray(t==null?void 0:t.questions)?t.questions:[],o=[];for(const r of n){const a=We(r),s=Re(a==null?void 0:a.id).trim();s&&o.push(s)}return o}function GL(e,t){const n=t.threadId||el,o=e.pendingServerRequestsByThreadId.value[n]??[],r=o.findIndex(s=>s.id===t.id),a=[...o];r>=0?a.splice(r,1,t):a.push(t),e.pendingServerRequestsByThreadId.value={...e.pendingServerRequestsByThreadId.value,[n]:a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso))},e.applyThreadFlags()}function VL(e,t){const n={};for(const[o,r]of Object.entries(e.pendingServerRequestsByThreadId.value)){const a=r.filter(s=>s.id!==t);a.length>0&&(n[o]=a)}e.pendingServerRequestsByThreadId.value=n,e.pendingReplyErrorByRequestId.value[String(t)]&&(e.pendingReplyErrorByRequestId.value=bt(e.pendingReplyErrorByRequestId.value,String(t))),e.applyThreadFlags()}function KL(e,t){return e.pendingReplyErrorByRequestId.value[String(t)]??""}function YL(e,t){const n={},o=new Set;for(const a of t){const s=a.threadId||el,i=n[s]??[];i.push(a),n[s]=i,o.add(a.id)}for(const a of Object.values(n))a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso));e.pendingServerRequestsByThreadId.value=n;const r={};for(const[a,s]of Object.entries(e.pendingReplyErrorByRequestId.value))o.has(Number(a))&&(r[a]=s);e.pendingReplyErrorByRequestId.value=r}function Ly(e,t,n){const o=e.liveAgentMessagesByThreadId.value[t]??[];cl(o,n)||(e.liveAgentMessagesByThreadId.value={...e.liveAgentMessagesByThreadId.value,[t]:n})}function JL(e,t){t&&t in e.liveAgentMessagesByThreadId.value&&(e.liveAgentMessagesByThreadId.value=bt(e.liveAgentMessagesByThreadId.value,t))}function QL(e,t,n){const o=e.livePlanMessagesByThreadId.value[t]??[];cl(o,n)||(e.livePlanMessagesByThreadId.value={...e.livePlanMessagesByThreadId.value,[t]:n})}function XL(e,t,n){!t||!n||(e.lastPlanByThreadId.value={...e.lastPlanByThreadId.value,[t]:n},My(e.lastPlanByThreadId.value))}function ZL(e,t,n){const o=e.livePlanMessagesByThreadId.value[t]??[],r=Sc(o,n);QL(e,t,r),XL(e,t,n)}function eN(e,t,n){const o=e.liveFileChangeMessagesByThreadId.value[t]??[],r=Sc(o,n);ep(e,t,r)}function tN(e,t,n){const o=e.liveAgentMessagesByThreadId.value[t]??[];let r=Sc(o,n);const a=Ja(n.text);if(n.role==="assistant"&&a.length>0){const s=r.filter(i=>i.id===n.id||Ja(i.text)!==a);s.length!==r.length&&(r=s)}Ly(e,t,r)}function ep(e,t,n){const o=e.liveFileChangeMessagesByThreadId.value[t]??[];cl(o,n)||(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:n})}function nN(e,t,n){const o=e.liveCommandsByThreadId.value[t]??[],r=Sc(o,n);r!==o&&(e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:r})}function oN(e,t,n){const o=e.liveCommandsByThreadId.value[t];if(!o||o.length===0)return;const r=new Set(n.map(s=>s.id)),a=o.filter(s=>!r.has(s.id));a.length!==o.length&&(a.length===0?e.liveCommandsByThreadId.value=bt(e.liveCommandsByThreadId.value,t):e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:a})}function rN(e,t,n){const o=e.liveFileChangeMessagesByThreadId.value[t];if(!o||o.length===0)return;const r=new Set(n.map(l=>l.id)),a=new Set(n.filter(l=>l.messageType==="fileChange"&&typeof l.turnId=="string"&&l.turnId.length>0).map(l=>l.turnId)),s=new Set(n.filter(l=>l.messageType==="fileChange"&&typeof l.turnIndex=="number").map(l=>l.turnIndex)),i=o.filter(l=>!r.has(l.id)&&!(l.turnId&&a.has(l.turnId))&&!(typeof l.turnIndex=="number"&&s.has(l.turnIndex)));i.length!==o.length&&(i.length===0?e.liveFileChangeMessagesByThreadId.value=bt(e.liveFileChangeMessagesByThreadId.value,t):e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:i})}function aN(e,t,n,o){if(!t||!n)return;const r=e.liveFileChangeMessagesByThreadId.value[t];if(!r)return;const a=r.findIndex(i=>i.id===n||i.turnId===n);if(a<0)return;const s=[...r];s[a]={...s[a],fileChanges:o},ep(e,t,s)}function sN(e,t,n,o){if(!t||!n)return;const r=e.liveFileChangeMessagesByThreadId.value[t];if(!r)return;const a=r.findIndex(l=>l.turnId===n);if(a<0)return;const s=[...r],i=s[a];s[a]={...i,fileChanges:(i.fileChanges??[]).map(l=>({...l,diff:o}))},ep(e,t,s)}function iN(e,t){const n=e.persistedMessagesByThreadId.value[t]??[];let o=-1;for(const r of n)typeof r.turnIndex=="number"&&Number.isFinite(r.turnIndex)&&(o=Math.max(o,r.turnIndex));return o+1}function lN(e,t,n,o){if(!t||!n||!Number.isInteger(o)||o<0)return;const r=e.turnIndexByTurnIdByThreadId.value[t]??{};r[n]!==o&&(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...r,[n]:o}})}function uN(e,t,n){const o=e.turnIndexByTurnIdByThreadId.value[t]??{},r=Object.entries(o),a=Object.entries(n);r.length===a.length&&r.every(([s,i])=>n[s]===i)||(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...n}})}function cN(e,t,n){var r;if(!t||!n)return;const o=(r=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:r[n];return typeof o=="number"?o:void 0}function dN(e,t){const n=e.liveFileChangeMessagesByThreadId.value[t];if(!n||n.length===0)return;const o=e.turnIndexByTurnIdByThreadId.value[t]??{};let r=!1;const a=n.map(s=>{if(typeof s.turnIndex=="number"||!s.turnId)return s;const i=o[s.turnId];return typeof i!="number"?s:(r=!0,{...s,turnIndex:i})});r&&(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:a})}const Zm=8e3,fN=1500,pN=15*60*1e3;function hN(e){let t=eL(),n=!1,o=null;function r(){o===null&&(o=setTimeout(()=>{if(o=null,n&&(n=!1,typeof window<"u"))try{window.localStorage.setItem(Ay,JSON.stringify(t))}catch{}n&&r()},fN))}function a(c,v){if(!c||e.inProgressById.value[c]!==!0)return;const f=v.length>Zm?v.slice(-Zm):v;t[c]={text:f,ts:Date.now()},n=!0,r()}function s(c,v){if(!c)return;const f=v.trim(),b=e.liveReasoningTextByThreadId.value[c]??"";if(f.length===0){if(!b)return;e.liveReasoningTextByThreadId.value=bt(e.liveReasoningTextByThreadId.value,c);return}b!==f&&(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[c]:f},a(c,f))}function i(c,v){if(!c)return;const f=e.liveReasoningTextByThreadId.value[c]??"";s(c,`${f}${v}`)}function l(c){var b;if(!c||((b=e.liveReasoningTextByThreadId.value[c])==null?void 0:b.trim()))return;const f=t[c];f!=null&&f.text&&(Date.now()-f.ts>pN||(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[c]:f.text}))}function d(c){c&&c in t&&(delete t[c],n=!0,r())}return{setLiveReasoningText:s,appendLiveReasoningText:i,restoreLiveReasoningSnapshot:l,clearLiveReasoningSnapshot:d}}function mN(e,t){if(!t)return;const n=e.activeTurnIdByThreadId.value[t]??"";n&&e.activeReasoningTurnIdByThreadId.set(t,n)}function vN(e,t,n=!1){var l;if(!t)return;const o=e.liveReasoningTextByThreadId.value[t];if(o===void 0){n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear());return}const r=e.activeReasoningTurnIdByThreadId.get(t)??e.activeTurnIdByThreadId.value[t]??"";e.activeReasoningTurnIdByThreadId.delete(t);const a=r?(l=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:l[r]:void 0,s=TN(e,t),i=r||void 0;s.length>0?yN(e,t,s,i,a):n||gN(e,t,o,i,a),e.liveReasoningTextByThreadId.value=bt(e.liveReasoningTextByThreadId.value,t),n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear(),e.clearLiveReasoningSnapshot(t))}function gN(e,t,n,o,r){if(!t)return;const a=n.trim();if(!a)return;const s=e.persistedReasoningByThreadId.value[t]??[];if(s.some(d=>d.text===a))return;const i={id:`reasoning:local:${t}:${Date.now()}`,role:"system",text:a,messageType:"reasoning",reasoning:{summary:[],content:[a]},turnId:o||void 0,turnIndex:typeof r=="number"?r:void 0},l=[...s,i].slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:l},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function yN(e,t,n,o,r){if(!t||n.length===0)return;const s=[...e.persistedReasoningByThreadId.value[t]??[]];for(const l of n){const d=l.text.trim();if(!d)continue;const c=`reasoning:item:${t}:${l.itemId}`,v=s.findIndex(f=>f.id===c);if(v>=0){const f=s[v],b=l.anchorMessageId||f.reasoningAnchorMessageId,y=typeof r=="number"?r:f.turnIndex;if(f.text===d&&f.turnIndex===y&&f.reasoningAnchorMessageId===b)continue;s[v]={...f,text:d,reasoning:{summary:[],content:[d]},turnId:o||f.turnId,turnIndex:y,reasoningAnchorMessageId:b};continue}s.some(f=>f.text===d)||s.push({id:c,role:"system",text:d,messageType:"reasoning",reasoning:{summary:[],content:[d]},turnId:o||void 0,turnIndex:typeof r=="number"?r:void 0,reasoningAnchorMessageId:l.anchorMessageId||void 0})}const i=s.slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:i},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function wN(e,t,n,o){if(!t||!o)return;o.trim()&&e.reasoningItemTextByItemId.set(n,o.trim());const r=e.liveReasoningTextByThreadId.value[t]??"",a=e.reasoningAppendedTextByItemId.get(n)??"";if(r.endsWith(o)||a&&o===a){e.reasoningAppendedTextByItemId.set(n,o);return}if(a&&o.startsWith(a)){const i=o.slice(a.length);i&&e.appendLiveReasoningText(t,i),e.reasoningAppendedTextByItemId.set(n,o);return}const s=r.length>0&&!r.endsWith(`
|
|
72
|
+
`)?`
|
|
73
|
+
|
|
74
|
+
`:"";e.appendLiveReasoningText(t,`${s}${o}`),e.reasoningAppendedTextByItemId.set(n,o)}function bN(e,t){const n=We(t.params);if(!n)return;const o=t.method==="item/started"||t.method==="item/completed",r=t.method==="item/reasoning/textDelta"||t.method==="item/reasoning/summaryTextDelta";if(!o&&!r)return;const a=We(n.item),s=Re(r?n.itemId:a==null?void 0:a.id);if(!s)return;const i=$n(t);if(!i)return;const l=r||Re(a==null?void 0:a.type).toLowerCase()==="reasoning"?"reasoning":"other",d=e.turnItemSequenceByThreadId.get(i)??[];d.some(c=>c.itemId===s)||e.turnItemSequenceByThreadId.set(i,[...d,{itemId:s,kind:l}])}function TN(e,t){var a;const n=e.turnItemSequenceByThreadId.get(t)??[],o=[];let r="";for(const s of n)if(s.kind==="reasoning"){const i=((a=e.reasoningItemTextByItemId.get(s.itemId))==null?void 0:a.trim())??"";i&&o.push({text:i,anchorMessageId:r,itemId:s.itemId})}else r=s.itemId;return o}function SN(e,t,n){if(!t||!n)return;const o=e.reasoningItemTextByItemId.get(t)??"";o.endsWith(n)||e.reasoningItemTextByItemId.set(t,`${o}${n}`)}function ev(e){e.reasoningItemTextByItemId.clear()}const Pr="gpt-5.4-mini",Ny="Codex CLI not found. Install @openai/codex or set CODEXUI_CODEX_COMMAND.",CN="big-pickle",xN=Bg;function kN(e){const t=S([]),n=S({}),o=S({}),r=S(nL()),a=S(Ed(r.value,e.selectedThreadId.value)),s=S("medium"),i=S("standard"),l=S(""),d=S(""),c=S(!1),v=S({});let f=!1;function b(ae){if(Ns(ae)===Wa){const ke=Is(l.value),Ie=Au(ke),ze=Ie?ul(r.value[Ie]):"";if(ze)return ze}return Ed(r.value,ae).trim()}function y(ae){const Ee=ae.trim();return Is(Ee?v.value[Ee]??l.value:l.value)}function P(ae){const Ee=ae.trim();return!Ee||Ns(Ee)===Wa?!1:Ed(r.value,Ee).trim().length>0}function B(ae){return n.value[ae.trim()]??xN}function $(ae,Ee=s.value){const ke=ae.trim(),Ie=B(ke);if(Ee&&Ie.includes(Ee))return Ee;if(Ie.includes("medium"))return"medium";const ze=o.value[ke];return ze&&Ie.includes(ze)?ze:Ie[0]??""}function j(ae){s.value=$(ae)}function H(ae){const Ee={},ke={};for(const Ie of ae)Ie.supportedReasoningEfforts!==null&&(Ee[Ie.id]=[...Ie.supportedReasoningEfforts]),Ie.defaultReasoningEffort&&(ke[Ie.id]=Ie.defaultReasoningEffort);n.value=Ee,o.value=ke}function q(...ae){const Ee=[...t.value];for(const ke of ae){const Ie=ke.trim();Ie&&!Ee.includes(Ie)&&Ee.push(Ie)}Ga(t.value,Ee)||(t.value=Ee)}function be(ae){const Ee=ae.trim();return t.value.length===0||Ee&&t.value.includes(Ee)?Ee:t.value[0]??""}function ce(ae,Ee){const ke=Ee.trim(),Ie=Ns(ae),ze=Is(l.value),st=Ie===Wa?Au(ze):"",tt=st||Ie;if(ke){const ct=Ou(r.value);ct[tt]=ke,st&&delete ct[Ie],r.value=ct}else{let ct=Fl(r.value,tt);st&&(ct=Fl(ct,Ie)),r.value=ct}Ie===Ns(e.selectedThreadId.value)?(a.value=b(e.selectedThreadId.value),q(a.value),j(a.value)):q(ke),Pu(r.value)}function W(ae){ce(e.selectedThreadId.value,ae)}function he(ae,Ee){const ke=ae.trim();if(!ke)return;const Ie=Ee.trim();if(Ie){const ze=Ou(r.value);ze[ke]=Ie,r.value=ze}else r.value=Fl(r.value,ke);q(Ie),e.selectedThreadId.value===ke&&(a.value=b(e.selectedThreadId.value),j(a.value)),Pu(r.value)}function Se(ae,Ee){const ke=ae.trim();if(!ke)return;const Ie=Is(Ee);Ie?v.value={...v.value,[ke]:Ie}:v.value[ke]&&(v.value=bt(v.value,ke))}function _e(ae,Ee,ke){const Ie=Ee.trim();if(Is(ke)!=="opencode-zen")return Ie;const st=b(ae).trim();return st&&!/^gpt-/i.test(st)?st:Ie&&!/^gpt-/i.test(Ie)?Ie:CN}async function ye(ae=e.selectedThreadId.value){ae.trim()?he(ae,Pr):W(Pr),q(Pr)}function X(ae){ae&&!B(a.value).includes(ae)||(f=!0,s.value=ae)}async function pe(ae){const Ee=ae==="fast"?"fast":"standard";if(c.value||i.value===Ee)return;const ke=i.value;i.value=Ee,c.value=!0,e.error.value="";try{await Uk(Ee)}catch(Ie){i.value=ke,e.error.value=Ie instanceof Error?Ie.message:"Failed to update Fast mode"}finally{c.value=!1}}function re(ae,Ee,ke){const Ie=ae.trim()||"default",ze=Ee||"default",st=ke==="plan"?"Plan":"Default",tt=i.value==="fast"?"Fast":"Standard";return[`Mode: ${st}`,`Model: ${Ie}`,`Thinking: ${ze}`,`Speed: ${tt}`]}async function xe(ae){d.value="";try{const Ee=await Wk(),ke=Ee.model.trim(),Ie=Is(Ee.providerId);l.value=Ie;const ze=y(e.selectedThreadId.value),st=ze!=="codex"&&ze!=="custom",tt=b(e.selectedThreadId.value),ct=await qk({includeProviderModels:st||(ae==null?void 0:ae.includeProviderModels)!==!1,requireProviderModels:st,providerId:st?ze:void 0}),ue=ct.map(De=>De.id);H(ct);const N=Au(ze),ie=N?ul(r.value[N]):"",se=[...ue];!(ae!=null&&ae.providerChanged)&&st&&ze===Ie&&ke&&!se.includes(ke)&&se.push(ke),t.value=se;const Oe=tt&&ue.includes(tt);if(!tt||!Oe||ae!=null&&ae.providerChanged?ae!=null&&ae.providerChanged&&se.length>0?ie&&ue.includes(ie)?W(ie):ze===Ie&&ke&&se.includes(ke)?W(ke):W(se[0]):ze===Ie&&ke&&se.includes(ke)?W(Ee.model):se.length>0?W(se[0]):W(""):a.value.trim()!==tt&&W(tt),N&&a.value.trim().length>0){const De=Ou(r.value);De[N]=a.value.trim();const A=Au(Ie);A&&A!==N&&ke&&(De[A]=ke),r.value=De,Pu(r.value)}s.value=$(a.value,f?s.value:"medium"),i.value=Ee.speedMode}catch(Ee){d.value=yy(Ee)?Ny:""}}function $e(ae){a.value=be(b(ae)),j(a.value)}function Ne(ae){const Ee=gy(r.value,ae);Ee!==r.value&&(r.value=Ee,$e(e.selectedThreadId.value),Pu(Ee)),v.value=Zt(v.value,ae)}return{activeProviderId:l,availableModelIds:t,availableModelReasoningEfforts:n,codexCliMissingError:d,isUpdatingSpeedMode:c,selectedModelId:a,selectedReasoningEffort:s,selectedSpeedMode:i,applyFallbackModelSelection:ye,buildPendingTurnDetails:re,hasThreadModelSelection:P,pruneThreadModelState:Ne,readModelIdForThread:b,refreshModelPreferences:xe,resolveThreadModelForProvider:_e,setSelectedModelId:W,setSelectedModelIdForThread:ce,setSelectedReasoningEffort:X,setThreadModelId:he,setThreadModelProviderId:Se,syncSelectedThreadModel:$e,updateSelectedSpeedMode:pe}}function IN(e){const t=S([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),n=S(oL()),o=S(Md(n.value,e.value));function r(d){const c=d==="plan"?"plan":"default",v=Ns(e.value);Md(n.value,e.value)===c&&o.value===c||(o.value=c,n.value=Wm(n.value,v,c),Nd(n.value))}function a(d,c){const v=c==="plan"?"plan":"default";n.value=Wm(n.value,d,v),d.trim()===e.value&&(o.value=v),Nd(n.value)}function s(d){o.value=Md(n.value,d)}function i(d){const c=gy(n.value,d);c!==n.value&&(n.value=c,s(e.value),Nd(c))}async function l(){try{const d=await Vk();t.value=d,d.some(c=>c.value===o.value)||r("default")}catch{}}return{availableCollaborationModes:t,selectedCollaborationMode:o,pruneThreadCollaborationState:i,refreshCollaborationModes:l,setSelectedCollaborationMode:r,setSelectedCollaborationModeForThread:a,syncSelectedThreadCollaborationMode:s}}const AN=500;function _N(){const e=S(null),t=S([]),n=Y(()=>e.value);let o=null,r=null;function a(d){e.value=d}async function s(){if(r){await r;return}r=(async()=>{try{const d=await NI();a(d),t.value=d?[d]:[]}catch{}finally{r=null}})(),await r}function i(){if(typeof window>"u"){s();return}o!==null&&window.clearTimeout(o),o=window.setTimeout(()=>{o=null,s()},AN)}function l(){o===null||typeof window>"u"||(window.clearTimeout(o),o=null)}return{accountRateLimitSnapshots:t,codexQuota:n,refreshRateLimits:s,scheduleRateLimitRefresh:i,setCodexRateLimit:a,stopRateLimitRefresh:l}}function PN(e){const t=S(dL()),n=S(pL());let o=null;function r(f,b={}){t.value=f,b.persist!==!1&&fL(f)}function a(f,b={}){n.value=f,b.persist!==!1&&hL(f)}async function s(f,b){try{const y=await Wi(),P={...y.labels};let B=!1;for(const $ of y.order){if(!Du($,f))continue;const j=b.trim();j.length===0?P[$]!==void 0&&(delete P[$],B=!0):P[$]!==j&&(P[$]=j,B=!0)}B&&await xd({order:y.order,labels:P,active:y.active,projectOrder:y.projectOrder})}catch{}}function i(f,b){f.length===0||(n.value[f]??"")===b||(a({...n.value,[f]:b}),o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,s(f,b)},500))}async function l(){try{const f=await Wi(),b=Dj(f,t.value,e.sourceGroups.value);await xd({order:b.order,labels:f.labels,active:b.active,projectOrder:b.projectOrder})}catch{}}async function d(f){var $;if(f.length===0)return;const b=t.value.filter(j=>j!==f);if(Ga(t.value,b)||r(b),e.sourceGroups.value=e.sourceGroups.value.filter(j=>j.projectName!==f),n.value[f]!==void 0){const j={...n.value};delete j[f],a(j)}e.applyThreadFlags();const y=Kn(e.projectGroups.value);e.pruneThreadScopedState(y),y.some(j=>j.id===e.selectedThreadId.value)||e.setSelectedThreadId((($=y[0])==null?void 0:$.id)??"");const B=new Set;try{const j=await Wi();Oj(j,f).forEach(H=>{B.add(H)})}catch{}if(B.size>0)try{const j=await Wi(),H=j.order.filter(ce=>!B.has(ce)),q=j.active.filter(ce=>!B.has(ce)),be=q.length===0&&H.length>0?[H[0]]:q;await xd({order:H,labels:Rj(j.labels,B),active:be,projectOrder:j.projectOrder.filter(ce=>ce!==f&&!B.has(ce))});return}catch{}await l()}function c(f,b){if(f.length===0||e.sourceGroups.value.length===0)return;const y=e.sourceGroups.value.map(H=>H.projectName),P=y.indexOf(f);if(P===-1)return;const B=Math.max(0,Math.min(b,y.length-1)),$=mj(y,P,B);if($===y)return;r(qi($,e.sourceGroups.value));const j=cf(e.sourceGroups.value,t.value);e.sourceGroups.value=tc(e.sourceGroups.value,j),e.applyThreadFlags(),l()}function v(f){const b=f.trim();if(!b)return;const y=[b,...t.value.filter(B=>B!==b)];if(Ga(t.value,y))return;r(y);const P=cf(e.sourceGroups.value,t.value);e.sourceGroups.value=tc(e.sourceGroups.value,P),e.applyThreadFlags(),l()}return{projectDisplayNameById:n,projectOrder:t,persistProjectOrderToWorkspaceRoots:l,pinProjectToTop:v,removeProject:d,renameProject:i,reorderProject:c,setProjectDisplayNames:a,setProjectOrder:r}}const RN=2e3;function EN(e){const t=S([]),n=S([]),o=S(!1);let r=null,a=null,s=!1,i=!1,l=0,d="";async function c(f={}){const b=e.getSelectedCwd().trim(),y=b||"__global__";if(r){await r;return}f.force!==!0&&s&&d===y&&Date.now()-l<RN||(r=(async()=>{try{t.value=await SI(b?[b]:void 0),s=!0,l=Date.now(),d=y}catch{}finally{r=null}})(),await r)}async function v(f={}){if(a){await a;return}f.force!==!0&&i||(o.value=!0,a=(async()=>{try{n.value=await Jk(),i=!0}catch{}finally{o.value=!1,a=null}})(),await a)}return{hooksList:n,installedSkills:t,isHooksLoading:o,refreshHooks:v,refreshSkills:c}}const $y="codex-web-local.stashed-messages.v1",Oy="codex-web-local.auto-compact-threshold.v1",Ru=10,MN=650;function jN(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem($y);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[o,r]of Object.entries(t)){if(!o||!Array.isArray(r))continue;const a=r.filter(s=>!!s&&typeof s=="object"&&typeof s.id=="string"&&typeof s.text=="string");a.length>0&&(n[o]=a)}return n}catch{return{}}}function LN(){if(typeof window>"u")return Ru;try{const e=window.localStorage.getItem(Oy);if(e===null)return Ru;const t=Number(e);return Number.isFinite(t)&&t>=0?Math.round(t):Ru}catch{return Ru}}function NN(e){const t={};for(const[n,o]of Object.entries(e)){const r=n.trim();!r||o.length===0||(t[r]=o.map(a=>({id:a.id,text:a.text,imageUrls:[...a.imageUrls],skills:a.skills.map(s=>({name:s.name,path:s.path})),fileAttachments:a.fileAttachments.map(s=>({label:s.label,path:s.path,fsPath:s.fsPath})),collaborationMode:a.collaborationMode})))}return t}function $N(e){const t=S({}),n=S({}),o=S(jN()),r=S(LN());let a=!1;const s=Y(()=>{const W=e.value;if(!W)return[];const he=t.value[W]??[];return[...(o.value[W]??[]).map(ye=>({...ye,awaitingCompaction:!0})),...he]});function i(){typeof window>"u"||window.localStorage.setItem($y,JSON.stringify(o.value))}function l(){iI(NN(t.value)).catch(()=>{})}async function d(){if(!a){a=!0;try{t.value=await ym()}catch{}}}async function c(W){if(n.value[W]!==!0){n.value={...n.value,[W]:!0};try{t.value=await ym()}catch{}finally{n.value=bt(n.value,W)}}}function v(W){c(W),!(typeof window>"u")&&window.setTimeout(()=>{c(W)},MN)}function f(W){const he=Number.isFinite(W)&&W>0?Math.round(W):0;he!==r.value&&(r.value=he,!(typeof window>"u")&&window.localStorage.setItem(Oy,String(he)))}function b(W){return o.value[W]??[]}function y(W,he){o.value={...o.value,[W]:[...b(W),he]},i()}function P(W){const he=[...b(W)];return he.length===0||(o.value=bt(o.value,W),i()),he}function B(W,he,Se){const ye=[...t.value[W]??[]],X=typeof Se=="number"?Math.max(0,Math.min(Se,ye.length)):ye.length;ye.splice(X,0,he),t.value={...t.value,[W]:ye},l()}function $(W,he){return b(W).find(Se=>Se.id===he)}function j(W,he){var Se;return(Se=t.value[W])==null?void 0:Se.find(_e=>_e.id===he)}function H(W){const he=e.value;if(!he)return;if($(he,W)){const ye=b(he).filter(X=>X.id!==W);o.value=ye.length>0?{...o.value,[he]:ye}:bt(o.value,he),i();return}const Se=t.value[he];if(!Se)return;const _e=Se.filter(ye=>ye.id!==W);t.value=_e.length>0?{...t.value,[he]:_e}:bt(t.value,he),l()}function q(W,he){const Se=e.value;if(!Se)return;const _e=t.value[Se];if(!_e||$(Se,W)||$(Se,he))return;const ye=_e.findIndex(xe=>xe.id===W),X=_e.findIndex(xe=>xe.id===he);if(ye<0||X<0||ye===X)return;const pe=[..._e],[re]=pe.splice(ye,1);pe.splice(X,0,re),t.value={...t.value,[Se]:pe},l()}function be(W){const he=Zt(t.value,W);he!==t.value&&(t.value=he,l())}function ce(){t.value={},n.value={},o.value={},i(),l()}return{appendStashedMessage:y,autoCompactThreshold:r,clearQueueState:ce,enqueueQueuedMessage:B,findQueuedMessage:j,findStashedMessage:$,getStashedMessages:b,loadPersistedQueueStateIfNeeded:d,processQueuedMessages:c,pruneQueueState:be,removeQueuedMessage:H,reorderQueuedMessage:q,scheduleQueueStateRefresh:v,selectedThreadQueuedMessages:s,setAutoCompactThreshold:f,takeStashedMessages:P}}const ON=1e4,DN=2e3;function FN(e){const{selectedThreadId:t,projectGroups:n,inProgressById:o,applyThreadGroups:r,hydrateWorkspaceRootsStateIfNeeded:a,loadThreadTitleCacheIfNeeded:s,loadWorkspaceRootsStateForThreadList:i,pruneThreadScopedState:l,setSelectedThreadId:d}=e,c=S(!1),v=S(!1),f=S(!1);let b=null,y=0,P=null,B=null,$=!1,j=!1,H=[],q=null;function be(pe,re){if(pe.length===0)return re;if(re.length===0)return pe;const xe=new Map;for(const Ne of Kn(pe))xe.set(Ne.id,Ne);for(const Ne of Kn(re))xe.set(Ne.id,Ne);const $e=new Map;for(const Ne of xe.values()){const ae=$e.get(Ne.projectName);ae?ae.push(Ne):$e.set(Ne.projectName,[Ne])}return Array.from($e.entries()).map(([Ne,ae])=>({projectName:Ne,threads:ae.sort((Ee,ke)=>new Date(ke.updatedAtIso).getTime()-new Date(Ee.updatedAtIso).getTime())})).sort((Ne,ae)=>{var Ie,ze;const Ee=new Date(((Ie=Ne.threads[0])==null?void 0:Ie.updatedAtIso)??0).getTime();return new Date(((ze=ae.threads[0])==null?void 0:ze.updatedAtIso)??0).getTime()-Ee})}function ce(){return Object.values(o.value).some(pe=>pe===!0)}function W(pe=q){if(!(!P||$||ce())){if(q=pe,typeof window>"u"){he(pe);return}B!==null&&window.clearTimeout(B),B=window.setTimeout(()=>{B=null,!(!P||ce())&&he(q)},ON)}}async function he(pe){if(!($||!P||ce())){$=!0;try{const re=await sm(P,oI());P=re.nextCursor,j=re.nextCursor===null,f.value=j,H=be(H,re.groups),r(H,pe)}catch{}finally{$=!1,P&&!ce()&&W(pe)}}}async function Se(pe={}){if(b){await b;return}pe.force!==!0&&c.value&&Date.now()-y<DN||(b=(async()=>{var re;c.value||(v.value=!0);try{const[xe,$e]=await Promise.all([sm(),i(),s({force:pe.force===!0})]);q=$e;const Ne=xe.groups;H=Ne,P=xe.nextCursor,j=xe.nextCursor===null,f.value=j,await a(Ne,$e),r(H,$e),c.value=!0,y=Date.now(),j||W($e);const ae=Kn(n.value);l(ae),!ae.some(ke=>ke.id===t.value)&&!t.value&&d(((re=ae[0])==null?void 0:re.id)??"")}finally{v.value=!1}})().finally(()=>{b=null}),await b)}function _e(pe){H=Ty(H,pe)}function ye(){return P!==null}function X(){B!==null&&typeof window<"u"&&(window.clearTimeout(B),B=null)}return{dispose:X,hasActiveInProgressThreads:ce,hasLoadedThreads:c,hasRemainingThreadPages:ye,isLoadingThreads:v,isThreadListFullyLoaded:f,loadThreads:Se,removeThreadFromLoadedLists:_e,scheduleRemainingThreadPages:W}}const tv=2e3;function BN(e){const t=S({}),n=S({}),o=S({}),r=S({}),a=S(!1),s=new Map,i=new Map,l=new Map;let d=0;async function c(y,P={}){var be;if(!y)return;const B=Date.now()-(l.get(y)??0)<tv;if((be=e.turnErrorByThreadId.value[y])!=null&&be.transient&&(P.silent===!0||B))return;const $=s.get(y);if($&&P.force!==!0){await $;return}const j=n.value[y]===!0,H=P.silent!==!0&&!j;H&&(d+=1,a.value=!0);const q=(async()=>{try{const ce=e.currentThreadVersion(y),W=t.value[y]??"",he=Date.now()-(i.get(y)??0)<tv;if(P.force===!0?!1:j&&(he||(ce.length===0||W===ce)&&e.inProgressById.value[y]!==!0)){e.markThreadAsRead(y);return}const ye=e.resumedThreadById.value[y]!==!0?await rf(y):null,X=ye??await of(y);X.modelProvider&&e.setThreadModelProviderId(y,X.modelProvider),X.model&&e.setThreadModelId(y,e.resolveThreadModelForProvider(y,X.model,X.modelProvider)),ye&&(e.resumedThreadById.value={...e.resumedThreadById.value,[y]:!0});const{messages:pe,inProgress:re,activeTurnId:xe,turnIndexByTurnId:$e}=X;o.value={...o.value,[y]:X.hasMoreOlder===!0},e.markThreadMessagesPersisted(y,pe),e.replaceTurnIndexLookupForThread(y,$e),e.rebindLiveFileChangeTurnIndices(y);const Ne=e.persistedMessagesByThreadId.value[y]??[],ae=Vm(Ne,pe,{preserveMissing:P.silent===!0||bj(Ne)});e.setPersistedMessagesForThread(y,ae);const Ee=e.liveAgentMessagesByThreadId.value[y]??[];if(re){const ke=Cj(Ee,pe);e.setLiveAgentMessagesForThread(y,ke)}else e.clearLiveAgentMessagesForThread(y);e.removeLiveCommandsPersistedIn(y,pe),e.removeLiveFileChangesPersistedIn(y,pe),n.value={...n.value,[y]:!0},i.set(y,Date.now()),l.delete(y),ce&&(t.value={...t.value,[y]:ce}),e.setThreadInProgress(y,re),X.externalSession&&(e.externalSessionByThreadId.value={...e.externalSessionByThreadId.value,[y]:X.externalSession}),e.clearTransientTurnErrorForThread(y),xe?e.activeTurnIdByThreadId.value={...e.activeTurnIdByThreadId.value,[y]:xe}:e.activeTurnIdByThreadId.value[y]&&(e.activeTurnIdByThreadId.value=bt(e.activeTurnIdByThreadId.value,y)),re||e.clearCompletedTurnLiveState(y),e.markThreadAsRead(y)}catch(ce){const W=ce instanceof Error?ce.message:"Unknown application error";throw e.selectedThreadId.value===y&&e.setTurnErrorForThread(y,W,{transient:!0}),l.set(y,Date.now()),ce}finally{H&&(d=Math.max(0,d-1),d===0&&(a.value=!1))}})().finally(()=>{s.delete(y)});s.set(y,q),await q}async function v(y=e.selectedThreadId.value){if(!y||r.value[y]===!0||o.value[y]!==!0)return;const P=e.getFirstPersistedTurnId(y);if(!P){o.value={...o.value,[y]:!1};return}r.value={...r.value,[y]:!0};try{const B=await Rk(y,P),$=e.persistedMessagesByThreadId.value[y]??[],j=Vm(B.messages,$,{preserveMissing:!0});e.setPersistedMessagesForThread(y,j),e.replaceTurnIndexLookupForThread(y,{...e.turnIndexByTurnIdByThreadId.value[y]??{},...B.turnIndexByTurnId}),e.rebindLiveFileChangeTurnIndices(y),o.value={...o.value,[y]:B.hasMoreOlder}}catch(B){throw e.error.value=B instanceof Error?B.message:"Failed to load earlier messages",B}finally{r.value={...r.value,[y]:!1}}}async function f(y,P={}){var B;y&&n.value[y]!==!0&&(P.silent===!0&&((B=e.turnErrorByThreadId.value[y])!=null&&B.transient)||await c(y,P))}function b(y){n.value=Zt(n.value,y),t.value=Zt(t.value,y)}return{ensureThreadMessagesLoaded:f,hasMoreOlderMessagesByThreadId:o,isLoadingMessages:a,loadMessages:c,loadOlderMessages:v,loadedMessagesByThreadId:n,loadedVersionByThreadId:t,loadingOlderMessagesByThreadId:r,pruneMessageHistoryState:b}}function UN(e){const t=S({});function n(s){const i=t.value;return Object.keys(i).length===0?s.map(l=>({projectName:l.projectName,threads:l.threads.map(d=>({...d,title:Ps(d.title)}))})):s.map(l=>({projectName:l.projectName,threads:l.threads.map(d=>{const c=i[d.id];return{...d,title:Ps(c??d.title)}})}))}async function o(s={}){if(!(s.force!==!0&&Object.keys(t.value).length>0))try{const i=await dI();if(Object.keys(i.titles).length>0){const l={};for(const[d,c]of Object.entries(i.titles))l[d]=Ps(c);t.value=l}}catch{}}function r(s,i,l){const d=s.trim();if(d)return Ps(d);const c=l.map(v=>v.label.trim()).find(v=>v.length>0);return c?Ps(c):i.length>0?Ps("[Image]"):"Untitled thread"}async function a(s,i,l,d=[],c=[]){if(t.value[s])return;const v=i.trim();if(!v){const b=r(i,d,c);t.value={...t.value,[s]:b},e.applyThreadFlags(),Xu(s,b);return}const f=v.length>300?v.slice(0,300):v;try{const b=await bI(f,l);if(!b||t.value[s])return;const y=b.length>hf?b.slice(0,hf):b;t.value={...t.value,[s]:y},e.applyThreadFlags(),Xu(s,y)}catch{}}return{applyCachedTitlesToGroups:n,loadThreadTitleCacheIfNeeded:o,requestThreadTitleGeneration:a,resolveFallbackThreadTitle:r,threadTitleById:t}}function zN(e){const t=S({}),n=S({});function o(){return{pendingServerRequestsByThreadId:t,pendingReplyErrorByRequestId:n,applyThreadFlags:e.applyThreadFlags}}function r(y){GL(o(),y)}function a(y){VL(o(),y)}function s(y){YL(o(),y)}function i(y){return KL(o(),y)}const l=Y(()=>{const y=[],P=e.getSelectedThreadId();return P&&Array.isArray(t.value[P])&&y.push(...t.value[P]),Array.isArray(t.value[el])&&y.push(...t.value[el]),y.sort((B,$)=>B.receivedAtIso.localeCompare($.receivedAtIso))});function d(y){return y?Array.isArray(t.value[y])?t.value[y]:[]:[]}function c(y){return y.some(P=>OL(P.method))?"approval":y.length>0?"response":null}function v(y){const P={};for(const[B,$]of Object.entries(t.value))(B===el||y.has(B))&&(P[B]=$);t.value=P}async function f(){try{const P=(await gm()).map(B=>jy(B)).filter(B=>B!==null);s(P)}catch{}}async function b(y){try{const P=await gm();for(const B of P){const $=We(B);if(($==null?void 0:$.id)===y)return!0}return!1}catch{return!0}}return{getThreadPendingRequests:d,loadPendingServerRequestsFromBridge:f,pendingReplyErrorByRequestId:n,pendingReplyErrorForRequest:i,pendingRequestStillExistsOnServer:b,pendingServerRequestsByThreadId:t,prunePendingServerRequestsByActiveThreads:v,readPendingRequestState:c,removePendingServerRequestById:a,replacePendingServerRequests:s,selectedThreadServerRequests:l,upsertPendingServerRequest:r}}const Eu=220,HN=3e3,qN=new Set(["account/login/completed","account/updated","authStatusChange","command/exec/outputDelta","configWarning","deprecationNotice","externalAgentConfig/import/completed","externalAgentConfig/import/progress","fs/changed","guardianWarning","item/autoApprovalReview/completed","item/autoApprovalReview/started","item/mcpToolCall/progress","loginChatGptComplete","model/rerouted","model/safetyBuffering/updated","model/verification","process/exited","process/outputDelta","sessionConfigured","thread/environment/connected","thread/environment/disconnected","thread/goal/cleared","thread/goal/updated","thread/realtime/closed","thread/realtime/error","thread/realtime/itemAdded","thread/realtime/outputAudio/delta","thread/realtime/sdp","thread/realtime/started","thread/realtime/transcript/delta","thread/realtime/transcript/done","thread/settings/updated","thread/started","turn/moderationMetadata","warning","windows/worldWritableWarning","windowsSandbox/setupCompleted"]);function WN(e,t){if(t.length===0)return e;const n=new Set(e.map(s=>s.id)),o=new Map,r=[];for(const s of t){const i=s.modelSwitchInsertAfterId;if(i&&n.has(i)){const l=o.get(i)??[];l.push(s),o.set(i,l)}else r.push(s)}const a=[];for(const s of e){a.push(s);const i=o.get(s.id);i&&i.length>0&&a.push(...i)}return r.length>0&&a.push(...r),a}function GN(){const e=S([]),t=S([]),n=S(uL()),o=S(""),r=S({}),a=S({}),s=S(Zj()),i=S({}),l=S({}),d=S(Qj()),c=S(Xj()),v=S({}),f=new Map,b=new Map,y=new Map,P=new Map,B=S({}),$=S({}),j=S({}),q=hN({liveReasoningTextByThreadId:v,inProgressById:j}),be=S({});let ce=!1;const W=S({}),{activeProviderId:he,availableModelIds:Se,availableModelReasoningEfforts:_e,codexCliMissingError:ye,isUpdatingSpeedMode:X,selectedModelId:pe,selectedReasoningEffort:re,selectedSpeedMode:xe,applyFallbackModelSelection:$e,buildPendingTurnDetails:Ne,hasThreadModelSelection:ae,pruneThreadModelState:Ee,readModelIdForThread:ke,refreshModelPreferences:Ie,resolveThreadModelForProvider:ze,setSelectedModelId:st,setSelectedModelIdForThread:tt,setSelectedReasoningEffort:ct,setThreadModelId:ue,setThreadModelProviderId:N,syncSelectedThreadModel:ie,updateSelectedSpeedMode:se}=kN({selectedThreadId:n,error:o}),{availableCollaborationModes:Oe,selectedCollaborationMode:De,pruneThreadCollaborationState:A,refreshCollaborationModes:M,setSelectedCollaborationMode:z,setSelectedCollaborationModeForThread:ee,syncSelectedThreadCollaborationMode:de}=IN(n),te=S(Jj()),Me=S(tL()),{projectDisplayNameById:je,projectOrder:Ce,pinProjectToTop:me,removeProject:Ve,renameProject:Le,reorderProject:He,setProjectDisplayNames:qe,setProjectOrder:dt}=PN({sourceGroups:t,projectGroups:e,selectedThreadId:n,applyThreadFlags:At,pruneThreadScopedState:wr,setSelectedThreadId:Un}),nt=S({}),Ze=S({}),vt=S({}),V=S({}),le=S({}),ge=S({}),Je=BN({selectedThreadId:n,error:o,persistedMessagesByThreadId:r,liveAgentMessagesByThreadId:i,inProgressById:j,externalSessionByThreadId:be,resumedThreadById:nt,turnIndexByTurnIdByThreadId:Ze,turnErrorByThreadId:le,activeTurnIdByThreadId:ge,markThreadAsRead:ss,markThreadMessagesPersisted:Ws,replaceTurnIndexLookupForThread:Qr,rebindLiveFileChangeTurnIndices:bo,setPersistedMessagesForThread:yn,setLiveAgentMessagesForThread:qn,clearLiveAgentMessagesForThread:Ii,removeLiveCommandsPersistedIn:Dt,removeLiveFileChangesPersistedIn:To,setThreadInProgress:Ot,setThreadModelProviderId:N,setThreadModelId:ue,resolveThreadModelForProvider:ze,clearTransientTurnErrorForThread:ro,clearCompletedTurnLiveState:cs,setTurnErrorForThread:Vt,getFirstPersistedTurnId:Ci,currentThreadVersion:yo}),{ensureThreadMessagesLoaded:Tt,hasMoreOlderMessagesByThreadId:St,isLoadingMessages:$t,loadMessages:Rn,loadOlderMessages:cn,loadedMessagesByThreadId:Io,loadedVersionByThreadId:ma,loadingOlderMessagesByThreadId:va,pruneMessageHistoryState:lr}=Je,Bs=UN({applyThreadFlags:At}),{threadTitleById:Ao,applyCachedTitlesToGroups:Xa,loadThreadTitleCacheIfNeeded:Za,requestThreadTitleGeneration:es}=Bs,zo=zN({applyThreadFlags:At,getSelectedThreadId:()=>n.value}),{getThreadPendingRequests:Br,loadPendingServerRequestsFromBridge:ur,pendingReplyErrorByRequestId:Ho,pendingReplyErrorForRequest:ga,pendingRequestStillExistsOnServer:Us,pendingServerRequestsByThreadId:ts,prunePendingServerRequestsByActiveThreads:ya,readPendingRequestState:ho,removePendingServerRequestById:_o,selectedThreadServerRequests:cr,upsertPendingServerRequest:ns}=zo,Po={liveReasoningTextByThreadId:v,persistedReasoningByThreadId:d,turnIndexByTurnIdByThreadId:Ze,activeTurnIdByThreadId:ge,activeReasoningTurnIdByThreadId:P,reasoningItemTextByItemId:b,reasoningAppendedTextByItemId:f,turnItemSequenceByThreadId:y,appendLiveReasoningText:(h,g)=>q.appendLiveReasoningText(h,g),clearLiveReasoningSnapshot:h=>q.clearLiveReasoningSnapshot(h),savePersistedReasoningMap:Ld},it=S({}),kt=S({}),Ct=S({}),qo=S({}),Sn=S({}),{accountRateLimitSnapshots:os,codexQuota:Bn,refreshRateLimits:mo,scheduleRateLimitRefresh:Wo,setCodexRateLimit:dr,stopRateLimitRefresh:an}=_N(),It=S(rL()),Xn=S(iL()),Ro=S(aL()),Zn=S({}),Go=S(!1),Cn=S(!1),xn=S(!1),En=S(new Set),eo=6e4,fr=S([]);let vo="";const Vo=S(!1);function tn(h){var g;try{const I=new URL(h,"http://localhost");return I.pathname!=="/codex-local-image"?"":((g=I.searchParams.get("path"))==null?void 0:g.trim())??""}catch{return""}}function Eo(h){const g=h.trim().toLowerCase();return g?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(g):!1}function Ko(h){var I;const g=r.value[h]??[];for(let L=g.length-1;L>=0;L-=1){const G=g[L];if(!(G.role!=="user"||!Array.isArray(G.images)||G.images.length===0))for(let oe=G.images.length-1;oe>=0;oe-=1){const J=((I=G.images[oe])==null?void 0:I.trim())??"";if(J&&tn(J))return J}}return""}let to=null,Yt=null;const sn=new Map;let Mn=!1,wa=!1;const Ut=new Set;let Ur=!1,jn=!1;const Mo=new Map,jo=new Set,Gt=FN({selectedThreadId:n,projectGroups:e,inProgressById:j,applyThreadGroups:xr,hydrateWorkspaceRootsStateIfNeeded:nu,loadThreadTitleCacheIfNeeded:Za,loadWorkspaceRootsStateForThreadList:Wn,pruneThreadScopedState:wr,setSelectedThreadId:Un}),zs=Y(()=>Kn(e.value)),pr=Y(()=>zs.value.find(h=>h.id===n.value)??null),{appendStashedMessage:zt,autoCompactThreshold:ln,clearQueueState:Hs,enqueueQueuedMessage:Lo,findQueuedMessage:rs,findStashedMessage:ba,getStashedMessages:go,loadPersistedQueueStateIfNeeded:hr,pruneQueueState:no,removeQueuedMessage:mr,reorderQueuedMessage:zr,scheduleQueueStateRefresh:ft,selectedThreadQueuedMessages:gn,setAutoCompactThreshold:Ln,takeStashedMessages:Hr}=$N(n),{hooksList:oo,installedSkills:vr,isHooksLoading:k,refreshHooks:E,refreshSkills:U}=EN({getSelectedCwd:()=>{var h;return((h=pr.value)==null?void 0:h.cwd)??""}}),Ae=Y(()=>{const h=n.value;return!!(h&&Xn.value[h]===!0)}),Ye=Y(()=>{const h=n.value;return h?it.value[h]===!0:!1}),gt=Y(()=>{const h=n.value;return h?ge.value[h]??"":""}),kn=Y(()=>{var Z;const h=n.value;if(!h)return null;const g=j.value[h]===!0,I=g?V.value[h]:void 0,L=g?(v.value[h]??"").trim():"",G=(((Z=le.value[h])==null?void 0:Z.message)??"").trim();let oe="";if(!g&&G){const fe=r.value[h]??[];for(let Te=fe.length-1;Te>=0;Te-=1){const Be=fe[Te];if(Be.messageType==="turnError"){oe=Ja(Be.text);break}}}const J=!g&&G&&oe===G?"":G;return!g&&!I&&!L&&!J?null:{activityLabel:(I==null?void 0:I.label)||"Thinking",activityDetails:(I==null?void 0:I.details)??[],reasoningText:L,errorText:J}}),Rt=Y(()=>{const h=n.value;return h?It.value[h]??null:null}),dn=Y(()=>{const h=n.value;if(!h)return[];const g=r.value[h]??[],I=a.value[h]??[],L=i.value[h]??[],G=B.value[h]??[],oe=$.value[h]??[],J=l.value[h]??[],Z=d.value[h]??[],fe=g.some(Xt=>Xt.messageType==="compaction.done"),Te=En.value.has(h),Be=fe&&!Te?J.filter(Xt=>Xt.messageType!=="compaction.pending"&&Xt.messageType!=="compaction.done"):J,mt=Kj(h,g,Z,[I,G,oe,L],Be),et=vt.value[h],yt=et?_j(mt,et):mt,Et=Pj(yt,c.value[h]),Mt=Ro.value[h]??[];return WN(Et,Mt)}),gr=Y(()=>{const h=n.value;return h?qo.value[h]??null:null}),Ta=Y(()=>{const h=n.value;return h?St.value[h]===!0:!1}),nn=Y(()=>{const h=n.value;return h?va.value[h]===!0:!1});function Ci(h){var I;const g=r.value[h]??[];for(const L of g){const G=((I=L.turnId)==null?void 0:I.trim())??"";if(G)return G}return""}function Un(h,g={}){n.value!==h&&(n.value=h,g.persist!==!1&&cL(h),ie(h),de(h),jn=!1)}function Sa(h,g){const I=h.trim();if(!I)return;if(!g){if(!(I in It.value))return;It.value=bt(It.value,I),$d(It.value);return}const L=It.value[I];if(L&&JSON.stringify(L)===JSON.stringify(g))return;It.value={...It.value,[I]:g},$d(It.value);const G=go(I);G&&G.length>0&&ln.value>0&&(g.remainingContextPercent!==null&&g.remainingContextPercent<=ln.value?En.value.has(I)||ja(I):Xo(I))}function Ca(h,g){Sn.value={...Sn.value,[h]:g}}function qr(h,g,I){var et;const L=h.trim(),G=g.trim(),oe=I.trim();if(!L||!oe||G===oe)return;const J=Ro.value[L]??[],Z=r.value[L]??[],fe=Z.length,Te=Zn.value[L],Be=J.length>0&&Te!==void 0&&Te===fe;let mt;if(Be){const yt=J[J.length-1];mt=[...J.slice(0,-1),{...yt,modelSwitchFrom:G||void 0,modelSwitchTo:oe}]}else{const yt=(et=Z[Z.length-1])==null?void 0:et.id,Et={id:`model-switch:${L}:${Date.now()}:${J.length}`,role:"system",text:"",messageType:py,modelSwitchFrom:G||void 0,modelSwitchTo:oe,...yt?{modelSwitchInsertAfterId:yt}:{}};mt=[...J,Et].slice(-hy)}Ro.value={...Ro.value,[L]:mt},Zn.value={...Zn.value,[L]:fe},sL(Ro.value)}function as(h){const g=h.trim(),I=It.value[g];I&&I.modelContextWindow!==null&&(It.value={...It.value,[g]:{...I,modelContextWindow:null}},$d(It.value))}function xa(h){Sn.value[h]&&(Sn.value=bt(Sn.value,h))}async function ka(h){if(jo.has(h))return;const g=Sn.value[h];if(!(!g||g.fallbackRetried)){jo.add(h),Ca(h,{...g,fallbackRetried:!0});try{await $e(h);try{const I=await Sd(h,1);yn(h,I),Yr(h),qn(h,[]),Kr(h),B.value[h]&&(B.value=bt(B.value,h))}catch{}if(Vt(h,null),o.value="",zn(h,null),on(h,{label:"Thinking",details:Ne(Pr,g.effort,g.collaborationMode)}),Ot(h,!0),nt.value[h]!==!0){const I=await rf(h);I.model&&ue(h,ze(h,I.model,I.modelProvider)),I.modelProvider&&N(h,I.modelProvider),nt.value={...nt.value,[h]:!0}}await Cd(h,g.text,g.imageUrls,Pr,g.effort||void 0,g.skills.length>0?g.skills:void 0,g.fileAttachments,g.collaborationMode),Wo(),Ut.add(h),await Gn()}catch(I){const L=I instanceof Error?I.message:"Unknown application error";Vt(h,L),o.value=L,Ot(h,!1),on(h,null)}finally{jo.delete(h)}}}function Wr(h){if(!h||typeof window>"u")return;const g=sn.get(h);g!==void 0&&(window.clearTimeout(g),sn.delete(h))}function yr(h){if(!h||typeof window>"u")return;Wr(h);const g=window.setTimeout(()=>{sn.delete(h),Ut.add(h),Gn()},HN);sn.set(h,g)}function At(){const g=Xa(t.value).map(I=>({projectName:I.projectName,threads:I.threads.map(L=>{const G=be.value[L.id]??L.externalSession??null,oe=j.value[L.id]===!0||(G==null?void 0:G.active)===!0,J=ho(Br(L.id)),Z=n.value===L.id,fe=W.value[L.id]===!0,Te=pj(L.updatedAtIso,te.value[L.id],Me.value);return{...L,inProgress:oe,unread:!Z&&!oe&&(fe||Te),pendingRequestState:J,...G?{externalSession:G}:{}}})}));e.value=tc(e.value,g)}function Yo(h,g,I){const L=new Date().toISOString(),G=Xe(g),oe=ar(G),J={id:h,title:Ps(I),projectName:oe,cwd:G,hasWorktree:G.includes("/.codex/worktrees/")||G.includes("/.git/worktrees/"),createdAtIso:L,updatedAtIso:L,preview:I,unread:!1,inProgress:!1},Z=t.value.findIndex(Te=>Te.projectName===oe);if(Z>=0){const Be=t.value[Z].threads.filter(yt=>yt.id!==h),mt={projectName:oe,threads:[J,...Be]},et=[...t.value];et.splice(Z,1,mt),t.value=et}else t.value=[{projectName:oe,threads:[J]},...t.value];const fe=qi(Ce.value,t.value);Ga(Ce.value,fe)||dt(fe),At()}function wr(h){const g=new Set(h.map(G=>G.id)),I=n.value.trim();I&&g.add(I),Ee(g),A(g);const L=Zt(te.value,g);if(L!==te.value&&(te.value=L,Jm(L)),lr(g),nt.value=Zt(nt.value,g),Ze.value=Zt(Ze.value,g),r.value=Zt(r.value,g),i.value=Zt(i.value,g),v.value=Zt(v.value,g),B.value=Zt(B.value,g),$.value=Zt($.value,g),vt.value=Zt(vt.value,g),V.value=Zt(V.value,g),le.value=Zt(le.value,g),ge.value=Zt(ge.value,g),P.size>0)for(const G of[...P.keys()])g.has(G)||P.delete(G);Wj(g),it.value=Zt(it.value,g),kt.value=Zt(kt.value,g),Ct.value=Zt(Ct.value,g),no(g),It.value=Zt(It.value,g),W.value=Zt(W.value,g),j.value=Zt(j.value,g),ya(g)}function ss(h){const g=Kn(t.value).find(I=>I.id===h);g&&(te.value={...te.value,[h]:g.updatedAtIso},Jm(te.value),W.value[h]&&(W.value=bt(W.value,h)),At())}function zn(h,g){if(!h)return;const I=vt.value[h];if(g){if(kj(I,g))return;vt.value={...vt.value,[h]:g}}else I&&(vt.value=bt(vt.value,h))}function Ia(h,g,I){if(!h||!g)return;const L={...c.value[h]??{}},G=Number.isFinite(I)?Math.max(0,Math.round(I)):0;G<=0?delete L[g]:L[g]=G,Object.keys(L).length===0?c.value=bt(c.value,h):c.value={...c.value,[h]:L},Qm(c.value)}function Ot(h,g){!h||j.value[h]===!0===g||(g?(j.value={...j.value,[h]:!0},Sr(h)):(j.value=bt(j.value,h),cs(h),is(h),Xo(h)),At(),!g&&!Gt.hasActiveInProgressThreads()&&Gt.hasRemainingThreadPages()&&Gt.scheduleRemainingThreadPages())}function is(h){h&&(it.value[h]&&(it.value=bt(it.value,h)),kt.value[h]&&(kt.value=bt(kt.value,h)),Ct.value[h]&&(Ct.value=bt(Ct.value,h)))}function ls(h){h&&(it.value={...it.value,[h]:!0},kt.value[h]&&(kt.value=bt(kt.value,h)),Ct.value[h]&&(Ct.value=bt(Ct.value,h)))}function xi(h){h&&it.value[h]===!0&&kt.value[h]===!0&&Ct.value[h]===!0&&is(h)}function Hn(h,g){!h||!g||it.value[h]===!0&&is(h)}function qs(h){const g=Object.keys(it.value);if(g.length===0)return;let I=kt.value,L=!1;for(const G of g)!h.has(G)||I[G]===!0||(I={...I,[G]:!0},L=!0);if(L){kt.value=I;for(const G of g)xi(G)}}function Ws(h,g){h&&it.value[h]===!0&&g.some(I=>I.role==="user")&&(Ct.value[h]!==!0&&(Ct.value={...Ct.value,[h]:!0}),xi(h))}function ki(h){h&&h!==n.value&&W.value[h]!==!0&&(W.value={...W.value,[h]:!0},At())}function on(h,g){if(!h)return;const I=V.value[h];if(!g){I&&(V.value=bt(V.value,h));return}const L=Pa(g.label)||"Thinking",G=g.details.map(Z=>Pa(Z)).filter(Z=>Z.length>0&&Z!==L),oe=Array.from(new Set([...(I==null?void 0:I.details)??[],...G])).slice(-3),J={label:L,details:oe};Ij(I,J)||(V.value={...V.value,[h]:J})}function Vt(h,g,I={}){if(!h)return;const L=le.value[h],G=g?Ja(g):"";if(!G){L&&(le.value=bt(le.value,h));return}const oe=I.transient===!0;(L==null?void 0:L.message)===G&&L.transient===oe||(le.value={...le.value,[h]:{message:G,transient:oe}})}function ro(h){var g;h&&(g=le.value[h])!=null&&g.transient&&Vt(h,null)}function us(){const h=Object.entries(le.value).filter(([,I])=>I==null?void 0:I.transient).map(([I])=>I);if(h.length===0)return;let g=le.value;for(const I of h)g=bt(g,I);le.value=g}function yo(h){const g=Kn(t.value).find(I=>I.id===h);return(g==null?void 0:g.updatedAtIso)??""}function wo(h,g){if(!h)return;const I={...Xn.value};g?I[h]=!0:delete I[h],Xn.value=I,lL(I)}function No(){const h=n.value;h&&wo(h,!Ae.value)}function yn(h,g){const I=r.value[h]??[];cl(I,g)||(r.value={...r.value,[h]:g})}function Aa(h,g,I=[],L=[],G=[]){const oe=r.value[h]??[],J={id:`optimistic-user:${h}:${Date.now()}`,role:"user",text:g,images:I.length>0?[...I]:void 0,skills:L.length>0?L.map(Z=>({name:Z.name,path:Z.path})):void 0,fileAttachments:G.length>0?G.map(Z=>({...Z})):void 0,messageType:"userMessage.optimistic"};yn(h,[...oe,J])}function qn(h,g){Ly(ao,h,g)}function Ii(h){JL(ao,h)}function br(h,g){ZL(ao,h,g)}function Tr(h,g){tN(ao,h,g)}function Ai(h,g){eN(ao,h,g)}function Gr(h,g){q.setLiveReasoningText(h,g)}function Jo(h,g){q.appendLiveReasoningText(h,g)}function Sr(h){q.restoreLiveReasoningSnapshot(h)}function Vr(h){mN(Po,h)}function Kr(h,g=!1){vN(Po,h,g)}function Yr(h){h&&h in a.value&&(a.value=bt(a.value,h))}function Gs(h){h&&h in $.value&&($.value=bt($.value,h))}function cs(h){if(!h)return;Yr(h);const g=s.value[h];if(g&&g.messageType==="plan.live"){const I={...g,messageType:"plan",plan:g.plan?{...g.plan,isStreaming:!1}:g.plan};s.value={...s.value,[h]:I},My(s.value)}Kr(h),Hj(h),on(h,null),n.value,B.value[h]&&(B.value=bt(B.value,h)),ge.value[h]&&(ge.value=bt(ge.value,h)),xa(h)}function ds(h){var Te;if(h.method!=="turn/plan/updated")return null;const g=We(h.params),I=$n(h),L=Re(g==null?void 0:g.turnId)||Re(g==null?void 0:g.turn_id),oe=(Array.isArray(g==null?void 0:g.plan)?g==null?void 0:g.plan:[]).map(Be=>We(Be)).map(Be=>({step:Re(Be==null?void 0:Be.step),status:mL(Be==null?void 0:Be.status)})).filter(Be=>Be.step.length>0);if(!I||!L)return null;const Z={explanation:Re(g==null?void 0:g.explanation).trim()||void 0,steps:oe,isStreaming:!0},fe=(Te=Ze.value[I])==null?void 0:Te[L];return{threadId:I,message:{id:`${L}:plan`,role:"assistant",text:vL(Z),messageType:"plan.live",plan:Z,turnId:L||void 0,turnIndex:typeof fe=="number"?fe:void 0}}}function Vs(h){var Be;if(h.method!=="item/plan/delta")return null;const g=We(h.params),I=$n(h),L=Re(g==null?void 0:g.turnId)||Re(g==null?void 0:g.turn_id),G=Re(g==null?void 0:g.delta);if(!I||!L||!G)return null;const oe=`${L}:plan`,J=(a.value[I]??[]).find(mt=>mt.id===oe),Z=`${(J==null?void 0:J.text)??""}${G}`,fe=J!=null&&J.plan?{...J.plan,isStreaming:!0}:void 0,Te=(Be=Ze.value[I])==null?void 0:Be[L];return{threadId:I,message:{id:oe,role:"assistant",text:Z,messageType:"plan.live",plan:fe,turnId:L||void 0,turnIndex:typeof Te=="number"?Te:void 0}}}const ao={liveCommandsByThreadId:B,liveFileChangeMessagesByThreadId:$,liveAgentMessagesByThreadId:i,livePlanMessagesByThreadId:a,lastPlanByThreadId:s},_a={turnIndexByTurnIdByThreadId:Ze,persistedMessagesByThreadId:r,liveFileChangeMessagesByThreadId:$};function _i(h){if(h.method==="server/request"){const g=jy(h.params);return g&&ns(g),!0}if(h.method==="server/request/resolved"){const g=We(h.params),I=g==null?void 0:g.id;return typeof I=="number"&&Number.isInteger(I)&&_o(I),!0}return!1}function Pa(h){return h.replace(/\s+/gu," ").trim()}function Pi(h){return iN(_a,h)}function Jr(h,g,I){lN(_a,h,g,I)}function Qr(h,g){uN(_a,h,g)}function Cr(h,g){return cN(_a,h,g)}function bo(h){dN(_a,h)}function $o(h,g,I){wN(Po,h,g,I)}function Xr(h){bN(Po,h)}function C(h){var fe;if(h.method!=="item/started"&&h.method!=="item/completed")return null;const g=We(h.params),I=We(g==null?void 0:g.item);if(!I||Re(I.type).toLowerCase()!=="plan")return null;const L=$n(h),G=Re(g==null?void 0:g.turnId)||Re(g==null?void 0:g.turn_id),oe=Re(I.id),J=Re(I.text);if(!L||!oe||!J)return null;const Z=L&&G?(fe=Ze.value[L])==null?void 0:fe[G]:void 0;return{threadId:L,message:{id:oe,role:"assistant",text:J,messageType:h.method==="item/completed"?"plan":"plan.live",plan:fy(J)??void 0,turnId:G||void 0,turnIndex:typeof Z=="number"?Z:void 0}}}function R(h){var Te;if(h.method!=="item/started")return null;const g=We(h.params),I=We(g==null?void 0:g.item);if(!I||I.type!=="commandExecution")return null;const L=Re(I.id),G=Re(I.command);if(!L)return null;const oe=typeof I.cwd=="string"?I.cwd:null,J=$n(h),Z=Re(g==null?void 0:g.turnId)||Re(g==null?void 0:g.turn_id),fe=J&&Z?(Te=Ze.value[J])==null?void 0:Te[Z]:void 0;return{id:L,role:"system",text:G,messageType:"commandExecution",commandExecution:{command:G,cwd:oe,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:Z||void 0,turnIndex:typeof fe=="number"?fe:void 0}}function x(h){var yt;if(h.method!=="item/completed")return null;const g=We(h.params),I=We(g==null?void 0:g.item);if(!I||I.type!=="commandExecution")return null;const L=Re(I.id),G=Re(I.command);if(!L)return null;const oe=typeof I.cwd=="string"?I.cwd:null,J=Re(I.status),Z=J==="failed"?"failed":J==="declined"?"declined":J==="interrupted"?"interrupted":"completed",fe=typeof I.aggregatedOutput=="string"?I.aggregatedOutput:"",Te=typeof I.exitCode=="number"?I.exitCode:null,Be=$n(h),mt=Re(g==null?void 0:g.turnId)||Re(g==null?void 0:g.turn_id),et=Be&&mt?(yt=Ze.value[Be])==null?void 0:yt[mt]:void 0;return{id:L,role:"system",text:G,messageType:"commandExecution",commandExecution:{command:G,cwd:oe,status:Z,aggregatedOutput:fe,exitCode:Te},turnId:mt||void 0,turnIndex:typeof et=="number"?et:void 0}}function K(h){var Te;if(h.method!=="item/completed")return null;const g=We(h.params),I=We(g==null?void 0:g.item);if(!I||I.type!=="fileChange")return null;const L=Re(I.id);if(!L)return null;const G=Re(g==null?void 0:g.threadId),oe=Re(g==null?void 0:g.turnId),J=G&&oe?(Te=Ze.value[G])==null?void 0:Te[oe]:void 0,Z=tf(I.changes),fe=Hg(I.status);return Z.length===0||fe!=="completed"?null:{id:L,role:"system",text:"",messageType:"fileChange",fileChangeStatus:fe,fileChanges:Z,turnId:oe||void 0,turnIndex:typeof J=="number"?J:void 0}}function Ke(h,g){nN(ao,h,g)}function Dt(h,g){oN(ao,h,g)}function To(h,g){rN(ao,h,g)}function so(h){if(h.method==="item/agentMessage/delta")return!0;const g=We(h.params);if(!g)return!1;if(h.method==="item/completed"){const I=We(g.item);return(I==null?void 0:I.type)==="agentMessage"}return!1}const Jt=new Set;function Zr(h){for(const g of Jt)try{g(h)}catch{}}function ea(h){return Jt.add(h),()=>{Jt.delete(h)}}function fs(h,g,I){aN(ao,h,g,I)}function ps(h,g,I){sN(ao,h,g,I)}function Ra(h){var Fo,vs,Mi,pn,Vn,Bo,ji,er;if(_i(h))return;if(Xr(h),h.method==="turn/started"){const Pe=$n(h);Pe&&y.delete(Pe)}if(qN.has(h.method))return;if(h.method==="app/list/updated"||h.method==="mcpServer/startupStatus/updated"||h.method==="mcpServer/oauthLogin/completed"||h.method==="remoteControl/status/changed"){Zr(h.method);return}if(h.method==="skills/changed"){U({force:!0});return}if(h.method==="hook/started"||h.method==="hook/completed"){E({force:!0});return}if(h.method==="thread/status/changed"){const Pe=$n(h);Pe&&Pe===n.value&&Ut.add(Pe);return}if(h.method==="thread/archived"||h.method==="thread/unarchived"||h.method==="thread/deleted"||h.method==="thread/closed")return;if(h.method==="item/fileChange/patchUpdated"||h.method==="turn/diff/updated"){const Pe=We(h.params),_t=Re(Pe==null?void 0:Pe.threadId);_t&&(h.method==="item/fileChange/patchUpdated"?fs(_t,Re(Pe==null?void 0:Pe.itemId),tf(Pe==null?void 0:Pe.changes)):ps(_t,Re(Pe==null?void 0:Pe.turnId),Re(Pe==null?void 0:Pe.diff)??""),_t===n.value&&Ut.add(_t));return}if(h.method==="account/rateLimits/updated"&&Wo(),h.method==="thread/name/updated"){const Pe=We(h.params),_t=Re(Pe==null?void 0:Pe.threadId),hn=Re(Pe==null?void 0:Pe.threadName);if(_t&&hn){const Na=Ps(hn);Ao.value={...Ao.value,[_t]:Na},At(),Xu(_t,Na)}}if(h.method==="thread/compacted"){const Pe=We(h.params),_t=Re(Pe==null?void 0:Pe.threadId);_t&&(sa(_t,!1),Qs(_t,"done"),Ut.add(_t));return}if(h.method==="fuzzyFileSearch/sessionUpdated"){const Pe=We(h.params),_t=Re(Pe==null?void 0:Pe.sessionId);_t&&_t===vo&&(fr.value=Mx(Pe));return}if(h.method==="fuzzyFileSearch/sessionCompleted"){const Pe=We(h.params),_t=Re(Pe==null?void 0:Pe.sessionId);_t&&_t===vo&&(vo="");return}if(h.method==="account/rateLimits/updated"){dr(Yg(h.params));return}const g=yL(h);if(g){Sa(g.threadId,g.usage);return}const I=TL(h);I&&on(I.threadId,I.activity);const L=$n(h),G=bL(h);!G&&L&&ro(L);const oe=SL(h);oe&&(Mo.set(oe.turnId,oe),Jr(oe.threadId,oe.turnId,Pi(oe.threadId)),ge.value={...ge.value,[oe.threadId]:oe.turnId},Hn(oe.threadId,oe.turnId),Yr(oe.threadId),Gs(oe.threadId),zn(oe.threadId,null),Vt(oe.threadId,null),Ot(oe.threadId,!0),ft(oe.threadId),W.value[oe.threadId]&&(W.value=bt(W.value,oe.threadId)));const J=CL(h),Z=wL(h),fe=(J==null?void 0:J.threadId)??$n(h),Te=fe?ke(fe):"",Be=!!fe&&!!Z&&Te!==Pr&&_u(new Error(Z));if(J){Sn.value[J.threadId];const Pe=Mo.get(J.turnId);Pe&&Mo.delete(J.turnId);const _t=js((Fo=We(h.params))==null?void 0:Fo.durationMs)??js((Mi=We((vs=We(h.params))==null?void 0:vs.turn))==null?void 0:Mi.durationMs)??(typeof J.startedAtMs=="number"?J.completedAtMs-J.startedAtMs:null)??(Pe?J.completedAtMs-Pe.startedAtMs:null),hn=typeof _t=="number"?Math.max(0,_t):0;zn(J.threadId,{turnId:J.turnId,durationMs:hn}),Ia(J.threadId,J.turnId,hn),ge.value[J.threadId]&&(ge.value=bt(ge.value,J.threadId)),Ot(J.threadId,!1),on(J.threadId,null),ki(J.threadId),Be||(xa(J.threadId),ft(J.threadId))}if(Z){const Pe=(J==null?void 0:J.threadId)||$n(h);Pe&&Vt(Pe,Z),o.value=Z,Pe&&Be&&ka(Pe)}else J&&Vt(J.threadId,null);if(G){const Pe=L,_t=Pe?ke(Pe):pe.value.trim();Pe&&Vt(Pe,G.message,{transient:G.transient}),o.value=G.message,_t!==Pr&&_u(new Error(G.message))&&(Pe?ka(Pe):$e())}const mt=ds(h);mt&&(br(mt.threadId,mt.message),on(mt.threadId,{label:"Planning",details:((pn=mt.message.plan)==null?void 0:pn.steps.map(Pe=>Pe.step).slice(0,2))??[]}));const et=Vs(h);et&&(br(et.threadId,et.message),on(et.threadId,{label:"Planning",details:[]}));const yt=C(h);if(yt&&(br(yt.threadId,yt.message),on(yt.threadId,{label:"Planning",details:((Vn=yt.message.plan)==null?void 0:Vn.steps.map(Pe=>Pe.step).slice(0,2))??[]})),!L||L!==n.value)return;RL(h);const Et=EL(h);if(Et){const Pe=(i.value[L]??[]).find(pl=>pl.id===Et.messageId),_t=`${(Pe==null?void 0:Pe.text)??""}${Et.delta}`,hn=Et.turnId??(Pe==null?void 0:Pe.turnId),Na=hn?(Bo=Ze.value[L])==null?void 0:Bo[hn]:Pe==null?void 0:Pe.turnIndex;Tr(L,{id:Et.messageId,role:"assistant",text:_t,messageType:"agentMessage.live",turnId:hn,turnIndex:typeof Na=="number"?Na:void 0})}const Mt=ML(h);if(Mt){const Pe=Mt.turnId?(ji=Ze.value[L])==null?void 0:ji[Mt.turnId]:void 0;Tr(L,{...Mt,turnIndex:typeof Pe=="number"?Pe:void 0})}const Xt=NL(h);Xt&&Tr(L,Xt),xL(h)&&Vr(L);const un=kL(h);un&&(Jo(L,un.delta),SN(Po,un.itemId,un.delta));const La=PL(h);if(La&&($o(L,La.itemId,La.text),Vr(L)),IL(h)){const Pe=v.value[L]??"";Pe.trim().length>0&&!Pe.endsWith(`
|
|
75
|
+
|
|
76
|
+
`)&&Gr(L,`${Pe}
|
|
77
|
+
|
|
78
|
+
`)}AL(h);const Zo=R(h);Zo&&(Ke(L,Zo),on(L,{label:"Running command",details:[((er=Zo.commandExecution)==null?void 0:er.command)??""]}));const Ei=$L(h);if(Ei){const Pe=(B.value[L]??[]).find(_t=>_t.id===Ei.itemId);Pe!=null&&Pe.commandExecution&&Ke(L,{...Pe,commandExecution:{...Pe.commandExecution,aggregatedOutput:`${Pe.commandExecution.aggregatedOutput}${Ei.delta}`}})}const iu=x(h);iu&&Ke(L,iu);const la=K(h);if(la&&Ai(L,la),so(h)&&Kr(L,!0),h.method==="turn/completed"){jn=!1,Kr(L),ev(Po),B.value[L]&&(B.value=bt(B.value,L));const Pe=$n(h);Pe&&(Wr(Pe),Ot(Pe,!1),on(Pe,null),ki(Pe),Be||(xa(Pe),ft(Pe)))}}function xc(h){if(h.method==="thread/tokenUsage/updated"||h.method.startsWith("thread/realtime/"))return;const g=h.method,I=g==="turn/started"||g==="turn/completed"||g==="error",L=g.startsWith("thread/")||g==="turn/completed";if(!I&&!L)return;const G=$n(h);G&&I&&Ut.add(G),L&&(Mn=!0,wa=!0),!(Yt!==null||typeof window>"u")&&(Yt=window.setTimeout(()=>{Yt=null,Gn()},Eu))}async function nu(h,g){if(!Ur){Ur=!0;try{if(!g)return;const I=[];for(const L of Cc(g)){const G=bi(L);I.includes(G)||I.push(G)}if(I.length>0){const L=g.projectOrder.length>0?qi(I,h):qi(Ce.value,h);Ga(Ce.value,L)||dt(L,{persist:!1})}if(Object.keys(g.labels).length>0||(g.remoteProjects??[]).length>0){const L={...je.value};let G=!1;for(const[oe,J]of Object.entries(g.labels)){const Z=Xe(oe).trim(),fe=[bi(oe)];Z&&fe.push(Z);for(const Te of fe)L[Te]!==J&&(L[Te]=J,G=!0)}for(const oe of g.order){const J=bi(oe),Z=ar(Xi(oe));if(!Z.startsWith(".")||Z===J)continue;const fe=`${J} ${Z}`;L[J]!==void 0||L[J]===fe||(L[J]=fe,G=!0)}for(const oe of g.remoteProjects??[]){const J=$j(oe);L[oe.id]!==J&&(L[oe.id]=J,G=!0)}G&&qe(L,{persist:!1})}}catch{}}}async function Wn(){try{return await Wi()}catch{return null}}function ta(h,g){const I=pf(h,g),L=Bj(h,g),G=Uj(L,g,I);if(!g||g.order.length===0&&(g.remoteProjects??[]).length===0)return G;const oe=new Set;for(const Z of ff(g,I))oe.add(Z);const J=G.filter(Z=>oe.has(Z.projectName)?!0:mf(Z));return Fj(J,g,I)}function xr(h,g){const I=ta(h,g),L=!!(g&&(g.order.length>0||g.projectOrder.length>0||(g.remoteProjects??[]).length>0)),G=g!=null&&g.projectOrder.length?qi(ff(g,pf(h,g)),I):qi(Ce.value,I);Ga(Ce.value,G)||dt(G,{persist:!L});const oe=cf(I,Ce.value);qs(new Set(Kn(oe).map(fe=>fe.id)));const J=Lj(t.value,oe,j.value);t.value=tc(t.value,J),j.value=Zt(j.value,new Set(Kn(t.value).map(fe=>fe.id))),new Set(Kn(t.value).map(fe=>fe.id));const Z={};for(const fe of Kn(t.value))Z[fe.id]=fe.externalSession??be.value[fe.id]??null;be.value=Z,At()}function na(h){Gt.removeThreadFromLoadedLists(h),t.value=Ty(t.value,h),j.value=bt(j.value,h),At()}async function In(h={}){await Promise.allSettled([Ie({providerChanged:h.providerChanged,includeProviderModels:h.includeProviderModels}),mo(),M(),U()])}function Ri(h={}){const g=()=>{In(h)};if(typeof window>"u"){g();return}window.setTimeout(g,0)}async function Ks(h={}){o.value="",ye.value="";const g=h.includeSelectedThreadMessages!==!1,I=h.awaitAncillaryRefreshes===!0;try{if(await hr(),await Gt.loadThreads({force:h.forceThreadRefresh===!0}),g)try{await Rn(n.value)}catch(L){o.value=L instanceof Error?L.message:"Unknown application error"}I?await In({providerChanged:h.providerChanged,includeProviderModels:h.providerChanged===!0||I}):Ri({providerChanged:h.providerChanged,includeProviderModels:!1})}catch(L){o.value=L instanceof Error?L.message:"Unknown application error",yy(L)?ye.value=Ny:ye.value=""}}async function Ea(h){Un(h);try{return await Rn(h),await Ie({includeProviderModels:!0}),U(),"ok"}catch(g){const I=g instanceof Error?g.message:"Unknown application error";o.value=I;const L=dj(g)?"not-found":"error";return h.trim()&&Vt(h,I,{transient:!0}),L}}async function ou(h){const g=n.value===h,I=g?cj(Kn(e.value),h):"";g&&(Un(I),I&&Rn(I,{silent:!0}));try{await Ek(h),na(h),await Gt.loadThreads(),g&&I&&n.value===I&&await Tt(I,{silent:!0})}catch(L){o.value=L instanceof Error?L.message:"Unknown application error"}}async function oa(h,g){const I=g.trim();if(!(!h||!I))try{await Lk(h,I),Ao.value={...Ao.value,[h]:I},At(),Xu(h,I)}catch(L){o.value=L instanceof Error?L.message:"Unknown application error"}}async function Qo(h){var J,Z;const g=h.trim();if(!g)return"";const I=Kn(t.value).find(fe=>fe.id===g),L=((J=I==null?void 0:I.cwd)==null?void 0:J.trim())??"",G=((Z=I==null?void 0:I.title)==null?void 0:Z.trim())??"Forked chat",oe=ke(g);o.value="";try{const fe=await lm(g,L||void 0,oe||void 0),Te=fe.threadId.trim();return Te?(Yo(Te,L,G),ue(Te,fe.model),nt.value={...nt.value,[Te]:!0},Un(Te),await Gt.loadThreads(),await Rn(Te),Te):""}catch(fe){return o.value=fe instanceof Error?fe.message:"Unknown application error",""}}async function ra(h,g){var J;const I=h.trim();if(!I||!Number.isInteger(g)||g<0)return"";if(j.value[I]===!0)return o.value="Finish the current turn before forking from a response.","";if(Io.value[I]!==!0)try{await Rn(I)}catch(Z){return o.value=Z instanceof Error?Z.message:"Unknown application error",""}const L=r.value[I]??[];let G=-1;for(const Z of L)typeof Z.turnIndex=="number"&&Number.isFinite(Z.turnIndex)&&(G=Math.max(G,Z.turnIndex));if(G>=0&&g>G)return"";const oe=Kn(t.value).find(Z=>Z.id===I)??null;try{o.value="";const Z=await lm(I),fe=Z.threadId.trim();if(!fe)return"";const Te=Z.cwd.trim()||((J=oe==null?void 0:oe.cwd)==null?void 0:J.trim())||"",Be=zj((oe==null?void 0:oe.title)||(oe==null?void 0:oe.preview)||"Untitled thread");Yo(fe,Te,Be),ue(fe,Z.model),yn(fe,Z.messages),Io.value={...Io.value,[fe]:!0},nt.value={...nt.value,[fe]:!0},Yr(fe),qn(fe,[]),Kr(fe),B.value[fe]&&(B.value=bt(B.value,fe)),zn(fe,null),on(fe,null),Vt(fe,null),Ot(fe,!1);const mt=G-g;if(mt>0){const et=await Sd(fe,mt);yn(fe,et)}return await oa(fe,Be),Un(fe),Gt.loadThreads().catch(()=>{}),fe}catch(Z){return o.value=Z instanceof Error?Z.message:"Unknown application error",""}}async function fn(h,g,I=[],L=[],G=[]){if(!h||!g.trim()||I.length>0||L.length>0||G.length>0)return!1;const J=(ts.value[h]??[]).filter(Te=>Te.method==="item/tool/requestUserInput");if(J.length!==1)return!1;const[Z]=J,fe=WL(Z);return fe.length!==1?!1:su({id:Z.id,result:{answers:{[fe[0]]:{answers:[g.trim()]}}}})}async function hs(h,g,I,L,G,oe){if(ce||ln.value<=0||j.value[h]===!0)return!1;const J=It.value[h];if(!J||J.remainingContextPercent===null||J.remainingContextPercent>ln.value)return!1;const Z=`stash-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,fe=oe==="plan"?"plan":oe==="default"?"default":De.value;return zt(h,{id:Z,text:g,imageUrls:I,skills:L,fileAttachments:G,collaborationMode:fe}),En.value.has(h)||ja(h),!0}async function Xo(h){const g=go(h);if(!g||g.length===0||j.value[h]===!0)return;const I=Hr(h);ce=!0;try{for(const L of I)try{await kr(L.text,L.imageUrls,L.skills,"steer",L.fileAttachments,void 0,L.collaborationMode)}catch{}}finally{ce=!1}}async function kr(h,g=[],I=[],L="steer",G=[],oe,J){if(X.value)return;const Z=n.value,fe=h.trim();if(!Z||!fe&&g.length===0&&G.length===0||await fn(Z,fe,g,I,G)||await hs(Z,fe,g,I,G,J))return;const Te=j.value[Z]===!0;if(Te&&L==="queue"){const Be=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;Lo(Z,{id:Be,text:fe,imageUrls:g,skills:I,fileAttachments:G,collaborationMode:J==="plan"?"plan":J==="default"?"default":De.value},oe);return}if(Te){jn=!0,Aa(Z,fe,g,I,G),aa(Z,fe,g,I,G,J).catch(Be=>{const mt=Be instanceof Error?Be.message:"Unknown application error";Vt(Z,mt),o.value=mt});return}o.value="",jn=!0,zn(Z,null),Aa(Z,fe,g,I,G),on(Z,{label:"Thinking",details:Ne(ke(Z),re.value,J==="plan"?"plan":J==="default"?"default":De.value)}),Vt(Z,null),Ot(Z,!0);try{await aa(Z,fe,g,I,G,J)}catch(Be){jn=!1,Ot(Z,!1),on(Z,null);const mt=Be instanceof Error?Be.message:"Unknown application error";throw Vt(Z,mt),o.value=mt,Be}}async function Ys(h,g,I=[],L=[],G=[]){if(X.value)return"";const oe=h.trim(),J=g.trim(),Z=ke(Wa).trim(),fe=De.value;if(!oe&&I.length===0&&G.length===0)return"";Go.value=!0,o.value="";let Te="";try{try{const yt=await im(J||void 0,Z||void 0);Te=yt.threadId,ue(Te,yt.model),N(Te,yt.modelProvider||he.value),ee(Te,fe)}catch(yt){if(Z&&Z!==Pr&&_u(yt)){await $e();const Et=await im(J||void 0,Pr);Te=Et.threadId,ue(Te,Et.model),N(Te,Et.modelProvider||he.value),ee(Te,fe)}else throw yt}if(!Te)return"";Yo(Te,J,oe||"[Image]"),Aa(Te,oe,I,L,G),ls(Te),nt.value={...nt.value,[Te]:!0},Un(Te),jn=!0,zn(Te,null),on(Te,{label:"Thinking",details:Ne(ke(Te),re.value,fe)}),Vt(Te,null),Ot(Te,!0);const Be=Te,mt=J||null,et=oe;return aa(Te,oe,I,L,G,fe).catch(yt=>{jn=!1,Ot(Te,!1),on(Te,null);const Et=yt instanceof Error?yt.message:"Unknown application error";Vt(Te,Et),o.value=Et}).finally(()=>{Go.value=!1}),es(Be,et,mt,I,G),Te}catch(Be){jn=!1,Te&&(Ot(Te,!1),on(Te,null));const mt=Be instanceof Error?Be.message:"Unknown application error";throw Te&&Vt(Te,mt),o.value=mt,Go.value=!1,Be}}async function aa(h,g,I=[],L=[],G=[],oe){const J=re.value,Z=oe==="plan"?"plan":oe==="default"?"default":De.value,fe=g.trim(),Te=[...I];if(Te.length===0&&Eo(fe)){const et=Ko(h);et&&Te.push(et)}const Be=L.map(et=>({name:et.name,path:et.path})),mt=G.map(et=>({...et}));Ca(h,{text:fe,imageUrls:[...Te],skills:Be,fileAttachments:mt,effort:J,collaborationMode:Z,fallbackRetried:!1});try{if(nt.value[h]!==!0){const Et=ae(h),Mt=await rf(h);Mt.model&&!Et&&ue(h,ze(h,Mt.model,Mt.modelProvider)),Mt.modelProvider&&N(h,Mt.modelProvider),nt.value={...nt.value,[h]:!0}}const et=ke(h);let yt="";try{yt=await Cd(h,g,Te,et||void 0,J||void 0,L.length>0?L:void 0,G,Z)}catch(Et){if(et&&et!==Pr&&_u(Et))await $e(h),Ca(h,{text:fe,imageUrls:[...Te],skills:Be,fileAttachments:mt,effort:J,collaborationMode:Z,fallbackRetried:!0}),yt=await Cd(h,g,Te,Pr,J||void 0,L.length>0?L:void 0,G,Z);else throw Et}yt&&(ge.value={...ge.value,[h]:yt},Hn(h,yt)),Ut.add(h),await Gn(),yr(h)}catch(et){throw et}}async function Ma(){const h=n.value;if(!h||j.value[h]!==!0||it.value[h]===!0)return;let g=ge.value[h];if(!g){const{activeTurnId:oe}=await of(h);g=oe,g&&(ge.value={...ge.value,[h]:g})}if(!g)throw new Error("Could not determine active turn id for interrupt");const I=dn.value.filter(oe=>oe.turnId===g),L=I.find(oe=>oe.role==="user"),G=I.some(oe=>{if(oe.role==="assistant")return!0;const J=oe.messageType??"";return J==="commandExecution"||J==="toolCall"||J==="worked"||J==="fileChange"||J==="plan"||J==="plan.live"||J==="compaction.done"||J==="turnError"});Cn.value=!0,o.value="";try{if(await $k(h,g),Ot(h,!1),on(h,null),Vt(h,null),ge.value[h]&&(ge.value=bt(ge.value,h)),Ut.add(h),Mn=!0,await Gn(),L&&!G){const oe=(r.value[h]??[]).filter(Z=>Z.turnId!==g);yn(h,oe);const J=d.value[h];if(J){const Z=J.filter(fe=>fe.turnId!==g);Z.length!==J.length&&(d.value={...d.value,[h]:Z},Ld(d.value))}qo.value={...qo.value,[h]:{text:L.text??"",imageUrls:L.images??[],fileAttachments:(L.fileAttachments??[]).map(Z=>({label:Z.label,path:Z.path,fsPath:Z.fsPath??Z.path})),skills:L.skills??[]}}}}catch(oe){const J=oe instanceof Error?oe.message:"Failed to interrupt active turn";Vt(h,J),o.value=J}finally{Cn.value=!1}}function Js(h){h&&qo.value[h]&&(qo.value=bt(qo.value,h))}async function kc(h,g,I){var G;return((G=pr.value)==null?void 0:G.historyMode)==="paginated"&&I?await Nk(h,I):await Sd(h,g)}async function Ic(h){var I,L,G,oe,J;const g=n.value;if(g&&!xn.value&&h.trim()){xn.value=!0,o.value="";try{j.value[g]===!0&&await Ma();const Z=r.value[g]??[],fe=Z.find(Mt=>Mt.turnId===h),Te=Z.reduce((Mt,Xt)=>typeof Xt.turnIndex=="number"&&Xt.turnIndex>Mt?Xt.turnIndex:Mt,-1);if(Te<0)return;let Be=typeof(fe==null?void 0:fe.turnIndex)=="number"?fe.turnIndex:((I=Ze.value[g])==null?void 0:I[h])??-1;(Be<0||Be>Te)&&(console.warn(`[rollback] turn ${h} not resolvable (index=${Be}), clamping to newest turn`),Be=Te);const mt=Te-Be+1;let et=((L=fe==null?void 0:fe.turnId)==null?void 0:L.trim())??"";if(!et){const Mt=Z.reduce((Xt,Do)=>{const un=typeof Do.turnIndex=="number"?Do.turnIndex:-1,La=Xt!==null&&typeof Xt.turnIndex=="number"?Xt.turnIndex:-1;return un>=0&&un>La?Do:Xt},null);et=((G=Mt==null?void 0:Mt.turnId)==null?void 0:G.trim())??""}const yt=await kc(g,mt,et),Et=((J=(oe=pr.value)==null?void 0:oe.cwd)==null?void 0:J.trim())??"";if(Et){const Mt=await pA(g,h,Et);Mt.errors.length>0&&console.warn(`[rollback] file revert for ${g} left errors: ${Mt.errors.join("; ")}`)}yn(g,yt),qn(g,[]),Kr(g),B.value[g]&&(B.value=bt(B.value,g)),zn(g,null),on(g,null),Vt(g,null),Mn=!0,await Gn()}catch(Z){o.value=Z instanceof Error?Z.message:"Failed to rollback thread"}finally{xn.value=!1}}}function Qs(h,g){const L=(l.value[h]??[]).filter(G=>G.messageType!=="compaction.pending"&&G.messageType!=="compaction.done");L.push({id:`compaction:${g}:${h}:${Date.now()}`,role:"system",text:"",messageType:g==="pending"?"compaction.pending":"compaction.done"}),l.value={...l.value,[h]:L}}function sa(h,g){const I=new Set(En.value);g?I.add(h):I.delete(h),En.value=I}function ia(h){vo=h.trim(),fr.value=[]}async function ja(h){const g=h.trim();if(!(!g||En.value.has(g))){sa(g,!0),Qs(g,"pending");try{await jk(g);const I=2e3,L=14,G=Date.now()+eo;let oe=0;for(;Date.now()<G&&oe<L&&En.value.has(g);){if((await of(g)).messages.some(fe=>fe.messageType==="compaction.done")){sa(g,!1),n.value===g&&await Rn(g,{silent:!0,force:!0}),Qs(g,"done"),Xo(g);break}oe+=1,await uj(I)}En.value.has(g)&&(sa(g,!1),Qs(g,"done"),Xo(g))}catch(I){o.value=I instanceof Error?I.message:"Failed to compact thread",sa(g,!1),Qs(g,"done"),Xo(g)}}}async function Gn(){if(Vo.value){typeof window<"u"&&Yt===null&&(Yt=window.setTimeout(()=>{Yt=null,Gn()},Eu));return}Vo.value=!0;const h=Mn,g=wa,I=new Set(Ut);Mn=!1,wa=!1,Ut.clear();try{h&&await Gt.loadThreads({force:g});const L=n.value;if(!L)return;const G=I.has(L),oe=j.value[L]===!0,J=yo(L),Z=ma.value[L]??"";(J.length>0&&J!==Z||G||oe&&Io.value[L]!==!0||h&&Io.value[L]!==!0)&&await Rn(L,{silent:!0,force:G})}catch{}finally{Vo.value=!1,(Mn||Ut.size>0)&&typeof window<"u"&&Yt===null&&(Yt=window.setTimeout(()=>{Yt=null,Gn()},Eu))}}async function ru(){await ur(),Mn=!Gt.hasLoadedThreads.value,n.value&&Io.value[n.value]!==!0&&Ut.add(n.value),await Gn()}function au(h){const g=We(h.params),I=typeof(g==null?void 0:g.threadId)=="string"?g.threadId.trim():"";if(!I)return;const L=We(g==null?void 0:g.externalSession),G=L&&typeof L.origin=="string"&&L.origin.trim().length>0?{origin:L.origin.trim(),active:L.active===!0,lastWriteAt:typeof L.lastWriteAt=="string"?L.lastWriteAt:null}:null;be.value={...be.value,[I]:G},Ot(I,(G==null?void 0:G.active)===!0),At(),Mn=!0,n.value===I&&Ut.add(I),Yt===null&&typeof window<"u"&&(Yt=window.setTimeout(()=>{Yt=null,Gn()},Eu))}function An(){typeof window>"u"||to||(ur(),Oo(),So(),to=rI(h=>{if(h.method==="ready"){us(),ru();return}if(h.method==="externalSessionChanged"){au(h);return}Ra(h),xc(h)}))}async function Oo(){try{const h=await fI(),g=Object.entries(h);if(g.length===0)return;const I={...d.value};let L=!1;for(const[G,oe]of g){const J=oe.filter(Be=>!!Be&&typeof Be.id=="string");if(J.length===0)continue;const Z=I[G]??[],fe=new Set(Z.map(Be=>Be.text)),Te=[...Z];for(const Be of J)fe.has(Be.text)||(Te.push(Be),fe.add(Be.text));I[G]=Te.slice(-20),L=!0}L&&(d.value=I,Ld(I))}catch{}}async function So(){try{const h=await hI(),g=Object.entries(h);if(g.length===0)return;const I={...c.value};let L=!1;for(const[G,oe]of g){if(!G||!oe||typeof oe!="object"||Array.isArray(oe))continue;const J={};for(const[Te,Be]of Object.entries(oe))!Te||typeof Be!="number"||!Number.isFinite(Be)||Be<=0||(J[Te]=Math.round(Be));if(Object.keys(J).length===0)continue;const Z={...I[G]??{},...J},fe=Object.keys(Z);I[G]=fe.length>200?Object.fromEntries(fe.slice(-200).map(Te=>[Te,Z[Te]])):Z,L=!0}L&&(c.value=I,Qm(I))}catch{}}async function su(h){try{return await aI(h.id,{result:h.result,error:h.error}),_o(h.id),Ho.value=bt(Ho.value,String(h.id)),!0}catch(g){const I=g instanceof Error?g.message:"Failed to reply to server request";return await Us(h.id)?(o.value=I,Ho.value={...Ho.value,[String(h.id)]:I},!1):(_o(h.id),Ho.value=bt(Ho.value,String(h.id)),!0)}}function ms(){if(to&&(to(),to=null),Mn=!1,Ut.clear(),Mo.clear(),Yt!==null&&typeof window<"u"&&(window.clearTimeout(Yt),Yt=null),an(),Gt.dispose(),typeof window<"u")for(const h of sn.values())window.clearTimeout(h);sn.clear(),jn=!1,r.value={},a.value={},i.value={},v.value={},d.value={},c.value={},B.value={},$.value={},Ze.value={},V.value={},vt.value={},le.value={},ge.value={},P.clear(),ev(Po),y.clear(),qj(),it.value={},kt.value={},Ct.value={},Hs(),dr(null),It.value={}}function Xs(h){const g=n.value;if(!g)return;const I=ba(g,h);if(I){mr(h),z(I.collaborationMode),ce=!0,kr(I.text,I.imageUrls,I.skills,"steer",I.fileAttachments).finally(()=>{ce=!1});return}const L=rs(g,h);L&&(mr(h),z(L.collaborationMode),kr(L.text,L.imageUrls,L.skills,"steer",L.fileAttachments))}function Zs(h,g={}){Un(h,g)}return{projectGroups:e,projectDisplayNameById:je,selectedThread:pr,selectedThreadTokenUsage:Rt,selectedThreadTerminalOpen:Ae,isSelectedThreadInterruptPending:Ye,selectedThreadServerRequests:cr,selectedLiveOverlay:kn,selectedActiveTurnId:gt,lastPlanByThreadId:s,resolveThreadTurnIndex:Cr,codexQuota:Bn,selectedThreadId:n,availableCollaborationModes:Oe,availableModelIds:Se,availableModelReasoningEfforts:_e,selectedCollaborationMode:De,selectedModelId:pe,selectedReasoningEffort:re,selectedSpeedMode:xe,codexCliMissingError:ye,installedSkills:vr,accountRateLimitSnapshots:os,messages:dn,hasMoreOlderMessages:Ta,isLoadingThreads:Gt.isLoadingThreads,isThreadListFullyLoaded:Gt.isThreadListFullyLoaded,isLoadingMessages:$t,isLoadingOlderMessages:nn,isSendingMessage:Go,isInterruptingTurn:Cn,isUpdatingSpeedMode:X,isRollingBack:xn,compactingThreadIds:En,fuzzyFileSearchResults:fr,registerFuzzyFileSearchSession:ia,error:o,refreshAll:Ks,refreshSkills:U,refreshHooks:E,hooksList:oo,isHooksLoading:k,onRealtimeEvent:ea,selectThread:Ea,loadMessages:Rn,loadOlderMessages:cn,ensureThreadMessagesLoaded:Tt,setThreadTerminalOpen:wo,toggleSelectedThreadTerminal:No,archiveThreadById:ou,compactThreadById:ja,renameThreadById:oa,forkThreadById:Qo,forkThreadFromTurn:ra,rollbackSelectedThread:Ic,sendMessageToSelectedThread:kr,sendMessageToNewThread:Ys,interruptSelectedThreadTurn:Ma,interruptedUnsubmittedMessage:gr,clearInterruptedUnsubmittedMessage:Js,selectedThreadQueuedMessages:gn,removeQueuedMessage:mr,reorderQueuedMessage:zr,steerQueuedMessage:Xs,autoCompactThreshold:ln,setAutoCompactThreshold:Ln,setSelectedCollaborationMode:z,readModelIdForThread:ke,setSelectedModelIdForThread:tt,injectModelSwitchDivision:qr,invalidateThreadContextWindow:as,setSelectedModelId:st,setSelectedReasoningEffort:ct,updateSelectedSpeedMode:se,respondToPendingServerRequest:su,pendingReplyErrorForRequest:ga,renameProject:Le,removeProject:Ve,reorderProject:He,pinProjectToTop:me,startPolling:An,stopPolling:ms,primeSelectedThread:Zs}}const Dy="codex-web-local.sidebar-collapsed.v1",Fy="codex-web-local.accounts-section-collapsed.v1";function VN(){return typeof window>"u"?!1:window.localStorage.getItem(Dy)==="1"}function KN(e){typeof window>"u"||window.localStorage.setItem(Dy,e?"1":"0")}function YN(){if(typeof window>"u")return!0;const e=window.localStorage.getItem(Fy);return e===null?!0:e==="1"}function JN(){const e=S(VN()),t=S(YN()),n=S(""),o=S(!1),r=S(null),a=S(null);let s=0,i=0,l=!1;function d($){var j;if(e.value!==$){if($){const H=(j=f())==null?void 0:j.scrollTop;typeof H=="number"&&(H>0||s===0)&&(s=H)}e.value=$,KN($),$||y()}}function c(){o.value=!o.value,o.value?Ft(()=>{var $;return($=a.value)==null?void 0:$.focus()}):n.value=""}function v(){var $;n.value="",($=a.value)==null||$.focus()}function f(){return r.value?r.value:typeof document>"u"?null:document.querySelector(".mobile-drawer .sidebar-scrollable, .sidebar-scrollable")}function b($){if(e.value||l)return;const H=($==null?void 0:$.currentTarget)&&typeof HTMLElement<"u"&&$.currentTarget instanceof HTMLElement?$.currentTarget:f();s=(H==null?void 0:H.scrollTop)??s}function y(){const $=++i,j=s,H=90;l=!0;const q=()=>{$===i&&(s=j,l=!1)},be=ce=>{if($!==i)return;if(e.value){q();return}const W=f();if(W&&(W.scrollTop=j,Math.abs(W.scrollTop-j)<=1||ce>=H)){q();return}if(ce>=H||typeof window>"u"){q();return}window.requestAnimationFrame(()=>be(ce+1))};Ft(()=>be(0))}function P($){$.key==="Escape"&&(o.value=!1,n.value="")}function B(){t.value=!t.value,!(typeof window>"u")&&window.localStorage.setItem(Fy,t.value?"1":"0")}return{isSidebarCollapsed:e,isAccountsSectionCollapsed:t,sidebarSearchQuery:n,isSidebarSearchVisible:o,sidebarScrollableRef:r,sidebarSearchInputRef:a,setSidebarCollapsed:d,toggleSidebarSearch:c,clearSidebarSearch:v,onSidebarScroll:b,onSidebarSearchKeydown:P,restoreSidebarScrollPosition:y,toggleAccountsSectionCollapsed:B}}const By="codex-web-local.right-panel-width.v1",QN=260,XN=640,nv=320;function Uy(e){return Math.min(XN,Math.max(QN,e))}function ZN(){if(typeof window>"u")return nv;const e=window.localStorage.getItem(By),t=Number(e);return Number.isFinite(t)?Uy(t):nv}function e$(e){typeof window>"u"||window.localStorage.setItem(By,String(e))}function t$(e){const{isMobile:t,canShowRightPanel:n,isVirtualKeyboardOpen:o}=e,r=S("git"),a=S([]),s=S(""),i=Y(()=>a.value.find(ye=>ye.key===s.value)??null),l=S(!1),d=S(!1),c=S(!1),v=S(ZN()),f=S(!1),b=S(!1);let y=null;function P(){y&&(clearTimeout(y),y=null)}function B(){f.value=!1,b.value=!1,P()}function $(ye){ye.preventDefault();const X=ye.clientX,pe=v.value,re=$e=>{const Ne=X-$e.clientX;v.value=Uy(pe+Ne)},xe=()=>{e$(v.value),window.removeEventListener("mousemove",re),window.removeEventListener("mouseup",xe)};window.addEventListener("mousemove",re),window.addEventListener("mouseup",xe)}function j(){n()&&(t()&&!d.value&&(d.value=!0),t()||(c.value=!1),r.value=r.value==="terminal"?"git":"terminal",r.value!=="terminal"&&B())}function H(ye){r.value=ye,l.value=!1,t()||(c.value=!1),t()&&(d.value=!0),ye!=="terminal"&&B()}function q(ye){const X=a.value.find(pe=>pe.path===ye.path);if(X)s.value=X.key;else{const pe={key:`preview-${Date.now()}`,path:ye.path,label:ye.label};a.value=[...a.value,pe],s.value=pe.key}H("preview")}function be(ye){a.value.some(X=>X.key===ye)&&(s.value=ye,H("preview"))}function ce(ye){const X=a.value.findIndex(xe=>xe.key===ye);if(X<0)return;const pe=a.value.filter(xe=>xe.key!==ye);if(a.value=pe,s.value!==ye)return;if(pe.length===0){s.value="",r.value="files";return}const re=pe[Math.min(X,pe.length-1)];s.value=re.key}function W(){if(t()){d.value=!1;return}c.value=!0,l.value=!1,B()}function he(){if(t()){d.value=!d.value;return}c.value=!c.value,c.value&&(l.value=!1,B())}function Se(){r.value="git",t()&&(d.value=!1),B()}function _e(ye){if(f.value=ye,!ye){b.value=!1,P();return}b.value=!0,P(),y=setTimeout(()=>{y=null,o()||(b.value=!1)},1500)}return{activeRightPanelTab:r,filePreviewTabs:a,activeFilePreviewTabKey:s,activeFilePreviewTab:i,isRightPanelMenuOpen:l,isMobileRightPanelOpen:d,isRightPanelCollapsed:c,rightPanelWidth:v,isTerminalInputFocused:f,isTerminalKeyboardFocusFallbackActive:b,onRightResizeHandleMouseDown:$,toggleRightPanelTerminal:j,selectRightPanelTab:H,onOpenFilePreview:q,selectFilePreviewTab:be,closeFilePreviewTab:ce,onCloseRightPanel:W,onToggleRightPanelToggle:he,onHideRightPanelTerminal:Se,onTerminalFocusChange:_e,resetTerminalKeyboardFocusState:B,clearTerminalKeyboardFocusFallbackTimer:P}}function n$(e){if(typeof document>"u")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.left="-9999px",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.focus(),t.select(),t.setSelectionRange(0,e.length);try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function o$(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!n$(e))throw new Error("Copy failed")}const r$=400;function a$(e,t,n,o){return e==="visible"&&!n&&t!==null&&o-t>=r$}const s$={class:"sidebar-root"},i$=["aria-pressed","aria-label","title"],l$={key:1,class:"sidebar-search-bar"},u$=["placeholder"],c$=["aria-label"],d$={class:"sidebar-skills-link-icon","aria-hidden":"true"},f$={class:"sidebar-skills-link-copy"},p$={class:"sidebar-skills-link-title"},h$={class:"sidebar-skills-link-subtitle"},m$={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},v$={class:"sidebar-skills-link-copy"},g$={class:"sidebar-skills-link-title"},y$={class:"sidebar-skills-link-subtitle"},w$={class:"sidebar-settings-actions"},b$=["title","aria-label"],T$=["title","aria-label"],S$={class:"content-root-wrap"},C$={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},x$={key:1,class:"skills-route-header-icon","aria-hidden":"true"},k$={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},I$=["aria-label","title"],A$={class:"content-body"},_$={key:2,class:"content-grid content-grid-home"},P$={class:"new-thread-empty"},R$={class:"new-thread-hero"},E$=["title"],M$={class:"new-thread-folder-actions"},j$=["disabled"],L$={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},N$={class:"new-thread-launch-card-copy"},$$={class:"new-thread-launch-card-topline"},O$={class:"new-thread-launch-card-badge","aria-hidden":"true"},D$={class:"new-thread-launch-card-eyebrow"},F$={class:"new-thread-launch-card-title"},B$={class:"new-thread-launch-card-text"},U$={class:"new-thread-launch-card-actions"},z$=["aria-label","onKeydown"],H$={class:"new-thread-open-folder-header"},q$={class:"new-thread-open-folder-title"},W$={class:"new-thread-open-folder-label"},G$={class:"new-thread-open-folder-current"},V$=["placeholder","title","disabled","onKeydown"],K$=["disabled"],Y$={class:"new-thread-open-folder-actions"},J$={class:"new-thread-open-folder-toggle"},Q$=["aria-pressed","disabled"],X$={key:0,class:"new-thread-open-folder-create"},Z$={class:"new-thread-open-folder-create-composer"},eO=["placeholder","onKeydown"],tO=["disabled"],nO={key:0,class:"new-thread-open-folder-error visible-error-with-feedback"},oO=["href"],rO=["placeholder","onKeydown"],aO={key:1,class:"new-thread-open-folder-error-actions"},sO={class:"new-thread-open-folder-error visible-error-with-feedback"},iO=["href"],lO=["disabled"],uO={key:2,class:"new-thread-open-folder-status"},cO={key:3,class:"new-thread-open-folder-status"},dO={key:4,class:"new-thread-open-folder-list"},fO=["title","disabled","onClick"],pO={class:"new-thread-open-folder-item-name"},hO=["disabled","onClick"],mO=["aria-label","onKeydown"],vO={class:"new-thread-open-folder-header"},gO={class:"new-thread-open-folder-title"},yO=["disabled"],wO=["aria-label"],bO=["aria-selected","disabled"],TO=["aria-selected","disabled"],SO={class:"new-thread-project-field"},CO={class:"new-thread-open-folder-label"},xO=["disabled","placeholder"],kO={key:0,class:"new-thread-project-field"},IO={class:"new-thread-open-folder-label"},AO=["disabled","placeholder","onKeydown"],_O={key:1,class:"new-thread-project-field"},PO={class:"new-thread-open-folder-label"},RO=["disabled","onKeydown"],EO={key:2,class:"new-thread-open-folder-error visible-error-with-feedback"},MO=["href"],jO={class:"new-thread-project-modal-actions"},LO=["disabled"],NO=["disabled"],$O={key:3,class:"new-thread-branch-select"},OO={class:"new-thread-branch-select-label"},DO={class:"new-thread-branch-select-help"},FO={key:4,class:"new-thread-runtime-help"},BO={class:"worktree-init-status-title"},UO={class:"worktree-init-status-message"},zO={class:"composer-with-queue"},HO={key:0,class:"composer-runtime-error",role:"alert"},qO=["href"],WO={key:3,class:"content-grid"},GO={class:"content-thread"},VO={key:0,class:"external-session-banner",role:"alert"},KO={key:1,class:"composer-runtime-error",role:"alert"},YO=["href"],JO={key:2,class:"interrupt-recovered-banner",role:"status"},QO=["aria-label"],XO={class:"content-right-panel-header"},ZO={class:"content-right-panel-tabs",role:"tablist"},eD=["aria-selected"],tD=["aria-selected"],nD=["aria-selected","title","onClick"],oD={class:"content-right-panel-tab-label"},rD=["aria-label","title","onClick"],aD={class:"content-right-panel-actions"},sD={class:"content-right-panel-add-wrap"},iD=["aria-label","title"],lD={key:0,class:"content-right-panel-menu"},uD=["aria-label","title"],cD={class:"content-right-panel-body"},dD={key:0,class:"project-zip-modal-backdrop",role:"presentation"},fD=["aria-label"],pD={class:"project-zip-modal-header"},hD={class:"project-zip-modal-title"},mD=["aria-label","disabled"],vD={class:"project-zip-modal-copy"},gD={class:"project-zip-progress-label",role:"status","aria-live":"polite"},yD={class:"project-zip-progress-track"},wD={key:0,class:"project-zip-modal-error",role:"alert"},bD={class:"project-zip-modal-actions"},TD=["disabled"],SD=["disabled"],CD=["disabled"],xD=["aria-label"],kD={class:"codex-login-modal-header"},ID={class:"codex-login-modal-title"},AD=["aria-label","disabled"],_D={class:"codex-login-modal-copy"},PD=["href"],RD=["placeholder","disabled"],ED={key:1,class:"codex-login-modal-error visible-error-with-feedback"},MD=["href"],jD={class:"codex-login-modal-actions"},LD=["disabled"],ND=["disabled"],$D=400,ov="codex-web-local.send-with-enter.v1",rv="codex-web-local.in-progress-send-mode.v1",av="codex-web-local.dark-mode.v1",sv="codex-web-local.dictation-click-to-toggle.v1",iv="codex-web-local.dictation-auto-send.v1",lv="codex-web-local.dictation-language.v1",uv="codex-web-local.chat-width.v1",OD=vn({__name:"App",setup(e){var Hp,qp;const t=Ar(()=>_r(()=>import("./ThreadConversation-9lNMJVzu.js"),__vite__mapDeps([0,1,2]))),n=Ar(()=>_r(()=>import("./ThreadTerminalPanel-ClNIUPAl.js"),__vite__mapDeps([3,4]))),o=Ar(()=>_r(()=>import("./ReviewPane-UleDl12M.js"),__vite__mapDeps([5,6]))),r=Ar(()=>_r(()=>import("./DirectoryHub-BOPhx2Of.js"),__vite__mapDeps([7,1,8]))),a=Ar(()=>_r(()=>import("./AutomationsPanel-Dx0KVoCE.js"),__vite__mapDeps([9,10]))),s=Ar(()=>_r(()=>import("./SettingsDialog-eR-iNCMC.js"),__vite__mapDeps([11,12]))),i=Ar(()=>_r(()=>import("./RightGitPanel-D5vGDcb7.js"),__vite__mapDeps([13,14]))),l=Ar(()=>_r(()=>import("./RightFilesPanel-DNsqEfsl.js"),__vite__mapDeps([15,16]))),d=Ar(()=>_r(()=>import("./RightFilePreview-Baikjk70.js"),__vite__mapDeps([17,18]))),c=Ar(()=>_r(()=>import("./ThreadPendingRequestPanel-BVMOch66.js"),__vite__mapDeps([19,20]))),v=Ar(()=>_r(()=>import("./QueuedMessages-Dq60IlFJ.js"),__vite__mapDeps([21,22]))),{t:f,uiLanguage:b,uiLanguageOptions:y,setUiLanguage:P}=ha(),B="codex-mobile",$="0.1.121",j={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},H={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:q,projectDisplayNameById:be,selectedThread:ce,selectedThreadTokenUsage:W,selectedThreadServerRequests:he,selectedLiveOverlay:Se,lastPlanByThreadId:_e,resolveThreadTurnIndex:ye,selectedActiveTurnId:X,codexQuota:pe,selectedThreadId:re,availableCollaborationModes:xe,availableModelIds:$e,availableModelReasoningEfforts:Ne,selectedCollaborationMode:ae,selectedReasoningEffort:Ee,selectedSpeedMode:ke,codexCliMissingError:Ie,installedSkills:ze,accountRateLimitSnapshots:st,messages:tt,hasMoreOlderMessages:ct,isLoadingThreads:ue,isThreadListFullyLoaded:N,isLoadingMessages:ie,isLoadingOlderMessages:se,isSendingMessage:Oe,isInterruptingTurn:De,isSelectedThreadInterruptPending:A,isUpdatingSpeedMode:M,error:z,refreshAll:ee,refreshSkills:de,refreshHooks:te,hooksList:Me,isHooksLoading:je,onRealtimeEvent:Ce,selectThread:me,ensureThreadMessagesLoaded:Ve,loadMessages:Le,loadOlderMessages:He,archiveThreadById:qe,compactThreadById:dt,compactingThreadIds:nt,fuzzyFileSearchResults:Ze,registerFuzzyFileSearchSession:vt,forkThreadById:V,renameThreadById:le,forkThreadFromTurn:ge,sendMessageToSelectedThread:Je,sendMessageToNewThread:Tt,interruptSelectedThreadTurn:St,interruptedUnsubmittedMessage:$t,clearInterruptedUnsubmittedMessage:Rn,selectedThreadQueuedMessages:cn,removeQueuedMessage:Io,reorderQueuedMessage:ma,steerQueuedMessage:va,autoCompactThreshold:lr,setAutoCompactThreshold:Bs,setSelectedCollaborationMode:Ao,readModelIdForThread:Xa,setSelectedModelIdForThread:Za,injectModelSwitchDivision:es,invalidateThreadContextWindow:zo,setSelectedReasoningEffort:Br,updateSelectedSpeedMode:ur,respondToPendingServerRequest:Ho,pendingReplyErrorForRequest:ga,renameProject:Us,removeProject:ts,reorderProject:ya,pinProjectToTop:ho,startPolling:_o,stopPolling:cr,primeSelectedThread:ns,rollbackSelectedThread:Po}=GN(),it=px(),kt=fx(),{isMobile:Ct}=qf();function qo(){return typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}const Sn=S(null),os=S(null),Bn=S(null);let mo=null;const{buildFeedbackMailto:Wo,feedbackMailtoBase:dr,recordVisibleFailure:an}=iy(),It=dr();function Xn(u,p){p&&an(p);const T=u.currentTarget;T instanceof HTMLAnchorElement&&(T.href=Wo())}const Ro=S(null),Zn=S(null),Go=S(null),Cn=S(0);let xn=null;function En(){const u=Go.value;if(!u)return;const p=window.getComputedStyle(u),T=Number.parseFloat(p.paddingLeft)+Number.parseFloat(p.paddingRight),O=Math.max(0,u.clientWidth-(Number.isFinite(T)?T:0)),Q=window.getComputedStyle(u).getPropertyValue("--chat-column-max").trim(),we=Number.parseFloat(Q)*(Q.endsWith("rem")?16:1),Ue=Number.isFinite(we)&&we>0?Math.min(O,we):O;Cn.value=Ue}const eo=S(null),fr=S(null),vo=S(!0),Vo=t$({isMobile:()=>Ct.value,canShowRightPanel:()=>uu.value,isVirtualKeyboardOpen:()=>vl.value}),{activeRightPanelTab:tn,filePreviewTabs:Eo,activeFilePreviewTabKey:Ko,activeFilePreviewTab:to,isRightPanelMenuOpen:Yt,isMobileRightPanelOpen:sn,isRightPanelCollapsed:Mn,rightPanelWidth:wa,isTerminalInputFocused:Ut,isTerminalKeyboardFocusFallbackActive:Ur,onRightResizeHandleMouseDown:jn,toggleRightPanelTerminal:Mo,selectRightPanelTab:jo,onOpenFilePreview:Gt,selectFilePreviewTab:zs,closeFilePreviewTab:pr,onCloseRightPanel:zt,onToggleRightPanelToggle:ln,onHideRightPanelTerminal:Hs,onTerminalFocusChange:Lo,resetTerminalKeyboardFocusState:rs,clearTerminalKeyboardFocusFallbackTimer:ba}=Vo,go=S(null),hr=S(!1),no=S("");let mr=!1;const zr=S(!1),ft=S(""),gn=S("local"),Ln=S({}),Hr=new Map,oo=S(""),vr=S([]),k=S(!1),E=S({order:[],labels:{},projectOrder:[]}),U=S({phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""}),Ae=S({phase:"idle",title:"",message:""}),Ye=JN(),{isSidebarCollapsed:gt,isAccountsSectionCollapsed:kn,sidebarSearchQuery:Rt,isSidebarSearchVisible:dn,sidebarScrollableRef:gr,sidebarSearchInputRef:Ta,setSidebarCollapsed:nn,toggleSidebarSearch:Ci,clearSidebarSearch:Un,onSidebarScroll:Sa,onSidebarSearchKeydown:Ca,toggleAccountsSectionCollapsed:qr}=Ye,as=S(null),xa=S(null),ka=S(null),Wr=S(null);let yr=null,At=0,Yo=0,wr=0,ss=0;const zn=S("New Project (1)"),Ia=S(""),Ot=S(!1),is=S("general");let ls=0;function xi(){if(Ot.value){ls=Date.now(),Ot.value=!1;return}Date.now()-ls<$D||(Ot.value=!0)}const Hn=S(!1),qs=S(!1),Ws=S(new Set);async function ki(){try{Ws.value=new Set(await Kk())}catch{}finally{qs.value=!0}}const on=Y(()=>!qs.value||Ws.value.has("hooks/list")),Vt=Y(()=>!qs.value||["remoteControl/status/read","remoteControl/enable","remoteControl/pairing/start","remoteControl/client/list"].every(u=>Ws.value.has(u)));ot(Ot,u=>{u&&(te(),Yr(),Vt.value&&Vs())});const ro=S({enabled:!1,clients:[]}),us=S(null),yo=S(!1),wo=S(!1),No=S(""),yn=S(""),Aa=S("");let qn=null,Ii=!1,br=null;const Tr=S("never"),Ai=S(!1),Gr=S(!1),Jo=S(""),Sr=S("");let Vr=!1;const Kr=S(!1);async function Yr(u={}){if(!(u.force!==!0&&Vr)){Ai.value=!0,Jo.value="";try{Tr.value=await PI(),Vr=!0}catch(p){Jo.value=p instanceof Error?p.message:"Failed to load approval policy"}finally{Ai.value=!1}}}function Gs(u){Tr.value=u}async function cs(){Gr.value=!0,Jo.value="",Sr.value="";try{await RI(Tr.value),Kr.value=!0,Sr.value=f("Approval policy saved"),ds&&clearTimeout(ds),ds=setTimeout(()=>{Sr.value=""},2200)}catch(u){Jo.value=u instanceof Error?u.message:"Failed to save approval policy"}finally{Gr.value=!1}}let ds=null;async function Vs(u={}){if(!(u.force!==!0&&Ii)){yo.value=!0,yn.value="";try{const p=await _I();ro.value=p,Ii=!0}catch(p){yn.value=p instanceof Error?p.message:"Failed to load remote control status"}finally{yo.value=!1}}}async function ao(){const u=!ro.value.enabled;wo.value=!0,No.value=u?"enable":"disable";try{await EI(u),ro.value={...ro.value,enabled:u},Pi(u?"Remote control enabled":"Remote control disabled")}catch(p){yn.value=p instanceof Error?p.message:"Failed to update remote control"}finally{wo.value=!1,No.value=""}}async function _a(){wo.value=!0,No.value="pairing";try{us.value=await MI()}catch(u){yn.value=u instanceof Error?u.message:"Failed to start pairing"}finally{wo.value=!1,No.value=""}}async function _i(){wo.value=!0,No.value="clients";try{ro.value={...ro.value,clients:await jI()}}catch(u){yn.value=u instanceof Error?u.message:"Failed to load remote clients"}finally{wo.value=!1,No.value=""}}async function Pa(u){wo.value=!0,No.value=`revoke:${u}`;try{await LI(u),ro.value={...ro.value,clients:ro.value.clients.filter(p=>p.clientId!==u)},Pi("Remote client removed")}catch(p){yn.value=p instanceof Error?p.message:"Failed to remove remote client"}finally{wo.value=!1,No.value=""}}function Pi(u){Aa.value=u,qn&&clearTimeout(qn),qn=setTimeout(()=>{Aa.value=""},3e3)}const Jr=S(""),Qr=S(""),Cr=S([]),bo=S(null),$o=S(null),Xr=S(null),C=S(null),R=S(!1),x=S(!1),K=S({addedLineCount:0,removedLineCount:0}),Ke=S([]),Dt=S(""),To=S({}),so=S(""),Jt=S(""),Zr=S({}),ea=S(""),fs=S(""),ps=S(!1),Ra=S(!1);function xc(u,p){return`${u}\0${p?"with-reset-history":"without-reset-history"}`}const nu=S(null),Wn=S([]),ta=S(!1),xr=S(!1),na=S(!1),In=S(!1),Ri=S(!1),Ks=S(""),Ea=S(""),ou=S(null),oa=S(""),Qo=S(""),ra=S(""),fn=S(""),hs=S(ed(ov,!0)),Xo=S(Qb()),kr=S(Jb()),Ys=S(Xb()),aa=S(ed(sv,!1)),Ma=S(ed(iv,!0)),Js=S(hT()),kc=Y(()=>mT()),Ic=Y(()=>{const{loaded:u,total:p}=U.value,T=bp(u);return p&&p>0?`${T} / ${bp(p)}`:u>0?T:f("Preparing...")}),Qs=Y(()=>{const{loaded:u,total:p,phase:T}=U.value;return T==="ready"?"100%":!p||p<=0?u>0?"55%":"20%":`${Math.min(100,Math.max(5,Math.round(u/p*100)))}%`}),sa=S(!1),ia=S(!1),ja=S(!1),Gn=S(""),ru=S(!1),au=S(null),An=S(!1),Oo=S(""),So=S("codex"),su=Y(()=>[{value:"codex",label:f("Codex")},{value:"openrouter",label:f("OpenRouter")},{value:"opencode-zen",label:f("OpenCode Zen")},{value:"custom",label:f("Custom endpoint")}]),ms=S(""),Xs=S(""),Zs=S("responses"),h=S("responses"),g=S(""),I=S(!1),L=S(""),G=S(""),oe=S(""),J=S(!1),Z=S(!1),fe=S(""),Te=S(""),Be=S(!1),mt=S(!1),et=S("create"),yt=S(""),Et=S(""),Mt=S(""),Xt=S(!1),Do=S(""),un=S(!1),La=S(null),Ac=S(null),Zo=S(!1),Ei=S(null),iu=S(null),la=S(""),Fo=S(""),vs=S(""),Mi=S([]),pn=S(""),Vn=S(!1),Bo=S(!1),ji=S(!1),er=S(""),Pe=[z,Ie,Dt,Jt,fn,Oo,oe,Te,Do,pn],_t=Y(()=>Pe.some(u=>u.value.trim().length>0)),hn=S({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),Na=S(null),pl=S(!1),_c=S(!1),ei=S(typeof window<"u"?((Hp=window.visualViewport)==null?void 0:Hp.height)??window.innerHeight:0),Pc=S(typeof window<"u"?((qp=window.visualViewport)==null?void 0:qp.offsetTop)??0:0),hl=S(typeof window<"u"?window.innerHeight:0);let gs=null,Rc=!1,Ec=!1,Mc=!1,ml=0;const ti=Y(()=>{const u=it.params.threadId;return typeof u=="string"?u:""}),wn=Y(()=>it.name==="home"),ys=Y(()=>it.name==="skills"),ni=Y(()=>it.name==="automations"),tp=Y(()=>{const u=it.query.automationId;return typeof u=="string"?u:""}),zy=Y(()=>{var u;return ni.value?f("Automations"):ys.value?f("Skills"):wn.value?f("Start new thread"):((u=ce.value)==null?void 0:u.title)??f("Choose a thread")}),Hy=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",qy=Y(()=>{var p,T;return(((T=(p=ce.value)==null?void 0:p.title)==null?void 0:T.trim())??"")||Hy}),Li=Y(()=>tt.value.filter(u=>{const p=gT(u.messageType,u.role);return p==="worked"?!0:!(p==="turnActivity.live"||p==="turnError.live"||p==="agentReasoning.live")})),jc=S([]);ot(()=>[Li.value,ie.value],([u,p])=>{p||(jc.value=u)},{immediate:!0});const Wy=Y(()=>ie.value&&jc.value.length>0?jc.value:Li.value),np=new Set(["commandExecution","worked","toolCall","fileChange","agentMessage","agentMessage.live","plan"]),Lc=S(null);function Gy(u,p,T){const O=typeof p.turnIndex=="number"?p.turnIndex:-1;return O<0?!1:u.some((Q,we)=>we>T&&typeof Q.turnIndex=="number"&&Q.turnIndex>=O&&np.has(Q.messageType??""))}function Vy(u,p){return u.some(T=>typeof T.turnIndex=="number"&&T.turnIndex>=p&&np.has(T.messageType??""))}const Nc=Y(()=>{const u=Li.value,p=ie.value;for(let we=u.length-1;we>=0;we-=1){const Ue=u[we];if(Ue.messageType!=="plan"&&Ue.messageType!=="plan.live")continue;const Ht=qm(Ue);if(!Ht||Lc.value!==null&&Ue.id===Lc.value)return null;const CT=p?!0:Gy(u,Ue,we);return{id:Ue.id,streaming:Ue.messageType==="plan.live",explanation:Ht.explanation,steps:Ht.steps,implemented:CT}}const T=re.value?_e.value[re.value]??null:null;if(!T)return null;const O=qm(T);if(!O)return null;const Q=typeof T.turnIndex=="number"?T.turnIndex:T.turnId?ye(re.value,T.turnId)??-1:-1;return{id:T.id,streaming:T.messageType==="plan.live",explanation:O.explanation,steps:O.steps,implemented:p?!0:Q>=0?Vy(u,Q):!1}}),Ky=Y(()=>Se.value),oi=Y(()=>wn.value?"__new-thread__":re.value),op=Y(()=>Xa(oi.value)),lu=Y(()=>{const u=he.value;return u.length>0?u[u.length-1]:null}),Yy=Y(()=>lu.value?ga(lu.value.id):""),bn=Y(()=>{var u,p;return wn.value?ft.value.trim():((p=(u=ce.value)==null?void 0:u.cwd)==null?void 0:p.trim())??""}),uu=Y(()=>vo.value&&(wn.value&&bn.value.length>0||it.name==="thread"&&re.value.length>0)),Jy=Y(()=>uu.value&&tn.value==="terminal"),vl=Y(()=>!Ct.value||ei.value<=0||hl.value<=0?!1:hl.value-ei.value>120),Qy=Y(()=>vl.value||Jy.value&&Ur.value),rp=Y(()=>{var u,p;return((p=(u=ce.value)==null?void 0:u.cwd)==null?void 0:p.trim())??ft.value.trim()}),$c=Y(()=>{var u;return!wn.value&&((u=ce.value)==null?void 0:u.inProgress)===!0}),Xy=Y(()=>{const u=re.value;return!!u&&nt.value.has(u)}),ap=Y(()=>{var u,p;return!wn.value&&((p=(u=ce.value)==null?void 0:u.externalSession)==null?void 0:p.active)===!0}),Oc=Y(()=>Oe.value||De.value||$c.value||he.value.length>0);function sp(){sa.value&&(sa.value=!1,wI(!0))}function Zy(){sp(),kt.push({name:"skills",query:{tab:"plugins"}})}function ew(){const u=re.value;u&&dt(u)}function Dc(u,p){const T=Xe(u).trim(),O=Uo(T);return!T||!O?!1:p.some(Q=>{const we=Xe(Q).trim();return we!==T&&Uo(we)===O})}function Fc(u,p=""){const T=Xe(u).trim(),O=p.trim();if(O)return O;const Q=Uo(T),we=[...E.value.order,...q.value.map(Ue=>{var Ht,Co;return((Co=(Ht=Ue.threads[0])==null?void 0:Ht.cwd)==null?void 0:Co.trim())??""}).filter(Boolean)];return Dc(T,we)?T:Q}function tw(){const u=new Set(E.value.order),p=E.value.projectOrder.filter(T=>u.has(T));for(const T of E.value.order)p.includes(T)||p.push(T);return p}function gl(u){const p=Xe(u).trim(),T=[...E.value.order,...q.value.map(O=>{var Q,we;return((we=(Q=O.threads[0])==null?void 0:Q.cwd)==null?void 0:we.trim())??""}).filter(Boolean)];return Dc(p,T)?p:Uo(p)}function ip(u){const p=Xe(u).trim();if(!p)return"";const T=[...E.value.order,...q.value.map(O=>{var Q,we;return((we=(Q=O.threads[0])==null?void 0:Q.cwd)==null?void 0:we.trim())??""}).filter(Boolean)];for(const O of E.value.order){const Q=Xe(O).trim();if(!Q)continue;const we=Uo(Q),Ue=Dc(Q,T)?Q:we;if(Q===p||Ue===p||we===p)return Q}return""}const Bc=Y(()=>{var O,Q;const u=[],p=new Set;for(const we of tw()){const Ue=we.trim();!Ue||p.has(Ue)||(p.add(Ue),u.push({value:Ue,label:Fc(Ue,E.value.labels[Ue])}))}for(const we of q.value){const Ue=((Q=(O=we.threads[0])==null?void 0:O.cwd)==null?void 0:Q.trim())??"";!Ue||p.has(Ue)||Qu(Ue)||(p.add(Ue),u.push({value:Ue,label:Fc(Ue,be.value[we.projectName])}))}const T=ft.value.trim();return T&&!p.has(T)&&u.unshift({value:T,label:Fc(T)}),u}),ri=Y(()=>{const u=ft.value.trim();return u?Ln.value[u]===!0:!1}),nw=Y(()=>{var p,T;const u={};for(const O of q.value){const Q=$i(O.projectName,((T=(p=O.threads[0])==null?void 0:p.cwd)==null?void 0:T.trim())??"");u[O.projectName]=Q?Ln.value[Q]===!0:!1}return u}),Uc=Y(()=>{const u=oo.value.trim(),p=[...vr.value];return u&&!p.some(T=>T.value===u)&&p.unshift({value:u,label:u}),p}),lp=Y(()=>{const u=oo.value.trim();if(!u)return"";const p=Uc.value.find(T=>T.value===u);return(p==null?void 0:p.label)??u}),up=Y(()=>Fo.value.trim()),cp=Y(()=>{const u=fe.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),ow=Y(()=>cp.value&&up.value.trim().length>0&&!pn.value),dp=Y(()=>{const u=Et.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),fp=Y(()=>yt.value.trim()?et.value==="create"?dp.value:Mt.value.trim().length>0:!1),yl=Y(()=>{const u=Xe(la.value).trim();return u||Fo.value.trim()}),rw=Y(()=>Be.value?"Creating…":"Create"),aw=Y(()=>un.value?et.value==="clone"?f("Cloning…"):f("Creating…"):et.value==="clone"?f("Clone repository"):f("Create project")),sw=Y(()=>{const u=Fo.value.trim(),p=vs.value.trim();return!!(u&&p&&u!==p)}),pp=Y(()=>{const u=[];sw.value&&u.push({key:`parent:${vs.value}`,name:"..",path:vs.value,kind:"parent"});for(const p of Mi.value)u.push({key:`directory:${p.path}`,name:p.name,path:p.path,kind:"directory"});return u}),zc=Y(()=>{const u=er.value.trim().toLowerCase();return u?pp.value.filter(p=>p.kind==="parent"||p.name.toLowerCase().includes(u)):pp.value}),Ni=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,iw=Y(()=>f(j[Ys.value].label)),lw=Y(()=>{const u=j[Ys.value],p=Math.max(0,hl.value-ei.value-Pc.value);return{"--chat-column-max":u.columnMax,"--chat-card-max":u.cardMax,"--visual-viewport-height":ei.value>0?`${ei.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,Pc.value)}px`,"--virtual-keyboard-inset":`${p}px`}}),uw=Y(()=>{if(!hn.value.configured)return f("Not configured");const u=hn.value.active?f("Online"):f("Configured (offline)"),p=hn.value.allowAllUsers?f("allow all users"):`${hn.value.allowedUsers} ${f("allowed user(s)")}`,T=`${hn.value.mappedChats} ${f("chat(s)")}, ${hn.value.mappedThreads} ${f("thread(s)")}, ${p}`,O=hn.value.lastError?`, ${f("error")}: ${hn.value.lastError}`:"";return`${u}, ${T}${O}`});Ti(()=>{var u,p;document.addEventListener("pointerdown",kp),window.addEventListener("keydown",xp),document.addEventListener("visibilitychange",Ip),window.addEventListener("pageshow",Ap),window.addEventListener("focus",_p),window.addEventListener("resize",ai),(u=window.visualViewport)==null||u.addEventListener("resize",ai),(p=window.visualViewport)==null||p.addEventListener("scroll",ai),ai(),vu(),Ni==null||Ni.addEventListener("change",vu),mo=Ce(T=>{Bn.value&&Bn.value.refreshFromNotification(T)}),br=Ce(T=>{T==="remoteControl/status/changed"&&Vs({force:!0})}),yT(),zb(),ki(),fw(),bs(),Ir(),mp(),Hc(),td(),ub(),Yr()}),ot(Pe,(u,p)=>{u.forEach((T,O)=>{if(T===p[O])return;const Q=T.trim();Q&&an(Q)})}),ot(Go,u=>{xn&&(xn.disconnect(),xn=null),typeof ResizeObserver<"u"&&(xn=new ResizeObserver(En),u&&xn.observe(u)),En()},{immediate:!0}),Zl(()=>{var u,p;document.removeEventListener("pointerdown",kp),window.removeEventListener("keydown",xp),document.removeEventListener("visibilitychange",Ip),window.removeEventListener("pageshow",Ap),window.removeEventListener("focus",_p),window.removeEventListener("resize",ai),(u=window.visualViewport)==null||u.removeEventListener("resize",ai),(p=window.visualViewport)==null||p.removeEventListener("scroll",ai),Ni==null||Ni.removeEventListener("change",vu),xn&&(xn.disconnect(),xn=null),gs!==null&&(window.clearInterval(gs),gs=null),yr&&(clearTimeout(yr),yr=null),ba(),cr(),mo&&(mo(),mo=null),br&&(br(),br=null),qn&&(clearTimeout(qn),qn=null)});function ai(){var u,p;typeof window>"u"||(hl.value=Math.max(hl.value,window.innerHeight),ei.value=((u=window.visualViewport)==null?void 0:u.height)??window.innerHeight,Pc.value=((p=window.visualViewport)==null?void 0:p.offsetTop)??0)}ot(Rt,u=>{const p=u.trim();if(yr&&(clearTimeout(yr),yr=null),!p){Wr.value=null;return}yr=setTimeout(()=>{$x(p,1e3).then(T=>{Rt.value.trim()===p&&(Wr.value=T.threadIds)}).catch(()=>{Rt.value.trim()===p&&(Wr.value=null)})},220)}),ot(vl,u=>{u||(Ur.value=!1)}),ot(Wn,()=>{if(typeof window>"u")return;if(!Wn.value.some(p=>p.quotaStatus==="loading")){gs!==null&&(window.clearInterval(gs),gs=null);return}gs===null&&(gs=window.setInterval(()=>{Rc||(Rc=!0,wl({silent:!0}).finally(()=>{Rc=!1}))},1500))},{deep:!0}),ot(st,()=>{hp().then(u=>{u&&ee({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})})},{deep:!0});async function hp(){if(!Ec||Mc||So.value!=="codex"||Wn.value.length>0||st.value.length===0)return!1;Mc=!0;const u=JSON.stringify(Wn.value.map(T=>T.accountId).sort());try{const T=await bm();Wn.value=T.accounts}catch{await wl({silent:!0})}const p=JSON.stringify(Wn.value.map(T=>T.accountId).sort());return u!==p}function cw(){de({force:!0})}function dw(u){u&&Le(u,{silent:!0,force:!0})}async function Hc(){try{hn.value=await cI()}catch(u){const p=u instanceof Error?u.message:"Failed to load Telegram status";hn.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:p}}}async function mp(){try{const u=await uI();L.value=u.botToken,G.value=u.allowedUserIds.map(p=>String(p)).join(`
|
|
79
|
+
`),oe.value=""}catch(u){oe.value=u instanceof Error?u.message:"Failed to load Telegram configuration"}}async function fw(){const u=await yI();sa.value=u.dismissed!==!0}function pw(u){const p=u.split(/[\n,]/).map(Q=>Q.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),T=p.includes("*"),O=Array.from(new Set(p.filter(Q=>/^-?\d+$/.test(Q)).map(Q=>Number.parseInt(Q,10))));return T?["*",...O]:O}async function hw(){const u=L.value.trim(),p=pw(G.value);if(!u){oe.value=f("Telegram bot token is required.");return}if(p.length===0){oe.value=f("At least one allowed Telegram user ID or * is required.");return}J.value=!0,oe.value="";try{await lI(u,p),G.value=p.map(T=>String(T)).join(`
|
|
80
|
+
`),await Promise.all([mp(),Hc()]),window.alert(f("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(T){oe.value=T instanceof Error?T.message:f("Failed to connect Telegram bot"),Hc()}finally{J.value=!1}}function mw(u){u&&(it.name==="thread"&&ti.value===u||(kt.push({name:"thread",params:{threadId:u}}),Ct.value&&nn(!0)))}function vw(u){it.name==="automations"&&tp.value!==u&&kt.replace({name:"automations",query:u?{automationId:u}:{}})}async function gw(u){var p;gt.value&&(nn(!1),await Ft()),(p=Sn.value)==null||p.openAutomationEditorFromPanel(u)}async function yw(){var u;gt.value&&(nn(!1),await Ft()),(u=Sn.value)==null||u.openAutomationCreatorFromPanel()}function ww(){var u;it.name==="automations"&&((u=os.value)==null||u.loadAutomations())}async function bw(u){u&&re.value===u&&await Vb()}function Tw(u){return u.length>8?u.slice(-8):u}function vp(u){const p=[u.planType||f("unknown")];return u.authMode&&p.unshift(u.authMode),p.join(" · ")}function Sw(u){if(!u)return!1;const p=u.toLowerCase();return p.includes("payment required")||/\b402\b/.test(p)}function cu(u){return u.unavailableReason==="payment_required"||Sw(u.quotaError)}function Cw(u){return ta.value||xr.value||na.value||In.value||oa.value.length>0||u.isActive&&oa.value!==u.storageId&&Oc.value}function qc(u){return Qo.value===u.storageId}function xw(u){return ra.value===u.storageId||qc(u)}function kw(u){return cu(u)?f("Unavailable"):u.isActive?f("Active"):xr.value?f("Switching…"):f("Switch")}function Iw(u){return oa.value===u.storageId?f("Removing…"):qc(u)?f("Click again to remove"):f("Remove")}function Aw(u){ra.value=u}function _w(u){ra.value===u&&(ra.value=""),oa.value!==u&&Qo.value===u&&(Qo.value="")}function Pw(u){const p=u.quotaSnapshot;if(!p)return null;const T=[p==null?void 0:p.primary,p==null?void 0:p.secondary].filter(we=>we!==null),O=T.find(we=>we.windowMinutes===7*24*60);if(O)return O;const Q=T.filter(we=>typeof we.windowMinutes=="number"&&we.windowMinutes>=7*24*60).sort((we,Ue)=>(we.windowMinutes??0)-(Ue.windowMinutes??0))[0]??null;return Q||(p.secondary??null)}function Rw(u){if(typeof u!="number"||!Number.isFinite(u))return"";const p=new Date(u*1e3);return`${p.getMonth()+1}月${p.getDate()}日`}function gp(u){var we,Ue;if(cu(u))return u.quotaError||f("402 Payment Required");const p=u.quotaSnapshot,T=Pw(u),O=(p==null?void 0:p.primary)??(p==null?void 0:p.secondary)??null,Q=T??O;if(Q){const Ht=Math.max(0,Math.min(100,100-Math.round(Q.usedPercent))),Co=Rw(Q.resetsAt);return Co?`${Ht}% ${f("weekly remaining")} · ${Co}`:`${Ht}% ${f("weekly remaining")}`}return(we=p==null?void 0:p.credits)!=null&&we.unlimited?f("Unlimited credits"):(Ue=p==null?void 0:p.credits)!=null&&Ue.hasCredits&&p.credits.balance?`${p.credits.balance} ${f("credits")}`:u.quotaStatus==="loading"?f("Loading quota…"):u.quotaStatus==="error"?u.quotaError||f("Quota unavailable"):u.quotaStatus==="ready"||u.quotaStatus==="idle"?f("Quota unavailable"):f("Fetching account details…")}function Ew(u){return[u.email||f("Account"),vp(u),cu(u)?f("Unavailable account"):null,gp(u),`${f("Workspace")} ${u.accountId}`].filter(Boolean).join(`
|
|
81
|
+
`)}async function wl(u={}){try{const p=await $I();Wn.value=p.accounts,p.accounts.some(T=>T.storageId===ra.value)||(ra.value=""),p.accounts.some(T=>T.storageId===Qo.value)||(Qo.value="")}catch(p){if(u.silent===!0)return;fn.value=p instanceof Error?p.message:f("Failed to load accounts")}}async function Mw(){if(!(ta.value||xr.value||na.value||In.value)){fn.value="",ra.value="",Qo.value="",ta.value=!0;try{const u=await bm();Wn.value=u.accounts,cr(),_o(),ee({includeSelectedThreadMessages:!0})}catch(u){fn.value=u instanceof Error?u.message:f("Failed to refresh accounts")}finally{ta.value=!1}}}async function jw(u){if(!(xr.value||ta.value||na.value||In.value)){if(Oc.value){fn.value=f("Finish the current turn and pending requests before switching accounts.");return}fn.value="",ra.value="",Qo.value="",xr.value=!0;try{const p=await FI(u);Wn.value=Wn.value.map(T=>T.storageId===u?p:{...T,isActive:!1}),cr(),_o(),ee({includeSelectedThreadMessages:!0}),wl({silent:!0})}catch(p){fn.value=p instanceof Error?p.message:f("Failed to switch account")}finally{xr.value=!1}}}async function Lw(){var u;if(!(ta.value||xr.value||na.value||In.value)){fn.value="",Ea.value="",na.value=!0;try{const p=await OI();Ks.value=p,Ri.value=!0,window.open(p,"_blank","noopener,noreferrer"),await Ft(),(u=ou.value)==null||u.focus()}catch(p){fn.value=p instanceof Error?p.message:f("Failed to start Codex login")}finally{na.value=!1}}}function Wc(){In.value||(Ri.value=!1,Ea.value="")}async function Nw(){const u=Ea.value.trim();u&&await $w(u)}async function $w(u){if(!(In.value||u.length===0)){fn.value="",In.value=!0;try{const p=await DI(u);Wn.value=p.accounts,Ks.value="",Ea.value="",Ri.value=!1,cr(),_o(),ee({includeSelectedThreadMessages:!0})}catch(p){fn.value=p instanceof Error?p.message:f("Failed to complete Codex login")}finally{In.value=!1}}}async function Ow(u){if(ta.value||xr.value||na.value||In.value||oa.value.length>0)return;const p=Wn.value.find(O=>O.storageId===u)??null;if(!p)return;if(Qo.value!==u){Qo.value=u;return}if(p.isActive&&Oc.value){fn.value=f("Finish the current turn and pending requests before removing the active account.");return}const T=p.isActive;fn.value="",Qo.value="",oa.value=u;try{const O=await BI(u);Wn.value=O.accounts,cr(),_o(),T&&ee({includeSelectedThreadMessages:!0}),wl({silent:!0})}catch(O){fn.value=O instanceof Error?O.message:f("Failed to remove account")}finally{oa.value=""}}function Dw(u){qe(u)}function Fw(u){ee({includeSelectedThreadMessages:!1,forceThreadRefresh:!0})}async function Bw(u){const p=await V(u);p&&(wn.value?await kt.replace({name:"thread",params:{threadId:p}}):await kt.push({name:"thread",params:{threadId:p}}),Ct.value&&nn(!0))}function yp(u){const p=u.trim().replace(/\\/gu,"/");return p?p.includes("/.codex/worktrees/")||p.includes("/.git/worktrees/"):!1}function $i(u,p=""){var we,Ue,Ht;const T=q.value.find(Co=>Co.projectName===u);if(!T)return ip(u)||p.trim();const O=T.threads.find(Co=>!yp(Co.cwd));return(((we=O==null?void 0:O.cwd)==null?void 0:we.trim())??((Ht=(Ue=T.threads[0])==null?void 0:Ue.cwd)==null?void 0:Ht.trim())??"")||ip(u)||p.trim()}function Uw(u){var O,Q;const p=q.value.find(we=>we.projectName===u),T=$i(u,((Q=(O=p==null?void 0:p.threads[0])==null?void 0:O.cwd)==null?void 0:Q.trim())??"");T&&(ft.value=T),Ct.value&&nn(!0),!wn.value&&kt.push({name:"home"})}function zw(u){var T;let p="";for(const O of q.value){const Q=O.threads.find(we=>we.id===u);if((T=Q==null?void 0:Q.cwd)!=null&&T.trim()){p=Q.cwd.trim();break}}!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}function du(u){var T,O;const p=q.value.find(Q=>Q.projectName===u);return $i(u,((O=(T=p==null?void 0:p.threads[0])==null?void 0:T.cwd)==null?void 0:O.trim())??"")}const wp=Y(()=>Object.fromEntries(q.value.map(u=>[u.projectName,du(u.projectName).trim()]).filter(([,u])=>u.length>0)));function Hw(u){return(be.value[u]??u).trim()||u}function qw(u){return Hw(u).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function Ww(u){const p=du(u);!p||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(p)}`,"_blank","noopener,noreferrer")}async function Gw(u){const p=du(u);await Sp(p)}async function Vw(u){const p=Kw(u);await Sp(p)}function Kw(u){var p;for(const T of q.value){const O=T.threads.find(Q=>Q.id===u);if((p=O==null?void 0:O.cwd)!=null&&p.trim())return O.cwd.trim()}return""}function bp(u){if(!Number.isFinite(u)||u<=0)return"0 B";const p=["B","KB","MB","GB"];let T=u,O=0;for(;T>=1024&&O<p.length-1;)T/=1024,O+=1;return`${T>=10||O===0?T.toFixed(0):T.toFixed(1)} ${p[O]}`}function Yw(u,p){const T=URL.createObjectURL(u),O=document.createElement("a");O.href=T,O.download=p,document.body.appendChild(O),O.click(),document.body.removeChild(O),window.setTimeout(()=>URL.revokeObjectURL(T),3e4)}async function Jw(u,p){const O={files:[new File([u],p,{type:u.type||"application/zip"})],title:p};if(!(typeof navigator<"u"&&typeof navigator.share=="function"&&(typeof navigator.canShare!="function"||navigator.canShare(O))))throw new Error("File sharing is not supported in this browser.");await navigator.share(O)}function Tp(){U.value.phase!=="exporting"&&(U.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""})}function Qw(){const{blob:u,fileName:p}=U.value;!u||!p||(U.value={...U.value,error:""},Yw(u,p))}async function Xw(){const{blob:u,fileName:p}=U.value;if(!(!u||!p))try{U.value={...U.value,error:""},await Jw(u,p)}catch(T){if(T instanceof DOMException&&T.name==="AbortError")return;const O=T instanceof Error?T.message:"",Q=T instanceof DOMException&&T.name==="NotAllowedError"||/permission denied|notallowed|not allowed|gesture/iu.test(O);U.value={...U.value,error:Q?f("This browser blocked sharing the ZIP. Use Download instead."):O||f("Failed to share project. Use Download instead.")}}}async function Sp(u){if(!(!u||typeof document>"u")){U.value={phase:"exporting",loaded:0,total:null,blob:null,fileName:"",error:""};try{const{blob:p,fileName:T}=await eA(u,({loaded:O,total:Q})=>{U.value={...U.value,phase:"exporting",loaded:O,total:Q}});U.value={phase:"ready",loaded:p.size,total:p.size,blob:p,fileName:T,error:""}}catch(p){if(U.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""},p instanceof DOMException&&p.name==="AbortError")return;const T=p instanceof Error?p.message:"Failed to export project.";window.alert(T)}}}async function Zw(u){const p=du(u);if(!p||typeof window>"u"||(await fu(p),Ln.value[p]!==!0))return;const T=`${qw(u)}-`,O=window.prompt("New worktree folder name",T);if(O===null)return;const Q=O.trim();if(Q){if(Q.includes("/")||Q.includes("\\")||Q==="."||Q===".."){window.alert("Worktree name must be a single folder name.");return}try{const we=await qI(p,Q),Ue=await xu(we.cwd,{createIfMissing:!1,label:""});if(!Ue)return;ft.value=Ue,gn.value="local",ho(gl(Ue)),await bs(),await Ir(),Ct.value&&nn(!0),wn.value||await kt.push({name:"home"})}catch(we){const Ue=we instanceof Error?we.message:"Failed to create worktree.";window.alert(Ue)}}}function eb(){var T,O,Q;const u=ce.value;if(!u)return"";const p=((T=u.projectName)==null?void 0:T.trim())??"";return p?$i(p,((Q=u.cwd)==null?void 0:Q.trim())??""):((O=u.cwd)==null?void 0:O.trim())??""}function Gc(){const u=eb();u&&(ft.value=u),gn.value="local",Ct.value&&nn(!0),!wn.value&&kt.push({name:"home"})}function tb(){ft.value="",gn.value="local",Ct.value&&nn(!0),!wn.value&&kt.push({name:"home"})}async function fu(u){const p=u.trim();if(!p||Object.prototype.hasOwnProperty.call(Ln.value,p))return;const T=Hr.get(p);if(T){const we=await T;Object.prototype.hasOwnProperty.call(Ln.value,p)||(Ln.value={...Ln.value,[p]:we});return}const O=VI(p).then(we=>we.isGitRepo).catch(()=>!1).finally(()=>{Hr.delete(p)});Hr.set(p,O);const Q=await O;Object.prototype.hasOwnProperty.call(Ln.value,p)||(Ln.value={...Ln.value,[p]:Q})}function nb(u){Us(u.projectName,u.displayName)}function ob(u){le(u.threadId,u.title)}async function rb(u){await ts(u),await bs(),Ir()}function ab(u){ya(u.projectName,u.toIndex)}function sb(u){var O,Q;const p=q.value.find(we=>we.projectName===u),T=$i(u,((Q=(O=p==null?void 0:p.threads[0])==null?void 0:O.cwd)==null?void 0:Q.trim())??"");fu(T)}function Cp(u){ib(u)}async function ib(u){var O;const p=await Ho(u),T=((O=u.followUpMessageText)==null?void 0:O.trim())??"";if(!(!p||!T||wn.value))try{await Je(T,[],[],"steer",[])}catch{}}async function lb(u){const p=await ge(u.threadId,u.turnIndex);p&&(await kt.push({name:"thread",params:{threadId:p}}),re.value!==p&&await me(p),Ct.value&&nn(!0))}function xp(u){if(u.defaultPrevented)return;if(u.key==="Escape"&&Ot.value){Ot.value=!1;return}if(!u.ctrlKey&&!u.metaKey||u.shiftKey||u.altKey)return;const p=u.key.toLowerCase();if(p==="b"){if(!(qo()?u.metaKey&&!u.ctrlKey:u.ctrlKey&&!u.metaKey))return;u.preventDefault(),nn(!gt.value);return}if(p==="j"&&it.name==="thread"&&re.value){u.preventDefault(),Mo();return}p==="j"&&wn.value&&bn.value&&(u.preventDefault(),Mo())}async function ub(){try{const u=await Dx();vo.value=u.available,!u.available&&tn.value==="terminal"&&(tn.value="git",rs())}catch{vo.value=!1,tn.value==="terminal"&&(tn.value="git")}}function kp(u){var T,O;const p=u.target;if(p instanceof Node){if(Ut.value){const Q=p instanceof Element?p:p.parentElement;Q!=null&&Q.closest(".thread-terminal-panel")||rs()}Ot.value&&((T=xa.value)!=null&&T.containsTarget(p)||(O=ka.value)!=null&&O.contains(p)||(ls=Date.now(),Ot.value=!1))}}function cb(u){var T,O;if(!Ot.value)return;const p=u.target;p instanceof Node&&((T=xa.value)!=null&&T.containsTarget(p)||(O=ka.value)!=null&&O.contains(p)||(ls=Date.now(),Ot.value=!1))}function db(){var u;(u=Sn.value)==null||u.openRecycleBin()}function Ip(){if(!(typeof document>"u")){if(document.visibilityState==="hidden"){Na.value=Date.now(),pl.value=!1;return}Vc()}}function Ap(u){u.persisted&&Vc()}function _p(){it.name==="home"&&(bs(),Ir()),Vc()}function Vc(){typeof window>"u"||typeof document>"u"||a$(document.visibilityState,Na.value,pl.value,Date.now())&&(pl.value=!0,Na.value=null,fb())}async function fb(){if(!_c.value){_c.value=!0;try{await ee({includeSelectedThreadMessages:!0}),await od()}finally{_c.value=!1}}}function Pp(u){const p=u.text;pu();const T=go.value,O=u.mode==="queue"&&T&&T.threadId===re.value?T.queueIndex:void 0;if(go.value=null,wn.value){wT(p,u.imageUrls,u.skills,u.fileAttachments);return}Je(p,u.imageUrls,u.skills,u.mode,u.fileAttachments,O)}function pb(u){const p=cn.value.findIndex(we=>we.id===u),T=p>=0?cn.value[p]:void 0,O=Zn.value;if(!T||!O||O.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;go.value=re.value?{threadId:re.value,queueIndex:p}:null;const Q={text:T.text,imageUrls:[...T.imageUrls],fileAttachments:T.fileAttachments.map(we=>({...we})),skills:T.skills.map(we=>({...we}))};O.hydrateDraft(Q),Io(u)}function pu(){if(!Ct.value||wn.value)return;const u=()=>{var p;(p=eo.value)==null||p.jumpToLatest()};u(),Ft(()=>{u(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{u(),window.requestAnimationFrame(u)})})}function hb(u){ft.value=u.trim(),Te.value=""}function mb(u){oo.value=u.trim()}function ws(u){const p=bn.value.trim();return!u||p!==u?!1:it.name==="thread"||it.name==="home"&&ri.value}function Rp(){At+=1,Yo+=1,wr+=1,ss+=1,Cr.value=[],bo.value=null,$o.value=null,Xr.value=null,C.value=null,R.value=!1,x.value=!1,K.value={addedLineCount:0,removedLineCount:0},Ke.value=[],To.value={},so.value="",Jt.value="",Zr.value={},ea.value="",fs.value="",Dt.value="",ps.value=!1}function Ep(u){const p=u.trim();if(!p){K.value={addedLineCount:0,removedLineCount:0};return}const T=++ss;dA(p,"unstaged").then(O=>{T!==ss||!ws(p)||(K.value={addedLineCount:O.addedLineCount,removedLineCount:O.removedLineCount})}).catch(()=>{T!==ss||!ws(p)||(K.value={addedLineCount:0,removedLineCount:0})})}async function bl(u){var O,Q,we;const p=u.trim();if(!p){Rp();return}const T=++At;ps.value=!0,Dt.value="";try{const Ue=await GI(p);if(T!==At||!ws(p))return;Cr.value=Ue.options,bo.value=Ue.currentBranch,$o.value=Ue.headSha,Xr.value=Ue.headSubject,C.value=Ue.headDate,R.value=Ue.detached,x.value=Ue.dirty,Ke.value=Ue.changedFiles,Ep(p);const Ht=((O=Ue.currentBranch)==null?void 0:O.trim())||((we=(Q=Ue.options[0])==null?void 0:Q.value)==null?void 0:we.trim())||"";Ht&&Mp({branch:Ht,includeResetHistory:!0})}catch{if(T!==At||!ws(p))return;Cr.value=[],bo.value=null,$o.value=null,Xr.value=null,C.value=null,R.value=!1,x.value=!1,K.value={addedLineCount:0,removedLineCount:0},Ke.value=[]}finally{T===At&&(ps.value=!1)}}function vb(u){bo.value=u.currentBranch,$o.value=u.headSha,Xr.value=u.headSubject,C.value=u.headDate,R.value=u.detached,x.value=u.dirty,Ke.value=u.changedFiles,Ep(bn.value)}function gb(u){if(Ra.value)return;const p=u.trim();if(!p||p===(bo.value??""))return;const T=bn.value.trim();T&&(Ra.value=!0,Dt.value="",KI(T,p).then(O=>(bo.value=O||p,$o.value=null,Xr.value=null,C.value=null,R.value=!1,Hn.value=!1,bl(T))).catch(O=>{const Q=O instanceof Error?O.message:"Failed to switch branch";bl(T).finally(()=>{Dt.value=Q})}).finally(()=>{Ra.value=!1}))}function yb(u){if(Ra.value)return;const p=u.branch.trim(),T=u.sha.trim(),O=bn.value.trim();!p||!T||!O||(Ra.value=!0,Dt.value="",QI(O,p,T).then(Q=>(vb(Q),Hn.value=!1,bl(O))).catch(Q=>{const we=Q instanceof Error?Q.message:"Failed to reset branch to commit";bl(O).finally(()=>{Dt.value=we})}).finally(()=>{Ra.value=!1}))}function Mp(u){const p=(typeof u=="string"?u:u.branch).trim(),T=typeof u=="string"?!0:u.includeResetHistory!==!1,O=bn.value.trim(),Q=xc(p,T);if(!p||!O||so.value===Q||(Jt.value="",To.value[Q]))return;const we=++Yo;so.value=Q,YI(O,p,{includeResetHistory:T}).then(Ue=>{we!==Yo||!ws(O)||(To.value={...To.value,[Q]:Ue})}).catch(Ue=>{we!==Yo||!ws(O)||(Jt.value=Ue instanceof Error?Ue.message:"Failed to load branch commits")}).finally(()=>{we===Yo&&so.value===Q&&(so.value="")})}function wb(u){const p=u.trim(),T=bn.value.trim();if(!p||!T||ea.value===p||(fs.value="",Zr.value[p]))return;const O=++wr;ea.value=p,JI(T,p).then(Q=>{O!==wr||!ws(T)||(Zr.value={...Zr.value,[p]:Q})}).catch(Q=>{O!==wr||!ws(T)||(fs.value=Q instanceof Error?Q.message:"Failed to load commit files")}).finally(()=>{O===wr&&ea.value===p&&(ea.value="")})}function bb(u){const p=u.path.trim(),T=u.sha.trim();!p||!T||(Jr.value=p,Qr.value=T,Hn.value=!0)}function Tb(){Jr.value="",Qr.value="",Hn.value=!Hn.value}function Sb(){!Jr.value&&!Qr.value||(Jr.value="",Qr.value="",Hn.value=!1)}async function Cb(){const u=await mu();u&&(await Ir(),yt.value=u,Et.value=zn.value.trim()||"New Project (1)",Mt.value="",Do.value="",et.value="create",mt.value=!0,Ft(()=>{var p;return(p=La.value)==null?void 0:p.focus()}))}function hu(){un.value||(mt.value=!1,Do.value="")}let Kc=!1,Yc=!1;function xb(){Kc=!0}function kb(){Kc&&(Kc=!1,Oi())}function Ib(){Yc=!0}function Ab(){Yc&&(Yc=!1,hu())}async function _b(){const u=yt.value.trim(),p=Et.value.trim();if(!dp.value)throw new Error("Enter a single project folder name.");const T=$p(Np(u,p));return T?xu(T,{createIfMissing:!0,label:""}):""}async function Pb(){const u=yt.value.trim(),p=Mt.value.trim();return p?rA(p,u):""}async function Jc(){if(!(!fp.value||un.value)){Do.value="",un.value=!0;try{const u=et.value==="clone"?await Pb():await _b();if(!u)return;ft.value=u,ho(gl(u)),await bs(),await Ir(),mt.value=!1}catch(u){Do.value=u instanceof Error?u.message:"Failed to create or clone project."}finally{un.value=!1}}}function Rb(){Eb(Ac.value)}function Eb(u){Xt.value||!u||(u.value="",u.click())}async function Mb(u,p,T){Xt.value=!0;try{const O=await mu();if(!O)return;const Q=await p(O);if(!Q.path)return;ft.value=Q.path,ho(gl(Q.path)),await bs(),await ee({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Ir()}catch(O){const Q=O instanceof Error?O.message:T;window.alert(Q)}finally{Xt.value=!1,u&&(u.value="")}}async function jb(u){var O;const p=u.target instanceof HTMLInputElement?u.target:null,T=((O=p==null?void 0:p.files)==null?void 0:O[0])??null;!T||Xt.value||await Mb(p,Q=>tA(T,Q),"Failed to import project.")}async function Lb(){const u=ft.value.trim()||await mu();u&&(Z.value=!1,Zo.value=!0,er.value="",await Ts(u),pn.value||Ft(()=>{var p;return(p=Ei.value)==null?void 0:p.focus()}))}function Oi(){ml+=1,Zo.value=!1,Vn.value=!1,pn.value="",er.value="",la.value="",Tl()}async function Nb(u){!u||Vn.value||(er.value="",await Ts(u))}function $b(){const u=Fo.value.trim();!Zo.value||!u||Ts(u)}function Ob(){const u=yl.value;!Zo.value||!u||Vn.value||Ts(u)}function Db(){if(!Zo.value||Vn.value||Bo.value)return;const u=yl.value,p=Fo.value.trim();!u||u===p||Ts(u)}function Fb(){const u=yl.value,p=Fo.value.trim();if(u){if(u!==p){Ts(u);return}Qc(u)}}async function Qc(u=yl.value){const p=Xe(u).trim();if(p){pn.value="",Bo.value=!0;try{const T=await xu(p,{createIfMissing:!1,label:""});if(!T){pn.value="Failed to open the selected folder.";return}ft.value=T,ho(gl(T)),await bs(),await ee({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Ir(),Oi()}catch(T){pn.value=T instanceof Error?T.message:"Failed to open the selected folder."}finally{Bo.value=!1}}}async function Bb(){if(Te.value="",Z.value){Tl();return}if(!Zo.value){const u=ft.value.trim()||await mu();if(!u||(Zo.value=!0,er.value="",await Ts(u),pn.value))return}pn.value||(fe.value=zn.value,Z.value=!0,Ft(()=>{var u;return(u=nu.value)==null?void 0:u.focus()}))}function Tl(){Te.value="",fe.value="",Z.value=!1}async function jp(){const u=fe.value.trim();if(!u)return;if(Te.value="",pn.value){Te.value="Reload the current folder before creating a new one.";return}Be.value=!0;const p=up.value.trim(),T=$p(Np(p,u));if(!T){Te.value="Unable to determine where the new folder should be created.",Be.value=!1;return}if(!cp.value){Te.value="Enter a single folder name.",Be.value=!1;return}try{const O=await oA(T);if(!O){Te.value="Failed to create the folder.";return}Te.value="",er.value="",await Ts(O),Tl()}catch(O){Te.value=O instanceof Error?O.message:"Failed to create folder."}finally{Be.value=!1}}async function Ub(){var p;if(typeof window>"u")return!1;const u=((p=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:p.trim())??"";if(!u)return!1;try{const T=await xu(u,{createIfMissing:!1,label:""});if(!T)return!1;ft.value=T,ho(gl(T)),await kt.replace({name:"home"}),await bs();const O=new URL(window.location.href);return O.searchParams.delete("openProjectPath"),window.history.replaceState({},"",O.toString()),!0}catch{return!1}}async function mu(){const u=Lp();if(u)return u;try{const p=await Tm();if(p)return Ia.value=p,p}catch{}return""}async function Ir(){const u=Lp();if(!u){zn.value="New Project (1)";return}try{const p=await sA(u);zn.value=p.name||"New Project (1)"}catch{zn.value="New Project (1)"}}function Lp(){var T,O;const u=ft.value.trim();if(u)return Xi(u);const p=((O=(T=Bc.value[0])==null?void 0:T.value)==null?void 0:O.trim())??"";return p?Xi(p):Ia.value.trim()}async function zb(){try{Ia.value=await Tm()}catch{Ia.value=""}}async function bs(){try{const u=await Wi();E.value={order:[...u.order],labels:{...u.labels},projectOrder:[...u.projectOrder]}}catch{E.value={order:[],labels:{},projectOrder:[]}}}async function Ts(u){const p=++ml,T=Xe(u).trim();la.value=T,Fo.value=T,pn.value="",Vn.value=!0;try{const O=await nA(u,{showHidden:ji.value});if(p!==ml)return;la.value=O.path,Fo.value=O.path,vs.value=O.parentPath,Mi.value=O.entries}catch(O){if(p!==ml)return;pn.value=O instanceof Error?O.message:"Failed to load local folders.",vs.value=Xi(Fo.value),Mi.value=[],Tl()}finally{p===ml&&(Vn.value=!1)}}function Np(u,p){const T=Xe(u).trim(),O=Xe(p).trim().replace(/^[\\/]+/u,"");if(!T||!O)return"";const Q=T.includes("\\")&&!T.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(T))return`${T.slice(0,2)}${Q}${O}`;if(/^\/+$/u.test(T))return`/${O}`;const we=T.replace(/[\\/]+$/u,"");return we?`${we}${Q}${O}`:""}function $p(u){const p=Xe(u).trim();if(!p)return"";const T=p.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(T){const[,Q,we,Ue=""]=T,Ht=Xc(Ue.split(/[\\/]+/u));return Ht.length>0?`\\\\${Q}\\${we}\\${Ht.join("\\")}`:`\\\\${Q}\\${we}`}const O=p.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(O){const[,Q,we=""]=O,Ue=p.includes("\\")&&!p.includes("/")?"\\":"/",Ht=Xc(we.split(/[\\/]+/u));return Ht.length>0?`${Q}${Ue}${Ht.join(Ue)}`:`${Q}${Ue}`}if(p.startsWith("/")){const Q=Xc(p.split("/"));return Q.length>0?`/${Q.join("/")}`:"/"}return p}function Xc(u){const p=[];for(const T of u){const O=T.trim();if(!(!O||O===".")){if(O===".."){p.length>0&&p.pop();continue}p.push(O)}}return p}function Hb(u){ma(u.draggedId,u.targetId)}function Op(u){const p=oi.value,T=Xa(p);Za(p,u),T&&T!==u&&(es(p,T,u),zo(p))}function Dp(u){Br(u)}function Fp(u){ur(u)}function qb(){St()}const Sl=S("");let Zc=null;ot($t,u=>{var p;u&&(u.text&&((p=Zn.value)==null||p.hydrateDraft({text:u.text,imageUrls:u.imageUrls,fileAttachments:u.fileAttachments,skills:u.skills})),Sl.value=u.text?f("Stopped: message not submitted, restored to input."):f("Stopped: message not submitted."),Zc&&clearTimeout(Zc),Zc=setTimeout(()=>{Sl.value=""},6e3),Rn(oi.value))});function Bp(u){var T,O;const p=re.value.trim();switch(u){case"compact":p&&dt(p);break;case"review":if(!p)return;Jr.value="",Qr.value="",Hn.value=!0;break;case"rename":p&&((O=Sn.value)==null||O.openRenameThreadDialog(p,((T=ce.value)==null?void 0:T.title)??""));break;case"archive":p&&qe(p);break;case"fork":p&&V(p);break;case"new":Gc();break;case"skills":ys.value||kt.push({name:"skills"});break}}function Wb(u){const p=u.turnId.trim();if(p.length>0){const T=[...Li.value].reverse().find(O=>{var Q;return O.role==="user"&&(((Q=O.turnId)==null?void 0:Q.trim())??"")===p&&O.text.trim().length>0});T!=null&&T.text&&Zn.value&&Zn.value.appendTextToDraft(T.text)}Po(u.turnId)}function Gb(){wn.value||!re.value||(Nc.value&&(Lc.value=Nc.value.id),Ao("default"),pu(),Je("Implement",[],[],"steer",[],void 0,"default"))}async function Vb(){if(wn.value||ys.value||ni.value||!ce.value||Li.value.length===0)return;const u=Kb();try{await o$(u)}catch{}}function Kb(){var T,O,Q;const u=[],p=((O=(T=ce.value)==null?void 0:T.title)==null?void 0:O.trim())||"Untitled thread";u.push(`# ${Yb(p)}`),u.push(""),u.push(`- Exported: ${new Date().toISOString()}`),u.push(`- Thread ID: ${((Q=ce.value)==null?void 0:Q.id)??""}`),u.push(""),u.push("---"),u.push("");for(const we of Li.value){const Ue=we.role?we.role.toUpperCase():"MESSAGE";u.push(`## ${Ue}`),u.push("");const Ht=we.text.trim();if(Ht&&(u.push(Ht),u.push("")),we.commandExecution&&(u.push("```text"),u.push(`command: ${we.commandExecution.command}`),u.push(`status: ${we.commandExecution.status}`),we.commandExecution.cwd&&u.push(`cwd: ${we.commandExecution.cwd}`),we.commandExecution.exitCode!==null&&u.push(`exitCode: ${we.commandExecution.exitCode}`),u.push(we.commandExecution.aggregatedOutput||"(no output)"),u.push("```"),u.push("")),we.fileAttachments&&we.fileAttachments.length>0){u.push("Attachments:");for(const Co of we.fileAttachments)u.push(`- ${Co.path}`);u.push("")}if(we.images&&we.images.length>0){u.push("Images:");for(const Co of we.images)u.push(`- ${Co}`);u.push("")}}return`${u.join(`
|
|
82
|
+
`).trimEnd()}
|
|
83
|
+
`}function Yb(u){return u.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function ed(u,p){if(typeof window>"u")return p;const T=window.localStorage.getItem(u);return T===null?p:T==="1"}function Jb(){if(typeof window>"u")return"system";const u=window.localStorage.getItem(av);return u==="light"||u==="dark"?u:"system"}function Qb(){if(typeof window>"u")return"steer";const u=window.localStorage.getItem(rv);return u==="steer"||u==="queue"?u:"queue"}function Xb(){if(typeof window>"u")return"standard";const u=window.localStorage.getItem(uv);return u==="standard"||u==="wide"||u==="extra-wide"?u:"standard"}function Zb(){hs.value=!hs.value,window.localStorage.setItem(ov,hs.value?"1":"0")}function eT(){Xo.value=Xo.value==="steer"?"queue":"steer",window.localStorage.setItem(rv,Xo.value)}function tT(){const u=["system","light","dark"],p=u.indexOf(kr.value);kr.value=u[(p+1)%u.length],window.localStorage.setItem(av,kr.value),vu()}function nT(){const u=["standard","wide","extra-wide"],p=u.indexOf(Ys.value);Ys.value=u[(p+1)%u.length],window.localStorage.setItem(uv,Ys.value)}function oT(){aa.value=!aa.value,window.localStorage.setItem(sv,aa.value?"1":"0")}function rT(){Ma.value=!Ma.value,window.localStorage.setItem(iv,Ma.value?"1":"0")}async function aT(u){if(!ja.value){ja.value=!0;try{if(u==="codex"){So.value="codex";const p=await fm(!1);ia.value=p.enabled}else if(u==="openrouter"){So.value="openrouter";const p=await fm(!0);ia.value=p.enabled,await Bi("","",{wireApi:h.value,provider:"openrouter"})}else u==="opencode-zen"?(So.value="opencode-zen",await Bi("",g.value.trim(),{wireApi:"responses",provider:"opencode-zen"}),ia.value=!0):u==="custom"&&(So.value="custom",ms.value.trim()&&Xs.value.trim()&&(await Bi(ms.value.trim(),Xs.value.trim(),{wireApi:Zs.value}),ia.value=!0));Oo.value="",await ee({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Oo.value=p instanceof Error?p.message:"Failed to switch provider"}finally{ja.value=!1}}}async function sT(){if(An.value)return;const u=ms.value.trim();if(u){An.value=!0;try{Oo.value="",await Bi(u,Xs.value.trim(),{wireApi:Zs.value}),ia.value=!0;const p=await dm();p.provider==="custom"&&!p.currentModel&&(Oo.value=f("Failed to resolve model from custom endpoint; check the URL and try again")),await ee({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Oo.value=p instanceof Error?p.message:"Failed to save custom endpoint"}finally{An.value=!1}}}async function iT(u){if(An.value||ja.value||h.value===u)return;const p=h.value;h.value=u,An.value=!0;try{Oo.value="",await Bi("","",{wireApi:u,provider:"openrouter"}),ia.value=!0,await ee({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(T){h.value=p,Oo.value=T instanceof Error?T.message:"Failed to save OpenRouter API format"}finally{An.value=!1}}async function lT(){if(An.value)return;const u=g.value.trim();if(u){An.value=!0;try{Oo.value="",await Bi("",u,{wireApi:"responses",provider:"opencode-zen"}),ia.value=!0,await ee({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(p){Oo.value=p instanceof Error?p.message:"Failed to save OpenCode Zen config"}finally{An.value=!1}}}async function uT(){if(!An.value){An.value=!0;try{const u=Gn.value.trim();await pm(u),Gn.value="",await td(),await ee({includeSelectedThreadMessages:!1})}catch{}finally{An.value=!1}}}async function cT(){if(!An.value){An.value=!0;try{await pm(""),Gn.value="",await td(),await ee({includeSelectedThreadMessages:!1})}catch{}finally{An.value=!1}}}async function td(){try{const u=So.value,p=await dm();ia.value=p.enabled,ru.value=p.customKey??!1,au.value=p.maskedKey??null,p.enabled?p.provider==="opencode-zen"?So.value="opencode-zen":p.provider==="custom"?(So.value="custom",ms.value=p.customBaseUrl??"",Zs.value=p.wireApi==="chat"?"chat":"responses"):(So.value="openrouter",h.value=p.wireApi==="chat"?"chat":"responses"):So.value="codex",Ec=p.hasCodexAuth===!0,Ec||(Mc=!1);const T=So.value!==u;T&&await ee({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0});const O=await hp();O&&await ee({includeSelectedThreadMessages:!1,providerChanged:T||O,awaitAncillaryRefreshes:!0})}catch{}}function dT(u){const T=nd(u.trim())||"auto";Js.value=T,window.localStorage.setItem(lv,T)}function fT(u){Bs(Number(u))}const pT=[{value:"0",label:f("Off")},{value:"5",label:"5%"},{value:"10",label:"10%"},{value:"15",label:"15%"},{value:"20",label:"20%"},{value:"25",label:"25%"}];function hT(){var T;if(typeof window>"u")return"auto";const u=((T=window.localStorage.getItem(lv))==null?void 0:T.trim())||"auto";return nd(u)||"auto"}function mT(){const u=[{value:"auto",label:f("Auto-detect")}],p=new Set(["auto"]);function T(Q){const we=H[Q]||Q;return`${we.charAt(0).toUpperCase()+we.slice(1)} (${Q})`}for(const Q of typeof navigator<"u"?navigator.languages??[]:[]){const we=nd(Q);!we||p.has(we)||(p.add(we),u.push({value:we,label:`${f("Preferred")}: ${T(we)}`}))}for(const Q of Object.keys(H))p.has(Q)||(p.add(Q),u.push({value:Q,label:T(Q)}));const O=Js.value.trim();return O&&!p.has(O)&&u.push({value:O,label:T(O)}),u}function nd(u){const p=u.trim().toLowerCase();if(!p||p==="auto")return"";if(p in H)return p;const T=p.split("-")[0]??p;return T in H?T:""}function vu(){const u=document.documentElement;if(kr.value==="dark")u.classList.add("dark");else if(kr.value==="light")u.classList.remove("dark");else{const p=window.matchMedia("(prefers-color-scheme: dark)").matches;u.classList.toggle("dark",p)}}const vT=Y(()=>({activeSettingsGroup:is.value,accounts:Wn.value,isAccountsSectionCollapsed:kn.value,isRefreshingAccounts:ta.value,isSwitchingAccounts:xr.value,isStartingCodexLogin:na.value,isCompletingCodexLogin:In.value,accountActionError:fn.value,codexLoginUrl:Ks.value,feedbackMailto:It,isAccountUnavailable:cu,isRemoveConfirmationActive:qc,isRemoveVisible:xw,buildAccountTitle:Ew,formatAccountMeta:vp,formatAccountQuota:gp,shortAccountId:Tw,isAccountActionDisabled:Cw,getAccountSwitchLabel:kw,getAccountRemoveLabel:Iw,onRefreshAccounts:Mw,onStartCodexLogin:Lw,onSwitchAccount:jw,onRemoveAccount:Ow,onAccountCardPointerEnter:Aw,onAccountCardPointerLeave:_w,toggleAccountsSectionCollapsed:qr,prepareFeedbackLink:Xn,sendWithEnter:hs.value,inProgressSendMode:Xo.value,darkMode:kr.value,uiLanguage:b.value,uiLanguageOptions:y,chatWidthLabel:iw.value,dictationClickToToggle:aa.value,dictationAutoSend:Ma.value,dictationLanguage:Js.value,dictationLanguageOptions:kc.value,autoCompactThreshold:lr.value,autoCompactThresholdOptions:pT,hasVisibleFeedbackError:_t.value,selectedProvider:So.value,providerDropdownOptions:su.value,freeModeLoading:ja.value,providerError:Oo.value,freeModeHasCustomKey:ru.value,freeModeCustomKey:Gn.value,freeModeCustomKeyMasked:au.value,freeModeCustomKeySaving:An.value,openRouterWireApi:h.value,opencodeZenKey:g.value,customEndpointUrl:ms.value,customEndpointKey:Xs.value,customEndpointWireApi:Zs.value,isTelegramConfigOpen:I.value,telegramStatusText:uw.value,telegramBotTokenDraft:L.value,telegramAllowedUserIdsDraft:G.value,telegramConfigError:oe.value,isTelegramSaving:J.value,supportsHooks:on.value,isHooksLoading:je.value,hooksList:Me.value,supportsRemoteControl:Vt.value,remoteControlStatus:ro.value,isRemoteControlActionInFlight:wo.value,remoteControlError:yn.value,remoteControlNotice:Aa.value,isRemoteControlLoading:yo.value,remoteControlActionName:No.value,pairingCode:us.value,accountRateLimitSnapshots:st.value,worktreeName:B,appVersion:$,onClose:()=>{Ot.value=!1},onActiveSettingsGroupChange:u=>{is.value=u},toggleSendWithEnter:Zb,cycleInProgressSendMode:eT,cycleDarkMode:tT,onUiLanguageChange:P,cycleChatWidth:nT,toggleDictationClickToToggle:oT,toggleDictationAutoSend:rT,onDictationLanguageChange:dT,onAutoCompactThresholdChange:fT,onProviderChange:aT,onFreeModeCustomKeyChange:u=>{Gn.value=u},clearFreeModeCustomKey:cT,saveFreeModeCustomKey:uT,setOpenRouterWireApi:iT,onOpencodeZenKeyChange:u=>{g.value=u},saveOpencodeZen:lT,onCustomEndpointUrlChange:u=>{ms.value=u},onCustomEndpointKeyChange:u=>{Xs.value=u},saveCustomEndpoint:sT,onCustomEndpointWireApiChange:u=>{Zs.value=u},onTelegramConfigOpenChange:u=>{I.value=u},onTelegramBotTokenDraftChange:u=>{L.value=u},onTelegramAllowedUserIdsDraftChange:u=>{G.value=u},saveTelegramConfig:hw,refreshHooks:te,toggleRemoteControl:ao,startRemotePairing:_a,refreshRemoteClients:_i,revokeRemoteClient:Pa}));function gT(u,p){const T=(u??"").trim();return T.length>0?T:p.trim()||"message"}function Up(u){Ao(u)}async function yT(){await kt.isReady(),it.name==="thread"&&ti.value?ns(ti.value):(it.name==="home"||it.name==="skills"||it.name==="automations")&&ns("",{persist:!1}),await ee({includeSelectedThreadMessages:it.name==="thread"}),wl({silent:!0}),await Ub(),zr.value=!0,await od(),_o()}async function od(){if(hr.value){mr=!0;return}hr.value=!0;try{do{if(mr=!1,it.name==="home"||it.name==="skills"||it.name==="automations"){re.value!==""&&await me("");continue}if(it.name==="thread"){const u=ti.value;if(!u)continue;if(re.value!==u){if(await me(u)==="not-found")continue}else Ve(u,{silent:!0}).catch(()=>{})}}while(mr)}finally{hr.value=!1}}ot(()=>[it.name,ti.value,ue.value,re.value],async()=>{zr.value&&await od()}),ot(()=>[re.value,bn.value],()=>{Sb()}),ot(()=>[it.name,bn.value],([u,p])=>{u==="thread"&&fu(p)},{immediate:!0}),ot(()=>re.value,async u=>{if(zr.value&&!hr.value&&!(wn.value||ys.value||ni.value)){if(!u){it.name!=="home"&&await kt.replace({name:"home"});return}it.name==="thread"&&ti.value===u||await kt.replace({name:"thread",params:{threadId:u}})}}),ot(()=>Bc.value,u=>{if(u.length===0){ft.value="",Ir();return}const p=ft.value.trim();p&&(u.some(O=>O.value===p)||(ft.value="")),Ir()},{immediate:!0}),ot(()=>ft.value,()=>{Ae.value={phase:"idle",title:"",message:""},Ir()}),ot(()=>[it.name,ft.value],([u,p])=>{u==="home"&&fu(p)},{immediate:!0}),ot(ri,u=>{!u&&gn.value==="worktree"&&(gn.value="local")},{immediate:!0}),ot(()=>[gn.value,ft.value],([u,p])=>{u!=="worktree"||!ri.value||zp(p)},{immediate:!0}),ot(()=>gn.value,u=>{var p;if(u==="local"){Ae.value={phase:"idle",title:"",message:""};const T=ft.value.trim();if(T&&yp(T)){const O=((p=ce.value)==null?void 0:p.projectName)??Uo(T),Q=$i(O,"");Q&&(ft.value=Q)}return}ri.value&&zp(ft.value)}),ot(()=>it.name,u=>{u!=="home"&&(Ae.value={phase:"idle",title:"",message:""}),u!=="thread"&&(Hn.value=!1)}),ot(()=>re.value,()=>{Ae.value={phase:"idle",title:"",message:""}}),ot(()=>[it.name,bn.value,ri.value],([u,p,T])=>{if(!(u==="thread"||u==="home"&&T)){Rp();return}Yo+=1,To.value={},so.value="",Jt.value="",bl(p)},{immediate:!0}),ot(qy,u=>{typeof document>"u"||(document.title=u)},{immediate:!0}),ot(Ct,u=>{u&&!gt.value&&nn(!0)},{immediate:!0});async function wT(u,p=[],T=[],O=[]){try{Ae.value={phase:"idle",title:"",message:""};let Q=ft.value;if(gn.value==="worktree"){Ae.value={phase:"running",title:f("Creating worktree"),message:f("Creating a worktree and running setup.")};try{const Ue=await HI(ft.value,oo.value);Q=Ue.cwd,ft.value=Ue.cwd,Ae.value={phase:"idle",title:"",message:""}}catch{Ae.value={phase:"error",title:f("Worktree setup failed"),message:f("Unable to create worktree. Try again or switch to Local project.")};return}}else if(!Q.trim()){const Ue=await aA(u);Q=Ue.cwd,ft.value=Ue.cwd}const we=await Tt(u,Q,p,T,O);if(!we)return;await kt.replace({name:"thread",params:{threadId:we}}),pu()}catch{}}function bT(u){var O;if((O=u.prompt)!=null&&O.trim())return u.prompt.trim();const p=u.displayName.trim()||u.name.trim(),T=u.kind==="skill"?"skill":u.kind==="plugin"?"plugin":u.kind==="composio"?"Composio connector":"app";return`Test ${p} ${T}. Give me a list of what it can do and one useful example.`}function TT(u){return`${u.kind}:${u.name}:${u.skillPath??""}`}async function ST(u){var O;if(no.value)return;no.value=TT(u);const p=bT(u),T=(O=u.attachedSkills)!=null&&O.length?u.attachedSkills:u.kind==="skill"&&u.skillPath?[{name:u.name,path:u.skillPath}]:[];try{const Q=rp.value.trim()||bn.value.trim(),we=await Tt(p,Q,[],T,[]);if(!we)return;await kt.replace({name:"thread",params:{threadId:we}}),pu()}catch{}finally{no.value=""}}async function zp(u){var T;const p=u.trim();if(!p){vr.value=[],oo.value="";return}k.value=!0;try{const O=await WI(p);vr.value=O;const Q=oo.value.trim();if(!(Q.length>0&&O.some(Ue=>Ue.value===Q))){const Ue=O.find(Ht=>Ht.value.trim()==="main");oo.value=(Ue==null?void 0:Ue.value)??((T=O[0])==null?void 0:T.value)??""}}catch{vr.value=[],oo.value=""}finally{k.value=!1}}return(u,p)=>(_(),F(lt,null,[Fe(wx,{"is-sidebar-collapsed":m(gt),onCloseSidebar:p[37]||(p[37]=T=>m(nn)(!0))},{sidebar:pt(()=>[w("section",s$,[w("div",{ref_key:"sidebarScrollableRef",ref:gr,class:"sidebar-scrollable",onScroll:p[7]||(p[7]=(...T)=>m(Sa)&&m(Sa)(...T))},[m(gt)?ve("",!0):(_(),Qe(Um,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":m(gt),"show-new-thread-button":!0,onToggleSidebar:p[1]||(p[1]=T=>m(nn)(!m(gt))),onStartNewThread:Gc},{default:pt(()=>[w("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":m(dn),"aria-label":m(f)("Search threads"),title:m(f)("Search threads"),onClick:p[0]||(p[0]=(...T)=>m(Ci)&&m(Ci)(...T))},[Fe(zm,{class:"sidebar-search-toggle-icon"})],8,i$)]),_:1},8,["is-sidebar-collapsed"])),!m(gt)&&m(dn)?(_(),F("div",l$,[Fe(zm,{class:"sidebar-search-bar-icon"}),_n(w("input",{ref_key:"sidebarSearchInputRef",ref:Ta,"onUpdate:modelValue":p[2]||(p[2]=T=>Pn(Rt)?Rt.value=T:null),class:"sidebar-search-input",type:"text",placeholder:m(f)("Filter threads..."),onKeydown:p[3]||(p[3]=(...T)=>m(Ca)&&m(Ca)(...T))},null,40,u$),[[On,m(Rt)]]),m(Rt).length>0?(_(),F("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":m(f)("Clear search"),onClick:p[4]||(p[4]=(...T)=>m(Un)&&m(Un)(...T))},[Fe(uf,{class:"sidebar-search-clear-icon"})],8,c$)):ve("",!0)])):ve("",!0),m(gt)?ve("",!0):(_(),F("button",{key:2,class:ut(["sidebar-skills-link",{"is-active":ys.value}]),type:"button",onClick:p[5]||(p[5]=T=>{m(kt).push({name:"skills"}),m(Ct)&&m(nn)(!0)})},[w("span",d$,[Fe(Es)]),w("span",f$,[w("span",p$,D(m(f)("Skills")),1),w("span",h$,D(m(f)("Plugins, apps, MCPs")),1)])],2)),m(gt)?ve("",!0):(_(),F("button",{key:3,class:ut(["sidebar-skills-link",{"is-active":ni.value}]),type:"button",onClick:p[6]||(p[6]=T=>{m(kt).push({name:"automations"}),m(Ct)&&m(nn)(!0)})},[w("span",m$,[Fe(Es)]),w("span",v$,[w("span",g$,D(m(f)("Automations")),1),w("span",y$,D(m(f)("Scheduled work")),1)])],2)),m(gt)?ve("",!0):(_(),Qe(OR,{key:4,ref_key:"sidebarThreadTreeRef",ref:Sn,groups:m(q),"project-display-name-by-id":m(be),"project-git-repo-by-name":nw.value,"project-cwd-by-name":wp.value,"selected-thread-id":m(re),"is-loading":m(ue),"is-thread-list-fully-loaded":m(N),"search-query":m(Rt),"search-matched-thread-ids":Wr.value,onSelect:mw,onArchive:Dw,onStartNewThread:Uw,onRenameProject:nb,onBrowseThreadFiles:zw,onSaveThreadProject:Vw,onBrowseProjectFiles:Ww,onSaveProject:Gw,onRequestProjectGitStatus:sb,onCreateProjectWorktree:Zw,onRenameThread:ob,onForkThread:Bw,onRemoveProject:rb,onReorderProject:ab,onCopyThreadChat:bw,onAutomationsChanged:ww,onRestoreThread:Fw,onStartNewChat:tb},null,8,["groups","project-display-name-by-id","project-git-repo-by-name","project-cwd-by-name","selected-thread-id","is-loading","is-thread-list-fully-loaded","search-query","search-matched-thread-ids"]))],544),m(gt)?ve("",!0):(_(),F("div",{key:0,ref_key:"settingsAreaRef",ref:as,class:"sidebar-settings-area",onClick:cb},[Ot.value?(_(),Qe(m(s),Ff({key:0,ref_key:"settingsDialogRef",ref:xa},vT.value),null,16)):ve("",!0),w("div",w$,[w("button",{ref_key:"settingsButtonRef",ref:ka,class:"sidebar-settings-icon-button",type:"button",title:m(f)("Settings"),"aria-label":m(f)("Settings"),onClick:wt(xi,["stop"])},[Fe(Q1,{class:"sidebar-settings-icon"})],8,b$),w("button",{ref:"recycleBinButtonRef",class:"sidebar-settings-icon-button",type:"button",title:m(f)("Recycle bin"),"aria-label":m(f)("Recycle bin"),onClick:wt(db,["stop"])},[Fe(cy,{class:"sidebar-settings-icon"})],8,T$)])],512))])]),content:pt(()=>[w("div",S$,[w("section",{class:ut(["content-root",{"is-virtual-keyboard-open":Qy.value}]),style:or(lw.value)},[vl.value?(_(),F("span",C$)):ve("",!0),Fe(zR,{title:zy.value,accent:ys.value||ni.value},{leading:pt(()=>[m(gt)||m(Ct)?(_(),Qe(Um,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":m(gt),"show-new-thread-button":!0,onToggleSidebar:p[8]||(p[8]=T=>m(nn)(!m(gt))),onStartNewThread:Gc},null,8,["is-sidebar-collapsed"])):ve("",!0),ys.value?(_(),F("span",x$,[Fe(Es)])):ni.value?(_(),F("span",k$,[Fe(Es)])):ve("",!0)]),actions:pt(()=>[uu.value?(_(),F("button",{key:0,class:"content-header-right-panel-toggle",type:"button","aria-label":m(Ct)?m(sn)?m(f)("Close side panel"):m(f)("Open side panel"):m(Mn)?m(f)("Open side panel"):m(f)("Close side panel"),title:m(Ct)?m(sn)?m(f)("Close side panel"):m(f)("Open side panel"):m(Mn)?m(f)("Open side panel"):m(f)("Close side panel"),onClick:p[9]||(p[9]=(...T)=>m(ln)&&m(ln)(...T))},[Fe(dy,{class:"content-header-right-panel-toggle-icon"})],8,I$)):ve("",!0)]),_:1},8,["title","accent"]),w("section",A$,[ys.value?(_(),Qe(m(r),{key:0,ref_key:"directoryHubRef",ref:Bn,cwd:rp.value,"thread-id":ti.value,"try-in-flight-key":no.value,onSkillsChanged:cw,onTryItem:ST},null,8,["cwd","thread-id","try-in-flight-key"])):ni.value?(_(),Qe(m(a),{key:1,ref_key:"automationsPanelRef",ref:os,groups:m(q),"project-cwd-by-name":wp.value,"project-display-name-by-id":m(be),"selected-automation-id":tp.value,onSelectAutomation:vw,onEditAutomation:gw,onCreateAutomation:yw},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):wn.value?(_(),F("div",_$,[w("div",P$,[w("p",R$,D(m(f)("Let's build")),1),Fe(wi,{class:"new-thread-folder-dropdown","model-value":ft.value,options:Bc.value,placeholder:m(f)("Choose folder"),"enable-search":!0,"search-placeholder":m(f)("Quick search project"),disabled:!1,"onUpdate:modelValue":hb},null,8,["model-value","options","placeholder","search-placeholder"]),ft.value?(_(),F("p",{key:0,class:"new-thread-folder-selected",title:ft.value},D(m(f)("Selected folder"))+": "+D(ft.value),9,E$)):ve("",!0),w("div",M$,[w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:Lb},D(m(f)("Select folder")),1),w("button",{class:"new-thread-folder-action",type:"button",onClick:Cb},D(m(f)("Create Project")),1),w("button",{class:"new-thread-folder-action",type:"button",disabled:Xt.value,onClick:Rb},D(Xt.value?m(f)("Importing…"):m(f)("Import Project")),9,j$),w("input",{ref_key:"projectImportInputRef",ref:Ac,class:"new-thread-project-import-input",type:"file",accept:".zip,application/zip",tabindex:"-1","aria-hidden":"true",onChange:jb},null,544)]),sa.value?(_(),F("section",L$,[w("div",N$,[w("div",$$,[w("span",O$,[Fe(Es)]),w("p",D$,D(m(f)("New in Codex")),1)]),w("h2",F$,D(m(f)("Plugins are here")),1),w("p",B$,D(m(f)("Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.")),1),p[42]||(p[42]=w("div",{class:"new-thread-launch-card-pills","aria-label":"Example integrations"},[w("span",{class:"new-thread-launch-card-pill"},"Gmail"),w("span",{class:"new-thread-launch-card-pill"},"Calendar"),w("span",{class:"new-thread-launch-card-pill"},"GitHub"),w("span",{class:"new-thread-launch-card-pill"},"Slack"),w("span",{class:"new-thread-launch-card-pill"},"Browser Use")],-1))]),w("div",U$,[w("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:Zy},D(m(f)("Explore Plugins & Apps")),1),w("button",{class:"new-thread-launch-card-button",type:"button",onClick:sp},D(m(f)("Dismiss")),1)])])):ve("",!0),(_(),Qe(nl,{to:"body"},[Zo.value?(_(),F("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:wt(xb,["self"]),onMouseup:kb},[w("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":m(f)("Select folder"),onKeydown:xo(wt(Oi,["prevent"]),["esc"])},[w("div",H$,[w("p",q$,D(m(f)("Select folder")),1),w("button",{class:"new-thread-open-folder-close",type:"button",onClick:Oi},D(m(f)("Cancel")),1)]),w("p",W$,D(m(f)("Current folder")),1),w("div",G$,[_n(w("input",{ref_key:"existingFolderPathInputRef",ref:Ei,"onUpdate:modelValue":p[10]||(p[10]=T=>la.value=T),class:"new-thread-open-folder-path",type:"text",placeholder:m(f)("Current folder"),title:la.value||m(f)("Unavailable"),disabled:Vn.value||Bo.value,onBlur:Db,onKeydown:[xo(wt(Fb,["prevent"]),["enter"]),xo(wt(Oi,["prevent"]),["esc"])]},null,40,V$),[[On,la.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!yl.value||Vn.value||Bo.value,onClick:p[11]||(p[11]=T=>Qc())},D(Bo.value?m(f)("Opening…"):m(f)("Open")),9,K$)]),w("div",Y$,[w("label",J$,[_n(w("input",{"onUpdate:modelValue":p[12]||(p[12]=T=>ji.value=T),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:$b},null,544),[[V0,ji.value]]),w("span",null,D(m(f)("Show hidden folders")),1)]),w("button",{class:ut(["new-thread-folder-action",{"new-thread-folder-action-primary":Z.value}]),type:"button","aria-pressed":Z.value,disabled:!Fo.value||Vn.value||Bo.value||Be.value||!!pn.value&&!Z.value,onClick:Bb},D(m(f)("New folder")),11,Q$)]),Z.value?(_(),F("div",X$,[w("div",Z$,[_n(w("input",{ref_key:"createFolderInputRef",ref:nu,"onUpdate:modelValue":p[13]||(p[13]=T=>fe.value=T),class:"new-thread-open-folder-create-input",type:"text",placeholder:m(f)("Folder name"),onKeydown:[xo(wt(jp,["prevent"]),["enter"]),xo(wt(Tl,["prevent"]),["esc"])]},null,40,eO),[[On,fe.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!ow.value||Be.value,onClick:jp},D(rw.value),9,tO)]),Te.value?(_(),F("div",nO,[w("span",null,D(Te.value),1),w("a",{class:"visible-error-feedback",href:m(It),onClick:p[14]||(p[14]=T=>Xn(T,Te.value))},D(m(f)("Send feedback")),9,oO)])):ve("",!0)])):ve("",!0),_n(w("input",{ref_key:"existingFolderFilterInputRef",ref:iu,"onUpdate:modelValue":p[15]||(p[15]=T=>er.value=T),class:"new-thread-open-folder-filter",type:"text",placeholder:m(f)("Filter folders..."),onKeydown:xo(wt(Oi,["prevent"]),["esc"])},null,40,rO),[[On,er.value]]),pn.value?(_(),F("div",aO,[w("div",sO,[w("span",null,D(pn.value),1),w("a",{class:"visible-error-feedback",href:m(It),onClick:p[16]||(p[16]=T=>Xn(T,pn.value))},D(m(f)("Send feedback")),9,iO)]),w("button",{class:"new-thread-folder-action",type:"button",disabled:Vn.value||Bo.value,onClick:Ob},D(m(f)("Retry")),9,lO)])):ve("",!0),Vn.value?(_(),F("p",uO,D(m(f)("Loading folders…")),1)):!pn.value&&zc.value.length===0?(_(),F("p",cO,D(er.value.trim()?m(f)("No folders match this filter."):m(f)("No subfolders found here.")),1)):zc.value.length>0?(_(),F("ul",dO,[(_(!0),F(lt,null,en(zc.value,T=>(_(),F("li",{key:T.key,class:"new-thread-open-folder-item"},[w("button",{class:"new-thread-open-folder-item-main",type:"button",title:T.path,disabled:Vn.value||Bo.value,onClick:O=>Nb(T.path)},[w("span",pO,D(T.name),1)],8,fO),T.kind==="directory"?(_(),F("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:Vn.value||Bo.value,onClick:O=>Qc(T.path)},D(m(f)("Open")),9,hO)):ve("",!0)]))),128))])):ve("",!0)],40,z$)],32)):ve("",!0)])),(_(),Qe(nl,{to:"body"},[mt.value?(_(),F("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:wt(Ib,["self"]),onMouseup:Ab},[w("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":m(f)("Create or clone project"),onKeydown:xo(wt(hu,["prevent"]),["esc"])},[w("div",vO,[w("p",gO,D(m(f)("Create or clone project")),1),w("button",{class:"new-thread-open-folder-close",type:"button",disabled:un.value,onClick:hu},D(m(f)("Cancel")),9,yO)]),w("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":m(f)("Project source")},[w("button",{class:ut(["new-thread-project-mode-tab",{"is-active":et.value==="create"}]),type:"button",role:"tab","aria-selected":et.value==="create",disabled:un.value,onClick:p[17]||(p[17]=T=>et.value="create")},D(m(f)("New project")),11,bO),w("button",{class:ut(["new-thread-project-mode-tab",{"is-active":et.value==="clone"}]),type:"button",role:"tab","aria-selected":et.value==="clone",disabled:un.value,onClick:p[18]||(p[18]=T=>et.value="clone")},D(m(f)("Clone from GitHub")),11,TO)],8,wO),w("label",SO,[w("span",CO,D(m(f)("Destination folder")),1),_n(w("input",{"onUpdate:modelValue":p[19]||(p[19]=T=>yt.value=T),class:"new-thread-open-folder-path",type:"text",disabled:un.value,placeholder:m(f)("Destination folder")},null,8,xO),[[On,yt.value]])]),et.value==="create"?(_(),F("label",kO,[w("span",IO,D(m(f)("Project name")),1),_n(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:La,"onUpdate:modelValue":p[20]||(p[20]=T=>Et.value=T),class:"new-thread-open-folder-create-input",type:"text",disabled:un.value,placeholder:m(f)("Project name"),onKeydown:xo(wt(Jc,["prevent"]),["enter"])},null,40,AO),[[On,Et.value]])])):et.value==="clone"?(_(),F("label",_O,[w("span",PO,D(m(f)("GitHub repository URL")),1),_n(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:La,"onUpdate:modelValue":p[21]||(p[21]=T=>Mt.value=T),class:"new-thread-open-folder-create-input",type:"url",disabled:un.value,placeholder:"https://github.com/owner/repo",onKeydown:xo(wt(Jc,["prevent"]),["enter"])},null,40,RO),[[On,Mt.value]])])):ve("",!0),Do.value?(_(),F("div",EO,[w("span",null,D(Do.value),1),w("a",{class:"visible-error-feedback",href:m(It),onClick:p[22]||(p[22]=T=>Xn(T,Do.value))},D(m(f)("Send feedback")),9,MO)])):ve("",!0),w("div",jO,[w("button",{class:"new-thread-folder-action",type:"button",disabled:un.value,onClick:hu},D(m(f)("Cancel")),9,LO),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!fp.value||un.value,onClick:Jc},D(aw.value),9,NO)])],40,mO)],32)):ve("",!0)])),ri.value?(_(),Qe(j1,{key:2,class:"new-thread-runtime-dropdown",modelValue:gn.value,"onUpdate:modelValue":p[23]||(p[23]=T=>gn.value=T)},null,8,["modelValue"])):ve("",!0),gn.value==="worktree"?(_(),F("div",$O,[w("p",OO,D(m(f)("Base branch")),1),Fe(wi,{class:"new-thread-branch-dropdown","model-value":oo.value,options:Uc.value,placeholder:m(f)("Select branch"),"enable-search":!0,"search-placeholder":m(f)("Search branches..."),disabled:k.value||Uc.value.length===0,"onUpdate:modelValue":mb},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),w("p",DO,D(k.value?m(f)("Loading branches…"):lp.value?m(f)("New worktree branch will start from {branch}.",{branch:lp.value}):m(f)("No Git branches found for this folder.")),1)])):ve("",!0),ri.value?(_(),F("p",FO,D(m(f)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):ve("",!0),Ae.value.phase!=="idle"?(_(),F("div",{key:5,class:ut(["worktree-init-status",{"is-running":Ae.value.phase==="running","is-error":Ae.value.phase==="error"}])},[w("strong",BO,D(Ae.value.title),1),w("span",UO,D(Ae.value.message),1)],2)):ve("",!0)]),w("div",zO,[m(Ie)?(_(),F("div",HO,[w("span",null,D(m(f)(m(Ie))),1),w("a",{class:"visible-error-feedback",href:m(It),onClick:p[24]||(p[24]=T=>Xn(T,m(Ie)))},D(m(f)("Send feedback")),9,qO)])):ve("",!0),Fe(Bm,{ref_key:"homeThreadComposerRef",ref:Ro,"active-thread-id":oi.value,cwd:bn.value,"fuzzy-file-search-results":m(Ze),onRegisterFuzzySession:m(vt),"collaboration-modes":m(xe),"selected-collaboration-mode":m(ae),models:m($e),"model-reasoning-efforts":m(Ne),"selected-model":op.value,"selected-reasoning-effort":m(Ee),"selected-speed-mode":m(ke),"is-updating-speed-mode":m(M),skills:m(ze),"thread-token-usage":m(W),"codex-quota":m(pe),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":hs.value,"in-progress-submit-mode":Xo.value,"dictation-click-to-toggle":aa.value,"dictation-auto-send":Ma.value,"dictation-language":Js.value,onSubmit:Pp,"onUpdate:selectedCollaborationMode":Up,"onUpdate:selectedModel":Op,"onUpdate:selectedReasoningEffort":Dp,"onUpdate:selectedSpeedMode":Fp,"approval-policy":Tr.value,"is-approval-policy-saving":Gr.value,"approval-policy-error":Jo.value,"approval-policy-notice":Sr.value,"onUpdate:approvalPolicy":Gs,onSaveApprovalPolicy:cs,onSlashCommand:Bp},null,8,["active-thread-id","cwd","fuzzy-file-search-results","onRegisterFuzzySession","collaboration-modes","selected-collaboration-mode","models","model-reasoning-efforts","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","thread-token-usage","codex-quota","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","dictation-language","approval-policy","is-approval-policy-saving","approval-policy-error","approval-policy-notice"])])])):(_(),F("div",WO,[Hn.value&&m(re)&&bn.value?(_(),Qe(m(o),{key:0,"thread-id":m(re),cwd:bn.value,"is-thread-in-progress":$c.value,"initial-file-path":Jr.value,"commit-sha":Qr.value,onClose:p[25]||(p[25]=T=>Hn.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress","initial-file-path","commit-sha"])):(_(),F(lt,{key:1},[w("div",GO,[Fe(m(t),{ref_key:"threadConversationRef",ref:eo,messages:Wy.value,"is-loading":m(ie),"active-thread-id":oi.value,cwd:bn.value,"live-overlay":Ky.value,"live-turn-id":m(X),"pending-requests":m(he),"has-more-persisted-above":m(ct),"is-loading-persisted-above":m(se),"load-earlier-messages":m(He),onForkThread:lb,onRollback:Wb,onFileChangesChanged:dw,onRespondServerRequest:Cp},null,8,["messages","is-loading","active-thread-id","cwd","live-overlay","live-turn-id","pending-requests","has-more-persisted-above","is-loading-persisted-above","load-earlier-messages"])]),w("div",{class:"composer-with-queue",ref_key:"composerQueueRef",ref:Go},[ap.value?(_(),F("div",VO,D(m(f)("This thread is running in the Codex TUI")),1)):ve("",!0),m(Ie)?(_(),F("div",KO,[w("span",null,D(m(f)(m(Ie))),1),w("a",{class:"visible-error-feedback",href:m(It),onClick:p[26]||(p[26]=T=>Xn(T,m(Ie)))},D(m(f)("Send feedback")),9,YO)])):ve("",!0),Fe(m(v),{messages:m(cn),onEdit:pb,onSteer:m(va),onDelete:m(Io),onReorder:Hb},null,8,["messages","onSteer","onDelete"]),Sl.value?(_(),F("div",JO,[w("span",null,D(Sl.value),1),w("button",{type:"button",class:"interrupt-recovered-dismiss","aria-label":m(f)("Dismiss"),onClick:p[27]||(p[27]=T=>Sl.value="")}," × ",8,QO)])):ve("",!0),lu.value?(_(),Qe(m(c),{key:3,request:lu.value,"request-count":m(he).length,"has-queue-above":m(cn).length>0,"panel-width":Cn.value,"visual-viewport-height":vl.value?ei.value:0,"panel-error":Yy.value,onRespondServerRequest:Cp},null,8,["request","request-count","has-queue-above","panel-width","visual-viewport-height","panel-error"])):(_(),Qe(Bm,{key:4,ref_key:"threadComposerRef",ref:Zn,"active-thread-id":oi.value,cwd:bn.value,"fuzzy-file-search-results":m(Ze),onRegisterFuzzySession:m(vt),"collaboration-modes":m(xe),"selected-collaboration-mode":m(ae),models:m($e),"model-reasoning-efforts":m(Ne),"selected-model":op.value,"selected-reasoning-effort":m(Ee),"selected-speed-mode":m(ke),"is-updating-speed-mode":m(M),skills:m(ze),"thread-token-usage":m(W),"codex-quota":m(pe),"is-turn-in-progress":$c.value,"is-stop-pending":m(A),"is-interrupting-turn":m(De),"is-compacting":Xy.value,"external-session-active":ap.value,"has-queue-above":m(cn).length>0,"send-with-enter":hs.value,"in-progress-submit-mode":Xo.value,"dictation-click-to-toggle":aa.value,"dictation-auto-send":Ma.value,"dictation-language":Js.value,"onUpdate:selectedCollaborationMode":Up,onSubmit:Pp,"onUpdate:selectedModel":Op,"onUpdate:selectedReasoningEffort":Dp,"onUpdate:selectedSpeedMode":Fp,"approval-policy":Tr.value,"is-approval-policy-saving":Gr.value,"approval-policy-error":Jo.value,"approval-policy-notice":Sr.value,"onUpdate:approvalPolicy":Gs,onSaveApprovalPolicy:cs,"plan-panel":Nc.value,onInterrupt:qb,onSlashCommand:Bp,onImplementPlan:Gb,onCompactContext:ew},null,8,["active-thread-id","cwd","fuzzy-file-search-results","onRegisterFuzzySession","collaboration-modes","selected-collaboration-mode","models","model-reasoning-efforts","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","thread-token-usage","codex-quota","is-turn-in-progress","is-stop-pending","is-interrupting-turn","is-compacting","external-session-active","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","dictation-language","approval-policy","is-approval-policy-saving","approval-policy-error","approval-policy-notice","plan-panel"]))],512)],64))]))])],6),m(Ct)&&m(sn)?(_(),F("div",{key:0,class:"content-right-panel-backdrop",role:"presentation",onClick:p[28]||(p[28]=(...T)=>m(zt)&&m(zt)(...T))})):ve("",!0),uu.value&&(m(Ct)||!m(Mn))?(_(),F("aside",{key:1,class:ut(["content-right-panel",{"is-mobile-open":m(sn)}]),style:or({"--right-panel-width":`${m(wa)}px`})},[m(Ct)?ve("",!0):(_(),F("div",{key:0,class:"content-right-panel-resize-handle","aria-hidden":"true",onMousedown:p[29]||(p[29]=(...T)=>m(jn)&&m(jn)(...T))},null,32)),w("div",XO,[w("div",ZO,[w("button",{class:ut(["content-right-panel-tab",{"is-active":m(tn)==="git"}]),type:"button",role:"tab","aria-selected":m(tn)==="git",onClick:p[30]||(p[30]=T=>m(jo)("git"))},[Fe(Zu,{class:"content-right-panel-tab-icon"}),Rs(" "+D(m(f)("Git")),1)],10,eD),w("button",{class:ut(["content-right-panel-tab",{"is-active":m(tn)==="files"}]),type:"button",role:"tab","aria-selected":m(tn)==="files",onClick:p[31]||(p[31]=T=>m(jo)("files"))},[Fe(Hm,{class:"content-right-panel-tab-icon"}),Rs(" "+D(m(f)("Files")),1)],10,tD),(_(!0),F(lt,null,en(m(Eo),T=>(_(),F("button",{key:T.key,class:ut(["content-right-panel-tab content-right-panel-tab--preview",{"is-active":m(tn)==="preview"&&m(Ko)===T.key}]),type:"button",role:"tab","aria-selected":m(tn)==="preview"&&m(Ko)===T.key,title:T.path,onClick:O=>m(zs)(T.key)},[Fe(ll,{class:"content-right-panel-tab-icon"}),w("span",oD,D(T.label),1),w("span",{class:"content-right-panel-tab-close",role:"button","aria-label":m(f)("Close"),title:m(f)("Close"),onClick:wt(O=>m(pr)(T.key),["stop"])},"×",8,rD)],10,nD))),128))]),w("div",aD,[w("div",sD,[w("button",{ref:"rightPanelAddButtonRef",class:"content-right-panel-add",type:"button","aria-label":m(f)("Add panel"),title:m(f)("Add panel"),onClick:p[32]||(p[32]=wt(T=>Yt.value=!m(Yt),["stop"]))},"+",8,iD),Fe(tu,{name:"right-panel-menu"},{default:pt(()=>[m(Yt)?(_(),F("div",lD,[w("button",{type:"button",onClick:p[33]||(p[33]=T=>m(jo)("terminal"))},[Fe(tj,{class:"content-right-panel-menu-icon"}),Rs(" "+D(m(f)("Terminal panel")),1)]),w("button",{type:"button",onClick:p[34]||(p[34]=T=>m(jo)("git"))},[Fe(Zu,{class:"content-right-panel-menu-icon"}),Rs(" "+D(m(f)("Git panel")),1)]),w("button",{type:"button",onClick:p[35]||(p[35]=T=>m(jo)("files"))},[Fe(Hm,{class:"content-right-panel-menu-icon"}),Rs(" "+D(m(f)("Files panel")),1)])])):ve("",!0)]),_:1})]),w("button",{class:"content-right-panel-close",type:"button","aria-label":m(f)("Close panel"),title:m(f)("Close panel"),onClick:p[36]||(p[36]=(...T)=>m(zt)&&m(zt)(...T))},[Fe(uf,{class:"content-right-panel-close-icon"})],8,uD)])]),w("div",cD,[m(tn)==="git"?(_(),Qe(m(i),{key:0,"current-branch":bo.value,"head-sha":$o.value,"head-subject":Xr.value,"head-date":C.value,detached:R.value,dirty:x.value,"worktree-change-summary":K.value,"worktree-changes":Ke.value,branches:Cr.value,"commits-by-branch":To.value,"commits-loading-for":so.value,"commits-error":Jt.value,"commit-files-by-sha":Zr.value,"commit-files-loading-for":ea.value,"commit-files-error":fs.value,loading:ps.value,busy:Ra.value,error:Dt.value,"review-open":Hn.value,"show-review":m(it).name==="thread"&&m(re).length>0,onToggleReview:Tb,onCheckoutBranch:gb,onResetBranchToCommit:yb,onLoadCommits:Mp,onLoadCommitFiles:wb,onOpenCommitFile:bb},null,8,["current-branch","head-sha","head-subject","head-date","detached","dirty","worktree-change-summary","worktree-changes","branches","commits-by-branch","commits-loading-for","commits-error","commit-files-by-sha","commit-files-loading-for","commit-files-error","loading","busy","error","review-open","show-review"])):m(tn)==="files"?(_(),Qe(m(l),{key:1,cwd:bn.value,onOpenPreview:m(Gt)},null,8,["cwd","onOpenPreview"])):m(tn)==="preview"&&m(to)?(_(),Qe(m(d),{key:2,"file-path":m(to).path,name:m(to).label},null,8,["file-path","name"])):(_(),Qe(m(n),{key:3,ref_key:"threadTerminalPanelRef",ref:fr,"thread-id":oi.value,cwd:bn.value,onHide:m(Hs),onTerminalFocusChange:m(Lo)},null,8,["thread-id","cwd","onHide","onTerminalFocusChange"]))])],6)):ve("",!0)])]),_:1},8,["is-sidebar-collapsed"]),U.value.phase!=="idle"?(_(),F("div",dD,[w("div",{class:"project-zip-modal",role:"dialog","aria-modal":"true","aria-label":m(f)("Export Project"),onClick:p[38]||(p[38]=wt(()=>{},["stop"]))},[w("div",pD,[w("h2",hD,D(m(f)("Export Project")),1),w("button",{class:"project-zip-modal-close",type:"button","aria-label":m(f)("Close"),disabled:U.value.phase==="exporting",onClick:Tp}," × ",8,mD)]),w("p",vD,D(U.value.phase==="exporting"?m(f)("Preparing project ZIP..."):U.value.fileName),1),w("div",gD,[w("span",null,D(U.value.phase==="exporting"?m(f)("Exporting"):m(f)("Ready")),1),w("span",null,D(Ic.value),1)]),w("div",yD,[w("div",{class:"project-zip-progress-fill",style:or({width:Qs.value})},null,4)]),U.value.error?(_(),F("p",wD,D(U.value.error),1)):ve("",!0),w("div",bD,[w("button",{class:"project-zip-modal-cancel",type:"button",disabled:U.value.phase==="exporting",onClick:Tp},D(m(f)("Close")),9,TD),w("button",{class:"project-zip-modal-action",type:"button",disabled:!U.value.blob,onClick:Qw},D(m(f)("Download")),9,SD),w("button",{class:"project-zip-modal-action project-zip-modal-action-primary",type:"button",disabled:!U.value.blob,onClick:Xw},D(m(f)("Share")),9,CD)])],8,fD)])):ve("",!0),Ri.value?(_(),F("div",{key:1,class:"codex-login-modal-backdrop",role:"presentation",onClick:Wc},[w("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":m(f)("Complete Codex login"),onSubmit:wt(Nw,["prevent"]),onClick:p[41]||(p[41]=wt(()=>{},["stop"]))},[w("div",kD,[w("h2",ID,D(m(f)("Complete Codex login")),1),w("button",{class:"codex-login-modal-close",type:"button","aria-label":m(f)("Close"),disabled:In.value,onClick:Wc}," × ",8,AD)]),w("p",_D,D(m(f)("Finish login in the browser, then paste the localhost callback URL here.")),1),Ks.value?(_(),F("a",{key:0,class:"codex-login-modal-link",href:Ks.value,target:"_blank",rel:"noreferrer"},D(m(f)("Open login URL")),9,PD)):ve("",!0),_n(w("input",{ref_key:"codexLoginCallbackInputRef",ref:ou,"onUpdate:modelValue":p[39]||(p[39]=T=>Ea.value=T),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:m(f)("Paste localhost callback URL"),disabled:In.value},null,8,RD),[[On,Ea.value]]),fn.value?(_(),F("div",ED,[w("span",null,D(fn.value),1),w("a",{class:"visible-error-feedback",href:m(It),onClick:p[40]||(p[40]=T=>Xn(T,fn.value))},D(m(f)("Send feedback")),9,MD)])):ve("",!0),w("div",jD,[w("button",{class:"codex-login-modal-cancel",type:"button",disabled:In.value,onClick:Wc},D(m(f)("Cancel")),9,LD),w("button",{class:"codex-login-modal-submit",type:"submit",disabled:In.value||Ea.value.trim().length===0},D(In.value?m(f)("Completing…"):m(f)("Complete")),9,ND)])],40,xD)])):ve("",!0)],64))}}),DD=xt(OD,[["__scopeId","data-v-8c863060"]]),Mu={render:()=>null},FD=dx({history:HC(),routes:[{path:"/",name:"home",component:Mu},{path:"/thread/:threadId",name:"thread",component:Mu},{path:"/skills",name:"skills",component:Mu},{path:"/automations",name:"automations",component:Mu},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codex-mobile-re. github: https://github.com/cattails-lgao/codex-mobile");YA();eC(DD).use(FD).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(oy("Service worker registration failed."),e)})});export{TF as $,Zu as A,ko as B,Ls as C,ku as D,xj as E,lt as F,KD as G,_r as H,uf as I,qf as J,Ft as K,UD as L,Lf as M,KR as N,fA as O,Ti as P,rI as Q,WD as R,HD as S,nl as T,GD as U,qD as V,VD as W,wi as X,bF as Y,SF as Z,xt as _,o$ as a,BD as a0,xo as a1,Qf as a2,_n as a3,On as a4,px as a5,fx as a6,Kk as a7,nF as a8,YD as a9,ll as aA,V0 as aB,yF as aC,wF as aD,JD as aa,QD as ab,iF as ac,fF as ad,pF as ae,oF as af,dF as ag,ZD as ah,XD as ai,eF as aj,tF as ak,hF as al,vF as am,gF as an,rF as ao,aF as ap,sF as aq,lF as ar,cF as as,uF as at,mF as au,Ix as av,Ax as aw,Es as ax,sE as ay,zD as az,n$ as b,Y as c,qm as d,vn as e,_ as f,Bf as g,Qe as h,F as i,w as j,ve as k,en as l,Rs as m,ut as n,Fs as o,Fe as p,tu as q,S as r,pt as s,D as t,m as u,ha as v,wt as w,ot as x,or as y,iy as z};
|