codex-mobile-re 0.1.136 → 0.1.138
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AutomationsPanel-BrxpYd3F.js → AutomationsPanel-CDEKwt6K.js} +1 -1
- package/dist/assets/{DirectoryHub-CbWz81wr.js → DirectoryHub-DVmDATpS.js} +1 -1
- package/dist/assets/{QueuedMessages-BYByp2ES.js → QueuedMessages-ELc1xjI5.js} +1 -1
- package/dist/assets/{ReviewPane-BzcuGGZz.js → ReviewPane-27Mn7pUF.js} +1 -1
- package/dist/assets/{RightFilePreview-BRXbHofi.js → RightFilePreview-7I6S8IKp.js} +1 -1
- package/dist/assets/{RightFilesPanel-mG5aaeVI.js → RightFilesPanel-BiloZijH.js} +1 -1
- package/dist/assets/{RightGitPanel-BsVCibLZ.js → RightGitPanel-Cx6ye-CJ.js} +2 -2
- package/dist/assets/{SettingsDialog-D34lKAxd.js → SettingsDialog-CidE2T-1.js} +3 -3
- package/dist/assets/ThreadConversation-BwVKGC9K.js +25 -0
- package/dist/assets/{ThreadConversation-DynLmaDw.css → ThreadConversation-C63h9DGI.css} +1 -1
- package/dist/assets/{ThreadPendingRequestPanel-Bg_3qi-T.js → ThreadPendingRequestPanel-64Dcj9Ku.js} +1 -1
- package/dist/assets/{ThreadTerminalPanel-BlisDnyv.js → ThreadTerminalPanel-D2OFYu0C.js} +1 -1
- package/dist/assets/index-B7NhUyvj.js +98 -0
- package/dist/assets/{index-CuSbagu4.css → index-CKSFHnPK.css} +1 -1
- package/dist/index.html +2 -2
- package/dist/sw.js +34 -8
- package/dist-cli/index.js +147 -38
- package/dist-cli/index.js.map +1 -1
- package/package.json +79 -81
- package/dist/assets/ThreadConversation-BiyKia_7.js +0 -25
- package/dist/assets/index-ChD_mFyW.js +0 -98
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreadConversation-BwVKGC9K.js","assets/sanitizeHtml-Bd3No2dT.js","assets/ThreadConversation-C63h9DGI.css","assets/ThreadTerminalPanel-D2OFYu0C.js","assets/ThreadTerminalPanel-DkX7vTl_.css","assets/ReviewPane-27Mn7pUF.js","assets/ReviewPane-BFBDQWlW.css","assets/DirectoryHub-DVmDATpS.js","assets/DirectoryHub-DcMzIMOW.css","assets/AutomationsPanel-CDEKwt6K.js","assets/AutomationsPanel-Dz1E0PMi.css","assets/SettingsDialog-CidE2T-1.js","assets/SettingsDialog-C6mYdSFF.css","assets/RightGitPanel-Cx6ye-CJ.js","assets/RightGitPanel-CQgG9pXB.css","assets/RightFilesPanel-BiloZijH.js","assets/RightFilesPanel-ev__hRb5.css","assets/RightFilePreview-7I6S8IKp.js","assets/RightFilePreview-DNZDBkBr.css","assets/ThreadPendingRequestPanel-64Dcj9Ku.js","assets/ThreadPendingRequestPanel-BlBoJVzv.css","assets/QueuedMessages-ELc1xjI5.js","assets/QueuedMessages-D6bvkQIC.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const s of a.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();/**
|
|
3
|
+
* @vue/shared v3.5.40
|
|
4
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
+
* @license MIT
|
|
6
|
+
**/function uh(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const zt={},il=[],va=()=>{},$v=()=>!1,Dc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Fc=e=>e.startsWith("onUpdate:"),bn=Object.assign,ch=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},hS=Object.prototype.hasOwnProperty,$t=(e,t)=>hS.call(e,t),lt=Array.isArray,ll=e=>gu(e)==="[object Map]",Bc=e=>gu(e)==="[object Set]",em=e=>gu(e)==="[object Date]",mt=e=>typeof e=="function",Yt=e=>typeof e=="string",Bo=e=>typeof e=="symbol",Ot=e=>e!==null&&typeof e=="object",Ov=e=>(Ot(e)||mt(e))&&mt(e.then)&&mt(e.catch),Dv=Object.prototype.toString,gu=e=>Dv.call(e),pS=e=>gu(e).slice(8,-1),Fv=e=>gu(e)==="[object Object]",dh=e=>Yt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Xl=uh(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Uc=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},mS=/-\w/g,vr=Uc(e=>e.replace(mS,t=>t.slice(1).toUpperCase())),gS=/\B([A-Z])/g,Hs=Uc(e=>e.replace(gS,"-$1").toLowerCase()),zc=Uc(e=>e.charAt(0).toUpperCase()+e.slice(1)),$d=Uc(e=>e?`on${zc(e)}`:""),No=(e,t)=>!Object.is(e,t),oc=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Bv=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},fh=e=>{const t=parseFloat(e);return isNaN(t)?e:t},vS=e=>{const t=Yt(e)?Number(e):NaN;return isNaN(t)?e:t};let tm;const Hc=()=>tm||(tm=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Zr(e){if(lt(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=Yt(r)?TS(r):Zr(r);if(o)for(const a in o)t[a]=o[a]}return t}else if(Yt(e)||Ot(e))return e}const yS=/;(?![^(]*\))/g,wS=/:([^]+)/,bS=/\/\*[^]*?\*\//g;function TS(e){const t={};return e.replace(bS,"").split(yS).forEach(n=>{if(n){const r=n.split(wS);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function ct(e){let t="";if(Yt(e))t=e;else if(lt(e))for(let n=0;n<e.length;n++){const r=ct(e[n]);r&&(t+=r+" ")}else if(Ot(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const SS="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",kS=uh(SS);function Uv(e){return!!e||e===""}function CS(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=vu(e[r],t[r]);return n}function vu(e,t){if(e===t)return!0;let n=em(e),r=em(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=Bo(e),r=Bo(t),n||r)return e===t;if(n=lt(e),r=lt(t),n||r)return n&&r?CS(e,t):!1;if(n=Ot(e),r=Ot(t),n||r){if(!n||!r)return!1;const o=Object.keys(e).length,a=Object.keys(t).length;if(o!==a)return!1;for(const s in e){const i=e.hasOwnProperty(s),l=t.hasOwnProperty(s);if(i&&!l||!i&&l||!vu(e[s],t[s]))return!1}}return String(e)===String(t)}function zv(e,t){return e.findIndex(n=>vu(n,t))}const Hv=e=>!!(e&&e.__v_isRef===!0),O=e=>Yt(e)?e:e==null?"":lt(e)||Ot(e)&&(e.toString===Dv||!mt(e.toString))?Hv(e)?O(e.value):JSON.stringify(e,Wv,2):String(e),Wv=(e,t)=>Hv(t)?Wv(e,t.value):ll(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],a)=>(n[Od(r,a)+" =>"]=o,n),{})}:Bc(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Od(n))}:Bo(t)?Od(t):Ot(t)&&!lt(t)&&!Fv(t)?String(t):t,Od=(e,t="")=>{var n;return Bo(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 Wn;class xS{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&&Wn&&(Wn.active?(this.parent=Wn,this.index=(Wn.scopes||(Wn.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 r=this.scopes.slice();for(t=0,n=r.length;t<n;t++)r[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 o=this.scopes.slice();for(t=0,n=o.length;t<n;t++)o[t].resume()}const r=this.effects.slice();for(t=0,n=r.length;t<n;t++)r[t].resume()}}run(t){if(this._active){const n=Wn;try{return Wn=this,t()}finally{Wn=n}}}on(){++this._on===1&&(this.prevScope=Wn,Wn=this)}off(){if(this._on>0&&--this._on===0){if(Wn===this)Wn=this.prevScope;else{let t=Wn;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){const o=this.scopes.slice();for(n=0,r=o.length;n<r;n++)o[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const o=this.parent.scopes.pop();o&&o!==this&&(this.parent.scopes[this.index]=o,o.index=this.index)}this.parent=void 0}}}function IS(){return Wn}let qt;const Dd=new WeakSet;class qv{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,Wn&&(Wn.active?Wn.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Dd.has(this)&&(Dd.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Vv(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,nm(this),Kv(this);const t=qt,n=Do;qt=this,Do=!0;try{return this.fn()}finally{Yv(this),qt=t,Do=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)mh(t);this.deps=this.depsTail=void 0,nm(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Dd.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Tf(this)&&this.run()}get dirty(){return Tf(this)}}let Gv=0,Zl,eu;function Vv(e,t=!1){if(e.flags|=8,t){e.next=eu,eu=e;return}e.next=Zl,Zl=e}function hh(){Gv++}function ph(){if(--Gv>0)return;if(eu){let t=eu;for(eu=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Zl;){let t=Zl;for(Zl=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function Kv(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Yv(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),mh(r),AS(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function Tf(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Jv(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Jv(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===su)||(e.globalVersion=su,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Tf(e))))return;e.flags|=2;const t=e.dep,n=qt,r=Do;qt=e,Do=!0;try{Kv(e);const o=e.fn(e._value);(t.version===0||No(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{qt=n,Do=r,Yv(e),e.flags&=-3}}function mh(e,t=!1){const{dep:n,prevSub:r,nextSub:o}=e;if(r&&(r.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let a=n.computed.deps;a;a=a.nextDep)mh(a,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function AS(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Do=!0;const Qv=[];function Ya(){Qv.push(Do),Do=!1}function Ja(){const e=Qv.pop();Do=e===void 0?!0:e}function nm(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=qt;qt=void 0;try{t()}finally{qt=n}}}let su=0;class _S{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 gh{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||!Do||qt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==qt)n=this.activeLink=new _S(qt,this),qt.deps?(n.prevDep=qt.depsTail,qt.depsTail.nextDep=n,qt.depsTail=n):qt.deps=qt.depsTail=n,Xv(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=qt.depsTail,n.nextDep=void 0,qt.depsTail.nextDep=n,qt.depsTail=n,qt.deps===n&&(qt.deps=r)}return n}trigger(t){this.version++,su++,this.notify(t)}notify(t){hh();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{ph()}}}function Xv(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)Xv(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Sf=new WeakMap,ki=Symbol(""),kf=Symbol(""),iu=Symbol("");function nr(e,t,n){if(Do&&qt){let r=Sf.get(e);r||Sf.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new gh),o.map=r,o.key=n),o.track()}}function za(e,t,n,r,o,a){const s=Sf.get(e);if(!s){su++;return}const i=l=>{l&&l.trigger()};if(hh(),t==="clear")s.forEach(i);else{const l=lt(e),c=l&&dh(n);if(l&&n==="length"){const d=Number(r);s.forEach((m,f)=>{(f==="length"||f===iu||!Bo(f)&&f>=d)&&i(m)})}else switch((n!==void 0||s.has(void 0))&&i(s.get(n)),c&&i(s.get(iu)),t){case"add":l?c&&i(s.get("length")):(i(s.get(ki)),ll(e)&&i(s.get(kf)));break;case"delete":l||(i(s.get(ki)),ll(e)&&i(s.get(kf)));break;case"set":ll(e)&&i(s.get(ki));break}}ph()}function Xi(e){const t=Lt(e);return t===e?t:(nr(t,"iterate",iu),eo(e)?t:t.map(Uo))}function Wc(e){return nr(e=Lt(e),"iterate",iu),e}function pa(e,t){return Qa(e)?yl(Ci(e)?Uo(t):t):Uo(t)}const PS={__proto__:null,[Symbol.iterator](){return Fd(this,Symbol.iterator,e=>pa(this,e))},concat(...e){return Xi(this).concat(...e.map(t=>lt(t)?Xi(t):t))},entries(){return Fd(this,"entries",e=>(e[1]=pa(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(r=>pa(this,r)),arguments)},find(e,t){return $a(this,"find",e,t,n=>pa(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=>pa(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 Bd(this,"includes",e)},indexOf(...e){return Bd(this,"indexOf",e)},join(e){return Xi(this).join(e)},lastIndexOf(...e){return Bd(this,"lastIndexOf",e)},map(e,t){return $a(this,"map",e,t,void 0,arguments)},pop(){return zl(this,"pop")},push(...e){return zl(this,"push",e)},reduce(e,...t){return rm(this,"reduce",e,t)},reduceRight(e,...t){return rm(this,"reduceRight",e,t)},shift(){return zl(this,"shift")},some(e,t){return $a(this,"some",e,t,void 0,arguments)},splice(...e){return zl(this,"splice",e)},toReversed(){return Xi(this).toReversed()},toSorted(e){return Xi(this).toSorted(e)},toSpliced(...e){return Xi(this).toSpliced(...e)},unshift(...e){return zl(this,"unshift",e)},values(){return Fd(this,"values",e=>pa(this,e))}};function Fd(e,t,n){const r=Wc(e),o=r[t]();return r!==e&&!eo(e)&&(o._next=o.next,o.next=()=>{const a=o._next();return a.done||(a.value=n(a.value)),a}),o}const ES=Array.prototype;function $a(e,t,n,r,o,a){const s=Wc(e),i=s!==e&&!eo(e),l=s[t];if(l!==ES[t]){const m=l.apply(e,a);return i?Uo(m):m}let c=n;s!==e&&(i?c=function(m,f){return n.call(this,pa(e,m),f,e)}:n.length>2&&(c=function(m,f){return n.call(this,m,f,e)}));const d=l.call(s,c,r);return i&&o?o(d):d}function rm(e,t,n,r){const o=Wc(e),a=o!==e&&!eo(e);let s=n,i=!1;o!==e&&(a?(i=r.length===0,s=function(c,d,m){return i&&(i=!1,c=pa(e,c)),n.call(this,c,pa(e,d),m,e)}):n.length>3&&(s=function(c,d,m){return n.call(this,c,d,m,e)}));const l=o[t](s,...r);return i?pa(e,l):l}function Bd(e,t,n){const r=Lt(e);nr(r,"iterate",iu);const o=r[t](...n);return(o===-1||o===!1)&&wh(n[0])?(n[0]=Lt(n[0]),r[t](...n)):o}function zl(e,t,n=[]){Ya(),hh();const r=Lt(e)[t].apply(e,n);return ph(),Ja(),r}const MS=uh("__proto__,__v_isRef,__isVue"),Zv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Bo));function RS(e){Bo(e)||(e=String(e));const t=Lt(this);return nr(t,"has",e),t.hasOwnProperty(e)}class ey{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const o=this._isReadonly,a=this._isShallow;if(n==="__v_isReactive")return!o;if(n==="__v_isReadonly")return o;if(n==="__v_isShallow")return a;if(n==="__v_raw")return r===(o?a?zS:oy:a?ry:ny).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const s=lt(t);if(!o){let l;if(s&&(l=PS[n]))return l;if(n==="hasOwnProperty")return RS}const i=Reflect.get(t,n,$n(t)?t:r);if((Bo(n)?Zv.has(n):MS(n))||(o||nr(t,"get",n),a))return i;if($n(i)){const l=s&&dh(n)?i:i.value;return o&&Ot(l)?xf(l):l}return Ot(i)?o?xf(i):qc(i):i}}class ty extends ey{constructor(t=!1){super(!1,t)}set(t,n,r,o){let a=t[n];const s=lt(t)&&dh(n);if(!this._isShallow){const c=Qa(a);if(!eo(r)&&!Qa(r)&&(a=Lt(a),r=Lt(r)),!s&&$n(a)&&!$n(r))return c||(a.value=r),!0}const i=s?Number(n)<t.length:$t(t,n),l=Reflect.set(t,n,r,$n(t)?t:o);return t===Lt(o)&&l&&(i?No(r,a)&&za(t,"set",n,r):za(t,"add",n,r)),l}deleteProperty(t,n){const r=$t(t,n);t[n];const o=Reflect.deleteProperty(t,n);return o&&r&&za(t,"delete",n,void 0),o}has(t,n){const r=Reflect.has(t,n);return(!Bo(n)||!Zv.has(n))&&nr(t,"has",n),r}ownKeys(t){return nr(t,"iterate",lt(t)?"length":ki),Reflect.ownKeys(t)}}class LS extends ey{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const jS=new ty,NS=new LS,$S=new ty(!0);const Cf=e=>e,Uu=e=>Reflect.getPrototypeOf(e);function OS(e,t,n){return function(...r){const o=this.__v_raw,a=Lt(o),s=ll(a),i=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,c=o[e](...r),d=n?Cf:t?yl:Uo;return!t&&nr(a,"iterate",l?kf:ki),bn(Object.create(c),{next(){const{value:m,done:f}=c.next();return f?{value:m,done:f}:{value:i?[d(m[0]),d(m[1])]:d(m),done:f}}})}}function zu(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function DS(e,t){const n={get(o){const a=this.__v_raw,s=Lt(a),i=Lt(o);e||(No(o,i)&&nr(s,"get",o),nr(s,"get",i));const{has:l}=Uu(s),c=t?Cf:e?yl:Uo;if(l.call(s,o))return c(a.get(o));if(l.call(s,i))return c(a.get(i));a!==s&&a.get(o)},get size(){const o=this.__v_raw;return!e&&nr(Lt(o),"iterate",ki),o.size},has(o){const a=this.__v_raw,s=Lt(a),i=Lt(o);return e||(No(o,i)&&nr(s,"has",o),nr(s,"has",i)),o===i?a.has(o):a.has(o)||a.has(i)},forEach(o,a){const s=this,i=s.__v_raw,l=Lt(i),c=t?Cf:e?yl:Uo;return!e&&nr(l,"iterate",ki),i.forEach((d,m)=>o.call(a,c(d),c(m),s))}};return bn(n,e?{add:zu("add"),set:zu("set"),delete:zu("delete"),clear:zu("clear")}:{add(o){const a=Lt(this),s=Uu(a),i=Lt(o),l=!t&&!eo(o)&&!Qa(o)?i:o;return s.has.call(a,l)||No(o,l)&&s.has.call(a,o)||No(i,l)&&s.has.call(a,i)||(a.add(l),za(a,"add",l,l)),this},set(o,a){!t&&!eo(a)&&!Qa(a)&&(a=Lt(a));const s=Lt(this),{has:i,get:l}=Uu(s);let c=i.call(s,o);c||(o=Lt(o),c=i.call(s,o));const d=l.call(s,o);return s.set(o,a),c?No(a,d)&&za(s,"set",o,a):za(s,"add",o,a),this},delete(o){const a=Lt(this),{has:s,get:i}=Uu(a);let l=s.call(a,o);l||(o=Lt(o),l=s.call(a,o)),i&&i.call(a,o);const c=a.delete(o);return l&&za(a,"delete",o,void 0),c},clear(){const o=Lt(this),a=o.size!==0,s=o.clear();return a&&za(o,"clear",void 0,void 0),s}}),["keys","values","entries",Symbol.iterator].forEach(o=>{n[o]=OS(o,e,t)}),n}function vh(e,t){const n=DS(e,t);return(r,o,a)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get($t(n,o)&&o in r?n:r,o,a)}const FS={get:vh(!1,!1)},BS={get:vh(!1,!0)},US={get:vh(!0,!1)};const ny=new WeakMap,ry=new WeakMap,oy=new WeakMap,zS=new WeakMap;function HS(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function qc(e){return Qa(e)?e:yh(e,!1,jS,FS,ny)}function ay(e){return yh(e,!1,$S,BS,ry)}function xf(e){return yh(e,!0,NS,US,oy)}function yh(e,t,n,r,o){if(!Ot(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const a=o.get(e);if(a)return a;const s=HS(pS(e));if(s===0)return e;const i=new Proxy(e,s===2?r:n);return o.set(e,i),i}function Ci(e){return Qa(e)?Ci(e.__v_raw):!!(e&&e.__v_isReactive)}function Qa(e){return!!(e&&e.__v_isReadonly)}function eo(e){return!!(e&&e.__v_isShallow)}function wh(e){return e?!!e.__v_raw:!1}function Lt(e){const t=e&&e.__v_raw;return t?Lt(t):e}function WS(e){return!$t(e,"__v_skip")&&Object.isExtensible(e)&&Bv(e,"__v_skip",!0),e}const Uo=e=>Ot(e)?qc(e):e,yl=e=>Ot(e)?xf(e):e;function $n(e){return e?e.__v_isRef===!0:!1}function S(e){return sy(e,!1)}function qS(e){return sy(e,!0)}function sy(e,t){return $n(e)?e:new GS(e,t)}class GS{constructor(t,n){this.dep=new gh,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Lt(t),this._value=n?t:Uo(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||eo(t)||Qa(t);t=r?t:Lt(t),No(t,n)&&(this._rawValue=t,this._value=r?t:Uo(t),this.dep.trigger())}}function g(e){return $n(e)?e.value:e}const VS={get:(e,t,n)=>t==="__v_raw"?e:g(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return $n(o)&&!$n(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}};function iy(e){return Ci(e)?e:new Proxy(e,VS)}class KS{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new gh(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=su-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&qt!==this)return Vv(this,!0),!0}get value(){const t=this.dep.track();return Jv(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function YS(e,t,n=!1){let r,o;return mt(e)?r=e:(r=e.get,o=e.set),new KS(r,o,n)}const Hu={},hc=new WeakMap;let vi;function JS(e,t=!1,n=vi){if(n){let r=hc.get(n);r||hc.set(n,r=[]),r.push(e)}}function QS(e,t,n=zt){const{immediate:r,deep:o,once:a,scheduler:s,augmentJob:i,call:l}=n,c=V=>o?V:eo(V)||o===!1||o===0?Ha(V,1):Ha(V);let d,m,f,v,T=!1,k=!1;if($n(e)?(m=()=>e.value,T=eo(e)):Ci(e)?(m=()=>c(e),T=!0):lt(e)?(k=!0,T=e.some(V=>Ci(V)||eo(V)),m=()=>e.map(V=>{if($n(V))return V.value;if(Ci(V))return c(V);if(mt(V))return l?l(V,2):V()})):mt(e)?t?m=l?()=>l(e,2):e:m=()=>{if(f){Ya();try{f()}finally{Ja()}}const V=vi;vi=d;try{return l?l(e,3,[v]):e(v)}finally{vi=V}}:m=va,t&&o){const V=m,U=o===!0?1/0:o;m=()=>Ha(V(),U)}const N=IS(),_=()=>{d.stop(),N&&N.active&&ch(N.effects,d)};if(a&&t){const V=t;t=(...U)=>{const fe=V(...U);return _(),fe}}let j=k?new Array(e.length).fill(Hu):Hu;const W=V=>{if(!(!(d.flags&1)||!d.dirty&&!V))if(t){const U=d.run();if(V||o||T||(k?U.some((fe,K)=>No(fe,j[K])):No(U,j))){f&&f();const fe=vi;vi=d;try{const K=[U,j===Hu?void 0:k&&j[0]===Hu?[]:j,v];j=U,l?l(t,3,K):t(...K)}finally{vi=fe}}}else d.run()};return i&&i(W),d=new qv(m),d.scheduler=s?()=>s(W,!1):W,v=V=>JS(V,!1,d),f=d.onStop=()=>{const V=hc.get(d);if(V){if(l)l(V,4);else for(const U of V)U();hc.delete(d)}},t?r?W(!0):j=d.run():s?s(W.bind(null,!0),!0):d.run(),_.pause=d.pause.bind(d),_.resume=d.resume.bind(d),_.stop=_,_}function Ha(e,t=1/0,n){if(t<=0||!Ot(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,$n(e))Ha(e.value,t,n);else if(lt(e))for(let r=0;r<e.length;r++)Ha(e[r],t,n);else if(Bc(e)||ll(e))e.forEach(r=>{Ha(r,t,n)});else if(Fv(e)){for(const r in e)Ha(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Ha(e[r],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 yu(e,t,n,r){try{return r?e(...r):e()}catch(o){wu(o,t,n)}}function no(e,t,n,r){if(mt(e)){const o=yu(e,t,n,r);return o&&Ov(o)&&o.catch(a=>{wu(a,t,n)}),o}if(lt(e)){const o=[];for(let a=0;a<e.length;a++)o.push(no(e[a],t,n,r));return o}}function wu(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||zt;if(t){let i=t.parent;const l=t.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;i;){const d=i.ec;if(d){for(let m=0;m<d.length;m++)if(d[m](e,l,c)===!1)return}i=i.parent}if(a){Ya(),yu(a,null,10,[e,l,c]),Ja();return}}XS(e,n,o,r,s)}function XS(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}const mr=[];let ha=-1;const ul=[];let Rs=null,nl=0;const ly=Promise.resolve();let pc=null;function Et(e){const t=pc||ly;return e?t.then(this?e.bind(this):e):t}function ZS(e){let t=ha+1,n=mr.length;for(;t<n;){const r=t+n>>>1,o=mr[r],a=lu(o);a<e||a===e&&o.flags&2?t=r+1:n=r}return t}function bh(e){if(!(e.flags&1)){const t=lu(e),n=mr[mr.length-1];!n||!(e.flags&2)&&t>=lu(n)?mr.push(e):mr.splice(ZS(t),0,e),e.flags|=1,uy()}}function uy(){pc||(pc=ly.then(dy))}function ek(e){lt(e)?ul.push(...e):Rs&&e.id===-1?Rs.splice(nl+1,0,e):e.flags&1||(ul.push(e),e.flags|=1),uy()}function om(e,t,n=ha+1){for(;n<mr.length;n++){const r=mr[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;mr.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function cy(e){if(ul.length){const t=[...new Set(ul)].sort((n,r)=>lu(n)-lu(r));if(ul.length=0,Rs){Rs.push(...t);return}for(Rs=t,nl=0;nl<Rs.length;nl++){const n=Rs[nl];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Rs=null,nl=0}}const lu=e=>e.id==null?e.flags&2?-1:1/0:e.id;function dy(e){try{for(ha=0;ha<mr.length;ha++){const t=mr[ha];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),yu(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;ha<mr.length;ha++){const t=mr[ha];t&&(t.flags&=-2)}ha=-1,mr.length=0,cy(),pc=null,(mr.length||ul.length)&&dy()}}let Vn=null,fy=null;function mc(e){const t=Vn;return Vn=e,fy=e&&e.type.__scopeId||null,t}function pt(e,t=Vn,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&yc(-1);const a=mc(t),s=qa.length;let i;try{i=e(...o)}finally{for(let l=qa.length;l>s;l--)Ih();mc(a),r._d&&yc(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function xn(e,t){if(Vn===null)return e;const n=Yc(Vn),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[a,s,i,l=zt]=t[o];a&&(mt(a)&&(a={mounted:a,updated:a}),a.deep&&Ha(s),r.push({dir:a,instance:n,value:s,oldValue:void 0,arg:i,modifiers:l}))}return e}function fi(e,t,n,r){const o=e.dirs,a=t&&t.dirs;for(let s=0;s<o.length;s++){const i=o[s];a&&(i.oldValue=a[s].value);let l=i.dir[r];l&&(Ya(),no(l,n,8,[e.el,i,e,t]),Ja())}}function ac(e,t){if(Gn){let n=Gn.provides;const r=Gn.parent&&Gn.parent.provides;r===n&&(n=Gn.provides=Object.create(r)),n[e]=t}}function Fo(e,t,n=!1){const r=_h();if(r||dl){let o=dl?dl._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&mt(t)?t.call(r&&r.proxy):t}}const tk=Symbol.for("v-scx"),nk=()=>Fo(tk);function ot(e,t,n){return hy(e,t,n)}function hy(e,t,n=zt){const{immediate:r,deep:o,flush:a,once:s}=n,i=bn({},n),l=t&&r||!t&&a!=="post";let c;if(bl){if(a==="sync"){const v=nk();c=v.__watcherHandles||(v.__watcherHandles=[])}else if(!l){const v=()=>{};return v.stop=va,v.resume=va,v.pause=va,v}}const d=Gn;i.call=(v,T,k)=>no(v,d,T,k);let m=!1;a==="post"?i.scheduler=v=>{hr(v,d&&d.suspense)}:a!=="sync"&&(m=!0,i.scheduler=(v,T)=>{T?v():bh(v)}),i.augmentJob=v=>{t&&(v.flags|=4),m&&(v.flags|=2,d&&(v.id=d.uid,v.i=d))};const f=QS(e,t,i);return bl&&(c?c.push(f):l&&f()),f}function rk(e,t,n){const r=this.proxy,o=Yt(e)?e.includes(".")?py(r,e):()=>r[e]:e.bind(r,r);let a;mt(t)?a=t:(a=t.handler,n=t);const s=Su(this),i=hy(o,a.bind(r),n);return s(),i}function py(e,t){const n=t.split(".");return()=>{let r=e;for(let o=0;o<n.length&&r;o++)r=r[n[o]];return r}}const Ps=new WeakMap,my=Symbol("_vte"),gy=e=>e.__isTeleport,wi=e=>e&&(e.disabled||e.disabled===""),ok=e=>e&&(e.defer||e.defer===""),am=e=>typeof SVGElement<"u"&&e instanceof SVGElement,sm=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,If=(e,t)=>{const n=e&&e.to;return Yt(n)?t?t(n):null:n},ak={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,a,s,i,l,c){const{mc:d,pc:m,pbc:f,o:{insert:v,querySelector:T,createText:k,createComment:N,parentNode:_}}=c,j=wi(t.props);let{dynamicChildren:W}=t;const V=(K,oe,ve)=>{K.shapeFlag&16&&d(K.children,oe,ve,o,a,s,i,l)},U=(K=t)=>{const oe=wi(K.props),ve=K.target=If(K.props,T),Pe=Af(ve,K,k,v);ve&&(s!=="svg"&&am(ve)?s="svg":s!=="mathml"&&sm(ve)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(ve),oe||(V(K,ve,Pe),Kl(K,!1)))},fe=K=>{const oe=()=>{if(Ps.get(K)===oe){if(Ps.delete(K),wi(K.props)){const ve=_(K.el)||n;V(K,ve,K.anchor),Kl(K,!0)}U(K)}};Ps.set(K,oe),hr(oe,a)};if(e==null){const K=t.el=k(""),oe=t.anchor=k("");if(v(K,n,r),v(oe,n,r),ok(t.props)||a&&a.pendingBranch){fe(t);return}j&&(V(t,n,oe),Kl(t,!0)),U()}else{t.el=e.el;const K=t.anchor=e.anchor,oe=Ps.get(e);if(oe){oe.flags|=8,Ps.delete(e),fe(t);return}t.targetStart=e.targetStart;const ve=t.target=e.target,Pe=t.targetAnchor=e.targetAnchor,we=wi(e.props),te=we?n:ve,ke=we?K:Pe;if(s==="svg"||am(ve)?s="svg":(s==="mathml"||sm(ve))&&(s="mathml"),W?(f(e.dynamicChildren,W,te,o,a,s,i),xh(e,t,!0)):l||m(e,t,te,ke,o,a,s,i,!1),j)we?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Wu(t,n,K,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const ee=If(t.props,T);ee&&(t.target=ee,Wu(t,ee,null,c,0))}else we&&Wu(t,ve,Pe,c,1);Kl(t,j)}},remove(e,t,n,{um:r,o:{remove:o}},a){const{shapeFlag:s,children:i,anchor:l,targetStart:c,targetAnchor:d,target:m,props:f}=e,v=wi(f),T=a||!v,k=Ps.get(e);if(k&&(k.flags|=8,Ps.delete(e)),m&&(o(c),o(d)),a&&o(l),!k&&(v||m)&&s&16)for(let N=0;N<i.length;N++){const _=i[N];r(_,t,n,T,!!_.dynamicChildren)}},move:Wu,hydrate:sk};function Wu(e,t,n,{o:{insert:r},m:o},a=2){a===0&&r(e.targetAnchor,t,n);const{el:s,anchor:i,shapeFlag:l,children:c,props:d}=e,m=a===2;if(m&&r(s,t,n),!Ps.has(e)&&(!m||wi(d))&&l&16)for(let f=0;f<c.length;f++)o(c[f],t,n,2);m&&r(i,t,n)}function sk(e,t,n,r,o,a,{o:{nextSibling:s,parentNode:i,querySelector:l,insert:c,createText:d}},m){function f(N,_){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,N._lpa=t.targetAnchor&&s(t.targetAnchor);break}}j=s(j)}}function v(N,_){_.anchor=m(s(N),_,i(N),n,r,o,a)}const T=t.target=If(t.props,l),k=wi(t.props);if(T){const N=T._lpa||T.firstChild;t.shapeFlag&16&&(k?(v(e,t),f(T,N),t.targetAnchor||Af(T,t,d,c,i(e)===T?e:null)):(t.anchor=s(e),f(T,N),t.targetAnchor||Af(T,t,d,c),m(N&&s(N),t,T,n,r,o,a))),Kl(t,k)}else k&&t.shapeFlag&16&&(v(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}const Bs=ak;function Kl(e,t){const n=e.ctx;if(n&&n.ut){let r,o;for(t?(r=e.el,o=e.anchor):(r=e.targetStart,o=e.targetAnchor);r&&r!==o;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function Af(e,t,n,r,o=null){const a=t.targetStart=n(""),s=t.targetAnchor=n("");return a[my]=s,e&&(r(a,e,o),r(s,e,o)),s}const Xr=Symbol("_leaveCb"),Hl=Symbol("_enterCb");function ik(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return es(()=>{e.isMounted=!0}),Ws(()=>{e.isUnmounting=!0}),e}const Qr=[Function,Array],vy={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Qr,onEnter:Qr,onAfterEnter:Qr,onEnterCancelled:Qr,onBeforeLeave:Qr,onLeave:Qr,onAfterLeave:Qr,onLeaveCancelled:Qr,onBeforeAppear:Qr,onAppear:Qr,onAfterAppear:Qr,onAppearCancelled:Qr},yy=e=>{const t=e.subTree;return t.component?yy(t.component):t},lk={name:"BaseTransition",props:vy,setup(e,{slots:t}){const n=_h(),r=ik();return()=>{const o=t.default&&Ty(t.default(),!0),a=o&&o.length?wy(o):n.subTree?me():void 0;if(!a)return;const s=Lt(e),{mode:i}=s;if(r.isLeaving)return Ud(a);const l=im(a);if(!l)return Ud(a);let c=_f(l,s,r,n,m=>c=m);l.type!==rr&&uu(l,c);let d=n.subTree&&im(n.subTree);if(d&&d.type!==rr&&!bi(d,l)&&yy(n).type!==rr){let m=_f(d,s,r,n);if(uu(d,m),i==="out-in"&&l.type!==rr)return r.isLeaving=!0,m.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete m.afterLeave,d=void 0},Ud(a);i==="in-out"&&l.type!==rr?m.delayLeave=(f,v,T)=>{const k=by(r,d);k[String(d.key)]=d,f[Xr]=()=>{v(),f[Xr]=void 0,delete c.delayedLeave,d=void 0},c.delayedLeave=()=>{T(),delete c.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return a}}};function wy(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==rr){t=n;break}}return t}const uk=lk;function by(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function _f(e,t,n,r,o){const{appear:a,mode:s,persisted:i=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:d,onEnterCancelled:m,onBeforeLeave:f,onLeave:v,onAfterLeave:T,onLeaveCancelled:k,onBeforeAppear:N,onAppear:_,onAfterAppear:j,onAppearCancelled:W}=t,V=String(e.key),U=by(n,e),fe=(ve,Pe)=>{ve&&no(ve,r,9,Pe)},K=(ve,Pe)=>{const we=Pe[1];fe(ve,Pe),lt(ve)?ve.every(te=>te.length<=1)&&we():ve.length<=1&&we()},oe={mode:s,persisted:i,beforeEnter(ve){let Pe=l;if(!n.isMounted)if(a)Pe=N||l;else return;ve[Xr]&&ve[Xr](!0);const we=U[V];we&&bi(e,we)&&we.el[Xr]&&we.el[Xr](),fe(Pe,[ve])},enter(ve){if(U[V]===e)return;let Pe=c,we=d,te=m;if(!n.isMounted)if(a)Pe=_||c,we=j||d,te=W||m;else return;let ke=!1;ve[Hl]=Ce=>{ke||(ke=!0,Ce?fe(te,[ve]):fe(we,[ve]),oe.delayedLeave&&oe.delayedLeave(),ve[Hl]=void 0)};const ee=ve[Hl].bind(null,!1);Pe?K(Pe,[ve,ee]):ee()},leave(ve,Pe){const we=String(e.key);if(ve[Hl]&&ve[Hl](!0),n.isUnmounting)return Pe();fe(f,[ve]);let te=!1;ve[Xr]=ee=>{te||(te=!0,Pe(),ee?fe(k,[ve]):fe(T,[ve]),ve[Xr]=void 0,U[we]===e&&delete U[we])};const ke=ve[Xr].bind(null,!1);U[we]=e,v?K(v,[ve,ke]):ke()},clone(ve){const Pe=_f(ve,t,n,r,o);return o&&o(Pe),Pe}};return oe}function Ud(e){if(bu(e))return e=Us(e),e.children=null,e}function im(e){if(!bu(e))return gy(e.type)&&e.children?wy(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&&mt(n.default))return n.default()}}function uu(e,t){e.shapeFlag&6&&e.component?(e.transition=t,uu(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 Ty(e,t=!1,n){let r=[],o=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===at?(s.patchFlag&128&&o++,r=r.concat(Ty(s.children,t,i))):(t||s.type!==rr)&&r.push(i!=null?Us(s,{key:i}):s)}if(o>1)for(let a=0;a<r.length;a++)r[a].patchFlag=-2;return r}function cn(e,t){return mt(e)?bn({name:e.name},t,{setup:e}):e}function Th(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function lm(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const gc=new WeakMap;function tu(e,t,n,r,o=!1){if(lt(e)){e.forEach((k,N)=>tu(k,t&&(lt(t)?t[N]:t),n,r,o));return}if(cl(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&tu(e,t,n,r.component.subTree);return}const a=r.shapeFlag&4?Yc(r.component):r.el,s=o?null:a,{i,r:l}=e,c=t&&t.r,d=i.refs===zt?i.refs={}:i.refs,m=i.setupState,f=Lt(m),v=m===zt?$v:k=>lm(d,k)?!1:$t(f,k),T=(k,N)=>!(N&&lm(d,N));if(c!=null&&c!==l){if(um(t),Yt(c))d[c]=null,v(c)&&(m[c]=null);else if($n(c)){const k=t;T(c,k.k)&&(c.value=null),k.k&&(d[k.k]=null)}}if(mt(l))yu(l,i,12,[s,d]);else{const k=Yt(l),N=$n(l);if(k||N){const _=()=>{if(e.f){const j=k?v(l)?m[l]:d[l]:T()||!e.k?l.value:d[e.k];if(o)lt(j)&&ch(j,a);else if(lt(j))j.includes(a)||j.push(a);else if(k)d[l]=[a],v(l)&&(m[l]=d[l]);else{const W=[a];T(l,e.k)&&(l.value=W),e.k&&(d[e.k]=W)}}else k?(d[l]=s,v(l)&&(m[l]=s)):N&&(T(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s))};if(s){const j=()=>{_(),gc.delete(e)};j.id=-1,gc.set(e,j),hr(j,n)}else um(e),_()}}}function um(e){const t=gc.get(e);t&&(t.flags|=8,gc.delete(e))}const cm=e=>e.nodeType===8;Hc().requestIdleCallback;Hc().cancelIdleCallback;function ck(e,t){if(cm(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(cm(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}const cl=e=>!!e.type.__asyncLoader;function Ro(e){mt(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:o=200,hydrate:a,timeout:s,suspensible:i=!0,onError:l}=e;let c=null,d,m=0;const f=()=>(m++,c=null,v()),v=()=>{let T;return c||(T=c=t().catch(k=>{if(k=k instanceof Error?k:new Error(String(k)),l)return new Promise((N,_)=>{l(k,()=>N(f()),()=>_(k),m+1)});throw k}).then(k=>T!==c&&c?c:(k&&(k.__esModule||k[Symbol.toStringTag]==="Module")&&(k=k.default),d=k,k)))};return cn({name:"AsyncComponentWrapper",__asyncLoader:v,__asyncHydrate(T,k,N){const _=T.isConnected;let j=!1;(k.bu||(k.bu=[])).push(()=>j=!0);const W=()=>{j||!T.parentNode||_&&!T.isConnected||N()},V=a?()=>{const U=a(W,fe=>ck(T,fe));U&&(k.bum||(k.bum=[])).push(U)}:W;d?V():v().then(()=>!k.isUnmounted&&V())},get __asyncResolved(){return d},setup(){const T=Gn;if(Th(T),d)return()=>qu(d,T);const k=U=>{c=null,wu(U,T,13,!r)};if(i&&T.suspense||bl)return v().then(U=>()=>qu(U,T)).catch(U=>(k(U),()=>r?Be(r,{error:U}):null));const N=S(!1),_=S(),j=S(!!o);let W,V;return Tu(()=>{W!=null&&clearTimeout(W),V!=null&&clearTimeout(V)}),o&&(V=setTimeout(()=>{T.isUnmounted||(j.value=!1)},o)),s!=null&&(W=setTimeout(()=>{if(!T.isUnmounted&&!N.value&&!_.value){const U=new Error(`Async component timed out after ${s}ms.`);k(U),_.value=U}},s)),v().then(()=>{T.isUnmounted||(N.value=!0,T.parent&&bu(T.parent.vnode)&&T.parent.update())}).catch(U=>{if(T.isUnmounted){c=null;return}k(U),_.value=U}),()=>{if(N.value&&d)return qu(d,T);if(_.value&&r)return Be(r,{error:_.value});if(n&&!j.value)return qu(n,T)}}})}function qu(e,t){const{ref:n,props:r,children:o,ce:a}=t.vnode,s=Be(e,r,o);return s.ref=n,s.ce=a,delete t.vnode.ce,s}const bu=e=>e.type.__isKeepAlive;function dk(e,t){Sy(e,"a",t)}function fk(e,t){Sy(e,"da",t)}function Sy(e,t,n=Gn){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(Gc(t,r,n),n){let o=n.parent;for(;o&&o.parent;)bu(o.parent.vnode)&&hk(r,t,n,o),o=o.parent}}function hk(e,t,n,r){const o=Gc(t,e,r,!0);Tu(()=>{ch(r[t],o)},n)}function Gc(e,t,n=Gn,r=!1){if(n){const o=n[e]||(n[e]=[]),a=t.__weh||(t.__weh=(...s)=>{Ya();const i=Su(n),l=no(t,n,e,s);return i(),Ja(),l});return r?o.unshift(a):o.push(a),a}}const Za=e=>(t,n=Gn)=>{(!bl||e==="sp")&&Gc(e,(...r)=>t(...r),n)},pk=Za("bm"),es=Za("m"),mk=Za("bu"),gk=Za("u"),Ws=Za("bum"),Tu=Za("um"),vk=Za("sp"),yk=Za("rtg"),wk=Za("rtc");function bk(e,t=Gn){Gc("ec",e,t)}const Tk="components",ky=Symbol.for("v-ndc");function Sh(e){return Yt(e)?Sk(Tk,e,!1)||e:e||ky}function Sk(e,t,n=!0,r=!1){const o=Vn||Gn;if(o){const a=o.type;{const i=aC(a,!1);if(i&&(i===t||i===vr(t)||i===zc(vr(t))))return a}const s=dm(o[e]||a[e],t)||dm(o.appContext[e],t);return!s&&r?a:s}}function dm(e,t){return e&&(e[t]||e[vr(t)]||e[zc(vr(t))])}function Ht(e,t,n,r){let o;const a=n,s=lt(e);if(s||Yt(e)){const i=s&&Ci(e);let l=!1,c=!1;i&&(l=!eo(e),c=Qa(e),e=Wc(e)),o=new Array(e.length);for(let d=0,m=e.length;d<m;d++)o[d]=t(l?c?yl(Uo(e[d])):Uo(e[d]):e[d],d,void 0,a)}else if(typeof e=="number"){o=new Array(e);for(let i=0;i<e;i++)o[i]=t(i+1,i,void 0,a)}else if(Ot(e))if(e[Symbol.iterator])o=Array.from(e,(i,l)=>t(i,l,void 0,a));else{const i=Object.keys(e);o=new Array(i.length);for(let l=0,c=i.length;l<c;l++){const d=i[l];o[l]=t(e[d],d,l,a)}}else o=[];return o}function xr(e,t,n={},r,o,a){if(Vn.ce||Vn.parent&&cl(Vn.parent)&&Vn.parent.ce){const c=a!=null&&n.key==null?bn({},n,{key:a}):n,d=Object.keys(c).length>0;return t!=="default"&&(c.name=t),P(),tt(at,null,[Be("slot",c,r)],d?-2:64)}let s=e[t];s&&s._c&&(s._d=!1);const i=qa.length;P();let l;try{const c=s&&Cy(s(n)),d=n.key||a||c&&c.key;l=tt(at,{key:(d&&!Bo(d)?d:`_${t}`)+(!c&&r?"_fb":"")},c||(r?r():[]),c&&e._===1?64:-2)}catch(c){for(let d=qa.length;d>i;d--)Ih();throw c}finally{s&&s._c&&(s._d=!0)}return l}function Cy(e){return e.some(t=>cu(t)?!(t.type===rr||t.type===at&&!Cy(t.children)):!0)?e:null}const Pf=e=>e?Hy(e)?Yc(e):Pf(e.parent):null,nu=bn(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=>Pf(e.parent),$root:e=>Pf(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Iy(e),$forceUpdate:e=>e.f||(e.f=()=>{bh(e.update)}),$nextTick:e=>e.n||(e.n=Et.bind(e.proxy)),$watch:e=>rk.bind(e)}),zd=(e,t)=>e!==zt&&!e.__isScriptSetup&&$t(e,t),kk={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:o,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 r[t];case 2:return o[t];case 4:return n[t];case 3:return a[t]}else{if(zd(r,t))return s[t]=1,r[t];if(o!==zt&&$t(o,t))return s[t]=2,o[t];if($t(a,t))return s[t]=3,a[t];if(n!==zt&&$t(n,t))return s[t]=4,n[t];Ef&&(s[t]=0)}}const c=nu[t];let d,m;if(c)return t==="$attrs"&&nr(e.attrs,"get",""),c(e);if((d=i.__cssModules)&&(d=d[t]))return d;if(n!==zt&&$t(n,t))return s[t]=4,n[t];if(m=l.config.globalProperties,$t(m,t))return m[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:a}=e;return zd(o,t)?(o[t]=n,!0):r!==zt&&$t(r,t)?(r[t]=n,!0):$t(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:o,props:a,type:s}},i){let l;return!!(n[i]||e!==zt&&i[0]!=="$"&&$t(e,i)||zd(t,i)||$t(a,i)||$t(r,i)||$t(nu,i)||$t(o.config.globalProperties,i)||(l=s.__cssModules)&&l[i])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:$t(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Ck(){return xk().slots}function xk(e){const t=_h();return t.setupContext||(t.setupContext=qy(t))}function fm(e){return lt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Ef=!0;function Ik(e){const t=Iy(e),n=e.proxy,r=e.ctx;Ef=!1,t.beforeCreate&&hm(t.beforeCreate,e,"bc");const{data:o,computed:a,methods:s,watch:i,provide:l,inject:c,created:d,beforeMount:m,mounted:f,beforeUpdate:v,updated:T,activated:k,deactivated:N,beforeDestroy:_,beforeUnmount:j,destroyed:W,unmounted:V,render:U,renderTracked:fe,renderTriggered:K,errorCaptured:oe,serverPrefetch:ve,expose:Pe,inheritAttrs:we,components:te,directives:ke,filters:ee}=t;if(c&&Ak(c,r,null),s)for(const Ue in s){const Ee=s[Ue];mt(Ee)&&(r[Ue]=Ee.bind(n))}if(o){const Ue=o.call(n,n);Ot(Ue)&&(e.data=qc(Ue))}if(Ef=!0,a)for(const Ue in a){const Ee=a[Ue],be=mt(Ee)?Ee.bind(n,n):mt(Ee.get)?Ee.get.bind(n,n):va,Te=!mt(Ee)&&mt(Ee.set)?Ee.set.bind(n):va,_e=J({get:be,set:Te});Object.defineProperty(r,Ue,{enumerable:!0,configurable:!0,get:()=>_e.value,set:xe=>_e.value=xe})}if(i)for(const Ue in i)xy(i[Ue],r,n,Ue);if(l){const Ue=mt(l)?l.call(n):l;Reflect.ownKeys(Ue).forEach(Ee=>{ac(Ee,Ue[Ee])})}d&&hm(d,e,"c");function De(Ue,Ee){lt(Ee)?Ee.forEach(be=>Ue(be.bind(n))):Ee&&Ue(Ee.bind(n))}if(De(pk,m),De(es,f),De(mk,v),De(gk,T),De(dk,k),De(fk,N),De(bk,oe),De(wk,fe),De(yk,K),De(Ws,j),De(Tu,V),De(vk,ve),lt(Pe))if(Pe.length){const Ue=e.exposed||(e.exposed={});Pe.forEach(Ee=>{Object.defineProperty(Ue,Ee,{get:()=>n[Ee],set:be=>n[Ee]=be,enumerable:!0})})}else e.exposed||(e.exposed={});U&&e.render===va&&(e.render=U),we!=null&&(e.inheritAttrs=we),te&&(e.components=te),ke&&(e.directives=ke),ve&&Th(e)}function Ak(e,t,n=va){lt(e)&&(e=Mf(e));for(const r in e){const o=e[r];let a;Ot(o)?"default"in o?a=Fo(o.from||r,o.default,!0):a=Fo(o.from||r):a=Fo(o),$n(a)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>a.value,set:s=>a.value=s}):t[r]=a}}function hm(e,t,n){no(lt(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function xy(e,t,n,r){let o=r.includes(".")?py(n,r):()=>n[r];if(Yt(e)){const a=t[e];mt(a)&&ot(o,a)}else if(mt(e))ot(o,e.bind(n));else if(Ot(e))if(lt(e))e.forEach(a=>xy(a,t,n,r));else{const a=mt(e.handler)?e.handler.bind(n):t[e.handler];mt(a)&&ot(o,a,e)}}function Iy(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:a,config:{optionMergeStrategies:s}}=e.appContext,i=a.get(t);let l;return i?l=i:!o.length&&!n&&!r?l=t:(l={},o.length&&o.forEach(c=>vc(l,c,s,!0)),vc(l,t,s)),Ot(t)&&a.set(t,l),l}function vc(e,t,n,r=!1){const{mixins:o,extends:a}=t;a&&vc(e,a,n,!0),o&&o.forEach(s=>vc(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const i=_k[s]||n&&n[s];e[s]=i?i(e[s],t[s]):t[s]}return e}const _k={data:pm,props:mm,emits:mm,methods:Yl,computed:Yl,beforeCreate:fr,created:fr,beforeMount:fr,mounted:fr,beforeUpdate:fr,updated:fr,beforeDestroy:fr,beforeUnmount:fr,destroyed:fr,unmounted:fr,activated:fr,deactivated:fr,errorCaptured:fr,serverPrefetch:fr,components:Yl,directives:Yl,watch:Ek,provide:pm,inject:Pk};function pm(e,t){return t?e?function(){return bn(mt(e)?e.call(this,this):e,mt(t)?t.call(this,this):t)}:t:e}function Pk(e,t){return Yl(Mf(e),Mf(t))}function Mf(e){if(lt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function fr(e,t){return e?[...new Set([].concat(e,t))]:t}function Yl(e,t){return e?bn(Object.create(null),e,t):t}function mm(e,t){return e?lt(e)&<(t)?[...new Set([...e,...t])]:bn(Object.create(null),fm(e),fm(t??{})):t}function Ek(e,t){if(!e)return t;if(!t)return e;const n=bn(Object.create(null),e);for(const r in t)n[r]=fr(e[r],t[r]);return n}function Ay(){return{app:null,config:{isNativeTag:$v,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 Mk=0;function Rk(e,t){return function(r,o=null){mt(r)||(r=bn({},r)),o!=null&&!Ot(o)&&(o=null);const a=Ay(),s=new WeakSet,i=[];let l=!1;const c=a.app={_uid:Mk++,_component:r,_props:o,_container:null,_context:a,_instance:null,version:lC,get config(){return a.config},set config(d){},use(d,...m){return s.has(d)||(d&&mt(d.install)?(s.add(d),d.install(c,...m)):mt(d)&&(s.add(d),d(c,...m))),c},mixin(d){return a.mixins.includes(d)||a.mixins.push(d),c},component(d,m){return m?(a.components[d]=m,c):a.components[d]},directive(d,m){return m?(a.directives[d]=m,c):a.directives[d]},mount(d,m,f){if(!l){const v=c._ceVNode||Be(r,o);return v.appContext=a,f===!0?f="svg":f===!1&&(f=void 0),e(v,d,f),l=!0,c._container=d,d.__vue_app__=c,Yc(v.component)}},onUnmount(d){i.push(d)},unmount(){l&&(no(i,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(d,m){return a.provides[d]=m,c},runWithContext(d){const m=dl;dl=c;try{return d()}finally{dl=m}}};return c}}let dl=null;const Lk=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${vr(t)}Modifiers`]||e[`${Hs(t)}Modifiers`];function jk(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||zt;let o=n;const a=t.startsWith("update:"),s=a&&Lk(r,t.slice(7));s&&(s.trim&&(o=n.map(d=>Yt(d)?d.trim():d)),s.number&&(o=n.map(fh)));let i,l=r[i=$d(t)]||r[i=$d(vr(t))];!l&&a&&(l=r[i=$d(Hs(t))]),l&&no(l,e,6,o);const c=r[i+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[i])return;e.emitted[i]=!0,no(c,e,6,o)}}const Nk=new WeakMap;function _y(e,t,n=!1){const r=n?Nk:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const a=e.emits;let s={},i=!1;if(!mt(e)){const l=c=>{const d=_y(c,t,!0);d&&(i=!0,bn(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!a&&!i?(Ot(e)&&r.set(e,null),null):(lt(a)?a.forEach(l=>s[l]=null):bn(s,a),Ot(e)&&r.set(e,s),s)}function Vc(e,t){return!e||!Dc(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),$t(e,t[0].toLowerCase()+t.slice(1))||$t(e,Hs(t))||$t(e,t))}function gm(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[a],slots:s,attrs:i,emit:l,render:c,renderCache:d,props:m,data:f,setupState:v,ctx:T,inheritAttrs:k}=e,N=mc(e);let _,j;try{if(n.shapeFlag&4){const V=o||r,U=V;_=ma(c.call(U,V,d,m,v,f,T)),j=i}else{const V=t;_=ma(V.length>1?V(m,{attrs:i,slots:s,emit:l}):V(m,null)),j=t.props?i:$k(i)}}catch(V){qa.length=0,wu(V,e,1),_=Be(rr)}let W=_;if(j&&k!==!1){const V=Object.keys(j),{shapeFlag:U}=W;V.length&&U&7&&(a&&V.some(Fc)&&(j=Ok(j,a)),W=Us(W,j,!1,!0))}return n.dirs&&(W=Us(W,null,!1,!0),W.dirs=W.dirs?W.dirs.concat(n.dirs):n.dirs),n.transition&&uu(W,n.transition),_=W,mc(N),_}const $k=e=>{let t;for(const n in e)(n==="class"||n==="style"||Dc(n))&&((t||(t={}))[n]=e[n]);return t},Ok=(e,t)=>{const n={};for(const r in e)(!Fc(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Dk(e,t,n){const{props:r,children:o,component:a}=e,{props:s,children:i,patchFlag:l}=t,c=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?vm(r,s,c):!!s;if(l&8){const d=t.dynamicProps;for(let m=0;m<d.length;m++){const f=d[m];if(Py(s,r,f)&&!Vc(c,f))return!0}}}else return(o||i)&&(!i||!i.$stable)?!0:r===s?!1:r?s?vm(r,s,c):!0:!!s;return!1}function vm(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let o=0;o<r.length;o++){const a=r[o];if(Py(t,e,a)&&!Vc(n,a))return!0}return!1}function Py(e,t,n){const r=e[n],o=t[n];return n==="style"&&Ot(r)&&Ot(o)?!vu(r,o):r!==o}function Fk({vnode:e,parent:t,suspense:n},r){for(;t;){const o=t.subTree;if(o.suspense&&o.suspense.activeBranch===e&&(o.suspense.vnode.el=o.el=r,e=o),o===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const Ey={},My=()=>Object.create(Ey),Ry=e=>Object.getPrototypeOf(e)===Ey;function Bk(e,t,n,r=!1){const o={},a=My();e.propsDefaults=Object.create(null),Ly(e,t,o,a);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:ay(o):e.type.props?e.props=o:e.props=a,e.attrs=a}function Uk(e,t,n,r){const{props:o,attrs:a,vnode:{patchFlag:s}}=e,i=Lt(o),[l]=e.propsOptions;let c=!1;if((r||s>0)&&!(s&16)){if(s&8){const d=e.vnode.dynamicProps;for(let m=0;m<d.length;m++){let f=d[m];if(Vc(e.emitsOptions,f))continue;const v=t[f];if(l)if($t(a,f))v!==a[f]&&(a[f]=v,c=!0);else{const T=vr(f);o[T]=Rf(l,i,T,v,e,!1)}else v!==a[f]&&(a[f]=v,c=!0)}}}else{Ly(e,t,o,a)&&(c=!0);let d;for(const m in i)(!t||!$t(t,m)&&((d=Hs(m))===m||!$t(t,d)))&&(l?n&&(n[m]!==void 0||n[d]!==void 0)&&(o[m]=Rf(l,i,m,void 0,e,!0)):delete o[m]);if(a!==i)for(const m in a)(!t||!$t(t,m))&&(delete a[m],c=!0)}c&&za(e.attrs,"set","")}function Ly(e,t,n,r){const[o,a]=e.propsOptions;let s=!1,i;if(t)for(let l in t){if(Xl(l))continue;const c=t[l];let d;o&&$t(o,d=vr(l))?!a||!a.includes(d)?n[d]=c:(i||(i={}))[d]=c:Vc(e.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,s=!0)}if(a){const l=Lt(n),c=i||zt;for(let d=0;d<a.length;d++){const m=a[d];n[m]=Rf(o,l,m,c[m],e,!$t(c,m))}}return s}function Rf(e,t,n,r,o,a){const s=e[n];if(s!=null){const i=$t(s,"default");if(i&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&mt(l)){const{propsDefaults:c}=o;if(n in c)r=c[n];else{const d=Su(o);r=c[n]=l.call(null,t),d()}}else r=l;o.ce&&o.ce._setProp(n,r)}s[0]&&(a&&!i?r=!1:s[1]&&(r===""||r===Hs(n))&&(r=!0))}return r}const zk=new WeakMap;function jy(e,t,n=!1){const r=n?zk:t.propsCache,o=r.get(e);if(o)return o;const a=e.props,s={},i=[];let l=!1;if(!mt(e)){const d=m=>{l=!0;const[f,v]=jy(m,t,!0);bn(s,f),v&&i.push(...v)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!a&&!l)return Ot(e)&&r.set(e,il),il;if(lt(a))for(let d=0;d<a.length;d++){const m=vr(a[d]);ym(m)&&(s[m]=zt)}else if(a)for(const d in a){const m=vr(d);if(ym(m)){const f=a[d],v=s[m]=lt(f)||mt(f)?{type:f}:bn({},f),T=v.type;let k=!1,N=!0;if(lt(T))for(let _=0;_<T.length;++_){const j=T[_],W=mt(j)&&j.name;if(W==="Boolean"){k=!0;break}else W==="String"&&(N=!1)}else k=mt(T)&&T.name==="Boolean";v[0]=k,v[1]=N,(k||$t(v,"default"))&&i.push(m)}}const c=[s,i];return Ot(e)&&r.set(e,c),c}function ym(e){return e[0]!=="$"&&!Xl(e)}const kh=e=>e==="_"||e==="_ctx"||e==="$stable",Ch=e=>lt(e)?e.map(ma):[ma(e)],Hk=(e,t,n)=>{if(t._n)return t;const r=pt((...o)=>Ch(t(...o)),n);return r._c=!1,r},Ny=(e,t,n)=>{const r=e._ctx;for(const o in e){if(kh(o))continue;const a=e[o];if(mt(a))t[o]=Hk(o,a,r);else if(a!=null){const s=Ch(a);t[o]=()=>s}}},$y=(e,t)=>{const n=Ch(t);e.slots.default=()=>n},Oy=(e,t,n)=>{for(const r in t)(n||!kh(r))&&(e[r]=t[r])},Wk=(e,t,n)=>{const r=e.slots=My();if(e.vnode.shapeFlag&32){const o=t._;o?(Oy(r,t,n),n&&Bv(r,"_",o,!0)):Ny(t,r)}else t&&$y(e,t)},qk=(e,t,n)=>{const{vnode:r,slots:o}=e;let a=!0,s=zt;if(r.shapeFlag&32){const i=t._;i?n&&i===1?a=!1:Oy(o,t,n):(a=!t.$stable,Ny(t,o)),s=t}else t&&($y(e,t),s={default:1});if(a)for(const i in o)!kh(i)&&s[i]==null&&delete o[i]},hr=Jk;function Gk(e){return Vk(e)}function Vk(e,t){const n=Hc();n.__VUE__=!0;const{insert:r,remove:o,patchProp:a,createElement:s,createText:i,createComment:l,setText:c,setElementText:d,parentNode:m,nextSibling:f,setScopeId:v=va,insertStaticContent:T}=e,k=(E,L,H,ue=null,se=null,le=null,Ne=void 0,Me=null,Ae=!!L.dynamicChildren)=>{if(E===L)return;E&&!bi(E,L)&&(ue=B(E),xe(E,se,le,!0),E=null),L.patchFlag===-2&&(Ae=!1,L.dynamicChildren=null);const{type:ye,ref:ze,shapeFlag:$e}=L;switch(ye){case Kc:N(E,L,H,ue);break;case rr:_(E,L,H,ue);break;case Wd:E==null&&j(L,H,ue,Ne);break;case at:te(E,L,H,ue,se,le,Ne,Me,Ae);break;default:$e&1?U(E,L,H,ue,se,le,Ne,Me,Ae):$e&6?ke(E,L,H,ue,se,le,Ne,Me,Ae):($e&64||$e&128)&&ye.process(E,L,H,ue,se,le,Ne,Me,Ae,je)}ze!=null&&se?tu(ze,E&&E.ref,le,L||E,!L):ze==null&&E&&E.ref!=null&&tu(E.ref,null,le,E,!0)},N=(E,L,H,ue)=>{if(E==null)r(L.el=i(L.children),H,ue);else{const se=L.el=E.el;L.children!==E.children&&c(se,L.children)}},_=(E,L,H,ue)=>{E==null?r(L.el=l(L.children||""),H,ue):L.el=E.el},j=(E,L,H,ue)=>{[E.el,E.anchor]=T(E.children,L,H,ue,E.el,E.anchor)},W=({el:E,anchor:L},H,ue)=>{let se;for(;E&&E!==L;)se=f(E),r(E,H,ue),E=se;r(L,H,ue)},V=({el:E,anchor:L})=>{let H;for(;E&&E!==L;)H=f(E),o(E),E=H;o(L)},U=(E,L,H,ue,se,le,Ne,Me,Ae)=>{if(L.type==="svg"?Ne="svg":L.type==="math"&&(Ne="mathml"),E==null)fe(L,H,ue,se,le,Ne,Me,Ae);else{const ye=E.el&&E.el._isVueCE?E.el:null;try{ye&&ye._beginPatch(),ve(E,L,se,le,Ne,Me,Ae)}finally{ye&&ye._endPatch()}}},fe=(E,L,H,ue,se,le,Ne,Me)=>{let Ae,ye;const{props:ze,shapeFlag:$e,transition:Ve,dirs:Ke}=E;if(Ae=E.el=s(E.type,le,ze&&ze.is,ze),$e&8?d(Ae,E.children):$e&16&&oe(E.children,Ae,null,ue,se,Hd(E,le),Ne,Me),Ke&&fi(E,null,ue,"created"),K(Ae,E,E.scopeId,Ne,ue),ze){for(const _t in ze)_t!=="value"&&!Xl(_t)&&a(Ae,_t,null,ze[_t],le,ue);"value"in ze&&a(Ae,"value",null,ze.value,le),(ye=ze.onVnodeBeforeMount)&&fa(ye,ue,E)}Ke&&fi(E,null,ue,"beforeMount");const ft=Kk(se,Ve);ft&&Ve.beforeEnter(Ae),r(Ae,L,H),((ye=ze&&ze.onVnodeMounted)||ft||Ke)&&hr(()=>{try{ye&&fa(ye,ue,E),ft&&Ve.enter(Ae),Ke&&fi(E,null,ue,"mounted")}finally{}},se)},K=(E,L,H,ue,se)=>{if(H&&v(E,H),ue)for(let le=0;le<ue.length;le++)v(E,ue[le]);if(se){let le=se.subTree;if(L===le||By(le.type)&&(le.ssContent===L||le.ssFallback===L)){const Ne=se.vnode;K(E,Ne,Ne.scopeId,Ne.slotScopeIds,se.parent)}}},oe=(E,L,H,ue,se,le,Ne,Me,Ae=0)=>{for(let ye=Ae;ye<E.length;ye++){const ze=E[ye]=Me?Ua(E[ye]):ma(E[ye]);k(null,ze,L,H,ue,se,le,Ne,Me)}},ve=(E,L,H,ue,se,le,Ne)=>{const Me=L.el=E.el;let{patchFlag:Ae,dynamicChildren:ye,dirs:ze}=L;Ae|=E.patchFlag&16;const $e=E.props||zt,Ve=L.props||zt;let Ke;if(H&&hi(H,!1),(Ke=Ve.onVnodeBeforeUpdate)&&fa(Ke,H,L,E),ze&&fi(L,E,H,"beforeUpdate"),H&&hi(H,!0),ye&&(!E.dynamicChildren||E.dynamicChildren.length!==ye.length)&&(Ae=0,Ne=!1,ye=null),($e.innerHTML&&Ve.innerHTML==null||$e.textContent&&Ve.textContent==null)&&d(Me,""),ye?Pe(E.dynamicChildren,ye,Me,H,ue,Hd(L,se),le):Ne||Ee(E,L,Me,null,H,ue,Hd(L,se),le,!1),Ae>0){if(Ae&16)we(Me,$e,Ve,H,se);else if(Ae&2&&$e.class!==Ve.class&&a(Me,"class",null,Ve.class,se),Ae&4&&a(Me,"style",$e.style,Ve.style,se),Ae&8){const ft=L.dynamicProps;for(let _t=0;_t<ft.length;_t++){const Ct=ft[_t],dt=$e[Ct],Y=Ve[Ct];(Y!==dt||Ct==="value")&&a(Me,Ct,dt,Y,se,H)}}Ae&1&&E.children!==L.children&&d(Me,L.children)}else!Ne&&ye==null&&we(Me,$e,Ve,H,se);((Ke=Ve.onVnodeUpdated)||ze)&&hr(()=>{Ke&&fa(Ke,H,L,E),ze&&fi(L,E,H,"updated")},ue)},Pe=(E,L,H,ue,se,le,Ne)=>{for(let Me=0;Me<L.length;Me++){const Ae=E[Me],ye=L[Me],ze=Ae.el&&(Ae.type===at||!bi(Ae,ye)||Ae.shapeFlag&198)?m(Ae.el):H;k(Ae,ye,ze,null,ue,se,le,Ne,!0)}},we=(E,L,H,ue,se)=>{if(L!==H){if(L!==zt)for(const le in L)!Xl(le)&&!(le in H)&&a(E,le,L[le],null,se,ue);for(const le in H){if(Xl(le))continue;const Ne=H[le],Me=L[le];Ne!==Me&&le!=="value"&&a(E,le,Me,Ne,se,ue)}"value"in H&&a(E,"value",L.value,H.value,se)}},te=(E,L,H,ue,se,le,Ne,Me,Ae)=>{const ye=L.el=E?E.el:i(""),ze=L.anchor=E?E.anchor:i("");let{patchFlag:$e,dynamicChildren:Ve,slotScopeIds:Ke}=L;Ke&&(Me=Me?Me.concat(Ke):Ke),E==null?(r(ye,H,ue),r(ze,H,ue),oe(L.children||[],H,ze,se,le,Ne,Me,Ae)):$e>0&&$e&64&&Ve&&E.dynamicChildren&&E.dynamicChildren.length===Ve.length?(Pe(E.dynamicChildren,Ve,H,se,le,Ne,Me),(L.key!=null||se&&L===se.subTree)&&xh(E,L,!0)):Ee(E,L,H,ze,se,le,Ne,Me,Ae)},ke=(E,L,H,ue,se,le,Ne,Me,Ae)=>{L.slotScopeIds=Me,E==null?L.shapeFlag&512?se.ctx.activate(L,H,ue,Ne,Ae):ee(L,H,ue,se,le,Ne,Ae):Ce(E,L,Ae)},ee=(E,L,H,ue,se,le,Ne)=>{const Me=E.component=tC(E,ue,se);if(bu(E)&&(Me.ctx.renderer=je),nC(Me,!1,Ne),Me.asyncDep){if(se&&se.registerDep(Me,De,Ne),!E.el){const Ae=Me.subTree=Be(rr);_(null,Ae,L,H),E.placeholder=Ae.el}}else De(Me,E,L,H,se,le,Ne)},Ce=(E,L,H)=>{const ue=L.component=E.component;if(Dk(E,L,H))if(ue.asyncDep&&!ue.asyncResolved){Ue(ue,L,H);return}else ue.next=L,ue.update();else L.el=E.el,ue.vnode=L},De=(E,L,H,ue,se,le,Ne)=>{const Me=()=>{if(E.isMounted){let{next:$e,bu:Ve,u:Ke,parent:ft,vnode:_t}=E;{const Ie=Dy(E);if(Ie){$e&&($e.el=_t.el,Ue(E,$e,Ne)),Ie.asyncDep.then(()=>{hr(()=>{E.isUnmounted||ye()},se)});return}}let Ct=$e,dt;hi(E,!1),$e?($e.el=_t.el,Ue(E,$e,Ne)):$e=_t,Ve&&oc(Ve),(dt=$e.props&&$e.props.onVnodeBeforeUpdate)&&fa(dt,ft,$e,_t),hi(E,!0);const Y=gm(E),pe=E.subTree;E.subTree=Y,k(pe,Y,m(pe.el),B(pe),E,se,le),$e.el=Y.el,Ct===null&&Fk(E,Y.el),Ke&&hr(Ke,se),(dt=$e.props&&$e.props.onVnodeUpdated)&&hr(()=>fa(dt,ft,$e,_t),se)}else{let $e;const{el:Ve,props:Ke}=L,{bm:ft,m:_t,parent:Ct,root:dt,type:Y}=E,pe=cl(L);hi(E,!1),ft&&oc(ft),!pe&&($e=Ke&&Ke.onVnodeBeforeMount)&&fa($e,Ct,L),hi(E,!0);{dt.ce&&dt.ce._hasShadowRoot()&&dt.ce._injectChildStyle(Y,E.parent?E.parent.type:void 0);const Ie=E.subTree=gm(E);k(null,Ie,H,ue,E,se,le),L.el=Ie.el}if(_t&&hr(_t,se),!pe&&($e=Ke&&Ke.onVnodeMounted)){const Ie=L;hr(()=>fa($e,Ct,Ie),se)}(L.shapeFlag&256||Ct&&cl(Ct.vnode)&&Ct.vnode.shapeFlag&256)&&E.a&&hr(E.a,se),E.isMounted=!0,L=H=ue=null}};E.scope.on();const Ae=E.effect=new qv(Me);E.scope.off();const ye=E.update=Ae.run.bind(Ae),ze=E.job=Ae.runIfDirty.bind(Ae);ze.i=E,ze.id=E.uid,Ae.scheduler=()=>bh(ze),hi(E,!0),ye()},Ue=(E,L,H)=>{L.component=E;const ue=E.vnode.props;E.vnode=L,E.next=null,Uk(E,L.props,ue,H),qk(E,L.children,H),Ya(),om(E),Ja()},Ee=(E,L,H,ue,se,le,Ne,Me,Ae=!1)=>{const ye=E&&E.children,ze=E?E.shapeFlag:0,$e=L.children,{patchFlag:Ve,shapeFlag:Ke}=L;if(Ve>0){if(Ve&128){Te(ye,$e,H,ue,se,le,Ne,Me,Ae);return}else if(Ve&256){be(ye,$e,H,ue,se,le,Ne,Me,Ae);return}}Ke&8?(ze&16&&de(ye,se,le),$e!==ye&&d(H,$e)):ze&16?Ke&16?Te(ye,$e,H,ue,se,le,Ne,Me,Ae):de(ye,se,le,!0):(ze&8&&d(H,""),Ke&16&&oe($e,H,ue,se,le,Ne,Me,Ae))},be=(E,L,H,ue,se,le,Ne,Me,Ae)=>{E=E||il,L=L||il;const ye=E.length,ze=L.length,$e=Math.min(ye,ze);let Ve;for(Ve=0;Ve<$e;Ve++){const Ke=L[Ve]=Ae?Ua(L[Ve]):ma(L[Ve]);k(E[Ve],Ke,H,null,se,le,Ne,Me,Ae)}ye>ze?de(E,se,le,!0,!1,$e):oe(L,H,ue,se,le,Ne,Me,Ae,$e)},Te=(E,L,H,ue,se,le,Ne,Me,Ae)=>{let ye=0;const ze=L.length;let $e=E.length-1,Ve=ze-1;for(;ye<=$e&&ye<=Ve;){const Ke=E[ye],ft=L[ye]=Ae?Ua(L[ye]):ma(L[ye]);if(bi(Ke,ft))k(Ke,ft,H,null,se,le,Ne,Me,Ae);else break;ye++}for(;ye<=$e&&ye<=Ve;){const Ke=E[$e],ft=L[Ve]=Ae?Ua(L[Ve]):ma(L[Ve]);if(bi(Ke,ft))k(Ke,ft,H,null,se,le,Ne,Me,Ae);else break;$e--,Ve--}if(ye>$e){if(ye<=Ve){const Ke=Ve+1,ft=Ke<ze?L[Ke].el:ue;for(;ye<=Ve;)k(null,L[ye]=Ae?Ua(L[ye]):ma(L[ye]),H,ft,se,le,Ne,Me,Ae),ye++}}else if(ye>Ve)for(;ye<=$e;)xe(E[ye],se,le,!0),ye++;else{const Ke=ye,ft=ye,_t=new Map;for(ye=ft;ye<=Ve;ye++){const xt=L[ye]=Ae?Ua(L[ye]):ma(L[ye]);xt.key!=null&&_t.set(xt.key,ye)}let Ct,dt=0;const Y=Ve-ft+1;let pe=!1,Ie=0;const qe=new Array(Y);for(ye=0;ye<Y;ye++)qe[ye]=0;for(ye=Ke;ye<=$e;ye++){const xt=E[ye];if(dt>=Y){xe(xt,se,le,!0);continue}let jt;if(xt.key!=null)jt=_t.get(xt.key);else for(Ct=ft;Ct<=Ve;Ct++)if(qe[Ct-ft]===0&&bi(xt,L[Ct])){jt=Ct;break}jt===void 0?xe(xt,se,le,!0):(qe[jt-ft]=ye+1,jt>=Ie?Ie=jt:pe=!0,k(xt,L[jt],H,null,se,le,Ne,Me,Ae),dt++)}const Qe=pe?Yk(qe):il;for(Ct=Qe.length-1,ye=Y-1;ye>=0;ye--){const xt=ft+ye,jt=L[xt],Ho=L[xt+1],Kn=xt+1<ze?Ho.el||Fy(Ho):ue;qe[ye]===0?k(null,jt,H,Kn,se,le,Ne,Me,Ae):pe&&(Ct<0||ye!==Qe[Ct]?_e(jt,H,Kn,2):Ct--)}}},_e=(E,L,H,ue,se=null)=>{const{el:le,type:Ne,transition:Me,children:Ae,shapeFlag:ye}=E;if(ye&6){_e(E.component.subTree,L,H,ue);return}if(ye&128){E.suspense.move(L,H,ue);return}if(ye&64){Ne.move(E,L,H,je);return}if(Ne===at){r(le,L,H);for(let $e=0;$e<Ae.length;$e++)_e(Ae[$e],L,H,ue);r(E.anchor,L,H);return}if(Ne===Wd){W(E,L,H);return}if(ue!==2&&ye&1&&Me)if(ue===0)Me.persisted&&!le[Xr]?r(le,L,H):(Me.beforeEnter(le),r(le,L,H),hr(()=>Me.enter(le),se));else{const{leave:$e,delayLeave:Ve,afterLeave:Ke}=Me,ft=()=>{E.ctx.isUnmounted?o(le):r(le,L,H)},_t=()=>{const Ct=le._isLeaving||!!le[Xr];le._isLeaving&&le[Xr](!0),Me.persisted&&!Ct?ft():$e(le,()=>{ft(),Ke&&Ke()})};Ve?Ve(le,ft,_t):_t()}else r(le,L,H)},xe=(E,L,H,ue=!1,se=!1)=>{const{type:le,props:Ne,ref:Me,children:Ae,dynamicChildren:ye,shapeFlag:ze,patchFlag:$e,dirs:Ve,cacheIndex:Ke,memo:ft}=E;if($e===-2&&(se=!1),Me!=null&&(Ya(),tu(Me,null,H,E,!0),Ja()),Ke!=null&&(L.renderCache[Ke]=void 0),ze&256){L.ctx.deactivate(E);return}const _t=ze&1&&Ve,Ct=!cl(E);let dt;if(Ct&&(dt=Ne&&Ne.onVnodeBeforeUnmount)&&fa(dt,L,E),ze&6)rt(E.component,H,ue);else{if(ze&128){E.suspense.unmount(H,ue);return}_t&&fi(E,null,L,"beforeUnmount"),ze&64?E.type.remove(E,L,H,je,ue):ye&&!ye.hasOnce&&(le!==at||$e>0&&$e&64)?de(ye,L,H,!1,!0):(le===at&&$e&384||!se&&ze&16)&&de(Ae,L,H),ue&&Je(E)}const Y=ft!=null&&Ke==null;(Ct&&(dt=Ne&&Ne.onVnodeUnmounted)||_t||Y)&&hr(()=>{dt&&fa(dt,L,E),_t&&fi(E,null,L,"unmounted"),Y&&(E.el=null)},H)},Je=E=>{const{type:L,el:H,anchor:ue,transition:se}=E;if(L===at){Xe(H,ue);return}if(L===Wd){V(E);return}const le=()=>{o(H),se&&!se.persisted&&se.afterLeave&&se.afterLeave()};if(E.shapeFlag&1&&se&&!se.persisted){const{leave:Ne,delayLeave:Me}=se,Ae=()=>Ne(H,le);Me?Me(E.el,le,Ae):Ae()}else le()},Xe=(E,L)=>{let H;for(;E!==L;)H=f(E),o(E),E=H;o(L)},rt=(E,L,H)=>{const{bum:ue,scope:se,job:le,subTree:Ne,um:Me,m:Ae,a:ye}=E;wm(Ae),wm(ye),ue&&oc(ue),se.stop(),le&&(le.flags|=8,xe(Ne,E,L,H)),Me&&hr(Me,L),hr(()=>{E.isUnmounted=!0},L)},de=(E,L,H,ue=!1,se=!1,le=0)=>{for(let Ne=le;Ne<E.length;Ne++)xe(E[Ne],L,H,ue,se)},B=E=>{if(E.shapeFlag&6)return B(E.component.subTree);if(E.shapeFlag&128)return E.suspense.next();const L=f(E.anchor||E.el),H=L&&L[my];return H?f(H):L};let ne=!1;const ae=(E,L,H)=>{let ue;E==null?L._vnode&&(xe(L._vnode,null,null,!0),ue=L._vnode.component):k(L._vnode||null,E,L,null,null,null,H),L._vnode=E,ne||(ne=!0,om(ue),cy(),ne=!1)},je={p:k,um:xe,m:_e,r:Je,mt:ee,mc:oe,pc:Ee,pbc:Pe,n:B,o:e};return{render:ae,hydrate:void 0,createApp:Rk(ae)}}function Hd({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 hi({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Kk(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function xh(e,t,n=!1){const r=e.children,o=t.children;if(lt(r)&<(o))for(let a=0;a<r.length;a++){const s=r[a];let i=o[a];i.shapeFlag&1&&!i.dynamicChildren&&((i.patchFlag<=0||i.patchFlag===32)&&(i=o[a]=Ua(o[a]),i.el=s.el),!n&&i.patchFlag!==-2&&xh(s,i)),i.type===Kc&&(i.patchFlag===-1&&(i=o[a]=Ua(i)),i.el=s.el),i.type===rr&&!i.el&&(i.el=s.el)}}function Yk(e){const t=e.slice(),n=[0];let r,o,a,s,i;const l=e.length;for(r=0;r<l;r++){const c=e[r];if(c!==0){if(o=n[n.length-1],e[o]<c){t[r]=o,n.push(r);continue}for(a=0,s=n.length-1;a<s;)i=a+s>>1,e[n[i]]<c?a=i+1:s=i;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,s=n[a-1];a-- >0;)n[a]=s,s=t[s];return n}function Dy(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Dy(t)}function wm(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Fy(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Fy(t.subTree):null}const By=e=>e.__isSuspense;function Jk(e,t){t&&t.pendingBranch?lt(e)?t.effects.push(...e):t.effects.push(e):ek(e)}const at=Symbol.for("v-fgt"),Kc=Symbol.for("v-txt"),rr=Symbol.for("v-cmt"),Wd=Symbol.for("v-stc"),qa=[];let gr=null;function P(e=!1){qa.push(gr=e?null:[])}function Ih(){qa.pop(),gr=qa[qa.length-1]||null}let wl=1;function yc(e,t=!1){wl+=e,e<0&&gr&&t&&(gr.hasOnce=!0)}function Uy(e){return e.dynamicChildren=wl>0?gr||il:null,Ih(),wl>0&&gr&&gr.push(e),e}function D(e,t,n,r,o,a){return Uy(w(e,t,n,r,o,a,!0))}function tt(e,t,n,r,o){return Uy(Be(e,t,n,r,o,!0))}function cu(e){return e?e.__v_isVNode===!0:!1}function bi(e,t){return e.type===t.type&&e.key===t.key}const zy=({key:e})=>e??null,sc=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Yt(e)||$n(e)||mt(e)?{i:Vn,r:e,k:t,f:!!n}:e:null);function w(e,t=null,n=null,r=0,o=null,a=e===at?0:1,s=!1,i=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&zy(t),ref:t&&sc(t),scopeId:fy,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:Vn};return i?(wc(l,n),a&128&&e.normalize(l)):n&&(l.shapeFlag|=Yt(n)?8:16),wl>0&&!s&&gr&&(l.patchFlag>0||a&6)&&l.patchFlag!==32&&gr.push(l),l}const Be=Qk;function Qk(e,t=null,n=null,r=0,o=null,a=!1){if((!e||e===ky)&&(e=rr),cu(e)){const i=Us(e,t,!0);return n&&wc(i,n),wl>0&&!a&&gr&&(i.shapeFlag&6?gr[gr.indexOf(e)]=i:gr.push(i)),i.patchFlag=-2,i}if(sC(e)&&(e=e.__vccOpts),t){t=Xk(t);let{class:i,style:l}=t;i&&!Yt(i)&&(t.class=ct(i)),Ot(l)&&(wh(l)&&!lt(l)&&(l=bn({},l)),t.style=Zr(l))}const s=Yt(e)?1:By(e)?128:gy(e)?64:Ot(e)?4:mt(e)?2:0;return w(e,t,n,r,o,s,a,!0)}function Xk(e){return e?wh(e)||Ry(e)?bn({},e):e:null}function Us(e,t,n=!1,r=!1){const{props:o,ref:a,patchFlag:s,children:i,transition:l}=e,c=t?Ah(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&zy(c),ref:t&&t.ref?n&&a?lt(a)?a.concat(sc(t)):[a,sc(t)]:sc(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!==at?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&&Us(e.ssContent),ssFallback:e.ssFallback&&Us(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&uu(d,l.clone(d)),d}function Ns(e=" ",t=0){return Be(Kc,null,e,t)}function me(e="",t=!1){return t?(P(),tt(rr,null,e)):Be(rr,null,e)}function ma(e){return e==null||typeof e=="boolean"?Be(rr):lt(e)?Be(at,null,e.slice()):cu(e)?Ua(e):Be(Kc,null,String(e))}function Ua(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Us(e)}function wc(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(lt(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),wc(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!Ry(t)?t._ctx=Vn:o===3&&Vn&&(Vn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(mt(t)){if(r&65){wc(e,{default:t});return}t={default:t,_ctx:Vn},n=32}else t=String(t),r&64?(n=16,t=[Ns(t)]):n=8;e.children=t,e.shapeFlag|=n}function Ah(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const o in r)if(o==="class")t.class!==r.class&&(t.class=ct([t.class,r.class]));else if(o==="style")t.style=Zr([t.style,r.style]);else if(Dc(o)){const a=t[o],s=r[o];s&&a!==s&&!(lt(a)&&a.includes(s))?t[o]=a?[].concat(a,s):s:s==null&&a==null&&!Fc(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function fa(e,t,n,r=null){no(e,t,7,[n,r])}const Zk=Ay();let eC=0;function tC(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||Zk,a={uid:eC++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new xS(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:jy(r,o),emitsOptions:_y(r,o),emit:null,emitted:null,propsDefaults:zt,inheritAttrs:r.inheritAttrs,ctx:zt,data:zt,props:zt,attrs:zt,slots:zt,refs:zt,setupState:zt,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=jk.bind(null,a),e.ce&&e.ce(a),a}let Gn=null;const _h=()=>Gn||Vn;let bc,Lf;{const e=Hc(),t=(n,r)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(r),a=>{o.length>1?o.forEach(s=>s(a)):o[0](a)}};bc=t("__VUE_INSTANCE_SETTERS__",n=>Gn=n),Lf=t("__VUE_SSR_SETTERS__",n=>bl=n)}const Su=e=>{const t=Gn;return bc(e),e.scope.on(),()=>{e.scope.off(),bc(t)}},bm=()=>{Gn&&Gn.scope.off(),bc(null)};function Hy(e){return e.vnode.shapeFlag&4}let bl=!1;function nC(e,t=!1,n=!1){t&&Lf(t);const{props:r,children:o}=e.vnode,a=Hy(e);Bk(e,r,a,t),Wk(e,o,n||t);const s=a?rC(e,t):void 0;return t&&Lf(!1),s}function rC(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,kk);const{setup:r}=n;if(r){Ya();const o=e.setupContext=r.length>1?qy(e):null,a=Su(e),s=yu(r,e,0,[e.props,o]),i=Ov(s);if(Ja(),a(),(i||e.sp)&&!cl(e)&&Th(e),i){if(s.then(bm,bm),t)return s.then(l=>{Tm(e,l)}).catch(l=>{wu(l,e,0)});e.asyncDep=s}else Tm(e,s)}else Wy(e)}function Tm(e,t,n){mt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Ot(t)&&(e.setupState=iy(t)),Wy(e)}function Wy(e,t,n){const r=e.type;e.render||(e.render=r.render||va);{const o=Su(e);Ya();try{Ik(e)}finally{Ja(),o()}}}const oC={get(e,t){return nr(e,"get",""),e[t]}};function qy(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,oC),slots:e.slots,emit:e.emit,expose:t}}function Yc(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(iy(WS(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in nu)return nu[n](e)},has(t,n){return n in t||n in nu}})):e.proxy}function aC(e,t=!0){return mt(e)?e.displayName||e.name:e.name||t&&e.__name}function sC(e){return mt(e)&&"__vccOpts"in e}const J=(e,t)=>YS(e,t,bl);function Ph(e,t,n){try{yc(-1);const r=arguments.length;return r===2?Ot(t)&&!lt(t)?cu(t)?Be(e,null,[t]):Be(e,t):Be(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&cu(n)&&(n=[n]),Be(e,t,n))}finally{yc(1)}}function yU(e,t,n,r){const o=n[r];if(o&&iC(o,e))return o;const a=t();return a.memo=e.slice(),a.cacheIndex=r,n[r]=a}function iC(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(No(n[r],t[r]))return!1;return wl>0&&gr&&gr.push(e),!0}const lC="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 jf;const Sm=typeof window<"u"&&window.trustedTypes;if(Sm)try{jf=Sm.createPolicy("vue",{createHTML:e=>e})}catch{}const Gy=jf?e=>jf.createHTML(e):e=>e,uC="http://www.w3.org/2000/svg",cC="http://www.w3.org/1998/Math/MathML",Ba=typeof document<"u"?document:null,km=Ba&&Ba.createElement("template"),dC={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const o=t==="svg"?Ba.createElementNS(uC,e):t==="mathml"?Ba.createElementNS(cC,e):n?Ba.createElement(e,{is:n}):Ba.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},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,r,o,a){const s=n?n.previousSibling:t.lastChild;if(o&&(o===a||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===a||!(o=o.nextSibling)););else{km.innerHTML=Gy(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const i=km.content;if(r==="svg"||r==="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]}},As="transition",Wl="animation",du=Symbol("_vtc"),Vy={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},fC=bn({},vy,Vy),hC=e=>(e.displayName="Transition",e.props=fC,e),ku=hC((e,{slots:t})=>Ph(uk,pC(e),t)),pi=(e,t=[])=>{lt(e)?e.forEach(n=>n(...t)):e&&e(...t)},Cm=e=>e?lt(e)?e.some(t=>t.length>1):e.length>1:!1;function pC(e){const t={};for(const te in e)te in Vy||(t[te]=e[te]);if(e.css===!1)return t;const{name:n="v",type:r,duration:o,enterFromClass:a=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:i=`${n}-enter-to`,appearFromClass:l=a,appearActiveClass:c=s,appearToClass:d=i,leaveFromClass:m=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:v=`${n}-leave-to`}=e,T=mC(o),k=T&&T[0],N=T&&T[1],{onBeforeEnter:_,onEnter:j,onEnterCancelled:W,onLeave:V,onLeaveCancelled:U,onBeforeAppear:fe=_,onAppear:K=j,onAppearCancelled:oe=W}=t,ve=(te,ke,ee,Ce)=>{te._enterCancelled=Ce,mi(te,ke?d:i),mi(te,ke?c:s),ee&&ee()},Pe=(te,ke)=>{te._isLeaving=!1,mi(te,m),mi(te,v),mi(te,f),ke&&ke()},we=te=>(ke,ee)=>{const Ce=te?K:j,De=()=>ve(ke,te,ee);pi(Ce,[ke,De]),xm(()=>{mi(ke,te?l:a),Oa(ke,te?d:i),Cm(Ce)||Im(ke,r,k,De)})};return bn(t,{onBeforeEnter(te){pi(_,[te]),Oa(te,a),Oa(te,s)},onBeforeAppear(te){pi(fe,[te]),Oa(te,l),Oa(te,c)},onEnter:we(!1),onAppear:we(!0),onLeave(te,ke){te._isLeaving=!0;const ee=()=>Pe(te,ke);Oa(te,m),te._enterCancelled?(Oa(te,f),Pm(te)):(Pm(te),Oa(te,f)),xm(()=>{te._isLeaving&&(mi(te,m),Oa(te,v),Cm(V)||Im(te,r,N,ee))}),pi(V,[te,ee])},onEnterCancelled(te){ve(te,!1,void 0,!0),pi(W,[te])},onAppearCancelled(te){ve(te,!0,void 0,!0),pi(oe,[te])},onLeaveCancelled(te){Pe(te),pi(U,[te])}})}function mC(e){if(e==null)return null;if(Ot(e))return[qd(e.enter),qd(e.leave)];{const t=qd(e);return[t,t]}}function qd(e){return vS(e)}function Oa(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[du]||(e[du]=new Set)).add(t)}function mi(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[du];n&&(n.delete(t),n.size||(e[du]=void 0))}function xm(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let gC=0;function Im(e,t,n,r){const o=e._endId=++gC,a=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(a,n);const{type:s,timeout:i,propCount:l}=vC(e,t);if(!s)return r();const c=s+"end";let d=0;const m=()=>{e.removeEventListener(c,f),a()},f=v=>{v.target===e&&++d>=l&&m()};setTimeout(()=>{d<l&&m()},i+1),e.addEventListener(c,f)}function vC(e,t){const n=window.getComputedStyle(e),r=T=>(n[T]||"").split(", "),o=r(`${As}Delay`),a=r(`${As}Duration`),s=Am(o,a),i=r(`${Wl}Delay`),l=r(`${Wl}Duration`),c=Am(i,l);let d=null,m=0,f=0;t===As?s>0&&(d=As,m=s,f=a.length):t===Wl?c>0&&(d=Wl,m=c,f=l.length):(m=Math.max(s,c),d=m>0?s>c?As:Wl:null,f=d?d===As?a.length:l.length:0);const v=d===As&&/\b(?:transform|all)(?:,|$)/.test(r(`${As}Property`).toString());return{type:d,timeout:m,propCount:f,hasTransform:v}}function Am(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>_m(n)+_m(e[r])))}function _m(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Pm(e){return(e?e.ownerDocument:document).body.offsetHeight}function yC(e,t,n){const r=e[du];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Tc=Symbol("_vod"),Ky=Symbol("_vsh"),wU={name:"show",beforeMount(e,{value:t},{transition:n}){e[Tc]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):ql(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),ql(e,!0),r.enter(e)):r.leave(e,()=>{ql(e,!1)}):ql(e,t))},beforeUnmount(e,{value:t}){ql(e,t)}};function ql(e,t){e.style.display=t?e[Tc]:"none",e[Ky]=!t}const wC=Symbol(""),bC=/(?:^|;)\s*display\s*:/;function TC(e,t,n){const r=e.style,o=Yt(n);let a=!1;if(n&&!o){if(t)if(Yt(t))for(const s of t.split(";")){const i=s.slice(0,s.indexOf(":")).trim();n[i]==null&&Jl(r,i,"")}else for(const s in t)n[s]==null&&Jl(r,s,"");for(const s in n){s==="display"&&(a=!0);const i=n[s];i!=null?kC(e,s,!Yt(t)&&t?t[s]:void 0,i)||Jl(r,s,i):Jl(r,s,"")}}else if(o){if(t!==n){const s=r[wC];s&&(n+=";"+s),r.cssText=n,a=bC.test(n)}}else t&&e.removeAttribute("style");Tc in e&&(e[Tc]=a?r.display:"",e[Ky]&&(r.display="none"))}const Em=/\s*!important$/;function Jl(e,t,n){if(lt(n))n.forEach(r=>Jl(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=SC(e,t);Em.test(n)?e.setProperty(Hs(r),n.replace(Em,""),"important"):e[r]=n}}const Mm=["Webkit","Moz","ms"],Gd={};function SC(e,t){const n=Gd[t];if(n)return n;let r=vr(t);if(r!=="filter"&&r in e)return Gd[t]=r;r=zc(r);for(let o=0;o<Mm.length;o++){const a=Mm[o]+r;if(a in e)return Gd[t]=a}return t}function kC(e,t,n,r){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&Yt(r)&&n===r}const Rm="http://www.w3.org/1999/xlink";function Lm(e,t,n,r,o,a=kS(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Rm,t.slice(6,t.length)):e.setAttributeNS(Rm,t,n):n==null||a&&!Uv(n)?e.removeAttribute(t):e.setAttribute(t,a?"":Bo(n)?String(n):n)}function jm(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Gy(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=Uv(n):n==null&&i==="string"?(n="",s=!0):i==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(o||t)}function Ti(e,t,n,r){e.addEventListener(t,n,r)}function CC(e,t,n,r){e.removeEventListener(t,n,r)}const Nm=Symbol("_vei");function xC(e,t,n,r,o=null){const a=e[Nm]||(e[Nm]={}),s=a[t];if(r&&s)s.value=r;else{const[i,l]=_C(t);if(r){const c=a[t]=MC(r,o);Ti(e,i,c,l)}else s&&(CC(e,i,s,l),a[t]=void 0)}}const IC=/(Once|Passive|Capture)$/,AC=/^on:?(?:Once|Passive|Capture)$/;function _C(e){let t,n;for(;(n=e.match(IC))&&!AC.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):Hs(e.slice(2)),t]}let Vd=0;const PC=Promise.resolve(),EC=()=>Vd||(PC.then(()=>Vd=0),Vd=Date.now());function MC(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;const o=n.value;if(lt(o)){const a=r.stopImmediatePropagation;r.stopImmediatePropagation=()=>{a.call(r),r._stopped=!0};const s=o.slice(),i=[r];for(let l=0;l<s.length&&!r._stopped;l++){const c=s[l];c&&no(c,t,5,i)}}else no(o,t,5,[r])};return n.value=e,n.attached=EC(),n}const $m=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,RC=(e,t,n,r,o,a)=>{const s=o==="svg";t==="class"?yC(e,r,s):t==="style"?TC(e,n,r):Dc(t)?Fc(t)||xC(e,t,n,r,a):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):LC(e,t,r,s))?(jm(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Lm(e,t,r,s,a,t!=="value")):e._isVueCE&&(jC(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Yt(r)))?jm(e,vr(t),r,a,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Lm(e,t,r,s))};function LC(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&$m(t)&&mt(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return $m(t)&&Yt(n)?!1:t in e}function jC(e,t){const n=e._def.props;if(!n)return!1;const r=vr(t);return Array.isArray(n)?n.some(o=>vr(o)===r):Object.keys(n).some(o=>vr(o)===r)}const Sc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return lt(t)?n=>oc(t,n):t};function NC(e){e.target.composing=!0}function Om(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const fl=Symbol("_assign");function Dm(e,t,n){return t&&(e=e.trim()),n&&(e=fh(e)),e}const Nn={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[fl]=Sc(o);const a=r||o.props&&o.props.type==="number";Ti(e,t?"change":"input",s=>{s.target.composing||e[fl](Dm(e.value,n,a))}),(n||a)&&Ti(e,"change",()=>{e.value=Dm(e.value,n,a)}),t||(Ti(e,"compositionstart",NC),Ti(e,"compositionend",Om),Ti(e,"change",Om))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:a}},s){if(e[fl]=Sc(s),e.composing)return;const i=(a||e.type==="number")&&!/^0\d/.test(e.value)?fh(e.value):e.value,l=t??"";if(i===l)return;const c=e.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===e&&e.type!=="range"&&(r&&t===n||o&&e.value.trim()===l)||(e.value=l)}},$C={deep:!0,created(e,t,n){e[fl]=Sc(n),Ti(e,"change",()=>{const r=e._modelValue,o=OC(e),a=e.checked,s=e[fl];if(lt(r)){const i=zv(r,o),l=i!==-1;if(a&&!l)s(r.concat(o));else if(!a&&l){const c=[...r];c.splice(i,1),s(c)}}else if(Bc(r)){const i=new Set(r);a?i.add(o):i.delete(o),s(i)}else s(Yy(e,a))})},mounted:Fm,beforeUpdate(e,t,n){e[fl]=Sc(n),Fm(e,t,n)}};function Fm(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(lt(t))o=zv(t,r.props.value)>-1;else if(Bc(t))o=t.has(r.props.value);else{if(t===n)return;o=vu(t,Yy(e,!0))}e.checked!==o&&(e.checked=o)}function OC(e){return"_value"in e?e._value:e.value}function Yy(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const DC=["ctrl","shift","alt","meta"],FC={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)=>DC.some(n=>e[`${n}Key`]&&!t.includes(n))},gt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=(o,...a)=>{for(let s=0;s<t.length;s++){const i=FC[t[s]];if(i&&i(o,t))return}return e(o,...a)})},BC={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Cr=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=o=>{if(!("key"in o))return;const a=Hs(o.key);if(t.some(s=>s===a||BC[s]===a))return e(o)})},UC=bn({patchProp:RC},dC);let Bm;function zC(){return Bm||(Bm=Gk(UC))}const HC=(...e)=>{const t=zC().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=qC(r);if(!o)return;const a=t._component;!mt(a)&&!a.render&&!a.template&&(a.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,WC(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t};function WC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function qC(e){return Yt(e)?document.querySelector(e):e}const GC="modulepreload",VC=function(e){return"/"+e},Um={},Lo=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let s=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};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"));o=s(n.map(c=>{if(c=VC(c),c in Um)return;Um[c]=!0;const d=c.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${m}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":GC,d||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),d)return new Promise((v,T)=>{f.addEventListener("load",v),f.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${c}`)))})}))}function a(s){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=s,window.dispatchEvent(i),!i.defaultPrevented)throw s}return o.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 rl=typeof document<"u";function Jy(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function KC(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Jy(e.default)}const Nt=Object.assign;function Kd(e,t){const n={};for(const r in t){const o=t[r];n[r]=zo(o)?o.map(e):e(o)}return n}const ru=()=>{},zo=Array.isArray;function zm(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const Qy=/#/g,YC=/&/g,JC=/\//g,QC=/=/g,XC=/\?/g,Xy=/\+/g,ZC=/%5B/g,ex=/%5D/g,Zy=/%5E/g,tx=/%60/g,ew=/%7B/g,nx=/%7C/g,tw=/%7D/g,rx=/%20/g;function Eh(e){return e==null?"":encodeURI(""+e).replace(nx,"|").replace(ZC,"[").replace(ex,"]")}function ox(e){return Eh(e).replace(ew,"{").replace(tw,"}").replace(Zy,"^")}function Nf(e){return Eh(e).replace(Xy,"%2B").replace(rx,"+").replace(Qy,"%23").replace(YC,"%26").replace(tx,"`").replace(ew,"{").replace(tw,"}").replace(Zy,"^")}function ax(e){return Nf(e).replace(QC,"%3D")}function sx(e){return Eh(e).replace(Qy,"%23").replace(XC,"%3F")}function ix(e){return sx(e).replace(JC,"%2F")}function fu(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const lx=/\/$/,ux=e=>e.replace(lx,"");function Yd(e,t,n="/"){let r,o={},a="",s="";const i=t.indexOf("#");let l=t.indexOf("?");return l=i>=0&&l>i?-1:l,l>=0&&(r=t.slice(0,l),a=t.slice(l,i>0?i:t.length),o=e(a.slice(1))),i>=0&&(r=r||t.slice(0,i),s=t.slice(i,t.length)),r=hx(r??t,n),{fullPath:r+a+s,path:r,query:o,hash:fu(s)}}function cx(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Hm(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function dx(e,t,n){const r=t.matched.length-1,o=n.matched.length-1;return r>-1&&r===o&&Tl(t.matched[r],n.matched[o])&&nw(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Tl(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function nw(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!fx(e[n],t[n]))return!1;return!0}function fx(e,t){return zo(e)?Wm(e,t):zo(t)?Wm(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Wm(e,t){return zo(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function hx(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),o=r[r.length-1];(o===".."||o===".")&&r.push("");let a=n.length-1,s,i;for(s=0;s<r.length;s++)if(i=r[s],i!==".")if(i==="..")a>1&&a--;else break;return n.slice(0,a).join("/")+"/"+r.slice(s).join("/")}const _s={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let $f=function(e){return e.pop="pop",e.push="push",e}({}),Jd=function(e){return e.back="back",e.forward="forward",e.unknown="",e}({});function px(e){if(!e)if(rl){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),ux(e)}const mx=/^[^#]+#/;function gx(e,t){return e.replace(mx,"#")+t}function vx(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const Jc=()=>({left:window.scrollX,top:window.scrollY});function yx(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),o=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!o)return;t=vx(o,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function qm(e,t){return(history.state?history.state.position-t:-1)+e}const Of=new Map;function wx(e,t){Of.set(e,t)}function bx(e){const t=Of.get(e);return Of.delete(e),t}function Tx(e){return typeof e=="string"||e&&typeof e=="object"}function rw(e){return typeof e=="string"||typeof e=="symbol"}let un=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 ow=Symbol("");un.MATCHER_NOT_FOUND+"",un.NAVIGATION_GUARD_REDIRECT+"",un.NAVIGATION_ABORTED+"",un.NAVIGATION_CANCELLED+"",un.NAVIGATION_DUPLICATED+"";function Sl(e,t){return Nt(new Error,{type:e,[ow]:!0},t)}function Da(e,t){return e instanceof Error&&ow in e&&(t==null||!!(e.type&t))}const Sx=["params","query","hash"];function kx(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Sx)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Cx(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<n.length;++r){const o=n[r].replace(Xy," "),a=o.indexOf("="),s=fu(a<0?o:o.slice(0,a)),i=a<0?null:fu(o.slice(a+1));if(s in t){let l=t[s];zo(l)||(l=t[s]=[l]),l.push(i)}else t[s]=i}return t}function Gm(e){let t="";for(let n in e){const r=e[n];if(n=ax(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(zo(r)?r.map(o=>o&&Nf(o)):[r&&Nf(r)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+n,o!=null&&(t+="="+o))})}return t}function xx(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=zo(r)?r.map(o=>o==null?null:""+o):r==null?r:""+r)}return t}const Ix=Symbol(""),Vm=Symbol(""),Qc=Symbol(""),Mh=Symbol(""),Df=Symbol("");function Gl(){let e=[];function t(r){return e.push(r),()=>{const o=e.indexOf(r);o>-1&&e.splice(o,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Ls(e,t,n,r,o,a=s=>s()){const s=r&&(r.enterCallbacks[o]=r.enterCallbacks[o]||[]);return()=>new Promise((i,l)=>{const c=f=>{f===!1?l(Sl(un.NAVIGATION_ABORTED,{from:n,to:t})):f instanceof Error?l(f):Tx(f)?l(Sl(un.NAVIGATION_GUARD_REDIRECT,{from:t,to:f})):(s&&r.enterCallbacks[o]===s&&typeof f=="function"&&s.push(f),i())},d=a(()=>e.call(r&&r.instances[o],t,n,c));let m=Promise.resolve(d);e.length<3&&(m=m.then(c)),m.catch(f=>l(f))})}function Qd(e,t,n,r,o=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(Jy(l)){const c=(l.__vccOpts||l)[t];c&&a.push(Ls(c,n,r,s,i,o))}else{let c=l();a.push(()=>c.then(d=>{if(!d)throw new Error(`Couldn't resolve component "${i}" at "${s.path}"`);const m=KC(d)?d.default:d;s.mods[i]=d,s.components[i]=m;const f=(m.__vccOpts||m)[t];return f&&Ls(f,n,r,s,i,o)()}))}}return a}function Ax(e,t){const n=[],r=[],o=[],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(c=>Tl(c,i))?r.push(i):n.push(i));const l=e.matched[s];l&&(t.matched.find(c=>Tl(c,l))||o.push(l))}return[n,r,o]}/*!
|
|
23
|
+
* vue-router v4.6.4
|
|
24
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
25
|
+
* @license MIT
|
|
26
|
+
*/let _x=()=>location.protocol+"//"+location.host;function aw(e,t){const{pathname:n,search:r,hash:o}=t,a=e.indexOf("#");if(a>-1){let s=o.includes(e.slice(a))?e.slice(a).length:1,i=o.slice(s);return i[0]!=="/"&&(i="/"+i),Hm(i,"")}return Hm(n,e)+r+o}function Px(e,t,n,r){let o=[],a=[],s=null;const i=({state:f})=>{const v=aw(e,location),T=n.value,k=t.value;let N=0;if(f){if(n.value=v,t.value=f,s&&s===T){s=null;return}N=k?f.position-k.position:0}else r(v);o.forEach(_=>{_(n.value,T,{delta:N,type:$f.pop,direction:N?N>0?Jd.forward:Jd.back:Jd.unknown})})};function l(){s=n.value}function c(f){o.push(f);const v=()=>{const T=o.indexOf(f);T>-1&&o.splice(T,1)};return a.push(v),v}function d(){if(document.visibilityState==="hidden"){const{history:f}=window;if(!f.state)return;f.replaceState(Nt({},f.state,{scroll:Jc()}),"")}}function m(){for(const f of a)f();a=[],window.removeEventListener("popstate",i),window.removeEventListener("pagehide",d),document.removeEventListener("visibilitychange",d)}return window.addEventListener("popstate",i),window.addEventListener("pagehide",d),document.addEventListener("visibilitychange",d),{pauseListeners:l,listen:c,destroy:m}}function Km(e,t,n,r=!1,o=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:o?Jc():null}}function Ex(e){const{history:t,location:n}=window,r={value:aw(e,n)},o={value:t.state};o.value||a(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(l,c,d){const m=e.indexOf("#"),f=m>-1?(n.host&&document.querySelector("base")?e:e.slice(m))+l:_x()+e+l;try{t[d?"replaceState":"pushState"](c,"",f),o.value=c}catch(v){console.error(v),n[d?"replace":"assign"](f)}}function s(l,c){a(l,Nt({},t.state,Km(o.value.back,l,o.value.forward,!0),c,{position:o.value.position}),!0),r.value=l}function i(l,c){const d=Nt({},o.value,t.state,{forward:l,scroll:Jc()});a(d.current,d,!0),a(l,Nt({},Km(r.value,l,null),{position:d.position+1},c),!1),r.value=l}return{location:r,state:o,push:i,replace:s}}function Mx(e){e=px(e);const t=Ex(e),n=Px(e,t.state,t.location,t.replace);function r(a,s=!0){s||n.pauseListeners(),history.go(a)}const o=Nt({location:"",base:e,go:r,createHref:gx.bind(null,e)},t,n);return Object.defineProperty(o,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(o,"state",{enumerable:!0,get:()=>t.state.value}),o}function Rx(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),Mx(e)}let Si=function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e}({});var Cn=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}(Cn||{});const Lx={type:Si.Static,value:""},jx=/[a-zA-Z0-9_]/;function Nx(e){if(!e)return[[]];if(e==="/")return[[Lx]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(v){throw new Error(`ERR (${n})/"${c}": ${v}`)}let n=Cn.Static,r=n;const o=[];let a;function s(){a&&o.push(a),a=[]}let i=0,l,c="",d="";function m(){c&&(n===Cn.Static?a.push({type:Si.Static,value:c}):n===Cn.Param||n===Cn.ParamRegExp||n===Cn.ParamRegExpEnd?(a.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),a.push({type:Si.Param,value:c,regexp:d,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),c="")}function f(){c+=l}for(;i<e.length;){if(l=e[i++],l==="\\"&&n!==Cn.ParamRegExp){r=n,n=Cn.EscapeNext;continue}switch(n){case Cn.Static:l==="/"?(c&&m(),s()):l===":"?(m(),n=Cn.Param):f();break;case Cn.EscapeNext:f(),n=r;break;case Cn.Param:l==="("?n=Cn.ParamRegExp:jx.test(l)?f():(m(),n=Cn.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--);break;case Cn.ParamRegExp:l===")"?d[d.length-1]=="\\"?d=d.slice(0,-1)+l:n=Cn.ParamRegExpEnd:d+=l;break;case Cn.ParamRegExpEnd:m(),n=Cn.Static,l!=="*"&&l!=="?"&&l!=="+"&&i--,d="";break;default:t("Unknown state");break}}return n===Cn.ParamRegExp&&t(`Unfinished custom RegExp for param "${c}"`),m(),s(),o}const Ym="[^/]+?",$x={sensitive:!1,strict:!1,start:!0,end:!0};var pr=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}(pr||{});const Ox=/[.+*?^${}()[\]/\\]/g;function Dx(e,t){const n=Nt({},$x,t),r=[];let o=n.start?"^":"";const a=[];for(const c of e){const d=c.length?[]:[pr.Root];n.strict&&!c.length&&(o+="/");for(let m=0;m<c.length;m++){const f=c[m];let v=pr.Segment+(n.sensitive?pr.BonusCaseSensitive:0);if(f.type===Si.Static)m||(o+="/"),o+=f.value.replace(Ox,"\\$&"),v+=pr.Static;else if(f.type===Si.Param){const{value:T,repeatable:k,optional:N,regexp:_}=f;a.push({name:T,repeatable:k,optional:N});const j=_||Ym;if(j!==Ym){v+=pr.BonusCustomRegExp;try{`${j}`}catch(V){throw new Error(`Invalid custom RegExp for param "${T}" (${j}): `+V.message)}}let W=k?`((?:${j})(?:/(?:${j}))*)`:`(${j})`;m||(W=N&&c.length<2?`(?:/${W})`:"/"+W),N&&(W+="?"),o+=W,v+=pr.Dynamic,N&&(v+=pr.BonusOptional),k&&(v+=pr.BonusRepeatable),j===".*"&&(v+=pr.BonusWildcard)}d.push(v)}r.push(d)}if(n.strict&&n.end){const c=r.length-1;r[c][r[c].length-1]+=pr.BonusStrict}n.strict||(o+="/?"),n.end?o+="$":n.strict&&!o.endsWith("/")&&(o+="(?:/|$)");const s=new RegExp(o,n.sensitive?"":"i");function i(c){const d=c.match(s),m={};if(!d)return null;for(let f=1;f<d.length;f++){const v=d[f]||"",T=a[f-1];m[T.name]=v&&T.repeatable?v.split("/"):v}return m}function l(c){let d="",m=!1;for(const f of e){(!m||!d.endsWith("/"))&&(d+="/"),m=!1;for(const v of f)if(v.type===Si.Static)d+=v.value;else if(v.type===Si.Param){const{value:T,repeatable:k,optional:N}=v,_=T in c?c[T]:"";if(zo(_)&&!k)throw new Error(`Provided param "${T}" is an array but it is not repeatable (* or + modifiers)`);const j=zo(_)?_.join("/"):_;if(!j)if(N)f.length<2&&(d.endsWith("/")?d=d.slice(0,-1):m=!0);else throw new Error(`Missing required param "${T}"`);d+=j}}return d||"/"}return{re:s,score:r,keys:a,parse:i,stringify:l}}function Fx(e,t){let n=0;for(;n<e.length&&n<t.length;){const r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?e.length===1&&e[0]===pr.Static+pr.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===pr.Static+pr.Segment?1:-1:0}function sw(e,t){let n=0;const r=e.score,o=t.score;for(;n<r.length&&n<o.length;){const a=Fx(r[n],o[n]);if(a)return a;n++}if(Math.abs(o.length-r.length)===1){if(Jm(r))return 1;if(Jm(o))return-1}return o.length-r.length}function Jm(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const Bx={strict:!1,end:!0,sensitive:!1};function Ux(e,t,n){const r=Dx(Nx(e.path),n),o=Nt(r,{record:e,parent:t,children:[],alias:[]});return t&&!o.record.aliasOf==!t.record.aliasOf&&t.children.push(o),o}function zx(e,t){const n=[],r=new Map;t=zm(Bx,t);function o(m){return r.get(m)}function a(m,f,v){const T=!v,k=Xm(m);k.aliasOf=v&&v.record;const N=zm(t,m),_=[k];if("alias"in m){const V=typeof m.alias=="string"?[m.alias]:m.alias;for(const U of V)_.push(Xm(Nt({},k,{components:v?v.record.components:k.components,path:U,aliasOf:v?v.record:k})))}let j,W;for(const V of _){const{path:U}=V;if(f&&U[0]!=="/"){const fe=f.record.path,K=fe[fe.length-1]==="/"?"":"/";V.path=f.record.path+(U&&K+U)}if(j=Ux(V,f,N),v?v.alias.push(j):(W=W||j,W!==j&&W.alias.push(j),T&&m.name&&!Zm(j)&&s(m.name)),iw(j)&&l(j),k.children){const fe=k.children;for(let K=0;K<fe.length;K++)a(fe[K],j,v&&v.children[K])}v=v||j}return W?()=>{s(W)}:ru}function s(m){if(rw(m)){const f=r.get(m);f&&(r.delete(m),n.splice(n.indexOf(f),1),f.children.forEach(s),f.alias.forEach(s))}else{const f=n.indexOf(m);f>-1&&(n.splice(f,1),m.record.name&&r.delete(m.record.name),m.children.forEach(s),m.alias.forEach(s))}}function i(){return n}function l(m){const f=qx(m,n);n.splice(f,0,m),m.record.name&&!Zm(m)&&r.set(m.record.name,m)}function c(m,f){let v,T={},k,N;if("name"in m&&m.name){if(v=r.get(m.name),!v)throw Sl(un.MATCHER_NOT_FOUND,{location:m});N=v.record.name,T=Nt(Qm(f.params,v.keys.filter(W=>!W.optional).concat(v.parent?v.parent.keys.filter(W=>W.optional):[]).map(W=>W.name)),m.params&&Qm(m.params,v.keys.map(W=>W.name))),k=v.stringify(T)}else if(m.path!=null)k=m.path,v=n.find(W=>W.re.test(k)),v&&(T=v.parse(k),N=v.record.name);else{if(v=f.name?r.get(f.name):n.find(W=>W.re.test(f.path)),!v)throw Sl(un.MATCHER_NOT_FOUND,{location:m,currentLocation:f});N=v.record.name,T=Nt({},f.params,m.params),k=v.stringify(T)}const _=[];let j=v;for(;j;)_.unshift(j.record),j=j.parent;return{name:N,path:k,params:T,matched:_,meta:Wx(_)}}e.forEach(m=>a(m));function d(){n.length=0,r.clear()}return{addRoute:a,resolve:c,removeRoute:s,clearRoutes:d,getRoutes:i,getRecordMatcher:o}}function Qm(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Xm(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:Hx(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 Hx(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function Zm(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Wx(e){return e.reduce((t,n)=>Nt(t,n.meta),{})}function qx(e,t){let n=0,r=t.length;for(;n!==r;){const a=n+r>>1;sw(e,t[a])<0?r=a:n=a+1}const o=Gx(e);return o&&(r=t.lastIndexOf(o,r-1)),r}function Gx(e){let t=e;for(;t=t.parent;)if(iw(t)&&sw(e,t)===0)return t}function iw({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function eg(e){const t=Fo(Qc),n=Fo(Mh),r=J(()=>{const l=g(e.to);return t.resolve(l)}),o=J(()=>{const{matched:l}=r.value,{length:c}=l,d=l[c-1],m=n.matched;if(!d||!m.length)return-1;const f=m.findIndex(Tl.bind(null,d));if(f>-1)return f;const v=tg(l[c-2]);return c>1&&tg(d)===v&&m[m.length-1].path!==v?m.findIndex(Tl.bind(null,l[c-2])):f}),a=J(()=>o.value>-1&&Qx(n.params,r.value.params)),s=J(()=>o.value>-1&&o.value===n.matched.length-1&&nw(n.params,r.value.params));function i(l={}){if(Jx(l)){const c=t[g(e.replace)?"replace":"push"](g(e.to)).catch(ru);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:r,href:J(()=>r.value.href),isActive:a,isExactActive:s,navigate:i}}function Vx(e){return e.length===1?e[0]:e}const Kx=cn({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:eg,setup(e,{slots:t}){const n=qc(eg(e)),{options:r}=Fo(Qc),o=J(()=>({[ng(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[ng(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&Vx(t.default(n));return e.custom?a:Ph("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:o.value},a)}}}),Yx=Kx;function Jx(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 Qx(e,t){for(const n in t){const r=t[n],o=e[n];if(typeof r=="string"){if(r!==o)return!1}else if(!zo(o)||o.length!==r.length||r.some((a,s)=>a.valueOf()!==o[s].valueOf()))return!1}return!0}function tg(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const ng=(e,t,n)=>e??t??n,Xx=cn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=Fo(Df),o=J(()=>e.route||r.value),a=Fo(Vm,0),s=J(()=>{let c=g(a);const{matched:d}=o.value;let m;for(;(m=d[c])&&!m.components;)c++;return c}),i=J(()=>o.value.matched[s.value]);ac(Vm,J(()=>s.value+1)),ac(Ix,i),ac(Df,o);const l=S();return ot(()=>[l.value,i.value,e.name],([c,d,m],[f,v,T])=>{d&&(d.instances[m]=c,v&&v!==d&&c&&c===f&&(d.leaveGuards.size||(d.leaveGuards=v.leaveGuards),d.updateGuards.size||(d.updateGuards=v.updateGuards))),c&&d&&(!v||!Tl(d,v)||!f)&&(d.enterCallbacks[m]||[]).forEach(k=>k(c))},{flush:"post"}),()=>{const c=o.value,d=e.name,m=i.value,f=m&&m.components[d];if(!f)return rg(n.default,{Component:f,route:c});const v=m.props[d],T=v?v===!0?c.params:typeof v=="function"?v(c):v:null,N=Ph(f,Nt({},T,t,{onVnodeUnmounted:_=>{_.component.isUnmounted&&(m.instances[d]=null)},ref:l}));return rg(n.default,{Component:N,route:c})||N}}});function rg(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Zx=Xx;function eI(e){const t=zx(e.routes,e),n=e.parseQuery||Cx,r=e.stringifyQuery||Gm,o=e.history,a=Gl(),s=Gl(),i=Gl(),l=qS(_s);let c=_s;rl&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const d=Kd.bind(null,B=>""+B),m=Kd.bind(null,ix),f=Kd.bind(null,fu);function v(B,ne){let ae,je;return rw(B)?(ae=t.getRecordMatcher(B),je=ne):je=B,t.addRoute(je,ae)}function T(B){const ne=t.getRecordMatcher(B);ne&&t.removeRoute(ne)}function k(){return t.getRoutes().map(B=>B.record)}function N(B){return!!t.getRecordMatcher(B)}function _(B,ne){if(ne=Nt({},ne||l.value),typeof B=="string"){const H=Yd(n,B,ne.path),ue=t.resolve({path:H.path},ne),se=o.createHref(H.fullPath);return Nt(H,ue,{params:f(ue.params),hash:fu(H.hash),redirectedFrom:void 0,href:se})}let ae;if(B.path!=null)ae=Nt({},B,{path:Yd(n,B.path,ne.path).path});else{const H=Nt({},B.params);for(const ue in H)H[ue]==null&&delete H[ue];ae=Nt({},B,{params:m(H)}),ne.params=m(ne.params)}const je=t.resolve(ae,ne),We=B.hash||"";je.params=d(f(je.params));const E=cx(r,Nt({},B,{hash:ox(We),path:je.path})),L=o.createHref(E);return Nt({fullPath:E,hash:We,query:r===Gm?xx(B.query):B.query||{}},je,{redirectedFrom:void 0,href:L})}function j(B){return typeof B=="string"?Yd(n,B,l.value.path):Nt({},B)}function W(B,ne){if(c!==B)return Sl(un.NAVIGATION_CANCELLED,{from:ne,to:B})}function V(B){return K(B)}function U(B){return V(Nt(j(B),{replace:!0}))}function fe(B,ne){const ae=B.matched[B.matched.length-1];if(ae&&ae.redirect){const{redirect:je}=ae;let We=typeof je=="function"?je(B,ne):je;return typeof We=="string"&&(We=We.includes("?")||We.includes("#")?We=j(We):{path:We},We.params={}),Nt({query:B.query,hash:B.hash,params:We.path!=null?{}:B.params},We)}}function K(B,ne){const ae=c=_(B),je=l.value,We=B.state,E=B.force,L=B.replace===!0,H=fe(ae,je);if(H)return K(Nt(j(H),{state:typeof H=="object"?Nt({},We,H.state):We,force:E,replace:L}),ne||ae);const ue=ae;ue.redirectedFrom=ne;let se;return!E&&dx(r,je,ae)&&(se=Sl(un.NAVIGATION_DUPLICATED,{to:ue,from:je}),_e(je,je,!0,!1)),(se?Promise.resolve(se):Pe(ue,je)).catch(le=>Da(le)?Da(le,un.NAVIGATION_GUARD_REDIRECT)?le:Te(le):Ee(le,ue,je)).then(le=>{if(le){if(Da(le,un.NAVIGATION_GUARD_REDIRECT))return K(Nt({replace:L},j(le.to),{state:typeof le.to=="object"?Nt({},We,le.to.state):We,force:E}),ne||ue)}else le=te(ue,je,!0,L,We);return we(ue,je,le),le})}function oe(B,ne){const ae=W(B,ne);return ae?Promise.reject(ae):Promise.resolve()}function ve(B){const ne=Xe.values().next().value;return ne&&typeof ne.runWithContext=="function"?ne.runWithContext(B):B()}function Pe(B,ne){let ae;const[je,We,E]=Ax(B,ne);ae=Qd(je.reverse(),"beforeRouteLeave",B,ne);for(const H of je)H.leaveGuards.forEach(ue=>{ae.push(Ls(ue,B,ne))});const L=oe.bind(null,B,ne);return ae.push(L),de(ae).then(()=>{ae=[];for(const H of a.list())ae.push(Ls(H,B,ne));return ae.push(L),de(ae)}).then(()=>{ae=Qd(We,"beforeRouteUpdate",B,ne);for(const H of We)H.updateGuards.forEach(ue=>{ae.push(Ls(ue,B,ne))});return ae.push(L),de(ae)}).then(()=>{ae=[];for(const H of E)if(H.beforeEnter)if(zo(H.beforeEnter))for(const ue of H.beforeEnter)ae.push(Ls(ue,B,ne));else ae.push(Ls(H.beforeEnter,B,ne));return ae.push(L),de(ae)}).then(()=>(B.matched.forEach(H=>H.enterCallbacks={}),ae=Qd(E,"beforeRouteEnter",B,ne,ve),ae.push(L),de(ae))).then(()=>{ae=[];for(const H of s.list())ae.push(Ls(H,B,ne));return ae.push(L),de(ae)}).catch(H=>Da(H,un.NAVIGATION_CANCELLED)?H:Promise.reject(H))}function we(B,ne,ae){i.list().forEach(je=>ve(()=>je(B,ne,ae)))}function te(B,ne,ae,je,We){const E=W(B,ne);if(E)return E;const L=ne===_s,H=rl?history.state:{};ae&&(je||L?o.replace(B.fullPath,Nt({scroll:L&&H&&H.scroll},We)):o.push(B.fullPath,We)),l.value=B,_e(B,ne,ae,L),Te()}let ke;function ee(){ke||(ke=o.listen((B,ne,ae)=>{if(!rt.listening)return;const je=_(B),We=fe(je,rt.currentRoute.value);if(We){K(Nt(We,{replace:!0,force:!0}),je).catch(ru);return}c=je;const E=l.value;rl&&wx(qm(E.fullPath,ae.delta),Jc()),Pe(je,E).catch(L=>Da(L,un.NAVIGATION_ABORTED|un.NAVIGATION_CANCELLED)?L:Da(L,un.NAVIGATION_GUARD_REDIRECT)?(K(Nt(j(L.to),{force:!0}),je).then(H=>{Da(H,un.NAVIGATION_ABORTED|un.NAVIGATION_DUPLICATED)&&!ae.delta&&ae.type===$f.pop&&o.go(-1,!1)}).catch(ru),Promise.reject()):(ae.delta&&o.go(-ae.delta,!1),Ee(L,je,E))).then(L=>{L=L||te(je,E,!1),L&&(ae.delta&&!Da(L,un.NAVIGATION_CANCELLED)?o.go(-ae.delta,!1):ae.type===$f.pop&&Da(L,un.NAVIGATION_ABORTED|un.NAVIGATION_DUPLICATED)&&o.go(-1,!1)),we(je,E,L)}).catch(ru)}))}let Ce=Gl(),De=Gl(),Ue;function Ee(B,ne,ae){Te(B);const je=De.list();return je.length?je.forEach(We=>We(B,ne,ae)):console.error(B),Promise.reject(B)}function be(){return Ue&&l.value!==_s?Promise.resolve():new Promise((B,ne)=>{Ce.add([B,ne])})}function Te(B){return Ue||(Ue=!B,ee(),Ce.list().forEach(([ne,ae])=>B?ae(B):ne()),Ce.reset()),B}function _e(B,ne,ae,je){const{scrollBehavior:We}=e;if(!rl||!We)return Promise.resolve();const E=!ae&&bx(qm(B.fullPath,0))||(je||!ae)&&history.state&&history.state.scroll||null;return Et().then(()=>We(B,ne,E)).then(L=>L&&yx(L)).catch(L=>Ee(L,B,ne))}const xe=B=>o.go(B);let Je;const Xe=new Set,rt={currentRoute:l,listening:!0,addRoute:v,removeRoute:T,clearRoutes:t.clearRoutes,hasRoute:N,getRoutes:k,resolve:_,options:e,push:V,replace:U,go:xe,back:()=>xe(-1),forward:()=>xe(1),beforeEach:a.add,beforeResolve:s.add,afterEach:i.add,onError:De.add,isReady:be,install(B){B.component("RouterLink",Yx),B.component("RouterView",Zx),B.config.globalProperties.$router=rt,Object.defineProperty(B.config.globalProperties,"$route",{enumerable:!0,get:()=>g(l)}),rl&&!Je&&l.value===_s&&(Je=!0,V(o.location).catch(je=>{}));const ne={};for(const je in _s)Object.defineProperty(ne,je,{get:()=>l.value[je],enumerable:!0});B.provide(Qc,rt),B.provide(Mh,ay(ne)),B.provide(Df,l);const ae=B.unmount;Xe.add(B),B.unmount=function(){Xe.delete(B),Xe.size<1&&(c=_s,ke&&ke(),ke=null,l.value=_s,Je=!1,Ue=!1),ae()}}};function de(B){return B.reduce((ne,ae)=>ne.then(()=>ve(ae)),Promise.resolve())}return rt}function tI(){return Fo(Qc)}function nI(e){return Fo(Mh)}const og=768;function Rh(){const e=S(typeof window<"u"?window.innerWidth<og:!1);let t=null;function n(r){e.value=r.matches}return es(()=>{t=window.matchMedia(`(max-width: ${og-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Tu(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const rI={key:0,class:"desktop-sidebar"},oI={class:"desktop-main"},ag="codex-web-local.sidebar-width.v1",aI=260,sI=620,sg=320,iI=cn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Rh();function r(c){return Math.min(sI,Math.max(aI,c))}function o(){if(typeof window>"u")return sg;const c=window.localStorage.getItem(ag),d=Number(c);return Number.isFinite(d)?r(d):sg}const a=S(o()),s=J(()=>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(c){typeof window>"u"||window.localStorage.setItem(ag,String(c))}function l(c){c.preventDefault();const d=c.clientX,m=a.value,f=T=>{const k=T.clientX-d;a.value=r(m+k)},v=()=>{i(a.value),window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",v)};window.addEventListener("mousemove",f),window.addEventListener("mouseup",v)}return(c,d)=>(P(),D("div",{class:ct(["desktop-layout",{"is-mobile":g(n)}]),style:Zr(s.value)},[g(n)?(P(),tt(Bs,{key:0,to:"body"},[Be(ku,{name:"drawer"},{default:pt(()=>[e.isSidebarCollapsed?me("",!0):(P(),D("div",{key:0,class:"mobile-drawer-backdrop",onClick:d[1]||(d[1]=m=>c.$emit("close-sidebar"))},[w("aside",{class:"mobile-drawer",onClick:d[0]||(d[0]=gt(()=>{},["stop"]))},[xr(c.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):me("",!0),g(n)?me("",!0):(P(),D(at,{key:1},[e.isSidebarCollapsed?me("",!0):(P(),D("aside",rI,[xr(c.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?me("",!0):(P(),D("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),w("section",oI,[xr(c.$slots,"content",{},void 0)])],6))}}),kt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n},lI=kt(iI,[["__scopeId","data-v-336d0207"]]);function ig(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Br extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function oo(e,t){if(typeof e=="string"&&e.length>0)return e;const n=ig(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const o=ig(r);return o&&typeof o.message=="string"&&o.message.length>0?o.message:typeof n.message=="string"&&n.message.length>0?n.message:typeof n.detail=="string"&&n.detail.length>0?n.detail:t}function ro(e,t,n){return e instanceof Br?e:e instanceof Error?new Br(e.message||t,{code:"unknown_error",method:n}):new Br(t,{code:"unknown_error",method:n})}function lw(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function uI(e,t){const n={method:e,params:t??null};let r;try{r=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(i){throw new Br(i instanceof Error?i.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let o=null,a=null;try{a=await r.text(),o=JSON.parse(a)}catch{o=null}if(!r.ok){const i=oo(o,"")||(a==null?void 0:a.slice(0,500))||"",l=`RPC ${e} failed with HTTP ${r.status}`;throw new Br(i?`${l}: ${i}`:l,{code:"http_error",method:e,status:r.status})}const s=o;if(!s||typeof s!="object"||!("result"in s))throw new Br(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return s.result}async function cI(){const e=await fetch("/codex-api/meta/methods");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Br(oo(t,`Method catalog failed with HTTP ${e.status}`),{code:"http_error",method:"meta/methods",status:e.status});const n=t;return Array.isArray(n.data)?n.data:[]}function dI(e){const t=lw(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 lg(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function fI(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const o=()=>{r!==null&&(window.clearTimeout(r),r=null)},a=(c,d)=>{if(n||r!==null)return;const m=Math.min(1e3*2**d,1e4);r=window.setTimeout(()=>{r=null,!n&&c()},m)},s=c=>{const d=dI(c);d&&e(d)},i=(c=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const d=new EventSource("/codex-api/events");let m=!1;d.onmessage=f=>{try{s(JSON.parse(f.data))}catch{}},d.addEventListener("ready",f=>{try{const v=f.data?JSON.parse(f.data):{ok:!0};lg(e,v)}catch{lg(e)}}),d.onerror=()=>{n||m||d.readyState===EventSource.CLOSED&&(m=!0,d.close(),a(()=>i(c+1),c))},t=()=>{m=!0,d.close()}},l=(c=0)=>{if(typeof WebSocket>"u"||n){i();return}t==null||t();const d=window.location.protocol==="https:"?"wss:":"ws:",m=new WebSocket(`${d}//${window.location.host}/codex-api/ws`);let f=!1,v=!1,T=window.setTimeout(()=>{f||n||v||(v=!0,m.close(),i())},2500);m.onopen=()=>{f=!0,o(),T!==null&&(window.clearTimeout(T),T=null)},m.onmessage=k=>{try{s(JSON.parse(String(k.data)))}catch{}},m.onerror=()=>{},m.onclose=()=>{if(T!==null&&(window.clearTimeout(T),T=null),!(n||v)){if(!f){i();return}a(()=>l(c+1),c)}},t=()=>{v=!0,T!==null&&(window.clearTimeout(T),T=null),m.close()}};return typeof WebSocket<"u"?l():i(),()=>{n=!0,o(),t==null||t()}}async function hI(e){let t;try{t=await fetch("/codex-api/server-requests/respond",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(r){throw new Br(r instanceof Error?r.message:"Failed to reply to server request",{code:"network_error",method:"server-requests/respond"})}let n=null;try{n=await t.json()}catch{n=null}if(!t.ok)throw new Br(oo(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function pI(){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 Br(oo(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=lw(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}async function it(e,t){try{return await uI(e,t)}catch(n){throw ro(n,`RPC ${e} failed`,e)}}function Zt(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},r=n.message;if(typeof r=="string"&&r.trim().length>0)return r;const o=n.error;return typeof o=="string"&&o.trim().length>0?o:t}function Ye(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function re(e){return typeof e=="string"&&e.length>0?e:null}function Gt(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function or(e){return typeof e=="boolean"?e:null}function $o(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}async function _i(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 kc(e){const t=Ye(e);if(!t)return null;const n=re(t.id),r=re(t.kind),o=re(t.name),a=re(t.prompt),s=re(t.rrule),i=re(t.status);return!n||!o||!a||!s||r!=="heartbeat"&&r!=="cron"||i!=="ACTIVE"&&i!=="PAUSED"?null:{id:n,kind:r,name:o,prompt:a,rrule:s,status:i,targetThreadId:re(t.targetThreadId),cwds:Array.isArray(t.cwds)?t.cwds.filter(l=>typeof l=="string"&&l.trim().length>0):[],createdAtMs:Gt(t.createdAtMs),updatedAtMs:Gt(t.updatedAtMs),nextRunAtMs:Gt(t.nextRunAtMs)}}function uw(e){if(Array.isArray(e))return e.flatMap(n=>{const r=kc(n);return r?[r]:[]});const t=kc(e);return t?[t]:[]}async function mI(){var o;const e=await fetch("/codex-api/thread-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(oo(t,"Failed to load thread automations"));const n=Ye((o=Ye(t))==null?void 0:o.data),r={};if(!n)return r;for(const[a,s]of Object.entries(n)){const i=uw(s);i.length>0&&(r[a]=i)}return r}async function gI(){var o;const e=await fetch("/codex-api/project-automations"),t=await e.json().catch(()=>null);if(!e.ok)throw new Error(oo(t,"Failed to load project automations"));const n=Ye((o=Ye(t))==null?void 0:o.data),r={};if(!n)return r;for(const[a,s]of Object.entries(n)){const i=uw(s);i.length>0&&(r[a]=i)}return r}async function vI(e){var o;const t=await fetch("/codex-api/thread-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(oo(n,"Failed to save thread automation"));const r=kc((o=Ye(n))==null?void 0:o.data);if(!r)throw new Error("Thread automation response was malformed");return r}async function yI(e){var o;const t=await fetch("/codex-api/project-automation",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error(oo(n,"Failed to save project automation"));const r=kc((o=Ye(n))==null?void 0:o.data);if(!r)throw new Error("Project automation response was malformed");return r}async function ug(e,t){const n=new URLSearchParams({threadId:e});t&&n.set("automationId",t);const r=await fetch(`/codex-api/thread-automation?${n.toString()}`,{method:"DELETE"}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error(oo(o,"Failed to delete thread automation"))}async function cw(e,t){const n=new URLSearchParams({projectName:e});t&&n.set("automationId",t);const r=await fetch(`/codex-api/project-automation?${n.toString()}`,{method:"DELETE"}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error(oo(o,"Failed to delete project automation"))}async function wI(e,t){const n=await fetch("/codex-api/thread-automation/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadId:e,automationId:t})}),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(oo(r,"Failed to run thread automation"))}const bI=new Set(["node_modules","dist","build","out",".next",".nuxt","coverage","__pycache__",".cache",".turbo","target",".venv","venv",".idea",".vscode","output"]);function dw(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>n.startsWith(".")||bI.has(n))}function TI(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=Array.isArray(t.files)?t.files:[],r=[];for(const o of n){if(!o||typeof o!="object"||Array.isArray(o))continue;const s=o.path,i=typeof s=="string"?s.trim():"";!i||dw(i)||r.push({path:i})}return r}async function SI(e,t){await it("fuzzyFileSearch/sessionStart",{sessionId:t,roots:e})}async function kI(e,t){await it("fuzzyFileSearch/sessionUpdate",{sessionId:e,query:t})}async function CI(e){await it("fuzzyFileSearch/sessionStop",{sessionId:e}).catch(()=>{})}async function cg(e,t,n=20){const r=e.trim();if(!r)return[];const o=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:r,query:t.trim(),limit:n})}),a=await o.json();if(!o.ok){const c=Zt(a,"Failed to search files");throw new Error(c)}const s=a&&typeof a=="object"&&!Array.isArray(a)?a:{},i=Array.isArray(s.data)?s.data:[],l=[];for(const c of i){if(!c||typeof c!="object"||Array.isArray(c))continue;const m=c.path,f=typeof m=="string"?m.trim():"";!f||dw(f)||l.push({path:f})}return l}async function xI(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to search threads");return r.data??{threadIds:[],indexedThreadCount:0}}function II(e){const t=Ye(e);if(!t)return null;const n=re(t.id),r=re(t.threadId),o=re(t.cwd),a=re(t.shell);return!n||!r||!o||!a?null:{id:n,threadId:r,cwd:o,shell:a,buffer:typeof t.buffer=="string"?t.buffer:"",truncated:or(t.truncated)??!1}}async function Il(e,t){const n=await fetch(e,t),r=await n.json().catch(()=>null);if(!n.ok)throw new Error(oo(r,`Terminal request failed with HTTP ${n.status}`));return r}async function bU(e){var r;const t=await Il("/codex-api/thread-terminal/attach",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=II((r=Ye(t))==null?void 0:r.session);if(!n)throw new Error("Terminal attach response was malformed");return n}async function AI(){const e=await Il("/codex-api/thread-terminal/status"),t=Ye(e);return{available:or(t==null?void 0:t.available)??!1,reason:re(t==null?void 0:t.reason)||null}}async function TU(e){const t=await Il(`/codex-api/thread-terminal/quick-commands?cwd=${encodeURIComponent(e)}`),n=Ye(t);return(Array.isArray(n==null?void 0:n.commands)?n.commands:[]).flatMap(o=>{const a=Ye(o),s=re(a==null?void 0:a.label),i=re(a==null?void 0:a.value),l=re(a==null?void 0:a.source);return!s||!i||l!=="package"&&l!=="script"&&l!=="make"?[]:[{label:s,value:i,source:l}]})}async function SU(e,t){await Il("/codex-api/thread-terminal/input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,data:t})})}async function kU(e,t,n){await Il("/codex-api/thread-terminal/resize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,cols:t,rows:n})})}async function CU(e){await Il("/codex-api/thread-terminal/close",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e})})}function _I(e,t=[],n=[]){if(e.trim().length>0)return e;const r=t.map(o=>(o.label??"").trim()).find(o=>o.length>0);return r||(n.some(o=>(o??"").trim().length>0)?"[Image]":"[Attachment]")}const fw=["none","minimal","low","medium","high","xhigh","max","ultra"];function kl(e){return typeof e=="string"&&fw.some(t=>t===e)}function PI(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function nt(e){return PI(e)}function hw(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function EI(e){const t=nt(e);return t.startsWith("/")||hw(t)}function MI(e){const t=nt(e).replace(/[\\/]+/gu,"/");return hw(t)?t.toLowerCase():t}function Fr(e){const t=nt(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function hl(e){const t=nt(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function to(e){return Fr(e)||nt(e)||"Projectless"}function Cc(e){const t=nt(e).replace(/[\\/]+/gu,"/");return t?/(?:^|\/)Documents\/Codex\/\d{4}-\d{2}-\d{2}\/[^/]+$/u.test(t):!1}function dg(e){return new Date(e*1e3).toISOString()}function RI(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return null;const t=e>1e11?e:e*1e3,n=new Date(t);return Number.isNaN(n.getTime())?null:n.toISOString()}function LI(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function jI(e){const t=e.error;return typeof(t==null?void 0:t.message)=="string"?t.message.trim():""}const NI=/^##\s+(.+?):\s+(.+?)\s*$/,$I=/^#\s*files mentioned by the user\s*:?\s*$/i;function OI(e){var o,a;const t=e.split(`
|
|
27
|
+
`).findIndex(s=>$I.test(s.trim()));if(t<0)return[];const n=e.split(`
|
|
28
|
+
`).slice(t+1),r=[];for(const s of n){const i=s.trim();if(!i)continue;const l=i.match(NI);if(!l)break;const c=(o=l[1])==null?void 0:o.trim(),d=(a=l[2])==null?void 0:a.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");c&&d&&r.push({label:c,path:d})}return r}function DI(e){const t=/(?:^|\n)\s{0,3}#{0,6}\s*my request for codex\s*:?\s*/giu,n=Array.from(e.matchAll(t));if(n.length===0)return e.trim();const r=n.at(-1);if(!r||typeof r.index!="number")return e.trim();const o=r.index+r[0].length;return e.slice(o).trim()}const FI=new Set(["text","image","localImage","audio","localAudio","skill","mention"]);function pw(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function BI(e){return`/codex-local-file?path=${encodeURIComponent(e)}`}function UI(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 zI(e){const t=e.aggregatedOutputSpill;if(!t||typeof t!="object"||Array.isArray(t))return;const n=t,r=typeof n.ref=="string"?n.ref.trim():"",o=i=>typeof i=="number"&&Number.isFinite(i)&&i>0?Math.trunc(i):0,a=o(n.totalBytes),s=o(n.omittedBytes);if(!(s<=0))return{ref:r,totalBytes:a,omittedBytes:s}}function HI(e){return e.replace(/</giu,"<").replace(/>/giu,">").replace(/&/giu,"&")}function Xd(e,t){const n=new RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*</${t}>`,"iu").exec(e);return n!=null&&n[1]?HI(n[1].trim()):""}function WI(e){const t=e.trim();if(!t.startsWith("<heartbeat>")||!t.endsWith("</heartbeat>"))return null;const n=Xd(t,"current_time_iso"),r=Xd(t,"instructions");return!n||!r?null:{automationId:Xd(t,"automation_id"),currentTimeIso:n,instructions:r}}function qI(e,t){if(!Array.isArray(t))return{text:"",images:[],skills:[],fileAttachments:[],imageAttachmentIds:[],audioSources:[],mentions:[],rawBlocks:[],isAutomationRun:!1,automationDisplayName:null};const n=[],r=[],o=[],a=[],s=[],i=[],l=[];for(const[f,v]of t.entries()){if(v.type==="text"&&typeof v.text=="string"&&v.text.length>0&&n.push(v.text),v.type==="image"&&"url"in v&&typeof v.url=="string"&&v.url.trim().length>0&&r.push(v.url.trim()),v.type==="image"&&!("url"in v)&&"fileId"in v&&typeof v.fileId=="string"&&v.fileId.trim().length>0&&o.push(v.fileId.trim()),v.type==="localImage"&&typeof v.path=="string"&&v.path.trim().length>0&&r.push(pw(v.path.trim())),v.type==="skill"){const k=typeof v.name=="string"?v.name.trim():"",N=typeof v.path=="string"?v.path.trim():"";k&&N&&i.push({name:k,path:N})}if(v.type==="audio"&&typeof v.url=="string"&&v.url.trim().length>0&&a.push(v.url.trim()),v.type==="localAudio"&&typeof v.path=="string"&&v.path.trim().length>0&&a.push(BI(v.path.trim())),v.type==="mention"){const k=typeof v.name=="string"?v.name.trim():"",N=typeof v.path=="string"?v.path.trim():"";k&&s.push({name:k,path:N})}const T=v.type;FI.has(T)||l.push({id:`${e}:user-content:${f}`,role:"user",text:"",messageType:`userContent.${T}`,rawPayload:LI(v),isUnhandled:!0})}const c=n.join(`
|
|
29
|
+
`),d=OI(c),m=WI(c);return{text:(m==null?void 0:m.instructions)??DI(c),images:r,skills:i,fileAttachments:d,imageAttachmentIds:o,audioSources:a,mentions:s,rawBlocks:l,isAutomationRun:m!==null,automationDisplayName:(m==null?void 0:m.automationId)||null}}function GI(e){var a;const t=e.replace(/\r\n/g,`
|
|
30
|
+
`).trim();if(!t)return null;const n=t.split(`
|
|
31
|
+
`),r=[],o=[];for(const s of n){const i=s.trim();if(!i){r.length===0&&o.push("");continue}const l=i.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(l){const c=(l[1]??" ").toLowerCase(),d=(a=l[2])==null?void 0:a.trim();if(!d)continue;let m="pending";c==="x"&&(m="completed"),(c==="~"||c===">"||c==="-")&&(m="inProgress"),r.push({step:d,status:m});continue}o.push(i)}return r.length===0?null:{explanation:o.join(`
|
|
32
|
+
`).trim()||void 0,steps:r}}function fg(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 VI(e){let t=0,n=0;for(const r of e.replace(/\r\n/g,`
|
|
36
|
+
`).split(`
|
|
37
|
+
`))if(r&&!(r.startsWith("+++")||r.startsWith("---")||r.startsWith("@@"))){if(r.startsWith("+")){t+=1;continue}r.startsWith("-")&&(n+=1)}return{addedLineCount:t,removedLineCount:n}}function mw(e){return e==="failed"||e==="declined"||e==="completed"?e:"inProgress"}function Ff(e){const t=Array.isArray(e)?e:[],n=[];for(const r of t){const o=r,a=typeof o.path=="string"?o.path:"",s=typeof o.diff=="string"?o.diff:"",i=o.kind,l=i==null?void 0:i.type;if(!a||l!=="add"&&l!=="delete"&&l!=="update")continue;const c=l==="update"&&typeof(i==null?void 0:i.move_path)=="string"?i.move_path:null,d=l==="update"?VI(s):l==="add"?{addedLineCount:fg(s),removedLineCount:0}:{addedLineCount:0,removedLineCount:fg(s)};n.push({path:a,operation:l,movedToPath:c,diff:s,...d})}return n}function KI(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=qI(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0||t.skills.length>0||t.imageAttachmentIds.length>0||t.audioSources.length>0||t.mentions.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,imageAttachmentIds:t.imageAttachmentIds.length>0?t.imageAttachmentIds:void 0,audioSources:t.audioSources.length>0?t.audioSources:void 0,mentions:t.mentions.length>0?t.mentions:void 0,messageType:e.type,clientId:typeof e.clientId=="string"&&e.clientId.length>0?e.clientId:null,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:[pw(t)],messageType:"imageView"}]:[]}{const t=e;if(t.type==="imageGeneration"||t.type==="image_generation"){const n=typeof t.result=="string"?UI(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"):[],r=Array.isArray(t.content)?t.content.filter(i=>typeof i=="string"):[],o=n.join(`
|
|
38
|
+
`).trim(),s=r.join(`
|
|
39
|
+
`).trim()||o;return s?[{id:e.id,role:"assistant",text:s,messageType:"reasoning",reasoning:{summary:n,content:r}}]:[]}if(e.type==="mcpToolCall"){const t=e,n=typeof t.server=="string"?t.server:"",r=typeof t.tool=="string"?t.tool:"";if(!n&&!r)return[];const o=t.status;let a="completed";const s=typeof o=="string"?o:o==null?void 0:o.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:r,messageType:"toolCall",toolCall:{server:n,tool:r,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:GI(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=YI(t.status),r=typeof t.command=="string"?t.command:"",o=typeof t.cwd=="string"?t.cwd:null,a=typeof t.aggregatedOutput=="string"?t.aggregatedOutput:"",s=typeof t.exitCode=="number"?t.exitCode:null;return[{id:e.id,role:"system",text:r,messageType:"commandExecution",commandExecution:{command:r,cwd:o,status:n,aggregatedOutput:a,exitCode:s,outputSpill:zI(t)}}]}if(e.type==="fileChange"){const t=Ff(e.changes),n=mw(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 YI(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function JI(e){const t=e,n=[t.name,t.title,e.preview];for(const r of n)if(typeof r=="string"&&r.trim().length>0)return r.trim();return""}function QI(e){const t=JI(e);return t.length>0?t:"Untitled thread"}function Lh(e){return(e==null?void 0:e.status)==="inProgress"}function jh(e){const n=e.externalSession;if(!n||typeof n!="object"||Array.isArray(n))return null;const r=n,o=typeof r.origin=="string"&&r.origin.trim().length>0?r.origin.trim():"";return o?{origin:o,active:r.active===!0,lastWriteAt:typeof r.lastWriteAt=="string"?r.lastWriteAt:null}:null}function XI(e){var t;return((t=jh(e))==null?void 0:t.active)===!0}function gw(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 o=(Array.isArray(e.turns)?e.turns:[]).at(-1);return Lh(o)||XI(e)}function vw(e){const t=e,n=nt(typeof t.cwd=="string"?t.cwd:e.cwd),r=MI(n),o=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||r.includes("/.codex/worktrees/")||r.includes("/.git/worktrees/");return{id:e.id,title:QI(e),projectName:to(n),cwd:n,hasWorktree:o,createdAtIso:dg(e.createdAt),updatedAtIso:dg(e.updatedAt),preview:e.preview,historyMode:t.historyMode==="legacy"?"legacy":"paginated",originator:typeof t.originator=="string"&&t.originator.trim().length>0?t.originator.trim():null,unread:!1,inProgress:gw(e),externalSession:jh(e)}}function ZI(e){return vw(e.thread)}function eA(e){const t=new Map;for(const n of e){const r=t.get(n.projectName);r?r.push(n):t.set(n.projectName,[n])}return Array.from(t.entries()).map(([n,r])=>({projectName:n,threads:r.sort((o,a)=>new Date(a.updatedAtIso).getTime()-new Date(o.updatedAtIso).getTime())})).sort((n,r)=>{var s,i;const o=new Date(((s=n.threads[0])==null?void 0:s.updatedAtIso)??0).getTime();return new Date(((i=r.threads[0])==null?void 0:i.updatedAtIso)??0).getTime()-o})}function tA(e){const t=e.data.map(vw);return eA(t)}const nA=["<subagent_notification>","<environment_context>"];function rA(e,t){const n=e.text.trimStart();return nA.some(r=>n.startsWith(r))?!0:t<=0?!1:(e.clientId??null)===null}function Xc(e,t=0){return $h(Nh(e,t))}function Nh(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],r=[];for(let o=0;o<n.length;o++){const a=t+o,s=n[o],i=typeof(s==null?void 0:s.id)=="string"?s.id.trim():"",l=i.length>0?i:void 0,c=Array.isArray(s.items)?s.items:[],d=RI(s==null?void 0:s.startedAt),m=[];for(const T of c)for(const k of KI(T))m.push({...k,turnId:l,turnIndex:a,turnStartedAtIso:d??void 0});let f=0;for(const T of m)T.role!=="user"||T.isUnhandled===!0||(rA(T,f)&&(T.isAgentNote=!0),f+=1);const v=jI(s);if(s.status==="failed"&&v){const T=l??`turn-${a}`;m.push({id:`${T}-error`,role:"system",text:v,messageType:"turnError",turnId:l,turnIndex:a,turnStartedAtIso:d??void 0})}r.push(...m)}return r}function $h(e){return lA(iA(e))}function oA(e,t={}){if(e.length===0)return[];const n=[],r=[];for(let s=e.length-1;s>=0;s-=1){const i=e[s]??[];n.push(Nh({thread:{...t,turns:[...i].reverse()}},0)),r.push(i.length)}const o=[];let a=0;for(let s=0;s<n.length;s+=1){const i=n[s];if(a!==0)for(const l of i)typeof l.turnIndex=="number"&&(l.turnIndex+=a);o.push(...i),a+=r[s]}return $h(o)}const Zd=30;function aA(){return new Promise(e=>{setTimeout(e,0)})}async function sA(e,t=0,n){const r=Array.isArray(e.thread.turns)?e.thread.turns:[];if(!n||r.length<=Zd)return Xc(e,t);let o=[],a=!0;for(let s=r.length;s>0;s-=Zd){const i=Math.max(0,s-Zd),l={...e,thread:{...e.thread,turns:r.slice(i,s)}},c=Nh(l,t+i);o=a?c:[...c,...o],a=!1,n(o),i>0&&await aA()}return $h(o)}function iA(e){var n;let t=-1;for(let r=e.length-1;r>=0;r-=1)if(((n=e[r])==null?void 0:n.messageType)==="compaction.done"){t=r;break}return t<0?e:e.filter((r,o)=>r.messageType!=="compaction.done"||o===t)}function lA(e){var s;let t=-1;for(let i=0;i<e.length;i+=1)if(((s=e[i])==null?void 0:s.messageType)==="compaction.done"){t=i;break}if(t<0)return e;const n=e[t],r=n.turnIndex;let o=-1;for(let i=0;i<e.length;i+=1){const l=e[i];if((l==null?void 0:l.turnIndex)===r&&(l==null?void 0:l.role)==="user"&&(l==null?void 0:l.isAgentNote)!==!0){o=i;break}}if(o<0||t<=o)return e;const a=e.filter((i,l)=>l!==t);return a.splice(o+1,0,n),a}function Oh(e){if(gw(e.thread))return!0;const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Lh(t.at(-1))}function yw(e){return jh(e.thread)}function Dh(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];for(let n=t.length-1;n>=0;n-=1){const r=t[n];if(Lh(r)&&typeof r.id=="string"&&r.id.trim().length>0)return r.id.trim()}return""}const uA=50,cA=3e4,Zi=new Map,dA=12e3;function ef(e){return e&&e.length>0?e:null}function tf(e){return e&&e.length>0?e:null}function fA(e){return kl(e)?e:""}function hA(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}function Fh(e,t=0){const n=Array.isArray(e.thread.turns)?e.thread.turns:[],r={};for(let o=0;o<n.length;o+=1){const a=t+o,s=n[o];typeof(s==null?void 0:s.id)!="string"||s.id.length===0||(r[s.id]=a)}return r}function Bh(e){const t=Ye(e),n=t==null?void 0:t.threadTurnStartIndex;return Math.max(0,Math.floor(typeof n=="number"?n:0))}function Bf(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.id;if(typeof r=="string"&&r.length>0)return r}return""}function pA(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.cwd;if(typeof r=="string"&&r.length>0)return r}return""}function hu(e){if(!e||typeof e!="object")return"";const t=e.model;return typeof t=="string"?t.trim():""}function Zc(e){var o,a;const t=Ye(e);if(!t)return"";const n=((o=re(t.modelProvider))==null?void 0:o.trim())??"";if(n)return n;const r=Ye(t.thread);return((a=re(r==null?void 0:r.modelProvider))==null?void 0:a.trim())??""}function hg(e){var t;if(!e)return null;try{const n=new URL(e,"http://localhost");if(n.pathname!=="/codex-local-image")return null;const r=((t=n.searchParams.get("path"))==null?void 0:t.trim())??"";return r.length>0?r:null}catch{return null}}function mA(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
|
|
40
|
+
`;for(const r of t)n+=`
|
|
41
|
+
## ${r.label}: ${r.path}
|
|
42
|
+
`;return`${n}
|
|
43
|
+
## My request for Codex:
|
|
44
|
+
|
|
45
|
+
${e}
|
|
46
|
+
`}function gA(e){const t=e.replace(/\\/g,"/");return t.split("/").filter(Boolean).at(-1)??t}async function vA(e){try{const t=(e==null?void 0:e.trim())??"",n=t?`/codex-api/provider-models?provider=${encodeURIComponent(t)}`:"/codex-api/provider-models",r=await fetch(n,{signal:AbortSignal.timeout(dA)});let o=null;try{o=await r.json()}catch{o=null}if(r.ok&&Array.isArray(o==null?void 0:o.data))return{ids:o.data.map(a=>typeof a=="string"?a.trim():"").filter((a,s,i)=>a.length>0&&i.indexOf(a)===s),exclusive:o.exclusive===!0}}catch{}return null}function yA(e){var s;const t=Ye(e);if(!t)return null;const n=((s=re(t.id??t.model))==null?void 0:s.trim())??"";if(!n)return null;const r=t.supportedReasoningEfforts??t.supported_reasoning_efforts,o=Array.isArray(r)?r.flatMap(i=>{const l=Ye(i),c=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return kl(c)?[c]:[]}).filter((i,l,c)=>c.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:o,defaultReasoningEffort:kl(a)?a:null}}function pg(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function wA(e={}){const t=e.includeProviderModels!==!1,n=t?await vA(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(pg);const r=await it("model/list",{}),o=[];for(const a of r.data){const s=yA(a);!s||o.some(i=>i.id===s.id)||o.push(s)}if(!t||!n)return o;for(const a of n.ids)o.some(s=>s.id===a)||o.push(pg(a));return o}async function bA(e={}){return(await wA(e)).map(t=>t.id)}async function TA(){const e=await it("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=fA(e.config.model_reasoning_effort),o=hA(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:o}}async function SA(e,t,n){var l;const r=(t==null?void 0:t.trim())??"";if(r)return{model:r,reasoningEffort:e==="plan"?ef(n):tf(n)};let o=null;try{o=await TA()}catch{o=null}const a=(o==null?void 0:o.model.trim())??"";if(a)return{model:a,reasoningEffort:e==="plan"?ef(n??(o==null?void 0:o.reasoningEffort)):tf(n??(o==null?void 0:o.reasoningEffort))};let s=[];try{s=await bA()}catch{s=[]}const i=((l=s.find(c=>c.trim().length>0))==null?void 0:l.trim())??"";if(i)return{model:i,reasoningEffort:e==="plan"?ef(n??(o==null?void 0:o.reasoningEffort)):tf(n??(o==null?void 0:o.reasoningEffort))};throw new Error(`${e==="plan"?"Plan":"Default"} mode requires an available model. Wait for models to load and try again.`)}async function kA(e,t){const n=await it("thread/list",{archived:!1,limit:t,sortKey:"updated_at",modelProviders:[],cursor:e});return{groups:tA(n),nextCursor:typeof n.nextCursor=="string"&&n.nextCursor.length>0?n.nextCursor:null}}async function CA(e){const t=await it("thread/read",{threadId:e,includeTurns:!1});return ZI(t)}async function xA(e){const t=await it("thread/read",{threadId:e,includeTurns:!0}),n=Bh(t),r=Xc(t,n);return{model:hu(t),modelProvider:Zc(t),messages:r,inProgress:Oh(t),activeTurnId:Dh(t),hasMoreOlder:n>0,turnIndexByTurnId:Fh(t,n),externalSession:yw(t)}}async function IA(e,t,n=10){const r=new URLSearchParams({threadId:e,beforeTurnId:t,limit:String(n)}),o=await fetch(`/codex-api/thread-turn-page?${r.toString()}`);if(!o.ok)throw new Error(`Older thread page request failed with ${o.status}`);const a=await o.json();if(a.olderTurnsUnavailable===!0)throw new Br("当前 codex-cli 版本暂不支持加载更早的消息",{code:"older_turns_unavailable",method:"thread/turns/list"});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:Xc(a.result,s),inProgress:Oh(a.result),activeTurnId:Dh(a.result),hasMoreOlder:a.hasMoreOlder===!0,startTurnIndex:s,turnIndexByTurnId:Fh(a.result,s)}}async function mg(e=null,t=uA){try{return await kA(e,t)}catch(n){throw ro(n,"Failed to load thread groups","thread/list")}}async function AA(e){try{return await CA(e)}catch(t){throw ro(t,`Failed to load thread ${e}`,"thread/read")}}async function Uf(e){try{return await xA(e)}catch(t){throw ro(t,`Failed to load thread ${e}`,"thread/read")}}async function _A(e,t,n){try{return await IA(e,t,n)}catch(r){throw ro(r,`Failed to load earlier messages for thread ${e}`,"thread/read")}}async function xU(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 r=await n.json();return typeof r.text=="string"?r.text:""}async function zf(e,t){const n=Zi.get(e);if(n)return n;const r=(async()=>{const a=await it("thread/resume",{threadId:e}),s=Bh(a),i=await sA(a,s,t);return{model:hu(a),modelProvider:Zc(a),messages:i,inProgress:Oh(a),activeTurnId:Dh(a),hasMoreOlder:s>0,turnIndexByTurnId:Fh(a,s),externalSession:yw(a)}})();Zi.set(e,r);const o=globalThis.setTimeout(()=>{Zi.get(e)===r&&Zi.delete(e)},cA);return r.finally(()=>{globalThis.clearTimeout(o),globalThis.setTimeout(()=>{Zi.get(e)===r&&Zi.delete(e)},2e3)}).catch(()=>{}),r}async function PA(e){await it("thread/archive",{threadId:e})}async function EA(e){await it("thread/unarchive",{threadId:e})}async function MA(e){await it("thread/compact/start",{threadId:e})}async function RA(e,t){await it("thread/name/set",{threadId:e,name:t})}const LA=20,gg=100;async function nf(e,t){const n=await it("thread/revert",{threadId:e,beforeTurnId:t});let r=re(n.turnsBackwardsCursor)??"";if(!r)return[];const o=[];let a=0;for(;r&&a<gg;){const s=await it("thread/turns/list",{threadId:e,cursor:r,sortDirection:"desc",limit:Math.min(LA,gg-a),itemsView:"full"}),i=Array.isArray(s.data)?s.data:[];if(i.length===0)break;o.push(i),a+=i.length,r=re(s.nextCursor)??""}return oA(o,Ye(n.thread)??{})}async function jA(e){const t=await it("thread/turns/list",{threadId:e,limit:1e4,sortDirection:"desc",itemsView:"notLoaded"});return{turnIds:(Array.isArray(t.data)?t.data:[]).map(o=>{var a;return re((a=Ye(o))==null?void 0:a.id)}).filter(o=>typeof o=="string"&&o.length>0),complete:!re(t.nextCursor)}}async function vg(e,t){try{const n={};typeof e=="string"&&e.trim().length>0&&(n.cwd=e.trim()),typeof t=="string"&&t.trim().length>0&&(n.model=t.trim());const r=await it("thread/start",n),o=Bf(r);if(!o)throw new Error("thread/start did not return a thread id");return{threadId:o,model:hu(r),modelProvider:Zc(r)}}catch(n){throw ro(n,"Failed to start a new thread","thread/start")}}async function rf(e,t,n){if(t===void 0||typeof t=="object"&&t!==null){const o=t&&typeof t=="object"?(t.beforeTurnId??"").trim():"";try{const a=await it("thread/fork",{threadId:e,persistExtendedHistory:!0,...o?{beforeTurnId:o}:{}}),s=Bf(a);if(!s)throw new Error("thread/fork did not return a thread id");return{threadId:s,cwd:pA(a),model:hu(a),messages:Xc(a,Bh(a))}}catch(a){throw ro(a,`Failed to fork thread ${e}`,"thread/fork")}}try{const o=e.trim();if(!o)throw new Error("thread/fork requires threadId");const a={threadId:o};typeof t=="string"&&t.trim().length>0&&(a.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(a.model=n.trim());const s=await it("thread/fork",a),i=Bf(s);if(!i)throw new Error("thread/fork did not return a thread id");return{threadId:i,model:hu(s),modelProvider:Zc(s)}}catch(o){throw ro(o,`Failed to fork thread ${e}`,"thread/fork")}}function ww(e,t,n,r=[]){const o=[];for(const c of t){const d=hg(c.trim());d&&o.push({label:gA(d),path:d,fsPath:d})}const a=[...r,...o],s=a.filter((c,d)=>a.findIndex(m=>m.fsPath===c.fsPath)===d),l=[{type:"text",text:mA(_I(e,s,t),s)}];for(const c of t){const d=c.trim();if(!d)continue;const m=hg(d);if(m){l.push({type:"localImage",path:m});continue}l.push({type:"image",url:d,image_url:d})}if(n)for(const c of n)l.push({type:"skill",name:c.name,path:c.path});return{input:l,dedupedFileAttachments:s}}function bw(){const e=typeof globalThis>"u"?void 0:globalThis.crypto;if(e&&typeof e.randomUUID=="function")try{return e.randomUUID()}catch{}const t="0123456789abcdef";let n="";for(let r=0;r<36;r+=1){if(r===8||r===13||r===18||r===23){n+="-";continue}if(r===14){n+="4";continue}const o=Math.floor(Math.random()*16);n+=r===19?t[o&3|8]:t[o]}return n}async function of(e,t,n=[],r,o,a,s=[],i,l){var c;try{const d=(r==null?void 0:r.trim())??"",{input:m,dedupedFileAttachments:f}=ww(t,n,a,s),v=f.map(N=>({label:N.label,path:N.path,fsPath:N.fsPath})),T={threadId:e,input:m,clientUserMessageId:bw()};if(typeof l=="string"&&l.trim().length>0&&(T.turnTrigger=l.trim()),v.length>0&&(T.attachments=v),d&&(T.model=d),typeof o=="string"&&o.length>0&&(T.effort=o),i){const N=await SA(i,d,o);T.collaborationMode={mode:i,settings:{model:N.model,reasoning_effort:N.reasoningEffort,developer_instructions:null}}}const k=await it("turn/start",T);return typeof((c=k==null?void 0:k.turn)==null?void 0:c.id)=="string"?k.turn.id.trim():""}catch(d){throw ro(d,`Failed to start turn for thread ${e}`,"turn/start")}}async function NA(e,t,n,r=[],o,a=[]){const s=e.trim(),i=t.trim();try{const{input:l}=ww(n,r,o,a),c=await it("turn/steer",{threadId:s,input:l,expectedTurnId:i,clientUserMessageId:bw()});return typeof(c==null?void 0:c.turnId)=="string"&&c.turnId.trim().length>0?c.turnId.trim():i}catch(l){throw ro(l,`Failed to steer turn for thread ${s}`,"turn/steer")}}async function $A(e,t){const n=e.trim(),r=(t==null?void 0:t.trim())||"";if(n)try{if(!r)throw new Error("turn/interrupt requires turnId");await it("turn/interrupt",{threadId:n,turnId:r})}catch(o){throw ro(o,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}const OA=12e3,DA=5*6e4,FA=3e3,Tw=new Map,af=new Map,yg=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function BA(e){return kl(e)?e:""}function UA(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}async function zA(e){const t=e==="fast"?"fast":"standard";await it("config/batchWrite",{edits:[{keyPath:"features.fast_mode",value:!0,mergeStrategy:"upsert"},{keyPath:"service_tier",value:t==="fast"?"fast":null,mergeStrategy:t==="fast"?"upsert":"replace"}],filePath:null,expectedVersion:null})}async function wg(){return await(await fetch("/codex-api/free-mode/status")).json()}async function bg(e){return await(await fetch("/codex-api/free-mode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enable:e})})).json()}async function Tg(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 el(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 Sg(e){const t=af.get(e);if(t)return t;const n=(async()=>{let r=null;try{const o=e?`/codex-api/provider-models?provider=${encodeURIComponent(e)}`:"/codex-api/provider-models",a=await fetch(o,{signal:AbortSignal.timeout(OA)});let s=null;try{s=await a.json()}catch{s=null}a.ok&&Array.isArray(s==null?void 0:s.data)&&(r={ids:s.data.map(i=>typeof i=="string"?i.trim():"").filter((i,l,c)=>i.length>0&&c.indexOf(i)===l),exclusive:s.exclusive===!0})}catch{}return Tw.set(e,{fetchedAt:Date.now(),result:r}),r})();af.set(e,n);try{return await n}finally{af.delete(e)}}async function HA(e){const n=(e==null?void 0:e.trim())??"",r=Tw.get(n);if(r){const o=r.result===null?FA:DA;if(Date.now()-r.fetchedAt<o)return r.result;if(r.result!==null)return Sg(n).catch(()=>{}),r.result}return await Sg(n)}function WA(e){var s;const t=Ye(e);if(!t)return null;const n=((s=re(t.id??t.model))==null?void 0:s.trim())??"";if(!n)return null;const r=t.supportedReasoningEfforts??t.supported_reasoning_efforts,o=Array.isArray(r)?r.flatMap(i=>{const l=Ye(i),c=l?l.reasoningEffort??l.reasoning_effort??l.effort:i;return kl(c)?[c]:[]}).filter((i,l,c)=>c.indexOf(i)===l):null,a=t.defaultReasoningEffort??t.default_reasoning_effort;return{id:n,supportedReasoningEfforts:o,defaultReasoningEffort:kl(a)?a:null}}function kg(e){return{id:e,supportedReasoningEfforts:null,defaultReasoningEffort:null}}async function qA(e={}){const t=e.includeProviderModels!==!1,n=t?await HA(e.providerId):null;if(n!=null&&n.exclusive||e.requireProviderModels)return((n==null?void 0:n.ids)??[]).map(kg);const r=await it("model/list",{}),o=[];for(const a of r.data){const s=WA(a);!s||o.some(i=>i.id===s.id)||o.push(s)}if(!t||!n)return o;for(const a of n.ids)o.some(s=>s.id===a)||o.push(kg(a));return o}async function GA(){const e=await it("config/read",{}),t=e.config.model??"",n=typeof e.config.model_provider=="string"?e.config.model_provider:"",r=BA(e.config.model_reasoning_effort),o=UA(e.config.service_tier);return{model:t,providerId:n,reasoningEffort:r,speedMode:o}}function VA(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function KA(){try{const e=await it("collaborationMode/list",{}),t=new Set,n=[];for(const r of e.data){const o=r.mode;o!=="default"&&o!=="plan"&&o!=="execplans"||t.has(o)||(t.add(o),n.push({value:o,label:VA(r.name||o)||(o==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of yg)t.has(r.value)||n.push(r);return n.sort((r,o)=>r.value===o.value?0:r.value==="default"?-1:1)}}catch{}return yg}async function YA(){return cI()}function JA(e){const t=Ye(e);if(!t)return null;const n=re(t.event??t.name??t.hookName),r=re(t.command??t.cmd);return!n||!r?null:{event:n,command:r,timeout:Gt(t.timeout??t.timeout_ms),enabled:or(t.enabled??t.active)}}async function QA(){const e=await it("hooks/list",{}),t=[];for(const n of e.data??[]){const r=Ye(n);r&&t.push({cwd:re(r.cwd)??"",hooks:Array.isArray(r.hooks)?r.hooks.map(JA).filter(o=>o!==null):[],warnings:$o(r.warnings),errors:$o(r.errors)})}return t}async function IU(e){await it("marketplace/add",{source:e})}async function AU(e){await it("marketplace/remove",{marketplaceName:e})}async function _U(){const e=await it("marketplace/upgrade",{});return{selectedMarketplaces:$o(e.selectedMarketplaces??e.selected_marketplaces),upgradedRoots:$o(e.upgradedRoots??e.upgraded_roots),errors:$o(e.errors)}}function XA(e){const t=Ye(e);if(!t)return null;const n=re(t.remotePluginId??t.remote_plugin_id??t.id);return n?{remotePluginId:n,pluginName:re(t.pluginName??t.plugin_name??t.name)??n,shareUrl:re(t.shareUrl??t.share_url??t.url)??"",createdAt:re(t.createdAt??t.created_at)??""}:null}async function PU(e){const t=await it("plugin/share/save",{pluginPath:e});return{remotePluginId:re(t.remotePluginId??t.remote_plugin_id)??"",shareUrl:re(t.shareUrl??t.share_url??t.url)??""}}async function EU(){const e=await it("plugin/share/list",{});return(e.data??e.shares??[]).map(XA).filter(n=>n!==null)}async function MU(e){await it("plugin/share/delete",{remotePluginId:e})}async function RU(e){await it("plugin/share/checkout",{remotePluginId:e})}function Sw(e){const t=Ye(e);if(!t)return null;const n=re(t.id),r=re(t.name);return!n||!r?null:{id:n,name:r,description:re(t.description)??"",installUrl:re(t.installUrl??t.install_url)??"",needsAuth:or(t.needsAuth??t.needs_auth)??!1}}function ZA(e){const t=Ye(e);if(!t)return null;const n=re(t.name),r=re(t.path);if(!n||!r)return null;const o=Ye(t.interface);return{name:n,path:r,description:re(t.description)??"",enabled:or(t.enabled)??!0,displayName:re((o==null?void 0:o.displayName)??(o==null?void 0:o.display_name))??n,shortDescription:re(t.shortDescription??t.short_description)??""}}function kw(e,t={}){const n=Ye(e);if(!n)return null;const r=re(n.id),o=re(n.name);if(!r||!o)return null;const a=Ye(n.interface),s=Ye(n.source),i=re(s==null?void 0:s.type)??"",l=re(s==null?void 0:s.path),c=re(s==null?void 0:s.url)??"",d=i==="remote"?t.name??null:null,m=t.path??(i==="local"?l:null),f=re((a==null?void 0:a.displayName)??(a==null?void 0:a.display_name))??o,v=re((a==null?void 0:a.shortDescription)??(a==null?void 0:a.short_description)),T=re((a==null?void 0:a.longDescription)??(a==null?void 0:a.long_description))??"";return{id:r,name:o,displayName:f,description:v??T,longDescription:T,developerName:re((a==null?void 0:a.developerName)??(a==null?void 0:a.developer_name))??"",category:re(a==null?void 0:a.category)??"",marketplaceName:t.name??"",marketplaceDisplayName:t.displayName??t.name??"",marketplacePath:m,remoteMarketplaceName:d,sourceType:i,sourceUrl:c,installed:or(n.installed)??!1,enabled:or(n.enabled)??!0,installPolicy:re(n.installPolicy??n.install_policy)??"",authPolicy:re(n.authPolicy??n.auth_policy)??"",logoUrl:re((a==null?void 0:a.logoUrl)??(a==null?void 0:a.logo_url))??"",logoPath:re(a==null?void 0:a.logo)??"",composerIconUrl:re((a==null?void 0:a.composerIconUrl)??(a==null?void 0:a.composer_icon_url))??"",composerIconPath:re((a==null?void 0:a.composerIcon)??(a==null?void 0:a.composer_icon))??"",brandColor:re((a==null?void 0:a.brandColor)??(a==null?void 0:a.brand_color))??"",capabilities:$o(a==null?void 0:a.capabilities),defaultPrompt:$o((a==null?void 0:a.defaultPrompt)??(a==null?void 0:a.default_prompt)),screenshotUrls:$o((a==null?void 0:a.screenshotUrls)??(a==null?void 0:a.screenshot_urls)),screenshots:$o(a==null?void 0:a.screenshots),websiteUrl:re((a==null?void 0:a.websiteUrl)??(a==null?void 0:a.website_url))??"",privacyPolicyUrl:re((a==null?void 0:a.privacyPolicyUrl)??(a==null?void 0:a.privacy_policy_url))??"",termsOfServiceUrl:re((a==null?void 0:a.termsOfServiceUrl)??(a==null?void 0:a.terms_of_service_url))??""}}function e_(e,t=0){const n=Ye(e);if(!n)return null;const r=re(n.id),o=re(n.name);if(!r||!o)return null;const a=Ye(n.branding),s=Ye(n.appMetadata??n.app_metadata);return{id:r,name:o,description:re(n.description)??re((s==null?void 0:s.seoDescription)??(s==null?void 0:s.seo_description))??"",logoUrl:re(n.logoUrl??n.logo_url)??"",logoUrlDark:re(n.logoUrlDark??n.logo_url_dark)??"",distributionChannel:re(n.distributionChannel??n.distribution_channel)??"",installUrl:re(n.installUrl??n.install_url)??"",isAccessible:or(n.isAccessible??n.is_accessible)??!1,isEnabled:or(n.isEnabled??n.is_enabled)??!0,pluginDisplayNames:$o(n.pluginDisplayNames??n.plugin_display_names),category:re(a==null?void 0:a.category)??"",developer:re(a==null?void 0:a.developer)??re(s==null?void 0:s.developer)??"",website:re(a==null?void 0:a.website)??"",privacyPolicy:re((a==null?void 0:a.privacyPolicy)??(a==null?void 0:a.privacy_policy))??"",termsOfService:re((a==null?void 0:a.termsOfService)??(a==null?void 0:a.terms_of_service))??"",catalogRank:t}}function t_(e){const t=Ye(e);if(!t)return null;const n=re(t.name);if(!n)return null;const r=Ye(t.tools)??{},o=Object.entries(r).map(([l,c])=>{const d=Ye(c);return{name:re(d==null?void 0:d.name)??l,title:re(d==null?void 0:d.title)??"",description:re(d==null?void 0:d.description)??""}}),a=Array.isArray(t.resources)?t.resources.map(l=>{const c=Ye(l);return{name:re(c==null?void 0:c.name)??"",title:re(c==null?void 0:c.title)??"",uri:re(c==null?void 0:c.uri)??"",description:re(c==null?void 0:c.description)??""}}).filter(l=>l.name||l.uri):[],s=t.resourceTemplates??t.resource_templates,i=Array.isArray(s)?s.map(l=>{const c=Ye(l);return{name:re(c==null?void 0:c.name)??"",title:re(c==null?void 0:c.title)??"",uriTemplate:re((c==null?void 0:c.uriTemplate)??(c==null?void 0:c.uri_template))??"",description:re(c==null?void 0:c.description)??""}}).filter(l=>l.name||l.uriTemplate):[];return{name:n,authStatus:re(t.authStatus??t.auth_status)??"unsupported",tools:o,resources:a,resourceTemplates:i}}async function LU(e){const t={};e&&e.length>0&&(t.cwds=e);const n=await it("plugin/list",t),r=[];for(const o of n.marketplaces??[]){const a=Ye(o);if(!a)continue;const s=Ye(a.interface),i={name:re(a.name)??"",displayName:re((s==null?void 0:s.displayName)??(s==null?void 0:s.display_name))??"",path:re(a.path)},l=Array.isArray(a.plugins)?a.plugins:[];for(const c of l){const d=kw(c,i);d&&r.push(d)}}return r}async function jU(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await it("plugin/read",t),r=Ye(n.plugin);if(!r)throw new Error("Plugin detail response is empty");const o=kw(r.summary,{name:re(r.marketplaceName)??e.marketplaceName,displayName:e.marketplaceDisplayName,path:re(r.marketplacePath)??e.marketplacePath})??e;return{summary:o,description:re(r.description)??o.longDescription,apps:Array.isArray(r.apps)?r.apps.map(Sw).filter(a=>a!==null):[],skills:Array.isArray(r.skills)?r.skills.map(ZA).filter(a=>a!==null):[],mcpServers:$o(r.mcpServers??r.mcp_servers)}}async function NU(e){const t={pluginName:e.name};e.marketplacePath&&(t.marketplacePath=e.marketplacePath),e.remoteMarketplaceName&&(t.remoteMarketplaceName=e.remoteMarketplaceName);const n=await it("plugin/install",t),r=n.appsNeedingAuth??n.apps_needing_auth??[];return{authPolicy:re(n.authPolicy??n.auth_policy)??"",appsNeedingAuth:r.map(Sw).filter(o=>o!==null)}}async function $U(e){await it("plugin/uninstall",{pluginId:e})}async function OU(e,t){await it("config/batchWrite",{edits:[{keyPath:`plugins.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function DU(e){const t=[];let n=null,r=0;do{const o={limit:100};n&&(o.cursor=n),e&&(o.threadId=e);const a=await it("app/list",o);for(const s of a.data??[]){const i=e_(s,r);i&&t.push(i),r+=1}n=re(a.nextCursor??a.next_cursor)}while(n);return t}async function FU(e,t){await it("config/batchWrite",{edits:[{keyPath:`apps.${e}.enabled`,value:t,mergeStrategy:"upsert"}],filePath:null,expectedVersion:null,reloadUserConfig:!0})}async function BU(){const e=[];let t=null;do{const n={};t&&(n.cursor=t);const r=await it("mcpServerStatus/list",n);for(const o of r.data??[]){const a=t_(o);a&&e.push(a)}t=re(r.nextCursor??r.next_cursor)}while(t);return e}async function UU(){await it("config/mcpServer/reload",{})}async function zU(e){const t=await it("mcpServer/oauth/login",{name:e});return{authorizationUrl:re(t.authorizationUrl??t.authorization_url)??""}}async function HU(){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 WU(e="",t=null,n=50){const r=new URLSearchParams;e.trim()&&r.set("query",e.trim()),t&&r.set("cursor",t),n&&Number.isFinite(n)&&r.set("limit",String(Math.max(1,Math.floor(n))));const o=r.toString(),a=await fetch(`/codex-api/composio/connectors${o?`?${o}`:""}`);if(!a.ok)throw new Error(`Failed to list Composio connectors (${a.status})`);const s=await a.json();return{data:Array.isArray(s.data)?s.data:[],nextCursor:typeof s.nextCursor=="string"&&s.nextCursor.length>0?s.nextCursor:null,total:typeof s.total=="number"&&Number.isFinite(s.total)?Math.max(0,Math.floor(s.total)):0}}async function qU(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 GU(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 VU(){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 KU(){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 Cg(e){const t=Ye(e);if(!t)return null;const n=Gt(t.usedPercent??t.used_percent);if(n===null)return null;const r=Gt(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:Gt(t.resetsAt??t.resets_at)}}function n_(e){const t=Ye(e);if(!t)return null;const n=or(t.hasCredits??t.has_credits),r=or(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:re(t.balance)}}function xg(e){const t=Ye(e);if(!t)return null;const n=Cg(t.primary),r=Cg(t.secondary),o=n_(t.credits);return!n&&!r&&!o?null:{limitId:re(t.limitId??t.limit_id),limitName:re(t.limitName??t.limit_name),primary:n,secondary:r,credits:o,planType:re(t.planType??t.plan_type)}}function Cw(e){const t=Ye(e);if(!t)return null;const n=Ye(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=xg(n==null?void 0:n.codex);return r||xg(t.rateLimits??t.rate_limits)}const r_=100;function o_(){return r_}function a_(e){return fI(e)}async function s_(e,t){await hI({id:e,...t})}async function Ig(){return pI()}function i_(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=typeof t.id=="string"?t.id.trim():"";if(!n)return null;const r=Array.isArray(t.imageUrls)?t.imageUrls.filter(s=>typeof s=="string"&&s.trim().length>0):[],o=Array.isArray(t.skills)?t.skills.flatMap(s=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const i=s,l=typeof i.name=="string"?i.name.trim():"",c=typeof i.path=="string"?i.path.trim():"";return l&&c?[{name:l,path:c}]:[]}):[],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():"",c=typeof i.path=="string"?i.path.trim():"",d=typeof i.fsPath=="string"?i.fsPath.trim():"";return l&&c&&d?[{label:l,path:c,fsPath:d}]:[]}):[];return{id:n,text:typeof t.text=="string"?t.text:"",imageUrls:r,skills:o,fileAttachments:a,collaborationMode:t.collaborationMode==="plan"?"plan":"default"}}function xw(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,r]of Object.entries(e)){const o=n.trim();if(!o||!Array.isArray(r))continue;const a=r.flatMap(s=>{const i=i_(s);return i?[i]:[]});a.length>0&&(t[o]=a)}return t}async function Ag(){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 xw(n.data)}async function l_(e){if(!(await fetch("/codex-api/thread-queue-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(xw(e))})).ok)throw new Error("Failed to save thread queue state")}async function u_(e,t){const n=await fetch("/codex-api/telegram/configure-bot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botToken:e,allowedUserIds:t})}),r=await n.json();if(!n.ok){const o=Zt(r,"Failed to connect Telegram bot");throw new Error(o)}}async function c_(){const e=await fetch("/codex-api/telegram/config"),t=await e.json();if(!e.ok){const s=Zt(t,"Failed to load Telegram configuration");throw new Error(s)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{},o=Array.isArray(r.allowedUserIds)?r.allowedUserIds:[],a=[];for(const s of o){if(s==="*"){a.push("*");continue}typeof s=="number"&&Number.isFinite(s)&&a.push(Math.trunc(s))}return{botToken:typeof r.botToken=="string"?r.botToken:"",allowedUserIds:a}}async function d_(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const o=Zt(t,"Failed to load Telegram status");throw new Error(o)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return{configured:r.configured===!0,active:r.active===!0,mappedChats:typeof r.mappedChats=="number"?r.mappedChats:0,mappedThreads:typeof r.mappedThreads=="number"?r.mappedThreads:0,allowedUsers:typeof r.allowedUsers=="number"?r.allowedUsers:0,allowAllUsers:r.allowAllUsers===!0,lastError:typeof r.lastError=="string"?r.lastError:""}}async function f_(){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 xc(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 h_(){try{const e=await fetch("/codex-api/thread-reasoning");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function p_(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 m_(){try{const e=await fetch("/codex-api/thread-turn-durations");return e.ok?(await e.json()).data??{}:{}}catch{return{}}}async function g_(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 v_(){try{const e=await fetch("/codex-api/thread-pins");return e.ok?(await e.json()).data??{threadIds:[]}:{threadIds:[]}}catch{return{threadIds:[]}}}async function y_(e){try{await fetch("/codex-api/thread-pins",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({threadIds:e})})}catch{}}async function w_(){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 b_(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 T_(e,t){var n;try{return((n=(await it("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}function Hf(e){return e?e.endsWith("/SKILL.md")?e:`${e}/SKILL.md`:""}function S_(e,t){const n=Hf(e),r=n.split("/").filter(Boolean);if(r.length<2)return null;const o=r.lastIndexOf("skills");if(o>=2){const l=r[o-2]??"";if(l){const c=`/${[...r.slice(0,o+1),l,"SKILL.md"].join("/")}`;if(t.has(c))return{rootPath:c,rootName:l,isNested:c!==n}}}const a=r.indexOf("skills");if(a<0||a+1>=r.length-1)return null;const s=r[a+1]??"";if(!s)return null;const i=`/${[...r.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 k_(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await it("skills/list",t),r=n.data.flatMap(s=>s.skills),o=new Set(r.map(s=>Hf(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=S_(i.path,o),c=Hf(i.path),m=!!(l!=null&&l.isNested&&o.has(l.rootPath))?l.rootPath:c,f=c===m,v=a.get(m),T={name:i.name,displayName:l&&m===l.rootPath?l.rootName:void 0,description:i.shortDescription||i.description||"",path:m,scope:i.scope,enabled:i.enabled,__hasRoot:f};if(!v){a.set(m,T);continue}if(v.enabled=v.enabled||i.enabled,!v.__hasRoot&&f){a.set(m,T);continue}!v.displayName&&T.displayName&&(v.displayName=T.displayName),!v.description&&T.description&&(v.description=T.description)}return Array.from(a.values()).map(({__hasRoot:s,...i})=>i)}catch{return[]}}const C_=6e4;async function Gu(e){const t=new AbortController,n=setTimeout(()=>t.abort(),C_);try{const r=new FormData;r.append("file",e);const o=await fetch("/codex-api/upload-file",{method:"POST",body:r,signal:t.signal});return o.ok?(await o.json()).path??null:null}catch{return null}finally{clearTimeout(n)}}function x_(e){return e==="payment_required"?e:null}function I_(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function _g(e){const t=Ye(e);if(!t)return null;const n=Gt(t.usedPercent??t.used_percent);if(n===null)return null;const r=Gt(t.windowDurationMins??t.window_minutes);return{usedPercent:n,windowDurationMins:r,windowMinutes:r,resetsAt:Gt(t.resetsAt??t.resets_at)}}function A_(e){const t=Ye(e);if(!t)return null;const n=or(t.hasCredits??t.has_credits),r=or(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:re(t.balance)}}function __(e){const t=Ye(e);if(!t)return null;const n=_g(t.primary),r=_g(t.secondary),o=A_(t.credits);return!n&&!r&&!o?null:{limitId:re(t.limitId??t.limit_id),limitName:re(t.limitName??t.limit_name),primary:n,secondary:r,credits:o,planType:re(t.planType??t.plan_type)}}function Iw(e,t=null,n=null){const r=Ye(e);if(!r)return null;const o=re(r.accountId),a=re(r.storageId)??o,s=re(r.quotaStatus),i=s==="loading"||s==="ready"||s==="error"?s:"idle";return o?{accountId:o,storageId:a??o,userId:re(r.userId),authMode:re(r.authMode),email:re(r.email),planType:re(r.planType),lastRefreshedAtIso:re(r.lastRefreshedAtIso)??"",lastActivatedAtIso:re(r.lastActivatedAtIso),quotaSnapshot:__(r.quotaSnapshot),quotaUpdatedAtIso:re(r.quotaUpdatedAtIso),quotaStatus:i,quotaError:re(r.quotaError),unavailableReason:x_(r.unavailableReason)??(I_(re(r.quotaError))?"payment_required":null),isActive:or(r.isActive)??(a===n||o===t)}:null}function Aw(e){const t=Ye(e);if(!t)return null;const n=re(t.clientId??t.client_id??t.id);return n?{clientId:n,deviceName:re(t.deviceName??t.device_name??t.name)??"",lastSeenAt:re(t.lastSeenAt??t.last_seen_at??t.lastSeen)}:null}async function P_(){const e=await it("remoteControl/status/read",{}),t=Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[];return{enabled:or(e.enabled)??!1,clients:t.map(Aw).filter(n=>n!==null)}}async function E_(){var r;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=re((r=t.data)==null?void 0:r.policy)??"";return n==="untrusted"||n==="on-failure"||n==="on-request"||n==="never"?n:"never"}async function M_(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 R_(e){await it(e?"remoteControl/enable":"remoteControl/disable",{})}async function L_(){const e=await it("remoteControl/pairing/start",{});return{pairingCode:re(e.pairingCode??e.pairing_code??e.code)??"",expiresAt:re(e.expiresAt??e.expires_at)}}async function j_(){const e=await it("remoteControl/client/list",{});return(Array.isArray(e.clients)?e.clients:Array.isArray(e.data)?e.data:[]).map(Aw).filter(n=>n!==null)}async function N_(e){await it("remoteControl/client/revoke",{clientId:e})}async function $_(){try{const e=await it("account/rateLimits/read");return Cw(e)}catch(e){throw ro(e,"Failed to load account rate limits","account/rateLimits/read")}}function ed(e){const t=Ye(e),n=re(t==null?void 0:t.activeAccountId),r=re(t==null?void 0:t.activeStorageId),o=Array.isArray(t==null?void 0:t.accounts)?t==null?void 0:t.accounts:[];return{activeAccountId:n,activeStorageId:r,importedAccountId:re(t==null?void 0:t.importedAccountId)??void 0,importedStorageId:re(t==null?void 0:t.importedStorageId)??void 0,accounts:o.map(a=>Iw(a,n,r)).filter(a=>a!==null)}}async function O_(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(Zt(t,"Failed to load accounts"));const n=Ye(t);return ed(n==null?void 0:n.data)}async function Pg(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Zt(t,"Failed to refresh accounts"));const n=Ye(t);return ed(n==null?void 0:n.data)}async function D_(){const e=await fetch("/codex-api/accounts/login/start",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Zt(t,"Failed to start Codex login"));const n=Ye(t),r=Ye(n==null?void 0:n.data),o=re(r==null?void 0:r.loginUrl);if(!o)throw new Error("Failed to start Codex login");return o}async function F_(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(Zt(n,"Failed to complete Codex login"));const r=Ye(n);return ed(r==null?void 0:r.data)}async function B_(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(Zt(n,"Failed to switch account"));const r=Ye(n),o=Ye(r==null?void 0:r.data),a=Iw(o==null?void 0:o.account,re(o==null?void 0:o.activeAccountId),re(o==null?void 0:o.activeStorageId));if(!a)throw new Error("Failed to switch account");return a}async function U_(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(Zt(n,"Failed to remove account"));const r=Ye(n);return ed(r==null?void 0:r.data)}let Vu=null,ou=null;function z_(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},r=t.labels,o={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[a,s]of Object.entries(r)){const i=typeof a=="string"?nt(a):"";i.length>0&&typeof s=="string"&&(o[i]=s)}return{order:n(t.order).map(a=>nt(a)),labels:o,active:n(t.active).map(a=>nt(a)),projectOrder:n(t.projectOrder).map(a=>nt(a)),remoteProjects:Array.isArray(t.remoteProjects)?t.remoteProjects.flatMap(a=>{if(!a||typeof a!="object"||Array.isArray(a))return[];const s=a,i=typeof s.id=="string"?s.id.trim():"";return i?[{id:i,hostId:typeof s.hostId=="string"?s.hostId.trim():"",remotePath:typeof s.remotePath=="string"?nt(s.remotePath):"",label:typeof s.label=="string"?s.label.trim():""}]:[]}):[]}}async function sl(){return ou?Wf(ou):(Vu||(Vu=H_().then(e=>(ou=e,e)).finally(()=>{Vu=null})),Wf(await Vu))}async function H_(){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 z_(n.data)}function Wf(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 Uh(){ou=null}async function W_(e,t){const n=(t??"").trim(),r=await fetch("/codex-api/worktree/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,baseBranch:n||void 0})}),o=await r.json();if(!r.ok||!o.data)throw new Error(o.error||"Failed to create worktree");return{...o.data,cwd:nt(o.data.cwd),gitRoot:nt(o.data.gitRoot)}}async function q_(e,t){const n=await fetch("/codex-api/worktree/create-permanent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e,worktreeName:t})}),r=await n.json();if(!n.ok||!r.data)throw new Error(r.error||"Failed to create worktree");return{...r.data,cwd:nt(r.data.cwd),gitRoot:nt(r.data.gitRoot)}}async function G_(e){const t=e.trim();if(!t)return[];const n=new URLSearchParams({sourceCwd:t}),r=await fetch(`/codex-api/worktree/branches?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to load branches");const a=Array.isArray(o.data)?o.data:[],s=[],i=new Set;for(const l of a){if(!l||typeof l!="object"||Array.isArray(l))continue;const c=l,d=typeof c.value=="string"?c.value.trim():"",m=typeof c.label=="string"?c.label.trim():"";!d||i.has(d)||(i.add(d),s.push({value:d,label:m||d}))}return s}async function V_(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}),r=await fetch(`/codex-api/git/branches?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to load Git branch state");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=a.currentBranch,i=typeof s=="string"&&s.trim()?s.trim():null,l=Array.isArray(a.options)?a.options:[],c=[],d=new Set;for(const N of l){if(!N||typeof N!="object"||Array.isArray(N))continue;const _=N,j=typeof _.value=="string"?_.value.trim():"",W=typeof _.label=="string"?_.label.trim():"";!j||d.has(j)||(d.add(j),c.push({value:j,label:W||j,isCurrent:_.isCurrent===!0,isRemote:_.isRemote===!0}))}i&&!d.has(i)&&c.unshift({value:i,label:i,isCurrent:!0});const m=a.headSha,f=a.headSubject,v=a.headDate,T=a.gitRoot,k=_w(a.changedFiles);return{currentBranch:i,headSha:typeof m=="string"&&m.trim()?m.trim():null,headSubject:typeof f=="string"&&f.trim()?f.trim():null,headDate:typeof v=="string"&&v.trim()?v.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof T=="string"?nt(T):"",options:c,changedFiles:k}}function _w(e){const t=Array.isArray(e)?e:[],n=[];for(const r of t){if(!r||typeof r!="object"||Array.isArray(r))continue;const o=r,a=o.path,s=typeof a=="string"?nt(a.trim()):"";if(!s)continue;const i=o.status,l=typeof i=="string"?i.trim():"",c=o.label,d=typeof c=="string"&&c.trim()?c.trim():l;n.push({path:s,previousPath:typeof o.previousPath=="string"&&o.previousPath.trim()?nt(o.previousPath.trim()):null,status:l,label:d,addedLineCount:typeof o.addedLineCount=="number"?o.addedLineCount:null,removedLineCount:typeof o.removedLineCount=="number"?o.removedLineCount:null})}return n}async function K_(e){const t=e.trim();if(!t)return{isGitRepo:!1,gitRoot:""};const n=new URLSearchParams({cwd:t}),r=await fetch(`/codex-api/git/repository-status?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to read Git repository status");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{isGitRepo:a.isGitRepo===!0,gitRoot:typeof a.gitRoot=="string"?nt(a.gitRoot):""}}async function Y_(e,t){var a;const n=await fetch("/codex-api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim()})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to switch branch");const o=(a=r.data)==null?void 0:a.currentBranch;return typeof o=="string"&&o.trim()?o.trim():null}async function J_(e,t,n={}){const r=e.trim(),o=t.trim();if(!r||!o)return[];const a=new URLSearchParams({cwd:r,branch:o,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(c=>{if(!c||typeof c!="object"||Array.isArray(c))return[];const d=c,m=typeof d.sha=="string"?d.sha.trim():"",f=typeof d.shortSha=="string"?d.shortSha.trim():"",v=typeof d.subject=="string"?d.subject.trim():"",T=typeof d.date=="string"?d.date.trim():"";return!m||!f?[]:[{sha:m,shortSha:f,subject:v||f,date:T}]})}async function Q_(e,t){const n=e.trim(),r=t.trim();if(!n||!r)return[];const o=new URLSearchParams({cwd:n,sha:r}),a=await fetch(`/codex-api/git/commit-files?${o.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 c=l,d=typeof c.path=="string"?c.path:"",m=typeof c.previousPath=="string"&&c.previousPath.length>0?c.previousPath:null,f=typeof c.status=="string"?c.status.trim():"",v=typeof c.label=="string"?c.label.trim():"",T=typeof c.addedLineCount=="number"&&Number.isFinite(c.addedLineCount)?c.addedLineCount:null,k=typeof c.removedLineCount=="number"&&Number.isFinite(c.removedLineCount)?c.removedLineCount:null;return!d||!f?[]:[{path:d,previousPath:m,status:f,label:v||f,addedLineCount:T,removedLineCount:k}]})}async function X_(e,t,n){const r=await fetch("/codex-api/git/reset-to-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e.trim(),branch:t.trim(),sha:n.trim()})}),o=await r.json();if(!r.ok)throw new Error(o.error||"Failed to reset branch to commit");const a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{currentBranch:typeof a.currentBranch=="string"&&a.currentBranch.trim()?a.currentBranch.trim():null,headSha:typeof a.headSha=="string"&&a.headSha.trim()?a.headSha.trim():null,headSubject:typeof a.headSubject=="string"&&a.headSubject.trim()?a.headSubject.trim():null,headDate:typeof a.headDate=="string"&&a.headDate.trim()?a.headDate.trim():null,detached:a.detached===!0,dirty:a.dirty===!0,gitRoot:typeof a.gitRoot=="string"?nt(a.gitRoot):"",options:[],changedFiles:_w(a.changedFiles)}}async function sf(e){if(!(await fetch("/codex-api/workspace-roots-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save workspace roots state");ou=Wf(e)}async function Ku(e,t){const n=await fetch("/codex-api/project-root",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,createIfMissing:(t==null?void 0:t.createIfMissing)===!0,label:(t==null?void 0:t.label)??""})}),r=await n.json();if(!n.ok){const i=Zt(r,"Failed to open project root");throw new Error(i)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{},s=typeof a.path=="string"?nt(a.path):"";return Uh(),s}function Z_(e){return`/codex-api/project-zip?${new URLSearchParams({cwd:e}).toString()}`}function eP(e,t){var a;const n=e.headers.get("content-disposition")??"",r=n.match(/filename\*=UTF-8''([^;]+)/iu);if(r!=null&&r[1])try{return decodeURIComponent(r[1])}catch{return r[1]}const o=n.match(/filename="?([^";]+)"?/iu);return((a=o==null?void 0:o[1])==null?void 0:a.trim())||t}async function tP(e,t){var d;const n=await fetch(Z_(e));if(!n.ok){const m=await n.json().catch(()=>null),f="Failed to export project",v=Zt(m,f),T=[n.status?String(n.status):"",n.statusText].filter(Boolean).join(" "),k=v!==f?v:T?`Failed to export project: ${T}`:f;throw new Error(k)}const r=Number(n.headers.get("content-length")??""),o=Number.isFinite(r)&&r>0?r:null,a=eP(n,"project.zip"),s=(d=n.body)==null?void 0:d.getReader();if(!s){const m=await n.blob();return t==null||t({loaded:m.size,total:m.size||o}),{blob:m,fileName:a}}const i=[];let l=0;for(t==null||t({loaded:l,total:o});;){const{done:m,value:f}=await s.read();if(m)break;f&&(i.push(new Uint8Array(f)),l+=f.byteLength,t==null||t({loaded:l,total:o}))}const c=i.map(m=>{const f=new Uint8Array(m.byteLength);return f.set(m),f.buffer});return{blob:new Blob(c,{type:n.headers.get("content-type")??"application/zip"}),fileName:a}}async function nP(e,t){const n=new URLSearchParams({parent:t}),r=await fetch(`/codex-api/project-import?${n.toString()}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e}),o=await _i(r);if(!r.ok){const l=Zt(o,"Failed to import project");throw new Error(l)}const a=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=typeof s.path=="string"?nt(s.path):"";return i&&Uh(),{path:i,importedSessions:typeof s.importedSessions=="number"?s.importedSessions:0}}async function Eg(){const e=await fetch("/codex-api/home-directory"),t=await e.json();if(!e.ok)throw new Error("Failed to load home directory");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return typeof r.path=="string"?r.path.trim():""}async function rP(e,t){const n=new URLSearchParams({path:e});(t==null?void 0:t.showHidden)===!0&&n.set("showHidden","1");const r=await fetch(`/codex-local-directories?${n.toString()}`),o=await _i(r);if(!r.ok){const l=Zt(o,"Failed to load local directories");throw new Error(l)}const a=o&&typeof o=="object"&&!Array.isArray(o)?o:{},s=a.data&&typeof a.data=="object"&&!Array.isArray(a.data)?a.data:{},i=Array.isArray(s.entries)?s.entries:[];return{path:typeof s.path=="string"?nt(s.path):"",parentPath:typeof s.parentPath=="string"?nt(s.parentPath):"",entries:i.flatMap(l=>{if(!l||typeof l!="object"||Array.isArray(l))return[];const c=l,d=typeof c.name=="string"?c.name.trim():"",m=typeof c.path=="string"?nt(c.path):"";return d&&m?[{name:d,path:m}]:[]})}}async function YU(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-files?${t.toString()}`),r=await _i(n);if(!n.ok){const i=Zt(r,"Failed to load workspace files");throw new Error(i)}const a=(r&&typeof r=="object"&&!Array.isArray(r)?r:{}).data;return(Array.isArray(a)?a:[]).flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const l=i,c=typeof l.path=="string"?nt(l.path):"",d=typeof l.relativePath=="string"?l.relativePath.trim():"";return!c||!d?[]:[{path:c,relativePath:d,isDirectory:l.isDirectory===!0}]})}async function JU(e){const t=new URLSearchParams({path:e}),n=await fetch(`/codex-local-preview?${t.toString()}`),r=await _i(n);if(!n.ok){const i=Zt(r,"Failed to preview file");throw new Error(i)}const a=(r&&typeof r=="object"&&!Array.isArray(r)?r:{}).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 oP(e){const t=await fetch("/codex-api/local-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})}),n=await _i(t);if(!t.ok){const s=Zt(n,"Failed to create local directory");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},o=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=typeof o.path=="string"?nt(o.path):"";return a&&Uh(),a}async function aP(e,t){const n=await fetch("/codex-api/github-clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e,basePath:t})}),r=await _i(n);if(!n.ok){const s=Zt(r,"Failed to clone GitHub repository");throw new Error(s)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return typeof a.path=="string"?nt(a.path):""}async function sP(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 _i(t);if(!t.ok){const s=Zt(n,"Failed to create new chat folder");throw new Error(s)}const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},o=r.data&&typeof r.data=="object"&&!Array.isArray(r.data)?r.data:{},a=typeof o.cwd=="string"?nt(o.cwd):"";if(!a)throw new Error("Failed to create new chat folder");return{cwd:a,outputDirectory:typeof o.outputDirectory=="string"?nt(o.outputDirectory):a,workspaceRoot:typeof o.workspaceRoot=="string"?nt(o.workspaceRoot):""}}async function iP(e){const t=new URLSearchParams({basePath:e}),n=await fetch(`/codex-api/project-root-suggestion?${t.toString()}`),r=await n.json();if(!n.ok){const s=Zt(r,"Failed to suggest project name");throw new Error(s)}const o=r&&typeof r=="object"&&!Array.isArray(r)?r:{},a=o.data&&typeof o.data=="object"&&!Array.isArray(o.data)?o.data:{};return{name:typeof a.name=="string"?a.name.trim():"",path:typeof a.path=="string"?nt(a.path):""}}function lP(e){const t=Ye(e);if(!t)return null;const n=re(t.key),r=typeof t.text=="string"?t.text:"",o=re(t.kind);return!n||!o||o!=="meta"&&o!=="hunk"&&o!=="add"&&o!=="remove"&&o!=="context"?null:{key:n,kind:o,text:r,oldLine:Gt(t.oldLine),newLine:Gt(t.newLine)}}function uP(e){const t=Ye(e);if(!t)return null;const n=re(t.id),r=typeof t.header=="string"?t.header:"",o=typeof t.patch=="string"?t.patch:"";return n?{id:n,header:r,patch:o,addedLineCount:Gt(t.addedLineCount)??0,removedLineCount:Gt(t.removedLineCount)??0,oldStart:Gt(t.oldStart),oldLineCount:Gt(t.oldLineCount)??0,newStart:Gt(t.newStart),newLineCount:Gt(t.newLineCount)??0,lines:Array.isArray(t.lines)?t.lines.map(a=>lP(a)).filter(a=>a!==null):[]}:null}function cP(e){const t=Ye(e);if(!t)return null;const n=re(t.id),r=re(t.path),o=re(t.absolutePath),a=re(t.operation);return!n||!r||!o||!a||a!=="add"&&a!=="delete"&&a!=="update"&&a!=="rename"?null:{id:n,path:r,absolutePath:o,previousPath:re(t.previousPath),previousAbsolutePath:re(t.previousAbsolutePath),operation:a,addedLineCount:Gt(t.addedLineCount)??0,removedLineCount:Gt(t.removedLineCount)??0,diff:typeof t.diff=="string"?t.diff:"",hunks:Array.isArray(t.hunks)?t.hunks.map(s=>uP(s)).filter(s=>s!==null):[]}}function Pw(e){const t=Ye(e),n=Ye(t==null?void 0:t.data),r=Ye(n==null?void 0:n.summary),o=re(n==null?void 0:n.scope),a=o==="baseBranch"||o==="commit"?o:"workspace",s=re(n==null?void 0:n.workspaceView)==="staged"?"staged":"unstaged";return{cwd:re(n==null?void 0:n.cwd)??"",gitRoot:re(n==null?void 0:n.gitRoot),isGitRepo:or(n==null?void 0:n.isGitRepo)??!1,scope:a,workspaceView:s,baseBranch:re(n==null?void 0:n.baseBranch),baseBranchOptions:Array.isArray(n==null?void 0:n.baseBranchOptions)?n.baseBranchOptions.map(i=>re(i)).filter(i=>typeof i=="string"&&i.length>0):[],commitSha:re(n==null?void 0:n.commitSha),headBranch:re(n==null?void 0:n.headBranch),mergeBaseSha:re(n==null?void 0:n.mergeBaseSha),generatedAtIso:re(n==null?void 0:n.generatedAtIso)??"",summary:{fileCount:Gt(r==null?void 0:r.fileCount)??0,addedLineCount:Gt(r==null?void 0:r.addedLineCount)??0,removedLineCount:Gt(r==null?void 0:r.removedLineCount)??0},files:Array.isArray(n==null?void 0:n.files)?n.files.map(i=>cP(i)).filter(i=>i!==null):[]}}function dP(e){const t=Ye(e),n=Ye(t==null?void 0:t.data);return{fileCount:Gt(n==null?void 0:n.fileCount)??0,addedLineCount:Gt(n==null?void 0:n.addedLineCount)??0,removedLineCount:Gt(n==null?void 0:n.removedLineCount)??0}}async function QU(e,t,n,r,o){const a=new URLSearchParams({cwd:e,scope:t,workspaceView:n});r&&r.trim()&&a.set("baseBranch",r.trim()),o&&o.trim()&&a.set("commitSha",o.trim());const s=await fetch(`/codex-api/review/snapshot?${a.toString()}`),i=await s.json();if(!s.ok)throw new Error(Zt(i,"Failed to load review snapshot"));return Pw(i)}async function fP(e,t){const n=new URLSearchParams({cwd:e,workspaceView:t}),r=await fetch(`/codex-api/review/summary?${n.toString()}`),o=await r.json();if(!r.ok)throw new Error(Zt(o,"Failed to load review summary"));return dP(o)}async function XU(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(Zt(n,"Failed to apply review action"));return Pw(n)}async function ZU(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(Zt(n,"Failed to initialize Git"))}async function hP(e,t,n,r,o,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:r,patchIds:o,scope:a,filePaths:s})}),l=await i.json().catch(()=>({}));if(!i.ok){const c=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:[c],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 pP(e,t,n){const r=await hP(e,t,n,"undo");return{reverted:r.changed,errors:r.errors}}const mP={},gP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function vP(e,t){return P(),D("svg",gP,[...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 Ds=kt(mP,[["render",vP]]),yP={},wP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function bP(e,t){return P(),D("svg",wP,[...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 Yu=kt(yP,[["render",bP]]),TP={},SP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function kP(e,t){return P(),D("svg",SP,[...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 qf=kt(TP,[["render",kP]]),CP={},xP={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function IP(e,t){return P(),D("svg",xP,[...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 Cl=kt(CP,[["render",IP]]),AP={},_P={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function PP(e,t){return P(),D("svg",_P,[...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 zh=kt(AP,[["render",PP]]),EP={},MP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function RP(e,t){return P(),D("svg",MP,[...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 LP=kt(EP,[["render",RP]]),jP={},NP={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function $P(e,t){return P(),D("svg",NP,[...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 td=kt(jP,[["render",$P]]),Ew="codex-web-local.ui-language.v1",OP={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...":"加载消息中...","Still loading — the first open of a large history can take a while.":"仍在加载——较大的历史会话首次打开可能需要较长时间。",Plan:"计划",Updating:"更新中",Step:"步骤","Edit this message":"编辑此消息","Edit message":"编辑消息","Saving rolls this turn back and resends it with your changes. Later replies will be removed.":"保存后将回退此轮并以修改后的文本重发。之后的回复将被移除。",Rollback:"回退","Fork thread from this response":"从此回复分叉线程",Fork:"分叉","Response copied":"回复已复制","Copy last code block":"复制最后一个代码块","Copy response":"复制回复","Jump to latest":"跳转到最新","Jump to latest output":"跳转到最新输出",Today:"今天",Yesterday:"昨天","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. Clear the search to see all threads.":"没有匹配的线程。清除搜索即可查看全部线程。","Loading threads...":"加载线程中...","Edit name":"编辑名称",Remove:"移除","Project name":"项目名称","No threads yet. Start a new thread to begin.":"还没有线程。新建一个线程即可开始。","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 failed: the original message could not be rolled back. Try again.":"编辑保存失败:原消息未能回退。请重试。","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":"上下文已压缩","Agent note":"代理注记","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":"已复制提交引用",Copied:"已复制",Copy:"复制","Copy chat":"复制聊天","Create a new automation":"创建新自动化","Create chat fork":"创建聊天分叉",current:"当前",Declined:"已拒绝",Done:"完成",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. Type a message below to get started.":"此线程还没有消息。在下方输入消息即可开始。","Image attachment (preview unavailable)":"图片附件(无法预览)",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.":"这会在所选项目文件夹上创建项目自动化。","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.":"请通过线程或项目菜单添加自动化。","Command palette":"命令面板","Type a command...":"输入命令…","No matching commands":"没有匹配的命令",Thread:"线程",Panel:"面板",View:"视图",Navigate:"导航","Open the Git panel":"打开 Git 面板","Open the files panel":"打开文件面板","Toggle the terminal panel":"切换终端面板","Toggle the side panel":"切换侧边面板","Close the side panel":"关闭侧边面板","Toggle the sidebar":"切换侧栏","Cycle the color theme":"循环切换主题","Cycle the chat width":"循环切换聊天宽度","Switch the interface language":"切换界面语言","Toggle send with Enter":"切换回车发送","Cycle the in-progress send mode":"循环切换进行中发送方式","Open the automations page":"打开自动化页面","Open the recycle bin":"打开回收站","Open settings":"打开设置","Copy the conversation as Markdown":"复制对话为 Markdown","Stop the running turn":"停止正在运行的轮次","Implement the current plan":"执行当前计划","Keyboard shortcuts":"键盘快捷键","Press Esc to close":"按 Esc 关闭",Composer:"输入框",Navigation:"导航","Open the command palette":"打开命令面板","Close dialogs and popovers":"关闭弹窗与浮层","Send the message":"发送消息",'When "send with Enter" is on':"当「回车发送」开启时",'When "send with Enter" is off':"当「回车发送」关闭时","Insert a line break":"插入换行","Open the slash command menu":"打开斜杠命令菜单","Mention a file":"提及文件","Move through the menu":"在菜单中移动","Accept the highlighted suggestion":"接受高亮的候选","Dismiss the menu":"关闭菜单","Move the selection":"移动选择","Activate the focused item":"激活当前项","Jump to the first or last item":"跳到第一项 / 最后一项"},Mg={en:"English","zh-CN":"简体中文"};function DP(){var t;return typeof window>"u"?"en":((t=window.localStorage.getItem(Ew))==null?void 0:t.trim())==="zh-CN"?"zh-CN":"en"}const nd=S(DP());function Mw(e){typeof document>"u"||(document.documentElement.lang=e==="zh-CN"?"zh-CN":"en",document.documentElement.dataset.uiLanguage=e)}Mw(nd.value);function FP(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??"")):e}function BP(e){nd.value=e,Mw(e),typeof window<"u"&&window.localStorage.setItem(Ew,e)}function Rw(e,t){const n=nd.value==="zh-CN"?OP[e]??e:e;return FP(n,t)}function ao(){return{uiLanguage:nd,uiLanguageOptions:[{value:"en",label:Mg.en},{value:"zh-CN",label:Mg["zh-CN"]}],t:Rw,setUiLanguage:BP}}const Lw="brutalstrikedevs@gmail.com",UP=20,zP=6500,Rg=1800,lf=12,Lg=240,jg=/token|secret|password|passwd|credential|authorization|auth|bearer|cookie|session|key/i,pl=S([]);let Ng=!1,uf=!1,cf=null;function Ql(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 HP(e){return typeof e=="string"?e:e instanceof URL?e.toString():e.url}function WP(e,t){var r;const n=(r=t==null?void 0:t.method)==null?void 0:r.trim();return n?n.toUpperCase():typeof e=="object"&&"method"in e&&typeof e.method=="string"&&e.method.trim()?e.method.trim().toUpperCase():"GET"}function jw(e){return((e||"").split(/\r?\n/,1)[0]??"").replace(/\s+/g," ").trim().slice(0,80)||"issue report"}function $g(e){return encodeURIComponent(e)}function qP(){return`mailto:${Lw}`}function GP(){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>Rg?`${e.slice(0,Rg)}
|
|
50
|
+
...[truncated]`:e:"No visible page text captured."}function VP(e,t){const n=t.replace(/\r\n/g,`
|
|
51
|
+
`).replace(/[ \t]+/g," ").trim();return n?jg.test(e)||jg.test(n)?`[omitted sensitive value, ${n.length} chars]`:n.length>Lg?`${n.slice(0,Lg)}...[truncated, ${n.length} chars total]`:n:""}function Og(e,t){if(!e)return`${t}: unavailable`;try{const n=[],r=Math.min(e.length,lf);for(let a=0;a<r;a+=1){const s=e.key(a);s&&n.push(`${s}=${VP(s,e.getItem(s)??"")}`)}const o=e.length>lf?`
|
|
52
|
+
...${e.length-lf} more item(s)`:"";return`${t}:
|
|
53
|
+
${n.join(`
|
|
54
|
+
`)||"empty"}${o}`}catch(n){return`${t}: unavailable (${jw(Ql(n))})`}}function KP(){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}`,Og(window.localStorage,"localStorage"),Og(window.sessionStorage,"sessionStorage")].join(`
|
|
55
|
+
`)}function yi(e){const t=e.message.trim();if(!t)return;const n=pl.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 r={...e,message:t,atIso:e.atIso??new Date().toISOString()};pl.value=[r,...pl.value].slice(0,UP)}function Nw(e=pl.value){var c;const t=typeof window>"u"?"unknown":`${window.innerWidth}x${window.innerHeight} @${window.devicePixelRatio||1}x`,n=typeof window>"u"?"unknown":window.location.href,r=typeof navigator>"u"?"unknown":navigator.userAgent,o="0.1.138",a="codex-mobile",s=e.slice(0,12).map((d,m)=>[`${m+1}. [${d.atIso}] ${d.kind}`,d.method?`${d.method}`:"",d.url??"",typeof d.status=="number"?`${d.status} ${d.statusText??""}`.trim():"",d.message].filter(Boolean).join(" | ")).join(`
|
|
56
|
+
`),i=["What happened?","","","Context",`URL: ${n}`,`User agent: ${r}`,`Viewport: ${t}`,`App version: ${o}`,`Worktree: ${a}`,"","Browser/app state",KP(),"","Recent diagnostics",s||"No diagnostics captured.","","Visible page text",GP()].join(`
|
|
57
|
+
`).slice(0,zP),l=`Codex Web feedback: ${jw((c=e[0])==null?void 0:c.message)}`;return`mailto:${Lw}?subject=${$g(l)}&body=${$g(i)}`}function YP(){typeof window>"u"||(window.location.href=Nw())}function JP(){if(!(typeof window>"u")&&(Ng||(Ng=!0,window.addEventListener("error",e=>{yi({kind:"window-error",message:e.error?Ql(e.error):e.message,url:e.filename||window.location.href})}),window.addEventListener("unhandledrejection",e=>{yi({kind:"unhandled-rejection",message:Ql(e.reason),url:window.location.href})})),!uf)){if(typeof window.fetch!="function"){yi({kind:"fetch-error",message:"Feedback diagnostics could not monitor fetch: window.fetch is unavailable",url:window.location.href});return}try{cf=window.fetch.bind(window),window.fetch=async(e,t)=>{const n=HP(e),r=WP(e,t);try{const o=await cf(e,t);return o.ok||yi({kind:n.includes("/codex-api/")?"api-response":"fetch-error",message:`Request failed with HTTP ${o.status}`,url:n,method:r,status:o.status,statusText:o.statusText}),o}catch(o){throw yi({kind:"fetch-error",message:Ql(o),url:n,method:r}),o}},uf=!0}catch(e){cf=null,uf=!1;try{yi({kind:"fetch-error",message:`Feedback diagnostics could not monitor fetch: ${Ql(e)}`,url:window.location.href})}catch{}}}}function $w(){const e=J(()=>pl.value.length>0);function t(n,r){yi({kind:"visible-error",message:n,url:r||(typeof window>"u"?void 0:window.location.href)})}return{diagnostics:pl,hasFeedbackDiagnostics:e,recordVisibleFailure:t,openFeedbackMail:YP,buildFeedbackMailto:Nw,feedbackMailtoBase:qP}}const Ow="codex-web-local.recycle-bin.v1";function Dw(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Ow);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 Dg(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Ow,JSON.stringify(e))}catch{}}const Fa=S(Dw());function QP(){function e(){Fa.value=Dw()}function t(o){Fa.value=[{...o,archivedAtIso:new Date().toISOString()},...Fa.value.filter(a=>a.id!==o.id)],Dg(Fa.value)}function n(o){Fa.value=Fa.value.filter(a=>a.id!==o),Dg(Fa.value)}async function r(o){if(!Fa.value.some(a=>a.id===o))return{ok:!1,error:"Thread is not in the recycle bin"};try{return await EA(o),n(o),{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:r}}function Fg(e){const t=Date.parse(e.updatedAtIso);return Number.isFinite(t)?t:0}function XP(e){let t=!1;const n=e.map(r=>{const o=[],a=new Map;for(const s of r.threads){const i=a.get(s.id);if(i===void 0){a.set(s.id,o.length),o.push(s);continue}t=!0,Fg(s)>Fg(o[i])&&(o[i]=s)}return o.length===r.threads.length?r:{...r,threads:o}});return t?n:e}const ZP=["title","aria-label","disabled"],eE={key:1,class:"composer-dropdown-value"},tE={key:0,class:"composer-dropdown-search-wrap"},nE=["placeholder","onKeydown"],rE={class:"composer-dropdown-options",role:"listbox"},oE=["onClick"],aE={key:0,class:"composer-dropdown-empty"},sE=cn({__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,r=t,o=S(null),a=S(null),s=S(null),i=S(null),l=S(!1),c=S(""),d=S({});let m=!1;const f=J(()=>{var Ce;const ee=n.options.find(De=>De.value===n.modelValue);return ee?ee.label:((Ce=n.placeholder)==null?void 0:Ce.trim())||""}),v=J(()=>n.openDirection??"down"),T=J(()=>n.menuAlign??"start"),k=J(()=>n.iconOnly===!0),N=J(()=>n.enableSearch===!0),_=J(()=>n.variant==="pill"?"composer-dropdown-trigger--pill":""),j=J(()=>{var ee;return((ee=n.searchPlaceholder)==null?void 0:ee.trim())||"Quick search projects"}),W=J(()=>{var ee;return((ee=n.emptyLabel)==null?void 0:ee.trim())||"No results"}),V=J(()=>{var ee;return f.value||((ee=n.placeholder)==null?void 0:ee.trim())||"Select option"}),U=J(()=>{const ee=c.value.trim().toLowerCase();return ee?n.options.filter(Ce=>Ce.label.toLowerCase().includes(ee)||Ce.value.toLowerCase().includes(ee)):n.options});function fe(){n.disabled||(l.value=!l.value)}function K(ee,Ce,De){return Math.min(De,Math.max(Ce,ee))}function oe(){var ne,ae,je,We;if(!l.value)return;const ee=o.value;if(!ee||typeof window>"u")return;const Ce=ee.getBoundingClientRect(),De=window.innerWidth,Ue=window.innerHeight,Ee=8,be=8,Te=Math.max(0,De-Ee*2),_e=((ne=s.value)==null?void 0:ne.offsetWidth)??((ae=a.value)==null?void 0:ae.offsetWidth)??224,xe=((je=s.value)==null?void 0:je.offsetHeight)??((We=a.value)==null?void 0:We.offsetHeight)??0,Je=Math.min(_e,Te),Xe=Math.max(Ee,De-Je-Ee),rt=T.value==="end"?Ce.right-Je:Ce.left,de=K(rt,Ee,Xe);let B=v.value==="up"?Ce.top-xe-be:Ce.bottom+be;xe>0&&B+xe>Ue-Ee&&(B=Ue-xe-Ee),B=Math.max(Ee,B),d.value={position:"fixed",left:`${de}px`,right:"auto",top:`${B}px`,bottom:"auto",width:`${Je}px`}}function ve(){m||typeof window>"u"||(window.addEventListener("resize",oe),window.addEventListener("scroll",oe,!0),m=!0)}function Pe(){!m||typeof window>"u"||(window.removeEventListener("resize",oe),window.removeEventListener("scroll",oe,!0),m=!1)}function we(ee){r("update:modelValue",ee),l.value=!1,c.value=""}function te(){if(c.value.length>0){c.value="";return}l.value=!1}function ke(ee){if(!l.value)return;const Ce=o.value;if(!Ce)return;const De=ee.target;De instanceof Node&&(Ce.contains(De)||(l.value=!1,c.value=""))}return ot(l,ee=>{if(!ee){Pe(),d.value={};return}ve(),Et(()=>{var Ce;oe(),window.requestAnimationFrame(oe),N.value&&((Ce=i.value)==null||Ce.focus())})}),es(()=>{window.addEventListener("pointerdown",ke)}),Ws(()=>{window.removeEventListener("pointerdown",ke),Pe()}),(ee,Ce)=>(P(),D("div",{ref_key:"rootRef",ref:o,class:"composer-dropdown"},[w("button",{class:ct(["composer-dropdown-trigger",_.value]),type:"button",title:V.value,"aria-label":V.value,disabled:e.disabled,onClick:fe},[e.selectedPrefixIcon?(P(),tt(Sh(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):me("",!0),k.value?me("",!0):(P(),D("span",eE,O(f.value),1)),Be(Ds,{class:"composer-dropdown-chevron"})],10,ZP),l.value?(P(),D("div",{key:0,ref_key:"menuWrapRef",ref:a,class:ct(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":v.value==="up","composer-dropdown-menu-wrap-down":v.value==="down"}]),style:Zr(d.value)},[w("div",{ref_key:"menuRef",ref:s,class:"composer-dropdown-menu"},[N.value?(P(),D("div",tE,[xn(w("input",{ref_key:"searchInputRef",ref:i,"onUpdate:modelValue":Ce[0]||(Ce[0]=De=>c.value=De),class:"composer-dropdown-search-input",type:"text",placeholder:j.value,onKeydown:Cr(gt(te,["prevent"]),["esc"])},null,40,nE),[[Nn,c.value]])])):me("",!0),w("ul",rE,[(P(!0),D(at,null,Ht(U.value,De=>(P(),D("li",{key:De.value},[w("button",{class:ct(["composer-dropdown-option",{"is-selected":De.value===e.modelValue}]),type:"button",onClick:Ue=>we(De.value)},O(De.label),11,oE)]))),128)),U.value.length===0?(P(),D("li",aE,O(W.value),1)):me("",!0)])],512)],6)):me("",!0)],512))}}),xi=kt(sE,[["__scopeId","data-v-58b5aa2e"]]),iE={},lE={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function uE(e,t){return P(),D("svg",lE,[...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 Ic=kt(iE,[["render",uE]]),cE=["aria-label","onKeydown"],dE={class:"app-dialog-header"},fE={class:"app-dialog-title-wrap"},hE={class:"app-dialog-title"},pE={key:0,class:"app-dialog-subtitle"},mE=["aria-label","title"],gE={class:"app-dialog-body"},vE={key:0,class:"app-dialog-footer"},yE=cn({__name:"AppDialog",props:{open:{type:Boolean},title:{},subtitle:{default:""},ariaLabel:{default:""},size:{default:"sm"}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,{t:o}=ao();function a(){r("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}),Ws(()=>{typeof window>"u"||window.removeEventListener("keydown",s)}),(i,l)=>(P(),tt(Bs,{to:"body"},[e.open?(P(),D("div",{key:0,class:"app-dialog-overlay",onClick:gt(a,["self"])},[w("div",{class:ct(["app-dialog-panel",`app-dialog-panel--${e.size}`]),role:"dialog","aria-modal":"true","aria-label":e.ariaLabel||e.title,onKeydown:Cr(gt(a,["prevent"]),["esc"])},[w("div",dE,[w("div",fE,[w("h3",hE,O(e.title),1),e.subtitle?(P(),D("p",pE,O(e.subtitle),1)):me("",!0)]),w("button",{class:"app-dialog-close",type:"button","aria-label":g(o)("Close"),title:g(o)("Close"),onClick:a},[Be(Ic,{class:"app-dialog-close-icon"})],8,mE)]),w("div",gE,[xr(i.$slots,"default",{},void 0)]),i.$slots.footer?(P(),D("div",vE,[xr(i.$slots,"footer",{},void 0)])):me("",!0)],42,cE)])):me("",!0)]))}}),df=kt(yE,[["__scopeId","data-v-3405af9b"]]),wE={key:0,class:"sidebar-menu-row-left"},bE={class:"sidebar-menu-row-main"},TE={key:1,class:"sidebar-menu-row-right"},SE={key:0,class:"sidebar-menu-row-right-default"},kE={key:1,class:"sidebar-menu-row-right-hover"},CE=cn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=Ck(),r=J(()=>!!n.left),o=J(()=>!!n.right),a=J(()=>!!n["right-hover"]),s=J(()=>o.value||a.value);return(i,l)=>(P(),tt(Sh(t.as),Ah({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":s.value,"data-has-right-hover":a.value,"data-force-right-hover":t.forceRightHover},i.$attrs),{default:pt(()=>[r.value?(P(),D("span",wE,[xr(i.$slots,"left",{},void 0,!0)])):me("",!0),w("span",bE,[xr(i.$slots,"default",{},void 0,!0)]),s.value?(P(),D("span",TE,[o.value?(P(),D("span",SE,[xr(i.$slots,"right",{},void 0,!0)])):me("",!0),a.value?(P(),D("span",kE,[xr(i.$slots,"right-hover",{},void 0,!0)])):me("",!0)])):me("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),Es=kt(CE,[["__scopeId","data-v-06eaad4c"]]),xE={},IE={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function AE(e,t){return P(),D("svg",IE,[...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 Ac=kt(xE,[["render",AE]]),_E={},PE={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function EE(e,t){return P(),D("svg",PE,[...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 Fw=kt(_E,[["render",EE]]),ME=["data-menu-open"],RE={class:"thread-left-stack"},LE=["data-state"],jE=["data-confirming","title"],NE={key:0,class:"thread-delete-confirm-label"},$E=["title"],OE={class:"thread-row-title-wrap"},DE={class:"thread-row-title-line"},FE={class:"thread-row-title"},BE={key:0,class:"thread-row-originator"},UE=["title"],zE={key:0,class:"thread-row-automation-count"},HE=["data-state"],WE={class:"thread-row-time"},qE=cn({__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,r=t,o=J(()=>n.thread.originator?`${n.thread.originator}`:"");function a(s){n.setMenuWrapRef(s instanceof HTMLDivElement?s:null)}return(s,i)=>(P(),D("li",{class:"thread-row-item","data-menu-open":n.menuOpen?"true":"false"},[Be(Es,{class:"thread-row","data-thread-id":n.thread.id,"data-active":n.selected,"data-live":n.threadState==="working"?"true":"false","data-pinned":n.pinned,"data-menu-open":n.menuOpen?"true":"false","force-right-hover":n.menuOpen,onClick:i[3]||(i[3]=l=>r("select")),onMouseleave:i[4]||(i[4]=l=>r("row-leave",l)),onContextmenu:i[5]||(i[5]=l=>r("row-contextmenu",l))},{left:pt(()=>[w("span",RE,[n.showStatusIndicator?(P(),D("span",{key:0,class:"thread-status-indicator","data-state":n.threadState},null,8,LE)):me("",!0),w("button",{class:"thread-delete-button",type:"button","data-confirming":n.inlineDeleteConfirming,title:n.inlineDeleteConfirming?n.confirmDeleteLabel:n.deleteLabel,onClick:i[0]||(i[0]=gt(l=>r("inline-delete"),["stop"]))},[n.inlineDeleteConfirming?(P(),D("span",NE,O(n.confirmLabel),1)):(P(),tt(Fw,{key:1,class:"thread-icon"}))],8,jE)])]),right:pt(()=>[w("span",WE,O(n.relativeTime),1)]),"right-hover":pt(()=>[w("div",{ref:a,class:"thread-menu-wrap"},[w("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:i[2]||(i[2]=gt(l=>r("menu-toggle"),["stop"]))},[Be(qf,{class:"thread-icon"})])])]),default:pt(()=>[w("button",{class:"thread-main-button",type:"button",title:o.value,onClick:i[1]||(i[1]=gt(l=>r("select"),["stop"]))},[w("span",OE,[w("span",DE,[w("span",FE,O(n.thread.title),1),n.thread.originator?(P(),D("span",BE,O(n.thread.originator),1)):me("",!0),n.thread.hasWorktree?(P(),tt(Ac,{key:1,class:"thread-row-worktree-icon",title:n.worktreeLabel},null,8,["title"])):me("",!0),n.automationCount>0?(P(),D("span",{key:2,class:"thread-row-automation-chip",title:n.automationTooltip},[Be(td,{class:"thread-row-automation-icon"}),n.automationCount>1?(P(),D("span",zE,O(n.automationCount),1)):me("",!0)],8,UE)):me("",!0),n.thread.pendingRequestState?(P(),D("span",{key:3,class:"thread-row-request-chip","data-state":n.thread.pendingRequestState},O(n.requestLabel),9,HE)):me("",!0)])])],8,$E)]),_:1},8,["data-thread-id","data-active","data-live","data-pinned","data-menu-open","force-right-hover"])],8,ME))}}),Ju=kt(qE,[["__scopeId","data-v-d01c8f46"]]);function GE(e,t,n){return n.canPruneMissing?e.filter(r=>t.has(r)):e}function VE(e){const{getGroups:t,t:n}=e,r=S({}),o=S({}),a=S(!1),s=S("thread"),i=S(""),l=S(""),c=S(""),d=S("create"),m=S(!1),f=S("thread"),v=S(""),T=S(""),k=S(""),N=S(""),_=S(!1),j=S(!1),W=S({name:"",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"}),V=S({mode:"daily",dailyTime:"09:00",interval:1,intervalUnit:"hours"}),U=J(()=>{if(s.value==="project"){const pe=l.value;return pe?o.value[pe]??[]:[]}const Y=i.value;return Y?r.value[Y]??[]:[]}),fe=J(()=>de(W.value.rrule)),K=J(()=>m.value&&d.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.")),oe=J(()=>{var pe;const Y=[];for(const Ie of t())for(const qe of Ie.threads){const Qe=((pe=qe.title)==null?void 0:pe.trim())||qe.id,xt=e.getProjectDisplayName(Ie.projectName);Y.push({value:qe.id,label:`${Qe} · ${xt}`,searchText:`${Qe} ${xt} ${qe.id}`.toLowerCase()})}return Y}),ve=J(()=>{const Y=[];for(const pe of t()){const Ie=e.getProjectAutomationKey(pe.projectName);if(!Ie)continue;const qe=e.getProjectDisplayName(pe.projectName);Y.push({value:Ie,label:qe,searchText:`${qe} ${Ie}`.toLowerCase()})}return Y}),Pe=J(()=>(f.value==="project"?ve.value:oe.value).map(pe=>({value:pe.value,label:pe.label}))),we=[{value:"minutes",label:n("minutes")},{value:"hours",label:n("hours")},{value:"days",label:n("days")}],te=J(()=>[{value:"ACTIVE",label:n("Active")},{value:"PAUSED",label:n("Paused")}]);ot(Pe,Y=>{var pe;m.value&&(Y.some(Ie=>Ie.value===v.value)||(v.value=((pe=Y[0])==null?void 0:pe.value)??""))});function ke(Y){var pe;return((pe=r.value[Y])==null?void 0:pe.length)??0}function ee(Y){return ke(Y)>0}function Ce(Y){var Ie;const pe=e.getProjectAutomationKey(Y);return pe?((Ie=o.value[pe])==null?void 0:Ie.length)??0:0}function De(Y){return Ce(Y)>0}function Ue(Y){if(Y.length===0)return"";if(Y.length>1){const qe=Y.filter(Qe=>Qe.status==="ACTIVE").length;return`${Y.length} ${n("automations")} • ${qe} ${n("active")}`}const[pe]=Y,Ie=pe.status==="PAUSED"?"-":pe.nextRunAtMs?new Date(pe.nextRunAtMs).toLocaleString():n("Not scheduled");return`${pe.name} • ${n("Next run")}: ${Ie}`}function Ee(Y){return Ue(r.value[Y]??[])}function be(Y){const pe=e.getProjectAutomationKey(Y);return Ue(pe?o.value[pe]??[]:[])}function Te(Y){return String(Math.max(0,Y)).padStart(2,"0")}function _e(Y,pe){const Ie=typeof Y=="number"?Y:Number(Y);return Number.isFinite(Ie)?Math.max(1,Math.floor(Ie)):pe}function xe(Y){const[pe,Ie]=Y.split(":"),qe=Math.min(23,Math.max(0,Number(pe)||0)),Qe=Math.min(59,Math.max(0,Number(Ie)||0));return`FREQ=DAILY;BYHOUR=${qe};BYMINUTE=${Qe}`}function Je(Y,pe){const Ie=_e(Y,1);return pe==="minutes"?`FREQ=MINUTELY;INTERVAL=${Ie}`:pe==="hours"?`FREQ=HOURLY;INTERVAL=${Ie}`:`FREQ=DAILY;INTERVAL=${Ie}`}function Xe(Y){return Object.fromEntries(Y.split(";").map(pe=>pe.trim()).filter(Boolean).map(pe=>{const[Ie,...qe]=pe.split("=");return[Ie.toUpperCase(),qe.join("=").trim()]}).filter(([pe,Ie])=>pe&&Ie))}function rt(Y){var Qe;const pe=Xe(Y),Ie=(Qe=pe.FREQ)==null?void 0:Qe.toUpperCase(),qe=_e(pe.INTERVAL,1);if(Ie==="DAILY"&&pe.BYHOUR!==void 0&&pe.BYMINUTE!==void 0&&qe===1){const xt=Math.min(23,Math.max(0,Number(pe.BYHOUR)||0)),jt=Math.min(59,Math.max(0,Number(pe.BYMINUTE)||0));return{mode:"daily",dailyTime:`${Te(xt)}:${Te(jt)}`,interval:1,intervalUnit:"hours"}}return Ie==="MINUTELY"||Ie==="HOURLY"||Ie==="DAILY"&&pe.INTERVAL!==void 0?{mode:"interval",dailyTime:"09:00",interval:qe,intervalUnit:Ie==="MINUTELY"?"minutes":Ie==="HOURLY"?"hours":"days"}:{mode:"advanced",dailyTime:"09:00",interval:1,intervalUnit:"hours"}}function de(Y){var Qe;const pe=Xe(Y),Ie=(Qe=pe.FREQ)==null?void 0:Qe.toUpperCase(),qe=_e(pe.INTERVAL,1);if(Ie==="DAILY"&&pe.BYHOUR!==void 0&&pe.BYMINUTE!==void 0&&qe===1){const xt=Math.min(23,Math.max(0,Number(pe.BYHOUR)||0)),jt=Math.min(59,Math.max(0,Number(pe.BYMINUTE)||0));return`${n("RRULE")}: ${Y} · ${n("runs daily at")} ${Te(xt)}:${Te(jt)}`}return Ie==="MINUTELY"?`${n("RRULE")}: ${Y} · ${n("runs every")} ${qe} ${n("minute(s)")}`:Ie==="HOURLY"?`${n("RRULE")}: ${Y} · ${n("runs every")} ${qe} ${n("hour(s)")}`:Ie==="DAILY"&&pe.INTERVAL!==void 0?`${n("RRULE")}: ${Y} · ${n("runs every")} ${qe} ${n("day(s)")}`:Y?`${n("RRULE")}: ${Y}`:n("RRULE is required.")}function B(){const Y=V.value;Y.mode==="daily"?W.value.rrule=xe(Y.dailyTime):Y.mode==="interval"&&(W.value.rrule=Je(Y.interval,Y.intervalUnit))}function ne(Y){Y!=="minutes"&&Y!=="hours"&&Y!=="days"||(V.value={...V.value,intervalUnit:Y},B())}function ae(Y){Y!=="ACTIVE"&&Y!=="PAUSED"||(W.value={...W.value,status:Y})}function je(){V.value=rt(W.value.rrule)}function We(Y){V.value={...V.value,mode:Y},B()}function E(Y){var Ie;s.value="thread",i.value=Y,l.value="",m.value=!1,T.value="",k.value="";const pe=(Ie=r.value[Y])==null?void 0:Ie[0];pe?Ne(pe.id):le(),a.value=!0,e.closeThreadMenu()}function L(Y){var qe;const pe=e.getProjectAutomationKey(Y);if(!pe){s.value="project",i.value="",l.value="",m.value=!1,T.value=n("Project automation requires a resolved absolute project path."),k.value="",a.value=!0,e.closeProjectMenu();return}s.value="project",i.value="",l.value=pe,m.value=!1,T.value="",k.value="";const Ie=(qe=o.value[pe])==null?void 0:qe[0];Ie?Ne(Ie.id):le(),a.value=!0,e.closeProjectMenu()}function H(Y){s.value=Y.scope,i.value=Y.scope==="thread"?Y.target:"",l.value=Y.scope==="project"?Y.target:"",m.value=!1,T.value="",k.value="",Y.scope==="project"?o.value=Ve(o.value,Y.target,Y.automation):r.value=ye(r.value,Y.target,Y.automation),Ne(Y.automation.id),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function ue(){var Y;m.value=!0,f.value="thread",v.value=((Y=oe.value[0])==null?void 0:Y.value)??"",s.value="thread",i.value="",l.value="",T.value="",k.value="",le(),a.value=!0,e.closeProjectMenu(),e.closeThreadMenu()}function se(Y){var pe;f.value=Y,v.value="",s.value=Y==="project"?"project":"thread",v.value=((pe=Pe.value[0])==null?void 0:pe.value)??""}function le(){c.value="",d.value="create",T.value="",k.value="",W.value={name:s.value==="project"?"Project automation":"Thread automation",prompt:"",rrule:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",status:"ACTIVE"},V.value=rt(W.value.rrule)}function Ne(Y){const pe=U.value.find(Ie=>Ie.id===Y);pe&&(c.value=pe.id,d.value="edit",T.value="",k.value="",W.value={name:pe.name,prompt:pe.prompt,rrule:pe.rrule,status:pe.status},V.value=rt(pe.rrule))}function Me(){a.value=!1,s.value="thread",i.value="",l.value="",c.value="",T.value="",k.value="",_.value=!1,j.value=!1}function Ae(Y,pe){return Object.fromEntries(Object.entries(Y).filter(([Ie])=>Ie!==pe))}function ye(Y,pe,Ie){const qe=Y[pe]??[],Qe=qe.findIndex(jt=>jt.id===Ie.id),xt=[...qe];return Qe>=0?xt.splice(Qe,1,Ie):xt.push(Ie),{...Y,[pe]:xt}}function ze(Y,pe,Ie){const qe=(Y[pe]??[]).filter(Qe=>Qe.id!==Ie);return qe.length>0?{...Y,[pe]:qe}:Ae(Y,pe)}function $e(Y,pe){return Object.fromEntries(Object.entries(Y).filter(([Ie])=>Ie!==pe))}function Ve(Y,pe,Ie){const qe=Y[pe]??[],Qe=qe.findIndex(jt=>jt.id===Ie.id),xt=[...qe];return Qe>=0?xt.splice(Qe,1,Ie):xt.push(Ie),{...Y,[pe]:xt}}async function Ke(){o.value=await gI()}async function ft(Y){await ug(Y).catch(()=>{}),r.value=Ae(r.value,Y)}async function _t(){let Y=i.value,pe=l.value;_.value=!0,T.value="",k.value="";try{if(B(),m.value&&d.value==="create"&&(f.value==="thread"?(Y=v.value,pe="",s.value="thread",i.value=Y,l.value=""):(pe=v.value,Y="",s.value="project",i.value="",l.value=pe)),s.value==="thread"&&!Y)throw new Error(n("Select a chat target for this automation"));if(s.value==="project"&&!pe)throw new Error(n("Select a project target for this automation"));const Ie={id:c.value||void 0,name:W.value.name,prompt:W.value.prompt,rrule:W.value.rrule,status:W.value.status},qe=s.value==="project"?await yI({...Ie,projectName:pe}):await vI({...Ie,threadId:Y});s.value==="project"?await Ke():r.value=ye(r.value,Y,qe),e.onAutomationsChanged(),Ne(qe.id),k.value=n("Automation saved."),_.value=!1}catch(Ie){T.value=Ie instanceof Error?Ie.message:n("Failed to save automation"),_.value=!1}}async function Ct(){const Y=i.value,pe=l.value,Ie=c.value;if(Ie&&!(s.value==="thread"&&!Y)&&!(s.value==="project"&&!pe)){_.value=!0,T.value="",k.value="";try{s.value==="project"?(await cw(pe,Ie),await Ke()):(await ug(Y,Ie),r.value=ze(r.value,Y,Ie));const qe=U.value[0];qe?Ne(qe.id):le(),e.onAutomationsChanged(),_.value=!1}catch(qe){T.value=qe instanceof Error?qe.message:n("Failed to remove automation"),_.value=!1}}}async function dt(){const Y=i.value,pe=c.value;if(!(!Y||!pe)){j.value=!0,T.value="",k.value="";try{await wI(Y,pe),k.value=n("Automation run queued.")}catch(Ie){T.value=Ie instanceof Error?Ie.message:n("Failed to run automation")}finally{j.value=!1}}}return{automationByThreadId:r,automationByProjectName:o,automationDialogVisible:a,automationDialogScope:s,automationDialogThreadId:i,automationDialogProjectName:l,automationDialogAutomationId:c,automationDialogMode:d,automationTargetPickerVisible:m,automationTargetMode:f,automationTargetValue:v,automationDialogError:T,automationDialogNotice:k,projectAutomationActionError:N,isSavingAutomation:_,isRunningAutomation:j,automationDraft:W,automationScheduleDraft:V,automationDialogAutomations:U,automationSchedulePreview:fe,automationDialogSubtitle:K,automationThreadTargetOptions:oe,automationProjectTargetOptions:ve,automationTargetDropdownOptions:Pe,automationIntervalUnitOptions:we,automationStatusOptions:te,threadAutomationCount:ke,threadHasAutomation:ee,projectAutomationCount:Ce,projectHasAutomation:De,threadAutomationTooltip:Ee,projectAutomationTooltip:be,syncAutomationRruleFromScheduleDraft:B,onAutomationIntervalUnitChange:ne,onAutomationStatusChange:ae,syncAutomationScheduleDraftFromRrule:je,setAutomationScheduleMode:We,openAutomationDialog:E,openProjectAutomationDialog:L,openAutomationEditorFromPanel:H,openAutomationCreatorFromPanel:ue,setAutomationTargetMode:se,startNewAutomationDraft:le,selectAutomationForEditing:Ne,closeAutomationDialog:Me,omitAutomationProject:$e,reloadProjectAutomations:Ke,removeAutomationsForThread:ft,submitAutomationDialog:_t,onDeleteAutomationFromDialog:Ct,onRunAutomationFromDialog:dt}}const KE=4,Bg=6;function YE(e,t,n){if(e===null||n===0)return null;const r=Math.max(0,Math.min(e,n)),o=r>t?r-1:r,a=Math.max(0,Math.min(o,n-1));return a===t?null:a}function JE(e){const{getGroups:t,getFilteredGroups:n,isSearchActive:r,isCollapsed:o,getElevatedProjectName:a,onReorderProject:s,closeProjectMenu:i}=e,l=S(null),c=S(null),d=S(null);let m=null,f=null;const v=S(""),T=S({}),k=new Map,N=new WeakMap,_=typeof window<"u"?new ResizeObserver(de=>{for(const B of de){const ne=B.target,ae=N.get(ne);ae&&W(ae,ne)}}):null,j=()=>{var de,B;return((de=d.value)==null?void 0:de.projectName)??((B=c.value)==null?void 0:B.projectName)??""};function W(de,B){const ne=B.getBoundingClientRect().height;if(!Number.isFinite(ne)||ne<=0)return;const ae=T.value[de];ae!==void 0&&Math.abs(ae-ne)<.5||(T.value={...T.value,[de]:ne})}function V(de,B){const ne=k.get(de);ne&&ne!==B&&_&&_.unobserve(ne);const ae=B instanceof HTMLElement?B:B&&"$el"in B&&B.$el instanceof HTMLElement?B.$el:null;if(ae){k.set(de,ae),N.set(ae,de),W(de,ae),_==null||_.observe(ae);return}ne&&(_==null||_.unobserve(ne)),k.delete(de)}function U(de){const B=T.value[de]??0,ne=d.value,je=((ne==null?void 0:ne.projectName)===de?ne.groupHeight:null)??B,We=o(de)?0:Bg;return Math.max(0,je+We)}const fe=J(()=>{const de=d.value;return de?YE(de.dropTargetIndexFull,de.fromIndex,t().length):null}),K=J(()=>{const B=(r()?n():t()).map(E=>E.projectName),ne=d.value,ae=fe.value;if(!ne||ae===null)return B;const je=[...B],[We]=je.splice(ne.fromIndex,1);return We?(je.splice(ae,0,We),je):B}),oe=J(()=>{const de={};let B=0;for(const ne of K.value)de[ne]=B,B+=U(ne);return de}),ve=J(()=>{let de=0;for(const B of K.value)de+=U(B);return{height:`${Math.max(0,de)}px`}});function Pe(de,B){if(de.button!==0||r()||c.value||d.value)return;const ae=t().findIndex(L=>L.projectName===B),je=k.get(B);if(ae<0||!je)return;const We=je.getBoundingClientRect(),E=o(B)?0:Bg;c.value={projectName:B,fromIndex:ae,startClientX:de.clientX,startClientY:de.clientY,pointerOffsetY:de.clientY-We.top,groupLeft:We.left,groupWidth:We.width,groupHeight:We.height,groupOuterHeight:We.height+E},de.preventDefault(),we()}function we(){window.addEventListener("mousemove",ke),window.addEventListener("mouseup",ee),window.addEventListener("keydown",Ce)}function te(){window.removeEventListener("mousemove",ke),window.removeEventListener("mouseup",ee),window.removeEventListener("keydown",Ce)}function ke(de){m={clientX:de.clientX,clientY:de.clientY},Ue()}function ee(de){Ee({clientX:de.clientX,clientY:de.clientY});const B=d.value;if(B&&fe.value!==null){const ne=t().findIndex(ae=>ae.projectName===B.projectName);if(ne>=0){const ae=fe.value;ae!==ne&&s(B.projectName,ae)}}De({preserveToggleSuppression:!!B})}function Ce(de){de.key==="Escape"&&(!c.value&&!d.value||(de.preventDefault(),De()))}function De(de={}){f!==null&&(window.cancelAnimationFrame(f),f=null),m=null,c.value=null,d.value=null,de.preserveToggleSuppression||(v.value=""),te()}function Ue(){f===null&&(f=window.requestAnimationFrame(()=>{if(f=null,!m)return;const de=m;m=null,Ee(de)}))}function Ee(de){const B=c.value;if(!d.value&&B){const ne=de.clientX-B.startClientX,ae=de.clientY-B.startClientY;if(Math.hypot(ne,ae)<KE)return;i(),v.value=B.projectName,d.value={projectName:B.projectName,fromIndex:B.fromIndex,pointerOffsetY:B.pointerOffsetY,groupLeft:B.groupLeft,groupWidth:B.groupWidth,groupHeight:B.groupHeight,groupOuterHeight:B.groupOuterHeight,ghostTop:de.clientY-B.pointerOffsetY,dropTargetIndexFull:null}}d.value&&be(de)}function be(de){const B=d.value;if(!B)return;if(B.ghostTop=de.clientY-B.pointerOffsetY,!Te(de)){B.dropTargetIndexFull=null;return}const ne=de.clientY,ae=l.value;if(!ae){B.dropTargetIndexFull=null;return}const je=t(),We=ae.getBoundingClientRect(),E=new Map(je.map((se,le)=>[se.projectName,le])),L=je.map(se=>se.projectName).filter(se=>se!==B.projectName);let H=0,ue=je.length;for(const se of L){const le=E.get(se);if(le===void 0)continue;const Ne=U(se),Me=We.top+H+Ne/2;if(ne<Me){ue=le;break}H+=Ne}B.dropTargetIndexFull=ue}function Te(de){const B=l.value;if(!B)return!1;const ne=B.getBoundingClientRect(),ae=de.clientX>=ne.left&&de.clientX<=ne.right,je=de.clientY>=ne.top-32&&de.clientY<=ne.bottom+32;return ae&&je}function _e(de){var B;return((B=d.value)==null?void 0:B.projectName)===de}function xe(de){const B=d.value,ne=oe.value[de]??0,ae=a()===de;return!B||B.projectName!==de?{position:"absolute",top:"0",left:"0",right:"0",zIndex:ae?"40":"1",transform:`translate3d(0, ${ne}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${B.groupLeft}px`,width:`${B.groupWidth}px`,height:`${B.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${B.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Je(de){return v.value===de?(v.value="",!0):!1}function Xe(de){const B=j();B&&!de.includes(B)&&De();const ne=new Set(de),ae=Object.fromEntries(Object.entries(T.value).filter(([je])=>ne.has(je)));Object.keys(ae).length!==Object.keys(T.value).length&&(T.value=ae)}function rt(){for(const de of k.values())_==null||_.unobserve(de);k.clear(),De()}return{groupsContainerRef:l,groupsContainerStyle:ve,setProjectGroupRef:V,isDraggingProject:_e,projectGroupStyle:xe,onProjectHandleMouseDown:Pe,takeToggleSuppression:Je,pruneProjectGroups:Xe,dispose:rt}}const QE={key:0,class:"pinned-section"},XE={class:"thread-tree-header"},ZE={key:0,class:"thread-list"},e1={class:"projects-section"},t1={class:"thread-tree-header"},n1=["aria-expanded","aria-label","title"],r1={class:"organize-menu-title"},o1=["data-active"],a1={key:0},s1=["data-active"],i1={key:0},l1=["data-active"],u1={key:0},c1={class:"organize-menu-title"},d1=["data-active"],f1={key:0},h1=["data-active"],p1={key:0},m1={key:0,class:"thread-tree-action-error"},g1={key:1,class:"thread-tree-no-results"},v1={key:2,class:"thread-tree-loading"},y1={key:3,class:"thread-list thread-list-global"},w1=["data-project-name","data-expanded","data-dragging"],b1={class:"project-icon-stack"},T1={class:"project-icon-folder"},S1={class:"project-icon-chevron"},k1=["data-dragging-handle","onMousedown"],C1=["title"],x1=["title"],I1={key:0,class:"thread-row-automation-count"},A1={class:"project-hover-controls"},_1=["onClick"],P1=["data-open-direction"],E1=["onClick"],M1=["onClick"],R1=["onClick"],L1=["onClick"],j1=["onClick"],N1=["onClick"],$1={class:"project-menu-label"},O1=["onInput"],D1=["aria-label","title","onClick"],F1={key:0,class:"thread-list"},B1={class:"project-empty"},U1=["onClick"],z1={class:"chats-section"},H1={class:"thread-tree-header"},W1={class:"chats-section-actions"},q1=["aria-label","title"],G1={key:0,class:"thread-tree-no-results"},V1={key:1,class:"thread-list thread-list-global"},K1=["data-open-direction"],Y1=["disabled","title"],J1=["placeholder","onKeydown"],Q1={class:"recycle-bin-content"},X1={key:0,class:"recycle-bin-empty"},Z1={key:1,class:"recycle-bin-list"},eM={class:"recycle-bin-item-copy"},tM={class:"recycle-bin-item-title"},nM={key:0,class:"recycle-bin-item-meta"},rM={class:"recycle-bin-item-time"},oM={class:"recycle-bin-item-actions"},aM=["disabled","onClick"],sM=["onClick"],iM={key:2,class:"recycle-bin-error",role:"alert"},lM=["aria-label"],uM={class:"rename-thread-title"},cM={class:"rename-thread-subtitle"},dM={key:0,class:"automation-target-picker"},fM={class:"automation-target-mode-group",role:"radiogroup","aria-label":"Automation target type"},hM={class:"automation-target-dropdown"},pM=["aria-label"],mM=["onClick"],gM={class:"automation-thread-field"},vM={class:"automation-thread-label"},yM=["placeholder"],wM={class:"automation-thread-field"},bM={class:"automation-thread-label"},TM=["placeholder"],SM={class:"automation-thread-field"},kM={class:"automation-thread-label"},CM={class:"automation-schedule-mode-group",role:"radiogroup","aria-label":"Automation schedule type"},xM={key:0,class:"automation-schedule-row"},IM={class:"automation-schedule-copy"},AM={key:1,class:"automation-schedule-row"},_M={class:"automation-schedule-copy"},PM={class:"automation-schedule-preview"},EM={class:"automation-thread-field"},MM={class:"automation-thread-label"},RM={key:2,class:"rename-thread-subtitle automation-thread-error"},LM={key:3,class:"rename-thread-subtitle automation-thread-notice"},jM={class:"rename-thread-actions"},NM=["disabled"],$M=["disabled"],OM=["disabled"],DM=["disabled"],Ug="codex-web-local.sidebar-section-expansion.v1",zg="codex-web-local.sidebar-chats-first.v1",Hg="codex-web-local.sidebar-chat-sort-mode.v1",Wg="codex-web-local.thread-view-mode.v1",qg="codex-web-local.collapsed-projects.v1",FM=cn({__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 r=e,{t:o}=ao(),{recordVisibleFailure:a}=$w(),s=n,{records:i,loadRecords:l,recordArchivedThread:c,removeArchivedRecord:d,restoreArchivedThread:m}=QP(),f=S(!1),v=S(""),T=S("");function k(){vn.value=!1,v.value="",l(),f.value=!0}async function N(C){if(!T.value){T.value=C,v.value="";try{const M=await m(C);M.ok?s("restore-thread",C):v.value=M.error??"Failed to restore thread"}finally{T.value=""}}}const _=S({}),j=S({}),W=S(!0),V=S(!0),U=S(!0),fe=S(!1),K=S(Mt(zg,!1)),oe=S(Ca());let ve=!1;const Pe=S([]),we=S({}),te=S(""),ke=S([]),ee=S(""),Ce=S(""),De=S("hover"),Ue=S({}),Ee=S({}),be=S({}),Te=S("actions"),_e=S(""),xe=S(!1),Je=S(""),Xe=S(""),rt=S(null),de=S(!1),B=S(""),ne=S(""),ae=VE({getGroups:()=>r.groups,t:o,getProjectDisplayName:vo,getProjectAutomationKey:Xs,closeThreadMenu:Oe,closeProjectMenu:hn,onAutomationsChanged:()=>s("automations-changed")}),{automationByThreadId:je,automationByProjectName:We,automationDialogVisible:E,automationDialogScope:L,automationDialogAutomationId:H,automationDialogMode:ue,automationTargetPickerVisible:se,automationTargetMode:le,automationTargetValue:Ne,automationDialogError:Me,automationDialogNotice:Ae,projectAutomationActionError:ye,isSavingAutomation:ze,isRunningAutomation:$e,automationDraft:Ve,automationScheduleDraft:Ke,automationDialogAutomations:ft,automationSchedulePreview:_t,automationDialogSubtitle:Ct,automationTargetDropdownOptions:dt,automationIntervalUnitOptions:Y,automationStatusOptions:pe,threadAutomationCount:Ie,threadHasAutomation:qe,projectAutomationCount:Qe,projectHasAutomation:xt,threadAutomationTooltip:jt,projectAutomationTooltip:Ho,syncAutomationRruleFromScheduleDraft:Kn,onAutomationIntervalUnitChange:gn,onAutomationStatusChange:Wo,syncAutomationScheduleDraftFromRrule:yr,setAutomationScheduleMode:so,openAutomationDialog:qs,openProjectAutomationDialog:ya,openAutomationEditorFromPanel:ts,openAutomationCreatorFromPanel:wa,setAutomationTargetMode:io,startNewAutomationDraft:Ur,selectAutomationForEditing:qo,closeAutomationDialog:Go,omitAutomationProject:Gs,reloadProjectAutomations:ba,removeAutomationsForThread:ns,submitAutomationDialog:Ir,onDeleteAutomationFromDialog:Ta,onRunAutomationFromDialog:Vo}=ae,lo=JE({getGroups:()=>r.groups,getFilteredGroups:()=>Wt.value,isSearchActive:()=>tn.value,isCollapsed:mn,getElevatedProjectName:()=>ee.value?ee.value:Ce.value?Jn.value.get(Ce.value)??"":"",onReorderProject:(C,M)=>s("reorder-project",{projectName:C,toIndex:M}),closeProjectMenu:hn}),{groupsContainerRef:uo,groupsContainerStyle:co,setProjectGroupRef:Ko,isDraggingProject:Sa,projectGroupStyle:Vs,onProjectHandleMouseDown:vt,takeToggleSuppression:It,pruneProjectGroups:Pt,dispose:an}=lo,Jt=new Map,In=new Map,Ar=S(null),_r=S(null),vn=S(!1),wr=S(ar());function ka(){if(typeof window>"u")return{};try{const C=window.localStorage.getItem(qg);if(!C)return{};const M=JSON.parse(C);return!M||typeof M!="object"||Array.isArray(M)?{}:M}catch{return{}}}function ar(){return typeof window>"u"?"project":window.localStorage.getItem(Wg)==="chronological"?"chronological":"project"}function Mt(C,M){if(typeof window>"u")return M;const I=window.localStorage.getItem(C);return I==="true"?!0:I==="false"?!1:M}function Ca(){return typeof window>"u"?"updated":window.localStorage.getItem(Hg)==="created"?"created":"updated"}j.value=ka();function en(){if(!(typeof window>"u"))try{const C=JSON.parse(window.localStorage.getItem(Ug)||"{}");typeof C.pinned=="boolean"&&(W.value=C.pinned),typeof C.projects=="boolean"&&(V.value=C.projects),typeof C.chats=="boolean"&&(U.value=C.chats)}catch{}}function zr(){typeof window>"u"||window.localStorage.setItem(Ug,JSON.stringify({pinned:W.value,projects:V.value,chats:U.value}))}en(),ot(j,C=>{typeof window>"u"||window.localStorage.setItem(qg,JSON.stringify(C))},{deep:!0}),ot(wr,C=>{typeof window>"u"||window.localStorage.setItem(Wg,C)}),ot(K,C=>{typeof window>"u"||window.localStorage.setItem(zg,String(C))}),ot(oe,C=>{typeof window>"u"||window.localStorage.setItem(Hg,C)}),ot([W,V,U],zr);const Hr=J(()=>r.searchQuery.trim().toLowerCase()),tn=J(()=>Hr.value.length>0),Pr=J(()=>r.searchMatchedThreadIds?new Set(r.searchMatchedThreadIds):null),Tn=J(()=>new Set(Pe.value)),Yo=J(()=>new Set(ke.value));function Er(C){if(Yo.value.has(C.id))return!1;if(!tn.value)return!0;if(Pr.value)return Pr.value.has(C.id);const M=Hr.value;return C.title.toLowerCase().includes(M)||C.preview.toLowerCase().includes(M)}const Yn=J(()=>XP(r.groups)),Wt=J(()=>Yn.value.flatMap(C=>{const M=C.threads.filter(I=>!Cc(I.cwd)&&Er(I));return M.length>0?[{...C,threads:M}]:!tn.value&&C.threads.length===0?[{...C,threads:M}]:[]})),xa=J(()=>wr.value==="chronological"),Ia=J(()=>{const C=[];for(const M of Yn.value)for(const I of M.threads)Tn.value.has(I.id)||Er(I)&&C.push(I);return C.sort((M,I)=>{const X=new Date(M.updatedAtIso||M.createdAtIso).getTime();return new Date(I.updatedAtIso||I.createdAtIso).getTime()-X})}),sr=J(()=>{const C=Ia.value.filter(I=>Cc(I.cwd)),M=oe.value==="created"?"createdAtIso":"updatedAtIso";return C.sort((I,X)=>{const Ze=new Date(I[M]||I.updatedAtIso||I.createdAtIso).getTime();return new Date(X[M]||X.updatedAtIso||X.createdAtIso).getTime()-Ze})}),Mr=J(()=>tn.value||fe.value?sr.value:sr.value.slice(0,10)),Qt=J(()=>tn.value?!1:sr.value.length>10),yn=J(()=>{const C=new Map;for(const M of Yn.value)for(const I of M.threads)Yo.value.has(I.id)||C.set(I.id,I);return C});ot(Pe,C=>{ve&&y_(C)}),ot([yn,()=>r.isThreadListFullyLoaded],([C])=>{const M=GE(Pe.value,new Set(C.keys()),{canPruneMissing:r.isThreadListFullyLoaded});if(M.length===Pe.value.length)return;const I=new Set(M),X=Object.fromEntries(Object.entries(we.value).filter(([Ze])=>I.has(Ze)));we.value=X,Pe.value=M});let On=0;async function fo(){if(r.isLoading)return;const C=Pe.value.filter(Ze=>!yn.value.has(Ze)&&!we.value[Ze]);if(C.length===0)return;const M=On+=1,I=await Promise.all(C.map(async Ze=>{try{return await AA(Ze)}catch{return null}}));if(M!==On)return;const X={...we.value};for(const Ze of I)Ze&&(X[Ze.id]=Ze);we.value=X}ot([Pe,yn,()=>r.isLoading],()=>{ve&&fo()}),es(async()=>{const{threadIds:C}=await v_(),M=Array.isArray(C)?C.filter(I=>typeof I=="string").map(I=>I.trim()).filter((I,X,Ze)=>I.length>0&&Ze.indexOf(I)===X):[];M.length>0&&(Pe.value=M);try{je.value=await mI()}catch{je.value={}}try{await ba()}catch{We.value={}}ve=!0,fo()});const Xt=J(()=>qe(B.value)),Jo=J(()=>{const C=ne.value;return Xt.value?o('This will archive the thread "{title}" and remove the attached heartbeat automations.',{title:C}):o('This will archive the thread "{title}". You can find it later in archived threads.',{title:C})}),Jn=J(()=>{const C=new Map;for(const M of r.groups)for(const I of M.threads)C.set(I.id,M.projectName);return C}),dn=J(()=>{const C=new Map;for(const M of r.groups){const I=M.threads.filter(X=>!Tn.value.has(X.id)&&!Yo.value.has(X.id));C.set(M.projectName,I)}return C}),ho=J(()=>{const C=new Map;for(const M of r.groups)for(const I of M.threads){const X=new Date(I.updatedAtIso||I.createdAtIso).getTime();C.set(I.id,X)}return C}),Vt=J(()=>{const C=Ce.value;return C?yn.value.get(C)??null:null}),Ft=J(()=>Pe.value.map(C=>yn.value.get(C)??we.value[C]??null).filter(C=>C!==null).filter(Er));function po(){W.value=!W.value}function Dn(){V.value=!V.value}function Ks(){U.value=!U.value}function ir(C){if(Number.isNaN(C))return"n/a";const M=Math.abs(Date.now()-C);if(M<6e4)return o("now");const I=Math.floor(M/6e4);if(I<60)return`${I}m`;const X=Math.floor(I/60);return X<24?`${X}h`:`${Math.floor(X/24)}d`}function Wr(C){const M=ho.value.get(C.id);return ir(typeof M=="number"?M:new Date(C.updatedAtIso||C.createdAtIso).getTime())}function Aa(C){const M=new Date(C).getTime();return Number.isNaN(M)?"":new Date(M).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function br(C){return Tn.value.has(C)}function Qo(C){if(br(C)){Pe.value=Pe.value.filter(M=>M!==C);return}Pe.value=[C,...Pe.value]}function qr(C){Qo(C),Oe()}function Rr(C){te.value="",s("select",C)}function mo(C){C===r.selectedThreadId&&(s("copy-thread-chat",C),Oe())}function yt(C){s("fork-thread",C),Oe()}function An(C){return`${o("start new thread")} ${vo(C)}`}function _n(C){s("start-new-thread",C)}function Xo(C){s("browse-thread-files",C),Oe()}function x(C){s("save-thread-project",C),Oe()}async function $(C){var I,X;const M=((X=(I=yn.value.get(C))==null?void 0:I.cwd)==null?void 0:X.trim())??"";if(Oe(),!(!M||typeof navigator>"u"||!navigator.clipboard))try{await navigator.clipboard.writeText(M)}catch{}}function Z(C,M){if(Ce.value===C&&De.value==="hover"){if(M){const I=M.relatedTarget,X=_r.value;if(I instanceof Node&&X&&X.contains(I))return}Oe()}}function Le(C){return Ce.value===C}function Oe(){Ce.value="",De.value="hover",be.value={}}function At(C){if(te.value="",Ce.value===C){Oe();return}De.value="hover",hn(),vn.value=!1,Ce.value=C,Et(()=>{Vr(C)})}function fn(C,M){C.preventDefault(),te.value="",De.value="contextmenu",Ce.value=M}function Tt(C,M){Je.value=C,Xe.value=M,xe.value=!0,Oe(),Et(()=>{var I,X;(I=rt.value)==null||I.focus(),(X=rt.value)==null||X.select()})}function Pn(){xe.value=!1,Je.value="",Xe.value=""}function En(){const C=Je.value,M=Xe.value.trim();!C||!M||(s("rename-thread",{threadId:C,title:M}),Pn())}function go(C,M){te.value="",B.value=C,ne.value=M,de.value=!0,Oe()}function Ys(){de.value=!1,B.value="",ne.value=""}async function Pi(){const C=B.value;C&&(Js(C),Ys())}function Kt(C){return te.value===C}function Zo(C){if(te.value!==C){te.value=C,Oe();return}Js(C),te.value=""}function Js(C){var I,X;const M=yn.value.get(C)??null;Yo.value.has(C)||(ke.value=[C,...ke.value]),te.value="",Oe(),c({id:C,title:((I=M==null?void 0:M.title)==null?void 0:I.trim())||"(untitled)",cwd:((X=M==null?void 0:M.cwd)==null?void 0:X.trim())??"",projectName:Jn.value.get(C)??""}),Pe.value=Pe.value.filter(Ze=>Ze!==C),s("archive",C),qe(C)&&ns(C)}function vo(C){return r.projectDisplayNameById[C]??C}t({openAutomationEditorFromPanel:ts,openAutomationCreatorFromPanel:wa,openRenameThreadDialog:Tt,openRecycleBin:k});function Qn(C){return C.includes("/")||C.includes("\\")}function Al(C){return Qn(C)?C:vo(C)}function rs(C){const M=Fr(C);if(!M)return!1;let I=0;for(const X of r.groups)if(Qn(X.projectName)&&Fr(X.projectName)===M&&(I+=1,I>1))return!0;return!1}function os(C){const M=r.projectDisplayNameById[C.projectName],I=vo(C.projectName),X=C.projectName;if(M&&!Qn(X)&&X!==I)return I.includes(X)||/^[0-9a-f]{8}-[0-9a-f-]{27,}$/iu.test(X)?I:`${I} ${X}`;if(M&&Qn(X)){const Nr=Fr(X),Zn=Fr(hl(X)),ln=rs(X)?Zn:Nr;return ln&&ln!==I?`${I} ${ln}`:I}if(!I.includes("/")&&!I.includes("\\"))return I;const Ze=Fr(I)||I,Ut=Fr(hl(I));return Ut.startsWith(".")&&Ut!==Ze?`${Ze} ${Ut}`:C.threads.length>0||!rs(X)?Ze:Ut?`${Ze} ${Ut}`:Ze}function as(C){return ee.value===C}function hn(){ee.value="",Te.value="actions",_e.value=""}function Gr(){const C=!vn.value;C&&(hn(),Oe()),vn.value=C}function yo(C){wr.value=C,vn.value=!1}function wo(){K.value=!K.value}function pn(C){oe.value=C}function bo(C){s("request-project-git-status",C),Et(()=>{Tr(C)})}function ea(C){if(ee.value===C){hn();return}Oe(),vn.value=!1,ee.value=C,Te.value="actions",_e.value=vo(C),bo(C)}function ss(C){Oe(),vn.value=!1,ee.value=C,Te.value="actions",_e.value=vo(C),bo(C)}function nn(C){return r.projectDisplayNameById[C.projectName]??os(C)}function Ei(C){Oe();const M=C.projectName;ee.value=M,Te.value="rename",_e.value=nn(C),Et(()=>{Tr(M)})}function _a(C){s("browse-project-files",C),hn()}function Mn(C){s("save-project",C),hn()}function Fn(C){s("create-project-worktree",C),hn()}function Qs(C){s("rename-project",{projectName:C,displayName:_e.value})}function is(C){const M=Xs(C);if(s("remove-project",C),M&&xt(C)){ye.value="";const I=We.value;We.value=Gs(We.value,M),cw(M).then(ba).catch(async X=>{We.value=I;const Ze=X instanceof Error?X.message:o("Failed to delete project automation");ye.value=Ze,a(Ze);try{await ba()}catch{We.value=I}}).finally(()=>{s("automations-changed")})}hn()}function Xs(C){var I;const M=((I=r.projectCwdByName[C])==null?void 0:I.trim())??"";return EI(M)?M:""}function _l(C,M){if(!C.altKey||C.key!=="ArrowUp"&&C.key!=="ArrowDown")return;const I=r.groups.findIndex(Ut=>Ut.projectName===M);if(I<0)return;const X=C.key==="ArrowUp"?-1:1,Ze=Math.max(0,Math.min(I+X,r.groups.length-1));Ze!==I&&(C.preventDefault(),s("reorder-project",{projectName:M,toIndex:Ze}))}function ls(C){return _.value[C]===!0}function mn(C){return j.value[C]===!0}function rn(C){_.value={..._.value,[C]:!ls(C)}}function Bt(){fe.value=!fe.value}function Xn(C){It(C)||(j.value={...j.value,[C]:!mn(C)})}function Lr(C,M){const I=M instanceof HTMLElement?M:M&&"$el"in M&&M.$el instanceof HTMLElement?M.$el:null;if(I){Jt.set(C,I);return}Jt.delete(C)}function lr(C,M){const I=M instanceof HTMLElement?M:M&&"$el"in M&&M.$el instanceof HTMLElement?M.$el:null;if(I){In.set(C,I);return}In.delete(C)}function us(C){let M=C.parentElement;for(;M;){const I=window.getComputedStyle(M),X=I.overflowY||I.overflow;if(X==="auto"||X==="scroll"||X==="hidden"||X==="clip")return M.getBoundingClientRect();M=M.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function To(C,M){const I=C.getBoundingClientRect(),X=us(C),Ze=6,Ut=X.bottom-I.bottom,Nr=I.top-X.top;return Ut>=M+Ze?"down":Nr>Ut?"up":"down"}function jr(C,M){const I=In.get(C);if(!I)return"down";const X=To(I,M);return Ee.value={...Ee.value,[C]:X},X}function So(C){return Ee.value[C]??"down"}function Tr(C){const M=Jt.get(C);if(!M)return;const I=M.querySelector(".project-menu-panel"),X=(I==null?void 0:I.getBoundingClientRect().height)??0;Ue.value={...Ue.value,[C]:To(M,X)}}function cs(C,M,I){return Math.min(Math.max(C,M),I)}function Vr(C){const M=In.get(C);if(!M)return;const I=_r.value,X=I==null?void 0:I.getBoundingClientRect(),Ze=(X==null?void 0:X.height)||(I==null?void 0:I.offsetHeight)||112,Ut=(X==null?void 0:X.width)||(I==null?void 0:I.offsetWidth)||160,Nr=jr(C,Ze),Zn=M.getBoundingClientRect(),ln=8,Jr=4,ta=Math.max(ln,window.innerWidth-Ut-ln),xo=cs(Zn.right-Ut,ln,ta),na=cs(Nr==="up"?Zn.top-Ze-Jr:Zn.bottom+Jr,ln,Math.max(ln,window.innerHeight-Ze-ln));be.value={left:`${Math.round(xo)}px`,top:`${Math.round(na)}px`}}function ur(){const C=Ce.value;C&&Vr(C)}function Pa(){window.addEventListener("resize",ur),document.addEventListener("scroll",ur,!0)}function Zs(){window.removeEventListener("resize",ur),document.removeEventListener("scroll",ur,!0)}function Mi(C){const M=ee.value;if(!M)return!1;const I=Jt.get(M);if(!I)return!1;if((typeof C.composedPath=="function"?C.composedPath():[]).includes(I))return!0;const Ze=C.target;return Ze instanceof Node?I.contains(Ze):!1}function ei(C){const M=Ce.value;if(!M)return!1;const I=In.get(M);if(!I)return!1;const X=typeof C.composedPath=="function"?C.composedPath():[];if(X.includes(I))return!0;const Ze=_r.value;if(Ze&&X.includes(Ze))return!0;const Ut=C.target;return Ut instanceof Node?!!(I.contains(Ut)||Ze&&Ze.contains(Ut)):!1}function ds(C){if(vn.value){const M=Ar.value,I=typeof C.composedPath=="function"?C.composedPath():[];!!M&&(I.includes(M)||C.target instanceof Node&&M.contains(C.target))||(vn.value=!1)}ee.value&&(Mi(C)||hn(),Ce.value&&(ei(C)||Oe()))}function Kr(C){ee.value&&!Mi(C)&&hn(),Ce.value&&!ei(C)&&Oe()}function ko(){vn.value&&(vn.value=!1),ee.value&&hn(),Ce.value&&Oe()}function Ri(){window.addEventListener("pointerdown",ds,{capture:!0}),window.addEventListener("focusin",Kr,{capture:!0}),window.addEventListener("blur",ko)}function ti(){window.removeEventListener("pointerdown",ds,{capture:!0}),window.removeEventListener("focusin",Kr,{capture:!0}),window.removeEventListener("blur",ko)}function Ea(C){return dn.value.get(C.projectName)??[]}function fs(C){if(tn.value)return Ea(C);if(mn(C.projectName))return[];const M=Ea(C);return ls(C.projectName)?M:M.slice(0,10)}function Pl(C){return tn.value?!1:!mn(C.projectName)&&Ea(C).length>10}function Li(C){return Ea(C).length>0}function sn(C){var M;return!!C.pendingRequestState||C.inProgress||C.unread||((M=C.externalSession)==null?void 0:M.active)===!0}function Bn(C){return C.pendingRequestState==="approval"?o("Awaiting approval"):o("Awaiting response")}function Co(C){var M;return((M=C.externalSession)==null?void 0:M.active)===!0?"external":C.pendingRequestState==="approval"?"awaiting-approval":C.pendingRequestState==="response"?"awaiting-response":C.inProgress?"working":C.unread?"unread":"idle"}ot(()=>r.groups.map(C=>C.projectName),C=>{Pt(C)}),ot(()=>{const C=ee.value;return C?r.projectGitRepoByName[C]:void 0},()=>{const C=ee.value;C&&Et(()=>{ee.value===C&&Tr(C)})});const Yr=J(()=>vn.value||ee.value!==""||Ce.value!=="");return ot(Yr,C=>{if(C){Ri();return}ti()}),ot(Ce,C=>{if(!C){Zs();return}Pa(),Et(()=>{Vr(C)})}),Ws(()=>{Jt.clear(),Zs(),ti(),an()}),(C,M)=>(P(),D("section",{class:ct(["thread-tree-root",{"chats-first":K.value}])},[Ft.value.length>0?(P(),D("section",QE,[Be(Es,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":W.value,onClick:po},{left:pt(()=>[W.value?(P(),tt(Ds,{key:1,class:"thread-icon"})):(P(),tt(Yu,{key:0,class:"thread-icon"}))]),default:pt(()=>[w("span",XE,O(g(o)("Pinned")),1)]),_:1},8,["aria-expanded"]),W.value?(P(),D("ul",ZE,[(P(!0),D(at,null,Ht(Ft.value,I=>(P(),tt(Ju,{key:I.id,thread:I,selected:I.id===e.selectedThreadId,pinned:br(I.id),"menu-open":Le(I.id),"show-status-indicator":sn(I),"thread-state":Co(I),"inline-delete-confirming":Kt(I.id),"automation-count":g(Ie)(I.id),"automation-tooltip":g(jt)(I.id),"request-label":Bn(I),"relative-time":Wr(I),"delete-label":g(o)("Delete thread"),"confirm-delete-label":g(o)("Confirm delete"),"confirm-label":g(o)("Confirm"),"worktree-label":g(o)("Worktree thread"),"set-menu-wrap-ref":X=>lr(I.id,X),onSelect:X=>Rr(I.id),onInlineDelete:X=>Zo(I.id),onMenuToggle:X=>At(I.id),onRowLeave:X=>Z(I.id,X),onRowContextmenu:X=>fn(X,I.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))])):me("",!0)])):me("",!0),w("section",e1,[Be(Es,{as:"button",class:"thread-tree-header-row section-toggle-row",type:"button","aria-expanded":V.value,onClick:Dn},{left:pt(()=>[V.value?(P(),tt(Ds,{key:1,class:"thread-icon"})):(P(),tt(Yu,{key:0,class:"thread-icon"}))]),right:pt(()=>[w("div",{ref_key:"organizeMenuWrapRef",ref:Ar,class:"organize-menu-wrap"},[w("button",{class:"organize-menu-trigger",type:"button","aria-expanded":vn.value,"aria-label":g(o)("Organize threads"),title:g(o)("Organize threads"),onClick:gt(Gr,["stop"])},[Be(qf,{class:"thread-icon"})],8,n1),vn.value?(P(),D("div",{key:0,class:"organize-menu-panel",onClick:M[4]||(M[4]=gt(()=>{},["stop"]))},[w("p",r1,O(g(o)("Organize")),1),w("button",{class:"organize-menu-item","data-active":wr.value==="project",type:"button",onClick:M[0]||(M[0]=I=>yo("project"))},[w("span",null,O(g(o)("By project")),1),wr.value==="project"?(P(),D("span",a1,"✓")):me("",!0)],8,o1),w("button",{class:"organize-menu-item","data-active":wr.value==="chronological",type:"button",onClick:M[1]||(M[1]=I=>yo("chronological"))},[w("span",null,O(g(o)("Chronological list")),1),wr.value==="chronological"?(P(),D("span",i1,"✓")):me("",!0)],8,s1),w("button",{class:"organize-menu-item","data-active":K.value,type:"button",onClick:wo},[w("span",null,O(g(o)("Chats first")),1),K.value?(P(),D("span",u1,"✓")):me("",!0)],8,l1),M[40]||(M[40]=w("div",{class:"organize-menu-separator"},null,-1)),w("p",c1,O(g(o)("Sort by")),1),w("button",{class:"organize-menu-item","data-active":oe.value==="created",type:"button",onClick:M[2]||(M[2]=I=>pn("created"))},[w("span",null,O(g(o)("Created")),1),oe.value==="created"?(P(),D("span",f1,"✓")):me("",!0)],8,d1),w("button",{class:"organize-menu-item","data-active":oe.value==="updated",type:"button",onClick:M[3]||(M[3]=I=>pn("updated"))},[w("span",null,O(g(o)("Updated")),1),oe.value==="updated"?(P(),D("span",p1,"✓")):me("",!0)],8,h1),M[41]||(M[41]=w("div",{class:"organize-menu-separator"},null,-1)),w("button",{class:"organize-menu-item",type:"button",onClick:k},[w("span",null,O(g(o)("Recycle bin")),1)])])):me("",!0)],512)]),default:pt(()=>[w("span",t1,O(g(o)("Projects")),1)]),_:1},8,["aria-expanded"]),V.value?(P(),D(at,{key:0},[g(ye)?(P(),D("p",m1,O(g(ye)),1)):me("",!0),tn.value&&Wt.value.length===0?(P(),D("p",g1,O(g(o)("No matching threads. Clear the search to see all threads.")),1)):e.isLoading&&e.groups.length===0?(P(),D("p",v1,O(g(o)("Loading threads...")),1)):xa.value?(P(),D("ul",y1,[(P(!0),D(at,null,Ht(Ia.value,I=>(P(),tt(Ju,{key:I.id,thread:I,selected:I.id===e.selectedThreadId,pinned:br(I.id),"menu-open":Le(I.id),"show-status-indicator":sn(I),"thread-state":Co(I),"inline-delete-confirming":Kt(I.id),"automation-count":g(Ie)(I.id),"automation-tooltip":g(jt)(I.id),"request-label":Bn(I),"relative-time":Wr(I),"delete-label":g(o)("Delete thread"),"confirm-delete-label":g(o)("Confirm delete"),"confirm-label":g(o)("Confirm"),"worktree-label":g(o)("Worktree thread"),"set-menu-wrap-ref":X=>lr(I.id,X),onSelect:X=>Rr(I.id),onInlineDelete:X=>Zo(I.id),onMenuToggle:X=>At(I.id),onRowLeave:X=>Z(I.id,X),onRowContextmenu:X=>fn(X,I.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))])):(P(),D("div",{key:4,ref_key:"groupsContainerRef",ref:uo,class:"thread-tree-groups",style:Zr(g(co))},[(P(!0),D(at,null,Ht(Wt.value,I=>(P(),D("article",{key:I.projectName,ref_for:!0,ref:X=>g(Ko)(I.projectName,X),class:"project-group","data-project-name":I.projectName,"data-expanded":!mn(I.projectName),"data-dragging":g(Sa)(I.projectName),style:Zr(g(Vs)(I.projectName))},[Be(Es,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:X=>Xn(I.projectName),onContextmenu:gt(X=>ss(I.projectName),["prevent"]),onKeydown:[X=>_l(X,I.projectName),Cr(gt(X=>Xn(I.projectName),["prevent"]),["enter"]),Cr(gt(X=>Xn(I.projectName),["prevent"]),["space"])]},{left:pt(()=>[w("span",b1,[w("span",T1,[mn(I.projectName)?(P(),tt(zh,{key:0,class:"thread-icon"})):(P(),tt(LP,{key:1,class:"thread-icon"}))]),w("span",S1,[mn(I.projectName)?(P(),tt(Yu,{key:0,class:"thread-icon"})):(P(),tt(Ds,{key:1,class:"thread-icon"}))])])]),right:pt(()=>[w("div",A1,[w("div",{ref_for:!0,ref:X=>Lr(I.projectName,X),class:"project-menu-wrap"},[w("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:gt(X=>ea(I.projectName),["stop"])},[Be(qf,{class:"thread-icon"})],8,_1),as(I.projectName)?(P(),D("div",{key:0,class:"project-menu-panel","data-open-direction":Ue.value[I.projectName]??"down",onClick:M[6]||(M[6]=gt(()=>{},["stop"]))},[Te.value==="actions"?(P(),D(at,{key:0},[w("button",{class:"project-menu-item",type:"button",onClick:X=>_a(I.projectName)},O(g(o)("Browse files")),9,E1),w("button",{class:"project-menu-item",type:"button",onClick:X=>Mn(I.projectName)},O(g(o)("Export Project")),9,M1),w("button",{class:"project-menu-item",type:"button",onClick:X=>g(ya)(I.projectName)},O(g(xt)(I.projectName)?g(o)("Manage automations…"):g(o)("Add automation…")),9,R1),e.projectGitRepoByName[I.projectName]?(P(),D("button",{key:0,class:"project-menu-item",type:"button",onClick:X=>Fn(I.projectName)},O(g(o)("New worktree")),9,L1)):me("",!0),w("button",{class:"project-menu-item",type:"button",onClick:X=>Ei(I)},O(g(o)("Rename project")),9,j1),w("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:X=>is(I.projectName)},O(g(o)("Remove")),9,N1)],64)):(P(),D(at,{key:1},[w("label",$1,O(g(o)("Project name")),1),xn(w("input",{"onUpdate:modelValue":M[5]||(M[5]=X=>_e.value=X),class:"project-menu-input",type:"text",onInput:X=>Qs(I.projectName)},null,40,O1),[[Nn,_e.value]])],64))],8,P1)):me("",!0)],512),w("button",{class:"thread-start-button",type:"button","aria-label":An(I.projectName),title:An(I.projectName),onClick:gt(X=>_n(I.projectName),["stop"])},[Be(Cl,{class:"thread-icon"})],8,D1)])]),default:pt(()=>[w("span",{class:"project-main-button","data-dragging-handle":g(Sa)(I.projectName),onMousedown:gt(X=>g(vt)(X,I.projectName),["left"])},[w("span",{class:"project-title",title:Al(I.projectName)},O(os(I)),9,C1),g(xt)(I.projectName)?(P(),D("span",{key:0,class:"thread-row-automation-chip",title:g(Ho)(I.projectName)},[Be(td,{class:"thread-row-automation-icon"}),g(Qe)(I.projectName)>1?(P(),D("span",I1,O(g(Qe)(I.projectName)),1)):me("",!0)],8,x1)):me("",!0)],40,k1)]),_:2},1032,["onClick","onContextmenu","onKeydown"]),Li(I)?(P(),D("ul",F1,[(P(!0),D(at,null,Ht(fs(I),X=>(P(),tt(Ju,{key:X.id,thread:X,selected:X.id===e.selectedThreadId,pinned:br(X.id),"menu-open":Le(X.id),"show-status-indicator":sn(X),"thread-state":Co(X),"inline-delete-confirming":Kt(X.id),"automation-count":g(Ie)(X.id),"automation-tooltip":g(jt)(X.id),"request-label":Bn(X),"relative-time":Wr(X),"delete-label":g(o)("Delete thread"),"confirm-delete-label":g(o)("Confirm delete"),"confirm-label":g(o)("Confirm"),"worktree-label":g(o)("Worktree thread"),"set-menu-wrap-ref":Ze=>lr(X.id,Ze),onSelect:Ze=>Rr(X.id),onInlineDelete:Ze=>Zo(X.id),onMenuToggle:Ze=>At(X.id),onRowLeave:Ze=>Z(X.id,Ze),onRowContextmenu:Ze=>fn(Ze,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))])):(P(),tt(Es,{key:1,as:"p",class:"project-empty-row"},{left:pt(()=>[...M[42]||(M[42]=[w("span",{class:"project-empty-spacer"},null,-1)])]),default:pt(()=>[w("span",B1,O(g(o)("No threads yet. Start a new thread to begin.")),1)]),_:1})),Pl(I)?(P(),tt(Es,{key:2,class:"thread-show-more-row"},{left:pt(()=>[...M[43]||(M[43]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:pt(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:X=>rn(I.projectName)},O(ls(I.projectName)?"Show less":"Show more"),9,U1)]),_:2},1024)):me("",!0)],12,w1))),128))],4))],64)):me("",!0)]),w("section",z1,[Be(Es,{as:"button",class:"section-toggle-row",type:"button","aria-expanded":U.value,onClick:Ks},{left:pt(()=>[U.value?(P(),tt(Ds,{key:1,class:"thread-icon"})):(P(),tt(Yu,{key:0,class:"thread-icon"}))]),right:pt(()=>[w("div",W1,[w("button",{class:"chats-section-action",type:"button","aria-label":g(o)("New chat"),title:g(o)("New chat"),onClick:M[7]||(M[7]=gt(I=>C.$emit("start-new-chat"),["stop"]))},[Be(Cl,{class:"thread-icon"})],8,q1)])]),default:pt(()=>[w("span",H1,O(g(o)("Chats")),1)]),_:1},8,["aria-expanded"]),U.value&&sr.value.length===0?(P(),D("p",G1,O(g(o)("No chats")),1)):U.value?(P(),D("ul",V1,[(P(!0),D(at,null,Ht(Mr.value,I=>(P(),tt(Ju,{key:I.id,thread:I,selected:I.id===e.selectedThreadId,pinned:br(I.id),"menu-open":Le(I.id),"show-status-indicator":sn(I),"thread-state":Co(I),"inline-delete-confirming":Kt(I.id),"automation-count":g(Ie)(I.id),"automation-tooltip":g(jt)(I.id),"request-label":Bn(I),"relative-time":Wr(I),"delete-label":g(o)("Delete thread"),"confirm-delete-label":g(o)("Confirm delete"),"confirm-label":g(o)("Confirm"),"worktree-label":g(o)("Worktree thread"),"set-menu-wrap-ref":X=>lr(I.id,X),onSelect:X=>Rr(I.id),onInlineDelete:X=>Zo(I.id),onMenuToggle:X=>At(I.id),onRowLeave:X=>Z(I.id,X),onRowContextmenu:X=>fn(X,I.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))])):me("",!0),U.value&&Qt.value?(P(),tt(Es,{key:2,class:"thread-show-more-row"},{left:pt(()=>[...M[44]||(M[44]=[w("span",{class:"thread-show-more-spacer"},null,-1)])]),default:pt(()=>[w("button",{class:"thread-show-more-button",type:"button",onClick:Bt},O(fe.value?"Show less":"Show more"),1)]),_:1})):me("",!0)]),(P(),tt(Bs,{to:"body"},[Vt.value?(P(),D("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:_r,class:"thread-menu-panel thread-menu-panel-fixed",style:Zr(be.value),"data-open-direction":So(Vt.value.id),onClick:M[17]||(M[17]=gt(()=>{},["stop"]))},[w("button",{class:"thread-menu-item",type:"button",onClick:M[8]||(M[8]=I=>g(qs)(Vt.value.id))},O(g(qe)(Vt.value.id)?g(o)("Manage automations…"):g(o)("Add automation…")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[9]||(M[9]=I=>Xo(Vt.value.id))},O(g(o)("Browse files")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[10]||(M[10]=I=>x(Vt.value.id))},O(g(o)("Export Project")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[11]||(M[11]=I=>$(Vt.value.id))},O(g(o)("Copy path")),1),w("button",{class:"thread-menu-item",type:"button",disabled:Vt.value.id!==e.selectedThreadId,title:Vt.value.id===e.selectedThreadId?g(o)("Copy chat"):g(o)("Open this chat before copying"),onClick:M[12]||(M[12]=I=>mo(Vt.value.id))},O(g(o)("Copy chat")),9,Y1),w("button",{class:"thread-menu-item",type:"button",onClick:M[13]||(M[13]=I=>yt(Vt.value.id))},O(g(o)("Create chat fork")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[14]||(M[14]=I=>qr(Vt.value.id))},O(br(Vt.value.id)?g(o)("Unpin thread"):g(o)("Pin thread")),1),w("button",{class:"thread-menu-item",type:"button",onClick:M[15]||(M[15]=I=>Tt(Vt.value.id,Vt.value.title))},O(g(o)("Rename thread")),1),w("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:M[16]||(M[16]=I=>go(Vt.value.id,Vt.value.title))},O(g(o)("Delete thread")),1)],12,K1)):me("",!0)])),Be(df,{open:xe.value,title:g(o)("Rename thread"),subtitle:g(o)("Make it short and recognizable."),onClose:Pn},{footer:pt(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:Pn},O(g(o)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:En},O(g(o)("Save")),1)]),default:pt(()=>[xn(w("input",{ref_key:"renameThreadInputRef",ref:rt,"onUpdate:modelValue":M[18]||(M[18]=I=>Xe.value=I),class:"rename-thread-input",type:"text",placeholder:g(o)("Add title..."),onKeydown:Cr(gt(En,["prevent"]),["enter"])},null,40,J1),[[Nn,Xe.value]])]),_:1},8,["open","title","subtitle"]),Be(df,{open:de.value,title:Xt.value?g(o)("Archive chat and remove automations?"):g(o)("Delete thread?"),subtitle:Jo.value,onClose:Ys},{footer:pt(()=>[w("button",{class:"rename-thread-button",type:"button",onClick:Ys},O(g(o)("Cancel")),1),w("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:Pi},O(Xt.value?g(o)("Archive and remove"):g(o)("Delete")),1)]),_:1},8,["open","title","subtitle"]),Be(df,{open:f.value,title:g(o)("Recycle bin"),subtitle:g(o)("Threads you removed are kept here so you can restore them."),size:"md",onClose:M[19]||(M[19]=I=>f.value=!1)},{default:pt(()=>[w("div",Q1,[g(i).length===0?(P(),D("div",X1,O(g(o)("Recycle bin is empty.")),1)):(P(),D("ul",Z1,[(P(!0),D(at,null,Ht(g(i),I=>(P(),D("li",{key:I.id,class:"recycle-bin-item"},[w("div",eM,[w("span",tM,O(I.title),1),I.projectName?(P(),D("span",nM,O(I.projectName),1)):me("",!0),w("span",rM,O(Aa(I.archivedAtIso)),1)]),w("div",oM,[w("button",{class:"recycle-bin-button recycle-bin-button-primary",type:"button",disabled:T.value===I.id,onClick:X=>N(I.id)},O(T.value===I.id?g(o)("Restoring…"):g(o)("Restore")),9,aM),w("button",{class:"recycle-bin-button recycle-bin-button-danger",type:"button",onClick:X=>g(d)(I.id)},O(g(o)("Delete permanently")),9,sM)])]))),128))])),v.value?(P(),D("p",iM,O(v.value),1)):me("",!0)])]),_:1},8,["open","title","subtitle"]),(P(),tt(Bs,{to:"body"},[g(E)?(P(),D("div",{key:0,class:"rename-thread-overlay",onClick:M[39]||(M[39]=gt((...I)=>g(Go)&&g(Go)(...I),["self"]))},[w("div",{class:"rename-thread-panel automation-thread-panel",role:"dialog","aria-modal":"true","aria-label":g(L)==="project"?g(o)("Project automation"):g(o)("Thread automation")},[w("h3",uM,O(g(ue)==="edit"?g(o)("Edit automation"):g(o)("Add automation")),1),w("p",cM,O(g(Ct)),1),g(se)&&g(ue)==="create"?(P(),D("div",dM,[M[45]||(M[45]=w("span",{class:"automation-thread-label"},"Target",-1)),w("div",fM,[w("button",{class:ct(["automation-target-mode",{"is-active":g(le)==="thread"}]),type:"button",onClick:M[20]||(M[20]=I=>g(io)("thread"))}," Existing chat ",2),w("button",{class:ct(["automation-target-mode",{"is-active":g(le)==="project"}]),type:"button",onClick:M[21]||(M[21]=I=>g(io)("project"))}," Project ",2)]),w("div",hM,[Be(xi,{modelValue:g(Ne),"onUpdate:modelValue":M[22]||(M[22]=I=>$n(Ne)?Ne.value=I:null),class:"automation-thread-dropdown",options:g(dt),placeholder:g(le)==="project"?"Select project":"Select chat","enable-search":"","search-placeholder":g(le)==="project"?"Search projects":"Search chats"},null,8,["modelValue","options","placeholder","search-placeholder"])])])):me("",!0),g(ft).length>0?(P(),D("div",{key:1,class:"automation-thread-list","aria-label":g(L)==="project"?"Project automations":"Thread automations"},[(P(!0),D(at,null,Ht(g(ft),I=>(P(),D("button",{key:I.id,class:ct(["automation-thread-list-item",{"is-active":I.id===g(H)}]),type:"button",onClick:X=>g(qo)(I.id)},[w("span",null,O(I.name),1),w("small",null,O(I.status==="PAUSED"?"Paused":"Active"),1)],10,mM))),128)),w("button",{class:"automation-thread-list-item automation-thread-list-add",type:"button",onClick:M[23]||(M[23]=(...I)=>g(Ur)&&g(Ur)(...I))},O(g(o)("Add another automation")),1)],8,pM)):me("",!0),w("label",gM,[w("span",vM,O(g(o)("Name")),1),xn(w("input",{"onUpdate:modelValue":M[24]||(M[24]=I=>g(Ve).name=I),class:"rename-thread-input",type:"text",placeholder:g(o)("Automation name")},null,8,yM),[[Nn,g(Ve).name]])]),w("label",wM,[w("span",bM,O(g(o)("Prompt")),1),xn(w("textarea",{"onUpdate:modelValue":M[25]||(M[25]=I=>g(Ve).prompt=I),class:"automation-thread-textarea",rows:"6",placeholder:g(o)("Describe what the automation should do")},null,8,TM),[[Nn,g(Ve).prompt]])]),w("div",SM,[w("span",kM,O(g(o)("Schedule")),1),w("div",CM,[w("button",{class:ct(["automation-schedule-mode",{"is-active":g(Ke).mode==="daily"}]),type:"button",onClick:M[26]||(M[26]=I=>g(so)("daily"))},O(g(o)("Daily")),3),w("button",{class:ct(["automation-schedule-mode",{"is-active":g(Ke).mode==="interval"}]),type:"button",onClick:M[27]||(M[27]=I=>g(so)("interval"))},O(g(o)("Interval")),3),w("button",{class:ct(["automation-schedule-mode",{"is-active":g(Ke).mode==="advanced"}]),type:"button",onClick:M[28]||(M[28]=I=>g(so)("advanced"))}," RRULE ",2)]),g(Ke).mode==="daily"?(P(),D("div",xM,[w("span",IM,O(g(o)("Run every day at")),1),xn(w("input",{"onUpdate:modelValue":M[29]||(M[29]=I=>g(Ke).dailyTime=I),class:"automation-schedule-time",type:"time",onInput:M[30]||(M[30]=(...I)=>g(Kn)&&g(Kn)(...I))},null,544),[[Nn,g(Ke).dailyTime]])])):g(Ke).mode==="interval"?(P(),D("div",AM,[w("span",_M,O(g(o)("Run every")),1),xn(w("input",{"onUpdate:modelValue":M[31]||(M[31]=I=>g(Ke).interval=I),class:"automation-schedule-number",type:"number",min:"1",step:"1",onInput:M[32]||(M[32]=(...I)=>g(Kn)&&g(Kn)(...I))},null,544),[[Nn,g(Ke).interval,void 0,{number:!0}]]),Be(xi,{class:"automation-schedule-unit-dropdown","model-value":g(Ke).intervalUnit,options:g(Y),placeholder:g(o)("Unit"),"onUpdate:modelValue":g(gn)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])])):me("",!0),g(Ke).mode==="advanced"?xn((P(),D("input",{key:2,"onUpdate:modelValue":M[33]||(M[33]=I=>g(Ve).rrule=I),class:"rename-thread-input",type:"text",placeholder:"FREQ=DAILY;BYHOUR=9;BYMINUTE=0",onInput:M[34]||(M[34]=(...I)=>g(yr)&&g(yr)(...I))},null,544)),[[Nn,g(Ve).rrule]]):me("",!0),w("p",PM,O(g(_t)),1)]),w("div",EM,[w("span",MM,O(g(o)("Status")),1),Be(xi,{class:"automation-thread-dropdown","model-value":g(Ve).status,options:g(pe),placeholder:g(o)("Status"),"onUpdate:modelValue":g(Wo)},null,8,["model-value","options","placeholder","onUpdate:modelValue"])]),g(Me)?(P(),D("p",RM,O(g(Me)),1)):g(Ae)?(P(),D("p",LM,O(g(Ae)),1)):me("",!0),w("div",jM,[g(ue)==="edit"&&g(L)==="thread"?(P(),D("button",{key:0,class:"rename-thread-button",type:"button",disabled:g(ze)||g($e),onClick:M[35]||(M[35]=(...I)=>g(Vo)&&g(Vo)(...I))},O(g($e)?g(o)("Running…"):g(o)("Run now")),9,NM)):me("",!0),g(ue)==="edit"?(P(),D("button",{key:1,class:"rename-thread-button rename-thread-button-danger",type:"button",disabled:g(ze)||g($e),onClick:M[36]||(M[36]=(...I)=>g(Ta)&&g(Ta)(...I))},O(g(o)("Remove")),9,$M)):me("",!0),w("button",{class:"rename-thread-button",type:"button",disabled:g(ze)||g($e),onClick:M[37]||(M[37]=(...I)=>g(Go)&&g(Go)(...I))},O(g(o)("Cancel")),9,OM),w("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",disabled:g(ze)||g($e),onClick:M[38]||(M[38]=(...I)=>g(Ir)&&g(Ir)(...I))},O(g(ze)?g(o)("Saving…"):g(o)("Save")),9,DM)])],8,lM)])):me("",!0)]))],2))}}),BM=kt(FM,[["__scopeId","data-v-0b490210"]]),UM={class:"content-header"},zM=["title"],HM={class:"content-actions"},WM=cn({__name:"ContentHeader",props:{title:{},accent:{type:Boolean}},setup(e){return(t,n)=>(P(),D("header",UM,[w("div",{class:ct(["content-leading",{"is-accent":e.accent}])},[xr(t.$slots,"leading",{},void 0)],2),w("h1",{class:ct(["content-title",{"is-accent":e.accent}]),title:e.title},O(e.title),11,zM),w("div",HM,[xr(t.$slots,"actions",{},void 0)])]))}}),qM=kt(WM,[["__scopeId","data-v-413c4c2d"]]),GM={},VM={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function KM(e,t){return P(),D("svg",VM,[...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 ic=kt(GM,[["render",KM]]),YM=["thread","panel","view","navigate"],JM={thread:"Thread",panel:"Panel",view:"View",navigate:"Navigate"},QM=[{id:"thread.new",title:"Start a new thread",group:"thread",keywords:["new","chat","新建","新线程"]},{id:"thread.rename",title:"Rename the current thread",group:"thread",keywords:["title","重命名","标题"],requiresThread:!0},{id:"thread.archive",title:"Archive the current thread",group:"thread",keywords:["delete","归档","删除"],requiresThread:!0},{id:"thread.fork",title:"Fork the current thread",group:"thread",keywords:["branch","copy","派生","分叉"],requiresThread:!0},{id:"thread.copy-markdown",title:"Copy the conversation as Markdown",group:"thread",keywords:["export","md","导出","复制对话"],requiresThread:!0},{id:"thread.copy-last-code-block",title:"Copy last code block",group:"thread",keywords:["code","snippet","clipboard","代码块","复制代码"],requiresThread:!0},{id:"thread.compact",title:"Compact the current thread context",group:"thread",keywords:["compress","summarize","压缩","上下文"],requiresThread:!0},{id:"thread.interrupt",title:"Stop the running turn",group:"thread",keywords:["cancel","abort","interrupt","中断","停止"],requiresThread:!0},{id:"thread.implement-plan",title:"Implement the current plan",group:"thread",keywords:["execute","approve","执行","计划"],requiresThread:!0},{id:"panel.git",title:"Open the Git panel",group:"panel",keywords:["diff","changes","git","变更"]},{id:"panel.files",title:"Open the files panel",group:"panel",keywords:["explorer","files","文件"]},{id:"panel.terminal",title:"Toggle the terminal panel",group:"panel",keywords:["shell","console","终端"],shortcut:"Mod+J"},{id:"panel.toggle",title:"Toggle the side panel",group:"panel",keywords:["right","layout","侧边栏"]},{id:"panel.close",title:"Close the side panel",group:"panel",keywords:["hide","right","关闭"]},{id:"view.toggle-sidebar",title:"Toggle the sidebar",group:"view",keywords:["collapse","sidebar","侧栏"],shortcut:"Mod+B"},{id:"view.search-threads",title:"Search threads",group:"view",keywords:["filter","find","搜索","筛选"]},{id:"view.cycle-theme",title:"Cycle the color theme",group:"view",keywords:["dark","light","system","theme","暗色","亮色","主题"]},{id:"view.cycle-chat-width",title:"Cycle the chat width",group:"view",keywords:["wide","layout","宽度"]},{id:"view.toggle-language",title:"Switch the interface language",group:"view",keywords:["language","chinese","english","语言","中文"]},{id:"view.send-with-enter",title:"Toggle send with Enter",group:"view",keywords:["keyboard","enter","回车"]},{id:"view.in-progress-send-mode",title:"Cycle the in-progress send mode",group:"view",keywords:["steer","queue","队列"]},{id:"view.shortcuts",title:"Keyboard shortcuts",group:"view",keywords:["keys","bindings","help","快捷键","帮助"]},{id:"nav.skills",title:"Open the skills page",group:"navigate",keywords:["plugins","mcp","技能"]},{id:"nav.automations",title:"Open the automations page",group:"navigate",keywords:["schedule","cron","自动化"]},{id:"nav.recycle-bin",title:"Open the recycle bin",group:"navigate",keywords:["trash","deleted","回收站"]},{id:"nav.settings",title:"Open settings",group:"navigate",keywords:["preferences","config","设置"]}];function XM(e,t){if(t<=0)return!0;const n=e[t-1]??"";return n===" "||n==="-"||n==="/"||n==="."||n==="_"}function Gg(e,t){const n=t.trim().toLowerCase();if(!n)return 0;const r=e.toLowerCase();if(!r)return null;let o=0,a=0,s=0,i=-1;for(let l=0;l<n.length;l+=1){const c=n[l];if(c===" ")continue;let d=-1;for(let m=a;m<r.length;m+=1)if(r[m]===c){d=m;break}if(d<0)return null;i<0&&(i=d),s=d===a?s+1:1,o+=10+s*6,XM(e,d)&&(o+=12),a=d+1}return o-=i*2,o-=Math.floor((r.length-n.length)/4),o}function ZM(e,t){const n=t.trim();if(!n)return[...e];const r=[];return e.forEach((o,a)=>{const s=Gg(o.title,n);if(s!==null){r.push({command:o,score:s,keywordOnly:!1,index:a});return}let i=null;for(const l of o.keywords??[]){const c=Gg(l,n);c!==null&&(i===null||c>i)&&(i=c)}i!==null&&r.push({command:o,score:i,keywordOnly:!0,index:a})}),r.sort((o,a)=>Number(o.keywordOnly)-Number(a.keywordOnly)||a.score-o.score||o.index-a.index),r.map(o=>o.command)}function eR(e){return YM.map(t=>({group:t,label:JM[t],commands:e.filter(n=>n.group===t)})).filter(t=>t.commands.length>0)}const tR=["aria-label"],nR={class:"command-palette-search"},rR=["placeholder"],oR={class:"command-palette-count","aria-hidden":"true"},aR={class:"command-palette-group-label"},sR=["aria-selected","onClick"],iR={class:"command-palette-row-title"},lR={key:0,class:"command-palette-row-shortcut"},uR={key:0,class:"command-palette-empty"},cR=cn({__name:"CommandPalette",props:{commands:{}},emits:["close","run"],setup(e,{emit:t}){const n=e,r=t,{t:o}=ao(),a=S(""),s=S(0),i=S(null),l=S(null),c=J(()=>ZM(n.commands,a.value)),d=J(()=>eR(c.value)),m=J(()=>d.value.flatMap(_=>_.commands));ot(c,()=>{s.value=0}),ot(s,async()=>{var W;await Et();const j=Array.from(((W=l.value)==null?void 0:W.querySelectorAll(".command-palette-row"))??[])[s.value];j instanceof HTMLElement&&j.scrollIntoView({block:"nearest"})});function f(_){return m.value.indexOf(_)}function v(_){const j=m.value.length;j!==0&&(s.value=(s.value+_+j)%j)}function T(_){r("run",_.id)}function k(){const _=m.value[s.value];_&&T(_)}function N(_){if(_.key==="ArrowDown"){_.preventDefault(),v(1);return}if(_.key==="ArrowUp"){_.preventDefault(),v(-1);return}if(_.key==="Tab"){_.preventDefault(),v(_.shiftKey?-1:1);return}if(_.key==="Enter"){_.preventDefault(),k();return}_.key==="Escape"&&(_.preventDefault(),r("close"))}return es(async()=>{var _;await Et(),(_=i.value)==null||_.focus()}),(_,j)=>(P(),tt(Bs,{to:"body"},[w("div",{class:"command-palette-backdrop",role:"presentation",onClick:j[2]||(j[2]=W=>r("close"))},[w("section",{class:"command-palette",role:"dialog","aria-modal":"true","aria-label":g(o)("Command palette"),onClick:j[1]||(j[1]=gt(()=>{},["stop"]))},[w("div",nR,[Be(ic,{class:"command-palette-search-icon"}),xn(w("input",{ref_key:"inputRef",ref:i,"onUpdate:modelValue":j[0]||(j[0]=W=>a.value=W),class:"command-palette-input",type:"text",role:"combobox","aria-expanded":"true","aria-controls":"command-palette-list",placeholder:g(o)("Type a command..."),autocomplete:"off",spellcheck:"false",onKeydown:N},null,40,rR),[[Nn,a.value]]),w("span",oR,O(c.value.length)+"/"+O(n.commands.length),1)]),w("div",{id:"command-palette-list",ref_key:"listRef",ref:l,class:"command-palette-list",role:"listbox"},[(P(!0),D(at,null,Ht(d.value,W=>(P(),D(at,{key:W.group},[w("div",aR,O(g(o)(W.label)),1),(P(!0),D(at,null,Ht(W.commands,V=>(P(),D("button",{key:V.id,class:ct(["command-palette-row",{"is-active":f(V)===s.value}]),type:"button",tabindex:"-1",role:"option","aria-selected":f(V)===s.value,onClick:U=>T(V)},[w("span",iR,O(g(o)(V.title)),1),V.shortcut?(P(),D("span",lR,O(V.shortcut),1)):me("",!0)],10,sR))),128))],64))),128)),c.value.length===0?(P(),D("p",uR,O(g(o)("No matching commands")),1)):me("",!0)],512)],8,tR)])]))}}),dR=kt(cR,[["__scopeId","data-v-d7a0f5d2"]]),fR="Mod",Bw=[{id:"global",label:"Global",entries:[{id:"global.palette",keys:["Mod","/"],label:"Open the command palette"},{id:"global.sidebar",keys:["Mod","B"],label:"Toggle the sidebar"},{id:"global.terminal",keys:["Mod","J"],label:"Toggle the terminal panel"},{id:"global.dismiss",keys:["Esc"],label:"Close dialogs and popovers"}]},{id:"composer",label:"Composer",entries:[{id:"composer.send-enter",keys:["Enter"],label:"Send the message",note:'When "send with Enter" is on'},{id:"composer.send-mod-enter",keys:["Mod","Enter"],label:"Send the message",note:'When "send with Enter" is off'},{id:"composer.newline",keys:["Shift","Enter"],label:"Insert a line break"},{id:"composer.slash",keys:["/"],label:"Open the slash command menu"},{id:"composer.mention",keys:["@"],label:"Mention a file"},{id:"composer.move",keys:["↑"],alsoKeys:["↓"],label:"Move through the menu"},{id:"composer.accept",keys:["Enter"],alsoKeys:["Tab"],label:"Accept the highlighted suggestion"},{id:"composer.dismiss",keys:["Esc"],label:"Dismiss the menu"}]},{id:"navigation",label:"Navigation",entries:[{id:"navigation.move",keys:["↑"],alsoKeys:["↓"],label:"Move the selection"},{id:"navigation.activate",keys:["Enter"],alsoKeys:["Space"],label:"Activate the focused item"},{id:"navigation.ends",keys:["Home"],alsoKeys:["End"],label:"Jump to the first or last item"}]}];function hR(e,t){return e.map(n=>n===fR?t?"⌘":"Ctrl":t&&n==="Shift"?"⇧":n)}function Vg(e,t){return hR(e,t).join(t?"":" + ")}function pR(e,t){const n=[Vg(e.keys,t)];return e.alsoKeys&&e.alsoKeys.length>0&&n.push(Vg(e.alsoKeys,t)),n.join(" / ")}function mR(e=Bw){return e.reduce((t,n)=>t+n.entries.length,0)}const gR=["aria-label"],vR={class:"shortcut-help-header"},yR={class:"shortcut-help-title"},wR={class:"shortcut-help-count","aria-hidden":"true"},bR=["aria-label","title"],TR={class:"shortcut-help-body"},SR={class:"shortcut-help-group-label"},kR={class:"shortcut-help-list"},CR={class:"shortcut-help-keys"},xR={class:"shortcut-help-key"},IR={class:"shortcut-help-label"},AR={class:"shortcut-help-label-text"},_R={key:0,class:"shortcut-help-note"},PR={class:"shortcut-help-footer"},ER=cn({__name:"ShortcutHelpPanel",props:{isMac:{type:Boolean,default:!1}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,{t:o}=ao(),a=Bw,s=mR(),i=S(null);return es(async()=>{var l;await Et(),(l=i.value)==null||l.focus()}),(l,c)=>(P(),tt(Bs,{to:"body"},[w("div",{class:"shortcut-help-backdrop",role:"presentation",onClick:c[2]||(c[2]=d=>r("close"))},[w("section",{class:"shortcut-help",role:"dialog","aria-modal":"true","aria-label":g(o)("Keyboard shortcuts"),onClick:c[1]||(c[1]=gt(()=>{},["stop"]))},[w("header",vR,[w("h2",yR,O(g(o)("Keyboard shortcuts")),1),w("span",wR,O(g(s)),1),w("button",{ref_key:"closeButtonRef",ref:i,class:"shortcut-help-close",type:"button","aria-label":g(o)("Close"),title:g(o)("Close"),onClick:c[0]||(c[0]=d=>r("close"))},[Be(Ic,{class:"shortcut-help-close-icon"})],8,bR)]),w("div",TR,[(P(!0),D(at,null,Ht(g(a),d=>(P(),D("section",{key:d.id,class:"shortcut-help-group"},[w("h3",SR,O(g(o)(d.label)),1),w("dl",kR,[(P(!0),D(at,null,Ht(d.entries,m=>(P(),D("div",{key:m.id,class:"shortcut-help-row"},[w("dt",CR,[w("kbd",xR,O(g(pR)(m,n.isMac)),1)]),w("dd",IR,[w("span",AR,O(g(o)(m.label)),1),m.note?(P(),D("span",_R,O(g(o)(m.note)),1)):me("",!0)])]))),128))])]))),128))]),w("footer",PR,O(g(o)("Press Esc to close")),1)],8,gR)])]))}}),MR=kt(ER,[["__scopeId","data-v-31a7bebc"]]),Kg=.0025,ff=3,Yg=2,RR=256;function LR(e){var we;const t=S("idle"),n=S(typeof navigator<"u"&&!!((we=navigator.mediaDevices)!=null&&we.getUserMedia)),r=S(0),o=S(null);let a=null,s=null,i=[],l=null,c=null,d=null,m=null,f=[],v=!1,T=!1,k=null;function N(){k&&(k.abort(),k=null),t.value==="transcribing"&&(t.value="idle")}function _(){const te=o.value;if(!te||typeof window>"u")return;const ke=te.getContext("2d");if(!ke)return;const ee=Math.max(1,Math.floor(te.clientWidth)),Ce=Math.max(1,Math.floor(te.clientHeight||36)),De=window.devicePixelRatio||1,Ue=Math.max(1,Math.floor(ee*De)),Ee=Math.max(1,Math.floor(Ce*De));(te.width!==Ue||te.height!==Ee)&&(te.width=Ue,te.height=Ee),ke.setTransform(De,0,0,De,0,0),ke.clearRect(0,0,ee,Ce);const be=Math.max(12,Math.floor(ee/(ff+Yg))),Te=f.slice(-be),_e=Math.max(0,be-Te.length),xe=Ce/2,Je=getComputedStyle(te).color||"#000000";for(let Xe=0;Xe<be;Xe+=1){const rt=Te[Xe-_e]??0,B=Math.max(.08,Math.min(1,rt*18))*xe,ne=Xe*(ff+Yg);ke.globalAlpha=rt<=Kg?.35:1,ke.fillStyle=Je,ke.fillRect(ne,xe-B,ff,B*2)}ke.globalAlpha=1}function j(){f=[],r.value=0,_()}function W(){d&&(d.disconnect(),d.onaudioprocess=null,d=null),c&&(c.disconnect(),c=null),l&&(l.close(),l=null),m=null}function V(te){if(typeof window>"u")return;const ke=window.webkitAudioContext,ee=window.AudioContext??ke;ee&&(W(),j(),l=new ee,c=l.createMediaStreamSource(te),d=l.createScriptProcessor(2048,1,1),m=performance.now(),d.onaudioprocess=Ce=>{const De=Ce.inputBuffer.getChannelData(0);let Ue=0;for(let Ee=0;Ee<De.length;Ee+=1){const be=Math.abs(De[Ee]??0);Ue+=be<Kg?0:be}f.push(Ue/De.length),f.length>RR&&f.shift(),m!==null&&(r.value=Math.max(0,performance.now()-m)),_()},c.connect(d),d.connect(l.destination),_())}async function U(){var te;if(t.value==="transcribing"&&N(),!(t.value!=="idle"||!n.value||v)){v=!0,T=!1;try{s=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),i=[],a=new MediaRecorder(s),a.ondataavailable=ke=>{ke.data.size>0&&i.push(ke.data)},a.onstop=()=>{var Ce;const ke=i,ee=(a==null?void 0:a.mimeType)||((Ce=ke[0])==null?void 0:Ce.type)||"audio/webm";ve(),oe(ke,ee)},V(s),a.start(250),t.value="recording",T&&fe()}catch(ke){ve(),t.value="idle",(te=e.onError)==null||te.call(e,ke)}finally{v=!1}}}function fe(){if(v&&t.value==="idle"){T=!0;return}if(!(t.value!=="recording"||!a)&&a.state!=="inactive"){t.value="transcribing";try{a.requestData()}catch{}a.stop()}}function K(){T=!1,N(),ve(),t.value="idle"}async function oe(te,ke){var De,Ue,Ee,be,Te;if(te.length===0){(De=e.onEmpty)==null||De.call(e),t.value="idle";return}const ee=new Blob(te,{type:ke});t.value="transcribing";let Ce=null;try{const _e=ke.split(/[/;]/)[1]??"webm",xe=new FormData;xe.append("file",ee,`codex.${_e}`);const Je=((Ue=e.getLanguage)==null?void 0:Ue.call(e).trim())??"";Je&&Je.toLowerCase()!=="auto"&&xe.append("language",Je),Ce=new AbortController,k=Ce;const Xe=await fetch("/codex-api/transcribe",{method:"POST",body:xe,signal:Ce.signal}),rt=await Xe.text();let de=null;try{de=rt.trim()?JSON.parse(rt):null}catch{de=null}if(!Xe.ok){const ne=(Ee=de==null?void 0:de.error)==null?void 0:Ee.trim(),ae=rt.trim();throw new Error(ne||ae||`Transcription failed: ${Xe.status}`)}const B=((de==null?void 0:de.text)??"").trim();B.length>0?e.onTranscript(B):(be=e.onEmpty)==null||be.call(e)}catch(_e){if(_e instanceof DOMException&&_e.name==="AbortError")return;(Te=e.onError)==null||Te.call(e,_e)}finally{Ce&&k===Ce&&(k=null),t.value==="transcribing"&&(t.value="idle")}}function ve(){W(),j(),a&&(a.ondataavailable=null,a.onstop=null,a=null),s&&(s.getTracks().forEach(te=>te.stop()),s=null),i=[]}Ws(()=>{K()});function Pe(){if(t.value==="recording"){fe();return}(t.value==="idle"||t.value==="transcribing")&&U()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:o,startRecording:U,stopRecording:fe,toggleRecording:Pe,cancel:K}}const jR={},NR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function $R(e,t){return P(),D("svg",NR,[...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 OR=kt(jR,[["render",$R]]),DR={},FR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function BR(e,t){return P(),D("svg",FR,[...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 UR=kt(DR,[["render",BR]]),zR={},HR={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function WR(e,t){return P(),D("svg",HR,[...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 qR=kt(zR,[["render",WR]]),GR={},VR={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function KR(e,t){return P(),D("svg",VR,[...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 YR=kt(GR,[["render",KR]]),JR=["aria-label"],QR=8,gi=8,XR=cn({__name:"ComposerPopover",props:{open:{type:Boolean},align:{},width:{},panelClass:{},ariaLabel:{}},emits:["update:open"],setup(e,{expose:t,emit:n}){const r=e,o=n,a=S(null),s=S(null),i=S({});let l=!1;const c=J(()=>r.open),d=J(()=>r.width==="lg"?"composer-popover-panel--lg":"composer-popover-panel--md");function m(_,j,W){return Math.min(Math.max(j,_),W)}function f(){var Pe,we;if(!c.value)return;const _=a.value;if(!_||typeof window>"u")return;const j=_.getBoundingClientRect(),W=window.innerWidth,V=window.innerHeight,U=Math.max(0,W-gi*2),fe=Math.min(((Pe=s.value)==null?void 0:Pe.offsetWidth)??288,U),K=((we=s.value)==null?void 0:we.offsetHeight)??0;let oe;r.align==="end"?oe=j.right-fe:r.align==="center"?oe=j.left+(j.width-fe)/2:oe=j.left,oe=m(oe,gi,Math.max(gi,W-fe-gi));let ve=j.top-K-QR;ve=m(ve,gi,Math.max(gi,V-K-gi)),i.value={position:"fixed",left:`${oe}px`,right:"auto",top:`${ve}px`,bottom:"auto",width:`${fe}px`}}function v(){l||typeof window>"u"||(window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),window.addEventListener("orientationchange",f),l=!0)}function T(){!l||typeof window>"u"||(window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0),window.removeEventListener("orientationchange",f),l=!1)}ot(c,_=>{if(!_){T(),i.value={};return}v(),Et(()=>{var j;(j=s.value)==null||j.focus(),f(),window.requestAnimationFrame(f)})}),Ws(()=>{T()});function k(){o("update:open",!r.open)}function N(_){var K,oe,ve;if(_.key==="Escape"){o("update:open",!1);return}const j=s.value;if(!j)return;const W=Array.from(j.querySelectorAll("button")).filter(Pe=>!Pe.disabled&&Pe.offsetParent!==null);if(W.length===0)return;if(_.key==="Home"){_.preventDefault(),(K=W[0])==null||K.focus();return}if(_.key==="End"){_.preventDefault(),(oe=W[W.length-1])==null||oe.focus();return}if(_.key!=="ArrowDown"&&_.key!=="ArrowUp")return;_.preventDefault();let V=W.findIndex(Pe=>Pe===document.activeElement);V<0&&(V=_.key==="ArrowDown"?-1:0);const U=_.key==="ArrowDown"?1:-1,fe=(V+U+W.length)%W.length;(ve=W[fe])==null||ve.focus()}return t({root:a}),(_,j)=>(P(),D("div",{ref_key:"rootRef",ref:a,class:"composer-popover-anchor"},[xr(_.$slots,"trigger",{toggle:k,isOpen:c.value},void 0),Be(ku,{name:"composer-popover"},{default:pt(()=>[c.value?(P(),D("div",{key:0,ref_key:"panelRef",ref:s,class:ct(["composer-popover-panel",[d.value,e.panelClass]]),style:Zr(i.value),role:"menu",tabindex:"-1","aria-label":e.ariaLabel,onKeydown:N},[xr(_.$slots,"default",{},void 0,!0)],46,JR)):me("",!0)]),_:3})],512))}}),_c=kt(XR,[["__scopeId","data-v-1fb1570a"]]),ZR=["aria-label"],eL={class:"composer-popover-group-label"},tL=["aria-selected","onMousedown"],nL={class:"thread-composer-slash-body"},rL={class:"thread-composer-slash-name"},oL={class:"thread-composer-slash-desc"},aL={class:"thread-composer-slash-kind"},sL={class:"composer-popover-group-label composer-popover-group-label--skills"},iL=["aria-selected","onMousedown"],lL=["aria-label","title"],uL={class:"thread-composer-slash-body thread-composer-slash-body--skill"},cL={class:"thread-composer-slash-skill-name"},dL={class:"thread-composer-slash-desc thread-composer-slash-desc--skill"},fL=cn({__name:"ComposerSlashMenu",props:{commands:{},highlightedIndex:{}},emits:["select"],setup(e,{emit:t}){const n=e,r=t,{t:o}=ao(),a=S(null),s=J(()=>n.commands.filter(m=>m.group!=="skill")),i=J(()=>n.commands.filter(m=>m.group==="skill"));ot(()=>n.highlightedIndex,async()=>{var m,f;await Et(),(f=(m=a.value)==null?void 0:m.querySelector(".is-active"))==null||f.scrollIntoView({block:"nearest"})});function l(m){return o(m==="rpc"?"Action":m==="text"?"Prompt":m==="skill"?"Skill":"Local")}function c(m){return m==="system"?"S":m==="repo"?"R":m==="plugin"?"P":"U"}function d(m){return o(m==="system"?"System":m==="repo"?"Repo":m==="plugin"?"Plugin":"User")}return(m,f)=>(P(),D("div",{ref_key:"rootRef",ref:a,class:"composer-popover",role:"listbox","aria-label":g(o)("Commands")},[s.value.length>0?(P(),D(at,{key:0},[w("div",eL,O(g(o)("Commands")),1),(P(!0),D(at,null,Ht(s.value,(v,T)=>(P(),D("button",{key:v.id,class:ct(["thread-composer-slash-row",{"is-active":T===e.highlightedIndex}]),type:"button",role:"option","aria-selected":T===e.highlightedIndex,onMousedown:gt(k=>r("select",v),["prevent"])},[f[0]||(f[0]=w("span",{class:"thread-composer-slash-prefix","aria-hidden":"true"},"/",-1)),w("span",nL,[w("span",rL,O(v.id),1),w("span",oL,O(g(o)(v.description)),1)]),w("span",aL,O(l(v.kind)),1)],42,tL))),128))],64)):me("",!0),i.value.length>0?(P(),D(at,{key:1},[w("div",sL,O(g(o)("Skills")),1),(P(!0),D(at,null,Ht(i.value,(v,T)=>(P(),D("button",{key:v.skillPath||v.id,class:ct(["thread-composer-slash-row thread-composer-slash-row--skill",{"is-active":s.value.length+T===e.highlightedIndex}]),type:"button",role:"option","aria-selected":s.value.length+T===e.highlightedIndex,onMousedown:gt(k=>r("select",v),["prevent"])},[w("span",{class:ct(["thread-composer-slash-skill-icon",`is-${v.scope||"user"}`]),"aria-label":d(v.scope),title:d(v.scope)},O(c(v.scope)),11,lL),w("span",uL,[w("span",cL,O(v.displayName||v.id),1),w("span",dL,O(v.description),1)])],42,iL))),128))],64)):me("",!0)],8,ZR))}}),hL=kt(fL,[["__scopeId","data-v-bc518c3f"]]),pL=["data-streaming"],mL=["aria-expanded"],gL={class:"thread-composer-plan-panel-title"},vL={key:0,class:"thread-composer-plan-panel-badge"},yL={class:"thread-composer-plan-panel-progress"},wL=["title"],bL=["data-status"],TL={class:"thread-composer-plan-panel-latest-text"},SL={class:"thread-composer-plan-panel-popover-content"},kL={class:"thread-composer-plan-panel-popover-scroll"},CL={class:"thread-composer-plan-panel-popover-head"},xL={class:"thread-composer-plan-panel-title"},IL={class:"thread-composer-plan-panel-progress"},AL={key:0,class:"thread-composer-plan-panel-popover-section"},_L={class:"thread-composer-plan-panel-section-label"},PL=["title"],EL={class:"thread-composer-plan-panel-popover-section"},ML={class:"thread-composer-plan-panel-section-label"},RL={class:"thread-composer-plan-panel-steps"},LL=["data-status"],jL=["data-status"],NL=["title"],$L={class:"thread-composer-plan-panel-popover-footer"},OL=["disabled","data-state"],DL=cn({__name:"ThreadComposerPlanPanel",props:{planPanel:{}},emits:["implement-plan"],setup(e,{emit:t}){const n=e,r=t,{t:o}=ao(),a=S(!1),s=J(()=>{var f;return(((f=n.planPanel)==null?void 0:f.steps)??[]).filter(v=>v.status==="completed").length}),i=J(()=>{var f;const m=((f=n.planPanel)==null?void 0:f.steps)??[];if(m.length===0)return null;for(let v=m.length-1;v>=0;v-=1){const T=m[v];if(T.status==="inProgress")return T}return m[m.length-1]}),l=J(()=>{var T,k,N;const m=((k=(T=n.planPanel)==null?void 0:T.explanation)==null?void 0:k.trim())??"";if(!m)return"";const f=((N=m.split(/[。!?!?\n]/u)[0])==null?void 0:N.trim())??"";if(!f)return m;const v=80;return f.length>v?`${f.slice(0,v)}…`:f});function c(m){switch(m){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function d(){a.value=!1,r("implement-plan")}return(m,f)=>(P(),D("div",{class:"thread-composer-plan-panel","data-streaming":e.planPanel.streaming},[Be(_c,{open:a.value,align:"center",width:"lg","panel-class":"thread-composer-plan-panel-popover","aria-label":g(o)("Plan"),"onUpdate:open":f[1]||(f[1]=v=>a.value=v)},{trigger:pt(()=>{var v,T;return[w("button",{type:"button",class:"thread-composer-plan-panel-header","aria-expanded":a.value,onClick:f[0]||(f[0]=k=>a.value=!a.value)},[f[2]||(f[2]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",gL,O(g(o)("Plan")),1),e.planPanel.streaming?(P(),D("span",vL,O(g(o)("Updating")),1)):me("",!0),w("span",yL,O(s.value)+"/"+O(e.planPanel.steps.length),1),w("span",{class:"thread-composer-plan-panel-latest",title:((v=i.value)==null?void 0:v.step)??""},[i.value?(P(),D("span",{key:0,class:"thread-composer-plan-panel-latest-status","data-status":i.value.status},O(c(i.value.status)),9,bL)):me("",!0),w("span",TL,O(((T=i.value)==null?void 0:T.step)??""),1)],8,wL),Be(Ds,{class:"thread-composer-plan-panel-chevron"})],8,mL)]}),default:pt(()=>[w("div",SL,[w("div",kL,[w("header",CL,[f[3]||(f[3]=w("span",{class:"thread-composer-plan-panel-icon","aria-hidden":"true"},"🗒",-1)),w("span",xL,O(g(o)("Plan")),1),w("span",IL,O(s.value)+"/"+O(e.planPanel.steps.length),1)]),e.planPanel.explanation?(P(),D("section",AL,[w("p",_L,O(g(o)("Summary")),1),w("p",{class:"thread-composer-plan-panel-explanation",title:e.planPanel.explanation},O(l.value),9,PL)])):me("",!0),w("section",EL,[w("p",ML,O(g(o)("Steps"))+" ("+O(e.planPanel.steps.length)+")",1),w("ol",RL,[(P(!0),D(at,null,Ht(e.planPanel.steps,(v,T)=>(P(),D("li",{key:`composer-plan-${e.planPanel.id}-${T}`,class:"thread-composer-plan-panel-step","data-status":v.status},[w("span",{class:"thread-composer-plan-panel-step-status","data-status":v.status},O(c(v.status)),9,jL),w("span",{class:"thread-composer-plan-panel-step-text",title:v.step},O(v.step),9,NL)],8,LL))),128))])])]),w("footer",$L,[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:d},O(e.planPanel.implemented?g(o)("Plan executed"):e.planPanel.streaming?g(o)("Implementing…"):g(o)("Implement plan")),9,OL)])])]),_:1},8,["open","aria-label"])],8,pL))}}),FL=kt(DL,[["__scopeId","data-v-970a9351"]]),BL={key:0,class:"thread-composer-attachments"},UL=["src"],zL=["src","alt"],HL=["aria-label","disabled","onClick"],WL={key:1,class:"thread-composer-folder-chips"},qL=["title"],GL={class:"thread-composer-folder-chip-meta"},VL=["aria-label","disabled","onClick"],KL={key:2,class:"thread-composer-file-chips"},YL=["title"],JL=["aria-label","disabled","onClick"],QL={key:3,class:"thread-composer-skill-chips"},XL=["title","aria-label","onClick"],ZL=["aria-label","onClick"],ej=cn({__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,r=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function o(l){const c=l.trim();return c?!!(/^video\/|^data:video\//i.test(c)||r.test(c)):!1}function a(l){return l.total<=0?0:Math.round(l.processed/l.total*100)}function s(l){const c=l.trim();return c?c.endsWith("/SKILL.md")?c:`${c.replace(/\/+$/,"")}/SKILL.md`:""}function i(l){const c=s(l.path);!c||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(c)}`,"_blank","noopener,noreferrer")}return(l,c)=>(P(),D(at,null,[e.selectedImages.length>0?(P(),D("div",BL,[(P(!0),D(at,null,Ht(e.selectedImages,d=>(P(),D("div",{key:d.id,class:"thread-composer-attachment"},[o(d.url)?(P(),D("video",{key:0,class:"thread-composer-attachment-image",src:d.url,controls:"",preload:"metadata"},null,8,UL)):(P(),D("img",{key:1,class:"thread-composer-attachment-image",src:d.url,alt:d.name||"Selected image"},null,8,zL)),w("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${d.name||"image"}`,disabled:e.isInteractionDisabled,onClick:m=>n("remove-image",d.id)}," x ",8,HL)]))),128))])):me("",!0),e.folderUploadGroups.length>0?(P(),D("div",WL,[(P(!0),D(at,null,Ht(e.folderUploadGroups,d=>(P(),D("span",{key:d.id,class:"thread-composer-folder-chip"},[Be(zh,{class:"thread-composer-folder-chip-icon"}),w("span",{class:"thread-composer-folder-chip-name",title:d.name},O(d.name),9,qL),w("span",GL,[d.isUploading?(P(),D(at,{key:0},[Ns(O(a(d))+"% uploading ("+O(d.processed)+"/"+O(d.total)+") ",1)],64)):(P(),D(at,{key:1},[Ns(O(d.filePaths.length)+" file"+O(d.filePaths.length===1?"":"s"),1)],64))]),w("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${d.name}`,disabled:e.isInteractionDisabled,onClick:m=>n("remove-folder",d.id)},"×",8,VL)]))),128))])):me("",!0),e.standaloneFileAttachments.length>0?(P(),D("div",KL,[(P(!0),D(at,null,Ht(e.standaloneFileAttachments,d=>(P(),D("span",{key:d.fsPath,class:"thread-composer-file-chip"},[Be(Cl,{class:"thread-composer-file-chip-icon"}),w("span",{class:"thread-composer-file-chip-name",title:d.fsPath},O(d.label),9,YL),w("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${d.label}`,disabled:e.isInteractionDisabled,onClick:m=>n("remove-file",d.fsPath)},"×",8,JL)]))),128))])):me("",!0),e.selectedSkills.length>0?(P(),D("div",QL,[(P(!0),D(at,null,Ht(e.selectedSkills,d=>(P(),D("span",{key:d.path,class:"thread-composer-skill-chip"},[w("button",{class:"thread-composer-skill-chip-name",type:"button",title:s(d.path),"aria-label":`Open ${d.displayName||d.name} SKILL.md`,onClick:m=>i(d)},O(d.displayName||d.name),9,XL),w("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${d.displayName||d.name}`,onClick:m=>n("remove-skill",d.path)},"×",8,ZL)]))),128))])):me("",!0)],64))}}),tj=kt(ej,[["__scopeId","data-v-7ba5474c"]]),nj=cn({__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,r=t,{t:o}=ao(),a=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"}],s=J(()=>{var N;const T=(N=n.modelReasoningEfforts)==null?void 0:N[n.selectedModel];if(T===void 0)return a;const k=new Set(T);return a.filter(_=>k.has(_.value))});function i(T){return T.trim().replace(/^gpt/i,"GPT")}const l=J(()=>n.models.map(T=>({value:T,label:i(T)}))),c=J(()=>n.disabled||!n.activeThreadId),d=J(()=>/^gpt-5\.(?:4|5)(?:$|-)/.test(n.selectedModel.trim())),m=J(()=>n.selectedSpeedMode==="fast"&&d.value);function f(T){r("update:selected-model",T)}function v(T){r("update:selected-reasoning-effort",T)}return(T,k)=>(P(),D(at,null,[Be(xi,{class:"thread-composer-control thread-composer-model-control","model-value":e.selectedModel,options:l.value,"selected-prefix-icon":m.value?td:null,placeholder:g(o)("Model"),"open-direction":"up",variant:"pill",disabled:c.value||e.models.length===0,"enable-search":"","search-placeholder":g(o)("Search models..."),"onUpdate:modelValue":f},null,8,["model-value","options","selected-prefix-icon","placeholder","disabled","search-placeholder"]),Be(xi,{class:"thread-composer-control thread-composer-thinking-control","model-value":e.selectedReasoningEffort,options:s.value,placeholder:g(o)("Thinking"),"open-direction":"up",variant:"pill",disabled:c.value||s.value.length===0,"onUpdate:modelValue":v},null,8,["model-value","options","placeholder","disabled"])],64))}}),rj=kt(nj,[["__scopeId","data-v-245f3391"]]),oj=["aria-label","disabled"],aj=["disabled"],sj=["disabled"],ij=["disabled"],lj={class:"thread-composer-attach-mode"},uj={class:"thread-composer-attach-mode-label"},cj={class:"thread-composer-attach-mode-buttons"},dj=["disabled"],fj=["disabled"],hj={class:"thread-composer-attach-mode"},pj={class:"thread-composer-attach-mode-label"},mj={class:"thread-composer-attach-mode-buttons"},gj=["disabled","onClick"],vj={class:"thread-composer-attach-mode"},yj={class:"thread-composer-attach-mode-label"},wj={class:"thread-composer-attach-mode-buttons"},bj=["disabled","onClick"],Tj={key:0,class:"thread-composer-menu-error",role:"alert"},Sj={key:0,class:"thread-composer-approval-tip",role:"status"},kj=cn({__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:r}=ao();function o(){n("toggle")}function a(m){n("set-active-mode",m)}function s(){n("select-photo")}function i(){n("select-folder")}function l(){n("capture-camera")}function c(m){n("select-collaboration-mode",m)}function d(m){n("select-approval-policy",m)}return(m,f)=>(P(),tt(_c,{open:e.open,align:"start",width:"lg","aria-label":g(r)("Add photos & files"),"onUpdate:open":f[2]||(f[2]=v=>n("update:open",v))},{trigger:pt(()=>[w("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":g(r)("Add photos & files"),disabled:e.isInteractionDisabled,onClick:o}," + ",8,oj)]),default:pt(()=>[w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:s},O(g(r)("Add photos & files")),9,aj),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:i},O(g(r)("Add folder")),9,sj),w("button",{class:"thread-composer-attach-item",type:"button",disabled:e.isInteractionDisabled,onClick:l},O(g(r)("Take photo")),9,ij),f[5]||(f[5]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",lj,[w("span",uj,O(g(r)("In-progress send")),1),w("div",cj,[w("button",{class:ct(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="steer"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[0]||(f[0]=v=>a("steer"))},O(g(r)("Steer")),11,dj),w("button",{class:ct(["thread-composer-attach-mode-button",{"is-active":e.activeInProgressMode==="queue"}]),type:"button",disabled:e.isInteractionDisabled,onClick:f[1]||(f[1]=v=>a("queue"))},O(g(r)("Queue")),11,fj)])]),e.isMobile?(P(),D(at,{key:0},[f[3]||(f[3]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",hj,[w("span",pj,O(g(r)("Plan mode")),1),w("div",mj,[(P(!0),D(at,null,Ht(e.collaborationModeChoices,v=>(P(),D("button",{key:`mobile-plan-${v.value}`,class:ct(["thread-composer-attach-mode-button",{"is-active":e.selectedCollaborationMode===v.value}]),type:"button",disabled:v.disabled||e.isComposerConfigDisabled,onClick:T=>c(v.value)},O(g(r)(v.labelKey)),11,gj))),128))])]),f[4]||(f[4]=w("div",{class:"thread-composer-attach-separator"},null,-1)),w("div",vj,[w("span",yj,O(g(r)("Approval policy")),1),w("div",wj,[(P(!0),D(at,null,Ht(e.approvalPolicyChoices,v=>(P(),D("button",{key:`mobile-approval-${v.value}`,class:ct(["thread-composer-attach-mode-button",{"is-active":e.approvalPolicy===v.value}]),type:"button",disabled:e.isApprovalPolicySaving,onClick:T=>d(v.value)},O(g(r)(v.label)),11,bj))),128))])]),e.approvalPolicyError?(P(),D("p",Tj,O(e.approvalPolicyError),1)):me("",!0),Be(ku,{name:"approval-tip"},{default:pt(()=>[e.approvalPolicyNotice?(P(),D("span",Sj,O(e.approvalPolicyNotice),1)):me("",!0)]),_:1})],64)):me("",!0)]),_:1},8,["open","aria-label"]))}}),Cj=kt(kj,[["__scopeId","data-v-4d71ea67"]]),xj=/(^|\s)(\/[a-zA-Z]*)$/,Jg=[{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 Ij(e){var r,o,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:((r=s.description)==null?void 0:r.trim())||"Run this skill",kind:"skill",group:"skill",skillPath:s.path,displayName:((o=s.displayName)==null?void 0:o.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 Aj(e){const t=e.match(xj);if(!t)return null;const n=t[2]??"";return{query:n.slice(1).toLowerCase(),token:n,startIndex:e.length-n.length}}function _j(e,t){const n=t.trim().toLowerCase();if(!n)return e;const r=e.filter(o=>o.id===n);return r.length>0?r:e.filter(o=>o.id.startsWith(n))}const Pj={class:"thread-composer-main"},Ej={class:"thread-composer-input-row"},Mj={key:0,class:"thread-composer-drop-overlay","aria-hidden":"true"},Rj={class:"thread-composer-drop-overlay-copy"},Lj={key:1,class:"composer-popover"},jj=["onMousedown"],Nj={key:1,class:"thread-composer-file-mention-icon-markdown"},$j={class:"thread-composer-file-mention-text"},Oj={class:"thread-composer-file-mention-name"},Dj={key:0,class:"thread-composer-file-mention-dir"},Fj={key:1,class:"thread-composer-file-mention-empty"},Bj={key:2,class:"thread-composer-file-mention-empty"},Uj=["placeholder","disabled"],zj=["aria-label","title","disabled"],Hj={class:"thread-composer-actions"},Wj=["aria-label","title","disabled"],qj={key:0,class:"thread-composer-stop-spinner","aria-hidden":"true"},Gj=["aria-label","title","disabled"],Vj={key:0,class:"thread-composer-secondary"},Kj=["aria-label","disabled"],Yj={class:"thread-composer-plan-trigger-label"},Jj=["aria-checked","disabled","onClick"],Qj={class:"thread-composer-menu-item-copy"},Xj={class:"thread-composer-menu-item-title"},Zj={key:0,class:"thread-composer-menu-item-sub"},eN={key:1,class:"thread-composer-menu-item-hint"},tN={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},nN=["aria-label","disabled"],rN={class:"thread-composer-approval-trigger-label"},oN=["aria-checked","disabled","onClick"],aN={class:"thread-composer-menu-item-copy"},sN={class:"thread-composer-menu-item-title"},iN={key:0,class:"thread-composer-menu-item-check","aria-hidden":"true"},lN={key:0,class:"thread-composer-menu-error",role:"alert"},uN={key:0,class:"thread-composer-approval-tip",role:"status"},cN=["title","aria-label"],dN={class:"thread-composer-context-usage-value"},fN={key:0,class:"thread-composer-context-usage-compact"},hN=["disabled"],pN=["disabled"],mN=["disabled"],hf=12e3,gN=2e3,vN="codex-web-local.thread-draft.v1.",yN=cn({__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 r=e,o=n,{t:a}=ao(),s=S(""),i=S([]),l=S([]),c=S([]),d=S([]),m=S(""),f=S(0),v=S(null),T=S(!1),{state:k,cancel:N}=LR({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:x=>{if(s.value=s.value?`${s.value}
|
|
58
|
+
${x}`:x,m.value="",r.dictationAutoSend!==!1){const $=r.isTurnInProgress?$e.value:"steer";Kn($);return}Et(()=>{var $;return($=V.value)==null?void 0:$.focus()})},onEmpty:()=>{m.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:x=>{if(x instanceof DOMException&&x.name==="NotAllowedError"){m.value="Microphone access was denied.";return}m.value=x instanceof Error?x.message:"Dictation failed."}}),_=S(null),j=S(null),W=S(null),V=S(null),{isMobile:U}=Rh(),fe=S(!1),K=S(!1),oe=S(!1),ve=S(null),Pe=S(""),we=S([]),te=S(!1),ke=S(0),ee=S(!1),Ce=S(null),De=S(""),Ue=S(0),Ee=S(Jg),be=J(()=>[...Jg,...Ij(r.skills??[])]),Te=S(!1),_e=S(!1);let xe=!1;const Je=S(0);let Xe=0,rt=null,de="",B=!1,ne=0,ae=0;const je=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let We="";const E=J(()=>{const x=new Set((r.collaborationModes??[]).map($=>$.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:!x.has("execplans")}]}),L=[{value:"on-request",label:"When Codex requests it"},{value:"untrusted",label:"Unless trusted"},{value:"never",label:"Never"}],H=J(()=>{const x=E.value.find($=>$.value===r.selectedCollaborationMode);return a(x?x.labelKey:"Plan mode")}),ue=J(()=>{const x=L.find($=>$.value===r.approvalPolicy);return a(x?x.label:"Approval policy")}),se=J(()=>r.selectedCollaborationMode==="plan"&&r.selectedModel.trim().length===0),le=J(()=>r.disabled||r.isUpdatingSpeedMode||!r.activeThreadId||se.value||f.value>0?!1:s.value.trim().length>0||i.value.length>0||c.value.length>0),Ne=J(()=>s.value.trim().length>0||i.value.length>0||l.value.length>0||c.value.length>0||d.value.length>0),Me=J(()=>{const x=new Set;for(const $ of d.value)for(const Z of $.filePaths)x.add(Z);return c.value.filter($=>!x.has($.fsPath))}),Ae=J(()=>r.disabled||!r.activeThreadId||r.externalSessionActive===!0),ye=J(()=>r.disabled||!r.activeThreadId),ze=J(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),$e=S(ze.value),Ve=J(()=>k.value==="recording"),Ke=J(()=>r.activeThreadId?se.value?a("Loading models for plan mode..."):a("Ask Codex anything, @ to add files, / for commands"):a("Select a thread to send a message")),ft=J(()=>s.value.trim().length>0||i.value.length>0||c.value.length>0),_t=J(()=>s.value.split(`
|
|
59
|
+
`).length),Ct=J(()=>Te.value||_t.value>=6||_e.value),dt=J(()=>Ho(r.threadTokenUsage??null)),Y=J(()=>{var x;return((x=dt.value)==null?void 0:x.summaryText)??""}),pe=J(()=>{var x;return((x=dt.value)==null?void 0:x.tooltipText)??""}),Ie=J(()=>{var x;return((x=dt.value)==null?void 0:x.tone)??"healthy"});function qe(){Ie.value!=="healthy"&&o("compact-context")}function Qe(x){if(!Number.isFinite(x))return"0";const $=Math.abs(x);return $>=1e6?`${($>=1e7?(x/1e6).toFixed(0):(x/1e6).toFixed(1)).replace(/\.0$/,"")}M`:$>=1e3?`${($>=1e5?(x/1e3).toFixed(0):(x/1e3).toFixed(1)).replace(/\.0$/,"")}k`:String(Math.round(x))}function xt(x){const $=Math.max(0,x.inputTokens-x.cachedInputTokens),Z=[`${Qe(x.totalTokens)} ${a("total")}`,`${Qe($)} ${a("input")}`];return x.cachedInputTokens>0&&Z.push(`${Qe(x.cachedInputTokens)} ${a("cached")}`),x.outputTokens>0&&Z.push(`${Qe(x.outputTokens)} ${a("output")}`),x.reasoningOutputTokens>0&&Z.push(`${Qe(x.reasoningOutputTokens)} ${a("reasoning")}`),Z.join(" · ")}function jt(x,$){if(!Number.isFinite(x)||!Number.isFinite($)||$<=0)return 0;if($<=hf){const At=Math.max(0,$-Math.max(0,x));return Math.max(0,Math.min(100,Math.round(At/$*100)))}const Z=$-hf,Le=Math.max(0,x-hf),Oe=Math.max(0,Z-Le);return Math.max(0,Math.min(100,Math.round(Oe/Z*100)))}function Ho(x){if(!x)return null;const $=x.modelContextWindow??null;if(typeof $!="number"||!Number.isFinite($)||$<=0)return null;const Z=Math.max(0,x.last.totalTokens),Le=jt(Z,$),Oe=Math.max(0,Math.min(100,100-Le)),At=Le<=15?"danger":Le<=35?"warning":"healthy";return{summaryText:`${Le}% · ${Qe(Z)} / ${Qe($)}`,tooltipText:[`${a("Context window")}: ${Le}% ${a("left")} (${Oe}% ${a("used")})`,`${a("In context")}: ${Z.toLocaleString()} / ${$.toLocaleString()} tokens`,`${a("Last turn")}: ${xt(x.last)}`,`${a("Session total")}: ${xt(x.total)}`].join(`
|
|
60
|
+
`),percentRemaining:Le,tone:At}}function Kn(x="steer"){var Z;const $=s.value.trim();if(le.value){if(o("submit",{text:$,imageUrls:i.value.map(Le=>Le.url),fileAttachments:[...c.value],skills:l.value.map(Le=>({name:Le.name,path:Le.path})),mode:x}),ts(r.activeThreadId),yr(),Te.value=!1,d.value=[],fe.value=!1,Ft(),je||U.value){(Z=V.value)==null||Z.blur();return}Et(()=>{var Le;return(Le=V.value)==null?void 0:Le.focus()})}}function gn(x){$e.value=x}function Wo(x){Je.value+=1,s.value=x.text,i.value=x.imageUrls.map(($,Z)=>({id:`queued-${Date.now()}-${Z}-${Math.random().toString(36).slice(2,8)}`,name:`${a("Image")} ${Z+1}`,url:$})),l.value=x.skills.map($=>(r.skills??[]).find(Z=>Z.path===$.path)??{name:$.name,displayName:void 0,description:"",path:$.path}),c.value=x.fileAttachments.map($=>({...$})),d.value=[],m.value="",v.value=null,f.value=0,fe.value=!1,Ft(),Dn(),ae+=1}function yr(){Wo({text:"",imageUrls:[],fileAttachments:[],skills:[]}),Te.value=!1}function so(x){return`${vN}${x}`}function qs(x){if(typeof window>"u")return null;const $=x.trim();if(!$)return null;try{const Z=window.localStorage.getItem(so($));if(!Z)return null;const Le=JSON.parse(Z);return typeof Le=="string"?{text:Le,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof Le.text=="string"?Le.text:"",imageUrls:Array.isArray(Le.imageUrls)?Le.imageUrls.filter(Oe=>typeof Oe=="string"):[],fileAttachments:Array.isArray(Le.fileAttachments)?Le.fileAttachments.filter(Oe=>!!Oe&&typeof Oe.label=="string"&&typeof Oe.path=="string"&&typeof Oe.fsPath=="string"):[],skills:Array.isArray(Le.skills)?Le.skills.filter(Oe=>!!Oe&&typeof Oe.name=="string"&&typeof Oe.path=="string"):[]}}catch{return null}}function ya(x,$){if(typeof window>"u")return;const Z=x.trim();if(Z)try{if($.text.trim().length>0||$.imageUrls.length>0||$.fileAttachments.length>0||$.skills.length>0){window.localStorage.setItem(so(Z),JSON.stringify($));return}window.localStorage.removeItem(so(Z))}catch{}}function ts(x){ya(x,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function wa(){return{text:s.value,imageUrls:i.value.map(x=>x.url),fileAttachments:c.value.map(x=>({...x})),skills:l.value.map(x=>({name:x.name,path:x.path}))}}function io(){o("interrupt")}function Ur(){const x=V.value;if(!x){_e.value=!1;return}_e.value=x.scrollHeight>x.clientHeight+2}function qo(){xe||(xe=!0,Et(()=>{xe=!1,Ur()}))}function Go(){Ae.value||(Te.value=!Te.value,qo(),Et(()=>{var x;return(x=V.value)==null?void 0:x.focus()}))}function Gs(x){o("update:selected-model",x)}function ba(x){if(x===r.selectedCollaborationMode){K.value=!1;return}o("update:selected-collaboration-mode",x),K.value=!1}function ns(x){if(x===r.selectedCollaborationMode){fe.value=!1;return}o("update:selected-collaboration-mode",x),fe.value=!1}function Ir(x){o("update:selected-reasoning-effort",x)}function Ta(x){r.approvalPolicy===x||r.isApprovalPolicySaving===!0||(o("update:approval-policy",x),o("save-approval-policy"))}function Vo(){r.dictationClickToToggle}function lo(){Ae.value||(fe.value=!fe.value,K.value=!1,oe.value=!1)}function uo(){ye.value||(K.value=!K.value,fe.value=!1,oe.value=!1)}function co(){ye.value||(oe.value=!oe.value,fe.value=!1,K.value=!1)}function Ko(){var x;(x=_.value)==null||x.click()}function Sa(){var x;(x=j.value)==null||x.click()}function Vs(){var x;(x=W.value)==null||x.click()}function vt(x){const $=i.value.find(Z=>Z.id===x);if($&&vn($.url)){const Z=wr($.url);Z&&Pt(Z)}i.value=i.value.filter(Z=>Z.id!==x)}function It(x){l.value=l.value.filter($=>$.path!==x)}function Pt(x){c.value=c.value.filter($=>$.fsPath!==x)}function an(x){const $=d.value.find(Le=>Le.id===x);if(!$)return;const Z=new Set($.filePaths);c.value=c.value.filter(Le=>!Z.has(Le.fsPath)),d.value=d.value.filter(Le=>Le.id!==x)}function Jt(x,$){const Z=x.replace(/\\/g,"/");if(c.value.some(At=>At.fsPath===Z))return;const Le=Z.split("/").filter(Boolean),Oe=($==null?void 0:$.trim())||Le[Le.length-1]||Z;c.value=[...c.value,{label:Oe,path:Z,fsPath:Z}]}function In(x){return x.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(x.name)}const Ar=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function _r(x){return x.type.startsWith("video/")?!0:Ar.test(x.name)}function vn(x){const $=x.trim();if(!$)return!1;if($.startsWith("data:video/"))return!0;try{const Z=new URL($,window.location.href);return Ar.test(Z.pathname)?!0:Z.pathname==="/codex-local-image"?Ar.test(Z.searchParams.get("path")??""):!1}catch{return Ar.test($)}}function wr(x){try{const $=new URL(x,window.location.href);return $.pathname!=="/codex-local-image"?"":decodeURIComponent($.searchParams.get("path")??"").replace(/\\/g,"/")}catch{return""}}function ka(x){return x?Array.from(x):[]}function ar(x){return x!==ae?!1:(f.value+=1,!0)}function Mt(x){x===ae&&(f.value=Math.max(0,f.value-1))}function Ca(x){if(x<=0)return;const $=v.value,Z=$?$.succeeded+$.failed:0;if(!$||Z>=$.total){v.value={total:x,succeeded:0,failed:0};return}v.value={...$,total:$.total+x}}function en(x){const $=v.value;$&&(v.value={...$,succeeded:$.succeeded+(x==="success"?1:0),failed:$.failed+(x==="failure"?1:0)})}function zr(){return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function Hr(x){const $=new Date,Z=[$.getFullYear(),String($.getMonth()+1).padStart(2,"0"),String($.getDate()).padStart(2,"0"),String($.getHours()).padStart(2,"0"),String($.getMinutes()).padStart(2,"0"),String($.getSeconds()).padStart(2,"0")].join("-"),Le=x.type.startsWith("image/")&&x.type.slice(6).replace(/[^a-z0-9]+/gi,"")||"png";return`pasted-image-${Z}.${Le}`}function tn(){const x=new Date;return`pasted-text-${[x.getFullYear(),String(x.getMonth()+1).padStart(2,"0"),String(x.getDate()).padStart(2,"0"),String(x.getHours()).padStart(2,"0"),String(x.getMinutes()).padStart(2,"0"),String(x.getSeconds()).padStart(2,"0")].join("-")}.txt`}function Pr(x){return x.name.trim()?x:new File([x],Hr(x),{type:x.type||"image/png",lastModified:Date.now()})}async function Tn(x,$){if(ar($))try{const Z=Pr(x),Le=await Gu(Z);if($!==ae)return;if(!Le){en("failure");return}i.value=[...i.value,{id:zr(),name:Z.name,url:`/codex-local-image?path=${encodeURIComponent(Le)}`}],en("success")}catch{$===ae&&en("failure")}finally{Mt($)}}async function Yo(x,$){if(ar($))try{const Z=await Gu(x);if($!==ae)return;if(!Z){en("failure");return}Jt(Z),en("success")}catch{$===ae&&en("failure")}finally{Mt($)}}async function Er(x,$){if(ar($))try{const Z=Pr(x),Le=await Gu(Z);if($!==ae)return;if(!Le){en("failure");return}const Oe=Le.replace(/\\/g,"/");i.value=[...i.value,{id:zr(),name:Z.name,url:`/codex-local-image?path=${encodeURIComponent(Oe)}`}],Jt(Oe),en("success")}catch{$===ae&&en("failure")}finally{Mt($)}}function Yn(x){const $=ka(x);if($.length===0)return;Ca($.length),fe.value=!1,Ft();const Z=ae;for(const Le of $)In(Le)?Tn(Le,Z):_r(Le)?Er(Le,Z):Yo(Le,Z)}function Wt(){ne=0,T.value=!1}function xa(x){return x?Array.from(x.types??[]).includes("Files"):!1}async function Ia(x){if(!x||x.length===0)return;const $=Je.value,Z=Array.from(x),Oe=(Z[0].webkitRelativePath||Z[0].name).split("/").filter(Boolean)[0]||"Folder",At=`${Date.now()}-${Math.random().toString(36).slice(2)}`;d.value=[...d.value,{id:At,name:Oe,total:Z.length,processed:0,filePaths:[],isUploading:!0}];const fn=Tt=>{$===Je.value&&(d.value=d.value.map(Pn=>Pn.id===At?Tt(Pn):Pn))};for(const Tt of Z)try{const Pn=await Gu(Tt);if($!==Je.value)return;if(Pn){const En=Tt.webkitRelativePath||Tt.name;Jt(Pn,En),fn(go=>({...go,processed:go.processed+1,filePaths:[...go.filePaths,Pn]}));continue}fn(En=>({...En,processed:En.processed+1}))}catch{fn(Pn=>({...Pn,processed:Pn.processed+1}))}fn(Tt=>({...Tt,isUploading:!1}))}function sr(x){x&&(x.value="")}function Mr(x){const $=x.target;Yn(($==null?void 0:$.files)??null),sr($),fe.value=!1}function Qt(x){const $=x.target;Yn(($==null?void 0:$.files)??null),sr($),fe.value=!1}function yn(x){const $=x.target;Ia(($==null?void 0:$.files)??null),sr($),fe.value=!1}function On(x){Ae.value||!xa(x.dataTransfer)||(x.preventDefault(),ne+=1,T.value=!0)}function fo(x){Ae.value||!xa(x.dataTransfer)||(x.preventDefault(),x.dataTransfer&&(x.dataTransfer.dropEffect="copy"),T.value=!0)}function Xt(x){T.value&&(x.preventDefault(),ne=Math.max(0,ne-1),ne===0&&Wt())}function Jo(x){var $;Ae.value||!xa(x.dataTransfer)||(x.preventDefault(),Wt(),Yn((($=x.dataTransfer)==null?void 0:$.files)??null))}function Jn(){!T.value&&ne===0||Wt()}function dn(x){var At,fn;if(Ae.value)return;const $=((At=x.clipboardData)==null?void 0:At.getData("text/plain"))??"";if($.length>=gN){x.preventDefault();const Tt=new File([$],tn(),{type:"text/plain",lastModified:Date.now()});Yn([Tt]);return}const Z=Array.from(((fn=x.clipboardData)==null?void 0:fn.items)??[]);if(Z.length===0)return;const Le=$.length>0,Oe=Z.filter(Tt=>Tt.kind==="file"&&Tt.type.startsWith("image/")).map(Tt=>Tt.getAsFile()).filter(Tt=>Tt instanceof File);Oe.length!==0&&(Le||x.preventDefault(),Yn(Oe))}function ho(){m.value&&(m.value=""),qo(),po(),Ks()}function Vt(x){if(x.isComposing||x.keyCode===229)return;if(te.value){if(x.key==="Escape"){x.preventDefault(),Ft();return}if(x.key==="ArrowDown"){x.preventDefault(),we.value.length>0&&(ke.value=(ke.value+1)%we.value.length);return}if(x.key==="ArrowUp"){if(x.preventDefault(),we.value.length>0){const Z=we.value.length;ke.value=(ke.value+Z-1)%Z}return}if(x.key==="Enter"||x.key==="Tab"){x.preventDefault();const Z=we.value[ke.value];Z?Aa(Z):Ft();return}}if(ee.value){if(x.key==="Escape"){x.preventDefault(),Dn();return}if(x.key==="ArrowDown"){x.preventDefault(),Ee.value.length>0&&(Ue.value=(Ue.value+1)%Ee.value.length);return}if(x.key==="ArrowUp"){if(x.preventDefault(),Ee.value.length>0){const Z=Ee.value.length;Ue.value=(Ue.value+Z-1)%Z}return}if(x.key==="Enter"||x.key==="Tab"){x.preventDefault();const Z=Ee.value[Ue.value];Z?ir(Z):Dn();return}}if(r.sendWithEnter!==!1?x.key==="Enter"&&!x.shiftKey:x.key==="Enter"&&(x.metaKey||x.ctrlKey)){x.preventDefault(),Kn(r.isTurnInProgress?$e.value:"steer");return}}function Ft(){if(te.value=!1,ve.value=null,Pe.value="",we.value=[],ke.value=0,B=!1,de){const x=de;de="",CI(x)}}function po(){const x=V.value;if(!x){Ft();return}const $=x.selectionStart??s.value.length,Le=s.value.slice(0,$).match(/(^|\s)(@[^\s@]*)$/);if(!Le){Ft();return}const Oe=Le[2]??"",At=Oe.length,fn=$-At;ee.value&&Dn(),ve.value=fn,Pe.value=Oe.slice(1),te.value=!0,Wr()}function Dn(){ee.value=!1,Ce.value=null,De.value="",Ue.value=0,Ee.value=be.value}function Ks(){const x=V.value;if(!x){Dn();return}const $=x.selectionStart??s.value.length,Z=s.value.slice(0,$),Le=Aj(Z);if(!Le){Dn();return}te.value&&Ft(),Ce.value=Le.startIndex,De.value=Le.query,Ee.value=_j(be.value,Le.query),Ue.value=0,ee.value=!0}function ir(x){const $=V.value,Z=Ce.value;if(Z!==null&&$){const Le=$.selectionStart??s.value.length;s.value=`${s.value.slice(0,Z)}${s.value.slice(Le)}`}if(Dn(),x.kind==="skill"){const Le=(r.skills??[]).find(At=>At.path===x.skillPath||At.name===x.id);Le&&!l.value.some(At=>At.path===Le.path)&&(l.value=[...l.value,{...Le}]);const Oe=s.value.trim();s.value=Oe.length>0?`${Oe} (Use the ${x.id} skill.)`:`Use the ${x.id} skill.`,Et(()=>{$==null||$.focus(),Ur()});return}if(x.kind==="rpc"){o("slash-command",x.id);return}x.kind==="text"&&x.insertText&&(s.value=s.value.trimEnd(),s.value=s.value.length>0?`${s.value} ${x.insertText}`:x.insertText),x.kind==="local"&&x.id==="clear"&&(s.value=""),Et(()=>{$==null||$.focus(),Ur()})}async function Wr(){if(!te.value)return;const x=(r.cwd??"").trim();if(!x){we.value=[],B=!0;return}B=!1,rt&&clearTimeout(rt);const $=++Xe;rt=setTimeout(async()=>{const Z=`composer-${$}`,Le=Pe.value;try{if(de||(await SI([x],Z),de=Z,o("register-fuzzy-session",Z)),await kI(de,Le),!te.value||$!==Xe)return;if(we.value=(r.fuzzyFileSearchResults??[]).map(Oe=>({path:Oe.path})),ke.value=0,we.value.length===0)try{const Oe=await cg(x,Le,20);if(!te.value||$!==Xe)return;we.value=Oe,ke.value=0}catch{if(!te.value||$!==Xe)return;we.value=[]}}catch{if(!te.value||$!==Xe)return;de="";try{const Oe=await cg(x,Le,20);if(!te.value||$!==Xe)return;we.value=Oe,ke.value=0}catch{if(!te.value||$!==Xe)return;we.value=[]}}},120)}function Aa(x){const $=V.value,Z=ve.value;if(Z!==null&&$){const Le=$.selectionStart??s.value.length;s.value=`${s.value.slice(0,Z)}${s.value.slice(Le)}`.trimEnd()}Jt(x.path),Ft(),Et(()=>$==null?void 0:$.focus())}function br(x){N(),Wo(x),Et(()=>{var $;($=V.value)==null||$.focus(),Ur()})}function Qo(x){const $=x.trim();$&&(s.value=s.value.trim()?`${s.value.trim()}
|
|
61
|
+
${$}`:$,Et(()=>{var Z;(Z=V.value)==null||Z.focus(),Ur()}))}function qr(x){const $=x.lastIndexOf("/");return $<0?x:x.slice($+1)}function Rr(x){const $=x.lastIndexOf("/");return $<=0?"":x.slice(0,$)}function mo(x){const $=qr(x),Z=$.lastIndexOf(".");return Z<=0?"":$.slice(Z+1).toLowerCase()}function yt(x){const $=mo(x);return $==="ts"?"TS":$==="tsx"?"TSX":$==="js"?"JS":$==="jsx"?"JSX":$==="json"?"{}":""}function An(x){const $=mo(x);return $.startsWith("ts")?"ts":$.startsWith("js")?"js":$==="json"?"json":"default"}function _n(x){const $=mo(x);return $==="md"||$==="mdx"}function Xo(x){if(!fe.value&&!K.value&&!oe.value)return;const $=x.target;$&&(typeof $.closest=="function"&&$.closest(".composer-popover-anchor")||(fe.value=!1,K.value=!1,oe.value=!1))}return es(()=>{document.addEventListener("click",Xo),window.addEventListener("drop",Jn),window.addEventListener("dragend",Jn),window.addEventListener("blur",Jn),qo()}),t({hydrateDraft:br,appendTextToDraft:Qo,hasUnsavedDraft:()=>Ne.value}),Ws(()=>{document.removeEventListener("click",Xo),window.removeEventListener("drop",Jn),window.removeEventListener("dragend",Jn),window.removeEventListener("blur",Jn),window.removeEventListener("pointerup",Vo),window.removeEventListener("pointercancel",Vo),window.removeEventListener("blur",Vo),rt&&clearTimeout(rt)}),ot(()=>r.activeThreadId,x=>{N(),We&&ya(We,wa()),yr();const $=qs(x);$&&(Wo($),ho()),We=x.trim()},{immediate:!0}),ot([s,i,c,l],()=>{We&&ya(We,wa())},{deep:!0}),ot(s,()=>{qo()}),ot(()=>r.cwd,()=>{te.value&&Wr()}),ot(()=>r.fuzzyFileSearchResults,x=>{!te.value||!de||(we.value=(x??[]).map($=>({path:$.path})),ke.value=0)}),ot(ze,x=>{$e.value=x}),(x,$)=>(P(),D("form",{class:"thread-composer",onSubmit:$[6]||($[6]=gt(Z=>Kn(e.isTurnInProgress?$e.value:"steer"),["prevent"]))},[w("div",{class:ct(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove,"thread-composer-shell--drag-active":T.value}])},[e.planPanel?(P(),tt(FL,{key:0,"plan-panel":e.planPanel,onImplementPlan:$[0]||($[0]=Z=>x.$emit("implement-plan"))},null,8,["plan-panel"])):me("",!0),Be(tj,{"selected-images":i.value,"folder-upload-groups":d.value,"standalone-file-attachments":Me.value,"selected-skills":l.value,"is-interaction-disabled":Ae.value,onRemoveImage:vt,onRemoveFolder:an,onRemoveFile:Pt,onRemoveSkill:It},null,8,["selected-images","folder-upload-groups","standalone-file-attachments","selected-skills","is-interaction-disabled"]),w("div",Pj,[w("div",Ej,[w("div",{class:ct(["thread-composer-input-wrap",{"thread-composer-input-wrap--drag-active":T.value,"thread-composer-input-wrap--expanded":Te.value}]),onDragenter:On,onDragover:fo,onDragleave:Xt,onDrop:Jo},[T.value?(P(),D("div",Mj,[w("span",Rj,O(g(a)("Drop images or files")),1)])):me("",!0),te.value?(P(),D("div",Lj,[we.value.length>0?(P(!0),D(at,{key:0},Ht(we.value,(Z,Le)=>(P(),D("button",{key:Z.path,class:ct(["thread-composer-file-mention-row",{"is-active":Le===ke.value}]),type:"button",onMousedown:gt(Oe=>Aa(Z),["prevent"])},[yt(Z.path)?(P(),D("span",{key:0,class:ct(["thread-composer-file-mention-icon-badge",`is-${An(Z.path)}`])},O(yt(Z.path)),3)):_n(Z.path)?(P(),D("span",Nj,"↓")):(P(),tt(Cl,{key:2,class:"thread-composer-file-mention-icon-file"})),w("span",$j,[w("span",Oj,O(qr(Z.path)),1),Rr(Z.path)?(P(),D("span",Dj,O(Rr(Z.path)),1)):me("",!0)])],42,jj))),128)):g(B)?(P(),D("div",Fj,O(g(a)("No searchable directory for this thread")),1)):(P(),D("div",Bj,O(g(a)("No matching files")),1))])):me("",!0),ee.value?(P(),tt(hL,{key:2,commands:Ee.value,"highlighted-index":Ue.value,onSelect:ir},null,8,["commands","highlighted-index"])):me("",!0),xn(w("textarea",{ref_key:"inputRef",ref:V,"onUpdate:modelValue":$[1]||($[1]=Z=>s.value=Z),class:"thread-composer-input",placeholder:Ke.value,disabled:Ae.value,onInput:ho,onKeydown:Vt,onPaste:dn},null,40,Uj),[[Nn,s.value]]),Ct.value?(P(),D("button",{key:3,class:"thread-composer-expand",type:"button","aria-label":Te.value?g(a)("Exit full screen composer"):g(a)("Expand composer"),title:Te.value?g(a)("Exit full screen composer"):g(a)("Expand composer"),disabled:Ae.value,onClick:Go},[Te.value?(P(),tt(qR,{key:0,class:"thread-composer-expand-icon"})):(P(),tt(UR,{key:1,class:"thread-composer-expand-icon"}))],8,zj)):me("",!0)],34),w("div",Hj,[e.isTurnInProgress&&!ft.value?(P(),D("button",{key:0,class:"thread-composer-stop",type:"button","aria-label":e.isStopPending?g(a)("Saving thread before stop is available"):g(a)("Stop"),title:e.isStopPending?g(a)("Saving thread before stop is available"):g(a)("Stop"),disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn||e.isStopPending||e.externalSessionActive===!0,onClick:io},[e.isStopPending?(P(),D("span",qj)):(P(),tt(YR,{key:1,class:"thread-composer-stop-icon"}))],8,Wj)):(P(),D("button",{key:1,class:ct(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&$e.value==="queue"}]),type:"button","aria-label":e.isCompacting?g(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress&&$e.value==="queue"?g(a)("Queue message"):g(a)("Send message"),title:e.isCompacting?g(a)("Compacting context — the message will send after compaction"):e.isTurnInProgress?`${g(a)("Send")} ${$e.value==="queue"?g(a)("Queue"):g(a)("Steer")}`:g(a)("Send"),disabled:!le.value,onClick:$[2]||($[2]=Z=>Kn(e.isTurnInProgress?$e.value:"steer"))},[Be(OR,{class:"thread-composer-submit-icon"})],10,Gj))])]),w("div",{class:ct(["thread-composer-controls",{"thread-composer-controls--recording":Ve.value}])},[Be(Cj,{open:fe.value,"is-mobile":g(U),"is-interaction-disabled":Ae.value,"is-composer-config-disabled":ye.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":E.value,"approval-policy-choices":L,"active-in-progress-mode":$e.value,"onUpdate:open":$[3]||($[3]=Z=>fe.value=Z),onToggle:lo,onSetActiveMode:gn,onSelectPhoto:Ko,onSelectFolder:Vs,onCaptureCamera:Sa,onSelectCollaborationMode:ns,onSelectApprovalPolicy:Ta},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"]),Be(rj,{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":Gs,"onUpdate:selectedReasoningEffort":Ir},null,8,["models","selected-model","model-reasoning-efforts","selected-reasoning-effort","selected-speed-mode","disabled","active-thread-id"]),g(U)?me("",!0):(P(),D("div",Vj,[Be(_c,{open:K.value,align:"start",width:"md","aria-label":g(a)("Plan mode"),"onUpdate:open":$[4]||($[4]=Z=>K.value=Z)},{trigger:pt(()=>[w("button",{class:ct(["thread-composer-plan-trigger",{"is-active":K.value}]),type:"button","aria-label":g(a)("Plan mode"),disabled:ye.value,onClick:uo},[w("span",Yj,O(H.value),1),Be(Ds,{class:"thread-composer-plan-trigger-chevron"})],10,Kj)]),default:pt(()=>[(P(!0),D(at,null,Ht(E.value,Z=>(P(),D("button",{key:Z.value,class:ct(["thread-composer-menu-item",{"is-active":e.selectedCollaborationMode===Z.value}]),type:"button",role:"menuitemradio","aria-checked":e.selectedCollaborationMode===Z.value,disabled:Z.disabled||ye.value,onClick:Le=>ba(Z.value)},[w("span",Qj,[w("span",Xj,O(g(a)(Z.labelKey)),1),Z.subLabel?(P(),D("span",Zj,O(Z.subLabel),1)):me("",!0),Z.disabled?(P(),D("span",eN,O(g(a)("Not supported by this Codex version")),1)):me("",!0)]),e.selectedCollaborationMode===Z.value?(P(),D("span",tN,"✓")):me("",!0)],10,Jj))),128))]),_:1},8,["open","aria-label"]),Be(_c,{open:oe.value,align:"center",width:"md","aria-label":g(a)("Approval policy"),"onUpdate:open":$[5]||($[5]=Z=>oe.value=Z)},{trigger:pt(()=>[w("button",{class:ct(["thread-composer-approval-trigger",{"is-active":oe.value}]),type:"button","aria-label":g(a)("Approval policy"),disabled:ye.value,onClick:co},[w("span",rN,O(ue.value),1),Be(Ds,{class:"thread-composer-approval-trigger-chevron"})],10,nN)]),default:pt(()=>[(P(),D(at,null,Ht(L,Z=>w("button",{key:Z.value,class:ct(["thread-composer-menu-item",{"is-active":e.approvalPolicy===Z.value}]),type:"button",role:"menuitemradio","aria-checked":e.approvalPolicy===Z.value,disabled:e.isApprovalPolicySaving,onClick:Le=>Ta(Z.value)},[w("span",aN,[w("span",sN,O(g(a)(Z.label)),1)]),e.approvalPolicy===Z.value?(P(),D("span",iN,"✓")):me("",!0)],10,oN)),64)),e.approvalPolicyError?(P(),D("p",lN,O(e.approvalPolicyError),1)):me("",!0),Be(ku,{name:"approval-tip"},{default:pt(()=>[e.approvalPolicyNotice?(P(),D("span",uN,O(e.approvalPolicyNotice),1)):me("",!0)]),_:1})]),_:1},8,["open","aria-label"])])),dt.value?(P(),D("button",{key:1,type:"button",class:ct(["thread-composer-context-usage-inline",{"is-warning":Ie.value==="warning","is-danger":Ie.value==="danger"}]),title:pe.value,"aria-label":g(a)("Context"),onClick:qe},[w("span",dN,O(Y.value),1),Ie.value!=="healthy"?(P(),D("span",fN,O(g(a)("Compact")),1)):me("",!0)],10,cN)):me("",!0)],2)])],2),w("input",{ref_key:"photoLibraryInputRef",ref:_,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:Ae.value,onChange:Mr},null,40,hN),w("input",{ref_key:"cameraCaptureInputRef",ref:j,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:Ae.value,onChange:Qt},null,40,pN),w("input",{ref_key:"folderPickerInputRef",ref:W,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:Ae.value,onChange:yn},null,40,mN)],32))}}),Qg=kt(yN,[["__scopeId","data-v-c87250dc"]]),Xg={hooks:{methods:["hooks/list"]},remoteControl:{methods:["remoteControl/status/read","remoteControl/enable","remoteControl/pairing/start","remoteControl/client/list"]},plugins:{methods:["plugin/list","plugin/read","plugin/install","plugin/uninstall"]},apps:{methods:["app/list"]},mcps:{methods:["mcpServerStatus/list"]},mcpReload:{methods:["config/mcpServer/reload"]},mcpLogin:{methods:["mcpServer/oauth/login"]},marketplace:{methods:["marketplace/add","marketplace/remove","marketplace/upgrade"]},pluginShare:{methods:["plugin/share/save","plugin/share/list","plugin/share/delete"]}};function Zg(e,t){return t.methods.every(n=>e.has(n))}const wN=["aria-label"],bN=["aria-checked","onClick"],TN={class:"runtime-toggle-option-label"},SN=cn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{t:r}=ao(),o=[{value:"local",label:r("Local project"),icon:zh},{value:"worktree",label:r("New worktree"),icon:Ac}];function a(s){n("update:modelValue",s)}return(s,i)=>(P(),D("div",{class:"runtime-toggle",role:"radiogroup","aria-label":g(r)("Continue in")},[(P(),D(at,null,Ht(o,l=>w("button",{key:l.value,class:ct(["runtime-toggle-option",{"is-selected":e.modelValue===l.value}]),type:"button",role:"radio","aria-checked":e.modelValue===l.value,onClick:c=>a(l.value)},[(P(),tt(Sh(l.icon),{class:"runtime-toggle-option-icon"})),w("span",TN,O(l.label),1)],10,bN)),64))],8,wN))}}),kN=kt(SN,[["__scopeId","data-v-b3c220d3"]]),CN={},xN={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 IN(e,t){return P(),D("svg",xN,[...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 Uw=kt(CN,[["render",IN]]),AN={},_N={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function PN(e,t){return P(),D("svg",_N,[...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 EN=kt(AN,[["render",PN]]),MN={class:"sidebar-thread-controls"},RN=["aria-label","title"],LN=["aria-label","title"],jN=cn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){const{t}=ao();return(n,r)=>(P(),D("div",MN,[w("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?g(t)("Expand sidebar"):g(t)("Collapse sidebar"),title:e.isSidebarCollapsed?g(t)("Expand sidebar"):g(t)("Collapse sidebar"),onClick:r[0]||(r[0]=o=>n.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(P(),tt(EN,{key:0,class:"sidebar-thread-controls-icon"})):(P(),tt(Uw,{key:1,class:"sidebar-thread-controls-icon"}))],8,RN),xr(n.$slots,"default",{},void 0),e.showNewThreadButton?(P(),D("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":g(t)("Start new thread"),title:g(t)("Start new thread"),onClick:r[1]||(r[1]=o=>n.$emit("start-new-thread"))},[Be(Cl,{class:"sidebar-thread-controls-icon"})],8,LN)):me("",!0)]))}}),ev=kt(jN,[["__scopeId","data-v-de38b7ee"]]),NN={},$N={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ON(e,t){return P(),D("svg",$N,[...t[0]||(t[0]=[w("circle",{cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.9"},null,-1),w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.9",d:"M12 8v4l3 2"},null,-1)])])}const tv=kt(NN,[["render",ON]]),DN={},FN={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function BN(e,t){return P(),D("svg",FN,[...t[0]||(t[0]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.9",d:"M4 7h16M4 12h16M4 17h10"},null,-1)])])}const nv=kt(DN,[["render",BN]]),UN={},zN={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function HN(e,t){return P(),D("svg",zN,[...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 WN=kt(UN,[["render",HN]]),qN={},GN={viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"};function VN(e,t){return P(),D("svg",GN,[...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 KN=kt(qN,[["render",VN]]),YN={},JN={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function QN(e,t){return P(),D("svg",JN,[...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 rv=kt(YN,[["render",QN]]);function zw(e){var o;const t=e.replace(/\r\n/g,`
|
|
62
|
+
`).trim();if(!t)return null;const n=[],r=[];for(const a of t.split(`
|
|
63
|
+
`)){const s=a.trim();if(!s){n.length===0&&r.push("");continue}const i=s.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(i){const l=(i[1]??" ").toLowerCase();let c="pending";l==="x"&&(c="completed"),(l==="~"||l===">"||l==="-")&&(c="inProgress"),n.push({step:((o=i[2])==null?void 0:o.trim())??"",status:c});continue}r.push(s)}if(n.length===0){const a=XN(t);return a||null}return{explanation:r.join(`
|
|
64
|
+
`).trim(),steps:n.filter(a=>a.step.length>0)}}function XN(e){var a,s;const t=[],n=[],r=[];for(const i of e.split(`
|
|
65
|
+
`)){const l=i.trim();if(!l){t.length===0&&n.length===0&&r.push("");continue}const c=l.match(/^\d+[.)]\s+(.+)$/);if(c){t.push({step:((a=c[1])==null?void 0:a.trim())??"",status:"pending"});continue}const d=l.match(/^[-*]\s+(.+)$/);if(d){n.push({step:((s=d[1])==null?void 0:s.trim())??"",status:"pending"});continue}r.push(l)}const o=t.length>0?t:n;return o.length===0?null:{explanation:ZN(r.join(`
|
|
66
|
+
`)),steps:o.filter(i=>i.step.length>0)}}function ZN(e){return e.split(`
|
|
67
|
+
`).map(t=>t.replace(/^\s*#{1,6}\s*/,"")).join(`
|
|
68
|
+
`).trim()}function ov(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}:zw(e.text)}function e$(e,t){var r;const n=e.find(o=>{var a;return typeof o.turnIndex=="number"&&o.turnIndex>t&&!!((a=o.turnId)!=null&&a.trim())});return((r=n==null?void 0:n.turnId)==null?void 0:r.trim())??""}function t$(e,t,n){return t?!e.some(r=>{var o;return((o=r.turnId)==null?void 0:o.trim())===t||typeof r.turnIndex=="number"&&r.turnIndex>n}):!0}const Hw="modelSwitch",Ww=20;function n$(e){return e.messageType===Hw}function zs(e){return e.role==="user"&&e.isAgentNote!==!0}function r$(e){return e.isAgentNote===!0?"agent-note":e.role==="user"?"user":e.messageType==="reasoning"?"reasoning":e.messageType==="plan"||e.messageType==="plan.live"?"plan":e.messageType==="fileChange"?"file-change":e.messageType==="commandExecution"||e.messageType==="toolCall"||e.messageType==="worked"?"process":"assistant"}function o$(e,t=!1){var n;return e.role==="assistant"&&e.messageType!=="reasoning"&&e.messageType!=="commandExecution"&&e.messageType!=="toolCall"&&e.messageType!=="worked"&&e.messageType!=="plan"&&e.messageType!=="plan.live"&&e.messageType!=="fileChange"&&(t||!((n=e.messageType)!=null&&n.endsWith(".live")))&&e.text.trim().length>0}function ez(e,t){var a,s;const n=[];let r=null;for(const i of e)(zs(i)||!r)&&(r={key:`turn-${i.id}`,items:[]},n.push(r)),r.items.push({message:i,kind:r$(i)});const o=n.length-1;for(let i=0;i<n.length;i+=1){const l=n[i],c=(s=(a=l.items.find(v=>{var T;return(T=v.message.turnId)==null?void 0:T.trim()}))==null?void 0:a.message.turnId)==null?void 0:s.trim(),d=t!==void 0&&"liveTurnId"in t;if((t==null?void 0:t.liveOverlayActive)===!0&&(d?c===(t==null?void 0:t.liveTurnId):i===o))continue;const f=[...l.items].reverse().find(v=>o$(v.message,(t==null?void 0:t.liveOverlayActive)===!1));f&&((t==null?void 0:t.liveOverlayActive)!==!1&&l.items.some(T=>typeof T.message.messageType=="string"&&T.message.messageType.endsWith(".live"))||(f.kind="final-assistant"))}return n}function qw(e){return e.replace(/\s+/g," ").trim()}function tz(e){const t=qw(e);return t.length<=80?t:t.slice(0,80)}function a$(e){const t=qw(e);return t.length<=80?t:t.slice(0,77)+"..."}function s$(e){return{sessionKey:e,expandedWarmTurns:new Set,coldPage:0}}function Hh(e,t){return e.sessionKey===t?e:s$(t)}function nz(e,t){const n=Hh(e,t);return{...n,coldPage:n.coldPage+1}}function rz(e,t,n){const r=Hh(e,t),o=Math.max(0,Math.floor(n));return r.coldPage>=o?r:{...r,coldPage:o}}function oz(e,t,n,r){const o=Hh(e,t),a=new Set(o.expandedWarmTurns);return r?a.add(n):a.delete(n),{...o,expandedWarmTurns:a}}function i$(e){return zs(e)}function l$(e){var t;return((t=e.messageType)==null?void 0:t.endsWith(".live"))===!0}function az(e){var a;const t=[];let n=-1,r=0;const o=(s,i)=>{t.push({userItem:s,assistantPreview:"",toolCount:0,startIdx:i,endIdx:e.length})};for(let s=0;s<e.length;s+=1){const i=e[s];if(i$(i)){if(n>=0)t[t.length-1].endIdx=s;else{t.push({userItem:i,assistantPreview:"",toolCount:0,startIdx:r,endIdx:e.length}),n=s,r=s;continue}n=s,o(i,s)}else if(n>=0&&t.length>0){const l=t[t.length-1],c=((a=i.text)==null?void 0:a.trim())||"";i.role==="assistant"&&!l$(i)&&c&&(l.assistantPreview=a$(c)),i.messageType==="toolCall"&&(l.toolCount+=1)}}return t}function sz({turnCount:e,hotTurns:t,pageSize:n,coldPage:r}){const o=Math.max(0,e),a=Math.max(0,t),s=Math.max(0,o-Math.min(o,a));if(s===0)return{warmStartTurn:0,warmEndTurn:0,coldTurnCount:0};const i=Math.max(0,n),l=Math.max(0,Math.floor(r)),c=Math.min(s,i*(l+1));return{warmStartTurn:s-c,warmEndTurn:s,coldTurnCount:s-c}}function iz({turn:e,turnCount:t,hotTurns:n,pageSize:r}){const o=Math.max(0,t),a=Math.max(0,n),s=Math.max(0,o-Math.min(o,a));if(s===0||e>=s)return 0;const i=Math.max(1,r),l=Math.max(0,Math.floor(e)),c=s-l;return Math.max(0,Math.ceil(c/i)-1)}function lz(e,t,n){if(t.length===0)return e.slice(0);if(n>=t.length)return[];const r=t[n].startIdx;return e.slice(r)}const ga="__new-thread__",Gw="__new-thread-provider__::";function Vw(e){return e==="plan"?"plan":"default"}function Ii(e){return typeof e=="string"?e.trim():""}function Oo(){return Object.create(null)}function lc(e){const t=Oo();for(const[n,r]of Object.entries(e))t[n]=r;return t}function au(e,t){if(!(t in e))return e;const n=Oo();for(const[r,o]of Object.entries(e))r!==t&&(n[r]=o);return n}function Kw(e,t){let n=!1;const r=Oo();for(const[o,a]of Object.entries(e)){if(o===ga||o.startsWith(Gw)||t.has(o)){r[o]=a;continue}n=!0}return n?r:e}function Ms(e){const t=e.trim().toLowerCase().replace(/_/g,"-");return!t||t==="openai"?"codex":t}function u$(e){return e===ga}function Qu(e){const t=Ms(e);return t?`${Gw}${t}`:""}function Wa(e){return e.trim()||ga}function pf(e,t){const n=Wa(t),r=Ii(e[n]);return r||Ii(e[ga])}function mf(e,t){const n=Wa(t);return Vw(e[n])}function av(e,t,n){const r=Wa(t);if(u$(r))return au(e,r);if(n==="plan"){const o=lc(e);return o[r]="plan",o}return au(e,r)}function c$(e){return new Promise(t=>{typeof window<"u"?window.setTimeout(t,e):globalThis.setTimeout(t,e)})}function tr(e){return e.flatMap(t=>t.threads)}function d$(e,t){var r,o;const n=e.findIndex(a=>a.id===t);return n<0?"":((r=e[n+1])==null?void 0:r.id)??((o=e[n-1])==null?void 0:o.id)??""}function Yw(e){return(e instanceof Error?e.message:String(e??"")).includes("Codex CLI is not available")}function f$(e){if(e instanceof Br&&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 h$(e,t){if(!e||!t)return!1;const n=new Date(e).getTime(),r=new Date(t).getTime();return!Number.isFinite(n)||!Number.isFinite(r)?!1:n>r}function p$(e,t,n){return h$(e,t??n)}function Jw(e,t,n){return Math.min(Math.max(e,t),n)}function ol(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 sv(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;return{totalTokens:ol(t.totalTokens)??0,inputTokens:ol(t.inputTokens)??0,cachedInputTokens:ol(t.cachedInputTokens)??0,outputTokens:ol(t.outputTokens)??0,reasoningOutputTokens:ol(t.reasoningOutputTokens)??0}}function m$(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=sv(t.total),r=sv(t.last);if(!n||!r)return null;const o=ol(t.modelContextWindow),a=r.totalTokens,s=typeof o=="number"?Math.max(o-a,0):null,i=typeof o=="number"&&o>0?Jw(Math.round((s??0)/o*100),0,100):null;return{total:n,last:r,modelContextWindow:o,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function al(e,t){const n=[];for(const r of e)n.includes(r)||n.push(r);for(const r of t)n.includes(r.projectName)||n.push(r.projectName);return Ga(e,n)?e:n}function Gf(e,t){const n=new Map(e.map(o=>[o.projectName,o])),r=t.map(o=>n.get(o)??null).filter(o=>o!==null);for(const o of e)t.includes(o.projectName)||r.push(o);return r}function Ga(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];if(n.length!==r.length)return!1;for(let o=0;o<n.length;o+=1)if(n[o]!==r[o])return!1;return!0}function g$(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const r=[...e],[o]=r.splice(t,1);return r.splice(n,0,o),r}function v$(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function y$(e=[],t=[]){var n,r,o,a;if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1)if(((n=e[s])==null?void 0:n.step)!==((r=t[s])==null?void 0:r.step)||((o=e[s])==null?void 0:o.status)!==((a=t[s])==null?void 0:a.status))return!1;return!0}function w$(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&y$(e.steps,t.steps)}function Xu(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 Vf(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Ga(e.images,t.images)&&b$(e.fileChanges,t.fileChanges)&&e.fileChangeStatus===t.fileChangeStatus&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&v$(e.commandExecution,t.commandExecution)&&w$(e.plan,t.plan)&&e.turnId===t.turnId&&e.turnIndex===t.turnIndex&&e.isAutomationRun===t.isAutomationRun&&e.automationDisplayName===t.automationDisplayName}function xl(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 iv(e,t,n={}){var T;const r=new Map(e.map(k=>[k.id,k])),o=new Map(t.map(k=>[k.id,k])),a=t.map(k=>{const N=r.get(k.id);return N&&Vf(N,k)?N:k});if(n.preserveMissing!==!0)return xl(e,a)?e:a;const s=e.map(k=>{const N=o.get(k.id);return!N||Vf(k,N)?k:N}).filter(k=>!ml(k)||!lv(k,t)),i=new Set(e.map(k=>k.id)),l=a.filter(k=>!i.has(k.id)),c=e.filter(ml);let d=[],m=l;if(c.length>0){const k=a.findIndex(N=>c.some(_=>lv(_,[N])));if(k>=0){const N=l.findIndex(_=>_.id===a[k].id);N>=0?(d=l.slice(0,N),m=l.slice(N)):(d=[],m=l)}else{const N=new Set(e.map(_=>{var j;return((j=_.turnId)==null?void 0:j.trim())??""}).filter(_=>_!==""));if(N.size>0){const _=[],j=[];for(const W of l){const V=((T=W.turnId)==null?void 0:T.trim())??"";V!==""&&N.has(V)?_.push(W):j.push(W)}d=_,m=j}}}const f=s.findIndex(ml),v=f>=0?[...s.slice(0,f),...d,...s.slice(f),...m]:[...s,...d,...m];return xl(e,v)?e:v}function b$(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){const r=e[n],o=t[n];if(r.path!==o.path||r.operation!==o.operation||r.movedToPath!==o.movedToPath||r.diff!==o.diff||r.addedLineCount!==o.addedLineCount||r.removedLineCount!==o.removedLineCount)return!1}return!0}function Xa(e){return e.replace(/\s+/gu," ").trim()}function ml(e){return e.messageType==="userMessage.optimistic"}function T$(e){return e.some(ml)}function lv(e,t){if(!zs(e))return!1;const n=Xa(e.text),r=Array.isArray(e.images)?e.images:[],o=Array.isArray(e.fileAttachments)?e.fileAttachments.length:0,a=Array.isArray(e.skills)?e.skills.length:0;return t.some(s=>{if(s===e||!zs(s)||ml(s))return!1;const i=Xa(s.text),l=Array.isArray(s.images)?s.images:[],c=Array.isArray(s.fileAttachments)?s.fileAttachments.length:0,d=Array.isArray(s.skills)?s.skills.length:0;return i===n&&Ga(l,r)&&c===o&&d===a})}function S$(e){const t=[];let n=new Map;for(const r of e){if(!(r.role==="assistant"&&typeof r.messageType=="string"&&(r.messageType==="agentMessage"||r.messageType==="agentMessage.live"))){zs(r)&&(n=new Map),t.push(r);continue}const a=Xa(r.text);if(a.length===0){t.push(r);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(r)}else n.set(a,t.length),t.push(r)}return t}function k$(e,t){const n=new Set(t.map(a=>a.id)),r=new Set(t.filter(a=>a.role==="assistant").map(a=>Xa(a.text)).filter(a=>a.length>0));if(r.size===0)return e;const o=e.filter(a=>{if(a.messageType!=="agentMessage.live")return!0;if(n.has(a.id))return!1;const s=Xa(a.text);return s.length===0?!1:!r.has(s)});return o.length===e.length?e:o}function rd(e,t){const n=e.findIndex(a=>a.id===t.id);if(n<0)return[...e,t];const r=e[n];if(Vf(r,t))return e;const o=[...e];return o.splice(n,1,t),o}const Wh="worked";function $s(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function C$(e){if(!Number.isFinite(e)||e<=0)return"<1s";const t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),o=t%60,a=[];n>0&&a.push(`${n}h`),(r>0||n>0)&&a.push(`${r}m`);const s=o>0||a.length===0?o:0;return a.push(`${s}s`),a.join(" ")}function x$(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function I$(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 Qw(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${C$(e.durationMs)}`,messageType:Wh,turnId:e.turnId,durationMs:e.durationMs}}function A$(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function _$(e,t){const n=Qw(t),r=e.filter(s=>s.messageType!==Wh),o=A$(r);if(o<0)return[...r,n];const a=[...r];return a.splice(o,0,n),a}function P$(e,t){var a;if(!t)return e;const n=new Set;for(const s of e)s.messageType===Wh&&s.turnId&&n.add(s.turnId);const r=new Set;for(const s of e){const i=((a=s.turnId)==null?void 0:a.trim())??"";i&&r.add(i)}const o=[];for(const[s,i]of Object.entries(t))!s||n.has(s)||r.has(s)&&(typeof i!="number"||!Number.isFinite(i)||i<=0||(o.push(Qw({turnId:s,durationMs:Math.round(i)})),n.add(s)));return o.length===0?e:[...e,...o]}function St(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function E$(e,t){if(t.size===0)return e;let n=!1;const r={};for(const[o,a]of Object.entries(e)){if(t.has(o)){n=!0;continue}r[o]=a}return n?r:e}function M$(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 R$(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 L$(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 on(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function Xw(e,t){const n=t.trim();if(!n)return e;let r=!1;const o=[];for(const a of e){const s=a.threads.filter(l=>l.id!==n),i=s.length!==a.threads.length;i&&(r=!0),s.length>0?o.push(i?{...a,threads:s}:a):a.threads.length===0&&o.push(a)}return r?o:e}function Pc(e,t){const n=new Map(e.map(o=>[o.projectName,o])),r=t.map(o=>{const a=n.get(o.projectName),s=new Map((a==null?void 0:a.threads.map(l=>[l.id,l]))??[]),i=o.threads.map(l=>{const c=s.get(l.id);return c&&M$(c,l)?c:l});return a&&a.projectName===o.projectName&&R$(a.threads,i)?a:{projectName:o.projectName,threads:i}});return L$(e,r)?e:r}function j$(e,t,n){const r=new Set(tr(t).map(i=>i.id)),o=tr(e).filter(i=>n[i.id]===!0&&!r.has(i.id));if(o.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 o){if(a.get(i.projectName)){const c=s.findIndex(d=>d.projectName===i.projectName);c>=0&&(s[c]={projectName:s[c].projectName,threads:[i,...s[c].threads]});continue}s.push({projectName:i.projectName,threads:[i]})}return s}function Ai(e){return to(e)}function N$(e){const t=e.trim();if(!t)return"";const n=t.lastIndexOf(":");return n>=0?t.slice(n+1):t}function $$(e){const t=e.label||to(e.remotePath),n=N$(e.hostId);return n?`${t} ${n}`:t}function Zw(e){const t=(e==null?void 0:e.remoteProjects)??[];return new Map(t.map(n=>[n.id,n]))}function od(e){if(!e)return[];const t=new Set(e.order),n=new Set((e.remoteProjects??[]).map(o=>o.id)),r=e.projectOrder.filter(o=>t.has(o)||n.has(o));for(const o of e.order)r.includes(o)||r.push(o);for(const o of n)r.includes(o)||r.push(o);return r}function Kf(e,t){const n=Zw(e);return od(e).map(r=>{if(n.has(r))return r;const o=nt(r).trim(),a=Ai(o);return t.has(a)?o:a})}function uc(e,t){return nt(e).trim()===t||Ai(e)===t}function O$(e,t){const n=new Set;for(const r of e.order)uc(r,t)&&n.add(r);for(const r of e.active)uc(r,t)&&n.add(r);for(const r of Object.keys(e.labels))uc(r,t)&&n.add(r);return n}function D$(e,t,n){var c,d;const r=new Set((e.remoteProjects??[]).map(m=>m.id)),o=new Map;for(const m of e.order){const f=Ai(m);o.has(f)||o.set(f,m)}for(const m of n){const f=((d=(c=m.threads[0])==null?void 0:c.cwd)==null?void 0:d.trim())??"";f&&o.set(m.projectName,f)}const a=[],s=m=>{m&&!a.includes(m)&&a.push(m)};for(const m of t){if(r.has(m)){s(m);continue}const f=o.get(m);f&&s(f)}for(const m of od(e))s(m);const i=a.filter(m=>e.order.includes(m));for(const m of e.order)i.includes(m)||i.push(m);const l=e.active.filter(m=>i.includes(m));return l.length===0&&i.length>0&&l.push(i[0]),{order:i,active:l,projectOrder:a}}function F$(e,t,n){const r=Kf(t,n);if(r.length===0)return e;const o=new Map(r.map((a,s)=>[a,s]));return[...e].sort((a,s)=>{if(Qf(a)||Qf(s))return 0;const i=o.get(a.projectName)??Number.POSITIVE_INFINITY,l=o.get(s.projectName)??Number.POSITIVE_INFINITY;return i===l?0:i-l})}function Yf(e,t){const n=new Map,r=new Map,o=s=>{const i=nt(s).trim();if(!i)return;const l=to(i),c=n.get(l)??new Set;c.add(i),n.set(l,c)};for(const s of(t==null?void 0:t.order)??[]){const i=nt(s).trim();if(!i)continue;const l=to(i);Ec(i)||r.set(l,(r.get(l)??0)+1),o(s)}for(const s of e)for(const i of s.threads){const l=nt(i.cwd).trim(),c=to(l),d=(t==null?void 0:t.order.some(m=>nt(m).trim()===l))===!0;Ec(l)&&!d&&r.get(c)===1||o(i.cwd)}const a=new Set;for(const[s,i]of n.entries())i.size>1&&a.add(s);return a}function Ec(e){return e.includes("/.codex/worktrees/")}function B$(e,t){const n=Yf(e,t);if(n.size===0)return e;const r=new Set,o=new Set,a=new Map,s=new Set;for(const c of(t==null?void 0:t.order)??[]){const d=nt(c).trim();if(!d||(s.add(d),Ec(d)))continue;const m=to(d);r.has(m)?(r.delete(m),o.add(m),a.delete(m)):o.has(m)||(r.add(m),a.set(m,d))}const i=[],l=new Map;for(const c of e)for(const d of c.threads){const m=nt(d.cwd).trim(),f=to(m),v=s.has(m),T=Ec(m)&&!v&&r.has(f);let k=c.projectName;T&&n.has(f)?k=a.get(f)??c.projectName:m&&n.has(f)&&(k=m);const N=d.projectName===k?d:{...d,projectName:k},_=l.get(k);if(_)_.threads.push(N);else{const j={projectName:k,threads:[N]};l.set(k,j),i.push(j)}}return i}function U$(e,t,n){if(!t||t.order.length===0&&(t.remoteProjects??[]).length===0)return e;const r=new Set(e.map(s=>s.projectName)),o=[...e],a=Zw(t);for(const s of od(t)){if(a.has(s)){if(r.has(s))continue;o.push({projectName:s,threads:[]}),r.add(s);continue}const i=nt(s).trim();if(!i)continue;const l=Ai(i),c=n.has(l)?i:l;r.has(c)||(o.push({projectName:c,threads:[]}),r.add(c))}return o}const Jf=20;function js(e){const t=e.split(`
|
|
69
|
+
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,Jf):"Untitled thread"}function z$(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function Qf(e){return e.threads.some(t=>t.cwd.trim().length===0||Cc(t.cwd))}const Fs=new Map;let cc=0;function gf(e,t){const n=`${e}:${t.id}`,r=Fs.get(n);return r!==void 0?r:(cc+=1,Fs.set(n,cc),cc)}function H$(e){const t=`${e}:`;for(const n of[...Fs.keys()])n.startsWith(t)&&Fs.delete(n)}function W$(){Fs.clear(),cc=0}function q$(e){if(Fs.size!==0)for(const t of[...Fs.keys()]){const n=t.indexOf(":"),r=n>0?t.slice(0,n):"";e.has(r)||Fs.delete(t)}}function uv(e,t){const n=t.trim();if(!n)return-1;const r=e.findIndex(i=>i.id===n);if(r>=0)return r;const o=`session-cmd-${n}`,a=e.findIndex(i=>i.id===o);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 cv(e){return e.replace(/\s+/g," ").trim().toLowerCase()}const dv=20;function G$(e,t){var o;const n=cv(e.text);if(n.length<dv)return!1;const r=((o=e.turnId)==null?void 0:o.trim())??"";return t.some(a=>{var i;if(a.messageType!=="reasoning"||r&&(((i=a.turnId)==null?void 0:i.trim())??"")!==r)return!1;const s=cv(a.text);return s.length<dv?!1:s.includes(n)||n.includes(s)})}function V$(e,t){var i,l,c;if(t.length===0)return e;const n=t.filter(d=>!G$(d,e));if(n.length===0)return e;t=n;const r=[...e],o=[],a=new Set(e.map(d=>{var m;return((m=d.turnId)==null?void 0:m.trim())??""}).filter(d=>d.length>0)),s=new Map;for(const d of t){const m=((i=d.reasoningAnchorMessageId)==null?void 0:i.trim())??"";if(m&&uv(r,m)>=0)continue;const f=d.turnIndex;if(typeof f!="number"||!Number.isFinite(f))continue;const v=s.get(f)??[];v.push(d),s.set(f,v)}for(const d of[...t].reverse()){const m=((l=d.reasoningAnchorMessageId)==null?void 0:l.trim())??"";if(m){const _=uv(r,m);if(_>=0){r.splice(_+1,0,d);continue}}const f=d.turnIndex;if(typeof f!="number"||!Number.isFinite(f)){const _=((c=d.turnId)==null?void 0:c.trim())??"";if(_&&!a.has(_))continue;o.push(d);continue}let v=-1,T=-1;const k=[];for(let _=0;_<r.length;_+=1)r[_].turnIndex===f&&(T=_,zs(r[_])?v=_:r[_].messageType!=="reasoning"&&k.push(_));if(k.some(_=>{const j=r[_].messageType;return j==="commandExecution"||j==="toolCall"||j==="fileChange"||j==="worked"})){const j=(s.get(f)??[]).indexOf(d),W=j>=0?j:0;r.splice(k[Math.min(W,k.length-1)]+1,0,d)}else if(v>=0)r.splice(v+1,0,d);else if(T>=0)r.splice(T+1,0,d);else continue}return o.length>0?[...r,...o.reverse()]:r}function K$(e,t,n){const r=new Set(n.map(s=>s.id)),o=new Map;for(const s of t)for(const i of s)r.has(i.id)||o.has(i.id)||o.set(i.id,i);const a=Array.from(o.values());for(const s of a)gf(e,s);return a.sort((s,i)=>gf(e,s)-gf(e,i))}function Y$(e,t,n,r,o){const a=K$(e,r,t),s=new Map;let i;for(let f=0;f<t.length;f+=1){const v=t[f];!zs(v)||!Number.isInteger(v.turnIndex)||v.turnIndex<0||(i!==void 0&&s.set(i,f),i=v.turnIndex)}if(i!==void 0){const f=t.findIndex(ml);s.set(i,f>=0?f:t.length)}const l=new Map,c=[];for(const f of a){const v=f.turnIndex,T=Number.isInteger(v)&&v>=0?s.get(v):void 0;if(T===void 0){c.push(f);continue}const k=l.get(T);k?k.push(f):l.set(T,[f])}const d=[];for(let f=0;f<=t.length;f+=1)d.push(...l.get(f)??[]),f<t.length&&d.push(t[f]);d.push(...c);const m=S$(d);return[...V$(m,n),...o]}const eb="codex-web-local.thread-read-state.v1",fv="codex-web-local.thread-unread-cutoff.v1",tb="codex-web-local.thread-token-usage.v1",nb="codex-web-local.thread-reasoning.v1",Xf="codex-web-local.thread-turn-durations.v1",rb="codex-web-local.thread-last-plan.v1",ob="codex-web-local.live-reasoning-snapshot.v1",ab="codex-web-local.thread-terminal-open.v1",Zf="codex-web-local.selected-thread-id.v1",eh="codex-web-local.selected-model-by-context.v1",sb="codex-web-local.selected-model-id.v1",ib="codex-web-local.project-order.v1",lb="codex-web-local.project-display-name.v1",th="codex-web-local.collaboration-mode-by-context.v1",J$="codex-web-local.collaboration-mode.v1";function Q$(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(eb);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function hv(e){typeof window>"u"||window.localStorage.setItem(eb,JSON.stringify(e))}function X$(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(nb);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Vl(e){if(!(typeof window>"u")){try{window.localStorage.setItem(nb,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e))t&&n.length>0&&p_(t,n)}}function Z$(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Xf);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r||!o||typeof o!="object"||Array.isArray(o))continue;const a={};for(const[s,i]of Object.entries(o))!s||typeof i!="number"||!Number.isFinite(i)||i<=0||(a[s]=Math.round(i));Object.keys(a).length>0&&(n[r]=a)}return n}catch{return{}}}let ub={};function cb(e){const t={};for(const[n,r]of Object.entries(e))n&&Object.keys(r).length>0&&(t[n]={...r});ub=t}function vf(e){if(!(typeof window>"u")){try{Object.keys(e).length===0?window.localStorage.removeItem(Xf):window.localStorage.setItem(Xf,JSON.stringify(e))}catch{}for(const[t,n]of Object.entries(e)){if(!t)continue;const r=ub[t]??{};for(const[o,a]of Object.entries(n))!o||typeof a!="number"||a<=0||r[o]!==a&&g_(t,o,a)}cb(e)}}function eO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(rb);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function db(e){if(!(typeof window>"u"))try{window.localStorage.setItem(rb,JSON.stringify(e))}catch{}}function tO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(ob);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){const a=o;typeof(a==null?void 0:a.text)=="string"&&a.text.trim()&&typeof a.ts=="number"&&(n[r]={text:a.text,ts:a.ts})}return n}catch{return{}}}function nO(){if(typeof window>"u")return"";const e=window.localStorage.getItem(fv);if(e)return e;const t=new Date().toISOString();return window.localStorage.setItem(fv,t),t}function rO(){if(typeof window>"u")return Oo();try{const n=window.localStorage.getItem(eh);if(n){const r=JSON.parse(n);if(!r||typeof r!="object"||Array.isArray(r))return Oo();const o=Oo();for(const[a,s]of Object.entries(r)){if(typeof a!="string"||a.length===0)continue;const i=Ii(s);i&&(o[a]=i)}return o}}catch{}const e=Ii(window.localStorage.getItem(sb)),t=Oo();return e&&(t[ga]=e),t}function Zu(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(eh):window.localStorage.setItem(eh,JSON.stringify(e)),window.localStorage.removeItem(sb)}catch{}}function oO(){if(typeof window>"u")return Oo();try{const e=window.localStorage.getItem(th);if(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return Oo();const n=Oo();for(const[r,o]of Object.entries(t)){if(typeof r!="string"||r.length===0)continue;const a=Vw(o);a==="plan"&&(n[r]=a)}return n}}catch{}return Oo()}function yf(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(th):window.localStorage.setItem(th,JSON.stringify(e)),window.localStorage.removeItem(J$)}catch{}}function aO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(tb);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r)continue;const a=m$(o);a&&(n[r]=a)}return n}catch{return{}}}function wf(e){typeof window>"u"||window.localStorage.setItem(tb,JSON.stringify(e))}const nh="codex-web-local.thread-model-switch-markers.v1",rh="codex-web-local.thread-scroll-state.v1",sO=24,iO=200;function fb(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;if(t.v!==1)return null;const n=t.coldPage;if(typeof n!="number"||!Number.isInteger(n)||n<0)return null;const r=t.distanceFromBottomPx;if(typeof r!="number"||!Number.isFinite(r)||r<0)return null;const o=t.savedAt;if(typeof o!="number"||!Number.isFinite(o)||o<=0)return null;const a=Array.isArray(t.expandedWarmTurns)?t.expandedWarmTurns:[],s=[];for(const c of a)typeof c=="number"&&Number.isInteger(c)&&c>=0&&!s.includes(c)&&s.push(c);const i=t.hotHeights,l={};if(i&&typeof i=="object"&&!Array.isArray(i)){for(const[c,d]of Object.entries(i))if(!(!c||typeof d!="number"||!Number.isFinite(d)||d<=0)&&(l[c]=d,Object.keys(l).length>=iO))break}return{v:1,coldPage:n,expandedWarmTurns:s,distanceFromBottomPx:r,hotHeights:l,savedAt:o}}function uz(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(rh);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r)continue;const a=fb(o);a&&(n[r]=a)}return n}catch{return{}}}function cz(e){if(!(typeof window>"u"))try{const t=Object.entries(e).filter(n=>!!n[0]&&fb(n[1])!==null).sort((n,r)=>r[1].savedAt-n[1].savedAt).slice(0,sO);if(t.length===0)window.localStorage.removeItem(rh);else{const n={};for(const[r,o]of t)n[r]=o;window.localStorage.setItem(rh,JSON.stringify(n))}}catch{}}function lO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(nh);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r||!Array.isArray(o))continue;const a=o.filter(s=>!!s&&typeof s=="object"&&n$(s)).slice(0,Ww);a.length>0&&(n[r]=a)}return n}catch{return{}}}function uO(e){if(!(typeof window>"u"))try{Object.keys(e).length===0?window.localStorage.removeItem(nh):window.localStorage.setItem(nh,JSON.stringify(e))}catch{}}function cO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(ab);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t))r&&typeof o=="boolean"&&(n[r]=o);return n}catch{return{}}}function dO(e){typeof window>"u"||window.localStorage.setItem(ab,JSON.stringify(e))}function fO(){return typeof window>"u"?"":window.localStorage.getItem(Zf)??""}function hO(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(Zf);return}window.localStorage.setItem(Zf,e)}}function pO(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(ib);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const r of t){if(typeof r!="string"||r.length===0)continue;const o=to(r);o.length>0&&!n.includes(o)&&n.push(o)}return n}catch{return[]}}function mO(e){typeof window>"u"||window.localStorage.setItem(ib,JSON.stringify(e))}function gO(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(lb);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){const a=typeof r=="string"?to(r):"";a.length>0&&typeof o=="string"&&(n[a]=o)}return n}catch{return{}}}function vO(e){typeof window>"u"||window.localStorage.setItem(lb,JSON.stringify(e))}const qh="codex-web-local.thread-message-snapshot.v1",yO=6,wO=384*1024;function Gh(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(qh);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){const a=o;!r||!a||typeof a!="object"||a.v!==1||!Array.isArray(a.messages)||a.messages.length===0||typeof a.savedAt!="number"||!Number.isFinite(a.savedAt)||(n[r]={v:1,savedAt:a.savedAt,hasMoreOlder:a.hasMoreOlder===!0,messages:a.messages,turnIndexByTurnId:a.turnIndexByTurnId&&typeof a.turnIndexByTurnId=="object"?a.turnIndexByTurnId:{}})}return n}catch{return{}}}function bO(e){return e?Gh()[e]??null:null}function pv(e){if(!(!e||typeof window>"u"))try{const t=Gh();if(!(e in t))return;delete t[e],window.localStorage.setItem(qh,JSON.stringify(t))}catch{}}function TO(e,t,n,r){if(!(!e||t.length===0||typeof window>"u"))try{const o=Gh(),a=SO(t);if(a.length===0)return;o[e]={v:1,savedAt:Date.now(),hasMoreOlder:r,messages:a,turnIndexByTurnId:n};const s=Object.entries(o).sort((l,c)=>c[1].savedAt-l[1].savedAt).slice(0,yO),i={};for(const[l,c]of s)i[l]=c;window.localStorage.setItem(qh,JSON.stringify(i))}catch{}}function SO(e){const t=[];let n=2;for(let r=e.length-1;r>=0;r-=1){let o="";try{o=JSON.stringify(e[r])??""}catch{continue}const a=o.length+1;if(t.length>0&&n+a>wO)break;n+=a,t.push(e[r])}return t.reverse(),t.length>0?t:e.slice(-1)}function kO(e){return e==="completed"?"completed":e==="inProgress"||e==="in_progress"?"inProgress":"pending"}function CO(e){var n;const t=[];(n=e.explanation)!=null&&n.trim()&&t.push(e.explanation.trim());for(const r of e.steps){const o=r.status==="completed"?"x":r.status==="inProgress"?"~":" ";t.push(`- [${o}] ${r.step}`)}return t.join(`
|
|
70
|
+
`).trim()}function Ge(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function Re(e){return typeof e=="string"?e:""}function Os(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function mv(e){const t=Ge(e);if(!t)return null;const n=Os(t.totalTokens??t.total_tokens),r=Os(t.inputTokens??t.input_tokens),o=Os(t.cachedInputTokens??t.cached_input_tokens),a=Os(t.outputTokens??t.output_tokens),s=Os(t.reasoningOutputTokens??t.reasoning_output_tokens);return n===null||r===null||o===null||a===null||s===null?null:{totalTokens:n,inputTokens:r,cachedInputTokens:o,outputTokens:a,reasoningOutputTokens:s}}function xO(e){const t=Ge(e);if(!t)return null;const n=mv(t.total),r=mv(t.last);if(!n||!r)return null;const o=Os(t.modelContextWindow??t.model_context_window),a=r.totalTokens,s=typeof o=="number"?Math.max(o-a,0):null,i=typeof o=="number"&&o>0?Jw(Math.round((s??0)/o*100),0,100):null;return{total:n,last:r,modelContextWindow:o,currentContextTokens:a,remainingContextTokens:s,remainingContextPercent:i}}function IO(e){if(e.method!=="thread/tokenUsage/updated")return null;const t=Ge(e.params),n=qn(e),r=xO((t==null?void 0:t.tokenUsage)??(t==null?void 0:t.token_usage));return!n||!r?null:{threadId:n,usage:r}}function qn(e){const t=Ge(e.params);if(!t)return"";const n=Re(t.threadId);if(n)return n;const r=Re(t.thread_id);if(r)return r;const o=Re(t.conversationId);if(o)return o;const a=Re(t.conversation_id);if(a)return a;const s=Ge(t.thread),i=Re(s==null?void 0:s.id);if(i)return i;const l=Ge(t.turn),c=Re(l==null?void 0:l.threadId);if(c)return c;const d=Re(l==null?void 0:l.thread_id);return d||""}function AO(e){if(e.method!=="turn/completed")return"";const t=Ge(e.params),n=Ge(t==null?void 0:t.turn);if(!n||n.status!=="failed")return"";const r=Ge(n.error);return Re(r==null?void 0:r.message)}function _O(e){var r;if(e.method!=="error")return null;const t=Ge(e.params),n=Re(t==null?void 0:t.message)||Re((r=Ge(t==null?void 0:t.error))==null?void 0:r.message);return n?{message:n,transient:(t==null?void 0:t.willRetry)===!0}:null}function PO(e){const t=qn(e);if(!t)return null;if(e.method==="turn/started")return{threadId:t,activity:{label:"Thinking",details:[]}};if(e.method==="item/started"){const n=Ge(e.params),r=Ge(n==null?void 0:n.item),o=Re(r==null?void 0:r.type).toLowerCase();if(o==="reasoning")return{threadId:t,activity:{label:"Thinking",details:[]}};if(o==="agentmessage")return{threadId:t,activity:{label:"Writing response",details:[]}};if(o==="commandexecution"){const a=Re(r==null?void 0:r.command);return{threadId:t,activity:{label:"Running command",details:a?[a]:[]}}}if(o==="filechange"){const s=(Array.isArray(r==null?void 0:r.changes)?r.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 EO(e){if(e.method!=="turn/started")return null;const t=Ge(e.params);if(!t)return null;const n=qn(e);if(!n)return null;const r=Ge(t.turn),o=Re(r==null?void 0:r.id)||Re(t.turnId)||`${n}:unknown`;if(!o)return null;const a=$s(Re(r==null?void 0:r.startedAt))??$s(Re(t.startedAt))??$s(e.atIso)??Date.now();return{threadId:n,turnId:o,startedAtMs:a}}function MO(e){if(e.method!=="turn/completed")return null;const t=Ge(e.params);if(!t)return null;const n=qn(e);if(!n)return null;const r=Ge(t.turn),o=Re(r==null?void 0:r.id)||Re(t.turnId)||`${n}:unknown`;if(!o)return null;const a=$s(Re(r==null?void 0:r.completedAt))??$s(Re(t.completedAt))??$s(e.atIso)??Date.now(),s=$s(Re(r==null?void 0:r.startedAt))??$s(Re(t.startedAt))??void 0;return{threadId:n,turnId:o,completedAtMs:a,startedAtMs:s}}function Mc(e){return`${e}:live-reasoning`}function RO(e){const t=Ge(e.params);if(!t)return"";if(e.method==="item/started"){const n=Ge(t.item);return!n||n.type!=="reasoning"?"":Re(n.id)}return""}function LO(e){const t=Ge(e.params);if(!t)return null;if(e.method==="item/reasoning/summaryTextDelta"){const n=Re(t.itemId),r=Re(t.delta);return!n||!r?null:{messageId:Mc(n),itemId:n,delta:r}}if(e.method==="item/reasoning/textDelta"){const n=Re(t.itemId),r=Re(t.delta);return!n||!r?null:{messageId:Mc(n),itemId:n,delta:r}}return null}function jO(e){const t=Ge(e.params);if(!t)return"";if(e.method==="item/reasoning/summaryPartAdded"){const n=Re(t.itemId);return n?Mc(n):""}return""}function NO(e){const t=Ge(e.params);if(!t)return"";if(e.method==="item/completed"){const n=Ge(t.item);return!n||n.type!=="reasoning"?"":Mc(Re(n.id))}return""}function $O(e){var n;const t=[];for(const r of["content","summary"]){const o=Array.isArray(e[r])?e[r]:[];for(const a of o){const s=typeof a=="string"?a:(n=Ge(a))==null?void 0:n.text;typeof s=="string"&&s.trim()&&t.push(s)}}return t.join(`
|
|
71
|
+
`).trim()}function OO(e){if(e.method!=="item/started"&&e.method!=="item/completed")return null;const t=Ge(e.params),n=Ge(t==null?void 0:t.item);if(!n||Re(n.type).toLowerCase()!=="reasoning")return null;const r=Re(n.id);return r?{itemId:r,text:$O(n)}:null}function DO(e){const t=Ge(e.params);if(!t)return"";if(e.method==="item/started"){const n=Ge(t.item);return!n||n.type!=="agentMessage"?"":Re(n.id)}return""}function FO(e){const t=Ge(e.params);if(!t)return null;if(e.method==="item/agentMessage/delta"){const n=Re(t.itemId),r=Re(t.delta);if(!n||!r)return null;const o=Re(t.turnId)||Re(t.turn_id);return{messageId:n,delta:r,turnId:o||void 0}}return null}function BO(e){const t=Ge(e.params);if(!t)return null;if(e.method==="item/completed"){const n=Ge(t.item);if(!n||n.type!=="agentMessage")return null;const r=Re(n.id),o=Re(n.text);if(!r||!o)return null;const a=Re(t.turnId)||Re(t.turn_id);return{id:r,role:"assistant",text:o,messageType:"agentMessage",turnId:a||void 0}}return null}function UO(e){return`/codex-local-image?path=${encodeURIComponent(e)}`}function zO(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 HO(e){if(e.method!=="item/completed")return null;const t=Ge(e.params),n=Ge(t==null?void 0:t.item);if(!n)return null;const r=Re(n.id);if(!r)return null;if(n.type==="imageView"){const s=Re(n.path);return s?{id:r,role:"assistant",text:"",images:[UO(s)],messageType:"imageView"}:null}if(n.type!=="imageGeneration"&&n.type!=="image_generation")return null;const o=Re(n.result),a=o?zO(o):"";return a?{id:r,role:"assistant",text:"",images:[a],messageType:"imageView"}:null}function WO(e){if(e.method!=="item/commandExecution/outputDelta")return null;const t=Ge(e.params);if(!t)return null;const n=Re(t.itemId),r=Re(t.delta);return!n||!r?null:{itemId:n,delta:r}}const gl="__global__";function qO(e){return e==="item/commandExecution/requestApproval"||e==="item/fileChange/requestApproval"||e==="item/permissions/requestApproval"||e==="execCommandApproval"||e==="applyPatchApproval"}function hb(e){const t=Ge(e);if(!t)return null;const n=t.id,r=Re(t.method),o=t.params;if(typeof n!="number"||!Number.isInteger(n)||!r)return null;const a=Ge(o),s=GO(r,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)||gl,l=Re(a==null?void 0:a.turnId)||Re(a==null?void 0:a.turn_id),c=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),d=Re(t.receivedAtIso)||new Date().toISOString();return{id:n,method:s,threadId:i,turnId:l,itemId:c,receivedAtIso:d,params:o??null}}function GO(e,t){const n=e.trim();return n&&(n==="item/commandExecution/requestApproval"||n==="execCommandApproval"||n==="exec_approval_request"||VO(t)?"item/commandExecution/requestApproval":n==="item/fileChange/requestApproval"||n==="applyPatchApproval"||n==="apply_patch_approval_request"||KO(t)?"item/fileChange/requestApproval":n==="item/tool/requestUserInput"||n==="request_user_input"||YO(t)?"item/tool/requestUserInput":n==="mcpServer/elicitation/request"||n==="elicitation_request"||QO(t)?"mcpServer/elicitation/request":n==="item/permissions/requestApproval"||XO(t)?"item/permissions/requestApproval":n==="item/tool/call"||n==="dynamic_tool_call_request"||JO(t)?"item/tool/call":n)}function VO(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 KO(e){return e?typeof e.grantRoot=="string"&&e.grantRoot.trim().length>0||typeof e.grant_root=="string"&&e.grant_root.trim().length>0||Ge(e.fileChanges)?!0:Ge(e.changes)!==null:!1}function YO(e){return!!(e&&Array.isArray(e.questions))}function JO(e){return e?typeof e.toolName=="string"||typeof e.tool_name=="string"||typeof e.name=="string"||Array.isArray(e.arguments):!1}function QO(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 XO(e){return e?typeof e.threadId=="string"&&typeof e.turnId=="string"&&typeof e.itemId=="string"&&Ge(e.permissions)!==null:!1}function ZO(e){if(e.method!=="item/tool/requestUserInput")return[];const t=Ge(e.params),n=Array.isArray(t==null?void 0:t.questions)?t.questions:[],r=[];for(const o of n){const a=Ge(o),s=Re(a==null?void 0:a.id).trim();s&&r.push(s)}return r}function eD(e,t){const n=t.threadId||gl,r=e.pendingServerRequestsByThreadId.value[n]??[],o=r.findIndex(s=>s.id===t.id),a=[...r];o>=0?a.splice(o,1,t):a.push(t),e.pendingServerRequestsByThreadId.value={...e.pendingServerRequestsByThreadId.value,[n]:a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso))},e.applyThreadFlags()}function tD(e,t){const n={};for(const[r,o]of Object.entries(e.pendingServerRequestsByThreadId.value)){const a=o.filter(s=>s.id!==t);a.length>0&&(n[r]=a)}e.pendingServerRequestsByThreadId.value=n,e.pendingReplyErrorByRequestId.value[String(t)]&&(e.pendingReplyErrorByRequestId.value=St(e.pendingReplyErrorByRequestId.value,String(t))),e.applyThreadFlags()}function nD(e,t){return e.pendingReplyErrorByRequestId.value[String(t)]??""}function rD(e,t){const n={},r=new Set;for(const a of t){const s=a.threadId||gl,i=n[s]??[];i.push(a),n[s]=i,r.add(a.id)}for(const a of Object.values(n))a.sort((s,i)=>s.receivedAtIso.localeCompare(i.receivedAtIso));e.pendingServerRequestsByThreadId.value=n;const o={};for(const[a,s]of Object.entries(e.pendingReplyErrorByRequestId.value))r.has(Number(a))&&(o[a]=s);e.pendingReplyErrorByRequestId.value=o}function pb(e,t,n){const r=e.liveAgentMessagesByThreadId.value[t]??[];xl(r,n)||(e.liveAgentMessagesByThreadId.value={...e.liveAgentMessagesByThreadId.value,[t]:n})}function oD(e,t){t&&t in e.liveAgentMessagesByThreadId.value&&(e.liveAgentMessagesByThreadId.value=St(e.liveAgentMessagesByThreadId.value,t))}function aD(e,t,n){const r=e.livePlanMessagesByThreadId.value[t]??[];xl(r,n)||(e.livePlanMessagesByThreadId.value={...e.livePlanMessagesByThreadId.value,[t]:n})}function sD(e,t,n){!t||!n||(e.lastPlanByThreadId.value={...e.lastPlanByThreadId.value,[t]:n},db(e.lastPlanByThreadId.value))}function iD(e,t,n){const r=e.livePlanMessagesByThreadId.value[t]??[],o=rd(r,n);aD(e,t,o),sD(e,t,n)}function lD(e,t,n){const r=e.liveFileChangeMessagesByThreadId.value[t]??[],o=rd(r,n);Vh(e,t,o)}function uD(e,t,n){const r=e.liveAgentMessagesByThreadId.value[t]??[];let o=rd(r,n);const a=Xa(n.text);if(n.role==="assistant"&&a.length>0){const s=o.filter(i=>i.id===n.id||Xa(i.text)!==a);s.length!==o.length&&(o=s)}pb(e,t,o)}function Vh(e,t,n){const r=e.liveFileChangeMessagesByThreadId.value[t]??[];xl(r,n)||(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:n})}function cD(e,t,n){const r=e.liveCommandsByThreadId.value[t]??[],o=rd(r,n);o!==r&&(e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:o})}function dD(e,t,n){const r=e.liveCommandsByThreadId.value[t];if(!r||r.length===0)return;const o=new Set(n.map(s=>s.id)),a=r.filter(s=>!o.has(s.id));a.length!==r.length&&(a.length===0?e.liveCommandsByThreadId.value=St(e.liveCommandsByThreadId.value,t):e.liveCommandsByThreadId.value={...e.liveCommandsByThreadId.value,[t]:a})}function fD(e,t,n){const r=e.liveFileChangeMessagesByThreadId.value[t];if(!r||r.length===0)return;const o=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=r.filter(l=>!o.has(l.id)&&!(l.turnId&&a.has(l.turnId))&&!(typeof l.turnIndex=="number"&&s.has(l.turnIndex)));i.length!==r.length&&(i.length===0?e.liveFileChangeMessagesByThreadId.value=St(e.liveFileChangeMessagesByThreadId.value,t):e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:i})}function hD(e,t,n,r){if(!t||!n)return;const o=e.liveFileChangeMessagesByThreadId.value[t];if(!o)return;const a=o.findIndex(i=>i.id===n||i.turnId===n);if(a<0)return;const s=[...o];s[a]={...s[a],fileChanges:r},Vh(e,t,s)}function pD(e,t,n,r){if(!t||!n)return;const o=e.liveFileChangeMessagesByThreadId.value[t];if(!o)return;const a=o.findIndex(l=>l.turnId===n);if(a<0)return;const s=[...o],i=s[a];s[a]={...i,fileChanges:(i.fileChanges??[]).map(l=>({...l,diff:r}))},Vh(e,t,s)}function mD(e,t){const n=e.persistedMessagesByThreadId.value[t]??[];let r=-1;for(const o of n)typeof o.turnIndex=="number"&&Number.isFinite(o.turnIndex)&&(r=Math.max(r,o.turnIndex));return r+1}function gD(e,t,n,r){if(!t||!n||!Number.isInteger(r)||r<0)return;const o=e.turnIndexByTurnIdByThreadId.value[t]??{};o[n]!==r&&(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...o,[n]:r}})}function vD(e,t,n){const r=e.turnIndexByTurnIdByThreadId.value[t]??{},o=Object.entries(r),a=Object.entries(n);o.length===a.length&&o.every(([s,i])=>n[s]===i)||(e.turnIndexByTurnIdByThreadId.value={...e.turnIndexByTurnIdByThreadId.value,[t]:{...n}})}function yD(e,t,n){var o;if(!t||!n)return;const r=(o=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:o[n];return typeof r=="number"?r:void 0}function wD(e,t){const n=e.liveFileChangeMessagesByThreadId.value[t];if(!n||n.length===0)return;const r=e.turnIndexByTurnIdByThreadId.value[t]??{};let o=!1;const a=n.map(s=>{if(typeof s.turnIndex=="number"||!s.turnId)return s;const i=r[s.turnId];return typeof i!="number"?s:(o=!0,{...s,turnIndex:i})});o&&(e.liveFileChangeMessagesByThreadId.value={...e.liveFileChangeMessagesByThreadId.value,[t]:a})}const gv=8e3,bD=1500,TD=15*60*1e3;function SD(e){let t=tO(),n=!1,r=null;function o(){r===null&&(r=setTimeout(()=>{if(r=null,n&&(n=!1,typeof window<"u"))try{window.localStorage.setItem(ob,JSON.stringify(t))}catch{}n&&o()},bD))}function a(d,m){if(!d||e.inProgressById.value[d]!==!0)return;const f=m.length>gv?m.slice(-gv):m;t[d]={text:f,ts:Date.now()},n=!0,o()}function s(d,m){if(!d)return;const f=m.trim(),v=e.liveReasoningTextByThreadId.value[d]??"";if(f.length===0){if(!v)return;e.liveReasoningTextByThreadId.value=St(e.liveReasoningTextByThreadId.value,d);return}v!==f&&(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[d]:f},a(d,f))}function i(d,m){if(!d)return;const f=e.liveReasoningTextByThreadId.value[d]??"";s(d,`${f}${m}`)}function l(d){var v;if(!d||((v=e.liveReasoningTextByThreadId.value[d])==null?void 0:v.trim()))return;const f=t[d];f!=null&&f.text&&(Date.now()-f.ts>TD||(e.liveReasoningTextByThreadId.value={...e.liveReasoningTextByThreadId.value,[d]:f.text}))}function c(d){d&&d in t&&(delete t[d],n=!0,o())}return{setLiveReasoningText:s,appendLiveReasoningText:i,restoreLiveReasoningSnapshot:l,clearLiveReasoningSnapshot:c}}function kD(e,t){if(!t)return;const n=e.activeTurnIdByThreadId.value[t]??"";n&&e.activeReasoningTurnIdByThreadId.set(t,n)}function CD(e,t,n=!1){var l;if(!t)return;const r=e.liveReasoningTextByThreadId.value[t];if(r===void 0){n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear());return}const o=e.activeReasoningTurnIdByThreadId.get(t)??e.activeTurnIdByThreadId.value[t]??"";e.activeReasoningTurnIdByThreadId.delete(t);const a=o?(l=e.turnIndexByTurnIdByThreadId.value[t])==null?void 0:l[o]:void 0,s=PD(e,t),i=o||void 0;s.length>0?ID(e,t,s,i,a):n||xD(e,t,r,i,a),e.liveReasoningTextByThreadId.value=St(e.liveReasoningTextByThreadId.value,t),n||(e.turnItemSequenceByThreadId.delete(t),e.reasoningAppendedTextByItemId.clear(),e.clearLiveReasoningSnapshot(t))}function xD(e,t,n,r,o){if(!t)return;const a=n.trim();if(!a)return;const s=e.persistedReasoningByThreadId.value[t]??[];if(s.some(c=>c.text===a))return;const i={id:`reasoning:local:${t}:${Date.now()}`,role:"system",text:a,messageType:"reasoning",reasoning:{summary:[],content:[a]},turnId:r||void 0,turnIndex:typeof o=="number"?o:void 0},l=[...s,i].slice(-20);e.persistedReasoningByThreadId.value={...e.persistedReasoningByThreadId.value,[t]:l},e.savePersistedReasoningMap(e.persistedReasoningByThreadId.value)}function ID(e,t,n,r,o){if(!t||n.length===0)return;const s=[...e.persistedReasoningByThreadId.value[t]??[]];for(const l of n){const c=l.text.trim();if(!c)continue;const d=`reasoning:item:${t}:${l.itemId}`,m=s.findIndex(f=>f.id===d);if(m>=0){const f=s[m],v=l.anchorMessageId||f.reasoningAnchorMessageId,T=typeof o=="number"?o:f.turnIndex;if(f.text===c&&f.turnIndex===T&&f.reasoningAnchorMessageId===v)continue;s[m]={...f,text:c,reasoning:{summary:[],content:[c]},turnId:r||f.turnId,turnIndex:T,reasoningAnchorMessageId:v};continue}s.some(f=>f.text===c)||s.push({id:d,role:"system",text:c,messageType:"reasoning",reasoning:{summary:[],content:[c]},turnId:r||void 0,turnIndex:typeof o=="number"?o: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 AD(e,t,n,r){if(!t||!r)return;r.trim()&&e.reasoningItemTextByItemId.set(n,r.trim());const o=e.liveReasoningTextByThreadId.value[t]??"",a=e.reasoningAppendedTextByItemId.get(n)??"";if(o.endsWith(r)||a&&r===a){e.reasoningAppendedTextByItemId.set(n,r);return}if(a&&r.startsWith(a)){const i=r.slice(a.length);i&&e.appendLiveReasoningText(t,i),e.reasoningAppendedTextByItemId.set(n,r);return}const s=o.length>0&&!o.endsWith(`
|
|
72
|
+
`)?`
|
|
73
|
+
|
|
74
|
+
`:"";e.appendLiveReasoningText(t,`${s}${r}`),e.reasoningAppendedTextByItemId.set(n,r)}function _D(e,t){const n=Ge(t.params);if(!n)return;const r=t.method==="item/started"||t.method==="item/completed",o=t.method==="item/reasoning/textDelta"||t.method==="item/reasoning/summaryTextDelta";if(!r&&!o)return;const a=Ge(n.item),s=Re(o?n.itemId:a==null?void 0:a.id);if(!s)return;const i=qn(t);if(!i)return;const l=o||Re(a==null?void 0:a.type).toLowerCase()==="reasoning"?"reasoning":"other",c=e.turnItemSequenceByThreadId.get(i)??[];c.some(d=>d.itemId===s)||e.turnItemSequenceByThreadId.set(i,[...c,{itemId:s,kind:l}])}function PD(e,t){var a;const n=e.turnItemSequenceByThreadId.get(t)??[],r=[];let o="";for(const s of n)if(s.kind==="reasoning"){const i=((a=e.reasoningItemTextByItemId.get(s.itemId))==null?void 0:a.trim())??"";i&&r.push({text:i,anchorMessageId:o,itemId:s.itemId})}else o=s.itemId;return r}function ED(e,t,n){if(!t||!n)return;const r=e.reasoningItemTextByItemId.get(t)??"";r.endsWith(n)||e.reasoningItemTextByItemId.set(t,`${r}${n}`)}function vv(e){e.reasoningItemTextByItemId.clear()}const jo="gpt-5.4-mini",mb="Codex CLI not found. Install @openai/codex or set CODEXUI_CODEX_COMMAND.",MD="big-pickle",RD=fw;function LD(e){const t=S([]),n=S({}),r=S({}),o=S(rO()),a=S(pf(o.value,e.selectedThreadId.value)),s=S("medium"),i=S("standard"),l=S(""),c=S(""),d=S(!1),m=S({});let f=!1;function v(be){if(Wa(be)===ga){const _e=Ms(l.value),xe=Qu(_e),Je=xe?Ii(o.value[xe]):"";if(Je)return Je}return pf(o.value,be).trim()}function T(be){const Te=be.trim();return Ms(Te?m.value[Te]??l.value:l.value)}function k(be){const Te=be.trim();return!Te||Wa(Te)===ga?!1:pf(o.value,Te).trim().length>0}function N(be){const Te=be.trim();if(!Te)return!1;const _e=Wa(Te);return _e===ga?!1:Ii(o.value[_e]).length>0}function _(be){return n.value[be.trim()]??RD}function j(be,Te=s.value){const _e=be.trim(),xe=_(_e);if(Te&&xe.includes(Te))return Te;if(xe.includes("medium"))return"medium";const Je=r.value[_e];return Je&&xe.includes(Je)?Je:xe[0]??""}function W(be){s.value=j(be)}function V(be){const Te={},_e={};for(const xe of be)xe.supportedReasoningEfforts!==null&&(Te[xe.id]=[...xe.supportedReasoningEfforts]),xe.defaultReasoningEffort&&(_e[xe.id]=xe.defaultReasoningEffort);n.value=Te,r.value=_e}function U(...be){const Te=[...t.value];for(const _e of be){const xe=_e.trim();xe&&!Te.includes(xe)&&Te.push(xe)}Ga(t.value,Te)||(t.value=Te)}function fe(be){const Te=be.trim();return t.value.length===0||Te&&t.value.includes(Te)?Te:Te?(U(Te),Te):t.value[0]??""}function K(be,Te){const _e=Te.trim(),xe=Wa(be),Je=Ms(l.value),Xe=xe===ga?Qu(Je):"",rt=Xe||xe;if(_e){const de=lc(o.value);de[rt]=_e,Xe&&delete de[xe],o.value=de}else{let de=au(o.value,rt);Xe&&(de=au(de,xe)),o.value=de}xe===Wa(e.selectedThreadId.value)?(a.value=v(e.selectedThreadId.value),U(a.value),W(a.value)):U(_e),Zu(o.value)}function oe(be){K(e.selectedThreadId.value,be)}function ve(be,Te){const _e=be.trim();if(!_e)return;const xe=Te.trim();if(xe){const Je=lc(o.value);Je[_e]=xe,o.value=Je}else o.value=au(o.value,_e);U(xe),e.selectedThreadId.value===_e&&(a.value=v(e.selectedThreadId.value),W(a.value)),Zu(o.value)}function Pe(be,Te){const _e=be.trim();if(!_e)return;const xe=Ms(Te);xe?m.value={...m.value,[_e]:xe}:m.value[_e]&&(m.value=St(m.value,_e))}function we(be,Te,_e){const xe=Te.trim();if(Ms(_e)!=="opencode-zen")return xe;const Xe=v(be).trim();return Xe&&!/^gpt-/i.test(Xe)?Xe:xe&&!/^gpt-/i.test(xe)?xe:MD}async function te(be=e.selectedThreadId.value){var _e;const Te=be.trim();Te?(ve(Te,jo),(_e=e.onThreadModelChanged)==null||_e.call(e,Te)):oe(jo),U(jo)}function ke(be){be&&!_(a.value).includes(be)||(f=!0,s.value=be)}async function ee(be){const Te=be==="fast"?"fast":"standard";if(d.value||i.value===Te)return;const _e=i.value;i.value=Te,d.value=!0,e.error.value="";try{await zA(Te)}catch(xe){i.value=_e,e.error.value=xe instanceof Error?xe.message:"Failed to update Fast mode"}finally{d.value=!1}}function Ce(be,Te,_e){const xe=be.trim()||"default",Je=Te||"default",Xe=_e==="plan"?"Plan":"Default",rt=i.value==="fast"?"Fast":"Standard";return[`Mode: ${Xe}`,`Model: ${xe}`,`Thinking: ${Je}`,`Speed: ${rt}`]}async function De(be){c.value="";try{const Te=await GA(),_e=Te.model.trim(),xe=Ms(Te.providerId);l.value=xe;const Je=T(e.selectedThreadId.value),Xe=Je!=="codex"&&Je!=="custom",rt=v(e.selectedThreadId.value),de=await qA({includeProviderModels:Xe||(be==null?void 0:be.includeProviderModels)!==!1,requireProviderModels:Xe,providerId:Xe?Je:void 0}),B=de.map(L=>L.id);V(de);const ne=Qu(Je),ae=ne?Ii(o.value[ne]):"",je=[...B];!(be!=null&&be.providerChanged)&&Xe&&Je===xe&&_e&&!je.includes(_e)&&je.push(_e),t.value=je;const We=rt&&B.includes(rt),E=N(e.selectedThreadId.value);if(!rt||!We||be!=null&&be.providerChanged?be!=null&&be.providerChanged&&je.length>0?ae&&B.includes(ae)?oe(ae):Je===xe&&_e&&je.includes(_e)?oe(_e):oe(je[0]):E&&rt?U(rt):Je===xe&&_e&&je.includes(_e)?oe(Te.model):je.length>0?oe(je[0]):oe(""):a.value.trim()!==rt&&oe(rt),ne&&a.value.trim().length>0){const L=lc(o.value);L[ne]=a.value.trim();const H=Qu(xe);H&&H!==ne&&_e&&(L[H]=_e),o.value=L,Zu(o.value)}s.value=j(a.value,f?s.value:"medium"),i.value=Te.speedMode}catch(Te){c.value=Yw(Te)?mb:""}}function Ue(be){a.value=fe(v(be)),W(a.value)}function Ee(be){const Te=Kw(o.value,be);Te!==o.value&&(o.value=Te,Ue(e.selectedThreadId.value),Zu(Te)),m.value=on(m.value,be)}return{activeProviderId:l,availableModelIds:t,availableModelReasoningEfforts:n,codexCliMissingError:c,isUpdatingSpeedMode:d,selectedModelId:a,selectedReasoningEffort:s,selectedSpeedMode:i,applyFallbackModelSelection:te,buildPendingTurnDetails:Ce,hasThreadModelSelection:k,hasThreadOwnModelSelection:N,pruneThreadModelState:Ee,readModelIdForThread:v,refreshModelPreferences:De,resolveThreadModelForProvider:we,setSelectedModelId:oe,setSelectedModelIdForThread:K,setSelectedReasoningEffort:ke,setThreadModelId:ve,setThreadModelProviderId:Pe,syncSelectedThreadModel:Ue,updateSelectedSpeedMode:ee}}function jD(e){const t=S([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),n=S(oO()),r=S(mf(n.value,e.value));function o(c){const d=c==="plan"?"plan":"default",m=Wa(e.value);mf(n.value,e.value)===d&&r.value===d||(r.value=d,n.value=av(n.value,m,d),yf(n.value))}function a(c,d){const m=d==="plan"?"plan":"default";n.value=av(n.value,c,m),c.trim()===e.value&&(r.value=m),yf(n.value)}function s(c){r.value=mf(n.value,c)}function i(c){const d=Kw(n.value,c);d!==n.value&&(n.value=d,s(e.value),yf(d))}async function l(){try{const c=await KA();t.value=c,c.some(d=>d.value===r.value)||o("default")}catch{}}return{availableCollaborationModes:t,selectedCollaborationMode:r,pruneThreadCollaborationState:i,refreshCollaborationModes:l,setSelectedCollaborationMode:o,setSelectedCollaborationModeForThread:a,syncSelectedThreadCollaborationMode:s}}const ND=500;function $D(){const e=S(null),t=S([]),n=J(()=>e.value);let r=null,o=null;function a(c){e.value=c}async function s(){if(o){await o;return}o=(async()=>{try{const c=await $_();a(c),t.value=c?[c]:[]}catch{}finally{o=null}})(),await o}function i(){if(typeof window>"u"){s();return}r!==null&&window.clearTimeout(r),r=window.setTimeout(()=>{r=null,s()},ND)}function l(){r===null||typeof window>"u"||(window.clearTimeout(r),r=null)}return{accountRateLimitSnapshots:t,codexQuota:n,refreshRateLimits:s,scheduleRateLimitRefresh:i,setCodexRateLimit:a,stopRateLimitRefresh:l}}function OD(e){const t=S(pO()),n=S(gO());let r=null;function o(f,v={}){t.value=f,v.persist!==!1&&mO(f)}function a(f,v={}){n.value=f,v.persist!==!1&&vO(f)}async function s(f,v){try{const T=await sl(),k={...T.labels};let N=!1;for(const _ of T.order){if(!uc(_,f))continue;const j=v.trim();j.length===0?k[_]!==void 0&&(delete k[_],N=!0):k[_]!==j&&(k[_]=j,N=!0)}N&&await sf({order:T.order,labels:k,active:T.active,projectOrder:T.projectOrder})}catch{}}function i(f,v){f.length===0||(n.value[f]??"")===v||(a({...n.value,[f]:v}),r!==null&&clearTimeout(r),r=setTimeout(()=>{r=null,s(f,v)},500))}async function l(){try{const f=await sl(),v=D$(f,t.value,e.sourceGroups.value);await sf({order:v.order,labels:f.labels,active:v.active,projectOrder:v.projectOrder})}catch{}}async function c(f){var _;if(f.length===0)return;const v=t.value.filter(j=>j!==f);if(Ga(t.value,v)||o(v),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 T=tr(e.projectGroups.value);e.pruneThreadScopedState(T),T.some(j=>j.id===e.selectedThreadId.value)||e.setSelectedThreadId(((_=T[0])==null?void 0:_.id)??"");const N=new Set;try{const j=await sl();O$(j,f).forEach(W=>{N.add(W)})}catch{}if(N.size>0)try{const j=await sl(),W=j.order.filter(fe=>!N.has(fe)),V=j.active.filter(fe=>!N.has(fe)),U=V.length===0&&W.length>0?[W[0]]:V;await sf({order:W,labels:E$(j.labels,N),active:U,projectOrder:j.projectOrder.filter(fe=>fe!==f&&!N.has(fe))});return}catch{}await l()}function d(f,v){if(f.length===0||e.sourceGroups.value.length===0)return;const T=e.sourceGroups.value.map(W=>W.projectName),k=T.indexOf(f);if(k===-1)return;const N=Math.max(0,Math.min(v,T.length-1)),_=g$(T,k,N);if(_===T)return;o(al(_,e.sourceGroups.value));const j=Gf(e.sourceGroups.value,t.value);e.sourceGroups.value=Pc(e.sourceGroups.value,j),e.applyThreadFlags(),l()}function m(f){const v=f.trim();if(!v)return;const T=[v,...t.value.filter(N=>N!==v)];if(Ga(t.value,T))return;o(T);const k=Gf(e.sourceGroups.value,t.value);e.sourceGroups.value=Pc(e.sourceGroups.value,k),e.applyThreadFlags(),l()}return{projectDisplayNameById:n,projectOrder:t,persistProjectOrderToWorkspaceRoots:l,pinProjectToTop:m,removeProject:c,renameProject:i,reorderProject:d,setProjectDisplayNames:a,setProjectOrder:o}}const DD=2e3;function FD(e){const t=S([]),n=S([]),r=S(!1);let o=null,a=null,s=!1,i=!1,l=0,c="";async function d(f={}){const v=e.getSelectedCwd().trim(),T=v||"__global__";if(o){await o;return}f.force!==!0&&s&&c===T&&Date.now()-l<DD||(o=(async()=>{try{t.value=await k_(v?[v]:void 0),s=!0,l=Date.now(),c=T}catch{}finally{o=null}})(),await o)}async function m(f={}){if(a){await a;return}f.force!==!0&&i||(r.value=!0,a=(async()=>{try{n.value=await QA(),i=!0}catch{}finally{r.value=!1,a=null}})(),await a)}return{hooksList:n,installedSkills:t,isHooksLoading:r,refreshHooks:m,refreshSkills:d}}const gb="codex-web-local.stashed-messages.v1",vb="codex-web-local.auto-compact-threshold.v1",ec=10,BD=650;function UD(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(gb);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,o]of Object.entries(t)){if(!r||!Array.isArray(o))continue;const a=o.filter(s=>!!s&&typeof s=="object"&&typeof s.id=="string"&&typeof s.text=="string");a.length>0&&(n[r]=a)}return n}catch{return{}}}function zD(){if(typeof window>"u")return ec;try{const e=window.localStorage.getItem(vb);if(e===null)return ec;const t=Number(e);return Number.isFinite(t)&&t>=0?Math.round(t):ec}catch{return ec}}function HD(e){const t={};for(const[n,r]of Object.entries(e)){const o=n.trim();!o||r.length===0||(t[o]=r.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 WD(e){const t=S({}),n=S({}),r=S(UD()),o=S(zD());let a=!1;const s=J(()=>{const K=e.value;if(!K)return[];const oe=t.value[K]??[];return[...(r.value[K]??[]).map(we=>({...we,awaitingCompaction:!0})),...oe]});function i(){typeof window>"u"||window.localStorage.setItem(gb,JSON.stringify(r.value))}function l(){l_(HD(t.value)).catch(()=>{})}async function c(){if(!a){a=!0;try{t.value=await Ag()}catch{}}}async function d(K){if(n.value[K]!==!0){n.value={...n.value,[K]:!0};try{t.value=await Ag()}catch{}finally{n.value=St(n.value,K)}}}function m(K){d(K),!(typeof window>"u")&&window.setTimeout(()=>{d(K)},BD)}function f(K){const oe=Number.isFinite(K)&&K>0?Math.round(K):0;oe!==o.value&&(o.value=oe,!(typeof window>"u")&&window.localStorage.setItem(vb,String(oe)))}function v(K){return r.value[K]??[]}function T(K,oe){r.value={...r.value,[K]:[...v(K),oe]},i()}function k(K){const oe=[...v(K)];return oe.length===0||(r.value=St(r.value,K),i()),oe}function N(K,oe,ve){const we=[...t.value[K]??[]],te=typeof ve=="number"?Math.max(0,Math.min(ve,we.length)):we.length;we.splice(te,0,oe),t.value={...t.value,[K]:we},l()}function _(K,oe){return v(K).find(ve=>ve.id===oe)}function j(K,oe){var ve;return(ve=t.value[K])==null?void 0:ve.find(Pe=>Pe.id===oe)}function W(K){const oe=e.value;if(!oe)return;if(_(oe,K)){const we=v(oe).filter(te=>te.id!==K);r.value=we.length>0?{...r.value,[oe]:we}:St(r.value,oe),i();return}const ve=t.value[oe];if(!ve)return;const Pe=ve.filter(we=>we.id!==K);t.value=Pe.length>0?{...t.value,[oe]:Pe}:St(t.value,oe),l()}function V(K,oe){const ve=e.value;if(!ve)return;const Pe=t.value[ve];if(!Pe||_(ve,K)||_(ve,oe))return;const we=Pe.findIndex(Ce=>Ce.id===K),te=Pe.findIndex(Ce=>Ce.id===oe);if(we<0||te<0||we===te)return;const ke=[...Pe],[ee]=ke.splice(we,1);ke.splice(te,0,ee),t.value={...t.value,[ve]:ke},l()}function U(K){const oe=on(t.value,K);oe!==t.value&&(t.value=oe,l())}function fe(){t.value={},n.value={},r.value={},i(),l()}return{appendStashedMessage:T,autoCompactThreshold:o,clearQueueState:fe,enqueueQueuedMessage:N,findQueuedMessage:j,findStashedMessage:_,getStashedMessages:v,loadPersistedQueueStateIfNeeded:c,processQueuedMessages:d,pruneQueueState:U,removeQueuedMessage:W,reorderQueuedMessage:V,scheduleQueueStateRefresh:m,selectedThreadQueuedMessages:s,setAutoCompactThreshold:f,takeStashedMessages:k}}const qD=1e4,GD=2e3;function VD(e){const{selectedThreadId:t,projectGroups:n,inProgressById:r,applyThreadGroups:o,reconcileInProgressFromThreadGroups:a,hydrateWorkspaceRootsStateIfNeeded:s,loadThreadTitleCacheIfNeeded:i,loadWorkspaceRootsStateForThreadList:l,pruneThreadScopedState:c,setSelectedThreadId:d}=e,m=S(!1),f=S(!1),v=S(!1);let T=null,k=0,N=null,_=null,j=!1,W=!1,V=[],U=null;function fe(ee,Ce){if(ee.length===0)return Ce;if(Ce.length===0)return ee;const De=new Map;for(const Ee of tr(ee))De.set(Ee.id,Ee);for(const Ee of tr(Ce))De.set(Ee.id,Ee);const Ue=new Map;for(const Ee of De.values()){const be=Ue.get(Ee.projectName);be?be.push(Ee):Ue.set(Ee.projectName,[Ee])}return Array.from(Ue.entries()).map(([Ee,be])=>({projectName:Ee,threads:be.sort((Te,_e)=>new Date(_e.updatedAtIso).getTime()-new Date(Te.updatedAtIso).getTime())})).sort((Ee,be)=>{var xe,Je;const Te=new Date(((xe=Ee.threads[0])==null?void 0:xe.updatedAtIso)??0).getTime();return new Date(((Je=be.threads[0])==null?void 0:Je.updatedAtIso)??0).getTime()-Te})}function K(){return Object.values(r.value).some(ee=>ee===!0)}function oe(ee=U){if(!(!N||j||K())){if(U=ee,typeof window>"u"){ve(ee);return}_!==null&&window.clearTimeout(_),_=window.setTimeout(()=>{_=null,!(!N||K())&&ve(U)},qD)}}async function ve(ee){if(!(j||!N||K())){j=!0;try{const Ce=Date.now(),De=await mg(N,o_());N=De.nextCursor,W=De.nextCursor===null,v.value=W,V=fe(V,De.groups),a(De.groups,Ce),o(V,ee)}catch{}finally{j=!1,N&&!K()&&oe(ee)}}}async function Pe(ee={}){if(T){await T;return}ee.force!==!0&&m.value&&Date.now()-k<GD||(T=(async()=>{var Ce;m.value||(f.value=!0);try{const De=Date.now(),[Ue,Ee]=await Promise.all([mg(),l(),i({force:ee.force===!0})]);U=Ee;const be=Ue.groups;V=be,N=Ue.nextCursor,W=Ue.nextCursor===null,v.value=W,await s(be,Ee),a(be,De),o(V,Ee),m.value=!0,k=Date.now(),W||oe(Ee);const Te=tr(n.value);c(Te),!Te.some(xe=>xe.id===t.value)&&!t.value&&d(((Ce=Te[0])==null?void 0:Ce.id)??"")}finally{f.value=!1}})().finally(()=>{T=null}),await T)}function we(ee){V=Xw(V,ee)}function te(){return N!==null}function ke(){_!==null&&typeof window<"u"&&(window.clearTimeout(_),_=null)}return{dispose:ke,hasActiveInProgressThreads:K,hasLoadedThreads:m,hasRemainingThreadPages:te,isLoadingThreads:f,isThreadListFullyLoaded:v,loadThreads:Pe,removeThreadFromLoadedLists:we,scheduleRemainingThreadPages:oe}}const yv=2e3;function KD(e){const t=S({}),n=S({}),r=S({}),o=S({}),a=S(!1),s=5e3,i=S(null);let l=0,c=null;function d(){l&&(clearTimeout(l),l=0),c=null,i.value=null}function m(U){d(),c=U,l=window.setTimeout(()=>{l=0,i.value=c},s)}const f=new Map,v=new Map,T=new Map;let k=0;function N(U,fe,K,oe){var we;const ve=(we=fe[fe.length-1])==null?void 0:we.id;if(!ve)return;const Pe=()=>{(e.persistedMessagesByThreadId.value[U]??[]).some(ke=>ke.id===ve)&&TO(U,fe,K,oe)};if(typeof window<"u"&&typeof window.requestAnimationFrame=="function"){window.requestAnimationFrame(()=>{window.setTimeout(Pe,0)});return}setTimeout(Pe,0)}async function _(U,fe={}){var te;if(!U)return;const K=Date.now()-(T.get(U)??0)<yv;if((te=e.turnErrorByThreadId.value[U])!=null&&te.transient&&(fe.silent===!0||K))return;const oe=f.get(U);if(oe&&fe.force!==!0){await oe;return}const ve=n.value[U]===!0,Pe=fe.silent!==!0&&!ve;Pe&&(k+=1,a.value=!0),m(U);const we=(async()=>{try{const ke=e.currentThreadVersion(U),ee=t.value[U]??"",Ce=Date.now()-(v.get(U)??0)<yv;if(fe.force===!0?!1:ve&&(Ce||(ke.length===0||ee===ke)&&e.inProgressById.value[U]!==!0)){e.markThreadAsRead(U);return}if(!ve&&e.inProgressById.value[U]!==!0&&(e.persistedMessagesByThreadId.value[U]??[]).length===0){const ae=bO(U);ae&&(e.setPersistedMessagesForThread(U,ae.messages),Object.keys(ae.turnIndexByTurnId).length>0&&e.replaceTurnIndexLookupForThread(U,ae.turnIndexByTurnId),ae.hasMoreOlder&&(r.value={...r.value,[U]:!0}))}const Ee=e.resumedThreadById.value[U]!==!0?await zf(U,ne=>{e.setPersistedMessagesForThread(U,ne)}):null,be=Ee??await Uf(U);be.modelProvider&&e.setThreadModelProviderId(U,be.modelProvider),be.model&&!e.hasThreadOwnModelSelection(U)&&e.setThreadModelId(U,e.resolveThreadModelForProvider(U,be.model,be.modelProvider)),Ee&&(e.resumedThreadById.value={...e.resumedThreadById.value,[U]:!0});const{messages:Te,inProgress:_e,activeTurnId:xe,turnIndexByTurnId:Je}=be,Xe=e.persistedMessagesByThreadId.value[U]??[],rt=Te.length===0&&Xe.length>0;rt&&console.warn(`[thread-load] ${U}: server returned 0 messages while ${Xe.length} are persisted locally; keeping local history`),r.value={...r.value,[U]:be.hasMoreOlder===!0},e.markThreadMessagesPersisted(U,Te),rt||e.replaceTurnIndexLookupForThread(U,Je),e.rebindLiveFileChangeTurnIndices(U);const de=iv(Xe,Te,{preserveMissing:fe.silent===!0||T$(Xe)||rt});e.setPersistedMessagesForThread(U,de);const B=e.liveAgentMessagesByThreadId.value[U]??[];if(_e){const ne=k$(B,Te);e.setLiveAgentMessagesForThread(U,ne)}else e.clearLiveAgentMessagesForThread(U);e.removeLiveCommandsPersistedIn(U,Te),e.removeLiveFileChangesPersistedIn(U,Te),n.value={...n.value,[U]:!0},v.set(U,Date.now()),T.delete(U),!rt&&!_e&&N(U,de,Je,be.hasMoreOlder===!0),ke&&(t.value={...t.value,[U]:ke}),e.setThreadInProgress(U,_e),be.externalSession&&(e.externalSessionByThreadId.value={...e.externalSessionByThreadId.value,[U]:be.externalSession}),e.clearTransientTurnErrorForThread(U),xe?e.activeTurnIdByThreadId.value={...e.activeTurnIdByThreadId.value,[U]:xe}:e.activeTurnIdByThreadId.value[U]&&(e.activeTurnIdByThreadId.value=St(e.activeTurnIdByThreadId.value,U)),_e||e.clearCompletedTurnLiveState(U),e.markThreadAsRead(U)}catch(ke){const ee=ke instanceof Error?ke.message:"Unknown application error";throw e.selectedThreadId.value===U&&e.setTurnErrorForThread(U,ee,{transient:!0}),T.set(U,Date.now()),ke}finally{Pe&&(k=Math.max(0,k-1),k===0&&(a.value=!1))}})().finally(()=>{c===U&&d(),f.delete(U)});f.set(U,we),await we}async function j(U=e.selectedThreadId.value){if(!U||o.value[U]===!0||r.value[U]!==!0)return;const fe=e.getFirstPersistedTurnId(U);if(!fe){r.value={...r.value,[U]:!1};return}o.value={...o.value,[U]:!0};try{const K=await _A(U,fe),oe=e.persistedMessagesByThreadId.value[U]??[],ve=iv(K.messages,oe,{preserveMissing:!0});e.setPersistedMessagesForThread(U,ve),e.replaceTurnIndexLookupForThread(U,{...e.turnIndexByTurnIdByThreadId.value[U]??{},...K.turnIndexByTurnId}),e.rebindLiveFileChangeTurnIndices(U),r.value={...r.value,[U]:K.hasMoreOlder}}catch(K){throw K instanceof Br&&K.code==="older_turns_unavailable"&&(r.value={...r.value,[U]:!1}),e.error.value=K instanceof Error?K.message:"Failed to load earlier messages",K}finally{o.value={...o.value,[U]:!1}}}async function W(U,fe={}){var K;U&&n.value[U]!==!0&&(fe.silent===!0&&((K=e.turnErrorByThreadId.value[U])!=null&&K.transient)||await _(U,fe))}function V(U){n.value=on(n.value,U),t.value=on(t.value,U)}return{ensureThreadMessagesLoaded:W,hasMoreOlderMessagesByThreadId:r,isLoadingMessages:a,loadMessages:_,loadOlderMessages:j,loadedMessagesByThreadId:n,loadedVersionByThreadId:t,loadingOlderMessagesByThreadId:o,pruneMessageHistoryState:V,slowOpenThreadId:i}}function YD(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(c=>({...c,title:js(c.title)}))})):s.map(l=>({projectName:l.projectName,threads:l.threads.map(c=>{const d=i[c.id];return{...c,title:js(d??c.title)}})}))}async function r(s={}){if(!(s.force!==!0&&Object.keys(t.value).length>0))try{const i=await f_();if(Object.keys(i.titles).length>0){const l={};for(const[c,d]of Object.entries(i.titles))l[c]=js(d);t.value=l}}catch{}}function o(s,i,l){const c=s.trim();if(c)return js(c);const d=l.map(m=>m.label.trim()).find(m=>m.length>0);return d?js(d):i.length>0?js("[Image]"):"Untitled thread"}async function a(s,i,l,c=[],d=[]){if(t.value[s])return;const m=i.trim();if(!m){const v=o(i,c,d);t.value={...t.value,[s]:v},e.applyThreadFlags(),xc(s,v);return}const f=m.length>300?m.slice(0,300):m;try{const v=await T_(f,l);if(!v||t.value[s])return;const T=v.length>Jf?v.slice(0,Jf):v;t.value={...t.value,[s]:T},e.applyThreadFlags(),xc(s,T)}catch{}}return{applyCachedTitlesToGroups:n,loadThreadTitleCacheIfNeeded:r,requestThreadTitleGeneration:a,resolveFallbackThreadTitle:o,threadTitleById:t}}function JD(e){const t=S({}),n=S({});function r(){return{pendingServerRequestsByThreadId:t,pendingReplyErrorByRequestId:n,applyThreadFlags:e.applyThreadFlags}}function o(T){eD(r(),T)}function a(T){tD(r(),T)}function s(T){rD(r(),T)}function i(T){return nD(r(),T)}const l=J(()=>{const T=[],k=e.getSelectedThreadId();return k&&Array.isArray(t.value[k])&&T.push(...t.value[k]),Array.isArray(t.value[gl])&&T.push(...t.value[gl]),T.sort((N,_)=>N.receivedAtIso.localeCompare(_.receivedAtIso))});function c(T){return T?Array.isArray(t.value[T])?t.value[T]:[]:[]}function d(T){return T.some(k=>qO(k.method))?"approval":T.length>0?"response":null}function m(T){const k={};for(const[N,_]of Object.entries(t.value))(N===gl||T.has(N))&&(k[N]=_);t.value=k}async function f(){try{const k=(await Ig()).map(N=>hb(N)).filter(N=>N!==null);s(k)}catch{}}async function v(T){try{const k=await Ig();for(const N of k){const _=Ge(N);if((_==null?void 0:_.id)===T)return!0}return!1}catch{return!0}}return{getThreadPendingRequests:c,loadPendingServerRequestsFromBridge:f,pendingReplyErrorByRequestId:n,pendingReplyErrorForRequest:i,pendingRequestStillExistsOnServer:v,pendingServerRequestsByThreadId:t,prunePendingServerRequestsByActiveThreads:m,readPendingRequestState:d,removePendingServerRequestById:a,replacePendingServerRequests:s,selectedThreadServerRequests:l,upsertPendingServerRequest:o}}const tc=220,QD=3e3,XD=1500,ZD=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 eF(e,t){if(t.length===0)return e;const n=new Set(e.map(s=>s.id)),r=new Map,o=[];for(const s of t){const i=s.modelSwitchInsertAfterId;if(i&&n.has(i)){const l=r.get(i)??[];l.push(s),r.set(i,l)}else o.push(s)}const a=[];for(const s of e){a.push(s);const i=r.get(s.id);i&&i.length>0&&a.push(...i)}return o.length>0&&a.push(...o),a}function tF(){const e=S([]),t=S([]),n=S(fO()),r=S(""),o=S({}),a=S({}),s=S(eO()),i=S({}),l=S({}),c=S(X$()),d=S(Z$()),m=S({}),f=new Map,v=new Map,T=new Map,k=new Map,N=S({}),_=S({}),j=S({}),W=new Map,U=SD({liveReasoningTextByThreadId:m,inProgressById:j}),fe=S({});let K=!1;const oe=S({}),{activeProviderId:ve,availableModelIds:Pe,availableModelReasoningEfforts:we,codexCliMissingError:te,isUpdatingSpeedMode:ke,selectedModelId:ee,selectedReasoningEffort:Ce,selectedSpeedMode:De,applyFallbackModelSelection:Ue,buildPendingTurnDetails:Ee,hasThreadModelSelection:be,hasThreadOwnModelSelection:Te,pruneThreadModelState:_e,readModelIdForThread:xe,refreshModelPreferences:Je,resolveThreadModelForProvider:Xe,setSelectedModelId:rt,setSelectedModelIdForThread:de,setSelectedReasoningEffort:B,setThreadModelId:ne,setThreadModelProviderId:ae,syncSelectedThreadModel:je,updateSelectedSpeedMode:We}=LD({selectedThreadId:n,error:r,onThreadModelChanged:p=>as(p)}),{availableCollaborationModes:E,selectedCollaborationMode:L,pruneThreadCollaborationState:H,refreshCollaborationModes:ue,setSelectedCollaborationMode:se,setSelectedCollaborationModeForThread:le,syncSelectedThreadCollaborationMode:Ne}=jD(n),Me=S(Q$()),Ae=S(nO()),{projectDisplayNameById:ye,projectOrder:ze,pinProjectToTop:$e,removeProject:Ve,renameProject:Ke,reorderProject:ft,setProjectDisplayNames:_t,setProjectOrder:Ct}=OD({sourceGroups:t,projectGroups:e,selectedThreadId:n,applyThreadFlags:pn,pruneThreadScopedState:ea,setSelectedThreadId:Qn}),dt=S({}),Y=S({}),pe=S({}),Ie=S({}),qe=S({}),Qe=S({}),xt=KD({selectedThreadId:n,error:r,persistedMessagesByThreadId:o,liveAgentMessagesByThreadId:i,inProgressById:j,externalSessionByThreadId:fe,resumedThreadById:dt,turnIndexByTurnIdByThreadId:Y,turnErrorByThreadId:qe,activeTurnIdByThreadId:Qe,markThreadAsRead:ss,markThreadMessagesPersisted:ls,replaceTurnIndexLookupForThread:I,rebindLiveFileChangeTurnIndices:Ze,setPersistedMessagesForThread:jr,setLiveAgentMessagesForThread:Tr,clearLiveAgentMessagesForThread:cs,removeLiveCommandsPersistedIn:na,removeLiveFileChangesPersistedIn:ji,setThreadInProgress:Mn,setThreadModelProviderId:ae,setThreadModelId:ne,resolveThreadModelForProvider:Xe,hasThreadOwnModelSelection:Te,clearTransientTurnErrorForThread:Xn,clearCompletedTurnLiveState:Ea,setTurnErrorForThread:Bt,getFirstPersistedTurnId:vo,currentThreadVersion:lr}),{ensureThreadMessagesLoaded:jt,hasMoreOlderMessagesByThreadId:Ho,isLoadingMessages:Kn,loadMessages:gn,loadOlderMessages:Wo,loadedMessagesByThreadId:yr,loadedVersionByThreadId:so,loadingOlderMessagesByThreadId:qs,pruneMessageHistoryState:ya,slowOpenThreadId:ts}=xt,wa=YD({applyThreadFlags:pn}),{threadTitleById:io,applyCachedTitlesToGroups:Ur,loadThreadTitleCacheIfNeeded:qo,requestThreadTitleGeneration:Go}=wa,Gs=JD({applyThreadFlags:pn,getSelectedThreadId:()=>n.value}),{getThreadPendingRequests:ba,loadPendingServerRequestsFromBridge:ns,pendingReplyErrorByRequestId:Ir,pendingReplyErrorForRequest:Ta,pendingRequestStillExistsOnServer:Vo,pendingServerRequestsByThreadId:lo,prunePendingServerRequestsByActiveThreads:uo,readPendingRequestState:co,removePendingServerRequestById:Ko,selectedThreadServerRequests:Sa,upsertPendingServerRequest:Vs}=Gs,vt={liveReasoningTextByThreadId:m,persistedReasoningByThreadId:c,turnIndexByTurnIdByThreadId:Y,activeTurnIdByThreadId:Qe,activeReasoningTurnIdByThreadId:k,reasoningItemTextByItemId:v,reasoningAppendedTextByItemId:f,turnItemSequenceByThreadId:T,appendLiveReasoningText:(p,y)=>U.appendLiveReasoningText(p,y),clearLiveReasoningSnapshot:p=>U.clearLiveReasoningSnapshot(p),savePersistedReasoningMap:Vl},It=S({}),Pt=S({}),an=S({}),Jt=S({}),In=S({}),{accountRateLimitSnapshots:Ar,codexQuota:_r,refreshRateLimits:vn,scheduleRateLimitRefresh:wr,setCodexRateLimit:ka,stopRateLimitRefresh:ar}=$D(),Mt=S(aO()),Ca=S(cO()),en=S(lO()),zr=S({}),Hr=S(!1),tn=S(!1),Pr=S(!1),Tn=S(new Set),Yo=6e4,Er=S([]);let Yn="";const Wt=S(!1);function xa(p){var y;try{const A=new URL(p,"http://localhost");return A.pathname!=="/codex-local-image"?"":((y=A.searchParams.get("path"))==null?void 0:y.trim())??""}catch{return""}}function Ia(p){const y=p.trim().toLowerCase();return y?/\b(attached image|attached screenshot|save the attached|copy (the )?screenshot|save screenshot)\b/i.test(y):!1}function sr(p){var A;const y=o.value[p]??[];for(let R=y.length-1;R>=0;R-=1){const z=y[R];if(!(z.role!=="user"||!Array.isArray(z.images)||z.images.length===0))for(let q=z.images.length-1;q>=0;q-=1){const G=((A=z.images[q])==null?void 0:A.trim())??"";if(G&&xa(G))return G}}return""}let Mr=null,Qt=null;const yn=new Map;let On=!1,fo=!1;const Xt=new Set,Jo=new Set;let Jn=!1,dn=!1;const ho=new Map,Vt=new Set,Ft=VD({selectedThreadId:n,projectGroups:e,inProgressById:j,applyThreadGroups:xu,reconcileInProgressFromThreadGroups:Ma,hydrateWorkspaceRootsStateIfNeeded:Un,loadThreadTitleCacheIfNeeded:qo,loadWorkspaceRootsStateForThreadList:$i,pruneThreadScopedState:ea,setSelectedThreadId:Qn}),po=J(()=>tr(e.value)),Dn=J(()=>po.value.find(p=>p.id===n.value)??null),{appendStashedMessage:Ks,autoCompactThreshold:ir,clearQueueState:Wr,enqueueQueuedMessage:Aa,findQueuedMessage:br,findStashedMessage:Qo,getStashedMessages:qr,loadPersistedQueueStateIfNeeded:Rr,pruneQueueState:mo,removeQueuedMessage:yt,reorderQueuedMessage:An,scheduleQueueStateRefresh:_n,selectedThreadQueuedMessages:Xo,setAutoCompactThreshold:x,takeStashedMessages:$}=WD(n),{hooksList:Z,installedSkills:Le,isHooksLoading:Oe,refreshHooks:At,refreshSkills:fn}=FD({getSelectedCwd:()=>{var p;return((p=Dn.value)==null?void 0:p.cwd)??""}}),Tt=J(()=>{const p=n.value;return!!(p&&Ca.value[p]===!0)}),Pn=J(()=>{const p=n.value;return p?It.value[p]===!0:!1}),En=J(()=>{const p=n.value;return p?Qe.value[p]??"":""}),go=J(()=>{var ie;const p=n.value;if(!p)return null;const y=j.value[p]===!0,A=y?Ie.value[p]:void 0,R=y?(m.value[p]??"").trim():"",z=(((ie=qe.value[p])==null?void 0:ie.message)??"").trim();let q="";if(!y&&z){const ce=o.value[p]??[];for(let ge=ce.length-1;ge>=0;ge-=1){const He=ce[ge];if(He.messageType==="turnError"){q=Xa(He.text);break}}}const G=!y&&z&&q===z?"":z;return!y&&!A&&!R&&!G?null:{activityLabel:(A==null?void 0:A.label)||"Thinking",activityDetails:(A==null?void 0:A.details)??[],reasoningText:R,errorText:G}}),Ys=J(()=>{const p=n.value;return p?Mt.value[p]??null:null}),Pi=J(()=>{const p=n.value;if(!p)return[];const y=o.value[p]??[],A=a.value[p]??[],R=i.value[p]??[],z=N.value[p]??[],q=_.value[p]??[],G=l.value[p]??[],ie=c.value[p]??[],ce=y.some(ht=>ht.messageType==="compaction.done"),ge=Tn.value.has(p),He=ce&&!ge?G.filter(ht=>ht.messageType!=="compaction.pending"&&ht.messageType!=="compaction.done"):G,et=Y$(p,y,ie,[A,z,q,R],He),wt=pe.value[p],ut=wt?_$(et,wt):et,Dt=P$(ut,d.value[p]),st=en.value[p]??[];return eF(Dt,st)}),Kt=J(()=>{const p=n.value;return p?Jt.value[p]??null:null}),Zo=J(()=>{const p=n.value;return p?Ho.value[p]===!0:!1}),Js=J(()=>{const p=n.value;return p?qs.value[p]===!0:!1});function vo(p){var A;const y=o.value[p]??[];for(const R of y){const z=((A=R.turnId)==null?void 0:A.trim())??"";if(z)return z}return""}function Qn(p,y={}){n.value!==p&&(n.value=p,y.persist!==!1&&hO(p),je(p),Ne(p),dn=!1)}function Al(p,y){const A=p.trim();if(!A)return;if(!y){if(!(A in Mt.value))return;Mt.value=St(Mt.value,A),wf(Mt.value);return}const R=Mt.value[A];if(R&&JSON.stringify(R)===JSON.stringify(y))return;Mt.value={...Mt.value,[A]:y},wf(Mt.value);const z=qr(A);z&&z.length>0&&ir.value>0&&(y.remainingContextPercent!==null&&y.remainingContextPercent<=ir.value?Tn.value.has(A)||li(A):ai(A))}function rs(p,y){In.value={...In.value,[p]:y}}function os(p,y,A){var wt;const R=p.trim(),z=y.trim(),q=A.trim();if(!R||!q||z===q)return;const G=en.value[R]??[],ie=o.value[R]??[],ce=ie.length,ge=zr.value[R],He=G.length>0&&ge!==void 0&&ge===ce;let et;if(He){const ut=G[G.length-1];et=[...G.slice(0,-1),{...ut,modelSwitchFrom:z||void 0,modelSwitchTo:q}]}else{const ut=(wt=ie[ie.length-1])==null?void 0:wt.id,Dt={id:`model-switch:${R}:${Date.now()}:${G.length}`,role:"system",text:"",messageType:Hw,modelSwitchFrom:z||void 0,modelSwitchTo:q,...ut?{modelSwitchInsertAfterId:ut}:{}};et=[...G,Dt].slice(-Ww)}en.value={...en.value,[R]:et},zr.value={...zr.value,[R]:ce},uO(en.value)}function as(p){const y=p.trim(),A=Mt.value[y];A&&A.modelContextWindow!==null&&(Mt.value={...Mt.value,[y]:{...A,modelContextWindow:null,remainingContextTokens:null,remainingContextPercent:null}},wf(Mt.value))}function hn(p){In.value[p]&&(In.value=St(In.value,p))}async function Gr(p){var A,R;if(Vt.has(p))return;const y=In.value[p];if(!(!y||y.fallbackRetried)){Vt.add(p),rs(p,{...y,fallbackRetried:!0});try{await Ue(p);try{const z=((R=(A=(o.value[p]??[]).reduce((q,G)=>{const ie=typeof G.turnIndex=="number"?G.turnIndex:-1,ce=q!==null&&typeof q.turnIndex=="number"?q.turnIndex:-1;return ie>=0&&ie>ce?G:q},null))==null?void 0:A.turnId)==null?void 0:R.trim())??"";if(z){const q=await nf(p,z);jr(p,q),ko(p),Tr(p,[]),Kr(p),N.value[p]&&(N.value=St(N.value,p))}}catch{}if(Bt(p,null),r.value="",nn(p,null),rn(p,{label:"Thinking",details:Ee(jo,y.effort,y.collaborationMode)}),Mn(p,!0),dt.value[p]!==!0){const z=await zf(p);z.model&&ne(p,Xe(p,z.model,z.modelProvider)),z.modelProvider&&ae(p,z.modelProvider),dt.value={...dt.value,[p]:!0}}await of(p,y.text,y.imageUrls,jo,y.effort||void 0,y.skills.length>0?y.skills:void 0,y.fileAttachments,y.collaborationMode),wr(),Xt.add(p),await zn()}catch(z){const q=z instanceof Error?z.message:"Unknown application error";Bt(p,q),r.value=q,Mn(p,!1),rn(p,null)}finally{Vt.delete(p)}}}function yo(p){if(!p||typeof window>"u")return;const y=yn.get(p);y!==void 0&&(window.clearTimeout(y),yn.delete(p))}function wo(p){if(!p||typeof window>"u")return;yo(p);const y=window.setTimeout(()=>{yn.delete(p),Xt.add(p),zn()},QD);yn.set(p,y)}function pn(){const y=Ur(t.value).map(A=>({projectName:A.projectName,threads:A.threads.map(R=>{const z=fe.value[R.id]??R.externalSession??null,q=j.value[R.id]===!0||(z==null?void 0:z.active)===!0,G=co(ba(R.id)),ie=n.value===R.id,ce=oe.value[R.id]===!0,ge=p$(R.updatedAtIso,Me.value[R.id],Ae.value);return{...R,inProgress:q,unread:!ie&&!q&&(ce||ge),pendingRequestState:G,...z?{externalSession:z}:{}}})}));e.value=Pc(e.value,y)}function bo(p,y,A){const R=new Date().toISOString(),z=nt(y),q=to(z),G={id:p,title:js(A),projectName:q,cwd:z,hasWorktree:z.includes("/.codex/worktrees/")||z.includes("/.git/worktrees/"),createdAtIso:R,updatedAtIso:R,preview:A,unread:!1,inProgress:!1},ie=t.value.findIndex(ge=>ge.projectName===q);if(ie>=0){const He=t.value[ie].threads.filter(ut=>ut.id!==p),et={projectName:q,threads:[G,...He]},wt=[...t.value];wt.splice(ie,1,et),t.value=wt}else t.value=[{projectName:q,threads:[G]},...t.value];const ce=al(ze.value,t.value);Ga(ze.value,ce)||Ct(ce),pn()}function ea(p){const y=new Set(p.map(z=>z.id)),A=n.value.trim();A&&y.add(A),_e(y),H(y);const R=on(Me.value,y);if(R!==Me.value&&(Me.value=R,hv(R)),ya(y),dt.value=on(dt.value,y),Y.value=on(Y.value,y),o.value=on(o.value,y),i.value=on(i.value,y),m.value=on(m.value,y),N.value=on(N.value,y),_.value=on(_.value,y),pe.value=on(pe.value,y),Ie.value=on(Ie.value,y),qe.value=on(qe.value,y),Qe.value=on(Qe.value,y),k.size>0)for(const z of[...k.keys()])y.has(z)||k.delete(z);q$(y),It.value=on(It.value,y),Pt.value=on(Pt.value,y),an.value=on(an.value,y),mo(y),Mt.value=on(Mt.value,y),oe.value=on(oe.value,y),j.value=on(j.value,y),uo(y)}function ss(p){const y=tr(t.value).find(A=>A.id===p);y&&(Me.value={...Me.value,[p]:y.updatedAtIso},hv(Me.value),oe.value[p]&&(oe.value=St(oe.value,p)),pn())}function nn(p,y){if(!p)return;const A=pe.value[p];if(y){if(x$(A,y))return;pe.value={...pe.value,[p]:y}}else A&&(pe.value=St(pe.value,p))}function Ei(p,y,A){if(!p||!y)return;const R={...d.value[p]??{}},z=Number.isFinite(A)?Math.max(0,Math.round(A)):0;z<=0?delete R[y]:R[y]=z,Object.keys(R).length===0?d.value=St(d.value,p):d.value={...d.value,[p]:R},vf(d.value)}function _a(p,y){if(!p||y.length===0)return;const A=d.value[p];if(!A)return;const R=new Set(y.map(q=>q.trim()).filter(q=>q.length>0));if(R.size===0)return;const z={};for(const[q,G]of Object.entries(A))R.has(q)||(z[q]=G);Object.keys(z).length!==Object.keys(A).length&&(Object.keys(z).length===0?d.value=St(d.value,p):d.value={...d.value,[p]:z},vf(d.value))}function Mn(p,y,A={}){!p||j.value[p]===!0===y||(y?(j.value={...j.value,[p]:!0},W.set(p,Date.now()),ei(p)):(j.value=St(j.value,p),W.delete(p),Ea(p,{keepLiveCommands:A.keepDeferredLiveCommands===!0}),Fn(p),oi(p)?li(p):ai(p)),pn(),!y&&!Ft.hasActiveInProgressThreads()&&Ft.hasRemainingThreadPages()&&Ft.scheduleRemainingThreadPages())}function Fn(p){p&&(It.value[p]&&(It.value=St(It.value,p)),Pt.value[p]&&(Pt.value=St(Pt.value,p)),an.value[p]&&(an.value=St(an.value,p)))}function Qs(p){p&&(It.value={...It.value,[p]:!0},Pt.value[p]&&(Pt.value=St(Pt.value,p)),an.value[p]&&(an.value=St(an.value,p)))}function is(p){p&&It.value[p]===!0&&Pt.value[p]===!0&&an.value[p]===!0&&Fn(p)}function Xs(p,y){!p||!y||It.value[p]===!0&&Fn(p)}function _l(p){const y=Object.keys(It.value);if(y.length===0)return;let A=Pt.value,R=!1;for(const z of y)!p.has(z)||A[z]===!0||(A={...A,[z]:!0},R=!0);if(R){Pt.value=A;for(const z of y)is(z)}}function ls(p,y){p&&It.value[p]===!0&&y.some(A=>A.role==="user")&&(an.value[p]!==!0&&(an.value={...an.value,[p]:!0}),is(p))}function mn(p){p&&p!==n.value&&oe.value[p]!==!0&&(oe.value={...oe.value,[p]:!0},pn())}function rn(p,y){if(!p)return;const A=Ie.value[p];if(!y){A&&(Ie.value=St(Ie.value,p));return}const R=Yr(y.label)||"Thinking",z=y.details.map(ie=>Yr(ie)).filter(ie=>ie.length>0&&ie!==R),q=Array.from(new Set([...(A==null?void 0:A.details)??[],...z])).slice(-3),G={label:R,details:q};I$(A,G)||(Ie.value={...Ie.value,[p]:G})}function Bt(p,y,A={}){if(!p)return;const R=qe.value[p],z=y?Xa(y):"";if(!z){R&&(qe.value=St(qe.value,p));return}const q=A.transient===!0;(R==null?void 0:R.message)===z&&R.transient===q||(qe.value={...qe.value,[p]:{message:z,transient:q}})}function Xn(p){var y;p&&(y=qe.value[p])!=null&&y.transient&&Bt(p,null)}function Lr(){const p=Object.entries(qe.value).filter(([,A])=>A==null?void 0:A.transient).map(([A])=>A);if(p.length===0)return;let y=qe.value;for(const A of p)y=St(y,A);qe.value=y}function lr(p){const y=tr(t.value).find(A=>A.id===p);return(y==null?void 0:y.updatedAtIso)??""}function us(p,y){if(!p)return;const A={...Ca.value};y?A[p]=!0:delete A[p],Ca.value=A,dO(A)}function To(){const p=n.value;p&&us(p,!Tt.value)}function jr(p,y){const A=o.value[p]??[];xl(A,y)||(o.value={...o.value,[p]:y})}function So(p,y,A=[],R=[],z=[]){const q=o.value[p]??[],G={id:`optimistic-user:${p}:${Date.now()}`,role:"user",text:y,images:A.length>0?[...A]:void 0,skills:R.length>0?R.map(ie=>({name:ie.name,path:ie.path})):void 0,fileAttachments:z.length>0?z.map(ie=>({...ie})):void 0,messageType:"userMessage.optimistic"};jr(p,[...q,G])}function Tr(p,y){pb(sn,p,y)}function cs(p){oD(sn,p)}function Vr(p,y){iD(sn,p,y)}function ur(p,y){uD(sn,p,y)}function Pa(p,y){lD(sn,p,y)}function Zs(p,y){U.setLiveReasoningText(p,y)}function Mi(p,y){U.appendLiveReasoningText(p,y)}function ei(p){U.restoreLiveReasoningSnapshot(p)}function ds(p){kD(vt,p)}function Kr(p,y=!1){CD(vt,p,y)}function ko(p){p&&p in a.value&&(a.value=St(a.value,p))}function Ri(p){p&&p in _.value&&(_.value=St(_.value,p))}function ti(p){p&&(Jo.delete(p),N.value[p]&&(N.value=St(N.value,p)))}function Ea(p,y={}){if(!p)return;ko(p);const A=s.value[p];if(A&&A.messageType==="plan.live"){const R={...A,messageType:"plan",plan:A.plan?{...A.plan,isStreaming:!1}:A.plan};s.value={...s.value,[p]:R},db(s.value)}Kr(p),H$(p),rn(p,null),n.value,y.keepLiveCommands===!0&&N.value[p]?Jo.add(p):ti(p),Qe.value[p]&&(Qe.value=St(Qe.value,p)),hn(p)}function fs(p){if(!p)return;const y=p===n.value;Mn(p,!1,{keepDeferredLiveCommands:y}),!(!y||typeof window>"u")&&window.setTimeout(()=>{Jo.has(p)&&j.value[p]!==!0&&ti(p)},XD)}function Pl(p){var ge;if(p.method!=="turn/plan/updated")return null;const y=Ge(p.params),A=qn(p),R=Re(y==null?void 0:y.turnId)||Re(y==null?void 0:y.turn_id),q=(Array.isArray(y==null?void 0:y.plan)?y==null?void 0:y.plan:[]).map(He=>Ge(He)).map(He=>({step:Re(He==null?void 0:He.step),status:kO(He==null?void 0:He.status)})).filter(He=>He.step.length>0);if(!A||!R)return null;const ie={explanation:Re(y==null?void 0:y.explanation).trim()||void 0,steps:q,isStreaming:!0},ce=(ge=Y.value[A])==null?void 0:ge[R];return{threadId:A,message:{id:`${R}:plan`,role:"assistant",text:CO(ie),messageType:"plan.live",plan:ie,turnId:R||void 0,turnIndex:typeof ce=="number"?ce:void 0}}}function Li(p){var He;if(p.method!=="item/plan/delta")return null;const y=Ge(p.params),A=qn(p),R=Re(y==null?void 0:y.turnId)||Re(y==null?void 0:y.turn_id),z=Re(y==null?void 0:y.delta);if(!A||!R||!z)return null;const q=`${R}:plan`,G=(a.value[A]??[]).find(et=>et.id===q),ie=`${(G==null?void 0:G.text)??""}${z}`,ce=G!=null&&G.plan?{...G.plan,isStreaming:!0}:void 0,ge=(He=Y.value[A])==null?void 0:He[R];return{threadId:A,message:{id:q,role:"assistant",text:ie,messageType:"plan.live",plan:ce,turnId:R||void 0,turnIndex:typeof ge=="number"?ge:void 0}}}const sn={liveCommandsByThreadId:N,liveFileChangeMessagesByThreadId:_,liveAgentMessagesByThreadId:i,livePlanMessagesByThreadId:a,lastPlanByThreadId:s},Bn={turnIndexByTurnIdByThreadId:Y,persistedMessagesByThreadId:o,liveFileChangeMessagesByThreadId:_};function Co(p){if(p.method==="server/request"){const y=hb(p.params);return y&&Vs(y),!0}if(p.method==="server/request/resolved"){const y=Ge(p.params),A=y==null?void 0:y.id;return typeof A=="number"&&Number.isInteger(A)&&Ko(A),!0}return!1}function Yr(p){return p.replace(/\s+/gu," ").trim()}function C(p){return mD(Bn,p)}function M(p,y,A){gD(Bn,p,y,A)}function I(p,y){vD(Bn,p,y)}function X(p,y){return yD(Bn,p,y)}function Ze(p){wD(Bn,p)}function Ut(p,y,A){AD(vt,p,y,A)}function Nr(p){_D(vt,p)}function Zn(p){var ce;if(p.method!=="item/started"&&p.method!=="item/completed")return null;const y=Ge(p.params),A=Ge(y==null?void 0:y.item);if(!A||Re(A.type).toLowerCase()!=="plan")return null;const R=qn(p),z=Re(y==null?void 0:y.turnId)||Re(y==null?void 0:y.turn_id),q=Re(A.id),G=Re(A.text);if(!R||!q||!G)return null;const ie=R&&z?(ce=Y.value[R])==null?void 0:ce[z]:void 0;return{threadId:R,message:{id:q,role:"assistant",text:G,messageType:p.method==="item/completed"?"plan":"plan.live",plan:zw(G)??void 0,turnId:z||void 0,turnIndex:typeof ie=="number"?ie:void 0}}}function ln(p){var ge;if(p.method!=="item/started")return null;const y=Ge(p.params),A=Ge(y==null?void 0:y.item);if(!A||A.type!=="commandExecution")return null;const R=Re(A.id),z=Re(A.command);if(!R)return null;const q=typeof A.cwd=="string"?A.cwd:null,G=qn(p),ie=Re(y==null?void 0:y.turnId)||Re(y==null?void 0:y.turn_id),ce=G&&ie?(ge=Y.value[G])==null?void 0:ge[ie]:void 0;return{id:R,role:"system",text:z,messageType:"commandExecution",commandExecution:{command:z,cwd:q,status:"inProgress",aggregatedOutput:"",exitCode:null},turnId:ie||void 0,turnIndex:typeof ce=="number"?ce:void 0}}function Jr(p){var ut;if(p.method!=="item/completed")return null;const y=Ge(p.params),A=Ge(y==null?void 0:y.item);if(!A||A.type!=="commandExecution")return null;const R=Re(A.id),z=Re(A.command);if(!R)return null;const q=typeof A.cwd=="string"?A.cwd:null,G=Re(A.status),ie=G==="failed"?"failed":G==="declined"?"declined":G==="interrupted"?"interrupted":"completed",ce=typeof A.aggregatedOutput=="string"?A.aggregatedOutput:"",ge=typeof A.exitCode=="number"?A.exitCode:null,He=qn(p),et=Re(y==null?void 0:y.turnId)||Re(y==null?void 0:y.turn_id),wt=He&&et?(ut=Y.value[He])==null?void 0:ut[et]:void 0;return{id:R,role:"system",text:z,messageType:"commandExecution",commandExecution:{command:z,cwd:q,status:ie,aggregatedOutput:ce,exitCode:ge},turnId:et||void 0,turnIndex:typeof wt=="number"?wt:void 0}}function ta(p){var ge;if(p.method!=="item/completed")return null;const y=Ge(p.params),A=Ge(y==null?void 0:y.item);if(!A||A.type!=="fileChange")return null;const R=Re(A.id);if(!R)return null;const z=Re(y==null?void 0:y.threadId),q=Re(y==null?void 0:y.turnId),G=z&&q?(ge=Y.value[z])==null?void 0:ge[q]:void 0,ie=Ff(A.changes),ce=mw(A.status);return ie.length===0||ce!=="completed"?null:{id:R,role:"system",text:"",messageType:"fileChange",fileChangeStatus:ce,fileChanges:ie,turnId:q||void 0,turnIndex:typeof G=="number"?G:void 0}}function xo(p,y){cD(sn,p,y)}function na(p,y){dD(sn,p,y)}function ji(p,y){fD(sn,p,y)}function Ni(p){if(p.method==="item/agentMessage/delta")return!0;const y=Ge(p.params);if(!y)return!1;if(p.method==="item/completed"){const A=Ge(y.item);return(A==null?void 0:A.type)==="agentMessage"}return!1}const Io=new Set;function ad(p){for(const y of Io)try{y(p)}catch{}}function Cu(p){return Io.add(p),()=>{Io.delete(p)}}function er(p,y,A){hD(sn,p,y,A)}function ra(p,y,A){pD(sn,p,y,A)}function Ao(p){var Hi,ca,Wi,ws,Eo,qi,Gi,Vi,bs,da;if(Co(p))return;if(Nr(p),p.method==="turn/started"){const Se=qn(p);Se&&T.delete(Se)}if(ZD.has(p.method))return;if(p.method==="app/list/updated"||p.method==="mcpServer/startupStatus/updated"||p.method==="mcpServer/oauthLogin/completed"||p.method==="remoteControl/status/changed"){ad(p.method);return}if(p.method==="skills/changed"){fn({force:!0});return}if(p.method==="hook/started"||p.method==="hook/completed"){At({force:!0});return}if(p.method==="thread/status/changed"){const Se=qn(p),bt=Re((ca=Ge((Hi=Ge(p.params))==null?void 0:Hi.status))==null?void 0:ca.type);Se&&(bt==="idle"||bt==="systemError")&&j.value[Se]===!0&&fs(Se),Se&&Se===n.value&&Xt.add(Se);return}if(p.method==="thread/archived"||p.method==="thread/unarchived"||p.method==="thread/deleted"||p.method==="thread/closed")return;if(p.method==="item/fileChange/patchUpdated"||p.method==="turn/diff/updated"){const Se=Ge(p.params),bt=Re(Se==null?void 0:Se.threadId);bt&&(p.method==="item/fileChange/patchUpdated"?er(bt,Re(Se==null?void 0:Se.itemId),Ff(Se==null?void 0:Se.changes)):ra(bt,Re(Se==null?void 0:Se.turnId),Re(Se==null?void 0:Se.diff)??""),bt===n.value&&Xt.add(bt));return}if(p.method==="account/rateLimits/updated"&&wr(),p.method==="thread/name/updated"){const Se=Ge(p.params),bt=Re(Se==null?void 0:Se.threadId),jn=Re(Se==null?void 0:Se.threadName);if(bt&&jn){const Ts=js(jn);io.value={...io.value,[bt]:Ts},pn(),xc(bt,Ts)}}if(p.method==="thread/compacted"){const Se=Ge(p.params),bt=Re(Se==null?void 0:Se.threadId);bt&&(Dr(bt,!1),_o(bt,"done"),Xt.add(bt));return}if(p.method==="fuzzyFileSearch/sessionUpdated"){const Se=Ge(p.params),bt=Re(Se==null?void 0:Se.sessionId);bt&&bt===Yn&&(Er.value=TI(Se));return}if(p.method==="fuzzyFileSearch/sessionCompleted"){const Se=Ge(p.params),bt=Re(Se==null?void 0:Se.sessionId);bt&&bt===Yn&&(Yn="");return}if(p.method==="account/rateLimits/updated"){ka(Cw(p.params));return}const y=IO(p);if(y){Al(y.threadId,y.usage);return}const A=PO(p);A&&rn(A.threadId,A.activity);const R=qn(p),z=_O(p);!z&&R&&Xn(R);const q=EO(p);q&&(ho.set(q.turnId,q),M(q.threadId,q.turnId,C(q.threadId)),Qe.value={...Qe.value,[q.threadId]:q.turnId},Xs(q.threadId,q.turnId),ko(q.threadId),Ri(q.threadId),nn(q.threadId,null),Bt(q.threadId,null),Mn(q.threadId,!0),_n(q.threadId),oe.value[q.threadId]&&(oe.value=St(oe.value,q.threadId)));const G=MO(p),ie=AO(p),ce=(G==null?void 0:G.threadId)??qn(p),ge=ce?xe(ce):"",He=!!ce&&!!ie&&ge!==jo&&Xu(new Error(ie));if(G){In.value[G.threadId];const Se=ho.get(G.turnId);Se&&ho.delete(G.turnId);const bt=Os((Wi=Ge(p.params))==null?void 0:Wi.durationMs)??Os((Eo=Ge((ws=Ge(p.params))==null?void 0:ws.turn))==null?void 0:Eo.durationMs)??(typeof G.startedAtMs=="number"?G.completedAtMs-G.startedAtMs:null)??(Se?G.completedAtMs-Se.startedAtMs:null),jn=typeof bt=="number"?Math.max(0,bt):0;nn(G.threadId,{turnId:G.turnId,durationMs:jn}),Ei(G.threadId,G.turnId,jn),Qe.value[G.threadId]&&(Qe.value=St(Qe.value,G.threadId)),fs(G.threadId),rn(G.threadId,null),mn(G.threadId),He||(hn(G.threadId),_n(G.threadId))}if(ie){const Se=(G==null?void 0:G.threadId)||qn(p);Se&&Bt(Se,ie),r.value=ie,Se&&He&&Gr(Se)}else G&&Bt(G.threadId,null);if(z){const Se=R,bt=Se?xe(Se):ee.value.trim();Se&&Bt(Se,z.message,{transient:z.transient}),r.value=z.message,bt!==jo&&Xu(new Error(z.message))&&(Se?Gr(Se):Ue())}const et=Pl(p);et&&(Vr(et.threadId,et.message),rn(et.threadId,{label:"Planning",details:((qi=et.message.plan)==null?void 0:qi.steps.map(Se=>Se.step).slice(0,2))??[]}));const wt=Li(p);wt&&(Vr(wt.threadId,wt.message),rn(wt.threadId,{label:"Planning",details:[]}));const ut=Zn(p);if(ut&&(Vr(ut.threadId,ut.message),rn(ut.threadId,{label:"Planning",details:((Gi=ut.message.plan)==null?void 0:Gi.steps.map(Se=>Se.step).slice(0,2))??[]})),!R||R!==n.value)return;DO(p);const Dt=FO(p);if(Dt){const Se=(i.value[R]??[]).find(cd=>cd.id===Dt.messageId),bt=`${(Se==null?void 0:Se.text)??""}${Dt.delta}`,jn=Dt.turnId??(Se==null?void 0:Se.turnId),Ts=jn?(Vi=Y.value[R])==null?void 0:Vi[jn]:Se==null?void 0:Se.turnIndex;ur(R,{id:Dt.messageId,role:"assistant",text:bt,messageType:"agentMessage.live",turnId:jn,turnIndex:typeof Ts=="number"?Ts:void 0})}const st=BO(p);if(st){const Se=st.turnId?(bs=Y.value[R])==null?void 0:bs[st.turnId]:void 0;ur(R,{...st,turnIndex:typeof Se=="number"?Se:void 0})}const ht=HO(p);ht&&ur(R,ht),RO(p)&&ds(R);const Po=LO(p);Po&&(Mi(R,Po.delta),ED(vt,Po.itemId,Po.delta));const dr=OO(p);if(dr&&(Ut(R,dr.itemId,dr.text),ds(R)),jO(p)){const Se=m.value[R]??"";Se.trim().length>0&&!Se.endsWith(`
|
|
75
|
+
|
|
76
|
+
`)&&Zs(R,`${Se}
|
|
77
|
+
|
|
78
|
+
`)}NO(p);const Rl=ln(p);Rl&&(xo(R,Rl),rn(R,{label:"Running command",details:[((da=Rl.commandExecution)==null?void 0:da.command)??""]}));const kr=WO(p);if(kr){const Se=(N.value[R]??[]).find(bt=>bt.id===kr.itemId);Se!=null&&Se.commandExecution&&xo(R,{...Se,commandExecution:{...Se.commandExecution,aggregatedOutput:`${Se.commandExecution.aggregatedOutput}${kr.delta}`}})}const Ui=Jr(p);Ui&&xo(R,Ui);const zi=ta(p);if(zi&&Pa(R,zi),Ni(p)&&Kr(R,!0),p.method==="turn/completed"){dn=!1,Kr(R),vv(vt);const Se=qn(p);Se&&(yo(Se),fs(Se),rn(Se,null),mn(Se),He||(hn(Se),_n(Se)))}}function oa(p){if(p.method==="thread/tokenUsage/updated"||p.method.startsWith("thread/realtime/"))return;const y=p.method,A=y==="turn/started"||y==="turn/completed"||y==="error",R=y.startsWith("thread/")||y==="turn/completed";if(!A&&!R)return;const z=qn(p);z&&A&&Xt.add(z),R&&(On=!0,fo=!0),!(Qt!==null||typeof window>"u")&&(Qt=window.setTimeout(()=>{Qt=null,zn()},tc))}async function Un(p,y){if(!Jn){Jn=!0;try{if(!y)return;const A=[];for(const R of od(y)){const z=Ai(R);A.includes(z)||A.push(z)}if(A.length>0){const R=y.projectOrder.length>0?al(A,p):al(ze.value,p);Ga(ze.value,R)||Ct(R,{persist:!1})}if(Object.keys(y.labels).length>0||(y.remoteProjects??[]).length>0){const R={...ye.value};let z=!1;for(const[q,G]of Object.entries(y.labels)){const ie=nt(q).trim(),ce=[Ai(q)];ie&&ce.push(ie);for(const ge of ce)R[ge]!==G&&(R[ge]=G,z=!0)}for(const q of y.order){const G=Ai(q),ie=to(hl(q));if(!ie.startsWith(".")||ie===G)continue;const ce=`${G} ${ie}`;R[G]!==void 0||R[G]===ce||(R[G]=ce,z=!0)}for(const q of y.remoteProjects??[]){const G=$$(q);R[q.id]!==G&&(R[q.id]=G,z=!0)}z&&_t(R,{persist:!1})}}catch{}}}async function $i(){try{return await sl()}catch{return null}}function ni(p,y){const A=Yf(p,y),R=B$(p,y),z=U$(R,y,A);if(!y||y.order.length===0&&(y.remoteProjects??[]).length===0)return z;const q=new Set;for(const ie of Kf(y,A))q.add(ie);const G=z.filter(ie=>q.has(ie.projectName)?!0:Qf(ie));return F$(G,y,A)}function Ma(p,y){const A=[];for(const R of p)for(const z of R.threads)j.value[z.id]!==!0||z.inProgress===!0||(W.get(z.id)??0)>=y||A.push(z.id);for(const R of A)fs(R)}function xu(p,y){const A=ni(p,y),R=!!(y&&(y.order.length>0||y.projectOrder.length>0||(y.remoteProjects??[]).length>0)),z=y!=null&&y.projectOrder.length?al(Kf(y,Yf(p,y)),A):al(ze.value,A);Ga(ze.value,z)||Ct(z,{persist:!R});const q=Gf(A,ze.value);_l(new Set(tr(q).map(ce=>ce.id)));const G=j$(t.value,q,j.value);t.value=Pc(t.value,G),j.value=on(j.value,new Set(tr(t.value).map(ce=>ce.id))),new Set(tr(t.value).map(ce=>ce.id));const ie={};for(const ce of tr(t.value))ie[ce.id]=ce.externalSession??fe.value[ce.id]??null;fe.value=ie,pn()}function Ra(p){Ft.removeThreadFromLoadedLists(p),t.value=Xw(t.value,p),j.value=St(j.value,p),pn()}async function $r(p={}){await Promise.allSettled([Je({providerChanged:p.providerChanged,includeProviderModels:p.includeProviderModels}),vn(),ue(),fn()])}function aa(p={}){const y=()=>{$r(p)};if(typeof window>"u"){y();return}window.setTimeout(y,0)}async function wn(p={}){r.value="",te.value="";const y=p.includeSelectedThreadMessages!==!1,A=p.awaitAncillaryRefreshes===!0;try{if(await Rr(),await Ft.loadThreads({force:p.forceThreadRefresh===!0}),y)try{await gn(n.value)}catch(R){r.value=R instanceof Error?R.message:"Unknown application error"}A?await $r({providerChanged:p.providerChanged,includeProviderModels:p.providerChanged===!0||A}):aa({providerChanged:p.providerChanged,includeProviderModels:!1})}catch(R){r.value=R instanceof Error?R.message:"Unknown application error",Yw(R)?te.value=mb:te.value=""}}async function hs(p){Qn(p);try{return await gn(p),Je({includeProviderModels:!0}),fn(),"ok"}catch(y){const A=y instanceof Error?y.message:"Unknown application error";r.value=A;const R=f$(y)?"not-found":"error";return p.trim()&&Bt(p,A,{transient:!0}),R}}async function ps(p){const y=n.value===p,A=y?d$(tr(e.value),p):"";y&&(Qn(A),A&&gn(A,{silent:!0}));try{await PA(p),Ra(p),await Ft.loadThreads(),y&&A&&n.value===A&&await jt(A,{silent:!0})}catch(R){r.value=R instanceof Error?R.message:"Unknown application error"}}async function La(p,y){const A=y.trim();if(!(!p||!A))try{await RA(p,A),io.value={...io.value,[p]:A},pn(),xc(p,A)}catch(R){r.value=R instanceof Error?R.message:"Unknown application error"}}async function ri(p){var G,ie;const y=p.trim();if(!y)return"";const A=tr(t.value).find(ce=>ce.id===y),R=((G=A==null?void 0:A.cwd)==null?void 0:G.trim())??"",z=((ie=A==null?void 0:A.title)==null?void 0:ie.trim())??"Forked chat",q=xe(y);r.value="";try{const ce=await rf(y,R||void 0,q||void 0),ge=ce.threadId.trim();return ge?(bo(ge,R,z),ne(ge,ce.model),dt.value={...dt.value,[ge]:!0},Qn(ge),await Ft.loadThreads(),await gn(ge),ge):""}catch(ce){return r.value=ce instanceof Error?ce.message:"Unknown application error",""}}async function ms(p,y){var G;const A=p.trim();if(!A||!Number.isInteger(y)||y<0)return"";if(j.value[A]===!0)return r.value="Finish the current turn before forking from a response.","";if(yr.value[A]!==!0)try{await gn(A)}catch(ie){return r.value=ie instanceof Error?ie.message:"Unknown application error",""}const R=o.value[A]??[];let z=-1;for(const ie of R)typeof ie.turnIndex=="number"&&Number.isFinite(ie.turnIndex)&&(z=Math.max(z,ie.turnIndex));if(z>=0&&y>z)return"";const q=tr(t.value).find(ie=>ie.id===A)??null;try{r.value="";const ie=e$(R,y),ce=ie?await rf(A,{beforeTurnId:ie}):await rf(A),ge=ce.threadId.trim();if(!ge)return"";const He=ce.cwd.trim()||((G=q==null?void 0:q.cwd)==null?void 0:G.trim())||"",et=z$((q==null?void 0:q.title)||(q==null?void 0:q.preview)||"Untitled thread");if(bo(ge,He,et),ne(ge,ce.model),jr(ge,ce.messages),yr.value={...yr.value,[ge]:!0},dt.value={...dt.value,[ge]:!0},ko(ge),Tr(ge,[]),Kr(ge),N.value[ge]&&(N.value=St(N.value,ge)),nn(ge,null),rn(ge,null),Bt(ge,null),Mn(ge,!1),!t$(ce.messages,ie,y)){const wt=await nf(ge,ie);jr(ge,wt)}return await La(ge,et),Qn(ge),Ft.loadThreads().catch(()=>{}),ge}catch(ie){return r.value=ie instanceof Error?ie.message:"Unknown application error",""}}async function gs(p,y,A=[],R=[],z=[]){if(!p||!y.trim()||A.length>0||R.length>0||z.length>0)return!1;const G=(lo.value[p]??[]).filter(ge=>ge.method==="item/tool/requestUserInput");if(G.length!==1)return!1;const[ie]=G,ce=ZO(ie);return ce.length!==1?!1:Hn({id:ie.id,result:{answers:{[ce[0]]:{answers:[y.trim()]}}}})}function oi(p){if(ir.value<=0||Tn.value.has(p))return!1;const y=Mt.value[p];return!y||y.remainingContextPercent===null?!1:y.remainingContextPercent<=ir.value}async function sd(p,y,A,R,z,q){if(K||ir.value<=0||j.value[p]===!0)return!1;const G=Mt.value[p];if(!G||G.remainingContextPercent===null||G.remainingContextPercent>ir.value)return!1;const ie=`stash-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,ce=q==="plan"?"plan":q==="default"?"default":L.value;return Ks(p,{id:ie,text:y,imageUrls:A,skills:R,fileAttachments:z,collaborationMode:ce}),Tn.value.has(p)||li(p),!0}async function ai(p){const y=qr(p);if(!y||y.length===0||j.value[p]===!0)return;const A=$(p);K=!0;try{for(const R of A)try{await ia(R.text,R.imageUrls,R.skills,"steer",R.fileAttachments,void 0,R.collaborationMode)}catch{}}finally{K=!1}}function id(p){return p instanceof Error&&/ActiveTurnNotSteerable|cannot steer a \S+ turn|same-turn steering/i.test(p.message)}function Oi(p){return p instanceof Error&&/expected active turn id/i.test(p.message)}async function sa(p,y,A,R,z,q){const G=Qe.value[p]??"";if(G)try{await NA(p,G,y,A,R,z),So(p,y,A,R,z),Xt.add(p),await zn(),wo(p);return}catch(ie){if(id(ie)){const ce=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;Aa(p,{id:ce,text:y,imageUrls:A,skills:R,fileAttachments:z,collaborationMode:q==="plan"?"plan":q==="default"?"default":L.value});return}if(!Oi(ie))throw ie}So(p,y,A,R,z),await Di(p,y,A,R,z,q)}async function ia(p,y=[],A=[],R="steer",z=[],q,G,ie){if(ke.value)return;const ce=n.value,ge=p.trim();if(!ce||!ge&&y.length===0&&z.length===0||await gs(ce,ge,y,A,z)||await sd(ce,ge,y,A,z,G))return;const He=j.value[ce]===!0;if(He&&R==="queue"){const et=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;Aa(ce,{id:et,text:ge,imageUrls:y,skills:A,fileAttachments:z,collaborationMode:G==="plan"?"plan":G==="default"?"default":L.value},q);return}if(He){dn=!0,sa(ce,ge,y,A,z,G).catch(et=>{const wt=et instanceof Error?et.message:"Unknown application error";Bt(ce,wt),r.value=wt});return}r.value="",dn=!0,nn(ce,null),So(ce,ge,y,A,z),rn(ce,{label:"Thinking",details:Ee(xe(ce),Ce.value,G==="plan"?"plan":G==="default"?"default":L.value)}),Bt(ce,null),Mn(ce,!0);try{await Di(ce,ge,y,A,z,G,ie)}catch(et){dn=!1,Mn(ce,!1),rn(ce,null);const wt=et instanceof Error?et.message:"Unknown application error";throw Bt(ce,wt),r.value=wt,et}}async function si(p,y,A=[],R=[],z=[]){if(ke.value)return"";const q=p.trim(),G=y.trim(),ie=xe(ga).trim(),ce=L.value;if(!q&&A.length===0&&z.length===0)return"";Hr.value=!0,r.value="";let ge="";try{try{const ut=await vg(G||void 0,ie||void 0);ge=ut.threadId,ne(ge,ut.model),ae(ge,ut.modelProvider||ve.value),le(ge,ce)}catch(ut){if(ie&&ie!==jo&&Xu(ut)){await Ue();const Dt=await vg(G||void 0,jo);ge=Dt.threadId,ne(ge,Dt.model),ae(ge,Dt.modelProvider||ve.value),le(ge,ce)}else throw ut}if(!ge)return"";bo(ge,G,q||"[Image]"),So(ge,q,A,R,z),Qs(ge),dt.value={...dt.value,[ge]:!0},Qn(ge),dn=!0,nn(ge,null),rn(ge,{label:"Thinking",details:Ee(xe(ge),Ce.value,ce)}),Bt(ge,null),Mn(ge,!0);const He=ge,et=G||null,wt=q;return Di(ge,q,A,R,z,ce).catch(ut=>{dn=!1,Mn(ge,!1),rn(ge,null);const Dt=ut instanceof Error?ut.message:"Unknown application error";Bt(ge,Dt),r.value=Dt}).finally(()=>{Hr.value=!1}),Go(He,wt,et,A,z),ge}catch(He){dn=!1,ge&&(Mn(ge,!1),rn(ge,null));const et=He instanceof Error?He.message:"Unknown application error";throw ge&&Bt(ge,et),r.value=et,Hr.value=!1,He}}async function Di(p,y,A=[],R=[],z=[],q,G){const ie=Ce.value,ce=q==="plan"?"plan":q==="default"?"default":L.value,ge=y.trim(),He=[...A];if(He.length===0&&Ia(ge)){const ut=sr(p);ut&&He.push(ut)}const et=R.map(ut=>({name:ut.name,path:ut.path})),wt=z.map(ut=>({...ut}));rs(p,{text:ge,imageUrls:[...He],skills:et,fileAttachments:wt,effort:ie,collaborationMode:ce,fallbackRetried:!1});try{if(dt.value[p]!==!0){const st=be(p),ht=await zf(p);ht.model&&!st&&ne(p,Xe(p,ht.model,ht.modelProvider)),ht.modelProvider&&ae(p,ht.modelProvider),dt.value={...dt.value,[p]:!0}}const ut=xe(p);let Dt="";try{Dt=await of(p,y,He,ut||void 0,ie||void 0,R.length>0?R:void 0,z,ce,...G?[G]:[])}catch(st){if(ut&&ut!==jo&&Xu(st))await Ue(p),rs(p,{text:ge,imageUrls:[...He],skills:et,fileAttachments:wt,effort:ie,collaborationMode:ce,fallbackRetried:!0}),Dt=await of(p,y,He,jo,ie||void 0,R.length>0?R:void 0,z,ce,...G?[G]:[]);else throw st}Dt&&(Qe.value={...Qe.value,[p]:Dt},Xs(p,Dt)),Xt.add(p),await zn(),wo(p)}catch(ut){throw ut}}async function El(){const p=n.value;if(!p||j.value[p]!==!0||It.value[p]===!0)return;let y=Qe.value[p];if(!y){const{activeTurnId:q}=await Uf(p);y=q,y&&(Qe.value={...Qe.value,[p]:y})}if(!y)throw new Error("Could not determine active turn id for interrupt");const A=Pi.value.filter(q=>q.turnId===y),R=A.find(q=>q.role==="user"&&q.isAgentNote!==!0),z=A.some(q=>{if(q.role==="assistant")return!0;const G=q.messageType??"";return G==="commandExecution"||G==="toolCall"||G==="worked"||G==="fileChange"||G==="plan"||G==="plan.live"||G==="compaction.done"||G==="turnError"});tn.value=!0,r.value="";try{if(await $A(p,y),Mn(p,!1),rn(p,null),Bt(p,null),Qe.value[p]&&(Qe.value=St(Qe.value,p)),Xt.add(p),On=!0,await zn(),R&&!z){const q=(o.value[p]??[]).filter(ie=>ie.turnId!==y);jr(p,q);const G=c.value[p];if(G){const ie=G.filter(ce=>ce.turnId!==y);ie.length!==G.length&&(c.value={...c.value,[p]:ie},Vl(c.value))}Jt.value={...Jt.value,[p]:{text:R.text??"",imageUrls:R.images??[],fileAttachments:(R.fileAttachments??[]).map(ie=>({label:ie.label,path:ie.path,fsPath:ie.fsPath??ie.path})),skills:R.skills??[]}}}}catch(q){const G=q instanceof Error?q.message:"Failed to interrupt active turn";Bt(p,G),r.value=G}finally{tn.value=!1}}function Rn(p){p&&Jt.value[p]&&(Jt.value=St(Jt.value,p))}async function Or(p,y){if(!y)throw new Error("Cannot roll back: failed to resolve the turn id where the removal starts");return await nf(p,y)}async function Sr(p,y){if(!p||!y||j.value[p]===!0||y===(Qe.value[p]??""))return!1;let A;try{A=await jA(p)}catch{return!1}return A.complete&&!A.turnIds.includes(y)}function ld(p,y){const A=o.value[p]??[],R=A.filter(G=>{var ie;return(((ie=G.turnId)==null?void 0:ie.trim())??"")!==y});R.length!==A.length&&jr(p,R);const z=c.value[p];if(!z)return;const q=z.filter(G=>{var ie;return(((ie=G.turnId)==null?void 0:ie.trim())??"")!==y});q.length!==z.length&&(c.value={...c.value,[p]:q},Vl(c.value))}function vs(p,y,A){const R=c.value[p];if(!R||R.length===0)return;const z=new Set(y.map(G=>G.trim()).filter(G=>G.length>0)),q=R.filter(G=>{var ge;const ie=((ge=G.turnId)==null?void 0:ge.trim())??"";if(ie&&z.has(ie))return!1;const ce=G.turnIndex;return!(A>=0&&typeof ce=="number"&&Number.isFinite(ce)&&ce>=A)});q.length!==R.length&&(c.value={...c.value,[p]:q},Vl(c.value))}async function ii(p){var A,R,z,q,G;const y=n.value;if(!y)return"no-thread";if(Pr.value)return"already-busy";if(!p.trim())return"no-turn";Pr.value=!0,r.value="";try{j.value[y]===!0&&await El();const ie=o.value[y]??[],ce=ie.find(st=>st.turnId===p),ge=ie.reduce((st,ht)=>typeof ht.turnIndex=="number"&&ht.turnIndex>st?ht.turnIndex:st,-1);if(ge<0)return"no-persisted";let He=typeof(ce==null?void 0:ce.turnIndex)=="number"?ce.turnIndex:((A=Y.value[y])==null?void 0:A[p])??-1;(He<0||He>ge)&&(console.warn(`[rollback] turn ${p} not resolvable (index=${He}), clamping to newest turn`),He=ge);let et=((R=ce==null?void 0:ce.turnId)==null?void 0:R.trim())??"";if(!et&&He>=0){const st=Y.value[y]??{};et=Object.keys(st).find(ht=>st[ht]===He)??""}if(!et){const st=ie.reduce((ht,Ln)=>{const Po=typeof Ln.turnIndex=="number"?Ln.turnIndex:-1,dr=ht!==null&&typeof ht.turnIndex=="number"?ht.turnIndex:-1;return Po>=0&&Po>dr?Ln:ht},null);et=((z=st==null?void 0:st.turnId)==null?void 0:z.trim())??""}if(await Sr(y,et)){console.warn(`[rollback] ${y}: turn ${et} is already gone on the server; reconciling locally instead of sending thread/revert`),ld(y,et),pv(y),_a(y,[et]),On=!0;try{await gn(y,{force:!0}),await zn()}catch{}if(!(o.value[y]??[]).some(ht=>{var Ln;return(((Ln=ht.turnId)==null?void 0:Ln.trim())??"")===et&&(ht.role==="user"||ht.role==="assistant")}))return"reconciled";console.warn(`[rollback] ${y}: probe reported turn ${et} as gone, but the forced reload restored it; falling back to thread/revert`)}const wt=await Or(y,et),ut=((G=(q=Dn.value)==null?void 0:q.cwd)==null?void 0:G.trim())??"";if(ut){const st=await pP(y,p,ut);st.errors.length>0&&console.warn(`[rollback] file revert for ${y} left errors: ${st.errors.join("; ")}`)}const Dt=ie.filter(st=>typeof st.turnIndex=="number"&&st.turnIndex>=He).map(st=>{var ht;return((ht=st.turnId)==null?void 0:ht.trim())??""}).filter(st=>st.length>0);return jr(y,wt),pv(y),Tr(y,[]),Kr(y),vs(y,[...Dt,et],He),_a(y,[...Dt,et]),N.value[y]&&(N.value=St(N.value,y)),nn(y,null),rn(y,null),Bt(y,null),On=!0,await zn(),"reverted"}catch(ie){const ce=ie instanceof Error?ie.message:"Failed to rollback thread";r.value=ce,Bt(y,ce);try{await gn(y,{force:!0})}catch{}return"failed"}finally{Pr.value=!1}}function _o(p,y){const R=(l.value[p]??[]).filter(z=>z.messageType!=="compaction.pending"&&z.messageType!=="compaction.done");R.push({id:`compaction:${y}:${p}:${Date.now()}`,role:"system",text:"",messageType:y==="pending"?"compaction.pending":"compaction.done"}),l.value={...l.value,[p]:R}}function Dr(p,y){const A=new Set(Tn.value);y?A.add(p):A.delete(p),Tn.value=A}function Fi(p){Yn=p.trim(),Er.value=[]}async function li(p){const y=p.trim();if(!(!y||Tn.value.has(y))){Dr(y,!0),_o(y,"pending");try{await MA(y);const A=2e3,R=14,z=Date.now()+Yo;let q=0;for(;Date.now()<z&&q<R&&Tn.value.has(y);){if((await Uf(y)).messages.some(ce=>ce.messageType==="compaction.done")){Dr(y,!1),n.value===y&&await gn(y,{silent:!0,force:!0}),_o(y,"done"),ai(y);break}q+=1,await c$(A)}Tn.value.has(y)&&(Dr(y,!1),_o(y,"done"),ai(y))}catch(A){r.value=A instanceof Error?A.message:"Failed to compact thread",Dr(y,!1),_o(y,"done"),ai(y)}}}async function zn(){if(Wt.value){typeof window<"u"&&Qt===null&&(Qt=window.setTimeout(()=>{Qt=null,zn()},tc));return}Wt.value=!0;const p=On,y=fo,A=new Set(Xt);On=!1,fo=!1,Xt.clear();try{p&&await Ft.loadThreads({force:y});const R=n.value;if(!R)return;const z=A.has(R),q=j.value[R]===!0,G=lr(R),ie=so.value[R]??"";(G.length>0&&G!==ie||z||q&&yr.value[R]!==!0||p&&yr.value[R]!==!0)&&await gn(R,{silent:!0,force:z})}catch{}finally{Wt.value=!1,(On||Xt.size>0)&&typeof window<"u"&&Qt===null&&(Qt=window.setTimeout(()=>{Qt=null,zn()},tc))}}async function ui(){await ns();const p=Object.values(j.value).some(y=>y===!0);On=!Ft.hasLoadedThreads.value||p,p&&(fo=!0),n.value&&(p||yr.value[n.value]!==!0)&&Xt.add(n.value),await zn()}function la(p){const y=Ge(p.params),A=typeof(y==null?void 0:y.threadId)=="string"?y.threadId.trim():"";if(!A)return;const R=Ge(y==null?void 0:y.externalSession),z=R&&typeof R.origin=="string"&&R.origin.trim().length>0?{origin:R.origin.trim(),active:R.active===!0,lastWriteAt:typeof R.lastWriteAt=="string"?R.lastWriteAt:null}:null;fe.value={...fe.value,[A]:z},Mn(A,(z==null?void 0:z.active)===!0),pn(),On=!0,n.value===A&&Xt.add(A),Qt===null&&typeof window<"u"&&(Qt=window.setTimeout(()=>{Qt=null,zn()},tc))}function Ml(){typeof window>"u"||Mr||(ns(),ua(),ys(),Mr=a_(p=>{if(p.method==="ready"){Lr(),ui();return}if(p.method==="externalSessionChanged"){la(p);return}Ao(p),oa(p)}))}async function ua(){try{const p=await h_(),y=Object.entries(p);if(y.length===0)return;const A={...c.value};let R=!1;for(const[z,q]of y){const G=q.filter(He=>!!He&&typeof He.id=="string");if(G.length===0)continue;const ie=A[z]??[],ce=new Set(ie.map(He=>He.text)),ge=[...ie];for(const He of G)ce.has(He.text)||(ge.push(He),ce.add(He.text));A[z]=ge.slice(-20),R=!0}R&&(c.value=A,Vl(A))}catch{}}async function ys(){try{const p=await m_(),y=Object.entries(p);if(y.length===0)return;const A={...d.value};let R=!1;for(const[z,q]of y){if(!z||!q||typeof q!="object"||Array.isArray(q))continue;const G={};for(const[ge,He]of Object.entries(q))!ge||typeof He!="number"||!Number.isFinite(He)||He<=0||(G[ge]=Math.round(He));if(Object.keys(G).length===0)continue;const ie={...A[z]??{},...G},ce=Object.keys(ie);A[z]=ce.length>200?Object.fromEntries(ce.slice(-200).map(ge=>[ge,ie[ge]])):ie,R=!0}R&&(d.value=A,cb(p),vf(A))}catch{}}async function Hn(p){try{return await s_(p.id,{result:p.result,error:p.error}),Ko(p.id),Ir.value=St(Ir.value,String(p.id)),!0}catch(y){const A=y instanceof Error?y.message:"Failed to reply to server request";return await Vo(p.id)?(r.value=A,Ir.value={...Ir.value,[String(p.id)]:A},!1):(Ko(p.id),Ir.value=St(Ir.value,String(p.id)),!0)}}function ja(){if(Mr&&(Mr(),Mr=null),On=!1,Xt.clear(),ho.clear(),Qt!==null&&typeof window<"u"&&(window.clearTimeout(Qt),Qt=null),ar(),Ft.dispose(),typeof window<"u")for(const p of yn.values())window.clearTimeout(p);yn.clear(),dn=!1,o.value={},a.value={},i.value={},m.value={},c.value={},d.value={},N.value={},_.value={},Y.value={},Ie.value={},pe.value={},qe.value={},Qe.value={},k.clear(),vv(vt),T.clear(),W$(),It.value={},Pt.value={},an.value={},Wr(),ka(null),Mt.value={}}function Bi(p){const y=n.value;if(!y)return;const A=Qo(y,p);if(A){yt(p),se(A.collaborationMode),K=!0,ia(A.text,A.imageUrls,A.skills,"steer",A.fileAttachments).finally(()=>{K=!1});return}const R=br(y,p);R&&(yt(p),se(R.collaborationMode),ia(R.text,R.imageUrls,R.skills,"steer",R.fileAttachments))}function cr(p,y={}){Qn(p,y)}return{projectGroups:e,projectDisplayNameById:ye,selectedThread:Dn,selectedThreadTokenUsage:Ys,selectedThreadTerminalOpen:Tt,isSelectedThreadInterruptPending:Pn,selectedThreadServerRequests:Sa,selectedLiveOverlay:go,selectedActiveTurnId:En,lastPlanByThreadId:s,resolveThreadTurnIndex:X,codexQuota:_r,selectedThreadId:n,availableCollaborationModes:E,availableModelIds:Pe,availableModelReasoningEfforts:we,selectedCollaborationMode:L,selectedModelId:ee,selectedReasoningEffort:Ce,selectedSpeedMode:De,codexCliMissingError:te,installedSkills:Le,accountRateLimitSnapshots:Ar,messages:Pi,hasMoreOlderMessages:Zo,isLoadingThreads:Ft.isLoadingThreads,isThreadListFullyLoaded:Ft.isThreadListFullyLoaded,isLoadingMessages:Kn,slowOpenThreadId:ts,isLoadingOlderMessages:Js,isSendingMessage:Hr,isInterruptingTurn:tn,isUpdatingSpeedMode:ke,isRollingBack:Pr,compactingThreadIds:Tn,fuzzyFileSearchResults:Er,registerFuzzyFileSearchSession:Fi,error:r,refreshAll:wn,refreshSkills:fn,refreshHooks:At,hooksList:Z,isHooksLoading:Oe,onRealtimeEvent:Cu,selectThread:hs,loadMessages:gn,loadOlderMessages:Wo,ensureThreadMessagesLoaded:jt,setThreadTerminalOpen:us,toggleSelectedThreadTerminal:To,archiveThreadById:ps,compactThreadById:li,renameThreadById:La,forkThreadById:ri,forkThreadFromTurn:ms,rollbackSelectedThread:ii,setTurnErrorForThread:Bt,sendMessageToSelectedThread:ia,sendMessageToNewThread:si,interruptSelectedThreadTurn:El,interruptedUnsubmittedMessage:Kt,clearInterruptedUnsubmittedMessage:Rn,selectedThreadQueuedMessages:Xo,removeQueuedMessage:yt,reorderQueuedMessage:An,steerQueuedMessage:Bi,autoCompactThreshold:ir,setAutoCompactThreshold:x,setSelectedCollaborationMode:se,readModelIdForThread:xe,setSelectedModelIdForThread:de,injectModelSwitchDivision:os,invalidateThreadContextWindow:as,setSelectedModelId:rt,setSelectedReasoningEffort:B,updateSelectedSpeedMode:We,respondToPendingServerRequest:Hn,pendingReplyErrorForRequest:Ta,renameProject:Ke,removeProject:Ve,reorderProject:ft,pinProjectToTop:$e,startPolling:Ml,stopPolling:ja,primeSelectedThread:cr}}const yb="codex-web-local.sidebar-collapsed.v1",wb="codex-web-local.accounts-section-collapsed.v1";function nF(){return typeof window>"u"?!1:window.localStorage.getItem(yb)==="1"}function rF(e){typeof window>"u"||window.localStorage.setItem(yb,e?"1":"0")}function oF(){if(typeof window>"u")return!0;const e=window.localStorage.getItem(wb);return e===null?!0:e==="1"}function aF(){const e=S(nF()),t=S(oF()),n=S(""),r=S(!1),o=S(null),a=S(null);let s=0,i=0,l=!1;function c(_){var j;if(e.value!==_){if(_){const W=(j=f())==null?void 0:j.scrollTop;typeof W=="number"&&(W>0||s===0)&&(s=W)}e.value=_,rF(_),_||T()}}function d(){r.value=!r.value,r.value?Et(()=>{var _;return(_=a.value)==null?void 0:_.focus()}):n.value=""}function m(){var _;n.value="",(_=a.value)==null||_.focus()}function f(){return o.value?o.value:typeof document>"u"?null:document.querySelector(".mobile-drawer .sidebar-scrollable, .sidebar-scrollable")}function v(_){if(e.value||l)return;const W=(_==null?void 0:_.currentTarget)&&typeof HTMLElement<"u"&&_.currentTarget instanceof HTMLElement?_.currentTarget:f();s=(W==null?void 0:W.scrollTop)??s}function T(){const _=++i,j=s,W=90;l=!0;const V=()=>{_===i&&(s=j,l=!1)},U=fe=>{if(_!==i)return;if(e.value){V();return}const K=f();if(K&&(K.scrollTop=j,Math.abs(K.scrollTop-j)<=1||fe>=W)){V();return}if(fe>=W||typeof window>"u"){V();return}window.requestAnimationFrame(()=>U(fe+1))};Et(()=>U(0))}function k(_){_.key==="Escape"&&(r.value=!1,n.value="")}function N(){t.value=!t.value,!(typeof window>"u")&&window.localStorage.setItem(wb,t.value?"1":"0")}return{isSidebarCollapsed:e,isAccountsSectionCollapsed:t,sidebarSearchQuery:n,isSidebarSearchVisible:r,sidebarScrollableRef:o,sidebarSearchInputRef:a,setSidebarCollapsed:c,toggleSidebarSearch:d,clearSidebarSearch:m,onSidebarScroll:v,onSidebarSearchKeydown:k,restoreSidebarScrollPosition:T,toggleAccountsSectionCollapsed:N}}const bb="codex-web-local.right-panel-width.v1",sF=260,iF=640,wv=320;function Tb(e){return Math.min(iF,Math.max(sF,e))}function lF(){if(typeof window>"u")return wv;const e=window.localStorage.getItem(bb),t=Number(e);return Number.isFinite(t)?Tb(t):wv}function uF(e){typeof window>"u"||window.localStorage.setItem(bb,String(e))}function cF(e){const{isMobile:t,canShowRightPanel:n,isVirtualKeyboardOpen:r}=e,o=S("git"),a=S([]),s=S(""),i=J(()=>a.value.find(we=>we.key===s.value)??null),l=S(!1),c=S(!1),d=S(!1),m=S(lF()),f=S(!1),v=S(!1);let T=null;function k(){T&&(clearTimeout(T),T=null)}function N(){f.value=!1,v.value=!1,k()}function _(we){we.preventDefault();const te=we.clientX,ke=m.value,ee=De=>{const Ue=te-De.clientX;m.value=Tb(ke+Ue)},Ce=()=>{uF(m.value),window.removeEventListener("mousemove",ee),window.removeEventListener("mouseup",Ce)};window.addEventListener("mousemove",ee),window.addEventListener("mouseup",Ce)}function j(){n()&&(t()&&!c.value&&(c.value=!0),t()||(d.value=!1),o.value=o.value==="terminal"?"git":"terminal",o.value!=="terminal"&&N())}function W(we){o.value=we,l.value=!1,t()||(d.value=!1),t()&&(c.value=!0),we!=="terminal"&&N()}function V(we){const te=a.value.find(ke=>ke.path===we.path);if(te)s.value=te.key;else{const ke={key:`preview-${Date.now()}`,path:we.path,label:we.label};a.value=[...a.value,ke],s.value=ke.key}W("preview")}function U(we){a.value.some(te=>te.key===we)&&(s.value=we,W("preview"))}function fe(we){const te=a.value.findIndex(Ce=>Ce.key===we);if(te<0)return;const ke=a.value.filter(Ce=>Ce.key!==we);if(a.value=ke,s.value!==we)return;if(ke.length===0){s.value="",o.value="files";return}const ee=ke[Math.min(te,ke.length-1)];s.value=ee.key}function K(){if(t()){c.value=!1;return}d.value=!0,l.value=!1,N()}function oe(){if(t()){c.value=!c.value;return}d.value=!d.value,d.value&&(l.value=!1,N())}function ve(){o.value="git",t()&&(c.value=!1),N()}function Pe(we){if(f.value=we,!we){v.value=!1,k();return}v.value=!0,k(),T=setTimeout(()=>{T=null,r()||(v.value=!1)},1500)}return{activeRightPanelTab:o,filePreviewTabs:a,activeFilePreviewTabKey:s,activeFilePreviewTab:i,isRightPanelMenuOpen:l,isMobileRightPanelOpen:c,isRightPanelCollapsed:d,rightPanelWidth:m,isTerminalInputFocused:f,isTerminalKeyboardFocusFallbackActive:v,onRightResizeHandleMouseDown:_,toggleRightPanelTerminal:j,selectRightPanelTab:W,onOpenFilePreview:V,selectFilePreviewTab:U,closeFilePreviewTab:fe,onCloseRightPanel:K,onToggleRightPanelToggle:oe,onHideRightPanelTerminal:ve,onTerminalFocusChange:Pe,resetTerminalKeyboardFocusState:N,clearTerminalKeyboardFocusFallbackTimer:k}}function dF(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 bv(e){var t;if(typeof navigator<"u"&&((t=navigator.clipboard)!=null&&t.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!dF(e))throw new Error("Copy failed")}const fF=400;function hF(e,t,n,r){return e==="visible"&&!n&&t!==null&&r-t>=fF}function pF(e){if(!e||/[\r\n]/u.test(e)||e.endsWith("/")||e.endsWith("\\")||/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(e))return!1;const t=e.startsWith("/"),n=/^[A-Za-z]:[\\/]/u.test(e),r=e.startsWith("./")||e.startsWith("../")||e.startsWith("~/");return t||n||r||/^[A-Za-z0-9._@() -]+\.[A-Za-z0-9]{1,12}$/u.test(e)?!0:/^[A-Za-z0-9._@() -]+(?:[\\/][A-Za-z0-9._@() -]+)+$/u.test(e)}function Rc(e){return e.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||e}function Lc(e){return e.replace(/\\/gu,"/")}function Sb(e){if(!e.startsWith("file://"))return e;let t=e.replace(/^file:\/\//u,"");try{t=decodeURIComponent(t)}catch{}return/^\/[A-Za-z]:\//u.test(t)&&(t=t.slice(1)),t}function mF(e){const t=Lc(e),n=t.match(/^\/Users\/([^/]+)/u);if(n)return`/Users/${n[1]}`;const r=t.match(/^\/home\/([^/]+)/u);return r?`/home/${r[1]}`:""}function nc(e){const t=Lc(e);if(!t)return t;let n="",r=t;const o=r.match(/^([A-Za-z]:)(\/.*)?$/u);o?(n=`${o[1]}/`,r=(o[2]??"").replace(/^\/+/u,"")):r.startsWith("/")&&(n="/",r=r.slice(1));const a=r.split("/").filter(Boolean),s=[];for(const l of a)if(l!=="."){if(l===".."){s.length>0&&s.pop();continue}s.push(l)}const i=s.join("/");return n?`${n}${i}`.replace(/\/+$/u,"")||n:i||t}function dz(e,t){const n=Lc(Sb(e.trim()));if(!n)return"";if(n.startsWith("/")||/^[A-Za-z]:\//u.test(n))return nc(n);if(n.startsWith("~/")){const a=mF(t);if(a)return nc(`${a}/${n.slice(2)}`)}const o=Lc(t.trim());return nc(o?`${o.replace(/\/+$/u,"")}/${n}`:n)}function jc(e){let t=e,n="",r="";const o={"(":")","[":"]","{":"}","<":">",'"':'"',"'":"'","`":"`","“":"”","‘":"’"};for(;t.length>0;){const a=t[0],s=Object.prototype.hasOwnProperty.call(o,a)?o[a]:"";if(!s||!t.endsWith(s))break;n+=a,r+=s,t=t.slice(1,-1)}return{core:t,leading:n,trailing:r}}function Nc(e){if(!e)return null;let t=e.trim();t=jc(t).core.trim();let r=null;const o=t.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(o)t=o[1],r=Number(o[2]);else{const a=t.match(/^(.*):(\d+)(?::\d+)?$/u);a&&(t=a[1],r=Number(a[2]))}return t=Sb(t),pF(t)?{path:t,line:r}:null}function Tv(e,t,n){let r=0,o=t-1;for(;o>=n&&e[o]==="*";)r+=1,o-=1;return r}function gF(e,t){let n=0,r=t;for(;r<e.length&&e[r]==="*";)n+=1,r+=1;return n}function kb(e,t,n,r,o){const a=Tv(e,t,r);return a<2?null:gF(e,n)>=a?{segmentStart:t-a,segmentEnd:n+a,tokenEndTrim:0}:Tv(o,o.length,0)>=a?{segmentStart:t-a,segmentEnd:n,tokenEndTrim:a}:null}function oh(e){const t=e.trim();if(!t.startsWith("[")||!t.endsWith(")"))return null;const n=t.indexOf("]");if(n<=1||t[n+1]!=="(")return null;const r=t.slice(1,n).trim(),o=t.slice(n+2,-1).trim();if(r.includes(`
|
|
79
|
+
`)||o.includes(`
|
|
80
|
+
`))return null;const a=jc(r).core.trim()||r,s=jc(o).core.trim();return s?{label:a,target:s}:null}function $c(e){const t=e.trim().match(/^codex:\/\/threads\/([A-Za-z0-9-]+)$/u);if(!t)return null;if(typeof window>"u")return`/#/thread/${t[1]}`;const n=window.location.pathname.replace(/\/?$/u,"/");return`${window.location.origin}${n}#/thread/${t[1]}`}function fz(e){const t=Math.min(6,Math.max(1,Math.trunc(e)));return`h${String(t)}`}function hz(e){switch(Math.min(6,Math.max(1,Math.trunc(e)))){case 1:return"message-heading-h1";case 2:return"message-heading-h2";case 3:return"message-heading-h3";case 4:return"message-heading-h4";case 5:return"message-heading-h5";default:return"message-heading-h6"}}function vF(e){const t=e.trim();if(!t)return"";if(t.startsWith("data:")||t.startsWith("blob:")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/codex-local-image?"))return t;if(t.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(t)}`;const n=t.startsWith("/"),r=/^[A-Za-z]:[\\/]/u.test(t);return n||r?`/codex-local-image?path=${encodeURIComponent(t)}`:t}function vl(e,t={}){const n=[],r=/codex:\/\/threads\/[A-Za-z0-9-]+|https?:\/\/[^\s<>"'`,。;:!?、()[\]{}「」『』《》]+|file:\/\/[^\n<>"'`,。;:!?、[\]{}「」『』《》]+|["'](?:[A-Za-z]:[\\/]|~\/|\.{1,2}\/|\/)[^\n"']+["']|`(?:[A-Za-z]:[\\/]|~\/|\.{1,2}\/|\/)[^`\n]+`/gu;let o=0;for(const a of e.matchAll(r)){if(typeof a.index!="number")continue;const s=a.index,i=s+a[0].length;let l=a[0],c="";for(;/[.,;:!?,。;:!?、]$/u.test(l);)c=l.slice(-1)+c,l=l.slice(0,-1);const d=kb(e,s,i,o,l),m=(d==null?void 0:d.segmentStart)??s,f=(d==null?void 0:d.segmentEnd)??i;m>o&&n.push({kind:"text",value:e.slice(o,m)}),d!=null&&d.tokenEndTrim&&(l=l.slice(0,-d.tokenEndTrim));const v=jc(l);l=v.core;const T=v.leading,k=v.trailing+c;T&&n.push({kind:"text",value:T});const N=$c(l);if(N)n.push({kind:"url",value:N,href:N}),k&&n.push({kind:"text",value:k});else if(l.startsWith("**")&&l.endsWith("**")&&l.length>4)n.push({kind:"bold",value:l.slice(2,-2)}),k&&n.push({kind:"text",value:k});else if(/^https?:\/\//u.test(l))n.push({kind:"url",value:l,href:l}),k&&n.push({kind:"text",value:k});else{const _=Nc(l);_?(n.push({kind:"file",value:l,path:_.path,displayPath:l,downloadName:Rc(_.path)}),k&&n.push({kind:"text",value:k})):n.push({kind:"text",value:a[0]})}o=f}return o<e.length&&n.push({kind:"text",value:e.slice(o)}),t.applyMarkdownMarkers===!1?n:Cb(n)}function bf(e,t){const n=[];let r=!1,o="";const a=s=>{s&&n.push({kind:"text",value:s})};for(const s of e){if(s.kind!=="text"){r&&(a(`${t.marker}${o}`),r=!1,o=""),n.push(s);continue}let i=s.value;for(;i.length>0;){const l=i.indexOf(t.marker);if(l<0){r?o+=i:a(i);break}const c=i.slice(0,l);if(r?o+=c:a(c),i=i.slice(l+t.marker.length),r){const d=o;d.length>0&&(!t.isValidContent||t.isValidContent(d))?n.push({kind:t.kind,value:d}):a(`${t.marker}${d}${t.marker}`),o="",r=!1}else r=!0}}return r&&a(`${t.marker}${o}`),n}function Cb(e){const t=r=>r.trim().length>0&&!/^\s/u.test(r)&&!/\s$/u.test(r);let n=bf(e,{marker:"**",kind:"bold",isValidContent:t});return n=bf(n,{marker:"~~",kind:"strikethrough",isValidContent:t}),n=bf(n,{marker:"*",kind:"italic",isValidContent:t}),n}function yF(e,t={}){const n=[];let r=0,o=0;const a=(s,i)=>{let l=s.indexOf("[",i);for(;l>=0;){const c=s.indexOf("]",l+1);if(c<0)return null;if(s[c+1]!=="("){l=s.indexOf("[",l+1);continue}let d=1,m=c+2,f=!1;for(;m<s.length;){const v=s[m];if(v===`
|
|
81
|
+
`){f=!0;break}if(v==="("&&(d+=1),v===")"&&(d-=1,d===0)){const T=s.slice(l,m+1);if(oh(T))return{start:l,end:m+1,token:T};break}m+=1}if(f){l=s.indexOf("[",l+1);continue}l=s.indexOf("[",l+1)}return null};for(;o<e.length;){const s=a(e,o);if(!s)break;const{start:i,end:l,token:c}=s,d=kb(e,i,l,r,c),m=(d==null?void 0:d.segmentStart)??i,f=(d==null?void 0:d.segmentEnd)??l;m>r&&n.push(...vl(e.slice(r,m),t));const v=oh(c);if(!v){n.push(...vl(e.slice(m,f),t)),r=f,o=f;continue}const T=v.label,k=v.target,N=$c(k);if(N)n.push({kind:"url",value:T||N,href:N});else if(/^https?:\/\//u.test(k))n.push({kind:"url",value:T||k,href:k});else{const _=Nc(k);_?n.push({kind:"file",value:k,path:_.path,displayPath:T||k,downloadName:Rc(_.path)}):n.push({kind:"text",value:c})}r=f,o=f}return r<e.length&&n.push(...vl(e.slice(r),t)),n}function pz(e){const t=e.includes("`"),n=yF(e,{applyMarkdownMarkers:!t});if(!t)return n;if(!n.some(o=>o.kind==="text"&&o.value.includes("`")))return Cb(n);const r=o=>{if(!o.includes("`"))return vl(o);const a=[];let s=0,i=0;for(;s<o.length;){if(o[s]!=="`"){s+=1;continue}let l=1;for(;s+l<o.length&&o[s+l]==="`";)l+=1;const c="`".repeat(l);let d=s+l,m=-1;for(;d<o.length;){const v=o.indexOf(c,d);if(v<0)break;const T=v>0&&o[v-1]==="`",k=v+l<o.length&&o[v+l]==="`",N=o.slice(s+l,v).includes(`
|
|
82
|
+
`);if(!T&&!k&&!N){m=v;break}d=v+1}if(m<0){s+=l;continue}s>i&&a.push(...vl(o.slice(i,s)));const f=o.slice(s+l,m);if(f.length>0){const v=oh(f);if(v){const T=$c(v.target);if(T)a.push({kind:"url",value:v.label||T,href:T});else if(/^https?:\/\//u.test(v.target))a.push({kind:"url",value:v.label||v.target,href:v.target});else{const k=Nc(v.target);k?a.push({kind:"file",value:v.target,path:k.path,displayPath:v.label||v.target,downloadName:Rc(k.path)}):a.push({kind:"code",value:f})}}else{const T=$c(f);if(T)a.push({kind:"url",value:T,href:T});else if(/^https?:\/\/[^\s]+$/u.test(f))a.push({kind:"url",value:f,href:f});else{const k=Nc(f);if(k){const N=k.line?`${k.path}:${String(k.line)}`:k.path;a.push({kind:"file",value:f,path:k.path,displayPath:N,downloadName:Rc(k.path)})}else a.push({kind:"code",value:f})}}}else a.push({kind:"text",value:`${c}${c}`});s=m+l,i=s}return i<o.length&&a.push(...vl(o.slice(i))),a};return n.flatMap(o=>o.kind==="text"?r(o.value):[o])}function xb(e){return e.replace(/\r\n/gu,`
|
|
83
|
+
`)}function Va(e){var n;return(((n=e.match(/^\s*/u))==null?void 0:n[0])??"").replace(/\t/gu," ").length}function Ib(e,t){if(t<=0)return e.trimStart();let n=0,r=0;for(;n<e.length&&r<t;){const o=e[n];r+=o===" "?4:1,n+=1}return e.slice(n)}function Ka(e){return e.trim().length===0}function ah(e){const t=e.match(/^\s{0,3}(#{1,6})\s+(.+)$/u);return t?{level:t[1].length,value:t[2].trim()}:null}function dc(e){const t=e.match(/^\s{0,3}>\s?(.*)$/u);return t?t[1]??"":null}function pu(e){var n;const t=e.match(/^\s*[-*+]\s+(.+)$/u);return((n=t==null?void 0:t[1])==null?void 0:n.trim())??null}function wF(e){var n;const t=e.match(/^(\s*)[-*+]\s+(.+)$/u);return t?{indent:Va(t[1]??""),text:((n=t[2])==null?void 0:n.trim())??""}:null}function mu(e){var n;const t=e.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.+)$/u);return t?{checked:(t[1]??" ").toLowerCase()==="x",text:((n=t[2])==null?void 0:n.trim())??""}:null}function Sv(e){var n;const t=e.match(/^(\s*)[-*+]\s+\[([ xX])\]\s+(.+)$/u);return t?{indent:Va(t[1]??""),item:{checked:(t[2]??" ").toLowerCase()==="x",text:((n=t[3])==null?void 0:n.trim())??""}}:null}function Ab(e){var n;const t=e.match(/^(\s*)(\d+)[.)]\s+(.+)$/u);return t?{indent:Va(t[1]??""),start:Number.parseInt(t[2]??"1",10)||1,text:((n=t[3])==null?void 0:n.trim())??""}:null}function sh(e){var t;return((t=Ab(e))==null?void 0:t.text)??null}function kv(e){return Ab(e)}function ih(e){const t=e.trim();if(!t.includes("|"))return null;let n=t;n.startsWith("|")&&(n=n.slice(1)),n.endsWith("|")&&(n=n.slice(0,-1));const r=[];let o="",a=0;for(let s=0;s<n.length;s+=1){const i=n[s];if(i==="\\"&&n[s+1]==="|"){o+="|",s+=1;continue}if(i==="`"){let l=1;for(;n[s+l]==="`";)l+=1;o+=n.slice(s,s+l),a===0?a=l:a===l&&(a=0),s+=l-1;continue}if(i==="|"&&a===0){r.push(o.trim()),o="";continue}o+=i}return r.push(o.trim()),r.some(s=>s.length>0)?r:null}function bF(e){const t=ih(e);if(!t||t.length===0)return null;const n=t.map(r=>{const o=r.replace(/\s+/gu,"");if(!/^:?-{3,}:?$/u.test(o))return null;const a=o.startsWith(":"),s=o.endsWith(":");return a&&s?"center":s?"right":a?"left":null});return n.every((r,o)=>r!==null||/^-+$/u.test(t[o].replace(/\s+/gu,"")))?n:null}function Cv(e,t){return e.length===t?e:e.length>t?e.slice(0,t):[...e,...Array.from({length:t-e.length},()=>"")]}function xv(e,t){var d;if(t+1>=e.length)return null;const n=e[t],r=e[t+1],o=ih(n),a=bF(r);if(!o||!a||o.length!==a.length)return null;const s=n.trim();if(!s.startsWith("|")&&(((d=s.match(/\|/gu))==null?void 0:d.length)??0)<2)return null;const i=o.length,l=[];let c=t+2;for(;c<e.length&&!Ka(e[c]);){const m=ih(e[c]);if(!m)break;l.push(Cv(m,i)),c+=1}return{kind:"table",headers:Cv(o,i),rows:l,alignments:a}}function TF(e){return Ka(e)||Oc(e)!==null||lh(e)||ah(e)!==null||dc(e)!==null||mu(e)!==null||pu(e)!==null||sh(e)!==null}function SF(e,t,n=-1){const r=[];let o=t;for(;o<e.length&&!(TF(e[o])||n>=0&&Va(e[o])<=n);)r.push(n>=0?Ib(e[o],n+1):e[o]),o+=1;const a=r.join(`
|
|
84
|
+
`).trim();return a?{value:a,nextIndex:o}:null}function _b(e,t){for(let n=t;n<e.length;n+=1)if(!Ka(e[n]))return n;return-1}function kF(e,t,n,r=null,o=!1){const a=[];let s=t;for(;s<e.length;){const i=e[s];if(Ka(i)){const m=_b(e,s+1);if(m===-1){a.push(""),s=e.length;break}const f=r==null?void 0:r(e[m]);if(f&&f.indent===n||Va(e[m])<=n)break;a.push(""),s+=1;continue}const l=r==null?void 0:r(i);if(l&&l.indent===n)break;const c=Va(i),d=o&&(mu(i)!==null||pu(i)!==null);if(c<=n&&!d)break;a.push(c>n?Ib(i,n+1):i.trimStart()),s+=1}for(;a.length>0&&Ka(a[0]);)a.shift();for(;a.length>0&&Ka(a[a.length-1]);)a.pop();return a.length===0?null:{blocks:fc(a.join(`
|
|
85
|
+
`)),nextIndex:s}}function Iv(e,t,n,r=!1){const o=[];let a=t;const s=n(e[t]);if(!s)return null;const i=s.indent;for(;a<e.length;){const l=n(e[a]);if(l===null||l.indent!==i)break;const c=[l.text],d=[];for(a+=1;a<e.length;){if(Ka(e[a])){const k=_b(e,a+1);if(k===-1){a=e.length;break}const N=n(e[k]);if(N&&N.indent===i){a=k;break}if(Va(e[k])<=i){a=k;break}a+=1;continue}const m=n(e[a]);if(m&&m.indent===i)break;const f=Va(e[a])>i,v=r&&(mu(e[a])!==null||pu(e[a])!==null);if(f||v){const k=kF(e,a,i,n,r);if(k){d.push(...k.blocks),a=k.nextIndex;continue}}if(Va(e[a])<=i)break;const T=SF(e,a,i);if(!T)break;c.push(T.value),a=T.nextIndex}o.push(d.length>0?{paragraphs:c,children:d}:{paragraphs:c})}return o.length>0?{items:o,nextIndex:a}:null}function lh(e){return/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(e.trim())}const Pb="^\\s{0,3}(```+|~~~+)\\s*([^\\s`~][^`]*)?\\s*$",CF=new RegExp(Pb,"u"),Av=new RegExp(Pb,"gmu");function Oc(e){const t=e.match(CF);return t?{marker:t[1],language:(t[2]??"").trim()}:null}function xF(e){return e?(Av.lastIndex=0,Av.test(e.replace(/\r\n/gu,`
|
|
86
|
+
`))):!1}function fc(e){var a;const n=xb(e).split(`
|
|
87
|
+
`),r=[];let o=0;for(;o<n.length;){if(Ka(n[o])){o+=1;continue}const s=Oc(n[o]);if(s){o+=1;const k=[];for(;o<n.length;){if(n[o].trim()===s.marker){o+=1;break}k.push(n[o]),o+=1}r.push({kind:"codeBlock",language:s.language,value:k.join(`
|
|
88
|
+
`)});continue}if(lh(n[o])){r.push({kind:"thematicBreak"}),o+=1;continue}const i=ah(n[o]);if(i){r.push({kind:"heading",level:i.level,value:i.value}),o+=1;continue}if(dc(n[o])!==null){const k=[];for(;o<n.length;){const N=dc(n[o]);if(N===null)break;k.push(N),o+=1}r.push({kind:"blockquote",value:k.join(`
|
|
89
|
+
`).trim()});continue}const c=xv(n,o);if(c){r.push(c),o+=2+c.rows.length;continue}if(mu(n[o])!==null){const k=[],N=((a=Sv(n[o]))==null?void 0:a.indent)??0;for(;o<n.length;){const _=Sv(n[o]);if(_===null||_.indent!==N)break;k.push(_.item),o+=1}if(k.length>0){r.push({kind:"taskList",items:k});continue}}const m=pu(n[o]);if(m!==null){const k=Iv(n,o,wF);if(k){r.push({kind:"unorderedList",items:k.items}),o=k.nextIndex;continue}if(m.length>0){r.push({kind:"unorderedList",items:[{paragraphs:[m]}]}),o+=1;continue}}const f=sh(n[o]);if(f!==null){const k=kv(n[o]),N=Iv(n,o,kv,!0);if(N){r.push({kind:"orderedList",items:N.items,start:(k==null?void 0:k.start)??1}),o=N.nextIndex;continue}if(f.length>0){r.push({kind:"orderedList",items:[{paragraphs:[f]}],start:(k==null?void 0:k.start)??1}),o+=1;continue}}const v=[];for(;o<n.length&&!(Ka(n[o])||Oc(n[o])||lh(n[o])||ah(n[o])||xv(n,o)||dc(n[o])!==null||mu(n[o])!==null||pu(n[o])!==null||sh(n[o])!==null);)v.push(n[o]),o+=1;const T=v.join(`
|
|
90
|
+
`).trim();T&&r.push({kind:"paragraph",value:T})}return r}function IF(e){if(!e.includes(")return fc(e);const t=[],n=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let r=0;for(const o of e.matchAll(n)){const[a,s,i]=o;if(typeof o.index!="number")continue;const l=o.index,c=l+a.length,d=vF(i.trim());d&&(l>r&&t.push(...fc(e.slice(r,l))),t.push({kind:"image",url:d,alt:s.trim(),markdown:a}),r=c)}return r<e.length&&t.push(...fc(e.slice(r))),t}function AF(e){const n=xb(e).split(`
|
|
91
|
+
`),r=[];let o=0,a=0;const s=i=>{if(i<=a)return;const l=n.slice(a,i).join(`
|
|
92
|
+
`);r.push(...IF(l))};for(;o<n.length;){const i=Oc(n[o]);if(!i){o+=1;continue}s(o),o+=1;const l=[];for(;o<n.length;){if(n[o].trim()===i.marker){o+=1;break}l.push(n[o]),o+=1}r.push({kind:"codeBlock",language:i.language,value:l.join(`
|
|
93
|
+
`)}),a=o}return s(n.length),r.length>0?r:[{kind:"paragraph",value:e}]}function Eb(e){return e.role==="assistant"&&!(e.messageType==="commandExecution"&&e.commandExecution)&&e.messageType!=="worked"&&!(e.messageType??"").endsWith(".live")}function Mb(e,t){for(const n of e){if(n.kind==="codeBlock"){t.push({language:n.language,value:n.value});continue}if(n.kind==="unorderedList"||n.kind==="orderedList")for(const r of n.items)r.children&&r.children.length>0&&Mb(r.children,t)}}function _F(e){const t=e.text;if(!t||!t.trim())return[];const n=[];return Mb(AF(t),n),n}function PF(e,t=Eb){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(t(r)&&xF(r.text??""))return!0}return!1}function EF(e,t=Eb){for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(!t(r))continue;const o=_F(r),a=o[o.length-1];if(a)return{messageId:r.id,turnIndex:typeof r.turnIndex=="number"?r.turnIndex:null,language:a.language,value:a.value}}return null}const MF=[[/(gmail|google calendar|google docs|google sheets|google drive|github|slack|notion|linear|outlook|supabase)/i,140],[/(email|calendar|document|sheet|drive|repo|issue|message|project|database|crm|deploy)/i,50]];function Rb(e){return e.trim().toLowerCase()}function RF(e,t){return t.reduce((n,[r,o])=>n+(r.test(e)?o:0),0)}function _v(e){return e.activeCount*1e3+(e.isNoAuth?300:0)+e.toolsCount*3+e.triggersCount*4+RF(`${e.name} ${e.slug} ${e.description}`,MF)}function LF(e,t){const n=Rb(t);if(!n)return 0;const r=e.name.toLowerCase(),o=e.slug.toLowerCase();return r===n||o===n?1e6:r.replace(/\s+/gu,"")===n.replace(/\s+/gu,"")?9e5:r.startsWith(n)||o.startsWith(n)?8e5:r.includes(n)||o.includes(n)?7e5:0}function tl(e){return e.activeCount>0?0:e.totalConnections>0?1:e.isNoAuth?2:3}function mz(e,t,n=""){const r=Rb(n),o=a=>LF(a,r);return t==="name"?[...e].sort((a,s)=>o(s)-o(a)||tl(a)-tl(s)||a.name.localeCompare(s.name)):t==="date"?[...e].sort((a,s)=>o(s)-o(a)||tl(a)-tl(s)||a.name.localeCompare(s.name)):[...e].sort((a,s)=>o(s)-o(a)||tl(a)-tl(s)||_v(s)-_v(a)||a.name.localeCompare(s.name))}function jF(e,t){var a;const n=e.lastIndexOf(":"),r=n>=0?e.slice(n+1):e,o=t.find(s=>s.name===e)??t.find(s=>s.name===r||s.name.endsWith(`:${r}`));return((a=o==null?void 0:o.path)==null?void 0:a.trim())??""}function NF(e,t){const n=[];for(const r of e){const o=r.name.trim();if(!o)continue;const a=(r.path??"").trim()||jF(o,t);a&&n.push({name:o,path:a})}return n}const $F={class:"sidebar-root"},OF=["aria-pressed","aria-label","title"],DF={key:1,class:"sidebar-search-bar"},FF=["placeholder"],BF=["aria-label"],UF={class:"sidebar-skills-link-icon","aria-hidden":"true"},zF={class:"sidebar-skills-link-copy"},HF={class:"sidebar-skills-link-title"},WF={class:"sidebar-skills-link-subtitle"},qF={class:"sidebar-skills-link-icon sidebar-automations-link-icon","aria-hidden":"true"},GF={class:"sidebar-skills-link-copy"},VF={class:"sidebar-skills-link-title"},KF={class:"sidebar-skills-link-subtitle"},YF={class:"sidebar-settings-actions"},JF=["title","aria-label"],QF=["title","aria-label"],XF={class:"content-root-wrap"},ZF={key:0,class:"content-keyboard-spacer","aria-hidden":"true"},eB={key:1,class:"skills-route-header-icon","aria-hidden":"true"},tB={key:2,class:"skills-route-header-icon automations-route-header-icon","aria-hidden":"true"},nB=["aria-label","title"],rB=["aria-label","title"],oB={class:"content-body"},aB={key:2,class:"content-grid content-grid-home"},sB={class:"new-thread-empty"},iB={class:"new-thread-hero"},lB=["title"],uB={class:"new-thread-folder-actions"},cB=["disabled"],dB={key:1,class:"new-thread-launch-card","aria-label":"Plugins and Apps announcement"},fB={class:"new-thread-launch-card-copy"},hB={class:"new-thread-launch-card-topline"},pB={class:"new-thread-launch-card-badge","aria-hidden":"true"},mB={class:"new-thread-launch-card-eyebrow"},gB={class:"new-thread-launch-card-title"},vB={class:"new-thread-launch-card-text"},yB={class:"new-thread-launch-card-actions"},wB=["aria-label","onKeydown"],bB={class:"new-thread-open-folder-header"},TB={class:"new-thread-open-folder-title"},SB={class:"new-thread-open-folder-label"},kB={class:"new-thread-open-folder-current"},CB=["placeholder","title","disabled","onKeydown"],xB=["disabled"],IB={class:"new-thread-open-folder-actions"},AB={class:"new-thread-open-folder-toggle"},_B=["aria-pressed","disabled"],PB={key:0,class:"new-thread-open-folder-create"},EB={class:"new-thread-open-folder-create-composer"},MB=["placeholder","onKeydown"],RB=["disabled"],LB={key:0,class:"new-thread-open-folder-error visible-error-with-feedback"},jB=["href"],NB=["placeholder","onKeydown"],$B={key:1,class:"new-thread-open-folder-error-actions"},OB={class:"new-thread-open-folder-error visible-error-with-feedback"},DB=["href"],FB=["disabled"],BB={key:2,class:"new-thread-open-folder-status"},UB={key:3,class:"new-thread-open-folder-status"},zB={key:4,class:"new-thread-open-folder-list"},HB=["title","disabled","onClick"],WB={class:"new-thread-open-folder-item-name"},qB=["disabled","onClick"],GB=["aria-label","onKeydown"],VB={class:"new-thread-open-folder-header"},KB={class:"new-thread-open-folder-title"},YB=["disabled"],JB=["aria-label"],QB=["aria-selected","disabled"],XB=["aria-selected","disabled"],ZB={class:"new-thread-project-field"},e2={class:"new-thread-open-folder-label"},t2=["disabled","placeholder"],n2={key:0,class:"new-thread-project-field"},r2={class:"new-thread-open-folder-label"},o2=["disabled","placeholder","onKeydown"],a2={key:1,class:"new-thread-project-field"},s2={class:"new-thread-open-folder-label"},i2=["disabled","onKeydown"],l2={key:2,class:"new-thread-open-folder-error visible-error-with-feedback"},u2=["href"],c2={class:"new-thread-project-modal-actions"},d2=["disabled"],f2=["disabled"],h2={key:3,class:"new-thread-branch-select"},p2={class:"new-thread-branch-select-label"},m2={class:"new-thread-branch-select-help"},g2={key:4,class:"new-thread-runtime-help"},v2={class:"worktree-init-status-title"},y2={class:"worktree-init-status-message"},w2={class:"composer-with-queue"},b2={key:0,class:"composer-runtime-error",role:"alert"},T2=["href"],S2={key:3,class:"content-grid"},k2={class:"content-thread"},C2={key:0,class:"external-session-banner",role:"alert"},x2={key:1,class:"composer-runtime-error",role:"alert"},I2=["href"],A2={key:2,class:"interrupt-recovered-banner",role:"status"},_2=["aria-label"],P2={class:"content-right-panel-header"},E2={class:"content-right-panel-tabs",role:"tablist"},M2=["aria-selected"],R2=["aria-selected"],L2=["aria-selected","title","onClick"],j2={class:"content-right-panel-tab-label"},N2=["aria-label","title","onClick"],$2={class:"content-right-panel-actions"},O2={class:"content-right-panel-add-wrap"},D2=["aria-label","title"],F2={key:0,class:"content-right-panel-menu"},B2=["aria-label","title"],U2={class:"content-right-panel-body"},z2={key:2,class:"project-zip-modal-backdrop",role:"presentation"},H2=["aria-label"],W2={class:"project-zip-modal-header"},q2={class:"project-zip-modal-title"},G2=["aria-label","disabled"],V2={class:"project-zip-modal-copy"},K2={class:"project-zip-progress-label",role:"status","aria-live":"polite"},Y2={class:"project-zip-progress-track"},J2={key:0,class:"project-zip-modal-error",role:"alert"},Q2={class:"project-zip-modal-actions"},X2=["disabled"],Z2=["disabled"],eU=["disabled"],tU=["aria-label"],nU={class:"codex-login-modal-header"},rU={class:"codex-login-modal-title"},oU=["aria-label","disabled"],aU={class:"codex-login-modal-copy"},sU=["href"],iU=["placeholder","disabled"],lU={key:1,class:"codex-login-modal-error visible-error-with-feedback"},uU=["href"],cU={class:"codex-login-modal-actions"},dU=["disabled"],fU=["disabled"],hU=400,Pv="codex-web-local.send-with-enter.v1",Ev="codex-web-local.in-progress-send-mode.v1",Mv="codex-web-local.dark-mode.v1",Rv="codex-web-local.dictation-click-to-toggle.v1",Lv="codex-web-local.dictation-auto-send.v1",jv="codex-web-local.dictation-language.v1",Nv="codex-web-local.chat-width.v1",pU=12e4,mU=cn({__name:"App",setup(e){var Xp,Zp;const t=Ro(()=>Lo(()=>import("./ThreadConversation-BwVKGC9K.js"),__vite__mapDeps([0,1,2]))),n=Ro(()=>Lo(()=>import("./ThreadTerminalPanel-D2OFYu0C.js"),__vite__mapDeps([3,4]))),r=Ro(()=>Lo(()=>import("./ReviewPane-27Mn7pUF.js"),__vite__mapDeps([5,6]))),o=Ro(()=>Lo(()=>import("./DirectoryHub-DVmDATpS.js"),__vite__mapDeps([7,1,8]))),a=Ro(()=>Lo(()=>import("./AutomationsPanel-CDEKwt6K.js"),__vite__mapDeps([9,10]))),s=Ro(()=>Lo(()=>import("./SettingsDialog-CidE2T-1.js"),__vite__mapDeps([11,12]))),i=Ro(()=>Lo(()=>import("./RightGitPanel-Cx6ye-CJ.js"),__vite__mapDeps([13,14]))),l=Ro(()=>Lo(()=>import("./RightFilesPanel-BiloZijH.js"),__vite__mapDeps([15,16]))),c=Ro(()=>Lo(()=>import("./RightFilePreview-7I6S8IKp.js"),__vite__mapDeps([17,18]))),d=Ro(()=>Lo(()=>import("./ThreadPendingRequestPanel-64Dcj9Ku.js"),__vite__mapDeps([19,20]))),m=Ro(()=>Lo(()=>import("./QueuedMessages-ELc1xjI5.js"),__vite__mapDeps([21,22]))),{t:f,uiLanguage:v,uiLanguageOptions:T,setUiLanguage:k}=ao(),N="codex-mobile",_="0.1.138",j={standard:{label:"Standard",columnMax:"45rem",cardMax:"76ch"},wide:{label:"Wide",columnMax:"72rem",cardMax:"88ch"},"extra-wide":{label:"Extra wide",columnMax:"96rem",cardMax:"96ch"}},W={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:V,projectDisplayNameById:U,selectedThread:fe,selectedThreadTokenUsage:K,selectedThreadServerRequests:oe,selectedLiveOverlay:ve,lastPlanByThreadId:Pe,resolveThreadTurnIndex:we,selectedActiveTurnId:te,codexQuota:ke,selectedThreadId:ee,availableCollaborationModes:Ce,availableModelIds:De,availableModelReasoningEfforts:Ue,selectedCollaborationMode:Ee,selectedReasoningEffort:be,selectedSpeedMode:Te,codexCliMissingError:_e,installedSkills:xe,accountRateLimitSnapshots:Je,messages:Xe,hasMoreOlderMessages:rt,isLoadingThreads:de,isThreadListFullyLoaded:B,isLoadingMessages:ne,slowOpenThreadId:ae,isLoadingOlderMessages:je,isSendingMessage:We,isInterruptingTurn:E,isSelectedThreadInterruptPending:L,isUpdatingSpeedMode:H,error:ue,refreshAll:se,refreshSkills:le,refreshHooks:Ne,hooksList:Me,isHooksLoading:Ae,onRealtimeEvent:ye,selectThread:ze,ensureThreadMessagesLoaded:$e,loadMessages:Ve,loadOlderMessages:Ke,archiveThreadById:ft,compactThreadById:_t,compactingThreadIds:Ct,fuzzyFileSearchResults:dt,registerFuzzyFileSearchSession:Y,forkThreadById:pe,renameThreadById:Ie,forkThreadFromTurn:qe,sendMessageToSelectedThread:Qe,sendMessageToNewThread:xt,interruptSelectedThreadTurn:jt,interruptedUnsubmittedMessage:Ho,clearInterruptedUnsubmittedMessage:Kn,selectedThreadQueuedMessages:gn,removeQueuedMessage:Wo,reorderQueuedMessage:yr,steerQueuedMessage:so,autoCompactThreshold:qs,setAutoCompactThreshold:ya,setSelectedCollaborationMode:ts,readModelIdForThread:wa,setSelectedModelIdForThread:io,injectModelSwitchDivision:Ur,invalidateThreadContextWindow:qo,setSelectedReasoningEffort:Go,updateSelectedSpeedMode:Gs,respondToPendingServerRequest:ba,pendingReplyErrorForRequest:ns,renameProject:Ir,removeProject:Ta,reorderProject:Vo,pinProjectToTop:lo,startPolling:uo,stopPolling:co,primeSelectedThread:Ko,rollbackSelectedThread:Sa,setTurnErrorForThread:Vs}=tF(),vt=nI(),It=tI(),{isMobile:Pt}=Rh();function an(){return typeof navigator<"u"&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}const Jt=S(null),In=S(null),Ar=S(null);let _r=null;const{buildFeedbackMailto:vn,feedbackMailtoBase:wr,recordVisibleFailure:ka}=$w(),ar=wr();function Mt(u,h){h&&ka(h);const b=u.currentTarget;b instanceof HTMLAnchorElement&&(b.href=vn())}const Ca=S(null),en=S(null),zr=S(null),Hr=S(0);let tn=null;function Pr(){const u=zr.value;if(!u)return;const h=window.getComputedStyle(u),b=Number.parseFloat(h.paddingLeft)+Number.parseFloat(h.paddingRight),F=Math.max(0,u.clientWidth-(Number.isFinite(b)?b:0)),Q=h.getPropertyValue("--chat-column-max").trim(),he=Number.parseFloat(Q)*(Q.endsWith("rem")?16:1),Fe=Number.isFinite(he)&&he>0?Math.min(F,he):F;Hr.value=Fe}const Tn=S(null),Yo=S(null),Er=S(!0),Yn=cF({isMobile:()=>Pt.value,canShowRightPanel:()=>Ll.value,isVirtualKeyboardOpen:()=>jl.value}),{activeRightPanelTab:Wt,filePreviewTabs:xa,activeFilePreviewTabKey:Ia,activeFilePreviewTab:sr,isRightPanelMenuOpen:Mr,isMobileRightPanelOpen:Qt,isRightPanelCollapsed:yn,rightPanelWidth:On,isTerminalInputFocused:fo,isTerminalKeyboardFocusFallbackActive:Xt,onRightResizeHandleMouseDown:Jo,toggleRightPanelTerminal:Jn,selectRightPanelTab:dn,onOpenFilePreview:ho,selectFilePreviewTab:Vt,closeFilePreviewTab:Ft,onCloseRightPanel:po,onToggleRightPanelToggle:Dn,onHideRightPanelTerminal:Ks,onTerminalFocusChange:ir,resetTerminalKeyboardFocusState:Wr,clearTerminalKeyboardFocusFallbackTimer:Aa}=Yn,br=S(null),Qo=S(!1),qr=S("");let Rr=!1;const mo=S(!1),yt=S(""),An=S("local"),_n=S({}),Xo=new Map,x=S(""),$=S([]),Z=S(!1),Le=S({order:[],labels:{},projectOrder:[]}),Oe=S({phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""}),At=S({phase:"idle",title:"",message:""}),fn=aF(),{isSidebarCollapsed:Tt,isAccountsSectionCollapsed:Pn,sidebarSearchQuery:En,isSidebarSearchVisible:go,sidebarScrollableRef:Ys,sidebarSearchInputRef:Pi,setSidebarCollapsed:Kt,toggleSidebarSearch:Zo,clearSidebarSearch:Js,onSidebarScroll:vo,onSidebarSearchKeydown:Qn,toggleAccountsSectionCollapsed:Al}=fn,rs=S(null),os=S(null),as=S(null),hn=S(null);let Gr=null,yo=0,wo=0,pn=0,bo=0;const ea=S("New Project (1)"),ss=S(""),nn=S(!1),Ei=S("general");let _a=0;function Mn(){if(nn.value){_a=Date.now(),nn.value=!1;return}Date.now()-_a<hU||(nn.value=!0)}const Fn=S(!1),Qs=S(!1),is=S(new Set);async function Xs(){try{is.value=new Set(await YA())}catch{}finally{Qs.value=!0}}const _l=J(()=>!Qs.value||Zg(is.value,Xg.hooks)),ls=J(()=>!Qs.value||Zg(is.value,Xg.remoteControl));ot(nn,u=>{u&&(Ne(),ei(),ls.value&&Ri())});const mn=S({enabled:!1,clients:[]}),rn=S(null),Bt=S(!1),Xn=S(!1),Lr=S(""),lr=S(""),us=S("");let To=null,jr=!1,So=null;const Tr=S("never"),cs=S(!1),Vr=S(!1),ur=S(""),Pa=S("");let Zs=!1;const Mi=S(!1);async function ei(u={}){if(!(u.force!==!0&&Zs)){cs.value=!0,ur.value="";try{Tr.value=await E_(),Zs=!0}catch(h){ur.value=h instanceof Error?h.message:"Failed to load approval policy"}finally{cs.value=!1}}}function ds(u){Tr.value=u}async function Kr(){Vr.value=!0,ur.value="",Pa.value="";try{await M_(Tr.value),Mi.value=!0,Pa.value=f("Approval policy saved"),ko&&clearTimeout(ko),ko=setTimeout(()=>{Pa.value=""},2200)}catch(u){ur.value=u instanceof Error?u.message:"Failed to save approval policy"}finally{Vr.value=!1}}let ko=null;async function Ri(u={}){if(!(u.force!==!0&&jr)){Bt.value=!0,lr.value="";try{const h=await P_();mn.value=h,jr=!0}catch(h){lr.value=h instanceof Error?h.message:"Failed to load remote control status"}finally{Bt.value=!1}}}async function ti(){const u=!mn.value.enabled;Xn.value=!0,Lr.value=u?"enable":"disable";try{await R_(u),mn.value={...mn.value,enabled:u},Li(u?"Remote control enabled":"Remote control disabled")}catch(h){lr.value=h instanceof Error?h.message:"Failed to update remote control"}finally{Xn.value=!1,Lr.value=""}}async function Ea(){Xn.value=!0,Lr.value="pairing";try{rn.value=await L_()}catch(u){lr.value=u instanceof Error?u.message:"Failed to start pairing"}finally{Xn.value=!1,Lr.value=""}}async function fs(){Xn.value=!0,Lr.value="clients";try{mn.value={...mn.value,clients:await j_()}}catch(u){lr.value=u instanceof Error?u.message:"Failed to load remote clients"}finally{Xn.value=!1,Lr.value=""}}async function Pl(u){Xn.value=!0,Lr.value=`revoke:${u}`;try{await N_(u),mn.value={...mn.value,clients:mn.value.clients.filter(h=>h.clientId!==u)},Li("Remote client removed")}catch(h){lr.value=h instanceof Error?h.message:"Failed to remove remote client"}finally{Xn.value=!1,Lr.value=""}}function Li(u){us.value=u,To&&clearTimeout(To),To=setTimeout(()=>{us.value=""},3e3)}const sn=S(""),Bn=S(""),Co=S([]),Yr=S(null),C=S(null),M=S(null),I=S(null),X=S(!1),Ze=S(!1),Ut=S({addedLineCount:0,removedLineCount:0}),Nr=S([]),Zn=S(""),ln=S({}),Jr=S(""),ta=S(""),xo=S({}),na=S(""),ji=S(""),Ni=S(!1),Io=S(!1);function ad(u,h){return`${u}\0${h?"with-reset-history":"without-reset-history"}`}const Cu=S(null),er=S([]),ra=S(!1),Ao=S(!1),oa=S(!1),Un=S(!1),$i=S(!1),ni=S(""),Ma=S(""),xu=S(null),Ra=S(""),$r=S(""),aa=S(""),wn=S(""),hs=S(Rd(Pv,!0)),ps=S(q0()),La=S(W0()),ri=S(G0()),ms=S(Rd(Rv,!1)),gs=S(Rd(Lv,!0)),oi=S(oS()),sd=J(()=>aS()),ai=J(()=>{const{loaded:u,total:h}=Oe.value,b=mp(u);return h&&h>0?`${b} / ${mp(h)}`:u>0?b:f("Preparing...")}),id=J(()=>{const{loaded:u,total:h,phase:b}=Oe.value;return b==="ready"?"100%":!h||h<=0?u>0?"55%":"20%":`${Math.min(100,Math.max(5,Math.round(u/h*100)))}%`}),Oi=S(!1),sa=S(!1),ia=S(!1),si=S(""),Di=S(!1),El=S(null),Rn=S(!1),Or=S(""),Sr=S("codex"),ld=J(()=>[{value:"codex",label:f("Codex")},{value:"openrouter",label:f("OpenRouter")},{value:"opencode-zen",label:f("OpenCode Zen")},{value:"custom",label:f("Custom endpoint")}]),vs=S(""),ii=S(""),_o=S("responses"),Dr=S("responses"),Fi=S(""),li=S(!1),zn=S(""),ui=S(""),la=S(""),Ml=S(!1),ua=S(!1),ys=S(""),Hn=S(""),ja=S(!1),Bi=S(!1),cr=S("create"),p=S(""),y=S(""),A=S(""),R=S(!1),z=S(""),q=S(!1),G=S(null),ie=S(null),ce=S(!1),ge=S(null),He=S(null),et=S(""),wt=S(""),ut=S(""),Dt=S([]),st=S(""),ht=S(!1),Ln=S(!1),Po=S(!1),dr=S(""),ud=[ue,_e,Zn,ta,wn,Or,la,Hn,z,st],Rl=J(()=>ud.some(u=>u.value.trim().length>0)),kr=S({configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:""}),Ui=S(null),zi=S(!1),Hi=S(!1),ca=S(typeof window<"u"?((Xp=window.visualViewport)==null?void 0:Xp.height)??window.innerHeight:0),Wi=S(typeof window<"u"?((Zp=window.visualViewport)==null?void 0:Zp.offsetTop)??0:0),ws=S(typeof window<"u"?window.innerHeight:0);let Eo=null,qi=!1,Gi=!1,Vi=!1,bs=0;const da=J(()=>{const u=vt.params.threadId;return typeof u=="string"?u:""}),Se=J(()=>vt.name==="home"),bt=J(()=>vt.name==="skills"),jn=J(()=>vt.name==="automations"),Ts=J(()=>{const u=vt.query.automationId;return typeof u=="string"?u:""}),cd=J(()=>{var u;return jn.value?f("Automations"):bt.value?f("Skills"):Se.value?f("Start new thread"):((u=fe.value)==null?void 0:u.title)??f("Choose a thread")}),Lb=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",jb=J(()=>{var h,b;return(((b=(h=fe.value)==null?void 0:h.title)==null?void 0:b.trim())??"")||Lb}),Na=J(()=>Xe.value.filter(u=>{const h=Yp(u.messageType,u.role);return h==="worked"?!0:!(h==="turnActivity.live"||h==="turnError.live"||h==="agentReasoning.live")})),dd=S([]);ot(()=>[Na.value,ne.value],([u,h])=>{h||(dd.value=u)},{immediate:!0});const Nb=J(()=>ne.value&&dd.value.length>0?dd.value:Na.value),Kh=new Set(["commandExecution","worked","toolCall","fileChange","agentMessage","agentMessage.live","plan"]),fd=S(null);function $b(u,h,b){const F=typeof h.turnIndex=="number"?h.turnIndex:-1;return F<0?!1:u.some((Q,he)=>he>b&&typeof Q.turnIndex=="number"&&Q.turnIndex>=F&&Kh.has(Q.messageType??""))}function Ob(u,h){return u.some(b=>typeof b.turnIndex=="number"&&b.turnIndex>=h&&Kh.has(b.messageType??""))}const Iu=J(()=>{const u=Na.value,h=ne.value;for(let he=u.length-1;he>=0;he-=1){const Fe=u[he];if(Fe.messageType!=="plan"&&Fe.messageType!=="plan.live")continue;const Rt=ov(Fe);if(!Rt||fd.value!==null&&Fe.id===fd.value)return null;const Bu=h?!0:$b(u,Fe,he);return{id:Fe.id,streaming:Fe.messageType==="plan.live",explanation:Rt.explanation,steps:Rt.steps,implemented:Bu}}const b=ee.value?Pe.value[ee.value]??null:null;if(!b)return null;const F=ov(b);if(!F)return null;const Q=typeof b.turnIndex=="number"?b.turnIndex:b.turnId?we(ee.value,b.turnId)??-1:-1;return{id:b.id,streaming:b.messageType==="plan.live",explanation:F.explanation,steps:F.steps,implemented:h?!0:Q>=0?Ob(u,Q):!1}}),Db=J(()=>ve.value),Ss=J(()=>Se.value?"__new-thread__":ee.value),Yh=J(()=>wa(Ss.value)),Au=J(()=>{const u=oe.value;return u.length>0?u[u.length-1]:null}),Fb=J(()=>Au.value?ns(Au.value.id):""),Sn=J(()=>{var u,h;return Se.value?yt.value.trim():((h=(u=fe.value)==null?void 0:u.cwd)==null?void 0:h.trim())??""}),Ll=J(()=>Er.value&&(Se.value&&Sn.value.length>0||vt.name==="thread"&&ee.value.length>0)),Bb=J(()=>Ll.value&&Wt.value==="terminal"),jl=J(()=>!Pt.value||ca.value<=0||ws.value<=0?!1:ws.value-ca.value>120),Ub=J(()=>jl.value||Bb.value&&Xt.value),Jh=J(()=>{var u,h;return((h=(u=fe.value)==null?void 0:u.cwd)==null?void 0:h.trim())??yt.value.trim()}),_u=J(()=>{var u;return!Se.value&&((u=fe.value)==null?void 0:u.inProgress)===!0}),zb=J(()=>{const u=ee.value;return!!u&&Ct.value.has(u)}),Qh=J(()=>{var u,h;return!Se.value&&((h=(u=fe.value)==null?void 0:u.externalSession)==null?void 0:h.active)===!0}),hd=J(()=>We.value||E.value||_u.value||oe.value.length>0);function Xh(){Oi.value&&(Oi.value=!1,b_(!0))}function Hb(){Xh(),It.push({name:"skills",query:{tab:"plugins"}})}function Zh(){const u=ee.value;u&&_t(u)}function pd(u,h){const b=nt(u).trim(),F=Fr(b);return!b||!F?!1:h.some(Q=>{const he=nt(Q).trim();return he!==b&&Fr(he)===F})}function md(u,h=""){const b=nt(u).trim(),F=h.trim();if(F)return F;const Q=Fr(b),he=[...Le.value.order,...V.value.map(Fe=>{var Rt,kn;return((kn=(Rt=Fe.threads[0])==null?void 0:Rt.cwd)==null?void 0:kn.trim())??""}).filter(Boolean)];return pd(b,he)?b:Q}function Wb(){const u=new Set(Le.value.order),h=Le.value.projectOrder.filter(b=>u.has(b));for(const b of Le.value.order)h.includes(b)||h.push(b);return h}function Nl(u){const h=nt(u).trim(),b=[...Le.value.order,...V.value.map(F=>{var Q,he;return((he=(Q=F.threads[0])==null?void 0:Q.cwd)==null?void 0:he.trim())??""}).filter(Boolean)];return pd(h,b)?h:Fr(h)}function ep(u){const h=nt(u).trim();if(!h)return"";const b=[...Le.value.order,...V.value.map(F=>{var Q,he;return((he=(Q=F.threads[0])==null?void 0:Q.cwd)==null?void 0:he.trim())??""}).filter(Boolean)];for(const F of Le.value.order){const Q=nt(F).trim();if(!Q)continue;const he=Fr(Q),Fe=pd(Q,b)?Q:he;if(Q===h||Fe===h||he===h)return Q}return""}const gd=J(()=>{var F,Q;const u=[],h=new Set;for(const he of Wb()){const Fe=he.trim();!Fe||h.has(Fe)||(h.add(Fe),u.push({value:Fe,label:md(Fe,Le.value.labels[Fe])}))}for(const he of V.value){const Fe=((Q=(F=he.threads[0])==null?void 0:F.cwd)==null?void 0:Q.trim())??"";!Fe||h.has(Fe)||Cc(Fe)||(h.add(Fe),u.push({value:Fe,label:md(Fe,U.value[he.projectName])}))}const b=yt.value.trim();return b&&!h.has(b)&&u.unshift({value:b,label:md(b)}),u}),ci=J(()=>{const u=yt.value.trim();return u?_n.value[u]===!0:!1}),qb=J(()=>{var h,b;const u={};for(const F of V.value){const Q=Yi(F.projectName,((b=(h=F.threads[0])==null?void 0:h.cwd)==null?void 0:b.trim())??"");u[F.projectName]=Q?_n.value[Q]===!0:!1}return u}),vd=J(()=>{const u=x.value.trim(),h=[...$.value];return u&&!h.some(b=>b.value===u)&&h.unshift({value:u,label:u}),h}),tp=J(()=>{const u=x.value.trim();if(!u)return"";const h=vd.value.find(b=>b.value===u);return(h==null?void 0:h.label)??u}),np=J(()=>wt.value.trim()),rp=J(()=>{const u=ys.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),Gb=J(()=>rp.value&&np.value.trim().length>0&&!st.value),op=J(()=>{const u=y.value.trim();return!u||u==="."||u===".."?!1:!/[\\/]/u.test(u)}),ap=J(()=>p.value.trim()?cr.value==="create"?op.value:A.value.trim().length>0:!1),$l=J(()=>{const u=nt(et.value).trim();return u||wt.value.trim()}),Vb=J(()=>ja.value?"Creating…":"Create"),Kb=J(()=>q.value?cr.value==="clone"?f("Cloning…"):f("Creating…"):cr.value==="clone"?f("Clone repository"):f("Create project")),Yb=J(()=>{const u=wt.value.trim(),h=ut.value.trim();return!!(u&&h&&u!==h)}),sp=J(()=>{const u=[];Yb.value&&u.push({key:`parent:${ut.value}`,name:"..",path:ut.value,kind:"parent"});for(const h of Dt.value)u.push({key:`directory:${h.path}`,name:h.name,path:h.path,kind:"directory"});return u}),yd=J(()=>{const u=dr.value.trim().toLowerCase();return u?sp.value.filter(h=>h.kind==="parent"||h.name.toLowerCase().includes(u)):sp.value}),Ki=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,Jb=J(()=>f(j[ri.value].label)),Qb=J(()=>{const u=j[ri.value],h=Math.max(0,ws.value-ca.value-Wi.value);return{"--chat-column-max":u.columnMax,"--chat-card-max":u.cardMax,"--visual-viewport-height":ca.value>0?`${ca.value}px`:"100dvh","--visual-viewport-offset-top":`${Math.max(0,Wi.value)}px`,"--virtual-keyboard-inset":`${h}px`}}),Xb=J(()=>{if(!kr.value.configured)return f("Not configured");const u=kr.value.active?f("Online"):f("Configured (offline)"),h=kr.value.allowAllUsers?f("allow all users"):`${kr.value.allowedUsers} ${f("allowed user(s)")}`,b=`${kr.value.mappedChats} ${f("chat(s)")}, ${kr.value.mappedThreads} ${f("thread(s)")}, ${h}`,F=kr.value.lastError?`, ${f("error")}: ${kr.value.lastError}`:"";return`${u}, ${b}${F}`});es(()=>{var u,h;document.addEventListener("pointerdown",Cp),window.addEventListener("keydown",kp),document.addEventListener("visibilitychange",Ip),window.addEventListener("pageshow",Ap),window.addEventListener("focus",_p),window.addEventListener("resize",di),(u=window.visualViewport)==null||u.addEventListener("resize",di),(h=window.visualViewport)==null||h.addEventListener("scroll",di),di(),Fu(),Ki==null||Ki.addEventListener("change",Fu),_r=ye(b=>{Ar.value&&Ar.value.refreshFromNotification(b)}),So=ye(b=>{b==="remoteControl/status/changed"&&Ri({force:!0})}),lS(),O0(),Xs(),tT(),xs(),Mo(),lp(),wd(),Ld(),a0(),ei()}),ot(ud,(u,h)=>{u.forEach((b,F)=>{if(b===h[F])return;const Q=b.trim();Q&&ka(Q)})}),ot(zr,u=>{if(tn&&(tn.disconnect(),tn=null),typeof ResizeObserver<"u"){tn=new ResizeObserver(Pr),u&&tn.observe(u);return}Pr()},{immediate:!0}),Tu(()=>{var u,h;document.removeEventListener("pointerdown",Cp),window.removeEventListener("keydown",kp),document.removeEventListener("visibilitychange",Ip),window.removeEventListener("pageshow",Ap),window.removeEventListener("focus",_p),window.removeEventListener("resize",di),(u=window.visualViewport)==null||u.removeEventListener("resize",di),(h=window.visualViewport)==null||h.removeEventListener("scroll",di),Ki==null||Ki.removeEventListener("change",Fu),tn&&(tn.disconnect(),tn=null),Eo!==null&&(window.clearInterval(Eo),Eo=null),Gr&&(clearTimeout(Gr),Gr=null),Aa(),co(),_r&&(_r(),_r=null),So&&(So(),So=null),To&&(clearTimeout(To),To=null)});function di(){var u,h;typeof window>"u"||(ws.value=Math.max(ws.value,window.innerHeight),ca.value=((u=window.visualViewport)==null?void 0:u.height)??window.innerHeight,Wi.value=((h=window.visualViewport)==null?void 0:h.offsetTop)??0)}ot(En,u=>{const h=u.trim();if(Gr&&(clearTimeout(Gr),Gr=null),!h){hn.value=null;return}Gr=setTimeout(()=>{xI(h,1e3).then(b=>{En.value.trim()===h&&(hn.value=b.threadIds)}).catch(()=>{En.value.trim()===h&&(hn.value=null)})},220)}),ot(jl,u=>{u||(Xt.value=!1)}),ot(er,()=>{if(typeof window>"u")return;if(!er.value.some(h=>h.quotaStatus==="loading")){Eo!==null&&(window.clearInterval(Eo),Eo=null);return}Eo===null&&(Eo=window.setInterval(()=>{qi||(qi=!0,Ol({silent:!0}).finally(()=>{qi=!1}))},1500))},{deep:!0}),ot(Je,()=>{ip().then(u=>{u&&se({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})})},{deep:!0});async function ip(){if(!Gi||Vi||Sr.value!=="codex"||er.value.length>0||Je.value.length===0)return!1;Vi=!0;const u=JSON.stringify(er.value.map(b=>b.accountId).sort());try{const b=await Pg();er.value=b.accounts}catch{await Ol({silent:!0})}const h=JSON.stringify(er.value.map(b=>b.accountId).sort());return u!==h}function Zb(){le({force:!0})}function eT(u){u&&Ve(u,{silent:!0,force:!0})}async function wd(){try{kr.value=await d_()}catch(u){const h=u instanceof Error?u.message:"Failed to load Telegram status";kr.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,allowedUsers:0,allowAllUsers:!1,lastError:h}}}async function lp(){try{const u=await c_();zn.value=u.botToken,ui.value=u.allowedUserIds.map(h=>String(h)).join(`
|
|
94
|
+
`),la.value=""}catch(u){la.value=u instanceof Error?u.message:"Failed to load Telegram configuration"}}async function tT(){const u=await w_();Oi.value=u.dismissed!==!0}function nT(u){const h=u.split(/[\n,]/).map(Q=>Q.trim().replace(/^(telegram|tg):/i,"").trim()).filter(Boolean),b=h.includes("*"),F=Array.from(new Set(h.filter(Q=>/^-?\d+$/.test(Q)).map(Q=>Number.parseInt(Q,10))));return b?["*",...F]:F}async function rT(){const u=zn.value.trim(),h=nT(ui.value);if(!u){la.value=f("Telegram bot token is required.");return}if(h.length===0){la.value=f("At least one allowed Telegram user ID or * is required.");return}Ml.value=!0,la.value="";try{await u_(u,h),ui.value=h.map(b=>String(b)).join(`
|
|
95
|
+
`),await Promise.all([lp(),wd()]),window.alert(f("Telegram bot configured. Only allowlisted Telegram users can use the bridge."))}catch(b){la.value=b instanceof Error?b.message:f("Failed to connect Telegram bot"),wd()}finally{Ml.value=!1}}const Pu=S(""),oT=J(()=>Pu.value||ee.value);ot(ee,()=>{Pu.value=""});function aT(){return new Promise(u=>{let h=!1;const b=()=>{h||(h=!0,u())};requestAnimationFrame(()=>setTimeout(b,0)),setTimeout(b,80)})}let bd=0;function sT(u){if(!u)return;if(vt.name==="thread"&&da.value===u){bd+=1,Pu.value="";return}Pu.value=u;const h=bd+=1;aT().then(()=>{h===bd&&It.push({name:"thread",params:{threadId:u}})}),Pt.value&&Kt(!0)}function iT(u){vt.name==="automations"&&Ts.value!==u&&It.replace({name:"automations",query:u?{automationId:u}:{}})}async function lT(u){var h;Tt.value&&(Kt(!1),await Et()),(h=Jt.value)==null||h.openAutomationEditorFromPanel(u)}async function uT(){var u;Tt.value&&(Kt(!1),await Et()),(u=Jt.value)==null||u.openAutomationCreatorFromPanel()}function cT(){var u;vt.name==="automations"&&((u=In.value)==null||u.loadAutomations())}async function dT(u){u&&ee.value===u&&await Wp()}function fT(u){return u.length>8?u.slice(-8):u}function up(u){const h=[u.planType||f("unknown")];return u.authMode&&h.unshift(u.authMode),h.join(" · ")}function hT(u){if(!u)return!1;const h=u.toLowerCase();return h.includes("payment required")||/\b402\b/.test(h)}function Eu(u){return u.unavailableReason==="payment_required"||hT(u.quotaError)}function pT(u){return ra.value||Ao.value||oa.value||Un.value||Ra.value.length>0||u.isActive&&Ra.value!==u.storageId&&hd.value}function Td(u){return $r.value===u.storageId}function mT(u){return aa.value===u.storageId||Td(u)}function gT(u){return Eu(u)?f("Unavailable"):u.isActive?f("Active"):Ao.value?f("Switching…"):f("Switch")}function vT(u){return Ra.value===u.storageId?f("Removing…"):Td(u)?f("Click again to remove"):f("Remove")}function yT(u){aa.value=u}function wT(u){aa.value===u&&(aa.value=""),Ra.value!==u&&$r.value===u&&($r.value="")}function bT(u){const h=u.quotaSnapshot;if(!h)return null;const b=[h==null?void 0:h.primary,h==null?void 0:h.secondary].filter(he=>he!==null),F=b.find(he=>he.windowMinutes===7*24*60);if(F)return F;const Q=b.filter(he=>typeof he.windowMinutes=="number"&&he.windowMinutes>=7*24*60).sort((he,Fe)=>(he.windowMinutes??0)-(Fe.windowMinutes??0))[0]??null;return Q||(h.secondary??null)}function TT(u){if(typeof u!="number"||!Number.isFinite(u))return"";const h=new Date(u*1e3);return`${h.getMonth()+1}月${h.getDate()}日`}function cp(u){var he,Fe;if(Eu(u))return u.quotaError||f("402 Payment Required");const h=u.quotaSnapshot,b=bT(u),F=(h==null?void 0:h.primary)??(h==null?void 0:h.secondary)??null,Q=b??F;if(Q){const Rt=Math.max(0,Math.min(100,100-Math.round(Q.usedPercent))),kn=TT(Q.resetsAt);return kn?`${Rt}% ${f("weekly remaining")} · ${kn}`:`${Rt}% ${f("weekly remaining")}`}return(he=h==null?void 0:h.credits)!=null&&he.unlimited?f("Unlimited credits"):(Fe=h==null?void 0:h.credits)!=null&&Fe.hasCredits&&h.credits.balance?`${h.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 ST(u){return[u.email||f("Account"),up(u),Eu(u)?f("Unavailable account"):null,cp(u),`${f("Workspace")} ${u.accountId}`].filter(Boolean).join(`
|
|
96
|
+
`)}async function Ol(u={}){try{const h=await O_();er.value=h.accounts,h.accounts.some(b=>b.storageId===aa.value)||(aa.value=""),h.accounts.some(b=>b.storageId===$r.value)||($r.value="")}catch(h){if(u.silent===!0)return;wn.value=h instanceof Error?h.message:f("Failed to load accounts")}}async function kT(){if(!(ra.value||Ao.value||oa.value||Un.value)){wn.value="",aa.value="",$r.value="",ra.value=!0;try{const u=await Pg();er.value=u.accounts,co(),uo(),se({includeSelectedThreadMessages:!0})}catch(u){wn.value=u instanceof Error?u.message:f("Failed to refresh accounts")}finally{ra.value=!1}}}async function CT(u){if(!(Ao.value||ra.value||oa.value||Un.value)){if(hd.value){wn.value=f("Finish the current turn and pending requests before switching accounts.");return}wn.value="",aa.value="",$r.value="",Ao.value=!0;try{const h=await B_(u);er.value=er.value.map(b=>b.storageId===u?h:{...b,isActive:!1}),co(),uo(),se({includeSelectedThreadMessages:!0}),Ol({silent:!0})}catch(h){wn.value=h instanceof Error?h.message:f("Failed to switch account")}finally{Ao.value=!1}}}async function xT(){var u;if(!(ra.value||Ao.value||oa.value||Un.value)){wn.value="",Ma.value="",oa.value=!0;try{const h=await D_();ni.value=h,$i.value=!0,window.open(h,"_blank","noopener,noreferrer"),await Et(),(u=xu.value)==null||u.focus()}catch(h){wn.value=h instanceof Error?h.message:f("Failed to start Codex login")}finally{oa.value=!1}}}function Sd(){Un.value||($i.value=!1,Ma.value="")}async function IT(){const u=Ma.value.trim();u&&await AT(u)}async function AT(u){if(!(Un.value||u.length===0)){wn.value="",Un.value=!0;try{const h=await F_(u);er.value=h.accounts,ni.value="",Ma.value="",$i.value=!1,co(),uo(),se({includeSelectedThreadMessages:!0})}catch(h){wn.value=h instanceof Error?h.message:f("Failed to complete Codex login")}finally{Un.value=!1}}}async function _T(u){if(ra.value||Ao.value||oa.value||Un.value||Ra.value.length>0)return;const h=er.value.find(F=>F.storageId===u)??null;if(!h)return;if($r.value!==u){$r.value=u;return}if(h.isActive&&hd.value){wn.value=f("Finish the current turn and pending requests before removing the active account.");return}const b=h.isActive;wn.value="",$r.value="",Ra.value=u;try{const F=await U_(u);er.value=F.accounts,co(),uo(),b&&se({includeSelectedThreadMessages:!0}),Ol({silent:!0})}catch(F){wn.value=F instanceof Error?F.message:f("Failed to remove account")}finally{Ra.value=""}}function dp(u){ft(u)}function PT(u){se({includeSelectedThreadMessages:!1,forceThreadRefresh:!0})}async function fp(u){const h=await pe(u);h&&(Se.value?await It.replace({name:"thread",params:{threadId:h}}):await It.push({name:"thread",params:{threadId:h}}),Pt.value&&Kt(!0))}function hp(u){const h=u.trim().replace(/\\/gu,"/");return h?h.includes("/.codex/worktrees/")||h.includes("/.git/worktrees/"):!1}function Yi(u,h=""){var he,Fe,Rt;const b=V.value.find(kn=>kn.projectName===u);if(!b)return ep(u)||h.trim();const F=b.threads.find(kn=>!hp(kn.cwd));return(((he=F==null?void 0:F.cwd)==null?void 0:he.trim())??((Rt=(Fe=b.threads[0])==null?void 0:Fe.cwd)==null?void 0:Rt.trim())??"")||ep(u)||h.trim()}function ET(u){var F,Q;const h=V.value.find(he=>he.projectName===u),b=Yi(u,((Q=(F=h==null?void 0:h.threads[0])==null?void 0:F.cwd)==null?void 0:Q.trim())??"");b&&(yt.value=b),Pt.value&&Kt(!0),!Se.value&&It.push({name:"home"})}function MT(u){var b;let h="";for(const F of V.value){const Q=F.threads.find(he=>he.id===u);if((b=Q==null?void 0:Q.cwd)!=null&&b.trim()){h=Q.cwd.trim();break}}!h||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(h)}`,"_blank","noopener,noreferrer")}function Mu(u){var b,F;const h=V.value.find(Q=>Q.projectName===u);return Yi(u,((F=(b=h==null?void 0:h.threads[0])==null?void 0:b.cwd)==null?void 0:F.trim())??"")}const pp=J(()=>Object.fromEntries(V.value.map(u=>[u.projectName,Mu(u.projectName).trim()]).filter(([,u])=>u.length>0)));function RT(u){return(U.value[u]??u).trim()||u}function LT(u){return RT(u).replace(/[\\/]+/gu,"-").replace(/[\u0000-\u001f]+/gu,"").trim()||"worktree"}function jT(u){const h=Mu(u);!h||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(h)}`,"_blank","noopener,noreferrer")}async function NT(u){const h=Mu(u);await vp(h)}async function $T(u){const h=OT(u);await vp(h)}function OT(u){var h;for(const b of V.value){const F=b.threads.find(Q=>Q.id===u);if((h=F==null?void 0:F.cwd)!=null&&h.trim())return F.cwd.trim()}return""}function mp(u){if(!Number.isFinite(u)||u<=0)return"0 B";const h=["B","KB","MB","GB"];let b=u,F=0;for(;b>=1024&&F<h.length-1;)b/=1024,F+=1;return`${b>=10||F===0?b.toFixed(0):b.toFixed(1)} ${h[F]}`}function DT(u,h){const b=URL.createObjectURL(u),F=document.createElement("a");F.href=b,F.download=h,document.body.appendChild(F),F.click(),document.body.removeChild(F),window.setTimeout(()=>URL.revokeObjectURL(b),3e4)}async function FT(u,h){const F={files:[new File([u],h,{type:u.type||"application/zip"})],title:h};if(!(typeof navigator<"u"&&typeof navigator.share=="function"&&(typeof navigator.canShare!="function"||navigator.canShare(F))))throw new Error("File sharing is not supported in this browser.");await navigator.share(F)}function gp(){Oe.value.phase!=="exporting"&&(Oe.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""})}function BT(){const{blob:u,fileName:h}=Oe.value;!u||!h||(Oe.value={...Oe.value,error:""},DT(u,h))}async function UT(){const{blob:u,fileName:h}=Oe.value;if(!(!u||!h))try{Oe.value={...Oe.value,error:""},await FT(u,h)}catch(b){if(b instanceof DOMException&&b.name==="AbortError")return;const F=b instanceof Error?b.message:"",Q=b instanceof DOMException&&b.name==="NotAllowedError"||/permission denied|notallowed|not allowed|gesture/iu.test(F);Oe.value={...Oe.value,error:Q?f("This browser blocked sharing the ZIP. Use Download instead."):F||f("Failed to share project. Use Download instead.")}}}async function vp(u){if(!(!u||typeof document>"u")){Oe.value={phase:"exporting",loaded:0,total:null,blob:null,fileName:"",error:""};try{const{blob:h,fileName:b}=await tP(u,({loaded:F,total:Q})=>{Oe.value={...Oe.value,phase:"exporting",loaded:F,total:Q}});Oe.value={phase:"ready",loaded:h.size,total:h.size,blob:h,fileName:b,error:""}}catch(h){if(Oe.value={phase:"idle",loaded:0,total:null,blob:null,fileName:"",error:""},h instanceof DOMException&&h.name==="AbortError")return;const b=h instanceof Error?h.message:"Failed to export project.";window.alert(b)}}}async function zT(u){const h=Mu(u);if(!h||typeof window>"u"||(await Lu(h),_n.value[h]!==!0))return;const b=`${LT(u)}-`,F=window.prompt("New worktree folder name",b);if(F===null)return;const Q=F.trim();if(Q){if(Q.includes("/")||Q.includes("\\")||Q==="."||Q===".."){window.alert("Worktree name must be a single folder name.");return}try{const he=await q_(h,Q),Fe=await Ku(he.cwd,{createIfMissing:!1,label:""});if(!Fe)return;yt.value=Fe,An.value="local",lo(Nl(Fe)),await xs(),await Mo(),Pt.value&&Kt(!0),Se.value||await It.push({name:"home"})}catch(he){const Fe=he instanceof Error?he.message:"Failed to create worktree.";window.alert(Fe)}}}function HT(){var b,F,Q;const u=fe.value;if(!u)return"";const h=((b=u.projectName)==null?void 0:b.trim())??"";return h?Yi(h,((Q=u.cwd)==null?void 0:Q.trim())??""):((F=u.cwd)==null?void 0:F.trim())??""}function Ru(){const u=HT();u&&(yt.value=u),An.value="local",Pt.value&&Kt(!0),!Se.value&&It.push({name:"home"})}function WT(){yt.value="",An.value="local",Pt.value&&Kt(!0),!Se.value&&It.push({name:"home"})}async function Lu(u){const h=u.trim();if(!h||Object.prototype.hasOwnProperty.call(_n.value,h))return;const b=Xo.get(h);if(b){const he=await b;Object.prototype.hasOwnProperty.call(_n.value,h)||(_n.value={..._n.value,[h]:he});return}const F=K_(h).then(he=>he.isGitRepo).catch(()=>!1).finally(()=>{Xo.delete(h)});Xo.set(h,F);const Q=await F;Object.prototype.hasOwnProperty.call(_n.value,h)||(_n.value={..._n.value,[h]:Q})}function qT(u){Ir(u.projectName,u.displayName)}function GT(u){Ie(u.threadId,u.title)}async function VT(u){await Ta(u),await xs(),Mo()}function KT(u){Vo(u.projectName,u.toIndex)}function YT(u){var F,Q;const h=V.value.find(he=>he.projectName===u),b=Yi(u,((Q=(F=h==null?void 0:h.threads[0])==null?void 0:F.cwd)==null?void 0:Q.trim())??"");Lu(b)}function yp(u){JT(u)}async function JT(u){var F;const h=await ba(u),b=((F=u.followUpMessageText)==null?void 0:F.trim())??"";if(!(!h||!b||Se.value))try{await Qe(b,[],[],"steer",[])}catch{}}async function QT(u){const h=await qe(u.threadId,u.turnIndex);h&&(await It.push({name:"thread",params:{threadId:h}}),ee.value!==h&&await ze(h),Pt.value&&Kt(!0))}const ks=S(!1),wp=S(null),XT=J(()=>an()?"⌘/":"Ctrl+/"),ZT=J(()=>`${f("Command palette")} · ${XT.value}`);let kd=null;function e0(){const u=document.activeElement;kd=u instanceof HTMLElement?u:null}function bp(){const u=kd;kd=null,Et(()=>{var h;if(u!=null&&u.isConnected){u.focus();return}(h=wp.value)==null||h.focus()})}function Tp(){e0(),Ji.value=!1,ks.value=!0}function t0(){if(ks.value){ju();return}Tp()}const Ji=S(!1);function n0(){ks.value=!1,Ji.value=!0}function Sp(){Ji.value&&(Ji.value=!1,bp())}function ju(){ks.value&&(ks.value=!1,bp())}const r0=J(()=>{const u=!Se.value&&!bt.value&&!jn.value&&ee.value.trim().length>0,h=an()?"⌘":"Ctrl+";return QM.filter(b=>!(b.requiresThread&&!u||b.id==="thread.interrupt"&&!_u.value||b.id==="thread.implement-plan"&&!Iu.value||b.id==="thread.copy-last-code-block"&&!PF(Na.value)||b.group==="panel"&&!Ll.value)).map(b=>b.shortcut?{...b,shortcut:b.shortcut.replace("Mod+",h)}:b)});function o0(u){var b,F;ju();const h=ee.value.trim();switch(u){case"thread.new":Ru();break;case"thread.rename":h&&((F=Jt.value)==null||F.openRenameThreadDialog(h,((b=fe.value)==null?void 0:b.title)??""));break;case"thread.archive":h&&dp(h);break;case"thread.fork":h&&fp(h);break;case"thread.copy-markdown":Wp();break;case"thread.copy-last-code-block":U0();break;case"thread.compact":Zh();break;case"thread.interrupt":Bp();break;case"thread.implement-plan":Hp();break;case"panel.git":dn("git");break;case"panel.files":dn("files");break;case"panel.terminal":Jn();break;case"panel.toggle":Dn();break;case"panel.close":po();break;case"view.toggle-sidebar":Kt(!Tt.value);break;case"view.search-threads":Tt.value&&Kt(!1),go.value||Zo();break;case"view.cycle-theme":Vp();break;case"view.cycle-chat-width":Kp();break;case"view.toggle-language":k(v.value==="zh-CN"?"en":"zh-CN");break;case"view.send-with-enter":qp();break;case"view.in-progress-send-mode":Gp();break;case"view.shortcuts":n0();break;case"nav.skills":It.push({name:"skills"});break;case"nav.automations":It.push({name:"automations"});break;case"nav.recycle-bin":xp();break;case"nav.settings":nn.value||Mn();break}}function kp(u){if(u.defaultPrevented)return;if(u.key==="Escape"&&Ji.value){Sp();return}if(u.key==="Escape"&&ks.value){ju();return}if(u.key==="Escape"&&nn.value){nn.value=!1;return}if(!u.ctrlKey&&!u.metaKey||u.shiftKey||u.altKey)return;const h=u.key.toLowerCase();if(h==="/"){u.preventDefault(),t0();return}if(!ks.value){if(h==="b"){if(!(an()?u.metaKey&&!u.ctrlKey:u.ctrlKey&&!u.metaKey))return;u.preventDefault(),Kt(!Tt.value);return}if(h==="j"&&vt.name==="thread"&&ee.value){u.preventDefault(),Jn();return}h==="j"&&Se.value&&Sn.value&&(u.preventDefault(),Jn())}}async function a0(){try{const u=await AI();Er.value=u.available,!u.available&&Wt.value==="terminal"&&(Wt.value="git",Wr())}catch{Er.value=!1,Wt.value==="terminal"&&(Wt.value="git")}}function Cp(u){var b,F;const h=u.target;if(h instanceof Node){if(fo.value){const Q=h instanceof Element?h:h.parentElement;Q!=null&&Q.closest(".thread-terminal-panel")||Wr()}nn.value&&((b=os.value)!=null&&b.containsTarget(h)||(F=as.value)!=null&&F.contains(h)||(_a=Date.now(),nn.value=!1))}}function s0(u){var b,F;if(!nn.value)return;const h=u.target;h instanceof Node&&((b=os.value)!=null&&b.containsTarget(h)||(F=as.value)!=null&&F.contains(h)||(_a=Date.now(),nn.value=!1))}function xp(){var u;(u=Jt.value)==null||u.openRecycleBin()}function Ip(){if(!(typeof document>"u")){if(document.visibilityState==="hidden"){Ui.value=Date.now(),zi.value=!1;return}Cd()}}function Ap(u){u.persisted&&Cd()}function _p(){vt.name==="home"&&(xs(),Mo()),Cd()}function Cd(){typeof window>"u"||typeof document>"u"||hF(document.visibilityState,Ui.value,zi.value,Date.now())&&(zi.value=!0,Ui.value=null,i0())}async function i0(){if(!Hi.value){Hi.value=!0;try{await se({includeSelectedThreadMessages:!1}),await Nd()}finally{Hi.value=!1}}}function Pp(u){const h=u.text;Nu();const b=br.value,F=u.mode==="queue"&&b&&b.threadId===ee.value?b.queueIndex:void 0;if(br.value=null,Se.value){uS(h,u.imageUrls,u.skills,u.fileAttachments);return}Qe(h,u.imageUrls,u.skills,u.mode,u.fileAttachments,F)}function l0(u){const h=gn.value.findIndex(he=>he.id===u),b=h>=0?gn.value[h]:void 0,F=en.value;if(!b||!F||F.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;br.value=ee.value?{threadId:ee.value,queueIndex:h}:null;const Q={text:b.text,imageUrls:[...b.imageUrls],fileAttachments:b.fileAttachments.map(he=>({...he})),skills:b.skills.map(he=>({...he}))};F.hydrateDraft(Q),Wo(u)}function Nu(){if(!Pt.value||Se.value)return;const u=()=>{var h;(h=Tn.value)==null||h.jumpToLatest()};u(),Et(()=>{u(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{u(),window.requestAnimationFrame(u)})})}function u0(u){yt.value=u.trim(),Hn.value=""}function c0(u){x.value=u.trim()}function Cs(u){const h=Sn.value.trim();return!u||h!==u?!1:vt.name==="thread"||vt.name==="home"&&ci.value}function Ep(){yo+=1,wo+=1,pn+=1,bo+=1,Co.value=[],Yr.value=null,C.value=null,M.value=null,I.value=null,X.value=!1,Ze.value=!1,Ut.value={addedLineCount:0,removedLineCount:0},Nr.value=[],ln.value={},Jr.value="",ta.value="",xo.value={},na.value="",ji.value="",Zn.value="",Ni.value=!1}function Mp(u){const h=u.trim();if(!h){Ut.value={addedLineCount:0,removedLineCount:0};return}const b=++bo;fP(h,"unstaged").then(F=>{b!==bo||!Cs(h)||(Ut.value={addedLineCount:F.addedLineCount,removedLineCount:F.removedLineCount})}).catch(()=>{b!==bo||!Cs(h)||(Ut.value={addedLineCount:0,removedLineCount:0})})}async function Dl(u){var F,Q,he;const h=u.trim();if(!h){Ep();return}const b=++yo;Ni.value=!0,Zn.value="";try{const Fe=await V_(h);if(b!==yo||!Cs(h))return;Co.value=Fe.options,Yr.value=Fe.currentBranch,C.value=Fe.headSha,M.value=Fe.headSubject,I.value=Fe.headDate,X.value=Fe.detached,Ze.value=Fe.dirty,Nr.value=Fe.changedFiles,Mp(h);const Rt=((F=Fe.currentBranch)==null?void 0:F.trim())||((he=(Q=Fe.options[0])==null?void 0:Q.value)==null?void 0:he.trim())||"";Rt&&Rp({branch:Rt,includeResetHistory:!0})}catch{if(b!==yo||!Cs(h))return;Co.value=[],Yr.value=null,C.value=null,M.value=null,I.value=null,X.value=!1,Ze.value=!1,Ut.value={addedLineCount:0,removedLineCount:0},Nr.value=[]}finally{b===yo&&(Ni.value=!1)}}function d0(u){Yr.value=u.currentBranch,C.value=u.headSha,M.value=u.headSubject,I.value=u.headDate,X.value=u.detached,Ze.value=u.dirty,Nr.value=u.changedFiles,Mp(Sn.value)}function f0(u){if(Io.value)return;const h=u.trim();if(!h||h===(Yr.value??""))return;const b=Sn.value.trim();b&&(Io.value=!0,Zn.value="",Y_(b,h).then(F=>(Yr.value=F||h,C.value=null,M.value=null,I.value=null,X.value=!1,Fn.value=!1,Dl(b))).catch(F=>{const Q=F instanceof Error?F.message:"Failed to switch branch";Dl(b).finally(()=>{Zn.value=Q})}).finally(()=>{Io.value=!1}))}function h0(u){if(Io.value)return;const h=u.branch.trim(),b=u.sha.trim(),F=Sn.value.trim();!h||!b||!F||(Io.value=!0,Zn.value="",X_(F,h,b).then(Q=>(d0(Q),Fn.value=!1,Dl(F))).catch(Q=>{const he=Q instanceof Error?Q.message:"Failed to reset branch to commit";Dl(F).finally(()=>{Zn.value=he})}).finally(()=>{Io.value=!1}))}function Rp(u){const h=(typeof u=="string"?u:u.branch).trim(),b=typeof u=="string"?!0:u.includeResetHistory!==!1,F=Sn.value.trim(),Q=ad(h,b);if(!h||!F||Jr.value===Q||(ta.value="",ln.value[Q]))return;const he=++wo;Jr.value=Q,J_(F,h,{includeResetHistory:b}).then(Fe=>{he!==wo||!Cs(F)||(ln.value={...ln.value,[Q]:Fe})}).catch(Fe=>{he!==wo||!Cs(F)||(ta.value=Fe instanceof Error?Fe.message:"Failed to load branch commits")}).finally(()=>{he===wo&&Jr.value===Q&&(Jr.value="")})}function p0(u){const h=u.trim(),b=Sn.value.trim();if(!h||!b||na.value===h||(ji.value="",xo.value[h]))return;const F=++pn;na.value=h,Q_(b,h).then(Q=>{F!==pn||!Cs(b)||(xo.value={...xo.value,[h]:Q})}).catch(Q=>{F!==pn||!Cs(b)||(ji.value=Q instanceof Error?Q.message:"Failed to load commit files")}).finally(()=>{F===pn&&na.value===h&&(na.value="")})}function m0(u){const h=u.path.trim(),b=u.sha.trim();!h||!b||(sn.value=h,Bn.value=b,Fn.value=!0)}function g0(){sn.value="",Bn.value="",Fn.value=!Fn.value}function v0(){!sn.value&&!Bn.value||(sn.value="",Bn.value="",Fn.value=!1)}async function y0(){const u=await Ou();u&&(await Mo(),p.value=u,y.value=ea.value.trim()||"New Project (1)",A.value="",z.value="",cr.value="create",Bi.value=!0,Et(()=>{var h;return(h=G.value)==null?void 0:h.focus()}))}function $u(){q.value||(Bi.value=!1,z.value="")}let xd=!1,Id=!1;function w0(){xd=!0}function b0(){xd&&(xd=!1,Qi())}function T0(){Id=!0}function S0(){Id&&(Id=!1,$u())}async function k0(){const u=p.value.trim(),h=y.value.trim();if(!op.value)throw new Error("Enter a single project folder name.");const b=$p(Np(u,h));return b?Ku(b,{createIfMissing:!0,label:""}):""}async function C0(){const u=p.value.trim(),h=A.value.trim();return h?aP(h,u):""}async function Ad(){if(!(!ap.value||q.value)){z.value="",q.value=!0;try{const u=cr.value==="clone"?await C0():await k0();if(!u)return;yt.value=u,lo(Nl(u)),await xs(),await Mo(),Bi.value=!1}catch(u){z.value=u instanceof Error?u.message:"Failed to create or clone project."}finally{q.value=!1}}}function x0(){I0(ie.value)}function I0(u){R.value||!u||(u.value="",u.click())}async function A0(u,h,b){R.value=!0;try{const F=await Ou();if(!F)return;const Q=await h(F);if(!Q.path)return;yt.value=Q.path,lo(Nl(Q.path)),await xs(),await se({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Mo()}catch(F){const Q=F instanceof Error?F.message:b;window.alert(Q)}finally{R.value=!1,u&&(u.value="")}}async function _0(u){var F;const h=u.target instanceof HTMLInputElement?u.target:null,b=((F=h==null?void 0:h.files)==null?void 0:F[0])??null;!b||R.value||await A0(h,Q=>nP(b,Q),"Failed to import project.")}async function P0(){const u=yt.value.trim()||await Ou();u&&(ua.value=!1,ce.value=!0,dr.value="",await Is(u),st.value||Et(()=>{var h;return(h=ge.value)==null?void 0:h.focus()}))}function Qi(){bs+=1,ce.value=!1,ht.value=!1,st.value="",dr.value="",et.value="",Fl()}async function E0(u){!u||ht.value||(dr.value="",await Is(u))}function M0(){const u=wt.value.trim();!ce.value||!u||Is(u)}function R0(){const u=$l.value;!ce.value||!u||ht.value||Is(u)}function L0(){if(!ce.value||ht.value||Ln.value)return;const u=$l.value,h=wt.value.trim();!u||u===h||Is(u)}function j0(){const u=$l.value,h=wt.value.trim();if(u){if(u!==h){Is(u);return}_d(u)}}async function _d(u=$l.value){const h=nt(u).trim();if(h){st.value="",Ln.value=!0;try{const b=await Ku(h,{createIfMissing:!1,label:""});if(!b){st.value="Failed to open the selected folder.";return}yt.value=b,lo(Nl(b)),await xs(),await se({includeSelectedThreadMessages:!1,forceThreadRefresh:!0}),await Mo(),Qi()}catch(b){st.value=b instanceof Error?b.message:"Failed to open the selected folder."}finally{Ln.value=!1}}}async function N0(){if(Hn.value="",ua.value){Fl();return}if(!ce.value){const u=yt.value.trim()||await Ou();if(!u||(ce.value=!0,dr.value="",await Is(u),st.value))return}st.value||(ys.value=ea.value,ua.value=!0,Et(()=>{var u;return(u=Cu.value)==null?void 0:u.focus()}))}function Fl(){Hn.value="",ys.value="",ua.value=!1}async function Lp(){const u=ys.value.trim();if(!u)return;if(Hn.value="",st.value){Hn.value="Reload the current folder before creating a new one.";return}ja.value=!0;const h=np.value.trim(),b=$p(Np(h,u));if(!b){Hn.value="Unable to determine where the new folder should be created.",ja.value=!1;return}if(!rp.value){Hn.value="Enter a single folder name.",ja.value=!1;return}try{const F=await oP(b);if(!F){Hn.value="Failed to create the folder.";return}Hn.value="",dr.value="",await Is(F),Fl()}catch(F){Hn.value=F instanceof Error?F.message:"Failed to create folder."}finally{ja.value=!1}}async function $0(){var h;if(typeof window>"u")return!1;const u=((h=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:h.trim())??"";if(!u)return!1;try{const b=await Ku(u,{createIfMissing:!1,label:""});if(!b)return!1;yt.value=b,lo(Nl(b)),await It.replace({name:"home"}),await xs();const F=new URL(window.location.href);return F.searchParams.delete("openProjectPath"),window.history.replaceState({},"",F.toString()),!0}catch{return!1}}async function Ou(){const u=jp();if(u)return u;try{const h=await Eg();if(h)return ss.value=h,h}catch{}return""}async function Mo(){const u=jp();if(!u){ea.value="New Project (1)";return}try{const h=await iP(u);ea.value=h.name||"New Project (1)"}catch{ea.value="New Project (1)"}}function jp(){var b,F;const u=yt.value.trim();if(u)return hl(u);const h=((F=(b=gd.value[0])==null?void 0:b.value)==null?void 0:F.trim())??"";return h?hl(h):ss.value.trim()}async function O0(){try{ss.value=await Eg()}catch{ss.value=""}}async function xs(){try{const u=await sl();Le.value={order:[...u.order],labels:{...u.labels},projectOrder:[...u.projectOrder]}}catch{Le.value={order:[],labels:{},projectOrder:[]}}}async function Is(u){const h=++bs,b=nt(u).trim();et.value=b,wt.value=b,st.value="",ht.value=!0;try{const F=await rP(u,{showHidden:Po.value});if(h!==bs)return;et.value=F.path,wt.value=F.path,ut.value=F.parentPath,Dt.value=F.entries}catch(F){if(h!==bs)return;st.value=F instanceof Error?F.message:"Failed to load local folders.",ut.value=hl(wt.value),Dt.value=[],Fl()}finally{h===bs&&(ht.value=!1)}}function Np(u,h){const b=nt(u).trim(),F=nt(h).trim().replace(/^[\\/]+/u,"");if(!b||!F)return"";const Q=b.includes("\\")&&!b.includes("/")?"\\":"/";if(/^[a-zA-Z]:[\\/]?$/u.test(b))return`${b.slice(0,2)}${Q}${F}`;if(/^\/+$/u.test(b))return`/${F}`;const he=b.replace(/[\\/]+$/u,"");return he?`${he}${Q}${F}`:""}function $p(u){const h=nt(u).trim();if(!h)return"";const b=h.match(/^\\\\([^\\/]+)[\\/]+([^\\/]+)([\\/].*)?$/u);if(b){const[,Q,he,Fe=""]=b,Rt=Pd(Fe.split(/[\\/]+/u));return Rt.length>0?`\\\\${Q}\\${he}\\${Rt.join("\\")}`:`\\\\${Q}\\${he}`}const F=h.match(/^([a-zA-Z]:)([\\/].*)?$/u);if(F){const[,Q,he=""]=F,Fe=h.includes("\\")&&!h.includes("/")?"\\":"/",Rt=Pd(he.split(/[\\/]+/u));return Rt.length>0?`${Q}${Fe}${Rt.join(Fe)}`:`${Q}${Fe}`}if(h.startsWith("/")){const Q=Pd(h.split("/"));return Q.length>0?`/${Q.join("/")}`:"/"}return h}function Pd(u){const h=[];for(const b of u){const F=b.trim();if(!(!F||F===".")){if(F===".."){h.length>0&&h.pop();continue}h.push(F)}}return h}function D0(u){yr(u.draggedId,u.targetId)}function Op(u){const h=Ss.value,b=wa(h);io(h,u),b&&b!==u&&(Ur(h,b,u),qo(h))}function Dp(u){Go(u)}function Fp(u){Gs(u)}function Bp(){jt()}const Bl=S("");let Ed=null;ot(Ho,u=>{var h;u&&(u.text&&((h=en.value)==null||h.hydrateDraft({text:u.text,imageUrls:u.imageUrls,fileAttachments:u.fileAttachments,skills:u.skills})),Bl.value=u.text?f("Stopped: message not submitted, restored to input."):f("Stopped: message not submitted."),Ed&&clearTimeout(Ed),Ed=setTimeout(()=>{Bl.value=""},6e3),Kn(Ss.value))});function Up(u){var b,F;const h=ee.value.trim();switch(u){case"compact":h&&_t(h);break;case"review":if(!h)return;sn.value="",Bn.value="",Fn.value=!0;break;case"rename":h&&((F=Jt.value)==null||F.openRenameThreadDialog(h,((b=fe.value)==null?void 0:b.title)??""));break;case"archive":h&&ft(h);break;case"fork":h&&pe(h);break;case"new":Ru();break;case"skills":bt.value||It.push({name:"skills"});break}}function F0(u){const h=u.turnId.trim();if(h.length>0){const b=[...Na.value].reverse().find(F=>{var Q;return zs(F)&&(((Q=F.turnId)==null?void 0:Q.trim())??"")===h&&F.text.trim().length>0});b!=null&&b.text&&en.value&&en.value.appendTextToDraft(b.text)}Sa(u.turnId)}const Du=S(!1),Md=S("");function Ul(u){Md.value=u;const h=ee.value;h&&Vs(h,u)}function zp(u,h){return new Promise((b,F)=>{const Q=setTimeout(()=>F(new Error(h)),pU);u.then(he=>{clearTimeout(Q),b(he)},he=>{clearTimeout(Q),F(he)})})}async function B0(u){const h=u.turnId.trim(),b=u.text.trim();if(!ee.value||!h||b.length===0||Du.value)return;Du.value=!0,Md.value="";const Q=f("Edit failed: the edit did not finish in time. Try again in a moment.");try{const he=await zp(Sa(h),Q);if(he==="already-busy"){Ul(f("Edit failed: another rollback is still running. Try again in a moment."));return}if(he==="no-thread"||he==="no-turn"||he==="no-persisted"){Ul(f("Edit failed: this message can no longer be located in the thread. Reopen the thread and try again."));return}if(he==="failed"){Ul(ue.value.trim().length>0?ue.value:f("Edit failed: the original message could not be rolled back. Try again."));return}if(Na.value.some(Rt=>{var Bu;if((((Bu=Rt.turnId)==null?void 0:Bu.trim())??"")!==h||Rt.role!=="user"&&Rt.role!=="assistant")return!1;const kn=Yp(Rt.messageType,Rt.role);return kn!=="worked"&&kn!=="turnActivity.live"&&kn!=="turnError.live"&&kn!=="agentReasoning.live"})){Ul(f("Edit failed: the original message is still in the thread after rolling back. Try again."));return}await zp(Qe(b,[],[],"steer",[],void 0,void 0,"edit_user_message"),Q)}catch(he){const Fe=he instanceof Error?he.message:String(he);Ul(Fe.trim().length>0?Fe:ue.value)}finally{Du.value=!1}}function Hp(){Se.value||!ee.value||(Iu.value&&(fd.value=Iu.value.id),ts("default"),Nu(),Qe("Implement",[],[],"steer",[],void 0,"default"))}async function Wp(){if(Se.value||bt.value||jn.value||!fe.value||Na.value.length===0)return;const u=z0();try{await bv(u)}catch{}}async function U0(){const u=EF(Na.value);if(u)try{await bv(u.value)}catch{}}function z0(){var b,F,Q;const u=[],h=((F=(b=fe.value)==null?void 0:b.title)==null?void 0:F.trim())||"Untitled thread";u.push(`# ${H0(h)}`),u.push(""),u.push(`- Exported: ${new Date().toISOString()}`),u.push(`- Thread ID: ${((Q=fe.value)==null?void 0:Q.id)??""}`),u.push(""),u.push("---"),u.push("");for(const he of Na.value){const Fe=he.role?he.role.toUpperCase():"MESSAGE";u.push(`## ${Fe}`),u.push("");const Rt=he.text.trim();if(Rt&&(u.push(Rt),u.push("")),he.commandExecution&&(u.push("```text"),u.push(`command: ${he.commandExecution.command}`),u.push(`status: ${he.commandExecution.status}`),he.commandExecution.cwd&&u.push(`cwd: ${he.commandExecution.cwd}`),he.commandExecution.exitCode!==null&&u.push(`exitCode: ${he.commandExecution.exitCode}`),u.push(he.commandExecution.aggregatedOutput||"(no output)"),u.push("```"),u.push("")),he.fileAttachments&&he.fileAttachments.length>0){u.push("Attachments:");for(const kn of he.fileAttachments)u.push(`- ${kn.path}`);u.push("")}if(he.images&&he.images.length>0){u.push("Images:");for(const kn of he.images)u.push(`- ${kn}`);u.push("")}}return`${u.join(`
|
|
97
|
+
`).trimEnd()}
|
|
98
|
+
`}function H0(u){return u.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Rd(u,h){if(typeof window>"u")return h;const b=window.localStorage.getItem(u);return b===null?h:b==="1"}function W0(){if(typeof window>"u")return"system";const u=window.localStorage.getItem(Mv);return u==="light"||u==="dark"?u:"system"}function q0(){if(typeof window>"u")return"steer";const u=window.localStorage.getItem(Ev);return u==="steer"||u==="queue"?u:"queue"}function G0(){if(typeof window>"u")return"standard";const u=window.localStorage.getItem(Nv);return u==="standard"||u==="wide"||u==="extra-wide"?u:"standard"}function qp(){hs.value=!hs.value,window.localStorage.setItem(Pv,hs.value?"1":"0")}function Gp(){ps.value=ps.value==="steer"?"queue":"steer",window.localStorage.setItem(Ev,ps.value)}function Vp(){const u=["system","light","dark"],h=u.indexOf(La.value);La.value=u[(h+1)%u.length],window.localStorage.setItem(Mv,La.value),Fu()}function Kp(){const u=["standard","wide","extra-wide"],h=u.indexOf(ri.value);ri.value=u[(h+1)%u.length],window.localStorage.setItem(Nv,ri.value)}function V0(){ms.value=!ms.value,window.localStorage.setItem(Rv,ms.value?"1":"0")}function K0(){gs.value=!gs.value,window.localStorage.setItem(Lv,gs.value?"1":"0")}async function Y0(u){if(!ia.value){ia.value=!0;try{if(u==="codex"){Sr.value="codex";const h=await bg(!1);sa.value=h.enabled}else if(u==="openrouter"){Sr.value="openrouter";const h=await bg(!0);sa.value=h.enabled,await el("","",{wireApi:Dr.value,provider:"openrouter"})}else u==="opencode-zen"?(Sr.value="opencode-zen",await el("",Fi.value.trim(),{wireApi:"responses",provider:"opencode-zen"}),sa.value=!0):u==="custom"&&(Sr.value="custom",vs.value.trim()&&ii.value.trim()&&(await el(vs.value.trim(),ii.value.trim(),{wireApi:_o.value}),sa.value=!0));Or.value="",await se({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(h){Or.value=h instanceof Error?h.message:"Failed to switch provider"}finally{ia.value=!1}}}async function J0(){if(Rn.value)return;const u=vs.value.trim();if(u){Rn.value=!0;try{Or.value="",await el(u,ii.value.trim(),{wireApi:_o.value}),sa.value=!0;const h=await wg();h.provider==="custom"&&!h.currentModel&&(Or.value=f("Failed to resolve model from custom endpoint; check the URL and try again")),await se({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(h){Or.value=h instanceof Error?h.message:"Failed to save custom endpoint"}finally{Rn.value=!1}}}async function Q0(u){if(Rn.value||ia.value||Dr.value===u)return;const h=Dr.value;Dr.value=u,Rn.value=!0;try{Or.value="",await el("","",{wireApi:u,provider:"openrouter"}),sa.value=!0,await se({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(b){Dr.value=h,Or.value=b instanceof Error?b.message:"Failed to save OpenRouter API format"}finally{Rn.value=!1}}async function X0(){if(Rn.value)return;const u=Fi.value.trim();if(u){Rn.value=!0;try{Or.value="",await el("",u,{wireApi:"responses",provider:"opencode-zen"}),sa.value=!0,await se({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0})}catch(h){Or.value=h instanceof Error?h.message:"Failed to save OpenCode Zen config"}finally{Rn.value=!1}}}async function Z0(){if(!Rn.value){Rn.value=!0;try{const u=si.value.trim();await Tg(u),si.value="",await Ld(),await se({includeSelectedThreadMessages:!1})}catch{}finally{Rn.value=!1}}}async function eS(){if(!Rn.value){Rn.value=!0;try{await Tg(""),si.value="",await Ld(),await se({includeSelectedThreadMessages:!1})}catch{}finally{Rn.value=!1}}}async function Ld(){try{const u=Sr.value,h=await wg();sa.value=h.enabled,Di.value=h.customKey??!1,El.value=h.maskedKey??null,h.enabled?h.provider==="opencode-zen"?Sr.value="opencode-zen":h.provider==="custom"?(Sr.value="custom",vs.value=h.customBaseUrl??"",_o.value=h.wireApi==="chat"?"chat":"responses"):(Sr.value="openrouter",Dr.value=h.wireApi==="chat"?"chat":"responses"):Sr.value="codex",Gi=h.hasCodexAuth===!0,Gi||(Vi=!1);const b=Sr.value!==u;b&&await se({includeSelectedThreadMessages:!1,providerChanged:!0,awaitAncillaryRefreshes:!0});const F=await ip();F&&await se({includeSelectedThreadMessages:!1,providerChanged:b||F,awaitAncillaryRefreshes:!0})}catch{}}function tS(u){const b=jd(u.trim())||"auto";oi.value=b,window.localStorage.setItem(jv,b)}function nS(u){ya(Number(u))}const rS=[{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 oS(){var b;if(typeof window>"u")return"auto";const u=((b=window.localStorage.getItem(jv))==null?void 0:b.trim())||"auto";return jd(u)||"auto"}function aS(){const u=[{value:"auto",label:f("Auto-detect")}],h=new Set(["auto"]);function b(Q){const he=W[Q]||Q;return`${he.charAt(0).toUpperCase()+he.slice(1)} (${Q})`}for(const Q of typeof navigator<"u"?navigator.languages??[]:[]){const he=jd(Q);!he||h.has(he)||(h.add(he),u.push({value:he,label:`${f("Preferred")}: ${b(he)}`}))}for(const Q of Object.keys(W))h.has(Q)||(h.add(Q),u.push({value:Q,label:b(Q)}));const F=oi.value.trim();return F&&!h.has(F)&&u.push({value:F,label:b(F)}),u}function jd(u){const h=u.trim().toLowerCase();if(!h||h==="auto")return"";if(h in W)return h;const b=h.split("-")[0]??h;return b in W?b:""}function Fu(){const u=document.documentElement;if(La.value==="dark")u.classList.add("dark");else if(La.value==="light")u.classList.remove("dark");else{const h=window.matchMedia("(prefers-color-scheme: dark)").matches;u.classList.toggle("dark",h)}sS()}function sS(){const u=document.querySelector('meta[name="theme-color"]');if(!u)return;const h=window.getComputedStyle(document.documentElement).getPropertyValue("--s0").trim();h&&u.setAttribute("content",h)}const iS=J(()=>({activeSettingsGroup:Ei.value,accounts:er.value,isAccountsSectionCollapsed:Pn.value,isRefreshingAccounts:ra.value,isSwitchingAccounts:Ao.value,isStartingCodexLogin:oa.value,isCompletingCodexLogin:Un.value,accountActionError:wn.value,codexLoginUrl:ni.value,feedbackMailto:ar,isAccountUnavailable:Eu,isRemoveConfirmationActive:Td,isRemoveVisible:mT,buildAccountTitle:ST,formatAccountMeta:up,formatAccountQuota:cp,shortAccountId:fT,isAccountActionDisabled:pT,getAccountSwitchLabel:gT,getAccountRemoveLabel:vT,onRefreshAccounts:kT,onStartCodexLogin:xT,onSwitchAccount:CT,onRemoveAccount:_T,onAccountCardPointerEnter:yT,onAccountCardPointerLeave:wT,toggleAccountsSectionCollapsed:Al,prepareFeedbackLink:Mt,sendWithEnter:hs.value,inProgressSendMode:ps.value,darkMode:La.value,uiLanguage:v.value,uiLanguageOptions:T,chatWidthLabel:Jb.value,dictationClickToToggle:ms.value,dictationAutoSend:gs.value,dictationLanguage:oi.value,dictationLanguageOptions:sd.value,autoCompactThreshold:qs.value,autoCompactThresholdOptions:rS,hasVisibleFeedbackError:Rl.value,selectedProvider:Sr.value,providerDropdownOptions:ld.value,freeModeLoading:ia.value,providerError:Or.value,freeModeHasCustomKey:Di.value,freeModeCustomKey:si.value,freeModeCustomKeyMasked:El.value,freeModeCustomKeySaving:Rn.value,openRouterWireApi:Dr.value,opencodeZenKey:Fi.value,customEndpointUrl:vs.value,customEndpointKey:ii.value,customEndpointWireApi:_o.value,isTelegramConfigOpen:li.value,telegramStatusText:Xb.value,telegramBotTokenDraft:zn.value,telegramAllowedUserIdsDraft:ui.value,telegramConfigError:la.value,isTelegramSaving:Ml.value,supportsHooks:_l.value,isHooksLoading:Ae.value,hooksList:Me.value,supportsRemoteControl:ls.value,remoteControlStatus:mn.value,isRemoteControlActionInFlight:Xn.value,remoteControlError:lr.value,remoteControlNotice:us.value,isRemoteControlLoading:Bt.value,remoteControlActionName:Lr.value,pairingCode:rn.value,accountRateLimitSnapshots:Je.value,worktreeName:N,appVersion:_,onClose:()=>{nn.value=!1},onActiveSettingsGroupChange:u=>{Ei.value=u},toggleSendWithEnter:qp,cycleInProgressSendMode:Gp,cycleDarkMode:Vp,onUiLanguageChange:k,cycleChatWidth:Kp,toggleDictationClickToToggle:V0,toggleDictationAutoSend:K0,onDictationLanguageChange:tS,onAutoCompactThresholdChange:nS,onProviderChange:Y0,onFreeModeCustomKeyChange:u=>{si.value=u},clearFreeModeCustomKey:eS,saveFreeModeCustomKey:Z0,setOpenRouterWireApi:Q0,onOpencodeZenKeyChange:u=>{Fi.value=u},saveOpencodeZen:X0,onCustomEndpointUrlChange:u=>{vs.value=u},onCustomEndpointKeyChange:u=>{ii.value=u},saveCustomEndpoint:J0,onCustomEndpointWireApiChange:u=>{_o.value=u},onTelegramConfigOpenChange:u=>{li.value=u},onTelegramBotTokenDraftChange:u=>{zn.value=u},onTelegramAllowedUserIdsDraftChange:u=>{ui.value=u},saveTelegramConfig:rT,refreshHooks:Ne,toggleRemoteControl:ti,startRemotePairing:Ea,refreshRemoteClients:fs,revokeRemoteClient:Pl}));function Yp(u,h){const b=(u??"").trim();return b.length>0?b:h.trim()||"message"}function Jp(u){ts(u)}async function lS(){await It.isReady(),vt.name==="thread"&&da.value?Ko(da.value):(vt.name==="home"||vt.name==="skills"||vt.name==="automations")&&Ko("",{persist:!1}),await se({includeSelectedThreadMessages:vt.name==="thread"}),Ol({silent:!0}),await $0(),mo.value=!0,await Nd(),uo()}async function Nd(){if(Qo.value){Rr=!0;return}Qo.value=!0;try{do{if(Rr=!1,vt.name==="home"||vt.name==="skills"||vt.name==="automations"){ee.value!==""&&await ze("");continue}if(vt.name==="thread"){const u=da.value;if(!u)continue;if(ee.value!==u){if(await ze(u)==="not-found")continue}else $e(u,{silent:!0}).catch(()=>{})}}while(Rr)}finally{Qo.value=!1}}ot(()=>[vt.name,da.value,de.value,ee.value],async()=>{mo.value&&await Nd()}),ot(()=>[ee.value,Sn.value],()=>{v0()}),ot(()=>[vt.name,Sn.value],([u,h])=>{u==="thread"&&Lu(h)},{immediate:!0}),ot(()=>ee.value,async u=>{if(mo.value&&!Qo.value&&!(Se.value||bt.value||jn.value)){if(!u){vt.name!=="home"&&await It.replace({name:"home"});return}vt.name==="thread"&&da.value===u||await It.replace({name:"thread",params:{threadId:u}})}}),ot(()=>gd.value,u=>{if(u.length===0){yt.value="",Mo();return}const h=yt.value.trim();h&&(u.some(F=>F.value===h)||(yt.value="")),Mo()},{immediate:!0}),ot(()=>yt.value,()=>{At.value={phase:"idle",title:"",message:""},Mo()}),ot(()=>[vt.name,yt.value],([u,h])=>{u==="home"&&Lu(h)},{immediate:!0}),ot(ci,u=>{!u&&An.value==="worktree"&&(An.value="local")},{immediate:!0}),ot(()=>[An.value,yt.value],([u,h])=>{u!=="worktree"||!ci.value||Qp(h)},{immediate:!0}),ot(()=>An.value,u=>{var h;if(u==="local"){At.value={phase:"idle",title:"",message:""};const b=yt.value.trim();if(b&&hp(b)){const F=((h=fe.value)==null?void 0:h.projectName)??Fr(b),Q=Yi(F,"");Q&&(yt.value=Q)}return}ci.value&&Qp(yt.value)}),ot(()=>vt.name,u=>{u!=="home"&&(At.value={phase:"idle",title:"",message:""}),u!=="thread"&&(Fn.value=!1)}),ot(()=>ee.value,()=>{At.value={phase:"idle",title:"",message:""}}),ot(()=>[vt.name,Sn.value,ci.value],([u,h,b])=>{if(!(u==="thread"||u==="home"&&b)){Ep();return}wo+=1,ln.value={},Jr.value="",ta.value="",Dl(h)},{immediate:!0}),ot(jb,u=>{typeof document>"u"||(document.title=u)},{immediate:!0}),ot(Pt,u=>{u&&!Tt.value&&Kt(!0)},{immediate:!0});async function uS(u,h=[],b=[],F=[]){try{At.value={phase:"idle",title:"",message:""};let Q=yt.value;if(An.value==="worktree"){At.value={phase:"running",title:f("Creating worktree"),message:f("Creating a worktree and running setup.")};try{const Fe=await W_(yt.value,x.value);Q=Fe.cwd,yt.value=Fe.cwd,At.value={phase:"idle",title:"",message:""}}catch{At.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 Fe=await sP(u);Q=Fe.cwd,yt.value=Fe.cwd}const he=await xt(u,Q,h,b,F);if(!he)return;await It.replace({name:"thread",params:{threadId:he}}),Nu()}catch{}}function cS(u){var F;if((F=u.prompt)!=null&&F.trim())return u.prompt.trim();const h=u.displayName.trim()||u.name.trim(),b=u.kind==="skill"?"skill":u.kind==="plugin"?"plugin":u.kind==="composio"?"Composio connector":"app";return`Test ${h} ${b}. Give me a list of what it can do and one useful example.`}function dS(u){return`${u.kind}:${u.name}:${u.skillPath??""}`}async function fS(u){var Q;if(qr.value)return;qr.value=dS(u);const h=cS(u),b=(Q=u.attachedSkills)!=null&&Q.length?u.attachedSkills:u.kind==="skill"&&u.skillPath?[{name:u.name,path:u.skillPath}]:[],F=NF(b,xe.value);try{const he=Jh.value.trim()||Sn.value.trim(),Fe=await xt(h,he,[],F,[]);if(!Fe)return;await It.replace({name:"thread",params:{threadId:Fe}}),Nu()}catch{}finally{qr.value=""}}async function Qp(u){var b;const h=u.trim();if(!h){$.value=[],x.value="";return}Z.value=!0;try{const F=await G_(h);$.value=F;const Q=x.value.trim();if(!(Q.length>0&&F.some(Fe=>Fe.value===Q))){const Fe=F.find(Rt=>Rt.value.trim()==="main");x.value=(Fe==null?void 0:Fe.value)??((b=F[0])==null?void 0:b.value)??""}}catch{$.value=[],x.value=""}finally{Z.value=!1}}return(u,h)=>(P(),D(at,null,[Be(lI,{"is-sidebar-collapsed":g(Tt),onCloseSidebar:h[37]||(h[37]=b=>g(Kt)(!0))},{sidebar:pt(()=>[w("section",$F,[w("div",{ref_key:"sidebarScrollableRef",ref:Ys,class:"sidebar-scrollable",onScroll:h[7]||(h[7]=(...b)=>g(vo)&&g(vo)(...b))},[g(Tt)?me("",!0):(P(),tt(ev,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":g(Tt),"show-new-thread-button":!0,onToggleSidebar:h[1]||(h[1]=b=>g(Kt)(!g(Tt))),onStartNewThread:Ru},{default:pt(()=>[w("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":g(go),"aria-label":g(f)("Search threads"),title:g(f)("Search threads"),onClick:h[0]||(h[0]=(...b)=>g(Zo)&&g(Zo)(...b))},[Be(ic,{class:"sidebar-search-toggle-icon"})],8,OF)]),_:1},8,["is-sidebar-collapsed"])),!g(Tt)&&g(go)?(P(),D("div",DF,[Be(ic,{class:"sidebar-search-bar-icon"}),xn(w("input",{ref_key:"sidebarSearchInputRef",ref:Pi,"onUpdate:modelValue":h[2]||(h[2]=b=>$n(En)?En.value=b:null),class:"sidebar-search-input",type:"text",placeholder:g(f)("Filter threads..."),onKeydown:h[3]||(h[3]=(...b)=>g(Qn)&&g(Qn)(...b))},null,40,FF),[[Nn,g(En)]]),g(En).length>0?(P(),D("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":g(f)("Clear search"),onClick:h[4]||(h[4]=(...b)=>g(Js)&&g(Js)(...b))},[Be(Ic,{class:"sidebar-search-clear-icon"})],8,BF)):me("",!0)])):me("",!0),g(Tt)?me("",!0):(P(),D("button",{key:2,class:ct(["sidebar-skills-link",{"is-active":bt.value}]),type:"button",onClick:h[5]||(h[5]=b=>{g(It).push({name:"skills"}),g(Pt)&&g(Kt)(!0)})},[w("span",UF,[Be(nv)]),w("span",zF,[w("span",HF,O(g(f)("Skills")),1),w("span",WF,O(g(f)("Plugins, apps, MCPs")),1)])],2)),g(Tt)?me("",!0):(P(),D("button",{key:3,class:ct(["sidebar-skills-link",{"is-active":jn.value}]),type:"button",onClick:h[6]||(h[6]=b=>{g(It).push({name:"automations"}),g(Pt)&&g(Kt)(!0)})},[w("span",qF,[Be(tv)]),w("span",GF,[w("span",VF,O(g(f)("Automations")),1),w("span",KF,O(g(f)("Scheduled work")),1)])],2)),g(Tt)?me("",!0):(P(),tt(BM,{key:4,ref_key:"sidebarThreadTreeRef",ref:Jt,groups:g(V),"project-display-name-by-id":g(U),"project-git-repo-by-name":qb.value,"project-cwd-by-name":pp.value,"selected-thread-id":oT.value,"is-loading":g(de),"is-thread-list-fully-loaded":g(B),"search-query":g(En),"search-matched-thread-ids":hn.value,onSelect:sT,onArchive:dp,onStartNewThread:ET,onRenameProject:qT,onBrowseThreadFiles:MT,onSaveThreadProject:$T,onBrowseProjectFiles:jT,onSaveProject:NT,onRequestProjectGitStatus:YT,onCreateProjectWorktree:zT,onRenameThread:GT,onForkThread:fp,onRemoveProject:VT,onReorderProject:KT,onCopyThreadChat:dT,onAutomationsChanged:cT,onRestoreThread:PT,onStartNewChat:WT},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),g(Tt)?me("",!0):(P(),D("div",{key:0,ref_key:"settingsAreaRef",ref:rs,class:"sidebar-settings-area",onClick:s0},[nn.value?(P(),tt(g(s),Ah({key:0,ref_key:"settingsDialogRef",ref:os},iS.value),null,16)):me("",!0),w("div",YF,[w("button",{ref_key:"settingsButtonRef",ref:as,class:"sidebar-settings-icon-button",type:"button",title:g(f)("Settings"),"aria-label":g(f)("Settings"),onClick:gt(Mn,["stop"])},[Be(WN,{class:"sidebar-settings-icon"})],8,JF),w("button",{ref:"recycleBinButtonRef",class:"sidebar-settings-icon-button",type:"button",title:g(f)("Recycle bin"),"aria-label":g(f)("Recycle bin"),onClick:gt(xp,["stop"])},[Be(Fw,{class:"sidebar-settings-icon"})],8,QF)])],512))])]),content:pt(()=>[w("div",XF,[w("section",{class:ct(["content-root",{"is-virtual-keyboard-open":Ub.value}]),style:Zr(Qb.value)},[jl.value?(P(),D("span",ZF)):me("",!0),Be(qM,{title:cd.value,accent:bt.value||jn.value},{leading:pt(()=>[g(Tt)||g(Pt)?(P(),tt(ev,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":g(Tt),"show-new-thread-button":!0,onToggleSidebar:h[8]||(h[8]=b=>g(Kt)(!g(Tt))),onStartNewThread:Ru},null,8,["is-sidebar-collapsed"])):me("",!0),bt.value?(P(),D("span",eB,[Be(nv)])):jn.value?(P(),D("span",tB,[Be(tv)])):me("",!0)]),actions:pt(()=>[w("button",{ref_key:"commandPaletteButtonRef",ref:wp,class:"content-header-command-button",type:"button","aria-label":g(f)("Command palette"),title:ZT.value,onClick:Tp},[Be(ic,{class:"content-header-command-button-icon"})],8,nB),Ll.value?(P(),D("button",{key:0,class:"content-header-right-panel-toggle",type:"button","aria-label":g(Pt)?g(Qt)?g(f)("Close side panel"):g(f)("Open side panel"):g(yn)?g(f)("Open side panel"):g(f)("Close side panel"),title:g(Pt)?g(Qt)?g(f)("Close side panel"):g(f)("Open side panel"):g(yn)?g(f)("Open side panel"):g(f)("Close side panel"),onClick:h[9]||(h[9]=(...b)=>g(Dn)&&g(Dn)(...b))},[Be(Uw,{class:"content-header-right-panel-toggle-icon"})],8,rB)):me("",!0)]),_:1},8,["title","accent"]),w("section",oB,[bt.value?(P(),tt(g(o),{key:0,ref_key:"directoryHubRef",ref:Ar,cwd:Jh.value,"thread-id":da.value,"try-in-flight-key":qr.value,onSkillsChanged:Zb,onTryItem:fS},null,8,["cwd","thread-id","try-in-flight-key"])):jn.value?(P(),tt(g(a),{key:1,ref_key:"automationsPanelRef",ref:In,groups:g(V),"project-cwd-by-name":pp.value,"project-display-name-by-id":g(U),"selected-automation-id":Ts.value,onSelectAutomation:iT,onEditAutomation:lT,onCreateAutomation:uT},null,8,["groups","project-cwd-by-name","project-display-name-by-id","selected-automation-id"])):Se.value?(P(),D("div",aB,[w("div",sB,[w("p",iB,O(g(f)("Let's build")),1),Be(xi,{class:"new-thread-folder-dropdown","model-value":yt.value,options:gd.value,placeholder:g(f)("Choose folder"),"enable-search":!0,"search-placeholder":g(f)("Quick search project"),disabled:!1,"onUpdate:modelValue":u0},null,8,["model-value","options","placeholder","search-placeholder"]),yt.value?(P(),D("p",{key:0,class:"new-thread-folder-selected",title:yt.value},O(g(f)("Selected folder"))+": "+O(yt.value),9,lB)):me("",!0),w("div",uB,[w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",onClick:P0},O(g(f)("Select folder")),1),w("button",{class:"new-thread-folder-action",type:"button",onClick:y0},O(g(f)("Create Project")),1),w("button",{class:"new-thread-folder-action",type:"button",disabled:R.value,onClick:x0},O(R.value?g(f)("Importing…"):g(f)("Import Project")),9,cB),w("input",{ref_key:"projectImportInputRef",ref:ie,class:"new-thread-project-import-input",type:"file",accept:".zip,application/zip",tabindex:"-1","aria-hidden":"true",onChange:_0},null,544)]),Oi.value?(P(),D("section",dB,[w("div",fB,[w("div",hB,[w("span",pB,[Be(td)]),w("p",mB,O(g(f)("New in Codex")),1)]),w("h2",gB,O(g(f)("Plugins are here")),1),w("p",vB,O(g(f)("Hook Codex up to Gmail, Calendar, GitHub, Slack, Browser Use, and more so it can actually help with real work right away.")),1),h[42]||(h[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",yB,[w("button",{class:"new-thread-launch-card-button new-thread-launch-card-button-primary",type:"button",onClick:Hb},O(g(f)("Explore Plugins & Apps")),1),w("button",{class:"new-thread-launch-card-button",type:"button",onClick:Xh},O(g(f)("Dismiss")),1)])])):me("",!0),(P(),tt(Bs,{to:"body"},[ce.value?(P(),D("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:gt(w0,["self"]),onMouseup:b0},[w("div",{class:"new-thread-open-folder",role:"dialog","aria-modal":"true","aria-label":g(f)("Select folder"),onKeydown:Cr(gt(Qi,["prevent"]),["esc"])},[w("div",bB,[w("p",TB,O(g(f)("Select folder")),1),w("button",{class:"new-thread-open-folder-close",type:"button",onClick:Qi},O(g(f)("Cancel")),1)]),w("p",SB,O(g(f)("Current folder")),1),w("div",kB,[xn(w("input",{ref_key:"existingFolderPathInputRef",ref:ge,"onUpdate:modelValue":h[10]||(h[10]=b=>et.value=b),class:"new-thread-open-folder-path",type:"text",placeholder:g(f)("Current folder"),title:et.value||g(f)("Unavailable"),disabled:ht.value||Ln.value,onBlur:L0,onKeydown:[Cr(gt(j0,["prevent"]),["enter"]),Cr(gt(Qi,["prevent"]),["esc"])]},null,40,CB),[[Nn,et.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!$l.value||ht.value||Ln.value,onClick:h[11]||(h[11]=b=>_d())},O(Ln.value?g(f)("Opening…"):g(f)("Open")),9,xB)]),w("div",IB,[w("label",AB,[xn(w("input",{"onUpdate:modelValue":h[12]||(h[12]=b=>Po.value=b),class:"new-thread-open-folder-toggle-input",type:"checkbox",onChange:M0},null,544),[[$C,Po.value]]),w("span",null,O(g(f)("Show hidden folders")),1)]),w("button",{class:ct(["new-thread-folder-action",{"new-thread-folder-action-primary":ua.value}]),type:"button","aria-pressed":ua.value,disabled:!wt.value||ht.value||Ln.value||ja.value||!!st.value&&!ua.value,onClick:N0},O(g(f)("New folder")),11,_B)]),ua.value?(P(),D("div",PB,[w("div",EB,[xn(w("input",{ref_key:"createFolderInputRef",ref:Cu,"onUpdate:modelValue":h[13]||(h[13]=b=>ys.value=b),class:"new-thread-open-folder-create-input",type:"text",placeholder:g(f)("Folder name"),onKeydown:[Cr(gt(Lp,["prevent"]),["enter"]),Cr(gt(Fl,["prevent"]),["esc"])]},null,40,MB),[[Nn,ys.value]]),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary new-thread-open-folder-create-submit",type:"button",disabled:!Gb.value||ja.value,onClick:Lp},O(Vb.value),9,RB)]),Hn.value?(P(),D("div",LB,[w("span",null,O(Hn.value),1),w("a",{class:"visible-error-feedback",href:g(ar),onClick:h[14]||(h[14]=b=>Mt(b,Hn.value))},O(g(f)("Send feedback")),9,jB)])):me("",!0)])):me("",!0),xn(w("input",{ref_key:"existingFolderFilterInputRef",ref:He,"onUpdate:modelValue":h[15]||(h[15]=b=>dr.value=b),class:"new-thread-open-folder-filter",type:"text",placeholder:g(f)("Filter folders..."),onKeydown:Cr(gt(Qi,["prevent"]),["esc"])},null,40,NB),[[Nn,dr.value]]),st.value?(P(),D("div",$B,[w("div",OB,[w("span",null,O(st.value),1),w("a",{class:"visible-error-feedback",href:g(ar),onClick:h[16]||(h[16]=b=>Mt(b,st.value))},O(g(f)("Send feedback")),9,DB)]),w("button",{class:"new-thread-folder-action",type:"button",disabled:ht.value||Ln.value,onClick:R0},O(g(f)("Retry")),9,FB)])):me("",!0),ht.value?(P(),D("p",BB,O(g(f)("Loading folders…")),1)):!st.value&&yd.value.length===0?(P(),D("p",UB,O(dr.value.trim()?g(f)("No folders match this filter."):g(f)("No subfolders found here.")),1)):yd.value.length>0?(P(),D("ul",zB,[(P(!0),D(at,null,Ht(yd.value,b=>(P(),D("li",{key:b.key,class:"new-thread-open-folder-item"},[w("button",{class:"new-thread-open-folder-item-main",type:"button",title:b.path,disabled:ht.value||Ln.value,onClick:F=>E0(b.path)},[w("span",WB,O(b.name),1)],8,HB),b.kind==="directory"?(P(),D("button",{key:0,class:"new-thread-open-folder-item-open",type:"button",disabled:ht.value||Ln.value,onClick:F=>_d(b.path)},O(g(f)("Open")),9,qB)):me("",!0)]))),128))])):me("",!0)],40,wB)],32)):me("",!0)])),(P(),tt(Bs,{to:"body"},[Bi.value?(P(),D("div",{key:0,class:"new-thread-open-folder-overlay",onMousedown:gt(T0,["self"]),onMouseup:S0},[w("div",{class:"new-thread-project-modal",role:"dialog","aria-modal":"true","aria-label":g(f)("Create or clone project"),onKeydown:Cr(gt($u,["prevent"]),["esc"])},[w("div",VB,[w("p",KB,O(g(f)("Create or clone project")),1),w("button",{class:"new-thread-open-folder-close",type:"button",disabled:q.value,onClick:$u},O(g(f)("Cancel")),9,YB)]),w("div",{class:"new-thread-project-mode-tabs",role:"tablist","aria-label":g(f)("Project source")},[w("button",{class:ct(["new-thread-project-mode-tab",{"is-active":cr.value==="create"}]),type:"button",role:"tab","aria-selected":cr.value==="create",disabled:q.value,onClick:h[17]||(h[17]=b=>cr.value="create")},O(g(f)("New project")),11,QB),w("button",{class:ct(["new-thread-project-mode-tab",{"is-active":cr.value==="clone"}]),type:"button",role:"tab","aria-selected":cr.value==="clone",disabled:q.value,onClick:h[18]||(h[18]=b=>cr.value="clone")},O(g(f)("Clone from GitHub")),11,XB)],8,JB),w("label",ZB,[w("span",e2,O(g(f)("Destination folder")),1),xn(w("input",{"onUpdate:modelValue":h[19]||(h[19]=b=>p.value=b),class:"new-thread-open-folder-path",type:"text",disabled:q.value,placeholder:g(f)("Destination folder")},null,8,t2),[[Nn,p.value]])]),cr.value==="create"?(P(),D("label",n2,[w("span",r2,O(g(f)("Project name")),1),xn(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:G,"onUpdate:modelValue":h[20]||(h[20]=b=>y.value=b),class:"new-thread-open-folder-create-input",type:"text",disabled:q.value,placeholder:g(f)("Project name"),onKeydown:Cr(gt(Ad,["prevent"]),["enter"])},null,40,o2),[[Nn,y.value]])])):cr.value==="clone"?(P(),D("label",a2,[w("span",s2,O(g(f)("GitHub repository URL")),1),xn(w("input",{ref_key:"projectSetupPrimaryInputRef",ref:G,"onUpdate:modelValue":h[21]||(h[21]=b=>A.value=b),class:"new-thread-open-folder-create-input",type:"url",disabled:q.value,placeholder:"https://github.com/owner/repo",onKeydown:Cr(gt(Ad,["prevent"]),["enter"])},null,40,i2),[[Nn,A.value]])])):me("",!0),z.value?(P(),D("div",l2,[w("span",null,O(z.value),1),w("a",{class:"visible-error-feedback",href:g(ar),onClick:h[22]||(h[22]=b=>Mt(b,z.value))},O(g(f)("Send feedback")),9,u2)])):me("",!0),w("div",c2,[w("button",{class:"new-thread-folder-action",type:"button",disabled:q.value,onClick:$u},O(g(f)("Cancel")),9,d2),w("button",{class:"new-thread-folder-action new-thread-folder-action-primary",type:"button",disabled:!ap.value||q.value,onClick:Ad},O(Kb.value),9,f2)])],40,GB)],32)):me("",!0)])),ci.value?(P(),tt(kN,{key:2,class:"new-thread-runtime-dropdown",modelValue:An.value,"onUpdate:modelValue":h[23]||(h[23]=b=>An.value=b)},null,8,["modelValue"])):me("",!0),An.value==="worktree"?(P(),D("div",h2,[w("p",p2,O(g(f)("Base branch")),1),Be(xi,{class:"new-thread-branch-dropdown","model-value":x.value,options:vd.value,placeholder:g(f)("Select branch"),"enable-search":!0,"search-placeholder":g(f)("Search branches..."),disabled:Z.value||vd.value.length===0,"onUpdate:modelValue":c0},null,8,["model-value","options","placeholder","search-placeholder","disabled"]),w("p",m2,O(Z.value?g(f)("Loading branches…"):tp.value?g(f)("New worktree branch will start from {branch}.",{branch:tp.value}):g(f)("No Git branches found for this folder.")),1)])):me("",!0),ci.value?(P(),D("p",g2,O(g(f)("Local project uses the selected folder directly. New worktree creates an isolated Git worktree before the first prompt.")),1)):me("",!0),At.value.phase!=="idle"?(P(),D("div",{key:5,class:ct(["worktree-init-status",{"is-running":At.value.phase==="running","is-error":At.value.phase==="error"}])},[w("strong",v2,O(At.value.title),1),w("span",y2,O(At.value.message),1)],2)):me("",!0)]),w("div",w2,[g(_e)?(P(),D("div",b2,[w("span",null,O(g(f)(g(_e))),1),w("a",{class:"visible-error-feedback",href:g(ar),onClick:h[24]||(h[24]=b=>Mt(b,g(_e)))},O(g(f)("Send feedback")),9,T2)])):me("",!0),Be(Qg,{ref_key:"homeThreadComposerRef",ref:Ca,"active-thread-id":Ss.value,cwd:Sn.value,"fuzzy-file-search-results":g(dt),onRegisterFuzzySession:g(Y),"collaboration-modes":g(Ce),"selected-collaboration-mode":g(Ee),models:g(De),"model-reasoning-efforts":g(Ue),"selected-model":Yh.value,"selected-reasoning-effort":g(be),"selected-speed-mode":g(Te),"is-updating-speed-mode":g(H),skills:g(xe),"thread-token-usage":g(K),"codex-quota":g(ke),"is-turn-in-progress":!1,"is-stop-pending":!1,"is-interrupting-turn":!1,"send-with-enter":hs.value,"in-progress-submit-mode":ps.value,"dictation-click-to-toggle":ms.value,"dictation-auto-send":gs.value,"dictation-language":oi.value,onSubmit:Pp,"onUpdate:selectedCollaborationMode":Jp,"onUpdate:selectedModel":Op,"onUpdate:selectedReasoningEffort":Dp,"onUpdate:selectedSpeedMode":Fp,"approval-policy":Tr.value,"is-approval-policy-saving":Vr.value,"approval-policy-error":ur.value,"approval-policy-notice":Pa.value,"onUpdate:approvalPolicy":ds,onSaveApprovalPolicy:Kr,onSlashCommand:Up},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"])])])):(P(),D("div",S2,[Fn.value&&g(ee)&&Sn.value?(P(),tt(g(r),{key:0,"thread-id":g(ee),cwd:Sn.value,"is-thread-in-progress":_u.value,"initial-file-path":sn.value,"commit-sha":Bn.value,onClose:h[25]||(h[25]=b=>Fn.value=!1)},null,8,["thread-id","cwd","is-thread-in-progress","initial-file-path","commit-sha"])):me("",!0),w("div",k2,[Be(g(t),{ref_key:"threadConversationRef",ref:Tn,messages:Nb.value,"is-loading":g(ne),"is-slow-open":g(ae)!==null&&g(ae)===Ss.value,"active-thread-id":Ss.value,cwd:Sn.value,"live-overlay":Db.value,"live-turn-id":g(te),"pending-requests":g(oe),"has-more-persisted-above":g(rt),"is-loading-persisted-above":g(je),"load-earlier-messages":g(Ke),"edit-saving":Du.value,"edit-failure":Md.value,onForkThread:QT,onRollback:F0,onEditMessage:B0,onFileChangesChanged:eT,onRespondServerRequest:yp},null,8,["messages","is-loading","is-slow-open","active-thread-id","cwd","live-overlay","live-turn-id","pending-requests","has-more-persisted-above","is-loading-persisted-above","load-earlier-messages","edit-saving","edit-failure"])]),w("div",{class:"composer-with-queue",ref_key:"composerQueueRef",ref:zr},[Qh.value?(P(),D("div",C2,O(g(f)("This thread is running in the Codex TUI")),1)):me("",!0),g(_e)?(P(),D("div",x2,[w("span",null,O(g(f)(g(_e))),1),w("a",{class:"visible-error-feedback",href:g(ar),onClick:h[26]||(h[26]=b=>Mt(b,g(_e)))},O(g(f)("Send feedback")),9,I2)])):me("",!0),Be(g(m),{messages:g(gn),onEdit:l0,onSteer:g(so),onDelete:g(Wo),onReorder:D0},null,8,["messages","onSteer","onDelete"]),Bl.value?(P(),D("div",A2,[w("span",null,O(Bl.value),1),w("button",{type:"button",class:"interrupt-recovered-dismiss","aria-label":g(f)("Dismiss"),onClick:h[27]||(h[27]=b=>Bl.value="")}," × ",8,_2)])):me("",!0),Au.value?(P(),tt(g(d),{key:3,request:Au.value,"request-count":g(oe).length,"has-queue-above":g(gn).length>0,"panel-width":Hr.value,"visual-viewport-height":jl.value?ca.value:0,"panel-error":Fb.value,onRespondServerRequest:yp},null,8,["request","request-count","has-queue-above","panel-width","visual-viewport-height","panel-error"])):(P(),tt(Qg,{key:4,ref_key:"threadComposerRef",ref:en,"active-thread-id":Ss.value,cwd:Sn.value,"fuzzy-file-search-results":g(dt),onRegisterFuzzySession:g(Y),"collaboration-modes":g(Ce),"selected-collaboration-mode":g(Ee),models:g(De),"model-reasoning-efforts":g(Ue),"selected-model":Yh.value,"selected-reasoning-effort":g(be),"selected-speed-mode":g(Te),"is-updating-speed-mode":g(H),skills:g(xe),"thread-token-usage":g(K),"codex-quota":g(ke),"is-turn-in-progress":_u.value,"is-stop-pending":g(L),"is-interrupting-turn":g(E),"is-compacting":zb.value,"external-session-active":Qh.value,"has-queue-above":g(gn).length>0,"send-with-enter":hs.value,"in-progress-submit-mode":ps.value,"dictation-click-to-toggle":ms.value,"dictation-auto-send":gs.value,"dictation-language":oi.value,"onUpdate:selectedCollaborationMode":Jp,onSubmit:Pp,"onUpdate:selectedModel":Op,"onUpdate:selectedReasoningEffort":Dp,"onUpdate:selectedSpeedMode":Fp,"approval-policy":Tr.value,"is-approval-policy-saving":Vr.value,"approval-policy-error":ur.value,"approval-policy-notice":Pa.value,"onUpdate:approvalPolicy":ds,onSaveApprovalPolicy:Kr,"plan-panel":Iu.value,onInterrupt:Bp,onSlashCommand:Up,onImplementPlan:Hp,onCompactContext:Zh},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)]))])],6),g(Pt)&&g(Qt)?(P(),D("div",{key:0,class:"content-right-panel-backdrop",role:"presentation",onClick:h[28]||(h[28]=(...b)=>g(po)&&g(po)(...b))})):me("",!0),Ll.value&&(g(Pt)||!g(yn))?(P(),D("aside",{key:1,class:ct(["content-right-panel",{"is-mobile-open":g(Qt)}]),style:Zr({"--right-panel-width":`${g(On)}px`})},[g(Pt)?me("",!0):(P(),D("div",{key:0,class:"content-right-panel-resize-handle","aria-hidden":"true",onMousedown:h[29]||(h[29]=(...b)=>g(Jo)&&g(Jo)(...b))},null,32)),w("div",P2,[w("div",E2,[w("button",{class:ct(["content-right-panel-tab",{"is-active":g(Wt)==="git"}]),type:"button",role:"tab","aria-selected":g(Wt)==="git",onClick:h[30]||(h[30]=b=>g(dn)("git"))},[Be(Ac,{class:"content-right-panel-tab-icon"}),Ns(" "+O(g(f)("Git")),1)],10,M2),w("button",{class:ct(["content-right-panel-tab",{"is-active":g(Wt)==="files"}]),type:"button",role:"tab","aria-selected":g(Wt)==="files",onClick:h[31]||(h[31]=b=>g(dn)("files"))},[Be(rv,{class:"content-right-panel-tab-icon"}),Ns(" "+O(g(f)("Files")),1)],10,R2),(P(!0),D(at,null,Ht(g(xa),b=>(P(),D("button",{key:b.key,class:ct(["content-right-panel-tab content-right-panel-tab--preview",{"is-active":g(Wt)==="preview"&&g(Ia)===b.key}]),type:"button",role:"tab","aria-selected":g(Wt)==="preview"&&g(Ia)===b.key,title:b.path,onClick:F=>g(Vt)(b.key)},[Be(Cl,{class:"content-right-panel-tab-icon"}),w("span",j2,O(b.label),1),w("span",{class:"content-right-panel-tab-close",role:"button","aria-label":g(f)("Close"),title:g(f)("Close"),onClick:gt(F=>g(Ft)(b.key),["stop"])},"×",8,N2)],10,L2))),128))]),w("div",$2,[w("div",O2,[w("button",{ref:"rightPanelAddButtonRef",class:"content-right-panel-add",type:"button","aria-label":g(f)("Add panel"),title:g(f)("Add panel"),onClick:h[32]||(h[32]=gt(b=>Mr.value=!g(Mr),["stop"]))},"+",8,D2),Be(ku,{name:"right-panel-menu"},{default:pt(()=>[g(Mr)?(P(),D("div",F2,[w("button",{type:"button",onClick:h[33]||(h[33]=b=>g(dn)("terminal"))},[Be(KN,{class:"content-right-panel-menu-icon"}),Ns(" "+O(g(f)("Terminal panel")),1)]),w("button",{type:"button",onClick:h[34]||(h[34]=b=>g(dn)("git"))},[Be(Ac,{class:"content-right-panel-menu-icon"}),Ns(" "+O(g(f)("Git panel")),1)]),w("button",{type:"button",onClick:h[35]||(h[35]=b=>g(dn)("files"))},[Be(rv,{class:"content-right-panel-menu-icon"}),Ns(" "+O(g(f)("Files panel")),1)])])):me("",!0)]),_:1})]),w("button",{class:"content-right-panel-close",type:"button","aria-label":g(f)("Close panel"),title:g(f)("Close panel"),onClick:h[36]||(h[36]=(...b)=>g(po)&&g(po)(...b))},[Be(Ic,{class:"content-right-panel-close-icon"})],8,B2)])]),w("div",U2,[g(Wt)==="git"?(P(),tt(g(i),{key:0,"current-branch":Yr.value,"head-sha":C.value,"head-subject":M.value,"head-date":I.value,detached:X.value,dirty:Ze.value,"worktree-change-summary":Ut.value,"worktree-changes":Nr.value,branches:Co.value,"commits-by-branch":ln.value,"commits-loading-for":Jr.value,"commits-error":ta.value,"commit-files-by-sha":xo.value,"commit-files-loading-for":na.value,"commit-files-error":ji.value,loading:Ni.value,busy:Io.value,error:Zn.value,"review-open":Fn.value,"show-review":g(vt).name==="thread"&&g(ee).length>0,onToggleReview:g0,onCheckoutBranch:f0,onResetBranchToCommit:h0,onLoadCommits:Rp,onLoadCommitFiles:p0,onOpenCommitFile:m0},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"])):g(Wt)==="files"?(P(),tt(g(l),{key:1,cwd:Sn.value,onOpenPreview:g(ho)},null,8,["cwd","onOpenPreview"])):g(Wt)==="preview"&&g(sr)?(P(),tt(g(c),{key:2,"file-path":g(sr).path,name:g(sr).label},null,8,["file-path","name"])):(P(),tt(g(n),{key:3,ref_key:"threadTerminalPanelRef",ref:Yo,"thread-id":Ss.value,cwd:Sn.value,onHide:g(Ks),onTerminalFocusChange:g(ir)},null,8,["thread-id","cwd","onHide","onTerminalFocusChange"]))])],6)):me("",!0)])]),_:1},8,["is-sidebar-collapsed"]),ks.value?(P(),tt(dR,{key:0,commands:r0.value,onClose:ju,onRun:o0},null,8,["commands"])):me("",!0),Ji.value?(P(),tt(MR,{key:1,"is-mac":an(),onClose:Sp},null,8,["is-mac"])):me("",!0),Oe.value.phase!=="idle"?(P(),D("div",z2,[w("div",{class:"project-zip-modal",role:"dialog","aria-modal":"true","aria-label":g(f)("Export Project"),onClick:h[38]||(h[38]=gt(()=>{},["stop"]))},[w("div",W2,[w("h2",q2,O(g(f)("Export Project")),1),w("button",{class:"project-zip-modal-close",type:"button","aria-label":g(f)("Close"),disabled:Oe.value.phase==="exporting",onClick:gp}," × ",8,G2)]),w("p",V2,O(Oe.value.phase==="exporting"?g(f)("Preparing project ZIP..."):Oe.value.fileName),1),w("div",K2,[w("span",null,O(Oe.value.phase==="exporting"?g(f)("Exporting"):g(f)("Ready")),1),w("span",null,O(ai.value),1)]),w("div",Y2,[w("div",{class:"project-zip-progress-fill",style:Zr({width:id.value})},null,4)]),Oe.value.error?(P(),D("p",J2,O(Oe.value.error),1)):me("",!0),w("div",Q2,[w("button",{class:"project-zip-modal-cancel",type:"button",disabled:Oe.value.phase==="exporting",onClick:gp},O(g(f)("Close")),9,X2),w("button",{class:"project-zip-modal-action",type:"button",disabled:!Oe.value.blob,onClick:BT},O(g(f)("Download")),9,Z2),w("button",{class:"project-zip-modal-action project-zip-modal-action-primary",type:"button",disabled:!Oe.value.blob,onClick:UT},O(g(f)("Share")),9,eU)])],8,H2)])):me("",!0),$i.value?(P(),D("div",{key:3,class:"codex-login-modal-backdrop",role:"presentation",onClick:Sd},[w("form",{class:"codex-login-modal",role:"dialog","aria-modal":"true","aria-label":g(f)("Complete Codex login"),onSubmit:gt(IT,["prevent"]),onClick:h[41]||(h[41]=gt(()=>{},["stop"]))},[w("div",nU,[w("h2",rU,O(g(f)("Complete Codex login")),1),w("button",{class:"codex-login-modal-close",type:"button","aria-label":g(f)("Close"),disabled:Un.value,onClick:Sd}," × ",8,oU)]),w("p",aU,O(g(f)("Finish login in the browser, then paste the localhost callback URL here.")),1),ni.value?(P(),D("a",{key:0,class:"codex-login-modal-link",href:ni.value,target:"_blank",rel:"noreferrer"},O(g(f)("Open login URL")),9,sU)):me("",!0),xn(w("input",{ref_key:"codexLoginCallbackInputRef",ref:xu,"onUpdate:modelValue":h[39]||(h[39]=b=>Ma.value=b),class:"codex-login-modal-input",type:"url",inputmode:"url",placeholder:g(f)("Paste localhost callback URL"),disabled:Un.value},null,8,iU),[[Nn,Ma.value]]),wn.value?(P(),D("div",lU,[w("span",null,O(wn.value),1),w("a",{class:"visible-error-feedback",href:g(ar),onClick:h[40]||(h[40]=b=>Mt(b,wn.value))},O(g(f)("Send feedback")),9,uU)])):me("",!0),w("div",cU,[w("button",{class:"codex-login-modal-cancel",type:"button",disabled:Un.value,onClick:Sd},O(g(f)("Cancel")),9,dU),w("button",{class:"codex-login-modal-submit",type:"submit",disabled:Un.value||Ma.value.trim().length===0},O(Un.value?g(f)("Completing…"):g(f)("Complete")),9,fU)])],40,tU)])):me("",!0)],64))}}),gU=kt(mU,[["__scopeId","data-v-637ef082"]]),rc={render:()=>null},vU=eI({history:Rx(),routes:[{path:"/",name:"home",component:rc},{path:"/thread/:threadId",name:"thread",component:rc},{path:"/skills",name:"skills",component:rc},{path:"/automations",name:"automations",component:rc},{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");JP();HC(gU).use(vU).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error(Rw("Service worker registration failed."),e)})});export{Sh as $,ot as A,Zr as B,$w as C,Ac as D,xr as E,at as F,Ds as G,Yu as H,Ic as I,C$ as J,xU as K,AF as L,Nc as M,pz as N,Lo as O,fz as P,hz as Q,Rh as R,s$ as S,Bs as T,Et as U,es as V,xn as W,Cr as X,Nn as Y,yU as Z,kt as _,Lc as a,YU as a$,OR as a0,uz as a1,cz as a2,a$ as a3,lz as a4,ez as a5,nz as a6,oz as a7,tz as a8,iz as a9,_U as aA,DU as aB,HU as aC,WU as aD,jU as aE,zU as aF,EU as aG,PU as aH,MU as aI,RU as aJ,qU as aK,VU as aL,KU as aM,NU as aN,$U as aO,OU as aP,FU as aQ,UU as aR,BU as aS,GU as aT,mI as aU,gI as aV,td as aW,YR as aX,wU as aY,Cl as aZ,$C as a_,rz as aa,az as ab,sz as ac,zs as ad,Hh as ae,hP as af,a_ as ag,SU as ah,bU as ai,kU as aj,TU as ak,CU as al,xi as am,QU as an,ZU as ao,XU as ap,zh as aq,nI as ar,tI as as,Zg as at,Xg as au,mz as av,YA as aw,LU as ax,IU as ay,AU as az,S as b,JU as b0,J as c,bv as d,dF as e,ov as f,_h as g,cn as h,P as i,tt as j,D as k,w as l,ct as m,nc as n,Ws as o,me as p,Ht as q,dz as r,Ns as s,O as t,g as u,Be as v,gt as w,ku as x,pt as y,ao as z};
|